UNPKG

openclaw

Version:

Multi-channel AI gateway with extensible messaging integrations

39 lines (38 loc) • 1.71 kB
import { n as listBundledChannelCatalogEntries } from "../bundled-channel-catalog-read-CmfX8BTg.mjs"; //#region src/plugin-sdk/chat-channel-ids.ts /** * Canonical bundled chat-channel id list. * * Mirrors the channel catalog ids that can be passed to the inbound-envelope * formatter (src/auto-reply/envelope.ts -> formatInboundEnvelope -> * formatAgentEnvelope) for its leading `[<channel> ...]` header. Plugins that * need to recognize an envelope-prefixed message (for example a memory plugin * filtering envelope sludge out of long-term capture) should not hardcode their * own channel-id table that can drift from the catalog. * * The list is derived from the same bundled/official channel catalog reader as * runtime channel metadata so catalog-only channels stay covered even when they * do not have a generated config metadata entry. */ const BUNDLED_CHAT_CHANNEL_ENTRIES = listBundledChannelCatalogEntries(); /** Bundled chat-channel ids from the official channel catalog. */ const BUNDLED_CHAT_CHANNEL_IDS = Object.freeze(BUNDLED_CHAT_CHANNEL_ENTRIES.map((e) => e.id)); /** * Channel ids, labels, and aliases that can appear as inbound-envelope prefixes. * Consumers should use this for envelope cleanup instead of hardcoding channel names. */ const BUNDLED_CHAT_CHANNEL_ENVELOPE_PREFIXES = Object.freeze((() => { const e = /* @__PURE__ */ new Map(); for (const t of BUNDLED_CHAT_CHANNEL_ENTRIES) for (const n of [ t.id, t.channel.label, ...t.aliases ]) { const t = n?.trim(); const r = t?.toLocaleLowerCase("en-US"); if (t && r && !e.has(r)) e.set(r, t); } return [...e.values()]; })()); //#endregion export { BUNDLED_CHAT_CHANNEL_ENVELOPE_PREFIXES, BUNDLED_CHAT_CHANNEL_IDS };