openclaw
Version:
Multi-channel AI gateway with extensible messaging integrations
1 lines • 5.3 kB
JavaScript
import{n as e}from"./rolldown-runtime-CNOWq4Kh.js";import{Hi as t,vi as n,wa as r,xa as i}from"./control-ui-connection-Bfj9beF_.js";import{Af as a,BA as o,Ry as s,bD as c,dj as l,kf as u,mj as d,nD as f,pj as p,tD as m,vD as h,zA as g,zy as _}from"./control-ui-boot-shared-DFTSUQQ0.js";import{I as v,O as y,Rt as b,U as x,d as S,g as C,j as w,l as T,m as E,s as D,u as O,v as k,x as A,yt as j}from"./solid-runtime-C416s-HC.js";import{M,Nt as N,Pt as P,j as F}from"./control-ui-boot-chat-DewxEbIm.js";import{vt as I,yt as L}from"./control-ui-boot-new-BsNYv3zK.js";import{n as R,t as z}from"./cloud-worker-stop.runtime-DpL9jcws.js";function B(e){let t;var n=H(),r=n.firstChild.firstChild,i=r.firstChild,a=i.nextSibling,o=r.nextSibling,s=o.firstChild,c=s.nextSibling,l=c.nextSibling,u=o.nextSibling,f=u.firstChild,p=f.nextSibling,m=p.firstChild,h=m.firstChild,_=h.nextSibling,v=m.nextSibling;return v.firstChild,n.addEventListener(`modal-cancel`,t=>{e.onCancel()||t.preventDefault()}),n.initialFocus=()=>t,n._$owner=b(),S(i,()=>d(`sessionsView.workerStopTitle`)),a._$$click=()=>e.onCancel(),S(a,w(g,{name:`x`})),S(o,()=>e.description,s),S(o,w(y,{get when(){return e.machineName},children:e=>[` `,(()=>{var t=U();return S(t,e),t})(),`.`]}),c),S(o,()=>d(`sessionsView.workerStopContinue`),l),u._$owner=b(),f._$$click=()=>e.onCancel(),E(()=>e=>t=e,f),S(f,()=>d(`common.cancel`)),p._$$click=()=>e.onConfirm(),S(m,w(g,{name:`stop`}),h),S(m,()=>d(`sessionsView.stopWorkerConfirmAction`),_),S(v,()=>d(`sessionsView.workerStopping`),null),T(()=>({e:d(`sessionsView.workerStopTitle`),t:d(`common.close`),a:e.pending,o:e.pending,i:e.pending,n:e.pending?`true`:`false`,s:e.pending?`hidden`:`visible`,h:e.pending?`true`:`false`,r:e.pending?`visible`:`hidden`,d:e.pending?`false`:`true`}),({e,t,a:r,o:i,i:o,n:s,s:c,h:l,r:u,d},h)=>{e!==h?.e&&C(n,`label`,e),t!==h?.t&&C(a,`aria-label`,t),r!==h?.a&&C(a,`disabled`,r),i!==h?.o&&C(f,`disabled`,i),o!==h?.i&&C(p,`disabled`,o),s!==h?.n&&C(p,`aria-busy`,s),c!==h?.s&&k(m,`visibility`,c),l!==h?.h&&C(m,`aria-hidden`,l),u!==h?.r&&k(v,`visibility`,u),d!==h?.d&&C(v,`aria-hidden`,d)}),n}async function V(e){if(!W){W=!0;try{await _(void 0,({render:t,finish:n})=>{t(()=>{let[t,r]=v(!1),i=!1,a=()=>!i&&(n(),!0),o=j(function*(){if(!i){i=!0,r(!0);try{(yield Promise.resolve().then(e.confirm))===`close`&&n()}finally{i=!1}}});return w(B,{get description(){return e.description},get machineName(){return e.machineName},get pending(){return t()},onCancel:a,onConfirm:()=>void o()})})})}finally{W=!1}}}var H,U,W;function G(){return(G=e((()=>{O(),x(),s(),o(),F(),l(),H=A(`<openclaw-modal-dialog class=session-worker-stop-dialog><section class=session-worker-stop><header class=session-worker-stop__heading><h2></h2><button type=button class=session-worker-stop__close></button></header><p class=session-worker-stop__description><!> <!></p><openclaw-modal-actions class="exec-approval-actions session-worker-stop__actions"><button type=button class=btn autofocus></button><button type=button class="btn danger session-worker-stop__submit"><span class=session-worker-stop__button-state><!><!></span><span class=session-worker-stop__button-state><span class=session-worker-stop__spinner>`,1),U=A(`<strong>`),p(M),W=!1,D([`click`])})))()}async function K(e){let n=e.client,i=a(e.row.placement),o=e.reclaimingKey===e.row.key,s=e.row.placement,l=s?.state===`active`&&s.runner?.kind===`device`&&s.runner.status===`offline`;if(!n||o||l||i?.blocksActiveRun&&e.row.hasActiveRun===!0||!i)return;let u=f(e.gatewaySnapshot,i);if(!u.allowed){e.publishError(u.reason);return}let d=e.row.key,p=e.row.sessionId,m=s?.generation,h=s?.state===`active`?s.activeOwnerEpoch:void 0,g=s&&`environmentId`in s?s.environmentId:void 0,_=s?.state===`active`?s.runner?.kind===`device`?`device`:`profile`:e.placementStartup.get(d)?.targetKind,v=t(e.row,e.fallbackAgentId);await V({machineName:_===`device`?e.machineName:void 0,description:r(_===`device`&&e.machineName?`sessionsView.workerStopDeviceDescription`:_===`profile`?`sessionsView.workerStopCloudDescription`:`sessionsView.workerStopDescription`),confirm:async()=>{if(!e.isCurrent())return e.publishError(r(`sessionsView.actionUnavailable`)),`close`;let i=e.currentGatewaySnapshot(),o=e.currentRow(),s=o?.placement,l=a(s),u=s&&`environmentId`in s?s.environmentId:void 0;if(i.client!==n||!o||!l||o.key!==d||o.sessionId!==p||s?.generation!==m||u!==g||h!==void 0&&(s?.state!==`active`||s.activeOwnerEpoch!==h)||t(o,e.fallbackAgentId)!==v)return e.publishError(r(`sessionsView.actionUnavailable`)),`close`;let f=P({gatewaySnapshot:i,movingKey:null,reclaimingKey:null,row:o});if(f.reclaimDisabledReason)return e.publishError(f.reclaimDisabledReason),`close`;e.onReclaimingChange(d);let _=!1;try{if(await R(n,{key:d,...v?{agentId:v}:{}},e.placementStartup),_=!0,e.isCurrent()){let t=await e.reconcileMutation(v);t.status===`failed`&&e.isCurrent()?e.publishError(t.error):e.isCurrent()&&c({message:r(`sessionsView.workerStopped`),icon:`check`})}return`close`}catch(t){return e.isCurrent()?(e.publishError(t),c({message:t instanceof Error?t.message:String(t),icon:`alertTriangle`}),_?`close`:`retry`):`close`}finally{e.onReclaimingChange(null)}}})}function q(){return(q=e((()=>{z(),u(),i(),I(),m(),n(),h(),N(),G(),L()})))()}q();export{K as reclaimChatPanePlacement};