UNPKG

openclaw

Version:

Multi-channel AI gateway with extensible messaging integrations

27 lines (26 loc) • 1.39 kB
import { l as normalizeOptionalString, u as normalizeOptionalStringifiedId } from "./string-coerce-CCIiB4H7.mjs"; import { t as INTERNAL_MESSAGE_CHANNEL } from "./message-channel-constants-CkbqRgGl.mjs"; import { n as normalizeMessageChannel } from "./message-channel-core-BbYZT1a-.mjs"; import { t as isDeliverableMessageChannel } from "./message-channel-normalize-CFHSufeo.mjs"; import "./message-channel-DTYVLJT1.mjs"; //#region src/infra/outbound/best-effort-delivery.ts /** Normalizes an optional best-effort destination into a deliver/no-deliver decision. */ function resolveExternalBestEffortDeliveryTarget(e) { const t = normalizeMessageChannel(e.channel); const n = t && isDeliverableMessageChannel(t) ? t : void 0; const r = normalizeOptionalString(e.to); const i = Boolean(n && r); return { deliver: i, channel: i ? n : void 0, to: i ? r : void 0, accountId: i ? normalizeOptionalString(e.accountId) : void 0, threadId: i && e.threadId != null && e.threadId !== "" ? normalizeOptionalStringifiedId(e.threadId) : void 0 }; } /** Detects best-effort sends that should stay session-only on the internal channel. */ function shouldDowngradeDeliveryToSessionOnly(e) { return e.wantsDelivery && e.bestEffortDeliver && e.resolvedChannel === "webchat"; } //#endregion export { shouldDowngradeDeliveryToSessionOnly as n, resolveExternalBestEffortDeliveryTarget as t };