openclaw
Version:
Multi-channel AI gateway with extensible messaging integrations
2 lines • 6.82 kB
JavaScript
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./session-placement-move-dialog-J2T2RP1l.js","./lit-runtime-P5vbNq6b.js","./gateway-runtime-5YzSCmfV.js","./control-ui-boot-shared-JlZTSJEC.js","./control-ui-boot-shared-3SP_aL-Y.js","./control-ui-boot-shared-90V688bk.js","./control-ui-boot-shared-DBJri5ri.js","./control-ui-boot-shared-BykNRHBP.js","./control-ui-boot-shared-Rs4iS2kF.js","./plugin-contracts-runtime-CsJ0WpAd.js","./markdown-runtime-Hc-lvqnn.js","./config-runtime-CgOgfOrG.js","./control-ui-boot-shared-CcmBeh0v.js","./control-ui-boot-shared-BR12heUA.js","./control-ui-boot-shared-CApmg5ot.js","./css-chat-Ckz95ikh.js","./chat-transcript-layout-w3EszKw8.js","./css-chat-custodian-new-session-B_euK-Vu.js","./sidebar-update-runtime-B0vYzX3D.js","./css-cron-custodian-new-session-DdqVeFqw.js","./chat-transcript-styles-BVZgOT1t.js","./css-new-session-BGJnpiJ5.js","./css-config-njfbfHBk.js","./control-ui-core-D-VUH4Gq.css","./control-ui-boot-shared-BJ_QKfFn.css","./css-chat-DCHf01mf.css","./css-chat-custodian-new-session-CEndYuO5.css","./sidebar-update-runtime-ah7rgQE7.css","./css-cron-custodian-new-session-Ci5c-FgJ.css","./chat-transcript-styles-DHHd4Hhc.css","./css-new-session-C71huhgC.css","./css-config-vi6FusyS.css","./control-ui-boot-new-D-SpiTTi.css"])))=>i.map(i=>d[i]);
import{n as e}from"./rolldown-runtime-8BhlS34s.js";import{Bi as t,zi as n}from"./control-ui-foundation-ZY_Flbbd.js";import{Ar as r,dl as i,hu as a,jr as o,nl as s,uu as c}from"./control-ui-core-3P365fbR.js";import{_r as l,fr as u}from"./control-ui-core-CFW9Qtjn.js";import{Al as d,jl as f}from"./control-ui-boot-shared-DoKu-5Ju.js";import{To as p,bi as m,wo as h,yi as g}from"./control-ui-boot-shared-CG9HtEG-.js";import{C as _,S as v,T as y}from"./control-ui-boot-shared-73R4ErOy.js";import{J as b,ct as x,ot as S,q as C,st as w,tt as T}from"./control-ui-boot-new-BTHisEC4.js";import{n as E,t as D}from"./cloud-worker-stop.runtime-Deft5Au6.js";async function O(e){let{showSessionPlacementTargetDialog:t}=await n(async()=>{let{showSessionPlacementTargetDialog:e}=await import(`./session-placement-move-dialog-J2T2RP1l.js`);return{showSessionPlacementTargetDialog:e}},__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32]),import.meta.url),r=e.row.agentRuntime,i=o(e.gatewaySnapshot,{method:e.mode===`restart`?`sessions.reclaim`:`sessions.move`,requiredScope:`operator.write`}),s=o(e.gatewaySnapshot,{method:e.mode===`move`?`sessions.move`:`sessions.dispatch`,requiredScope:`operator.write`});return await t({mode:e.mode,sessionLabel:e.row.label||e.row.key,activeRun:e.row.hasActiveRun===!0,gatewayDisabledReason:i.allowed?void 0:i.reason,deviceDisabledReason:s.allowed?r&&!r.devicePlacement?a(`newSession.deviceRuntimeUnsupported`):void 0:s.reason,profileDisabledReason:e=>s.allowed?r?.cloudPlacementSupported===!1?a(`newSession.cloudRuntimeUnsupported`,{runtime:r.id}):r?.cloudPlacementExecutionMode&&!w(e,r.cloudPlacementExecutionMode)?a(`newSession.cloudProfileRuntimeUnsupported`,{runtime:r.id}):void 0:s.reason,loadCatalog:async()=>{let t=await S(e.client,r?.id);return{profiles:u(e.gatewaySnapshot.hello?.auth??null)?t.profiles:[],devices:b(t.environments,r?.devicePlacement)}}})}async function k(e){let t=e.client,n=e.row.placement,r=e.mode===`move`&&n?.state===`active`?n:void 0,s=n?.state===`failed`&&n.recoveryAction===`restart`?n:void 0,c=_(e.row);if(!t||e.pendingKey===e.row.key||(e.mode===`move`?!r||e.row.placementMove!==void 0&&e.row.placementMove.error===void 0:e.row.archived===!0||!s&&!c))return;let l=o(e.gatewaySnapshot,{method:e.mode===`move`?`sessions.move`:`sessions.dispatch`,requiredScope:`operator.write`}),u=o(e.gatewaySnapshot,{method:`sessions.reclaim`,requiredScope:`operator.write`});if(!l.allowed&&(e.mode===`move`||!s||!u.allowed)){e.publishError(l.reason);return}let d=r?.runner?.kind===`device`&&r.runner.status===`offline`,f;if(f=d?await p({message:a(`sessionsView.continueOnGatewayConfirm`,{session:e.row.label||e.row.key}),confirmLabel:a(`sessionsView.continueOnGatewayAction`),danger:!0})?{kind:`gateway`}:null:await O({client:t,gatewaySnapshot:e.gatewaySnapshot,mode:e.mode===`move`?`move`:c?`dispatch`:`restart`,row:e.row}),!f)return;if(!e.isCurrent(t,e.connectionGeneration)){e.publishError(a(`sessionsView.actionUnavailable`));return}if(e.mode===`recover`){let t=e.currentRow(),n=t?.placement,r=n?.state===`failed`&&n.recoveryAction===`restart`&&n.generation===s?.generation;if(!t||t.key!==e.row.key||t.sessionId!==e.row.sessionId||t.repositoryWorkspaceId!==e.row.repositoryWorkspaceId||t.archived===!0||(c?!_(t):!r)){e.publishError(a(`sessionsView.actionUnavailable`));return}}let m=i(e.row.key)?.agentId,h={key:e.row.key,...m?{agentId:m}:{}};e.onPendingChange(e.row.key);try{if(r)await t.request(`sessions.move`,{...h,expected:{generation:r.generation,environmentId:r.environmentId,ownerEpoch:r.activeOwnerEpoch},target:f,...d?{abandonSource:!0}:{}});else if(f.kind===`gateway`){if(!s){e.publishError(a(`sessionsView.actionUnavailable`));return}await t.request(`sessions.reclaim`,{...h,recoverToGateway:{expectedGeneration:s.generation}},{timeoutMs:null})}else await t.request(`sessions.dispatch`,{...h,...f.kind===`profile`?{profileId:f.profileId,...f.os?{os:f.os}:{},...f.machineClass?{machineClass:f.machineClass}:{}}:{deviceId:f.deviceId}});if(e.isCurrent(t,e.connectionGeneration)){let n=await e.reconcileMutation(m);n.status===`failed`&&e.isCurrent(t,e.connectionGeneration)&&e.publishError(n.error)}}catch(n){e.isCurrent(t,e.connectionGeneration)&&(await e.reconcileMutation(m).catch(()=>void 0),e.isCurrent(t,e.connectionGeneration)&&e.publishError(n))}finally{e.onPendingChange(null),e.requestUpdate()}}async function A(e){let t=e.client,n=e.connectionGeneration,r=m(e.row.placement),s=e.reclaimingKey===e.row.key,c=e.row.placement,l=c?.state===`active`&&c.runner?.kind===`device`&&c.runner.status===`offline`;if(!t||s||l||r?.blocksActiveRun&&e.row.hasActiveRun===!0||!r)return;let u=o(e.gatewaySnapshot,r);if(!u.allowed){e.publishError(u.reason);return}let d=y(e.row,e.placementStartup.get(e.row.key));if(!await p({message:d.confirmMessage,confirmLabel:d.confirmLabel,danger:!0}))return;if(!e.isCurrent(t,n)){e.publishError(a(`sessionsView.actionUnavailable`));return}let f=i(e.row.key)?.agentId;e.onReclaimingChange(e.row.key);try{if(await E(t,{key:e.row.key,...f?{agentId:f}:{}},e.placementStartup),e.isCurrent(t,n)){let n=await e.reconcileMutation(f);n.status===`failed`&&e.isCurrent(t,e.connectionGeneration)&&e.publishError(n.error)}}catch(r){e.isCurrent(t,n)&&e.publishError(r)}finally{e.onReclaimingChange(null),e.requestUpdate()}}function j(){return(j=e((()=>{l(),D(),g(),h(),c(),d(),r(),s(),T(),C(),x(),v(),t(),f()})))()}j();export{k as changeChatPanePlacement,A as reclaimChatPanePlacement};