UNPKG

openclaw

Version:

Multi-channel AI gateway with extensible messaging integrations

39 lines (38 loc) • 1.43 kB
import { b as uniqueStrings } from "./string-normalization-DLmfYZXI.mjs"; import { p as resolvePluginMetadataSnapshot } from "./plugin-metadata-snapshot-By9ySblt.mjs"; import { t as appendUniqueEnvVarCandidates } from "./env-var-candidates-B_T5jp_S.mjs"; //#region src/secrets/channel-env-vars.ts /** Discovers plugin-declared environment variable names for channel credential setup. */ /** * Resolves plugin-declared channel environment variable names keyed by channel id. * The result is deterministic so env-shell docs and prompt snapshots stay stable. */ function resolveChannelEnvVars(e) { const t = resolvePluginMetadataSnapshot({ config: e?.config, env: e?.env ?? process.env }); const n = {}; for (const e of t.plugins) { const t = e.packageChannel?.id?.trim(); const r = e.packageChannel?.configuredState?.env; if (!t || !r) continue; appendUniqueEnvVarCandidates(n, t, [...r.allOf ?? [], ...r.anyOf ?? []]); } return n; } /** * Returns the declared env var names for one channel id. */ function getChannelEnvVars(e, t) { const n = resolveChannelEnvVars(t); return [...(Object.hasOwn(n, e) ? n[e] : void 0) ?? []]; } /** * Lists every known channel env var name across installed plugin metadata. */ function listKnownChannelEnvVarNames(e) { return uniqueStrings(Object.values(resolveChannelEnvVars(e)).flat()); } //#endregion export { listKnownChannelEnvVarNames as n, getChannelEnvVars as t };