bazilion 0.12.2 → 0.14.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 (217) hide show
  1. package/README.md +2 -2
  2. package/dist/cli.js +795 -240
  3. package/dist/cli.js.map +1 -1
  4. package/dist/daemon.js +4555 -1280
  5. package/dist/daemon.js.map +1 -1
  6. package/dist/migrations/0001_init.sql +21 -0
  7. package/dist/web/client/assets/AgentTabs-BcmmwYJc.js +1 -0
  8. package/dist/web/client/assets/ConfigPage-BCLp-FUC.js +1 -0
  9. package/dist/web/client/assets/ConfirmDialog-CyL9A20V.js +1 -0
  10. package/dist/web/client/assets/FieldRow-D6REbYUa.js +1 -0
  11. package/dist/web/client/assets/Page-NV96O47A.js +1 -0
  12. package/dist/web/client/assets/ProductionTeamPolicyEditor-DBKnOezm.js +7 -0
  13. package/dist/web/client/assets/{ProfileCommunicationEditor-C43HvUe-.js → ProfileCommunicationEditor-4RK2laqO.js} +1 -1
  14. package/dist/web/client/assets/SectionTabs-4kCQXuFY.js +1 -0
  15. package/dist/web/client/assets/TeamTabs-CdtNEqt4.js +1 -0
  16. package/dist/web/client/assets/{TemplatesTabs-6Jd_xQj7.js → TemplatesTabs-CZyss2Y0.js} +1 -1
  17. package/dist/web/client/assets/UnsavedChangesGuard-CEoK-ZcN.js +1 -0
  18. package/dist/web/client/assets/_id-4ZS-w_Aj.js +1 -0
  19. package/dist/web/client/assets/{_id-AOAT0H_5.js → _id-DIqtdQij.js} +1 -1
  20. package/dist/web/client/assets/_id-DbcC2E7F.js +1 -0
  21. package/dist/web/client/assets/_id-f_r5M0p3.js +1 -0
  22. package/dist/web/client/assets/activity-CB9Ufth-.js +1 -0
  23. package/dist/web/client/assets/agents-D-JGXVg9.js +1 -0
  24. package/dist/web/client/assets/agents-DS2XafoA.js +1 -0
  25. package/dist/web/client/assets/approvals-Cke_mrJv.js +1 -0
  26. package/dist/web/client/assets/attention-PYwRM2wC.js +1 -0
  27. package/dist/web/client/assets/chevron-right-BG4OeFRQ.js +1 -0
  28. package/dist/web/client/assets/config-DF9Gqmfa.js +3 -0
  29. package/dist/web/client/assets/dm-sans-latin-400-normal-BwCSEQnW.woff +0 -0
  30. package/dist/web/client/assets/dm-sans-latin-400-normal-CW0RaeGs.woff2 +0 -0
  31. package/dist/web/client/assets/dm-sans-latin-500-normal-B9HHJjqV.woff2 +0 -0
  32. package/dist/web/client/assets/dm-sans-latin-500-normal-Dr3UlScf.woff +0 -0
  33. package/dist/web/client/assets/dm-sans-latin-600-normal-Aqo67rzb.woff2 +0 -0
  34. package/dist/web/client/assets/dm-sans-latin-600-normal-BmdmIIQ2.woff +0 -0
  35. package/dist/web/client/assets/dm-sans-latin-700-normal-CUSSCpQX.woff +0 -0
  36. package/dist/web/client/assets/dm-sans-latin-700-normal-DvUfVpUG.woff2 +0 -0
  37. package/dist/web/client/assets/dm-serif-display-latin-400-normal-C5_t9oOD.woff2 +0 -0
  38. package/dist/web/client/assets/dm-serif-display-latin-400-normal-_kVFYEpx.woff +0 -0
  39. package/dist/web/client/assets/{inbox-Bn1GbUsJ.js → inbox-DC_HdOfI.js} +1 -1
  40. package/dist/web/client/assets/index-Cofc7zhl.css +1 -0
  41. package/dist/web/client/assets/index-Cp6UHWr2.js +52 -0
  42. package/dist/web/client/assets/jetbrains-mono-latin-400-normal-6-qcROiO.woff +0 -0
  43. package/dist/web/client/assets/jetbrains-mono-latin-400-normal-V6pRDFza.woff2 +0 -0
  44. package/dist/web/client/assets/jetbrains-mono-latin-500-normal-BWZEU5yA.woff2 +0 -0
  45. package/dist/web/client/assets/jetbrains-mono-latin-500-normal-CJOVTJB7.woff +0 -0
  46. package/dist/web/client/assets/learning-BfrQ4YZY.js +1 -0
  47. package/dist/web/client/assets/login-D4n3AcBR.js +1 -0
  48. package/dist/web/client/assets/mcp-CnjQc_JJ.js +1 -0
  49. package/dist/web/client/assets/members-wxsVTJdW.js +1 -0
  50. package/dist/web/client/assets/memory-Du60O3pE.js +1 -0
  51. package/dist/web/client/assets/{policy-DaijITy7.js → policy-BOfnkJsL.js} +1 -1
  52. package/dist/web/client/assets/{preload-helper-mNuBjNXU.js → preload-helper-bztXdkDj.js} +1 -1
  53. package/dist/web/client/assets/routes-B9CuhzUW.js +1 -0
  54. package/dist/web/client/assets/services-DyvqJqM2.js +1 -0
  55. package/dist/web/client/assets/skills-DQo7ioW7.js +1 -0
  56. package/dist/web/client/assets/styles-B5vcgXln.css +2 -0
  57. package/dist/web/client/assets/{teams-D92R9Pb7.js → teams-DPggy97H.js} +1 -1
  58. package/dist/web/client/assets/teams-DdawcfNR.js +1 -0
  59. package/dist/web/client/assets/telegram-DcTeDpP5.js +1 -0
  60. package/dist/web/client/assets/tokens-CIEKwZXc.js +1 -0
  61. package/dist/web/client/assets/triggers-Bc2RrUPm.js +1 -0
  62. package/dist/web/client/assets/utils-B6KiDbIe.js +1 -0
  63. package/dist/web/client/assets/welcome-DlhNXUIa.js +1 -0
  64. package/dist/web/client/assets/wire-constants-BzdHSc6A.js +74 -0
  65. package/dist/web/client/assets/x-DAXGIe_Q.js +1 -0
  66. package/dist/web/server/assets/{AgentTabs-aXdsiiMp.js → AgentTabs-Dq8hDM2Q.js} +9 -2
  67. package/dist/web/server/assets/{ChatPane-Ba5wTsVk.js → ChatPane-CgSe7tsy.js} +81 -43
  68. package/dist/web/server/assets/{ConfigPage-BKlh5vOU.js → ConfigPage-CiQ-gxmJ.js} +3 -2
  69. package/dist/web/server/assets/ConfirmDialog-C-MPYYSU.js +99 -0
  70. package/dist/web/server/assets/FieldRow-DCOF07kl.js +160 -0
  71. package/dist/web/server/assets/{Page-LENulSXY.js → Page-Bz-ydB8j.js} +4 -10
  72. package/dist/web/server/assets/{ProductionTeamPolicyEditor-Y4mzFFvR.js → ProductionTeamPolicyEditor-DQSdP7Yx.js} +140 -123
  73. package/dist/web/server/assets/{SectionTabs-BJTPr5nU.js → SectionTabs-B2Yw81XN.js} +2 -2
  74. package/dist/web/server/assets/{Sidebar-DsRVCszF.js → Sidebar-DKyk7oIo.js} +563 -283
  75. package/dist/web/server/assets/{TeamTabs-zZzbP1t_.js → TeamTabs-Co3n2exj.js} +2 -6
  76. package/dist/web/server/assets/{TemplatesTabs-CcRxZhJe.js → TemplatesTabs-B0fA361R.js} +1 -1
  77. package/dist/web/server/assets/UnsavedChangesGuard-CiStXyBI.js +40 -0
  78. package/dist/web/server/assets/{_id-Dj1yZ3zJ.js → _id-BAA9KJBU.js} +4 -4
  79. package/dist/web/server/assets/{_id-LrvXU4Nr.js → _id-BM5m2FLT.js} +4 -4
  80. package/dist/web/server/assets/{_id-CwyGjJeP.js → _id-BYKpT2Tu.js} +4 -5
  81. package/dist/web/server/assets/{_id-BHYLL8M-.js → _id-BeKhPKw3.js} +350 -185
  82. package/dist/web/server/assets/{_id-C3HY4lWg.js → _id-BqWTB8Wl.js} +188 -86
  83. package/dist/web/server/assets/{_id-DinTp_7X.js → _id-BwvCtzlD.js} +3 -3
  84. package/dist/web/server/assets/{_id-D27T85mU.js → _id-DYU6uIBx.js} +4 -5
  85. package/dist/web/server/assets/{_id-IzadFZV9.js → _id-DvlDkk04.js} +4 -4
  86. package/dist/web/server/assets/{_id-BhOB8Umi.js → _id-DxCnEFpm.js} +4 -4
  87. package/dist/web/server/assets/{_id-tB47Vsfp.js → _id-HMy7jM3P.js} +3 -3
  88. package/dist/web/server/assets/{_id-D3Ap7zZA.js → _id-ndxFHx0t.js} +75 -71
  89. package/dist/web/server/assets/{_id-FcHdSocl.js → _id-sNu5aXZt.js} +5 -4
  90. package/dist/web/server/assets/{_tanstack-start-manifest_v-BGDBdnUs.js → _tanstack-start-manifest_v-C-OiOZeM.js} +118 -94
  91. package/dist/web/server/assets/{activity-DohitgwW.js → activity-9VP6QDTH.js} +3 -3
  92. package/dist/web/server/assets/{activity-BCI4mfNS.js → activity-BWv1goK6.js} +3 -3
  93. package/dist/web/server/assets/{activity-D9SMqBhy.js → activity-LjpblbDL.js} +3 -3
  94. package/dist/web/server/assets/{agents-C9xlWK0Z.js → agents-BDFGrU3o.js} +4 -4
  95. package/dist/web/server/assets/{agents-BY74v7fM.js → agents-BJAv919x.js} +3 -3
  96. package/dist/web/server/assets/{agents-BvttypqB.js → agents-CJk4pxKu.js} +3 -3
  97. package/dist/web/server/assets/{agents-CgZMHj80.js → agents-CYw1xHoY.js} +138 -16
  98. package/dist/web/server/assets/{agents-DZuFEj0D.js → agents-DfNKc_Q7.js} +52 -8
  99. package/dist/web/server/assets/{agents-BPKOshR5.js → agents-DjyQk94u.js} +4 -4
  100. package/dist/web/server/assets/{approvals-CWcFHlor.js → approvals-7JOoBchn.js} +3 -3
  101. package/dist/web/server/assets/{approvals-BGU-XGIO.js → approvals-BYi84gwl.js} +3 -3
  102. package/dist/web/server/assets/{approvals-DCaVw1Mz.js → approvals-Bz123liE.js} +59 -21
  103. package/dist/web/server/assets/{attention-BxkTf337.js → attention-B35JvhOL.js} +3 -3
  104. package/dist/web/server/assets/{attention-w21GQIGH.js → attention-C1pPWSXw.js} +3 -3
  105. package/dist/web/server/assets/{attention-CM-Ks1N9.js → attention-UhqPK_Ro.js} +3 -3
  106. package/dist/web/server/assets/{auth-byfSx6Ja.js → auth-7BHTH-KS.js} +5 -5
  107. package/dist/web/server/assets/{config-BDCJdtj2.js → config-BMiajTZP.js} +10 -5
  108. package/dist/web/server/assets/{config-1w2GiJUn.js → config-BlMkHStx.js} +3 -3
  109. package/dist/web/server/assets/config-ExacOzHX.js +958 -0
  110. package/dist/web/server/assets/{createServerRpc-pU-IQV2Y.js → createServerRpc-B7Yr1K8i.js} +1 -1
  111. package/dist/web/server/assets/{createSsrRpc-DFsIAfFd.js → createSsrRpc-6LHNEsSK.js} +1 -1
  112. package/dist/web/server/assets/{daemon-client-2NRMzlTr.js → daemon-client-CI5NHwNC.js} +16 -4
  113. package/dist/web/server/assets/{inbox-CzlKT9Wg.js → inbox-Dv55rGYq.js} +4 -4
  114. package/dist/web/server/assets/{inbox-BLUzA5sQ.js → inbox-RweGCV3D.js} +3 -3
  115. package/dist/web/server/assets/{inbox-ZvDNAjaM.js → inbox-cu3jLzNP.js} +4 -4
  116. package/dist/web/server/assets/{learning-B7PBkvER.js → learning-BaKM6qaw.js} +4 -4
  117. package/dist/web/server/assets/{learning-8zav4pIT.js → learning-C2upa1CE.js} +4 -4
  118. package/dist/web/server/assets/{learning-Cq7K2heb.js → learning-CbtNlqYo.js} +76 -23
  119. package/dist/web/server/assets/{login-CmWvxfTK.js → login-BNj3U6ok.js} +22 -12
  120. package/dist/web/server/assets/{login-Bx5LEyGP.js → login-Be8eP4Jp.js} +2 -2
  121. package/dist/web/server/assets/{mcp-DIWTogHM.js → mcp-B0goWO8Q.js} +3 -3
  122. package/dist/web/server/assets/{mcp-2pwT9HU8.js → mcp-BvnvlVFd.js} +3 -3
  123. package/dist/web/server/assets/mcp-CiBs8unU.js +332 -0
  124. package/dist/web/server/assets/members-BP3UTqu1.js +12 -0
  125. package/dist/web/server/assets/members-DHYTVgwb.js +100 -0
  126. package/dist/web/server/assets/members-DiYtr-zm.js +12 -0
  127. package/dist/web/server/assets/{memory-Dngc13Nw.js → memory-BqV-Afy1.js} +4 -4
  128. package/dist/web/server/assets/{memory-a8Kz57Kh.js → memory-CkXUgf5s.js} +150 -48
  129. package/dist/web/server/assets/{memory-pZ4pZT7p.js → memory-DTFEmfF3.js} +4 -4
  130. package/dist/web/server/assets/{policy-Bb-vEgqg.js → policy-18fdTFO4.js} +3 -3
  131. package/dist/web/server/assets/{policy-C30AeFIb.js → policy-BddK4xom.js} +3 -3
  132. package/dist/web/server/assets/{policy-BcGELcc9.js → policy-Bvvav8fh.js} +4 -4
  133. package/dist/web/server/assets/public-origin-xV0lm0Ty.js +25 -0
  134. package/dist/web/server/assets/router-pjH2t8Rl.js +813 -0
  135. package/dist/web/server/assets/{routes-B6cMLIPk.js → routes-BgHisAxH.js} +22 -5
  136. package/dist/web/server/assets/{routes-BrA-U_Hm.js → routes-COtkyZG1.js} +5 -5
  137. package/dist/web/server/assets/{routes-C19CMLZt.js → routes-DAU2g7Uz.js} +4 -4
  138. package/dist/web/server/assets/services-ClyGBU7W.js +83 -0
  139. package/dist/web/server/assets/{services-C4szdhPx.js → services-DgoU1udp.js} +3 -3
  140. package/dist/web/server/assets/{services-wG8I06oS.js → services-DozuJtzX.js} +3 -3
  141. package/dist/web/server/assets/{skills-BZdqiDig.js → skills-CYih9TJw.js} +47 -6
  142. package/dist/web/server/assets/{skills-a9VSWHWq.js → skills-DfGSJTCB.js} +3 -3
  143. package/dist/web/server/assets/{skills-C-UgkuCW.js → skills-Dw3cI3si.js} +3 -3
  144. package/dist/web/server/assets/start-D4Wq9iTa.js +70 -0
  145. package/dist/web/server/assets/{teams-OIkHuxy1.js → teams-BJuoNOTB.js} +3 -3
  146. package/dist/web/server/assets/{teams-CpQ0YgWf.js → teams-DF3RViAg.js} +3 -3
  147. package/dist/web/server/assets/{teams-DEpQR2QA.js → teams-DFnuc660.js} +3 -3
  148. package/dist/web/server/assets/{teams-DqfrEoH6.js → teams-DPnAX4wD.js} +4 -4
  149. package/dist/web/server/assets/{teams-jBtvnk59.js → teams-TV6nbEN_.js} +101 -10
  150. package/dist/web/server/assets/{teams-MjqgsmC3.js → teams-be05ci17.js} +3 -3
  151. package/dist/web/server/assets/{telegram-DNgCWebD.js → telegram-1AWL6lFw.js} +3 -3
  152. package/dist/web/server/assets/{telegram-XwyKSEtj.js → telegram-DbOFpTFm.js} +3 -3
  153. package/dist/web/server/assets/{telegram-CBF8SJzB.js → telegram-Dj4Wwhd6.js} +262 -43
  154. package/dist/web/server/assets/tokens-DDwtO15P.js +359 -0
  155. package/dist/web/server/assets/tokens-DjM8GsgS.js +19 -0
  156. package/dist/web/server/assets/{tokens-BnwFbV7T.js → tokens-_2hptHP6.js} +4 -4
  157. package/dist/web/server/assets/{triggers-BZPl5CHs.js → triggers-BvjYNmmY.js} +4 -4
  158. package/dist/web/server/assets/triggers-CHk9O3rU.js +367 -0
  159. package/dist/web/server/assets/{triggers-D79NoSXk.js → triggers-Nezfw-Bd.js} +4 -4
  160. package/dist/web/server/assets/utils-C_uf36nf.js +8 -0
  161. package/dist/web/server/assets/{welcome-DDB11L5j.js → welcome-B8nchXdF.js} +9 -8
  162. package/dist/web/server/server.js +29 -33
  163. package/dist/web-server.js +4 -0
  164. package/dist/web-server.js.map +1 -1
  165. package/dist/worker.js +1744 -362
  166. package/dist/worker.js.map +1 -1
  167. package/package.json +7 -6
  168. package/dist/web/client/assets/AgentTabs-R6gSjIj3.js +0 -1
  169. package/dist/web/client/assets/ConfigPage-BCwfgyjD.js +0 -1
  170. package/dist/web/client/assets/FieldRow-avAFLgYW.js +0 -1
  171. package/dist/web/client/assets/Page-CwNuDhWz.js +0 -1
  172. package/dist/web/client/assets/ProductionTeamPolicyEditor-CsWpTsy6.js +0 -7
  173. package/dist/web/client/assets/SectionTabs-DZzy01az.js +0 -1
  174. package/dist/web/client/assets/TeamTabs-DvqWieCq.js +0 -1
  175. package/dist/web/client/assets/_id-BUuz7Drv.js +0 -1
  176. package/dist/web/client/assets/_id-BegmVRmT.js +0 -1
  177. package/dist/web/client/assets/_id-BrA4Crh_.js +0 -1
  178. package/dist/web/client/assets/activity-n0Fw9_w3.js +0 -1
  179. package/dist/web/client/assets/agents-B33VQtbl.js +0 -1
  180. package/dist/web/client/assets/agents-C50pdxp7.js +0 -1
  181. package/dist/web/client/assets/approvals-DVW0hX8h.js +0 -1
  182. package/dist/web/client/assets/attention-B2490jcN.js +0 -1
  183. package/dist/web/client/assets/chevron-down-B0aNNOyn.js +0 -1
  184. package/dist/web/client/assets/config-CMMxxeX2.js +0 -3
  185. package/dist/web/client/assets/context-DcFzsfZ3.js +0 -1
  186. package/dist/web/client/assets/index-3nrK5iFr.js +0 -12
  187. package/dist/web/client/assets/learning-BUX1MFu2.js +0 -1
  188. package/dist/web/client/assets/login-CMWpGDKv.js +0 -1
  189. package/dist/web/client/assets/mcp-lZV08dqc.js +0 -1
  190. package/dist/web/client/assets/members-DAeaY2Cy.js +0 -1
  191. package/dist/web/client/assets/memory-HmMWxxdF.js +0 -1
  192. package/dist/web/client/assets/plus-CPzRJg1V.js +0 -1
  193. package/dist/web/client/assets/routes-BNk270AM.js +0 -1
  194. package/dist/web/client/assets/services-DtrpJrdo.js +0 -1
  195. package/dist/web/client/assets/skills-Cv93A3P3.js +0 -1
  196. package/dist/web/client/assets/styles-DMltY3su.css +0 -2
  197. package/dist/web/client/assets/teams-CCFnSNKi.js +0 -1
  198. package/dist/web/client/assets/telegram-BF1vdgDB.js +0 -1
  199. package/dist/web/client/assets/tokens-BXj6hWW-.js +0 -1
  200. package/dist/web/client/assets/triggers-NT24i4hZ.js +0 -1
  201. package/dist/web/client/assets/welcome-D0cy68eZ.js +0 -1
  202. package/dist/web/client/assets/wire-constants-BhVKOCQa.js +0 -74
  203. package/dist/web/server/assets/FieldRow-B4eTegH9.js +0 -94
  204. package/dist/web/server/assets/config-BmixCpz-.js +0 -372
  205. package/dist/web/server/assets/context-B-XDf6Ym.js +0 -12
  206. package/dist/web/server/assets/context-BXGo5Vfi.js +0 -12
  207. package/dist/web/server/assets/context-DrkrIWun.js +0 -47
  208. package/dist/web/server/assets/mcp-BJjLIdP0.js +0 -261
  209. package/dist/web/server/assets/members-CCv17cjQ.js +0 -46
  210. package/dist/web/server/assets/members-CW5aBe81.js +0 -12
  211. package/dist/web/server/assets/members-VdPwD6CE.js +0 -12
  212. package/dist/web/server/assets/router-CIVjTgNp.js +0 -537
  213. package/dist/web/server/assets/services-B9yBWDX0.js +0 -79
  214. package/dist/web/server/assets/start-WH8WzTL_.js +0 -4
  215. package/dist/web/server/assets/tokens-DPDMSN5O.js +0 -12
  216. package/dist/web/server/assets/tokens-yyTSfBSN.js +0 -186
  217. package/dist/web/server/assets/triggers-CSNNzRIi.js +0 -216
@@ -1,9 +1,130 @@
1
- import { t as Button } from "./Button-Dsnw22OF.js";
1
+ import { t as cn } from "./utils-C_uf36nf.js";
2
+ import { t as Button$1 } from "./Button-Dsnw22OF.js";
3
+ import { t as ConfirmDialog } from "./ConfirmDialog-C-MPYYSU.js";
2
4
  import "./wire-constants-C8nBJcU3.js";
3
5
  import { useEffect, useRef, useState } from "react";
4
6
  import { Link, useNavigate, useRouter } from "@tanstack/react-router";
5
7
  import { Fragment, jsx, jsxs } from "react/jsx-runtime";
6
- import { Archive, Bot, ChevronDown, ChevronRight, Pencil, Plus, Send, UsersRound } from "lucide-react";
8
+ import { Archive, Bot, ChevronDown, ChevronRight, Pencil, Plus, Send, UsersRound, XIcon } from "lucide-react";
9
+ import { Dialog, Slot } from "radix-ui";
10
+ import { cva } from "class-variance-authority";
11
+ //#region src/components/ui/button.tsx
12
+ var buttonVariants = cva("team/button inline-flex shrink-0 items-center justify-center rounded-lg border border-transparent bg-clip-padding text-sm font-medium whitespace-nowrap transition-all outline-none select-none focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 active:not-aria-[haspopup]:translate-y-px disabled:pointer-events-none disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4", {
13
+ variants: {
14
+ variant: {
15
+ default: "bg-primary text-primary-foreground [a]:hover:bg-primary/80",
16
+ outline: "border-border bg-background hover:bg-muted hover:text-foreground aria-expanded:bg-muted aria-expanded:text-foreground dark:border-input dark:bg-input/30 dark:hover:bg-input/50",
17
+ secondary: "bg-secondary text-secondary-foreground hover:bg-secondary/80 aria-expanded:bg-secondary aria-expanded:text-secondary-foreground",
18
+ ghost: "hover:bg-muted hover:text-foreground aria-expanded:bg-muted aria-expanded:text-foreground dark:hover:bg-muted/50",
19
+ destructive: "bg-destructive/10 text-destructive hover:bg-destructive/20 focus-visible:border-destructive/40 focus-visible:ring-destructive/20 dark:bg-destructive/20 dark:hover:bg-destructive/30 dark:focus-visible:ring-destructive/40",
20
+ link: "text-primary underline-offset-4 hover:underline"
21
+ },
22
+ size: {
23
+ default: "h-8 gap-1.5 px-2.5 has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2",
24
+ xs: "h-6 gap-1 rounded-[min(var(--radius-md),10px)] px-2 text-xs in-data-[slot=button-team]:rounded-lg has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 [&_svg:not([class*='size-'])]:size-3",
25
+ sm: "h-7 gap-1 rounded-[min(var(--radius-md),12px)] px-2.5 text-[0.8rem] in-data-[slot=button-team]:rounded-lg has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 [&_svg:not([class*='size-'])]:size-3.5",
26
+ lg: "h-9 gap-1.5 px-2.5 has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2",
27
+ icon: "size-8",
28
+ "icon-xs": "size-6 rounded-[min(var(--radius-md),10px)] in-data-[slot=button-team]:rounded-lg [&_svg:not([class*='size-'])]:size-3",
29
+ "icon-sm": "size-7 rounded-[min(var(--radius-md),12px)] in-data-[slot=button-team]:rounded-lg",
30
+ "icon-lg": "size-9"
31
+ }
32
+ },
33
+ defaultVariants: {
34
+ variant: "default",
35
+ size: "default"
36
+ }
37
+ });
38
+ function Button({ className, variant = "default", size = "default", asChild = false, ...props }) {
39
+ return /* @__PURE__ */ jsx(asChild ? Slot.Root : "button", {
40
+ "data-slot": "button",
41
+ "data-variant": variant,
42
+ "data-size": size,
43
+ className: cn(buttonVariants({
44
+ variant,
45
+ size,
46
+ className
47
+ })),
48
+ ...props
49
+ });
50
+ }
51
+ //#endregion
52
+ //#region src/components/ui/dialog.tsx
53
+ function Dialog$1({ ...props }) {
54
+ return /* @__PURE__ */ jsx(Dialog.Root, {
55
+ "data-slot": "dialog",
56
+ ...props
57
+ });
58
+ }
59
+ function DialogPortal({ ...props }) {
60
+ return /* @__PURE__ */ jsx(Dialog.Portal, {
61
+ "data-slot": "dialog-portal",
62
+ ...props
63
+ });
64
+ }
65
+ function DialogOverlay({ className, ...props }) {
66
+ return /* @__PURE__ */ jsx(Dialog.Overlay, {
67
+ "data-slot": "dialog-overlay",
68
+ className: cn("fixed inset-0 isolate z-50 bg-black/10 duration-100 supports-backdrop-filter:backdrop-blur-xs data-open:animate-in data-open:fade-in-0 data-closed:animate-out data-closed:fade-out-0", className),
69
+ ...props
70
+ });
71
+ }
72
+ function DialogContent({ className, children, showCloseButton = true, ...props }) {
73
+ return /* @__PURE__ */ jsxs(DialogPortal, { children: [/* @__PURE__ */ jsx(DialogOverlay, {}), /* @__PURE__ */ jsxs(Dialog.Content, {
74
+ "data-slot": "dialog-content",
75
+ className: cn("fixed top-1/2 left-1/2 z-50 grid w-full max-w-[calc(100%-2rem)] -translate-x-1/2 -translate-y-1/2 gap-4 rounded-xl bg-popover p-4 text-sm text-popover-foreground ring-1 ring-foreground/10 duration-100 outline-none sm:max-w-sm data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95", className),
76
+ ...props,
77
+ children: [children, showCloseButton && /* @__PURE__ */ jsx(Dialog.Close, {
78
+ "data-slot": "dialog-close",
79
+ asChild: true,
80
+ children: /* @__PURE__ */ jsxs(Button, {
81
+ variant: "ghost",
82
+ className: "absolute top-2 right-2",
83
+ size: "icon-sm",
84
+ children: [/* @__PURE__ */ jsx(XIcon, {}), /* @__PURE__ */ jsx("span", {
85
+ className: "sr-only",
86
+ children: "Close"
87
+ })]
88
+ })
89
+ })]
90
+ })] });
91
+ }
92
+ function DialogHeader({ className, ...props }) {
93
+ return /* @__PURE__ */ jsx("div", {
94
+ "data-slot": "dialog-header",
95
+ className: cn("flex flex-col gap-2", className),
96
+ ...props
97
+ });
98
+ }
99
+ function DialogFooter({ className, showCloseButton = false, children, ...props }) {
100
+ return /* @__PURE__ */ jsxs("div", {
101
+ "data-slot": "dialog-footer",
102
+ className: cn("-mx-4 -mb-4 flex flex-col-reverse gap-2 rounded-b-xl border-t bg-muted/50 p-4 sm:flex-row sm:justify-end", className),
103
+ ...props,
104
+ children: [children, showCloseButton && /* @__PURE__ */ jsx(Dialog.Close, {
105
+ asChild: true,
106
+ children: /* @__PURE__ */ jsx(Button, {
107
+ variant: "outline",
108
+ children: "Close"
109
+ })
110
+ })]
111
+ });
112
+ }
113
+ function DialogTitle({ className, ...props }) {
114
+ return /* @__PURE__ */ jsx(Dialog.Title, {
115
+ "data-slot": "dialog-title",
116
+ className: cn("font-heading text-base leading-none font-medium", className),
117
+ ...props
118
+ });
119
+ }
120
+ function DialogDescription({ className, ...props }) {
121
+ return /* @__PURE__ */ jsx(Dialog.Description, {
122
+ "data-slot": "dialog-description",
123
+ className: cn("text-sm text-muted-foreground *:[a]:underline *:[a]:underline-offset-3 *:[a]:hover:text-foreground", className),
124
+ ...props
125
+ });
126
+ }
127
+ //#endregion
7
128
  //#region src/components/CreateTeamDialog.tsx
8
129
  function CreateTeamDialog({ onClose }) {
9
130
  const router = useRouter();
@@ -40,107 +161,107 @@ function CreateTeamDialog({ onClose }) {
40
161
  setBusy(false);
41
162
  }
42
163
  }
43
- return /* @__PURE__ */ jsx("div", {
44
- onClick: onClose,
45
- onKeyDown: (event) => {
46
- if (event.key === "Escape") onClose();
164
+ return /* @__PURE__ */ jsx(Dialog$1, {
165
+ open: true,
166
+ onOpenChange: (open) => {
167
+ if (!open && !busy) onClose();
47
168
  },
48
- className: "fixed inset-0 z-50 flex items-center justify-center bg-charcoal/45 p-4 backdrop-blur-sm",
49
- children: /* @__PURE__ */ jsxs("form", {
50
- role: "dialog",
51
- "aria-modal": "true",
52
- "aria-labelledby": "create-team-title",
53
- onSubmit: submit,
54
- onClick: (e) => e.stopPropagation(),
169
+ children: /* @__PURE__ */ jsx(DialogContent, {
170
+ showCloseButton: !busy,
55
171
  className: "max-h-[calc(100dvh-2rem)] w-full max-w-lg overflow-y-auto rounded-3xl border border-frost bg-card p-6 shadow-baziu-lg sm:p-7",
56
- children: [
57
- /* @__PURE__ */ jsx("h2", {
58
- id: "create-team-title",
59
- className: "font-serif text-2xl text-foreground",
60
- children: "Create a team"
61
- }),
62
- /* @__PURE__ */ jsxs("p", {
63
- className: "text-sm text-muted-foreground mb-4",
64
- children: [
172
+ onEscapeKeyDown: (event) => {
173
+ if (busy) event.preventDefault();
174
+ },
175
+ onPointerDownOutside: (event) => {
176
+ if (busy) event.preventDefault();
177
+ },
178
+ children: /* @__PURE__ */ jsxs("form", {
179
+ onSubmit: submit,
180
+ children: [
181
+ /* @__PURE__ */ jsxs(DialogHeader, { children: [/* @__PURE__ */ jsx(DialogTitle, {
182
+ className: "font-serif text-2xl text-foreground",
183
+ children: "Create a team"
184
+ }), /* @__PURE__ */ jsxs(DialogDescription, { children: [
65
185
  "A team is a collaboration context — one filesystem root, one USER.md, one roster. The slot lives at ",
66
186
  /* @__PURE__ */ jsx("code", {
67
187
  className: "font-mono",
68
188
  children: "~/.bazilion/teams/<slug>/"
69
189
  }),
70
190
  "."
71
- ]
72
- }),
73
- /* @__PURE__ */ jsxs("div", {
74
- className: "mb-3 grid gap-3 sm:grid-cols-2",
75
- children: [/* @__PURE__ */ jsxs("label", {
76
- className: "block text-sm",
77
- children: ["ID (slug)", /* @__PURE__ */ jsx("input", {
78
- type: "text",
79
- value: id,
80
- onChange: (e) => setId(e.target.value),
81
- required: true,
82
- pattern: "[a-z0-9][a-z0-9_-]*",
83
- placeholder: "myproject",
84
- autoFocus: true,
85
- className: "mt-1 block w-full rounded-md border bg-background px-3 py-2 outline-none focus:ring-2 focus:ring-ring/30"
191
+ ] })] }),
192
+ /* @__PURE__ */ jsxs("div", {
193
+ className: "mb-3 mt-4 grid gap-3 sm:grid-cols-2",
194
+ children: [/* @__PURE__ */ jsxs("label", {
195
+ className: "block text-sm",
196
+ children: ["ID (slug)", /* @__PURE__ */ jsx("input", {
197
+ type: "text",
198
+ value: id,
199
+ onChange: (e) => setId(e.target.value),
200
+ required: true,
201
+ pattern: "[a-z0-9][a-z0-9_-]*",
202
+ placeholder: "myproject",
203
+ className: "mt-1 block w-full rounded-md border bg-background px-3 py-2 outline-none focus:ring-2 focus:ring-ring/30"
204
+ })]
205
+ }), /* @__PURE__ */ jsxs("label", {
206
+ className: "block text-sm",
207
+ children: [
208
+ "Name ",
209
+ /* @__PURE__ */ jsx("span", {
210
+ className: "text-muted-foreground font-normal",
211
+ children: "(optional)"
212
+ }),
213
+ /* @__PURE__ */ jsx("input", {
214
+ type: "text",
215
+ value: name,
216
+ onChange: (e) => setName(e.target.value),
217
+ className: "mt-1 block w-full rounded-md border bg-background px-3 py-2 outline-none focus:ring-2 focus:ring-ring/30"
218
+ })
219
+ ]
86
220
  })]
87
- }), /* @__PURE__ */ jsxs("label", {
88
- className: "block text-sm",
221
+ }),
222
+ /* @__PURE__ */ jsxs("label", {
223
+ className: "mb-3 block text-sm",
89
224
  children: [
90
- "Name ",
225
+ "Link target",
226
+ " ",
91
227
  /* @__PURE__ */ jsx("span", {
92
228
  className: "text-muted-foreground font-normal",
93
- children: "(optional)"
229
+ children: "(optional, absolute path)"
94
230
  }),
95
231
  /* @__PURE__ */ jsx("input", {
96
232
  type: "text",
97
- value: name,
98
- onChange: (e) => setName(e.target.value),
233
+ value: link,
234
+ onChange: (e) => setLink(e.target.value),
235
+ placeholder: "/home/you/projects/myrepo",
99
236
  className: "mt-1 block w-full rounded-md border bg-background px-3 py-2 outline-none focus:ring-2 focus:ring-ring/30"
237
+ }),
238
+ /* @__PURE__ */ jsx("span", {
239
+ className: "mt-1 block text-xs text-muted-foreground",
240
+ children: "Leave blank to create a fresh directory. Supply an absolute path to materialize the slot as a symlink to your existing project tree."
100
241
  })
101
242
  ]
102
- })]
103
- }),
104
- /* @__PURE__ */ jsxs("label", {
105
- className: "block text-sm mb-3",
106
- children: [
107
- "Link target",
108
- " ",
109
- /* @__PURE__ */ jsx("span", {
110
- className: "text-muted-foreground font-normal",
111
- children: "(optional, absolute path)"
112
- }),
113
- /* @__PURE__ */ jsx("input", {
114
- type: "text",
115
- value: link,
116
- onChange: (e) => setLink(e.target.value),
117
- placeholder: "/home/you/projects/myrepo",
118
- className: "mt-1 block w-full rounded-md border bg-background px-3 py-2 outline-none focus:ring-2 focus:ring-ring/30"
119
- }),
120
- /* @__PURE__ */ jsx("span", {
121
- className: "mt-1 block text-xs text-muted-foreground",
122
- children: "Leave blank to create a fresh directory. Supply an absolute path to materialize the slot as a symlink to your existing project tree."
123
- })
124
- ]
125
- }),
126
- err && /* @__PURE__ */ jsx("p", {
127
- className: "err mt-2",
128
- children: err
129
- }),
130
- /* @__PURE__ */ jsxs("div", {
131
- className: "mt-5 flex justify-end gap-2",
132
- children: [/* @__PURE__ */ jsx(Button, {
133
- variant: "ghost",
134
- onClick: onClose,
135
- children: "Cancel"
136
- }), /* @__PURE__ */ jsx(Button, {
137
- variant: "primary",
138
- type: "submit",
139
- disabled: busy,
140
- children: busy ? "Creating…" : "Create"
141
- })]
142
- })
143
- ]
243
+ }),
244
+ err && /* @__PURE__ */ jsx("p", {
245
+ role: "alert",
246
+ className: "err mt-2",
247
+ children: err
248
+ }),
249
+ /* @__PURE__ */ jsxs("div", {
250
+ className: "mt-5 flex justify-end gap-2",
251
+ children: [/* @__PURE__ */ jsx(Button$1, {
252
+ variant: "ghost",
253
+ disabled: busy,
254
+ onClick: onClose,
255
+ children: "Cancel"
256
+ }), /* @__PURE__ */ jsx(Button$1, {
257
+ variant: "primary",
258
+ type: "submit",
259
+ disabled: busy,
260
+ children: busy ? "Creating…" : "Create team"
261
+ })]
262
+ })
263
+ ]
264
+ })
144
265
  })
145
266
  });
146
267
  }
@@ -225,148 +346,150 @@ function SpawnDialog({ profileId, teamHint, teams, onClose }) {
225
346
  setBusy(false);
226
347
  }
227
348
  }
228
- return /* @__PURE__ */ jsx(Backdrop, {
229
- onClose,
230
- children: /* @__PURE__ */ jsxs("form", {
231
- role: "dialog",
232
- "aria-modal": "true",
233
- "aria-labelledby": "spawn-agent-title",
234
- onSubmit: submit,
349
+ return /* @__PURE__ */ jsx(Dialog$1, {
350
+ open: true,
351
+ onOpenChange: (open) => {
352
+ if (!open && !busy) onClose();
353
+ },
354
+ children: /* @__PURE__ */ jsx(DialogContent, {
355
+ showCloseButton: !busy,
235
356
  className: "max-h-[calc(100dvh-2rem)] w-full max-w-lg overflow-y-auto rounded-3xl border border-frost bg-card p-6 shadow-baziu-lg sm:p-7",
236
- onClick: (e) => e.stopPropagation(),
237
- children: [
238
- /* @__PURE__ */ jsx("h3", {
239
- id: "spawn-agent-title",
240
- className: "font-serif text-xl text-foreground mb-1",
241
- children: "Spawn a new agent"
242
- }),
243
- /* @__PURE__ */ jsxs("p", {
244
- className: "text-sm text-muted-foreground mb-4",
245
- children: ["Profile: ", /* @__PURE__ */ jsx("code", {
246
- className: "font-mono",
247
- children: profileId
248
- })]
249
- }),
250
- /* @__PURE__ */ jsxs("label", {
251
- className: "block text-sm text-foreground mb-3",
252
- children: [
253
- "Agent name",
254
- " ",
255
- /* @__PURE__ */ jsx("span", {
256
- className: "text-muted-foreground font-normal",
257
- children: "(optional — defaults to the profile's name)"
357
+ onEscapeKeyDown: (event) => {
358
+ if (busy) event.preventDefault();
359
+ },
360
+ onPointerDownOutside: (event) => {
361
+ if (busy) event.preventDefault();
362
+ },
363
+ children: /* @__PURE__ */ jsxs("form", {
364
+ onSubmit: submit,
365
+ children: [
366
+ /* @__PURE__ */ jsxs(DialogHeader, { children: [/* @__PURE__ */ jsx(DialogTitle, {
367
+ className: "font-serif text-xl text-foreground",
368
+ children: "Spawn a new agent"
369
+ }), /* @__PURE__ */ jsxs(DialogDescription, { children: [
370
+ "Create an agent from profile ",
371
+ /* @__PURE__ */ jsx("code", {
372
+ className: "font-mono",
373
+ children: profileId
258
374
  }),
259
- /* @__PURE__ */ jsx("input", {
260
- type: "text",
261
- value: name,
262
- onChange: (e) => setName(e.target.value),
263
- autoFocus: true,
264
- autoComplete: "off",
265
- className: "mt-1 block w-full rounded-md border bg-background px-3 py-2 outline-none focus:ring-2 focus:ring-ring/30"
266
- })
267
- ]
268
- }),
269
- /* @__PURE__ */ jsxs("label", {
270
- className: "block text-sm text-foreground mb-3",
271
- children: [
272
- "Initial policy placement",
273
- /* @__PURE__ */ jsxs("select", {
274
- value: placement,
375
+ ", then review its exact Team policy placement before committing."
376
+ ] })] }),
377
+ /* @__PURE__ */ jsxs("label", {
378
+ className: "mb-3 mt-4 block text-sm text-foreground",
379
+ children: [
380
+ "Agent name",
381
+ " ",
382
+ /* @__PURE__ */ jsx("span", {
383
+ className: "text-muted-foreground font-normal",
384
+ children: "(optional — defaults to the profile's name)"
385
+ }),
386
+ /* @__PURE__ */ jsx("input", {
387
+ type: "text",
388
+ value: name,
389
+ onChange: (e) => setName(e.target.value),
390
+ autoComplete: "off",
391
+ className: "mt-1 block w-full rounded-md border bg-background px-3 py-2 outline-none focus:ring-2 focus:ring-ring/30"
392
+ })
393
+ ]
394
+ }),
395
+ /* @__PURE__ */ jsxs("label", {
396
+ className: "mb-3 block text-sm text-foreground",
397
+ children: [
398
+ "Initial policy placement",
399
+ /* @__PURE__ */ jsxs("select", {
400
+ value: placement,
401
+ onChange: (e) => {
402
+ setPlacement(e.target.value);
403
+ setPreview(null);
404
+ },
405
+ className: "mt-1 block w-full rounded-md border bg-background px-3 py-2",
406
+ children: [/* @__PURE__ */ jsx("option", {
407
+ value: "profile_defaults",
408
+ children: "Agent-template defaults"
409
+ }), /* @__PURE__ */ jsx("option", {
410
+ value: "isolated",
411
+ children: "Isolated"
412
+ })]
413
+ }),
414
+ /* @__PURE__ */ jsx("span", {
415
+ className: "mt-1 block text-xs text-muted-foreground",
416
+ children: "The current Team revision is checked again when you submit."
417
+ })
418
+ ]
419
+ }),
420
+ /* @__PURE__ */ jsxs("label", {
421
+ className: "mb-3 block text-sm text-foreground",
422
+ children: ["Team", /* @__PURE__ */ jsx("select", {
423
+ value: teamId,
275
424
  onChange: (e) => {
276
- setPlacement(e.target.value);
425
+ setTeamId(e.target.value);
277
426
  setPreview(null);
278
427
  },
279
- className: "mt-1 block w-full rounded-md border bg-background px-3 py-2",
280
- children: [/* @__PURE__ */ jsx("option", {
281
- value: "profile_defaults",
282
- children: "Agent-template defaults"
283
- }), /* @__PURE__ */ jsx("option", {
284
- value: "isolated",
285
- children: "isolated"
286
- })]
287
- }),
288
- /* @__PURE__ */ jsx("span", {
289
- className: "mt-1 block text-xs text-muted-foreground",
290
- children: "The current Team revision is checked again when you submit."
291
- })
292
- ]
293
- }),
294
- /* @__PURE__ */ jsxs("label", {
295
- className: "block text-sm text-foreground mb-3",
296
- children: ["Team", /* @__PURE__ */ jsx("select", {
297
- value: teamId,
298
- onChange: (e) => {
299
- setTeamId(e.target.value);
300
- setPreview(null);
301
- },
302
- className: "mt-1 block w-full rounded-md border bg-background px-3 py-2 outline-none focus:ring-2 focus:ring-ring/30",
303
- children: teams.map((g) => /* @__PURE__ */ jsxs("option", {
304
- value: g.id,
305
- children: [g.name, g.id === "default" ? " (default)" : ""]
306
- }, g.id))
307
- })]
308
- }),
309
- err && /* @__PURE__ */ jsx("p", {
310
- className: "err mt-2",
311
- children: err
312
- }),
313
- preview && /* @__PURE__ */ jsxs("div", {
314
- className: "mt-3 rounded-md border border-sapphire-light bg-sapphire-glow p-3 text-sm",
315
- children: [
316
- /* @__PURE__ */ jsxs("p", { children: [
317
- "Creating this Agent advances Team revision ",
318
- preview.currentRevision,
319
- " ",
320
- /* @__PURE__ */ jsx("strong", { children: preview.resultingRevision }),
321
- " and adds ",
322
- /* @__PURE__ */ jsx("strong", { children: preview.addedEdges.length }),
323
- " directed edges to the existing ",
324
- preview.existingEdges.length,
325
- "."
326
- ] }),
327
- /* @__PURE__ */ jsx("ul", {
328
- className: "mt-2 max-h-36 overflow-auto",
329
- children: preview.addedEdges.map((edge, index) => /* @__PURE__ */ jsx("li", { children: /* @__PURE__ */ jsxs("code", { children: [
330
- edge.sourceKind,
331
- edge.sourceId ? `:${edge.sourceId}` : "",
332
- " ",
333
- edge.targetKind,
334
- edge.targetId ? `:${edge.targetId}` : ""
335
- ] }) }, `${edge.sourceKind}:${edge.sourceId ?? ""}>${edge.targetKind}:${edge.targetId ?? ""}:${index}`))
336
- }),
337
- preview.addedEdges.length === 0 && /* @__PURE__ */ jsx("p", {
338
- className: "mt-2",
339
- children: "The new Agent starts isolated."
340
- })
341
- ]
342
- }),
343
- /* @__PURE__ */ jsxs("div", {
344
- className: "mt-5 flex justify-end gap-2",
345
- children: [/* @__PURE__ */ jsx(Button, {
346
- variant: "ghost",
347
- onClick: onClose,
348
- children: "Cancel"
349
- }), /* @__PURE__ */ jsx(Button, {
350
- variant: "primary",
351
- type: "submit",
352
- disabled: busy,
353
- children: busy ? "Working…" : preview ? "Commit reviewed creation" : "Review exact policy"
354
- })]
355
- })
356
- ]
428
+ className: "mt-1 block w-full rounded-md border bg-background px-3 py-2 outline-none focus:ring-2 focus:ring-ring/30",
429
+ children: teams.map((g) => /* @__PURE__ */ jsxs("option", {
430
+ value: g.id,
431
+ children: [g.name, g.id === "default" ? " (default)" : ""]
432
+ }, g.id))
433
+ })]
434
+ }),
435
+ err && /* @__PURE__ */ jsx("p", {
436
+ role: "alert",
437
+ className: "err mt-2",
438
+ children: err
439
+ }),
440
+ preview && /* @__PURE__ */ jsxs("div", {
441
+ role: "status",
442
+ className: "mt-3 rounded-md border border-sapphire-light bg-sapphire-glow p-3 text-sm",
443
+ children: [
444
+ /* @__PURE__ */ jsxs("p", { children: [
445
+ "Creating this Agent advances Team revision ",
446
+ preview.currentRevision,
447
+ " →",
448
+ " ",
449
+ /* @__PURE__ */ jsx("strong", { children: preview.resultingRevision }),
450
+ " and adds",
451
+ " ",
452
+ /* @__PURE__ */ jsx("strong", { children: preview.addedEdges.length }),
453
+ " directed edges to the existing",
454
+ " ",
455
+ preview.existingEdges.length,
456
+ "."
457
+ ] }),
458
+ /* @__PURE__ */ jsx("ul", {
459
+ className: "mt-2 max-h-36 overflow-auto",
460
+ children: preview.addedEdges.map((edge, index) => /* @__PURE__ */ jsx("li", { children: /* @__PURE__ */ jsxs("code", { children: [
461
+ edge.sourceKind,
462
+ edge.sourceId ? `:${edge.sourceId}` : "",
463
+ " ",
464
+ edge.targetKind,
465
+ edge.targetId ? `:${edge.targetId}` : ""
466
+ ] }) }, `${edge.sourceKind}:${edge.sourceId ?? ""}>${edge.targetKind}:${edge.targetId ?? ""}:${index}`))
467
+ }),
468
+ preview.addedEdges.length === 0 && /* @__PURE__ */ jsx("p", {
469
+ className: "mt-2",
470
+ children: "The new Agent starts isolated."
471
+ })
472
+ ]
473
+ }),
474
+ /* @__PURE__ */ jsxs("div", {
475
+ className: "mt-5 flex justify-end gap-2",
476
+ children: [/* @__PURE__ */ jsx(Button$1, {
477
+ variant: "ghost",
478
+ disabled: busy,
479
+ onClick: onClose,
480
+ children: "Cancel"
481
+ }), /* @__PURE__ */ jsx(Button$1, {
482
+ variant: "primary",
483
+ type: "submit",
484
+ disabled: busy,
485
+ children: busy ? "Working…" : preview ? "Commit reviewed creation" : "Review exact policy"
486
+ })]
487
+ })
488
+ ]
489
+ })
357
490
  })
358
491
  });
359
492
  }
360
- function Backdrop({ children, onClose }) {
361
- return /* @__PURE__ */ jsx("div", {
362
- onClick: onClose,
363
- onKeyDown: (event) => {
364
- if (event.key === "Escape") onClose();
365
- },
366
- className: "fixed inset-0 z-50 flex items-center justify-center bg-charcoal/45 p-4 backdrop-blur-sm",
367
- children
368
- });
369
- }
370
493
  //#endregion
371
494
  //#region src/components/SpawnTeamModal.tsx
372
495
  function SpawnTeamModal({ profileGroup: team, teams, onClose, onSpawned }) {
@@ -375,13 +498,9 @@ function SpawnTeamModal({ profileGroup: team, teams, onClose, onSpawned }) {
375
498
  const [error, setError] = useState(null);
376
499
  const [busy, setBusy] = useState(false);
377
500
  const [preview, setPreview] = useState(null);
378
- const dialogRef = useRef(null);
379
- useEffect(() => {
380
- dialogRef.current?.focus();
381
- }, []);
382
501
  async function requestBody() {
383
502
  const target = teamId.trim();
384
- if (!target) throw new Error("target Team slug is required");
503
+ if (!target) throw new Error("Target Team slug is required");
385
504
  const existing = teams.find((team) => team.id === target);
386
505
  let teamExpectedRevision;
387
506
  if (existing) {
@@ -422,7 +541,7 @@ function SpawnTeamModal({ profileGroup: team, teams, onClose, onSpawned }) {
422
541
  async function spawn() {
423
542
  const target = teamId.trim();
424
543
  if (!target) {
425
- setError("target Team slug is required");
544
+ setError("Target Team slug is required");
426
545
  return;
427
546
  }
428
547
  setBusy(true);
@@ -442,43 +561,36 @@ function SpawnTeamModal({ profileGroup: team, teams, onClose, onSpawned }) {
442
561
  setBusy(false);
443
562
  }
444
563
  }
445
- return /* @__PURE__ */ jsx("div", {
446
- role: "dialog",
447
- "aria-modal": "true",
448
- "aria-labelledby": "spawn-team-title",
449
- className: "fixed inset-0 z-50 flex items-center justify-center bg-charcoal/45 p-4 backdrop-blur-sm",
450
- onClick: onClose,
451
- onKeyDown: (event) => {
452
- if (event.key === "Escape") onClose();
564
+ return /* @__PURE__ */ jsx(Dialog$1, {
565
+ open: true,
566
+ onOpenChange: (open) => {
567
+ if (!open && !busy) onClose();
453
568
  },
454
- children: /* @__PURE__ */ jsxs("div", {
455
- ref: dialogRef,
456
- tabIndex: -1,
569
+ children: /* @__PURE__ */ jsxs(DialogContent, {
570
+ showCloseButton: !busy,
457
571
  className: "max-h-[calc(100dvh-2rem)] w-full max-w-lg overflow-y-auto rounded-3xl border border-frost bg-card p-6 shadow-baziu-lg sm:p-7",
458
- role: "document",
459
- onClick: (event) => event.stopPropagation(),
460
- onKeyDown: (event) => {
461
- if (event.key !== "Escape") event.stopPropagation();
572
+ onEscapeKeyDown: (event) => {
573
+ if (busy) event.preventDefault();
574
+ },
575
+ onPointerDownOutside: (event) => {
576
+ if (busy) event.preventDefault();
462
577
  },
463
578
  children: [
464
- /* @__PURE__ */ jsxs("h2", {
465
- id: "spawn-team-title",
579
+ /* @__PURE__ */ jsxs(DialogHeader, { children: [/* @__PURE__ */ jsxs(DialogTitle, {
580
+ className: "font-serif text-xl text-foreground",
466
581
  children: ["Spawn team — ", team.name]
467
- }),
582
+ }), /* @__PURE__ */ jsxs(DialogDescription, { children: [
583
+ "Uses immutable Team revision ",
584
+ team.currentRevision,
585
+ ". Existing Teams append at their current reviewed revision; a new Team initializes at revision 1. Conflicts never overwrite newer state."
586
+ ] })] }),
468
587
  error && /* @__PURE__ */ jsx("div", {
588
+ role: "alert",
469
589
  className: "err",
470
590
  children: error
471
591
  }),
472
- /* @__PURE__ */ jsxs("p", {
473
- className: "muted",
474
- children: [
475
- "Uses immutable Team revision ",
476
- team.currentRevision,
477
- ". Existing Teams append at their current reviewed revision; a new Team initializes at revision 1. Conflicts never overwrite newer state."
478
- ]
479
- }),
480
592
  /* @__PURE__ */ jsxs("label", { children: [
481
- "target Team slug",
593
+ "Target Team slug",
482
594
  /* @__PURE__ */ jsx("input", {
483
595
  value: teamId,
484
596
  onChange: (event) => {
@@ -496,7 +608,7 @@ function SpawnTeamModal({ profileGroup: team, teams, onClose, onSpawned }) {
496
608
  }, team.id))
497
609
  })
498
610
  ] }),
499
- /* @__PURE__ */ jsxs("label", { children: ["starter USER.md (new Team only)", /* @__PURE__ */ jsx("textarea", {
611
+ /* @__PURE__ */ jsxs("label", { children: ["Starter USER.md (new Team only)", /* @__PURE__ */ jsx("textarea", {
500
612
  rows: 3,
501
613
  value: userMd,
502
614
  onChange: (event) => {
@@ -506,6 +618,7 @@ function SpawnTeamModal({ profileGroup: team, teams, onClose, onSpawned }) {
506
618
  className: "font-mono text-[0.88em] leading-[1.55]"
507
619
  })] }),
508
620
  preview && /* @__PURE__ */ jsxs("div", {
621
+ role: "status",
509
622
  className: "mt-4 rounded-md border border-sapphire-light bg-sapphire-glow p-3 text-sm",
510
623
  children: [
511
624
  /* @__PURE__ */ jsxs("p", { children: [
@@ -546,20 +659,21 @@ function SpawnTeamModal({ profileGroup: team, teams, onClose, onSpawned }) {
546
659
  }),
547
660
  /* @__PURE__ */ jsxs("div", {
548
661
  className: "mt-4 flex justify-end gap-2",
549
- children: [/* @__PURE__ */ jsx(Button, {
662
+ children: [/* @__PURE__ */ jsx(Button$1, {
550
663
  variant: "ghost",
664
+ disabled: busy,
551
665
  onClick: onClose,
552
- children: "cancel"
553
- }), preview ? /* @__PURE__ */ jsx(Button, {
666
+ children: "Cancel"
667
+ }), preview ? /* @__PURE__ */ jsx(Button$1, {
554
668
  variant: "primary",
555
669
  onClick: spawn,
556
670
  disabled: busy,
557
- children: busy ? "spawning…" : `commit ${preview.mode}`
558
- }) : /* @__PURE__ */ jsx(Button, {
671
+ children: busy ? "Spawning…" : `Commit ${preview.mode}`
672
+ }) : /* @__PURE__ */ jsx(Button$1, {
559
673
  variant: "primary",
560
674
  onClick: review,
561
675
  disabled: busy || team.slotCount === 0,
562
- children: busy ? "reviewing…" : "review exact result"
676
+ children: busy ? "Reviewing…" : "Review exact result"
563
677
  })]
564
678
  })
565
679
  ]
@@ -580,11 +694,52 @@ function Sidebar({ agents, teams, profiles, profileGroups, selectedAgentId, init
580
694
  const [spawnTeamFor, setSpawnTeamFor] = useState(null);
581
695
  const [createGroupOpen, setCreateGroupOpen] = useState(false);
582
696
  const [menuOpen, setMenuOpen] = useState(false);
697
+ const [renameTarget, setRenameTarget] = useState(null);
698
+ const [archiveTarget, setArchiveTarget] = useState(null);
699
+ const [actionError, setActionError] = useState(null);
583
700
  const newButtonRef = useRef(null);
701
+ const newMenuRef = useRef(null);
584
702
  const restoreNewButton = () => window.requestAnimationFrame(() => newButtonRef.current?.focus());
585
703
  const [openGroups, setOpenGroups] = useState(() => initialOpenGroups ?? {});
586
- async function rename(a) {
587
- const next = window.prompt(`rename "${a.name}" to:`, a.name)?.trim();
704
+ useEffect(() => {
705
+ if (!menuOpen) return;
706
+ const menu = newMenuRef.current;
707
+ window.requestAnimationFrame(() => {
708
+ menu?.querySelector("[role=\"menuitem\"]:not([disabled])")?.focus();
709
+ });
710
+ const onPointerDown = (event) => {
711
+ if (menu?.contains(event.target) || newButtonRef.current?.contains(event.target)) return;
712
+ setMenuOpen(false);
713
+ restoreNewButton();
714
+ };
715
+ const onKeyDown = (event) => {
716
+ if (event.key !== "Escape") return;
717
+ event.preventDefault();
718
+ setMenuOpen(false);
719
+ restoreNewButton();
720
+ };
721
+ document.addEventListener("pointerdown", onPointerDown);
722
+ document.addEventListener("keydown", onKeyDown);
723
+ return () => {
724
+ document.removeEventListener("pointerdown", onPointerDown);
725
+ document.removeEventListener("keydown", onKeyDown);
726
+ };
727
+ }, [menuOpen]);
728
+ function moveMenuFocus(event) {
729
+ if (![
730
+ "ArrowDown",
731
+ "ArrowUp",
732
+ "Home",
733
+ "End"
734
+ ].includes(event.key)) return;
735
+ const items = Array.from(event.currentTarget.querySelectorAll("[role=\"menuitem\"]:not([disabled])"));
736
+ if (items.length === 0) return;
737
+ event.preventDefault();
738
+ const current = items.indexOf(document.activeElement);
739
+ items[event.key === "Home" ? 0 : event.key === "End" ? items.length - 1 : event.key === "ArrowDown" ? (current + 1 + items.length) % items.length : (current - 1 + items.length) % items.length]?.focus();
740
+ }
741
+ async function rename(a, nextName) {
742
+ const next = nextName.trim();
588
743
  if (!next || next === a.name) return;
589
744
  const res = await fetch(`/api/agents/${a.id}`, {
590
745
  method: "PATCH",
@@ -593,17 +748,15 @@ function Sidebar({ agents, teams, profiles, profileGroups, selectedAgentId, init
593
748
  });
594
749
  if (!res.ok) {
595
750
  const body = await res.json().catch(() => null);
596
- alert(body?.error ?? res.statusText);
597
- return;
751
+ throw new Error(body?.error ?? `Could not rename agent (${res.status})`);
598
752
  }
599
753
  await router.invalidate();
600
754
  }
601
755
  async function archive(a) {
602
- if (!confirm(`archive "${a.name}"? (reversible — find under "show archived")`)) return;
603
756
  const res = await fetch(`/api/agents/${a.id}/archive`, { method: "POST" });
604
757
  if (!res.ok && res.status !== 204) {
605
- alert(res.statusText);
606
- return;
758
+ const body = await res.json().catch(() => null);
759
+ throw new Error(body?.error ?? `Could not archive agent (${res.status})`);
607
760
  }
608
761
  await router.invalidate();
609
762
  }
@@ -641,7 +794,7 @@ function Sidebar({ agents, teams, profiles, profileGroups, selectedAgentId, init
641
794
  })
642
795
  }), /* @__PURE__ */ jsx("span", { children: "Agents" })]
643
796
  }), /* @__PURE__ */ jsxs("p", {
644
- className: "mt-0.5 truncate pl-9 text-[0.7rem] text-muted-foreground",
797
+ className: "mt-0.5 truncate pl-9 text-xs text-muted-foreground",
645
798
  children: [
646
799
  agents.length,
647
800
  " agent",
@@ -656,8 +809,11 @@ function Sidebar({ agents, teams, profiles, profileGroups, selectedAgentId, init
656
809
  className: "relative",
657
810
  children: [/* @__PURE__ */ jsxs("button", {
658
811
  ref: newButtonRef,
812
+ id: "sidebar-new-menu-button",
659
813
  type: "button",
660
814
  onClick: () => setMenuOpen((v) => !v),
815
+ "aria-label": "Create a new Agent or Team",
816
+ "aria-controls": menuOpen ? "sidebar-new-menu" : void 0,
661
817
  "aria-expanded": menuOpen,
662
818
  "aria-haspopup": "menu",
663
819
  className: "unstyled inline-flex h-8 items-center gap-1 rounded-lg border border-border bg-card px-2.5 text-xs font-semibold text-foreground shadow-baziu-sm transition-colors hover:border-primary/30 hover:bg-accent hover:text-accent-foreground",
@@ -673,9 +829,12 @@ function Sidebar({ agents, teams, profiles, profileGroups, selectedAgentId, init
673
829
  })
674
830
  ]
675
831
  }), menuOpen && /* @__PURE__ */ jsxs("div", {
832
+ ref: newMenuRef,
833
+ id: "sidebar-new-menu",
676
834
  role: "menu",
835
+ "aria-labelledby": "sidebar-new-menu-button",
677
836
  className: "absolute right-0 top-[calc(100%+0.4rem)] z-20 w-60 overflow-hidden rounded-xl border border-border bg-popover p-1.5 text-popover-foreground shadow-baziu-lg",
678
- onMouseLeave: () => setMenuOpen(false),
837
+ onKeyDown: moveMenuFocus,
679
838
  children: [
680
839
  profiles.length === 0 ? /* @__PURE__ */ jsxs("div", {
681
840
  className: "rounded-lg bg-muted/40 px-3 py-2.5 text-xs leading-5 text-muted-foreground",
@@ -684,12 +843,13 @@ function Sidebar({ agents, teams, profiles, profileGroups, selectedAgentId, init
684
843
  " ",
685
844
  /* @__PURE__ */ jsx("a", {
686
845
  href: "/templates/agents",
846
+ role: "menuitem",
687
847
  className: "text-primary underline",
688
848
  children: "Create one to spawn agents."
689
849
  })
690
850
  ]
691
851
  }) : /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsxs("div", {
692
- className: "flex items-center gap-1.5 px-2.5 pb-1 pt-1 text-[0.68rem] font-semibold uppercase tracking-[0.1em] text-muted-foreground",
852
+ className: "flex items-center gap-1.5 px-2.5 pb-1 pt-1 text-xs font-semibold uppercase tracking-[0.08em] text-muted-foreground",
693
853
  children: [/* @__PURE__ */ jsx(Bot, {
694
854
  className: "size-3",
695
855
  "aria-hidden": "true"
@@ -715,14 +875,14 @@ function Sidebar({ agents, teams, profiles, profileGroups, selectedAgentId, init
715
875
  children: p.name || p.id
716
876
  }),
717
877
  p.id === "default" && /* @__PURE__ */ jsx("span", {
718
- className: "rounded-full border border-border bg-muted px-1.5 py-0.5 text-[0.65rem] font-semibold text-muted-foreground",
878
+ className: "rounded-full border border-border bg-muted px-1.5 py-0.5 text-xs font-semibold text-muted-foreground",
719
879
  children: "Default"
720
880
  })
721
881
  ]
722
882
  }, p.id))] }),
723
883
  /* @__PURE__ */ jsx("div", { className: "my-1.5 h-px bg-border" }),
724
884
  /* @__PURE__ */ jsxs("div", {
725
- className: "flex items-center gap-1.5 px-2.5 pb-1 pt-1 text-[0.68rem] font-semibold uppercase tracking-[0.1em] text-muted-foreground",
885
+ className: "flex items-center gap-1.5 px-2.5 pb-1 pt-1 text-xs font-semibold uppercase tracking-[0.08em] text-muted-foreground",
726
886
  children: [/* @__PURE__ */ jsx(UsersRound, {
727
887
  className: "size-3",
728
888
  "aria-hidden": "true"
@@ -735,6 +895,7 @@ function Sidebar({ agents, teams, profiles, profileGroups, selectedAgentId, init
735
895
  " ",
736
896
  /* @__PURE__ */ jsx("a", {
737
897
  href: "/templates/teams",
898
+ role: "menuitem",
738
899
  className: "text-primary underline",
739
900
  children: "Create one"
740
901
  }),
@@ -763,7 +924,7 @@ function Sidebar({ agents, teams, profiles, profileGroups, selectedAgentId, init
763
924
  children: pg.name || pg.id
764
925
  }),
765
926
  /* @__PURE__ */ jsx("span", {
766
- className: "inline-flex min-w-6 items-center justify-center rounded-full bg-muted px-1.5 font-mono text-[0.68rem] text-muted-foreground",
927
+ className: "inline-flex min-w-6 items-center justify-center rounded-full bg-muted px-1.5 font-mono text-xs text-muted-foreground",
767
928
  children: pg.slotCount
768
929
  })
769
930
  ]
@@ -771,6 +932,7 @@ function Sidebar({ agents, teams, profiles, profileGroups, selectedAgentId, init
771
932
  /* @__PURE__ */ jsx("div", { className: "my-1.5 h-px bg-border" }),
772
933
  /* @__PURE__ */ jsxs("button", {
773
934
  type: "button",
935
+ role: "menuitem",
774
936
  onClick: () => {
775
937
  setMenuOpen(false);
776
938
  setCreateGroupOpen(true);
@@ -785,10 +947,15 @@ function Sidebar({ agents, teams, profiles, profileGroups, selectedAgentId, init
785
947
  })]
786
948
  })]
787
949
  }),
950
+ actionError && /* @__PURE__ */ jsx("p", {
951
+ role: "alert",
952
+ className: "m-2 rounded-lg bg-danger/10 px-3 py-2 text-xs text-danger",
953
+ children: actionError
954
+ }),
788
955
  /* @__PURE__ */ jsx("nav", {
789
956
  className: "flex-1 overflow-y-auto p-1.5",
790
957
  "aria-label": "Teams and agents",
791
- children: agents.length === 0 && teams.length === 0 ? /* @__PURE__ */ jsxs("div", {
958
+ children: agents.length === 0 ? /* @__PURE__ */ jsxs("div", {
792
959
  className: "m-1 flex flex-col items-center rounded-xl border border-dashed border-border bg-muted/30 px-4 py-6 text-center",
793
960
  children: [
794
961
  /* @__PURE__ */ jsx("span", {
@@ -804,12 +971,20 @@ function Sidebar({ agents, teams, profiles, profileGroups, selectedAgentId, init
804
971
  }),
805
972
  /* @__PURE__ */ jsx("p", {
806
973
  className: "mt-1 text-xs leading-5 text-muted-foreground",
807
- children: "Spawn your first agent to start a conversation."
974
+ children: "Your default Team is ready. Spawn the first agent to start a conversation."
808
975
  }),
809
- /* @__PURE__ */ jsxs("a", {
810
- href: "/agents",
976
+ sortedProfiles[0] ? /* @__PURE__ */ jsxs("button", {
977
+ type: "button",
978
+ onClick: () => setSpawnFor({ profileId: sortedProfiles[0]?.id ?? "default" }),
979
+ className: "unstyled mt-3 inline-flex min-h-9 items-center gap-1 rounded-lg bg-primary px-3 text-xs font-semibold text-primary-foreground hover:bg-primary/90",
980
+ children: ["Spawn first agent", /* @__PURE__ */ jsx(ChevronRight, {
981
+ className: "size-3.5",
982
+ "aria-hidden": "true"
983
+ })]
984
+ }) : /* @__PURE__ */ jsxs("a", {
985
+ href: "/templates/agents",
811
986
  className: "mt-3 inline-flex items-center gap-1 text-xs font-semibold text-primary hover:text-primary/80",
812
- children: ["Open agent setup", /* @__PURE__ */ jsx(ChevronRight, {
987
+ children: ["Create an Agent template", /* @__PURE__ */ jsx(ChevronRight, {
813
988
  className: "size-3.5",
814
989
  "aria-hidden": "true"
815
990
  })]
@@ -852,11 +1027,11 @@ function Sidebar({ agents, teams, profiles, profileGroups, selectedAgentId, init
852
1027
  children: g.name
853
1028
  }),
854
1029
  g.id === "default" && /* @__PURE__ */ jsx("span", {
855
- className: "text-[0.62rem] font-semibold uppercase tracking-wide text-muted-foreground",
1030
+ className: "text-xs font-semibold uppercase tracking-wide text-muted-foreground",
856
1031
  children: "Default"
857
1032
  }),
858
1033
  /* @__PURE__ */ jsx("span", {
859
- className: "inline-flex min-w-6 items-center justify-center rounded-full border border-border bg-card px-1.5 font-mono text-[0.68rem] text-muted-foreground",
1034
+ className: "inline-flex min-w-6 items-center justify-center rounded-full border border-border bg-card px-1.5 font-mono text-xs text-muted-foreground",
860
1035
  children: teamAgents.length
861
1036
  })
862
1037
  ]
@@ -894,7 +1069,7 @@ function Sidebar({ agents, teams, profiles, profileGroups, selectedAgentId, init
894
1069
  })
895
1070
  ]
896
1071
  }), /* @__PURE__ */ jsxs("div", {
897
- className: "mt-0.5 flex gap-2 pl-3 font-mono text-[0.65rem] text-muted-foreground",
1072
+ className: "mt-0.5 flex gap-2 pl-3 font-mono text-xs text-muted-foreground",
898
1073
  children: [/* @__PURE__ */ jsx("span", {
899
1074
  className: "uppercase tracking-wide",
900
1075
  children: a.status
@@ -904,7 +1079,7 @@ function Sidebar({ agents, teams, profiles, profileGroups, selectedAgentId, init
904
1079
  className: "absolute right-1 top-1/2 z-10 flex -translate-y-1/2 gap-0.5",
905
1080
  children: [/* @__PURE__ */ jsx("button", {
906
1081
  type: "button",
907
- onClick: () => rename(a),
1082
+ onClick: () => setRenameTarget(a),
908
1083
  title: "Rename",
909
1084
  "aria-label": `Rename ${a.name}`,
910
1085
  className: "unstyled flex size-8 items-center justify-center rounded-lg text-muted-foreground transition-colors hover:bg-card hover:text-primary focus-visible:bg-card",
@@ -914,7 +1089,7 @@ function Sidebar({ agents, teams, profiles, profileGroups, selectedAgentId, init
914
1089
  })
915
1090
  }), /* @__PURE__ */ jsx("button", {
916
1091
  type: "button",
917
- onClick: () => archive(a),
1092
+ onClick: () => setArchiveTarget(a),
918
1093
  title: "Archive",
919
1094
  "aria-label": `Archive ${a.name}`,
920
1095
  className: "unstyled flex size-8 items-center justify-center rounded-lg text-muted-foreground transition-colors hover:bg-destructive/10 hover:text-destructive focus-visible:bg-destructive/10 focus-visible:text-destructive",
@@ -956,9 +1131,114 @@ function Sidebar({ agents, teams, profiles, profileGroups, selectedAgentId, init
956
1131
  createGroupOpen && /* @__PURE__ */ jsx(CreateTeamDialog, { onClose: () => {
957
1132
  setCreateGroupOpen(false);
958
1133
  restoreNewButton();
959
- } })
1134
+ } }),
1135
+ /* @__PURE__ */ jsx(RenameAgentDialog, {
1136
+ agent: renameTarget,
1137
+ onOpenChange: (open) => {
1138
+ if (!open) setRenameTarget(null);
1139
+ },
1140
+ onRename: async (agent, name) => {
1141
+ setActionError(null);
1142
+ try {
1143
+ await rename(agent, name);
1144
+ } catch (error) {
1145
+ setActionError(error instanceof Error ? error.message : String(error));
1146
+ throw error;
1147
+ }
1148
+ }
1149
+ }),
1150
+ /* @__PURE__ */ jsx(ConfirmDialog, {
1151
+ open: archiveTarget !== null,
1152
+ onOpenChange: (open) => {
1153
+ if (!open) setArchiveTarget(null);
1154
+ },
1155
+ title: `Archive ${archiveTarget?.name ?? "agent"}?`,
1156
+ description: /* @__PURE__ */ jsx("p", { children: "The Agent will stop appearing in this sidebar and cannot receive normal work. You can restore it later from the Agents page with “Show archived”." }),
1157
+ confirmLabel: "Archive agent",
1158
+ confirmVariant: "primary",
1159
+ onConfirm: async () => {
1160
+ if (!archiveTarget) return;
1161
+ setActionError(null);
1162
+ try {
1163
+ await archive(archiveTarget);
1164
+ } catch (error) {
1165
+ setActionError(error instanceof Error ? error.message : String(error));
1166
+ throw error;
1167
+ }
1168
+ }
1169
+ })
960
1170
  ]
961
1171
  });
962
1172
  }
1173
+ function RenameAgentDialog({ agent, onOpenChange, onRename }) {
1174
+ const [name, setName] = useState("");
1175
+ const [busy, setBusy] = useState(false);
1176
+ const [error, setError] = useState(null);
1177
+ function changeOpen(open) {
1178
+ if (!open && busy) return;
1179
+ if (open && agent) setName(agent.name);
1180
+ if (!open) {
1181
+ setName("");
1182
+ setError(null);
1183
+ setBusy(false);
1184
+ }
1185
+ onOpenChange(open);
1186
+ }
1187
+ async function submit(event) {
1188
+ event.preventDefault();
1189
+ if (!agent || !name.trim() || name.trim() === agent.name) return;
1190
+ setBusy(true);
1191
+ setError(null);
1192
+ try {
1193
+ await onRename(agent, name);
1194
+ changeOpen(false);
1195
+ } catch (cause) {
1196
+ setError(cause instanceof Error ? cause.message : String(cause));
1197
+ setBusy(false);
1198
+ }
1199
+ }
1200
+ return /* @__PURE__ */ jsx(Dialog$1, {
1201
+ open: agent !== null,
1202
+ onOpenChange: changeOpen,
1203
+ children: /* @__PURE__ */ jsx(DialogContent, {
1204
+ showCloseButton: !busy,
1205
+ children: /* @__PURE__ */ jsxs("form", {
1206
+ onSubmit: (event) => void submit(event),
1207
+ children: [
1208
+ /* @__PURE__ */ jsxs(DialogHeader, { children: [/* @__PURE__ */ jsxs(DialogTitle, { children: ["Rename ", agent?.name ?? "agent"] }), /* @__PURE__ */ jsx(DialogDescription, { children: "This changes the display name only; the Agent ID and history stay the same." })] }),
1209
+ /* @__PURE__ */ jsxs("label", {
1210
+ className: "mt-4 block text-sm font-semibold text-foreground",
1211
+ children: ["Agent name", /* @__PURE__ */ jsx("input", {
1212
+ autoFocus: true,
1213
+ className: "mt-1",
1214
+ value: name || agent?.name || "",
1215
+ onChange: (event) => setName(event.target.value),
1216
+ maxLength: 120
1217
+ })]
1218
+ }),
1219
+ error && /* @__PURE__ */ jsx("p", {
1220
+ role: "alert",
1221
+ className: "mt-3 text-sm text-danger",
1222
+ children: error
1223
+ }),
1224
+ /* @__PURE__ */ jsxs(DialogFooter, {
1225
+ className: "mt-4",
1226
+ children: [/* @__PURE__ */ jsx(Button$1, {
1227
+ variant: "ghost",
1228
+ disabled: busy,
1229
+ onClick: () => changeOpen(false),
1230
+ children: "Cancel"
1231
+ }), /* @__PURE__ */ jsx(Button$1, {
1232
+ variant: "primary",
1233
+ type: "submit",
1234
+ disabled: busy || !name.trim() || name.trim() === agent?.name,
1235
+ children: busy ? "Renaming…" : "Rename agent"
1236
+ })]
1237
+ })
1238
+ ]
1239
+ })
1240
+ })
1241
+ });
1242
+ }
963
1243
  //#endregion
964
1244
  export { Sidebar as n, SIDEBAR_OPEN_GROUPS_COOKIE as t };