UNPKG

openclaw

Version:

Multi-channel AI gateway with extensible messaging integrations

1 lines • 2.19 kB
import{n as e}from"./rolldown-runtime-CNOWq4Kh.js";import{B as t,K as n,Qo as r,bs as i,li as a,ll as o,oi as s,sl as c,us as l}from"./_4____________________________.js";import{vc as u,yc as d}from"./_2_____________________________.js";import{Bi as f,Hi as p}from"./deferred-ui-support-DZEPWjAk.js";import{An as m,On as h}from"./control-ui-boot-chat-CqvkfPXD.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((()=>{c()})))()}async function y(e,n,r,o){let s=r.recovery,c=()=>!o.signal?.aborted&&o.canDispatch()&&t(e.hello?.auth??null);if(r.reason===`sandbox-required`||!s||s.action!==`use-native-permissions`||s.sessionId!==o.expectedSessionId||!c())return null;let u=e.sessions.captureConnectionScope(),d=l(n)?.agentId??o.agentId??i(e,n);if(!u||!d)return null;let f=await u.client.request(`config.get`,{});if(!c()||!e.sessions.isConnectionScopeCurrent(u))return null;let h=_(f.config,d,r.runtimeId);return!(h||await p({title:a(`chat.nativeRuntimeRecovery.title`,{runtime:r.runtimeLabel}),message:`${a(`chat.nativeRuntimeRecovery.reasons.${r.reason}`,{runtime:r.runtimeLabel})}\n\n${a(`chat.nativeRuntimeRecovery.confirmMessage`,{runtime:r.runtimeLabel})}${o.retriesMessage?`\n\n${a(`chat.nativeRuntimeRecovery.retryMessage`)}`:``}`,confirmLabel:a(`chat.nativeRuntimeRecovery.confirm`),danger:!0,signal:o.signal}))||!c()?null:m(e,n,{...o.model===void 0?{}:{model:o.model,agentRuntime:r.runtimeId},...o.cyberAccessProgram===void 0?{}:{cyberAccessProgram:o.cyberAccessProgram},...h?{}:{nativeRuntimeConsent:r.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:c})}function b(){return(b=e((()=>{v(),n(),f(),s(),u(),r(),h(),d()})))()}b();export{y as confirmNativeRuntimePermissionRecovery};