UNPKG

openclaw

Version:

Multi-channel AI gateway with extensible messaging integrations

46 lines (45 loc) • 2.16 kB
import { c as normalizeOptionalLowercaseString } from "./string-coerce-CCIiB4H7.mjs"; import { l as isRecord } from "./record-coerce-CVPuDqcc.mjs"; import "./utils-C8YECn2Q.mjs"; import { t as hasMeaningfulChannelConfig } from "./channel-config-activation-BzEa8FnN.mjs"; import { n as isChannelConfigMetadataKey } from "./config-metadata-BVUrt758.mjs"; import { r as listPotentialConfiguredChannelPresenceSignals, t as listExplicitlyDisabledChannelIdsForConfig } from "./config-presence-G9kglnWa.mjs"; //#region 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; } /** Lists configured channel ids while leaving caller-specific activation policy at the caller. */ 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; } //#endregion export { listDoctorConfiguredChannelIds as t };