




















@@ -13,6 +13,7 @@ import {
1313normalizeLowercaseStringOrEmpty,
1414normalizeOptionalLowercaseString,
1515} from "../shared/string-coerce.js";
16+import { listDeliverableMessageChannels } from "../utils/message-channel.js";
1617import type { ActiveProcessSessionReference } from "./bash-process-references.js";
1718import type { BootstrapMode } from "./bootstrap-mode.js";
1819import {
@@ -461,6 +462,7 @@ function buildMessagingSection(params: {
461462availableTools: Set<string>;
462463inlineButtonsEnabled: boolean;
463464runtimeChannel?: string;
465+messageChannelOptions?: string;
464466messageToolHints?: string[];
465467sourceReplyDeliveryMode?: SourceReplyDeliveryMode;
466468}) {
@@ -499,7 +501,9 @@ function buildMessagingSection(params: {
499501messageToolOnly
500502 ? "- For `action=send`, include `message`. The target defaults to the current source channel; include `target` only when sending somewhere else."
501503 : "- For `action=send`, include `target` and `message`.",
502-"- Pass `channel` only when sending outside the current/default source channel.",
504+params.messageChannelOptions
505+ ? `- No current/default source channel: include \`channel\` for proactive sends; valid ids: ${params.messageChannelOptions}.`
506+ : "- Pass `channel` only when sending outside the current/default source channel.",
503507messageToolOnly
504508 ? "- If you use `message` (`action=send`) to deliver visible output, do not repeat that visible content in your final answer; final answers are private in this mode."
505509 : `- If you use \`message\` (\`action=send\`) to deliver your user-visible reply, respond with ONLY: ${SILENT_REPLY_TOKEN} (avoid duplicate replies).`,
@@ -519,6 +523,17 @@ function buildMessagingSection(params: {
519523];
520524}
521525526+function buildMessageChannelOptions(runtimeChannel?: string): string | undefined {
527+const deliverableChannels: readonly string[] = listDeliverableMessageChannels();
528+if (deliverableChannels.length <= 1) {
529+return undefined;
530+}
531+if (runtimeChannel && deliverableChannels.includes(runtimeChannel)) {
532+return undefined;
533+}
534+return deliverableChannels.join("|");
535+}
536+522537function buildVoiceSection(params: { isMinimal: boolean; ttsHint?: string }) {
523538if (params.isMinimal) {
524539return [];
@@ -842,6 +857,9 @@ export function buildAgentSystemPrompt(params: {
842857const isMinimal = promptMode === "minimal" || promptMode === "none";
843858const subagentDelegationMode = normalizeSubagentDelegationMode(params.subagentDelegationMode);
844859const sourceMessageToolOnly = params.sourceReplyDeliveryMode === "message_tool_only";
860+const messageChannelOptions = availableTools.has("message")
861+ ? buildMessageChannelOptions(runtimeChannel)
862+ : undefined;
845863const silentReplyPromptMode = sourceMessageToolOnly
846864 ? "none"
847865 : (params.silentReplyPromptMode ?? "generic");
@@ -1206,6 +1224,7 @@ export function buildAgentSystemPrompt(params: {
12061224 availableTools,
12071225 inlineButtonsEnabled,
12081226 runtimeChannel,
1227+ messageChannelOptions,
12091228messageToolHints: params.messageToolHints,
12101229sourceReplyDeliveryMode: params.sourceReplyDeliveryMode,
12111230}),
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。