bazilion 0.54.0 → 0.56.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 (188) hide show
  1. package/dist/cli.js +201 -41
  2. package/dist/cli.js.map +1 -1
  3. package/dist/daemon.js +1561 -522
  4. package/dist/daemon.js.map +1 -1
  5. package/dist/web/client/assets/AddProviderDialog-DZ9mXFdq.js +1 -0
  6. package/dist/web/client/assets/AgentTemplateParts-BfG3a-ri.js +1 -0
  7. package/dist/web/client/assets/{Button-UiegBKOK.js → Button-CoKQRO-s.js} +1 -1
  8. package/dist/web/client/assets/ConfigPage-Ch-DSJUO.js +1 -0
  9. package/dist/web/client/assets/ConfirmDialog-B_jXAPmh.js +1 -0
  10. package/dist/web/client/assets/ConnectionsView-D1Liebtf.js +1 -0
  11. package/dist/web/client/assets/ManagePage-kd7iWYEL.js +1 -0
  12. package/dist/web/client/assets/SectionTabs-Dc0bNn-J.js +1 -0
  13. package/dist/web/client/assets/{Segmented-MYKKTuZO.js → Segmented-iylzLwE6.js} +1 -1
  14. package/dist/web/client/assets/SkillsParts-C5T7sYDA.js +1 -0
  15. package/dist/web/client/assets/{SpawnTeamModal-DG5UbJNK.js → SpawnTeamModal-DatFF4f_.js} +1 -1
  16. package/dist/web/client/assets/{TeamForm-DGlxWv4e.js → TeamForm-l-N_PYeE.js} +1 -1
  17. package/dist/web/client/assets/TeamThread-BWmIQiAh.js +1 -0
  18. package/dist/web/client/assets/{UnsavedChangesGuard-BmdwLH99.js → UnsavedChangesGuard-vQBdMl8h.js} +1 -1
  19. package/dist/web/client/assets/_id-C6SADaiD.js +1 -0
  20. package/dist/web/client/assets/_id-CC9r0qsr.js +1 -0
  21. package/dist/web/client/assets/{access-C8d8vaQ6.js → access-BbQFbTPh.js} +1 -1
  22. package/dist/web/client/assets/{agent-actions-BgE9fKHH.js → agent-actions-B-9KIwn6.js} +1 -1
  23. package/dist/web/client/assets/agents-BXwzmHu8.js +1 -0
  24. package/dist/web/client/assets/agents-BtETzVIY.js +1 -0
  25. package/dist/web/client/assets/arrow-right-BqqfPqVi.js +1 -0
  26. package/dist/web/client/assets/attention-BMrZJ9ui.js +1 -0
  27. package/dist/web/client/assets/{bot-Bb--PFVU.js → bot-BHky7KAX.js} +1 -1
  28. package/dist/web/client/assets/chart-column-DTsDbzL0.js +1 -0
  29. package/dist/web/client/assets/chevron-right-D1shxvdo.js +1 -0
  30. package/dist/web/client/assets/config-B2ZDYo52.js +1 -0
  31. package/dist/web/client/assets/createLucideIcon-CZHSSDYA.js +1 -0
  32. package/dist/web/client/assets/{download-C4t9l5wR.js → download-Dr0PgyMr.js} +1 -1
  33. package/dist/web/client/assets/es2015-D1pnOGPG.js +41 -0
  34. package/dist/web/client/assets/{file-text-DzbjpYrV.js → file-text-D6OTHixJ.js} +1 -1
  35. package/dist/web/client/assets/{images-DSYgPKM7.js → images-BULrW-FC.js} +1 -1
  36. package/dist/web/client/assets/index-B-N6NIX4.js +14 -0
  37. package/dist/web/client/assets/{key-round-BpK4-E3T.js → key-round-DmSZN0Kq.js} +1 -1
  38. package/dist/web/client/assets/{list-checks-JNXcmws9.js → list-checks-DdTdAQXS.js} +1 -1
  39. package/dist/web/client/assets/login-DM3q-V4R.js +1 -0
  40. package/dist/web/client/assets/{manage-SRGSx8n2.js → manage-R57MUzsY.js} +1 -1
  41. package/dist/web/client/assets/{mcp-BUWu4TvS.js → mcp-CSHrVH1t.js} +1 -1
  42. package/dist/web/client/assets/{message-square-DM2MP9vF.js → message-square-B_pULba_.js} +1 -1
  43. package/dist/web/client/assets/{network-BJ4iPjQO.js → network-BqmVqC4_.js} +1 -1
  44. package/dist/web/client/assets/parts-68zf8Fgw.js +1 -0
  45. package/dist/web/client/assets/plus-CEKaHPBw.js +1 -0
  46. package/dist/web/client/assets/preload-helper-CZOd_z6l.js +1 -0
  47. package/dist/web/client/assets/routes-DOoeKVwr.js +85 -0
  48. package/dist/web/client/assets/skills-CPZftp9O.js +1 -0
  49. package/dist/web/client/assets/{square-terminal-Dmm6cV-G.js → square-terminal-CYfGBHPC.js} +1 -1
  50. package/dist/web/client/assets/{style-CA2GAk9b.js → style-Bm9QsFpy.js} +1 -1
  51. package/dist/web/client/assets/styles-B-kTTvCo.css +2 -0
  52. package/dist/web/client/assets/{system-zQ0NnQML.js → system-Dd2P9eqE.js} +1 -1
  53. package/dist/web/client/assets/teams-7FEpSZg1.js +1 -0
  54. package/dist/web/client/assets/teams-ClirFbDV.js +1 -0
  55. package/dist/web/client/assets/telegram-BJnT5THs.js +1 -0
  56. package/dist/web/client/assets/tools-DqNXLMpc.js +1 -0
  57. package/dist/web/client/assets/usage-BC_TStVj.js +1 -0
  58. package/dist/web/client/assets/{use-resource-CQaIZbpy.js → use-resource-Bn0Sx7r6.js} +1 -1
  59. package/dist/web/client/assets/{users-round-BJrym3FG.js → users-round-cxQ5HF-C.js} +1 -1
  60. package/dist/web/client/assets/welcome-g8wtn_or.js +1 -0
  61. package/dist/web/client/assets/{wrench-GbE1M1RJ.js → wrench-BLEJjETg.js} +1 -1
  62. package/dist/web/server/assets/{AddProviderDialog-Nc5mc_P6.js → AddProviderDialog-DtkjBMv4.js} +5 -2
  63. package/dist/web/server/assets/AgentAvatar-8gTAy_tP.js +37 -0
  64. package/dist/web/server/assets/{AgentTemplateParts-DZK_r3nQ.js → AgentTemplateParts-CxWyovvM.js} +6 -2
  65. package/dist/web/server/assets/Button-Dsnw22OF.js +17 -0
  66. package/dist/web/server/assets/{ConfigPage-CxzL-gTm.js → ConfigPage-usZi48Zr.js} +2 -2
  67. package/dist/web/server/assets/{ConfirmDialog-4xeCXKHe.js → ConfirmDialog-DAcSBHkT.js} +3 -1
  68. package/dist/web/server/assets/{ConnectionsView-B02FjNsM.js → ConnectionsView-Dy6uYSRI.js} +9 -7
  69. package/dist/web/server/assets/Dialog-DTeF-nOZ.js +85 -0
  70. package/dist/web/server/assets/{ManagePage-BfCWE8Lj.js → ManagePage-Dy1EdovO.js} +2 -2
  71. package/dist/web/server/assets/{SectionTabs-CWQ5orUW.js → SectionTabs-BVrMn76H.js} +2 -1
  72. package/dist/web/server/assets/{SkillsParts-D58l8voo.js → SkillsParts-Cw05b3al.js} +6 -2
  73. package/dist/web/server/assets/SpawnDialog-BAE8W91z.js +125 -0
  74. package/dist/web/server/assets/{SpawnTeamModal-RjzAeX_Q.js → SpawnTeamModal-CgBY0HuN.js} +6 -2
  75. package/dist/web/server/assets/{TeamForm-DdOgIMiV.js → TeamForm-JyO5xJXX.js} +6 -2
  76. package/dist/web/server/assets/{TeamThread-D-PvO3fu.js → TeamThread-5o48EbXL.js} +52 -4
  77. package/dist/web/server/assets/{UnsavedChangesGuard-Bb5frygQ.js → UnsavedChangesGuard-CJQGu45L.js} +1 -1
  78. package/dist/web/server/assets/{_id-C1_l6oSR.js → _id-BE_RSvuN.js} +14 -9
  79. package/dist/web/server/assets/{_id-CHvYQhWt.js → _id-BNvm89oJ.js} +2 -2
  80. package/dist/web/server/assets/{_id-De3Bm0SG.js → _id-BW6sVrvw.js} +1 -1
  81. package/dist/web/server/assets/{_id-BPjVkcNb.js → _id-BfjTS4JO.js} +15 -9
  82. package/dist/web/server/assets/{_id-BKzOw78O.js → _id-BpumuCYL.js} +1 -1
  83. package/dist/web/server/assets/{_id-BUfy-GwH.js → _id-C54t_nX6.js} +2 -2
  84. package/dist/web/server/assets/_tanstack-start-manifest_v-BPwQX_5b.js +275 -0
  85. package/dist/web/server/assets/{access-CNfvQ3NB.js → access-6FWih7nC.js} +7 -4
  86. package/dist/web/server/assets/{access-WWspT0v4.js → access-BhAMfi7U.js} +1 -1
  87. package/dist/web/server/assets/{access-Cm_izIIC.js → access-DEyq3uP_.js} +2 -2
  88. package/dist/web/server/assets/activity-Czfq-5_F.js +471 -0
  89. package/dist/web/server/assets/{agent-actions-COnfW5AU.js → agent-actions-ChH7Mne4.js} +1 -1
  90. package/dist/web/server/assets/{agents-CRtMfKqX.js → agents-3hBjrd8B.js} +1 -1
  91. package/dist/web/server/assets/{agents-NOkh61dV.js → agents-BXuglv4G.js} +12 -6
  92. package/dist/web/server/assets/{agents-C7UmTjfO.js → agents-DhenbitX.js} +2 -2
  93. package/dist/web/server/assets/{agents-D0hfGIMK.js → agents-KJcDMj0Y.js} +9 -6
  94. package/dist/web/server/assets/{agents-DzpqlIuJ.js → agents-ncyhVx-T.js} +2 -2
  95. package/dist/web/server/assets/{agents-DQowl6Ly.js → agents-rTDlRZa5.js} +1 -1
  96. package/dist/web/server/assets/{attention-Cx9ZWPOO.js → attention-CDdOCOio.js} +3 -2
  97. package/dist/web/server/assets/{attention-CRvxt22X.js → attention-DM__BzWY.js} +24 -9
  98. package/dist/web/server/assets/{attention-CgWhXjX7.js → attention-X0U6ZmiA.js} +2 -1
  99. package/dist/web/server/assets/{auth-dJnrFW6y.js → auth-BexhV8Yq.js} +1 -1
  100. package/dist/web/server/assets/{config-B5CS8juO.js → config-Cld8Q8N7.js} +2 -2
  101. package/dist/web/server/assets/{config-X7qWbbpH.js → config-Cx5ri2DL2.js} +1 -1
  102. package/dist/web/server/assets/{config-D117117T.js → config-DpgYAXQ3.js} +9 -6
  103. package/dist/web/server/assets/createSsrRpc-6LHNEsSK.js +16 -0
  104. package/dist/web/server/assets/{daemon-client-B_ZRIIrT.js → daemon-client-RxAllljf.js} +1 -1
  105. package/dist/web/server/assets/form-BEjeiSy3.js +416 -0
  106. package/dist/web/server/assets/live-DbJeq6KP.js +263 -0
  107. package/dist/web/server/assets/{login-va4EtvA8.js → login-BJdJ219n.js} +1 -1
  108. package/dist/web/server/assets/{login-IF0Gbsuq.js → login-C4lL4AxI.js} +2 -2
  109. package/dist/web/server/assets/{manage-Ce6cI4eW.js → manage-C6ucNYZW.js} +2 -1
  110. package/dist/web/server/assets/{mcp-C96PBxpb.js → mcp-BXnWQOwM.js} +7 -4
  111. package/dist/web/server/assets/{mcp-C97uAZe1.js → mcp-C8VLspco.js} +1 -1
  112. package/dist/web/server/assets/{mcp-Bm9U6x7N.js → mcp-DwCzj7eO.js} +2 -2
  113. package/dist/web/server/assets/open-groups-BMGYUTtY.js +12 -0
  114. package/dist/web/server/assets/{page-title-CwcbXMhx.js → page-title-PTpFHXWo.js} +6 -3
  115. package/dist/web/server/assets/parts-k9M-atPa.js +436 -0
  116. package/dist/web/server/assets/{router-8Iq19GOz.js → router-BttfLktO.js} +354 -114
  117. package/dist/web/server/assets/{routes-Kwam6JmS.js → routes-A7UcreVX.js} +9 -6
  118. package/dist/web/server/assets/{routes-BLo-fWbQ.js → routes-B9jw-MJ8.js} +1286 -331
  119. package/dist/web/server/assets/{routes-BXvYYFrN.js → routes-BX2FV8rS.js} +3 -3
  120. package/dist/web/server/assets/{skills-DSezIdDc.js → skills-BVAH93cd.js} +8 -6
  121. package/dist/web/server/assets/{skills-DWzlT_hC.js → skills-Cd5Cfdaz.js} +1 -1
  122. package/dist/web/server/assets/{skills-BqCnA-74.js → skills-y3GsyKce.js} +2 -2
  123. package/dist/web/server/assets/src-vrZVrV9u.js +103 -0
  124. package/dist/web/server/assets/{start-DhW7sy23.js → start-Dl8gQ-95.js} +1 -1
  125. package/dist/web/server/assets/{style-C2hIPY_Y.js → style-BQ3H9I7Y.js} +1 -1
  126. package/dist/web/server/assets/{system-CcLCmkIC.js → system-BJPKqM6b.js} +2 -2
  127. package/dist/web/server/assets/{system-E0VePdzO.js → system-C7mejQSc.js} +3 -3
  128. package/dist/web/server/assets/{system-D3th6n2E.js → system-LsLcuVzY.js} +1 -1
  129. package/dist/web/server/assets/{teams-CdCmBJIj.js → teams-B6gbflsZ.js} +10 -6
  130. package/dist/web/server/assets/{teams-CQVV18D3.js → teams-C7kXMNgc.js} +10 -6
  131. package/dist/web/server/assets/{teams-BopOP4x7.js → teams-CPXoTggb.js} +1 -1
  132. package/dist/web/server/assets/{teams-70u1XQTr.js → teams-CeLLd2Mf.js} +1 -1
  133. package/dist/web/server/assets/{teams-DScFp8mK.js → teams-CiX8LUQo.js} +2 -2
  134. package/dist/web/server/assets/{teams-DxA-vnzY.js → teams-D-XdIkCr.js} +2 -2
  135. package/dist/web/server/assets/{telegram-CGol0CKX2.js → telegram-D7TW3LNZ.js} +1 -1
  136. package/dist/web/server/assets/{telegram-DJ8s_91Y.js → telegram-D8_V7_sW.js} +286 -272
  137. package/dist/web/server/assets/{telegram-DR7xijeS.js → telegram-DA2dwLID.js} +2 -2
  138. package/dist/web/server/assets/{tools-V6kezUpL.js → tools-CckcG9Jl.js} +5 -3
  139. package/dist/web/server/assets/{tools-CsH9DI-4.js → tools-CluiJywK.js} +2 -2
  140. package/dist/web/server/assets/{tools-C-wwWjLI.js → tools-D1BBVkRh.js} +1 -1
  141. package/dist/web/server/assets/usage-CrYyvPgf.js +46 -0
  142. package/dist/web/server/assets/usage-PNNb3pPj.js +465 -0
  143. package/dist/web/server/assets/{use-resource-CjcJwn7F.js → use-resource-BUA9qGGY.js} +1 -1
  144. package/dist/web/server/assets/{welcome-CxXMI4HI.js → welcome-CUTYf8UG.js} +1 -1
  145. package/dist/web/server/assets/{welcome-Ya8TkL4v.js → welcome-CYhh3iUU.js} +8 -6
  146. package/dist/web/server/assets/{welcome-BpmcD-ia.js → welcome-CwzLt6Rp.js} +2 -2
  147. package/dist/web/server/assets/workspace-0XPILV1W.js +82 -0
  148. package/dist/web/server/server.js +20 -20
  149. package/dist/web-server.js +4 -0
  150. package/dist/web-server.js.map +1 -1
  151. package/dist/worker.js +40 -15
  152. package/dist/worker.js.map +1 -1
  153. package/package.json +4 -4
  154. package/dist/web/client/assets/AddProviderDialog-CkwSq3C7.js +0 -1
  155. package/dist/web/client/assets/AgentTemplateParts-CEn_4qVs.js +0 -1
  156. package/dist/web/client/assets/ConfigPage-CUbHBhzx.js +0 -1
  157. package/dist/web/client/assets/ConfirmDialog-VqBOFZEp.js +0 -1
  158. package/dist/web/client/assets/ConnectionsView-ByARMcWP.js +0 -1
  159. package/dist/web/client/assets/ManagePage-BJWZd1ts.js +0 -1
  160. package/dist/web/client/assets/SectionTabs-ViZKm3-B.js +0 -1
  161. package/dist/web/client/assets/SkillsParts-UvNK5SYP.js +0 -1
  162. package/dist/web/client/assets/TeamThread-mkwODO0S.js +0 -1
  163. package/dist/web/client/assets/_id-CvcxNmBH.js +0 -1
  164. package/dist/web/client/assets/_id-UyBk7gRl.js +0 -1
  165. package/dist/web/client/assets/agents-CgtzqBpD.js +0 -1
  166. package/dist/web/client/assets/agents-D7W4BT8r.js +0 -1
  167. package/dist/web/client/assets/arrow-right-D0HKRb7U.js +0 -1
  168. package/dist/web/client/assets/attention-D9mQWoKt.js +0 -1
  169. package/dist/web/client/assets/chevron-right-bs0TUSl2.js +0 -1
  170. package/dist/web/client/assets/config-Dw6GWf38.js +0 -1
  171. package/dist/web/client/assets/createLucideIcon-DkniuEtD.js +0 -1
  172. package/dist/web/client/assets/index-YW0gXPfk.js +0 -14
  173. package/dist/web/client/assets/login-DcQJk5-U.js +0 -1
  174. package/dist/web/client/assets/parts-LZxl9Gvc.js +0 -41
  175. package/dist/web/client/assets/plus-CLGNN5QX.js +0 -1
  176. package/dist/web/client/assets/routes-BxIIyGho.js +0 -85
  177. package/dist/web/client/assets/skills-C7DzIwFJ.js +0 -1
  178. package/dist/web/client/assets/styles-C3CDSGAr.css +0 -2
  179. package/dist/web/client/assets/teams-BEIJHObN.js +0 -1
  180. package/dist/web/client/assets/teams-DlOc7Ods.js +0 -1
  181. package/dist/web/client/assets/telegram-DKHq5DpE.js +0 -1
  182. package/dist/web/client/assets/tools-BKIpLaiC.js +0 -1
  183. package/dist/web/client/assets/welcome-CyS4Hrd-.js +0 -1
  184. package/dist/web/server/assets/Rail-3gbidhyv.js +0 -605
  185. package/dist/web/server/assets/SpawnDialog-MJWwppgC.js +0 -1648
  186. package/dist/web/server/assets/_tanstack-start-manifest_v-CR3jm1nY.js +0 -256
  187. package/dist/web/server/assets/createSsrRpc-CwTd0zrB.js +0 -72
  188. package/dist/web/server/assets/public-origin-BpDkdS5Q.js +0 -34
@@ -1,22 +1,31 @@
1
- import { A as RowMenu, B as isTeamSection, E as Facts, G as DialogActions, K as Button, L as PANEL_LABELS, M as SetupCard, N as Switch, O as ListRow, Q as ActivityProvider, R as PANEL_TABS, T as Fact, U as writePanelCookie, W as Dialog$1, Z as REASONING_LEVELS, _ as CardEmpty, at as lineChange, c as SelectField, ct as ApiError, d as TextAreaField, dt as errorMessage, et as shortTime, f as TextField, g as CardBody, h as CARD_ROW, i as FilterSelect, it as describeStep, j as SearchField, k as Notice, l as SelectMenu, lt as api, nt as useActivity, o as SaveBar, ot as parseArgs, p as saveStatus, q as AgentAvatar, r as ChoiceCards, rt as useActivityOptional, st as summarizeSteps, t as SpawnDialog, tt as teamSummary, u as SwitchRow, ut as apiFetch, v as CardForm, w as Chip, x as CardToolbar, y as CardList, z as isAgentSection } from "./SpawnDialog-MJWwppgC.js";
2
- import { n as useMediaQuery, r as useResource, t as useHydrated } from "./use-resource-CjcJwn7F.js";
1
+ import { a as apiFetch, i as api, n as useLive, o as errorMessage, r as ApiError } from "./live-DbJeq6KP.js";
2
+ import { a as useActivity, c as lineChange, i as teamSummary, l as parseArgs, o as useActivityOptional, r as shortTime, s as describeStep, t as ActivityProvider, u as summarizeSteps } from "./activity-Czfq-5_F.js";
3
+ import { c as DEFAULT_TEAM_ID, i as isTextPreview, r as usageSummary, s as DEFAULT_PROFILE_ID, u as REASONING_LEVELS } from "./src-vrZVrV9u.js";
4
+ import { n as useMediaQuery, r as useResource, t as useHydrated } from "./use-resource-BUA9qGGY.js";
5
+ import { t as AgentAvatar } from "./AgentAvatar-8gTAy_tP.js";
6
+ import { t as Button } from "./Button-Dsnw22OF.js";
3
7
  import { l as modelName, n as ModelMenu, p as cn, t as MODELS_PATH } from "./ModelMenu-D-hTgYOO.js";
4
- import { t as ConfirmDialog } from "./ConfirmDialog-4xeCXKHe.js";
8
+ import { n as DialogActions, t as Dialog$1 } from "./Dialog-DTeF-nOZ.js";
9
+ import { t as ConfirmDialog } from "./ConfirmDialog-DAcSBHkT.js";
5
10
  import { t as Segmented } from "./Segmented-3ZLdqa5U.js";
6
- import { t as UnsavedChangesGuard } from "./UnsavedChangesGuard-Bb5frygQ.js";
7
- import { a as STATE_TEXT, c as useWorkspace, i as STATE_DOT, l as useWorkspaceOptional, n as RenameAgentDialog, o as SlimRail, s as WorkspaceProvider, t as Rail } from "./Rail-3gbidhyv.js";
8
- import { a as trafficByPair, i as pairKey, n as useTeamMessages, o as FocusFrame, r as messageText, t as TeamThread } from "./TeamThread-D-PvO3fu.js";
9
- import { i as unarchiveAgent, n as deleteAgent, t as archiveAgent } from "./agent-actions-COnfW5AU.js";
10
- import { S as slugify, _ as skillState, x as slugProblem } from "./manage-Ce6cI4eW.js";
11
- import { t as SpawnTeamModal } from "./SpawnTeamModal-RjzAeX_Q.js";
12
- import { i as useAttentionCount, n as usePageTitle } from "./page-title-CwcbXMhx.js";
13
- import { i as StatusBadge } from "./createSsrRpc-CwTd0zrB.js";
14
- import { a as neighbour, i as isTyping, n as NEW_CONVERSATION_EVENT, t as Route } from "./routes-Kwam6JmS.js";
15
- import { n as FindingsNotice, t as FindingLines } from "./SkillsParts-D58l8voo.js";
11
+ import { t as UnsavedChangesGuard } from "./UnsavedChangesGuard-CJQGu45L.js";
12
+ import { a as trafficByPair, c as FocusFrame, d as useWorkspaceOptional, i as pairKey, l as WorkspaceProvider, n as useTeamMessages, o as STATE_DOT, r as messageText, s as STATE_TEXT, t as TeamThread, u as useWorkspace } from "./TeamThread-5o48EbXL.js";
13
+ import { a as isAgentSection, i as PANEL_TABS, l as writePanelCookie, o as isTeamSection, r as PANEL_LABELS } from "./workspace-0XPILV1W.js";
14
+ import { i as useAttentionCount, n as usePageTitle } from "./page-title-PTpFHXWo.js";
15
+ import { _ as RowMenu, a as CardForm, b as Switch, c as CardToolbar, d as Chip, f as Fact, g as Notice, h as ListRow, i as CardEmpty, n as CARD_ROW, o as CardList, p as Facts, r as CardBody, v as SearchField, w as StatusBadge, y as SetupCard } from "./parts-k9M-atPa.js";
16
+ import { a as neighbour, i as isTyping, n as NEW_CONVERSATION_EVENT, t as Route } from "./routes-A7UcreVX.js";
17
+ import { a as SaveBar, c as SelectMenu, d as TextField, f as saveStatus, l as SwitchRow, n as ChoiceCards, r as FilterSelect, s as SelectField, u as TextAreaField } from "./form-BEjeiSy3.js";
18
+ import { t as SpawnDialog } from "./SpawnDialog-BAE8W91z.js";
19
+ import { i as unarchiveAgent, n as deleteAgent, r as renameAgent, t as archiveAgent } from "./agent-actions-ChH7Mne4.js";
20
+ import { S as slugify, _ as skillState, x as slugProblem } from "./manage-C6ucNYZW.js";
21
+ import { t as SpawnTeamModal } from "./SpawnTeamModal-CgBY0HuN.js";
22
+ import { t as TeamForm } from "./TeamForm-JyO5xJXX.js";
23
+ import { n as isGroupOpen, r as writeOpenGroupsCookie } from "./open-groups-BMGYUTtY.js";
24
+ import { n as FindingsNotice, t as FindingLines } from "./SkillsParts-Cw05b3al.js";
16
25
  import { Fragment, Suspense, createContext, lazy, useCallback, useContext, useEffect, useId, useLayoutEffect, useMemo, useRef, useState, useSyncExternalStore } from "react";
17
- import { Link, useRouter } from "@tanstack/react-router";
26
+ import { Link, useNavigate, useRouter } from "@tanstack/react-router";
18
27
  import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
19
- import { ArrowLeft, ArrowLeftRight, ArrowRight, BellRing, BookOpen, BookOpenCheck, CalendarClock, Check, ChevronDown, ChevronRight, CircleHelp, Code2, Columns2, Download, FileText, FolderOpen, GitBranch, Globe, History, Image, Images, Inbox, LayoutTemplate, Lightbulb, ListChecks, MessageSquare, MessageSquarePlus, MessagesSquare, Network, NotebookText, OctagonX, PanelRight, Paperclip, Pencil, PencilLine, Plus, RefreshCw, Search, Send, Settings2, Sparkles, StickyNote, Terminal, Trash2, UserRound, Wrench, X } from "lucide-react";
28
+ import { Archive, ArrowLeft, ArrowLeftRight, ArrowRight, BarChart3, BellRing, BookOpen, BookOpenCheck, Bot, CalendarClock, Check, ChevronDown, ChevronRight, CircleHelp, Code2, Columns2, Download, Ellipsis, FileText, FolderOpen, GitBranch, Globe, History, Image, Images, Inbox, LayoutTemplate, Lightbulb, ListChecks, MessageSquare, MessageSquarePlus, MessagesSquare, Network, NotebookText, OctagonX, PanelLeft, PanelRight, Paperclip, Pencil, PencilLine, Plus, RefreshCw, Search, Send, Settings2, Sparkles, StickyNote, Terminal, Trash2, UserRound, UsersRound, Wrench, X } from "lucide-react";
20
29
  import { DropdownMenu } from "radix-ui";
21
30
  import DOMPurify from "dompurify";
22
31
  import { marked } from "marked";
@@ -275,7 +284,7 @@ function BaseBar({ changes, base, loading, onBase, onRefresh }) {
275
284
  //#region src/components/changes/DiffView.tsx
276
285
  /** Rows drawn before "show the rest": a very long diff stays quick to open. */
277
286
  var ROWS_AT_FIRST = 1500;
278
- var NUMBER = "select-none px-2 text-right text-xs leading-[1.6] text-mocha-light tabular-nums";
287
+ var NUMBER = "select-none px-2 text-right text-xs leading-[1.6] text-muted-foreground tabular-nums";
279
288
  var TEXT = "whitespace-pre-wrap px-2 leading-[1.6] [overflow-wrap:anywhere]";
280
289
  /** The line number of a commentable line: click to comment on it. */
281
290
  function LineButton({ line, active, onClick }) {
@@ -652,7 +661,7 @@ var STATUS_TONE = {
652
661
  type_changed: "bg-accent text-accent-foreground",
653
662
  deleted: "bg-danger/15 text-danger",
654
663
  unmerged: "bg-warning/15 text-warning",
655
- unknown: "bg-frost text-mocha"
664
+ unknown: "bg-frost text-foreground"
656
665
  };
657
666
  /** The one-letter mark of a change: A added, M modified, D deleted… */
658
667
  function StatusMark({ status }) {
@@ -1099,6 +1108,66 @@ function AgentModel({ agent }) {
1099
1108
  });
1100
1109
  }
1101
1110
  //#endregion
1111
+ //#region src/components/agent/RenameAgentDialog.tsx
1112
+ /** A new display name for an Agent, from its row in the rail or from its panel. */
1113
+ function RenameAgentDialog({ agent, onClose, onRenamed }) {
1114
+ const [name, setName] = useState(agent.name);
1115
+ const [busy, setBusy] = useState(false);
1116
+ const [error, setError] = useState(null);
1117
+ const unchanged = !name.trim() || name.trim() === agent.name;
1118
+ async function submit(event) {
1119
+ event.preventDefault();
1120
+ if (unchanged) return;
1121
+ setBusy(true);
1122
+ setError(null);
1123
+ try {
1124
+ await renameAgent(agent.id, name.trim());
1125
+ await onRenamed();
1126
+ onClose();
1127
+ } catch (cause) {
1128
+ setError(errorMessage(cause));
1129
+ setBusy(false);
1130
+ }
1131
+ }
1132
+ return /* @__PURE__ */ jsx(Dialog$1, {
1133
+ title: `Rename ${agent.name}`,
1134
+ description: "This changes the display name only; the Agent ID and history stay the same.",
1135
+ busy,
1136
+ onClose,
1137
+ className: "max-w-md",
1138
+ children: /* @__PURE__ */ jsxs("form", {
1139
+ onSubmit: (event) => void submit(event),
1140
+ children: [
1141
+ /* @__PURE__ */ jsxs("label", { children: ["Agent name", /* @__PURE__ */ jsx("input", {
1142
+ autoFocus: true,
1143
+ value: name,
1144
+ onChange: (event) => setName(event.target.value),
1145
+ maxLength: 120
1146
+ })] }),
1147
+ error && /* @__PURE__ */ jsx("p", {
1148
+ role: "alert",
1149
+ className: "mt-3 text-sm text-danger",
1150
+ children: error
1151
+ }),
1152
+ /* @__PURE__ */ jsx("div", {
1153
+ className: "mt-4",
1154
+ children: /* @__PURE__ */ jsxs(DialogActions, { children: [/* @__PURE__ */ jsx(Button, {
1155
+ variant: "ghost",
1156
+ disabled: busy,
1157
+ onClick: onClose,
1158
+ children: "Cancel"
1159
+ }), /* @__PURE__ */ jsx(Button, {
1160
+ variant: "primary",
1161
+ type: "submit",
1162
+ disabled: busy || unchanged,
1163
+ children: busy ? "Renaming…" : "Rename agent"
1164
+ })] })
1165
+ })
1166
+ ]
1167
+ })
1168
+ });
1169
+ }
1170
+ //#endregion
1102
1171
  //#region src/components/CopyButton.tsx
1103
1172
  function CopyButton({ value, className, ariaLabel = "Copy to clipboard", title = "Copy to clipboard" }) {
1104
1173
  const [copied, setCopied] = useState(false);
@@ -1562,7 +1631,7 @@ function ConnectionsPanel({ team }) {
1562
1631
  }),
1563
1632
  reach.map((entry) => /* @__PURE__ */ jsxs("span", {
1564
1633
  title: entry.out && entry.back ? `${member.name} and ${entry.name} can message each other` : entry.out ? `${member.name} can message ${entry.name}` : `${entry.name} can message ${member.name}`,
1565
- className: `inline-flex items-center gap-1 rounded-full px-2 py-0.5 text-xs ${entry.out ? "bg-accent text-accent-foreground" : "bg-frost text-mocha"}`,
1634
+ className: `inline-flex items-center gap-1 rounded-full px-2 py-0.5 text-xs ${entry.out ? "bg-accent text-accent-foreground" : "bg-frost text-foreground"}`,
1566
1635
  children: [entry.out && entry.back ? /* @__PURE__ */ jsx(ArrowLeftRight, {
1567
1636
  className: "size-3",
1568
1637
  "aria-hidden": "true"
@@ -1666,15 +1735,16 @@ var PREVIEW_IMAGE = [
1666
1735
  "image/gif",
1667
1736
  "image/webp"
1668
1737
  ];
1669
- var PREVIEW_TEXT = ["text/plain", "text/markdown"];
1670
1738
  /** The daemon previews these images up to 10 MiB. */
1671
1739
  function isPreviewImage(result) {
1672
1740
  return PREVIEW_IMAGE.includes(result.mimeType) && result.byteLength <= 10 * 1024 * 1024;
1673
1741
  }
1674
- /** The daemon previews plain text and Markdown up to 256 KiB. */
1742
+ /** The daemon previews text up to 256 KiB: by its type, or by its name when sent untyped. */
1675
1743
  function isPreviewText(result) {
1676
- return PREVIEW_TEXT.includes(result.mimeType) && result.byteLength <= 256 * 1024;
1744
+ return isTextPreview(result);
1677
1745
  }
1746
+ /** How much of a text file a grid tile shows. */
1747
+ var TILE_TEXT_BYTES = 1200;
1678
1748
  function formatBytes$1(bytes) {
1679
1749
  if (bytes < 1024) return `${bytes} B`;
1680
1750
  if (bytes < 1024 * 1024) return `${(bytes / 1024).toFixed(bytes < 10 * 1024 ? 1 : 0)} KB`;
@@ -1690,6 +1760,8 @@ function kindLabel(mimeType, name) {
1690
1760
  return extension ? extension.toUpperCase() : mimeType;
1691
1761
  }
1692
1762
  var resultPath = (id, action) => `/api/results/${encodeURIComponent(id)}${action ? `/${action}` : ""}`;
1763
+ /** The start of a text file, for a tile. */
1764
+ var tileTextPath = (id) => `${resultPath(id, "preview")}?bytes=${TILE_TEXT_BYTES}`;
1693
1765
  /** The archive of a Team's, an Agent's or a conversation's saved files. */
1694
1766
  function archivePath(filter) {
1695
1767
  const params = new URLSearchParams();
@@ -1757,35 +1829,30 @@ function ResultTile({ resultId, result: preloaded, detail, open, selected = fals
1757
1829
  if (compact) {
1758
1830
  const face = isPreviewImage(result) ? /* @__PURE__ */ jsx("img", {
1759
1831
  src: resultPath(result.id, "preview"),
1760
- alt: result.name,
1832
+ alt: "",
1761
1833
  loading: "lazy",
1762
1834
  className: "block aspect-[4/3] w-full bg-card object-contain p-1.5"
1763
- }) : /* @__PURE__ */ jsxs("span", {
1764
- className: "flex aspect-[4/3] w-full flex-col items-center justify-center gap-1.5 bg-card text-mocha",
1765
- children: [/* @__PURE__ */ jsx(FileText, {
1766
- className: "size-7",
1767
- "aria-hidden": "true"
1768
- }), /* @__PURE__ */ jsx("span", {
1769
- className: "max-w-full truncate px-2 font-mono text-xs font-medium uppercase tracking-wide",
1770
- children: kindLabel(result.mimeType, result.name)
1771
- })]
1772
- });
1835
+ }) : isPreviewText(result) ? /* @__PURE__ */ jsx(TextFace, { result }) : /* @__PURE__ */ jsx(KindFace, { result });
1773
1836
  return /* @__PURE__ */ jsxs("figure", {
1774
1837
  className: `m-0 ${frame}`,
1775
- children: [onPick ? /* @__PURE__ */ jsx("button", {
1838
+ children: [onPick ? /* @__PURE__ */ jsxs("button", {
1776
1839
  type: "button",
1777
1840
  onClick: onPick,
1778
- "aria-label": `Choose ${result.name}`,
1779
1841
  "aria-pressed": selected,
1780
1842
  className: "unstyled block w-full",
1781
- children: face
1782
- }) : open ? /* @__PURE__ */ jsx(Link, {
1843
+ children: [/* @__PURE__ */ jsxs("span", {
1844
+ className: "sr-only",
1845
+ children: ["Choose ", result.name]
1846
+ }), face]
1847
+ }) : open ? /* @__PURE__ */ jsxs(Link, {
1783
1848
  to: "/",
1784
1849
  search: open,
1785
- "aria-label": `Open ${result.name}`,
1786
1850
  "aria-current": selected ? "true" : void 0,
1787
1851
  className: "block",
1788
- children: face
1852
+ children: [/* @__PURE__ */ jsxs("span", {
1853
+ className: "sr-only",
1854
+ children: ["Open ", result.name]
1855
+ }), face]
1789
1856
  }) : face, /* @__PURE__ */ jsxs("figcaption", {
1790
1857
  className: "flex items-center gap-1.5 py-1.5 pl-2.5 pr-1.5",
1791
1858
  children: [/* @__PURE__ */ jsxs("span", {
@@ -1878,6 +1945,42 @@ function ResultTile({ resultId, result: preloaded, detail, open, selected = fals
1878
1945
  ]
1879
1946
  });
1880
1947
  }
1948
+ /** A file shown by its kind: an icon and "PDF", "ZIP". */
1949
+ function KindFace({ result }) {
1950
+ return /* @__PURE__ */ jsxs("span", {
1951
+ "aria-hidden": "true",
1952
+ className: "flex aspect-[4/3] w-full flex-col items-center justify-center gap-1.5 bg-card text-mocha",
1953
+ children: [/* @__PURE__ */ jsx(FileText, { className: "size-7" }), /* @__PURE__ */ jsx("span", {
1954
+ className: "max-w-full truncate px-2 font-mono text-xs font-medium uppercase tracking-wide",
1955
+ children: kindLabel(result.mimeType, result.name)
1956
+ })]
1957
+ });
1958
+ }
1959
+ /** A text file shown by its first lines, fading out; by its kind until they arrive or if not. */
1960
+ function TextFace({ result }) {
1961
+ const [start, setStart] = useState(null);
1962
+ useEffect(() => {
1963
+ const controller = new AbortController();
1964
+ apiFetch(tileTextPath(result.id), { signal: controller.signal }).then((response) => response.text()).then((text) => setStart(text.trim() ? text : null)).catch(() => setStart(null));
1965
+ return () => controller.abort();
1966
+ }, [result.id]);
1967
+ if (start === null) return /* @__PURE__ */ jsx(KindFace, { result });
1968
+ return /* @__PURE__ */ jsxs("span", {
1969
+ "aria-hidden": "true",
1970
+ className: "relative block aspect-[4/3] w-full overflow-hidden bg-card text-left",
1971
+ children: [
1972
+ /* @__PURE__ */ jsx("pre", {
1973
+ className: "m-0 h-full overflow-hidden whitespace-pre-wrap break-words p-2.5 font-mono text-[10px] leading-[1.45] text-mocha",
1974
+ children: start
1975
+ }),
1976
+ /* @__PURE__ */ jsx("span", { className: "pointer-events-none absolute inset-x-0 bottom-0 h-10 bg-gradient-to-t from-card to-transparent" }),
1977
+ /* @__PURE__ */ jsx("span", {
1978
+ className: "absolute bottom-1.5 right-2 rounded bg-muted px-1.5 py-0.5 font-mono text-[10px] font-medium uppercase tracking-wide text-mocha",
1979
+ children: kindLabel(result.mimeType, result.name)
1980
+ })
1981
+ ]
1982
+ });
1983
+ }
1881
1984
  //#endregion
1882
1985
  //#region src/components/files/use-results.ts
1883
1986
  /** The daemon lists at most this many at once. */
@@ -2829,6 +2932,64 @@ function ChangesView({ team }) {
2829
2932
  });
2830
2933
  }
2831
2934
  //#endregion
2935
+ //#region src/lib/find-in-transcript.ts
2936
+ var GIVE_UP_MS = 8e3;
2937
+ var MARK_MS = 2500;
2938
+ /**
2939
+ * The `nth` element marked `data-message` whose text holds every word (oldest first, from 0), or
2940
+ * the last one that does when there are fewer.
2941
+ */
2942
+ function findMessage(root, find, nth = 0) {
2943
+ const words = find.toLowerCase().split(/\s+/).filter(Boolean);
2944
+ if (words.length === 0) return null;
2945
+ const found = [];
2946
+ for (const element of root.querySelectorAll("[data-message]")) {
2947
+ const text = (element.textContent ?? "").toLowerCase();
2948
+ if (words.every((word) => text.includes(word))) found.push(element);
2949
+ }
2950
+ return found[Math.min(nth, found.length - 1)] ?? null;
2951
+ }
2952
+ /**
2953
+ * Scroll to the message `find` and `nth` name, then call `done` (found or not) to drop them from
2954
+ * the address. `done` is the latest one passed: what was opened meanwhile stays open.
2955
+ */
2956
+ function useFindInTranscript(container, find, nth, done) {
2957
+ const latest = useRef(done);
2958
+ latest.current = done;
2959
+ useEffect(() => {
2960
+ const root = container.current;
2961
+ if (!find || !root) return;
2962
+ let finished = false;
2963
+ const finish = () => {
2964
+ finished = true;
2965
+ observer.disconnect();
2966
+ window.clearTimeout(giveUp);
2967
+ latest.current();
2968
+ };
2969
+ const look = () => {
2970
+ if (finished) return;
2971
+ const found = findMessage(root, find, nth);
2972
+ if (!found) return;
2973
+ found.scrollIntoView({ block: "center" });
2974
+ found.classList.add("found-message");
2975
+ window.setTimeout(() => found.classList.remove("found-message"), MARK_MS);
2976
+ finish();
2977
+ };
2978
+ const observer = new MutationObserver(look);
2979
+ observer.observe(root, {
2980
+ childList: true,
2981
+ subtree: true
2982
+ });
2983
+ const giveUp = window.setTimeout(finish, GIVE_UP_MS);
2984
+ look();
2985
+ return () => {
2986
+ finished = true;
2987
+ observer.disconnect();
2988
+ window.clearTimeout(giveUp);
2989
+ };
2990
+ }, [find, nth]);
2991
+ }
2992
+ //#endregion
2832
2993
  //#region src/components/chat/AgentQuestions.tsx
2833
2994
  /**
2834
2995
  * Questions the Agent is waiting on. The chat reloads them when it opens, when a turn starts or
@@ -2999,6 +3160,17 @@ function shellApprovalsUrl(agentId) {
2999
3160
  return `/api/shell-approvals?agentId=${encodeURIComponent(agentId)}`;
3000
3161
  }
3001
3162
  var isImageMime = (mimeType) => mimeType.startsWith("image/");
3163
+ /** The message being sent, shown at once: the `done` frame replaces it with the saved history. */
3164
+ function draftEntry(text, attachments) {
3165
+ const images = attachments.filter((file) => isImageMime(file.mimeType));
3166
+ const files = attachments.filter((file) => !isImageMime(file.mimeType)).map((file) => ({ name: file.name ?? "file" }));
3167
+ return {
3168
+ type: "user",
3169
+ content: text,
3170
+ ...images.length > 0 ? { images } : {},
3171
+ ...files.length > 0 ? { files } : {}
3172
+ };
3173
+ }
3002
3174
  /**
3003
3175
  * Persisted messages as entries: assistant text, then its tool calls and the tool results that
3004
3176
  * answer them grouped into one tool box. Saved results and images are deliverables, so they stand
@@ -3899,54 +4071,59 @@ function Handoffs({ steps }) {
3899
4071
  const recipient = workspace?.agentById(to);
3900
4072
  const message = typeof args?.text === "string" ? args.text : "";
3901
4073
  const state = recipient ? activity?.stateOf(recipient.id) : void 0;
3902
- return /* @__PURE__ */ jsxs("details", {
3903
- className: "group border-t border-frost/70",
3904
- children: [
3905
- /* @__PURE__ */ jsxs("summary", {
3906
- className: "flex min-h-11 cursor-pointer list-none items-center gap-2.5 px-3 py-1.5 [&::-webkit-details-marker]:hidden",
3907
- children: [
3908
- /* @__PURE__ */ jsx(AgentAvatar, {
3909
- identity: recipient?.identity,
3910
- size: 24
3911
- }),
3912
- /* @__PURE__ */ jsx("span", {
3913
- className: "shrink-0 font-semibold text-foreground",
3914
- children: recipient?.name ?? (to ? to.slice(0, 8) : "Teammate")
3915
- }),
3916
- /* @__PURE__ */ jsx("span", {
3917
- className: "min-w-0 flex-1 truncate text-mocha group-open:invisible",
3918
- children: message
3919
- }),
3920
- step.status === "failed" ? /* @__PURE__ */ jsx("span", {
3921
- className: "shrink-0 text-xs font-semibold text-danger",
3922
- children: "not sent"
3923
- }) : step.status === "running" ? /* @__PURE__ */ jsx("span", {
3924
- className: "shrink-0 text-xs text-mocha",
3925
- children: "sending…"
3926
- }) : state && /* @__PURE__ */ jsx("span", {
3927
- className: "shrink-0 text-xs text-mocha",
3928
- children: state.text
3929
- }),
3930
- workspace && recipient && /* @__PURE__ */ jsx(Link, {
3931
- to: "/",
3932
- search: {
3933
- agent: recipient.id,
3934
- ...workspace.search.panel ? { panel: workspace.search.panel } : {}
3935
- },
3936
- className: "flex h-7 shrink-0 items-center rounded-[10px] border border-border bg-card px-2.5 text-xs font-semibold text-foreground hover:border-sapphire-light hover:text-sapphire",
3937
- children: "Open"
3938
- })
3939
- ]
3940
- }),
3941
- /* @__PURE__ */ jsx("p", {
3942
- className: "m-0 whitespace-pre-wrap break-words px-3 pb-2.5 pl-[3.1rem] text-chocolate",
3943
- children: message
3944
- }),
3945
- step.status === "failed" && /* @__PURE__ */ jsx("p", {
3946
- className: "m-0 break-words px-3 pb-2.5 pl-[3.1rem] text-xs text-danger",
3947
- children: step.output
3948
- })
3949
- ]
4074
+ return /* @__PURE__ */ jsxs("div", {
4075
+ className: "relative border-t border-frost/70",
4076
+ children: [/* @__PURE__ */ jsxs("details", {
4077
+ className: "group",
4078
+ children: [
4079
+ /* @__PURE__ */ jsxs("summary", {
4080
+ className: `flex min-h-11 cursor-pointer list-none items-center gap-2.5 py-1.5 pl-3 [&::-webkit-details-marker]:hidden ${workspace && recipient ? "pr-[4.5rem]" : "pr-3"}`,
4081
+ children: [
4082
+ /* @__PURE__ */ jsx(AgentAvatar, {
4083
+ identity: recipient?.identity,
4084
+ size: 24
4085
+ }),
4086
+ /* @__PURE__ */ jsx("span", {
4087
+ className: "shrink-0 font-semibold text-foreground",
4088
+ children: recipient?.name ?? (to ? to.slice(0, 8) : "Teammate")
4089
+ }),
4090
+ /* @__PURE__ */ jsx("span", {
4091
+ className: "min-w-0 flex-1 truncate text-mocha group-open:invisible",
4092
+ children: message
4093
+ }),
4094
+ step.status === "failed" ? /* @__PURE__ */ jsx("span", {
4095
+ className: "shrink-0 text-xs font-semibold text-danger",
4096
+ children: "not sent"
4097
+ }) : step.status === "running" ? /* @__PURE__ */ jsx("span", {
4098
+ className: "shrink-0 text-xs text-mocha",
4099
+ children: "sending…"
4100
+ }) : state && /* @__PURE__ */ jsx("span", {
4101
+ className: "shrink-0 text-xs text-mocha",
4102
+ children: state.text
4103
+ })
4104
+ ]
4105
+ }),
4106
+ /* @__PURE__ */ jsx("p", {
4107
+ className: "m-0 whitespace-pre-wrap break-words px-3 pb-2.5 pl-[3.1rem] text-chocolate",
4108
+ children: message
4109
+ }),
4110
+ step.status === "failed" && /* @__PURE__ */ jsx("p", {
4111
+ className: "m-0 break-words px-3 pb-2.5 pl-[3.1rem] text-xs text-danger",
4112
+ children: step.output
4113
+ })
4114
+ ]
4115
+ }), workspace && recipient && /* @__PURE__ */ jsxs(Link, {
4116
+ to: "/",
4117
+ search: {
4118
+ agent: recipient.id,
4119
+ ...workspace.search.panel ? { panel: workspace.search.panel } : {}
4120
+ },
4121
+ className: "absolute right-3 top-2 flex h-7 items-center rounded-[10px] border border-border bg-card px-2.5 text-xs font-semibold text-foreground hover:border-sapphire-light hover:text-sapphire",
4122
+ children: ["Open", /* @__PURE__ */ jsxs("span", {
4123
+ className: "sr-only",
4124
+ children: [" ", recipient.name]
4125
+ })]
4126
+ })]
3950
4127
  }, index);
3951
4128
  })]
3952
4129
  });
@@ -4010,6 +4187,7 @@ function Bubble({ entry, markdownReady, onEdit, dropped = false, approvals }) {
4010
4187
  if (entry.content.startsWith(INBOX_WAKE_PREFIX)) {
4011
4188
  const body = entry.content.slice(24);
4012
4189
  return /* @__PURE__ */ jsxs("details", {
4190
+ "data-message": "",
4013
4191
  className: `my-3 rounded-lg border border-fawn bg-ivory px-3 py-2 text-sm text-mocha ${dropClass}`,
4014
4192
  "aria-label": "Teammate update",
4015
4193
  children: [
@@ -4029,6 +4207,7 @@ function Bubble({ entry, markdownReady, onEdit, dropped = false, approvals }) {
4029
4207
  });
4030
4208
  }
4031
4209
  return /* @__PURE__ */ jsxs("div", {
4210
+ "data-message": "",
4032
4211
  className: `group relative my-4 flex flex-col items-end ${dropClass}`,
4033
4212
  children: [
4034
4213
  /* @__PURE__ */ jsx("span", {
@@ -4081,6 +4260,7 @@ function Bubble({ entry, markdownReady, onEdit, dropped = false, approvals }) {
4081
4260
  });
4082
4261
  }
4083
4262
  return /* @__PURE__ */ jsxs("div", {
4263
+ "data-message": "",
4084
4264
  className: `my-4 flex flex-col items-start ${dropClass}`,
4085
4265
  children: [/* @__PURE__ */ jsx("span", {
4086
4266
  className: "sr-only",
@@ -4257,64 +4437,164 @@ function formatContext(context) {
4257
4437
  function formatCompaction(result) {
4258
4438
  return `/compact: ${result.before} → ${result.after} entries (${result.summarized} summarized, ${result.keptTail} kept verbatim; ~${result.tokensBefore.toLocaleString()} → ~${result.tokensAfter.toLocaleString()} tok). reloading…`;
4259
4439
  }
4440
+ async function compact(rest, chat) {
4441
+ if (chat.messageCount < 2) {
4442
+ chat.pushNote("/compact: need ≥2 messages to compact");
4443
+ return;
4444
+ }
4445
+ chat.setCompacting(true);
4446
+ try {
4447
+ const result = await api(`${chat.base}/chat/compact`, { body: { keepTail: parseKeepTail(rest) } });
4448
+ chat.pushNote(formatCompaction(result));
4449
+ setTimeout(() => window.location.reload(), 400);
4450
+ } catch (error) {
4451
+ chat.pushNote(`/compact failed: ${errorMessage(error)}`);
4452
+ } finally {
4453
+ chat.setCompacting(false);
4454
+ }
4455
+ }
4456
+ /** True when `command` is a slash command, which then ran. */
4457
+ async function runSlashCommand(command, rest, chat) {
4458
+ switch (command) {
4459
+ case "/help":
4460
+ chat.pushNote(SLASH_HELP);
4461
+ return true;
4462
+ case "/context":
4463
+ try {
4464
+ chat.pushNote(formatContext(await api(`${chat.base}/chat/context`)));
4465
+ } catch (error) {
4466
+ chat.pushNote(`/context failed: ${errorMessage(error)}`);
4467
+ }
4468
+ return true;
4469
+ case "/new":
4470
+ chat.onOpenLibrary();
4471
+ return true;
4472
+ case "/compact":
4473
+ await compact(rest, chat);
4474
+ return true;
4475
+ default: return false;
4476
+ }
4477
+ }
4260
4478
  //#endregion
4261
- //#region src/components/chat/useChatSession.ts
4262
- var SESSION_POLL_MS = 1e4;
4263
- var QUEUE_POLL_MS = 5e3;
4479
+ //#region src/components/chat/useCommandApprovals.ts
4480
+ function useCommandApprovals({ agentId, setLive }) {
4481
+ const [recoveredTurn, setRecoveredTurn] = useState(false);
4482
+ const [approvalBusy, setApprovalBusy] = useState({});
4483
+ const [approvalErrors, setApprovalErrors] = useState({});
4484
+ const approvalTurnRef = useRef(false);
4485
+ useEffect(() => {
4486
+ const controller = new AbortController();
4487
+ api(shellApprovalsUrl(agentId), { signal: controller.signal }).then(({ approvals }) => {
4488
+ const pending = approvals.filter((approval) => approval.agentId === agentId && approval.status === "pending");
4489
+ if (pending.length === 0) return;
4490
+ approvalTurnRef.current = true;
4491
+ setLive((entries) => pending.reduce(upsertCommandApprovalEntry, entries));
4492
+ setRecoveredTurn(true);
4493
+ }).catch(() => {});
4494
+ return () => controller.abort();
4495
+ }, [agentId, setLive]);
4496
+ async function reconcileApproval(id) {
4497
+ try {
4498
+ const { approvals } = await api(shellApprovalsUrl(agentId));
4499
+ const approval = approvals.find((item) => item.id === id && item.agentId === agentId);
4500
+ if (approval) setLive((entries) => upsertCommandApprovalEntry(entries, approval));
4501
+ return approval ?? null;
4502
+ } catch {
4503
+ return null;
4504
+ }
4505
+ }
4506
+ async function decide(approval, decision) {
4507
+ if (approval.agentId !== agentId || approval.status !== "pending") return;
4508
+ setApprovalBusy((current) => ({
4509
+ ...current,
4510
+ [approval.id]: true
4511
+ }));
4512
+ setApprovalErrors(({ [approval.id]: _cleared, ...rest }) => rest);
4513
+ try {
4514
+ const body = await api(`/api/shell-approvals/${encodeURIComponent(approval.id)}`, { body: { decision } });
4515
+ if (body.approval.agentId === agentId) setLive((entries) => upsertCommandApprovalEntry(entries, body.approval));
4516
+ } catch (error) {
4517
+ const current = await reconcileApproval(approval.id);
4518
+ if (!current || current.status === "pending") setApprovalErrors((errors) => ({
4519
+ ...errors,
4520
+ [approval.id]: errorMessage(error)
4521
+ }));
4522
+ } finally {
4523
+ setApprovalBusy((current) => ({
4524
+ ...current,
4525
+ [approval.id]: false
4526
+ }));
4527
+ }
4528
+ }
4529
+ return {
4530
+ recoveredTurn,
4531
+ setRecoveredTurn,
4532
+ approvalTurnRef,
4533
+ approvalBusy,
4534
+ approvalErrors,
4535
+ decide,
4536
+ /** A turn starts or ends: no approval is being decided or failed any more. */
4537
+ resetApprovals: () => {
4538
+ setApprovalBusy({});
4539
+ setApprovalErrors({});
4540
+ }
4541
+ };
4542
+ }
4543
+ //#endregion
4544
+ //#region src/components/chat/session-sync.ts
4264
4545
  var EMPTY_HEAD = {
4265
4546
  file: null,
4266
4547
  size: 0,
4267
4548
  conversationId: null
4268
4549
  };
4550
+ /** Follow-ups that wait or run. */
4269
4551
  function openFollowUps(queue) {
4270
4552
  return queue?.items.filter((item) => item.status === "pending" || item.status === "running").length ?? 0;
4271
4553
  }
4272
- function useChatSession({ agentId, initialMessages, initialSessionHead, onOpenLibrary, onConversation }) {
4273
- const base = `/api/agents/${encodeURIComponent(agentId)}`;
4274
- const [messages, setMessages] = useState(initialMessages);
4275
- const [live, setLive] = useState([]);
4276
- const [notes, setNotes] = useState([]);
4277
- const [thinking, setThinking] = useState(false);
4278
- const [streaming, setStreaming] = useState(false);
4279
- const [recoveredTurn, setRecoveredTurn] = useState(false);
4280
- const [editing, setEditing] = useState(false);
4554
+ /** A turn runs, or a follow-up runs or is about to. */
4555
+ function isQueueWorking(queue) {
4556
+ return queue?.turnActive || queue?.items.some((item) => item.status === "running" || item.status === "pending" && !queue.paused);
4557
+ }
4558
+ /** The conversation file is not the one `known` describes: another source wrote to it. */
4559
+ function headMoved(head, known) {
4560
+ return Boolean(head.unavailable) !== Boolean(known.unavailable) || head.file !== known.file || head.size !== known.size;
4561
+ }
4562
+ /**
4563
+ * What a new activity reading of the Agent asks of the chat: look at the conversation's head, read
4564
+ * the queue again, read the queue and then look at the head when that did not reload the history
4565
+ * (a turn ended), or nothing.
4566
+ */
4567
+ function activityReaction(was, now) {
4568
+ if (!was) return "head";
4569
+ if (now.working !== was.working || now.queuePaused !== was.queuePaused || now.followUps !== was.followUps) return was.working && !now.working ? "queue-then-head" : "queue";
4570
+ if (!now.working && now.lastActivityAt !== was.lastActivityAt) return "head";
4571
+ return null;
4572
+ }
4573
+ //#endregion
4574
+ //#region src/components/chat/useSessionSync.ts
4575
+ var SESSION_POLL_MS = 1e4;
4576
+ var QUEUE_POLL_MS = 5e3;
4577
+ function useSessionSync({ agentId, base, initialSessionHead, onConversation, streamingRef, pushNote, onHistory }) {
4281
4578
  const [stale, setStale] = useState(false);
4282
4579
  const [historyUnavailable, setHistoryUnavailable] = useState(initialSessionHead?.unavailable ?? false);
4283
4580
  const [queue, setQueue] = useState(null);
4284
- const [questionsKey, setQuestionsKey] = useState(0);
4285
- const [approvalBusy, setApprovalBusy] = useState({});
4286
- const [approvalErrors, setApprovalErrors] = useState({});
4287
- const abortRef = useRef(null);
4288
- const approvalTurnRef = useRef(false);
4289
4581
  const knownHeadRef = useRef(initialSessionHead ?? EMPTY_HEAD);
4290
4582
  const queueRef = useRef(null);
4291
- const noteIdRef = useRef(0);
4292
- const entryCountRef = useRef(0);
4293
- const streamingRef = useRef(false);
4294
- streamingRef.current = streaming;
4295
- const turnBusy = streaming || recoveredTurn;
4296
- const agentBusy = turnBusy || Boolean(queue?.turnActive);
4297
- const queueWorking = queue?.turnActive || queue?.items.some((item) => item.status === "running" || item.status === "pending" && !queue.paused);
4583
+ const staleRef = useRef(stale);
4584
+ staleRef.current = stale;
4585
+ const activityRef = useRef(null);
4586
+ const feed = useLive();
4587
+ const queueWorking = isQueueWorking(queue);
4298
4588
  function know(head) {
4299
4589
  if (head.conversationId !== knownHeadRef.current.conversationId) onConversation?.(head.conversationId);
4300
4590
  knownHeadRef.current = head;
4301
4591
  }
4302
- function pushNote(content) {
4303
- const note = {
4304
- id: noteIdRef.current++,
4305
- content,
4306
- afterIndex: entryCountRef.current
4307
- };
4308
- setNotes((current) => [...current, note]);
4309
- }
4310
4592
  async function refreshHistory() {
4311
4593
  if (streamingRef.current) return;
4312
4594
  try {
4313
4595
  const body = await api(`${base}/sessions/messages`);
4314
4596
  setHistoryUnavailable(body.head.unavailable ?? false);
4315
- setMessages(body.messages);
4316
- setLive([]);
4317
- setEditing(false);
4597
+ onHistory(body.messages);
4318
4598
  know(body.head);
4319
4599
  setStale(false);
4320
4600
  } catch {
@@ -4333,55 +4613,30 @@ function useChatSession({ agentId, initialMessages, initialSessionHead, onOpenLi
4333
4613
  know(head);
4334
4614
  } catch {}
4335
4615
  }
4616
+ /** True when a follow-up had finished and the history was loaded again. */
4336
4617
  async function refreshQueue() {
4337
4618
  try {
4338
4619
  const next = await api(`${base}/queue`);
4339
- if (openFollowUps(next) < openFollowUps(queueRef.current) && !streamingRef.current) refreshHistory();
4620
+ const finished = openFollowUps(next) < openFollowUps(queueRef.current) && !streamingRef.current;
4621
+ if (finished) refreshHistory();
4340
4622
  queueRef.current = next;
4341
4623
  setQueue(next);
4624
+ return finished;
4625
+ } catch {
4626
+ return false;
4627
+ }
4628
+ }
4629
+ /** Activity from another source (Telegram, a schedule, another tab) shows a reload banner. */
4630
+ async function checkHead() {
4631
+ if (!initialSessionHead || staleRef.current || streamingRef.current) return;
4632
+ try {
4633
+ if (headMoved(await api(`${base}/sessions/head`), knownHeadRef.current)) {
4634
+ setStale(true);
4635
+ refreshQueue();
4636
+ }
4342
4637
  } catch {}
4343
4638
  }
4344
- useEffect(() => () => abortRef.current?.abort(), []);
4345
- useEffect(() => {
4346
- refreshQueue();
4347
- }, []);
4348
- useEffect(() => {
4349
- if (!queueWorking) return;
4350
- const timer = setInterval(() => {
4351
- if (!document.hidden) refreshQueue();
4352
- }, QUEUE_POLL_MS);
4353
- return () => clearInterval(timer);
4354
- }, [queueWorking]);
4355
- useEffect(() => {
4356
- if (!initialSessionHead || stale) return;
4357
- const timer = setInterval(async () => {
4358
- if (document.hidden || streamingRef.current) return;
4359
- try {
4360
- const head = await api(`${base}/sessions/head`);
4361
- const known = knownHeadRef.current;
4362
- if (Boolean(head.unavailable) !== Boolean(known.unavailable) || head.file !== known.file || head.size !== known.size) {
4363
- setStale(true);
4364
- refreshQueue();
4365
- }
4366
- } catch {}
4367
- }, SESSION_POLL_MS);
4368
- return () => clearInterval(timer);
4369
- }, [
4370
- base,
4371
- initialSessionHead,
4372
- stale
4373
- ]);
4374
- useEffect(() => {
4375
- const controller = new AbortController();
4376
- api(shellApprovalsUrl(agentId), { signal: controller.signal }).then(({ approvals }) => {
4377
- const pending = approvals.filter((approval) => approval.agentId === agentId && approval.status === "pending");
4378
- if (pending.length === 0) return;
4379
- approvalTurnRef.current = true;
4380
- setLive((entries) => pending.reduce(upsertCommandApprovalEntry, entries));
4381
- setRecoveredTurn(true);
4382
- }).catch(() => {});
4383
- return () => controller.abort();
4384
- }, [agentId]);
4639
+ /** Queue a follow-up; returns the draft to give back to the composer when it was not queued. */
4385
4640
  async function enqueue(draft) {
4386
4641
  try {
4387
4642
  await api(`${base}/queue`, { body: {
@@ -4395,46 +4650,96 @@ function useChatSession({ agentId, initialMessages, initialSessionHead, onOpenLi
4395
4650
  return draft;
4396
4651
  }
4397
4652
  }
4398
- async function compact(rest) {
4399
- if (messages.length < 2) {
4400
- pushNote("/compact: need ≥2 messages to compact");
4401
- return;
4402
- }
4403
- setEditing(false);
4404
- setStreaming(true);
4405
- setThinking(true);
4406
- try {
4407
- pushNote(formatCompaction(await api(`${base}/chat/compact`, { body: { keepTail: parseKeepTail(rest) } })));
4408
- setTimeout(() => window.location.reload(), 400);
4409
- } catch (error) {
4410
- pushNote(`/compact failed: ${errorMessage(error)}`);
4411
- } finally {
4412
- setThinking(false);
4413
- setStreaming(false);
4414
- }
4653
+ useEffect(() => {
4654
+ refreshQueue();
4655
+ }, []);
4656
+ useEffect(() => feed.subscribe("activity", (event) => {
4657
+ const now = event.agents.find((entry) => entry.agentId === agentId) ?? null;
4658
+ const was = activityRef.current;
4659
+ activityRef.current = now;
4660
+ if (!now || streamingRef.current) return;
4661
+ const reaction = activityReaction(was, now);
4662
+ if (reaction === "head") checkHead();
4663
+ else if (reaction !== null) refreshQueue().then((reloaded) => {
4664
+ if (reaction === "queue-then-head" && !reloaded) checkHead();
4665
+ });
4666
+ }), [feed.subscribe, agentId]);
4667
+ useEffect(() => {
4668
+ if (!queueWorking || feed.connected) return;
4669
+ const timer = setInterval(() => {
4670
+ if (!document.hidden) refreshQueue();
4671
+ }, QUEUE_POLL_MS);
4672
+ return () => clearInterval(timer);
4673
+ }, [queueWorking, feed.connected]);
4674
+ useEffect(() => {
4675
+ if (!initialSessionHead || stale || feed.connected) return;
4676
+ const timer = setInterval(() => {
4677
+ if (!document.hidden) checkHead();
4678
+ }, SESSION_POLL_MS);
4679
+ return () => clearInterval(timer);
4680
+ }, [
4681
+ base,
4682
+ initialSessionHead,
4683
+ stale,
4684
+ feed.connected
4685
+ ]);
4686
+ return {
4687
+ stale,
4688
+ dismissStale: () => setStale(false),
4689
+ historyUnavailable,
4690
+ queue,
4691
+ /** The conversation this tab last knew of; null before the Agent's first turn. */
4692
+ knownConversationId: () => knownHeadRef.current.conversationId,
4693
+ refreshHistory,
4694
+ refreshKnownHead,
4695
+ refreshQueue,
4696
+ enqueue
4697
+ };
4698
+ }
4699
+ //#endregion
4700
+ //#region src/components/chat/useChatSession.ts
4701
+ function useChatSession({ agentId, initialMessages, initialSessionHead, onOpenLibrary, onConversation }) {
4702
+ const base = `/api/agents/${encodeURIComponent(agentId)}`;
4703
+ const [messages, setMessages] = useState(initialMessages);
4704
+ const [live, setLive] = useState([]);
4705
+ const [notes, setNotes] = useState([]);
4706
+ const [thinking, setThinking] = useState(false);
4707
+ const [streaming, setStreaming] = useState(false);
4708
+ const [editing, setEditing] = useState(false);
4709
+ const [questionsKey, setQuestionsKey] = useState(0);
4710
+ const abortRef = useRef(null);
4711
+ const noteIdRef = useRef(0);
4712
+ const entryCountRef = useRef(0);
4713
+ const streamingRef = useRef(false);
4714
+ streamingRef.current = streaming;
4715
+ function pushNote(content) {
4716
+ const note = {
4717
+ id: noteIdRef.current++,
4718
+ content,
4719
+ afterIndex: entryCountRef.current
4720
+ };
4721
+ setNotes((current) => [...current, note]);
4415
4722
  }
4416
- /** True when `command` is a slash command, which then ran. */
4417
- async function runSlashCommand(command, rest) {
4418
- switch (command) {
4419
- case "/help":
4420
- pushNote(SLASH_HELP);
4421
- return true;
4422
- case "/context":
4423
- try {
4424
- pushNote(formatContext(await api(`${base}/chat/context`)));
4425
- } catch (error) {
4426
- pushNote(`/context failed: ${errorMessage(error)}`);
4427
- }
4428
- return true;
4429
- case "/new":
4430
- onOpenLibrary();
4431
- return true;
4432
- case "/compact":
4433
- await compact(rest);
4434
- return true;
4435
- default: return false;
4723
+ useEffect(() => () => abortRef.current?.abort(), []);
4724
+ const sync = useSessionSync({
4725
+ agentId,
4726
+ base,
4727
+ initialSessionHead,
4728
+ onConversation,
4729
+ streamingRef,
4730
+ pushNote,
4731
+ onHistory: (saved) => {
4732
+ setMessages(saved);
4733
+ setLive([]);
4734
+ setEditing(false);
4436
4735
  }
4437
- }
4736
+ });
4737
+ const { recoveredTurn, setRecoveredTurn, approvalTurnRef, approvalBusy, approvalErrors, decide, resetApprovals } = useCommandApprovals({
4738
+ agentId,
4739
+ setLive
4740
+ });
4741
+ const turnBusy = streaming || recoveredTurn;
4742
+ const agentBusy = turnBusy || Boolean(sync.queue?.turnActive);
4438
4743
  function lastUserMessage() {
4439
4744
  return messages.findLastIndex((message) => message.role === "user");
4440
4745
  }
@@ -4453,8 +4758,7 @@ function useChatSession({ agentId, initialMessages, initialSessionHead, onOpenLi
4453
4758
  setMessages(frame.messages);
4454
4759
  setLive([]);
4455
4760
  setRecoveredTurn(false);
4456
- setApprovalBusy({});
4457
- setApprovalErrors({});
4761
+ resetApprovals();
4458
4762
  return;
4459
4763
  }
4460
4764
  const event = frame.event;
@@ -4473,12 +4777,22 @@ function useChatSession({ agentId, initialMessages, initialSessionHead, onOpenLi
4473
4777
  */
4474
4778
  async function send(draft) {
4475
4779
  const slash = parseSlashCommand(draft.text);
4476
- if (slash && await runSlashCommand(slash.command, slash.rest)) return draft.attachments.length > 0 ? {
4780
+ if (slash && await runSlashCommand(slash.command, slash.rest, {
4781
+ base,
4782
+ messageCount: messages.length,
4783
+ pushNote,
4784
+ onOpenLibrary,
4785
+ setCompacting: (compacting) => {
4786
+ if (compacting) setEditing(false);
4787
+ setStreaming(compacting);
4788
+ setThinking(compacting);
4789
+ }
4790
+ })) return draft.attachments.length > 0 ? {
4477
4791
  text: "",
4478
4792
  attachments: draft.attachments
4479
4793
  } : null;
4480
4794
  if (turnBusy) {
4481
- if (!editing) return enqueue(draft);
4795
+ if (!editing) return sync.enqueue(draft);
4482
4796
  pushNote("Wait for the current turn to finish before replacing the last message.");
4483
4797
  return draft;
4484
4798
  }
@@ -4487,7 +4801,7 @@ function useChatSession({ agentId, initialMessages, initialSessionHead, onOpenLi
4487
4801
  try {
4488
4802
  await api(`${base}/chat/truncate`, { body: {
4489
4803
  keepCount,
4490
- conversationId: knownHeadRef.current.conversationId ?? void 0
4804
+ conversationId: sync.knownConversationId() ?? void 0
4491
4805
  } });
4492
4806
  } catch (error) {
4493
4807
  pushNote(`Could not replace the last turn: ${errorMessage(error)}`);
@@ -4496,17 +4810,9 @@ function useChatSession({ agentId, initialMessages, initialSessionHead, onOpenLi
4496
4810
  setMessages((current) => current.slice(0, keepCount));
4497
4811
  setEditing(false);
4498
4812
  }
4499
- const images = draft.attachments.filter((file) => isImageMime(file.mimeType));
4500
- const files = draft.attachments.filter((file) => !isImageMime(file.mimeType)).map((file) => ({ name: file.name ?? "file" }));
4501
- setLive([{
4502
- type: "user",
4503
- content: draft.text,
4504
- ...images.length > 0 ? { images } : {},
4505
- ...files.length > 0 ? { files } : {}
4506
- }]);
4813
+ setLive([draftEntry(draft.text, draft.attachments)]);
4507
4814
  setRecoveredTurn(false);
4508
- setApprovalBusy({});
4509
- setApprovalErrors({});
4815
+ resetApprovals();
4510
4816
  approvalTurnRef.current = false;
4511
4817
  const abort = new AbortController();
4512
4818
  abortRef.current = abort;
@@ -4524,11 +4830,11 @@ function useChatSession({ agentId, initialMessages, initialSessionHead, onOpenLi
4524
4830
  if (frame.kind !== "event") finished = true;
4525
4831
  handleFrame(frame);
4526
4832
  }
4527
- await refreshKnownHead();
4833
+ await sync.refreshKnownHead();
4528
4834
  } catch (error) {
4529
4835
  if (error instanceof ApiError) if (error.code === "agent_turn_active") {
4530
4836
  setLive([]);
4531
- restore = await enqueue(draft);
4837
+ restore = await sync.enqueue(draft);
4532
4838
  } else {
4533
4839
  setLive([{
4534
4840
  type: "error",
@@ -4546,7 +4852,7 @@ function useChatSession({ agentId, initialMessages, initialSessionHead, onOpenLi
4546
4852
  setThinking(false);
4547
4853
  setStreaming(false);
4548
4854
  abortRef.current = null;
4549
- refreshQueue();
4855
+ sync.refreshQueue();
4550
4856
  setQuestionsKey((key) => key + 1);
4551
4857
  }
4552
4858
  }
@@ -4559,40 +4865,7 @@ function useChatSession({ agentId, initialMessages, initialSessionHead, onOpenLi
4559
4865
  } catch (error) {
4560
4866
  if (!(error instanceof ApiError && error.status === 409)) pushNote("Stop was not confirmed; the response may still be running.");
4561
4867
  }
4562
- refreshQueue();
4563
- }
4564
- async function reconcileApproval(id) {
4565
- try {
4566
- const { approvals } = await api(shellApprovalsUrl(agentId));
4567
- const approval = approvals.find((item) => item.id === id && item.agentId === agentId);
4568
- if (approval) setLive((entries) => upsertCommandApprovalEntry(entries, approval));
4569
- return approval ?? null;
4570
- } catch {
4571
- return null;
4572
- }
4573
- }
4574
- async function decide(approval, decision) {
4575
- if (approval.agentId !== agentId || approval.status !== "pending") return;
4576
- setApprovalBusy((current) => ({
4577
- ...current,
4578
- [approval.id]: true
4579
- }));
4580
- setApprovalErrors(({ [approval.id]: _cleared, ...rest }) => rest);
4581
- try {
4582
- const body = await api(`/api/shell-approvals/${encodeURIComponent(approval.id)}`, { body: { decision } });
4583
- if (body.approval.agentId === agentId) setLive((entries) => upsertCommandApprovalEntry(entries, body.approval));
4584
- } catch (error) {
4585
- const current = await reconcileApproval(approval.id);
4586
- if (!current || current.status === "pending") setApprovalErrors((errors) => ({
4587
- ...errors,
4588
- [approval.id]: errorMessage(error)
4589
- }));
4590
- } finally {
4591
- setApprovalBusy((current) => ({
4592
- ...current,
4593
- [approval.id]: false
4594
- }));
4595
- }
4868
+ sync.refreshQueue();
4596
4869
  }
4597
4870
  /** Put the last user message back in the composer; sending it replaces the last turn. */
4598
4871
  function startEdit() {
@@ -4617,10 +4890,10 @@ function useChatSession({ agentId, initialMessages, initialSessionHead, onOpenLi
4617
4890
  turnBusy,
4618
4891
  agentBusy,
4619
4892
  editing,
4620
- stale,
4893
+ stale: sync.stale,
4621
4894
  recoveredTurn,
4622
- historyUnavailable,
4623
- queue,
4895
+ historyUnavailable: sync.historyUnavailable,
4896
+ queue: sync.queue,
4624
4897
  questionsKey,
4625
4898
  approvals: {
4626
4899
  busy: approvalBusy,
@@ -4631,9 +4904,9 @@ function useChatSession({ agentId, initialMessages, initialSessionHead, onOpenLi
4631
4904
  stop,
4632
4905
  startEdit,
4633
4906
  cancelEdit: () => setEditing(false),
4634
- refreshHistory,
4635
- refreshQueue,
4636
- dismissStale: () => setStale(false)
4907
+ refreshHistory: sync.refreshHistory,
4908
+ refreshQueue: sync.refreshQueue,
4909
+ dismissStale: sync.dismissStale
4637
4910
  };
4638
4911
  }
4639
4912
  //#endregion
@@ -4661,6 +4934,19 @@ function AgentChat({ agentId, agentName, initialMessages, initialSessionHead, he
4661
4934
  const inputRef = useRef(null);
4662
4935
  const logRef = useRef(null);
4663
4936
  const nearBottomRef = useRef(true);
4937
+ const workspace = useWorkspaceOptional();
4938
+ const navigate = useNavigate();
4939
+ useFindInTranscript(logRef, workspace?.search.find, workspace?.search.match, () => {
4940
+ nearBottomRef.current = false;
4941
+ if (workspace) navigate({
4942
+ to: "/",
4943
+ search: workspace.to({
4944
+ find: void 0,
4945
+ match: void 0
4946
+ }),
4947
+ replace: true
4948
+ });
4949
+ });
4664
4950
  useLayoutEffect(() => {
4665
4951
  const log = logRef.current;
4666
4952
  if (log && nearBottomRef.current) log.scrollTop = log.scrollHeight;
@@ -5207,7 +5493,7 @@ function Preview({ result }) {
5207
5493
  //#endregion
5208
5494
  //#region src/components/workspace/ConversationHeader.tsx
5209
5495
  var CHIP = "inline-flex h-[26px] shrink-0 items-center gap-1 rounded-full border border-border bg-muted px-2.5 text-xs font-semibold text-mocha hover:border-sapphire-light hover:text-sapphire";
5210
- var MENU_ITEM = "flex min-h-10 w-full cursor-pointer items-center gap-2 rounded-lg px-2.5 py-1.5 text-left text-sm text-foreground outline-none data-[highlighted]:bg-accent data-[highlighted]:text-accent-foreground data-[disabled]:cursor-not-allowed data-[disabled]:opacity-50";
5496
+ var MENU_ITEM$1 = "flex min-h-10 w-full cursor-pointer items-center gap-2 rounded-lg px-2.5 py-1.5 text-left text-sm text-foreground outline-none data-[highlighted]:bg-accent data-[highlighted]:text-accent-foreground data-[disabled]:cursor-not-allowed data-[disabled]:opacity-50";
5211
5497
  /** The model without its provider: `lmstudio:paper-coder-32b` reads as `paper-coder-32b`. */
5212
5498
  function shortModel(model) {
5213
5499
  const colon = model.indexOf(":");
@@ -5233,7 +5519,7 @@ function ConversationHeader({ agent, chat, panel, lastPanel }) {
5233
5519
  size: 32
5234
5520
  }),
5235
5521
  /* @__PURE__ */ jsx("h1", {
5236
- className: "m-0 min-w-0 truncate font-display text-xl leading-tight text-charcoal",
5522
+ className: "m-0 min-w-0 max-w-[14rem] shrink-0 truncate font-display text-xl leading-tight text-charcoal",
5237
5523
  children: agent.agent.name
5238
5524
  }),
5239
5525
  /* @__PURE__ */ jsx(Link, {
@@ -5271,7 +5557,6 @@ function ConversationHeader({ agent, chat, panel, lastPanel }) {
5271
5557
  }),
5272
5558
  "aria-label": panel === "none" ? "Show the side panel" : "Hide the side panel",
5273
5559
  title: panel === "none" ? "Show the side panel" : "Hide the side panel",
5274
- "aria-pressed": panel !== "none",
5275
5560
  className: `flex size-8 shrink-0 items-center justify-center rounded-[10px] border ${panel === "none" ? "border-border bg-card text-mocha hover:text-sapphire" : "border-primary/25 bg-accent text-accent-foreground"}`,
5276
5561
  children: /* @__PURE__ */ jsx(PanelRight, {
5277
5562
  className: "size-4",
@@ -5343,7 +5628,7 @@ function ConversationMenu({ agentId, chat }) {
5343
5628
  asChild: true,
5344
5629
  children: /* @__PURE__ */ jsxs("button", {
5345
5630
  type: "button",
5346
- "aria-label": "Conversations",
5631
+ "aria-label": shown ? `${shown.title}: conversations` : "Conversations",
5347
5632
  className: "unstyled inline-flex h-8 min-w-0 max-w-[15rem] items-center gap-1.5 rounded-[10px] border border-border bg-card px-2.5 text-sm font-semibold text-foreground hover:border-sapphire-light",
5348
5633
  children: [
5349
5634
  /* @__PURE__ */ jsx(MessageSquare, {
@@ -5392,17 +5677,24 @@ function ConversationMenu({ agentId, chat }) {
5392
5677
  conversations.map((conversation) => {
5393
5678
  const active = conversation.id === activeId;
5394
5679
  const reading = conversation.id === shownId;
5680
+ const used = list.data?.usage[conversation.id];
5395
5681
  return /* @__PURE__ */ jsx(DropdownMenu.Item, {
5396
5682
  asChild: true,
5397
- className: MENU_ITEM,
5683
+ className: MENU_ITEM$1,
5398
5684
  children: /* @__PURE__ */ jsxs(Link, {
5399
5685
  to: "/",
5400
5686
  search: to({ conversation: active ? void 0 : conversation.id }),
5401
5687
  "aria-current": reading ? "true" : void 0,
5402
5688
  className: reading ? "bg-accent/70 text-accent-foreground" : "",
5403
- children: [/* @__PURE__ */ jsx("span", {
5404
- className: "min-w-0 flex-1 truncate font-medium",
5405
- children: conversation.title
5689
+ children: [/* @__PURE__ */ jsxs("span", {
5690
+ className: "min-w-0 flex-1",
5691
+ children: [/* @__PURE__ */ jsx("span", {
5692
+ className: "block truncate font-medium",
5693
+ children: conversation.title
5694
+ }), used && /* @__PURE__ */ jsx("span", {
5695
+ className: "block truncate text-xs text-muted-foreground",
5696
+ children: usageSummary(used)
5697
+ })]
5406
5698
  }), active ? /* @__PURE__ */ jsxs("span", {
5407
5699
  className: "flex shrink-0 items-center gap-1 text-xs font-semibold text-success",
5408
5700
  children: [/* @__PURE__ */ jsx(Check, {
@@ -5431,7 +5723,7 @@ function ConversationMenu({ agentId, chat }) {
5431
5723
  }),
5432
5724
  /* @__PURE__ */ jsx(DropdownMenu.Separator, { className: "my-1.5 h-px bg-border" }),
5433
5725
  /* @__PURE__ */ jsxs(DropdownMenu.Item, {
5434
- className: `${MENU_ITEM} font-semibold`,
5726
+ className: `${MENU_ITEM$1} font-semibold`,
5435
5727
  disabled: chat?.agentBusy ?? false,
5436
5728
  onSelect: () => void startNew(),
5437
5729
  children: [
@@ -5447,7 +5739,7 @@ function ConversationMenu({ agentId, chat }) {
5447
5739
  ]
5448
5740
  }),
5449
5741
  shown && /* @__PURE__ */ jsxs(DropdownMenu.Item, {
5450
- className: MENU_ITEM,
5742
+ className: MENU_ITEM$1,
5451
5743
  onSelect: () => setRenaming(shown),
5452
5744
  children: [
5453
5745
  /* @__PURE__ */ jsx(Pencil, {
@@ -5458,6 +5750,18 @@ function ConversationMenu({ agentId, chat }) {
5458
5750
  shown.title.length > 24 ? `${shown.title.slice(0, 24)}…` : shown.title,
5459
5751
  "”"
5460
5752
  ]
5753
+ }),
5754
+ /* @__PURE__ */ jsx(DropdownMenu.Item, {
5755
+ asChild: true,
5756
+ className: MENU_ITEM$1,
5757
+ children: /* @__PURE__ */ jsxs(Link, {
5758
+ to: "/usage",
5759
+ search: { agent: agentId },
5760
+ children: [/* @__PURE__ */ jsx(BarChart3, {
5761
+ className: "size-3.5",
5762
+ "aria-hidden": "true"
5763
+ }), "This Agent's usage"]
5764
+ })
5461
5765
  })
5462
5766
  ]
5463
5767
  }) })]
@@ -5530,8 +5834,20 @@ function RenameConversation({ base, conversation, onClose, onRenamed }) {
5530
5834
  //#endregion
5531
5835
  //#region src/components/workspace/EarlierConversation.tsx
5532
5836
  function EarlierConversation({ agentId, agentName, conversationId, header }) {
5533
- const { to } = useWorkspace();
5837
+ const { search, to } = useWorkspace();
5534
5838
  const router = useRouter();
5839
+ const navigate = useNavigate();
5840
+ const logRef = useRef(null);
5841
+ useFindInTranscript(logRef, search.find, search.match, () => {
5842
+ navigate({
5843
+ to: "/",
5844
+ search: to({
5845
+ find: void 0,
5846
+ match: void 0
5847
+ }),
5848
+ replace: true
5849
+ });
5850
+ });
5535
5851
  const path = `/api/agents/${encodeURIComponent(agentId)}/conversations/${encodeURIComponent(conversationId)}`;
5536
5852
  const [busy, setBusy] = useState(false);
5537
5853
  const [error, setError] = useState("");
@@ -5603,6 +5919,7 @@ function EarlierConversation({ agentId, agentName, conversationId, header }) {
5603
5919
  children: error
5604
5920
  }),
5605
5921
  /* @__PURE__ */ jsx("div", {
5922
+ ref: logRef,
5606
5923
  className: "min-h-0 flex-1 overflow-y-auto px-5 py-4",
5607
5924
  children: /* @__PURE__ */ jsxs("div", {
5608
5925
  className: "mx-auto max-w-[50rem]",
@@ -5837,6 +6154,543 @@ function TeamCard({ team, members, summary }) {
5837
6154
  }) });
5838
6155
  }
5839
6156
  //#endregion
6157
+ //#region src/components/workspace/rail/menu.ts
6158
+ 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";
6159
+ 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";
6160
+ //#endregion
6161
+ //#region src/components/workspace/rail/NewMenu.tsx
6162
+ function NewMenu({ buttonRef, profiles, teamTemplates, onSpawnAgent, onSpawnTeam, onCreateTeam }) {
6163
+ return /* @__PURE__ */ jsxs(DropdownMenu.Root, {
6164
+ modal: false,
6165
+ children: [/* @__PURE__ */ jsx(DropdownMenu.Trigger, {
6166
+ asChild: true,
6167
+ children: /* @__PURE__ */ jsxs("button", {
6168
+ ref: buttonRef,
6169
+ type: "button",
6170
+ "aria-label": "Create a new Agent or Team",
6171
+ 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",
6172
+ children: [
6173
+ /* @__PURE__ */ jsx(Plus, {
6174
+ className: "size-3.5",
6175
+ "aria-hidden": "true"
6176
+ }),
6177
+ "New",
6178
+ /* @__PURE__ */ jsx(ChevronDown, {
6179
+ className: "size-3.5 text-muted-foreground transition-transform group-data-[state=open]:rotate-180",
6180
+ "aria-hidden": "true"
6181
+ })
6182
+ ]
6183
+ })
6184
+ }), /* @__PURE__ */ jsx(DropdownMenu.Portal, { children: /* @__PURE__ */ jsxs(DropdownMenu.Content, {
6185
+ align: "end",
6186
+ sideOffset: 6,
6187
+ className: "z-50 w-60 rounded-xl border border-border bg-popover p-1.5 text-popover-foreground shadow-baziu-lg outline-none",
6188
+ children: [
6189
+ /* @__PURE__ */ jsxs(DropdownMenu.Label, {
6190
+ className: MENU_LABEL,
6191
+ children: [/* @__PURE__ */ jsx(Bot, {
6192
+ className: "size-3",
6193
+ "aria-hidden": "true"
6194
+ }), "Agent templates"]
6195
+ }),
6196
+ profiles.length === 0 ? /* @__PURE__ */ jsx(DropdownMenu.Item, {
6197
+ asChild: true,
6198
+ className: MENU_ITEM,
6199
+ children: /* @__PURE__ */ jsx("a", {
6200
+ href: "/templates/agents?new=1",
6201
+ children: "Create an Agent template"
6202
+ })
6203
+ }) : profiles.map((profile) => /* @__PURE__ */ jsxs(DropdownMenu.Item, {
6204
+ className: MENU_ITEM,
6205
+ onSelect: () => onSpawnAgent(profile.id),
6206
+ children: [/* @__PURE__ */ jsx("span", {
6207
+ className: "min-w-0 flex-1 truncate",
6208
+ children: profile.name || profile.id
6209
+ }), profile.id === "default" && /* @__PURE__ */ jsx("span", {
6210
+ className: "rounded-full border border-border bg-muted px-1.5 py-0.5 text-xs font-semibold text-muted-foreground",
6211
+ children: "Default"
6212
+ })]
6213
+ }, profile.id)),
6214
+ /* @__PURE__ */ jsx(DropdownMenu.Separator, { className: "my-1.5 h-px bg-border" }),
6215
+ /* @__PURE__ */ jsxs(DropdownMenu.Label, {
6216
+ className: MENU_LABEL,
6217
+ children: [/* @__PURE__ */ jsx(UsersRound, {
6218
+ className: "size-3",
6219
+ "aria-hidden": "true"
6220
+ }), "Team templates"]
6221
+ }),
6222
+ teamTemplates.length === 0 ? /* @__PURE__ */ jsx(DropdownMenu.Item, {
6223
+ asChild: true,
6224
+ className: MENU_ITEM,
6225
+ children: /* @__PURE__ */ jsx("a", {
6226
+ href: "/templates/teams?new=1",
6227
+ children: "Create a Team template"
6228
+ })
6229
+ }) : teamTemplates.map((entry) => /* @__PURE__ */ jsxs(DropdownMenu.Item, {
6230
+ className: MENU_ITEM,
6231
+ disabled: entry.slots.length === 0,
6232
+ title: entry.slots.length === 0 ? "Add at least one member before spawning" : void 0,
6233
+ onSelect: () => onSpawnTeam(entry.id),
6234
+ children: [/* @__PURE__ */ jsx("span", {
6235
+ className: "min-w-0 flex-1 truncate",
6236
+ children: entry.name || entry.id
6237
+ }), /* @__PURE__ */ jsx("span", {
6238
+ className: "inline-flex min-w-6 items-center justify-center rounded-full bg-muted px-1.5 font-mono text-xs text-muted-foreground",
6239
+ children: entry.slots.length
6240
+ })]
6241
+ }, entry.id)),
6242
+ /* @__PURE__ */ jsx(DropdownMenu.Separator, { className: "my-1.5 h-px bg-border" }),
6243
+ /* @__PURE__ */ jsxs(DropdownMenu.Item, {
6244
+ className: MENU_ITEM,
6245
+ onSelect: onCreateTeam,
6246
+ children: [/* @__PURE__ */ jsx(Plus, {
6247
+ className: "size-3.5",
6248
+ "aria-hidden": "true"
6249
+ }), "Create a Team"]
6250
+ })
6251
+ ]
6252
+ }) })]
6253
+ });
6254
+ }
6255
+ //#endregion
6256
+ //#region src/components/workspace/rail/order.ts
6257
+ /** The Default Team first, then the rest as the daemon lists them. */
6258
+ function sortTeams(teams) {
6259
+ return [...teams].sort((a, b) => Number(b.id === DEFAULT_TEAM_ID) - Number(a.id === DEFAULT_TEAM_ID));
6260
+ }
6261
+ /** The seeded default template first: the one-click path for a new install. */
6262
+ function sortProfiles(profiles) {
6263
+ return [...profiles].sort((a, b) => Number(b.id === DEFAULT_PROFILE_ID) - Number(a.id === DEFAULT_PROFILE_ID));
6264
+ }
6265
+ /** The folded rail's Teams: only those with Agents, the Team in view first. */
6266
+ function slimTeams(teams, agents, inViewId) {
6267
+ const sorted = sortTeams(teams).filter((team) => agents.some((agent) => agent.teamId === team.id));
6268
+ sorted.sort((a, b) => Number(b.id === inViewId) - Number(a.id === inViewId));
6269
+ return sorted;
6270
+ }
6271
+ //#endregion
6272
+ //#region src/components/workspace/rail/AgentRow.tsx
6273
+ function AgentRow({ agent, selected, state, lastActivityAt, panel, onRename, onArchive }) {
6274
+ const hydrated = useHydrated();
6275
+ return /* @__PURE__ */ jsxs("div", {
6276
+ className: "group/row relative rounded-2xl",
6277
+ children: [/* @__PURE__ */ jsxs(Link, {
6278
+ to: "/",
6279
+ search: {
6280
+ agent: agent.id,
6281
+ ...panel ? { panel } : {}
6282
+ },
6283
+ "aria-current": selected ? "page" : void 0,
6284
+ 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"}`,
6285
+ children: [/* @__PURE__ */ jsx(AgentAvatar, {
6286
+ identity: agent.identity,
6287
+ size: 30
6288
+ }), /* @__PURE__ */ jsxs("span", {
6289
+ className: "block min-w-0 flex-1",
6290
+ children: [/* @__PURE__ */ jsxs("span", {
6291
+ className: "flex items-center gap-1.5",
6292
+ children: [
6293
+ /* @__PURE__ */ jsx("span", {
6294
+ className: `min-w-0 truncate text-sm font-semibold leading-tight ${selected ? "text-accent-foreground" : "text-foreground"}`,
6295
+ children: agent.name
6296
+ }),
6297
+ agent.telegramTopicId !== null && /* @__PURE__ */ jsx("span", {
6298
+ className: "shrink-0 text-primary",
6299
+ title: `Telegram topic #${agent.telegramTopicId}`,
6300
+ role: "img",
6301
+ "aria-label": `Bound to Telegram topic ${agent.telegramTopicId}`,
6302
+ children: /* @__PURE__ */ jsx(Send, {
6303
+ className: "size-3",
6304
+ "aria-hidden": "true"
6305
+ })
6306
+ }),
6307
+ hydrated && lastActivityAt !== null && /* @__PURE__ */ jsx("time", {
6308
+ dateTime: new Date(lastActivityAt).toISOString(),
6309
+ className: "ml-auto shrink-0 text-xs font-normal text-muted-foreground",
6310
+ children: shortTime(lastActivityAt)
6311
+ })
6312
+ ]
6313
+ }), /* @__PURE__ */ jsxs("span", {
6314
+ className: `mt-0.5 flex items-center gap-1.5 text-xs leading-snug ${STATE_TEXT[state.kind]}`,
6315
+ children: [/* @__PURE__ */ jsx("span", {
6316
+ className: `size-[7px] shrink-0 rounded-full ${STATE_DOT[state.kind]}`,
6317
+ "aria-hidden": "true"
6318
+ }), /* @__PURE__ */ jsx("span", {
6319
+ className: "min-w-0 truncate",
6320
+ children: state.text
6321
+ })]
6322
+ })]
6323
+ })]
6324
+ }), /* @__PURE__ */ jsxs(DropdownMenu.Root, {
6325
+ modal: false,
6326
+ children: [/* @__PURE__ */ jsx(DropdownMenu.Trigger, {
6327
+ asChild: true,
6328
+ children: /* @__PURE__ */ jsx("button", {
6329
+ type: "button",
6330
+ "aria-label": `More for ${agent.name}`,
6331
+ 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",
6332
+ children: /* @__PURE__ */ jsx(Ellipsis, {
6333
+ className: "size-4",
6334
+ "aria-hidden": "true"
6335
+ })
6336
+ })
6337
+ }), /* @__PURE__ */ jsx(DropdownMenu.Portal, { children: /* @__PURE__ */ jsxs(DropdownMenu.Content, {
6338
+ align: "start",
6339
+ sideOffset: 4,
6340
+ className: "z-50 w-48 rounded-xl border border-border bg-popover p-1.5 text-popover-foreground shadow-baziu-lg outline-none",
6341
+ children: [
6342
+ /* @__PURE__ */ jsx(DropdownMenu.Item, {
6343
+ asChild: true,
6344
+ className: MENU_ITEM,
6345
+ children: /* @__PURE__ */ jsxs(Link, {
6346
+ to: "/",
6347
+ search: {
6348
+ agent: agent.id,
6349
+ panel: "agent"
6350
+ },
6351
+ children: [/* @__PURE__ */ jsx(Settings2, {
6352
+ className: "size-3.5",
6353
+ "aria-hidden": "true"
6354
+ }), "Agent settings"]
6355
+ })
6356
+ }),
6357
+ /* @__PURE__ */ jsxs(DropdownMenu.Item, {
6358
+ className: MENU_ITEM,
6359
+ onSelect: onRename,
6360
+ children: [/* @__PURE__ */ jsx(Pencil, {
6361
+ className: "size-3.5",
6362
+ "aria-hidden": "true"
6363
+ }), "Rename"]
6364
+ }),
6365
+ /* @__PURE__ */ jsxs(DropdownMenu.Item, {
6366
+ className: MENU_ITEM,
6367
+ onSelect: onArchive,
6368
+ children: [/* @__PURE__ */ jsx(Archive, {
6369
+ className: "size-3.5",
6370
+ "aria-hidden": "true"
6371
+ }), "Archive"]
6372
+ })
6373
+ ]
6374
+ }) })]
6375
+ })]
6376
+ });
6377
+ }
6378
+ //#endregion
6379
+ //#region src/components/workspace/rail/TeamGroup.tsx
6380
+ function TeamGroup({ team, members, current, isOpen, onOpenChange, openAgentId, selectedId, activity, panel, onRename, onArchive }) {
6381
+ const summary = teamSummary(members.map((agent) => activity.stateOf(agent.id)));
6382
+ return /* @__PURE__ */ jsxs("div", {
6383
+ className: "relative mb-1 last:mb-0",
6384
+ children: [/* @__PURE__ */ jsxs("details", {
6385
+ open: isOpen,
6386
+ onToggle: (event) => {
6387
+ const next = event.currentTarget.open;
6388
+ if (next === isOpen) return;
6389
+ onOpenChange(next);
6390
+ },
6391
+ className: "group/details",
6392
+ children: [/* @__PURE__ */ jsxs("summary", {
6393
+ className: `flex min-h-9 cursor-pointer list-none items-center gap-1.5 rounded-lg py-1 pl-2 pr-9 text-sm transition-colors hover:bg-accent/60 [&::-webkit-details-marker]:hidden ${current ? "bg-muted text-foreground" : "text-mocha"}`,
6394
+ children: [
6395
+ /* @__PURE__ */ jsx(ChevronRight, {
6396
+ className: "size-3.5 shrink-0 text-muted-foreground transition-transform group-open/details:rotate-90",
6397
+ "aria-hidden": "true"
6398
+ }),
6399
+ /* @__PURE__ */ jsx("span", {
6400
+ className: "min-w-0 flex-1 truncate font-semibold",
6401
+ children: team.name
6402
+ }),
6403
+ /* @__PURE__ */ jsx("span", {
6404
+ className: "shrink-0 text-xs text-muted-foreground",
6405
+ children: summary || members.length
6406
+ })
6407
+ ]
6408
+ }), members.length === 0 ? /* @__PURE__ */ jsx("div", {
6409
+ className: "py-2 pl-7 pr-2 text-xs text-muted-foreground",
6410
+ children: "No agents in this team"
6411
+ }) : /* @__PURE__ */ jsx("div", {
6412
+ className: "space-y-0.5 py-1 pl-1.5",
6413
+ children: members.map((agent) => /* @__PURE__ */ jsx(AgentRow, {
6414
+ agent,
6415
+ selected: agent.id === selectedId,
6416
+ state: activity.stateOf(agent.id),
6417
+ lastActivityAt: activity.byAgent.get(agent.id)?.lastActivityAt ?? null,
6418
+ panel,
6419
+ onRename: () => onRename(agent),
6420
+ onArchive: () => onArchive(agent)
6421
+ }, agent.id))
6422
+ })]
6423
+ }), /* @__PURE__ */ jsx(Link, {
6424
+ to: "/",
6425
+ search: {
6426
+ ...openAgentId !== null ? { agent: openAgentId } : {},
6427
+ team: team.id,
6428
+ panel: "team"
6429
+ },
6430
+ "aria-label": `Open ${team.name}: members, USER.md, memory`,
6431
+ title: "Open the Team",
6432
+ className: "absolute right-1 top-1 flex size-7 items-center justify-center rounded-lg text-muted-foreground hover:bg-card hover:text-primary",
6433
+ children: /* @__PURE__ */ jsx(PanelRight, {
6434
+ className: "size-3.5",
6435
+ "aria-hidden": "true"
6436
+ })
6437
+ })]
6438
+ });
6439
+ }
6440
+ //#endregion
6441
+ //#region src/components/workspace/rail/Rail.tsx
6442
+ function Rail({ initialOpenGroups }) {
6443
+ const { agents, teams, profiles, teamTemplates, agent: open, team: inView, search } = useWorkspace();
6444
+ const activity = useActivity();
6445
+ const router = useRouter();
6446
+ const [spawnProfile, setSpawnProfile] = useState(null);
6447
+ const [spawnTeam, setSpawnTeam] = useState(void 0);
6448
+ const [spawnTemplate, setSpawnTemplate] = useState(null);
6449
+ const [createTeamOpen, setCreateTeamOpen] = useState(false);
6450
+ const [createTeamBusy, setCreateTeamBusy] = useState(false);
6451
+ const [renameTarget, setRenameTarget] = useState(null);
6452
+ const [archiveTarget, setArchiveTarget] = useState(null);
6453
+ const [openGroups, setOpenGroups] = useState(initialOpenGroups);
6454
+ const newButton = useRef(null);
6455
+ const refocusNewButton = () => window.requestAnimationFrame(() => newButton.current?.focus());
6456
+ const sortedProfiles = sortProfiles(profiles);
6457
+ const sortedTeams = sortTeams(teams);
6458
+ const template = teamTemplates.find((entry) => entry.id === spawnTemplate);
6459
+ const selectedId = open?.agent.id ?? null;
6460
+ return /* @__PURE__ */ jsxs("aside", {
6461
+ className: "flex h-full flex-col overflow-hidden rounded-2xl border border-border bg-card shadow-baziu-sm",
6462
+ children: [
6463
+ /* @__PURE__ */ jsxs("header", {
6464
+ className: "flex items-center justify-between gap-3 border-b border-border bg-muted/60 px-3 py-2.5",
6465
+ children: [/* @__PURE__ */ jsxs("div", {
6466
+ className: "flex min-w-0 items-center gap-2",
6467
+ children: [/* @__PURE__ */ jsx("span", {
6468
+ className: "flex size-7 shrink-0 items-center justify-center rounded-[10px] bg-accent text-accent-foreground",
6469
+ children: /* @__PURE__ */ jsx(UsersRound, {
6470
+ className: "size-4",
6471
+ "aria-hidden": "true"
6472
+ })
6473
+ }), /* @__PURE__ */ jsxs("div", {
6474
+ className: "min-w-0",
6475
+ children: [/* @__PURE__ */ jsx("div", {
6476
+ className: "text-sm font-semibold leading-tight text-foreground",
6477
+ children: "Teams"
6478
+ }), /* @__PURE__ */ jsxs("p", {
6479
+ className: "m-0 truncate text-xs leading-snug text-muted-foreground",
6480
+ children: [
6481
+ agents.length,
6482
+ " agent",
6483
+ agents.length === 1 ? "" : "s",
6484
+ " in ",
6485
+ teams.length,
6486
+ " team",
6487
+ teams.length === 1 ? "" : "s"
6488
+ ]
6489
+ })]
6490
+ })]
6491
+ }), /* @__PURE__ */ jsx(NewMenu, {
6492
+ buttonRef: newButton,
6493
+ profiles: sortedProfiles,
6494
+ teamTemplates,
6495
+ onSpawnAgent: (profileId) => {
6496
+ setSpawnTeam(inView?.id);
6497
+ setSpawnProfile(profileId);
6498
+ },
6499
+ onSpawnTeam: (templateId) => setSpawnTemplate(templateId),
6500
+ onCreateTeam: () => setCreateTeamOpen(true)
6501
+ })]
6502
+ }),
6503
+ /* @__PURE__ */ jsxs("nav", {
6504
+ className: "flex-1 overflow-y-auto p-1.5",
6505
+ "aria-label": "Teams and agents",
6506
+ children: [agents.length === 0 && /* @__PURE__ */ jsxs("div", {
6507
+ 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",
6508
+ children: [
6509
+ /* @__PURE__ */ jsx("p", {
6510
+ className: "m-0 text-sm font-semibold text-foreground",
6511
+ children: "No agents yet"
6512
+ }),
6513
+ /* @__PURE__ */ jsx("p", {
6514
+ className: "mt-1 text-xs leading-5 text-muted-foreground",
6515
+ children: "Your default Team is ready. Spawn the first agent to start a conversation."
6516
+ }),
6517
+ sortedProfiles[0] ? /* @__PURE__ */ jsx(Button, {
6518
+ variant: "primary",
6519
+ className: "mt-3",
6520
+ onClick: () => setSpawnProfile(sortedProfiles[0]?.id ?? "default"),
6521
+ children: "Spawn first agent"
6522
+ }) : /* @__PURE__ */ jsx("a", {
6523
+ href: "/templates/agents?new=1",
6524
+ className: "mt-3 text-xs font-semibold",
6525
+ children: "Create an Agent template"
6526
+ })
6527
+ ]
6528
+ }), sortedTeams.map((team) => {
6529
+ const current = inView?.id === team.id;
6530
+ return /* @__PURE__ */ jsx(TeamGroup, {
6531
+ team,
6532
+ members: agents.filter((agent) => agent.teamId === team.id),
6533
+ current,
6534
+ isOpen: isGroupOpen(openGroups, team.id, current),
6535
+ onOpenChange: (next) => {
6536
+ const merged = {
6537
+ ...openGroups,
6538
+ [team.id]: next
6539
+ };
6540
+ writeOpenGroupsCookie(merged);
6541
+ setOpenGroups(merged);
6542
+ },
6543
+ openAgentId: open?.team.id === team.id ? open.agent.id : null,
6544
+ selectedId,
6545
+ activity,
6546
+ panel: search.panel,
6547
+ onRename: (agent) => setRenameTarget(agent),
6548
+ onArchive: (agent) => setArchiveTarget(agent)
6549
+ }, team.id);
6550
+ })]
6551
+ }),
6552
+ spawnProfile && /* @__PURE__ */ jsx(SpawnDialog, {
6553
+ profiles: sortedProfiles,
6554
+ teams: sortedTeams,
6555
+ profileId: spawnProfile,
6556
+ teamId: spawnTeam,
6557
+ onClose: () => {
6558
+ setSpawnProfile(null);
6559
+ refocusNewButton();
6560
+ }
6561
+ }),
6562
+ template && /* @__PURE__ */ jsx(SpawnTeamModal, {
6563
+ template,
6564
+ teams: sortedTeams,
6565
+ onClose: () => {
6566
+ setSpawnTemplate(null);
6567
+ refocusNewButton();
6568
+ },
6569
+ onSpawned: (slug) => {
6570
+ setSpawnTemplate(null);
6571
+ router.navigate({
6572
+ to: "/",
6573
+ search: {
6574
+ team: slug,
6575
+ panel: "team"
6576
+ }
6577
+ });
6578
+ }
6579
+ }),
6580
+ createTeamOpen && /* @__PURE__ */ jsx(Dialog$1, {
6581
+ title: "Create a Team",
6582
+ description: "A Team is one workspace: its folder, its Agents, its USER.md and shared memory, and who may message whom.",
6583
+ busy: createTeamBusy,
6584
+ onClose: () => {
6585
+ setCreateTeamOpen(false);
6586
+ refocusNewButton();
6587
+ },
6588
+ children: /* @__PURE__ */ jsx(TeamForm, {
6589
+ onBusyChange: setCreateTeamBusy,
6590
+ onCreated: async (team) => {
6591
+ setCreateTeamOpen(false);
6592
+ await router.navigate({
6593
+ to: "/",
6594
+ search: {
6595
+ team: team.id,
6596
+ panel: "team"
6597
+ }
6598
+ });
6599
+ },
6600
+ extraActions: (busy) => /* @__PURE__ */ jsx(Button, {
6601
+ variant: "ghost",
6602
+ disabled: busy,
6603
+ onClick: () => setCreateTeamOpen(false),
6604
+ children: "Cancel"
6605
+ })
6606
+ })
6607
+ }),
6608
+ renameTarget && /* @__PURE__ */ jsx(RenameAgentDialog, {
6609
+ agent: renameTarget,
6610
+ onClose: () => setRenameTarget(null),
6611
+ onRenamed: () => router.invalidate()
6612
+ }),
6613
+ /* @__PURE__ */ jsx(ConfirmDialog, {
6614
+ open: archiveTarget !== null,
6615
+ onOpenChange: (next) => {
6616
+ if (!next) setArchiveTarget(null);
6617
+ },
6618
+ title: `Archive ${archiveTarget?.name ?? "agent"}?`,
6619
+ description: /* @__PURE__ */ jsx("p", { children: "The Agent leaves this list and receives no work. Restore it later under Manage → Agents, in Archived." }),
6620
+ confirmLabel: "Archive agent",
6621
+ confirmVariant: "primary",
6622
+ onConfirm: async () => {
6623
+ if (!archiveTarget) return;
6624
+ await archiveAgent(archiveTarget.id);
6625
+ if (archiveTarget.id === selectedId) await router.navigate({
6626
+ to: "/",
6627
+ search: {}
6628
+ });
6629
+ else await router.invalidate();
6630
+ }
6631
+ })
6632
+ ]
6633
+ });
6634
+ }
6635
+ //#endregion
6636
+ //#region src/components/workspace/rail/SlimRail.tsx
6637
+ /** The rail folded to avatars, beside a full-width view. */
6638
+ function SlimRail() {
6639
+ const { agents, teams, agent: open, team: inView, search } = useWorkspace();
6640
+ const activity = useActivity();
6641
+ const sortedTeams = slimTeams(teams, agents, inView?.id);
6642
+ return /* @__PURE__ */ jsxs("nav", {
6643
+ "aria-label": "Agents",
6644
+ 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",
6645
+ children: [/* @__PURE__ */ jsx(Link, {
6646
+ to: "/",
6647
+ search: {
6648
+ ...search,
6649
+ view: void 0,
6650
+ file: void 0,
6651
+ result: void 0
6652
+ },
6653
+ "aria-label": "Back to the conversation and the full list",
6654
+ title: "Back to the conversation",
6655
+ className: "flex size-10 shrink-0 items-center justify-center rounded-xl text-mocha hover:bg-accent hover:text-accent-foreground",
6656
+ children: /* @__PURE__ */ jsx(PanelLeft, {
6657
+ className: "size-[18px]",
6658
+ "aria-hidden": "true"
6659
+ })
6660
+ }), sortedTeams.map((team) => /* @__PURE__ */ jsxs("div", {
6661
+ className: "flex w-full flex-col items-center gap-2",
6662
+ children: [
6663
+ /* @__PURE__ */ jsx("div", { className: "h-px w-8 bg-border" }),
6664
+ /* @__PURE__ */ jsx("span", {
6665
+ className: `max-w-14 truncate text-xs font-bold uppercase tracking-[0.06em] ${team.id === inView?.id ? "text-accent-foreground" : "text-muted-foreground"}`,
6666
+ title: team.name,
6667
+ children: team.name
6668
+ }),
6669
+ agents.filter((agent) => agent.teamId === team.id).map((agent) => {
6670
+ const state = activity.stateOf(agent.id);
6671
+ return /* @__PURE__ */ jsxs(Link, {
6672
+ to: "/",
6673
+ search: {
6674
+ agent: agent.id,
6675
+ ...search.panel ? { panel: search.panel } : {}
6676
+ },
6677
+ "aria-label": `${agent.name}: ${state.text}`,
6678
+ title: `${agent.name}: ${state.text}`,
6679
+ 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" : ""}`,
6680
+ children: [/* @__PURE__ */ jsx(AgentAvatar, {
6681
+ identity: agent.identity,
6682
+ size: 40
6683
+ }), /* @__PURE__ */ jsx("span", {
6684
+ className: `absolute -bottom-px -right-px size-3 rounded-full border-2 border-card ${STATE_DOT[state.kind]}`,
6685
+ "aria-hidden": "true"
6686
+ })]
6687
+ }, agent.id);
6688
+ })
6689
+ ]
6690
+ }, team.id))]
6691
+ });
6692
+ }
6693
+ //#endregion
5840
6694
  //#region src/components/AgentBrowserCard.tsx
5841
6695
  var MODE = {
5842
6696
  headless: "without a window",
@@ -7105,6 +7959,19 @@ function AgentSchedules({ agent }) {
7105
7959
  onChanged: data.reload
7106
7960
  });
7107
7961
  }
7962
+ /** "Next run in 5 min", "Next run Mon 24 Nov, 09:00": when a schedule runs next, in words. */
7963
+ function nextRunWords(at, now) {
7964
+ const wait = at - now;
7965
+ if (wait < 6e4) return "Next run now";
7966
+ if (wait < 36e5) return `Next run in ${Math.round(wait / 6e4)} min`;
7967
+ return `Next run ${new Date(at).toLocaleString(void 0, {
7968
+ weekday: "short",
7969
+ day: "numeric",
7970
+ month: "short",
7971
+ hour: "2-digit",
7972
+ minute: "2-digit"
7973
+ })}`;
7974
+ }
7108
7975
  var RUN = {
7109
7976
  pending: {
7110
7977
  label: "Waiting for the Agent",
@@ -7128,7 +7995,7 @@ var RUN = {
7128
7995
  }
7129
7996
  };
7130
7997
  /** The schedules and their recent runs, as loaded. */
7131
- function SchedulesView({ agentId, agentName = "The Agent", triggers, dispatches, onChanged }) {
7998
+ function SchedulesView({ agentId, agentName = "The Agent", triggers, dispatches, nextRuns, schedulerOff, onChanged }) {
7132
7999
  const [adding, setAdding] = useState(false);
7133
8000
  const [removing, setRemoving] = useState(null);
7134
8001
  const [error, setError] = useState(null);
@@ -7167,64 +8034,78 @@ function SchedulesView({ agentId, agentName = "The Agent", triggers, dispatches,
7167
8034
  "aria-hidden": "true"
7168
8035
  }), "Add a schedule"]
7169
8036
  }),
7170
- children: [error && /* @__PURE__ */ jsx("div", {
7171
- className: "border-t border-border px-4 py-3 sm:px-5",
7172
- children: /* @__PURE__ */ jsx(Notice, {
7173
- role: "alert",
7174
- title: "That did not work.",
7175
- children: error
7176
- })
7177
- }), triggers.length === 0 ? /* @__PURE__ */ jsxs(CardEmpty, {
7178
- icon: /* @__PURE__ */ jsx(CalendarClock, { className: "size-5" }),
7179
- title: "No schedules yet",
7180
- action: /* @__PURE__ */ jsxs(Button, {
7181
- variant: "primary",
7182
- onClick: () => setAdding(true),
7183
- children: [/* @__PURE__ */ jsx(Plus, {
7184
- className: "size-4",
7185
- "aria-hidden": "true"
7186
- }), "Add a schedule"]
8037
+ children: [
8038
+ error && /* @__PURE__ */ jsx("div", {
8039
+ className: "border-t border-border px-4 py-3 sm:px-5",
8040
+ children: /* @__PURE__ */ jsx(Notice, {
8041
+ role: "alert",
8042
+ title: "That did not work.",
8043
+ children: error
8044
+ })
7187
8045
  }),
7188
- children: [
7189
- "A schedule gives ",
7190
- agentName,
7191
- " a message at set times: a morning check, a weekly summary."
7192
- ]
7193
- }) : /* @__PURE__ */ jsx(CardList, { children: triggers.map((trigger) => {
7194
- const schedule = describeSchedule(trigger);
7195
- return /* @__PURE__ */ jsx(ListRow, {
7196
- inline: true,
7197
- title: schedule.raw ? /* @__PURE__ */ jsx("code", {
7198
- className: "font-mono text-[0.92em]",
7199
- children: schedule.text
7200
- }) : schedule.text,
7201
- chip: trigger.enabled ? /* @__PURE__ */ jsx(Chip, {
7202
- tone: "success",
7203
- children: "On"
7204
- }) : /* @__PURE__ */ jsx(Chip, {
7205
- tone: "neutral",
7206
- children: "Paused"
7207
- }),
7208
- meta: /* @__PURE__ */ jsx("span", { children: trigger.lastFiredAt ? `Last ran ${when(trigger.lastFiredAt)}` : "Has not run yet" }),
7209
- actions: /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx(Switch, {
7210
- label: `${schedule.text}: ${trigger.enabled ? "on" : "paused"}`,
7211
- checked: trigger.enabled,
7212
- disabled: busyId === trigger.id,
7213
- onChange: () => void toggle(trigger)
7214
- }), /* @__PURE__ */ jsx(RowMenu, {
7215
- label: `More for ${schedule.text}`,
7216
- items: [{
7217
- label: "Delete…",
7218
- danger: true,
7219
- onSelect: () => setRemoving(trigger)
7220
- }]
7221
- })] }),
7222
- children: /* @__PURE__ */ jsx("p", {
7223
- className: "m-0 whitespace-pre-wrap break-words rounded-xl bg-muted/50 px-3 py-2 text-sm text-foreground",
7224
- children: trigger.message
8046
+ schedulerOff && triggers.length > 0 && /* @__PURE__ */ jsx("div", {
8047
+ className: "border-t border-border px-4 py-3 sm:px-5",
8048
+ children: /* @__PURE__ */ jsxs(Notice, {
8049
+ title: "No schedule runs on this daemon",
8050
+ children: [
8051
+ "It was started with ",
8052
+ /* @__PURE__ */ jsx("code", { children: "BAZILION_SCHEDULER=off" }),
8053
+ "."
8054
+ ]
7225
8055
  })
7226
- }, trigger.id);
7227
- }) })]
8056
+ }),
8057
+ triggers.length === 0 ? /* @__PURE__ */ jsxs(CardEmpty, {
8058
+ icon: /* @__PURE__ */ jsx(CalendarClock, { className: "size-5" }),
8059
+ title: "No schedules yet",
8060
+ action: /* @__PURE__ */ jsxs(Button, {
8061
+ variant: "primary",
8062
+ onClick: () => setAdding(true),
8063
+ children: [/* @__PURE__ */ jsx(Plus, {
8064
+ className: "size-4",
8065
+ "aria-hidden": "true"
8066
+ }), "Add a schedule"]
8067
+ }),
8068
+ children: [
8069
+ "A schedule gives ",
8070
+ agentName,
8071
+ " a message at set times: a morning check, a weekly summary."
8072
+ ]
8073
+ }) : /* @__PURE__ */ jsx(CardList, { children: triggers.map((trigger) => {
8074
+ const schedule = describeSchedule(trigger);
8075
+ return /* @__PURE__ */ jsx(ListRow, {
8076
+ inline: true,
8077
+ title: schedule.raw ? /* @__PURE__ */ jsx("code", {
8078
+ className: "font-mono text-[0.92em]",
8079
+ children: schedule.text
8080
+ }) : schedule.text,
8081
+ chip: trigger.enabled ? /* @__PURE__ */ jsx(Chip, {
8082
+ tone: "success",
8083
+ children: "On"
8084
+ }) : /* @__PURE__ */ jsx(Chip, {
8085
+ tone: "neutral",
8086
+ children: "Paused"
8087
+ }),
8088
+ meta: /* @__PURE__ */ jsxs(Fragment$1, { children: [hydrated && typeof nextRuns[trigger.id] === "number" && /* @__PURE__ */ jsx("span", { children: nextRunWords(nextRuns[trigger.id], Date.now()) }), /* @__PURE__ */ jsx("span", { children: trigger.lastFiredAt ? `Last ran ${when(trigger.lastFiredAt)}` : "Has not run yet" })] }),
8089
+ actions: /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx(Switch, {
8090
+ label: `${schedule.text}: ${trigger.enabled ? "on" : "paused"}`,
8091
+ checked: trigger.enabled,
8092
+ disabled: busyId === trigger.id,
8093
+ onChange: () => void toggle(trigger)
8094
+ }), /* @__PURE__ */ jsx(RowMenu, {
8095
+ label: `More for ${schedule.text}`,
8096
+ items: [{
8097
+ label: "Delete…",
8098
+ danger: true,
8099
+ onSelect: () => setRemoving(trigger)
8100
+ }]
8101
+ })] }),
8102
+ children: /* @__PURE__ */ jsx("p", {
8103
+ className: "m-0 whitespace-pre-wrap break-words rounded-xl bg-muted/50 px-3 py-2 text-sm text-foreground",
8104
+ children: trigger.message
8105
+ })
8106
+ }, trigger.id);
8107
+ }) })
8108
+ ]
7228
8109
  }),
7229
8110
  /* @__PURE__ */ jsx(SetupCard, {
7230
8111
  labelledBy: "agent-schedule-runs",
@@ -8464,9 +9345,80 @@ function TeamHome({ team }) {
8464
9345
  });
8465
9346
  }
8466
9347
  //#endregion
9348
+ //#region src/components/workspace/WaitingStrip.tsx
9349
+ /** How many Agents the strip names before it points to Attention. */
9350
+ var SHOWN = 3;
9351
+ function WaitingStrip({ className = "" }) {
9352
+ const { agents, teams } = useWorkspace();
9353
+ const activity = useActivity();
9354
+ const waiting = agents.map((agent) => ({
9355
+ agent,
9356
+ state: activity.stateOf(agent.id)
9357
+ })).filter((entry) => entry.state.kind === "needs");
9358
+ if (waiting.length === 0) return null;
9359
+ const teamName = new Map(teams.map((team) => [team.id, team.name]));
9360
+ const more = waiting.length - SHOWN;
9361
+ return /* @__PURE__ */ jsxs("section", {
9362
+ "aria-label": "Waiting for you",
9363
+ className: `rounded-2xl border border-warning/40 bg-warning/10 px-3 py-2.5 shadow-baziu-sm ${className}`,
9364
+ children: [
9365
+ /* @__PURE__ */ jsxs("h2", {
9366
+ className: "m-0 mb-1.5 flex items-center gap-1.5 font-body text-xs font-bold uppercase tracking-[0.08em] text-warning",
9367
+ children: [/* @__PURE__ */ jsx(BellRing, {
9368
+ className: "size-3.5",
9369
+ "aria-hidden": "true"
9370
+ }), "Waiting for you"]
9371
+ }),
9372
+ /* @__PURE__ */ jsx("ul", {
9373
+ className: "m-0 flex list-none flex-col gap-1 p-0",
9374
+ children: waiting.slice(0, SHOWN).map(({ agent, state }) => /* @__PURE__ */ jsx("li", { children: /* @__PURE__ */ jsx(WaitingRow, {
9375
+ agent,
9376
+ team: teamName.get(agent.teamId),
9377
+ text: state.text
9378
+ }) }, agent.id))
9379
+ }),
9380
+ more > 0 && /* @__PURE__ */ jsxs(Link, {
9381
+ to: "/attention",
9382
+ className: "mt-1.5 inline-block text-sm font-semibold",
9383
+ children: [more, " more in Attention"]
9384
+ })
9385
+ ]
9386
+ });
9387
+ }
9388
+ function WaitingRow({ agent, team, text }) {
9389
+ return /* @__PURE__ */ jsxs(Link, {
9390
+ to: "/",
9391
+ search: { agent: agent.id },
9392
+ className: "flex min-h-11 items-center gap-2.5 rounded-xl px-1.5 py-1 text-foreground hover:bg-card/70",
9393
+ children: [
9394
+ /* @__PURE__ */ jsx(AgentAvatar, {
9395
+ identity: agent.identity,
9396
+ size: 28
9397
+ }),
9398
+ /* @__PURE__ */ jsxs("span", {
9399
+ className: "min-w-0 flex-1",
9400
+ children: [/* @__PURE__ */ jsxs("span", {
9401
+ className: "block truncate text-sm font-semibold",
9402
+ children: [agent.name, team && /* @__PURE__ */ jsxs("span", {
9403
+ className: "font-normal text-mocha",
9404
+ children: [" · ", team]
9405
+ })]
9406
+ }), /* @__PURE__ */ jsx("span", {
9407
+ className: "block truncate text-xs text-warning",
9408
+ children: text
9409
+ })]
9410
+ }),
9411
+ /* @__PURE__ */ jsx("span", {
9412
+ className: "shrink-0 text-xs font-semibold text-accent-foreground",
9413
+ children: "Open"
9414
+ })
9415
+ ]
9416
+ });
9417
+ }
9418
+ //#endregion
8467
9419
  //#region src/routes/index.tsx?tsr-split=component
8468
9420
  /** The rail's open/closed Teams; a bad cookie is ignored. */
8469
- var ConnectionsView = lazy(() => import("./ConnectionsView-B02FjNsM.js").then((module) => ({ default: module.ConnectionsView })));
9421
+ var ConnectionsView = lazy(() => import("./ConnectionsView-Dy6uYSRI.js").then((module) => ({ default: module.ConnectionsView })));
8470
9422
  function WorkspacePage() {
8471
9423
  const data = Route.useLoaderData();
8472
9424
  const search = Route.useSearch();
@@ -8612,9 +9564,12 @@ function WorkspacePage() {
8612
9564
  }) : /* @__PURE__ */ jsxs("div", {
8613
9565
  className: `grid h-full min-h-0 grid-cols-1 gap-3 py-3 lg:grid-cols-[18rem_minmax(0,1fr)] ${panel === "none" ? "" : "xl:grid-cols-[18rem_minmax(0,1fr)_minmax(22rem,27rem)]"}`,
8614
9566
  children: [
8615
- /* @__PURE__ */ jsx("div", {
8616
- className: `min-h-0 ${open || team ? "hidden lg:block" : ""}`,
8617
- children: /* @__PURE__ */ jsx(Rail, { initialOpenGroups: data.openGroups })
9567
+ /* @__PURE__ */ jsxs("div", {
9568
+ className: `flex min-h-0 flex-col gap-3 ${open || team ? "hidden lg:flex" : ""}`,
9569
+ children: [/* @__PURE__ */ jsx(WaitingStrip, { className: "lg:hidden" }), /* @__PURE__ */ jsx("div", {
9570
+ className: "min-h-0 flex-1",
9571
+ children: /* @__PURE__ */ jsx(Rail, { initialOpenGroups: data.openGroups })
9572
+ })]
8618
9573
  }),
8619
9574
  /* @__PURE__ */ jsx("div", {
8620
9575
  className: `min-h-0 min-w-0 ${open || team ? "" : "hidden lg:block"}`,