bazilion 0.27.0 → 0.51.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 (234) hide show
  1. package/dist/cli.js +651 -309
  2. package/dist/cli.js.map +1 -1
  3. package/dist/daemon.js +2105 -997
  4. package/dist/daemon.js.map +1 -1
  5. package/dist/web/client/assets/AddProviderDialog-Diic36c_.js +1 -0
  6. package/dist/web/client/assets/ConfigPage-pupvtSCX.js +1 -0
  7. package/dist/web/client/assets/ConfirmDialog-GFDcHI1L.js +1 -0
  8. package/dist/web/client/assets/ConnectionsView-y1CeY-6U.js +1 -0
  9. package/dist/web/client/assets/Dialog-bg86_x4v.js +1 -0
  10. package/dist/web/client/assets/FieldRow-B8eIni5r.js +1 -0
  11. package/dist/web/client/assets/ModelSelect-DvCLUmkW.js +1 -0
  12. package/dist/web/client/assets/SectionTabs-D4ezA6U4.js +1 -0
  13. package/dist/web/client/assets/Segmented-Dh77vmpp.js +1 -0
  14. package/dist/web/client/assets/SkillFindings-BzLO1lNA.js +1 -0
  15. package/dist/web/client/assets/SkillsPicker-hI3YXvib.js +1 -0
  16. package/dist/web/client/assets/SpawnDialog-YJX6UMBC.js +1 -0
  17. package/dist/web/client/assets/Tabs-f6bHvCGn.js +1 -0
  18. package/dist/web/client/assets/TeamForm-kda1HYZG.js +1 -0
  19. package/dist/web/client/assets/TeamThread-DFvbakHo.js +1 -0
  20. package/dist/web/client/assets/UnsavedChangesGuard-DBJikVgc.js +1 -0
  21. package/dist/web/client/assets/_id-BjNtLwak.js +1 -0
  22. package/dist/web/client/assets/_id-BklaQf3z.js +1 -0
  23. package/dist/web/client/assets/agents-D9cUF2d9.js +1 -0
  24. package/dist/web/client/assets/agents-wuBlzx4e.js +1 -0
  25. package/dist/web/client/assets/api-HC_YzjBy.js +1 -0
  26. package/dist/web/client/assets/arrow-right-Gm_FDWJ_.js +1 -0
  27. package/dist/web/client/assets/attention-8ZkSLl2e.js +1 -0
  28. package/dist/web/client/assets/check-BjgKoGvU.js +1 -0
  29. package/dist/web/client/assets/config-Con_BbSh.js +1 -0
  30. package/dist/web/client/assets/createLucideIcon-C6gOo8sD.js +1 -0
  31. package/dist/web/client/assets/index-Br9qkGM-.js +54 -0
  32. package/dist/web/client/assets/link-Cbztlp_R.js +1 -0
  33. package/dist/web/client/assets/login-llnOKSJc.js +1 -0
  34. package/dist/web/client/assets/mcp-zIUguMSI.js +1 -0
  35. package/dist/web/client/assets/plus-CWrKMtvA.js +1 -0
  36. package/dist/web/client/assets/routes-BY5uqJ2n.js +76 -0
  37. package/dist/web/client/assets/save-f9O-CQia.js +1 -0
  38. package/dist/web/client/assets/services-esLrcTwe.js +1 -0
  39. package/dist/web/client/assets/skills-DzYXksM0.js +1 -0
  40. package/dist/web/client/assets/style-Cdzqt_TJ.js +7 -0
  41. package/dist/web/client/assets/styles-BRSS6yrm.css +2 -0
  42. package/dist/web/client/assets/system-CsI66nyZ.js +1 -0
  43. package/dist/web/client/assets/teams-CHE_zpxS.js +1 -0
  44. package/dist/web/client/assets/teams-dxG9OESG.js +1 -0
  45. package/dist/web/client/assets/telegram-C3dGndJV.js +1 -0
  46. package/dist/web/client/assets/tokens-CNNH-Wr9.js +1 -0
  47. package/dist/web/client/assets/use-resource-BjnxgGvh.js +1 -0
  48. package/dist/web/client/assets/welcome-C8EOtc8P.js +1 -0
  49. package/dist/web/server/assets/AddProviderDialog-CR6TRYdZ.js +910 -0
  50. package/dist/web/server/assets/{ConfigPage-CGld_wCK.js → ConfigPage-CIh3ohea.js} +4 -4
  51. package/dist/web/server/assets/ConfirmDialog-B79K2KEW.js +52 -0
  52. package/dist/web/server/assets/ConnectionsView-BIMYdp9C.js +710 -0
  53. package/dist/web/server/assets/{ConfirmDialog-LdVlEanK.js → Dialog-CVqpXxuN.js} +3 -50
  54. package/dist/web/server/assets/{FieldRow-Dah2KKqo.js → FieldRow-CHVhX2rS.js} +4 -4
  55. package/dist/web/server/assets/{ModelSelect-Vwro6OkL.js → ModelSelect-DrZrdndo.js} +7 -7
  56. package/dist/web/server/assets/Rail-Cg-efcpA.js +698 -0
  57. package/dist/web/server/assets/{SectionTabs-CqFg9Vwx.js → SectionTabs-DrcgVeZd.js} +4 -18
  58. package/dist/web/server/assets/Segmented-3ZLdqa5U.js +18 -0
  59. package/dist/web/server/assets/{SkillFindings-Bd6e81Wu.js → SkillFindings-DSDiL6hn.js} +1 -1
  60. package/dist/web/server/assets/{SpawnDialog-BGNaMfFb.js → SpawnDialog-BUUlLxE9.js} +25 -7
  61. package/dist/web/server/assets/{TeamForm-C93tpn9r.js → TeamForm-CvQAs2FA.js} +1 -1
  62. package/dist/web/server/assets/TeamThread-5CjVPcDr.js +190 -0
  63. package/dist/web/server/assets/{UnsavedChangesGuard-Dm4a27_5.js → UnsavedChangesGuard-CyF2Z9p1.js} +8 -4
  64. package/dist/web/server/assets/{TeamPolicyEditor-BHS3J0R9.js → _id-0fEWiVZX.js} +114 -263
  65. package/dist/web/server/assets/{_id-B0x1ffz3.js → _id-8bsYEcGg.js} +2 -2
  66. package/dist/web/server/assets/{_id-sW6zXrTP.js → _id-BvAaRSUW.js} +2 -2
  67. package/dist/web/server/assets/{_id-lOVnT5sS.js → _id-Dg6M_qfr.js} +6 -6
  68. package/dist/web/server/assets/{_id-ByiXeIPS.js → _id-Dji7xr9C.js} +2 -2
  69. package/dist/web/server/assets/{_id-Bdf_Rg62.js → _id-TVruGcOd.js} +1 -1
  70. package/dist/web/server/assets/_tanstack-start-manifest_v-sxiIH4M7.js +214 -0
  71. package/dist/web/server/assets/{agents-D4tqK1kH.js → agents-BDA5yYZ2.js} +14 -15
  72. package/dist/web/server/assets/{agents-Cn9GkXFX.js → agents-BTDxmp-F.js} +2 -2
  73. package/dist/web/server/assets/{agents-BNPkidbH.js → agents-BnWgFo6o.js} +1 -1
  74. package/dist/web/server/assets/{agents-lOqc6VGd.js → agents-DM7guWF2.js} +2 -2
  75. package/dist/web/server/assets/{agents-DycxHDt8.js → agents-DktqUffG.js} +10 -10
  76. package/dist/web/server/assets/{agents-BK8OmB8g.js → agents-xgZ9rsac.js} +2 -2
  77. package/dist/web/server/assets/{attention-DULVjdmF.js → attention-CHQEQiZl.js} +2 -2
  78. package/dist/web/server/assets/{attention-YWnLKA2E.js → attention-Cr7puThv.js} +1 -1
  79. package/dist/web/server/assets/{attention-BIm455bC.js → attention-De3-ehuf.js} +6 -6
  80. package/dist/web/server/assets/{auth-DiN92ydD.js → auth-dJnrFW6y.js} +1 -1
  81. package/dist/web/server/assets/config-DOp28gcy.js +1067 -0
  82. package/dist/web/server/assets/config-DzgkbBoD.js +17 -0
  83. package/dist/web/server/assets/config-X7qWbbpH.js +20 -0
  84. package/dist/web/server/assets/{Page-CMSYKXWJ.js → createSsrRpc-CcLbajrF.js} +17 -2
  85. package/dist/web/server/assets/{daemon-client-DL2ik2Em.js → daemon-client-B_ZRIIrT.js} +2 -1
  86. package/dist/web/server/assets/{mcp-BwmpNQPN.js → mcp-C97uAZe1.js} +1 -1
  87. package/dist/web/server/assets/{mcp-B09_O05r.js → mcp-CO_tycXU.js} +9 -9
  88. package/dist/web/server/assets/{mcp-CqdTfXcn.js → mcp-D3OCoHtO.js} +2 -2
  89. package/dist/web/server/assets/router-Cs2Ak4II.js +892 -0
  90. package/dist/web/server/assets/routes-BSNOKE-C.js +7647 -0
  91. package/dist/web/server/assets/routes-BVwqgZGI.js +16 -0
  92. package/dist/web/server/assets/routes-CO4l-GJ0.js +57 -0
  93. package/dist/web/server/assets/{services-Q9HYQXXB.js → services-DZLxUSG8.js} +2 -2
  94. package/dist/web/server/assets/{services-BLvAvb8g.js → services-DsHRLL8q.js} +1 -1
  95. package/dist/web/server/assets/{services-tCfB1B83.js → services-DsvpaF3L.js} +4 -4
  96. package/dist/web/server/assets/{skills-BZg_txbf.js → skills-CggQJk6a.js} +2 -2
  97. package/dist/web/server/assets/{skills-C7fqRPna.js → skills-DKYV7PTk.js} +11 -11
  98. package/dist/web/server/assets/{skills-C_g8IKag.js → skills-h5aHa7Q8.js} +1 -1
  99. package/dist/web/server/assets/style-GYDODk2F.js +178 -0
  100. package/dist/web/server/assets/system-CZ2qzBz3.js +138 -0
  101. package/dist/web/server/assets/system-DsJfpBPl.js +12 -0
  102. package/dist/web/server/assets/system-DtswhLW62.js +18 -0
  103. package/dist/web/server/assets/{teams-BS-oweRl.js → teams-B6PzNcoy.js} +23 -15
  104. package/dist/web/server/assets/{teams-D4CaU76n.js → teams-B6lBhvdL.js} +2 -2
  105. package/dist/web/server/assets/{teams-BHkhnt6b.js → teams-Bp2tERZe.js} +2 -2
  106. package/dist/web/server/assets/{teams-DX2HmKqi.js → teams-BxnvFTyn.js} +1 -1
  107. package/dist/web/server/assets/{teams-BSflKBP8.js → teams-C-8iz-uV.js} +6 -6
  108. package/dist/web/server/assets/{teams-CNyB5nM9.js → teams-YrmyutM4.js} +1 -1
  109. package/dist/web/server/assets/{telegram-CrJiygCX.js → telegram-CXrP3hMp.js} +6 -6
  110. package/dist/web/server/assets/{telegram-BUdnc8oF.js → telegram-D2RZriz_.js} +2 -2
  111. package/dist/web/server/assets/{telegram-C4v1HhyJ.js → telegram-Gy7_9yih.js} +1 -1
  112. package/dist/web/server/assets/{tokens-DqldzPUq.js → tokens-C-oDTqnp.js} +2 -2
  113. package/dist/web/server/assets/{tokens-B1twAJdd.js → tokens-CEdl8puR.js} +1 -1
  114. package/dist/web/server/assets/{tokens-DdjEyALj.js → tokens-DSLwQ1Pw.js} +10 -10
  115. package/dist/web/server/assets/use-resource-ChQozXVI.js +63 -0
  116. package/dist/web/server/assets/welcome-BLw1G6SS.js +318 -0
  117. package/dist/web/server/assets/welcome-ByAkvHSP.js +26 -0
  118. package/dist/web/server/assets/welcome-CxXMI4HI.js +15 -0
  119. package/dist/web/server/assets/workspace-DeEYMPDX.js +658 -0
  120. package/dist/web/server/server.js +30 -74
  121. package/dist/worker.js +78 -36
  122. package/dist/worker.js.map +1 -1
  123. package/package.json +1 -1
  124. package/dist/web/client/assets/AgentAvatar-DWx-bM6n.js +0 -1
  125. package/dist/web/client/assets/ChatPane-DOV_HJg-.js +0 -72
  126. package/dist/web/client/assets/ConfigPage-Dfu9DzFX.js +0 -1
  127. package/dist/web/client/assets/ConfirmDialog-536ziJ5P.js +0 -1
  128. package/dist/web/client/assets/FieldRow-z1JqCdqn.js +0 -1
  129. package/dist/web/client/assets/ModelSelect-CvOHjUyB.js +0 -1
  130. package/dist/web/client/assets/ResultCard-X4nTbjYY.js +0 -1
  131. package/dist/web/client/assets/SectionTabs-DXHzXmmb.js +0 -1
  132. package/dist/web/client/assets/SkillFindings-8LX6bYf_.js +0 -1
  133. package/dist/web/client/assets/SkillsPicker-Cr87y_W-.js +0 -1
  134. package/dist/web/client/assets/SpawnDialog-DoZl-yes.js +0 -1
  135. package/dist/web/client/assets/SpawnTeamModal-C638hEoN.js +0 -1
  136. package/dist/web/client/assets/Tabs-D0LgBNIk.js +0 -1
  137. package/dist/web/client/assets/TeamForm-C-WzvOl4.js +0 -1
  138. package/dist/web/client/assets/TeamPolicyEditor-CSKBx0oK.js +0 -7
  139. package/dist/web/client/assets/UnsavedChangesGuard-GC-vzw7h.js +0 -1
  140. package/dist/web/client/assets/_id-BKLynswT.js +0 -1
  141. package/dist/web/client/assets/_id-BYM_NORr.js +0 -1
  142. package/dist/web/client/assets/_id-Cxa98a9m.js +0 -1
  143. package/dist/web/client/assets/_id-D4hV1U1t.js +0 -1
  144. package/dist/web/client/assets/agent-actions-CXQCoxKO.js +0 -1
  145. package/dist/web/client/assets/agents-BxPS1_Bp.js +0 -1
  146. package/dist/web/client/assets/agents-GozAWW-l.js +0 -1
  147. package/dist/web/client/assets/attention-Cz9rZcrr.js +0 -1
  148. package/dist/web/client/assets/chevron-right-CPAb1zac.js +0 -1
  149. package/dist/web/client/assets/config-9vv9Lipb.js +0 -3
  150. package/dist/web/client/assets/inbox-DHLArXxl.js +0 -1
  151. package/dist/web/client/assets/index-1YXquAq8.js +0 -52
  152. package/dist/web/client/assets/jsx-runtime-bzQ4Vb5N.js +0 -1
  153. package/dist/web/client/assets/learning-PvtXm8Ne.js +0 -1
  154. package/dist/web/client/assets/login-DIJpNQFo.js +0 -1
  155. package/dist/web/client/assets/mcp-pKBL0xIf.js +0 -1
  156. package/dist/web/client/assets/members-DHWsgsEs.js +0 -1
  157. package/dist/web/client/assets/memory-CEVppPyU.js +0 -1
  158. package/dist/web/client/assets/plus-BaIRdB10.js +0 -1
  159. package/dist/web/client/assets/policy-DEh4BLSw.js +0 -1
  160. package/dist/web/client/assets/preload-helper-eUUcpe2S.js +0 -1
  161. package/dist/web/client/assets/results-DgJPjEZF.js +0 -1
  162. package/dist/web/client/assets/review-BbshafTQ.js +0 -1
  163. package/dist/web/client/assets/route-Ccb8v41z.js +0 -1
  164. package/dist/web/client/assets/route-D1d6kCEV.js +0 -1
  165. package/dist/web/client/assets/routes-g7V4ru7T.js +0 -1
  166. package/dist/web/client/assets/services-B2f7e5jV.js +0 -1
  167. package/dist/web/client/assets/settings-B6elpcYm.js +0 -1
  168. package/dist/web/client/assets/skills-CngE7TF8.js +0 -1
  169. package/dist/web/client/assets/styles-xUnZ-ep_.css +0 -2
  170. package/dist/web/client/assets/teams-BdJZXOan.js +0 -1
  171. package/dist/web/client/assets/teams-c496ISsT.js +0 -1
  172. package/dist/web/client/assets/telegram-B_-hK6EC.js +0 -1
  173. package/dist/web/client/assets/tokens-CKz8gx4-.js +0 -1
  174. package/dist/web/client/assets/triggers-DCEPciGW.js +0 -1
  175. package/dist/web/client/assets/welcome-D-zVOLGA.js +0 -1
  176. package/dist/web/server/assets/AgentAvatar-8gTAy_tP.js +0 -37
  177. package/dist/web/server/assets/ChatPane-De_FPEoD.js +0 -1887
  178. package/dist/web/server/assets/ResultCard-CZn1w4KA.js +0 -97
  179. package/dist/web/server/assets/Sidebar-puq47KyR.js +0 -430
  180. package/dist/web/server/assets/SpawnTeamModal-C6GbfScI.js +0 -97
  181. package/dist/web/server/assets/_id-BR6tnR6I.js +0 -23
  182. package/dist/web/server/assets/_id-Bm611NQz.js +0 -13
  183. package/dist/web/server/assets/_id-D5UCoyES.js +0 -359
  184. package/dist/web/server/assets/_id-DHx5UmmL.js +0 -12
  185. package/dist/web/server/assets/_id-DLpGmOVm.js +0 -19
  186. package/dist/web/server/assets/_id-Y5ctILG2.js +0 -13
  187. package/dist/web/server/assets/_id-dDA0pdVo.js +0 -54
  188. package/dist/web/server/assets/_tanstack-start-manifest_v-B8u80HjK.js +0 -292
  189. package/dist/web/server/assets/agent-actions-BBdFVdoa.js +0 -20
  190. package/dist/web/server/assets/api-WWxPqx67.js +0 -85
  191. package/dist/web/server/assets/config-BNEgu7WG.js +0 -798
  192. package/dist/web/server/assets/config-C1VB28se.js +0 -12
  193. package/dist/web/server/assets/config-TdVqnqNL.js +0 -25
  194. package/dist/web/server/assets/createSsrRpc-6LHNEsSK.js +0 -16
  195. package/dist/web/server/assets/inbox-4Vj5jTT8.js +0 -245
  196. package/dist/web/server/assets/inbox-D4IqUv3l.js +0 -38
  197. package/dist/web/server/assets/inbox-Dle24AfV.js +0 -23
  198. package/dist/web/server/assets/learning-BScq7VbO.js +0 -12
  199. package/dist/web/server/assets/learning-CBWFEnhg.js +0 -263
  200. package/dist/web/server/assets/learning-DWAKevhF.js +0 -25
  201. package/dist/web/server/assets/members-B8QBF6TF.js +0 -12
  202. package/dist/web/server/assets/members-DsF02Wp7.js +0 -12
  203. package/dist/web/server/assets/members-tWZA9b15.js +0 -36
  204. package/dist/web/server/assets/memory-BNN0b-0x.js +0 -12
  205. package/dist/web/server/assets/memory-CTl1E1Rm.js +0 -267
  206. package/dist/web/server/assets/memory-CV5uCBb2.js +0 -12
  207. package/dist/web/server/assets/policy-C9M6zV6w.js +0 -79
  208. package/dist/web/server/assets/policy-h-6NpU3m.js +0 -19
  209. package/dist/web/server/assets/policy-xEw9X0DK.js +0 -12
  210. package/dist/web/server/assets/results-D3A3UA4d.js +0 -182
  211. package/dist/web/server/assets/results-D6Ui5S8D.js +0 -12
  212. package/dist/web/server/assets/results-DWmxvfyn.js +0 -15
  213. package/dist/web/server/assets/review-CyQky-WQ.js +0 -40
  214. package/dist/web/server/assets/review-Sq0GGcPV.js +0 -322
  215. package/dist/web/server/assets/review-XWbSF8cF.js +0 -12
  216. package/dist/web/server/assets/route-BErtkz6t.js +0 -19
  217. package/dist/web/server/assets/route-CLoV-An_.js +0 -48
  218. package/dist/web/server/assets/route-WQ19JkBa.js +0 -19
  219. package/dist/web/server/assets/route-dEK_2GLj.js +0 -203
  220. package/dist/web/server/assets/route-iHTkhO81.js +0 -16
  221. package/dist/web/server/assets/route-zs8uUQtB.js +0 -16
  222. package/dist/web/server/assets/router-BI9gmY3S.js +0 -751
  223. package/dist/web/server/assets/routes-081s4n24.js +0 -45
  224. package/dist/web/server/assets/routes-CWo5WPsr.js +0 -15
  225. package/dist/web/server/assets/routes-Cqp1ufHm.js +0 -56
  226. package/dist/web/server/assets/settings-CVaGv-xF.js +0 -12
  227. package/dist/web/server/assets/settings-D9viV-86.js +0 -561
  228. package/dist/web/server/assets/settings-DaZNZ_CC.js +0 -27
  229. package/dist/web/server/assets/triggers-B7LW784F.js +0 -214
  230. package/dist/web/server/assets/triggers-C5sMCZXv2.js +0 -12
  231. package/dist/web/server/assets/triggers-DMfVdImD.js +0 -12
  232. package/dist/web/server/assets/welcome-D0d38Pzx.js +0 -93
  233. package/dist/web/client/assets/{TeamPolicyEditor-DLioOiRN.css → style-DLioOiRN.css} +0 -0
  234. package/dist/web/server/assets/{start-DTX6aKCi.js → start-DhW7sy23.js} +1 -1
@@ -0,0 +1,698 @@
1
+ import { E as errorMessage, _ as useActivity, d as Button, f as AgentAvatar, g as teamSummary, h as shortTime, w as api } from "./workspace-DeEYMPDX.js";
2
+ import { n as DEFAULT_TEAM_ID, t as DEFAULT_PROFILE_ID } from "./entities-Dn2xzKIw.js";
3
+ import { t as useHydrated } from "./use-resource-ChQozXVI.js";
4
+ import { n as DialogActions, t as Dialog$1 } from "./Dialog-CVqpXxuN.js";
5
+ import { t as ConfirmDialog } from "./ConfirmDialog-B79K2KEW.js";
6
+ import { i as renameAgent, n as archiveAgent, t as SpawnDialog } from "./SpawnDialog-BUUlLxE9.js";
7
+ import { t as TeamForm } from "./TeamForm-CvQAs2FA.js";
8
+ import { createContext, useContext, useMemo, useRef, useState } from "react";
9
+ import { Link, useRouter } from "@tanstack/react-router";
10
+ import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
11
+ import { Archive, Bot, ChevronDown, ChevronRight, Ellipsis, PanelLeft, PanelRight, Pencil, Plus, Send, Settings2, UsersRound } from "lucide-react";
12
+ import { DropdownMenu } from "radix-ui";
13
+ //#region src/components/workspace/context.tsx
14
+ var WorkspaceContext = createContext(null);
15
+ function WorkspaceProvider({ value, children }) {
16
+ const full = useMemo(() => {
17
+ const byId = new Map(value.agents.map((agent) => [agent.id, agent]));
18
+ return {
19
+ ...value,
20
+ agentById: (id) => byId.get(id),
21
+ to: (patch) => ({
22
+ ...value.search,
23
+ ...patch
24
+ })
25
+ };
26
+ }, [value]);
27
+ return /* @__PURE__ */ jsx(WorkspaceContext.Provider, {
28
+ value: full,
29
+ children
30
+ });
31
+ }
32
+ function useWorkspace() {
33
+ const value = useContext(WorkspaceContext);
34
+ if (!value) throw new Error("useWorkspace needs a WorkspaceProvider");
35
+ return value;
36
+ }
37
+ /** The workspace when there is one: a conversation can also render on its own. */
38
+ function useWorkspaceOptional() {
39
+ return useContext(WorkspaceContext);
40
+ }
41
+ //#endregion
42
+ //#region src/components/SpawnTeamModal.tsx
43
+ /** Spawn a Team template's Agents and allow edges into a new or existing Team. */
44
+ function SpawnTeamModal({ template, teams, initialTeamId = "", onClose, onSpawned }) {
45
+ const [teamId, setTeamId] = useState(initialTeamId);
46
+ const [userMd, setUserMd] = useState("");
47
+ const [error, setError] = useState(null);
48
+ const [busy, setBusy] = useState(false);
49
+ const target = teamId.trim();
50
+ const existing = teams.some((team) => team.id === target);
51
+ async function spawn(event) {
52
+ event.preventDefault();
53
+ setBusy(true);
54
+ setError(null);
55
+ try {
56
+ await api(`/api/team-templates/${encodeURIComponent(template.id)}/spawn`, { body: {
57
+ teamId: target,
58
+ ...userMd && !existing ? { userMd } : {}
59
+ } });
60
+ onSpawned(target);
61
+ } catch (cause) {
62
+ setError(errorMessage(cause));
63
+ } finally {
64
+ setBusy(false);
65
+ }
66
+ }
67
+ return /* @__PURE__ */ jsx(Dialog$1, {
68
+ title: `Spawn team: ${template.name}`,
69
+ description: /* @__PURE__ */ jsxs(Fragment$1, { children: [
70
+ "Creates ",
71
+ template.slots.length,
72
+ " Agent",
73
+ template.slots.length === 1 ? "" : "s",
74
+ " and",
75
+ " ",
76
+ template.edges.length,
77
+ " allow edge",
78
+ template.edges.length === 1 ? "" : "s",
79
+ ". An unknown slug creates a new ",
80
+ template.policyMode,
81
+ " Team; an existing Team keeps its mode."
82
+ ] }),
83
+ busy,
84
+ onClose,
85
+ children: /* @__PURE__ */ jsxs("form", {
86
+ onSubmit: (event) => void spawn(event),
87
+ children: [
88
+ /* @__PURE__ */ jsxs("label", { children: [
89
+ "Target Team slug",
90
+ /* @__PURE__ */ jsx("input", {
91
+ value: teamId,
92
+ onChange: (event) => setTeamId(event.target.value),
93
+ list: "spawn-team-targets",
94
+ required: true
95
+ }),
96
+ /* @__PURE__ */ jsx("datalist", {
97
+ id: "spawn-team-targets",
98
+ children: teams.map((team) => /* @__PURE__ */ jsx("option", {
99
+ value: team.id,
100
+ children: team.name
101
+ }, team.id))
102
+ })
103
+ ] }),
104
+ !existing && /* @__PURE__ */ jsxs("label", { children: ["Starter USER.md (new Team only; defaults to the template's)", /* @__PURE__ */ jsx("textarea", {
105
+ rows: 3,
106
+ value: userMd,
107
+ onChange: (event) => setUserMd(event.target.value),
108
+ className: "font-mono text-[0.88em] leading-[1.55]"
109
+ })] }),
110
+ error && /* @__PURE__ */ jsx("p", {
111
+ role: "alert",
112
+ className: "err mt-2",
113
+ children: error
114
+ }),
115
+ /* @__PURE__ */ jsx("div", {
116
+ className: "mt-4",
117
+ children: /* @__PURE__ */ jsxs(DialogActions, { children: [/* @__PURE__ */ jsx(Button, {
118
+ variant: "ghost",
119
+ disabled: busy,
120
+ onClick: onClose,
121
+ children: "Cancel"
122
+ }), /* @__PURE__ */ jsx(Button, {
123
+ variant: "primary",
124
+ type: "submit",
125
+ disabled: busy || !target || template.slots.length === 0,
126
+ children: busy ? "Spawning…" : "Spawn team"
127
+ })] })
128
+ })
129
+ ]
130
+ })
131
+ });
132
+ }
133
+ //#endregion
134
+ //#region src/components/workspace/Rail.tsx
135
+ var SIDEBAR_OPEN_GROUPS_COOKIE = "bz_sidebar_open_groups";
136
+ function writeOpenGroupsCookie(map) {
137
+ document.cookie = `${SIDEBAR_OPEN_GROUPS_COOKIE}=${encodeURIComponent(JSON.stringify(map))}; Path=/; Max-Age=31536000; SameSite=Lax`;
138
+ }
139
+ var MENU_ITEM = "flex min-h-8 w-full cursor-pointer items-center gap-2 rounded-lg px-2.5 py-1.5 text-left text-sm text-foreground outline-none transition-colors data-[highlighted]:bg-accent data-[highlighted]:text-accent-foreground data-[disabled]:cursor-not-allowed data-[disabled]:opacity-50";
140
+ var MENU_LABEL = "flex items-center gap-1.5 px-2.5 pb-1 pt-1 text-xs font-semibold uppercase tracking-[0.08em] text-muted-foreground";
141
+ var STATE_TEXT = {
142
+ needs: "text-warning",
143
+ working: "text-success",
144
+ paused: "text-warning",
145
+ fresh: "text-accent-foreground",
146
+ idle: "text-muted-foreground"
147
+ };
148
+ var STATE_DOT = {
149
+ needs: "bg-warning",
150
+ working: "bg-success animate-pulse",
151
+ paused: "bg-fawn",
152
+ fresh: "bg-primary",
153
+ idle: "bg-fawn"
154
+ };
155
+ /** The Default Team first, then the rest as the daemon lists them. */
156
+ function sortTeams(teams) {
157
+ return [...teams].sort((a, b) => Number(b.id === DEFAULT_TEAM_ID) - Number(a.id === DEFAULT_TEAM_ID));
158
+ }
159
+ function Rail({ initialOpenGroups }) {
160
+ const { agents, teams, profiles, teamTemplates, agent: open, team: inView, search } = useWorkspace();
161
+ const activity = useActivity();
162
+ const router = useRouter();
163
+ const [spawnProfile, setSpawnProfile] = useState(null);
164
+ const [spawnTeam, setSpawnTeam] = useState(void 0);
165
+ const [spawnTemplate, setSpawnTemplate] = useState(null);
166
+ const [createTeamOpen, setCreateTeamOpen] = useState(false);
167
+ const [createTeamBusy, setCreateTeamBusy] = useState(false);
168
+ const [renameTarget, setRenameTarget] = useState(null);
169
+ const [archiveTarget, setArchiveTarget] = useState(null);
170
+ const [openGroups, setOpenGroups] = useState(initialOpenGroups);
171
+ const newButton = useRef(null);
172
+ const refocusNewButton = () => window.requestAnimationFrame(() => newButton.current?.focus());
173
+ const sortedProfiles = [...profiles].sort((a, b) => Number(b.id === DEFAULT_PROFILE_ID) - Number(a.id === DEFAULT_PROFILE_ID));
174
+ const sortedTeams = sortTeams(teams);
175
+ const template = teamTemplates.find((entry) => entry.id === spawnTemplate);
176
+ const selectedId = open?.agent.id ?? null;
177
+ return /* @__PURE__ */ jsxs("aside", {
178
+ className: "flex h-full flex-col overflow-hidden rounded-2xl border border-border bg-card shadow-baziu-sm",
179
+ children: [
180
+ /* @__PURE__ */ jsxs("header", {
181
+ className: "flex items-center justify-between gap-3 border-b border-border bg-muted/60 px-3 py-2.5",
182
+ children: [/* @__PURE__ */ jsxs("div", {
183
+ className: "flex min-w-0 items-center gap-2",
184
+ children: [/* @__PURE__ */ jsx("span", {
185
+ className: "flex size-7 shrink-0 items-center justify-center rounded-[10px] bg-accent text-accent-foreground",
186
+ children: /* @__PURE__ */ jsx(UsersRound, {
187
+ className: "size-4",
188
+ "aria-hidden": "true"
189
+ })
190
+ }), /* @__PURE__ */ jsxs("div", {
191
+ className: "min-w-0",
192
+ children: [/* @__PURE__ */ jsx("div", {
193
+ className: "text-sm font-semibold leading-tight text-foreground",
194
+ children: "Teams"
195
+ }), /* @__PURE__ */ jsxs("p", {
196
+ className: "m-0 truncate text-xs leading-snug text-muted-foreground",
197
+ children: [
198
+ agents.length,
199
+ " agent",
200
+ agents.length === 1 ? "" : "s",
201
+ " in ",
202
+ teams.length,
203
+ " team",
204
+ teams.length === 1 ? "" : "s"
205
+ ]
206
+ })]
207
+ })]
208
+ }), /* @__PURE__ */ jsxs(DropdownMenu.Root, {
209
+ modal: false,
210
+ children: [/* @__PURE__ */ jsx(DropdownMenu.Trigger, {
211
+ asChild: true,
212
+ children: /* @__PURE__ */ jsxs("button", {
213
+ ref: newButton,
214
+ type: "button",
215
+ "aria-label": "Create a new Agent or Team",
216
+ className: "unstyled group 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",
217
+ children: [
218
+ /* @__PURE__ */ jsx(Plus, {
219
+ className: "size-3.5",
220
+ "aria-hidden": "true"
221
+ }),
222
+ "New",
223
+ /* @__PURE__ */ jsx(ChevronDown, {
224
+ className: "size-3.5 text-muted-foreground transition-transform group-data-[state=open]:rotate-180",
225
+ "aria-hidden": "true"
226
+ })
227
+ ]
228
+ })
229
+ }), /* @__PURE__ */ jsx(DropdownMenu.Portal, { children: /* @__PURE__ */ jsxs(DropdownMenu.Content, {
230
+ align: "end",
231
+ sideOffset: 6,
232
+ className: "z-50 w-60 rounded-xl border border-border bg-popover p-1.5 text-popover-foreground shadow-baziu-lg outline-none",
233
+ children: [
234
+ /* @__PURE__ */ jsxs(DropdownMenu.Label, {
235
+ className: MENU_LABEL,
236
+ children: [/* @__PURE__ */ jsx(Bot, {
237
+ className: "size-3",
238
+ "aria-hidden": "true"
239
+ }), "Agent templates"]
240
+ }),
241
+ sortedProfiles.length === 0 ? /* @__PURE__ */ jsx(DropdownMenu.Item, {
242
+ asChild: true,
243
+ className: MENU_ITEM,
244
+ children: /* @__PURE__ */ jsx("a", {
245
+ href: "/templates/agents",
246
+ children: "Create an Agent template"
247
+ })
248
+ }) : sortedProfiles.map((profile) => /* @__PURE__ */ jsxs(DropdownMenu.Item, {
249
+ className: MENU_ITEM,
250
+ onSelect: () => {
251
+ setSpawnTeam(inView?.id);
252
+ setSpawnProfile(profile.id);
253
+ },
254
+ children: [/* @__PURE__ */ jsx("span", {
255
+ className: "min-w-0 flex-1 truncate",
256
+ children: profile.name || profile.id
257
+ }), profile.id === "default" && /* @__PURE__ */ jsx("span", {
258
+ className: "rounded-full border border-border bg-muted px-1.5 py-0.5 text-xs font-semibold text-muted-foreground",
259
+ children: "Default"
260
+ })]
261
+ }, profile.id)),
262
+ /* @__PURE__ */ jsx(DropdownMenu.Separator, { className: "my-1.5 h-px bg-border" }),
263
+ /* @__PURE__ */ jsxs(DropdownMenu.Label, {
264
+ className: MENU_LABEL,
265
+ children: [/* @__PURE__ */ jsx(UsersRound, {
266
+ className: "size-3",
267
+ "aria-hidden": "true"
268
+ }), "Team templates"]
269
+ }),
270
+ teamTemplates.length === 0 ? /* @__PURE__ */ jsx(DropdownMenu.Item, {
271
+ asChild: true,
272
+ className: MENU_ITEM,
273
+ children: /* @__PURE__ */ jsx("a", {
274
+ href: "/templates/teams",
275
+ children: "Create a Team template"
276
+ })
277
+ }) : teamTemplates.map((entry) => /* @__PURE__ */ jsxs(DropdownMenu.Item, {
278
+ className: MENU_ITEM,
279
+ disabled: entry.slots.length === 0,
280
+ title: entry.slots.length === 0 ? "Add at least one member before spawning" : void 0,
281
+ onSelect: () => setSpawnTemplate(entry.id),
282
+ children: [/* @__PURE__ */ jsx("span", {
283
+ className: "min-w-0 flex-1 truncate",
284
+ children: entry.name || entry.id
285
+ }), /* @__PURE__ */ jsx("span", {
286
+ className: "inline-flex min-w-6 items-center justify-center rounded-full bg-muted px-1.5 font-mono text-xs text-muted-foreground",
287
+ children: entry.slots.length
288
+ })]
289
+ }, entry.id)),
290
+ /* @__PURE__ */ jsx(DropdownMenu.Separator, { className: "my-1.5 h-px bg-border" }),
291
+ /* @__PURE__ */ jsxs(DropdownMenu.Item, {
292
+ className: MENU_ITEM,
293
+ onSelect: () => setCreateTeamOpen(true),
294
+ children: [/* @__PURE__ */ jsx(Plus, {
295
+ className: "size-3.5",
296
+ "aria-hidden": "true"
297
+ }), "Create a team"]
298
+ })
299
+ ]
300
+ }) })]
301
+ })]
302
+ }),
303
+ /* @__PURE__ */ jsxs("nav", {
304
+ className: "flex-1 overflow-y-auto p-1.5",
305
+ "aria-label": "Teams and agents",
306
+ children: [agents.length === 0 && /* @__PURE__ */ jsxs("div", {
307
+ className: "m-1 mb-2 flex flex-col items-center rounded-xl border border-dashed border-border bg-muted/30 px-4 py-6 text-center",
308
+ children: [
309
+ /* @__PURE__ */ jsx("p", {
310
+ className: "m-0 text-sm font-semibold text-foreground",
311
+ children: "No agents yet"
312
+ }),
313
+ /* @__PURE__ */ jsx("p", {
314
+ className: "mt-1 text-xs leading-5 text-muted-foreground",
315
+ children: "Your default Team is ready. Spawn the first agent to start a conversation."
316
+ }),
317
+ sortedProfiles[0] ? /* @__PURE__ */ jsx(Button, {
318
+ variant: "primary",
319
+ className: "mt-3",
320
+ onClick: () => setSpawnProfile(sortedProfiles[0]?.id ?? "default"),
321
+ children: "Spawn first agent"
322
+ }) : /* @__PURE__ */ jsx("a", {
323
+ href: "/templates/agents",
324
+ className: "mt-3 text-xs font-semibold",
325
+ children: "Create an Agent template"
326
+ })
327
+ ]
328
+ }), sortedTeams.map((team) => {
329
+ const members = agents.filter((agent) => agent.teamId === team.id);
330
+ const current = inView?.id === team.id;
331
+ const isOpen = openGroups[team.id] ?? (current || team.id === "default");
332
+ const summary = teamSummary(members.map((agent) => activity.stateOf(agent.id)));
333
+ return /* @__PURE__ */ jsxs("details", {
334
+ open: isOpen,
335
+ onToggle: (event) => {
336
+ const next = event.currentTarget.open;
337
+ if (next === isOpen) return;
338
+ const merged = {
339
+ ...openGroups,
340
+ [team.id]: next
341
+ };
342
+ writeOpenGroupsCookie(merged);
343
+ setOpenGroups(merged);
344
+ },
345
+ className: "group/details mb-1 last:mb-0",
346
+ children: [/* @__PURE__ */ jsxs("summary", {
347
+ className: `flex min-h-9 cursor-pointer list-none items-center gap-1.5 rounded-lg py-1 pl-2 pr-1 text-sm transition-colors hover:bg-accent/60 [&::-webkit-details-marker]:hidden ${current ? "bg-muted text-foreground" : "text-mocha"}`,
348
+ children: [
349
+ /* @__PURE__ */ jsx(ChevronRight, {
350
+ className: "size-3.5 shrink-0 text-muted-foreground transition-transform group-open/details:rotate-90",
351
+ "aria-hidden": "true"
352
+ }),
353
+ /* @__PURE__ */ jsx("span", {
354
+ className: "min-w-0 flex-1 truncate font-semibold",
355
+ children: team.name
356
+ }),
357
+ /* @__PURE__ */ jsx("span", {
358
+ className: "shrink-0 text-xs text-muted-foreground",
359
+ children: summary || members.length
360
+ }),
361
+ /* @__PURE__ */ jsx(Link, {
362
+ to: "/",
363
+ search: {
364
+ ...open?.team.id === team.id ? { agent: open.agent.id } : {},
365
+ team: team.id,
366
+ panel: "team"
367
+ },
368
+ "aria-label": `Open ${team.name}: members, USER.md, memory`,
369
+ title: "Open the Team",
370
+ className: "flex size-7 shrink-0 items-center justify-center rounded-lg text-muted-foreground hover:bg-card hover:text-primary",
371
+ children: /* @__PURE__ */ jsx(PanelRight, {
372
+ className: "size-3.5",
373
+ "aria-hidden": "true"
374
+ })
375
+ })
376
+ ]
377
+ }), members.length === 0 ? /* @__PURE__ */ jsx("div", {
378
+ className: "py-2 pl-7 pr-2 text-xs text-muted-foreground",
379
+ children: "No agents in this team"
380
+ }) : /* @__PURE__ */ jsx("div", {
381
+ className: "space-y-0.5 py-1 pl-1.5",
382
+ children: members.map((agent) => /* @__PURE__ */ jsx(AgentRow, {
383
+ agent,
384
+ selected: agent.id === selectedId,
385
+ state: activity.stateOf(agent.id),
386
+ lastActivityAt: activity.byAgent.get(agent.id)?.lastActivityAt ?? null,
387
+ panel: search.panel,
388
+ onRename: () => setRenameTarget(agent),
389
+ onArchive: () => setArchiveTarget(agent)
390
+ }, agent.id))
391
+ })]
392
+ }, team.id);
393
+ })]
394
+ }),
395
+ spawnProfile && /* @__PURE__ */ jsx(SpawnDialog, {
396
+ profiles: sortedProfiles,
397
+ teams: sortedTeams,
398
+ profileId: spawnProfile,
399
+ teamId: spawnTeam,
400
+ onClose: () => {
401
+ setSpawnProfile(null);
402
+ refocusNewButton();
403
+ }
404
+ }),
405
+ template && /* @__PURE__ */ jsx(SpawnTeamModal, {
406
+ template,
407
+ teams: sortedTeams,
408
+ onClose: () => {
409
+ setSpawnTemplate(null);
410
+ refocusNewButton();
411
+ },
412
+ onSpawned: (slug) => {
413
+ setSpawnTemplate(null);
414
+ router.navigate({
415
+ to: "/",
416
+ search: {
417
+ team: slug,
418
+ panel: "team"
419
+ }
420
+ });
421
+ }
422
+ }),
423
+ createTeamOpen && /* @__PURE__ */ jsx(Dialog$1, {
424
+ title: "Create a team",
425
+ description: "A Team is one workspace with its own USER.md, members and shared memory.",
426
+ busy: createTeamBusy,
427
+ onClose: () => {
428
+ setCreateTeamOpen(false);
429
+ refocusNewButton();
430
+ },
431
+ children: /* @__PURE__ */ jsx(TeamForm, {
432
+ onBusyChange: setCreateTeamBusy,
433
+ onCreated: async (team) => {
434
+ setCreateTeamOpen(false);
435
+ await router.navigate({
436
+ to: "/",
437
+ search: {
438
+ team: team.id,
439
+ panel: "team"
440
+ }
441
+ });
442
+ },
443
+ extraActions: (busy) => /* @__PURE__ */ jsx(Button, {
444
+ variant: "ghost",
445
+ disabled: busy,
446
+ onClick: () => setCreateTeamOpen(false),
447
+ children: "Cancel"
448
+ })
449
+ })
450
+ }),
451
+ renameTarget && /* @__PURE__ */ jsx(RenameAgentDialog, {
452
+ agent: renameTarget,
453
+ onClose: () => setRenameTarget(null),
454
+ onRenamed: () => router.invalidate()
455
+ }),
456
+ /* @__PURE__ */ jsx(ConfirmDialog, {
457
+ open: archiveTarget !== null,
458
+ onOpenChange: (next) => {
459
+ if (!next) setArchiveTarget(null);
460
+ },
461
+ title: `Archive ${archiveTarget?.name ?? "agent"}?`,
462
+ description: /* @__PURE__ */ jsx("p", { children: "The Agent leaves this list and receives no work. Restore it later under Manage, Agents, with “Show archived”." }),
463
+ confirmLabel: "Archive agent",
464
+ confirmVariant: "primary",
465
+ onConfirm: async () => {
466
+ if (!archiveTarget) return;
467
+ await archiveAgent(archiveTarget.id);
468
+ if (archiveTarget.id === selectedId) await router.navigate({
469
+ to: "/",
470
+ search: {}
471
+ });
472
+ else await router.invalidate();
473
+ }
474
+ })
475
+ ]
476
+ });
477
+ }
478
+ function AgentRow({ agent, selected, state, lastActivityAt, panel, onRename, onArchive }) {
479
+ const hydrated = useHydrated();
480
+ return /* @__PURE__ */ jsxs("div", {
481
+ className: "group/row relative rounded-2xl",
482
+ children: [/* @__PURE__ */ jsxs(Link, {
483
+ to: "/",
484
+ search: {
485
+ agent: agent.id,
486
+ ...panel ? { panel } : {}
487
+ },
488
+ "aria-current": selected ? "page" : void 0,
489
+ className: `flex min-h-[3.1rem] items-center gap-2.5 rounded-2xl border py-1.5 pl-2 pr-9 transition-colors hover:bg-accent/60 ${selected ? "border-primary/20 bg-accent shadow-baziu-sm" : "border-transparent"}`,
490
+ children: [/* @__PURE__ */ jsx(AgentAvatar, {
491
+ identity: agent.identity,
492
+ size: 30
493
+ }), /* @__PURE__ */ jsxs("span", {
494
+ className: "block min-w-0 flex-1",
495
+ children: [/* @__PURE__ */ jsxs("span", {
496
+ className: "flex items-center gap-1.5",
497
+ children: [
498
+ /* @__PURE__ */ jsx("span", {
499
+ className: `min-w-0 truncate text-sm font-semibold leading-tight ${selected ? "text-accent-foreground" : "text-foreground"}`,
500
+ children: agent.name
501
+ }),
502
+ agent.telegramTopicId !== null && /* @__PURE__ */ jsx("span", {
503
+ className: "shrink-0 text-primary",
504
+ title: `Telegram topic #${agent.telegramTopicId}`,
505
+ role: "img",
506
+ "aria-label": `Bound to Telegram topic ${agent.telegramTopicId}`,
507
+ children: /* @__PURE__ */ jsx(Send, {
508
+ className: "size-3",
509
+ "aria-hidden": "true"
510
+ })
511
+ }),
512
+ hydrated && lastActivityAt !== null && /* @__PURE__ */ jsx("time", {
513
+ dateTime: new Date(lastActivityAt).toISOString(),
514
+ className: "ml-auto shrink-0 text-[0.7rem] font-normal text-muted-foreground",
515
+ children: shortTime(lastActivityAt)
516
+ })
517
+ ]
518
+ }), /* @__PURE__ */ jsxs("span", {
519
+ className: `mt-0.5 flex items-center gap-1.5 text-xs leading-snug ${STATE_TEXT[state.kind]}`,
520
+ children: [/* @__PURE__ */ jsx("span", {
521
+ className: `size-[7px] shrink-0 rounded-full ${STATE_DOT[state.kind]}`,
522
+ "aria-hidden": "true"
523
+ }), /* @__PURE__ */ jsx("span", {
524
+ className: "min-w-0 truncate",
525
+ children: state.text
526
+ })]
527
+ })]
528
+ })]
529
+ }), /* @__PURE__ */ jsxs(DropdownMenu.Root, {
530
+ modal: false,
531
+ children: [/* @__PURE__ */ jsx(DropdownMenu.Trigger, {
532
+ asChild: true,
533
+ children: /* @__PURE__ */ jsx("button", {
534
+ type: "button",
535
+ "aria-label": `More for ${agent.name}`,
536
+ className: "unstyled absolute right-1 top-1/2 flex size-7 -translate-y-1/2 items-center justify-center rounded-lg text-muted-foreground opacity-0 transition-opacity hover:bg-card hover:text-primary focus-visible:opacity-100 group-hover/row:opacity-100 data-[state=open]:opacity-100 [@media(hover:none)]:opacity-100",
537
+ children: /* @__PURE__ */ jsx(Ellipsis, {
538
+ className: "size-4",
539
+ "aria-hidden": "true"
540
+ })
541
+ })
542
+ }), /* @__PURE__ */ jsx(DropdownMenu.Portal, { children: /* @__PURE__ */ jsxs(DropdownMenu.Content, {
543
+ align: "start",
544
+ sideOffset: 4,
545
+ className: "z-50 w-48 rounded-xl border border-border bg-popover p-1.5 text-popover-foreground shadow-baziu-lg outline-none",
546
+ children: [
547
+ /* @__PURE__ */ jsx(DropdownMenu.Item, {
548
+ asChild: true,
549
+ className: MENU_ITEM,
550
+ children: /* @__PURE__ */ jsxs(Link, {
551
+ to: "/",
552
+ search: {
553
+ agent: agent.id,
554
+ panel: "agent"
555
+ },
556
+ children: [/* @__PURE__ */ jsx(Settings2, {
557
+ className: "size-3.5",
558
+ "aria-hidden": "true"
559
+ }), "Agent settings"]
560
+ })
561
+ }),
562
+ /* @__PURE__ */ jsxs(DropdownMenu.Item, {
563
+ className: MENU_ITEM,
564
+ onSelect: onRename,
565
+ children: [/* @__PURE__ */ jsx(Pencil, {
566
+ className: "size-3.5",
567
+ "aria-hidden": "true"
568
+ }), "Rename"]
569
+ }),
570
+ /* @__PURE__ */ jsxs(DropdownMenu.Item, {
571
+ className: MENU_ITEM,
572
+ onSelect: onArchive,
573
+ children: [/* @__PURE__ */ jsx(Archive, {
574
+ className: "size-3.5",
575
+ "aria-hidden": "true"
576
+ }), "Archive"]
577
+ })
578
+ ]
579
+ }) })]
580
+ })]
581
+ });
582
+ }
583
+ /** The rail folded to avatars, beside a full-width view. */
584
+ function SlimRail() {
585
+ const { agents, teams, agent: open, team: inView, search } = useWorkspace();
586
+ const activity = useActivity();
587
+ const sortedTeams = sortTeams(teams).filter((team) => agents.some((agent) => agent.teamId === team.id));
588
+ sortedTeams.sort((a, b) => Number(b.id === inView?.id) - Number(a.id === inView?.id));
589
+ return /* @__PURE__ */ jsxs("nav", {
590
+ "aria-label": "Agents",
591
+ className: "flex h-full w-16 flex-col items-center gap-2 overflow-y-auto rounded-xl border border-border bg-card py-2.5 shadow-baziu-sm",
592
+ children: [/* @__PURE__ */ jsx(Link, {
593
+ to: "/",
594
+ search: {
595
+ ...search,
596
+ view: void 0,
597
+ file: void 0,
598
+ result: void 0
599
+ },
600
+ "aria-label": "Back to the conversation and the full list",
601
+ title: "Back to the conversation",
602
+ className: "flex size-10 shrink-0 items-center justify-center rounded-xl text-mocha hover:bg-accent hover:text-accent-foreground",
603
+ children: /* @__PURE__ */ jsx(PanelLeft, {
604
+ className: "size-[18px]",
605
+ "aria-hidden": "true"
606
+ })
607
+ }), sortedTeams.map((team) => /* @__PURE__ */ jsxs("div", {
608
+ className: "flex w-full flex-col items-center gap-2",
609
+ children: [
610
+ /* @__PURE__ */ jsx("div", { className: "h-px w-8 bg-border" }),
611
+ /* @__PURE__ */ jsx("span", {
612
+ className: `max-w-14 truncate text-[0.65rem] font-bold uppercase tracking-[0.06em] ${team.id === inView?.id ? "text-accent-foreground" : "text-muted-foreground"}`,
613
+ title: team.name,
614
+ children: team.name
615
+ }),
616
+ agents.filter((agent) => agent.teamId === team.id).map((agent) => {
617
+ const state = activity.stateOf(agent.id);
618
+ return /* @__PURE__ */ jsxs(Link, {
619
+ to: "/",
620
+ search: {
621
+ agent: agent.id,
622
+ ...search.panel ? { panel: search.panel } : {}
623
+ },
624
+ "aria-label": `${agent.name}: ${state.text}`,
625
+ title: `${agent.name}: ${state.text}`,
626
+ className: `relative flex size-10 shrink-0 items-center justify-center rounded-full ${agent.id === open?.agent.id ? "ring-2 ring-primary ring-offset-2 ring-offset-card" : ""}`,
627
+ children: [/* @__PURE__ */ jsx(AgentAvatar, {
628
+ identity: agent.identity,
629
+ size: 40
630
+ }), /* @__PURE__ */ jsx("span", {
631
+ className: `absolute -bottom-px -right-px size-3 rounded-full border-2 border-card ${STATE_DOT[state.kind]}`,
632
+ "aria-hidden": "true"
633
+ })]
634
+ }, agent.id);
635
+ })
636
+ ]
637
+ }, team.id))]
638
+ });
639
+ }
640
+ function RenameAgentDialog({ agent, onClose, onRenamed }) {
641
+ const [name, setName] = useState(agent.name);
642
+ const [busy, setBusy] = useState(false);
643
+ const [error, setError] = useState(null);
644
+ const unchanged = !name.trim() || name.trim() === agent.name;
645
+ async function submit(event) {
646
+ event.preventDefault();
647
+ if (unchanged) return;
648
+ setBusy(true);
649
+ setError(null);
650
+ try {
651
+ await renameAgent(agent.id, name.trim());
652
+ await onRenamed();
653
+ onClose();
654
+ } catch (cause) {
655
+ setError(errorMessage(cause));
656
+ setBusy(false);
657
+ }
658
+ }
659
+ return /* @__PURE__ */ jsx(Dialog$1, {
660
+ title: `Rename ${agent.name}`,
661
+ description: "This changes the display name only; the Agent ID and history stay the same.",
662
+ busy,
663
+ onClose,
664
+ className: "max-w-md",
665
+ children: /* @__PURE__ */ jsxs("form", {
666
+ onSubmit: (event) => void submit(event),
667
+ children: [
668
+ /* @__PURE__ */ jsxs("label", { children: ["Agent name", /* @__PURE__ */ jsx("input", {
669
+ autoFocus: true,
670
+ value: name,
671
+ onChange: (event) => setName(event.target.value),
672
+ maxLength: 120
673
+ })] }),
674
+ error && /* @__PURE__ */ jsx("p", {
675
+ role: "alert",
676
+ className: "mt-3 text-sm text-danger",
677
+ children: error
678
+ }),
679
+ /* @__PURE__ */ jsx("div", {
680
+ className: "mt-4",
681
+ children: /* @__PURE__ */ jsxs(DialogActions, { children: [/* @__PURE__ */ jsx(Button, {
682
+ variant: "ghost",
683
+ disabled: busy,
684
+ onClick: onClose,
685
+ children: "Cancel"
686
+ }), /* @__PURE__ */ jsx(Button, {
687
+ variant: "primary",
688
+ type: "submit",
689
+ disabled: busy || unchanged,
690
+ children: busy ? "Renaming…" : "Rename agent"
691
+ })] })
692
+ })
693
+ ]
694
+ })
695
+ });
696
+ }
697
+ //#endregion
698
+ export { SlimRail as a, useWorkspace as c, STATE_DOT as i, useWorkspaceOptional as l, RenameAgentDialog as n, SpawnTeamModal as o, SIDEBAR_OPEN_GROUPS_COOKIE as r, WorkspaceProvider as s, Rail as t };