@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
package/assets/inspector-tabs-app/assets/{useMutation-CmlocRNE.js → useMutation-B4fxUbt-.js}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
var
|
|
1
|
+
var w=i=>{throw TypeError(i)};var S=(i,t,s)=>t.has(i)||w("Cannot "+s);var e=(i,t,s)=>(S(i,t,"read from private field"),s?s.call(i):t.get(i)),p=(i,t,s)=>t.has(i)?w("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(i):t.set(i,s),y=(i,t,s,r)=>(S(i,t,"write to private field"),r?r.call(i,s):t.set(i,s),s),d=(i,t,s)=>(S(i,t,"access private method"),s);import{t as U,v as k,w as R,x as q,y as P,u as z,r as f,z as L,B as A}from"./index-CMgGagyE.js";var n,c,h,a,o,v,g,j,B=(j=class extends U{constructor(t,s){super();p(this,o);p(this,n);p(this,c);p(this,h);p(this,a);y(this,n,t),this.setOptions(s),this.bindMethods(),d(this,o,v).call(this)}bindMethods(){this.mutate=this.mutate.bind(this),this.reset=this.reset.bind(this)}setOptions(t){var r;const s=this.options;this.options=e(this,n).defaultMutationOptions(t),k(this.options,s)||e(this,n).getMutationCache().notify({type:"observerOptionsUpdated",mutation:e(this,h),observer:this}),s!=null&&s.mutationKey&&this.options.mutationKey&&R(s.mutationKey)!==R(this.options.mutationKey)?this.reset():((r=e(this,h))==null?void 0:r.state.status)==="pending"&&e(this,h).setOptions(this.options)}onSubscribe(){this.listeners.size===1&&e(this,h)&&(e(this,h).addObserver(this),d(this,o,v).call(this))}onUnsubscribe(){var t;this.hasListeners()||(t=e(this,h))==null||t.removeObserver(this)}onMutationUpdate(t){d(this,o,v).call(this),d(this,o,g).call(this,t)}getCurrentResult(){return e(this,c)}reset(){var t;(t=e(this,h))==null||t.removeObserver(this),y(this,h,void 0),d(this,o,v).call(this),d(this,o,g).call(this)}mutate(t,s){var r;return y(this,a,s),(r=e(this,h))==null||r.removeObserver(this),y(this,h,e(this,n).getMutationCache().build(e(this,n),this.options)),e(this,h).addObserver(this),e(this,h).execute(t)}},n=new WeakMap,c=new WeakMap,h=new WeakMap,a=new WeakMap,o=new WeakSet,v=function(){var s;const t=((s=e(this,h))==null?void 0:s.state)??q();y(this,c,{...t,isPending:t.status==="pending",isSuccess:t.status==="success",isError:t.status==="error",isIdle:t.status==="idle",mutate:this.mutate,reset:this.reset})},g=function(t){P.batch(()=>{var s,r,u,O,l,E,x,K;if(e(this,a)&&this.hasListeners()){const m=e(this,c).variables,M=e(this,c).context,C={client:e(this,n),meta:this.options.meta,mutationKey:this.options.mutationKey};if((t==null?void 0:t.type)==="success"){try{(r=(s=e(this,a)).onSuccess)==null||r.call(s,t.data,m,M,C)}catch(b){Promise.reject(b)}try{(O=(u=e(this,a)).onSettled)==null||O.call(u,t.data,null,m,M,C)}catch(b){Promise.reject(b)}}else if((t==null?void 0:t.type)==="error"){try{(E=(l=e(this,a)).onError)==null||E.call(l,t.error,m,M,C)}catch(b){Promise.reject(b)}try{(K=(x=e(this,a)).onSettled)==null||K.call(x,void 0,t.error,m,M,C)}catch(b){Promise.reject(b)}}}this.listeners.forEach(m=>{m(e(this,c))})})},j);function Q(i,t){const s=z(),[r]=f.useState(()=>new B(s,i));f.useEffect(()=>{r.setOptions(i)},[r,i]);const u=f.useSyncExternalStore(f.useCallback(l=>r.subscribe(P.batchCalls(l)),[r]),()=>r.getCurrentResult(),()=>r.getCurrentResult()),O=f.useCallback((...l)=>{r.mutate(l[0],l[1]).catch(L)},[r]);if(u.error&&A(r.options.throwOnError,[u.error]))throw u.error;return{...u,mutate:O,mutateAsync:u.mutate}}export{Q as u};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var de=t=>{throw TypeError(t)};var W=(t,e,s)=>e.has(t)||de("Cannot "+s);var i=(t,e,s)=>(W(t,e,"read from private field"),s?s.call(t):e.get(t)),g=(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)=>(W(t,e,"write to private field"),r?r.call(t,s):e.set(t,s),s),m=(t,e,s)=>(W(t,e,"access private method"),s);import{t as Ce,E as v,v as X,z as Ee,G as Pe,H as _e,J as Ne,K,L as Qe,M as Fe,N as fe,y as Re,r as A,B as Me,O as Le,u as Ue,m as f,Q as C,V as Be,p as ke,j as H,S as me}from"./index-CMgGagyE.js";var E,o,q,R,_,L,O,z,U,B,N,Q,T,k,l,D,Y,J,Z,ee,te,se,re,ie,ge,De=(ge=class extends Ce{constructor(e,s){super();g(this,l);g(this,E);g(this,o);g(this,q);g(this,R);g(this,_);g(this,L);g(this,O);g(this,z);g(this,U);g(this,B);g(this,N);g(this,Q);g(this,T);g(this,k,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,k).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:S}=h;y=h.data;let F=!1;if(s.placeholderData!==void 0&&y===void 0&&S==="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,B))==null?void 0:he.state.data,i(this,B)):s.placeholderData,I!==void 0&&(S="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,z))y=i(this,U);else try{d(this,z,s.select),y=s.select(y),y=fe(a==null?void 0:a.data,y,s),d(this,U,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,U),M=Date.now(),S="error",b=!1);const V=h.fetchStatus==="fetching",G=S==="pending",$=S==="error",le=G&&V,ue=y!==void 0;return{status:S,fetchStatus:h.fetchStatus,isPending:G,isSuccess:S==="success",isError:$,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:$&&!ue,isPaused:h.fetchStatus==="paused",isPlaceholderData:b,isRefetchError:$&&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,B,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,k).size)return!0;const u=new Set(c??i(this,k));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,z=new WeakMap,U=new WeakMap,B=new WeakMap,N=new WeakMap,Q=new WeakMap,T=new WeakMap,k=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,K.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,K.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&&(K.clearTimeout(i(this,N)),d(this,N,void 0))},re=function(){i(this,Q)!==void 0&&(K.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))},ge);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),ze=()=>A.useContext(xe);xe.Provider;const Ke=(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))},He=t=>{A.useEffect(()=>{t.clearReset()},[t])},je=({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,$e=(t,e,s)=>e.fetchOptimistic(t).catch(()=>{s.clearReset()});function We(t,e,s){const r=ze(),n=Le(),a=Ue(),c=a.defaultQueryOptions(t),u=a.getQueryCache().get(c.queryHash),w=t.subscribed!==!1;c._optimisticResults=r?"isRestoring":w?"optimistic":void 0,Ve(c),Ke(c,n,u),He(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 $e(c,p,n);if(je({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 We(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,Se=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:Be,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 j(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 j(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 j(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 j(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",S=>S.v1.terminal.output.read({terminal:n,after:u,maxBytes:Se,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 S of b.events){if(S.sequence<0||typeof S.sequence=="number"&&!Number.isSafeInteger(S.sequence)||x!==void 0&&S.sequence<=x)throw new Error("Terminal replay returned out-of-order sequences");x=S.sequence;const F=ve(S.data);if(y+=F.byteLength,y>Se)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 j(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=ke();if(n.useEvent("vmBooted",()=>{r("ready"),e.refetch()}),n.useEvent("vmShutdown",()=>{r("stopped"),e.refetch()}),e.error)return H.jsxs("span",{className:"inline-flex items-center gap-1.5 rounded border px-2 py-0.5 text-[11px] text-muted-foreground",children:[H.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 H.jsxs("span",{className:"inline-flex items-center gap-1.5 rounded border px-2 py-0.5 text-[11px] text-muted-foreground",children:[H.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,We as c,ot as d,ve as e,it as h,lt as s,Xe as u};
|
|
@@ -4,7 +4,7 @@
|
|
|
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-
|
|
7
|
+
<script type="module" crossorigin src="./assets/index-CMgGagyE.js"></script>
|
|
8
8
|
<link rel="stylesheet" crossorigin href="./assets/index-BQ48yGn7.css">
|
|
9
9
|
</head>
|
|
10
10
|
<body>
|
package/dist/index.d.ts
CHANGED
|
@@ -3,13 +3,13 @@ import { ActorAccessor, GetOptions, ActorHandle, ActorConnectOptions, ActorConn,
|
|
|
3
3
|
|
|
4
4
|
declare const AGENTOS_API_VERSION: "agentos-sdk.dev/v1alpha1";
|
|
5
5
|
declare const AGENTOS_CONTRACT_MAJOR: 1;
|
|
6
|
-
declare const AGENTOS_CONTRACT_HASH: "sha256:
|
|
7
|
-
declare const AGENTOS_CAPABILITIES: readonly ["config.merge-patch", "network.pull-streaming", "output.replay", "inspector.filesystem", "inspector.processes", "inspector.software", "inspector.terminals", "inspector.vm", "language.javascript", "language.python", "language.typescript"];
|
|
6
|
+
declare const AGENTOS_CONTRACT_HASH: "sha256:06086c42788602d49d762f2b3003a8fe89a3d136219611cdbbc84d0fc4c267ca";
|
|
7
|
+
declare const AGENTOS_CAPABILITIES: readonly ["config.merge-patch", "network.pull-streaming", "output.replay", "inspector.filesystem", "inspector.processes", "inspector.software", "inspector.terminals", "inspector.vm", "language.javascript", "language.python", "language.typescript", "software.registry"];
|
|
8
8
|
declare const AGENTOS_CONTRACT: {
|
|
9
9
|
readonly apiVersion: "agentos-sdk.dev/v1alpha1";
|
|
10
10
|
readonly contractMajor: 1;
|
|
11
|
-
readonly contractHash: "sha256:
|
|
12
|
-
readonly capabilities: readonly ["config.merge-patch", "network.pull-streaming", "output.replay", "inspector.filesystem", "inspector.processes", "inspector.software", "inspector.terminals", "inspector.vm", "language.javascript", "language.python", "language.typescript"];
|
|
11
|
+
readonly contractHash: "sha256:06086c42788602d49d762f2b3003a8fe89a3d136219611cdbbc84d0fc4c267ca";
|
|
12
|
+
readonly capabilities: readonly ["config.merge-patch", "network.pull-streaming", "output.replay", "inspector.filesystem", "inspector.processes", "inspector.software", "inspector.terminals", "inspector.vm", "language.javascript", "language.python", "language.typescript", "software.registry"];
|
|
13
13
|
};
|
|
14
14
|
declare namespace Input {
|
|
15
15
|
type ActorCodeEvaluationResult = {
|
|
@@ -275,6 +275,12 @@ declare namespace Input {
|
|
|
275
275
|
};
|
|
276
276
|
cwd?: string | null;
|
|
277
277
|
stdio?: SpawnStdio | null;
|
|
278
|
+
/**
|
|
279
|
+
* Keep stdin open for `v1.process.stdin.write`. Without it the process reads EOF, as under
|
|
280
|
+
* `docker exec` without `-i`, so a command that reads stdin cannot wait forever, and
|
|
281
|
+
* `v1.process.stdin.write` fails with `invalid_input`.
|
|
282
|
+
*/
|
|
283
|
+
openStdin?: boolean | null;
|
|
278
284
|
stdinFd?: number | null;
|
|
279
285
|
stdoutFd?: number | null;
|
|
280
286
|
stderrFd?: number | null;
|
|
@@ -360,7 +366,12 @@ declare namespace Input {
|
|
|
360
366
|
* diffutils, tar, gzip) before `software`. Defaults to true.
|
|
361
367
|
*/
|
|
362
368
|
defaultSoftware?: boolean | null;
|
|
363
|
-
|
|
369
|
+
/**
|
|
370
|
+
* Software installed after the default software, in order. Registry
|
|
371
|
+
* entries are resolved to an exact URL and digest when the config is
|
|
372
|
+
* accepted, so the durable config never follows a moving manifest.
|
|
373
|
+
*/
|
|
374
|
+
software?: Array<SoftwareSourceInput> | null;
|
|
364
375
|
preview?: PreviewPolicyInput | null;
|
|
365
376
|
};
|
|
366
377
|
type AgentOsActorCreateInput = {
|
|
@@ -784,6 +795,17 @@ declare namespace Input {
|
|
|
784
795
|
module: string;
|
|
785
796
|
options?: ActorLanguageSpawnOptions;
|
|
786
797
|
};
|
|
798
|
+
type RegistrySoftwareSourceInput = {
|
|
799
|
+
/**
|
|
800
|
+
* Registry package name, such as `git` or `ripgrep`.
|
|
801
|
+
*/
|
|
802
|
+
registry: string;
|
|
803
|
+
/**
|
|
804
|
+
* agentOS release whose manifest lists the package, such as `0.4.3` or
|
|
805
|
+
* `latest`. Defaults to the agentOS release the actor is built with.
|
|
806
|
+
*/
|
|
807
|
+
version?: string | null;
|
|
808
|
+
};
|
|
787
809
|
type RemotePackageSource = {
|
|
788
810
|
url: string;
|
|
789
811
|
digest?: string | null;
|
|
@@ -832,7 +854,11 @@ declare namespace Input {
|
|
|
832
854
|
};
|
|
833
855
|
type SnapshotExportKind = "snapshot-export";
|
|
834
856
|
type SoftwareInstall = {
|
|
835
|
-
|
|
857
|
+
/**
|
|
858
|
+
* A `{ url, digest? }` artifact or a `{ registry, version? }` package. The
|
|
859
|
+
* result's `source` is the resolved, digest-pinned URL that is persisted.
|
|
860
|
+
*/
|
|
861
|
+
source: SoftwareSourceInput;
|
|
836
862
|
expectedRevision?: number | bigint | null;
|
|
837
863
|
};
|
|
838
864
|
type SoftwareList = Record<string, never>;
|
|
@@ -841,6 +867,7 @@ declare namespace Input {
|
|
|
841
867
|
source: RemotePackageSource;
|
|
842
868
|
config: ConfigSnapshot;
|
|
843
869
|
};
|
|
870
|
+
type SoftwareSourceInput = RegistrySoftwareSourceInput | RemotePackageSourceInput;
|
|
844
871
|
type SoftwareUninstall = {
|
|
845
872
|
packageId: string;
|
|
846
873
|
expectedRevision?: number | bigint | null;
|
|
@@ -1252,6 +1279,12 @@ declare namespace Output {
|
|
|
1252
1279
|
};
|
|
1253
1280
|
cwd?: string | null;
|
|
1254
1281
|
stdio?: SpawnStdio | null;
|
|
1282
|
+
/**
|
|
1283
|
+
* Keep stdin open for `v1.process.stdin.write`. Without it the process reads EOF, as under
|
|
1284
|
+
* `docker exec` without `-i`, so a command that reads stdin cannot wait forever, and
|
|
1285
|
+
* `v1.process.stdin.write` fails with `invalid_input`.
|
|
1286
|
+
*/
|
|
1287
|
+
openStdin?: boolean | null;
|
|
1255
1288
|
stdinFd?: number | null;
|
|
1256
1289
|
stdoutFd?: number | null;
|
|
1257
1290
|
stderrFd?: number | null;
|
|
@@ -1337,7 +1370,12 @@ declare namespace Output {
|
|
|
1337
1370
|
* diffutils, tar, gzip) before `software`. Defaults to true.
|
|
1338
1371
|
*/
|
|
1339
1372
|
defaultSoftware?: boolean | null;
|
|
1340
|
-
|
|
1373
|
+
/**
|
|
1374
|
+
* Software installed after the default software, in order. Registry
|
|
1375
|
+
* entries are resolved to an exact URL and digest when the config is
|
|
1376
|
+
* accepted, so the durable config never follows a moving manifest.
|
|
1377
|
+
*/
|
|
1378
|
+
software?: Array<SoftwareSourceInput> | null;
|
|
1341
1379
|
preview?: PreviewPolicyInput | null;
|
|
1342
1380
|
};
|
|
1343
1381
|
type AgentOsActorCreateInput = {
|
|
@@ -1761,6 +1799,17 @@ declare namespace Output {
|
|
|
1761
1799
|
module: string;
|
|
1762
1800
|
options?: ActorLanguageSpawnOptions;
|
|
1763
1801
|
};
|
|
1802
|
+
type RegistrySoftwareSourceInput = {
|
|
1803
|
+
/**
|
|
1804
|
+
* Registry package name, such as `git` or `ripgrep`.
|
|
1805
|
+
*/
|
|
1806
|
+
registry: string;
|
|
1807
|
+
/**
|
|
1808
|
+
* agentOS release whose manifest lists the package, such as `0.4.3` or
|
|
1809
|
+
* `latest`. Defaults to the agentOS release the actor is built with.
|
|
1810
|
+
*/
|
|
1811
|
+
version?: string | null;
|
|
1812
|
+
};
|
|
1764
1813
|
type RemotePackageSource = {
|
|
1765
1814
|
url: string;
|
|
1766
1815
|
digest?: string | null;
|
|
@@ -1809,7 +1858,11 @@ declare namespace Output {
|
|
|
1809
1858
|
};
|
|
1810
1859
|
type SnapshotExportKind = "snapshot-export";
|
|
1811
1860
|
type SoftwareInstall = {
|
|
1812
|
-
|
|
1861
|
+
/**
|
|
1862
|
+
* A `{ url, digest? }` artifact or a `{ registry, version? }` package. The
|
|
1863
|
+
* result's `source` is the resolved, digest-pinned URL that is persisted.
|
|
1864
|
+
*/
|
|
1865
|
+
source: SoftwareSourceInput;
|
|
1813
1866
|
expectedRevision?: number | bigint | null;
|
|
1814
1867
|
};
|
|
1815
1868
|
type SoftwareList = Record<string, never>;
|
|
@@ -1818,6 +1871,7 @@ declare namespace Output {
|
|
|
1818
1871
|
source: RemotePackageSource;
|
|
1819
1872
|
config: ConfigSnapshot;
|
|
1820
1873
|
};
|
|
1874
|
+
type SoftwareSourceInput = RegistrySoftwareSourceInput | RemotePackageSourceInput;
|
|
1821
1875
|
type SoftwareUninstall = {
|
|
1822
1876
|
packageId: string;
|
|
1823
1877
|
expectedRevision?: number | bigint | null;
|
|
@@ -2506,7 +2560,11 @@ type V1PythonSpawnModuleOutput = {
|
|
|
2506
2560
|
pid: number;
|
|
2507
2561
|
};
|
|
2508
2562
|
type V1SoftwareInstallInput = {
|
|
2509
|
-
|
|
2563
|
+
/**
|
|
2564
|
+
* A `{ url, digest? }` artifact or a `{ registry, version? }` package. The
|
|
2565
|
+
* result's `source` is the resolved, digest-pinned URL that is persisted.
|
|
2566
|
+
*/
|
|
2567
|
+
source: Input.SoftwareSourceInput;
|
|
2510
2568
|
expectedRevision?: number | bigint | null;
|
|
2511
2569
|
};
|
|
2512
2570
|
type V1SoftwareInstallOutput = {
|
|
@@ -2872,6 +2930,12 @@ type AgentOsClient = Omit<Client<AgentOsRegistry>, "agentOS" | "getForId"> & {
|
|
|
2872
2930
|
* Creates a vanilla RivetKit client with the generated agentOS contract.
|
|
2873
2931
|
* Services runs the agentOS actor in the `services` pool, so the client
|
|
2874
2932
|
* uses that pool unless the config sets `poolName`.
|
|
2933
|
+
*
|
|
2934
|
+
* The client talks to the engine, whose `/metadata` has no client endpoint to
|
|
2935
|
+
* redirect to, so it skips that lookup unless the config sets
|
|
2936
|
+
* `disableMetadataLookup: false`. RivetKit retries the lookup forever, which
|
|
2937
|
+
* makes every call hang when the endpoint is unreachable. A RivetKit app URL
|
|
2938
|
+
* that redirects through `/metadata` needs `disableMetadataLookup: false`.
|
|
2875
2939
|
*/
|
|
2876
2940
|
declare function createAgentOsClient(endpointOrConfig?: string | ClientConfigInput): AgentOsClient;
|
|
2877
2941
|
|
package/dist/index.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import { createClient } from "rivetkit/client";
|
|
3
3
|
var AGENTOS_API_VERSION = "agentos-sdk.dev/v1alpha1";
|
|
4
4
|
var AGENTOS_CONTRACT_MAJOR = 1;
|
|
5
|
-
var AGENTOS_CONTRACT_HASH = "sha256:
|
|
5
|
+
var AGENTOS_CONTRACT_HASH = "sha256:06086c42788602d49d762f2b3003a8fe89a3d136219611cdbbc84d0fc4c267ca";
|
|
6
6
|
var AGENTOS_CAPABILITIES = [
|
|
7
7
|
"config.merge-patch",
|
|
8
8
|
"network.pull-streaming",
|
|
@@ -14,7 +14,8 @@ var AGENTOS_CAPABILITIES = [
|
|
|
14
14
|
"inspector.vm",
|
|
15
15
|
"language.javascript",
|
|
16
16
|
"language.python",
|
|
17
|
-
"language.typescript"
|
|
17
|
+
"language.typescript",
|
|
18
|
+
"software.registry"
|
|
18
19
|
];
|
|
19
20
|
var AGENTOS_CONTRACT = {
|
|
20
21
|
apiVersion: AGENTOS_API_VERSION,
|
|
@@ -26,6 +27,7 @@ function createAgentOsClient(endpointOrConfig) {
|
|
|
26
27
|
const config = typeof endpointOrConfig === "string" ? { endpoint: endpointOrConfig } : endpointOrConfig ?? {};
|
|
27
28
|
return createClient({
|
|
28
29
|
poolName: "services",
|
|
30
|
+
disableMetadataLookup: true,
|
|
29
31
|
...config
|
|
30
32
|
});
|
|
31
33
|
}
|