openclaw
Version:
Multi-channel AI gateway with extensible messaging integrations
5 lines • 1.97 kB
JavaScript
import{l as normalizeOptionalString}from"./string-coerce-CpTFcSwY.mjs";import"./src-0ci69Prg.mjs";import{t as expectDefined}from"./expect-DkJCbmLj.mjs";import{s as resolveBundledPluginsDir}from"./bundled-dir-CMJ7m2eP.mjs";import{n as listBundledChannelCatalogEntries}from"./bundled-channel-catalog-read-CX1nvZIw.mjs";import{n as CHAT_CHANNEL_ORDER}from"./ids-CXs0NhN-.mjs";import{t as buildManifestChannelMeta}from"./channel-meta-CjLF10Ak.mjs";
//!src/channels/chat-meta-shared.ts
const CHAT_CHANNEL_ID_SET=new Set(CHAT_CHANNEL_ORDER);function buildChatChannelMetaById(){const e=/* @__PURE__ */ new Map;for(const t of listBundledChannelCatalogEntries()){const n=normalizeOptionalString(t.id);if(!n||!CHAT_CHANNEL_ID_SET.has(n))continue;const r=t.channel;const i=normalizeOptionalString(r.label);if(!i)throw new Error(`Missing label for bundled chat channel "${n}"`);e.set(n,buildManifestChannelMeta({id:n,channel:r,label:i,selectionLabel:normalizeOptionalString(r.selectionLabel)||i,docsPath:normalizeOptionalString(r.docsPath)||`/channels/${n}`,docsLabel:normalizeOptionalString(r.docsLabel),blurb:normalizeOptionalString(r.blurb)||``,detailLabel:normalizeOptionalString(r.detailLabel),systemImage:normalizeOptionalString(r.systemImage),arrayFieldMode:`non-empty`}))}return Object.freeze(Object.fromEntries(e))}
//!src/channels/chat-meta.ts
let chatChannelMetaCache;function getChatChannelMetaById(){const e=resolveBundledPluginsDir(process.env)??``;if(chatChannelMetaCache?.cacheKey!==e)chatChannelMetaCache={cacheKey:e,metaById:buildChatChannelMetaById()};return chatChannelMetaCache.metaById}function listChatChannels(){const e=getChatChannelMetaById();return CHAT_CHANNEL_ORDER.map(t=>e[t]).filter(e=>Boolean(e))}function findChatChannelMeta(e){return getChatChannelMetaById()[e]}function getChatChannelMeta(e){return expectDefined(findChatChannelMeta(e),`chat channel meta for ${e}`)}export{getChatChannelMeta as n,listChatChannels as r,findChatChannelMeta as t};