fix: thread accountId through subagent announce

Co-authored-by: Adam Holt <adam91holt@users.noreply.github.com>
This commit is contained in:
Peter Steinberger
2026-01-17 02:09:32 +00:00
parent 4ba6f6e8ee
commit d5332ae29a
9 changed files with 37 additions and 3 deletions

View File

@@ -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),

View File

@@ -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;