fix: propagate agent run context for subagent announce

This commit is contained in:
Peter Steinberger
2026-01-19 00:45:03 +00:00
parent 953472bf25
commit 989543c9c3
8 changed files with 157 additions and 3 deletions

View File

@@ -0,0 +1,18 @@
import { normalizeAccountId } from "../../utils/account-id.js";
import { resolveMessageChannel } from "../../utils/message-channel.js";
import type { AgentCommandOpts, AgentRunContext } from "./types.js";
export function resolveAgentRunContext(opts: AgentCommandOpts): AgentRunContext {
const merged: AgentRunContext = opts.runContext ? { ...opts.runContext } : {};
const normalizedChannel = resolveMessageChannel(
merged.messageChannel ?? opts.messageChannel,
opts.replyChannel ?? opts.channel,
);
if (normalizedChannel) merged.messageChannel = normalizedChannel;
const normalizedAccountId = normalizeAccountId(merged.accountId ?? opts.accountId);
if (normalizedAccountId) merged.accountId = normalizedAccountId;
return merged;
}