import { resolveSessionAgentId } from "../../agents/agent-scope.js"; import { resolveEffectiveMessagesConfig } from "../../agents/identity.js"; import { getBundledChannelPlugin } from "../../channels/plugins/bundled.js"; import { getLoadedChannelPlugin, normalizeChannelId } from "../../channels/plugins/index.js"; import { normalizeChatChannelId } from "../../channels/registry.js"; import { resolveSilentReplyPolicy } from "../../config/silent-reply.js"; import type { OpenClawConfig } from "../../config/types.openclaw.js"; import { formatErrorMessage } from "../../infra/errors.js"; import { buildOutboundSessionContext } from "../../infra/outbound/session-context.js"; import { hasReplyPayloadContent } from "../../interactive/payload.js"; import type { SilentReplyConversationType } from "../../shared/silent-reply-policy.js"; import { normalizeOptionalLowercaseString } from "../../shared/string-coerce.js"; import { INTERNAL_MESSAGE_CHANNEL, normalizeMessageChannel } from "../../utils/message-channel.js"; import type { OriginatingChannelType } from "../templating.js"; import { isSilentReplyPayloadText, SILENT_REPLY_TOKEN } from "../tokens.js"; import type { ReplyPayload } from "../types.js"; import { normalizeReplyPayload } from "./normalize-reply.js"; import {
formatBtwTextForExternalDelivery,
shouldSuppressReasoningPayload,
} from "./reply-payloads.js";
let deliverRuntimePromise: Promise< typeofimport("../../infra/outbound/deliver-runtime.js")
> | null = null;
function loadDeliverRuntime() {
deliverRuntimePromise ??= import("../../infra/outbound/deliver-runtime.js"); return deliverRuntimePromise;
}
export type RouteReplyParams = { /** The reply payload to send. */
payload: ReplyPayload; /** The originating channel type. */
channel: OriginatingChannelType; /** The destination chat/channel/user ID. */
to: string; /** Session key for deriving agent identity defaults (multi-agent). */
sessionKey?: string; /** Session key for policy resolution when native-command delivery targets a different session. */
policySessionKey?: string; /** Explicit conversation type for policy resolution when the policy key is generic. */
policyConversationType?: SilentReplyConversationType; /** Provider account id (multi-account). */
accountId?: string; /** Originating sender id for sender-scoped outbound media policy. */
requesterSenderId?: string; /** Originating sender display name for name-keyed sender policy matching. */
requesterSenderName?: string; /** Originating sender username for username-keyed sender policy matching. */
requesterSenderUsername?: string; /** Originating sender E.164 phone number for e164-keyed sender policy matching. */
requesterSenderE164?: string; /** Thread id for replies (Telegram topic id or Matrix thread event id). */
threadId?: string | number; /** Config for provider-specific settings. */
cfg: OpenClawConfig; /** Optional abort signal for cooperative cancellation. */
abortSignal?: AbortSignal; /** Mirror reply into session transcript (default: true when sessionKey is set). */
mirror?: boolean; /** Whether this message is being sent in a group/channel context */
isGroup?: boolean; /** Group or channel identifier for correlation with received events */
groupId?: string;
};
export type RouteReplyResult = { /** Whether the reply was sent successfully. */
ok: boolean; /** Optional message ID from the provider. */
messageId?: string; /** Error message if the send failed. */
error?: string;
};
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.