@rivet-dev/agentos 0.4.1 → 0.4.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +18 -0
- package/assets/inspector-tabs-app/assets/{filesystem-C9Z7HA3k.js → filesystem-Dt4eKrkX.js} +1 -1
- package/assets/inspector-tabs-app/assets/{hooks-DaKa0v02.js → hooks-B_kCGlJx.js} +1 -1
- package/assets/inspector-tabs-app/assets/index-CMgGagyE.js +126 -0
- package/assets/inspector-tabs-app/assets/processes-C3xk9hpI.js +4 -0
- package/assets/inspector-tabs-app/assets/{scroll-area-BN1MPKEE.js → scroll-area-DKdlhVEr.js} +1 -1
- package/assets/inspector-tabs-app/assets/system-DOSmuuav.js +1 -0
- package/assets/inspector-tabs-app/assets/{terminal-yincB5PP.js → terminal-DbNlwtw-.js} +4 -4
- package/assets/inspector-tabs-app/assets/{useMutation-CmlocRNE.js → useMutation-B4fxUbt-.js} +1 -1
- package/assets/inspector-tabs-app/assets/vm-status-badges-QaK7sEZ4.js +1 -0
- package/assets/inspector-tabs-app/index.html +1 -1
- package/dist/index.d.ts +73 -9
- package/dist/index.js +4 -2
- package/dist/index.js.map +1 -1
- package/package.json +6 -4
- package/assets/inspector-tabs-app/assets/index-bwUfaXzS.js +0 -126
- package/assets/inspector-tabs-app/assets/processes-CZ6M0f6m.js +0 -4
- package/assets/inspector-tabs-app/assets/system-CXd1uvC-.js +0 -1
- package/assets/inspector-tabs-app/assets/vm-status-badges-C7eIpgyG.js +0 -1
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
var Q=Object.defineProperty;var D=(s,t,n)=>t in s?Q(s,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):s[t]=n;var S=(s,t,n)=>D(s,typeof t!="symbol"?t+"":t,n);import{u as M,r as b,w as $,j as e,x as _,C as L,d as P,y as K,g as F,a as I}from"./index-bwUfaXzS.js";import{k as V,Q as H,i as z,P as A,l as G,a as y,V as X}from"./vm-status-badges-C7eIpgyG.js";import{b as Y}from"./hooks-DaKa0v02.js";function O(s,t){return V({...s,enabled:!0,suspense:!0,throwOnError:z,placeholderData:void 0},H)}function g(s){return s.process?`${s.process.generation}:tracked:${s.process.pid}`:`${s.generation}:guest:${s.pid}`}const U=8;async function J(s,t,n,o){const l=[];let a=n,c=!1,x=!1,v;for(let j=0;j<U;j++){o==null||o.throwIfAborted();const i=await s(a);if(o==null||o.throwIfAborted(),BigInt(i.generation)!==BigInt(t))throw new Error("Process replay returned a different VM generation");if(i.events.length>A.maxEvents)throw new Error("Process replay exceeded the requested event page limit");let u=a,r=0;const d=[];for(const h of i.events){if(h.sequence<0||typeof h.sequence=="number"&&!Number.isSafeInteger(h.sequence)||u!==void 0&&h.sequence<=u)throw new Error("Process replay returned out-of-order sequences");x||(x=BigInt(h.sequence)>BigInt(u??-1)+1n),u=h.sequence;const N=G(h.data);if(r+=N.byteLength,r>A.maxBytes)throw new Error("Process replay exceeded the requested byte page limit");d.push({...h,data:N})}const m=i.nextCursor??void 0;if(m!==void 0&&(m<0||typeof m=="number"&&!Number.isSafeInteger(m))||i.hasMore&&i.events.length===0||i.events.length>0&&m===void 0||m!==void 0&&BigInt(m)!==BigInt(u??-1)&&!(i.truncated&&!i.hasMore&&BigInt(m)>BigInt(u??-1)))throw new Error("Process replay did not advance its cursor");if(l.push(...d),a=m??a,x||(x=i.truncated),v=i.end??v,c=i.hasMore,!c)break}return{events:l,nextCursor:a,hasMore:c,truncated:x,end:v}}class W{constructor(){S(this,"streams",{stdout:new TextDecoder,stderr:new TextDecoder});S(this,"sequence")}decode(t){return this.sequence!==void 0&&BigInt(t.sequence)!==BigInt(this.sequence)+1n&&this.reset(),this.sequence=t.sequence,this.streams[t.stream].decode(t.data,{stream:!0})}reset(){this.streams={stdout:new TextDecoder,stderr:new TextDecoder},this.sequence=void 0}finish(){return this.streams.stdout.decode()+this.streams.stderr.decode()}}function R(s){return s?new Date(s).toLocaleTimeString():"—"}function T(s,t=0,n=[]){const o=[...s].sort((l,a)=>+(a.status==="running")-+(l.status==="running")||a.startTime-l.startTime);for(const l of o){const{children:a,...c}=l;n.push({...c,args:c.args??[],depth:t}),T(a??[],t+1,n)}return n}function B(s){if(!s.process)throw new Error("This guest process has no actor process handle");return s.process}const Z=64e3;function ee(s,t){const n=t==null?void 0:t.generation,o=t==null?void 0:t.pid,[l,a]=b.useState(""),[c,x]=b.useState(null),[v,j]=b.useState(!1);return b.useEffect(()=>{if(n===void 0||o===void 0)return;let i=!1,u=!1,r,d=!1;const m=new AbortController,h=new W,N=async()=>{if(!(u||i)){u=!0;try{const f=await J(y.processOutputReader(n,o),n,r,m.signal);if(i)return;f.truncated&&j(!0),r=f.nextCursor??r;let E=f.events.map(C=>h.decode(C)).join("");const q=f.truncated?`
|
|
2
|
-
[earlier output was truncated]
|
|
3
|
-
`:"",w=!f.hasMore&&f.end&&!d?`
|
|
4
|
-
[exited ${f.end.exitCode}]`:"";w&&(E+=h.finish()),w&&(d=!0),(E||q||w)&&a(C=>(C+q+E+w).slice(-Z)),x(null)}catch(f){i||x(f)}finally{u=!1}}};N();const k=window.setInterval(()=>void N(),2e3);return()=>{i=!0,m.abort(),window.clearInterval(k)}},[s,n,o]),{output:l,error:c,historyTruncated:v}}function p({label:s,value:t}){return e.jsxs("div",{className:"min-w-0",children:[e.jsx("div",{className:"text-muted-foreground/70",children:s}),e.jsx("div",{className:"truncate font-mono",title:t,children:t})]})}function te({actorId:s,p:t,onStop:n,onKill:o,actionError:l}){const a=ee(s,t.process),{armed:c,confirm:x}=Y({resetKey:g(t)});return e.jsxs("div",{className:"flex flex-col gap-3 px-4 py-3 text-xs",children:[e.jsxs("div",{className:"grid grid-cols-2 gap-x-8 gap-y-2 sm:grid-cols-4",children:[e.jsx(p,{label:"ppid",value:t.ppid?String(t.ppid):"—"}),e.jsx(p,{label:"cwd",value:t.cwd||"—"}),e.jsx(p,{label:"driver",value:t.driver||"—"}),e.jsx(p,{label:"exit code",value:t.exitCode==null?"—":String(t.exitCode)}),e.jsx(p,{label:"args",value:t.args.join(" ")||"—"}),e.jsx(p,{label:"first seen",value:R(t.startTime)}),e.jsx(p,{label:"exit observed",value:t.exitTime==null?"—":F(t.exitTime)}),e.jsx(p,{label:"group / session",value:`${t.pgid} / ${t.sid}`})]}),t.status==="running"&&t.process?e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("button",{type:"button",onClick:()=>x("stop",n),className:"rounded border px-2 py-0.5 text-muted-foreground transition-colors hover:bg-muted hover:text-foreground",children:c==="stop"?"Confirm stop?":"Stop"}),e.jsx("button",{type:"button",onClick:()=>x("kill",o),className:"rounded border border-destructive/40 px-2 py-0.5 text-destructive transition-colors hover:bg-destructive/10",children:c==="kill"?"Confirm kill?":"Kill"})]}):null,t.process?null:e.jsx("div",{className:"text-muted-foreground/60",children:"Control and output replay are available only for processes started through this actor."}),l?e.jsx(I,{error:l,className:"p-0"}):null,a.error?e.jsx(I,{error:a.error,className:"p-0"}):null,a.historyTruncated?e.jsx("div",{className:"text-muted-foreground",children:"Some earlier output is no longer available."}):null,a.output?e.jsxs("div",{children:[e.jsx("div",{className:"mb-1 text-muted-foreground/70",children:"Output (replay, latest 64,000 characters)"}),e.jsx("pre",{className:"max-h-48 overflow-y-auto whitespace-pre-wrap break-words rounded bg-muted/50 p-2 font-mono text-[11px] leading-relaxed",children:a.output})]}):t.process?e.jsx("div",{className:"text-muted-foreground/60",children:"No captured output for this process."}):null]})}function ie(s){const{data:t}=O(y.processTreeQueryOptions(s)),n=T(t);return{running:n.filter(o=>o.status==="running").length,total:n.length}}function se({actorId:s}){const{data:t}=O(y.processTreeQueryOptions(s)),n=M(),[o,l]=b.useState(null),[a,c]=b.useState(null),x=T(t),j=$().useEvent;j("processExit",r=>{const d=r;!d||typeof d.pid!="number"||n.invalidateQueries({queryKey:y.processTreeQueryOptions(s).queryKey})});const i=()=>n.invalidateQueries({queryKey:y.processTreeQueryOptions(s).queryKey}),u=async r=>{c(null);try{await r(),await i()}catch(d){c(d)}};return x.length===0?e.jsx("div",{className:"px-4 py-3 text-sm text-muted-foreground",children:"No processes in the VM."}):e.jsx("div",{className:"max-h-96 overflow-y-auto",children:e.jsxs("table",{className:"w-full text-sm",children:[e.jsx("thead",{className:"sticky top-0 bg-secondary text-[11px] text-muted-foreground",children:e.jsxs("tr",{className:"border-b",children:[e.jsx("th",{className:"w-8 px-3 py-2","aria-label":"Expand"}),e.jsx("th",{className:"w-16 px-2 py-2 text-left font-medium",children:"PID"}),e.jsx("th",{className:"px-2 py-2 text-left font-medium",children:"Command"}),e.jsx("th",{className:"w-28 px-2 py-2 text-left font-medium",children:"First seen"}),e.jsx("th",{className:"w-28 px-2 py-2 text-left font-medium",children:"Status"})]})}),e.jsx("tbody",{children:x.map(r=>e.jsxs(_.Fragment,{children:[e.jsxs("tr",{onClick:()=>l(d=>d===g(r)?null:g(r)),className:P("cursor-pointer border-b border-foreground/[0.06] hover:bg-muted/50",o===g(r)&&"bg-muted/40",r.status==="exited"&&"opacity-50"),children:[e.jsx("td",{className:"px-3 py-1.5",children:e.jsx(L,{className:P("size-3 text-muted-foreground/60 transition-transform",o===g(r)&&"rotate-90")})}),e.jsx("td",{className:"px-2 py-1.5 font-mono",children:r.pid}),e.jsx("td",{className:"px-2 py-1.5 font-mono text-xs",children:e.jsxs("span",{style:{paddingLeft:`${r.depth*14}px`},children:[r.depth>0?e.jsx("span",{className:"text-muted-foreground/40",children:"└ "}):null,r.command,r.args.length>0?e.jsxs("span",{className:"text-muted-foreground/60",children:[" ",r.args.join(" ")]}):null]})}),e.jsx("td",{className:"px-2 py-1.5 font-mono text-xs text-muted-foreground",children:R(r.startTime)}),e.jsx("td",{className:"px-2 py-1.5",children:e.jsxs("span",{className:"inline-flex items-center gap-1.5 text-xs",children:[e.jsx(K,{color:r.status==="running"?"green":"muted"}),r.status]})})]}),o===g(r)?e.jsx("tr",{className:"border-b border-foreground/[0.06] bg-muted/20",children:e.jsx("td",{colSpan:5,children:e.jsx(te,{actorId:s,p:r,onStop:()=>void u(()=>{const d=B(r);return y.stopProcess(d.generation,d.pid)}),onKill:()=>void u(()=>{const d=B(r);return y.killProcess(d.generation,d.pid)}),actionError:a},`${s}:${g(r)}`)})}):null]},g(r)))})]})})}function de({actorId:s}){return e.jsxs("div",{className:"relative h-full min-h-0 overflow-auto p-4",children:[e.jsxs("div",{className:"mb-3 flex items-center gap-2",children:[e.jsx("h1",{className:"text-sm font-semibold",children:"Processes"}),e.jsx("span",{className:"ml-auto"}),e.jsx(X,{actorId:s})]}),e.jsx("div",{className:"overflow-hidden rounded-lg border bg-secondary",children:e.jsx(se,{actorId:s})})]})}export{se as ProcessTable,de as ProcessesTabConnected,ie as useProcessCounts};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
var oe=s=>{throw TypeError(s)};var I=(s,e,t)=>e.has(s)||oe("Cannot "+t);var f=(s,e,t)=>(I(s,e,"read from private field"),t?t.call(s):e.get(s)),N=(s,e,t)=>e.has(s)?oe("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(s):e.set(s,t),C=(s,e,t,n)=>(I(s,e,"write to private field"),n?n.call(s,t):e.set(s,t),t),S=(s,e,t)=>(I(s,e,"access private method"),t);import{S as Oe,n as U,s as Ee,i as ke,u as ge,k as Pe,r as h,l as _e,m as Me,j as r,d as G,o as F,p as Ve,a as z,q as ae,C as Qe,t as Ae}from"./index-bwUfaXzS.js";import{Q as xe,c as Te,e as Be,d as qe,f as Le,s as ie,g as ze,h as He,i as Fe,u as K,j as ve,a as H,V as $e}from"./vm-status-badges-C7eIpgyG.js";import{u as Z}from"./useMutation-CmlocRNE.js";import{u as $,P as te,c as De,a as Ie,b as Ue,d as Ge,S as Ke}from"./scroll-area-BN1MPKEE.js";import{useProcessCounts as Ze,ProcessTable as We}from"./processes-CZ6M0f6m.js";import"./hooks-DaKa0v02.js";function le(s,e){const t=new Set(e);return s.filter(n=>!t.has(n))}var _,w,M,k,j,P,Q,A,T,B,v,W,J,be,X,Y,ee,pe,Je=(pe=class extends Oe{constructor(e,t,n){super();N(this,v);N(this,_);N(this,w);N(this,M);N(this,k);N(this,j);N(this,P);N(this,Q);N(this,A);N(this,T);N(this,B,[]);C(this,_,e),C(this,k,n),C(this,M,[]),C(this,j,[]),C(this,w,[]),this.setQueries(t)}onSubscribe(){this.listeners.size===1&&f(this,j).forEach(e=>{e.subscribe(t=>{S(this,v,Y).call(this,e,t)})})}onUnsubscribe(){this.listeners.size||this.destroy()}destroy(){this.listeners=new Set,f(this,j).forEach(e=>{e.destroy()})}setQueries(e,t){C(this,M,e),C(this,k,t),U.batch(()=>{const n=f(this,j),o=S(this,v,X).call(this,f(this,M));o.forEach(u=>u.observer.setOptions(u.defaultedQueryOptions));const a=o.map(u=>u.observer),l=a.map(u=>u.getCurrentResult()),i=n.length!==a.length,c=a.some((u,p)=>u!==n[p]),d=i||c,m=d?!0:l.some((u,p)=>{const b=f(this,w)[p];return!b||!Ee(u,b)});!d&&!m||(d&&(C(this,B,o),C(this,j,a)),C(this,w,l),this.hasListeners()&&(d&&(le(n,a).forEach(u=>{u.destroy()}),le(a,n).forEach(u=>{u.subscribe(p=>{S(this,v,Y).call(this,u,p)})})),S(this,v,ee).call(this)))})}getCurrentResult(){return f(this,w)}getQueries(){return f(this,j).map(e=>e.getCurrentQuery())}getObservers(){return f(this,j)}getOptimisticResult(e,t){const n=S(this,v,X).call(this,e),o=n.map(l=>l.observer.getOptimisticResult(l.defaultedQueryOptions)),a=n.map(l=>l.defaultedQueryOptions.queryHash);return[o,l=>S(this,v,J).call(this,l??o,t,a),()=>S(this,v,W).call(this,o,n)]}},_=new WeakMap,w=new WeakMap,M=new WeakMap,k=new WeakMap,j=new WeakMap,P=new WeakMap,Q=new WeakMap,A=new WeakMap,T=new WeakMap,B=new WeakMap,v=new WeakSet,W=function(e,t){const n=new Set;return t.map((o,a)=>{const l=e[a];return o.defaultedQueryOptions.notifyOnChangeProps?l:o.observer.trackResult(l,i=>{n.has(i)||(n.add(i),t.forEach(c=>{c.observer.trackProp(i)}))})})},J=function(e,t,n){if(t){const o=f(this,T),a=n!==void 0&&o!==void 0&&(o.length!==n.length||n.some((l,i)=>l!==o[i]));return(f(this,w)!==f(this,A)||a||t!==f(this,Q))&&(C(this,Q,t),C(this,A,f(this,w)),n!==void 0&&C(this,T,n),C(this,P,ke(f(this,P),t(e)))),f(this,P)}return e},be=function(){var e;return!((e=f(this,k))!=null&&e.combine)||f(this,j).some((t,n)=>{var o;return t.options.suspense&&((o=f(this,w)[n])==null?void 0:o.data)===void 0})},X=function(e){const t=new Map;f(this,j).forEach(o=>{const a=o.options.queryHash;if(!a)return;const l=t.get(a);l?l.push(o):t.set(a,[o])});const n=[];return e.forEach(o=>{var i;const a=f(this,_).defaultQueryOptions(o),l=((i=t.get(a.queryHash))==null?void 0:i.shift())??new xe(f(this,_),a);n.push({defaultedQueryOptions:a,observer:l})}),n},Y=function(e,t){const n=f(this,j).indexOf(e);n!==-1&&(C(this,w,f(this,w).slice()),f(this,w)[n]=t,S(this,v,ee).call(this))},ee=function(){var e;if(this.hasListeners()){const t=S(this,v,be).call(this),n=f(this,P),o=t?n:S(this,v,J).call(this,S(this,v,W).call(this,f(this,w),f(this,B)),(e=f(this,k))==null?void 0:e.combine);(t||n!==o)&&U.batch(()=>{this.listeners.forEach(a=>{a(f(this,w))})})}},pe);function Xe({queries:s,...e},t){const n=ge(),o=Te(),a=Pe(),l=e.subscribed!==!1,i=h.useMemo(()=>s.map(x=>{const g=n.defaultQueryOptions(x);return g._optimisticResults=o?"isRestoring":l?"optimistic":void 0,g}),[s,n,o,l]);i.forEach(x=>{Be(x);const g=n.getQueryCache().get(x.queryHash);qe(x,a,g)}),Le(a);const[c]=h.useState(()=>new Je(n,i,e)),[d,m,u]=c.getOptimisticResult(i,e.combine),p=!o&&l;h.useSyncExternalStore(h.useCallback(x=>p?c.subscribe(U.batchCalls(x)):_e,[c,p]),()=>c.getCurrentResult(),()=>c.getCurrentResult()),h.useEffect(()=>{c.setQueries(i,e)},[i,e,c]);const b=d.some((x,g)=>ie(i[g],x))?d.flatMap((x,g)=>{const y=i[g];if(y&&ie(y,x)){const O=new xe(n,y);return ze(y,O,a)}return[]}):[];if(b.length>0)throw Promise.all(b);const R=d.find((x,g)=>{const y=i[g];return y&&He({result:x,errorResetBoundary:a,throwOnError:y.throwOnError,query:n.getQueryCache().get(y.queryHash),suspense:y.suspense})});if(R)throw R.error;return m(u())}function Ye(s,e){return Xe({...s,queries:s.queries.map(t=>({...t,suspense:!0,throwOnError:Fe,enabled:!0,placeholderData:void 0}))})}const ce=s=>typeof s=="boolean"?`${s}`:s===0?"0":s,ue=Me,e0=(s,e)=>t=>{var n;if((e==null?void 0:e.variants)==null)return ue(s,t==null?void 0:t.class,t==null?void 0:t.className);const{variants:o,defaultVariants:a}=e,l=Object.keys(o).map(d=>{const m=t==null?void 0:t[d],u=a==null?void 0:a[d];if(m===null)return null;const p=ce(m)||ce(u);return o[d][p]}),i=t&&Object.entries(t).reduce((d,m)=>{let[u,p]=m;return p===void 0||(d[u]=p),d},{}),c=e==null||(n=e.compoundVariants)===null||n===void 0?void 0:n.reduce((d,m)=>{let{class:u,className:p,...b}=m;return Object.entries(b).every(R=>{let[x,g]=R;return Array.isArray(g)?g.includes({...a,...i}[x]):{...a,...i}[x]===g})?[...d,u,p]:d},[]);return ue(s,l,c,t==null?void 0:t.class,t==null?void 0:t.className)},t0=e0("inline-flex items-center tracking-normal rounded-full border px-2.5 py-0.5 text-xs font-semibold transition-colors whitespace-nowrap max-w-full overflow-hidden truncate",{variants:{variant:{secondary:"border-transparent bg-secondary text-secondary-foreground",outline:"text-foreground"}},defaultVariants:{variant:"secondary"}});function ye({className:s,variant:e,...t}){return r.jsx("div",{className:G(t0({variant:e}),s),...t})}var s0=Object.defineProperty,r0=(s,e)=>s0(s,"name",{value:e,configurable:!0}),de=F[" useEffectEvent ".trim().toString()],he=F[" useInsertionEffect ".trim().toString()];function Ce(s){if(typeof de=="function")return de(s);const e=h.useRef(()=>{throw new Error("Cannot call an event handler while rendering.")});return typeof he=="function"?he(()=>{e.current=s}):$(()=>{e.current=s}),h.useMemo(()=>(...t)=>{var n;return(n=e.current)==null?void 0:n.call(e,...t)},[])}r0(Ce,"useEffectEvent");var n0=Object.defineProperty,q=(s,e)=>n0(s,"name",{value:e,configurable:!0}),o0=F[" useInsertionEffect ".trim().toString()]||$;function we({prop:s,defaultProp:e,onChange:t=q(()=>{},"onChange"),caller:n}){const[o,a,l]=je({defaultProp:e,onChange:t}),i=s!==void 0,c=i?s:o,d=h.useCallback(m=>{var u;if(i){const p=Ne(m)?m(s):m;p!==s&&((u=l.current)==null||u.call(l,p))}else a(m)},[i,s,a,l]);return[c,d]}q(we,"useControllableState");function je({defaultProp:s,onChange:e}){const[t,n]=h.useState(s),o=h.useRef(t),a=h.useRef(e);return o0(()=>{a.current=e},[e]),h.useEffect(()=>{var l;o.current!==t&&((l=a.current)==null||l.call(a,t),o.current=t)},[t,o]),[t,n,a]}q(je,"useUncontrolledState");function Ne(s){return typeof s=="function"}q(Ne,"isFunction");var fe=Symbol("RADIX:SYNC_STATE");function a0(s,e,t,n){const{prop:o,defaultProp:a,onChange:l,caller:i}=e,c=o!==void 0,d=Ce(l),m=[{...t,state:a}];n&&m.push(n);const[u,p]=h.useReducer((g,y)=>{if(y.type===fe)return{...g,state:y.state};const O=s(g,y);return c&&!Object.is(O.state,g.state)&&d(O.state),O},...m),b=u.state,R=h.useRef(b);h.useEffect(()=>{R.current!==b&&(R.current=b,c||d(b))},[b,R,c]);const x=h.useMemo(()=>o!==void 0?{...u,state:o}:u,[u,o]);return h.useEffect(()=>{c&&!Object.is(o,u.state)&&p({type:fe,state:o})},[o,u.state,c]),[x,p]}q(a0,"useControllableStateReducer");var i0=Object.defineProperty,l0=(s,e)=>i0(s,"name",{value:e,configurable:!0}),c0=F[" useId ".trim().toString()]||(()=>{}),u0=0;function Se(s){const[e,t]=h.useState(c0());return $(()=>{s||t(n=>n??String(u0++))},[s]),s||(e?`radix-${e}`:"")}l0(Se,"useId");var d0=Object.defineProperty,L=(s,e)=>d0(s,"name",{value:e,configurable:!0}),se="Collapsible",[h0,U0]=Ge(se),[f0,re]=h0(se),m0=h.forwardRef(L(function(e,t){const{__scopeCollapsible:n,open:o,defaultOpen:a,disabled:l,onOpenChange:i,...c}=e,[d,m]=we({prop:o,defaultProp:a??!1,onChange:i,caller:se});return r.jsx(f0,{scope:n,disabled:l,contentId:Se(),open:d,onOpenToggle:h.useCallback(()=>m(u=>!u),[m]),children:r.jsx(te.div,{"data-state":D(d),"data-disabled":l?"":void 0,...c,ref:t})})},"Collapsible")),p0="CollapsibleTrigger",g0=h.forwardRef(L(function(e,t){const{__scopeCollapsible:n,...o}=e,a=re(p0,n);return r.jsx(te.button,{type:"button","aria-controls":a.open?a.contentId:void 0,"aria-expanded":a.open||!1,"data-state":D(a.open),"data-disabled":a.disabled?"":void 0,disabled:a.disabled,...o,ref:t,onClick:De(e.onClick,a.onOpenToggle)})},"CollapsibleTrigger")),Re="CollapsibleContent",x0=h.forwardRef(L(function(e,t){const{forceMount:n,...o}=e,a=re(Re,e.__scopeCollapsible);return r.jsx(Ie,{present:n||a.open,children:({present:l})=>r.jsx(v0,{...o,ref:t,present:l})})},"CollapsibleContent")),v0=h.forwardRef(L(function(e,t){const{__scopeCollapsible:n,present:o,children:a,...l}=e,i=re(Re,n),[c,d]=h.useState(o),m=h.useRef(null),u=Ue(t,m),p=h.useRef(0),b=p.current,R=h.useRef(0),x=R.current,g=i.open||c,y=h.useRef(g),O=h.useRef(void 0);return h.useEffect(()=>{const E=requestAnimationFrame(()=>y.current=!1);return()=>cancelAnimationFrame(E)},[]),$(()=>{const E=m.current;if(E){O.current=O.current||{transitionDuration:E.style.transitionDuration,animationName:E.style.animationName},E.style.transitionDuration="0s",E.style.animationName="none";const ne=E.getBoundingClientRect();p.current=ne.height,R.current=ne.width,y.current||(E.style.transitionDuration=O.current.transitionDuration,E.style.animationName=O.current.animationName),d(o)}},[i.open,o]),r.jsx(te.div,{"data-state":D(i.open),"data-disabled":i.disabled?"":void 0,id:i.contentId,hidden:!g,...l,ref:u,style:{"--radix-collapsible-content-height":b?`${b}px`:void 0,"--radix-collapsible-content-width":x?`${x}px`:void 0,...e.style},children:g&&a})},"CollapsibleContentImpl"));function D(s){return s?"open":"closed"}L(D,"getState");var b0=m0;const y0=b0,C0=g0,w0=x0,j0="data:image/svg+xml,%3csvg%20width='100'%20height='100'%20viewBox='0%200%20100%20100'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cg%20clip-path='url(%23clip0_2212_248)'%3e%3cpath%20d='M0%200H100V100H0V0Z'%20fill='%23F03603'/%3e%3cpath%20d='M36%2072.2222V27.7778H51.2381C57.5873%2027.7778%2062.6667%2032.8571%2062.6667%2039.2063V41.746C62.6667%2044.6667%2061.5873%2047.3968%2059.7461%2049.3651C62.2858%2051.4603%2063.9366%2054.6349%2063.9366%2058.254V60.7936C63.9366%2067.1428%2058.8572%2072.2222%2052.508%2072.2222H36ZM42.3493%2065.873H52.508C55.3651%2065.873%2057.5873%2063.6508%2057.5873%2060.7936V58.254C57.5873%2055.3968%2055.3651%2053.1746%2052.508%2053.1746H42.3493V65.873ZM42.3493%2046.8254H51.2381C54.0953%2046.8254%2056.3175%2044.6032%2056.3175%2041.746V39.2063C56.3175%2036.3492%2054.0953%2034.127%2051.2381%2034.127H42.3493V46.8254Z'%20fill='white'/%3e%3c/g%3e%3cdefs%3e%3cclipPath%20id='clip0_2212_248'%3e%3crect%20width='100'%20height='100'%20fill='white'/%3e%3c/clipPath%3e%3c/defs%3e%3c/svg%3e",N0=""+new URL("coreutils-CQXb6ysD.svg",import.meta.url).href,S0="data:image/svg+xml,%3csvg%20fill='%23073551'%20role='img'%20viewBox='0%200%2024%2024'%20xmlns='http://www.w3.org/2000/svg'%3e%3ctitle%3ecurl%3c/title%3e%3cpath%20d='M.803%2014.8169c0-.5342.433-.9665.9665-.9665.5335%200%20.9665.4323.9665.9665%200%20.5335-.433.9657-.9665.9657-.5335%200-.9666-.4322-.9666-.9657m2.736%200c0-.1963-.0532-.376-.1119-.5525-.2344-.7024-.876-1.2169-1.6575-1.2169-.1249%200-.2344.0465-.3524.0708C.6149%2013.2865%200%2013.9646%200%2014.817c0%20.9764.7923%201.7694%201.7695%201.7694.9772%200%201.7694-.793%201.7694-1.7694m-1.7694-7.149c.5335%200%20.9665.433.9665.9665%200%20.5335-.433.9665-.9665.9665-.5343%200-.9666-.433-.9666-.9665%200-.5335.4323-.9665.9666-.9665m0%202.7359c.9772%200%201.7694-.7923%201.7694-1.7694%200-.1956-.0532-.376-.1119-.5525-.2344-.7024-.8767-1.2169-1.6575-1.2169-.1249%200-.2344.0465-.3524.0716C.6149%207.104%200%207.782%200%208.6344c0%20.9771.7923%201.7694%201.7695%201.7694m13.221-5.694c-.5342%200-.9665-.433-.9665-.9664a.966.966%200%2001.9666-.9665c.5335%200%20.9658.4322.9658.9665%200%20.5334-.4323.9664-.9658.9664m-9.6%2016.5133c-.5335%200-.9666-.433-.9666-.9665%200-.5342.433-.9665.9666-.9665a.966.966%200%2001.9665.9665c0%20.5335-.4323.9665-.9665.9665m9.6-19.2491c-.978%200-1.7695.7922-1.7695%201.7694%200%20.2085.0525.4025.1187.5882L5.039%2018.5581c-.803.1681-1.4179.8462-1.4179%201.6985%200%20.9772.7923%201.7694%201.7695%201.7694.9772%200%201.7694-.7922%201.7694-1.7694%200-.1963-.0525-.3759-.111-.5525l8.3427-14.2728c.7778-.1865%201.3683-.8531%201.3683-1.688%200-.977-.793-1.7693-1.7694-1.7693m7.24%202.7359c-.5343%200-.9666-.433-.9666-.9665a.966.966%200%2001.9665-.9665c.5335%200%20.9666.4322.9666.9665%200%20.5334-.433.9665-.9666.9665M12.6313%2021.223c-.5343%200-.9665-.433-.9665-.9665a.966.966%200%2001.9665-.9665c.5335%200%20.9658.4323.9658.9665%200%20.5335-.4323.9665-.9658.9665M22.2305%201.974c-.9772%200-1.7694.7922-1.7694%201.7694%200%20.2085.0525.4025.1187.5882l-8.3009%2014.2265c-.8021.1681-1.417.8462-1.417%201.6985%200%20.9772.7922%201.7694%201.7694%201.7694.9764%200%201.7687-.7922%201.7687-1.7694%200-.1963-.0525-.3759-.1111-.5525l8.3427-14.2728C23.4094%205.2448%2024%204.5782%2024%203.7433c0-.977-.7923-1.7693-1.7695-1.7693'/%3e%3c/svg%3e",R0="data:image/svg+xml,%3csvg%20fill='%23FFF000'%20role='img'%20viewBox='0%200%2024%2024'%20xmlns='http://www.w3.org/2000/svg'%3e%3ctitle%3eDuckDB%3c/title%3e%3cpath%20d='M12%200C5.363%200%200%205.363%200%2012s5.363%2012%2012%2012%2012-5.363%2012-12S18.637%200%2012%200zM9.502%207.03a4.974%204.974%200%200%201%204.97%204.97%204.974%204.974%200%200%201-4.97%204.97A4.974%204.974%200%200%201%204.532%2012a4.974%204.974%200%200%201%204.97-4.97zm6.563%203.183h2.351c.98%200%201.787.782%201.787%201.762s-.807%201.789-1.787%201.789h-2.351v-3.551z'/%3e%3c/svg%3e",O0="data:image/svg+xml,%3csvg%20fill='%23F03C2E'%20role='img'%20viewBox='0%200%2024%2024'%20xmlns='http://www.w3.org/2000/svg'%3e%3ctitle%3eGit%3c/title%3e%3cpath%20d='M13.09%2023.549a1.54%201.54%200%200%201-2.18%200L.451%2013.089a1.54%201.54%200%200%201%200-2.179l7.191-7.19%202.733%202.733a1.85%201.85%200%200%200%20.964%202.326v6.66a1.849%201.849%200%201%200%201.54%200V8.957l2.508%202.508a1.85%201.85%200%201%200%201.09-1.09l-2.634-2.634a1.85%201.85%200%200%200-2.378-2.377L8.73%202.63%2010.91.451a1.54%201.54%200%200%201%202.179%200l10.459%2010.46a1.54%201.54%200%200%201%200%202.179z'/%3e%3c/svg%3e",E0="data:image/svg+xml,%3csvg%20width='400'%20height='220'%20version='1.0'%20viewBox='0%200%20400%20220'%20xmlns='http://www.w3.org/2000/svg'%3e%3cstyle%3e@media%20(prefers-color-scheme:dark){g[fill]{filter:invert(1);stroke:none}}%3c/style%3e%3cg%20transform='scale(.1)'%20stroke='%23fff'%20stroke-width='10'%3e%3cg%20fill='%23444'%3e%3ccircle%20cx='220'%20cy='1570'%20r='190'/%3e%3cpath%20d='m1330%20312c-30%2041-698%201492-710%201528s25%2066%20100%20101c77%2036%20102%2034%20124%203s701-1477%20716-1525c15-47-20-73-84-104s-116-44-146-3z'/%3e%3c/g%3e%3cg%20fill='%23111'%3e%3ccircle%20cx='2410'%20cy='200'%20r='190'/%3e%3cpath%20d='m1830%20655c0%20129%200%20130%2070%20130h360v423c0%20246-5%20474-10%20506-19%20112-88%20176-190%20176-59%200-120-27-147-66-51-73-65-84-99-84-31%200-40%208-104%2093-84%20111-86%20129-32%20189%20227%20252%20692%20187%20836-118%2053-112%2056-153%2056-795v-514c0-64-30-100-100-100h-490c-149%200-150%200-150%20160zM2867%201233c30%20302%20250%20499%20438%20527%20144%2019%20244%200%20375-90v410c0%2081%200%20100%20150%20100%20136%200%20150-20%20150-150v-1420c0-99-19-100-150-100s-139%2015-139%2082c-103-89-351-149-523-49s-342%20278-301%20690zm803-107c0%20292-105%20356-237%20356-178%200-249-147-273-296-27-168%2025-420%20262-420%20171%200%20248%2089%20248%20360z'/%3e%3c/g%3e%3c/g%3e%3c/svg%3e",me="data:image/svg+xml,%3csvg%20fill='%235FA04E'%20role='img'%20viewBox='0%200%2024%2024'%20xmlns='http://www.w3.org/2000/svg'%3e%3ctitle%3eNode.js%3c/title%3e%3cpath%20d='M11.998,24c-0.321,0-0.641-0.084-0.922-0.247l-2.936-1.737c-0.438-0.245-0.224-0.332-0.08-0.383%20c0.585-0.203,0.703-0.25,1.328-0.604c0.065-0.037,0.151-0.023,0.218,0.017l2.256,1.339c0.082,0.045,0.197,0.045,0.272,0l8.795-5.076%20c0.082-0.047,0.134-0.141,0.134-0.238V6.921c0-0.099-0.053-0.192-0.137-0.242l-8.791-5.072c-0.081-0.047-0.189-0.047-0.271,0%20L3.075,6.68C2.99,6.729,2.936,6.825,2.936,6.921v10.15c0,0.097,0.054,0.189,0.139,0.235l2.409,1.392%20c1.307,0.654,2.108-0.116,2.108-0.89V7.787c0-0.142,0.114-0.253,0.256-0.253h1.115c0.139,0,0.255,0.112,0.255,0.253v10.021%20c0,1.745-0.95,2.745-2.604,2.745c-0.508,0-0.909,0-2.026-0.551L2.28,18.675c-0.57-0.329-0.922-0.945-0.922-1.604V6.921%20c0-0.659,0.353-1.275,0.922-1.603l8.795-5.082c0.557-0.315,1.296-0.315,1.848,0l8.794,5.082c0.57,0.329,0.924,0.944,0.924,1.603%20v10.15c0,0.659-0.354,1.273-0.924,1.604l-8.794,5.078C12.643,23.916,12.324,24,11.998,24z%20M19.099,13.993%20c0-1.9-1.284-2.406-3.987-2.763c-2.731-0.361-3.009-0.548-3.009-1.187c0-0.528,0.235-1.233,2.258-1.233%20c1.807,0,2.473,0.389,2.747,1.607c0.024,0.115,0.129,0.199,0.247,0.199h1.141c0.071,0,0.138-0.031,0.186-0.081%20c0.048-0.054,0.074-0.123,0.067-0.196c-0.177-2.098-1.571-3.076-4.388-3.076c-2.508,0-4.004,1.058-4.004,2.833%20c0,1.925,1.488,2.457,3.895,2.695c2.88,0.282,3.103,0.703,3.103,1.269c0,0.983-0.789,1.402-2.642,1.402%20c-2.327,0-2.839-0.584-3.011-1.742c-0.02-0.124-0.126-0.215-0.253-0.215h-1.137c-0.141,0-0.254,0.112-0.254,0.253%20c0,1.482,0.806,3.248,4.655,3.248C17.501,17.007,19.099,15.91,19.099,13.993z'/%3e%3c/svg%3e",k0="data:image/svg+xml,%3csvg%20fill='%233776AB'%20role='img'%20viewBox='0%200%2024%2024'%20xmlns='http://www.w3.org/2000/svg'%3e%3ctitle%3ePython%3c/title%3e%3cpath%20d='M14.25.18l.9.2.73.26.59.3.45.32.34.34.25.34.16.33.1.3.04.26.02.2-.01.13V8.5l-.05.63-.13.55-.21.46-.26.38-.3.31-.33.25-.35.19-.35.14-.33.1-.3.07-.26.04-.21.02H8.77l-.69.05-.59.14-.5.22-.41.27-.33.32-.27.35-.2.36-.15.37-.1.35-.07.32-.04.27-.02.21v3.06H3.17l-.21-.03-.28-.07-.32-.12-.35-.18-.36-.26-.36-.36-.35-.46-.32-.59-.28-.73-.21-.88-.14-1.05-.05-1.23.06-1.22.16-1.04.24-.87.32-.71.36-.57.4-.44.42-.33.42-.24.4-.16.36-.1.32-.05.24-.01h.16l.06.01h8.16v-.83H6.18l-.01-2.75-.02-.37.05-.34.11-.31.17-.28.25-.26.31-.23.38-.2.44-.18.51-.15.58-.12.64-.1.71-.06.77-.04.84-.02%201.27.05zm-6.3%201.98l-.23.33-.08.41.08.41.23.34.33.22.41.09.41-.09.33-.22.23-.34.08-.41-.08-.41-.23-.33-.33-.22-.41-.09-.41.09zm13.09%203.95l.28.06.32.12.35.18.36.27.36.35.35.47.32.59.28.73.21.88.14%201.04.05%201.23-.06%201.23-.16%201.04-.24.86-.32.71-.36.57-.4.45-.42.33-.42.24-.4.16-.36.09-.32.05-.24.02-.16-.01h-8.22v.82h5.84l.01%202.76.02.36-.05.34-.11.31-.17.29-.25.25-.31.24-.38.2-.44.17-.51.15-.58.13-.64.09-.71.07-.77.04-.84.01-1.27-.04-1.07-.14-.9-.2-.73-.25-.59-.3-.45-.33-.34-.34-.25-.34-.16-.33-.1-.3-.04-.25-.02-.2.01-.13v-5.34l.05-.64.13-.54.21-.46.26-.38.3-.32.33-.24.35-.2.35-.14.33-.1.3-.06.26-.04.21-.02.13-.01h5.84l.69-.05.59-.14.5-.21.41-.28.33-.32.27-.35.2-.36.15-.36.1-.35.07-.32.04-.28.02-.21V6.07h2.09l.14.01zm-6.47%2014.25l-.23.33-.08.41.08.41.23.33.33.23.41.08.41-.08.33-.23.23-.33.08-.41-.08-.41-.23-.33-.33-.23-.41-.08-.41.08z'/%3e%3c/svg%3e",P0="data:image/svg+xml,%3csvg%20fill='%23003B57'%20role='img'%20viewBox='0%200%2024%2024'%20xmlns='http://www.w3.org/2000/svg'%3e%3ctitle%3eSQLite%3c/title%3e%3cpath%20d='M21.678.521c-1.032-.92-2.28-.55-3.513.544a8.71%208.71%200%200%200-.547.535c-2.109%202.237-4.066%206.38-4.674%209.544.237.48.422%201.093.544%201.561a13.044%2013.044%200%200%201%20.164.703s-.019-.071-.096-.296l-.05-.146a1.689%201.689%200%200%200-.033-.08c-.138-.32-.518-.995-.686-1.289-.143.423-.27.818-.376%201.176.484.884.778%202.4.778%202.4s-.025-.099-.147-.442c-.107-.303-.644-1.244-.772-1.464-.217.804-.304%201.346-.226%201.478.152.256.296.698.422%201.186.286%201.1.485%202.44.485%202.44l.017.224a22.41%2022.41%200%200%200%20.056%202.748c.095%201.146.273%202.13.5%202.657l.155-.084c-.334-1.038-.47-2.399-.41-3.967.09-2.398.642-5.29%201.661-8.304%201.723-4.55%204.113-8.201%206.3-9.945-1.993%201.8-4.692%207.63-5.5%209.788-.904%202.416-1.545%204.684-1.931%206.857.666-2.037%202.821-2.912%202.821-2.912s1.057-1.304%202.292-3.166c-.74.169-1.955.458-2.362.629-.6.251-.762.337-.762.337s1.945-1.184%203.613-1.72C21.695%207.9%2024.195%202.767%2021.678.521m-18.573.543A1.842%201.842%200%200%200%201.27%202.9v16.608a1.84%201.84%200%200%200%201.835%201.834h9.418a22.953%2022.953%200%200%201-.052-2.707c-.006-.062-.011-.141-.016-.2a27.01%2027.01%200%200%200-.473-2.378c-.121-.47-.275-.898-.369-1.057-.116-.197-.098-.31-.097-.432%200-.12.015-.245.037-.386a9.98%209.98%200%200%201%20.234-1.045l.217-.028c-.017-.035-.014-.065-.031-.097l-.041-.381a32.8%2032.8%200%200%201%20.382-1.194l.2-.019c-.008-.016-.01-.038-.018-.053l-.043-.316c.63-3.28%202.587-7.443%204.8-9.791.066-.069.133-.128.198-.194Z'/%3e%3c/svg%3e",_0={coreutils:"dark:brightness-[1.8]",curl:"dark:brightness-[2.6]",sqlite3:"dark:brightness-[2.6]",duckdb:"dark:invert",jq:"dark:invert"},M0={browserbase:j0,coreutils:N0,curl:S0,duckdb:R0,git:O0,jq:E0,node:me,nodejs:me,python:k0,sqlite3:P0};function V0({bundle:s}){const[e,t]=h.useState(!1),n=s.binaries.length>0,o=M0[s.slug];return r.jsxs(y0,{open:e,onOpenChange:t,className:"border-none",children:[r.jsxs(C0,{className:"flex w-full items-center gap-2 px-4 py-3 text-left transition-colors hover:bg-muted/50",disabled:!n,children:[r.jsx(Qe,{className:G("size-3 shrink-0 text-muted-foreground transition-transform",e&&"rotate-90",!n&&"opacity-0")}),r.jsx("span",{className:"flex size-6 shrink-0 items-center justify-center overflow-hidden rounded border bg-white/90 dark:bg-muted/60",children:o?r.jsx("img",{src:o,alt:"",className:G("size-4",_0[s.slug])}):r.jsx("span",{className:"text-[11px] font-medium text-black/60 dark:text-muted-foreground",children:s.slug.charAt(0)})}),r.jsx("span",{className:"flex-1 truncate font-mono text-sm",children:s.name}),n?r.jsxs("span",{className:"text-[11px] tabular-nums text-muted-foreground/70",children:[s.binaries.length," cmd",s.binaries.length===1?"":"s"]}):null,r.jsx("span",{className:"text-xs tabular-nums text-muted-foreground",children:s.version}),r.jsx(ye,{variant:s.source==="user"?"outline":"secondary",children:s.source})]}),n?r.jsx(w0,{children:r.jsx("div",{className:"flex flex-wrap gap-1.5 px-4 pb-3 pl-9",children:s.binaries.map(a=>r.jsx("span",{className:"rounded bg-muted px-1.5 py-0.5 font-mono text-xs text-muted-foreground",children:a},a))})}):null]})}const Q0=s=>typeof s>"u"||s===null||Object.keys(s).length===0;function A0({mounts:s}){return r.jsxs("table",{className:"w-full text-sm",children:[r.jsx("thead",{className:"text-[11px] text-muted-foreground",children:r.jsxs("tr",{className:"border-b",children:[r.jsx("th",{className:"px-4 py-2 text-left font-medium",children:"Path"}),r.jsx("th",{className:"px-3 py-2 text-left font-medium",children:"Kind"}),r.jsx("th",{className:"px-3 py-2 text-left font-medium",children:"Access"}),r.jsx("th",{className:"px-3 py-2 text-left font-medium",children:"Config"})]})}),r.jsx("tbody",{children:s.map(e=>r.jsxs("tr",{className:"border-b border-foreground/[0.06] align-top last:border-0 hover:bg-muted/50",children:[r.jsx("td",{className:"px-4 py-2 font-mono text-xs",children:e.path}),r.jsx("td",{className:"px-3 py-2",children:r.jsx(ye,{variant:"secondary",className:"font-mono",children:e.kind})}),r.jsx("td",{className:"px-3 py-2 text-xs text-muted-foreground",children:e.readOnly?"read-only":"read-write"}),r.jsx("td",{className:"px-3 py-2",children:Q0(e.config)?r.jsx("span",{className:"text-muted-foreground/60",children:"—"}):r.jsxs("div",{className:"group relative max-w-[20rem]",children:[r.jsx("code",{className:"block overflow-x-auto whitespace-nowrap rounded bg-muted/30 py-1.5 pl-2 pr-7 font-mono text-xs text-muted-foreground",children:JSON.stringify(e.config)}),r.jsx(Ae,{value:JSON.stringify(e.config,null,2),className:"absolute right-1 top-1 bg-background/70 backdrop-blur-sm"})]})})]},e.path))})]})}function T0(){const[s,e]=h.useState("3000"),[t,n]=h.useState([]),o=Z({mutationFn:async i=>{const c=Number.parseInt(i,10);if(!Number.isInteger(c)||c<1||c>65535)throw new Error(`Not a valid port: ${i}`);return H.createSignedPreviewUrl(c,900)},onSuccess:i=>n(c=>[...c.filter(d=>d.token!==i.token),i])}),a=Z({mutationFn:async i=>(await H.expireSignedPreviewUrl(i.token),i),onSuccess:i=>n(c=>c.filter(d=>d.token!==i.token))}),l=o.error??a.error;return r.jsxs("div",{className:"text-xs",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("label",{className:"text-muted-foreground",htmlFor:"agentos-preview-port",children:"Port"}),r.jsx("input",{id:"agentos-preview-port",value:s,onChange:i=>e(i.target.value),onKeyDown:i=>i.key==="Enter"&&o.mutate(s),inputMode:"numeric",className:"w-20 rounded border bg-background px-2 py-1 font-mono focus:outline-none"}),r.jsx("button",{type:"button",disabled:o.isPending,onClick:()=>o.mutate(s),className:"rounded-md border px-2.5 py-1 text-muted-foreground transition-colors hover:bg-muted hover:text-foreground disabled:opacity-40",children:o.isPending?"Creating…":"Create preview link"}),r.jsx("span",{className:"text-muted-foreground/60",children:"Signed URL to an HTTP server on that port, valid 15 minutes. Boots the VM if asleep."})]}),l?r.jsx(z,{error:l,className:"py-2"}):null,t.length>0?r.jsx("div",{className:"mt-2 flex flex-col gap-1",children:t.map(i=>r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsxs("a",{href:i.path,target:"_blank",rel:"noreferrer",className:"truncate font-mono text-primary hover:underline",children:["port ",i.port,": ",i.path]}),r.jsxs("span",{className:"text-muted-foreground/60",children:["expires ",new Date(i.expiresAt).toLocaleTimeString()]}),r.jsx("button",{type:"button",onClick:()=>a.mutate(i),className:"rounded border px-1.5 py-0.5 text-muted-foreground transition-colors hover:bg-muted hover:text-foreground",children:"Revoke"})]},i.token))}):null]})}function V({title:s,right:e,children:t}){return r.jsxs("section",{className:"rounded-xl border bg-secondary p-4",children:[r.jsxs("div",{className:"mb-3 flex items-center gap-2",children:[r.jsx("span",{className:"text-sm font-semibold",children:s}),r.jsx("span",{className:"ml-auto"}),e]}),t]})}function G0({actorId:s}){var t;const e=K(ve(s));return r.jsxs("div",{className:"flex h-full min-h-0 flex-col",children:[r.jsx("div",{className:"mx-auto w-full max-w-4xl shrink-0 px-4 pt-4",children:r.jsx(q0,{actorId:s})}),r.jsx("div",{className:"min-h-0 flex-1",children:r.jsx(Ve,{children:r.jsx(B0,{actorId:s})},String((t=e.data)==null?void 0:t.generation))})]})}function B0({actorId:s}){const[e,t]=Ye({queries:[H.softwareQueryOptions(s),H.mountsQueryOptions(s)]}),n=Ze(s),o=a=>r.jsx("span",{className:"text-xs text-muted-foreground",children:a});return r.jsxs("div",{className:"relative h-full min-h-0",children:[r.jsx("div",{className:"absolute right-3 top-2 z-10",children:r.jsx($e,{actorId:s})}),r.jsx(Ke,{className:"h-full min-h-0",children:r.jsxs("div",{className:"mx-auto flex w-full max-w-4xl flex-col gap-4 px-4 py-4",children:[r.jsx(V,{title:"Processes",right:o(`${n.running} of ${n.total} running`),children:r.jsx("div",{className:"overflow-hidden rounded-lg border",children:r.jsx(We,{actorId:s})})}),r.jsx(V,{title:"Software",right:o(String(e.data.length)),children:e.data.length===0?r.jsx("div",{className:"text-sm text-muted-foreground",children:"No software bundles installed."}):r.jsx("div",{className:"divide-y overflow-hidden rounded-lg border",children:e.data.map(a=>r.jsx(V0,{bundle:a},a.name))})}),r.jsx(V,{title:"Mounts",right:o(String(t.data.length)),children:t.data.length===0?r.jsx("div",{className:"text-sm text-muted-foreground",children:"No mounts configured on this actor."}):r.jsx("div",{className:"overflow-hidden rounded-lg border",children:r.jsx(A0,{mounts:t.data})})}),r.jsx(V,{title:"Preview links",children:r.jsx(T0,{})})]})})]})}function q0({actorId:s}){const e=ge(),t=K(ve(s)),n=K({queryKey:["agentOS",s,"config"],queryFn:()=>ae("v1.config.get",l=>l.v1.config.get({})),refetchInterval:5e3}),o=Z({mutationFn:()=>ae("v1.vm.restart",l=>l.v1.vm.restart({})),onSuccess:()=>e.invalidateQueries({queryKey:["agentOS",s]})}),a=l=>JSON.stringify(l,(i,c)=>typeof c=="bigint"?c.toString():c,2);return r.jsxs(V,{title:"VM status and configuration",right:r.jsx("button",{type:"button",className:"rounded border px-2 py-1 text-xs hover:bg-muted disabled:opacity-50",disabled:o.isPending,onClick:()=>o.mutate(),children:o.isPending?"Restarting…":"Restart VM"}),children:[t.error?r.jsx(z,{error:t.error}):null,n.error?r.jsx(z,{error:n.error}):null,o.error?r.jsx(z,{error:o.error}):null,t.data?r.jsxs("div",{className:"mb-3 text-xs",children:[r.jsx("span",{className:"font-medium",children:t.data.lifecycle}),r.jsxs("span",{className:"ml-2 text-muted-foreground",children:["Generation ",String(t.data.generation)," · Config ",t.data.configState]}),t.data.issues.map((l,i)=>r.jsxs("p",{className:"mt-1 text-destructive",children:[l.code,": ",l.message]},`${l.code}-${i}`))]}):null,n.data?r.jsxs("details",{children:[r.jsxs("summary",{className:"cursor-pointer text-xs",children:["Desired config, revision ",String(n.data.revision)]}),r.jsx("pre",{className:"mt-2 max-h-64 overflow-auto rounded bg-muted p-3 text-xs",children:a(n.data.desired)})]}):null]})}export{G0 as SystemTabConnected};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
var de=t=>{throw TypeError(t)};var $=(t,e,s)=>e.has(t)||de("Cannot "+s);var i=(t,e,s)=>($(t,e,"read from private field"),s?s.call(t):e.get(t)),S=(t,e,s)=>e.has(t)?de("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(t):e.set(t,s),d=(t,e,s,r)=>($(t,e,"write to private field"),r?r.call(t,s):e.set(t,s),s),m=(t,e,s)=>($(t,e,"access private method"),s);import{S as Ce,H as v,s as X,l as Ee,J as Pe,K as _e,L as Ne,M as j,N as Qe,O as Fe,Q as fe,n as Re,r as A,G as Me,k as Le,u as ke,q as f,V as C,W as Ue,w as Be,j as z,y as me}from"./index-bwUfaXzS.js";var E,o,q,R,_,L,O,K,k,U,N,Q,T,B,l,D,Y,J,Z,ee,te,se,re,ie,Se,De=(Se=class extends Ce{constructor(e,s){super();S(this,l);S(this,E);S(this,o);S(this,q);S(this,R);S(this,_);S(this,L);S(this,O);S(this,K);S(this,k);S(this,U);S(this,N);S(this,Q);S(this,T);S(this,B,new Set);this.options=s,d(this,E,e),d(this,O,null),this.bindMethods(),this.setOptions(s)}bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(i(this,o).addObserver(this),pe(i(this,o),this.options)?m(this,l,D).call(this):this.updateResult(),m(this,l,te).call(this))}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return ne(i(this,o),this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return ne(i(this,o),this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,m(this,l,se).call(this),m(this,l,re).call(this),i(this,o).removeObserver(this)}setOptions(e){const s=this.options,r=i(this,o);if(this.options=i(this,E).defaultQueryOptions(e),this.options.enabled!==void 0&&typeof this.options.enabled!="boolean"&&typeof this.options.enabled!="function"&&typeof v(this.options.enabled,i(this,o))!="boolean")throw new Error("Expected enabled to be a boolean or a callback that returns a boolean");m(this,l,ie).call(this),i(this,o).setOptions(this.options),s._defaulted&&!X(this.options,s)&&i(this,E).getQueryCache().notify({type:"observerOptionsUpdated",query:i(this,o),observer:this});const n=this.hasListeners();n&&ye(i(this,o),r,this.options,s)&&m(this,l,D).call(this),this.updateResult(),n&&(i(this,o)!==r||v(this.options.enabled,i(this,o))!==v(s.enabled,i(this,o))||v(this.options.staleTime,i(this,o))!==v(s.staleTime,i(this,o)))&&m(this,l,J).call(this);const a=m(this,l,Z).call(this);n&&(i(this,o)!==r||v(this.options.enabled,i(this,o))!==v(s.enabled,i(this,o))||a!==i(this,T))&&m(this,l,ee).call(this,a)}getOptimisticResult(e){const s=i(this,E).getQueryCache().build(i(this,E),e),r=this.createResult(s,e);return X(this.getCurrentResult(),r)||(d(this,R,r),d(this,L,this.options),d(this,_,i(this,o).state)),r}getCurrentResult(){return i(this,R)}trackResult(e,s){return new Proxy(e,{get:(r,n)=>(this.trackProp(n),s==null||s(n),Reflect.get(r,n))})}trackProp(e){i(this,B).add(e)}getCurrentQuery(){return i(this,o)}refetch({...e}={}){return this.fetch({...e})}fetchOptimistic(e){const s=i(this,E).defaultQueryOptions(e),r=i(this,E).getQueryCache().build(i(this,E),s);let n=()=>{},a;const c=new Promise(u=>{a=u,n=i(this,E).getQueryCache().subscribe(w=>{w.type==="updated"&&w.query.queryHash===r.queryHash&&r.state.data!==void 0&&(n(),u(this.createResult(r,s)))})});return Promise.race([r.fetch().then(()=>{const u=this.createResult(r,s);return a==null||a(u),u}).finally(()=>{n()}),c])}fetch(e){return m(this,l,D).call(this,{...e,cancelRefetch:e.cancelRefetch??!0}).then(()=>(this.updateResult(),i(this,R)))}createResult(e,s){var he;const r=i(this,o),n=this.options,a=i(this,R),c=i(this,_),u=i(this,L),w=e!==r?e.state:i(this,q),{state:p}=e;let h={...p},b=!1,y;if(s._optimisticResults){const I=this.hasListeners(),Te=!I&&pe(e,s),Ae=I&&ye(e,r,s,n);(Te||Ae)&&(h={...h,...Fe(p.data,e.options)}),s._optimisticResults==="isRestoring"&&(h.fetchStatus="idle")}let{error:x,errorUpdatedAt:M,status:g}=h;y=h.data;let F=!1;if(s.placeholderData!==void 0&&y===void 0&&g==="pending"){let I;a!=null&&a.isPlaceholderData&&s.placeholderData===(u==null?void 0:u.placeholderData)?(I=a.data,F=!0):I=typeof s.placeholderData=="function"?s.placeholderData((he=i(this,U))==null?void 0:he.state.data,i(this,U)):s.placeholderData,I!==void 0&&(g="success",y=fe(a==null?void 0:a.data,I,s),b=!0)}if(s.select&&y!==void 0&&!F)if(a&&y===(c==null?void 0:c.data)&&s.select===i(this,K))y=i(this,k);else try{d(this,K,s.select),y=s.select(y),y=fe(a==null?void 0:a.data,y,s),d(this,k,y),d(this,O,null)}catch(I){d(this,O,I)}else y===void 0&&d(this,O,null);i(this,O)&&(x=i(this,O),y=i(this,k),M=Date.now(),g="error",b=!1);const V=h.fetchStatus==="fetching",G=g==="pending",W=g==="error",le=G&&V,ue=y!==void 0;return{status:g,fetchStatus:h.fetchStatus,isPending:G,isSuccess:g==="success",isError:W,isInitialLoading:le,isLoading:le,data:y,dataUpdatedAt:h.dataUpdatedAt,error:x,errorUpdatedAt:M,failureCount:h.fetchFailureCount,failureReason:h.fetchFailureReason,errorUpdateCount:h.errorUpdateCount,isFetched:e.isFetched(),isFetchedAfterMount:h.dataUpdateCount>w.dataUpdateCount||h.errorUpdateCount>w.errorUpdateCount,isFetching:V,isRefetching:V&&!G,isLoadingError:W&&!ue,isPaused:h.fetchStatus==="paused",isPlaceholderData:b,isRefetchError:W&&ue,isStale:ce(e,s),refetch:this.refetch,isEnabled:v(s.enabled,e)!==!1}}updateResult(){const e=i(this,R),s=this.createResult(i(this,o),this.options);if(d(this,_,i(this,o).state),d(this,L,this.options),i(this,_).data!==void 0&&d(this,U,i(this,o)),X(s,e))return;d(this,R,s);const n=(()=>{if(!e)return!0;const{notifyOnChangeProps:a}=this.options,c=typeof a=="function"?a():a;if(c==="all"||!c&&!i(this,B).size)return!0;const u=new Set(c??i(this,B));return this.options.throwOnError&&u.add("error"),Object.keys(i(this,R)).some(w=>{const p=w;return i(this,R)[p]!==e[p]&&u.has(p)})})();Re.batch(()=>{n&&this.listeners.forEach(a=>{a(i(this,R))}),i(this,E).getQueryCache().notify({query:i(this,o),type:"observerResultsUpdated"})})}onQueryUpdate(){this.updateResult(),this.hasListeners()&&m(this,l,te).call(this)}},E=new WeakMap,o=new WeakMap,q=new WeakMap,R=new WeakMap,_=new WeakMap,L=new WeakMap,O=new WeakMap,K=new WeakMap,k=new WeakMap,U=new WeakMap,N=new WeakMap,Q=new WeakMap,T=new WeakMap,B=new WeakMap,l=new WeakSet,D=function(e){m(this,l,ie).call(this);let s=i(this,o).fetch(this.options,e);return e!=null&&e.throwOnError||(s=s.catch(Ee)),s},Y=function(e){return!Pe()&&v(this.options.enabled,i(this,o))!==!1&&_e(e)},J=function(){m(this,l,se).call(this);const e=v(this.options.staleTime,i(this,o));if(i(this,R).isStale||!m(this,l,Y).call(this,e))return;const s=Ne(i(this,R).dataUpdatedAt,e)+1;d(this,N,j.setTimeout(()=>{i(this,R).isStale||this.updateResult()},s))},Z=function(){return v(this.options.refetchInterval,i(this,o))??!1},ee=function(e){m(this,l,re).call(this),d(this,T,e),!(i(this,T)===0||!m(this,l,Y).call(this,i(this,T)))&&d(this,Q,j.setInterval(()=>{(this.options.refetchIntervalInBackground||Qe.isFocused())&&m(this,l,D).call(this)},i(this,T)))},te=function(){m(this,l,J).call(this),m(this,l,ee).call(this,m(this,l,Z).call(this))},se=function(){i(this,N)!==void 0&&(j.clearTimeout(i(this,N)),d(this,N,void 0))},re=function(){i(this,Q)!==void 0&&(j.clearInterval(i(this,Q)),d(this,Q,void 0))},ie=function(){const e=i(this,E).getQueryCache().build(i(this,E),this.options);if(e===i(this,o))return;const s=i(this,o);d(this,o,e),d(this,q,e.state),this.hasListeners()&&(s==null||s.removeObserver(this),e.addObserver(this))},Se);function qe(t,e){return v(e.enabled,t)!==!1&&t.state.data===void 0&&!(t.state.status==="error"&&v(e.retryOnMount,t)===!1)}function pe(t,e){return qe(t,e)||t.state.data!==void 0&&ne(t,e,e.refetchOnMount)}function ne(t,e,s){if(v(e.enabled,t)!==!1&&v(e.staleTime,t)!=="static"){const r=v(s,t);return r==="always"||r!==!1&&ce(t,e)}return!1}function ye(t,e,s,r){return(t!==e||v(r.enabled,t)===!1)&&(!s.suspense||t.state.status!=="error")&&ce(t,s)}function ce(t,e){return v(e.enabled,t)!==!1&&t.isStaleByTime(v(e.staleTime,t))}const xe=A.createContext(!1),Ke=()=>A.useContext(xe);xe.Provider;const je=(t,e,s)=>{const r=s!=null&&s.state.error&&typeof t.throwOnError=="function"?Me(t.throwOnError,[s.state.error,s]):t.throwOnError;(t.suspense||r)&&(e.isReset()||(t.retryOnMount=!1))},ze=t=>{A.useEffect(()=>{t.clearReset()},[t])},He=({result:t,errorResetBoundary:e,throwOnError:s,query:r,suspense:n})=>t.isError&&!e.isReset()&&!t.isFetching&&r&&(n&&t.data===void 0||Me(s,[t.error,r])),ot=(t,e)=>e.state.data===void 0,Ve=t=>{if(t.suspense){const s=n=>n==="static"?n:Math.max(n??1e3,1e3),r=t.staleTime;t.staleTime=typeof r=="function"?(...n)=>s(r(...n)):s(r),typeof t.gcTime=="number"&&(t.gcTime=Math.max(t.gcTime,1e3))}},Ge=(t,e)=>(t==null?void 0:t.suspense)&&e.isPending,We=(t,e,s)=>e.fetchOptimistic(t).catch(()=>{s.clearReset()});function $e(t,e,s){const r=Ke(),n=Le(),a=ke(),c=a.defaultQueryOptions(t),u=a.getQueryCache().get(c.queryHash),w=t.subscribed!==!1;c._optimisticResults=r?"isRestoring":w?"optimistic":void 0,Ve(c),je(c,n,u),ze(n);const[p]=A.useState(()=>new e(a,c)),h=p.getOptimisticResult(c),b=!r&&w;if(A.useSyncExternalStore(A.useCallback(y=>{const x=b?p.subscribe(Re.batchCalls(y)):Ee;return p.updateResult(),x},[p,b]),()=>p.getCurrentResult(),()=>p.getCurrentResult()),A.useEffect(()=>{p.setOptions(c)},[c,p]),Ge(c,h))throw We(c,p,n);if(He({result:h,errorResetBoundary:n,throwOnError:c.throwOnError,query:u,suspense:c.suspense}))throw h.error;return c.notifyOnChangeProps?h:p.trackResult(h)}function Xe(t,e){return $e(t,De)}const P=(t,...e)=>["agentOS",t,...e];function ve(t){if(t instanceof Uint8Array)return t;if(Array.isArray(t)&&t[0]==="$Uint8Array"&&typeof t[1]=="string"){const e=atob(t[1]);return Uint8Array.from(e,s=>s.charCodeAt(0))}return Array.isArray(t)?Uint8Array.from(t):typeof t=="string"?new TextEncoder().encode(t):new Uint8Array}function Ye(t,e){return t==="/"?`/${e}`:`${t}/${e}`}function Je(t){return t.subarray(0,8192).includes(0)?null:new TextDecoder("utf-8",{fatal:!1}).decode(t)}function Ze(t){const e=t.packageName.split("/").at(-1)??t.packageName;return{name:t.packageName,slug:e.toLowerCase(),version:t.version,source:t.packageName.startsWith("@agentos-software/")?"rivet-dev":"user",binaries:t.commands}}function Ie(t,e){var s;return{generation:e,process:t.process??null,pid:t.pid,ppid:t.ppid,pgid:t.pgid,sid:t.sid,driver:t.driver,command:t.command,args:t.args,cwd:t.cwd,status:t.status,exitCode:((s=t.exit)==null?void 0:s.exitCode)??null,startTime:t.startTimeMs,exitTime:t.exitTimeMs??null,children:t.children.map(r=>Ie(r,e))}}const be=700*1024,we=256,ge=700*1024,et=8,tt=2*1024*1024,st={maxEvents:256,maxBytes:64*1024},ct={softwareQueryOptions:t=>({queryKey:P(t,"software"),queryFn:async()=>(await f("v1.software.list",e=>e.v1.software.list({}))).map(Ze)}),processTreeQueryOptions:t=>({queryKey:P(t,"process-tree"),queryFn:async()=>{const e=await f("v1.process.tree",s=>s.v1.process.tree({}));return e.roots.map(s=>Ie(s,e.generation))},refetchInterval:5e3}),listDirQueryOptions:(t,e,s=!0)=>({queryKey:P(t,"dir",e),enabled:s,queryFn:async()=>(await f("v1.filesystem.readdirEntries",n=>n.v1.filesystem.readdirEntries({path:e}))).filter(n=>n.name!=="."&&n.name!=="..").map(n=>({name:n.name,path:Ye(e,n.name),dir:n.isDirectory,symlink:n.isSymbolicLink})).sort((n,a)=>Number(a.dir)-Number(n.dir)||n.name.localeCompare(a.name))}),fileContentQueryOptions:(t,e)=>({queryKey:P(t,"file",e??""),enabled:e!==null,placeholderData:Ue,queryFn:async()=>{const s=e,r=await f("v1.filesystem.stat",u=>u.v1.filesystem.stat({path:s})),n=Number(r.sizeBytes),a=r.mode&61440;if([8192,24576,4096,49152].includes(a))return{path:s,sizeBytes:n,mtimeMs:r.mtimeMs,text:null,bytes:null,oversize:!1,special:!0};if(n>be)return{path:s,sizeBytes:n,mtimeMs:r.mtimeMs,text:null,bytes:null,oversize:!0};const c=ve(await f("v1.filesystem.readFile",u=>u.v1.filesystem.readFile({path:s,maxBytes:be})));return{path:s,sizeBytes:n,mtimeMs:r.mtimeMs,text:Je(c),bytes:c,oversize:!1}}}),mountsQueryOptions:t=>({queryKey:P(t,"mounts"),queryFn:async()=>f("v1.filesystem.listMounts",e=>e.v1.filesystem.listMounts({}))}),stopProcess:async(t,e)=>f("v1.process.signal",s=>s.v1.process.signal({process:{generation:t,pid:e},signal:"SIGTERM"})),processOutputReader:(t,e)=>{const s=C();return r=>f("v1.process.output.read",n=>n.v1.process.output.read({process:{generation:t,pid:e},after:r,...st}),s)},killProcess:async(t,e)=>f("v1.process.signal",s=>s.v1.process.signal({process:{generation:t,pid:e},signal:"SIGKILL"})),openShell:async(t,e)=>{const s=C(),r=await f("v1.terminal.open",n=>n.v1.terminal.open({options:{args:[],env:{},cols:t,rows:e}}),s);return oe(s).set(r.shellId,r),r},writeShell:async(t,e)=>{const s=C(),r=await H(s,t);return f("v1.terminal.stdin.write",n=>n.v1.terminal.stdin.write({terminal:r,data:e}),s)},resizeShell:async(t,e,s)=>{const r=C(),n=await H(r,t);return f("v1.terminal.pty.resize",a=>a.v1.terminal.pty.resize({terminal:n,cols:e,rows:s}),r)},closeShell:async t=>{const e=C(),s=await H(e,t),r=await f("v1.terminal.close",n=>n.v1.terminal.close({terminal:s}),e);return oe(e).delete(t),r},shellSnapshot:async(t,e="screen",s)=>{s==null||s.throwIfAborted();const r=C(),n=await H(r,t),a=[];let c=0,u,w=!1,p=!1;for(let h=0;h<et;h++){s==null||s.throwIfAborted();const b=await f("v1.terminal.output.read",g=>g.v1.terminal.output.read({terminal:n,after:u,maxBytes:ge,maxEvents:we}),r);if(s==null||s.throwIfAborted(),p||(p=b.truncated),b.events.length>we)throw new Error("Terminal replay exceeded the requested event page limit");let y=0,x=u;for(const g of b.events){if(g.sequence<0||typeof g.sequence=="number"&&!Number.isSafeInteger(g.sequence)||x!==void 0&&g.sequence<=x)throw new Error("Terminal replay returned out-of-order sequences");x=g.sequence;const F=ve(g.data);if(y+=F.byteLength,y>ge)throw new Error("Terminal replay exceeded the requested byte page limit");if(c+=F.byteLength,c>tt)throw new Error("Terminal snapshot exceeds the 2 MiB inspector limit");a.push(F)}const M=b.nextCursor??void 0;if(M!==void 0&&(M<0||typeof M=="number"&&!Number.isSafeInteger(M))||b.hasMore&&b.events.length===0||b.events.length>0&&M===void 0||M!==void 0&&BigInt(M)!==BigInt(x??-1)&&!(b.truncated&&!b.hasMore&&BigInt(M)>BigInt(x??-1)))throw new Error("Terminal replay did not advance its cursor");if(u=M??u,w=b.hasMore,!w)break}if(w)throw new Error("Terminal snapshot exceeds the 8-page inspector limit");return{shellId:t,mode:e,seq:u??-1,truncated:p,cols:80,rows:24,data:rt(a)}},writeFile:(t,e)=>f("v1.filesystem.writeFile",s=>s.v1.filesystem.writeFile({path:t,content:e})),mkdir:t=>f("v1.filesystem.mkdir",e=>e.v1.filesystem.mkdir({path:t,recursive:!0})),moveEntry:(t,e)=>f("v1.filesystem.move",s=>s.v1.filesystem.move({from:t,to:e})),deleteFile:(t,e)=>f("v1.filesystem.remove",s=>s.v1.filesystem.remove({path:t,recursive:e.recursive??!1})),createSignedPreviewUrl:async(t,e)=>{const s=await f("v1.network.preview.create",r=>r.v1.network.preview.create({port:t,ttlMs:e*1e3}));return{path:s.path,token:s.token,port:s.port,expiresAt:Number(s.expiresAtMs)}},expireSignedPreviewUrl:t=>f("v1.network.preview.expire",e=>e.v1.network.preview.expire({token:t}))};async function H(t,e){const s=oe(t).get(e);if(s)return s;const n=(await Oe(t)).find(a=>a.terminal.shellId===e);if(!n)throw new Error(`terminal ${e} is no longer available`);return n.terminal}const ae=new WeakMap;function oe(t){let e=ae.get(t);return e||(e=new Map,ae.set(t,e)),e}async function Oe(t){const e=await f("v1.terminal.list",s=>s.v1.terminal.list({}),t);return ae.set(t,new Map(e.map(({terminal:s})=>[s.shellId,s]))),e}function rt(t){const e=new Uint8Array(t.reduce((r,n)=>r+n.byteLength,0));let s=0;for(const r of t)e.set(r,s),s+=r.byteLength;return e}const lt=t=>({queryKey:P(t,"terminals"),queryFn:async()=>{const e=C();return(await Oe(e)).map(s=>({shellId:s.terminal.shellId,openedAt:0}))},refetchInterval:1e4}),it=t=>({queryKey:P(t,"vm-status"),queryFn:()=>f("v1.vm.status",e=>e.v1.vm.status({})),refetchInterval:5e3});function ut({actorId:t}){const e=Xe(it(t)),[s,r]=A.useState(null),n=Be();if(n.useEvent("vmBooted",()=>{r("ready"),e.refetch()}),n.useEvent("vmShutdown",()=>{r("stopped"),e.refetch()}),e.error)return z.jsxs("span",{className:"inline-flex items-center gap-1.5 rounded border px-2 py-0.5 text-[11px] text-muted-foreground",children:[z.jsx(me,{color:"muted"})," status unavailable"]});const a=e.data;if(!a)return null;const c=s??a.lifecycle,u=a.issues.length,w=c==="ready"&&u===0?"green":c==="failed"?"red":"muted";return z.jsxs("span",{className:"inline-flex items-center gap-1.5 rounded border px-2 py-0.5 text-[11px] text-muted-foreground",children:[z.jsx(me,{color:w}),c,u>0?` · ${u} issue${u===1?"":"s"}`:""]})}export{st as P,De as Q,ut as V,ct as a,P as b,Ke as c,je as d,Ve as e,ze as f,We as g,He as h,ot as i,it as j,$e as k,ve as l,lt as m,Ge as s,Xe as u};
|