UNPKG

openclaw

Version:

Multi-channel AI gateway with extensible messaging integrations

3 lines • 1.25 kB
import{n as classifyExecAllowlistScope}from"./exec-command-resolution-BI7wY-6_.mjs";import{f as updateExecApprovalsForMaintenance}from"./exec-approvals-store-CKqFK0Id.mjs"; //!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}export{countObsoleteGeneratedExecApprovals as n,repairObsoleteGeneratedExecApprovals as r,countObsoleteGeneratedExecApprovalRules as t};