openclaw
Version:
Multi-channel AI gateway with extensible messaging integrations
1 lines • 2.12 kB
JavaScript
import{n as e}from"./rolldown-runtime-CNOWq4Kh.js";import{Ai as t,Bi as n,Tt as r,ec as i,jt as a,nc as o,vi as s,wa as c,xa as l}from"./control-ui-connection-Bfj9beF_.js";import{As as u,ks as d}from"./control-ui-boot-shared-DFTSUQQ0.js";import{ar as f,rr as p}from"./control-ui-boot-chat-DewxEbIm.js";import{gr as m,mr as h}from"./deferred-ui-support-D-VedBtc.js";function g(e,t){let n=e?.agents?.entries;if(!n||Object.hasOwn(n,t))return t;let r=o(t);return Object.keys(n).find(e=>o(e)===r)??t}function _(e,t,n){let r=g(e,t);return e?.agents?.entries?.[r]?.nativeRuntimeConsent?.includes(n)===!0}function v(){return(v=e((()=>{i()})))()}async function y(e,i,a,o){let s=a.recovery,l=()=>!o.signal?.aborted&&o.canDispatch()&&r(e.hello?.auth??null);if(a.reason===`sandbox-required`||!s||s.action!==`use-native-permissions`||s.sessionId!==o.expectedSessionId||!l())return null;let u=e.sessions.captureConnectionScope(),d=t(i)?.agentId??o.agentId??n(e,i);if(!u||!d)return null;let p=await u.client.request(`config.get`,{});if(!l()||!e.sessions.isConnectionScopeCurrent(u))return null;let h=_(p.config,d,a.runtimeId);return!(h||await m({title:c(`chat.nativeRuntimeRecovery.title`,{runtime:a.runtimeLabel}),message:`${c(`chat.nativeRuntimeRecovery.reasons.${a.reason}`,{runtime:a.runtimeLabel})}\n\n${c(`chat.nativeRuntimeRecovery.confirmMessage`,{runtime:a.runtimeLabel})}${o.retriesMessage?`\n\n${c(`chat.nativeRuntimeRecovery.retryMessage`)}`:``}`,confirmLabel:c(`chat.nativeRuntimeRecovery.confirm`),danger:!0,signal:o.signal}))||!l()?null:f(e,i,{...o.model===void 0?{}:{model:o.model,agentRuntime:a.runtimeId},...h?{}:{nativeRuntimeConsent:a.runtimeId},sandboxMode:`off`,permissionMode:`full`,expectedLifecycleRevision:s.lifecycleRevision,expectedPermissionMode:s.expectedPermissionMode,expectedSandboxMode:s.expectedSandboxMode,...h?{}:{expectedNativeRuntimeConsent:s.expectedNativeRuntimeConsent}},{agentId:o.agentId,expectedSessionId:s.sessionId,ownsModelOverride:o.canDispatch,canDispatch:l})}function b(){return(b=e((()=>{v(),a(),h(),l(),d(),s(),p(),u()})))()}b();export{y as confirmNativeRuntimePermissionRecovery};