openclaw
Version:
Multi-channel AI gateway with extensible messaging integrations
3 lines • 854 B
JavaScript
import{t as commitExecAuthorizations}from"./exec-approvals-store-CKqFK0Id.mjs";
//!src/infra/exec-approvals-native.ts
async function commitNativeExecAuthorization(e,t,n){t();if((e.authorization.source===`current-policy`||e.authorization.source===`ask-fallback`)&&e.authorization.security===`allowlist`&&e.uses.length===0&&!e.authorization.requireAutoAllowSkills)throw new Error(`Native exec allowlist authorization requires a matched rule.`);const r=e.grants.map(e=>({...e,source:`allow-always`}));await commitExecAuthorizations({agentId:e.agentId,command:e.command,matches:[...e.uses.map(({match:e,resolvedPath:t})=>({...e,resolvedPath:t})),...r],authorization:e.authorization,...e.grants.length?{allowAlwaysDecision:{kind:`patterns`,patterns:e.grants}}:{},requireCommit:true},t,n);t();return{authorized:true}}export{commitNativeExecAuthorization as t};