dorkos 0.82.0 → 0.87.0

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.
Files changed (118) hide show
  1. package/README.md +11 -0
  2. package/dist/bin/cli.js +12725 -4763
  3. package/dist/client/assets/{AboutPage-WmtNTKyp.js → AboutPage-BSUaz4JJ.js} +1 -1
  4. package/dist/client/assets/{AppearancePage-D7ZHuThu.js → AppearancePage-CXOeapnY.js} +1 -1
  5. package/dist/client/assets/{BaseTanStackRouterDevtoolsPanel-B-iktbLX-wUJCR3vL.js → BaseTanStackRouterDevtoolsPanel-B-iktbLX-BnlmhnMf.js} +1 -1
  6. package/dist/client/assets/{BlintzCanvas-BXKUjnNQ.js → BlintzCanvas-CPvaejf6.js} +23 -23
  7. package/dist/client/assets/{CanvasCsvContent-BLAtnhdQ.js → CanvasCsvContent-BQMcLeXX.js} +1 -1
  8. package/dist/client/assets/CanvasFileContent-DZAWEzyp.js +2 -0
  9. package/dist/client/assets/CanvasModel3dContent-CU-0WLIz.js +2 -0
  10. package/dist/client/assets/{CodeMirrorDiff-Cpi43Atp.js → CodeMirrorDiff-B705Z174.js} +1 -1
  11. package/dist/client/assets/{CodeMirrorEditor-CviERH82.js → CodeMirrorEditor-CnoVRaAX.js} +1 -1
  12. package/dist/client/assets/ConnectionAccessLists-CLulSQsd.js +1 -0
  13. package/dist/client/assets/ConnectionsPage-5Yc0-dNp.js +1 -0
  14. package/dist/client/assets/{ConventionPage-Coim_h2z.js → ConventionPage-CPTqeeNZ.js} +3 -3
  15. package/dist/client/assets/{FloatingTanStackRouterDevtools-CqogiFob-lqp1rgj8.js → FloatingTanStackRouterDevtools-CqogiFob-C3cf2ADt.js} +1 -1
  16. package/dist/client/assets/HandlePage-CUJPQsdv.js +1 -0
  17. package/dist/client/assets/{LexicalField-DPe-aAXb.js → LexicalField-ClgIzBq7.js} +1 -1
  18. package/dist/client/assets/{ManagesPage-BZS2TdZL.js → ManagesPage-CKzcFzKR.js} +1 -1
  19. package/dist/client/assets/{Model3dViewer-qs0tZlVU.js → Model3dViewer-CVVsdftR.js} +1 -1
  20. package/dist/client/assets/NamePage-CYHYXhrs.js +1 -0
  21. package/dist/client/assets/{NotificationsPage-gmiItsT0.js → NotificationsPage-D3m6Jrm2.js} +1 -1
  22. package/dist/client/assets/PermissionsPage-CviWqCJ3.js +1 -0
  23. package/dist/client/assets/{PersonalityPopover-Dej6dI7y.js → PersonalityPopover-BN1CFq8D.js} +1 -1
  24. package/dist/client/assets/PhotoPage-ytqVZP3t.js +1 -0
  25. package/dist/client/assets/{RoomsPage-3_HuXajd.js → RoomsPage-CoZd-4Xe.js} +1 -1
  26. package/dist/client/assets/RunsOnPopover-91nKS6qj.js +1 -0
  27. package/dist/client/assets/SessionsPage-DDrQLNW-.js +6 -0
  28. package/dist/client/assets/SkillsPage-2H6QD77F.js +1 -0
  29. package/dist/client/assets/TasksPage-ocRUPiec.js +1 -0
  30. package/dist/client/assets/ToolsPage-q3wxIc3n.js +2 -0
  31. package/dist/client/assets/{TopologyGraph-C-BTnRXU.js → TopologyGraph-DeRqfLBW.js} +2 -2
  32. package/dist/client/assets/{agent-browser-DT3ABR4l.js → agent-browser-C7Q5muxI.js} +1 -1
  33. package/dist/client/assets/{highlighted-body-KPVGNVTW-CVFODbIg.js → highlighted-body-KPVGNVTW-CYowLe07.js} +1 -1
  34. package/dist/client/assets/{index-ClnyhFUL.js → index-1dt_mWBC.js} +1 -1
  35. package/dist/client/assets/{index-DiFG9bwF.js → index-34_CucI4.js} +1 -1
  36. package/dist/client/assets/{index-DGr90Ygi.js → index-6F4HxV-x.js} +1 -1
  37. package/dist/client/assets/{index-CgakJfik.js → index-B029XwR8.js} +1 -1
  38. package/dist/client/assets/index-B4TIVWAq.js +1668 -0
  39. package/dist/client/assets/index-BUcM96PD.css +1 -0
  40. package/dist/client/assets/{index-ClmokM0M.js → index-BX9en7bH.js} +1 -1
  41. package/dist/client/assets/{index-BZaMgVdg.js → index-BeqTVkgE.js} +1 -1
  42. package/dist/client/assets/index-BkFaL4dr.js +1 -0
  43. package/dist/client/assets/index-Bv_P5_tJ.js +1 -0
  44. package/dist/client/assets/{index-Dh-3NGE9.js → index-BwbRY8dK.js} +1 -1
  45. package/dist/client/assets/{index-B3P6TTvD.js → index-BzVyUKXW.js} +3 -3
  46. package/dist/client/assets/{index-B8oHvyN5.js → index-C0oow5Fn.js} +1 -1
  47. package/dist/client/assets/{index-DN8DYUEX.js → index-CCLVR1so.js} +1 -1
  48. package/dist/client/assets/{index-J8BMKg6y.js → index-CEw2JwVz.js} +1 -1
  49. package/dist/client/assets/{index-DIkpB_1y.js → index-CKHPMgwE.js} +1 -1
  50. package/dist/client/assets/{index-Dm6W0lml.js → index-CbxbAPgT.js} +1 -1
  51. package/dist/client/assets/{index-D_gnDrw3.js → index-Cm0G2vDh.js} +1 -1
  52. package/dist/client/assets/{index-DiFc1nSZ.js → index-CpZi173j.js} +1 -1
  53. package/dist/client/assets/index-CqfEH_t6.js +1 -0
  54. package/dist/client/assets/index-CuEwCZKH.js +17 -0
  55. package/dist/client/assets/{index-Cca_q1vW.js → index-CvQeke9n.js} +9 -9
  56. package/dist/client/assets/{index-BuU7EEtP.js → index-CxZB8Cqj.js} +1 -1
  57. package/dist/client/assets/{index-DjY4p5H5.js → index-D45q57-5.js} +1 -1
  58. package/dist/client/assets/{index-kzr7_3di.js → index-D8fmSjjO.js} +11 -11
  59. package/dist/client/assets/{index-W25uMuZA.js → index-DDagpuEn.js} +1 -1
  60. package/dist/client/assets/{index-DbsvSNI-.js → index-DT3ci-3h.js} +1 -1
  61. package/dist/client/assets/{index-nEQI8fB2.js → index-D_Pj9S7y.js} +1 -1
  62. package/dist/client/assets/{index-DF5k9E7k.js → index-Da-4WWcu.js} +1 -1
  63. package/dist/client/assets/{index-PrqHZbD1.js → index-DsRm4kZF.js} +1 -1
  64. package/dist/client/assets/{index-CaZw0EC7.js → index-GiEn7nQQ.js} +1 -1
  65. package/dist/client/assets/{index-ByCzVYkU.js → index-SGZRUhq4.js} +1 -1
  66. package/dist/client/assets/index-VLhj4QNP.js +1 -0
  67. package/dist/client/assets/index-otf5JgVx.js +1 -0
  68. package/dist/client/assets/{index-lciid4H8.js → index-qWahGPGi.js} +1 -1
  69. package/dist/client/assets/{index-BrgOWbRQ.js → index-sMuUIc_W.js} +2 -2
  70. package/dist/client/assets/{index-DgjZhEr3.js → index-snpaQsNQ.js} +1 -1
  71. package/dist/client/assets/room-files-source-C3tzeG6y.js +6 -0
  72. package/dist/client/assets/{soul-file-BHeAw6R9.js → soul-file-tc6-HkDy.js} +1 -1
  73. package/dist/client/assets/{use-personality-commit-DyJAMzzb.js → use-personality-commit-vpAu5T8A.js} +1 -1
  74. package/dist/client/index.html +6 -5
  75. package/dist/drizzle/0107_productive_peter_parker.sql +5 -0
  76. package/dist/drizzle/0108_magical_morph.sql +2 -0
  77. package/dist/drizzle/0109_aspiring_union_jack.sql +5 -0
  78. package/dist/drizzle/0110_ambiguous_wendigo.sql +1 -0
  79. package/dist/drizzle/0111_community_redaction_cursor.sql +11 -0
  80. package/dist/drizzle/0112_account_drop_issuer.sql +18 -0
  81. package/dist/drizzle/0113_room_departed_seats.sql +14 -0
  82. package/dist/drizzle/0114_schedule_account.sql +1 -0
  83. package/dist/drizzle/0115_furry_starjammers.sql +1 -0
  84. package/dist/drizzle/meta/0107_snapshot.json +8966 -0
  85. package/dist/drizzle/meta/0108_snapshot.json +8980 -0
  86. package/dist/drizzle/meta/0109_snapshot.json +8987 -0
  87. package/dist/drizzle/meta/0110_snapshot.json +8994 -0
  88. package/dist/drizzle/meta/0111_snapshot.json +9062 -0
  89. package/dist/drizzle/meta/0112_snapshot.json +9055 -0
  90. package/dist/drizzle/meta/0113_snapshot.json +9147 -0
  91. package/dist/drizzle/meta/0114_snapshot.json +9154 -0
  92. package/dist/drizzle/meta/0115_snapshot.json +9146 -0
  93. package/dist/drizzle/meta/_journal.json +63 -0
  94. package/dist/server/index.js +103645 -79264
  95. package/dist/server/index.js.map +2 -2
  96. package/package.json +7 -9
  97. package/dist/client/assets/CanvasFileContent-VogEwZeM.js +0 -2
  98. package/dist/client/assets/CanvasModel3dContent-DCTC7eOc.js +0 -2
  99. package/dist/client/assets/ConnectionAccessLists-Be1b30nn.js +0 -1
  100. package/dist/client/assets/ConnectionsPage-BVN7GiuC.js +0 -1
  101. package/dist/client/assets/HandlePage-DnzPN8N_.js +0 -1
  102. package/dist/client/assets/NamePage-DyWqRDIe.js +0 -1
  103. package/dist/client/assets/PhotoPage-GtCoB8dK.js +0 -1
  104. package/dist/client/assets/RunsOnPopover-DbSoBFaL.js +0 -1
  105. package/dist/client/assets/SessionsPage-Dc_lqBom.js +0 -6
  106. package/dist/client/assets/SkillsPage-C0qMUkgs.js +0 -1
  107. package/dist/client/assets/TasksPage-DvzTPDnw.js +0 -1
  108. package/dist/client/assets/ToolsPage-Cwc96TTa.js +0 -2
  109. package/dist/client/assets/index-BUxNND2H.js +0 -1
  110. package/dist/client/assets/index-C08DUVQ4.css +0 -1
  111. package/dist/client/assets/index-CGqPFWQw.js +0 -1
  112. package/dist/client/assets/index-CN1plkKF.js +0 -1
  113. package/dist/client/assets/index-CXWMnEDK.js +0 -1
  114. package/dist/client/assets/index-DDXrdlj0.js +0 -1648
  115. package/dist/client/assets/index-DEA1uIWn.js +0 -1
  116. package/dist/client/assets/index-PRwgIfzy.js +0 -7
  117. package/dist/client/assets/room-files-source-CSKgcbkn.js +0 -11
  118. package/dist/client/assets/use-mesh-update-BP_UXq60.js +0 -1
@@ -1 +0,0 @@
1
- import{j as e,bu as h,d8 as x,cR as m,d9 as b,da as N,db as P,cl as w,dc as C,J as S,dd as T,de as R,B as p,df as E,dg as I,dh as L,di as M}from"./index-DDXrdlj0.js";import{dj as q}from"./index-DDXrdlj0.js";function g({label:i,empty:s,allClear:a,action:o,children:l}){return e.jsxs("section",{children:[e.jsxs("div",{className:"mb-2 flex min-h-6 items-center justify-between gap-2",children:[e.jsx("h3",{className:"text-muted-foreground text-xs font-medium tracking-widest uppercase",children:i}),!s&&o]}),s?e.jsx("p",{className:"text-muted-foreground/70 text-xs",children:a}):l]})}const d=5,O={animate:{transition:{staggerChildren:.04}}};function _(){const i=h(),s=x(),a=m(),{schedules:o,errors:l,activity:c,isLoading:n,total:f}=b(),j=N(),v=P(o),A=s==="/"&&!a,r=v.slice(0,d),u=l.slice(0,d-r.length),y=c.slice(0,d-r.length-u.length);return A?null:e.jsxs(g,{label:"Needs attention",empty:!n&&f===0&&r.length===0,allClear:"All quiet. Nothing needs you.",action:e.jsx(p,{variant:"ghost",size:"sm",className:"h-6 text-xs",onClick:()=>i({to:"/"}),children:"View all →"}),children:[e.jsx(w,{initial:!1,children:r.map(t=>e.jsx(C,{task:t,className:"mb-2"},t.id))}),e.jsxs(S.div,{variants:O,initial:"initial",animate:"animate",children:[u.map(t=>e.jsx(T,{signal:t},t.id)),y.map(t=>e.jsx(R,{notification:t,onOpen:()=>j(t)},t.id))]})]})}const B=5;function k(){const i=h(),s=x(),a=m(),{groups:o,isLoading:l}=E();if(s==="/activity"&&!a)return null;const c=o.flatMap(n=>n.items).slice(0,B);return e.jsx(g,{label:"Activity",empty:!l&&c.length===0,allClear:"No recent activity.",action:e.jsx(p,{variant:"ghost",size:"sm",className:"h-6 text-xs",onClick:()=>i({to:"/activity"}),children:"Open activity →"}),children:e.jsx(I,{children:e.jsx(L,{children:c.map(n=>e.jsx(M,{item:n},n.id))})})})}function H(){return e.jsxs("div",{"data-slot":"pulse",className:"flex h-full flex-col gap-6 overflow-y-auto p-4",children:[e.jsx(_,{}),e.jsx(k,{})]})}export{H as PulsePanel,q as usePulseFreshness};
@@ -1,7 +0,0 @@
1
- import{e0 as we,fX as re,aV as W,ec as le,w as B,r as l,fY as ke,fZ as z,f_ as H,f$ as S,e5 as oe,g0 as J,g1 as Q,cS as Ee,g2 as Re,bv as je,g3 as Ne,x as V,g4 as Te,g5 as De,et as Se,g6 as Oe,ac as se,g7 as Fe,j as t,aA as ce,ah as de,aM as _e,C as Pe,g8 as Me,d7 as ue,g9 as Ae,fa as he,ff as Le,ag as ae,ga as fe,gb as pe,gc as Ie,eB as ze,eC as Ke,eD as He,eE as K,eF as q,dl as $e,B as Y,dC as Ye,dD as Ue,dE as Be,dF as Qe,dG as qe,dH as We,dI as Ge,dJ as Ve,fl as Xe,gd as Ze,ae as X,ge as me,gf as Je,aU as et,gg as tt,gh as nt,gi as st,gj as at,eb as ee,gk as xe,y as rt,aK as ot,gl as it,gm as lt}from"./index-DDXrdlj0.js";import{p as ct,F as dt,w as ut,c as ht}from"./room-files-source-CSKgcbkn.js";import{N as Xt,R as Zt}from"./room-files-source-CSKgcbkn.js";/**
2
- * @license lucide-react v1.44.0 - ISC
3
- *
4
- * This source code is licensed under the ISC license.
5
- * See the LICENSE file in the root directory of this source tree.
6
- */const ge={name:"file-plus",size:24,node:[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M9 15h6",key:"cctwl0"}],["path",{d:"M12 18v-6",key:"17g6i2"}]]};ge.node;const ft=we(ge),pt=[".git",".dork",".claude",".agents","node_modules"];function mt(e){return e.startsWith(".")||pt.includes(e)}const te=["ROOM.md","README.md"];function ne(e){return te.some(s=>s.toLowerCase()===e.toLowerCase())}function xt(e){return e.filter(s=>!mt(s.name))}function gt(e){if(e.reduce((p,x)=>x.type==="file"&&ne(x.name)?p+1:p,0)===0)return e;const n=[],m=[];for(const p of e)p.type==="file"&&ne(p.name)?n.push(p):m.push(p);return n.sort((p,x)=>te.findIndex(h=>h.toLowerCase()===p.name.toLowerCase())-te.findIndex(h=>h.toLowerCase()===x.name.toLowerCase())),[...n,...m]}function G(e,s,n){return["file-explorer","tree",e.scopeKey,s,e.filtersHidden?n:null]}function ye(e,s,n,m){return{queryKey:G(e,s,n),queryFn:()=>e.list(s,{showHidden:n}),staleTime:re.FILE_TREE_STALE_TIME_MS,gcTime:re.FILE_TREE_GC_TIME_MS,placeholderData:p=>p??m.getQueryData(G(e,s,!n))}}const yt=["CONFLICT","COPY_INTO_SELF","DIR_NOT_EMPTY","NOT_FOUND","REFUSE_ROOT","OUTSIDE_BOUNDARY"];function ve(e){const s=le(e);return s!==void 0&&yt.includes(s)?s:void 0}const Ce="Can’t copy a folder into itself",vt={CONFLICT:"That name already exists",COPY_INTO_SELF:Ce,DIR_NOT_EMPTY:"This folder isn’t empty",NOT_FOUND:"That item no longer exists",REFUSE_ROOT:"Can’t modify the working directory root",OUTSIDE_BOUNDARY:"That path is outside the working directory"};function $(e,s){const n=ve(e);W.error(n?vt[n]:s)}const Ct=/ copy(?: \d+)?$/;function bt({name:e,isDir:s,taken:n}){const m=new Set(n);if(!m.has(e))return e;const p=s?-1:e.lastIndexOf("."),x=p>0,h=x?e.slice(p):"",a=(x?e.slice(0,p):e).replace(Ct,"");for(let f=1;;f+=1){const v=f===1?`${a} copy${h}`:`${a} copy ${f}${h}`;if(!m.has(v))return v}}function ie(e,s,n){return{name:s,path:e,type:n,size:0,mtime:Date.now(),isSymlink:!1}}function wt(e){const s=B(),{source:n,showHidden:m,queryClient:p,inFlightRef:x}=e,h=n.cwd??"",[a,f]=l.useState(null),v=l.useCallback(async r=>{x.current+=1;try{return await r()}finally{x.current-=1}},[x]),i=l.useMemo(()=>{const r=d=>G(n,d,m);return{getChildren:d=>{var g;return((g=p.getQueryData(r(d)))==null?void 0:g.entries)??[]},isLoaded:d=>p.getQueryData(r(d))!==void 0,takenNames:async d=>(await s.readFileTree(h,{path:d===z?void 0:d,showHidden:!0})).entries.map(C=>C.name),snapshot:d=>p.getQueryData(r(d)),setChildren:(d,g)=>{p.setQueryData(r(d),C=>({entries:ke(g((C==null?void 0:C.entries)??[]))}))},restore:(d,g)=>{p.setQueryData(r(d),g)},invalidate:d=>{p.invalidateQueries({queryKey:r(d),exact:!0})}}},[p,s,h,n,m]),E=l.useCallback((r,d,g)=>v(async()=>{const C=Q(r,d),w=!i.getChildren(r).some(y=>y.path===C),j=i.snapshot(r);w&&i.setChildren(r,y=>[...y,ie(C,d,g)]);try{return await s.createEntry(h,C,g),!0}catch(y){return w&&i.restore(r,j),$(y,`Couldn’t create ${g==="dir"?"folder":"file"}`),!1}finally{i.invalidate(r)}}),[s,h,i,v]),T=l.useCallback((r,d)=>v(async()=>{if(d===r.name||d.length===0)return!0;const g=H(r.path),C=Q(g,d),w=i.getChildren(g).some(N=>N.path===C),j=i.snapshot(g),y={...r,name:d,path:C};w||i.setChildren(g,N=>N.map(A=>A.path===r.path?y:A));try{return await s.renameEntry(h,r.path,C),S.getState().remapExpandedPaths(r.path,C),!0}catch(N){return w||i.restore(g,j),$(N,"Couldn’t rename"),!1}finally{i.invalidate(g)}}),[s,h,i,v]),b=l.useCallback(r=>v(async()=>{const d=H(r.path),g=i.snapshot(d);i.setChildren(d,C=>C.filter(w=>w.path!==r.path));try{await s.deleteEntry(h,r.path,{recursive:!0}),S.getState().dropExpandedPaths(r.path)}catch(C){i.restore(d,g),$(C,"Couldn’t delete")}finally{i.invalidate(d)}}),[s,h,i,v]),M=l.useCallback(r=>v(async()=>{const d=H(r.path);if(r.type==="file"){const g=i.snapshot(d);i.setChildren(d,C=>C.filter(w=>w.path!==r.path));try{await s.deleteEntry(h,r.path),S.getState().dropExpandedPaths(r.path)}catch(C){i.restore(d,g),$(C,"Couldn’t delete")}finally{i.invalidate(d)}return}try{await s.deleteEntry(h,r.path),i.setChildren(d,g=>g.filter(C=>C.path!==r.path)),S.getState().dropExpandedPaths(r.path),i.invalidate(d)}catch(g){if(ve(g)==="DIR_NOT_EMPTY"){f(r);return}$(g,"Couldn’t delete")}}),[s,h,i,v]),_=l.useCallback(async()=>{const r=a;f(null),r&&await b(r)},[a,b]),O=l.useCallback(()=>f(null),[]),P=l.useCallback((r,d)=>v(async()=>{const g=H(r),C=oe(r),w=Q(d,C);if(d===g||w===r||J(d,r))return;const j=i.getChildren(g).find(c=>c.path===r);if(!j)return;const y=i.isLoaded(d),N=y&&i.getChildren(d).some(c=>c.path===w),A={...j,name:C,path:w},u=i.snapshot(g),o=y?i.snapshot(d):void 0;i.setChildren(g,c=>c.filter(k=>k.path!==r)),y&&!N&&i.setChildren(d,c=>[...c,A]);try{await s.renameEntry(h,r,w),S.getState().remapExpandedPaths(r,w)}catch(c){i.restore(g,u),y&&!N&&i.restore(d,o),$(c,"Couldn’t move")}finally{i.invalidate(g),y&&i.invalidate(d)}}),[s,h,i,v]),R=l.useCallback((r,d)=>v(async()=>{if(r.isDir&&J(d,r.path)){W.error(Ce);return}let g;try{g=await i.takenNames(d)}catch(N){$(N,"Couldn’t copy");return}const C=bt({name:oe(r.path),isDir:r.isDir,taken:g}),w=Q(d,C),j=i.isLoaded(d),y=j?i.snapshot(d):void 0;if(j){const N=i.getChildren(H(r.path)).find(u=>u.path===r.path),A=N?{...N,name:C,path:w}:ie(w,C,r.isDir?"dir":"file");i.setChildren(d,u=>[...u,A])}try{await s.copyEntry(h,r.path,w)}catch(N){j&&i.restore(d,y),$(N,"Couldn’t copy")}finally{i.invalidate(d)}}),[s,h,i,v]);return{createEntry:E,renameEntry:T,removeEntry:M,moveEntry:P,copyEntry:R,pendingRecursiveDelete:a,confirmRecursiveDelete:_,cancelRecursiveDelete:O}}function kt(e){return e!=null&&e.startsWith("darwin")?"Reveal in Finder":e!=null&&e.startsWith("win32")?"Reveal in File Explorer":"Show in File Manager"}function Et(e,s){const n=e.includes("\\")&&!e.includes("/"),m=e.replace(/[\\/]+$/,""),p=n?s.split("/").join("\\"):s;return`${m}${n?"\\":"/"}${p}`}function Rt(e){const s=B(),{data:n}=Ee(),m=l.useMemo(()=>s.supportsReveal?kt(n==null?void 0:n.platform):null,[s.supportsReveal,n==null?void 0:n.platform]),p=l.useCallback(async v=>{if(e)try{await s.revealEntry(e,v.path)}catch(i){$(i,"Couldn’t open the file manager")}},[s,e]),{copy:x}=Re(),h=l.useCallback(async(v,i)=>{const E=i==="absolute"&&e?Et(e,v.path):v.path;await x(E)||W.error("Couldn’t copy to the clipboard")},[e,x]),a=l.useCallback(v=>{je(Ne(v.path))||W.error("Open a chat first to add a file to it")},[]),f=l.useCallback(v=>{S.getState().setClipboard({path:v.path,isDir:v.type==="dir"});try{navigator.clipboard.writeText(v.path).catch(()=>{})}catch{}},[]);return{revealLabel:m,reveal:p,copyPath:h,addToChat:a,copyToClipboard:f}}const jt={scopeKey:"",cwd:null,writable:!1,provenance:!1,filtersHidden:!0,preview:"canvas",editable:!1,list:()=>Promise.resolve({entries:[]})};function Nt(e){var u,o;const s=B(),n=V(),{setTheme:m}=Te(),p=S(c=>c.showHidden),x=S(c=>c.expanded),h=S(c=>c.loadExplorerForCwd),a=S(c=>c.pruneMissing),f=(e==null?void 0:e.scopeKey)??null,v=(e==null?void 0:e.cwd)??null;l.useEffect(()=>{h(f)},[f,h]);const i=l.useMemo(()=>[z,...De(x)],[x]),E=Se({queries:e?i.map(c=>ye(e,c,p,n)):[]}),T=(e==null?void 0:e.filtersHidden)??!0,b=l.useMemo(()=>{const c={};return i.forEach((k,F)=>{var U;const L=E[F];let I=((U=L==null?void 0:L.data)==null?void 0:U.entries)??[];!p&&!T&&(I=xt(I)),k===z&&(I=gt(I)),c[k]={entries:I,loading:(L==null?void 0:L.isLoading)??!1,error:(L==null?void 0:L.isError)??!1}}),c},[i,E,p,T]),M=l.useRef(0),_=l.useRef({});l.useEffect(()=>{M.current>0||i.forEach((c,k)=>{var L,I,U;const F=(I=(L=E[k])==null?void 0:L.data)==null?void 0:I.entries;!F||(U=E[k])!=null&&U.isError||_.current[c]!==F&&(_.current[c]=F,a(c,F.map(D=>D.name)))})},[i,E,a]);const O=l.useMemo(()=>Oe(x,b),[x,b]),P=!!e&&!!((u=b[z])!=null&&u.loading),R=!!e&&!!((o=b[z])!=null&&o.error),r=l.useMemo(()=>{var k;const c=new Set;for(const F of i)F!==z&&((k=b[F])!=null&&k.error)&&c.add(F);return c},[i,b]),d=l.useCallback(c=>{if(c.type!=="dir")return;const k=S.getState();k.setDirExpanded(c.path,!k.expanded[c.path])},[]),g=l.useCallback(c=>{if(c===z)return;const k=S.getState();k.expanded[c]||k.setDirExpanded(c,!0)},[]),C=(e==null?void 0:e.preview)==="canvas",w=l.useCallback(c=>{if(c.type!=="file"||!C)return;const k={getStore:se.getState,setTheme:m,supportsTerminal:s.supportsTerminal};Fe(k,{action:"open_file",sourcePath:c.path},"user")},[C,m,s]),j=l.useCallback(()=>{f!==null&&n.invalidateQueries({queryKey:["file-explorer","tree",f]})},[n,f]),y=l.useCallback(c=>{e!==null&&n.invalidateQueries({queryKey:G(e,c,p),exact:!0})},[n,e,p]);l.useEffect(()=>{if(e!=null&&e.events)return e.events(j)},[e,j]);const N=wt({source:e??jt,showHidden:p,queryClient:n,inFlightRef:M}),A=Rt(v);return{rows:O,rootLoading:P,rootError:R,errorPaths:r,toggleExpand:d,ensureExpanded:g,openFile:w,reload:j,retryDir:y,...N,...A}}function Tt(e){const{transport:s,cwd:n}=e;return{scopeKey:n,cwd:n,writable:!0,provenance:!1,filtersHidden:!0,preview:"canvas",editable:!1,list(m,p){return s.readFileTree(n,{path:m===""?void 0:m,showHidden:p.showHidden})}}}const Dt=12;function St({row:e,selected:s,renaming:n,error:m,onSelect:p,onActivate:x,onRetry:h,onSubmitRename:a,onCancelRename:f,onNewFile:v,onNewFolder:i,onStartRename:E,onDelete:T,onMove:b,onCopyInto:M,onCopy:_,onPaste:O,onDuplicate:P,canPasteInto:R,revealLabel:r,onReveal:d,onAddToChat:g,onCopyPath:C,readOnly:w=!1,provenance:j=!1}){const{entry:y,depth:N,expanded:A,loading:u}=e,o=y.type==="dir",c=o?y.path:H(y.path),[k,F]=l.useState(!1),L=!o&&N===0&&ne(y.name),I=ct(y.lastCommit),U=t.jsxs("div",{role:"treeitem","aria-label":y.name,"aria-expanded":o?A:void 0,"aria-selected":s,tabIndex:-1,onKeyDown:D=>{(D.key==="Enter"||D.key===" ")&&(D.preventDefault(),p(y),x(y))},draggable:!n&&!w,onDragStart:D=>{w||(D.dataTransfer.setData("text/plain",y.path),D.dataTransfer.setData(Ie,y.path),D.dataTransfer.effectAllowed="copyMove")},onDragOver:D=>{D.stopPropagation(),!(w||!o||!pe(D.dataTransfer.types))&&(D.preventDefault(),D.dataTransfer.dropEffect=D.altKey?"copy":"move",F(!0))},onDragLeave:()=>F(!1),onDrop:D=>{if(D.stopPropagation(),w||!o)return;F(!1);const Z=fe(D.dataTransfer);Z!==null&&(D.preventDefault(),D.altKey?M(Z,y.path):b(Z,y.path))},onClick:()=>{p(y),x(y)},className:ae("flex w-full cursor-pointer items-center gap-1 py-1 pr-2 text-sm transition-colors",s?"bg-accent text-foreground":"hover:bg-accent/50",k&&"ring-ring/60 bg-accent ring-1"),style:{paddingLeft:N*Dt+8},children:[t.jsx("span",{className:"flex size-4 flex-shrink-0 items-center justify-center",children:o&&(u?t.jsx(ce,{size:"xs",className:"text-muted-foreground"}):m?t.jsx("button",{type:"button","aria-label":"Retry loading",title:"Couldn’t load. Retry",onClick:D=>{D.stopPropagation(),h()},className:"flex items-center justify-center",children:t.jsx(de,{className:"text-destructive size-3.5"})}):A?t.jsx(_e,{className:"text-muted-foreground size-3.5"}):t.jsx(Pe,{className:"text-muted-foreground size-3.5"}))}),o?A?t.jsx(Me,{className:"size-(--size-icon-sm) flex-shrink-0 text-sky-500"}):t.jsx(ue,{className:"size-(--size-icon-sm) flex-shrink-0 text-sky-500"}):y.isSymlink===!0?t.jsx(Ae,{className:"text-muted-foreground size-(--size-icon-sm) flex-shrink-0"}):t.jsx(he,{className:"text-muted-foreground size-(--size-icon-sm) flex-shrink-0"}),n?t.jsx(Ot,{initialName:y.name,onSubmit:D=>a(y,D),onCancel:f}):t.jsx("span",{className:"min-w-0 flex-1 truncate",children:y.name}),L&&!n&&t.jsx(Le,{"aria-label":"Pinned to the top",className:"text-muted-foreground/60 size-3 flex-shrink-0"}),j&&!n&&t.jsx("span",{className:"text-muted-foreground/70 text-2xs max-w-[45%] flex-shrink-0 truncate tabular-nums",title:I.title??void 0,children:I.label})]});return w?U:t.jsxs(ze,{children:[t.jsx(Ke,{asChild:!0,children:U}),t.jsxs(He,{className:"w-52",children:[t.jsx(K,{onClick:()=>v(c),children:"New file"}),t.jsx(K,{onClick:()=>i(c),children:"New folder"}),t.jsx(q,{}),r&&t.jsx(K,{onClick:()=>d(y),children:r}),t.jsx(K,{movesFocus:!0,onClick:()=>g(y),children:"Add to chat"}),t.jsx(q,{}),t.jsx(K,{onClick:()=>_(y),children:"Copy"}),t.jsx(K,{disabled:!R(c),onClick:()=>O(c),children:"Paste"}),t.jsx(K,{onClick:()=>P(y),children:"Duplicate"}),t.jsx(q,{}),t.jsx(K,{onClick:()=>C(y,"absolute"),children:"Copy path"}),t.jsx(K,{onClick:()=>C(y,"relative"),children:"Copy relative path"}),t.jsx(q,{}),t.jsx(K,{onClick:()=>E(y),children:"Rename"}),t.jsx(K,{variant:"destructive",onClick:()=>T(y),children:"Delete"})]})]})}function Ot({initialName:e,onSubmit:s,onCancel:n}){const m=l.useRef(null),[p,x]=l.useState(e);l.useEffect(()=>{const a=m.current;if(!a)return;a.focus();const f=e.lastIndexOf(".");a.setSelectionRange(0,f>0?f:e.length)},[e]);const h=()=>{const a=p.trim();a&&a!==e?s(a):n()};return t.jsx("input",{ref:m,type:"text",value:p,"aria-label":"New name",onChange:a=>x(a.target.value),onClick:a=>a.stopPropagation(),onBlur:h,onKeyDown:a=>{a.key==="Enter"?h():a.key==="Escape"&&n()},className:"border-border bg-background min-w-0 flex-1 rounded border px-1 py-0 text-sm outline-none"})}const Ft=100,_t=28,Pt=250;function Mt(e){const{rows:s,selectedPath:n,renamingPath:m,errorPaths:p,onSelectPath:x,onRetryDir:h}=e,a=l.useRef(null),f=S(o=>o.setScrollTop),v=S(o=>o.scopeKey),i=l.useCallback(o=>o.type==="dir"?e.onToggle(o):e.onOpen(o),[e]),E=Lt(e,i),T=s.length>Ft,b=$e({count:s.length,getScrollElement:()=>a.current,estimateSize:()=>_t,overscan:12,enabled:T}),M=l.useRef({scope:void 0,done:!1}),_=l.useRef(null);l.useLayoutEffect(()=>{const o=M.current;if(o.scope!==v&&(o.scope=v,o.done=!1),o.done||s.length===0)return;const c=a.current;if(!c)return;const k=S.getState().scrollTop;if(k<=0){o.done=!0;return}T?b.scrollToOffset(k):c.scrollTop=k,_.current=c.scrollTop,c.scrollTop>=k&&(o.done=!0)},[s.length,v,T,b]);const O=l.useRef(null),P=l.useRef(null),R=l.useCallback(()=>{const o=a.current;o&&o.scrollTop!==_.current&&(M.current.done=!0,O.current=o.scrollTop,P.current&&clearTimeout(P.current),P.current=setTimeout(()=>{P.current=null,O.current!==null&&f(O.current)},Pt))},[f]);l.useEffect(()=>()=>{P.current&&clearTimeout(P.current),O.current!==null&&f(O.current)},[f]);const r=l.useRef(void 0);l.useEffect(()=>{var F,L;const o=r.current;if(r.current=n,o===void 0||n===o||n===null)return;const c=s.findIndex(I=>I.entry.path===n);if(c<0)return;const k=a.current;k&&(T?b.scrollToIndex(c,{align:"auto"}):(L=(F=k.querySelector(`[data-row-index="${c}"]`))==null?void 0:F.scrollIntoView)==null||L.call(F,{block:"nearest"}),_.current=k.scrollTop)},[n,s,T,b]);const[d,g]=l.useState(!1),{onCopyInto:C,onMove:w}=e,j=e.readOnly===!0,y=l.useCallback(o=>{j||!pe(o.dataTransfer.types)||(o.preventDefault(),o.dataTransfer.dropEffect=o.altKey?"copy":"move",g(!0))},[j]),N=l.useCallback((o,c)=>{const k=s.find(F=>F.entry.path===o);k&&C({path:o,isDir:k.entry.type==="dir"},c)},[s,C]),A=l.useCallback(o=>{if(g(!1),j)return;const c=fe(o.dataTransfer);c!==null&&(o.preventDefault(),o.altKey?N(c,z):w(c,z))},[N,w,j]),u=o=>t.jsx(St,{row:o,selected:o.entry.path===n,renaming:o.entry.path===m,error:o.entry.type==="dir"&&o.expanded&&p.has(o.entry.path),onSelect:c=>x(c.path),onActivate:i,onRetry:()=>h(o.entry.path),onSubmitRename:e.onSubmitRename,onCancelRename:e.onCancelRename,onStartRename:e.onStartRename,onNewFile:e.onNewFile,onNewFolder:e.onNewFolder,onDelete:e.onDelete,onMove:e.onMove,onCopyInto:N,onCopy:e.onCopy,onPaste:e.onPaste,onDuplicate:e.onDuplicate,canPasteInto:e.canPasteInto,revealLabel:e.revealLabel,onReveal:e.onReveal,onAddToChat:e.onAddToChat,onCopyPath:e.onCopyPath,readOnly:e.readOnly,provenance:e.provenance});return t.jsx("div",{ref:a,role:"tree","aria-label":"File explorer",tabIndex:0,onKeyDown:E,onScroll:R,onDragOver:y,onDragLeave:()=>g(!1),onDrop:A,className:ae("focus-visible:ring-ring/40 h-full overflow-auto outline-none focus-visible:ring-1 focus-visible:ring-inset",d&&"ring-ring/60 bg-accent/30 ring-1 ring-inset"),children:T?t.jsx("div",{style:{height:b.getTotalSize()},className:"relative w-full",children:b.getVirtualItems().map(o=>t.jsx("div",{"data-row-index":o.index,className:"absolute top-0 left-0 w-full",style:{transform:`translateY(${o.start}px)`},children:u(s[o.index])},s[o.index].entry.path))}):s.map((o,c)=>t.jsx("div",{"data-row-index":c,children:u(o)},o.entry.path))})}function At(e){return e?e.type==="dir"?e.path:H(e.path):z}function Lt(e,s){const{rows:n,selectedPath:m,renamingPath:p,onSelectPath:x}=e;return l.useCallback(h=>{var v,i,E,T;if(p!==null)return;const a=n.findIndex(b=>b.entry.path===m),f=a>=0?n[a]:void 0;if(h.metaKey||h.ctrlKey){if(e.readOnly===!0)return;const b=h.key.toLowerCase();if(b==="c"&&f){h.preventDefault(),e.onCopy(f.entry);return}if(b==="v"){h.preventDefault(),e.onPaste(At(f==null?void 0:f.entry));return}return}switch(h.key){case"ArrowDown":h.preventDefault(),x(((v=n[Math.min(a+1,n.length-1)])==null?void 0:v.entry.path)??((i=n[0])==null?void 0:i.entry.path));break;case"ArrowUp":h.preventDefault(),x(((E=n[Math.max(a-1,0)])==null?void 0:E.entry.path)??((T=n[0])==null?void 0:T.entry.path));break;case"ArrowRight":(f==null?void 0:f.entry.type)==="dir"&&!f.expanded&&(h.preventDefault(),e.onToggle(f.entry));break;case"ArrowLeft":if(!f)break;if(h.preventDefault(),f.entry.type==="dir"&&f.expanded)e.onToggle(f.entry);else{const b=H(f.entry.path);b&&x(b)}break;case"Enter":f&&(h.preventDefault(),s(f.entry));break;case"F2":f&&e.readOnly!==!0&&(h.preventDefault(),e.onStartRename(f.entry));break;case"Delete":case"Backspace":f&&e.readOnly!==!0&&(h.preventDefault(),e.onDelete(f.entry));break}},[n,m,p,x,e,s])}function It({source:e,className:s}={}){var A;const n=B(),m=se(u=>u.selectedCwd),p=l.useMemo(()=>m?Tt({transport:n,cwd:m}):null,[n,m]),x=e===void 0?p:e,h=x!==null&&!x.writable,a=Nt(x),{rows:f,rootLoading:v,rootError:i,errorPaths:E}=a,T=S(u=>u.setCommands),b=S(u=>u.selectedPath),M=S(u=>u.setSelectedPath),_=S(u=>u.clipboard),[O,P]=l.useState(null),[R,r]=l.useState(null),[d,g]=l.useState(null),C=l.useCallback(u=>_!==null&&!(_.isDir&&J(u,_.path)),[_]),w=l.useCallback((u,o)=>{a.ensureExpanded(u),r(null),P({parent:u,type:o})},[a]),j=l.useRef({startCreate:w,reload:a.reload});l.useEffect(()=>{j.current={startCreate:w,reload:a.reload}}),l.useEffect(()=>{if(!h)return T({newFile:()=>j.current.startCreate(z,"file"),newFolder:()=>j.current.startCreate(z,"dir"),refresh:()=>j.current.reload()}),()=>T(null)},[T,h]);const y=l.useCallback(async u=>{if(!O)return;const o=O;P(null),await a.createEntry(o.parent,u,o.type)&&M(Q(o.parent,u))},[O,a,M]),N=l.useCallback(async(u,o)=>{r(null),await a.renameEntry(u,o)&&M(Q(H(u.path),o))},[a,M]);return x===null?e!==void 0?null:t.jsx("div",{className:"text-muted-foreground flex h-full items-center justify-center p-6 text-center text-sm",children:"Select a working directory to browse its files."}):t.jsxs("div",{className:ae("flex h-full flex-col",s),children:[t.jsxs("div",{className:"min-h-0 flex-1",children:[O&&t.jsx(zt,{type:O.type,onSubmit:u=>void y(u),onCancel:()=>P(null)}),v&&f.length===0?t.jsx("div",{className:"flex h-20 items-center justify-center",children:t.jsx(ce,{size:"md",className:"text-muted-foreground",label:"Loading files"})}):i&&f.length===0?t.jsxs("div",{className:"text-muted-foreground flex h-20 flex-col items-center justify-center gap-2 text-xs",children:[t.jsx("span",{children:"Couldn’t load files."}),t.jsxs(Y,{variant:"outline",size:"xs",onClick:a.reload,children:[t.jsx(de,{}),"Retry"]})]}):f.length===0&&!O?t.jsx("div",{className:"text-muted-foreground/60 flex h-20 items-center justify-center text-xs",children:"Empty directory"}):t.jsx(Mt,{rows:f,selectedPath:b,renamingPath:R,errorPaths:E,onSelectPath:M,onToggle:a.toggleExpand,onOpen:u=>{x.preview==="inline"?g(u.path):a.openFile(u)},onRetryDir:a.retryDir,onSubmitRename:(u,o)=>void N(u,o),onCancelRename:()=>r(null),onStartRename:u=>r(u.path),onNewFile:u=>w(u,"file"),onNewFolder:u=>w(u,"dir"),onDelete:u=>void a.removeEntry(u),onMove:(u,o)=>void a.moveEntry(u,o),onCopyInto:(u,o)=>void a.copyEntry(u,o),onCopy:a.copyToClipboard,onPaste:u=>{_&&a.copyEntry(_,u)},onDuplicate:u=>void a.copyEntry({path:u.path,isDir:u.type==="dir"},H(u.path)),canPasteInto:C,readOnly:h,provenance:x.provenance,revealLabel:a.revealLabel,onReveal:u=>void a.reveal(u),onAddToChat:a.addToChat,onCopyPath:(u,o)=>void a.copyPath(u,o)})]}),x.preview==="inline"&&t.jsx(dt,{source:x,path:d,onClose:()=>g(null)}),t.jsx(Ye,{open:a.pendingRecursiveDelete!==null,onOpenChange:u=>!u&&a.cancelRecursiveDelete(),children:t.jsxs(Ue,{children:[t.jsxs(Be,{children:[t.jsx(Qe,{children:"Delete this folder?"}),t.jsxs(qe,{children:["“",(A=a.pendingRecursiveDelete)==null?void 0:A.name,"” isn’t empty. Deleting it removes everything inside. This can’t be undone."]})]}),t.jsxs(We,{children:[t.jsx(Ge,{onClick:a.cancelRecursiveDelete,children:"Cancel"}),t.jsx(Ve,{onClick:()=>void a.confirmRecursiveDelete(),className:"bg-destructive hover:bg-destructive/90 dark:bg-destructive/60 text-white",children:"Delete"})]})]})})]})}function zt({type:e,onSubmit:s,onCancel:n}){const m=l.useRef(null),[p,x]=l.useState("");l.useEffect(()=>{var a;(a=m.current)==null||a.focus()},[]);const h=()=>{const a=p.trim();a?s(a):n()};return t.jsxs("div",{className:"flex items-center gap-1 px-3 py-1",children:[e==="dir"?t.jsx(ue,{className:"size-(--size-icon-sm) flex-shrink-0 text-sky-500"}):t.jsx(he,{className:"text-muted-foreground size-(--size-icon-sm) flex-shrink-0"}),t.jsx("input",{ref:m,type:"text",value:p,"aria-label":e==="dir"?"New folder name":"New file name",placeholder:e==="dir"?"folder-name":"file-name",onChange:a=>x(a.target.value),onBlur:h,onKeyDown:a=>{a.key==="Enter"?h():a.key==="Escape"&&n()},className:"border-border bg-background min-w-0 flex-1 rounded border px-1 py-0 text-sm outline-none"})]})}function be(){const e=S(m=>m.showHidden),s=S(m=>m.setShowHidden),n=e?"Hide hidden files":"Show hidden files";return t.jsx(Y,{variant:"ghost",size:"icon-xs","aria-label":n,title:n,onClick:()=>s(!e),children:e?t.jsx(Xe,{className:"text-muted-foreground"}):t.jsx(Ze,{className:"text-muted-foreground"})})}function Kt({cwd:e}){const s=B(),{data:n}=X({queryKey:["file-explorer","workspace",e],queryFn:()=>s.resolveWorkspace(e),staleTime:6e4});return n!=null&&n.branch?t.jsxs("span",{className:"text-muted-foreground bg-muted/50 text-2xs inline-flex min-w-0 items-center gap-1 rounded px-1.5 py-0.5",title:`Workspace ${n.key} on ${n.branch}`,children:[t.jsx(me,{className:"size-3 flex-shrink-0"}),t.jsx("span",{className:"truncate",children:n.branch})]}):null}function qt(){const e=se(n=>n.selectedCwd),s=S(n=>n.commands);return e?t.jsxs(t.Fragment,{children:[t.jsx(Kt,{cwd:e}),t.jsx(Y,{variant:"ghost",size:"icon-xs","aria-label":"New file",title:"New file",onClick:()=>s==null?void 0:s.newFile(),children:t.jsx(ft,{className:"text-muted-foreground"})}),t.jsx(Y,{variant:"ghost",size:"icon-xs","aria-label":"New folder",title:"New folder",onClick:()=>s==null?void 0:s.newFolder(),children:t.jsx(Je,{className:"text-muted-foreground"})}),t.jsx(be,{}),t.jsx(Y,{variant:"ghost",size:"icon-xs","aria-label":"Refresh",title:"Refresh",onClick:()=>s==null?void 0:s.refresh(),children:t.jsx(et,{className:"text-muted-foreground"})})]}):null}function Ht({roomId:e}){const s=B(),n=V(),m=X(xe(s,e));l.useEffect(()=>ut(n,e,()=>{n.invalidateQueries({queryKey:ee.repoStatus(e)})}),[n,e]);const p=l.useMemo(()=>{var f;return((f=m.data)==null?void 0:f.kind)==="ok"?tt(m.data.status):[]},[m.data]),x=nt(p),h=st(p);if(!h)return null;const a=p.map((f,v)=>`${x[v]}: ${at(f)}`);return t.jsxs("span",{"data-slot":"pending-work-badge",title:a.join(`
7
- `),className:"text-muted-foreground bg-muted/50 text-2xs inline-flex min-w-0 items-center gap-1 rounded px-1.5 py-0.5",children:[t.jsx(me,{className:"size-3 flex-shrink-0"}),t.jsxs("span",{className:"sr-only",children:["Not merged into the room yet. ",a.join(". "),"."]}),t.jsx("span",{"aria-hidden":"true",className:"truncate",children:h})]})}const $t={added:"added",modified:"changed",deleted:"deleted",untracked:"new"},Yt=new Map([["OPERATOR_ONLY","Only the person who owns this DorkOS can decide what happens to those changes."],["ROOM_FILE_NOT_FOUND","One of those changes is not there any more, so nothing was discarded. The list below has been refreshed."],["MERGE_IN_FLIGHT","Something else is writing to this room’s files right now. Nothing was changed. Try again in a moment."],["MAIN_CHECKOUT_DIRTY","This room’s files are on another branch, which DorkOS will not move for you. Put them back on main yourself."],["ROOM_REPO_GIT_UNAVAILABLE","This computer doesn’t have git installed, and a room’s files are a git repository."],["ROOM_HAS_NO_REPO","This room does not have files of its own any more."],["ROOM_REPOS_DISABLED","Rooms cannot have files of their own on this install right now."]]);function Ut({roomId:e}){var O,P;const s=B(),n=V(),m=X(xe(s,e)),[p,x]=l.useState([]),[h,a]=l.useState(!1),[f,v]=l.useState(null),i=rt({mutationFn:R=>s.repairRoomMain(e,R),onSuccess:()=>{x([]),a(!1),v(null),n.invalidateQueries({queryKey:ee.repoStatus(e)})},onError:R=>{a(!1);const r=Yt.get(le(R)??"");v(r??"That didn’t work. Try again in a moment."),n.invalidateQueries({queryKey:ee.repoStatus(e)})}});if(((O=m.data)==null?void 0:O.kind)==="unavailable")return t.jsx("p",{role:"alert","data-slot":"room-main-warning",className:"border-border/60 text-muted-foreground rounded-lg border px-3 py-2.5 text-xs",children:"DorkOS couldn’t check whether this room’s files are in order. If saving here is refused, this is why. Try again in a moment."});const E=((P=m.data)==null?void 0:P.kind)==="ok"?m.data.status.main:void 0;if(E===void 0||!E.dirty)return null;const T=E.branch!=="main",b=p.filter(R=>E.strays.some(r=>r.path===R)),M=h&&b.length>0,_=R=>x(r=>r.includes(R)?r.filter(d=>d!==R):[...r,R]);return t.jsxs("div",{role:"alert","data-slot":"room-main-warning",className:"border-border/60 bg-muted/40 space-y-3 rounded-lg border px-3 py-2.5 text-sm",children:[t.jsxs("div",{className:"flex gap-2",children:[t.jsx(ot,{className:"text-muted-foreground mt-0.5 size-(--size-icon-sm) flex-shrink-0"}),t.jsxs("div",{className:"min-w-0 space-y-1",children:[t.jsx("p",{className:"font-medium",children:"Somebody changed this room’s files outside DorkOS"}),t.jsx("p",{className:"text-muted-foreground text-xs",children:T?`This room’s files are on ${E.branch??"no branch"} instead of main. Nobody can save a file here and no agent can merge into it until they are back on main. DorkOS will not move a branch it did not move, in case there is work on it.`:"Nobody can save a file here, and no agent can merge its work in, until these are dealt with."})]})]}),!T&&t.jsxs(t.Fragment,{children:[t.jsx("ul",{className:"space-y-1.5",children:E.strays.map(R=>t.jsxs("li",{className:"flex items-center gap-2",children:[t.jsx(it,{id:`stray-${e}-${R.path}`,checked:b.includes(R.path),onCheckedChange:()=>_(R.path),disabled:i.isPending}),t.jsx("label",{htmlFor:`stray-${e}-${R.path}`,className:"min-w-0 flex-1 cursor-pointer truncate font-mono text-xs",title:R.path,children:R.path}),t.jsx("span",{className:"text-muted-foreground flex-shrink-0 text-xs",children:$t[R.kind]})]},R.path))}),E.strayCount>E.strays.length&&t.jsxs("p",{className:"text-muted-foreground text-xs",children:["…and ",E.strayCount-E.strays.length," more, not listed here. Keeping them all still keeps every one."]}),M?t.jsxs("div",{className:"space-y-2",children:[t.jsx("p",{className:"text-xs",children:b.length===1?"Throw away that change? It cannot be brought back.":`Throw away those ${b.length} changes? They cannot be brought back.`}),t.jsxs("div",{className:"flex flex-wrap gap-2",children:[t.jsx(Y,{type:"button",variant:"ghost",size:"sm",disabled:i.isPending,onClick:()=>a(!1),children:"Cancel"}),t.jsx(Y,{type:"button",variant:"destructive",size:"sm",disabled:i.isPending,onClick:()=>i.mutate({action:"discard",paths:[...b]}),children:"Yes, discard"})]})]}):t.jsxs("div",{className:"flex flex-wrap gap-2",children:[t.jsx(Y,{type:"button",variant:"outline",size:"sm",disabled:i.isPending,onClick:()=>i.mutate({action:"commit"}),children:"Keep them all"}),t.jsx(Y,{type:"button",variant:"ghost",size:"sm",disabled:i.isPending||b.length===0,onClick:()=>a(!0),children:b.length===0?"Discard…":`Discard ${b.length}`})]})]}),f!==null&&t.jsx("p",{className:"text-destructive text-xs",children:f})]})}function Wt({roomId:e}){const s=B(),n=V(),m=S(v=>v.showHidden),p=l.useMemo(()=>ht({transport:s,queryClient:n,roomId:e}),[s,n,e]),x=X(ye(p,z,m,n)),h=x.isSuccess&&x.data.absent!==!0||x.isError,[a,f]=l.useState(null);return h&&a!==e&&f(e),!h&&a!==e?null:t.jsxs("section",{"aria-label":"Room files",className:"space-y-2",children:[t.jsxs("header",{className:"flex items-center gap-2",children:[t.jsx(lt,{className:"text-muted-foreground size-(--size-icon-sm) flex-shrink-0"}),t.jsx("h3",{className:"text-muted-foreground text-xs font-medium tracking-wide uppercase",children:"Files"}),t.jsx("div",{className:"min-w-0 flex-1",children:t.jsx(Ht,{roomId:e})}),t.jsx(be,{})]}),t.jsx(Ut,{roomId:e}),t.jsx("div",{"data-slot":"room-files-body",className:"border-border/60 h-72 overflow-hidden rounded-lg border",children:t.jsx(It,{source:p})})]})}export{It as FileExplorer,qt as FileExplorerActions,dt as FilePreviewDialog,pt as HIDDEN_ENTRY_NAMES,be as HiddenEntriesToggle,Xt as NO_PROVENANCE,te as PINNED_ENTRY_NAMES,Zt as ROOM_FILES_REFRESH_INTERVAL_MS,Wt as RoomFilesSection,ht as createRoomFilesSource,Tt as createSessionCwdSource,G as explorerDirQueryKey,ye as explorerDirQueryOptions,mt as isHiddenEntryName,ne as isPinnedEntryName,gt as pinnedFirst,ct as provenanceLine,xe as roomRepoStatusQueryOptions,xt as withoutHidden};
@@ -1,11 +0,0 @@
1
- import{e0 as K,aB as q,x as ie,ae as oe,r as a,y as ae,j as t,e1 as re,e2 as le,e3 as ce,e4 as de,e5 as $,e6 as ue,B as y,aj as me,e7 as he,aA as fe,ag as xe,e8 as ye,e9 as ge,ea as ve,eb as H,ec as k,ed as be,ee as pe}from"./index-DDXrdlj0.js";/**
2
- * @license lucide-react v1.44.0 - ISC
3
- *
4
- * This source code is licensed under the ISC license.
5
- * See the LICENSE file in the root directory of this source tree.
6
- */const U={name:"file-exclamation-point",size:24,node:[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]],aliases:["file-warning"]};U.node;const we=K(U);/**
7
- * @license lucide-react v1.44.0 - ISC
8
- *
9
- * This source code is licensed under the ISC license.
10
- * See the LICENSE file in the root directory of this source tree.
11
- */const Q={name:"share-2",size:24,node:[["circle",{cx:"18",cy:"5",r:"3",key:"gq8acd"}],["circle",{cx:"6",cy:"12",r:"3",key:"w7nqdw"}],["circle",{cx:"18",cy:"19",r:"3",key:"1xt0gg"}],["line",{x1:"8.59",x2:"15.42",y1:"13.51",y2:"17.49",key:"47mynk"}],["line",{x1:"15.41",x2:"8.59",y1:"6.51",y2:"10.49",key:"1n3mei"}]]};Q.node;const Ee=K(Q),Oe="—";function Re(e){if(e==null)return{label:Oe,title:null};const s=q(e.at);return{label:`${e.author} · ${s}`,title:`${e.subject} · ${e.author}, ${s}`}}function V(e){return/\.(md|markdown|mdx)$/i.test(e)}function _e(e){return e<1024?`${e} bytes`:e<1024*1024?`${Math.round(e/1024)} KB`:`${(e/(1024*1024)).toFixed(1)} MB`}function je(e,s){return e.editable&&e.save!==void 0&&s!==void 0&&s.body.kind==="text"&&V(s.path)}function Le({source:e,path:s,onClose:d}){const r=e.read,i=ie(),n=["file-explorer","preview",e.scopeKey,s],u=oe({queryKey:n,queryFn:()=>r(s),enabled:s!==null&&r!==void 0}),l=u.data,[h,S]=a.useState(!1),[D,F]=a.useState(null),j=e.showToEveryone,G=a.useCallback(async o=>{if(j!==void 0){S(!0),F(null);try{await j(o),d()}catch(c){F(c instanceof Error&&c.message.trim().length>0?c.message:"DorkOS couldn’t reach the server. Check your connection and try again.")}finally{S(!1)}}},[j,d]),[f,N]=a.useState(!1),[b,p]=a.useState(""),[M,O]=a.useState({text:"",commit:null}),[g,x]=a.useState(null),[C,m]=a.useState(null),[A,w]=a.useState(!1),[Y,R]=a.useState(!1),P=a.useRef(null),z=a.useRef(null),L=a.useRef(!1),v=f&&b!==M.text,I=Y&&v,T=a.useCallback(()=>{N(!1),p(""),O({text:"",commit:null}),x(null),m(null),w(!1),R(!1)},[]),[J,X]=a.useState(s);J!==s&&(X(s),(f||b!==""||g!==null||C!==null||A)&&T());const E=ae({mutationFn:o=>e.save({path:s,baseCommit:o.baseCommit,text:o.text}),onSuccess:(o,c)=>{if(o.status==="saved"){O({text:c.text,commit:o.commit}),x(null),m(null),w(!0),i.invalidateQueries({queryKey:n}),i.invalidateQueries({queryKey:["file-explorer","tree",e.scopeKey]});return}if(w(!1),o.status==="conflict"){x(ne=>({commit:o.commit,lastCommit:o.lastCommit,again:ne!==null})),m(null);return}x(null),m(o.reason)},onError:()=>{w(!1),x(null),m("That didn’t save. Try again in a moment.")}}),B=je(e,l),W=()=>{l===void 0||l.body.kind!=="text"||(p(l.body.text),O({text:l.body.text,commit:l.commit??null}),x(null),m(null),w(!1),N(!0))},Z=()=>{N(!1),p(""),x(null),m(null),R(!1)},ee=async()=>{const o=await u.refetch();if(o.isError||o.data===void 0){m("Their version couldn’t be fetched just now, so nothing here changed.");return}const c=o.data;if(c.body.kind!=="text"){m(c.body.kind==="not-readable"?`${c.body.reason} What you typed is still here. Save it over their change, or close this and copy it out first.`:"Their version isn’t something that can be shown here, so nothing here changed.");return}p(c.body.text),O({text:c.body.text,commit:c.commit??null}),x(null),m(null)},te=()=>{g!==null&&E.mutate({text:b,baseCommit:g.commit})},se=()=>{if(v){R(!0);return}T(),d()};return a.useEffect(()=>{var o,c;f?(o=P.current)==null||o.focus():L.current&&((c=z.current)==null||c.focus()),L.current=f},[f]),t.jsx(re,{open:s!==null,onOpenChange:o=>!o&&se(),children:t.jsxs(le,{className:"max-h-[80vh] sm:max-w-2xl",children:[t.jsxs(ce,{children:[t.jsx(de,{className:"truncate font-mono text-sm",children:s===null?"":$(s)}),t.jsx(ue,{className:"truncate text-xs",children:Ce(l,s)})]}),!f&&(e.showToEveryone!==void 0||B)&&t.jsxs("div",{className:"flex justify-end gap-1 px-4",children:[e.showToEveryone!==void 0&&s!==null&&t.jsxs(y,{type:"button",variant:"ghost",size:"sm",disabled:h,className:"text-muted-foreground hover:text-foreground gap-1.5",onClick:()=>void G(s),children:[t.jsx(Ee,{className:"size-(--size-icon-xs)"}),h?"Putting it there…":"Put on the canvas"]}),B&&t.jsxs(y,{ref:z,type:"button",variant:"ghost",size:"sm",className:"text-muted-foreground hover:text-foreground gap-1.5",onClick:W,children:[t.jsx(me,{className:"size-(--size-icon-xs)"}),"Edit"]})]}),D!==null&&t.jsx("p",{role:"status",className:"text-destructive px-4 pb-1 text-xs",children:D}),g!==null&&t.jsx(Ne,{conflict:g,onTakeTheirs:()=>void ee(),onKeepMine:te,busy:E.isPending||u.isFetching}),C!==null&&t.jsx("p",{role:"alert",className:"bg-destructive/10 text-destructive mx-4 rounded-md px-3 py-2 text-sm",children:C}),t.jsx(he,{className:"min-h-0 flex-1 overflow-auto",children:u.isPending?t.jsx("div",{className:"flex h-32 items-center justify-center",children:t.jsx(fe,{size:"md",className:"text-muted-foreground",label:"Loading the file"})}):u.isError||l===void 0?t.jsx(_,{children:"This file couldn’t be read."}):f?t.jsx("textarea",{ref:P,"aria-label":`${s===null?"File":$(s)} contents`,value:b,onChange:o=>p(o.target.value),spellCheck:!1,autoComplete:"off",className:xe("text-foreground/90 border-border/60 bg-background field-sizing-content","focus-visible:border-ring focus-visible:ring-ring/50 min-h-64 w-full","resize-none rounded-md border px-3 py-2 font-mono text-xs","whitespace-pre-wrap focus-visible:ring-[3px] focus-visible:outline-none")}):t.jsx(Te,{file:l})}),f&&t.jsxs(ye,{className:"items-center gap-2 sm:justify-between",children:[t.jsx("span",{className:"text-muted-foreground text-xs","aria-live":"polite",children:E.isPending?"Saving…":I?"You haven’t saved your changes.":A&&!v?"Saved":v?"Not saved yet":""}),t.jsx("span",{className:"flex gap-2",children:I?t.jsxs(t.Fragment,{children:[t.jsx(y,{type:"button",variant:"ghost",size:"sm",onClick:()=>R(!1),children:"Keep editing"}),t.jsx(y,{type:"button",variant:"destructive",size:"sm",onClick:()=>{T(),d()},children:"Discard changes"})]}):t.jsxs(t.Fragment,{children:[t.jsx(y,{type:"button",variant:"ghost",size:"sm",onClick:Z,children:v?"Discard":"Done"}),t.jsx(y,{type:"button",size:"sm",disabled:!v||E.isPending||g!==null,onClick:()=>E.mutate({text:b,baseCommit:M.commit}),children:"Save"})]})})]})]})})}function Ne({conflict:e,onTakeTheirs:s,onKeepMine:d,busy:r}){const i=e.lastCommit,n=i===null?"Somebody":i.author;return t.jsxs("div",{role:"alert",className:"border-border/60 bg-muted/40 mx-4 space-y-2 rounded-md border px-3 py-2 text-sm",children:[t.jsx("p",{children:e.again?`${n} changed this file again while you were deciding, so it still isn’t saved.`:`${n} changed this file while you were editing it, so nothing was saved.`}),i!==null&&t.jsxs("p",{className:"text-muted-foreground text-xs",children:[i.subject," · ",q(i.at)]}),t.jsxs("div",{className:"flex flex-wrap gap-2",children:[t.jsx(y,{type:"button",variant:"outline",size:"sm",disabled:r,onClick:s,children:"Open their version"}),t.jsx(y,{type:"button",variant:"destructive",size:"sm",disabled:r,onClick:d,children:"Save mine over it"})]}),t.jsx("p",{className:"text-muted-foreground text-xs",children:"Opening theirs replaces what you typed here."})]})}function Ce(e,s){if(s===null)return"";const d=e===void 0?null:Re(e.lastCommit);return d===null?s:`${s} · ${d.label}`}function Te({file:e}){switch(e.body.kind){case"text":return V(e.path)?t.jsx(ge,{content:e.body.text,className:"text-sm",errorFallback:"This file couldn’t be displayed."}):t.jsx("pre",{className:"text-foreground/90 overflow-x-auto font-mono text-xs whitespace-pre",children:e.body.text});case"binary":return t.jsx(_,{children:"This isn’t text, so there’s nothing to show here."});case"too-large":return t.jsxs(_,{children:["This file is larger than ",_e(e.body.maxBytes),", so it isn’t shown here."]});case"not-readable":return t.jsx(_,{children:e.body.reason})}}function _({children:e}){return t.jsxs("div",{className:"text-muted-foreground flex h-32 flex-col items-center justify-center gap-2 px-6 text-center text-sm",children:[t.jsx(we,{className:"size-(--size-icon-md) opacity-60"}),t.jsx("span",{children:e})]})}const ke=new Map([["REQUEST_TOO_LARGE","That is too much text to send in one go, so nothing was saved. A room’s files are for documents people read. Anything this big belongs in the room’s attachments."],["FILE_TOO_LARGE","This file would be bigger than this room allows, so nothing was saved."],["REPO_CAP_EXCEEDED","This room’s files are already as large as they are allowed to get, so nothing was saved."],["MAIN_CHECKOUT_DIRTY","Somebody changed this room’s files outside DorkOS, so saving is paused until that is sorted out. The warning above the files says how."],["MERGE_IN_FLIGHT","Somebody else is writing to this room’s files right now. Nothing was saved. Try again in a moment."],["PEOPLE_ONLY","Only a person can save a room’s files this way. An agent brings its work in by merging."],["ROOM_FILE_NOT_TEXT","This file has something in it that is not text, so it cannot be saved from here."],["ROOM_FILE_PATH_INVALID","That file name could mean somewhere else, so nothing was saved."],["ROOM_FILE_NOT_FOUND","This file is not in the room’s files any more, so there was nothing to save over."],["ROOM_FILE_NOT_READABLE","This is not a file that can be edited here."],["ROOM_HAS_NO_REPO","This room does not have files of its own any more."],["ROOM_REPOS_DISABLED","Rooms cannot have files of their own on this install right now, so nothing was saved."],["ROOM_REPO_GIT_UNAVAILABLE","This computer doesn’t have git installed, and a room’s files are a git repository."],["ROOM_NOT_FOUND","This room is not there any more."],["ROOM_ARCHIVED","This room is archived, so its files cannot be changed."]]);function Se(e){return e===void 0?void 0:ke.get(e)}function De(e){if(typeof e!="object"||e===null)return null;const s=ve.safeParse(e.body);return s.success?s.data.conflict:null}const Fe=15e3;function Me(e,s,d){const r=JSON.stringify(H.entries(s));let i=0,n=null;const u=e.getQueryCache().subscribe(l=>{if(l.type!=="updated"||JSON.stringify(l.query.queryKey)!==r||n!==null)return;const h=Math.max(0,Fe-(Date.now()-i));n=setTimeout(()=>{n=null,i=Date.now(),d()},h)});return()=>{n!==null&&clearTimeout(n),u()}}function Ae(e){return{name:e.name,path:e.path,type:e.kind==="dir"?"dir":"file",size:e.size,isSymlink:e.kind==="symlink",lastCommit:e.lastCommit}}const Pe=new Map([["ROOM_FILE_NOT_READABLE","This isn’t a file that can be shown here."],["ROOM_FILE_NOT_FOUND","This file isn’t in the room’s files any more."]]);function Ie(e){const{transport:s,queryClient:d,roomId:r}=e;return{scopeKey:`room:${r}`,cwd:null,writable:!1,provenance:!0,filtersHidden:!1,preview:"inline",async showToEveryone(i){await s.openRoomCanvasDocument(r,{type:"file",sourcePath:i})},editable:!0,async list(i){try{return{entries:(await s.readRoomFiles(r,i===""?void 0:i)).entries.map(Ae)}}catch(n){if(k(n)!==pe)throw n;return{entries:[],absent:!0}}},async read(i){try{const n=await s.readRoomFileContent(r,i);return{path:n.path,size:n.size,lastCommit:n.lastCommit,commit:n.commit,body:n.body.kind==="text"?{kind:"text",text:n.body.text}:n.body.kind==="binary"?{kind:"binary"}:{kind:"too-large",maxBytes:n.body.maxBytes}}}catch(n){const u=Pe.get(k(n)??"");if(u===void 0)throw n;return{path:i,size:0,lastCommit:null,commit:null,body:{kind:"not-readable",reason:u}}}},async save(i){try{const n=await s.saveRoomFile(r,{path:i.path,baseCommit:i.baseCommit,text:i.text});return{status:"saved",commit:n.commit,lastCommit:n.lastCommit,committed:n.committed}}catch(n){const u=k(n);if(u===be){const h=De(n);return h!==null?{status:"conflict",commit:h.commit,lastCommit:h.lastCommit}:{status:"refused",reason:"Somebody changed this file while you were editing it, so nothing was saved. Close this and open it again to see their version."}}u==="MAIN_CHECKOUT_DIRTY"&&d.invalidateQueries({queryKey:H.repoStatus(r)});const l=Se(u);if(l===void 0)throw n;return{status:"refused",reason:l}}},events(i){return Me(d,r,i)}}}export{Le as F,Oe as N,Fe as R,Ie as c,Re as p,Me as w};
@@ -1 +0,0 @@
1
- import{w as u,x as n,y as s}from"./index-DDXrdlj0.js";const i=["agents"];function d(e){const a=u(),r=n();return s({...e!=null&&e.errorLabel?{meta:{errorLabel:e.errorLabel}}:{},mutationFn:t=>a.updateMeshAgent(t.id,t.updates),onSuccess:()=>{r.invalidateQueries({queryKey:["mesh","agents"]})},onSettled:()=>{r.invalidateQueries({queryKey:i})}})}export{d as u};