UNPKG

openclaw

Version:

Multi-channel AI gateway with extensible messaging integrations

30 lines (29 loc) • 1.1 kB
import { t as commitExecAuthorizations } from "./exec-approvals-store-BUZ9uOWF.mjs"; //#region src/infra/exec-approvals-native.ts /** The live native caller owns its bound argv/cwd and rechecks them immediately before spawn. */ 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 }; } //#endregion export { commitNativeExecAuthorization as t };