dorkos 0.82.0 → 0.87.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (118) hide show
  1. package/README.md +11 -0
  2. package/dist/bin/cli.js +12725 -4763
  3. package/dist/client/assets/{AboutPage-WmtNTKyp.js → AboutPage-BSUaz4JJ.js} +1 -1
  4. package/dist/client/assets/{AppearancePage-D7ZHuThu.js → AppearancePage-CXOeapnY.js} +1 -1
  5. package/dist/client/assets/{BaseTanStackRouterDevtoolsPanel-B-iktbLX-wUJCR3vL.js → BaseTanStackRouterDevtoolsPanel-B-iktbLX-BnlmhnMf.js} +1 -1
  6. package/dist/client/assets/{BlintzCanvas-BXKUjnNQ.js → BlintzCanvas-CPvaejf6.js} +23 -23
  7. package/dist/client/assets/{CanvasCsvContent-BLAtnhdQ.js → CanvasCsvContent-BQMcLeXX.js} +1 -1
  8. package/dist/client/assets/CanvasFileContent-DZAWEzyp.js +2 -0
  9. package/dist/client/assets/CanvasModel3dContent-CU-0WLIz.js +2 -0
  10. package/dist/client/assets/{CodeMirrorDiff-Cpi43Atp.js → CodeMirrorDiff-B705Z174.js} +1 -1
  11. package/dist/client/assets/{CodeMirrorEditor-CviERH82.js → CodeMirrorEditor-CnoVRaAX.js} +1 -1
  12. package/dist/client/assets/ConnectionAccessLists-CLulSQsd.js +1 -0
  13. package/dist/client/assets/ConnectionsPage-5Yc0-dNp.js +1 -0
  14. package/dist/client/assets/{ConventionPage-Coim_h2z.js → ConventionPage-CPTqeeNZ.js} +3 -3
  15. package/dist/client/assets/{FloatingTanStackRouterDevtools-CqogiFob-lqp1rgj8.js → FloatingTanStackRouterDevtools-CqogiFob-C3cf2ADt.js} +1 -1
  16. package/dist/client/assets/HandlePage-CUJPQsdv.js +1 -0
  17. package/dist/client/assets/{LexicalField-DPe-aAXb.js → LexicalField-ClgIzBq7.js} +1 -1
  18. package/dist/client/assets/{ManagesPage-BZS2TdZL.js → ManagesPage-CKzcFzKR.js} +1 -1
  19. package/dist/client/assets/{Model3dViewer-qs0tZlVU.js → Model3dViewer-CVVsdftR.js} +1 -1
  20. package/dist/client/assets/NamePage-CYHYXhrs.js +1 -0
  21. package/dist/client/assets/{NotificationsPage-gmiItsT0.js → NotificationsPage-D3m6Jrm2.js} +1 -1
  22. package/dist/client/assets/PermissionsPage-CviWqCJ3.js +1 -0
  23. package/dist/client/assets/{PersonalityPopover-Dej6dI7y.js → PersonalityPopover-BN1CFq8D.js} +1 -1
  24. package/dist/client/assets/PhotoPage-ytqVZP3t.js +1 -0
  25. package/dist/client/assets/{RoomsPage-3_HuXajd.js → RoomsPage-CoZd-4Xe.js} +1 -1
  26. package/dist/client/assets/RunsOnPopover-91nKS6qj.js +1 -0
  27. package/dist/client/assets/SessionsPage-DDrQLNW-.js +6 -0
  28. package/dist/client/assets/SkillsPage-2H6QD77F.js +1 -0
  29. package/dist/client/assets/TasksPage-ocRUPiec.js +1 -0
  30. package/dist/client/assets/ToolsPage-q3wxIc3n.js +2 -0
  31. package/dist/client/assets/{TopologyGraph-C-BTnRXU.js → TopologyGraph-DeRqfLBW.js} +2 -2
  32. package/dist/client/assets/{agent-browser-DT3ABR4l.js → agent-browser-C7Q5muxI.js} +1 -1
  33. package/dist/client/assets/{highlighted-body-KPVGNVTW-CVFODbIg.js → highlighted-body-KPVGNVTW-CYowLe07.js} +1 -1
  34. package/dist/client/assets/{index-ClnyhFUL.js → index-1dt_mWBC.js} +1 -1
  35. package/dist/client/assets/{index-DiFG9bwF.js → index-34_CucI4.js} +1 -1
  36. package/dist/client/assets/{index-DGr90Ygi.js → index-6F4HxV-x.js} +1 -1
  37. package/dist/client/assets/{index-CgakJfik.js → index-B029XwR8.js} +1 -1
  38. package/dist/client/assets/index-B4TIVWAq.js +1668 -0
  39. package/dist/client/assets/index-BUcM96PD.css +1 -0
  40. package/dist/client/assets/{index-ClmokM0M.js → index-BX9en7bH.js} +1 -1
  41. package/dist/client/assets/{index-BZaMgVdg.js → index-BeqTVkgE.js} +1 -1
  42. package/dist/client/assets/index-BkFaL4dr.js +1 -0
  43. package/dist/client/assets/index-Bv_P5_tJ.js +1 -0
  44. package/dist/client/assets/{index-Dh-3NGE9.js → index-BwbRY8dK.js} +1 -1
  45. package/dist/client/assets/{index-B3P6TTvD.js → index-BzVyUKXW.js} +3 -3
  46. package/dist/client/assets/{index-B8oHvyN5.js → index-C0oow5Fn.js} +1 -1
  47. package/dist/client/assets/{index-DN8DYUEX.js → index-CCLVR1so.js} +1 -1
  48. package/dist/client/assets/{index-J8BMKg6y.js → index-CEw2JwVz.js} +1 -1
  49. package/dist/client/assets/{index-DIkpB_1y.js → index-CKHPMgwE.js} +1 -1
  50. package/dist/client/assets/{index-Dm6W0lml.js → index-CbxbAPgT.js} +1 -1
  51. package/dist/client/assets/{index-D_gnDrw3.js → index-Cm0G2vDh.js} +1 -1
  52. package/dist/client/assets/{index-DiFc1nSZ.js → index-CpZi173j.js} +1 -1
  53. package/dist/client/assets/index-CqfEH_t6.js +1 -0
  54. package/dist/client/assets/index-CuEwCZKH.js +17 -0
  55. package/dist/client/assets/{index-Cca_q1vW.js → index-CvQeke9n.js} +9 -9
  56. package/dist/client/assets/{index-BuU7EEtP.js → index-CxZB8Cqj.js} +1 -1
  57. package/dist/client/assets/{index-DjY4p5H5.js → index-D45q57-5.js} +1 -1
  58. package/dist/client/assets/{index-kzr7_3di.js → index-D8fmSjjO.js} +11 -11
  59. package/dist/client/assets/{index-W25uMuZA.js → index-DDagpuEn.js} +1 -1
  60. package/dist/client/assets/{index-DbsvSNI-.js → index-DT3ci-3h.js} +1 -1
  61. package/dist/client/assets/{index-nEQI8fB2.js → index-D_Pj9S7y.js} +1 -1
  62. package/dist/client/assets/{index-DF5k9E7k.js → index-Da-4WWcu.js} +1 -1
  63. package/dist/client/assets/{index-PrqHZbD1.js → index-DsRm4kZF.js} +1 -1
  64. package/dist/client/assets/{index-CaZw0EC7.js → index-GiEn7nQQ.js} +1 -1
  65. package/dist/client/assets/{index-ByCzVYkU.js → index-SGZRUhq4.js} +1 -1
  66. package/dist/client/assets/index-VLhj4QNP.js +1 -0
  67. package/dist/client/assets/index-otf5JgVx.js +1 -0
  68. package/dist/client/assets/{index-lciid4H8.js → index-qWahGPGi.js} +1 -1
  69. package/dist/client/assets/{index-BrgOWbRQ.js → index-sMuUIc_W.js} +2 -2
  70. package/dist/client/assets/{index-DgjZhEr3.js → index-snpaQsNQ.js} +1 -1
  71. package/dist/client/assets/room-files-source-C3tzeG6y.js +6 -0
  72. package/dist/client/assets/{soul-file-BHeAw6R9.js → soul-file-tc6-HkDy.js} +1 -1
  73. package/dist/client/assets/{use-personality-commit-DyJAMzzb.js → use-personality-commit-vpAu5T8A.js} +1 -1
  74. package/dist/client/index.html +6 -5
  75. package/dist/drizzle/0107_productive_peter_parker.sql +5 -0
  76. package/dist/drizzle/0108_magical_morph.sql +2 -0
  77. package/dist/drizzle/0109_aspiring_union_jack.sql +5 -0
  78. package/dist/drizzle/0110_ambiguous_wendigo.sql +1 -0
  79. package/dist/drizzle/0111_community_redaction_cursor.sql +11 -0
  80. package/dist/drizzle/0112_account_drop_issuer.sql +18 -0
  81. package/dist/drizzle/0113_room_departed_seats.sql +14 -0
  82. package/dist/drizzle/0114_schedule_account.sql +1 -0
  83. package/dist/drizzle/0115_furry_starjammers.sql +1 -0
  84. package/dist/drizzle/meta/0107_snapshot.json +8966 -0
  85. package/dist/drizzle/meta/0108_snapshot.json +8980 -0
  86. package/dist/drizzle/meta/0109_snapshot.json +8987 -0
  87. package/dist/drizzle/meta/0110_snapshot.json +8994 -0
  88. package/dist/drizzle/meta/0111_snapshot.json +9062 -0
  89. package/dist/drizzle/meta/0112_snapshot.json +9055 -0
  90. package/dist/drizzle/meta/0113_snapshot.json +9147 -0
  91. package/dist/drizzle/meta/0114_snapshot.json +9154 -0
  92. package/dist/drizzle/meta/0115_snapshot.json +9146 -0
  93. package/dist/drizzle/meta/_journal.json +63 -0
  94. package/dist/server/index.js +103645 -79264
  95. package/dist/server/index.js.map +2 -2
  96. package/package.json +7 -9
  97. package/dist/client/assets/CanvasFileContent-VogEwZeM.js +0 -2
  98. package/dist/client/assets/CanvasModel3dContent-DCTC7eOc.js +0 -2
  99. package/dist/client/assets/ConnectionAccessLists-Be1b30nn.js +0 -1
  100. package/dist/client/assets/ConnectionsPage-BVN7GiuC.js +0 -1
  101. package/dist/client/assets/HandlePage-DnzPN8N_.js +0 -1
  102. package/dist/client/assets/NamePage-DyWqRDIe.js +0 -1
  103. package/dist/client/assets/PhotoPage-GtCoB8dK.js +0 -1
  104. package/dist/client/assets/RunsOnPopover-DbSoBFaL.js +0 -1
  105. package/dist/client/assets/SessionsPage-Dc_lqBom.js +0 -6
  106. package/dist/client/assets/SkillsPage-C0qMUkgs.js +0 -1
  107. package/dist/client/assets/TasksPage-DvzTPDnw.js +0 -1
  108. package/dist/client/assets/ToolsPage-Cwc96TTa.js +0 -2
  109. package/dist/client/assets/index-BUxNND2H.js +0 -1
  110. package/dist/client/assets/index-C08DUVQ4.css +0 -1
  111. package/dist/client/assets/index-CGqPFWQw.js +0 -1
  112. package/dist/client/assets/index-CN1plkKF.js +0 -1
  113. package/dist/client/assets/index-CXWMnEDK.js +0 -1
  114. package/dist/client/assets/index-DDXrdlj0.js +0 -1648
  115. package/dist/client/assets/index-DEA1uIWn.js +0 -1
  116. package/dist/client/assets/index-PRwgIfzy.js +0 -7
  117. package/dist/client/assets/room-files-source-CSKgcbkn.js +0 -11
  118. package/dist/client/assets/use-mesh-update-BP_UXq60.js +0 -1
@@ -1,4 +1,4 @@
1
1
  [diffend] Oversized file quarantined before diffing.
2
2
  name: package/dist/server/index.js.map
3
- size: 38618451 bytes
4
- sha256: dfd9e7ab107eac3f9a3306db38c0612160db7d1843f3988c160f907d4cd5680b
3
+ size: 40973823 bytes
4
+ sha256: 92b5a85b6ea46cfb264e1b4c7a9b22339e4925ad63f0c8b201a2a896bd38a9ce
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dorkos",
3
- "version": "0.82.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",
@@ -68,7 +67,6 @@
68
67
  "dotenv": "^17.4.2",
69
68
  "esbuild": "^0.28.2",
70
69
  "express": "^5.2.1",
71
- "gray-matter": "^4.0.3",
72
70
  "node-pty": "^1.1.0",
73
71
  "qrcode-terminal": "^0.12.0",
74
72
  "uuid": "^13.0.2",
@@ -76,21 +74,21 @@
76
74
  "zod": "^4.6.2"
77
75
  },
78
76
  "devDependencies": {
79
- "@better-auth/api-key": "1.7.2",
80
- "@better-auth/core": "1.7.2",
81
- "@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",
82
80
  "@types/better-sqlite3": "^7.6.13",
83
81
  "@types/qrcode-terminal": "^0.12.2",
84
- "better-auth": "1.7.2",
82
+ "better-auth": "1.7.5",
85
83
  "tsx": "^4.23.13",
86
84
  "typescript": "^5.9.3",
87
85
  "vitest": "^4.1.11",
88
86
  "@dorkos/db": "0.0.0",
89
- "@dorkos/eslint-config": "0.0.0",
90
87
  "@dorkos/harness": "0.0.0",
91
- "@dorkos/marketplace": "0.0.0",
88
+ "@dorkos/eslint-config": "0.0.0",
92
89
  "@dorkos/server": "0.0.0",
93
90
  "@dorkos/shared": "0.0.0",
91
+ "@dorkos/marketplace": "0.0.0",
94
92
  "@dorkos/typescript-config": "0.0.0",
95
93
  "@dorkos/client": "0.0.0"
96
94
  },
@@ -1,2 +0,0 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/CodeMirrorEditor-CviERH82.js","assets/index-DDXrdlj0.js","assets/index-C08DUVQ4.css","assets/index-DGr90Ygi.js","assets/index-B3P6TTvD.js","assets/BlintzCanvas-BXKUjnNQ.js","assets/BlintzCanvas-GgiCXV7C.css"])))=>i.map(i=>d[i]);
2
- import{w as A,ac as b,ad as D,ae as B,r as n,j as t,x as M,af as Q,ag as q,B as y,ah as H,ai as K,aj as V,ak as P}from"./index-DDXrdlj0.js";const $=n.lazy(()=>P(()=>import("./CodeMirrorEditor-CviERH82.js"),__vite__mapDeps([0,1,2,3,4])).then(e=>({default:e.CodeMirrorEditor}))),U=n.lazy(()=>P(()=>import("./BlintzCanvas-BXKUjnNQ.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=A(),l=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:_(l,e.sourcePath),enabled:l!==null,queryFn:()=>m.readFileContent(l,e.sourcePath),staleTime:3e4,retry:!1}),[u,v]=n.useState(null),p=r=>{v(r&&c?{pinnedHash:c.hash}:null)};if(l===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 o=u!==null&&a,s=(o?u==null?void 0:u.pinnedHash:null)??c.hash;return t.jsx(W,{content:e,documentId:i,cwd:l,loaded:c.content,theme:h,isEditing:o,onEditingChange:p,setDocumentEditing:C},`${e.sourcePath}:${s}`)}function W({content:e,documentId:i,cwd:m,loaded:l,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(l),o=Q({sourcePath:e.sourcePath,cwd:m,loadedContent:l}),s=n.useRef(null),r=n.useRef(v),d=n.useRef(o.save),j=n.useRef(h);n.useEffect(()=>{r.current=v,d.current=o.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)},[]),z=()=>{p(l),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=o.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=o.adoptDisk();f!=null&&p(f)},F=()=>{o.overwrite(r.current)},w=J(o.status),E=a?v:l;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",o.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():z,"aria-label":a?"Finish editing":"Edit file",children:a?t.jsx(K,{className:"size-4"}):t.jsx(V,{className:"size-4"})})]}),o.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:F,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:E,editable:a,onChange:a?k:void 0})}):t.jsx($,{value:E,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-qs0tZlVU.js","assets/index-DDXrdlj0.js","assets/index-C08DUVQ4.css"])))=>i.map(i=>d[i]);
2
- import{w as u,ac as d,r as l,al as i,j as t,ak as f}from"./index-DDXrdlj0.js";const c=l.lazy(()=>f(()=>import("./Model3dViewer-qs0tZlVU.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{a6 as g,j as e,a as u,a7 as p,B as d,a8 as x,a9 as j,aa as m,ab as f}from"./index-DDXrdlj0.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 n;const a=g(i);if(a.isPending)return e.jsx(u,{className:"h-24 w-full rounded-lg"});if(a.isError)return e.jsx(p,{title:"Couldn’t load account access",description:"No access details were changed. Try again.",onRetry:()=>void a.refetch(),isRetrying:a.isFetching});const r=((n=a.data)==null?void 0:n.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:a,footer:r}){var o;const n=f(i);if(n.isPending)return e.jsx(u,{className:"h-16 w-full rounded-lg"});if(n.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 n.refetch(),children:"Try again"})]});const s=((o=n.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."})]}),a]}):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{w as G,y as H,r,dp as K,aB as Z,j as e,dq as F,ag as I,dr as M,ds as J,aa as L,cm as Q,cn as X,co as Y,dt as ee,du as se,B,dv as ae,dw as te,dx as R,aA as ne,dy as ie,dz as _,dA as re,dB as de,dC as ce,dD as oe,dE as le,dF as me,dG as ue,dH as xe,dI as pe,dJ as ge,dK as he,dL as fe,dM as je,P as ye,dN as ve,dO as Ne,dP as Ce,dQ as be,dR as Te,dS as Ie,dT as we,dU as Ae,dV as W,aV as N,dW as Se,dX as ke,dY as De,dZ as Re,d_ as Pe,d$ as $,u as Me,a as Be}from"./index-DDXrdlj0.js";import{A as Ee}from"./ConnectionAccessLists-Be1b30nn.js";import"./agent-browser-DT3ABR4l.js";function ze(){const t=G();return H({mutationFn:i=>t.testBinding(i),meta:{errorLabel:"Test failed"}})}const Oe={connected:M.connected,disconnected:J.warning,error:M.error,connecting:M.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 E=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 ${Z(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:E}),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(Q,{children:[e.jsx(X,{asChild:!0,children:e.jsx(L,{variant:"outline",children:"Restricted"})}),e.jsx(Y,{children:z})]}),e.jsxs(ee,{children:[e.jsx(se,{asChild:!0,children:e.jsxs(B,{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(B,{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]",M[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,V=T==="connected"||T==="error"?T:T==="starting"||T==="stopping"||T==="reconnecting"?"connecting":"disconnected";s.set(b.id,{state:V,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})},[]),E=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(B,{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:()=>E(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(B,{variant:"outline",size:"sm",onClick:()=>f("messaging"),children:"Open Messaging settings"})]}),C]})}function Ve({member:t}){const{agent:i,isPending:y}=Me(t),l=W();return y?e.jsx(Be,{className:"h-32 w-full"}):i?e.jsxs("div",{className:"space-y-6",children:[e.jsx(Ee,{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{Ve as ConnectionsPage};
@@ -1 +0,0 @@
1
- import{j as r,i}from"./index-DDXrdlj0.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-DDXrdlj0.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-DDXrdlj0.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,aK as ie,cl as de,J as ue,ag as j,cL as Q,cM as Z,cN as q,cO as G,cP as F,cQ as fe,cR as ee,cS as pe,cT as te,cU as me,cV as xe,cW as Y,cX as he,cY as be,cZ as T,c_ as je,c$ as E,d0 as ge,d1 as se,aM as ve,u as Ne,a as Se,d2 as Ee,d3 as Ce,d4 as ke,d5 as ye,d6 as we,d7 as Ae}from"./index-DDXrdlj0.js";import{u as Te}from"./use-mesh-update-BP_UXq60.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":i}){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?Q.warning:Q.neutral,s&&"hover:bg-accent hover:text-accent-foreground transition-colors",a),"data-testid":i,children:[r&&e.jsx(ie,{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(Z,{open:f,onOpenChange:m,children:[e.jsx(q,{asChild:!0,children:e.jsx("button",{type:"button","aria-label":`Set here${r?`: ${r}`:""}`,children:p})}),e.jsxs(G,{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":i?`${i}-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:i,warning:f,onSelect:m,onInherit:o,testId:s,showHeader:p=!0,className:k,describedBy:h}){const S=ee(),[b,c]=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:i,warning:f,onUseServerDefault:o,"data-testid":`${s}-chip`})]}),e.jsxs(Z,{open:b,onOpenChange:c,children:[e.jsx(q,{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(ve,{className:"text-muted-foreground ml-auto size-3.5 shrink-0"})]})}),e.jsxs(G,{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),c(!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(),c(!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:i?`Using server default: ${i}. Tap to restore`:"Use server default: the runtime picks"})]})]})]})}function Pe({agent:n,onUpdate:l,className:d}){var V,z,W,B,X,J;const r=ee(),{data:a}=pe(),{data:i,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,c=b?(p??[]).find(t=>t.value===b):void 0,u=(s==null?void 0:s.supportsEffort)??((W=xe(i,o))==null?void 0:W.supportsEffort),L=u===void 0&&f,I=u!==!1,P=c?c.supportsEffort??!1:void 0,g=(B=a==null?void 0:a.claudeCode)==null?void 0:B.accounts,x=g==null?void 0:g.flatMap(t=>t.id===null?[]:[{id:t.id,label:Y(t.path,g),path:t.path}]),v=n.account??null,$=v!==null,O=a!=null&&a.claudeCode?Y(a.claudeCode.resolvedAccount,g??[]):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 K;return((K=le.breakages.find(ce=>t.includes(ce.kind)))==null?void 0:K.message)??null},y=!L&&I&&P!==!1,M=n.effort??(s==null?void 0:s.effort)??null,_=T(o).label,oe=o==="claude-code"&&x!==void 0&&(x.length>1||$),re=N(["account-unregistered"]),D=(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:(c==null?void 0:c.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:D?R:void 0}),D&&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 ${_} supports`,warning:null}):I?y?e.jsx(w,{label:"Effort",valueLabel:E(M),options:ge.filter(t=>!(c!=null&&c.supportedEffortLevels)||c.supportedEffortLevels.includes(t)).map(t=>({value:t,label:E(t)})),selected:M,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 ${_}`,warning:N(["effort-unsupported-runtime"])})]}),oe&&e.jsx(w,{label:"Account",valueLabel:v!==null?((J=x==null?void 0:x.find(t=>t.id===v))==null?void 0:J.label)??v:O??"Default account",options:(x??[]).map(t=>({value:t.id,label:t.label,hint:se(t.path)})),selected:v,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:i}=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=i?Object.keys(i.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{e0 as ie,er as re,es as oe,w as D,r as d,et as le,eu as ce,ev as ue,ew as de,bd as P,ex as me,ey as xe,ez as pe,eA as fe,j as e,eB as ge,eC as he,eD as je,eE as z,aj as F,eF as ve,eG as T,cl as be,J as w,eH as ye,eI as Ne,bB as N,cZ as O,eJ as Ce,ag as S,eK as V,eL as we,cm as R,cn as M,co as A,eM as $,aB as K,eN as B,eO as Se,eP as _,aM as ke,eQ as G,eR as W,eS as L,eT as Re,eU as Me,eV as Ae,b1 as Pe,au as Le,eW as Te,av as Ie,aw as ze,ax as Ee,ay as De,eX as Fe,e as Oe,x as Ve,eY as $e,eZ as Ke,a as Be,e_ as _e,I as Ge,e$ as We,f0 as Qe,aV as qe}from"./index-DDXrdlj0.js";/**
2
- * @license lucide-react v1.44.0 - ISC
3
- *
4
- * This source code is licensed under the ISC license.
5
- * See the LICENSE file in the root directory of this source tree.
6
- */const 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 Z(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 J({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(z,{onClick:s,children:[e.jsx(F,{className:"mr-2 size-4"}),"Rename"]}),s&&a&&e.jsx(ve,{}),a&&e.jsxs(z,{onClick:a,children:[e.jsx(q,{className:"mr-2 size-4"}),"Fork session"]})]})]})}const C="font-mono select-all";function E(t){try{return new Date(t).toLocaleString([],{month:"short",day:"numeric",year:"numeric",hour:"2-digit",minute:"2-digit"})}catch{return t}}function Ze({session:t,expanded:s,onFork:a,className:n}){var m;const{permissionMode:i,isFullPower:l}=Z(t),r=l?"Full power":we(i),{nameFor:c}=T(),u=t.account?c(t.account):null;return e.jsx(be,{initial:!1,children:s&&e.jsx(w.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:S("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:E(t.createdAt)}),e.jsx(N,{label:"Updated",align:"start",valueClassName:C,children:E(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:S(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 X({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(M,{asChild:!0,children:e.jsx("span",{"aria-label":`Account: ${i}`,className:S("text-3xs max-w-24 shrink-0 truncate",s),children:i})}),e.jsx(A,{side:"top",sideOffset:4,children:t})]})}function Je({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}=Z(t),y=$(6e4),o=d.useMemo(()=>K(t.updatedAt),[t.updatedAt,y]),p=B(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:I}=Ye({isNew:l,borderState:p});return e.jsx(R,{children:e.jsxs(w.div,{"data-testid":"session-row",initial:ae,animate:te,transition:se,"data-pulsing":I?"true":"false",style:I?void 0:{borderLeftColor:p.color},className:S("group relative rounded-lg border-l-2 transition-colors duration-150",s?"text-foreground":"hover:bg-secondary/60"),children:[s&&e.jsx(w.div,{layoutId:"active-session-bg",className:"bg-secondary absolute inset-0 rounded-lg",transition:{type:"spring",stiffness:280,damping:32}}),e.jsx(J,{onRename:i?x:void 0,onFork:n?()=>n(t.id):void 0,children:e.jsx(M,{asChild:!0,disabled:p.kind==="idle",children:e.jsxs(w.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(Se,{session:t}),p.kind==="pendingApproval"&&e.jsx(_,{className:"size-(--size-icon-xs) text-amber-500","aria-label":"Awaiting your approval"}),b&&e.jsx(Xe,{}),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:S("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(w.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(X,{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(A,{side:"right",sideOffset:8,children:p.label}),e.jsx(Ze,{session:t,expanded:r,className:"border-border/30 border-t",...n?{onFork:n}:{}})]})})}function Xe(){return e.jsxs(R,{children:[e.jsx(M,{asChild:!0,children:e.jsx("button",{type:"button",className:"inline-flex cursor-help","aria-label":Re,onClick:t=>t.stopPropagation(),children:e.jsx(Me,{className:`size-(--size-icon-xs) ${V.power}`})})}),e.jsx(A,{side:"top",sideOffset:4,children:"This chat runs commands without stopping for approval."})]})}function Ye({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=B(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(J,{onRename:i?m:void 0,onFork:n?()=>n(t.id):void 0,children:e.jsx(M,{asChild:!0,children:e.jsxs("button",{type:"button","data-testid":"session-row",onClick:a,className:S("flex w-full items-center gap-2 rounded-md px-2.5 py-1.5 text-left text-xs",Ae,s?"bg-secondary text-foreground":"text-muted-foreground hover:bg-accent hover:text-foreground"),children:[e.jsx(w.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(_,{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(X,{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(A,{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(Je,{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 Y(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-${Y(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},Y(c)))}),e.jsx(st,{}),e.jsx(w.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(Ie,{children:[!u&&e.jsx(ze,{className:"text-2xs text-muted-foreground/70 font-medium tracking-wider uppercase",children:c.label}),e.jsx(Ee,{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(Be,{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(_e,{"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{w as b,ae as B,ei as p,ej as g,x as w,y as A,aV as z,ek as M,j as e,el as O,r as d,aM as E,ag as N,B as j,aK as I,cL as y,em as C,dC as q,dD as K,dE as W,dF as Q,dG as U,dH as G,dI as J,dJ as Y,e as H,en as L,eo as V,aO as X,a as $,ep as Z,eq as R,aa as P}from"./index-DDXrdlj0.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(E,{"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(E,{"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(J,{children:"Cancel"}),e.jsx(Y,{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 Ee({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=H();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(He,{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(L,{"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(V,{htmlFor:o,className:"text-muted-foreground text-3xs",children:"Show every agent tool"}),e.jsx(X,{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 He({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(Z,{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 Le({group:s}){const[t,n]=d.useState(!1);return e.jsxs(R,{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 Re({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(Le,{group:a},a.harness))})}function Pe({entries:s}){const[t,n]=d.useState(!1);return s.length===0?null:e.jsx(R,{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=H(),{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(Ee,{projectPath:s,showBrowseLink:!1}),a&&e.jsx(Re,{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(L,{"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{an as F,ac as y,ao as U,ap as D,aq as L,ar as P,as as B,r as u,j as e,at as G,au as O,av as f,aw as j,ax as g,ay as k,az as N,aA as w,aB as R,aC as $,aD as X,aE as _,aF as q,aG as H,aH as V,aI as W}from"./index-DDXrdlj0.js";const J=5;function K({status:t}){switch(t){case"running":return e.jsx(w,{size:"xs",className:"text-status-info shrink-0"});case"completed":return e.jsx(V,{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(K,{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,p)=>(p.finishedAt??p.createdAt).localeCompare(i.finishedAt??i.createdAt)),{runningRuns:s,recentRuns:r.slice(0,J)}},[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(f,{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(f,{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(f,{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=W(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{w as ae,ae as We,y as me,x as V,fD as re,fE as Te,r as l,j as e,cr as T,cs as A,fF as Ae,B as f,P as Me,fG as he,eo as _,I as Z,d2 as Oe,d3 as Ee,d4 as Re,d5 as De,d6 as ee,fH as be,by as Je,fI as Ze,C as le,ag as Ne,fJ as ge,cm as B,cn as G,aa as ne,co as q,bB as K,aN as Xe,fK as ye,aA as ce,dt as es,du as ss,dv as ns,dw as ts,dx as oe,ah as as,dz as rs,aO as te,fL as is,f5 as os,fM as ls,fN as cs,ey as Pe,a as de,fO as ds,dP as us,fP as ms,fQ as hs,fR as pe,fS as X,fT as Se,fU as gs,fV as ps,fW as xs,u as fs}from"./index-DDXrdlj0.js";import{u as xe}from"./use-mesh-update-BP_UXq60.js";import{a as vs}from"./agent-browser-DT3ABR4l.js";function js(s,n){const t=ae();return We({queryKey:["mcp-config",s,n??null],queryFn:()=>t.getMcpConfig(s,{runtime:n??void 0}),enabled:!!s,staleTime:3e4})}function ze(s,n){s.invalidateQueries({queryKey:re.mcpServers(n)}),s.invalidateQueries({queryKey:["mcp-config"]})}function Ie(s){const n=ae(),t=V();return me({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"&&ze(t,a.agentId)}})}function Fe(){return Ie((s,n,t)=>s.addAgentMcpServer(n,t?{approvalToken:t}:void 0))}function bs(){return Ie((s,n,t)=>s.importAgentMcpServer(n,t?{approvalToken:t}:void 0))}function fe(s){const n=ae(),t=V();return me({mutationFn:({agentId:i,name:a})=>s(n,i,a),onSuccess:(i,{agentId:a})=>ze(t,a)})}function Ns(){return fe((s,n,t)=>s.removeAgentMcpServer(n,t))}function ys(){return fe((s,n,t)=>s.enableAgentMcpServer(n,t))}function Ss(){return fe((s,n,t)=>s.disableAgentMcpServer(n,t))}function Cs(){const s=ae();return me({mutationFn:({agentId:n,name:t})=>s.testAgentMcpServer(n,t)})}function ws({agentId:s,serverName:n,onDone:t}){const i=Te(s,n),{start:a}=i,r=l.useRef(!1);return l.useEffect(()=>{r.current||(r.current=!0,a())},[a]),e.jsx(T,{children:e.jsxs(A,{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(Ae,{flow:i,serverName:n,failedActions:e.jsxs(e.Fragment,{children:[e.jsx(f,{variant:"secondary",size:"sm",onClick:()=>i.start(),className:"focus-visible:ring-2",children:"Try again"}),e.jsx(f,{variant:"ghost",size:"sm",onClick:t,className:"focus-visible:ring-2",children:"Later"})]}),connectedActions:e.jsx(f,{variant:"ghost",size:"sm",onClick:t,className:"focus-visible:ring-2",children:"Done"})}),i.state.step!=="failed"&&i.state.step!=="connected"&&e.jsx(f,{variant:"ghost",size:"sm",onClick:t,className:"focus-visible:ring-2",children:"Later"})]})})}const ks=["stdio","http","sse"],Ts=/^[a-zA-Z0-9_-]+$/;function Ce(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 we(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 Ms({agentId:s,agentLabel:n,supportedTransports:t,onAdded:i,oauthDetectedFor:a=null}){const r=Fe(),[o,d]=l.useState(!1),[u,x]=l.useState(""),[p,m]=l.useState(t[0]??"stdio"),c=t.includes(p)?p:t[0]??"stdio",[j,v]=l.useState(""),[b,k]=l.useState(""),[N,P]=l.useState(""),[C,E]=l.useState(""),[z,M]=l.useState(""),[R,I]=l.useState(null),[O,F]=l.useState(null),[ie,Q]=l.useState(null),[$,H]=l.useState(null),U=Ts.test(u)&&u.length<=64,Y=c==="stdio"?j.trim().length>0:C.trim().length>0,h=U&&Y&&!r.isPending,y=l.useCallback(()=>c==="stdio"?{transport:"stdio",command:j.trim(),args:we(b),env:Ce(N)}:{transport:c,url:C.trim(),headers:Ce(z)},[c,j,b,N,C,z]),w=l.useCallback(()=>({agentId:s,name:u.trim(),connection:y()}),[s,u,y]),D=l.useCallback(()=>{d(!1),I(null),F(null),x(""),m(t[0]??"stdio"),v(""),k(""),P(""),E(""),M("")},[t]),je=l.useCallback(g=>{i({name:g.name,transport:g.connection.transport}),D()},[i,D]),W=l.useCallback((g,S)=>{const Ye=As(g,S.name);je(S),Ye&&Q(S.name)},[je]),qe=l.useCallback(async()=>{F(null);const g=w();try{const S=await r.mutateAsync({input:g});S.status==="approval_required"?I(S.approval):W(S,g)}catch(S){F(S instanceof Error?S.message:"Couldn’t add the server.")}},[r,w,W]),Ve=l.useCallback(async()=>{if(!R)return;F(null);const g=w();try{const S=await r.mutateAsync({input:g,approval:R});S.status==="ok"?W(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,W]),J=ie??(a&&a!==$?a:null),Qe=l.useCallback(()=>{H(J),Q(null)},[J]),He=l.useMemo(()=>[j.trim(),...we(b)].filter(Boolean).join(" "),[j,b]);return J?e.jsx(ws,{agentId:s,serverName:J,onDone:Qe}):o?R?e.jsx(T,{children:e.jsxs(A,{className:"space-y-3",children:[e.jsxs("div",{className:"flex items-start gap-2",children:[e.jsx(he,{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:c==="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:c==="stdio"?He:C.trim()}),O&&e.jsx("p",{className:"text-destructive text-xs",children:O}),e.jsxs("div",{className:"flex justify-end gap-2",children:[e.jsx(f,{variant:"ghost",size:"sm",onClick:()=>I(null),disabled:r.isPending,className:"focus-visible:ring-2",children:"Back"}),e.jsx(f,{size:"sm",onClick:Ve,disabled:r.isPending,className:"focus-visible:ring-2",children:r.isPending?"Adding…":"Confirm & add"})]})]})}):e.jsx(T,{children:e.jsxs(A,{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:u,onChange:g=>x(g.target.value),placeholder:"my-server","aria-invalid":u.length>0&&!U}),u.length>0&&!U&&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:c,onValueChange:g=>m(g),children:[e.jsx(Ee,{id:"mcp-transport",className:"w-full",children:e.jsx(Re,{})}),e.jsx(De,{children:t.map(g=>e.jsx(ee,{value:g,children:g},g))})]})]}),c==="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(be,{id:"mcp-env",value:N,onChange:g=>P(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(be,{id:"mcp-headers",value:z,onChange:g=>M(g.target.value),placeholder:"Authorization=Bearer …",rows:2,className:"font-mono text-xs"})]})]}),O&&e.jsx("p",{className:"text-destructive text-xs",children:O}),e.jsx(Je,{}),e.jsxs("div",{className:"flex justify-end gap-2",children:[e.jsx(f,{variant:"ghost",size:"sm",onClick:D,className:"focus-visible:ring-2",children:"Cancel"}),e.jsx(f,{size:"sm",onClick:qe,disabled:!h,className:"focus-visible:ring-2",children:"Continue"})]})]})}):e.jsxs(f,{variant:"outline",size:"sm",onClick:()=>d(!0),className:"focus-visible:ring-2",children:[e.jsx(Me,{className:"size-4"}),"Add server"]})}const Os={connected:"connected","needs-auth":"needs-sign-in",pending:"connecting",disabled:"off"},Es=["validation","invalid config","invalid configuration","missing required","command not found","enoent"];function ve(s){if(!s)return"cant-reach";const n=s.toLowerCase();return Es.some(t=>n.includes(t))?"setup-problem":"cant-reach"}function _e(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"?ve(r):o==="connected"&&a==="needs-auth"?"signed-in":o==="needs-auth"&&(a==="connected"||a==="pending")?"needs-sign-in":a?Os[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 Ps(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 zs(s){const{status:n,probe:t}=s;return n==="off"||!t||t.ok?n:t.needsAuth===!0?"needs-sign-in":ve(t.error)}const se={attention:0,working:1,elsewhere:2,off:3};function Is(s){return s==="off"?se.off:s==="needs-sign-in"||s==="cant-reach"||s==="setup-problem"?se.attention:se.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:_e(r.connection)}))}}),...i.map(r=>({name:r.name,band:se.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 Ks(){const s=Ze(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 Le={"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"}},Ls={"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 Ls[s]}function Us({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 Bs(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 Us(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 Gs(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 qs(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"},Hs={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."},Ys=[{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 $e(s){for(const n of Ys){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 Js="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 Zs(s,n){return s===null?Js:s==="plugin"&&n?`Comes with the ${n} plugin. Add it to manage it here.`:Hs[s]}const Xs=ge("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=ge("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=ge("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=Le[s];return e.jsxs(B,{children:[e.jsx(G,{asChild:!0,children:e.jsx("span",{className:sn({chip:nn[s]}),children:n.label})}),e.jsx(q,{children:n.tooltip})]})}function an({scope:s,pluginName:n}){return e.jsxs(B,{children:[e.jsx(G,{asChild:!0,children:e.jsx(ne,{size:"xs",tone:"neutral",variant:"secondary",className:"shrink-0 font-normal",children:s})}),e.jsx(q,{children:Ue(s,n)})]})}function Be({displayName:s,rawName:n,scope:t,pluginName:i,status:a,sentence:r,managed:o,toggle:d,actions:u,children:x,details:p,defaultDetailsOpen:m=!1}){const[c,j]=l.useState(m),v=l.useId(),b=Le[a].tone;return e.jsxs("div",{"data-mcp-server":n,className:Ne(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}),x,u&&e.jsx("div",{className:"mt-2 flex items-center gap-1",children:u}),p&&e.jsxs(e.Fragment,{children:[e.jsxs("button",{type:"button",onClick:()=>j(k=>!k),"aria-expanded":c,"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(le,{className:Ne("size-3 transition-transform",c&&"rotate-90"),"aria-hidden":!0}),"Details"]}),c&&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(le,{className:"size-3 -rotate-90","aria-hidden":!0}),"Collapse details"]})]})]})]})}const rn=3,L="text-muted-foreground/70";function on({tools:s}){const[n,t]=l.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(le,{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?qs(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:u,serverInfo:x,alsoUsedBy:p,error:m}){const c=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(K,{label:"Sign-in",align:"start",wrap:!0,labelClassName:L,children:e.jsxs("span",{className:"inline-flex items-start gap-1.5",children:[e.jsx(Xe,{className:"mt-0.5 size-3 shrink-0","aria-hidden":!0}),Gs({connection:s,authStatus:n,clientOrigin:t})]})}),c&&e.jsx(K,{label:"Source",align:"start",wrap:!0,labelClassName:L,children:c}),r!==o&&e.jsx(K,{label:"Raw id",align:"start",wrap:!0,labelClassName:L,children:e.jsx("code",{className:"text-2xs font-mono",children:r})}),x&&e.jsx(K,{label:"Server",align:"start",wrap:!0,labelClassName:L,children:x}),p&&e.jsx(K,{label:"Also used by",align:"start",wrap:!0,labelClassName:L,children:p}),typeof d=="number"&&e.jsx(K,{label:"Tools",align:"start",labelClassName:L,children:d}),u&&u.length>0&&e.jsx(on,{tools:u}),m&&e.jsx(K,{label:"Error",align:"start",wrap:!0,labelClassName:L,children:e.jsx("code",{className:"text-2xs font-mono break-all",children:m})})]})}function cn({flow:s,serverName:n}){return e.jsxs(e.Fragment,{children:[e.jsx(Ae,{flow:s,serverName:n,failedActions:e.jsxs(e.Fragment,{children:[e.jsx(f,{variant:"secondary",size:"sm",onClick:()=>s.start(),className:"focus-visible:ring-2",children:"Try again"}),e.jsx(f,{variant:"ghost",size:"sm",onClick:()=>s.reset(),className:"focus-visible:ring-2",children:"Dismiss"})]}),connectedActions:e.jsx(f,{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(f,{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:u,onRemove:x}){const p=Te(n,s.name),m=p.state.step==="connected",c=Ps({stamped:i,signedInNow:m,authStatus:s.authStatus,rosterUpdatedAt:a}),j=_e(s.connection),v=Ke({enabled:s.enabled,testedOk:(c==null?void 0:c.ok)===!0,signedInNow:m,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,P=Ds({statusKey:v,testResult:c,signedInNow:m})&&(p.state.step==="idle"||b),C=$e(s.name),E=c!=null&&c.ok?c.toolCount??null:p.state.toolCount,z=k?N:zs({status:N,probe:c}),M=Bs(z,{displayName:C.displayName,toolCount:E,justSignedIn:m}),R=k?"none":$s(z),I=Rs({connection:s.connection,authStatus:s.authStatus});return e.jsx(Be,{displayName:C.displayName,rawName:s.name,scope:"agent",pluginName:C.pluginName,status:N,sentence:M,managed:!0,toggle:e.jsx(te,{checked:s.enabled,onCheckedChange:O=>d(s.name,O),disabled:o,"aria-label":`Enable ${s.name}`}),actions:e.jsxs(e.Fragment,{children:[P&&e.jsxs(f,{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(ye,{className:"size-3.5","aria-hidden":!0}),"Sign in"]}),!P&&R==="try-again"&&e.jsxs(f,{variant:"outline",size:"sm",onClick:()=>u(s.name),disabled:r||o,"aria-label":`Try ${s.name} again`,className:"gap-1.5 focus-visible:ring-2",children:[r?e.jsx(ce,{size:"xs"}):null,"Try again"]}),!P&&R==="test"&&e.jsx(f,{variant:"outline",size:"sm",onClick:()=>u(s.name),disabled:r||o,className:"focus-visible:ring-2",children:r?e.jsx(ce,{size:"xs"}):"Test"}),e.jsxs(es,{children:[e.jsx(ss,{asChild:!0,children:e.jsx(f,{variant:"ghost",size:"sm","aria-label":`More actions for ${s.name}`,className:"ml-auto focus-visible:ring-2",children:e.jsx(ns,{className:"size-4","aria-hidden":!0})})}),e.jsxs(ts,{align:"end",children:[e.jsxs(oe,{onSelect:()=>u(s.name),disabled:r||o,children:[e.jsx(as,{className:"size-3.5","aria-hidden":!0}),"Test"]}),I&&e.jsxs(oe,{onSelect:()=>p.start(),disabled:o,children:[e.jsx(ye,{className:"size-3.5","aria-hidden":!0}),"Sign in again"]}),e.jsx(rs,{}),e.jsx(oe,{variant:"destructive",onSelect:()=>x(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:(c==null?void 0:c.ok)===!1?c.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 ve(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]=l.useState(null),[d,u]=l.useState(null),x=l.useCallback(async()=>{u(null);try{const N=await a.mutateAsync({input:{agentId:n,name:s.name}});N.status==="approval_required"&&o(N.approval)}catch(N){u(N instanceof Error?N.message:"Couldn’t add the server.")}},[a,n,s.name]),p=l.useCallback(async()=>{if(r){u(null);try{(await a.mutateAsync({input:{agentId:n,name:s.name},approval:r})).status!=="ok"&&u("Adding it still needs approval. Try again.")}catch(N){u(N instanceof Error?N.message:"Couldn’t add the server.")}}},[a,n,s.name,r]),m=$e(s.name),c=Ws(s,m),j=c!==null,v=m.rawName!==m.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(he,{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 “",m.displayName,"” to ",t,"?"]}),e.jsx("p",{className:"text-muted-foreground text-xs leading-relaxed",children:mn({displayName:m.displayName,scope:c,pluginName:m.pluginName})})]})]}),d&&e.jsx("p",{className:"text-destructive text-xs",children:d}),e.jsxs("div",{className:"flex justify-end gap-2",children:[e.jsx(f,{variant:"ghost",size:"sm",onClick:()=>o(null),disabled:a.isPending,className:"focus-visible:ring-2",children:"Cancel"}),e.jsx(f,{size:"sm",onClick:p,disabled:a.isPending,className:"focus-visible:ring-2",children:a.isPending?"Adding…":"Add to agent"})]})]}):e.jsx(Be,{displayName:m.displayName,rawName:s.name,scope:c,pluginName:m.pluginName,status:un(s),sentence:Zs(c,m.pluginName),managed:!1,actions:i?e.jsxs(e.Fragment,{children:[e.jsxs(f,{variant:"outline",size:"sm",onClick:x,disabled:a.isPending,"aria-label":`Add ${s.name} to agent`,className:"gap-1.5 focus-visible:ring-2",children:[a.isPending?e.jsx(ce,{size:"xs"}):e.jsx(Me,{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:c,pluginName:m.pluginName,rawName:m.rawName,displayName:m.displayName,error:s.error}):void 0})}function pn(s,n){return{agentId:s,name:n.server.name,connection:n.server.connection}}function xn(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 fn({agentId:s,agentLabel:n}){const t=is(),i=Fe(),[a,r]=l.useState(null),[o,d]=l.useState(null),u=l.useCallback(async c=>{if(t.data){d(null);try{const j=await i.mutateAsync({input:pn(s,t.data),...c?{approval:c}:{}});j.status!=="approval_required"?r(null):c?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 x=t.data,p=xn(x),m=`${x.loginCommand} <site>`;return e.jsx(T,{children:e.jsxs(A,{className:"space-y-3",children:[e.jsxs("div",{className:"flex items-start gap-2",children:[a?e.jsx(he,{className:"mt-0.5 size-4 shrink-0 text-amber-500"}):e.jsx(os,{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."}),x.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:m}),e.jsx(ls,{value:m,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:[x.server.connection.command,...x.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(f,{variant:"ghost",size:"sm",onClick:()=>r(null),disabled:i.isPending,className:"focus-visible:ring-2",children:"Back"}),e.jsx(f,{variant:a?"default":"outline",size:"sm",onClick:()=>void u(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 ke(s){return vn[s]??ks}function jn(){const{open:s}=ds();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(f,{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=cs(s.id),i=js(n,s.runtime),a=i.data,r=Pe(s.runtime),o=(r==null?void 0:r.supportsManagedMcpServers)??!0,d=ys(),u=Ss(),x=Ns(),p=Cs(),[m,c]=l.useState({}),[j,v]=l.useState(null),[b,k]=l.useState(null),N=Ks(),P=l.useCallback((h,y)=>{(y?d:u).mutate({agentId:s.id,name:h})},[s.id,d,u]),C=l.useCallback(h=>{x.mutate({agentId:s.id,name:h}),c(y=>{const w={...y};return delete w[h],w})},[s.id,x]),E=l.useCallback(async h=>{v(h);try{const y=await p.mutateAsync({agentId:s.id,name:h});c(w=>({...w,[h]:{result:y,at:Date.now()}}))}finally{v(null)}},[s.id,p]),z=l.useCallback(({name:h,transport:y})=>{k(h),y!=="stdio"&&E(h).catch(()=>{})},[E]),M=t.data??[],R=new Set(M.map(h=>h.name)),I=new Map(((a==null?void 0:a.servers)??[]).map(h=>[h.name,h])),O=((a==null?void 0:a.servers)??[]).filter(h=>!R.has(h.name)),F=d.isPending||u.isPending||x.isPending,ie=M.some(h=>vs(h.connection)!==void 0),Q=o&&!t.isPending&&!ie&&ke(s.runtime).includes("stdio"),$=new Map;M.forEach((h,y)=>$.set(h.name,{kind:"managed",index:y})),O.forEach((h,y)=>$.set(h.name,{kind:"discovered",index:y}));const H=N({bothSettled:!t.isPending&&!i.isPending,managed:M,live:I,discovered:O,present:[...M.map(h=>h.name),...O.map(h=>h.name)]});function U(h){const y=$.get(h);if(!y)return null;if(y.kind==="managed"){const D=M[y.index];return e.jsx(dn,{server:D,agentId:s.id,live:I.get(D.name),testResult:m[D.name],rosterUpdatedAt:t.dataUpdatedAt,testing:j===D.name,busy:F,onToggle:P,onTest:E,onRemove:C},D.name)}const w=O[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(Ms,{agentId:s.id,agentLabel:s.displayName??s.name,supportedTransports:ke(s.runtime),onAdded:z,oauthDetectedFor:b&&((Y=m[b])==null?void 0:Y.result.needsAuth)===!0?b:null})]}),e.jsx(jn,{}),Q&&e.jsx(fn,{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(T,{children:e.jsxs(A,{className:"space-y-2",children:[e.jsx(de,{className:"h-5 w-full"}),e.jsx(de,{className:"h-5 w-3/4"})]})}):t.isError?e.jsx(T,{children:e.jsxs(A,{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(f,{variant:"outline",size:"sm",onClick:()=>t.refetch(),className:"focus-visible:ring-2",children:"Retry"})]})}):H.length===0?e.jsx(T,{children:e.jsx(A,{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(T,{children:e.jsx(A,{children:H.map(U)})})]})}function ue({tools:s}){return e.jsxs(B,{children:[e.jsx(G,{asChild:!0,children:e.jsx(ne,{tone:"neutral",variant:"outline",className:"shrink-0 cursor-default font-normal",children:s.length})}),e.jsx(q,{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(Se,{label:s.label,description:s.description,className:"py-1",children:e.jsxs(B,{children:[e.jsx(G,{asChild:!0,children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(ne,{variant:"secondary",children:"Disabled"}),e.jsx(ue,{tools:s.tools}),e.jsx(te,{checked:!1,disabled:!0,"aria-label":`Toggle ${s.label} tools`})]})}),e.jsx(q,{side:"left",children:s.serverDisabledReason??"Disabled globally by server configuration."})]})}):e.jsx(Se,{label:s.label,description:s.description,className:"py-1",children:e.jsxs("div",{className:"flex items-center gap-2",children:[!r&&e.jsx(ne,{tone:"neutral",variant:"outline",className:"font-normal",children:"default"}),r&&e.jsxs(B,{children:[e.jsx(G,{asChild:!0,children:e.jsx(f,{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(gs,{className:"size-3"})})}),e.jsx(q,{side:"top",children:"Reset to global default"})]}),e.jsx(ue,{tools:s.tools}),e.jsx(te,{checked:o,onCheckedChange:d=>i(s.key,d),"aria-label":`Toggle ${s.label} tools`})]})})}function yn({agent:s,supportsDorkTools:n}){var d;const t=xs("roomsManage"),i=xe(),a=V(),r=((d=s.enabledToolGroups)==null?void 0:d.roomsManage)===!0,o=l.useCallback(u=>{i.mutate({id:s.id,updates:{enabledToolGroups:{...s.enabledToolGroups??{},roomsManage:u}}},{onSettled:()=>{a.invalidateQueries({queryKey:re.all}),a.invalidateQueries({queryKey:pe})}})},[s.id,s.enabledToolGroups,a,i]);return e.jsx(T,{children:e.jsxs(A,{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.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"text-sm font-medium",children:"Manage rooms"}),t.length>0?e.jsx(ue,{tools:t}):null]}),e.jsx("p",{className:"text-muted-foreground text-sm",children:"Let this agent create channels and direct messages, add and remove members, rename a channel, and leave a channel."})]}),e.jsx(te,{checked:r,onCheckedChange:o,disabled:i.isPending,"aria-label":"Manage rooms"})]}),e.jsxs("p",{className:"text-muted-foreground text-sm",children:[e.jsx("span",{className:"text-foreground font-medium",children:"This switch is a lock, not a hint."})," ","Unlike the groups above, turning it off blocks the calls: the agent is refused, and told to ask you. It is off until you turn it on, and only you can change it. The agent cannot turn it on for itself."]}),e.jsx("p",{className:"text-muted-foreground text-sm",children:"It can never remove you from a room, and any room holding two agents holds you too."}),n?null:e.jsx("p",{className:"text-muted-foreground text-sm",children:"This agent’s runtime reaches these over the external MCP server rather than in-session, and the switch applies there just the same."})]})})}function Sn({agent:s}){const n=xe(),t=V(),i=s.tierCeiling??ps,a=l.useCallback(r=>{n.mutate({id:s.id,updates:{tierCeiling:r}},{onSettled:()=>{t.invalidateQueries({queryKey:re.all}),t.invalidateQueries({queryKey:pe})}})},[s.id,t,n]);return e.jsx(T,{children:e.jsxs(A,{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(Ee,{className:"w-56","aria-label":"The most this agent can ever do",children:e.jsx(Re,{})}),e.jsxs(De,{children:[e.jsx(ee,{value:"observe",children:"Read only"}),e.jsx(ee,{value:"act",children:"Change things, never delete"}),e.jsx(ee,{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=us(),i=ms(),{config:a}=hs(),r=xe(),o=V(),d=Pe(s.runtime),u=(d==null?void 0:d.supportsMcp)??!0,x=l.useCallback(v=>{r.mutate({id:s.id,updates:{enabledToolGroups:v}},{onSettled:()=>{o.invalidateQueries({queryKey:re.all}),o.invalidateQueries({queryKey:pe})}})},[s.id,o,r]),p=l.useCallback((v,b)=>{x({...s.enabledToolGroups??{},[v]:b})},[s.enabledToolGroups,x]),m=l.useCallback(v=>{const b={...s.enabledToolGroups??{}};delete b[v],x(b)},[s.enabledToolGroups,x]),c=[{key:"tasks",configKey:"tasksTools",label:"Scheduling",description:"Create and run scheduled tasks",tools:X("tasks"),serverDisabled:!i,serverDisabledReason:"Disabled globally by server configuration."},{key:"relay",configKey:"relayTools",label:"Messaging",description:"Send and receive messages between agents",tools:X("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:X("mesh")},{key:"adapter",configKey:"adapterTools",label:"Connection management",description:"Set up Telegram, Slack, and webhooks, and route each chat to an agent",tools:X("adapter"),serverDisabled:!t,serverDisabledReason:"Disabled globally by server configuration."}],j=s.enabledToolGroups??{};return e.jsxs("div",{className:"space-y-4",children:[u?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(T,{children:e.jsx(A,{children:c.map(v=>e.jsx(Nn,{domain:v,agentOverride:j[v.key],globalDefault:a[v.configKey],onToggle:p,onReset:m},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(T,{children:e.jsx(A,{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(yn,{agent:s,supportsDorkTools:u}),e.jsx(bn,{agent:s,projectPath:n})]})}function An({member:s}){const{agent:n,projectPath:t,isPending:i}=fs(s);return i?e.jsx(de,{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{O as i,r as l,Q as u,j as e,a as o,R as c,U as m}from"./index-DDXrdlj0.js";import{V as x,W as h,Y as N,Z as g,$ as j,a0 as O,a1 as P,a2 as w,a3 as I,a4 as y,a5 as S}from"./index-DDXrdlj0.js";function f(){const s=i(),a=s.status==="ready"?s.roomId:null,t=l.useRef(null);return l.useEffect(()=>{const n=t.current;if(t.current=a,n===null||n===a)return;const r=u.getState().request;r!==null&&r.roomId!==a&&u.getState().consume()},[a]),s.status==="loading"?e.jsxs("div",{className:"space-y-4 p-4","aria-busy":!0,children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(o,{className:"size-9 rounded-full"}),e.jsx(o,{className:"h-4 w-32"})]}),e.jsx(o,{className:"h-3 w-48"}),e.jsx(o,{className:"h-24 w-full"})]}):s.status==="none"?e.jsx(c,{title:"No room open",body:"Open a channel or a direct message and this panel says who is in it."}):e.jsx(m,{roomId:s.roomId},s.roomId)}export{x as AgentChipPicker,h as AgentRosterPicker,N as ChannelCreateDialog,g as NewDirectMessageMenu,j as ONE_DOOR_HINT,O as ROOM_PANEL_ID,f as RoomPanel,m as RoomPanelBody,P as facesOfRoster,w as oneDoorSubmitLabel,I as openRoomPanel,y as opensAgentSession,S as useRoomFaces,u as useRoomPanelFocusStore};