UNPKG

openclaw

Version:

Multi-channel AI gateway with extensible messaging integrations

48 lines (47 loc) • 1.47 kB
import { n as classifyExecAllowlistScope } from "./exec-command-resolution-DaBYjPqy.mjs"; import { f as updateExecApprovalsForMaintenance } from "./exec-approvals-store-BUZ9uOWF.mjs"; //#region src/infra/exec-approvals-generated-migration.ts function isObsoleteGeneratedEntry(e) { return e.source === "allow-always" && classifyExecAllowlistScope(e) === "inactive"; } function countObsoleteGeneratedExecApprovalRules(e) { return e.filter(isObsoleteGeneratedEntry).length; } function countObsoleteGeneratedExecApprovals(e) { return Object.values(e.agents ?? {}).reduce((e, t) => e + countObsoleteGeneratedExecApprovalRules(t.allowlist ?? []), 0); } function removeObsoleteGeneratedExecApprovals(e) { let t = 0; const n = Object.fromEntries(Object.entries(e.agents ?? {}).map(([e, n]) => { const r = (n.allowlist ?? []).filter((e) => { if (!isObsoleteGeneratedEntry(e)) return true; t += 1; return false; }); return [e, { ...n, allowlist: r }]; })); return t === 0 ? { file: e, removed: t } : { file: { ...e, agents: n }, removed: t }; } function repairObsoleteGeneratedExecApprovals() { let e = 0; updateExecApprovalsForMaintenance((t) => { const n = removeObsoleteGeneratedExecApprovals(t); e = n.removed; return n.removed > 0 ? n.file : null; }); return e; } //#endregion export { countObsoleteGeneratedExecApprovals as n, repairObsoleteGeneratedExecApprovals as r, countObsoleteGeneratedExecApprovalRules as t };