dorkos 0.83.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 (108) hide show
  1. package/README.md +7 -0
  2. package/dist/bin/cli.js +5338 -2653
  3. package/dist/client/assets/{AboutPage-BCPZr0Kt.js → AboutPage-BSUaz4JJ.js} +1 -1
  4. package/dist/client/assets/{AppearancePage-CJfCCSBv.js → AppearancePage-CXOeapnY.js} +1 -1
  5. package/dist/client/assets/{BaseTanStackRouterDevtoolsPanel-B-iktbLX-Rg6hvlIh.js → BaseTanStackRouterDevtoolsPanel-B-iktbLX-BnlmhnMf.js} +1 -1
  6. package/dist/client/assets/{BlintzCanvas-CUSuHP_Q.js → BlintzCanvas-CPvaejf6.js} +1 -1
  7. package/dist/client/assets/{CanvasCsvContent-B3gnlTxe.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-Dsell_F0.js → CodeMirrorDiff-B705Z174.js} +1 -1
  11. package/dist/client/assets/{CodeMirrorEditor-DW4-Dilh.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-Dto1Cfs1.js → ConventionPage-CPTqeeNZ.js} +2 -2
  15. package/dist/client/assets/{FloatingTanStackRouterDevtools-CqogiFob-B8JWq1xE.js → FloatingTanStackRouterDevtools-CqogiFob-C3cf2ADt.js} +1 -1
  16. package/dist/client/assets/HandlePage-CUJPQsdv.js +1 -0
  17. package/dist/client/assets/{LexicalField-BymSjNLW.js → LexicalField-ClgIzBq7.js} +1 -1
  18. package/dist/client/assets/{ManagesPage-D0ykMsYy.js → ManagesPage-CKzcFzKR.js} +1 -1
  19. package/dist/client/assets/{Model3dViewer-DpzkRmRI.js → Model3dViewer-CVVsdftR.js} +1 -1
  20. package/dist/client/assets/NamePage-CYHYXhrs.js +1 -0
  21. package/dist/client/assets/{NotificationsPage-C4Ol8NO6.js → NotificationsPage-D3m6Jrm2.js} +1 -1
  22. package/dist/client/assets/{PermissionsPage-BEtP78wl.js → PermissionsPage-CviWqCJ3.js} +1 -1
  23. package/dist/client/assets/{PersonalityPopover-xJuTkLLJ.js → PersonalityPopover-BN1CFq8D.js} +1 -1
  24. package/dist/client/assets/PhotoPage-ytqVZP3t.js +1 -0
  25. package/dist/client/assets/{RoomsPage-CeB_8k-m.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-3rXK5QTB.js → TopologyGraph-DeRqfLBW.js} +2 -2
  32. package/dist/client/assets/{agent-browser-DaDOSH9H.js → agent-browser-C7Q5muxI.js} +1 -1
  33. package/dist/client/assets/{highlighted-body-KPVGNVTW-CGXZGdzv.js → highlighted-body-KPVGNVTW-CYowLe07.js} +1 -1
  34. package/dist/client/assets/{index-C4yxotik.js → index-1dt_mWBC.js} +1 -1
  35. package/dist/client/assets/{index-DQdV5YDl.js → index-34_CucI4.js} +1 -1
  36. package/dist/client/assets/{index-CUXXDUxt.js → index-6F4HxV-x.js} +1 -1
  37. package/dist/client/assets/{index-MUbvQBCQ.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-rJuQe7Pl.js → index-BX9en7bH.js} +1 -1
  41. package/dist/client/assets/{index-Bco5PCIk.js → index-BeqTVkgE.js} +1 -1
  42. package/dist/client/assets/{index-D9vFzXJR.js → index-BkFaL4dr.js} +1 -1
  43. package/dist/client/assets/index-Bv_P5_tJ.js +1 -0
  44. package/dist/client/assets/{index-3xtUyFwf.js → index-BwbRY8dK.js} +1 -1
  45. package/dist/client/assets/{index-oU5xA1N3.js → index-BzVyUKXW.js} +3 -3
  46. package/dist/client/assets/{index-BiKxY3b6.js → index-C0oow5Fn.js} +1 -1
  47. package/dist/client/assets/{index-B2AJ6tkg.js → index-CCLVR1so.js} +1 -1
  48. package/dist/client/assets/{index-bR1UztQC.js → index-CEw2JwVz.js} +1 -1
  49. package/dist/client/assets/{index-DdpxcyXN.js → index-CKHPMgwE.js} +1 -1
  50. package/dist/client/assets/{index-dDcguWyg.js → index-CbxbAPgT.js} +1 -1
  51. package/dist/client/assets/{index-Cc8vG2jf.js → index-Cm0G2vDh.js} +1 -1
  52. package/dist/client/assets/{index-CUDguphz.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-DT376l6b.js → index-CvQeke9n.js} +9 -9
  56. package/dist/client/assets/{index-i6WvrE1p.js → index-CxZB8Cqj.js} +1 -1
  57. package/dist/client/assets/{index-DPpw-DKV.js → index-D45q57-5.js} +1 -1
  58. package/dist/client/assets/{index-zrZDQvuW.js → index-D8fmSjjO.js} +1 -1
  59. package/dist/client/assets/{index-D4OPDslu.js → index-DDagpuEn.js} +1 -1
  60. package/dist/client/assets/{index-CXeb3CZh.js → index-DT3ci-3h.js} +1 -1
  61. package/dist/client/assets/{index-Ck1VEXu0.js → index-D_Pj9S7y.js} +1 -1
  62. package/dist/client/assets/{index-pBoKYStL.js → index-Da-4WWcu.js} +1 -1
  63. package/dist/client/assets/{index-Ce4ArSsI.js → index-DsRm4kZF.js} +1 -1
  64. package/dist/client/assets/{index-Bg2WUou4.js → index-GiEn7nQQ.js} +1 -1
  65. package/dist/client/assets/{index-CemK6fUn.js → index-SGZRUhq4.js} +1 -1
  66. package/dist/client/assets/{index-Ygg0URfB.js → index-VLhj4QNP.js} +1 -1
  67. package/dist/client/assets/index-otf5JgVx.js +1 -0
  68. package/dist/client/assets/{index-FOgsYoCt.js → index-qWahGPGi.js} +1 -1
  69. package/dist/client/assets/{index-BabO0TEf.js → index-sMuUIc_W.js} +2 -2
  70. package/dist/client/assets/{index-z0vAkUHY.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-C1wnpxhH.js → soul-file-tc6-HkDy.js} +1 -1
  73. package/dist/client/assets/{use-personality-commit-OViAsTwD.js → use-personality-commit-vpAu5T8A.js} +1 -1
  74. package/dist/client/index.html +3 -3
  75. package/dist/drizzle/0111_community_redaction_cursor.sql +11 -0
  76. package/dist/drizzle/0112_account_drop_issuer.sql +18 -0
  77. package/dist/drizzle/0113_room_departed_seats.sql +14 -0
  78. package/dist/drizzle/0114_schedule_account.sql +1 -0
  79. package/dist/drizzle/0115_furry_starjammers.sql +1 -0
  80. package/dist/drizzle/meta/0111_snapshot.json +9062 -0
  81. package/dist/drizzle/meta/0112_snapshot.json +9055 -0
  82. package/dist/drizzle/meta/0113_snapshot.json +9147 -0
  83. package/dist/drizzle/meta/0114_snapshot.json +9154 -0
  84. package/dist/drizzle/meta/0115_snapshot.json +9146 -0
  85. package/dist/drizzle/meta/_journal.json +35 -0
  86. package/dist/server/index.js +34994 -22406
  87. package/dist/server/index.js.map +2 -2
  88. package/package.json +7 -8
  89. package/dist/client/assets/CanvasFileContent-C2PyVniO.js +0 -2
  90. package/dist/client/assets/CanvasModel3dContent-BU77_Cf0.js +0 -2
  91. package/dist/client/assets/ConnectionAccessLists-C6PZsSaI.js +0 -1
  92. package/dist/client/assets/ConnectionsPage-d1mpye9j.js +0 -1
  93. package/dist/client/assets/HandlePage-D9x_OTks.js +0 -1
  94. package/dist/client/assets/NamePage-zm23PjaF.js +0 -1
  95. package/dist/client/assets/PhotoPage-DlqgNQWM.js +0 -1
  96. package/dist/client/assets/RunsOnPopover-DT6aWGUP.js +0 -1
  97. package/dist/client/assets/SessionsPage-CoZhOOr9.js +0 -6
  98. package/dist/client/assets/SkillsPage-C8bahTTW.js +0 -1
  99. package/dist/client/assets/TasksPage-CuFN--Cj.js +0 -1
  100. package/dist/client/assets/ToolsPage-C5cJiedq.js +0 -2
  101. package/dist/client/assets/index-4zzP7Qsj.js +0 -1
  102. package/dist/client/assets/index-B9qRpVKa.js +0 -7
  103. package/dist/client/assets/index-BMR65QI4.js +0 -1658
  104. package/dist/client/assets/index-C9o2w5d_.js +0 -1
  105. package/dist/client/assets/index-DZ-SO2sz.css +0 -1
  106. package/dist/client/assets/index-Rf5Yz119.js +0 -1
  107. package/dist/client/assets/room-files-source-BXF5daqI.js +0 -11
  108. package/dist/client/assets/use-mesh-update-CZIA8V07.js +0 -1
@@ -1,4 +1,4 @@
1
1
  [diffend] Oversized file quarantined before diffing.
2
2
  name: package/dist/server/index.js.map
3
- size: 39676189 bytes
4
- sha256: 30688c7bd4e4fdf29255e075c5106b4ca2deb450fe14e6293a78a2287d49c635
3
+ size: 40973823 bytes
4
+ sha256: 92b5a85b6ea46cfb264e1b4c7a9b22339e4925ad63f0c8b201a2a896bd38a9ce
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dorkos",
3
- "version": "0.83.0",
3
+ "version": "0.87.0",
4
4
  "description": "You, multiplied. All your agents in one place: Claude Code, Codex, and OpenCode. See every session, approve what your agents do, and run them on a schedule. Self-hosted, MIT.",
5
5
  "license": "MIT",
6
6
  "author": "Dorian Collier",
@@ -25,7 +25,6 @@
25
25
  "cron",
26
26
  "scheduler",
27
27
  "telegram",
28
- "obsidian",
29
28
  "relay",
30
29
  "mesh",
31
30
  "rest-api",
@@ -75,21 +74,21 @@
75
74
  "zod": "^4.6.2"
76
75
  },
77
76
  "devDependencies": {
78
- "@better-auth/api-key": "1.7.2",
79
- "@better-auth/core": "1.7.2",
80
- "@better-fetch/fetch": "1.3.1",
77
+ "@better-auth/api-key": "1.7.5",
78
+ "@better-auth/core": "1.7.5",
79
+ "@better-fetch/fetch": "1.3.2",
81
80
  "@types/better-sqlite3": "^7.6.13",
82
81
  "@types/qrcode-terminal": "^0.12.2",
83
- "better-auth": "1.7.2",
82
+ "better-auth": "1.7.5",
84
83
  "tsx": "^4.23.13",
85
84
  "typescript": "^5.9.3",
86
85
  "vitest": "^4.1.11",
87
86
  "@dorkos/db": "0.0.0",
88
- "@dorkos/eslint-config": "0.0.0",
89
87
  "@dorkos/harness": "0.0.0",
90
- "@dorkos/marketplace": "0.0.0",
88
+ "@dorkos/eslint-config": "0.0.0",
91
89
  "@dorkos/server": "0.0.0",
92
90
  "@dorkos/shared": "0.0.0",
91
+ "@dorkos/marketplace": "0.0.0",
93
92
  "@dorkos/typescript-config": "0.0.0",
94
93
  "@dorkos/client": "0.0.0"
95
94
  },
@@ -1,2 +0,0 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/CodeMirrorEditor-DW4-Dilh.js","assets/index-BMR65QI4.js","assets/index-DZ-SO2sz.css","assets/index-CUXXDUxt.js","assets/index-oU5xA1N3.js","assets/BlintzCanvas-CUSuHP_Q.js","assets/BlintzCanvas-GgiCXV7C.css"])))=>i.map(i=>d[i]);
2
- import{z as F,af as b,ag as D,ah as B,r as n,j as t,A as M,ai as Q,aj as q,B as y,ak as H,al as K,am as V,an as E}from"./index-BMR65QI4.js";const $=n.lazy(()=>E(()=>import("./CodeMirrorEditor-DW4-Dilh.js"),__vite__mapDeps([0,1,2,3,4])).then(e=>({default:e.CodeMirrorEditor}))),U=n.lazy(()=>E(()=>import("./BlintzCanvas-CUSuHP_Q.js"),__vite__mapDeps([5,1,2,4,6])).then(e=>({default:e.BlintzCanvas}))),Y=500;function _(e,i){return["canvas-file",e,i]}function G(e,i){return i==="markdown"||/\.(md|markdown|mdx)$/i.test(e)}function I(e){switch(e==null?void 0:e.code){case"NOT_FOUND":return"This file doesn’t exist.";case"NOT_A_FILE":return"This path is a directory, not a file.";case"TOO_LARGE":return"This file is too large to open here.";case"BINARY_FILE":return"This file isn’t text and can’t be shown in the editor.";default:return"This file couldn’t be loaded."}}function J(e){switch(e){case"saving":return"Saving…";case"saved":return"Saved";case"error":return"Couldn’t save";default:return null}}function Z({content:e,documentId:i}){const m=F(),o=b(r=>r.selectedCwd),C=b(r=>r.setDocumentEditing),a=b(r=>{var d;return((d=r.openDocuments.find(j=>j.id===i))==null?void 0:d.editing)??!1}),h=D(),{data:c,error:x,isLoading:T}=B({queryKey:_(o,e.sourcePath),enabled:o!==null,queryFn:()=>m.readFileContent(o,e.sourcePath),staleTime:3e4,retry:!1}),[u,v]=n.useState(null),p=r=>{v(r&&c?{pinnedHash:c.hash}:null)};if(o===null)return t.jsx(R,{children:"Open a session to view files."});if(T)return t.jsx(R,{children:"Loading file…"});if(x||!c)return t.jsx(R,{children:I(x)});const l=u!==null&&a,s=(l?u==null?void 0:u.pinnedHash:null)??c.hash;return t.jsx(W,{content:e,documentId:i,cwd:o,loaded:c.content,theme:h,isEditing:l,onEditingChange:p,setDocumentEditing:C},`${e.sourcePath}:${s}`)}function W({content:e,documentId:i,cwd:m,loaded:o,theme:C,isEditing:a,onEditingChange:h,setDocumentEditing:c}){const x=e.readOnly!==!0,T=G(e.sourcePath,e.language),u=M(),[v,p]=n.useState(o),l=Q({sourcePath:e.sourcePath,cwd:m,loadedContent:o}),s=n.useRef(null),r=n.useRef(v),d=n.useRef(l.save),j=n.useRef(h);n.useEffect(()=>{r.current=v,d.current=l.save,j.current=h});const k=n.useCallback(f=>{p(f),s.current&&clearTimeout(s.current),s.current=setTimeout(()=>{s.current=null,d.current(r.current)},Y)},[]),P=()=>{p(o),h(!0),c(i,!0)},O=async()=>{s.current&&(clearTimeout(s.current),s.current=null);const f=await d.current(r.current);if(f==="conflict"||f==="error")return;const g=l.getConfirmedBase();g.hash!==null&&g.content===r.current&&u.setQueryData(_(m,e.sourcePath),N=>N&&{...N,content:g.content,hash:g.hash}),h(!1),c(i,!1)},L=()=>{u.invalidateQueries({queryKey:_(m,e.sourcePath)})};n.useEffect(()=>{a||!s.current||(clearTimeout(s.current),s.current=null)},[a]),n.useEffect(()=>()=>{s.current&&(clearTimeout(s.current),d.current(r.current)),c(i,!1),j.current(!1)},[i,c]);const S=()=>{const f=l.adoptDisk();f!=null&&p(f)},A=()=>{l.overwrite(r.current)},w=J(l.status),z=a?v:o;return t.jsxs("div",{className:"relative flex h-full flex-col",children:[t.jsxs("div",{className:"sticky top-0 z-10 flex h-0 items-start justify-end gap-2 pr-2",children:[x&&w&&t.jsx("span",{className:q("mt-3 text-xs",l.status==="error"?"text-destructive":"text-muted-foreground"),"aria-live":"polite",children:w}),!a&&t.jsx(y,{type:"button",variant:"ghost",size:"icon-md",className:"text-muted-foreground hover:text-foreground mt-2",onClick:L,"aria-label":"Refresh from disk",children:t.jsx(H,{className:"size-4"})}),x&&t.jsx(y,{type:"button",variant:"ghost",size:"icon-md",className:"text-muted-foreground hover:text-foreground mt-2",onClick:a?()=>void O():P,"aria-label":a?"Finish editing":"Edit file",children:a?t.jsx(K,{className:"size-4"}):t.jsx(V,{className:"size-4"})})]}),l.status==="conflict"&&t.jsxs("div",{className:"bg-destructive/10 text-destructive mx-2 mt-2 flex flex-wrap items-center gap-x-3 gap-y-1 rounded-md px-3 py-2 text-sm",children:[t.jsx("span",{className:"flex-1",children:"This file changed on disk since you opened it."}),t.jsx(y,{type:"button",variant:"ghost",size:"sm",className:"h-7",onClick:S,children:"Reload"}),t.jsx(y,{type:"button",variant:"destructive",size:"sm",className:"h-7",onClick:A,children:"Overwrite"})]}),t.jsx("div",{className:"min-h-0 flex-1",children:t.jsx(n.Suspense,{fallback:t.jsx("div",{className:"text-muted-foreground p-4 text-sm",children:"Loading editor…"}),children:T?t.jsx("div",{className:"px-2 pb-6",children:t.jsx(U,{value:z,editable:a,onChange:a?k:void 0})}):t.jsx($,{value:z,editable:a,filename:e.sourcePath,languageHint:e.language,theme:C,onChange:a?k:void 0})})})]})}function R({children:e}){return t.jsx("div",{className:"text-muted-foreground flex h-full items-center justify-center p-8 text-center",children:t.jsx("p",{children:e})})}export{Z as CanvasFileContent};
@@ -1,2 +0,0 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/Model3dViewer-DpzkRmRI.js","assets/index-BMR65QI4.js","assets/index-DZ-SO2sz.css"])))=>i.map(i=>d[i]);
2
- import{z as u,af as d,r as l,ao as i,j as t,an as f}from"./index-BMR65QI4.js";const c=l.lazy(()=>f(()=>import("./Model3dViewer-DpzkRmRI.js"),__vite__mapDeps([0,1,2])).then(r=>({default:r.Model3dViewer})));function m(r){var s;const e=(s=r.split(".").pop())==null?void 0:s.toLowerCase();return e==="glb"||e==="gltf"?"gltf":e==="stl"?"stl":e==="obj"?"obj":e==="3mf"?"3mf":e==="ply"?"ply":e==="fbx"?"fbx":e==="dae"?"dae":null}function x({content:r}){const e=u(),s=d(a=>a.selectedCwd),n=l.useMemo(()=>i(r.src,a=>e.mediaUrl(s??"",a)),[r.src,e,s]),o=l.useMemo(()=>m(r.src),[r.src]);return n.url===null||o===null?t.jsx("div",{className:"text-muted-foreground flex h-full items-center justify-center p-8 text-center",children:t.jsx("p",{children:"This 3D model can’t be displayed here."})}):t.jsx("div",{className:"bg-muted/40 h-full w-full",children:t.jsx(l.Suspense,{fallback:t.jsx("div",{className:"text-muted-foreground p-4 text-sm",children:"Loading 3D viewer…"}),children:t.jsx(c,{url:n.url,format:o,label:r.title??"Canvas 3D model"})})})}export{x as CanvasModel3dContent,m as formatOf};
@@ -1 +0,0 @@
1
- import{U as g,j as e,a as u,V as p,B as d,W as x,Y as j,Z as m,$ as f}from"./index-BMR65QI4.js";const N={inherited:"Inherited from agent",session_only:"Allowed only in this session",disabled:"Disabled in this session"},v={none:null,connection_paused:"The account is paused.",connection_revoked:"The account was disconnected.",authentication_required:"The account needs to be signed in again.",grant_revoked:"This access was removed.",session_detached:"This session is blocked from using the account.",reconciliation_required:"The account access needs review.",authority_sync_required:"Account access has not finished updating."};function h(i){return i.charAt(0).toUpperCase()+i.slice(1)}function b({agentId:i,onManage:c}){var a;const n=g(i);if(n.isPending)return e.jsx(u,{className:"h-24 w-full rounded-lg"});if(n.isError)return e.jsx(p,{title:"Couldn’t load account access",description:"No access details were changed. Try again.",onRetry:()=>void n.refetch(),isRetrying:n.isFetching});const r=((a=n.data)==null?void 0:a.connections)??[];return e.jsxs("section",{"aria-labelledby":"agent-account-access",className:"space-y-3",children:[e.jsxs("div",{className:"flex items-center justify-between gap-3",children:[e.jsxs("div",{children:[e.jsx("h3",{id:"agent-account-access",className:"text-sm font-semibold",children:"Account access"}),e.jsx("p",{className:"text-muted-foreground mt-0.5 text-xs",children:"Accounts this agent may use for approved actions."})]}),c&&e.jsxs(d,{variant:"ghost",size:"sm",onClick:c,children:["Manage",e.jsx(x,{className:"size-3.5","aria-hidden":!0})]})]}),r.length===0?e.jsxs("div",{className:"bg-muted/40 rounded-lg p-4 text-sm",children:[e.jsx("p",{className:"font-medium",children:"No account access"}),e.jsx("p",{className:"text-muted-foreground mt-1 text-xs",children:"Grant an account from Connections when this agent needs it."})]}):e.jsx("ul",{className:"space-y-1.5",children:r.map(s=>{const o=s.lifecycle==="connected"&&s.authenticationStatus==="active"&&s.reconciliationStatus==="ready"&&s.authoritySync.status==="ready";return e.jsxs("li",{"data-testid":`agent-connection-${s.connectionId}`,className:"bg-muted/40 flex min-h-11 items-center gap-3 rounded-lg px-3 py-2",children:[e.jsx(j,{className:"text-muted-foreground size-4 shrink-0","aria-hidden":!0}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsxs("p",{className:"truncate text-sm font-medium",children:[h(s.toolkit)," (",s.label,")"]}),e.jsxs("p",{className:"text-muted-foreground text-xs",children:[s.operationRevisionIds.length," approved"," ",s.operationRevisionIds.length===1?"action":"actions"]})]}),e.jsx(m,{size:"xs",variant:o?"secondary":"outline",children:o?"Available":"Unavailable"})]},s.connectionId)})})]})}function C({sessionId:i,onManage:c,emptyAction:n,footer:r}){var o;const a=f(i);if(a.isPending)return e.jsx(u,{className:"h-16 w-full rounded-lg"});if(a.isError)return e.jsxs("section",{"data-testid":"session-connectors",className:"space-y-2",children:[e.jsx("p",{role:"alert",className:"text-destructive px-1 text-xs",children:"Couldn’t load account access."}),e.jsx(d,{variant:"ghost",size:"sm",onClick:()=>void a.refetch(),children:"Try again"})]});const s=((o=a.data)==null?void 0:o.connections)??[];return e.jsxs("section",{"data-testid":"session-connectors","aria-labelledby":"session-account-access",className:"space-y-1",children:[e.jsxs("div",{className:"flex items-center justify-between gap-2 px-1 pb-1",children:[e.jsx("h3",{id:"session-account-access",className:"text-muted-foreground text-xs font-medium tracking-wide uppercase",children:"Connections"}),c&&e.jsxs(d,{variant:"ghost",size:"xs",onClick:c,children:["Manage agent access",e.jsx(x,{className:"size-3","aria-hidden":!0})]})]}),s.length===0?e.jsxs("div",{className:"bg-muted/40 space-y-2 rounded-md px-2.5 py-3",children:[e.jsxs("div",{children:[e.jsx("p",{className:"text-sm font-medium",children:"No account access"}),e.jsx("p",{className:"text-muted-foreground mt-1 text-xs",children:"Ask this agent to request the service and actions it needs."})]}),n]}):s.map(t=>{const l=v[t.dominatingReason];return e.jsxs("div",{"data-testid":`session-connection-${t.connectionId}`,className:"bg-muted/40 rounded-md px-2.5 py-2",children:[e.jsxs("div",{className:"flex flex-wrap items-center gap-1.5",children:[e.jsxs("span",{className:"text-sm font-medium",children:[h(t.toolkit)," (",t.label,")"]}),e.jsx(m,{size:"xs",variant:t.access==="disabled"?"outline":"secondary",children:N[t.access]})]}),e.jsx("p",{className:l?"text-destructive mt-1 text-xs":"text-muted-foreground mt-1 text-xs",children:l??`${t.operationRevisionIds.length} actions available in this session.`})]},t.connectionId)}),s.length>0&&r]})}export{b as A,C as S};
@@ -1 +0,0 @@
1
- import{z as G,D as H,r,ds as K,aE as V,j as e,dt as F,aj as I,du as E,dv as Y,Z as L,cp as J,cq as Q,cr as X,dw as ee,dx as se,B as M,dy as ae,dz as te,dA as R,aD as ne,dB as ie,dC as _,dD as re,dE as de,dF as ce,dG as oe,dH as le,dI as me,dJ as ue,dK as xe,dL as pe,dM as ge,dN as he,dO as fe,dP as je,P as ye,dQ as ve,dR as Ne,dS as Ce,dT as be,dU as Te,dV as Ie,dW as we,dX as Ae,dY as W,aY as N,dZ as Se,d_ as ke,d$ as De,e0 as Re,e1 as Pe,e2 as $,u as Ee,a as Me}from"./index-BMR65QI4.js";import{A as Be}from"./ConnectionAccessLists-C6PZsSaI.js";import"./agent-browser-DaDOSH9H.js";function ze(){const t=G();return H({mutationFn:i=>t.testBinding(i),meta:{errorLabel:"Test failed"}})}const Oe={connected:E.connected,disconnected:Y.warning,error:E.error,connecting:E.starting};function Fe(t){const i=[];return t.canInitiate&&i.push("Can start conversations"),t.canReply||i.push("Cannot reply"),t.canReceive||i.push("Cannot receive"),i.join(" · ")}function Le({binding:t,integrationName:i,integrationIconId:y,integrationAdapterType:l,adapterState:p,errorMessage:g,chatDisplayName:h,lastMessageAt:o,onTogglePause:f,onTest:n,onEdit:m,onRemove:u}){const[a,c]=r.useState(!1),[j,v]=r.useState(!1),x=t.enabled===!1,[w,A]=r.useState(0);r.useEffect(()=>{if(!o||x)return;const C=setInterval(()=>A(s=>s+1),6e4);return()=>clearInterval(C)},[o,x]);const B=h?`${i} · ${h}`:i,S=K({sessionStrategy:t.sessionStrategy,chatDisplayName:h,channelType:t.channelType}),k=t.canInitiate||!t.canReply||!t.canReceive,z=k?Fe(t):"",D=r.useMemo(()=>x?"Paused — no messages routing":o?`Last received ${V(o).toLowerCase()}`:"No recent activity",[x,o,w]),O=async()=>{v(!0);try{await n()}finally{v(!1)}};return e.jsxs("div",{className:I("relative rounded-xl border px-4 py-3 transition-colors",p==="error"&&!x&&"border-red-500/50 bg-red-500/[0.02]",x&&"opacity-60"),children:[e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsxs("div",{className:"relative shrink-0",children:[e.jsx(F,{iconId:y,adapterType:l,size:32}),e.jsx("span",{className:I("ring-background absolute -right-0.5 -bottom-0.5 size-2.5 rounded-full ring-2",x?"bg-muted-foreground/40":Oe[p])})]}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"truncate text-sm font-medium",children:B}),x&&e.jsx(L,{variant:"secondary",children:"Paused"})]}),x?e.jsx("p",{className:"text-muted-foreground mt-1 text-xs",children:D}):p==="error"&&g?e.jsx("p",{className:"text-xs text-red-600 dark:text-red-400",children:g}):e.jsxs(e.Fragment,{children:[S&&e.jsx("p",{className:"text-muted-foreground truncate text-xs italic",children:S}),e.jsx("p",{className:"text-muted-foreground mt-1 text-xs",children:D})]})]}),k&&e.jsxs(J,{children:[e.jsx(Q,{asChild:!0,children:e.jsx(L,{variant:"outline",children:"Restricted"})}),e.jsx(X,{children:z})]}),e.jsxs(ee,{children:[e.jsx(se,{asChild:!0,children:e.jsxs(M,{variant:"ghost",size:"icon-md",responsive:!1,className:"h-8 w-8 shrink-0",children:[e.jsx(ae,{className:"size-4"}),e.jsx("span",{className:"sr-only",children:"Actions"})]})}),e.jsxs(te,{align:"end",children:[e.jsxs(R,{onClick:O,disabled:j||x,children:[j?e.jsx(ne,{className:"mr-2"}):e.jsx(ie,{className:"mr-2 size-(--size-icon-sm)"}),"Send test"]}),e.jsx(_,{}),e.jsx(R,{onClick:()=>f(!t.enabled),children:x?e.jsxs(e.Fragment,{children:[e.jsx(re,{className:"mr-2 size-4"}),"Resume"]}):e.jsxs(e.Fragment,{children:[e.jsx(de,{className:"mr-2 size-4"}),"Pause"]})}),e.jsx(_,{}),e.jsx(R,{onClick:m,children:"Edit"}),e.jsx(R,{onClick:()=>c(!0),className:"text-destructive focus:text-destructive",children:"Remove"})]})]})]}),e.jsx(ce,{open:a,onOpenChange:c,children:e.jsxs(oe,{children:[e.jsxs(le,{children:[e.jsx(me,{children:"Remove connection"}),e.jsxs(ue,{children:["Remove the connection to ",i,"? The agent will no longer receive messages from it."]})]}),e.jsxs(xe,{children:[e.jsx(pe,{children:"Cancel"}),e.jsx(ge,{onClick:()=>{u(),c(!1)},className:"bg-red-600 hover:bg-red-700",children:"Remove"})]})]})})]})}function _e({binding:t,integrationName:i,integrationIconId:y,integrationAdapterType:l,adapterState:p,errorMessage:g,onTogglePause:h,onTest:o,onEdit:f,onRemove:n}){const{data:m=[]}=he(t.adapterId),u=t.chatId?m.find(j=>j.chatId===t.chatId):void 0,a=(u==null?void 0:u.displayName)??(t.chatId?`#${t.chatId.slice(-4)}`:void 0),c=r.useMemo(()=>{if(u)return u.lastMessageAt;if(m.length!==0)return m.reduce((j,v)=>v.lastMessageAt>j?v.lastMessageAt:j,m[0].lastMessageAt)},[u,m]);return e.jsx(Le,{binding:t,integrationName:i,integrationIconId:y,integrationAdapterType:l,adapterState:p,errorMessage:g,chatDisplayName:a,lastMessageAt:c,onTogglePause:h,onTest:o,onEdit:f,onRemove:n})}function q({catalog:t,boundAdapterIds:i,onSelectIntegration:y,onRequestSetup:l,disabled:p}){const[g,h]=r.useState(!1),o=r.useMemo(()=>t.flatMap(a=>a.instances.map(c=>({id:c.id,displayName:c.status.displayName??a.manifest.displayName,label:c.label,state:c.status.state,isDisabled:c.status.state==="error"||!c.enabled,alreadyBound:i.has(c.id),iconId:a.manifest.iconId,adapterType:a.manifest.type}))),[t,i]),f=r.useMemo(()=>t.filter(a=>!a.manifest.deprecated&&(a.instances.length===0||a.manifest.multiInstance)),[t]);function n(a){y(a),h(!1)}function m(a){h(!1),l(a)}const u=o.length===0&&f.length===0;return e.jsxs(fe,{open:g,onOpenChange:h,children:[e.jsx(je,{asChild:!0,children:e.jsxs(M,{variant:"outline",size:"sm",disabled:p,children:[e.jsx(ye,{className:"mr-1.5 size-3.5"}),"Add connection"]})}),e.jsx(ve,{className:"w-72 p-0",align:"start",children:e.jsx("div",{className:"max-h-64 overflow-y-auto",children:u?e.jsx("div",{className:"px-3 py-4 text-center",children:e.jsx("p",{className:"text-muted-foreground text-sm",children:"No connections available"})}):e.jsxs(e.Fragment,{children:[o.length>0&&e.jsx("div",{className:"py-1",children:o.map(a=>e.jsxs("button",{disabled:a.isDisabled||a.alreadyBound,onClick:()=>n(a.id),className:I("flex w-full items-center gap-3 px-3 py-2 text-left text-sm transition-colors","hover:bg-accent disabled:cursor-not-allowed disabled:opacity-50"),children:[e.jsxs("div",{className:"relative shrink-0",children:[e.jsx(F,{iconId:a.iconId,adapterType:a.adapterType,size:20,className:"text-muted-foreground"}),e.jsx("span",{className:I("ring-background absolute -right-0.5 -bottom-0.5 size-1.5 rounded-full ring-[1.5px]",E[a.state])})]}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("p",{className:"truncate font-medium",children:a.displayName}),a.label&&e.jsx("p",{className:"text-muted-foreground truncate text-xs",children:a.label})]}),e.jsx("span",{className:"text-muted-foreground/60 text-xs",children:a.alreadyBound?"Connected":Ne[a.state]})]},a.id))}),f.length>0&&e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"border-t"}),e.jsxs("div",{className:"py-1",children:[e.jsx("p",{className:"text-muted-foreground px-3 py-1 text-xs font-medium",children:"Available to set up"}),f.map(a=>e.jsxs("button",{onClick:()=>m(a.manifest),className:I("flex w-full items-center gap-3 px-3 py-2 text-left text-sm transition-colors","hover:bg-accent"),children:[e.jsx(F,{iconId:a.manifest.iconId,adapterType:a.manifest.type,size:14,className:"text-muted-foreground shrink-0"}),e.jsx("span",{className:"truncate font-medium",children:a.manifest.displayName})]},a.manifest.type))]})]})]})})})]})}const P={open:!1,binding:null,adapterName:""},U={open:!1};function $e({agent:t}){const i=Ce(),{data:y=[]}=be(),{data:l=[]}=Te(i),p=Ie(),g=we(),h=ze(),o=Ae(),f=W(),[n,m]=r.useState(P),[u,a]=r.useState(U),c=y.filter(s=>s.agentId===t.id),j=r.useMemo(()=>{const s=new Map;for(const d of l)for(const b of d.instances){const T=b.status.state,Z=T==="connected"||T==="error"?T:T==="starting"||T==="stopping"||T==="reconnecting"?"connecting":"disconnected";s.set(b.id,{state:Z,name:b.status.displayName??d.manifest.displayName,iconId:d.manifest.iconId,adapterType:d.manifest.type,errorMessage:b.status.lastError??void 0})}return s},[l]),v=r.useCallback(s=>j.get(s)??{state:"disconnected",name:s,adapterType:s},[j]),x=r.useMemo(()=>new Set(c.map(s=>s.adapterId)),[c]),w=r.useCallback(async s=>{try{await p.mutateAsync({adapterId:s,agentId:t.id,sessionStrategy:"per-chat",label:"",canInitiate:!1,canReply:!0,canReceive:!0}),N.success("Connection added")}catch{}},[t.id,p]),A=r.useCallback(s=>{a({open:!0,manifest:s})},[]),B=r.useCallback(s=>{m({open:!0,binding:s,adapterName:v(s.adapterId).name})},[v]),S=r.useCallback(async s=>{try{await g.mutateAsync(s),N.success("Connection removed")}catch{}},[g]),k=r.useCallback(async(s,d)=>{try{await o.mutateAsync({id:s,updates:{enabled:d}}),N.success(d?"Connection resumed":"Connection paused")}catch{}},[o]),z=r.useCallback(async s=>{const d=await h.mutateAsync(s);return d.ok?N.success(`Test OK: routed in ${d.latencyMs}ms`):N.error(`Test failed: ${d.reason??"unknown error"}`),d},[h]),D=r.useCallback(async s=>{if(n.binding)try{await o.mutateAsync({id:n.binding.id,updates:Se(s)}),N.success("Connection updated"),m(P)}catch{}},[n.binding,o]),O=r.useCallback(async s=>{try{await g.mutateAsync(s),N.success("Connection removed"),m(P)}catch{}},[g]),C=e.jsxs(e.Fragment,{children:[n.binding&&e.jsx(ke,{open:n.open,onOpenChange:s=>{s||m(P)},mode:"edit",initialValues:{adapterId:n.binding.adapterId,agentId:n.binding.agentId,sessionStrategy:n.binding.sessionStrategy,label:n.binding.label,permissionMode:n.binding.permissionMode,chatId:n.binding.chatId,channelType:n.binding.channelType,canInitiate:n.binding.canInitiate,canReply:n.binding.canReply,canReceive:n.binding.canReceive,notifyOnTaskComplete:n.binding.notifyOnTaskComplete},adapterName:n.adapterName,agentName:De(t),bindingId:n.binding.id,onConfirm:D,onDelete:O,isPending:o.isPending||g.isPending}),u.manifest&&e.jsx(Re,{open:u.open,onOpenChange:s=>{s||a(U)},manifest:u.manifest,existingAdapterIds:l.flatMap(s=>s.instances.map(d=>d.id))})]});return i?l.length===0?e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"flex flex-col items-center gap-3 rounded-xl border border-dashed px-6 py-10",children:[e.jsx($,{className:"text-muted-foreground/40 size-8"}),e.jsxs("div",{className:"space-y-1 text-center",children:[e.jsx("p",{className:"text-sm font-medium",children:"No connections available"}),e.jsx("p",{className:"text-muted-foreground max-w-xs text-xs leading-relaxed",children:"To connect this agent to Telegram, Slack, or a webhook, add a connection first. It will appear here as soon as it’s ready."})]}),e.jsx(M,{variant:"outline",size:"sm",onClick:()=>f("messaging"),children:"Add a connection"})]}),C]}):c.length===0?e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"flex flex-col items-center gap-3 rounded-xl border border-dashed px-6 py-10",children:[e.jsx($,{className:"text-muted-foreground/40 size-8"}),e.jsxs("div",{className:"space-y-1 text-center",children:[e.jsx("p",{className:"text-sm font-medium",children:"Let this agent reach the outside world"}),e.jsx("p",{className:"text-muted-foreground max-w-xs text-xs leading-relaxed",children:"Connect Telegram, Slack, or a webhook so this agent can send and receive messages while you are away."})]}),e.jsx(q,{catalog:l,boundAdapterIds:x,onSelectIntegration:w,onRequestSetup:A,disabled:p.isPending})]}),C]}):e.jsxs("div",{className:"space-y-4",children:[e.jsx("div",{className:"space-y-2",children:c.map(s=>{const d=v(s.adapterId);return e.jsx(_e,{binding:s,integrationName:d.name,integrationIconId:d.iconId,integrationAdapterType:d.adapterType,adapterState:d.state,errorMessage:d.errorMessage,onTogglePause:b=>k(s.id,b),onTest:()=>z(s.id),onEdit:()=>B(s),onRemove:()=>S(s.id)},s.id)})}),e.jsx(q,{catalog:l,boundAdapterIds:x,onSelectIntegration:w,onRequestSetup:A,disabled:p.isPending}),C]}):e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"flex flex-col items-center gap-3 rounded-xl border border-dashed px-6 py-10",children:[e.jsx(Pe,{className:"text-muted-foreground/40 size-8"}),e.jsxs("div",{className:"space-y-1 text-center",children:[e.jsx("p",{className:"text-sm font-medium",children:"Messaging is off"}),e.jsx("p",{className:"text-muted-foreground max-w-xs text-xs leading-relaxed",children:"Connections link this agent to messaging platforms. Turn on Messaging in Settings to get started."})]}),e.jsx(M,{variant:"outline",size:"sm",onClick:()=>f("messaging"),children:"Open Messaging settings"})]}),C]})}function Ze({member:t}){const{agent:i,isPending:y}=Ee(t),l=W();return y?e.jsx(Me,{className:"h-32 w-full"}):i?e.jsxs("div",{className:"space-y-6",children:[e.jsx(Be,{agentId:i.id,onManage:()=>l("accounts")}),e.jsxs("section",{"aria-labelledby":"agent-messaging-access",className:"space-y-3",children:[e.jsxs("div",{children:[e.jsx("h3",{id:"agent-messaging-access",className:"text-sm font-semibold",children:"Messaging"}),e.jsx("p",{className:"text-muted-foreground mt-0.5 text-xs",children:"Places where people can reach this agent."})]}),e.jsx($e,{agent:i})]})]}):e.jsx("p",{className:"text-muted-foreground text-sm",children:"Couldn’t read this agent’s connections."})}export{Ze as ConnectionsPage};
@@ -1 +0,0 @@
1
- import{j as r,i}from"./index-BMR65QI4.js";function o({member:e}){return r.jsx(i,{member:e})}export{o as HandlePage};
@@ -1 +0,0 @@
1
- import{j as r,h as o}from"./index-BMR65QI4.js";function a({member:e}){return r.jsx(o,{member:e})}export{a as NamePage};
@@ -1 +0,0 @@
1
- import{j as t,k as r}from"./index-BMR65QI4.js";function i({member:o}){return t.jsx(r,{member:o})}export{i as PhotoPage};
@@ -1 +0,0 @@
1
- import{r as C,j as e,aN as ce,co as de,N as ue,aj as j,cO as Z,cP as G,cQ as J,cR as K,cS as F,cT as fe,cU as ee,cV as pe,cW as te,cX as me,cY as xe,cZ as q,c_ as he,c$ as be,d0 as T,d1 as je,d2 as E,d3 as ve,d4 as se,aP as ge,u as Ne,a as Se,d5 as Ee,d6 as Ce,d7 as ke,d8 as ye,d9 as we,da as Ae}from"./index-BMR65QI4.js";import{u as Te}from"./use-mesh-update-CZIA8V07.js";const Le={duration:.12,ease:"easeOut"},Ie={type:"spring",stiffness:320,damping:28};function ae({isSetHere:n,serverDefault:l,onUseServerDefault:d,warning:r,className:a,"data-testid":c}){const[f,m]=C.useState(!1),o=n?"set here":`server default · ${l??"none"}`,s=n&&!!d,p=e.jsxs("span",{className:j("text-3xs inline-flex h-5 items-center gap-1 rounded-full px-2 leading-none whitespace-nowrap",r?Z.warning:Z.neutral,s&&"hover:bg-accent hover:text-accent-foreground transition-colors",a),"data-testid":c,children:[r&&e.jsx(ce,{className:"size-2.5 shrink-0","aria-hidden":!0}),e.jsx(de,{mode:"wait",initial:!1,children:e.jsx(ue.span,{initial:{opacity:0,y:2},animate:{opacity:1,y:0,transition:Ie},exit:{opacity:0},transition:Le,children:o},o)})]});return s?e.jsxs(G,{open:f,onOpenChange:m,children:[e.jsx(J,{asChild:!0,children:e.jsx("button",{type:"button","aria-label":`Set here${r?`: ${r}`:""}`,children:p})}),e.jsxs(K,{className:"w-64 p-2",align:"start",children:[e.jsx(F,{children:"Where this value comes from"}),r&&e.jsx("p",{className:j("px-2 pt-1 text-xs",fe.warning),children:r}),e.jsxs("button",{type:"button",onClick:()=>{d(),m(!1)},className:"hover:bg-accent mt-1 w-full rounded-md px-2 py-1.5 text-left text-sm transition-colors","data-testid":c?`${c}-reset`:void 0,children:["Use server default",l?e.jsxs("span",{className:"text-muted-foreground block text-xs",children:["currently ",l]}):e.jsx("span",{className:"text-muted-foreground block text-xs",children:"the runtime picks, nothing is set"})]})]})]}):r?e.jsx("span",{title:r,"aria-label":`${o}: ${r}`,children:p}):p}const ne="text-muted-foreground text-3xs font-medium tracking-wider uppercase";function w({label:n,valueLabel:l,options:d,selected:r,isSetHere:a,serverDefault:c,warning:f,onSelect:m,onInherit:o,testId:s,showHeader:p=!0,className:k,describedBy:h}){const S=ee(),[b,i]=C.useState(!1);return e.jsxs("div",{className:j("space-y-1",k),children:[p&&e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx("span",{className:ne,children:n}),!S&&e.jsx(ae,{isSetHere:a,serverDefault:c,warning:f,onUseServerDefault:o,"data-testid":`${s}-chip`})]}),e.jsxs(G,{open:b,onOpenChange:i,children:[e.jsx(J,{asChild:!0,children:e.jsxs("button",{type:"button",className:"border-input hover:bg-accent flex h-8 w-full items-center gap-1 rounded-md border px-2 text-sm transition-colors",...h?{"aria-describedby":h}:{},"data-testid":s,children:[e.jsx("span",{className:j("truncate",f?"text-amber-700 dark:text-amber-400":a?"md:text-foreground text-amber-700 dark:text-amber-400":"md:text-foreground text-emerald-700 dark:text-emerald-400"),children:l}),e.jsx(ge,{className:"text-muted-foreground ml-auto size-3.5 shrink-0"})]})}),e.jsxs(K,{className:"w-64 p-1",align:"start",children:[e.jsx(F,{children:n}),e.jsx("div",{className:"max-h-72 overflow-y-auto",children:d.map(u=>e.jsxs("button",{type:"button","data-testid":`${s}-option-${u.value}`,onClick:()=>{m(u.value),i(!1)},className:j("hover:bg-accent w-full rounded-md px-2 py-1.5 text-left text-sm transition-colors",u.value===r&&"bg-accent"),children:[u.label,u.hint&&e.jsx("span",{className:"text-muted-foreground block text-xs",children:u.hint})]},u.value))}),e.jsx("button",{type:"button",onClick:()=>{o(),i(!1)},className:"hover:bg-accent border-border text-muted-foreground mt-1 w-full border-t px-2 py-2 text-left text-xs transition-colors","data-testid":`${s}-inherit`,children:c?`Using server default: ${c}. Tap to restore`:"Use server default: the runtime picks"})]})]})]})}function Pe({agent:n,onUpdate:l,className:d}){var V,z,W,B,X,Q;const r=ee(),{data:a}=pe(),{data:c,isPending:f}=te(),m=((V=a==null?void 0:a.executionDefaults)==null?void 0:V.runtime)??"claude-code",o=n.runtime??m,s=(z=a==null?void 0:a.executionDefaults)==null?void 0:z.perRuntime.find(t=>t.runtime===o),{data:p}=me({runtime:o}),k=n.model!=null,h=n.effort!=null,S=(s==null?void 0:s.model)??null,b=n.model??S,i=b?(p??[]).find(t=>t.value===b):void 0,u=(s==null?void 0:s.supportsEffort)??((W=xe(c,o))==null?void 0:W.supportsEffort),L=u===void 0&&f,I=u!==!1,P=i?i.supportsEffort??!1:void 0,v=(B=a==null?void 0:a.claudeCode)==null?void 0:B.accounts,x=v==null?void 0:v.flatMap(t=>t.id===null?[]:[{id:t.id,label:q(t.path,v),path:t.path}]),g=n.account??null,$=g!==null,O=a!=null&&a.claudeCode?q(a.claudeCode.resolvedAccount,v??[]):null,U=Te({errorLabel:"Couldn’t change this agent’s account"}),H=C.useCallback(t=>{U.mutate({id:n.id,updates:{account:t}})},[n.id,U]),le=he({agent:{runtime:n.runtime,model:n.model,effort:n.effort,account:n.account},defaultRuntime:m,serverDefaultModel:S,knownModels:be(p),knownAccounts:x,accountsUnavailable:(X=a==null?void 0:a.claudeCode)==null?void 0:X.accountsUnavailable,modelSupportsEffort:P,runtimeSupportsEffort:u,runtimeLabel:t=>T(t).label}),N=t=>{var Y;return((Y=le.breakages.find(ie=>t.includes(ie.kind)))==null?void 0:Y.message)??null},y=!L&&I&&P!==!1,_=n.effort??(s==null?void 0:s.effort)??null,D=T(o).label,oe=o==="claude-code"&&x!==void 0&&(x.length>1||$),re=N(["account-unregistered"]),M=(p??[]).some(t=>t.unverified),R=C.useId();return e.jsxs("div",{className:j("grid grid-cols-2 gap-3",d),children:[e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(w,{label:"Model",valueLabel:(i==null?void 0:i.displayName)??b??"Automatic",options:[...(p??[]).map(t=>({value:t.value,label:t.displayName,hint:t.description}))],selected:b,isSetHere:k,serverDefault:(s==null?void 0:s.model)??null,warning:N(["model-unavailable"]),onSelect:t=>l({model:t}),onInherit:()=>l({model:null}),testId:"agent-model-row",describedBy:M?R:void 0}),M&&e.jsx(je,{id:R})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx("span",{className:ne,children:"Effort"}),(!r||!y)&&(h||y)&&e.jsx(ae,{isSetHere:h,serverDefault:s!=null&&s.effort?E(s.effort):null,warning:N(["effort-unsupported-runtime","effort-unsupported-model"]),onUseServerDefault:()=>l({effort:null}),"data-testid":"agent-effort-row-chip"})]}),L?e.jsx(A,{testId:"agent-effort-pending",text:`Checking what ${D} supports`,warning:null}):I?y?e.jsx(w,{label:"Effort",valueLabel:E(_),options:ve.filter(t=>!(i!=null&&i.supportedEffortLevels)||i.supportedEffortLevels.includes(t)).map(t=>({value:t,label:E(t)})),selected:_,isSetHere:h,serverDefault:s!=null&&s.effort?E(s.effort):null,warning:null,showHeader:!1,onSelect:t=>l({effort:t}),onInherit:()=>l({effort:null}),testId:"agent-effort-row"}):e.jsx(A,{testId:"agent-effort-unsupported-model",text:"This model doesn’t take an effort setting",warning:N(["effort-unsupported-model"])}):e.jsx(A,{testId:"agent-effort-unsupported-runtime",text:`Not supported by ${D}`,warning:N(["effort-unsupported-runtime"])})]}),oe&&e.jsx(w,{label:"Account",valueLabel:g!==null?((Q=x==null?void 0:x.find(t=>t.id===g))==null?void 0:Q.label)??g:O??"Default account",options:(x??[]).map(t=>({value:t.id,label:t.label,hint:se(t.path)})),selected:g,isSetHere:$,serverDefault:O,warning:re,onSelect:t=>H(t),onInherit:()=>H(null),testId:"agent-account-row",className:"col-span-full"})]})}function A({text:n,warning:l,testId:d}){return e.jsxs("div",{className:"flex h-8 flex-col justify-center","data-testid":d,children:[e.jsx("p",{className:"text-muted-foreground text-xs",children:n}),l&&e.jsx("p",{className:"text-xs text-amber-700 dark:text-amber-400",children:l})]})}const $e="text-muted-foreground text-3xs font-medium tracking-wider uppercase";function He({member:n}){const{agent:l,projectPath:d,isPending:r,update:a}=Ne(n),{data:c}=te();if(r)return e.jsx(Se,{className:"h-24 w-full"});if(!l)return e.jsx("p",{className:"text-muted-foreground p-1 text-sm",children:"Couldn’t read this agent’s settings."});const f=c?Object.keys(c.capabilities):[l.runtime],m=f.includes(l.runtime)?f:[l.runtime,...f];return e.jsxs("div",{className:"space-y-3 p-1","data-slot":"profile-runs-on",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsx("div",{className:$e,children:"Runtime"}),e.jsxs(Ee,{value:l.runtime??"claude-code",onValueChange:o=>a({runtime:o}),children:[e.jsx(Ce,{className:"h-8 text-sm",responsive:!1,children:e.jsx(ke,{})}),e.jsx(ye,{children:m.map(o=>e.jsx(we,{value:o,responsive:!1,children:T(o).label},o))})]})]}),e.jsx(Pe,{agent:l,onUpdate:a,className:"grid-cols-1"}),d&&e.jsxs("div",{className:"text-muted-foreground flex min-w-0 items-center gap-1.5",children:[e.jsx(Ae,{"aria-hidden":!0,className:"size-3.5 shrink-0"}),e.jsx("span",{className:"min-w-0 truncate font-mono text-xs",children:se(d)})]})]})}export{He as RunsOnPopover};
@@ -1,6 +0,0 @@
1
- import{e3 as ie,eu as re,ev as oe,z as D,r as d,ew as le,ex as ce,ey as ue,ez as de,bg as P,eA as me,m as xe,eB as pe,eC as fe,j as e,eD as ge,eE as he,eF as je,eG as E,am as F,eH as ve,eI as T,co as be,N as S,eJ as ye,eK as Ne,bE as N,d0 as O,eL as Ce,aj as w,eM as V,eN as Se,cp as R,cq as A,cr as M,eO as $,aE as K,eP as _,eQ as we,eR as B,aP as ke,eS as G,eT as W,eU as L,eV as Re,eW as Ae,eX as Me,b4 as Pe,ax as Le,eY as Te,ay as ze,az as Ee,aA as Ie,aB as De,eZ as Fe,e as Oe,A as Ve,e_ as $e,e$ as Ke,a as _e,f0 as Be,I as Ge,f1 as We,f2 as qe,aY as Qe}from"./index-BMR65QI4.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 q={name:"git-fork",size:24,node:[["circle",{cx:"12",cy:"18",r:"3",key:"1mpf1b"}],["circle",{cx:"6",cy:"6",r:"3",key:"1lh9wr"}],["circle",{cx:"18",cy:"6",r:"3",key:"1h7g24"}],["path",{d:"M18 9v2c0 .6-.4 1-1 1H7c-.6 0-1-.4-1-1V9",key:"1uq4wg"}],["path",{d:"M12 12v3",key:"158kv8"}]]};q.node;const Q=ie(q);function He(){const t=re(),s=oe(r=>r.contextReadings),a=D(),n=d.useMemo(()=>Array.from(new Set(t.map(r=>r.runtime))),[t]),i=d.useCallback(r=>{const c={};return n.forEach((u,m)=>{var x;const f=(x=r[m])==null?void 0:x.data;if(!f)return;const j={};for(const h of f)h.contextWindow!=null&&(j[h.value]=h.contextWindow);c[u]=j}),c},[n]),l=le({queries:n.map(r=>ce(a,{runtime:r})),combine:i});return d.useMemo(()=>{var c;const r={total:0,known:0,unknown:0,warning:0,critical:0,autoCompacted:0};for(const u of t){r.total+=1;const m=u.model?(c=l[u.runtime])==null?void 0:c[u.model]:void 0,f=ue(u,{reading:s[u.id]??null,window:m});f.autoCompactedAt&&(r.autoCompacted+=1),f.status==="known"?(r.known+=1,f.severity==="warning"?r.warning+=1:f.severity==="critical"&&(r.critical+=1)):r.unknown+=1}return r},[t,s,l])}function Ue(t,s,a){return t&&s!==void 0&&!a}function H(t,s,a,n="borderLeftColor"){const i=de()??!1,l=Ue(t,a,i);return d.useMemo(()=>!l||!a?{animate:void 0,transition:void 0,pulsing:!1}:{animate:{[n]:[s,a,s]},transition:{[n]:{duration:2,repeat:1/0,ease:"easeInOut"}},pulsing:!0},[l,s,a,n])}function U({value:t,onCommit:s,onEnd:a}){const[n,i]=d.useState(!1),[l,r]=d.useState(""),c=d.useRef(null),u=d.useRef(!1),m=P(t),f=P(s),j=P(a);d.useEffect(()=>{if(!n)return;u.current=!1;const o=requestAnimationFrame(()=>{var p,k;(p=c.current)==null||p.focus(),(k=c.current)==null||k.select()});return()=>cancelAnimationFrame(o)},[n]);const x=d.useCallback(()=>{var o;i(!1),(o=j.read())==null||o()},[j]),h=d.useCallback(()=>{r(m.read()),i(!0)},[m]),v=d.useCallback(()=>{if(u.current)return;u.current=!0,x();const o=l.trim();o.length===0||o===m.read()||f.read()(o)},[x,l,m,f]),b=d.useCallback(()=>{u.current=!0,x()},[x]),y=d.useCallback(o=>{o.key==="Enter"?(o.preventDefault(),v()):o.key==="Escape"&&(o.preventDefault(),b())},[v,b]);return{isRenaming:n,renameValue:l,setRenameValue:r,inputRef:c,start:h,commit:v,cancel:b,handleKeyDown:y}}function Y(t){const s=me(t.id,{enabled:!1,fallback:t.permissionMode})??t.permissionMode,a=xe(t.runtime),n=a==null?void 0:a.permissionModes.values.find(l=>l.id===s),i=n?pe(n):fe(s);return{permissionMode:s,isFullPower:i}}function X({children:t,onRename:s,onFork:a}){return!s&&!a?e.jsx(e.Fragment,{children:t}):e.jsxs(ge,{children:[e.jsx(he,{asChild:!0,children:t}),e.jsxs(je,{className:"w-44",children:[s&&e.jsxs(E,{onClick:s,children:[e.jsx(F,{className:"mr-2 size-4"}),"Rename"]}),s&&a&&e.jsx(ve,{}),a&&e.jsxs(E,{onClick:a,children:[e.jsx(Q,{className:"mr-2 size-4"}),"Fork session"]})]})]})}const C="font-mono select-all";function I(t){try{return new Date(t).toLocaleString([],{month:"short",day:"numeric",year:"numeric",hour:"2-digit",minute:"2-digit"})}catch{return t}}function Ye({session:t,expanded:s,onFork:a,className:n}){var m;const{permissionMode:i,isFullPower:l}=Y(t),r=l?"Full power":Se(i),{nameFor:c}=T(),u=t.account?c(t.account):null;return e.jsx(be,{initial:!1,children:s&&e.jsx(S.div,{variants:Ne,initial:"initial",animate:"animate",exit:"exit",transition:ye,className:"relative z-10 overflow-hidden","data-slot":"session-details-panel",children:e.jsxs("div",{className:w("text-muted-foreground text-2xs mx-2 space-y-1.5 px-3 pt-2 pb-2",n),children:[e.jsx(N,{label:"Session ID",align:"start",copyValue:t.id,valueClassName:C,children:t.id}),e.jsx(N,{label:"Created",align:"start",valueClassName:C,children:I(t.createdAt)}),e.jsx(N,{label:"Updated",align:"start",valueClassName:C,children:I(t.updatedAt)}),e.jsx(N,{label:"Runtime",align:"start",valueClassName:C,children:O(t.runtime).label}),u&&e.jsx(N,{label:"Account",align:"start",copyValue:t.account,valueClassName:C,children:u}),e.jsx(N,{label:"Origin",align:"start",valueClassName:C,children:t.originLabel??((m=Ce(t.origin))==null?void 0:m.label)??"You"}),e.jsx(N,{label:"Permissions",align:"start",valueClassName:w(C,l&&V.power),children:r}),a&&e.jsxs("button",{type:"button",onClick:f=>{f.stopPropagation(),a(t.id)},className:"hover:bg-secondary/80 text-muted-foreground/60 hover:text-muted-foreground mt-1 inline-flex items-center gap-1 rounded px-1.5 py-0.5 transition-colors duration-100","aria-label":"Fork session",children:[e.jsx(Q,{className:"size-(--size-icon-xs)"}),e.jsx("span",{children:"Fork"})]})]})})})}function Z({account:t,className:s}){const{isMultiAccount:a,nameFor:n}=T();if(!t||!a)return null;const i=n(t);return e.jsxs(R,{children:[e.jsx(A,{asChild:!0,children:e.jsx("span",{"aria-label":`Account: ${i}`,className:w("text-3xs max-w-24 shrink-0 truncate",s),children:i})}),e.jsx(M,{side:"top",sideOffset:4,children:t})]})}function Xe({session:t,isActive:s,onClick:a,onFork:n,onRename:i,isNew:l=!1}){const[r,c]=d.useState(!1),{isRenaming:u,renameValue:m,setRenameValue:f,inputRef:j,start:x,commit:h,handleKeyDown:v}=U({value:t.title,onCommit:g=>i==null?void 0:i(t.id,g)}),{isFullPower:b}=Y(t),y=$(6e4),o=d.useMemo(()=>K(t.updatedAt),[t.updatedAt,y]),p=_(t.id),k=d.useCallback(g=>{g.stopPropagation(),c(ne=>!ne)},[]),ee=d.useCallback(g=>{g.stopPropagation(),x()},[x]),{animate:te,transition:se,initial:ae,pulsing:z}=Je({isNew:l,borderState:p});return e.jsx(R,{children:e.jsxs(S.div,{"data-testid":"session-row",initial:ae,animate:te,transition:se,"data-pulsing":z?"true":"false",style:z?void 0:{borderLeftColor:p.color},className:w("group relative rounded-lg border-l-2 transition-colors duration-150",s?"text-foreground":"hover:bg-secondary/60"),children:[s&&e.jsx(S.div,{layoutId:"active-session-bg",className:"bg-secondary absolute inset-0 rounded-lg",transition:{type:"spring",stiffness:280,damping:32}}),e.jsx(X,{onRename:i?x:void 0,onFork:n?()=>n(t.id):void 0,children:e.jsx(A,{asChild:!0,disabled:p.kind==="idle",children:e.jsxs(S.div,{role:"button",tabIndex:0,"aria-current":s?"page":void 0,"aria-label":`Session: ${L(t.title)}. ${p.label}.`,onClick:a,onKeyDown:g=>{u||(g.key==="Enter"||g.key===" ")&&(g.preventDefault(),a())},whileTap:{scale:.98},transition:{type:"spring",stiffness:400,damping:30},className:"relative z-10 cursor-pointer px-3 py-2",children:[e.jsxs("div",{className:"text-muted-foreground flex items-center gap-1 text-xs",children:[e.jsx("span",{className:"min-w-0 flex-1",children:o}),e.jsxs("span",{className:"flex flex-shrink-0 items-center gap-1",children:[e.jsx(we,{session:t}),p.kind==="pendingApproval"&&e.jsx(B,{className:"size-(--size-icon-xs) text-amber-500","aria-label":"Awaiting your approval"}),b&&e.jsx(Ze,{}),i&&!u&&e.jsx("button",{type:"button",onClick:ee,className:"text-muted-foreground/60 hover:text-muted-foreground rounded p-0.5 opacity-0 transition-opacity duration-150 group-hover:opacity-100 focus-visible:opacity-100 max-md:p-1.5 max-md:opacity-100","aria-label":"Rename session",children:e.jsx(F,{className:"size-(--size-icon-xs)"})}),e.jsx("button",{type:"button",onClick:k,className:w("rounded p-0.5 transition-opacity duration-150 max-md:p-1.5",r?"text-muted-foreground opacity-100":"text-muted-foreground/60 hover:text-muted-foreground opacity-0 group-hover:opacity-100 focus-visible:opacity-100 max-md:opacity-100"),"aria-label":"Session details","aria-expanded":r,children:e.jsx(S.div,{animate:{rotate:r?180:0},transition:{type:"spring",stiffness:400,damping:30},children:e.jsx(ke,{className:"size-(--size-icon-sm)"})})})]})]}),u?e.jsx("input",{ref:j,autoFocus:!0,value:m,onChange:g=>f(g.target.value),onBlur:h,onKeyDown:v,onClick:g=>g.stopPropagation(),className:"bg-background text-foreground mt-0.5 w-full rounded border px-1 text-xs outline-none","aria-label":"Session title"}):e.jsxs("div",{className:"mt-0.5 flex items-center gap-1.5",children:[e.jsx(G,{origin:t.origin,label:t.originLabel,className:"text-muted-foreground/50"}),e.jsx(W,{type:t.runtime,model:t.model,className:"text-muted-foreground/50"}),e.jsx(Z,{account:t.account,className:"text-muted-foreground/60"}),e.jsx("div",{className:"text-muted-foreground/70 min-w-0 flex-1 truncate text-xs",title:i?"Click the pencil icon to rename":void 0,children:L(t.title)})]})]})})}),e.jsx(M,{side:"right",sideOffset:8,children:p.label}),e.jsx(Ye,{session:t,expanded:r,className:"border-border/30 border-t",...n?{onFork:n}:{}})]})})}function Ze(){return e.jsxs(R,{children:[e.jsx(A,{asChild:!0,children:e.jsx("button",{type:"button",className:"inline-flex cursor-help","aria-label":Re,onClick:t=>t.stopPropagation(),children:e.jsx(Ae,{className:`size-(--size-icon-xs) ${V.power}`})})}),e.jsx(M,{side:"top",sideOffset:4,children:"This chat runs commands without stopping for approval."})]})}function Je({isNew:t,borderState:s}){const{animate:a,transition:n,pulsing:i}=H(s.pulse,s.color,s.dimColor);return d.useMemo(()=>{if(!(t||i))return{initial:void 0,animate:void 0,transition:void 0,pulsing:i};const r={...t?{opacity:1,y:0}:{},...a},c={...t?{opacity:{duration:.2,ease:[0,0,.2,1]},y:{duration:.2,ease:[0,0,.2,1]}}:{},...n};return{initial:t?{opacity:0,y:-8}:void 0,animate:r,transition:c,pulsing:i}},[t,i,a,n])}function et({session:t,isActive:s,onClick:a,onFork:n,onRename:i}){const{isRenaming:l,renameValue:r,setRenameValue:c,inputRef:u,start:m,commit:f,handleKeyDown:j}=U({value:t.title,onCommit:p=>i==null?void 0:i(t.id,p)}),x=_(t.id),h=$(6e4),v=d.useMemo(()=>K(t.updatedAt),[t.updatedAt,h]),{animate:b,transition:y,pulsing:o}=H(x.pulse,x.color,x.dimColor,"backgroundColor");return e.jsxs(R,{children:[e.jsx(X,{onRename:i?m:void 0,onFork:n?()=>n(t.id):void 0,children:e.jsx(A,{asChild:!0,children:e.jsxs("button",{type:"button","data-testid":"session-row",onClick:a,className:w("flex w-full items-center gap-2 rounded-md px-2.5 py-1.5 text-left text-xs",Me,s?"bg-secondary text-foreground":"text-muted-foreground hover:bg-accent hover:text-foreground"),children:[e.jsx(S.span,{"aria-hidden":!0,"data-pulsing":o?"true":"false",animate:b,transition:y,style:o?void 0:{backgroundColor:x.color},className:"size-1.5 shrink-0 rounded-full"}),l?e.jsx("input",{ref:u,autoFocus:!0,value:r,onChange:p=>c(p.target.value),onBlur:f,onKeyDown:j,onClick:p=>p.stopPropagation(),className:"bg-background text-foreground min-w-0 flex-1 rounded border px-1 text-xs outline-none","aria-label":"Session title"}):e.jsx("span",{className:"min-w-0 flex-1 truncate",children:L(t.title)}),e.jsxs("span",{className:"flex shrink-0 items-center gap-1",children:[x.kind==="pendingApproval"&&e.jsx(B,{className:"size-(--size-icon-xs) text-amber-500","aria-label":"Awaiting approval"}),e.jsx(G,{origin:t.origin,label:t.originLabel,className:"text-muted-foreground/50"}),e.jsx(W,{type:t.runtime,model:t.model,className:"text-muted-foreground/50"}),e.jsx(Z,{account:t.account,className:"text-muted-foreground/60"}),e.jsx("span",{className:"text-muted-foreground/60 text-3xs",children:v})]})]})})}),x.kind!=="idle"&&e.jsx(M,{side:"right",sideOffset:8,children:x.label})]})}function tt({variant:t,session:s,isActive:a,onClick:n,onFork:i,onRename:l,isNew:r}){return t==="compact"?e.jsx(et,{session:s,isActive:a,onClick:n,onFork:i,onRename:l}):e.jsx(Xe,{session:s,isActive:a,onClick:n,onFork:i,onRename:l,isNew:r})}function st(){const{known:t,warning:s,critical:a,autoCompacted:n}=He(),i=s+a;if(t===0&&i===0&&n===0)return null;const l=i>0||n>0,r=l?a>0?"bg-red-500":i>0?"bg-amber-500":"bg-muted-foreground/40":"bg-emerald-500",c=l?[i>0?`${i} near full`:null,n>0?`${n} auto-compacted`:null].filter(Boolean).join(" · "):"All sessions have room.";return e.jsxs("div",{className:"text-muted-foreground flex items-center gap-2 border-b px-3 py-1.5 text-xs","data-testid":"fleet-context-bar",children:[e.jsx("span",{className:`size-2 shrink-0 rounded-full ${r}`,"aria-hidden":"true"}),e.jsx("span",{className:"truncate",children:c})]})}function J(t){return t.account?`${t.runtime}-${t.account}`:t.runtime}function at({warning:t}){const{nameFor:s}=T(),a=O(t.runtime).label,n=t.account?`${a} sessions from ${s(t.account)}`:`${a} sessions`;return e.jsxs("p",{className:"text-muted-foreground/60 flex items-start gap-1.5 text-xs",title:t.message,"data-testid":`session-list-warning-${J(t)}`,children:[e.jsx(Pe,{className:"mt-px size-3 shrink-0","aria-hidden":!0}),e.jsxs("span",{children:["Couldn’t load ",n]})]})}function nt({activeSessionId:t,groupedSessions:s,warnings:a=[],onSessionClick:n,onForkSession:i,onRenameSession:l}){const r=d.useId();return e.jsxs(Le,{type:"scroll",className:"h-full",viewportClassName:"[&>div]:!block",children:[a.length>0&&e.jsx("div",{className:"space-y-1 px-4 pt-2","data-testid":"session-list-warnings",children:a.map(c=>e.jsx(at,{warning:c},J(c)))}),e.jsx(st,{}),e.jsx(S.div,{layout:!0,children:e.jsx(Te,{id:r,children:s.length>0?e.jsx(e.Fragment,{children:s.map(c=>{const u=s.length===1&&c.label==="Today";return e.jsxs(ze,{children:[!u&&e.jsx(Ee,{className:"text-2xs text-muted-foreground/70 font-medium tracking-wider uppercase",children:c.label}),e.jsx(Ie,{children:c.sessions.map(m=>e.jsx(De,{children:e.jsx(tt,{variant:"full",session:m,isActive:m.id===t,onClick:()=>n(m.id),onFork:i,onRename:l})},m.id))})]},c.label)})}):e.jsx("div",{className:"flex h-32 items-center justify-center",children:e.jsx("p",{className:"text-muted-foreground/60 text-sm",children:"No conversations yet"})})})})]})}function it(t,s){return s===""?!0:(t.title??"").toLowerCase().includes(s)}function ot({member:t}){var y;const s=((y=t.agent)==null?void 0:y.projectPath)??null,{sessions:a,isLoading:n,isError:i,activeSessionId:l}=Fe(s),r=Oe(),c=D(),u=Ve(),m=$e(s),[f,j]=d.useState(""),x=f.trim().toLowerCase(),h=d.useMemo(()=>Ke(a.filter(o=>it(o,x))),[a,x]);function v(o){!r||s===null||(We.getState().recordOpened("agent",s),r({to:"/session",search:{dir:s,session:o}}))}async function b(o){try{const p=await c.forkSession(o,void 0,s??void 0);await u.invalidateQueries({queryKey:qe.listRoot}),v(p.id)}catch(p){Qe.error("Couldn’t branch off this conversation.",{description:p instanceof Error?p.message:"The original is untouched."})}}return n?e.jsx(_e,{className:"h-16 w-full"}):i?e.jsxs("p",{className:"text-muted-foreground text-sm",children:["Couldn’t read ",t.displayName,"’s conversations."]}):a.length===0?e.jsxs("p",{className:"text-muted-foreground text-sm",children:["No conversations yet. ",t.displayName," starts one the first time you message it."]}):e.jsxs("div",{className:"flex min-h-0 flex-1 flex-col gap-2",children:[e.jsxs("div",{className:"relative shrink-0",children:[e.jsx(Be,{"aria-hidden":!0,className:"text-muted-foreground pointer-events-none absolute top-1/2 left-2 size-3.5 -translate-y-1/2"}),e.jsx(Ge,{value:f,onChange:o=>j(o.target.value),placeholder:"Search conversations","aria-label":"Search conversations",className:"h-8 pl-7 text-sm"})]}),h.length===0?e.jsxs("p",{className:"text-muted-foreground text-sm",children:["No conversation matches “",f.trim(),"”."]}):e.jsx("div",{className:"min-h-0 flex-1 overflow-auto",children:e.jsx(nt,{activeSessionId:l,groupedSessions:h,onSessionClick:v,onForkSession:o=>void b(o),onRenameSession:(o,p)=>m.mutate({sessionId:o,title:p})})})]})}export{ot as SessionsPage};
@@ -1 +0,0 @@
1
- import{z as b,ah as B,el as p,em as g,A as w,D as A,aY as z,en as M,j as e,eo as O,r as d,aP as H,aj as N,B as j,aN as I,cO as y,ep as C,dF as q,dG as K,dH as W,dI as Q,dJ as U,dK as G,dL as Y,dM as J,e as E,eq as R,er as Z,aR as V,a as $,es as X,et as L,Z as P}from"./index-BMR65QI4.js";function D(s){const t=b();return B({queryKey:p.status(s),queryFn:()=>t.getHarnessStatus(s),staleTime:3e4,refetchOnMount:"always"})}const ee={native:"reads it",projected:"shared",drifted:"out of date",dropped:"can’t see it",warned:"may not work",conflict:"blocked","pending-approval":"needs your OK"},se={native:"neutral",projected:"neutral",drifted:"info",dropped:"muted",warned:"warning",conflict:"warning","pending-approval":"warning"},k="\0",te=new Set(["native","projected"]);function _(s){return`${s.scope??"project"}${k}${s.artifact}${k}${s.source??""}${k}${s.name}`}function ne(s,t){return`${g[s]} ${ee[t]}`}function ae(s){return s.reason??s.target}function F(s,t){return t.flatMap(n=>{const a=s.cells[n];return a===void 0?[]:[{harness:n,cell:a}]})}function re(s,t){if(t.length===0)return!1;const n=F(s,t);return n.length===t.length&&n.every(({cell:a})=>{var r;return te.has(a.state)&&!((r=a.warnings)!=null&&r.length)})}function S(s){return`${s} ${s===1?"file":"files"}`}function le(s){return s===1?"One package is waiting for your approval.":`${s} packages are waiting for your approval.`}function ie(s){return`Shared with all ${s}`}function oe(s){return s===1?"1 agent file":`${s} agent files`}function ce(s){return`Every agent file ${s} cannot see — skills, rules, commands and more.`}function de(s){return s===1?"1 entry":`${s} entries`}function ue(s,t){return t.flatMap(n=>{const a=s.flatMap(r=>{const l=r.cells[n];return l===void 0||l.state!=="dropped"?[]:[{key:_(r),artifact:r.artifact,name:r.name,...l.reason===void 0?{}:{reason:l.reason}}]});return a.length===0?[]:[{harness:n,label:g[n],entries:a}]})}const xe={drop:"Not shared",warning:"Could not read",write:"Will be written",notice:"Notice"};function fe(s){return`${xe[s.kind]} · ${s.artifact} ${s.name}`}function me(s){const t=b(),n=w();return A({mutationFn:()=>t.syncHarness(s),meta:{errorLabel:"Couldn’t share your agent files"},onSuccess:a=>{n.setQueryData(p.status(s),a.status),z.success("Agent files updated.")}})}function he(s){const t=w();M("approval_resolved",()=>{t.invalidateQueries({queryKey:p.status(s)})})}function pe({result:s,onDismiss:t}){const{applied:n,removals:a,askedAbout:r}=s;return e.jsx(O,{variant:"neutral",onDismiss:t,dismissLabel:"Dismiss what changed","data-slot":"harness-sync-summary",children:e.jsxs("div",{className:"flex flex-col gap-1",children:[e.jsxs("p",{children:[e.jsx("span",{className:"font-medium",children:"Agent files updated."}),n>0&&e.jsxs(e.Fragment,{children:[" ",S(n)," written."]})]}),a.length>0&&e.jsxs("div",{className:"flex flex-col gap-0.5",children:[e.jsxs("p",{className:"font-medium",children:["Removed ",S(a.length)," DorkOS put here:"]}),e.jsx("ul",{className:"flex flex-col gap-0.5",children:a.map(({path:l,reason:c})=>e.jsxs("li",{className:"text-3xs flex flex-col",children:[e.jsx("code",{className:"font-mono",children:l}),e.jsx("span",{className:"opacity-80",children:c})]},l))})]}),r.length>0&&e.jsx("p",{children:le(r.length)})]})})}function ge(s){const{counts:t,sweepPreview:n}=s;return t.drifted>0||n.length>0?{message:"Some agent files are out of date.",variant:n.length>0?"warning":"info",actionable:!0}:t.conflicts>0?{message:"DorkOS can’t update some files. Something else is in the way.",variant:"warning",actionable:!1}:t.adoptable>0?{message:"Some skills live where only a few of your agents look.",variant:"info",actionable:!1}:null}function je({projectPath:s}){return he(s),null}function ve({projectPath:s}){const{data:t}=D(s),n=me(s),[a,r]=d.useState(!1),[l,c]=d.useState(!1);if(t===void 0||t.state!=="ready")return null;const u=e.jsx(je,{projectPath:s});if(n.data!==void 0&&!l)return e.jsxs(e.Fragment,{children:[u,e.jsx(pe,{result:n.data,onDismiss:()=>c(!0)})]});const o=ge(t);if(o===null)return u;const{removals:x,sweepPreview:m}=t,i=m.length;return e.jsxs(e.Fragment,{children:[u,e.jsx(O,{variant:o.variant,"data-slot":"harness-drift-banner",detailsOpen:a,details:i===0?void 0:e.jsx("ul",{className:"flex flex-col gap-0.5",children:x.map(({path:f,reason:v})=>e.jsxs("li",{className:"text-3xs flex flex-col",children:[e.jsx("code",{className:"font-mono",children:f}),e.jsx("span",{className:"opacity-80",children:v})]},f))}),actions:o.actionable?e.jsx(j,{size:"sm",variant:"outline",className:"h-6 text-xs",disabled:n.isPending,onClick:()=>{c(!1),n.mutate()},children:n.isPending?"Syncing…":"Sync now"}):void 0,children:e.jsxs("div",{className:"flex flex-col gap-0.5",children:[e.jsx("p",{children:o.message}),i>0&&e.jsxs("button",{type:"button","aria-expanded":a,onClick:()=>r(f=>!f),className:"text-3xs flex w-fit items-center gap-1 underline underline-offset-2 opacity-90 hover:opacity-100",children:["Syncing also removes ",S(i)," DorkOS put here",e.jsx(H,{"aria-hidden":!0,className:N("size-3 transition-transform",a&&"rotate-180")})]})]})})]})}function Ne(s){const t=b(),n=w();return A({mutationFn:a=>t.adoptHarness(s,a),meta:{errorLabel:"Couldn’t move that skill"},onSuccess:a=>{n.setQueryData(p.status(s),a.status),n.setQueriesData({queryKey:p.all,predicate:r=>{var l;return((l=r.state.data)==null?void 0:l.projectPath)===a.status.projectPath}},a.status)}})}const ye={neutral:y.neutral,info:y.info,warning:y.warning,muted:"border border-dashed border-border text-muted-foreground"};function ke({harness:s,cell:t}){var l;const n=ne(s,t.state),a=ae(t),r=(l=t.warnings)!=null&&l.length?t.warnings.join(" · "):void 0;return e.jsxs("li",{"aria-label":n,...a===void 0?{}:{title:a},className:N("text-3xs inline-flex items-center gap-1 rounded-full px-2 py-0.5 leading-tight",ye[se[t.state]]),children:[n,r!==void 0&&e.jsx("span",{role:"img","aria-label":"May not work",title:r,className:"inline-flex",children:e.jsx(I,{"aria-hidden":!0,className:"text-status-warning-fg size-2.5"})})]})}function Se(s){const t=s===void 0?-1:s.lastIndexOf("/"),n=t>0?s==null?void 0:s.slice(0,t):void 0;return n===void 0?"Lives where only some of your agents look. Move it to .agents/skills so every agent can read it.":`Lives in ${n}. Move it to .agents/skills so every agent can read it.`}function be(s,t){return`dorkos harness adopt ${s} --project ${t}`}const we="Share with every agent";function Ce(s,t,n){const a=`It moves from ${t} to .agents/skills/${s}`;return n?`${a}, and DorkOS leaves a link behind so Claude Code still finds it.`:`${a}, where every agent reads it.`}const De="for all your projects";function $e({row:s,enabled:t,projectPath:n,showEveryHarness:a}){var v;const[r,l]=d.useState(!1),[c,u]=d.useState(!1),o=Ne(n),x=F(s,t),m=re(s,t)&&!a,i=m&&!r,f=(v=o.data)==null?void 0:v.refusals[0];return e.jsxs("div",{role:"group","aria-label":s.name,className:"flex flex-col gap-1 py-1.5",children:[e.jsxs("div",{className:"flex min-w-0 items-baseline gap-2",children:[e.jsx("span",{className:"min-w-0 shrink truncate text-xs font-medium",children:s.name}),s.scope==="global"&&e.jsx("span",{className:"text-muted-foreground text-3xs shrink-0",children:De}),s.source!==void 0&&e.jsx("span",{dir:"rtl",title:s.source,className:"text-muted-foreground text-3xs ml-auto min-w-0 truncate text-left font-mono",children:e.jsx("bdi",{dir:"ltr",children:s.source})})]}),e.jsxs("ul",{"aria-label":"Agent tools",className:"flex flex-wrap items-center gap-1",children:[m&&e.jsx("li",{children:e.jsxs("button",{type:"button","aria-expanded":!i,title:x.map(({harness:h})=>g[h]).join(" · "),onClick:()=>l(h=>!h),className:"bg-muted text-muted-foreground hover:bg-accent hover:text-accent-foreground text-3xs focus-visible:ring-ring inline-flex items-center gap-1 rounded-full px-2 py-0.5 leading-tight transition-colors focus-visible:ring-2 focus-visible:outline-none",children:[ie(x.length),e.jsx(H,{"aria-hidden":!0,className:N("size-2.5 transition-transform",i&&"-rotate-90")})]})}),!i&&x.map(({harness:h,cell:T})=>e.jsx(ke,{harness:h,cell:T},h))]}),s.adoptable&&e.jsxs(e.Fragment,{children:[e.jsx("p",{role:"status","aria-live":"polite",className:"text-muted-foreground text-3xs",children:(f==null?void 0:f.reason)||Se(s.source)}),e.jsxs("p",{className:"text-muted-foreground text-3xs",children:["Run: ",e.jsx(C,{children:be(s.name,n)})]}),e.jsx("div",{children:e.jsx(j,{size:"sm",variant:"outline",className:"h-6 text-xs",disabled:o.isPending,onClick:()=>u(!0),children:we})}),e.jsx(q,{open:c,onOpenChange:u,children:e.jsxs(K,{children:[e.jsxs(W,{children:[e.jsxs(Q,{children:["Move ",s.name," so every agent can read it?"]}),e.jsx(U,{children:Ce(s.name,s.source??"",t.includes("claude-code"))})]}),e.jsxs(G,{children:[e.jsx(Y,{children:"Cancel"}),e.jsx(J,{onClick:()=>o.mutate(s.name),children:"Move it"})]})]})})]})]})}const Ae="https://dorkos.ai/docs/guides/cli-usage#agent-files";function Oe(){return e.jsxs(e.Fragment,{children:[e.jsx("span",{role:"status",className:"sr-only",children:"Loading skills…"}),e.jsx("div",{"aria-hidden":!0,className:"flex flex-col gap-3 py-1",children:[0,1,2].map(s=>e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx($,{className:"h-3 w-32"}),e.jsx($,{className:"h-3 w-48"})]},s))})]})}function He({projectPath:s,showBrowseLink:t=!0}){const{data:n,isPending:a,error:r,refetch:l}=D(s),[c,u]=d.useState(!1),o=d.useId(),x=E();if(a)return e.jsx(Oe,{});if(r)return e.jsxs("div",{className:"flex items-center gap-2 py-2",children:[e.jsx("p",{className:"text-destructive text-xs",children:"Couldn’t load skills."}),e.jsx(j,{variant:"ghost",size:"sm",className:"h-6 text-xs",onClick:()=>void l(),children:"Retry"})]});if(n.state!=="ready")return e.jsx(Ee,{status:n});const m=n.rows.filter(i=>i.artifact==="skill");return m.length===0?e.jsxs("div",{className:"flex flex-col items-start gap-1 py-2",children:[e.jsx("p",{className:"text-muted-foreground text-xs",children:"No skills here yet."}),t&&x&&e.jsxs(j,{variant:"ghost",size:"sm",className:"text-muted-foreground hover:text-foreground h-6 px-1 text-xs",onClick:()=>void x({to:"/marketplace",search:{type:"skill-pack"}}),children:[e.jsx(R,{"aria-hidden":!0,className:"mr-1.5 size-3.5"}),"Browse skill-packs"]})]}):e.jsxs("div",{className:"flex flex-col gap-1",children:[e.jsxs("div",{className:"flex items-center justify-between gap-2 pb-1",children:[e.jsx(Z,{htmlFor:o,className:"text-muted-foreground text-3xs",children:"Show every agent tool"}),e.jsx(V,{id:o,size:"sm",checked:c,onCheckedChange:u})]}),e.jsx("div",{className:"divide-border divide-y",children:m.map(i=>e.jsx($e,{row:i,enabled:n.enabled,projectPath:n.projectPath,showEveryHarness:c},_(i)))})]})}function Ee({status:s}){return s.state==="not-set-up"?e.jsxs("div",{className:"flex flex-col gap-1 py-2",children:[e.jsx("p",{className:"text-muted-foreground text-xs",children:"DorkOS isn’t sharing agent files for this folder yet."}),e.jsxs("p",{className:"text-muted-foreground text-3xs",children:["Run ",e.jsx(C,{children:"dorkos harness sync --fix"})," in this folder to set it up."]}),e.jsx(X,{href:Ae,className:"text-3xs text-muted-foreground hover:text-foreground underline underline-offset-2",children:"How agent file sharing works"})]}):s.state==="unreadable"?e.jsxs("div",{className:"flex flex-col gap-1 py-2",children:[e.jsx("p",{className:"text-muted-foreground text-xs",children:"DorkOS can’t read this folder’s agent file settings."}),s.detail!==void 0&&e.jsx("p",{className:"text-muted-foreground text-3xs",children:s.detail})]}):e.jsx("p",{className:"text-muted-foreground py-2 text-xs",children:"Agent file sharing runs in the DorkOS app."})}function Re({group:s}){const[t,n]=d.useState(!1);return e.jsxs(L,{open:t,onOpenChange:n,trigger:e.jsxs("span",{className:"text-xs",children:["Not shared with ",s.label]}),badge:e.jsx(P,{variant:"secondary",size:"xs",className:"whitespace-nowrap",children:oe(s.entries.length)}),children:[e.jsx("p",{className:"text-muted-foreground text-3xs px-4 pt-3",children:ce(s.label)}),e.jsx("ul",{className:"space-y-2 px-4 pt-2 pb-3",children:s.entries.map(a=>e.jsxs("li",{className:"flex flex-col gap-0.5",children:[e.jsxs("span",{className:"text-3xs font-medium",children:[a.artifact," ",a.name]}),a.reason!==void 0&&e.jsx("span",{className:"text-muted-foreground text-3xs",children:a.reason})]},a.key))})]})}function Le({rows:s,enabled:t}){const n=ue(s,t);return n.length===0?null:e.jsx("div",{className:"flex flex-col gap-1.5",children:n.map(a=>e.jsx(Re,{group:a},a.harness))})}function Pe({entries:s}){const[t,n]=d.useState(!1);return s.length===0?null:e.jsx(L,{open:t,onOpenChange:n,trigger:e.jsx("span",{className:"text-xs",children:"Project-level notices"}),badge:e.jsx(P,{variant:"secondary",size:"xs",className:"whitespace-nowrap",children:de(s.length)}),children:e.jsx("ul",{className:"space-y-2 px-4 pb-3",children:s.map(a=>e.jsxs("li",{className:"flex flex-col gap-0.5",children:[e.jsx("span",{className:N("text-3xs font-medium",a.kind==="notice"&&"text-muted-foreground font-normal"),children:fe(a)}),e.jsx("span",{className:"text-muted-foreground text-3xs",children:a.reason})]},`${a.kind} ${a.artifact} ${a.source??""} ${a.name}`))})})}function _e({command:s}){return e.jsx(C,{className:"break-normal",children:s.split(" ").map((t,n)=>e.jsxs(d.Fragment,{children:[n>0&&" ",e.jsx("span",{className:"whitespace-nowrap",children:t})]},`${n}-${t}`))})}function Fe({notEnabled:s}){return s.length===0?null:e.jsx("div",{className:"flex flex-col gap-1.5 py-1",children:s.map(({harness:t,why:n,signal:a})=>e.jsxs("div",{title:a,className:"flex flex-col gap-0.5",children:[e.jsx("p",{className:"text-xs font-medium",children:n==="dorkos-runtime"?`DorkOS runs ${g[t]} here, but this folder isn’t sharing to it.`:`${g[t]} files are in this folder, but DorkOS isn’t sharing to it.`}),e.jsxs("p",{className:"text-muted-foreground text-3xs",children:["Run ",e.jsx(_e,{command:`dorkos harness sync --fix --enable ${t}`})," in this folder to turn it on."]})]},t))})}function Te({projectPath:s}){const t=E(),{data:n}=D(s),a=(n==null?void 0:n.state)==="ready"?n:null;return e.jsxs("div",{className:"flex flex-col gap-2","data-slot":"profile-skills",children:[e.jsx(ve,{projectPath:s}),a&&e.jsx(Fe,{notEnabled:a.notEnabled}),e.jsx(He,{projectPath:s,showBrowseLink:!1}),a&&e.jsx(Le,{rows:a.rows,enabled:a.enabled}),a&&e.jsx(Pe,{entries:a.projectLevel}),t&&e.jsxs(j,{variant:"ghost",size:"sm",className:"text-muted-foreground hover:text-foreground w-full",onClick:()=>void t({to:"/marketplace",search:{type:"skill-pack"}}),children:[e.jsx(R,{"aria-hidden":!0,className:"mr-1.5 size-3.5"}),"Browse skill-packs"]})]})}function ze({member:s}){var n;const t=((n=s.agent)==null?void 0:n.projectPath)??null;return t===null?e.jsx("p",{className:"text-muted-foreground text-sm",children:"This agent’s folder isn’t known here."}):e.jsx(Te,{projectPath:t})}export{ze as SkillsPage};
@@ -1 +0,0 @@
1
- import{aq as F,af as y,ar as U,as as D,at as L,au as P,av as B,r as u,j as e,aw as G,ax as O,ay as p,az as j,aA as g,aB as k,aC as N,aD as w,aE as R,aF as $,aG as X,aH as _,aI as q,aJ as H,aK as J,aL as K}from"./index-BMR65QI4.js";const V=5;function W({status:t}){switch(t){case"running":return e.jsx(w,{size:"xs",className:"text-status-info shrink-0"});case"completed":return e.jsx(J,{className:"size-3 shrink-0 text-green-500","aria-hidden":!0});case"failed":return e.jsx(H,{className:"text-destructive size-3 shrink-0","aria-hidden":!0});case"cancelled":return e.jsx(q,{className:"text-muted-foreground size-3 shrink-0","aria-hidden":!0});case"skipped":return e.jsx(_,{className:"text-muted-foreground size-3 shrink-0","aria-hidden":!0});case"blocked":return e.jsx(X,{className:"text-status-warning-dot size-3 shrink-0","aria-hidden":!0});default:return null}}function Q(t){if(t===null)return"";if(t<1e3)return"< 1s";const n=Math.floor(t/1e3);if(n<60)return`${n}s`;const a=Math.floor(n/60),c=n%60;return`${a}m ${c}s`}function Y({run:t,scheduleName:n}){return e.jsx(k,{children:e.jsxs(N,{className:"text-sm",children:[e.jsx(w,{size:"xs",className:"text-status-info shrink-0"}),e.jsx("span",{className:"truncate",children:n}),t.startedAt&&e.jsx("span",{className:"text-muted-foreground/50 ml-auto shrink-0 text-xs",children:R(t.startedAt)})]})})}function Z({schedule:t,onEdit:n}){return e.jsx(k,{children:e.jsxs(N,{onClick:()=>n(t.id),className:"text-sm",children:[e.jsx($,{className:"text-muted-foreground/50 size-3 shrink-0","aria-hidden":!0}),e.jsx("span",{className:"truncate",children:t.name}),t.nextRun&&e.jsx("span",{className:"text-muted-foreground/50 ml-auto shrink-0 text-xs",children:R(t.nextRun)})]})})}function ee({run:t,scheduleName:n}){const a=t.status==="running"&&t.finishedAt?t.error?"failed":"completed":t.status;return e.jsx(k,{children:e.jsxs(N,{className:"text-sm",children:[e.jsx(W,{status:a}),e.jsx("span",{className:"truncate",children:n}),e.jsxs("span",{className:"text-muted-foreground/50 ml-auto flex shrink-0 items-center gap-1.5 text-xs",children:[t.durationMs!==null&&e.jsx("span",{children:Q(t.durationMs)}),t.finishedAt&&e.jsx("span",{children:R(t.finishedAt)})]})]})})}function se({toolStatus:t,agentId:n}){const a=F(),c=y(s=>s.setTasksAgentFilter),l=y(s=>s.setTasksEditScheduleId),o=t!=="disabled-by-server",{data:h=[]}=U(o),{data:I=0}=D(o),{data:S=[]}=L(void 0,o),{data:v=[]}=P(),{openWithTemplate:z}=B(),T=[v[0],v[2]].filter(Boolean),d=u.useMemo(()=>n?h.filter(s=>s.agentId===n):h,[n,h]),x=u.useMemo(()=>{const s=new Map;for(const r of d)s.set(r.id,r.name);return s},[d]),A=u.useMemo(()=>S.filter(s=>x.has(s.scheduleId)),[S,x]),{runningRuns:b,recentRuns:C}=u.useMemo(()=>{const s=[],r=[];for(const i of A)i.finishedAt!=null||i.status!=="running"?r.push(i):s.push(i);return r.sort((i,f)=>(f.finishedAt??f.createdAt).localeCompare(i.finishedAt??i.createdAt)),{runningRuns:s,recentRuns:r.slice(0,V)}},[A]),M=u.useMemo(()=>d.filter(s=>s.enabled&&s.status==="active"&&s.nextRun).sort((s,r)=>(s.nextRun??"").localeCompare(r.nextRun??"")),[d]),m=()=>{n&&(c(n),l(null)),a.open()},E=s=>{l(s),c(null),a.open()};return t==="disabled-by-agent"?e.jsxs("div",{className:"flex flex-col items-center justify-center gap-3 px-4 py-8",children:[e.jsx("p",{className:"text-muted-foreground/60 text-sm",children:"Scheduled tasks are off for this agent"}),e.jsx("button",{onClick:m,className:"text-muted-foreground hover:text-foreground text-xs transition-colors",children:"Open Schedules →"})]}):d.length===0?e.jsxs("div",{className:"flex flex-col gap-3 px-3 py-4",children:[e.jsx("p",{className:"text-muted-foreground/70 text-xs",children:"No schedules yet."}),T.length>0&&e.jsx("div",{className:"space-y-2",children:T.map(s=>e.jsxs("div",{className:"rounded-lg border p-3 text-sm",children:[e.jsx("div",{className:"font-medium",children:s.name}),e.jsx("p",{className:"text-muted-foreground text-xs",children:G(s.cron)}),e.jsx("button",{type:"button",onClick:()=>{z(s),m()},className:"text-primary mt-2 text-xs hover:underline",children:"+ Use preset"})]},s.id))}),e.jsx("button",{onClick:m,className:"text-muted-foreground hover:text-foreground text-xs transition-colors",children:"Open Schedules →"})]}):e.jsx(O,{type:"scroll",className:"h-full",children:e.jsxs("div",{className:"pr-1",children:[b.length>0&&e.jsxs(p,{children:[e.jsxs(j,{className:"text-2xs text-muted-foreground/70 font-medium tracking-wider uppercase",children:["Running",e.jsx("span",{className:"text-muted-foreground/50 ml-auto text-xs font-normal normal-case",children:I})]}),e.jsx(g,{children:b.map(s=>e.jsx(Y,{run:s,scheduleName:x.get(s.scheduleId)??"Unknown"},s.id))})]}),M.length>0&&e.jsxs(p,{children:[e.jsx(j,{className:"text-2xs text-muted-foreground/70 font-medium tracking-wider uppercase",children:"Upcoming"}),e.jsx(g,{children:M.map(s=>e.jsx(Z,{schedule:s,onEdit:E},s.id))})]}),C.length>0&&e.jsxs(p,{children:[e.jsx(j,{className:"text-2xs text-muted-foreground/70 font-medium tracking-wider uppercase",children:"Recent Runs"}),e.jsx(g,{children:C.map(s=>e.jsx(ee,{run:s,scheduleName:x.get(s.scheduleId)??"Unknown"},s.id))})]}),e.jsx("div",{className:"px-3 py-2",children:e.jsx("button",{onClick:m,className:"text-muted-foreground hover:text-foreground text-xs transition-colors",children:"Open Schedules →"})})]})})}function ne({member:t}){var l,o;const n=((l=t.agent)==null?void 0:l.projectPath)??null,a=K(n),c=((o=t.agent)==null?void 0:o.manifestId)??null;return e.jsx("div",{className:"min-h-0 flex-1","data-slot":"profile-tasks",children:e.jsx(se,{toolStatus:a.tasks,agentId:c})})}export{ne as TasksPage};
@@ -1,2 +0,0 @@
1
- import{z as ne,ah as Ze,D as de,A as te,fF as ue,fG as ke,r as c,j as e,cu as O,cv as M,fH as Te,B as x,P as Ae,fI as me,er as _,I as Z,d5 as Oe,d6 as Me,d7 as Ee,d8 as Re,d9 as X,fJ as xe,bB as Je,fK as Xe,C as ie,aj as ve,fL as he,cp as U,cq as q,Z as se,cr as G,bE as L,aQ as es,fM as je,aD as oe,dw as ss,dx as ns,dy as ts,dz as as,dA as re,ak as rs,dC as is,aR as le,fN as os,f7 as ls,fO as cs,fP as ds,m as De,a as ce,fQ as us,dS as ms,fR as hs,fS as gs,fT as ze,fU as J,fV as be,fW as ps,fX as fs,u as xs}from"./index-BMR65QI4.js";import{u as Pe}from"./use-mesh-update-CZIA8V07.js";import{a as vs}from"./agent-browser-DaDOSH9H.js";function js(s,n){const t=ne();return Ze({queryKey:["mcp-config",s,n??null],queryFn:()=>t.getMcpConfig(s,{runtime:n??void 0}),enabled:!!s,staleTime:3e4})}function Ie(s,n){s.invalidateQueries({queryKey:ue.mcpServers(n)}),s.invalidateQueries({queryKey:["mcp-config"]})}function Fe(s){const n=ne(),t=te();return de({mutationFn:async({input:i,approval:a})=>a?(await n.grantApproval(a.approvalId),s(n,i,a.approvalToken)):s(n,i),onSuccess:(i,{input:a})=>{i.status==="ok"&&Ie(t,a.agentId)}})}function _e(){return Fe((s,n,t)=>s.addAgentMcpServer(n,t?{approvalToken:t}:void 0))}function bs(){return Fe((s,n,t)=>s.importAgentMcpServer(n,t?{approvalToken:t}:void 0))}function ge(s){const n=ne(),t=te();return de({mutationFn:({agentId:i,name:a})=>s(n,i,a),onSuccess:(i,{agentId:a})=>Ie(t,a)})}function Ns(){return ge((s,n,t)=>s.removeAgentMcpServer(n,t))}function ys(){return ge((s,n,t)=>s.enableAgentMcpServer(n,t))}function Ss(){return ge((s,n,t)=>s.disableAgentMcpServer(n,t))}function Cs(){const s=ne();return de({mutationFn:({agentId:n,name:t})=>s.testAgentMcpServer(n,t)})}function ws({agentId:s,serverName:n,onDone:t}){const i=ke(s,n),{start:a}=i,r=c.useRef(!1);return c.useEffect(()=>{r.current||(r.current=!0,a())},[a]),e.jsx(O,{children:e.jsxs(M,{className:"space-y-2",children:[e.jsxs("p",{className:"text-sm font-medium",children:["Sign in to ",n]}),e.jsx("p",{className:"text-muted-foreground text-xs",children:"This server needs you to sign in before your agent can use it."}),e.jsx(Te,{flow:i,serverName:n,failedActions:e.jsxs(e.Fragment,{children:[e.jsx(x,{variant:"secondary",size:"sm",onClick:()=>i.start(),className:"focus-visible:ring-2",children:"Try again"}),e.jsx(x,{variant:"ghost",size:"sm",onClick:t,className:"focus-visible:ring-2",children:"Later"})]}),connectedActions:e.jsx(x,{variant:"ghost",size:"sm",onClick:t,className:"focus-visible:ring-2",children:"Done"})}),i.state.step!=="failed"&&i.state.step!=="connected"&&e.jsx(x,{variant:"ghost",size:"sm",onClick:t,className:"focus-visible:ring-2",children:"Later"})]})})}const ks=["stdio","http","sse"],Ts=/^[a-zA-Z0-9_-]+$/;function Ne(s){const n={};for(const t of s.split(`
2
- `)){const i=t.trim();if(!i)continue;const a=i.indexOf("=");if(a===-1)continue;const r=i.slice(0,a).trim();r&&(n[r]=i.slice(a+1).trim())}return n}function ye(s){return s.trim().length?s.trim().split(/\s+/):[]}function As(s,n){if(s.status!=="ok")return!1;const t=s.servers.find(a=>a.name===n),i=t==null?void 0:t.connection;return i!==void 0&&"authKind"in i&&i.authKind==="oauth2"}function Os({agentId:s,agentLabel:n,supportedTransports:t,onAdded:i,oauthDetectedFor:a=null}){const r=_e(),[o,d]=c.useState(!1),[m,f]=c.useState(""),[p,u]=c.useState(t[0]??"stdio"),l=t.includes(p)?p:t[0]??"stdio",[j,v]=c.useState(""),[b,k]=c.useState(""),[N,z]=c.useState(""),[C,E]=c.useState(""),[P,T]=c.useState(""),[R,I]=c.useState(null),[A,F]=c.useState(null),[ae,V]=c.useState(null),[$,Q]=c.useState(null),B=Ts.test(m)&&m.length<=64,Y=l==="stdio"?j.trim().length>0:C.trim().length>0,h=B&&Y&&!r.isPending,y=c.useCallback(()=>l==="stdio"?{transport:"stdio",command:j.trim(),args:ye(b),env:Ne(N)}:{transport:l,url:C.trim(),headers:Ne(P)},[l,j,b,N,C,P]),w=c.useCallback(()=>({agentId:s,name:m.trim(),connection:y()}),[s,m,y]),D=c.useCallback(()=>{d(!1),I(null),F(null),f(""),u(t[0]??"stdio"),v(""),k(""),z(""),E(""),T("")},[t]),fe=c.useCallback(g=>{i({name:g.name,transport:g.connection.transport}),D()},[i,D]),H=c.useCallback((g,S)=>{const We=As(g,S.name);fe(S),We&&V(S.name)},[fe]),Ve=c.useCallback(async()=>{F(null);const g=w();try{const S=await r.mutateAsync({input:g});S.status==="approval_required"?I(S.approval):H(S,g)}catch(S){F(S instanceof Error?S.message:"Couldn’t add the server.")}},[r,w,H]),Qe=c.useCallback(async()=>{if(!R)return;F(null);const g=w();try{const S=await r.mutateAsync({input:g,approval:R});S.status==="ok"?H(S,g):F("The server still needs approval. Try again.")}catch(S){F(S instanceof Error?S.message:"Couldn’t add the server.")}},[r,w,R,H]),W=ae??(a&&a!==$?a:null),Ye=c.useCallback(()=>{Q(W),V(null)},[W]),He=c.useMemo(()=>[j.trim(),...ye(b)].filter(Boolean).join(" "),[j,b]);return W?e.jsx(ws,{agentId:s,serverName:W,onDone:Ye}):o?R?e.jsx(O,{children:e.jsxs(M,{className:"space-y-3",children:[e.jsxs("div",{className:"flex items-start gap-2",children:[e.jsx(me,{className:"mt-0.5 size-4 shrink-0 text-amber-500"}),e.jsxs("div",{className:"space-y-1",children:[e.jsxs("p",{className:"text-sm font-medium",children:["Confirm this server for ",n]}),e.jsx("p",{className:"text-muted-foreground text-xs",children:l==="stdio"?"This command runs on your machine whenever the agent starts a session.":"The agent connects to this URL whenever it starts a session."})]})]}),e.jsx("pre",{className:"bg-muted text-foreground overflow-x-auto rounded-md px-3 py-2 font-mono text-xs",children:l==="stdio"?He:C.trim()}),A&&e.jsx("p",{className:"text-destructive text-xs",children:A}),e.jsxs("div",{className:"flex justify-end gap-2",children:[e.jsx(x,{variant:"ghost",size:"sm",onClick:()=>I(null),disabled:r.isPending,className:"focus-visible:ring-2",children:"Back"}),e.jsx(x,{size:"sm",onClick:Qe,disabled:r.isPending,className:"focus-visible:ring-2",children:r.isPending?"Adding…":"Confirm & add"})]})]})}):e.jsx(O,{children:e.jsxs(M,{className:"space-y-3",children:[e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(_,{htmlFor:"mcp-name",children:"Name"}),e.jsx(Z,{id:"mcp-name",value:m,onChange:g=>f(g.target.value),placeholder:"my-server","aria-invalid":m.length>0&&!B}),m.length>0&&!B&&e.jsx("p",{className:"text-destructive text-xs",children:"Letters, numbers, dashes, underscores only."})]}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(_,{htmlFor:"mcp-transport",children:"Transport"}),e.jsxs(Oe,{value:l,onValueChange:g=>u(g),children:[e.jsx(Me,{id:"mcp-transport",className:"w-full",children:e.jsx(Ee,{})}),e.jsx(Re,{children:t.map(g=>e.jsx(X,{value:g,children:g},g))})]})]}),l==="stdio"?e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(_,{htmlFor:"mcp-command",children:"Command"}),e.jsx(Z,{id:"mcp-command",value:j,onChange:g=>v(g.target.value),placeholder:"npx",className:"font-mono"})]}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(_,{htmlFor:"mcp-args",children:"Arguments"}),e.jsx(Z,{id:"mcp-args",value:b,onChange:g=>k(g.target.value),placeholder:"-y @modelcontextprotocol/server-filesystem",className:"font-mono"})]}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(_,{htmlFor:"mcp-env",children:"Environment (KEY=VALUE per line)"}),e.jsx(xe,{id:"mcp-env",value:N,onChange:g=>z(g.target.value),placeholder:"API_KEY=…",rows:2,className:"font-mono text-xs"})]})]}):e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(_,{htmlFor:"mcp-url",children:"URL"}),e.jsx(Z,{id:"mcp-url",value:C,onChange:g=>E(g.target.value),placeholder:"https://example.com/mcp",className:"font-mono"})]}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(_,{htmlFor:"mcp-headers",children:"Headers (KEY=VALUE per line)"}),e.jsx(xe,{id:"mcp-headers",value:P,onChange:g=>T(g.target.value),placeholder:"Authorization=Bearer …",rows:2,className:"font-mono text-xs"})]})]}),A&&e.jsx("p",{className:"text-destructive text-xs",children:A}),e.jsx(Je,{}),e.jsxs("div",{className:"flex justify-end gap-2",children:[e.jsx(x,{variant:"ghost",size:"sm",onClick:D,className:"focus-visible:ring-2",children:"Cancel"}),e.jsx(x,{size:"sm",onClick:Ve,disabled:!h,className:"focus-visible:ring-2",children:"Continue"})]})]})}):e.jsxs(x,{variant:"outline",size:"sm",onClick:()=>d(!0),className:"focus-visible:ring-2",children:[e.jsx(Ae,{className:"size-4"}),"Add server"]})}const Ms={connected:"connected","needs-auth":"needs-sign-in",pending:"connecting",disabled:"off"},Es=["validation","invalid config","invalid configuration","missing required","command not found","enoent"];function pe(s){if(!s)return"cant-reach";const n=s.toLowerCase();return Es.some(t=>n.includes(t))?"setup-problem":"cant-reach"}function Le(s){return s.transport==="stdio"||s.authKind==="oauth2"?!1:Object.keys(s.headers).some(n=>n.toLowerCase()==="authorization")}function Rs(s){const{connection:n,authStatus:t}=s;return n.transport!=="stdio"&&n.authKind==="oauth2"?!0:t!==void 0}function Ke(s){const{enabled:n,testedOk:t,signedInNow:i,runtimeStatus:a,runtimeError:r,authStatus:o,ownKey:d}=s;return n?t?"connected":i?"signed-in":a==="failed"?pe(r):o==="connected"&&a==="needs-auth"?"signed-in":o==="needs-auth"&&(a==="connected"||a==="pending")?"needs-sign-in":a?Ms[a]:o==="connected"?"signed-in":o==="needs-auth"?"needs-sign-in":d?"uses-your-key":"not-checked":"off"}function Ds(s){const{statusKey:n,testResult:t,signedInNow:i}=s;return n==="off"||i?!1:(t==null?void 0:t.needsAuth)===!0?!0:n==="needs-sign-in"}function zs(s){const{stamped:n,signedInNow:t,authStatus:i,rosterUpdatedAt:a}=s;if(!n)return;const{result:r}=n;if(!(t&&r.needsAuth===!0)&&!(n.at<=a&&(i==="needs-auth"&&r.ok||i==="connected"&&r.needsAuth===!0)))return r}function Ps(s){const{status:n,probe:t}=s;return n==="off"||!t||t.ok?n:t.needsAuth===!0?"needs-sign-in":pe(t.error)}const ee={attention:0,working:1,elsewhere:2,off:3};function Is(s){return s==="off"?ee.off:s==="needs-sign-in"||s==="cant-reach"||s==="setup-problem"?ee.attention:ee.working}function Fs(s){const{managed:n,live:t,discovered:i}=s;return[...n.map(r=>{var o,d;return{name:r.name,band:Is(Ke({enabled:r.enabled,testedOk:!1,signedInNow:!1,runtimeStatus:(o=t.get(r.name))==null?void 0:o.status,runtimeError:(d=t.get(r.name))==null?void 0:d.error,authStatus:r.authStatus,ownKey:Le(r.connection)}))}}),...i.map(r=>({name:r.name,band:ee.elsewhere}))].map((r,o)=>({entry:r,index:o})).sort((r,o)=>r.entry.band-o.entry.band||r.index-o.index).map(({entry:r})=>r.name)}function _s(s){const{frozen:n,present:t}=s,i=new Set(t),a=new Set(n);return{ordered:n.filter(r=>i.has(r)),added:t.filter(r=>!a.has(r))}}function Ls(){const s=Xe(null);return({bothSettled:n,managed:t,live:i,discovered:a,present:r})=>{s.read()===null&&n&&r.length>0&&s.write(Fs({managed:t,live:i,discovered:a}));const{ordered:o,added:d}=_s({frozen:s.read()??[],present:r});return d.length>0&&s.read()!==null&&s.write([...o,...d]),[...o,...d]}}const $e={"needs-sign-in":{label:"Needs sign-in",tooltip:"Sign in to let this agent use the server.",tone:"attention"},"signing-in":{label:"Signing in…",tooltip:"A sign-in is in progress. Finish it in the tab that opened.",tone:"attention"},connected:{label:"Connected",tooltip:"This server answered, and its tools are available to the agent.",tone:"calm"},"signed-in":{label:"Signed in",tooltip:"DorkOS has a sign-in for this server. Use Test to check it responds.",tone:"calm"},"uses-your-key":{label:"Uses your key",tooltip:"This server is authenticated with a key you supplied, not one DorkOS holds.",tone:"calm"},"cant-reach":{label:"Can’t reach",tooltip:"The server did not answer. Open Details for what it said.",tone:"error"},"setup-problem":{label:"Setup problem",tooltip:"This server’s setup is wrong, so it could not start. Open Details for the reason.",tone:"error"},connecting:{label:"Connecting…",tooltip:"The agent is connecting to this server.",tone:"calm"},"not-checked":{label:"Not checked yet",tooltip:"Nothing has contacted this server yet, so there is nothing to report.",tone:"calm"},off:{label:"Off",tooltip:"Turned off. Its tools are not given to the agent.",tone:"calm"}},Ks={"needs-sign-in":"sign-in","signing-in":"none",connected:"none","signed-in":"test","uses-your-key":"test","cant-reach":"try-again","setup-problem":"try-again",connecting:"none","not-checked":"test",off:"none"};function $s(s){return Ks[s]}function Bs({toolCount:s,justSignedIn:n}){const t=n?"Signed in just now. ":"";return s===null?`${t||"This server answered. "}Its tools are available.`:`${t}${s} tool${s===1?"":"s"} available.`}function Us(s,n){switch(s){case"needs-sign-in":return`Sign in to ${n.displayName} so this agent can use its tools.`;case"signing-in":return null;case"connected":return Bs(n);case"signed-in":return n.justSignedIn?"Signed in just now. Test to check the server responds.":"DorkOS has a sign-in for this server. Test to check it responds.";case"uses-your-key":return"You added an access key when setting this up.";case"cant-reach":return"This server didn’t answer. It may be down.";case"setup-problem":return"This server’s setup has a problem.";case"connecting":return"Connecting to this server.";case"not-checked":return"Nothing has checked this server yet.";case"off":return"Turned off. The agent doesn’t see this server."}}function qs(s){const{connection:n,authStatus:t,clientOrigin:i}=s;return n.transport==="stdio"?"None. This server doesn’t need one.":n.authKind==="oauth2"?i==="manual"?`OAuth: using your own app credentials, ${t==="connected"?"signed in, and it renews automatically":"not signed in yet"}. DorkOS holds the key; the agent never sees it.`:t==="connected"?"OAuth: signed in, and it renews automatically. DorkOS holds the key; the agent never sees it.":"OAuth: DorkOS will hold the key for you; the agent never sees it.":Object.keys(n.headers).some(r=>r.toLowerCase()==="authorization")?"Access key: you added a key when setting this up.":t===void 0?"Nothing has checked this yet.":"None. This server doesn’t need one."}function Gs(s){if(s.transport==="stdio")return`Runs \`${s.command}\` on this computer`;const n=Vs(s.url);return n?`${n} (web service)`:`${s.url} (web service)`}function Vs(s){try{return new URL(s).host}catch{return null}}const Qs={agent:"Added to this agent through DorkOS",project:"From this project, declared in its config files",plugin:"Comes with a plugin",computer:"From your computer-wide config"},Ys={agent:"Added to this agent through DorkOS.",project:"From this project’s config. Add it to manage it here.",plugin:"Comes with a plugin. Add it to manage it here.",computer:"From your computer-wide config. Add it to manage it here."},Hs=[{runtime:"claude-code",pattern:/^plugin:([^:]+):(.+)$/,read:s=>({pluginName:s[1],displayName:s[2]})},{runtime:"claude-code",pattern:/^plugin:(.+)$/,read:s=>({pluginName:s[1],displayName:s[1]})}];function Be(s){for(const n of Hs){const t=s.match(n.pattern);if(!t)continue;const{displayName:i,pluginName:a}=n.read(t);if(!(!i||!a))return{displayName:i,pluginName:a,rawName:s}}return{displayName:s,pluginName:null,rawName:s}}function Ws(s,n){return n.pluginName?"plugin":s.scope==="project"||s.scope==="local"?"project":s.scope==="user"?"computer":null}const Zs="This agent’s runtime loads this server. Add it to manage it here.";function Ue(s,n){return s==="plugin"&&n?`Comes with the ${n} plugin`:Qs[s]}function Js(s,n){return s===null?Zs:s==="plugin"&&n?`Comes with the ${n} plugin. Add it to manage it here.`:Ys[s]}const Xs=he("border-border/60 relative overflow-hidden rounded-md border px-3 py-2.5 transition-colors",{variants:{managed:{true:"bg-card",false:"bg-muted/30"},dimmed:{true:"opacity-65",false:""}},defaultVariants:{managed:!0,dimmed:!1}}),en=he("pointer-events-none absolute inset-y-0 left-0 w-0.5",{variants:{tone:{calm:"hidden",attention:"bg-status-warning",error:"bg-status-error"}},defaultVariants:{tone:"calm"}}),sn=he("shrink-0 rounded-full px-2 py-0.5 text-2xs leading-4 font-medium whitespace-nowrap",{variants:{chip:{success:"bg-status-success-bg text-status-success-fg",info:"bg-status-info-bg text-status-info-fg",warning:"bg-status-warning-bg text-status-warning-fg",error:"bg-status-error-bg text-status-error-fg",neutral:"bg-muted text-muted-foreground"}},defaultVariants:{chip:"neutral"}}),nn={connected:"success","signed-in":"info","needs-sign-in":"warning","signing-in":"warning","cant-reach":"error","setup-problem":"error","uses-your-key":"neutral",connecting:"neutral","not-checked":"neutral",off:"neutral"};function tn({status:s}){const n=$e[s];return e.jsxs(U,{children:[e.jsx(q,{asChild:!0,children:e.jsx("span",{className:sn({chip:nn[s]}),children:n.label})}),e.jsx(G,{children:n.tooltip})]})}function an({scope:s,pluginName:n}){return e.jsxs(U,{children:[e.jsx(q,{asChild:!0,children:e.jsx(se,{size:"xs",tone:"neutral",variant:"secondary",className:"shrink-0 font-normal",children:s})}),e.jsx(G,{children:Ue(s,n)})]})}function qe({displayName:s,rawName:n,scope:t,pluginName:i,status:a,sentence:r,managed:o,toggle:d,actions:m,children:f,details:p,defaultDetailsOpen:u=!1}){const[l,j]=c.useState(u),v=c.useId(),b=$e[a].tone;return e.jsxs("div",{"data-mcp-server":n,className:ve(Xs({managed:o,dimmed:a==="off"}),"mb-2 last:mb-0"),children:[e.jsx("span",{className:en({tone:b}),"aria-hidden":!0}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"min-w-0 flex-1 truncate text-sm font-medium",children:s}),t&&e.jsx(an,{scope:t,pluginName:i}),e.jsx(tn,{status:a}),d]}),r&&e.jsx("p",{className:"text-muted-foreground mt-1 text-xs leading-relaxed",children:r}),f,m&&e.jsx("div",{className:"mt-2 flex items-center gap-1",children:m}),p&&e.jsxs(e.Fragment,{children:[e.jsxs("button",{type:"button",onClick:()=>j(k=>!k),"aria-expanded":l,"aria-controls":v,className:"text-muted-foreground hover:text-foreground mt-2 flex items-center gap-1 text-xs focus-visible:ring-2",children:[e.jsx(ie,{className:ve("size-3 transition-transform",l&&"rotate-90"),"aria-hidden":!0}),"Details"]}),l&&e.jsxs("div",{id:v,children:[p,e.jsxs("button",{type:"button",onClick:()=>j(!1),className:"text-muted-foreground hover:text-foreground mt-2 flex items-center gap-1 text-xs focus-visible:ring-2",children:[e.jsx(ie,{className:"size-3 -rotate-90","aria-hidden":!0}),"Collapse details"]})]})]})]})}const rn=3,K="text-muted-foreground/70";function on({tools:s}){const[n,t]=c.useState(!1),i=n?s:s.slice(0,rn),a=s.length-i.length;return e.jsxs("div",{className:"mt-1.5",children:[i.map(r=>e.jsxs("div",{className:"border-border/40 flex items-baseline gap-2 border-b py-1 last:border-b-0",children:[e.jsx("code",{className:"text-foreground text-2xs shrink-0 font-mono",children:r.name}),r.description&&e.jsx("span",{className:"text-muted-foreground text-2xs truncate",children:r.description})]},r.name)),a>0&&e.jsxs("button",{type:"button",onClick:()=>t(!0),className:"text-muted-foreground hover:text-foreground mt-1 flex items-center gap-1 text-xs focus-visible:ring-2",children:[e.jsx(ie,{className:"size-3","aria-hidden":!0}),"Show ",a," more"]})]})}function ln(s){const{scope:n,pluginName:t,connection:i}=s;return n==="plugin"&&t?`Comes with the ${t} plugin`:i?Gs(i):n?Ue(n,t):null}function Ge({connection:s,authStatus:n,authClientOrigin:t,scope:i,pluginName:a,rawName:r,displayName:o,toolCount:d,tools:m,serverInfo:f,alsoUsedBy:p,error:u}){const l=ln({scope:i,pluginName:a,connection:s});return e.jsxs("div",{className:"border-border/60 text-muted-foreground mt-2 space-y-1 border-t pt-2 text-xs leading-relaxed",children:[s&&e.jsx(L,{label:"Sign-in",align:"start",wrap:!0,labelClassName:K,children:e.jsxs("span",{className:"inline-flex items-start gap-1.5",children:[e.jsx(es,{className:"mt-0.5 size-3 shrink-0","aria-hidden":!0}),qs({connection:s,authStatus:n,clientOrigin:t})]})}),l&&e.jsx(L,{label:"Source",align:"start",wrap:!0,labelClassName:K,children:l}),r!==o&&e.jsx(L,{label:"Raw id",align:"start",wrap:!0,labelClassName:K,children:e.jsx("code",{className:"text-2xs font-mono",children:r})}),f&&e.jsx(L,{label:"Server",align:"start",wrap:!0,labelClassName:K,children:f}),p&&e.jsx(L,{label:"Also used by",align:"start",wrap:!0,labelClassName:K,children:p}),typeof d=="number"&&e.jsx(L,{label:"Tools",align:"start",labelClassName:K,children:d}),m&&m.length>0&&e.jsx(on,{tools:m}),u&&e.jsx(L,{label:"Error",align:"start",wrap:!0,labelClassName:K,children:e.jsx("code",{className:"text-2xs font-mono break-all",children:u})})]})}function cn({flow:s,serverName:n}){return e.jsxs(e.Fragment,{children:[e.jsx(Te,{flow:s,serverName:n,failedActions:e.jsxs(e.Fragment,{children:[e.jsx(x,{variant:"secondary",size:"sm",onClick:()=>s.start(),className:"focus-visible:ring-2",children:"Try again"}),e.jsx(x,{variant:"ghost",size:"sm",onClick:()=>s.reset(),className:"focus-visible:ring-2",children:"Dismiss"})]}),connectedActions:e.jsx(x,{variant:"ghost",size:"sm",onClick:()=>s.reset(),className:"focus-visible:ring-2",children:"Dismiss"})}),(s.state.step==="disclosure"||s.state.step==="waiting")&&e.jsx("div",{className:"mt-2",children:e.jsx(x,{variant:"ghost",size:"sm",onClick:()=>s.reset(),"aria-label":`Cancel signing in to ${n}`,className:"focus-visible:ring-2",children:"Cancel"})})]})}function dn({server:s,agentId:n,live:t,testResult:i,rosterUpdatedAt:a,testing:r,busy:o,onToggle:d,onTest:m,onRemove:f}){const p=ke(n,s.name),u=p.state.step==="connected",l=zs({stamped:i,signedInNow:u,authStatus:s.authStatus,rosterUpdatedAt:a}),j=Le(s.connection),v=Ke({enabled:s.enabled,testedOk:(l==null?void 0:l.ok)===!0,signedInNow:u,runtimeStatus:t==null?void 0:t.status,runtimeError:t==null?void 0:t.error,authStatus:s.authStatus,ownKey:j}),b=p.state.step==="starting",k=p.state.step==="disclosure"||p.state.step==="waiting"||b,N=k?"signing-in":v,z=Ds({statusKey:v,testResult:l,signedInNow:u})&&(p.state.step==="idle"||b),C=Be(s.name),E=l!=null&&l.ok?l.toolCount??null:p.state.toolCount,P=k?N:Ps({status:N,probe:l}),T=Us(P,{displayName:C.displayName,toolCount:E,justSignedIn:u}),R=k?"none":$s(P),I=Rs({connection:s.connection,authStatus:s.authStatus});return e.jsx(qe,{displayName:C.displayName,rawName:s.name,scope:"agent",pluginName:C.pluginName,status:N,sentence:T,managed:!0,toggle:e.jsx(le,{checked:s.enabled,onCheckedChange:A=>d(s.name,A),disabled:o,"aria-label":`Enable ${s.name}`}),actions:e.jsxs(e.Fragment,{children:[z&&e.jsxs(x,{variant:"default",size:"sm",onClick:()=>p.start(),disabled:o||b,"aria-label":`Sign in to ${s.name}`,className:"gap-1.5 focus-visible:ring-2",children:[e.jsx(je,{className:"size-3.5","aria-hidden":!0}),"Sign in"]}),!z&&R==="try-again"&&e.jsxs(x,{variant:"outline",size:"sm",onClick:()=>m(s.name),disabled:r||o,"aria-label":`Try ${s.name} again`,className:"gap-1.5 focus-visible:ring-2",children:[r?e.jsx(oe,{size:"xs"}):null,"Try again"]}),!z&&R==="test"&&e.jsx(x,{variant:"outline",size:"sm",onClick:()=>m(s.name),disabled:r||o,className:"focus-visible:ring-2",children:r?e.jsx(oe,{size:"xs"}):"Test"}),e.jsxs(ss,{children:[e.jsx(ns,{asChild:!0,children:e.jsx(x,{variant:"ghost",size:"sm","aria-label":`More actions for ${s.name}`,className:"ml-auto focus-visible:ring-2",children:e.jsx(ts,{className:"size-4","aria-hidden":!0})})}),e.jsxs(as,{align:"end",children:[e.jsxs(re,{onSelect:()=>m(s.name),disabled:r||o,children:[e.jsx(rs,{className:"size-3.5","aria-hidden":!0}),"Test"]}),I&&e.jsxs(re,{onSelect:()=>p.start(),disabled:o,children:[e.jsx(je,{className:"size-3.5","aria-hidden":!0}),"Sign in again"]}),e.jsx(is,{}),e.jsx(re,{variant:"destructive",onSelect:()=>f(s.name),disabled:o,children:"Remove"})]})]})]}),details:e.jsx(Ge,{connection:s.connection,authStatus:s.authStatus,authClientOrigin:s.authClientOrigin,scope:"agent",pluginName:C.pluginName,rawName:C.rawName,displayName:C.displayName,toolCount:E,error:(l==null?void 0:l.ok)===!1?l.error:t==null?void 0:t.error}),children:e.jsx(cn,{flow:p,serverName:C.displayName})})}function un(s){switch(s.status){case"connected":return"connected";case"failed":return pe(s.error);case"needs-auth":return"needs-sign-in";case"pending":return"connecting";case"disabled":return"off";default:return"not-checked"}}function mn(s){const{displayName:n,scope:t,pluginName:i}=s,a=hn(t,i);return`${n} ${a}. Manage it here to enable, disable, or sign in from DorkOS.`}function hn(s,n){return s==="plugin"&&n?`comes with the ${n} plugin`:s==="project"?"comes from this project’s own config":s==="computer"?"comes from your computer-wide config":"is loaded by this agent’s runtime"}function gn({entry:s,agentId:n,agentLabel:t,canImport:i}){const a=bs(),[r,o]=c.useState(null),[d,m]=c.useState(null),f=c.useCallback(async()=>{m(null);try{const N=await a.mutateAsync({input:{agentId:n,name:s.name}});N.status==="approval_required"&&o(N.approval)}catch(N){m(N instanceof Error?N.message:"Couldn’t add the server.")}},[a,n,s.name]),p=c.useCallback(async()=>{if(r){m(null);try{(await a.mutateAsync({input:{agentId:n,name:s.name},approval:r})).status!=="ok"&&m("Adding it still needs approval. Try again.")}catch(N){m(N instanceof Error?N.message:"Couldn’t add the server.")}}},[a,n,s.name,r]),u=Be(s.name),l=Ws(s,u),j=l!==null,v=u.rawName!==u.displayName,b=s.error!==void 0,k=j||v||b;return r?e.jsxs("div",{className:"border-border/60 mb-2 space-y-3 rounded-md border p-3 last:mb-0",children:[e.jsxs("div",{className:"flex items-start gap-2",children:[e.jsx(me,{className:"text-status-warning mt-0.5 size-4 shrink-0","aria-hidden":!0}),e.jsxs("div",{className:"space-y-1",children:[e.jsxs("p",{className:"text-sm font-medium",children:["Add “",u.displayName,"” to ",t,"?"]}),e.jsx("p",{className:"text-muted-foreground text-xs leading-relaxed",children:mn({displayName:u.displayName,scope:l,pluginName:u.pluginName})})]})]}),d&&e.jsx("p",{className:"text-destructive text-xs",children:d}),e.jsxs("div",{className:"flex justify-end gap-2",children:[e.jsx(x,{variant:"ghost",size:"sm",onClick:()=>o(null),disabled:a.isPending,className:"focus-visible:ring-2",children:"Cancel"}),e.jsx(x,{size:"sm",onClick:p,disabled:a.isPending,className:"focus-visible:ring-2",children:a.isPending?"Adding…":"Add to agent"})]})]}):e.jsx(qe,{displayName:u.displayName,rawName:s.name,scope:l,pluginName:u.pluginName,status:un(s),sentence:Js(l,u.pluginName),managed:!1,actions:i?e.jsxs(e.Fragment,{children:[e.jsxs(x,{variant:"outline",size:"sm",onClick:f,disabled:a.isPending,"aria-label":`Add ${s.name} to agent`,className:"gap-1.5 focus-visible:ring-2",children:[a.isPending?e.jsx(oe,{size:"xs"}):e.jsx(Ae,{className:"size-(--size-icon-xs)","aria-hidden":!0}),"Add to agent"]}),d&&e.jsx("p",{className:"text-destructive text-xs",children:d})]}):void 0,details:k?e.jsx(Ge,{scope:l,pluginName:u.pluginName,rawName:u.rawName,displayName:u.displayName,error:s.error}):void 0})}function pn(s,n){return{agentId:s,name:n.server.name,connection:n.server.connection}}function fn(s){const n=s.sites.filter(t=>!t.expired).map(t=>t.site);return n.length<=3?n.join(", "):`${n.slice(0,3).join(", ")} and ${n.length-3} more`}function xn({agentId:s,agentLabel:n}){const t=os(),i=_e(),[a,r]=c.useState(null),[o,d]=c.useState(null),m=c.useCallback(async l=>{if(t.data){d(null);try{const j=await i.mutateAsync({input:pn(s,t.data),...l?{approval:l}:{}});j.status!=="approval_required"?r(null):l?d("The browser still needs approval. Try again."):r(j.approval)}catch(j){d(j instanceof Error?j.message:"Couldn’t add the browser.")}}},[i,s,t.data]);if(!t.data)return null;const f=t.data,p=fn(f),u=`${f.loginCommand} <site>`;return e.jsx(O,{children:e.jsxs(M,{className:"space-y-3",children:[e.jsxs("div",{className:"flex items-start gap-2",children:[a?e.jsx(me,{className:"mt-0.5 size-4 shrink-0 text-amber-500"}):e.jsx(ls,{className:"text-muted-foreground mt-0.5 size-4 shrink-0"}),e.jsxs("div",{className:"min-w-0 space-y-1",children:[e.jsx("p",{className:"text-sm font-medium",children:a?`Confirm the signed-in browser for ${n}`:"Signed-in browser"}),e.jsx("p",{className:"text-muted-foreground text-xs",children:a?"This command runs on your machine whenever the agent starts a session. Each session gets its own browser, so agents working at the same time never share one.":"A web browser that starts signed in to the sites you saved. The agent never sees your passwords."}),f.saved?e.jsxs("p",{className:"text-xs",children:["Signed in to ",p,"."]}):e.jsxs("p",{className:"text-xs text-amber-600 dark:text-amber-500",children:["No sign-ins saved yet, so it starts signed out. Run"," ",e.jsx("code",{className:"font-mono",children:u}),e.jsx(cs,{value:u,label:"Copy the sign-in command",size:"xs",className:"mx-0.5 inline-flex align-middle"})," ","in a terminal first."]})]})]}),a&&e.jsx("pre",{className:"bg-muted text-foreground overflow-x-auto rounded-md px-3 py-2 font-mono text-xs",children:[f.server.connection.command,...f.server.connection.args].join(" ")}),o&&e.jsx("p",{className:"text-destructive text-xs",children:o}),e.jsxs("div",{className:"flex justify-end gap-2",children:[a&&e.jsx(x,{variant:"ghost",size:"sm",onClick:()=>r(null),disabled:i.isPending,className:"focus-visible:ring-2",children:"Back"}),e.jsx(x,{variant:a?"default":"outline",size:"sm",onClick:()=>void m(a??void 0),disabled:i.isPending,className:"focus-visible:ring-2",children:i.isPending?"Adding…":a?"Confirm & add":"Give it the browser"})]})]})})}const vn={codex:["stdio","http"],opencode:["stdio","http"]};function Se(s){return vn[s]??ks}function jn(){const{open:s}=us();return e.jsxs("p",{className:"text-muted-foreground text-xs leading-relaxed",children:["Want other apps to use DorkOS as an MCP server instead? That is the other direction."," ",e.jsx(x,{variant:"link",size:"sm",className:"h-auto p-0 text-xs",onClick:()=>s("tools","external-mcp"),children:"See Settings → Tools"})]})}function bn({agent:s,projectPath:n}){var Y;const t=ds(s.id),i=js(n,s.runtime),a=i.data,r=De(s.runtime),o=(r==null?void 0:r.supportsManagedMcpServers)??!0,d=ys(),m=Ss(),f=Ns(),p=Cs(),[u,l]=c.useState({}),[j,v]=c.useState(null),[b,k]=c.useState(null),N=Ls(),z=c.useCallback((h,y)=>{(y?d:m).mutate({agentId:s.id,name:h})},[s.id,d,m]),C=c.useCallback(h=>{f.mutate({agentId:s.id,name:h}),l(y=>{const w={...y};return delete w[h],w})},[s.id,f]),E=c.useCallback(async h=>{v(h);try{const y=await p.mutateAsync({agentId:s.id,name:h});l(w=>({...w,[h]:{result:y,at:Date.now()}}))}finally{v(null)}},[s.id,p]),P=c.useCallback(({name:h,transport:y})=>{k(h),y!=="stdio"&&E(h).catch(()=>{})},[E]),T=t.data??[],R=new Set(T.map(h=>h.name)),I=new Map(((a==null?void 0:a.servers)??[]).map(h=>[h.name,h])),A=((a==null?void 0:a.servers)??[]).filter(h=>!R.has(h.name)),F=d.isPending||m.isPending||f.isPending,ae=T.some(h=>vs(h.connection)!==void 0),V=o&&!t.isPending&&!ae&&Se(s.runtime).includes("stdio"),$=new Map;T.forEach((h,y)=>$.set(h.name,{kind:"managed",index:y})),A.forEach((h,y)=>$.set(h.name,{kind:"discovered",index:y}));const Q=N({bothSettled:!t.isPending&&!i.isPending,managed:T,live:I,discovered:A,present:[...T.map(h=>h.name),...A.map(h=>h.name)]});function B(h){const y=$.get(h);if(!y)return null;if(y.kind==="managed"){const D=T[y.index];return e.jsx(dn,{server:D,agentId:s.id,live:I.get(D.name),testResult:u[D.name],rosterUpdatedAt:t.dataUpdatedAt,testing:j===D.name,busy:F,onToggle:z,onTest:E,onRemove:C},D.name)}const w=A[y.index];return e.jsx(gn,{entry:w,agentId:s.id,agentLabel:s.displayName??s.name,canImport:o},w.name)}return e.jsxs("section",{className:"space-y-3","aria-label":"MCP servers",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("h3",{className:"text-sm font-semibold",children:"MCP Servers"}),o&&e.jsx(Os,{agentId:s.id,agentLabel:s.displayName??s.name,supportedTransports:Se(s.runtime),onAdded:P,oauthDetectedFor:b&&((Y=u[b])==null?void 0:Y.result.needsAuth)===!0?b:null})]}),e.jsx(jn,{}),V&&e.jsx(xn,{agentId:s.id,agentLabel:s.displayName??s.name}),!o&&e.jsx("p",{className:"text-muted-foreground text-xs",children:"This agent’s runtime can’t run DorkOS-managed MCP servers yet. Any servers below show read-only status."}),t.isLoading?e.jsx(O,{children:e.jsxs(M,{className:"space-y-2",children:[e.jsx(ce,{className:"h-5 w-full"}),e.jsx(ce,{className:"h-5 w-3/4"})]})}):t.isError?e.jsx(O,{children:e.jsxs(M,{className:"flex items-center justify-between gap-2",children:[e.jsx("p",{className:"text-destructive text-sm",children:"Couldn’t load managed servers."}),e.jsx(x,{variant:"outline",size:"sm",onClick:()=>t.refetch(),className:"focus-visible:ring-2",children:"Retry"})]})}):Q.length===0?e.jsx(O,{children:e.jsx(M,{children:e.jsxs("p",{className:"text-muted-foreground text-sm",children:["No MCP servers yet."," ",o?"Add one to give this agent tools from an external server.":"This runtime can’t run managed servers."]})})}):e.jsx(O,{children:e.jsx(M,{children:Q.map(B)})})]})}function Ce({tools:s}){return e.jsxs(U,{children:[e.jsx(q,{asChild:!0,children:e.jsx(se,{tone:"neutral",variant:"outline",className:"shrink-0 cursor-default font-normal",children:s.length})}),e.jsx(G,{side:"top",className:"max-w-xs",children:e.jsx("p",{className:"font-mono text-xs",children:s.join(", ")})})]})}function Nn({domain:s,agentOverride:n,globalDefault:t,onToggle:i,onReset:a}){const r=n!==void 0,o=n??t;return s.serverDisabled?e.jsx(be,{label:s.label,description:s.description,className:"py-1",children:e.jsxs(U,{children:[e.jsx(q,{asChild:!0,children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(se,{variant:"secondary",children:"Disabled"}),e.jsx(Ce,{tools:s.tools}),e.jsx(le,{checked:!1,disabled:!0,"aria-label":`Toggle ${s.label} tools`})]})}),e.jsx(G,{side:"left",children:s.serverDisabledReason??"Disabled globally by server configuration."})]})}):e.jsx(be,{label:s.label,description:s.description,className:"py-1",children:e.jsxs("div",{className:"flex items-center gap-2",children:[!r&&e.jsx(se,{tone:"neutral",variant:"outline",className:"font-normal",children:"default"}),r&&e.jsxs(U,{children:[e.jsx(q,{asChild:!0,children:e.jsx(x,{variant:"ghost",size:"sm",className:"h-6 w-6 p-0",onClick:()=>a(s.key),"aria-label":`Reset ${s.label} to default`,children:e.jsx(ps,{className:"size-3"})})}),e.jsx(G,{side:"top",children:"Reset to global default"})]}),e.jsx(Ce,{tools:s.tools}),e.jsx(le,{checked:o,onCheckedChange:d=>i(s.key,d),"aria-label":`Toggle ${s.label} tools`})]})})}const yn=["tasks","relay","mesh","adapter"];function we(s){const n={};for(const t of yn)(s==null?void 0:s[t])!==void 0&&(n[t]=s[t]);return n}function Sn({agent:s}){const n=Pe(),t=te(),i=s.tierCeiling??fs,a=c.useCallback(r=>{n.mutate({id:s.id,updates:{tierCeiling:r}},{onSettled:()=>{t.invalidateQueries({queryKey:ue.all}),t.invalidateQueries({queryKey:ze})}})},[s.id,t,n]);return e.jsx(O,{children:e.jsxs(M,{className:"space-y-3",children:[e.jsxs("div",{className:"flex items-start justify-between gap-4",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsx("span",{className:"text-sm font-medium",children:"The most this agent can ever do"}),e.jsx("p",{className:"text-muted-foreground text-sm",children:"Anything past this line is refused, and no approval can unlock it. Use it when you want an agent that reads your work but can never take anything away."})]}),e.jsxs(Oe,{value:i,onValueChange:a,disabled:n.isPending,children:[e.jsx(Me,{className:"w-56","aria-label":"The most this agent can ever do",children:e.jsx(Ee,{})}),e.jsxs(Re,{children:[e.jsx(X,{value:"observe",children:"Read only"}),e.jsx(X,{value:"act",children:"Change things, never delete"}),e.jsx(X,{value:"destructive",children:"No extra limit"})]})]})]}),e.jsx("p",{className:"text-muted-foreground text-sm",children:"Every agent starts with no extra limit, so nothing you already run changes until you set one here. An agent can tighten its own limit; only you can loosen it."}),e.jsx("p",{className:"text-muted-foreground text-sm",children:"This covers what the agent asks DorkOS to do. An agent that can run terminal commands can still act outside DorkOS. Turn on Require login, in Settings under Access, to close that door too."})]})})}function Cn({agent:s,projectPath:n}){const t=ms(),i=hs(),{config:a}=gs(),r=Pe(),o=te(),d=De(s.runtime),m=(d==null?void 0:d.supportsMcp)??!0,f=c.useCallback(v=>{r.mutate({id:s.id,updates:{enabledToolGroups:v}},{onSettled:()=>{o.invalidateQueries({queryKey:ue.all}),o.invalidateQueries({queryKey:ze})}})},[s.id,o,r]),p=c.useCallback((v,b)=>{f({...we(s.enabledToolGroups),[v]:b})},[s.enabledToolGroups,f]),u=c.useCallback(v=>{const b=we(s.enabledToolGroups);delete b[v],f(b)},[s.enabledToolGroups,f]),l=[{key:"tasks",configKey:"tasksTools",label:"Scheduling",description:"Create and run scheduled tasks",tools:J("tasks"),serverDisabled:!i,serverDisabledReason:"Disabled globally by server configuration."},{key:"relay",configKey:"relayTools",label:"Messaging",description:"Send and receive messages between agents",tools:J("relay"),serverDisabled:!t,serverDisabledReason:"Disabled globally by server configuration."},{key:"mesh",configKey:"meshTools",label:"Agent discovery",description:"Find and register agents on this machine",tools:J("mesh")},{key:"adapter",configKey:"adapterTools",label:"Connection management",description:"Set up Telegram, Slack, and webhooks, and route each chat to an agent",tools:J("adapter"),serverDisabled:!t,serverDisabledReason:"Disabled globally by server configuration."}],j=s.enabledToolGroups??{};return e.jsxs("div",{className:"space-y-4",children:[m?e.jsxs(e.Fragment,{children:[e.jsx("p",{className:"text-muted-foreground text-sm",children:"Choose which tool groups this agent is told about. Turn a group off and the agent stops being told those tools exist, so it stops reaching for them. This is guidance, not a lock: an agent that asks for one anyway still gets it. Leave a group unset to inherit the global default."}),e.jsx(O,{children:e.jsx(M,{children:l.map(v=>e.jsx(Nn,{domain:v,agentOverride:j[v.key],globalDefault:a[v.configKey],onToggle:p,onReset:u},v.key))})}),e.jsx("p",{className:"text-muted-foreground text-xs",children:"Core tools (ping, server info, agent identity) are always registered, whatever you set here."})]}):e.jsx(O,{children:e.jsx(M,{children:e.jsx("p",{className:"text-muted-foreground text-sm",children:"This agent’s runtime does not support DorkOS tool groups (Scheduling, Messaging, Agent discovery, Connection management). These are delivered over MCP, which this runtime cannot consume."})})}),e.jsx(Sn,{agent:s}),e.jsx(bn,{agent:s,projectPath:n})]})}function An({member:s}){const{agent:n,projectPath:t,isPending:i}=xs(s);return i?e.jsx(ce,{className:"h-32 w-full"}):!n||t===null?e.jsx("p",{className:"text-muted-foreground text-sm",children:"Couldn’t read this agent’s tools."}):e.jsx(Cn,{agent:n,projectPath:t})}export{An as ToolsPage};
@@ -1 +0,0 @@
1
- import{j as e,b3 as C,b4 as M,a as i,b5 as R,b6 as I,af as u,b7 as L,b8 as O,b9 as z,ba as F,bb as v,r,bc as q,bd as T,be as U,bf as _,bg as K,bh as V,bi as $,bj as B}from"./index-BMR65QI4.js";import{bk as Z,bl as ee,bm as se,bn as te,bo as ne,bp as ae,bq as le,br as oe,bs as re,bt as ie,bu as ce,bv as de,bw as ue}from"./index-BMR65QI4.js";function G(){return e.jsxs("div",{className:"flex h-full flex-col items-center justify-center gap-3 p-6 text-center",children:[e.jsx("div",{className:"bg-muted flex size-12 items-center justify-center rounded-full",children:e.jsx(C,{className:"text-muted-foreground size-5"})}),e.jsxs("div",{className:"space-y-1",children:[e.jsx("p",{className:"text-sm font-medium",children:"No agent selected"}),e.jsx("p",{className:"text-muted-foreground text-xs",children:"Select an agent to view its profile."})]})]})}function H({agentPath:s}){return e.jsxs("div",{className:"flex h-full flex-col items-center justify-center gap-3 p-6 text-center",children:[e.jsx("div",{className:"bg-destructive/10 flex size-12 items-center justify-center rounded-full",children:e.jsx(M,{className:"text-destructive size-5"})}),e.jsxs("div",{className:"space-y-1",children:[e.jsx("p",{className:"text-sm font-medium",children:"Agent not found"}),e.jsx("p",{className:"text-muted-foreground font-mono text-xs break-all",children:s}),e.jsx("p",{className:"text-muted-foreground text-xs",children:"The agent at this path could not be loaded."})]})]})}function J(){return e.jsxs("div",{"data-slot":"profile-dock-skeleton",className:"flex h-full flex-col overflow-hidden",children:[e.jsxs("div",{className:"flex flex-col items-center gap-2 px-4 pt-6 pb-4",children:[e.jsx(i,{className:"size-16 rounded-full"}),e.jsx(i,{className:"mt-1 h-4 w-28 rounded"}),e.jsx(i,{className:"h-3 w-16 rounded"}),e.jsx(i,{className:"h-3 w-36 rounded"})]}),e.jsx("div",{className:"space-y-2 px-4",children:["w-full","w-full","w-full"].map((s,f)=>e.jsx(i,{className:`h-8 ${s} rounded`},f))})]})}function W(){var N;const s=R(),f=I(),b=u(t=>t.rightPanelOpen),S=L(),c=O(s??void 0),p=z({enabled:c!==void 0}),l=(N=p.data)==null?void 0:N.members,D=c===void 0||l==null?void 0:l.find(t=>t.id===c),x=S.isFetched&&(c===void 0||p.isFetched),n=D??null,g=F(s),d=v(t=>t.setDockedEntries),m=v(t=>t.clearDockedStacks),E=u(t=>t.setRightPanelOpen),j=u(t=>t.releaseRightPanelRequest),[w,h]=r.useState(!1),a=r.useMemo(()=>n?q(n.id,[...g]):null,[n,g]),P=a===null?null:T(a),o=(P===(n==null?void 0:n.id)?n:l==null?void 0:l.find(t=>t.id===P))??n,y=r.useCallback(t=>{!s||!a||d(s,U(a,t).entries)},[s,a,d]),A=r.useCallback(()=>{!s||!a||d(s,_(a).entries)},[s,a,d]);r.useEffect(()=>{s===null||!x||o!==null||j(s)},[s,x,o,j]);const k=K(o===null?null:{home:"docked",memberId:o.id});return r.useEffect(()=>{if(b)return()=>{if(!u.getState().rightPanelOpen){if(V(k.read()))return h(!0);m()}}},[b,m,k]),s?!n||!a||!o?x?e.jsx(H,{agentPath:s}):e.jsx(J,{}):e.jsxs("div",{"data-slot":"profile-dock",className:"flex h-full min-h-0 flex-col overflow-hidden",children:[e.jsx($,{member:o,roster:l??[],home:"docked",inOwnSession:s===f.agentPath&&o.id===n.id,stack:a,onPush:y,onPop:A}),e.jsx(B,{open:w,onKeep:()=>{h(!1),E(!0)},onDiscard:()=>{h(!1),m()}})]}):e.jsx(G,{})}export{Z as AccountMenu,ee as AccountMenuContainer,se as PROFILE_PANEL_ID,W as ProfileDock,te as ProfilePanel,ne as ProfilePanelContainer,ae as ProfileSheet,le as ProfileSheetContainer,$ as ProfileView,oe as handleErrorMessage,re as identityLinkErrorMessage,q as profileStack,ie as useLegacyProfileLinkRedirect,ce as useProfileDockDeepLink,de as useProfileShortcut,v as useProfileStore,ue as useSetIdentityLinkedToMe};
@@ -1,7 +0,0 @@
1
- import{e3 as we,fY as re,aY as W,ef as le,z as U,r as l,fZ as ke,f_ as z,f$ as H,g0 as S,e8 as oe,g1 as J,g2 as q,cV as Ee,g3 as Re,by as je,g4 as Ne,A as V,g5 as De,g6 as Te,ew as Se,g7 as Oe,af as se,g8 as Fe,j as t,aD as ce,ak as de,aP as _e,C as Pe,g9 as Me,da as ue,ga as Le,fc as he,fh as Ae,aj as ae,gb as fe,gc as pe,gd as Ie,eD as ze,eE as Ke,eF as He,eG as K,eH as B,dp as $e,B as Y,dF as Ye,dG as Qe,dH as Ue,dI as qe,dJ as Be,dK as We,dL as Ge,dM as Ve,fn as Xe,ge as Ze,ah as X,gf as me,gg as Je,aX as et,gh as tt,gi as nt,gj as st,gk as at,ee,gl as xe,D as rt,aN as ot,gm as it,gn as lt}from"./index-BMR65QI4.js";import{p as ct,F as dt,w as ut,c as ht}from"./room-files-source-BXF5daqI.js";import{N as Xt,R as Zt}from"./room-files-source-BXF5daqI.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=U(),{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]),D=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(L=>L.path===r.path?y:L));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),L={...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,L]);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),L=N?{...N,name:C,path:w}:ie(w,C,r.isDir?"dir":"file");i.setChildren(d,u=>[...u,L])}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:D,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=U(),{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=U(),n=V(),{setTheme:m}=De(),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,...Te(x)],[x]),E=Se({queries:e?i.map(c=>ye(e,c,p,n)):[]}),D=(e==null?void 0:e.filtersHidden)??!0,b=l.useMemo(()=>{const c={};return i.forEach((k,F)=>{var Q;const A=E[F];let I=((Q=A==null?void 0:A.data)==null?void 0:Q.entries)??[];!p&&!D&&(I=xt(I)),k===z&&(I=gt(I)),c[k]={entries:I,loading:(A==null?void 0:A.isLoading)??!1,error:(A==null?void 0:A.isError)??!1}}),c},[i,E,p,D]),M=l.useRef(0),_=l.useRef({});l.useEffect(()=>{M.current>0||i.forEach((c,k)=>{var A,I,Q;const F=(I=(A=E[k])==null?void 0:A.data)==null?void 0:I.entries;!F||(Q=E[k])!=null&&Q.isError||_.current[c]!==F&&(_.current[c]=F,a(c,F.map(T=>T.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}),L=Rt(v);return{rows:O,rootLoading:P,rootError:R,errorPaths:r,toggleExpand:d,ensureExpanded:g,openFile:w,reload:j,retryDir:y,...N,...L}}function Dt(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 Tt=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:D,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:L,loading:u}=e,o=y.type==="dir",c=o?y.path:H(y.path),[k,F]=l.useState(!1),A=!o&&N===0&&ne(y.name),I=ct(y.lastCommit),Q=t.jsxs("div",{role:"treeitem","aria-label":y.name,"aria-expanded":o?L:void 0,"aria-selected":s,tabIndex:-1,onKeyDown:T=>{(T.key==="Enter"||T.key===" ")&&(T.preventDefault(),p(y),x(y))},draggable:!n&&!w,onDragStart:T=>{w||(T.dataTransfer.setData("text/plain",y.path),T.dataTransfer.setData(Ie,y.path),T.dataTransfer.effectAllowed="copyMove")},onDragOver:T=>{T.stopPropagation(),!(w||!o||!pe(T.dataTransfer.types))&&(T.preventDefault(),T.dataTransfer.dropEffect=T.altKey?"copy":"move",F(!0))},onDragLeave:()=>F(!1),onDrop:T=>{if(T.stopPropagation(),w||!o)return;F(!1);const Z=fe(T.dataTransfer);Z!==null&&(T.preventDefault(),T.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*Tt+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:T=>{T.stopPropagation(),h()},className:"flex items-center justify-center",children:t.jsx(de,{className:"text-destructive size-3.5"})}):L?t.jsx(_e,{className:"text-muted-foreground size-3.5"}):t.jsx(Pe,{className:"text-muted-foreground size-3.5"}))}),o?L?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(Le,{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:T=>a(y,T),onCancel:f}):t.jsx("span",{className:"min-w-0 flex-1 truncate",children:y.name}),A&&!n&&t.jsx(Ae,{"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?Q:t.jsxs(ze,{children:[t.jsx(Ke,{asChild:!0,children:Q}),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(B,{}),r&&t.jsx(K,{onClick:()=>d(y),children:r}),t.jsx(K,{movesFocus:!0,onClick:()=>g(y),children:"Add to chat"}),t.jsx(B,{}),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(B,{}),t.jsx(K,{onClick:()=>C(y,"absolute"),children:"Copy path"}),t.jsx(K,{onClick:()=>C(y,"relative"),children:"Copy relative path"}),t.jsx(B,{}),t.jsx(K,{onClick:()=>E(y),children:"Rename"}),t.jsx(K,{variant:"destructive",onClick:()=>D(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=At(e,i),D=s.length>Ft,b=$e({count:s.length,getScrollElement:()=>a.current,estimateSize:()=>_t,overscan:12,enabled:D}),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}D?b.scrollToOffset(k):c.scrollTop=k,_.current=c.scrollTop,c.scrollTop>=k&&(o.done=!0)},[s.length,v,D,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,A;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&&(D?b.scrollToIndex(c,{align:"auto"}):(A=(F=k.querySelector(`[data-row-index="${c}"]`))==null?void 0:F.scrollIntoView)==null||A.call(F,{block:"nearest"}),_.current=k.scrollTop)},[n,s,D,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]),L=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:L,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:D?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 Lt(e){return e?e.type==="dir"?e.path:H(e.path):z}function At(e,s){const{rows:n,selectedPath:m,renamingPath:p,onSelectPath:x}=e;return l.useCallback(h=>{var v,i,E,D;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(Lt(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)??((D=n[0])==null?void 0:D.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 L;const n=U(),m=se(u=>u.selectedCwd),p=l.useMemo(()=>m?Dt({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,D=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 D({newFile:()=>j.current.startCreate(z,"file"),newFolder:()=>j.current.startCreate(z,"dir"),refresh:()=>j.current.reload()}),()=>D(null)},[D,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(Qe,{children:[t.jsxs(Ue,{children:[t.jsx(qe,{children:"Delete this folder?"}),t.jsxs(Be,{children:["“",(L=a.pendingRecursiveDelete)==null?void 0:L.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=U(),{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 Bt(){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=U(),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 Qt({roomId:e}){var O,P;const s=U(),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 D=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:D?`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."})]})]}),!D&&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=U(),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(Qt,{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,Bt 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,Dt 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};