openclaw
Version:
Multi-channel AI gateway with extensible messaging integrations
2 lines • 2.35 kB
JavaScript
import{n as e}from"./rolldown-runtime-8BhlS34s.js";import{At as t,Dt as n,Ui as r,kt as i,yn as a}from"./control-ui-foundation-ZY_Flbbd.js";import{Ar as o,Gl as s,hu as c,jr as l,ql as u,uu as d}from"./control-ui-core-3P365fbR.js";import{en as f,tn as p}from"./control-ui-boot-shared-DoKu-5Ju.js";import{To as m,wo as h}from"./control-ui-boot-shared-CG9HtEG-.js";function g(e){let t=r(e),o=r(t?.details),s=r(o?.source);return t?.code!==n.UNAVAILABLE||o?.code!==i.SESSION_WORKSPACE_RECOVERY_REQUIRED||o.cause!==`device_offline`||o.recoveryAction!==`continue_on_gateway`||!a(o.sessionId)||typeof s?.generation!=`number`||!Number.isSafeInteger(s.generation)||s.generation<0||!a(s.environmentId)||typeof s.ownerEpoch!=`number`||!Number.isSafeInteger(s.ownerEpoch)||s.ownerEpoch<1?null:{code:o.code,cause:o.cause,recoveryAction:o.recoveryAction,sessionId:o.sessionId,source:{generation:s.generation,environmentId:s.environmentId,ownerEpoch:s.ownerEpoch}}}function _(){return(_=e((()=>{t()})))()}function v(e){let t=e.map(e=>`${e.branch} — ${c(`sessionsView.deletePreservedReasons.${e.reason}`)}`).join(`
`);return`${c(`worktrees.title`)}:\n${t}`}function y(e){let t=c(`sessionsView.deletePreservedReasons.${e.reason}`);return`${c(`sessionsView.attentionRequired`)}: ${e.branch} — ${t}. ${c(`common.remove`)}?`}function b(){return(b=e((()=>{d()})))()}function x(e){let t=s(e);return g(e)?`${t} ${c(`sessionsView.workspaceRecoveryBatchHint`)}`:t}async function S(e){let t=!1;for(;e.isCurrent();)try{return await e.request()}catch(n){if(!e.isCurrent())return;let r=g(n);if(t||!r||r.sessionId!==e.session.sessionId)throw n;let i={key:e.session.key,...e.session.agentId?{agentId:e.session.agentId}:{},expected:r.source,target:{kind:`gateway`},abandonSource:!0},a=()=>{let t=l(e.scope.gateway.snapshot,{method:`sessions.move`,params:i,requiredScope:`operator.write`});if(!t.allowed)throw Error(t.reason,{cause:n})};a();let o=e.action===`delete`?`Delete`:`Archive`,s=await m({message:c(`sessionsView.discardWorkspace${o}Confirm`,{session:e.session.label}),confirmLabel:c(`sessionsView.discardWorkspace${o}Action`),danger:!0,signal:e.scope.signal});if(!e.isCurrent())return;if(!s)throw n;a(),await e.scope.client.request(`sessions.move`,i),t=!0}}function C(){return(C=e((()=>{_(),d(),f(),u(),o(),h(),p()})))()}export{v as a,y as i,C as n,b as o,S as r,x as t};