UNPKG

openclaw

Version:

Multi-channel AI gateway with extensible messaging integrations

2 lines • 6.29 kB
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./session-placement-move-dialog-DXpsM34I.js","./lit-runtime-B8uOr6OX.js","./gateway-runtime-Cr51Pi7N.js","./session-snapshot-database-BurLa_ut.js","./control-ui-boot-shared-Dfs-gZII.js","./control-ui-boot-shared-umGE-sEP.js","./control-ui-boot-shared-Sj2zqjOr.js","./control-ui-boot-shared-em9-jnbz.js","./plugin-contracts-runtime-CNCaYops.js","./control-ui-boot-shared-D4XEBdOG.js","./config-runtime-BecGLziM.js","./markdown-runtime-ORQpioyT.js","./control-ui-boot-shared-D3oo_6Fq.js","./control-ui-boot-shared-styles-BaQ2sAfZ.js","./sidebar-update-runtime-DonYLwN5.js","./chat-transcript-styles-Dzr3t9kA.js","./control-ui-boot-new-styles-Bb6Ub5D3.js","./control-ui-core-yIvVj14Y.css","./control-ui-boot-shared-styles-DKyMAG_6.css","./control-ui-boot-shared-CXHNz0Bh.css","./sidebar-update-runtime-ah7rgQE7.css","./chat-transcript-styles-B_dd5Ueo.css","./control-ui-boot-new-styles-u1aN_ui5.css","./control-ui-boot-new-D-SpiTTi.css"])))=>i.map(i=>d[i]); import{n as e}from"./rolldown-runtime-8BhlS34s.js";import{Eu as t,Hr as n,Sl as r,Ur as i,jl as a,ju as o}from"./control-ui-core-BncvAZjR.js";import{gr as s,xr as c}from"./control-ui-core-9qYjK5B2.js";import{Fo as l,Io as u}from"./control-ui-boot-shared-DJkUdZmL.js";import{oa as d,sa as f}from"./ui-DuRgK6kL.js";import{Bi as p,Gn as m,Wn as h,zi as g}from"./control-ui-boot-shared-xfDhIVun.js";import{f as _,h as v,p as y}from"./control-ui-boot-chat-BPMc7uzL.js";import{G as b,Q as x,W as S,at as C,it as w,rt as T}from"./control-ui-boot-new-CxgnwT6A.js";import{n as E,t as D}from"./cloud-worker-stop.runtime-BR0jZ8bp.js";async function O(e){let{showSessionPlacementTargetDialog:t}=await d(async()=>{let{showSessionPlacementTargetDialog:e}=await import(`./session-placement-move-dialog-DXpsM34I.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]),import.meta.url),n=e.row.agentRuntime,r=i(e.gatewaySnapshot,{method:e.mode===`restart`?`sessions.reclaim`:`sessions.move`,requiredScope:`operator.write`}),a=i(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:r.allowed?void 0:r.reason,deviceDisabledReason:a.allowed?n&&!n.devicePlacement?o(`newSession.deviceRuntimeUnsupported`):void 0:a.reason,profileDisabledReason:e=>a.allowed?n?.cloudPlacementSupported===!1?o(`newSession.cloudRuntimeUnsupported`,{runtime:n.id}):n?.cloudPlacementExecutionMode&&!w(e,n.cloudPlacementExecutionMode)?o(`newSession.cloudProfileRuntimeUnsupported`,{runtime:n.id}):void 0:a.reason,loadCatalog:async()=>{let t=await T(e.client,n?.id);return{profiles:s(e.gatewaySnapshot.hello?.auth??null)?t.profiles:[],devices:b(t.environments,n?.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=y(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=i(e.gatewaySnapshot,{method:e.mode===`move`?`sessions.move`:`sessions.dispatch`,requiredScope:`operator.write`}),u=i(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:o(`sessionsView.continueOnGatewayConfirm`,{session:e.row.label||e.row.key}),confirmLabel:o(`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()){e.publishError(o(`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?!y(t):!r)){e.publishError(o(`sessionsView.actionUnavailable`));return}}let m=a(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(o(`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()){let t=await e.reconcileMutation(m);t.status===`failed`&&e.isCurrent()&&e.publishError(t.error)}}catch(t){e.isCurrent()&&(await e.reconcileMutation(m).catch(()=>void 0),e.isCurrent()&&e.publishError(t))}finally{e.onPendingChange(null),e.requestUpdate()}}async function A(e){let t=e.client,n=m(e.row.placement),r=e.reclaimingKey===e.row.key,s=e.row.placement,c=s?.state===`active`&&s.runner?.kind===`device`&&s.runner.status===`offline`;if(!t||r||c||n?.blocksActiveRun&&e.row.hasActiveRun===!0||!n)return;let l=i(e.gatewaySnapshot,n);if(!l.allowed){e.publishError(l.reason);return}let u=v(e.row,e.placementStartup.get(e.row.key));if(!await p({message:u.confirmMessage,confirmLabel:u.confirmLabel,danger:!0}))return;if(!e.isCurrent()){e.publishError(o(`sessionsView.actionUnavailable`));return}let d=a(e.row.key)?.agentId;e.onReclaimingChange(e.row.key);try{if(await E(t,{key:e.row.key,...d?{agentId:d}:{}},e.placementStartup),e.isCurrent()){let t=await e.reconcileMutation(d);t.status===`failed`&&e.isCurrent()&&e.publishError(t.error)}}catch(t){e.isCurrent()&&e.publishError(t)}finally{e.onReclaimingChange(null),e.requestUpdate()}}function j(){return(j=e((()=>{c(),D(),h(),g(),t(),l(),n(),r(),x(),S(),C(),_(),f(),u()})))()}j();export{k as changeChatPanePlacement,A as reclaimChatPanePlacement};