UNPKG

openclaw

Version:

Multi-channel AI gateway with extensible messaging integrations

41 lines (40 loc) • 1.63 kB
import { l as normalizeOptionalString } from "./string-coerce-CCIiB4H7.mjs"; import "./session-key-CqAyZeVk.mjs"; import { n as normalizeAccountId } from "./account-id-BqKT3GuY.mjs"; import { n as normalizeMessageChannel } from "./message-channel-core-BbYZT1a-.mjs"; import { t as isDeliverableMessageChannel } from "./message-channel-normalize-CFHSufeo.mjs"; import "./message-channel-DTYVLJT1.mjs"; //#region src/cli/message-secret-scope.ts function resolveScopedChannelCandidate(e) { if (typeof e !== "string") return; const t = normalizeMessageChannel(e); if (!t || !isDeliverableMessageChannel(t)) return; return t; } function resolveChannelFromTargetValue(e) { const t = normalizeOptionalString(e); if (!t) return; const n = t.indexOf(":"); if (n <= 0) return; return resolveScopedChannelCandidate(t.slice(0, n)); } function resolveChannelFromTargets(e) { if (!Array.isArray(e)) return; const t = new Set(e.map(resolveChannelFromTargetValue).filter((e) => e !== void 0)); return t.size === 1 ? [...t][0] : void 0; } function resolveScopedAccountId(e) { const t = normalizeOptionalString(e); if (!t) return; return normalizeAccountId(t); } function resolveMessageSecretScope(e) { const t = resolveScopedChannelCandidate(e.channel) ?? resolveChannelFromTargetValue(e.target) ?? resolveChannelFromTargets(e.targets) ?? resolveScopedChannelCandidate(e.fallbackChannel); const n = resolveScopedAccountId(e.accountId) ?? resolveScopedAccountId(e.fallbackAccountId ?? void 0); return { ...t ? { channel: t } : {}, ...n ? { accountId: n } : {} }; } //#endregion export { resolveMessageSecretScope as t };