File tree Expand file tree Collapse file tree 1 file changed +18
-1
lines changed
Expand file tree Collapse file tree 1 file changed +18
-1
lines changed Original file line number Diff line number Diff line change @@ -845,13 +845,30 @@ function resolveFeishuSession(
845845 accountId : params . accountId ,
846846 peer,
847847 } ) ;
848+
849+ // Normalize the session "to" field so that downstream tooling (including the
850+ // message tool in isolated/cron runs) sees the same Feishu target shapes as
851+ // the main session:
852+ // - DM/user targets -> user:ou_xxx
853+ // - Chat/group targets -> chat:oc_xxx
854+ // This keeps DeliveryContext.To aligned with the Feishu plugin's
855+ // normalizeFeishuTarget/looksLikeFeishuId helpers and avoids
856+ // Unknown target "user" for Feishu / missing-target errors when the
857+ // message tool infers its default target from the session route.
858+ const to =
859+ isGroup || idLower . startsWith ( "oc_" )
860+ ? `chat:${ trimmed } `
861+ : idLower . startsWith ( "ou_" ) || idLower . startsWith ( "on_" )
862+ ? `user:${ trimmed } `
863+ : trimmed ;
864+
848865 return {
849866 sessionKey : baseSessionKey ,
850867 baseSessionKey,
851868 peer,
852869 chatType : isGroup ? "group" : "direct" ,
853870 from : isGroup ? `feishu:group:${ trimmed } ` : `feishu:${ trimmed } ` ,
854- to : trimmed ,
871+ to,
855872 } ;
856873}
857874
You can’t perform that action at this time.
0 commit comments