fix: thread accountId through subagent announce
Co-authored-by: Adam Holt <adam91holt@users.noreply.github.com>
This commit is contained in:
@@ -48,13 +48,19 @@ export async function deliverAgentCommandResult(params: {
|
||||
|
||||
const targetMode: ChannelOutboundTargetMode =
|
||||
opts.deliveryTargetMode ?? (opts.to ? "explicit" : "implicit");
|
||||
const resolvedAccountId =
|
||||
typeof opts.accountId === "string" && opts.accountId.trim()
|
||||
? opts.accountId.trim()
|
||||
: targetMode === "implicit"
|
||||
? sessionEntry?.lastAccountId
|
||||
: undefined;
|
||||
const resolvedTarget =
|
||||
deliver && isDeliveryChannelKnown && deliveryChannel
|
||||
? resolveOutboundTarget({
|
||||
channel: deliveryChannel,
|
||||
to: opts.to,
|
||||
cfg,
|
||||
accountId: targetMode === "implicit" ? sessionEntry?.lastAccountId : undefined,
|
||||
accountId: resolvedAccountId,
|
||||
mode: targetMode,
|
||||
})
|
||||
: null;
|
||||
@@ -112,6 +118,7 @@ export async function deliverAgentCommandResult(params: {
|
||||
cfg,
|
||||
channel: deliveryChannel,
|
||||
to: deliveryTarget,
|
||||
accountId: resolvedAccountId,
|
||||
payloads: deliveryPayloads,
|
||||
bestEffort: bestEffortDeliver,
|
||||
onError: (err) => logDeliveryError(err),
|
||||
|
||||
@@ -23,6 +23,8 @@ export type AgentCommandOpts = {
|
||||
/** Message channel context (webchat|voicewake|whatsapp|...). */
|
||||
messageChannel?: string;
|
||||
channel?: string; // delivery channel (whatsapp|telegram|...)
|
||||
/** Account ID for multi-account channel routing (e.g., WhatsApp account). */
|
||||
accountId?: string;
|
||||
deliveryTargetMode?: ChannelOutboundTargetMode;
|
||||
bestEffortDeliver?: boolean;
|
||||
abortSignal?: AbortSignal;
|
||||
|
||||
Reference in New Issue
Block a user