UNPKG

openclaw

Version:

Multi-channel AI gateway with extensible messaging integrations

3 lines • 1.79 kB
import{c as normalizeOptionalLowercaseString}from"./string-coerce-CpTFcSwY.mjs";import{l as isRecord}from"./record-coerce-BTbqdJ3-.mjs";import"./utils-Dlk0IYAa.mjs";import{t as hasMeaningfulChannelConfig}from"./channel-config-activation-g_b_Clo2.mjs";import{n as isChannelConfigMetadataKey}from"./config-metadata-RS-_hyk8.mjs";import{r as listPotentialConfiguredChannelPresenceSignals,t as listExplicitlyDisabledChannelIdsForConfig}from"./config-presence-BcbNJcgC.mjs"; //!src/commands/doctor/shared/configured-channel-ids.ts function includesConfigEntry(e,t,n){if(t===`raw`)return true;if(t===`enabled`)return!isRecord(e)||e.enabled!==false;const r=hasMeaningfulChannelConfig(e,n);return t===`meaningful`?r:isRecord(e)&&e.enabled===true||r}function listDoctorConfiguredChannelIds(e,t){const n=isRecord(e)?e:{};const r=n;if(t.skipWhenPluginsDisabled&&isRecord(n.plugins)&&n.plugins.enabled===false)return[];const i=t.excludeExplicitlyDisabled?new Set(listExplicitlyDisabledChannelIdsForConfig(r)):null;const a=/* @__PURE__ */ new Set;const add=e=>{const t=e.trim();const n=normalizeOptionalLowercaseString(t);if(!t||isChannelConfigMetadataKey(t)||n&&i?.has(n))return;a.add(t)};const o=isRecord(n.channels)?n.channels:null;if(o){for(const[e,n]of Object.entries(o))if(includesConfigEntry(n,t.configEntryPolicy,e))add(e)}if(t.env)for(const e of listPotentialConfiguredChannelPresenceSignals(r,t.env,{channelIds:t.candidateChannelIds,includePersistedAuthState:false})){if(e.source!==`env`)continue;const n=t.mapEnvironmentChannelId?.(e.channelId)??e.channelId;if(t.environmentChannelIsConfigured?.(n)===false)continue;add(n)}const s=[...a];if(t.sort===`locale`)return s.toSorted((e,t)=>e.localeCompare(t));return t.sort===`codepoint`?s.toSorted():s}export{listDoctorConfiguredChannelIds as t};