@rivet-dev/agentos 0.0.0-main.29b0797 → 0.0.0-main.5ac5a14
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/assets/inspector-tabs-app/assets/__vite-browser-external-2447137e-BIHI7g3E.js +1 -0
- package/assets/inspector-tabs-app/assets/agentos-hero-logo-E3fapwXM.svg +74 -0
- package/assets/inspector-tabs-app/assets/filesystem-C-x0K5sy.js +1 -0
- package/assets/inspector-tabs-app/assets/hooks-DU8a-cwM.js +1 -0
- package/assets/inspector-tabs-app/assets/index-7G_DbdZ6.js +110 -0
- package/assets/inspector-tabs-app/assets/index-DG_s1YoH.css +1 -0
- package/assets/inspector-tabs-app/assets/scroll-area-kPbv4IGy.js +1 -0
- package/assets/inspector-tabs-app/assets/sed-BwsOyU9v.svg +1 -0
- package/assets/inspector-tabs-app/assets/system-D98yBhMj.js +2 -0
- package/assets/inspector-tabs-app/assets/terminal-Bv9GKv4q.js +13 -0
- package/assets/inspector-tabs-app/assets/transcript-kMbm_tF8.js +1 -0
- package/assets/inspector-tabs-app/assets/useSuspenseQuery-ChN8rnBd.js +1 -0
- package/assets/inspector-tabs-app/assets/vm-boot-gate-rpuO0b5W.js +1 -0
- package/assets/inspector-tabs-app/assets/vm-status-badges-09qyfN_A.js +5 -0
- package/assets/inspector-tabs-app/index.html +2 -2
- package/dist/chunk-V6TY7KAL.js +8 -0
- package/dist/chunk-V6TY7KAL.js.map +1 -0
- package/dist/index.d.ts +328 -22
- package/dist/index.js +1238 -138
- package/dist/index.js.map +1 -1
- package/dist/node.d.ts +67 -0
- package/dist/node.js +275 -0
- package/dist/node.js.map +1 -0
- package/package.json +22 -10
- package/assets/inspector-tabs-app/assets/badge-NKTqivIc.js +0 -1
- package/assets/inspector-tabs-app/assets/filesystem-CyIvO-1j.js +0 -1
- package/assets/inspector-tabs-app/assets/index-DcBRn-yP.js +0 -125
- package/assets/inspector-tabs-app/assets/index-Dt5XhJ9h.css +0 -1
- package/assets/inspector-tabs-app/assets/mounts-DWpTN-N6.js +0 -1
- package/assets/inspector-tabs-app/assets/processes-CUocx7Ya.js +0 -1
- package/assets/inspector-tabs-app/assets/scroll-area-C07uoUZ4.js +0 -1
- package/assets/inspector-tabs-app/assets/software-ftDfKuwh.js +0 -1
- package/assets/inspector-tabs-app/assets/transcript-7Ao7EjSb.js +0 -1
- package/assets/inspector-tabs-app/assets/useSuspenseQuery-DBzwnHO3.js +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as f,u as te,r as l,l as ne,b as Y,c as re,m as oe,j as e,I as F,S as ae,P as ie,A as le,d as K,e as P,C as ce,f as de,g as H,h as U,i as W,k as ue,n as pe}from"./index-7G_DbdZ6.js";import{u as xe}from"./useSuspenseQuery-ChN8rnBd.js";import{S as G}from"./scroll-area-kPbv4IGy.js";import{V as me}from"./vm-status-badges-09qyfN_A.js";function fe({event:n}){var r,u;switch(n.kind){case"user":return e.jsx("div",{className:"flex justify-end",children:e.jsx("div",{className:"max-w-[80%] whitespace-pre-wrap rounded-2xl rounded-br-md bg-muted px-3.5 py-2 text-sm",children:n.text||"—"})});case"assistant":return e.jsx("div",{className:"flex",children:e.jsx("div",{className:"max-w-[85%] whitespace-pre-wrap text-sm leading-relaxed",children:n.text||"—"})});case"thinking":return e.jsx("div",{className:"flex",children:e.jsx("div",{className:"max-w-[85%] whitespace-pre-wrap text-xs italic leading-relaxed text-muted-foreground/70",children:n.text||"—"})});case"tool":{const a=n.input!==void 0||n.output!==void 0||!!((r=n.locations)!=null&&r.length),o=e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"font-mono",children:n.tool}),n.status?e.jsx("span",{className:"rounded-full border px-1.5 py-px text-[10px]",children:n.status}):null]});return a?e.jsxs("details",{className:"group rounded-lg border border-foreground/10 bg-muted/20 text-xs text-muted-foreground",children:[e.jsxs("summary",{className:"flex cursor-pointer list-none items-center gap-2 px-2.5 py-1.5 [&::-webkit-details-marker]:hidden",children:[e.jsx(W,{className:"size-3 shrink-0 transition-transform group-open:rotate-90"}),o]}),e.jsxs("div",{className:"flex flex-col gap-2 border-t border-foreground/10 px-2.5 py-2",children:[n.input!==void 0?e.jsxs("div",{children:[e.jsx("div",{className:"mb-1 text-[10px] text-muted-foreground/70",children:"Input"}),e.jsx("pre",{className:"max-h-40 overflow-y-auto whitespace-pre-wrap break-words rounded bg-muted/50 p-2 font-mono text-[11px] leading-relaxed",children:JSON.stringify(n.input,null,2)})]}):null,n.output!==void 0?e.jsxs("div",{children:[e.jsx("div",{className:"mb-1 text-[10px] text-muted-foreground/70",children:"Output"}),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:n.output})]}):null,(u=n.locations)!=null&&u.length?e.jsx("div",{className:"font-mono text-[11px] text-muted-foreground/70",children:n.locations.join(" ")}):null]})]}):e.jsx("div",{className:"flex items-center gap-2 text-xs text-muted-foreground",children:o})}case"plan":return e.jsxs("div",{className:"rounded-lg border border-foreground/10 bg-muted/20 px-2.5 py-2 text-xs text-muted-foreground",children:[e.jsx("div",{className:"mb-1 text-[10px] text-muted-foreground/70",children:"Plan"}),e.jsx("ul",{className:"flex flex-col gap-1",children:n.entries.map((a,o)=>e.jsxs("li",{className:"flex items-start gap-2",children:[e.jsx(P,{color:a.status==="completed"?"green":a.status==="in_progress"?"amber":"muted",className:"mt-1"}),e.jsx("span",{className:H("min-w-0 flex-1",a.status==="completed"&&"text-muted-foreground/60 line-through"),children:a.content})]},`${o}-${a.content.slice(0,24)}`))})]});case"notice":return e.jsx("div",{className:"text-center text-[11px] text-muted-foreground/60",children:n.text});case"permission":return e.jsxs("div",{className:"flex items-center gap-2 rounded-lg border border-amber-500/30 bg-amber-500/5 px-2.5 py-1.5 text-xs text-amber-500/90",children:[e.jsx(P,{color:"amber",className:"size-1.5"}),n.text]});case"error":return e.jsx("div",{className:"whitespace-pre-wrap text-sm text-destructive",children:n.text});default:return e.jsxs("details",{className:"group text-xs text-muted-foreground/70",children:[e.jsxs("summary",{className:"flex cursor-pointer list-none items-center gap-1.5 [&::-webkit-details-marker]:hidden",children:[e.jsx(W,{className:"size-3 shrink-0 transition-transform group-open:rotate-90"}),e.jsx("span",{className:"font-mono",children:n.label})]}),e.jsx("pre",{className:"mt-1.5 max-h-48 overflow-y-auto whitespace-pre-wrap break-words rounded bg-muted/50 p-2 font-mono text-[11px] leading-relaxed",children:JSON.stringify(n.json,null,2)})]})}}function he({count:n}){const r=l.useRef(null),u=l.useRef(!0);return l.useEffect(()=>{const a=r.current,o=a==null?void 0:a.closest("[data-radix-scroll-area-viewport]");if(!a||!o)return;const c=new IntersectionObserver(([x])=>{u.current=x.isIntersecting},{root:o,rootMargin:"0px 0px 96px 0px"});return c.observe(a),()=>c.disconnect()},[]),l.useEffect(()=>{var a;u.current&&((a=r.current)==null||a.scrollIntoView({block:"end"}))},[n]),e.jsx("div",{ref:r,className:"h-px"})}function ge(n){const r=[],u=new Map;let a=null;for(const o of n){const c=r[r.length-1];if((o.kind==="user"||o.kind==="assistant"||o.kind==="thinking")&&(c==null?void 0:c.kind)===o.kind){r[r.length-1]={...c,text:c.text+o.text};continue}if(o.kind==="tool"&&o.toolCallId){const x=u.get(o.toolCallId);if(x!==void 0){const p=r[x];r[x]={...p,tool:o.tool!==o.toolCallId?o.tool:p.tool,status:o.status??p.status,input:o.input??p.input,output:o.output??p.output,locations:o.locations??p.locations};continue}u.set(o.toolCallId,r.length)}if(o.kind==="plan"){if(a!==null){r[a]={...r[a],entries:o.entries};continue}a=r.length}r.push(o)}return r}function ye(){return e.jsx("div",{className:"flex items-center gap-1 px-1 py-0.5","aria-label":"Turn in progress",children:[0,1,2].map(n=>e.jsx("span",{className:"size-1.5 animate-pulse rounded-full bg-muted-foreground/50",style:{animationDelay:`${n*200}ms`}},n))})}const D="agentos-inspector:composer-agent-type",L="agentos-inspector:composer-env",J=n=>`agentos-inspector:transcript:${n}`,X=JSON.stringify({ANTHROPIC_API_KEY:"",OPENCODE_CONFIG_CONTENT:JSON.stringify({model:"anthropic/claude-haiku-4-5-20251001"})},null,2);function ve(){const n=(localStorage.getItem(D)??"opencode").trim()||"opencode",r=localStorage.getItem(L)??X;let u;try{u=JSON.parse(r)}catch(a){throw new Error(`Session env is not valid JSON: ${a.message}`)}return{agentType:n,env:u}}function Ne({actorId:n,sessionId:r,sessionStatus:u,onSessionCreated:a,onErrorEvent:o,onBusyChange:c}){const[x,p]=l.useState(""),[g,R]=l.useState(!1),S=i=>{R(i),c==null||c(i)},[v,N]=l.useState(!1),[j,k]=l.useState(!1),[C,O]=l.useState(()=>localStorage.getItem(D)??"opencode"),[b,A]=l.useState(()=>localStorage.getItem(L)??X),E=l.useRef(null),T=(Y({...f.softwareQueryOptions(n),enabled:j}).data??[]).filter(i=>i.name.endsWith("· agent")).map(i=>{var d;return((d=i.name.split(" · ")[0])==null?void 0:d.split("/").pop())??""}).filter(Boolean),w=async()=>{const i=x.trim();if(!(!i||g)){S(!0),p("");try{let d=r;if(!d){let h;try{h=JSON.parse(b)}catch(_){throw new Error(`Session env is not valid JSON: ${_.message}`)}d=await f.createSession(C.trim()||"opencode",{env:h}),a(d)}E.current=d,await f.sendPrompt(d,i)}catch(d){let h=ue(d)?` — ${d.hint}`:"";r&&u!=="running"&&(h=" — this session is idle (not live in the current VM boot). Send without a selection to start a fresh session, or resume it from a client."),o(`${d instanceof Error?d.message:String(d)}${h}`)}finally{E.current=null,S(!1)}}},I=async()=>{const i=E.current??r;if(i)try{await pe(i)||(N(!0),o("Stop is not supported by this runtime (no cancelPrompt action)."))}catch(d){o(d instanceof Error?d.message:String(d))}};return e.jsx("div",{className:"shrink-0",children:e.jsxs("div",{className:"mx-auto w-full max-w-3xl px-3 pb-3",children:[j&&!r?e.jsxs("div",{className:"mb-2 flex flex-col gap-2 rounded-xl border bg-muted/30 p-3 text-xs",children:[e.jsxs("label",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"w-24 shrink-0 text-muted-foreground",children:"Agent type"}),e.jsx("input",{value:C,onChange:i=>{O(i.target.value),localStorage.setItem(D,i.target.value)},list:"agentos-composer-agent-types",className:"flex-1 rounded border bg-background px-2 py-1 font-mono"}),e.jsx("datalist",{id:"agentos-composer-agent-types",children:T.map(i=>e.jsx("option",{value:i},i))})]}),e.jsxs("label",{className:"flex items-start gap-2",children:[e.jsx("span",{className:"w-24 shrink-0 pt-1 text-muted-foreground",children:"Session env"}),e.jsx("textarea",{value:b,onChange:i=>{A(i.target.value),localStorage.setItem(L,i.target.value)},rows:4,spellCheck:!1,className:"flex-1 resize-y rounded border bg-background px-2 py-1 font-mono"})]}),e.jsx("div",{className:"text-muted-foreground/70",children:"Used when sending without a session: creates one with these options. Values stay in this browser."})]}):null,e.jsxs("div",{className:"rounded-2xl border bg-muted/40 transition-colors focus-within:border-ring/60",children:[e.jsx("textarea",{value:x,onChange:i=>p(i.target.value),onKeyDown:i=>{i.key==="Enter"&&!i.shiftKey&&(i.preventDefault(),w())},placeholder:r?"Prompt this session…":"Prompt a new session…",rows:2,className:"max-h-48 min-h-[3.25rem] w-full resize-none bg-transparent px-4 pt-3 text-sm placeholder:text-muted-foreground/50 focus:outline-none"}),e.jsxs("div",{className:"flex items-center gap-1.5 px-2.5 pb-2.5",children:[r?null:e.jsxs("button",{type:"button",onClick:()=>k(i=>!i),title:"New-session options (agent, env)",className:"inline-flex items-center gap-1 rounded px-2.5 py-1 text-xs text-muted-foreground transition-colors hover:bg-muted hover:text-foreground",children:[e.jsx("span",{"aria-hidden":"true",className:"text-sm leading-none",children:"+"}),"Options"]}),e.jsx("span",{className:"ml-auto"}),g?e.jsx("button",{type:"button",onClick:()=>void I(),disabled:v,title:v?"This runtime has no cancelPrompt action":"Stop the running turn",className:"inline-flex size-8 items-center justify-center rounded-md bg-foreground/90 text-background transition-opacity hover:opacity-80 disabled:opacity-40",children:e.jsx("span",{"aria-hidden":"true",className:"block size-2.5 rounded-[2px] bg-current"})}):e.jsx("button",{type:"button",onClick:()=>void w(),disabled:!x.trim(),title:"Send (⏎)",className:"inline-flex size-8 items-center justify-center rounded-md bg-primary text-primary-foreground transition-opacity hover:opacity-90 disabled:opacity-40",children:e.jsx("svg",{viewBox:"0 0 16 16",className:"size-4",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:e.jsx("path",{d:"M8 13V3M4 7l4-4 4 4"})})})]})]})]})})}function Ce({actorId:n}){var V;const{data:r}=xe(f.sessionsQueryOptions(n)),u=te(),[a,o]=l.useState(()=>{try{const s=sessionStorage.getItem(J(n));if(!s)return;const t=JSON.parse(s);return t.selected===null||typeof t.selected=="string"?t.selected:void 0}catch{return}});l.useEffect(()=>{try{a===void 0?sessionStorage.removeItem(J(n)):sessionStorage.setItem(J(n),JSON.stringify({selected:a}))}catch(s){console.warn("agentos inspector: failed to persist transcript state",s)}},[n,a]);const c=a===void 0||typeof a=="string"&&!r.some(s=>s.sessionId===a)?((V=r[0])==null?void 0:V.sessionId)??null:a,x=l.useMemo(()=>ne(r),[r]),p=s=>x.has(s.sessionId),{data:g=[]}=Y(f.transcriptQueryOptions(n,c)),S=re().useEvent,[v,N]=l.useState([]),j=l.useRef(0),k=l.useRef(c);k.current=c,l.useEffect(()=>{N([])},[c]),S("sessionEvent",s=>{const t=s,y=k.current;if(!y||!(t!=null&&t.sessionId)||t.sessionId!==y)return;let m=oe(t);t.type==="permission_request"&&m.kind==="permission"&&(m={...m,text:`${m.text} (answer in the banner above)`});const q=j.current++;N(B=>{if(t.durability==="durable"){const se=t.type==="agent_message_chunk"||t.type==="agent_thought_chunk";return[...B.filter($=>$.seq!==m.seq&&!(se&&$.kind===m.kind&&!Number.isInteger($.seq)&&$.seq<m.seq)),{...m,liveKey:q}]}return[...B,{...m,liveKey:q}]})}),S("agentExit",s=>{const t=s,y=k.current;if(!y||(t==null?void 0:t.sessionId)!==y)return;const m=j.current++;N(q=>[...q,{kind:"error",seq:-1-m,liveKey:m,text:`Agent crashed (exit ${t.exitCode??"?"}) — restart: ${t.restart}${t.restartCount?` (attempt ${t.restartCount})`:""}`}])});const C=s=>{const t=j.current++;N(y=>[...y,{kind:"error",seq:-1-t,liveKey:t,text:s}])},O=s=>{o(s),u.invalidateQueries({queryKey:f.sessionsQueryOptions(n).queryKey})},[b,A]=l.useState(!1),[E,z]=l.useState(!1),[T,w]=l.useState(""),I=T.trim().toLowerCase(),i=I?r.filter(s=>s.sessionId.toLowerCase().includes(I)||s.agent.toLowerCase().includes(I)):r,[d,h]=l.useState(null),_=async()=>{if(!b){A(!0),h(null);try{const{agentType:s,env:t}=ve();O(await f.createSession(s,{env:t}))}catch(s){h(s)}finally{A(!1)}}},[M,Z]=l.useState(!1),ee=async s=>{try{await f.closeSession(s)}catch(t){C(t instanceof Error?t.message:String(t))}o(void 0),u.invalidateQueries({queryKey:f.sessionsQueryOptions(n).queryKey})},Q=l.useMemo(()=>{const s=new Set(g.map(t=>t.seq));return ge([...g.map(t=>({...t,key:`b-${t.seq}`})),...v.filter(t=>!s.has(t.seq)).map(t=>({...t,key:`l-${t.liveKey}`}))])},[g,v]);return e.jsxs("div",{className:"flex h-full min-h-0",children:[e.jsxs("div",{className:"flex h-full w-64 shrink-0 flex-col border-r",children:[e.jsxs("div",{className:"flex items-center px-3 pb-1 pt-2.5",children:[e.jsxs("span",{className:"text-[11px] font-medium text-muted-foreground",children:["Sessions",x.size>0?` · ${x.size} live`:""]}),e.jsx("span",{className:"ml-auto"}),e.jsx(F,{title:"Search sessions by id",onClick:()=>z(s=>(s&&w(""),!s)),className:"mr-1",children:e.jsx(ae,{className:"size-3.5"})}),e.jsx(F,{title:b?"Creating session…":"New session",onClick:()=>void _(),disabled:b,children:e.jsx(ie,{className:"size-3.5"})})]}),E?e.jsx("div",{className:"px-3 pb-1.5",children:e.jsx("input",{value:T,onChange:s=>w(s.target.value),onKeyDown:s=>{s.key==="Escape"&&(w(""),z(!1))},spellCheck:!1,autoFocus:!0,"aria-label":"Search sessions",placeholder:"session id or agent",className:"w-full rounded border bg-background px-2 py-1 font-mono text-xs focus:outline-none"})}):null,d?e.jsx(le,{error:d,className:"border-b py-2"}):null,r.length===0?e.jsx(K,{children:"No sessions yet."}):e.jsx(G,{className:"min-h-0 flex-1",children:e.jsxs("div",{className:"p-1.5",children:[i.length===0?e.jsx("div",{className:"px-2 py-3 text-center text-xs text-muted-foreground",children:"No sessions match."}):null,i.map(s=>e.jsxs("div",{role:"button",tabIndex:0,onClick:()=>o(s.sessionId),onKeyDown:t=>{(t.key==="Enter"||t.key===" ")&&o(s.sessionId)},className:H("group flex w-full cursor-pointer items-center gap-2 rounded px-2 py-1.5 text-left",s.sessionId===c?"bg-muted":"hover:bg-muted/50"),children:[e.jsx(P,{color:p(s)?"green":"muted"}),e.jsxs("div",{className:"min-w-0 flex-1",title:p(s)?"Live in the current VM":"Idle — persisted, not loaded in the current VM",children:[e.jsxs("div",{className:"flex items-center gap-1 text-xs",children:[e.jsxs("span",{className:"truncate font-mono",children:["…",s.sessionId.slice(-12)]}),e.jsx(ce,{value:s.sessionId,className:"opacity-0 focus:opacity-100 group-hover:opacity-100"})]}),e.jsxs("div",{className:"truncate text-[10px] text-muted-foreground/60",children:[s.agent," · ",de(Date.parse(s.createdAt))]})]}),p(s)?e.jsx("button",{type:"button",onClick:t=>{t.stopPropagation(),ee(s.sessionId)},title:"End the live agent process; the transcript stays","aria-label":"Close session",className:"text-muted-foreground/40 opacity-0 transition-opacity hover:text-foreground focus:opacity-100 group-hover:opacity-100",children:e.jsx("svg",{viewBox:"0 0 12 12",className:"size-2.5",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round","aria-hidden":"true",children:e.jsx("path",{d:"M3 3l6 6M9 3l-6 6"})})}):null]},s.sessionId))]})})]}),e.jsxs("div",{className:"relative flex min-h-0 flex-1 flex-col",children:[e.jsx("div",{className:"absolute right-3 top-2 z-10",children:e.jsx(me,{actorId:n})}),c?e.jsx(e.Fragment,{children:Q.length===0&&!M?e.jsx(K,{children:e.jsxs("div",{className:"flex flex-col items-center gap-5",children:[e.jsx(U,{className:"w-44"}),e.jsx("span",{children:"No activity yet — send a prompt below."})]})}):e.jsx(G,{className:"min-h-0 flex-1",children:e.jsxs("div",{className:"mx-auto flex w-full max-w-3xl flex-col gap-3 px-4 py-4",children:[Q.map(s=>e.jsx(fe,{event:s},s.key)),M?e.jsx(ye,{}):null,e.jsx(he,{count:g.length+v.length})]})})}):e.jsx(K,{children:e.jsxs("div",{className:"flex flex-col items-center gap-5",children:[e.jsx(U,{className:"w-44"}),e.jsx("span",{children:"No session selected — press + or send a prompt below to start one."})]})}),e.jsx(Ne,{actorId:n,sessionId:c,sessionStatus:c?(()=>{const s=r.find(t=>t.sessionId===c);return s&&p(s)?"running":"idle"})():void 0,onSessionCreated:O,onErrorEvent:C,onBusyChange:Z})]})]})}export{Ce as TranscriptTabConnected};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{Y as r,Q as u,N as s}from"./index-7G_DbdZ6.js";function t(e,a){return r({...e,enabled:!0,suspense:!0,throwOnError:s,placeholderData:void 0},u)}export{t as u};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var K=e=>{throw TypeError(e)};var E=(e,t,s)=>t.has(e)||K("Cannot "+s);var r=(e,t,s)=>(E(e,t,"read from private field"),s?s.call(e):t.get(e)),y=(e,t,s)=>t.has(e)?K("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,s),f=(e,t,s,i)=>(E(e,t,"write to private field"),i?i.call(e,s):t.set(e,s),s),v=(e,t,s)=>(E(e,t,"access private method"),s);import{v as A,x as N,a0 as R,a1 as Q,w as k,u as U,r as x,J as q,a2 as L,b as V,a3 as B,j as m,d as D,h as F}from"./index-7G_DbdZ6.js";var n,l,o,h,u,C,M,P,G=(P=class extends A{constructor(t,s){super();y(this,u);y(this,n);y(this,l);y(this,o);y(this,h);f(this,n,t),this.setOptions(s),this.bindMethods(),v(this,u,C).call(this)}bindMethods(){this.mutate=this.mutate.bind(this),this.reset=this.reset.bind(this)}setOptions(t){var i;const s=this.options;this.options=r(this,n).defaultMutationOptions(t),N(this.options,s)||r(this,n).getMutationCache().notify({type:"observerOptionsUpdated",mutation:r(this,o),observer:this}),s!=null&&s.mutationKey&&this.options.mutationKey&&R(s.mutationKey)!==R(this.options.mutationKey)?this.reset():((i=r(this,o))==null?void 0:i.state.status)==="pending"&&r(this,o).setOptions(this.options)}onUnsubscribe(){var t;this.hasListeners()||(t=r(this,o))==null||t.removeObserver(this)}onMutationUpdate(t){v(this,u,C).call(this),v(this,u,M).call(this,t)}getCurrentResult(){return r(this,l)}reset(){var t;(t=r(this,o))==null||t.removeObserver(this),f(this,o,void 0),v(this,u,C).call(this),v(this,u,M).call(this)}mutate(t,s){var i;return f(this,h,s),(i=r(this,o))==null||i.removeObserver(this),f(this,o,r(this,n).getMutationCache().build(r(this,n),this.options)),r(this,o).addObserver(this),r(this,o).execute(t)}},n=new WeakMap,l=new WeakMap,o=new WeakMap,h=new WeakMap,u=new WeakSet,C=function(){var s;const t=((s=r(this,o))==null?void 0:s.state)??Q();f(this,l,{...t,isPending:t.status==="pending",isSuccess:t.status==="success",isError:t.status==="error",isIdle:t.status==="idle",mutate:this.mutate,reset:this.reset})},M=function(t){k.batch(()=>{var s,i,a,p,c,g,S,w;if(r(this,h)&&this.hasListeners()){const b=r(this,l).variables,O=r(this,l).context,j={client:r(this,n),meta:this.options.meta,mutationKey:this.options.mutationKey};if((t==null?void 0:t.type)==="success"){try{(i=(s=r(this,h)).onSuccess)==null||i.call(s,t.data,b,O,j)}catch(d){Promise.reject(d)}try{(p=(a=r(this,h)).onSettled)==null||p.call(a,t.data,null,b,O,j)}catch(d){Promise.reject(d)}}else if((t==null?void 0:t.type)==="error"){try{(g=(c=r(this,h)).onError)==null||g.call(c,t.error,b,O,j)}catch(d){Promise.reject(d)}try{(w=(S=r(this,h)).onSettled)==null||w.call(S,void 0,t.error,b,O,j)}catch(d){Promise.reject(d)}}}this.listeners.forEach(b=>{b(r(this,l))})})},P);function T(e,t){const s=U(),[i]=x.useState(()=>new G(s,e));x.useEffect(()=>{i.setOptions(e)},[i,e]);const a=x.useSyncExternalStore(x.useCallback(c=>i.subscribe(k.batchCalls(c)),[i]),()=>i.getCurrentResult(),()=>i.getCurrentResult()),p=x.useCallback((c,g)=>{i.mutate(c,g).catch(q)},[i]);if(a.error&&L(i.options.throwOnError,[a.error]))throw a.error;return{...a,mutate:p,mutateAsync:a.mutate}}function W({actorId:e,note:t,actionLabel:s,children:i}){const a=V(B(e)),[p,c]=x.useState(!1);return a.data&&!a.data.booted&&!p?m.jsx(D,{children:m.jsxs("div",{className:"flex max-w-sm flex-col items-center gap-2",children:[m.jsx(F,{className:"mb-3 w-44"}),m.jsx("span",{children:t}),m.jsx("button",{type:"button",onClick:()=>c(!0),className:"rounded-md border px-2.5 py-1 text-xs text-muted-foreground transition-colors hover:bg-muted hover:text-foreground",children:s})]})}):m.jsx(m.Fragment,{children:i})}export{W as V,T as u};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import{k as h,b,a3 as j,r as x,c as v,j as t,e as $,g as N,i as w,C as d,f as g}from"./index-7G_DbdZ6.js";function k(s){return h(s)&&s.layer==="contract"}function C(s,r){if((r==null?void 0:r.kind)==="shutdown"){const a=r.reason??"unknown";return a==="error"?{tone:"red",label:"VM shut down after an error"}:{tone:"muted",label:`VM shut down (${a})`}}return s?s.sidecar&&s.sidecar.state!=="ready"?{tone:"red",label:`sidecar ${s.sidecar.state}`}:!s.booted&&(r==null?void 0:r.kind)!=="booted"?{tone:"muted",label:"VM not booted"}:null:null}function S({actorId:s,align:r="right"}){const a=b(j(s)),[p,c]=x.useState(null),[u,f]=x.useState(!1),m=v().useEvent;if(m("vmBooted",()=>{c({kind:"booted"}),a.refetch()}),m("vmShutdown",e=>{c({kind:"shutdown",reason:e==null?void 0:e.reason}),a.refetch()}),a.error&&k(a.error))return null;const n=a.data,o=a.error?{tone:"muted",label:"health unavailable"}:C(n,p),i=((n==null?void 0:n.warnings.length)??0)+((n==null?void 0:n.agentExits.length)??0);return!o&&i===0?null:t.jsxs("span",{className:"inline-flex shrink-0 items-center gap-1.5 text-xs",children:[o?t.jsxs("span",{className:N("inline-flex items-center gap-1.5 rounded border px-2 py-0.5 text-[11px]",o.tone==="red"?"border-destructive/40 text-destructive":"border-foreground/15 text-muted-foreground"),children:[t.jsx($,{color:o.tone==="red"?"red":"muted"}),o.label]}):null,i>0?t.jsxs("span",{className:"relative",children:[t.jsxs("button",{type:"button",onClick:()=>f(e=>!e),className:"inline-flex items-center gap-1 rounded border border-amber-500/40 px-2 py-0.5 text-[11px] text-amber-500 transition-colors hover:bg-amber-500/10",children:[i," warning",i===1?"":"s",t.jsx(w,{className:`size-2.5 transition-transform ${u?"rotate-90":""}`})]}),u&&n?t.jsxs("div",{className:`absolute top-full z-20 mt-1 max-h-64 w-80 overflow-y-auto rounded-md border bg-background p-2 text-[11px] leading-relaxed shadow-lg ${r==="right"?"right-0":"left-0"}`,children:[n.warnings.length>0?t.jsxs("div",{className:"mb-2",children:[t.jsxs("div",{className:"mb-1 flex items-center gap-1 font-medium text-muted-foreground",children:["Limit warnings",t.jsx(d,{value:n.warnings.map(e=>`${new Date(e.ts).toISOString()} ${e.limit} ${e.observed}/${e.capacity} · ${e.fillPercent}%`).join(`
|
|
2
|
+
`)})]}),n.warnings.map((e,l)=>t.jsxs("div",{className:"flex items-center gap-2 font-mono",children:[t.jsxs("span",{children:[e.limit," ",e.observed,"/",e.capacity," · ",e.fillPercent,"%"]}),t.jsx("span",{className:"ml-auto text-muted-foreground",children:g(e.ts)})]},`w-${l}`))]}):null,n.agentExits.length>0?t.jsxs("div",{className:"mb-2",children:[t.jsxs("div",{className:"mb-1 flex items-center gap-1 font-medium text-muted-foreground",children:["Agent exits",t.jsx(d,{value:n.agentExits.map(e=>`${new Date(e.ts).toISOString()} ${e.agentType} session=${e.sessionId} exit=${e.exitCode??"?"} restart=${e.restart} (${e.restartCount})`).join(`
|
|
3
|
+
`)})]}),n.agentExits.map((e,l)=>t.jsxs("div",{className:"flex items-center gap-2 font-mono",children:[t.jsxs("span",{children:[e.agentType," exit ",e.exitCode??"?"," · ",e.restart," (",e.restartCount,")"]}),t.jsx("span",{className:"ml-auto text-muted-foreground",children:g(e.ts)})]},`e-${l}`))]}):null,n.stderrTail.length>0?t.jsxs("div",{children:[t.jsxs("div",{className:"mb-1 flex items-center gap-1 font-medium text-muted-foreground",children:["Adapter stderr (tail)",t.jsx(d,{value:n.stderrTail.map(e=>e.line).join(`
|
|
4
|
+
`)})]}),t.jsx("pre",{className:"whitespace-pre-wrap break-words font-mono text-muted-foreground",children:n.stderrTail.map(e=>e.line).join(`
|
|
5
|
+
`)})]}):null]}):null]}):null]})}export{S as V};
|
|
@@ -4,8 +4,8 @@
|
|
|
4
4
|
<meta charset="utf-8" />
|
|
5
5
|
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
|
6
6
|
<title>agentOS inspector</title>
|
|
7
|
-
<script type="module" crossorigin src="./assets/index-
|
|
8
|
-
<link rel="stylesheet" crossorigin href="./assets/index-
|
|
7
|
+
<script type="module" crossorigin src="./assets/index-7G_DbdZ6.js"></script>
|
|
8
|
+
<link rel="stylesheet" crossorigin href="./assets/index-DG_s1YoH.css">
|
|
9
9
|
</head>
|
|
10
10
|
<body>
|
|
11
11
|
<div id="root"></div>
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
3
|
+
var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
4
|
+
|
|
5
|
+
export {
|
|
6
|
+
__publicField
|
|
7
|
+
};
|
|
8
|
+
//# sourceMappingURL=chunk-V6TY7KAL.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { Actions, ActorConfigInput, ActorContext, ActorDefinition, Type, setup as setup$1 } from 'rivetkit';
|
|
2
|
+
export { Registry } from 'rivetkit';
|
|
2
3
|
import * as _rivet_dev_agentos_core from '@rivet-dev/agentos-core';
|
|
3
|
-
import { SessionStreamEntry, AgentExitEvent, ProcessOutput, ProcessExit, ShellData, ShellExit, CronEvent, CronJobInfo, AgentOsOptions, OpenSessionInput, PromptInput,
|
|
4
|
-
export
|
|
4
|
+
import { LanguageSpawnOptions, SpawnOptions, LanguageExecutionOptions, JavaScriptExecutionOptions, NpmProjectInstallOptions, NpmPackageInstallOptions, TypeScriptExecutionOptions, TypeScriptFileExecutionOptions, TypeScriptCheckOptions, InlineExecutionOptions, PythonInstallOptions, SessionStreamEntry, AgentExitEvent, ProcessOutput, ProcessExit, ShellData, ShellExit, CronEvent, CronJobInfo, AgentOsOptions, AgentOs, DynamicMountDescriptor, ProcessDescriptor, OpenSessionInput, PromptInput, PackageDescriptor, CodeExecutionResult } from '@rivet-dev/agentos-core';
|
|
5
|
+
export * from '@rivet-dev/agentos-core';
|
|
5
6
|
import * as _agentclientprotocol_sdk from '@agentclientprotocol/sdk';
|
|
6
7
|
import * as _rivet_dev_agentos_core_internal_runtime_compat from '@rivet-dev/agentos-core/internal/runtime-compat';
|
|
7
8
|
import { DatabaseProvider, RawAccess } from 'rivetkit/db';
|
|
@@ -12,9 +13,45 @@ interface VmShutdownPayload {
|
|
|
12
13
|
}
|
|
13
14
|
type ProcessOutputPayload = ProcessOutput;
|
|
14
15
|
type ProcessExitPayload = ProcessExit;
|
|
15
|
-
|
|
16
|
+
/** `seq` orders this chunk against `ShellSnapshot.seq`; it is 0 when the shell
|
|
17
|
+
* has no server-side emulator and therefore no replay. */
|
|
18
|
+
type ShellDataPayload = ShellData & {
|
|
19
|
+
seq: number;
|
|
20
|
+
};
|
|
16
21
|
type ShellExitPayload = ShellExit;
|
|
17
22
|
type SerializableCronEvent = CronEvent;
|
|
23
|
+
type ActorData = {
|
|
24
|
+
encoding: "utf8";
|
|
25
|
+
data: string;
|
|
26
|
+
} | {
|
|
27
|
+
encoding: "base64";
|
|
28
|
+
data: string;
|
|
29
|
+
};
|
|
30
|
+
type ActorLanguageExecutionOptions = Omit<LanguageExecutionOptions, "stdin" | "signal" | "onStdout" | "onStderr"> & {
|
|
31
|
+
stdin?: ActorData;
|
|
32
|
+
};
|
|
33
|
+
type ActorSpawnOptions = Omit<SpawnOptions, "stdin" | "signal" | "onStdout" | "onStderr"> & {
|
|
34
|
+
stdin?: ActorData;
|
|
35
|
+
};
|
|
36
|
+
type ActorLanguageSpawnOptions = Omit<LanguageSpawnOptions, "stdin" | "signal" | "onStdout" | "onStderr"> & {
|
|
37
|
+
stdin?: ActorData;
|
|
38
|
+
};
|
|
39
|
+
type ActorInlineExecutionOptions = Omit<InlineExecutionOptions, "stdin" | "signal" | "onStdout" | "onStderr"> & {
|
|
40
|
+
stdin?: ActorData;
|
|
41
|
+
};
|
|
42
|
+
type ActorJavaScriptExecutionOptions = Omit<JavaScriptExecutionOptions, "stdin" | "signal" | "onStdout" | "onStderr"> & {
|
|
43
|
+
stdin?: ActorData;
|
|
44
|
+
};
|
|
45
|
+
type ActorTypeScriptExecutionOptions = Omit<TypeScriptExecutionOptions, "stdin" | "signal" | "onStdout" | "onStderr"> & {
|
|
46
|
+
stdin?: ActorData;
|
|
47
|
+
};
|
|
48
|
+
type ActorTypeScriptFileExecutionOptions = Omit<TypeScriptFileExecutionOptions, "stdin" | "signal" | "onStdout" | "onStderr"> & {
|
|
49
|
+
stdin?: ActorData;
|
|
50
|
+
};
|
|
51
|
+
type ActorTypeScriptCheckOptions = Omit<TypeScriptCheckOptions, "signal">;
|
|
52
|
+
type ActorNpmProjectInstallOptions = Omit<NpmProjectInstallOptions, "signal">;
|
|
53
|
+
type ActorNpmPackageInstallOptions = Omit<NpmPackageInstallOptions, "signal">;
|
|
54
|
+
type ActorPythonInstallOptions = Omit<PythonInstallOptions, "signal">;
|
|
18
55
|
interface AgentOsEvents {
|
|
19
56
|
sessionEvent: SessionStreamEntry;
|
|
20
57
|
agentExit: AgentExitEvent;
|
|
@@ -30,6 +67,93 @@ interface AgentOsEvents {
|
|
|
30
67
|
shellExit: ShellExitPayload;
|
|
31
68
|
cronEvent: SerializableCronEvent;
|
|
32
69
|
}
|
|
70
|
+
/** One buffered near-capacity limit warning (`RuntimeHealth.warnings`). */
|
|
71
|
+
interface RuntimeLimitWarning {
|
|
72
|
+
/** Epoch milliseconds when the warning was observed host-side. */
|
|
73
|
+
ts: number;
|
|
74
|
+
limit: string;
|
|
75
|
+
category: string;
|
|
76
|
+
observed: number;
|
|
77
|
+
capacity: number;
|
|
78
|
+
fillPercent: number;
|
|
79
|
+
}
|
|
80
|
+
/** One buffered unexpected adapter exit (`RuntimeHealth.agentExits`). */
|
|
81
|
+
interface RuntimeAgentExit {
|
|
82
|
+
/** Epoch milliseconds when the exit was observed host-side. */
|
|
83
|
+
ts: number;
|
|
84
|
+
sessionId: string;
|
|
85
|
+
agentType: string;
|
|
86
|
+
exitCode: number | null;
|
|
87
|
+
restart: string;
|
|
88
|
+
restartCount: number;
|
|
89
|
+
}
|
|
90
|
+
/**
|
|
91
|
+
* One buffered adapter stderr line (`RuntimeHealth.stderrTail`). Always empty
|
|
92
|
+
* today; kept in the reply shape so consumers stay stable when a stderr feed
|
|
93
|
+
* lands.
|
|
94
|
+
*/
|
|
95
|
+
interface RuntimeStderrLine {
|
|
96
|
+
ts: number;
|
|
97
|
+
line: string;
|
|
98
|
+
}
|
|
99
|
+
/** `RuntimeHealth.sidecar`: the non-waking sidecar descriptor subset. */
|
|
100
|
+
interface RuntimeSidecarInfo {
|
|
101
|
+
state: string;
|
|
102
|
+
activeVmCount: number;
|
|
103
|
+
}
|
|
104
|
+
/**
|
|
105
|
+
* Reply of the observe-only `health` action. Reading it never boots the VM;
|
|
106
|
+
* the post-mortem buffers survive VM sleep so warnings and crash exits stay
|
|
107
|
+
* readable while `booted` is false.
|
|
108
|
+
*/
|
|
109
|
+
interface RuntimeHealth {
|
|
110
|
+
booted: boolean;
|
|
111
|
+
/**
|
|
112
|
+
* Count of sessions with live event subscriptions through this actor since
|
|
113
|
+
* the last wake (not total loaded sessions); `null` while the VM is down.
|
|
114
|
+
*/
|
|
115
|
+
sessions: number | null;
|
|
116
|
+
/** Sidecar descriptor; `null` while the VM is down. */
|
|
117
|
+
sidecar: RuntimeSidecarInfo | null;
|
|
118
|
+
warnings: RuntimeLimitWarning[];
|
|
119
|
+
agentExits: RuntimeAgentExit[];
|
|
120
|
+
stderrTail: RuntimeStderrLine[];
|
|
121
|
+
}
|
|
122
|
+
/**
|
|
123
|
+
* One live shell from the observe-only `listShells` action. A shell outlives
|
|
124
|
+
* the page that opened it and keeps the VM awake until closed, so enumeration
|
|
125
|
+
* is server-owned rather than tracked per client.
|
|
126
|
+
*/
|
|
127
|
+
interface ShellInfo {
|
|
128
|
+
shellId: string;
|
|
129
|
+
/** Epoch ms when the shell was opened through this actor. */
|
|
130
|
+
openedAt: number;
|
|
131
|
+
}
|
|
132
|
+
/**
|
|
133
|
+
* How much of a shell's history a snapshot repaints.
|
|
134
|
+
*
|
|
135
|
+
* - `none` — sequence number only; the caller repaints nothing.
|
|
136
|
+
* - `screen` — the visible viewport, cursor, and terminal modes.
|
|
137
|
+
* - `scrollback` — the retained scrollback above the viewport, then `screen`.
|
|
138
|
+
*/
|
|
139
|
+
type ShellReplayMode = "none" | "screen" | "scrollback";
|
|
140
|
+
/**
|
|
141
|
+
* Server-rendered repaint for a shell that is already running. `data` is an
|
|
142
|
+
* ANSI stream to write verbatim into a fresh terminal.
|
|
143
|
+
*/
|
|
144
|
+
interface ShellSnapshot {
|
|
145
|
+
shellId: string;
|
|
146
|
+
mode: ShellReplayMode;
|
|
147
|
+
/**
|
|
148
|
+
* Sequence of the last `shellData` chunk folded into this snapshot.
|
|
149
|
+
* Broadcasts carry the same counter, so a client applies the snapshot and
|
|
150
|
+
* then only the chunks whose `seq` is greater — no gap, no double-render.
|
|
151
|
+
*/
|
|
152
|
+
seq: number;
|
|
153
|
+
cols: number;
|
|
154
|
+
rows: number;
|
|
155
|
+
data: string;
|
|
156
|
+
}
|
|
33
157
|
type SerializableCronAction = {
|
|
34
158
|
type: "session";
|
|
35
159
|
agentType: string;
|
|
@@ -55,6 +179,29 @@ type ActorDb = DatabaseProvider<RawAccess>;
|
|
|
55
179
|
type EventSchemaConfig = Record<string, any>;
|
|
56
180
|
type QueueSchemaConfig = Record<string, any>;
|
|
57
181
|
type AnyContext = ActorContext<any, any, any, any, any, ActorDb, any, any>;
|
|
182
|
+
interface VmFetchOptions {
|
|
183
|
+
method?: string;
|
|
184
|
+
headers?: Record<string, string>;
|
|
185
|
+
body?: string | Uint8Array;
|
|
186
|
+
}
|
|
187
|
+
interface VmFetchResponse {
|
|
188
|
+
status: number;
|
|
189
|
+
statusText: string;
|
|
190
|
+
headers: Record<string, string>;
|
|
191
|
+
rawHeaders?: Array<[string, string]>;
|
|
192
|
+
body: Uint8Array;
|
|
193
|
+
}
|
|
194
|
+
interface VmFetchStreamHead {
|
|
195
|
+
streamId: string;
|
|
196
|
+
status: number;
|
|
197
|
+
statusText: string;
|
|
198
|
+
headers: Record<string, string>;
|
|
199
|
+
rawHeaders?: Array<[string, string]>;
|
|
200
|
+
}
|
|
201
|
+
interface VmFetchStreamChunk {
|
|
202
|
+
body: Uint8Array;
|
|
203
|
+
done: boolean;
|
|
204
|
+
}
|
|
58
205
|
interface AgentOsEventHooks<TContext = AnyContext> {
|
|
59
206
|
onSessionEvent?: (c: TContext, sessionId: string, event: SessionStreamEntry) => void | Promise<void>;
|
|
60
207
|
}
|
|
@@ -75,28 +222,34 @@ declare function createAgentOsActions(options?: AgentOsOptions, hooks?: AgentOsE
|
|
|
75
222
|
remove: (c: AnyContext, path: string, options?: {
|
|
76
223
|
recursive?: boolean;
|
|
77
224
|
} | undefined) => Promise<void>;
|
|
225
|
+
exportRootFilesystem: (c: AnyContext, options: _rivet_dev_agentos_core.ExportRootFilesystemOptions) => Promise<_rivet_dev_agentos_core.RootSnapshotExport>;
|
|
226
|
+
mountFs: (c: AnyContext, descriptor: DynamicMountDescriptor) => Promise<void>;
|
|
227
|
+
unmountFs: (c: AnyContext, path: string) => Promise<void>;
|
|
228
|
+
listMounts: (c: AnyContext) => Promise<_rivet_dev_agentos_core.MountInfo[]>;
|
|
78
229
|
exec: (c: AnyContext, command: string, options?: _rivet_dev_agentos_core_internal_runtime_compat.ExecOptions | undefined) => Promise<_rivet_dev_agentos_core_internal_runtime_compat.ExecResult>;
|
|
79
230
|
execArgv: (c: AnyContext, command: string, args?: readonly string[] | undefined, options?: _rivet_dev_agentos_core_internal_runtime_compat.ExecOptions | undefined) => Promise<_rivet_dev_agentos_core_internal_runtime_compat.ExecResult>;
|
|
80
|
-
spawn: (c: AnyContext, command: string, args
|
|
81
|
-
|
|
82
|
-
}>;
|
|
83
|
-
waitProcess: (c: AnyContext, pid: number) => Promise<number>;
|
|
231
|
+
spawn: (c: AnyContext, command: string, args?: string[], actorOptions?: ActorSpawnOptions) => Promise<ProcessDescriptor>;
|
|
232
|
+
waitProcess: (c: AnyContext, pid: number) => Promise<_rivet_dev_agentos_core.ProcessExit>;
|
|
84
233
|
killProcess: (c: AnyContext, pid: number) => Promise<void>;
|
|
85
|
-
|
|
86
|
-
listProcesses: (c: AnyContext) => Promise<_rivet_dev_agentos_core.SpawnedProcessInfo[]>;
|
|
87
|
-
allProcesses: (c: AnyContext) => Promise<_rivet_dev_agentos_core_internal_runtime_compat.ProcessInfo[]>;
|
|
234
|
+
listProcesses: (c: AnyContext) => Promise<ProcessDescriptor[]>;
|
|
88
235
|
processTree: (c: AnyContext) => Promise<_rivet_dev_agentos_core.ProcessTreeNode[]>;
|
|
89
|
-
getProcess: (c: AnyContext, pid: number) => Promise<
|
|
236
|
+
getProcess: (c: AnyContext, pid: number) => Promise<ProcessDescriptor>;
|
|
90
237
|
writeProcessStdin: (c: AnyContext, pid: number, data: string | Uint8Array<ArrayBufferLike>) => Promise<void>;
|
|
91
238
|
closeProcessStdin: (c: AnyContext, pid: number) => Promise<void>;
|
|
92
239
|
openShell: (c: AnyContext, options?: _rivet_dev_agentos_core.ShellOptions | undefined) => Promise<{
|
|
93
240
|
shellId: string;
|
|
94
241
|
}>;
|
|
242
|
+
listShells: (c: AnyContext) => Promise<ShellInfo[]>;
|
|
243
|
+
shellSnapshot: (c: AnyContext, shellId: string, mode?: ShellReplayMode) => Promise<ShellSnapshot | null>;
|
|
95
244
|
writeShell: (c: AnyContext, shellId: string, data: string | Uint8Array<ArrayBufferLike>) => Promise<void>;
|
|
96
245
|
resizeShell: (c: AnyContext, shellId: string, cols: number, rows: number) => Promise<void>;
|
|
97
246
|
closeShell: (c: AnyContext, shellId: string) => Promise<void>;
|
|
98
247
|
waitShell: (c: AnyContext, shellId: string) => Promise<number>;
|
|
99
248
|
httpRequest: (c: AnyContext, request: _rivet_dev_agentos_core.HttpRequest) => Promise<_rivet_dev_agentos_core.HttpResponse>;
|
|
249
|
+
vmFetch: (c: AnyContext, port: number, url: string, requestOptions?: VmFetchOptions) => Promise<VmFetchResponse>;
|
|
250
|
+
vmFetchStreamStart: (c: AnyContext, port: number, url: string, requestOptions?: VmFetchOptions) => Promise<VmFetchStreamHead>;
|
|
251
|
+
vmFetchStreamRead: (c: AnyContext, streamId: string, maxBytes?: number) => Promise<VmFetchStreamChunk>;
|
|
252
|
+
vmFetchStreamCancel: (c: AnyContext, streamId: string) => Promise<void>;
|
|
100
253
|
scheduleCron: (c: AnyContext, cronOptions: SerializableCronJobOptions) => Promise<{
|
|
101
254
|
id: string;
|
|
102
255
|
}>;
|
|
@@ -116,6 +269,11 @@ declare function createAgentOsActions(options?: AgentOsOptions, hooks?: AgentOsE
|
|
|
116
269
|
setSessionConfigOption: (c: AnyContext, input: _rivet_dev_agentos_core.SetSessionConfigOptionInput) => Promise<_rivet_dev_agentos_core.SessionConfig>;
|
|
117
270
|
getSessionCapabilities: (c: AnyContext, input?: _rivet_dev_agentos_core.SessionTarget | undefined) => Promise<_rivet_dev_agentos_core.SessionCapabilities | null>;
|
|
118
271
|
getSessionAgentInfo: (c: AnyContext, input?: _rivet_dev_agentos_core.SessionTarget | undefined) => Promise<_agentclientprotocol_sdk.Implementation | null>;
|
|
272
|
+
listSoftware: (c: AnyContext) => Promise<{
|
|
273
|
+
packageName: string;
|
|
274
|
+
commands: string[];
|
|
275
|
+
}[]>;
|
|
276
|
+
linkSoftware: (c: AnyContext, descriptor: PackageDescriptor) => Promise<void>;
|
|
119
277
|
createPreviewUrl: (c: AnyContext, port: number, ttlSeconds?: number) => Promise<{
|
|
120
278
|
path: string;
|
|
121
279
|
token: string;
|
|
@@ -123,18 +281,165 @@ declare function createAgentOsActions(options?: AgentOsOptions, hooks?: AgentOsE
|
|
|
123
281
|
expiresAt: number;
|
|
124
282
|
}>;
|
|
125
283
|
expirePreviewUrl: (c: AnyContext, token: string) => Promise<void>;
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
284
|
+
health: (c: AnyContext) => Promise<RuntimeHealth>;
|
|
285
|
+
createContext: (c: AnyContext, contextId: string) => Promise<void>;
|
|
286
|
+
process: {
|
|
287
|
+
exec: (c: AnyContext, command: string, actorOptions?: ActorLanguageExecutionOptions) => Promise<CodeExecutionResult>;
|
|
288
|
+
execFile: (c: AnyContext, command: string, args?: readonly string[], actorOptions?: Omit<ActorLanguageExecutionOptions, "args">) => Promise<CodeExecutionResult>;
|
|
289
|
+
spawn: (c: AnyContext, command: string, args?: string[], actorOptions?: ActorSpawnOptions) => Promise<ProcessDescriptor>;
|
|
290
|
+
get: (c: AnyContext, pid: number) => Promise<ProcessDescriptor>;
|
|
291
|
+
list: (c: AnyContext) => Promise<ProcessDescriptor[]>;
|
|
292
|
+
tree: (c: AnyContext) => Promise<_rivet_dev_agentos_core.ProcessTreeNode[]>;
|
|
293
|
+
wait: (c: AnyContext, pid: number) => Promise<_rivet_dev_agentos_core.ProcessExit>;
|
|
294
|
+
signal: (c: AnyContext, pid: number, signal: _rivet_dev_agentos_core.ExecutionSignal) => Promise<void>;
|
|
295
|
+
kill: (c: AnyContext, pid: number) => Promise<void>;
|
|
296
|
+
writeStdin: (c: AnyContext, pid: number, data: string | Uint8Array<ArrayBufferLike>) => Promise<void>;
|
|
297
|
+
closeStdin: (c: AnyContext, pid: number) => Promise<void>;
|
|
298
|
+
resizePty: (c: AnyContext, pid: number, size: {
|
|
299
|
+
cols: number;
|
|
300
|
+
rows: number;
|
|
301
|
+
}) => Promise<void>;
|
|
302
|
+
readOutput: (c: AnyContext, pid: number, options?: {
|
|
303
|
+
after?: number;
|
|
304
|
+
} | undefined) => Promise<{
|
|
305
|
+
events: {
|
|
306
|
+
chunk: {
|
|
307
|
+
encoding: "base64";
|
|
308
|
+
data: string;
|
|
309
|
+
};
|
|
310
|
+
pid: number;
|
|
311
|
+
sequence: number;
|
|
312
|
+
channel: "stdout" | "stderr" | "pty";
|
|
313
|
+
timestampMs: number;
|
|
314
|
+
}[];
|
|
315
|
+
pid: number;
|
|
316
|
+
nextCursor: string;
|
|
317
|
+
hasMore: boolean;
|
|
318
|
+
truncated: boolean;
|
|
319
|
+
}>;
|
|
320
|
+
};
|
|
321
|
+
javascript: {
|
|
322
|
+
execute: (c: AnyContext, source: string, actorOptions?: ActorJavaScriptExecutionOptions) => Promise<CodeExecutionResult>;
|
|
323
|
+
evaluate: (c: AnyContext, expression: string, actorOptions?: ActorJavaScriptExecutionOptions) => Promise<_rivet_dev_agentos_core.CodeEvaluationResult<_rivet_dev_agentos_core.JsonValue>>;
|
|
324
|
+
executeFile: (c: AnyContext, path: string, actorOptions?: ActorLanguageExecutionOptions) => Promise<CodeExecutionResult>;
|
|
325
|
+
spawn: (c: AnyContext, source: string, actorOptions?: ActorLanguageSpawnOptions) => Promise<ProcessDescriptor>;
|
|
326
|
+
spawnFile: (c: AnyContext, path: string, actorOptions?: ActorLanguageSpawnOptions) => Promise<ProcessDescriptor>;
|
|
327
|
+
npm: {
|
|
328
|
+
install: (c: AnyContext, ...args: [options?: ActorNpmProjectInstallOptions] | [packages: string | string[], options?: ActorNpmPackageInstallOptions]) => Promise<CodeExecutionResult>;
|
|
329
|
+
runScript: (c: AnyContext, script: string, actorOptions?: ActorLanguageExecutionOptions) => Promise<CodeExecutionResult>;
|
|
330
|
+
runPackage: (c: AnyContext, packageSpec: string, actorOptions?: ActorLanguageExecutionOptions & {
|
|
331
|
+
binary?: string;
|
|
332
|
+
}) => Promise<CodeExecutionResult>;
|
|
333
|
+
};
|
|
334
|
+
};
|
|
335
|
+
typescript: {
|
|
336
|
+
execute: (c: AnyContext, source: string, actorOptions?: ActorTypeScriptExecutionOptions) => Promise<CodeExecutionResult>;
|
|
337
|
+
evaluate: (c: AnyContext, expression: string, actorOptions?: ActorTypeScriptExecutionOptions) => Promise<_rivet_dev_agentos_core.CodeEvaluationResult<_rivet_dev_agentos_core.JsonValue>>;
|
|
338
|
+
executeFile: (c: AnyContext, path: string, actorOptions?: ActorTypeScriptFileExecutionOptions) => Promise<CodeExecutionResult>;
|
|
339
|
+
spawn: (c: AnyContext, source: string, actorOptions?: ActorLanguageSpawnOptions) => Promise<ProcessDescriptor>;
|
|
340
|
+
spawnFile: (c: AnyContext, path: string, actorOptions?: ActorLanguageSpawnOptions) => Promise<ProcessDescriptor>;
|
|
341
|
+
check: (c: AnyContext, source: string, actorOptions?: ActorTypeScriptCheckOptions) => Promise<_rivet_dev_agentos_core.TypeScriptCheckResult>;
|
|
342
|
+
checkProject: (c: AnyContext, actorOptions?: Omit<ActorTypeScriptCheckOptions, "filePath" | "compilerOptions">) => Promise<_rivet_dev_agentos_core.TypeScriptCheckResult>;
|
|
343
|
+
};
|
|
344
|
+
python: {
|
|
345
|
+
execute: (c: AnyContext, source: string, actorOptions?: ActorInlineExecutionOptions) => Promise<CodeExecutionResult>;
|
|
346
|
+
evaluate: (c: AnyContext, expression: string, actorOptions?: ActorInlineExecutionOptions) => Promise<_rivet_dev_agentos_core.CodeEvaluationResult<_rivet_dev_agentos_core.JsonValue>>;
|
|
347
|
+
executeFile: (c: AnyContext, path: string, actorOptions?: ActorLanguageExecutionOptions) => Promise<CodeExecutionResult>;
|
|
348
|
+
executeModule: (c: AnyContext, module: string, actorOptions?: ActorLanguageExecutionOptions) => Promise<CodeExecutionResult>;
|
|
349
|
+
spawn: (c: AnyContext, source: string, actorOptions?: ActorLanguageSpawnOptions) => Promise<ProcessDescriptor>;
|
|
350
|
+
spawnFile: (c: AnyContext, path: string, actorOptions?: ActorLanguageSpawnOptions) => Promise<ProcessDescriptor>;
|
|
351
|
+
spawnModule: (c: AnyContext, module: string, actorOptions?: ActorLanguageSpawnOptions) => Promise<ProcessDescriptor>;
|
|
352
|
+
install: (c: AnyContext, ...args: [options?: ActorPythonInstallOptions] | [packages: string | string[], options?: ActorPythonInstallOptions]) => Promise<CodeExecutionResult>;
|
|
353
|
+
};
|
|
354
|
+
contexts: {
|
|
355
|
+
get: (c: AnyContext, contextId: string) => Promise<_rivet_dev_agentos_core.ContextDescriptor>;
|
|
356
|
+
list: (c: AnyContext) => Promise<_rivet_dev_agentos_core.ContextDescriptor[]>;
|
|
357
|
+
reset: (c: AnyContext, contextId: string) => Promise<void>;
|
|
358
|
+
delete: (c: AnyContext, contextId: string) => Promise<void>;
|
|
359
|
+
};
|
|
360
|
+
terminal: {
|
|
361
|
+
open: (c: AnyContext, options?: _rivet_dev_agentos_core.ShellOptions | undefined) => Promise<{
|
|
362
|
+
shellId: string;
|
|
363
|
+
}>;
|
|
364
|
+
list: (c: AnyContext) => Promise<ShellInfo[]>;
|
|
365
|
+
snapshot: (c: AnyContext, shellId: string, mode?: ShellReplayMode) => Promise<ShellSnapshot | null>;
|
|
366
|
+
write: (c: AnyContext, shellId: string, data: string | Uint8Array<ArrayBufferLike>) => Promise<void>;
|
|
367
|
+
resize: (c: AnyContext, shellId: string, cols: number, rows: number) => Promise<void>;
|
|
368
|
+
wait: (c: AnyContext, shellId: string) => Promise<number>;
|
|
369
|
+
close: (c: AnyContext, shellId: string) => Promise<void>;
|
|
370
|
+
};
|
|
371
|
+
filesystem: {
|
|
372
|
+
readFile: (c: AnyContext, path: string) => Promise<Uint8Array<ArrayBufferLike>>;
|
|
373
|
+
writeFile: (c: AnyContext, path: string, content: string | Uint8Array<ArrayBufferLike>) => Promise<void>;
|
|
374
|
+
readFiles: (c: AnyContext, paths: string[]) => Promise<_rivet_dev_agentos_core.BatchReadResult[]>;
|
|
375
|
+
writeFiles: (c: AnyContext, entries: _rivet_dev_agentos_core.BatchWriteEntry[]) => Promise<_rivet_dev_agentos_core.BatchWriteResult[]>;
|
|
376
|
+
stat: (c: AnyContext, path: string) => Promise<_rivet_dev_agentos_core_internal_runtime_compat.VirtualStat>;
|
|
377
|
+
mkdir: (c: AnyContext, path: string, options?: {
|
|
378
|
+
recursive?: boolean;
|
|
379
|
+
} | undefined) => Promise<void>;
|
|
380
|
+
readdir: (c: AnyContext, path: string) => Promise<string[]>;
|
|
381
|
+
readdirEntries: (c: AnyContext, path: string) => Promise<_rivet_dev_agentos_core.ReaddirEntry[]>;
|
|
382
|
+
readdirRecursive: (c: AnyContext, path: string, options?: _rivet_dev_agentos_core.ReaddirRecursiveOptions | undefined) => Promise<_rivet_dev_agentos_core.DirEntry[]>;
|
|
383
|
+
exists: (c: AnyContext, path: string) => Promise<boolean>;
|
|
384
|
+
move: (c: AnyContext, from: string, to: string) => Promise<void>;
|
|
385
|
+
remove: (c: AnyContext, path: string, options?: {
|
|
386
|
+
recursive?: boolean;
|
|
387
|
+
} | undefined) => Promise<void>;
|
|
388
|
+
export: (c: AnyContext, options: _rivet_dev_agentos_core.ExportRootFilesystemOptions) => Promise<_rivet_dev_agentos_core.RootSnapshotExport>;
|
|
389
|
+
mount: (c: AnyContext, descriptor: DynamicMountDescriptor) => Promise<void>;
|
|
390
|
+
unmount: (c: AnyContext, path: string) => Promise<void>;
|
|
391
|
+
listMounts: (c: AnyContext) => Promise<_rivet_dev_agentos_core.MountInfo[]>;
|
|
392
|
+
};
|
|
393
|
+
network: {
|
|
394
|
+
httpRequest: (c: AnyContext, request: _rivet_dev_agentos_core.HttpRequest) => Promise<_rivet_dev_agentos_core.HttpResponse>;
|
|
395
|
+
};
|
|
396
|
+
software: {
|
|
397
|
+
list: (c: AnyContext) => Promise<{
|
|
398
|
+
packageName: string;
|
|
399
|
+
commands: string[];
|
|
400
|
+
}[]>;
|
|
401
|
+
link: (c: AnyContext, descriptor: PackageDescriptor) => Promise<void>;
|
|
402
|
+
};
|
|
403
|
+
agents: {
|
|
404
|
+
list: (c: AnyContext) => Promise<_rivet_dev_agentos_core.AgentRegistryEntry[]>;
|
|
405
|
+
};
|
|
406
|
+
sessions: {
|
|
407
|
+
open: (c: AnyContext, input: OpenSessionInput) => Promise<void>;
|
|
408
|
+
get: (c: AnyContext, input?: _rivet_dev_agentos_core.SessionTarget | undefined) => Promise<_rivet_dev_agentos_core.SessionInfo>;
|
|
409
|
+
list: (c: AnyContext, input?: _rivet_dev_agentos_core.ListSessionsInput | undefined) => Promise<_rivet_dev_agentos_core.SessionPage>;
|
|
410
|
+
delete: (c: AnyContext, input?: _rivet_dev_agentos_core.SessionTarget | undefined) => Promise<void>;
|
|
411
|
+
unload: (c: AnyContext, input?: _rivet_dev_agentos_core.SessionTarget | undefined) => Promise<void>;
|
|
412
|
+
prompt: (c: AnyContext, input: PromptInput) => Promise<_rivet_dev_agentos_core.PromptResult>;
|
|
413
|
+
cancelPrompt: (c: AnyContext, input?: _rivet_dev_agentos_core.SessionTarget | undefined) => Promise<_rivet_dev_agentos_core.CancelPromptResult>;
|
|
414
|
+
respondPermission: (c: AnyContext, input: _rivet_dev_agentos_core.PermissionResponse) => Promise<_rivet_dev_agentos_core.PermissionResponseResult>;
|
|
415
|
+
readHistory: (c: AnyContext, input?: _rivet_dev_agentos_core.ReadHistoryInput | undefined) => Promise<_rivet_dev_agentos_core.HistoryPage>;
|
|
416
|
+
getConfig: (c: AnyContext, input?: _rivet_dev_agentos_core.SessionTarget | undefined) => Promise<_rivet_dev_agentos_core.SessionConfig>;
|
|
417
|
+
setConfigOption: (c: AnyContext, input: _rivet_dev_agentos_core.SetSessionConfigOptionInput) => Promise<_rivet_dev_agentos_core.SessionConfig>;
|
|
418
|
+
getCapabilities: (c: AnyContext, input?: _rivet_dev_agentos_core.SessionTarget | undefined) => Promise<_rivet_dev_agentos_core.SessionCapabilities | null>;
|
|
419
|
+
getAgentInfo: (c: AnyContext, input?: _rivet_dev_agentos_core.SessionTarget | undefined) => Promise<_agentclientprotocol_sdk.Implementation | null>;
|
|
420
|
+
};
|
|
421
|
+
cron: {
|
|
422
|
+
schedule: (c: AnyContext, cronOptions: SerializableCronJobOptions) => Promise<{
|
|
423
|
+
id: string;
|
|
424
|
+
}>;
|
|
425
|
+
list: (c: AnyContext) => Promise<_rivet_dev_agentos_core.CronJobInfo[]>;
|
|
426
|
+
cancel: (c: AnyContext, id: string) => Promise<void>;
|
|
427
|
+
};
|
|
135
428
|
};
|
|
136
429
|
type AgentOsActions = ReturnType<typeof createAgentOsActions>;
|
|
137
430
|
interface AgentOsActorExtras extends AgentOsOptions {
|
|
431
|
+
/**
|
|
432
|
+
* Resolve trusted VM options from actor state immediately before the VM's
|
|
433
|
+
* first boot. Evaluated once per wake. The actor-owned root filesystem and
|
|
434
|
+
* database cannot be replaced.
|
|
435
|
+
*/
|
|
436
|
+
resolveOptions?: (c: AnyContext) => AgentOsOptions | Promise<AgentOsOptions>;
|
|
437
|
+
/** Start long-lived processes after each VM boot. Trusted host code only. */
|
|
438
|
+
onVmStart?: (c: AnyContext, vm: AgentOs) => void | Promise<void>;
|
|
439
|
+
/** Gracefully stop long-lived processes before the VM is disposed. */
|
|
440
|
+
onVmStop?: (c: AnyContext, vm: AgentOs, reason: "sleep" | "destroy" | "error") => void | Promise<void>;
|
|
441
|
+
/** Clean up host resources after the VM and lazy mount readers close. */
|
|
442
|
+
onVmDisposed?: (c: AnyContext, reason: "sleep" | "destroy" | "error") => void | Promise<void>;
|
|
138
443
|
/** Maximum live session event subscriptions per actor VM. Default: 10,000. */
|
|
139
444
|
maxSessionSubscriptions?: number;
|
|
140
445
|
/** Maximum durable dynamic mount descriptors per actor. Default: 10,000. */
|
|
@@ -147,7 +452,8 @@ interface AgentOsActorExtras extends AgentOsOptions {
|
|
|
147
452
|
maxActiveTokens?: number;
|
|
148
453
|
};
|
|
149
454
|
}
|
|
150
|
-
type
|
|
455
|
+
type DistributiveOmit<T, K extends PropertyKey> = T extends unknown ? Omit<T, K> : never;
|
|
456
|
+
type AgentOsActorConfigInput<TState = undefined, TConnParams = undefined, TConnState = undefined, TVars = undefined, TInput = undefined, TEvents extends EventSchemaConfig = Record<never, never>, TQueues extends QueueSchemaConfig = Record<never, never>, TUserActions extends Actions<TState, TConnParams, TConnState, TVars, TInput, ActorDb, TEvents, TQueues> = Record<never, never>> = DistributiveOmit<ActorConfigInput<TState, TConnParams, TConnState, TVars, TInput, ActorDb, TEvents, TQueues, TUserActions>, "db"> & AgentOsActorExtras & AgentOsEventHooks<ActorContext<TState, TConnParams, TConnState, TVars, TInput, ActorDb, TEvents, TQueues>>;
|
|
151
457
|
declare function createAgentOS<TState = undefined, TConnParams = undefined, TConnState = undefined, TVars = undefined, TInput = undefined, TEvents extends EventSchemaConfig = Record<never, never>, TQueues extends QueueSchemaConfig = Record<never, never>, TUserActions extends Actions<TState, TConnParams, TConnState, TVars, TInput, ActorDb, TEvents, TQueues> = Record<never, never>>(config?: AgentOsActorConfigInput<TState, TConnParams, TConnState, TVars, TInput, TEvents, TQueues, TUserActions>): ActorDefinition<TState, TConnParams, TConnState, TVars, TInput, ActorDb, TEvents & BuiltInEvents, TQueues, TUserActions & AgentOsActions>;
|
|
152
458
|
|
|
153
459
|
/**
|
|
@@ -156,4 +462,4 @@ declare function createAgentOS<TState = undefined, TConnParams = undefined, TCon
|
|
|
156
462
|
*/
|
|
157
463
|
declare const setup: typeof setup$1;
|
|
158
464
|
|
|
159
|
-
export { type AgentOsActorConfigInput as AgentOSActorConfigInput, type AgentOsActorConfigInput as AgentOSConfigInput, type AgentOsActions, type AgentOsActorConfigInput, type AgentOsActorExtras, type AgentOsEventHooks, type AgentOsEvents, type ProcessExitPayload, type ProcessOutputPayload, type SerializableCronAction, type SerializableCronEvent, type SerializableCronJobInfo, type SerializableCronJobOptions, type ShellDataPayload, type ShellExitPayload, type VmBootedPayload, type VmShutdownPayload, createAgentOS as agentOS, createAgentOS, createAgentOsActions, setup };
|
|
465
|
+
export { type ActorData, type ActorLanguageSpawnOptions, type ActorSpawnOptions, type AgentOsActorConfigInput as AgentOSActorConfigInput, type AgentOsActorConfigInput as AgentOSConfigInput, type AgentOsActions, type AgentOsActorConfigInput, type AgentOsActorExtras, type AgentOsEventHooks, type AgentOsEvents, type ProcessExitPayload, type ProcessOutputPayload, type RuntimeAgentExit, type RuntimeHealth, type RuntimeLimitWarning, type RuntimeSidecarInfo, type RuntimeStderrLine, type SerializableCronAction, type SerializableCronEvent, type SerializableCronJobInfo, type SerializableCronJobOptions, type ShellDataPayload, type ShellExitPayload, type ShellInfo, type ShellReplayMode, type ShellSnapshot, type VmBootedPayload, type VmFetchOptions, type VmFetchResponse, type VmFetchStreamChunk, type VmFetchStreamHead, type VmShutdownPayload, createAgentOS as agentOS, createAgentOS, createAgentOsActions, setup };
|