openclaw
Version:
Multi-channel AI gateway with extensible messaging integrations
3 lines • 1 kB
JavaScript
import{n as normalizeAgentId}from"./agent-id-cOfqmfln.mjs";
//!src/config/native-runtime-consent.ts
function resolveConsentAgentKey(e,t){const n=e?.agents?.entries;if(!n||Object.hasOwn(n,t))return t;const r=normalizeAgentId(t);return Object.keys(n).find(e=>normalizeAgentId(e)===r)??t}function hasRememberedNativeRuntimeConsent(e,t,n){const r=resolveConsentAgentKey(e,t);return e?.agents?.entries?.[r]?.nativeRuntimeConsent?.includes(n)===true}function rememberNativeRuntimeConsent(e,t,n){if(hasRememberedNativeRuntimeConsent(e,t,n))return e;const r=resolveConsentAgentKey(e,t);const i=e.agents?.entries?.[r];return{...e,agents:{...e.agents,entries:{...e.agents?.entries,[r]:{...i,nativeRuntimeConsent:[...i?.nativeRuntimeConsent??[],n]}}}}}function withOwnerNativeConsentModes(e,t,n){return t===true&&!n?{...e,permissionMode:e.permissionMode??`full`,sandboxMode:e.sandboxMode??`off`}:e}export{rememberNativeRuntimeConsent as n,withOwnerNativeConsentModes as r,hasRememberedNativeRuntimeConsent as t};