UNPKG

openclaw

Version:

Multi-channel AI gateway with extensible messaging integrations

67 lines (66 loc) • 3.35 kB
import { n as listBundledChannelCatalogEntries } from "./bundled-channel-catalog-read-CmfX8BTg.mjs"; import { i as normalizeChatChannelId } from "./ids-BRSWrLzE.mjs"; import { c as normalizeGatewayClientMode, i as GATEWAY_CLIENT_NAMES, l as normalizeGatewayClientName, r as GATEWAY_CLIENT_MODES } from "./client-info-Cm1BcrMm.mjs"; import { t as INTERNAL_MESSAGE_CHANNEL } from "./message-channel-constants-CkbqRgGl.mjs"; import { t as findChatChannelMeta } from "./chat-meta-CsbrDHrF.mjs"; import { r as getRegisteredChannelPluginMeta } from "./registry-BB86xKJa.mjs"; import { n as normalizeMessageChannel } from "./message-channel-core-BbYZT1a-.mjs"; import "./message-channel-normalize-CFHSufeo.mjs"; //#region src/utils/message-channel.ts function isGatewayCliClient(e) { return normalizeGatewayClientMode(e?.mode) === GATEWAY_CLIENT_MODES.CLI; } /** * Test-mode clients stay excluded from this list: suites use them as stand-ins * for real clients and assert presence propagation through the full pipeline. */ function isEphemeralGatewayClient(e) { const t = normalizeGatewayClientMode(e?.mode); return t === GATEWAY_CLIENT_MODES.CLI || t === GATEWAY_CLIENT_MODES.BACKEND || t === GATEWAY_CLIENT_MODES.PROBE; } function isOperatorUiClient(e) { const t = normalizeGatewayClientName(e?.id); return t === GATEWAY_CLIENT_NAMES.CONTROL_UI || t === GATEWAY_CLIENT_NAMES.BROWSER_COPILOT || t === GATEWAY_CLIENT_NAMES.TUI; } function isBrowserOperatorUiClient(e) { const t = normalizeGatewayClientName(e?.id); return t === GATEWAY_CLIENT_NAMES.CONTROL_UI || t === GATEWAY_CLIENT_NAMES.BROWSER_COPILOT; } function isBrowserCopilotClient(e) { return normalizeGatewayClientName(e?.id) === GATEWAY_CLIENT_NAMES.BROWSER_COPILOT; } function isInternalMessageChannel(e) { return normalizeMessageChannel(e) === INTERNAL_MESSAGE_CHANNEL; } function isWebchatClient(e) { if (normalizeGatewayClientMode(e?.mode) === GATEWAY_CLIENT_MODES.WEBCHAT) return true; return normalizeGatewayClientName(e?.id) === GATEWAY_CLIENT_NAMES.WEBCHAT_UI; } const PROGRESS_CARD_RENDERER_PLATFORMS = /* @__PURE__ */ new Set([ "web", "ios", "android", "macos", "darwin" ]); function isProgressCardRendererClient(e) { const t = normalizeGatewayClientName(e?.clientId); const n = t === GATEWAY_CLIENT_NAMES.CONTROL_UI || t === GATEWAY_CLIENT_NAMES.WEBCHAT_UI || t === GATEWAY_CLIENT_NAMES.IOS_APP || t === GATEWAY_CLIENT_NAMES.ANDROID_APP || t === GATEWAY_CLIENT_NAMES.MACOS_APP; const r = e?.platform?.trim().toLowerCase(); return n || (r ? PROGRESS_CARD_RENDERER_PLATFORMS.has(r) : false); } function isMarkdownCapableMessageChannel(e) { const t = normalizeMessageChannel(e); if (!t) return false; if (t === "webchat" || t === "tui") return true; const n = normalizeChatChannelId(t); if (n) { const e = findChatChannelMeta(n); if (e) return e.markdownCapable === true; const t = listBundledChannelCatalogEntries().find((e) => e.id === n); if (t) return t.channel.markdownCapable === true; } return getRegisteredChannelPluginMeta(t)?.markdownCapable === true; } //#endregion export { isInternalMessageChannel as a, isProgressCardRendererClient as c, isGatewayCliClient as i, isWebchatClient as l, isBrowserOperatorUiClient as n, isMarkdownCapableMessageChannel as o, isEphemeralGatewayClient as r, isOperatorUiClient as s, isBrowserCopilotClient as t };