UNPKG

openclaw

Version:

Multi-channel AI gateway with extensible messaging integrations

66 lines (65 loc) • 2.1 kB
import { t as expandHomePrefix } from "./home-dir-EKmgmdPG.mjs"; import { f as resolveExecApprovalsSocketPath, i as DEFAULT_SECURITY, n as DEFAULT_AUTO_ALLOW_SKILLS, r as DEFAULT_EXEC_APPROVAL_ASK_FALLBACK, s as normalizeExecApprovalsInternal, t as DEFAULT_ASK, u as resolveExecApprovalsDisplayPath } from "./exec-approvals-config-BBzEUJlE.mjs"; //#region src/infra/exec-approvals-resolver.ts function resolveExecApprovalsFromFileInternal(e) { const t = e.file; const n = normalizeExecApprovalsInternal(t); const r = n.defaults ?? {}; const i = e.agentId ?? "default"; const a = n.agents?.[i] ?? {}; const o = n.agents?.["*"] ?? {}; const s = t.agents?.[i] ?? {}; const c = t.agents?.["*"] ?? {}; const l = e.overrides?.security ?? "full"; const u = e.overrides?.ask ?? "off"; const d = e.overrides?.askFallback ?? "deny"; const f = e.overrides?.autoAllowSkills ?? false; const p = { security: r.security ?? l, ask: r.ask ?? u, askFallback: r.askFallback ?? d, autoAllowSkills: r.autoAllowSkills ?? f }; const resolveField = (e) => { const t = r[e]; const n = t !== void 0 ? { value: t, source: `defaults.${e}` } : { value: p[e], source: null }; const l = s[e] != null; const u = (l ? a : c[e] != null ? o : void 0)?.[e]; return u !== void 0 ? { value: u, source: `agents.${l ? i : "*"}.${e}` } : n; }; const m = resolveField("security"); const h = resolveField("ask"); const g = resolveField("askFallback"); const _ = { security: m.value, ask: h.value, askFallback: g.value, autoAllowSkills: a.autoAllowSkills ?? o.autoAllowSkills ?? p.autoAllowSkills }; const v = [...o.allowlist ?? [], ...a.allowlist ?? []]; return { path: e.path ?? resolveExecApprovalsDisplayPath(), socketPath: expandHomePrefix(e.socketPath ?? n.socket?.path ?? resolveExecApprovalsSocketPath()), token: e.token ?? n.socket?.token ?? "", defaults: p, agent: _, agentSources: { security: m.source, ask: h.source, askFallback: g.source }, allowlist: v, file: n }; } //#endregion export { resolveExecApprovalsFromFileInternal as t };