@rivet-dev/agentos 0.4.1 → 0.4.6

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 ADDED
@@ -0,0 +1,18 @@
1
+ Rivet Services License
2
+
3
+ Copyright (c) 2023-2026 Rivet Gaming, Inc. All rights reserved.
4
+
5
+ This repository (the "Software") is proprietary, commercial software from
6
+ Rivet. It is NOT open source.
7
+
8
+ The Software is made available only to licensed customers under a separate
9
+ commercial agreement with Rivet Gaming, Inc. Except as expressly permitted in
10
+ that agreement, you may not use, copy, modify, distribute, sublicense, or sell
11
+ the Software, in whole or in part.
12
+
13
+ For licensing inquiries, contact sales@rivet.dev.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
17
+ CLAIM, DAMAGES, OR OTHER LIABILITY ARISING FROM OR IN CONNECTION WITH THE
18
+ SOFTWARE OR ITS USE.
@@ -1 +1 @@
1
- import{j as e,r as v,u as B,I as j,R as Q,F as K,U as T,A as V,a as S,b as P,c as U,C as M,d as z,f as D,e as W,g as _,D as q,h as G,P as J,T as X}from"./index-bwUfaXzS.js";import{u as R,a as y,V as H,b as Y}from"./vm-status-badges-C7eIpgyG.js";import{u as O}from"./useMutation-CmlocRNE.js";import{u as Z,a as ee,b as te}from"./hooks-DaKa0v02.js";import{S as I}from"./scroll-area-BN1MPKEE.js";const se=/\.(png|jpe?g|gif|webp|svg|ico|bmp|avif)$/i;function L({actorId:s,entry:t,depth:n,selectedPath:o,onSelect:p,openPaths:c,onToggle:u}){const i=c.has(t.path),d=t.path===o,a=t.dir&&!t.virtual,f=R(y.listDirQueryOptions(s,t.path,a&&i));return e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center gap-1",style:{paddingLeft:`${n*12}px`},children:[e.jsx("button",{type:"button",onClick:()=>a&&u(t.path),className:z("flex size-5 items-center justify-center rounded text-muted-foreground hover:bg-muted/50",!a&&"pointer-events-none opacity-0"),disabled:!a,children:e.jsx(M,{className:z("size-3 transition-transform",i&&"rotate-90")})}),e.jsxs("button",{type:"button",onClick:()=>{a&&u(t.path),p(t)},className:z("flex min-w-0 flex-1 items-center gap-2 rounded px-2 py-1 text-left text-sm",d?"bg-muted text-foreground":"hover:bg-muted/50"),children:[e.jsx(U,{dir:t.dir,className:"size-3.5 shrink-0 text-muted-foreground"}),e.jsx("span",{className:"flex-1 truncate",children:t.name}),t.symlink?e.jsx("span",{title:"Symbolic link (not followed)",className:"shrink-0 font-mono text-[10px] text-muted-foreground/50",children:"→"}):null,!t.dir&&t.size!=null?e.jsx("span",{className:"shrink-0 text-[10px] tabular-nums text-muted-foreground/60",children:D(t.size)}):null]})]}),a&&i?(f.data??[]).map(x=>e.jsx(L,{actorId:s,entry:x,depth:n+1,selectedPath:o,onSelect:p,openPaths:c,onToggle:u},x.path)):null]})}function re(s,t){const n=URL.createObjectURL(new Blob([s])),o=document.createElement("a");o.href=n,o.download=t,o.click(),URL.revokeObjectURL(n)}const E=s=>({path:s,renameDraft:null,error:null});function ne({actorId:s,path:t,onMutated:n,onDeleted:o,onRenamed:p}){const[c,u]=v.useState(()=>E(t));c.path!==t&&u(E(t));const i=c.path===t?c:E(t),d=r=>u(l=>({...l,...r})),{data:a,error:f}=R(y.fileContentQueryOptions(s,t)),x=!!(a!=null&&a.bytes)&&a.text===null&&se.test(a.path),h=ee(x?a==null?void 0:a.bytes:null),{armed:m,confirm:g}=te({resetKey:t});if(!t)return e.jsx(P,{children:e.jsxs("div",{className:"flex flex-col items-center gap-5",children:[e.jsx(W,{className:"w-44"}),e.jsx("span",{children:"Select a file to view its contents."})]})});if(f)return e.jsx(S,{error:f,className:"items-center justify-center text-center"});if(!a)return e.jsxs(P,{children:["Loading ",t,"…"]});const w=a.path.split("/").pop()??a.path,b=async()=>{var l;const r=(l=i.renameDraft)==null?void 0:l.trim();if(!r||r===a.path){d({renameDraft:null});return}d({error:null});try{await y.moveEntry(a.path,r),d({renameDraft:null}),p(r),n()}catch(k){d({error:k})}},N=async()=>{d({error:null});try{await y.deleteFile(a.path,{}),o(),n()}catch(r){d({error:r})}};return e.jsxs("div",{className:"flex h-full flex-col",children:[e.jsxs("div",{className:"flex items-center gap-2 border-b px-4 py-2.5",children:[i.renameDraft!==null?e.jsx("input",{value:i.renameDraft,onChange:r=>d({renameDraft:r.target.value}),onKeyDown:r=>{r.key==="Enter"&&b(),r.key==="Escape"&&d({renameDraft:null})},spellCheck:!1,autoFocus:!0,"aria-label":"New path",className:"min-w-0 flex-1 rounded border bg-background px-2 py-1 font-mono text-xs focus:outline-none"}):e.jsx("span",{className:"min-w-0 flex-1 truncate font-mono text-sm",children:a.path}),e.jsx("span",{className:"shrink-0 text-xs text-muted-foreground",children:D(a.sizeBytes)}),e.jsx("span",{className:"shrink-0 text-xs text-muted-foreground",children:_(a.mtimeMs)}),e.jsx(j,{title:a.bytes?"Download this file":"Load the file first",disabled:!a.bytes,onClick:()=>a.bytes&&re(a.bytes,w),children:e.jsx(q,{className:"size-3.5"})}),e.jsx(j,{title:i.renameDraft!==null?"Save new name":"Rename this file",onClick:()=>i.renameDraft!==null?void b():d({renameDraft:a.path}),children:i.renameDraft!==null?e.jsx(G,{className:"size-3.5"}):e.jsx(J,{className:"size-3.5"})}),m==="delete"?e.jsx("button",{type:"button",onClick:()=>g("delete",()=>void N()),className:"shrink-0 rounded border border-destructive/50 px-2 py-1 text-xs text-destructive transition-colors hover:bg-destructive/10",children:"Confirm delete?"}):e.jsx(j,{title:"Delete this file",destructive:!0,onClick:()=>g("delete",()=>void N()),children:e.jsx(X,{className:"size-3.5"})})]}),i.error?e.jsx(S,{error:i.error,className:"border-b py-2"}):null,e.jsx(I,{className:"min-h-0 flex-1",children:a.special?e.jsx("div",{className:"flex h-full items-center justify-center p-8 text-center text-sm text-muted-foreground",children:"Device or stream — no readable contents."}):a.oversize?e.jsx("div",{className:"flex h-full flex-col items-center justify-center gap-2 p-8 text-center text-sm text-muted-foreground",children:e.jsxs("span",{children:["Large file (",D(a.sizeBytes),"). Preview exceeds the hosted action limit."]})}):a.text===null?h?e.jsx("div",{className:"flex items-start justify-center p-4",children:e.jsx("img",{src:h,alt:w,className:"max-w-full rounded border"})}):e.jsxs("div",{className:"flex h-full items-center justify-center p-8 text-center text-sm text-muted-foreground",children:["Binary file (",D(a.sizeBytes),") — use Download to save it."]}):e.jsx("pre",{className:"whitespace-pre-wrap break-words p-4 font-mono text-xs leading-relaxed",children:a.text})})]})}function F(s){const t=s.lastIndexOf("/");return t<=0?"/":s.slice(0,t)}function C(s){let t=s.trim();return t===""?"/":(t.startsWith("/")||(t=`/${t}`),t=t.replace(/\/+/g,"/"),t.length>1&&t.endsWith("/")&&(t=t.slice(0,-1)),t)}const A=(s,t)=>s==="/"?`/${t}`:`${s}/${t}`;function pe({actorId:s}){return e.jsx(ie,{actorId:s})}const $=s=>`agentos-inspector:fs:${s}`,ae=200;function le(s){try{const t=sessionStorage.getItem($(s));if(t){const n=JSON.parse(t);return{root:typeof n.root=="string"?n.root:"/",selectedPath:typeof n.selectedPath=="string"?n.selectedPath:null,openPaths:Array.isArray(n.openPaths)?n.openPaths.filter(o=>typeof o=="string"):[]}}}catch{}return{root:"/",selectedPath:null,openPaths:[]}}function oe(s,t){switch(t.type){case"type":return{...s,draft:t.value};case"commitDraft":{const n=C(s.draft);return n===s.root&&n===s.draft?s:{...s,root:n,draft:n}}case"commitDebounced":{const n=C(s.draft);return n===s.root?s:{...s,root:n}}case"goUp":{const n=F(C(s.draft));return{...s,root:n,draft:n}}case"openDir":return{...s,draft:t.path};case"selectFile":return{...s,selectedPath:t.path,draft:F(t.path)};case"reselect":return{...s,selectedPath:t.path};case"toggleOpen":{const n=new Set(s.openPaths);if(n.has(t.path))n.delete(t.path);else if(n.add(t.path),n.size>ae){const o=n.values().next().value;o!==void 0&&n.delete(o)}return{...s,openPaths:n}}}}function ie({actorId:s}){const[{root:t,draft:n,selectedPath:o,openPaths:p},c]=v.useReducer(oe,s,r=>{const l=le(r);return{root:l.root,draft:l.root,selectedPath:l.selectedPath,openPaths:new Set(l.openPaths)}});v.useEffect(()=>{try{sessionStorage.setItem($(s),JSON.stringify({root:t,selectedPath:o,openPaths:[...p]}))}catch(r){console.warn("agentos inspector: failed to persist filesystem state",r)}},[s,t,o,p]);const[u,i]=v.useState(null),d=v.useRef(null),a=B(),f=R(y.listDirQueryOptions(s,t)),x=f.data??[];Z(n,500,()=>c({type:"commitDebounced"}));const h=()=>a.invalidateQueries({queryKey:Y(s,"dir")}),m=C(n),g=O({mutationFn:r=>y.mkdir(r.startsWith("/")?r:A(m,r)),onSuccess:async()=>{i(null),await h()}}),w=()=>{const r=u==null?void 0:u.trim();if(!r){i(null);return}g.mutate(r)},b=O({mutationFn:async r=>{const l=new Uint8Array(await r.arrayBuffer());await y.writeFile(A(m,r.name),l)},onSuccess:()=>h()}),N=g.error??b.error;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 gap-1 px-3 pb-1 pt-2.5",children:[e.jsx("span",{className:"text-[11px] font-medium text-muted-foreground",children:"Files"}),e.jsx("span",{className:"ml-auto"}),e.jsx(j,{title:"Refresh the tree",onClick:()=>void h(),children:e.jsx(Q,{className:"size-3.5"})}),e.jsx(j,{title:`New folder under ${m}`,onClick:()=>i(r=>r===null?"":null),children:e.jsx(K,{className:"size-3.5"})}),e.jsx(j,{title:`Upload a file into ${m}`,onClick:()=>{var r;return(r=d.current)==null?void 0:r.click()},children:e.jsx(T,{className:"size-3.5"})}),e.jsx("input",{ref:d,type:"file",className:"hidden",onChange:r=>{var k;const l=(k=r.target.files)==null?void 0:k[0];r.target.value="",l&&b.mutate(l)}})]}),e.jsxs("div",{className:"flex items-center gap-1 border-b px-3 pb-1.5",children:[e.jsx(j,{title:m==="/"?"Already at the root":`Up to ${F(m)}`,disabled:m==="/",onClick:()=>c({type:"goUp"}),className:"size-5",children:e.jsx(V,{className:"size-3.5"})}),e.jsx("input",{value:n,onChange:r=>c({type:"type",value:r.target.value}),onKeyDown:r=>{r.key==="Enter"&&c({type:"commitDraft"})},spellCheck:!1,autoComplete:"off","aria-label":"Root directory",placeholder:"/",className:"w-full bg-transparent font-mono text-xs text-muted-foreground outline-none placeholder:text-muted-foreground/40 focus:text-foreground"})]}),u!==null?e.jsx("div",{className:"border-b px-3 py-1.5",children:e.jsx("input",{value:u,onChange:r=>i(r.target.value),onKeyDown:r=>{r.key==="Enter"&&w(),r.key==="Escape"&&i(null)},spellCheck:!1,autoFocus:!0,"aria-label":"New folder name",placeholder:`folder name (created under ${m})`,className:"w-full rounded border bg-background px-2 py-1 font-mono text-xs focus:outline-none"})}):null,N?e.jsx(S,{error:N,className:"border-b py-2"}):null,e.jsx(I,{className:"min-h-0 flex-1 p-2",children:f.isLoading?e.jsxs(P,{children:["Loading ",t,"…"]}):f.error?e.jsx(S,{error:f.error}):x.length===0?e.jsx(P,{children:e.jsxs("div",{className:"flex flex-col items-center gap-2",children:[e.jsx(U,{dir:!0,className:"size-8 text-muted-foreground/40"}),e.jsx("span",{children:"Empty directory."})]})}):x.map(r=>e.jsx(L,{actorId:s,entry:r,depth:0,selectedPath:o,onSelect:l=>c(l.dir?{type:"openDir",path:l.path}:{type:"selectFile",path:l.path}),openPaths:p,onToggle:l=>c({type:"toggleOpen",path:l})},r.path))})]}),e.jsxs("div",{className:"relative min-h-0 min-w-0 flex-1",children:[e.jsx("div",{className:"absolute right-3 top-11 z-10",children:e.jsx(H,{actorId:s})}),e.jsx(ne,{actorId:s,path:o,onMutated:()=>void h(),onDeleted:()=>c({type:"reselect",path:null}),onRenamed:r=>c({type:"reselect",path:r})})]})]})}export{pe as FilesystemTabConnected};
1
+ import{j as e,r as v,u as B,I as j,R as Q,F as K,U as T,A as V,a as S,b as P,c as U,C as M,d as z,f as D,e as W,g as _,D as q,h as G,P as J,T as X}from"./index-UFq5tVw_.js";import{u as R,a as y,V as H,b as Y}from"./vm-status-badges-BzRIP4lN.js";import{u as O}from"./useMutation-5EZ20Lg8.js";import{u as Z,a as ee,b as te}from"./hooks-cSr2w3ti.js";import{S as I}from"./scroll-area-BlieIIFq.js";const se=/\.(png|jpe?g|gif|webp|svg|ico|bmp|avif)$/i;function L({actorId:s,entry:t,depth:n,selectedPath:o,onSelect:p,openPaths:c,onToggle:u}){const i=c.has(t.path),d=t.path===o,a=t.dir&&!t.virtual,f=R(y.listDirQueryOptions(s,t.path,a&&i));return e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center gap-1",style:{paddingLeft:`${n*12}px`},children:[e.jsx("button",{type:"button",onClick:()=>a&&u(t.path),className:z("flex size-5 items-center justify-center rounded text-muted-foreground hover:bg-muted/50",!a&&"pointer-events-none opacity-0"),disabled:!a,children:e.jsx(M,{className:z("size-3 transition-transform",i&&"rotate-90")})}),e.jsxs("button",{type:"button",onClick:()=>{a&&u(t.path),p(t)},className:z("flex min-w-0 flex-1 items-center gap-2 rounded px-2 py-1 text-left text-sm",d?"bg-muted text-foreground":"hover:bg-muted/50"),children:[e.jsx(U,{dir:t.dir,className:"size-3.5 shrink-0 text-muted-foreground"}),e.jsx("span",{className:"flex-1 truncate",children:t.name}),t.symlink?e.jsx("span",{title:"Symbolic link (not followed)",className:"shrink-0 font-mono text-[10px] text-muted-foreground/50",children:"→"}):null,!t.dir&&t.size!=null?e.jsx("span",{className:"shrink-0 text-[10px] tabular-nums text-muted-foreground/60",children:D(t.size)}):null]})]}),a&&i?(f.data??[]).map(x=>e.jsx(L,{actorId:s,entry:x,depth:n+1,selectedPath:o,onSelect:p,openPaths:c,onToggle:u},x.path)):null]})}function re(s,t){const n=URL.createObjectURL(new Blob([s])),o=document.createElement("a");o.href=n,o.download=t,o.click(),URL.revokeObjectURL(n)}const E=s=>({path:s,renameDraft:null,error:null});function ne({actorId:s,path:t,onMutated:n,onDeleted:o,onRenamed:p}){const[c,u]=v.useState(()=>E(t));c.path!==t&&u(E(t));const i=c.path===t?c:E(t),d=r=>u(l=>({...l,...r})),{data:a,error:f}=R(y.fileContentQueryOptions(s,t)),x=!!(a!=null&&a.bytes)&&a.text===null&&se.test(a.path),h=ee(x?a==null?void 0:a.bytes:null),{armed:m,confirm:g}=te({resetKey:t});if(!t)return e.jsx(P,{children:e.jsxs("div",{className:"flex flex-col items-center gap-5",children:[e.jsx(W,{className:"w-44"}),e.jsx("span",{children:"Select a file to view its contents."})]})});if(f)return e.jsx(S,{error:f,className:"items-center justify-center text-center"});if(!a)return e.jsxs(P,{children:["Loading ",t,"…"]});const w=a.path.split("/").pop()??a.path,b=async()=>{var l;const r=(l=i.renameDraft)==null?void 0:l.trim();if(!r||r===a.path){d({renameDraft:null});return}d({error:null});try{await y.moveEntry(a.path,r),d({renameDraft:null}),p(r),n()}catch(k){d({error:k})}},N=async()=>{d({error:null});try{await y.deleteFile(a.path,{}),o(),n()}catch(r){d({error:r})}};return e.jsxs("div",{className:"flex h-full flex-col",children:[e.jsxs("div",{className:"flex items-center gap-2 border-b px-4 py-2.5",children:[i.renameDraft!==null?e.jsx("input",{value:i.renameDraft,onChange:r=>d({renameDraft:r.target.value}),onKeyDown:r=>{r.key==="Enter"&&b(),r.key==="Escape"&&d({renameDraft:null})},spellCheck:!1,autoFocus:!0,"aria-label":"New path",className:"min-w-0 flex-1 rounded border bg-background px-2 py-1 font-mono text-xs focus:outline-none"}):e.jsx("span",{className:"min-w-0 flex-1 truncate font-mono text-sm",children:a.path}),e.jsx("span",{className:"shrink-0 text-xs text-muted-foreground",children:D(a.sizeBytes)}),e.jsx("span",{className:"shrink-0 text-xs text-muted-foreground",children:_(a.mtimeMs)}),e.jsx(j,{title:a.bytes?"Download this file":"Load the file first",disabled:!a.bytes,onClick:()=>a.bytes&&re(a.bytes,w),children:e.jsx(q,{className:"size-3.5"})}),e.jsx(j,{title:i.renameDraft!==null?"Save new name":"Rename this file",onClick:()=>i.renameDraft!==null?void b():d({renameDraft:a.path}),children:i.renameDraft!==null?e.jsx(G,{className:"size-3.5"}):e.jsx(J,{className:"size-3.5"})}),m==="delete"?e.jsx("button",{type:"button",onClick:()=>g("delete",()=>void N()),className:"shrink-0 rounded border border-destructive/50 px-2 py-1 text-xs text-destructive transition-colors hover:bg-destructive/10",children:"Confirm delete?"}):e.jsx(j,{title:"Delete this file",destructive:!0,onClick:()=>g("delete",()=>void N()),children:e.jsx(X,{className:"size-3.5"})})]}),i.error?e.jsx(S,{error:i.error,className:"border-b py-2"}):null,e.jsx(I,{className:"min-h-0 flex-1",children:a.special?e.jsx("div",{className:"flex h-full items-center justify-center p-8 text-center text-sm text-muted-foreground",children:"Device or stream — no readable contents."}):a.oversize?e.jsx("div",{className:"flex h-full flex-col items-center justify-center gap-2 p-8 text-center text-sm text-muted-foreground",children:e.jsxs("span",{children:["Large file (",D(a.sizeBytes),"). Preview exceeds the hosted action limit."]})}):a.text===null?h?e.jsx("div",{className:"flex items-start justify-center p-4",children:e.jsx("img",{src:h,alt:w,className:"max-w-full rounded border"})}):e.jsxs("div",{className:"flex h-full items-center justify-center p-8 text-center text-sm text-muted-foreground",children:["Binary file (",D(a.sizeBytes),") — use Download to save it."]}):e.jsx("pre",{className:"whitespace-pre-wrap break-words p-4 font-mono text-xs leading-relaxed",children:a.text})})]})}function F(s){const t=s.lastIndexOf("/");return t<=0?"/":s.slice(0,t)}function C(s){let t=s.trim();return t===""?"/":(t.startsWith("/")||(t=`/${t}`),t=t.replace(/\/+/g,"/"),t.length>1&&t.endsWith("/")&&(t=t.slice(0,-1)),t)}const A=(s,t)=>s==="/"?`/${t}`:`${s}/${t}`;function pe({actorId:s}){return e.jsx(ie,{actorId:s})}const $=s=>`agentos-inspector:fs:${s}`,ae=200;function le(s){try{const t=sessionStorage.getItem($(s));if(t){const n=JSON.parse(t);return{root:typeof n.root=="string"?n.root:"/",selectedPath:typeof n.selectedPath=="string"?n.selectedPath:null,openPaths:Array.isArray(n.openPaths)?n.openPaths.filter(o=>typeof o=="string"):[]}}}catch{}return{root:"/",selectedPath:null,openPaths:[]}}function oe(s,t){switch(t.type){case"type":return{...s,draft:t.value};case"commitDraft":{const n=C(s.draft);return n===s.root&&n===s.draft?s:{...s,root:n,draft:n}}case"commitDebounced":{const n=C(s.draft);return n===s.root?s:{...s,root:n}}case"goUp":{const n=F(C(s.draft));return{...s,root:n,draft:n}}case"openDir":return{...s,draft:t.path};case"selectFile":return{...s,selectedPath:t.path,draft:F(t.path)};case"reselect":return{...s,selectedPath:t.path};case"toggleOpen":{const n=new Set(s.openPaths);if(n.has(t.path))n.delete(t.path);else if(n.add(t.path),n.size>ae){const o=n.values().next().value;o!==void 0&&n.delete(o)}return{...s,openPaths:n}}}}function ie({actorId:s}){const[{root:t,draft:n,selectedPath:o,openPaths:p},c]=v.useReducer(oe,s,r=>{const l=le(r);return{root:l.root,draft:l.root,selectedPath:l.selectedPath,openPaths:new Set(l.openPaths)}});v.useEffect(()=>{try{sessionStorage.setItem($(s),JSON.stringify({root:t,selectedPath:o,openPaths:[...p]}))}catch(r){console.warn("agentos inspector: failed to persist filesystem state",r)}},[s,t,o,p]);const[u,i]=v.useState(null),d=v.useRef(null),a=B(),f=R(y.listDirQueryOptions(s,t)),x=f.data??[];Z(n,500,()=>c({type:"commitDebounced"}));const h=()=>a.invalidateQueries({queryKey:Y(s,"dir")}),m=C(n),g=O({mutationFn:r=>y.mkdir(r.startsWith("/")?r:A(m,r)),onSuccess:async()=>{i(null),await h()}}),w=()=>{const r=u==null?void 0:u.trim();if(!r){i(null);return}g.mutate(r)},b=O({mutationFn:async r=>{const l=new Uint8Array(await r.arrayBuffer());await y.writeFile(A(m,r.name),l)},onSuccess:()=>h()}),N=g.error??b.error;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 gap-1 px-3 pb-1 pt-2.5",children:[e.jsx("span",{className:"text-[11px] font-medium text-muted-foreground",children:"Files"}),e.jsx("span",{className:"ml-auto"}),e.jsx(j,{title:"Refresh the tree",onClick:()=>void h(),children:e.jsx(Q,{className:"size-3.5"})}),e.jsx(j,{title:`New folder under ${m}`,onClick:()=>i(r=>r===null?"":null),children:e.jsx(K,{className:"size-3.5"})}),e.jsx(j,{title:`Upload a file into ${m}`,onClick:()=>{var r;return(r=d.current)==null?void 0:r.click()},children:e.jsx(T,{className:"size-3.5"})}),e.jsx("input",{ref:d,type:"file",className:"hidden",onChange:r=>{var k;const l=(k=r.target.files)==null?void 0:k[0];r.target.value="",l&&b.mutate(l)}})]}),e.jsxs("div",{className:"flex items-center gap-1 border-b px-3 pb-1.5",children:[e.jsx(j,{title:m==="/"?"Already at the root":`Up to ${F(m)}`,disabled:m==="/",onClick:()=>c({type:"goUp"}),className:"size-5",children:e.jsx(V,{className:"size-3.5"})}),e.jsx("input",{value:n,onChange:r=>c({type:"type",value:r.target.value}),onKeyDown:r=>{r.key==="Enter"&&c({type:"commitDraft"})},spellCheck:!1,autoComplete:"off","aria-label":"Root directory",placeholder:"/",className:"w-full bg-transparent font-mono text-xs text-muted-foreground outline-none placeholder:text-muted-foreground/40 focus:text-foreground"})]}),u!==null?e.jsx("div",{className:"border-b px-3 py-1.5",children:e.jsx("input",{value:u,onChange:r=>i(r.target.value),onKeyDown:r=>{r.key==="Enter"&&w(),r.key==="Escape"&&i(null)},spellCheck:!1,autoFocus:!0,"aria-label":"New folder name",placeholder:`folder name (created under ${m})`,className:"w-full rounded border bg-background px-2 py-1 font-mono text-xs focus:outline-none"})}):null,N?e.jsx(S,{error:N,className:"border-b py-2"}):null,e.jsx(I,{className:"min-h-0 flex-1 p-2",children:f.isLoading?e.jsxs(P,{children:["Loading ",t,"…"]}):f.error?e.jsx(S,{error:f.error}):x.length===0?e.jsx(P,{children:e.jsxs("div",{className:"flex flex-col items-center gap-2",children:[e.jsx(U,{dir:!0,className:"size-8 text-muted-foreground/40"}),e.jsx("span",{children:"Empty directory."})]})}):x.map(r=>e.jsx(L,{actorId:s,entry:r,depth:0,selectedPath:o,onSelect:l=>c(l.dir?{type:"openDir",path:l.path}:{type:"selectFile",path:l.path}),openPaths:p,onToggle:l=>c({type:"toggleOpen",path:l})},r.path))})]}),e.jsxs("div",{className:"relative min-h-0 min-w-0 flex-1",children:[e.jsx("div",{className:"absolute right-3 top-11 z-10",children:e.jsx(H,{actorId:s})}),e.jsx(ne,{actorId:s,path:o,onMutated:()=>void h(),onDeleted:()=>c({type:"reselect",path:null}),onRenamed:r=>c({type:"reselect",path:r})})]})]})}export{pe as FilesystemTabConnected};
@@ -1 +1 @@
1
- import{r as t}from"./index-bwUfaXzS.js";function a(r){const e=t.useMemo(()=>r?URL.createObjectURL(new Blob([r])):null,[r]);return t.useEffect(()=>()=>{e&&URL.revokeObjectURL(e)},[e]),e}function i(r,e,n){const u=t.useRef(n);t.useEffect(()=>{u.current=n}),t.useEffect(()=>{const c=setTimeout(()=>u.current(r),e);return()=>clearTimeout(c)},[r,e])}function d({timeoutMs:r=3e3,resetKey:e}={}){const[n,u]=t.useState({armed:null,key:e}),c=t.useRef(void 0);n.key!==e&&u({armed:null,key:e});const o=n.key===e?n.armed:null;return t.useEffect(()=>()=>clearTimeout(c.current),[]),{armed:o,confirm:(f,m)=>{if(clearTimeout(c.current),o===f){u({armed:null,key:e}),m();return}u({armed:f,key:e}),c.current=setTimeout(()=>u({armed:null,key:e}),r)}}}export{a,d as b,i as u};
1
+ import{r as t}from"./index-UFq5tVw_.js";function a(r){const e=t.useMemo(()=>r?URL.createObjectURL(new Blob([r])):null,[r]);return t.useEffect(()=>()=>{e&&URL.revokeObjectURL(e)},[e]),e}function i(r,e,n){const u=t.useRef(n);t.useEffect(()=>{u.current=n}),t.useEffect(()=>{const c=setTimeout(()=>u.current(r),e);return()=>clearTimeout(c)},[r,e])}function d({timeoutMs:r=3e3,resetKey:e}={}){const[n,u]=t.useState({armed:null,key:e}),c=t.useRef(void 0);n.key!==e&&u({armed:null,key:e});const o=n.key===e?n.armed:null;return t.useEffect(()=>()=>clearTimeout(c.current),[]),{armed:o,confirm:(f,m)=>{if(clearTimeout(c.current),o===f){u({armed:null,key:e}),m();return}u({armed:f,key:e}),c.current=setTimeout(()=>u({armed:null,key:e}),r)}}}export{a,d as b,i as u};