bazilion 0.56.0 → 0.57.1

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 (141) hide show
  1. package/dist/cli.js +2 -1
  2. package/dist/cli.js.map +1 -1
  3. package/dist/daemon.js +599 -318
  4. package/dist/daemon.js.map +1 -1
  5. package/dist/web/client/assets/AddProviderDialog-D8VvDmbM.js +1 -0
  6. package/dist/web/client/assets/AgentTemplateParts-BWorU6-F.js +1 -0
  7. package/dist/web/client/assets/{ConfigPage-Ch-DSJUO.js → ConfigPage-DFmHgEaL.js} +1 -1
  8. package/dist/web/client/assets/ConfirmDialog-DrN26lN_.js +1 -0
  9. package/dist/web/client/assets/ConnectionsView-DcO7RJZ7.js +1 -0
  10. package/dist/web/client/assets/{ManagePage-kd7iWYEL.js → ManagePage-BzyMHGqs.js} +1 -1
  11. package/dist/web/client/assets/SectionTabs-C8H_LunZ.js +1 -0
  12. package/dist/web/client/assets/SkillsParts-BueR3HoP.js +1 -0
  13. package/dist/web/client/assets/SpawnTeamModal-B65eQyzu.js +1 -0
  14. package/dist/web/client/assets/TeamForm-BhI9FbjV.js +1 -0
  15. package/dist/web/client/assets/TeamThread-FPpHlVFc.js +1 -0
  16. package/dist/web/client/assets/{UnsavedChangesGuard-vQBdMl8h.js → UnsavedChangesGuard-CYz0AopL.js} +1 -1
  17. package/dist/web/client/assets/{_id-CC9r0qsr.js → _id-5mTcKU2j.js} +1 -1
  18. package/dist/web/client/assets/{_id-C6SADaiD.js → _id-DKgyyyeX.js} +1 -1
  19. package/dist/web/client/assets/{access-BbQFbTPh.js → access-BGtASxet.js} +1 -1
  20. package/dist/web/client/assets/{agents-BXwzmHu8.js → agents-BAODfMcm.js} +1 -1
  21. package/dist/web/client/assets/agents-Bfwz3dl5.js +1 -0
  22. package/dist/web/client/assets/{attention-BMrZJ9ui.js → attention-BIC0TL8d.js} +1 -1
  23. package/dist/web/client/assets/config-kMzM8kdp.js +1 -0
  24. package/dist/web/client/assets/{es2015-D1pnOGPG.js → es2015-DZDOQ3kj.js} +11 -11
  25. package/dist/web/client/assets/index-DuLpyCSP.js +14 -0
  26. package/dist/web/client/assets/{login-DM3q-V4R.js → login-q9O7dqRe.js} +1 -1
  27. package/dist/web/client/assets/{manage-R57MUzsY.js → manage-DdCiSgG9.js} +1 -1
  28. package/dist/web/client/assets/{mcp-CSHrVH1t.js → mcp-B3LzNtrr.js} +1 -1
  29. package/dist/web/client/assets/{parts-68zf8Fgw.js → parts-C104qEuC.js} +1 -1
  30. package/dist/web/client/assets/routes-BDdLZEGO.js +85 -0
  31. package/dist/web/client/assets/{skills-CPZftp9O.js → skills-VEtq-MQJ.js} +1 -1
  32. package/dist/web/client/assets/style-J8ypSsCb.js +7 -0
  33. package/dist/web/client/assets/styles-C7NsCHeU.css +2 -0
  34. package/dist/web/client/assets/{system-Dd2P9eqE.js → system-DtBBeAjO.js} +1 -1
  35. package/dist/web/client/assets/teams-D4X9oNx8.js +1 -0
  36. package/dist/web/client/assets/teams-QlaY2Sxd.js +1 -0
  37. package/dist/web/client/assets/telegram-B7vlTQbt.js +1 -0
  38. package/dist/web/client/assets/{tools-DqNXLMpc.js → tools-C0FIeAL1.js} +1 -1
  39. package/dist/web/client/assets/{usage-BC_TStVj.js → usage-3mYfS5C-.js} +1 -1
  40. package/dist/web/client/assets/use-resource-qjIkNQDY.js +1 -0
  41. package/dist/web/client/assets/{welcome-g8wtn_or.js → welcome-CkmanVa_.js} +1 -1
  42. package/dist/web/server/assets/{AddProviderDialog-DtkjBMv4.js → AddProviderDialog-CpLDHOcA.js} +4 -4
  43. package/dist/web/server/assets/{AgentTemplateParts-CxWyovvM.js → AgentTemplateParts-Dh9F_-T_.js} +5 -5
  44. package/dist/web/server/assets/{ConfigPage-usZi48Zr.js → ConfigPage-CrxctbtN.js} +2 -2
  45. package/dist/web/server/assets/{ConfirmDialog-DAcSBHkT.js → ConfirmDialog-C89B8qKM.js} +1 -1
  46. package/dist/web/server/assets/{ConnectionsView-Dy6uYSRI.js → ConnectionsView-DslcKQmA.js} +5 -5
  47. package/dist/web/server/assets/{Dialog-DTeF-nOZ.js → Dialog-_Gt_Nt86.js} +2 -2
  48. package/dist/web/server/assets/{ManagePage-Dy1EdovO.js → ManagePage-DGYNJ6XG.js} +2 -2
  49. package/dist/web/server/assets/{ModelMenu-D-hTgYOO.js → ModelMenu-DEJoYASj.js} +13 -1
  50. package/dist/web/server/assets/{SectionTabs-BVrMn76H.js → SectionTabs--vMBvaUz.js} +7 -1
  51. package/dist/web/server/assets/{SkillsParts-Cw05b3al.js → SkillsParts-CqS2B45v.js} +5 -5
  52. package/dist/web/server/assets/{SpawnDialog-BAE8W91z.js → SpawnDialog-BNKj2Lup.js} +10 -8
  53. package/dist/web/server/assets/{SpawnTeamModal-CgBY0HuN.js → SpawnTeamModal-zcLxtFOO.js} +4 -4
  54. package/dist/web/server/assets/{TeamForm-JyO5xJXX.js → TeamForm-XFP0l2TB.js} +9 -7
  55. package/dist/web/server/assets/{TeamThread-5o48EbXL.js → TeamThread-gYV_ToRM.js} +8 -9
  56. package/dist/web/server/assets/{UnsavedChangesGuard-CJQGu45L.js → UnsavedChangesGuard-CB_TugFF.js} +1 -1
  57. package/dist/web/server/assets/{_id-BNvm89oJ.js → _id-517adSuB.js} +1 -1
  58. package/dist/web/server/assets/{_id-BpumuCYL.js → _id-BTyd2i5U.js} +1 -1
  59. package/dist/web/server/assets/{_id-BE_RSvuN.js → _id-BsQnL9LV.js} +9 -9
  60. package/dist/web/server/assets/{_id-BfjTS4JO.js → _id-CyinHJam.js} +11 -11
  61. package/dist/web/server/assets/{_id-BW6sVrvw.js → _id-D4RFNqaJ.js} +2 -2
  62. package/dist/web/server/assets/{_id-C54t_nX6.js → _id-josYXBx3.js} +1 -1
  63. package/dist/web/server/assets/{_tanstack-start-manifest_v-BPwQX_5b.js → _tanstack-start-manifest_v-DIMayzEa.js} +78 -78
  64. package/dist/web/server/assets/{access-BhAMfi7U.js → access-B97-94Wt.js} +1 -1
  65. package/dist/web/server/assets/{access-DEyq3uP_.js → access-BdQmjMJV.js} +1 -1
  66. package/dist/web/server/assets/{access-6FWih7nC.js → access-Cc7fMMod.js} +5 -5
  67. package/dist/web/server/assets/{agents-ncyhVx-T.js → agents-BL918wVc.js} +1 -1
  68. package/dist/web/server/assets/{agents-BXuglv4G.js → agents-BlUZqqJn.js} +10 -10
  69. package/dist/web/server/assets/{agents-3hBjrd8B.js → agents-BzJFjA2i.js} +2 -2
  70. package/dist/web/server/assets/{agents-KJcDMj0Y.js → agents-CjrkaEz8.js} +9 -9
  71. package/dist/web/server/assets/{agents-rTDlRZa5.js → agents-Tg3zkmQv.js} +2 -2
  72. package/dist/web/server/assets/{agents-DhenbitX.js → agents-uw32jPWx.js} +1 -1
  73. package/dist/web/server/assets/{attention-X0U6ZmiA.js → attention-2unmuO-q.js} +1 -1
  74. package/dist/web/server/assets/{attention-CDdOCOio.js → attention-C94WWwQe.js} +1 -1
  75. package/dist/web/server/assets/{attention-DM__BzWY.js → attention-a_OmC6L3.js} +6 -6
  76. package/dist/web/server/assets/{auth-BexhV8Yq.js → auth-DuIqEAed.js} +1 -1
  77. package/dist/web/server/assets/{config-Cld8Q8N7.js → config-BG1KOtwA.js} +1 -1
  78. package/dist/web/server/assets/{config-DpgYAXQ3.js → config-Bhem9XER.js} +8 -8
  79. package/dist/web/server/assets/{config-Cx5ri2DL2.js → config-D1Li_7Yt2.js} +1 -1
  80. package/dist/web/server/assets/{daemon-client-RxAllljf.js → daemon-client-D-NWKQto.js} +1 -1
  81. package/dist/web/server/assets/{form-BEjeiSy3.js → form-Bwsyt9OY.js} +2 -2
  82. package/dist/web/server/assets/{manage-C6ucNYZW.js → manage-C7ReF2ZZ.js} +1 -1
  83. package/dist/web/server/assets/{mcp-DwCzj7eO.js → mcp-BFixpBQk.js} +1 -1
  84. package/dist/web/server/assets/{mcp-BXnWQOwM.js → mcp-BTZkDvdc.js} +5 -5
  85. package/dist/web/server/assets/{mcp-C8VLspco.js → mcp-Ceg9gzKE.js} +1 -1
  86. package/dist/web/server/assets/{open-groups-BMGYUTtY.js → open-groups-C89TEK85.js} +1 -1
  87. package/dist/web/server/assets/{parts-k9M-atPa.js → parts-B0wbj_yK.js} +1 -1
  88. package/dist/web/server/assets/{router-BttfLktO.js → router-DizFxqh-.js} +141 -51
  89. package/dist/web/server/assets/{routes-A7UcreVX.js → routes-CVrH9qgo.js} +1 -1
  90. package/dist/web/server/assets/{routes-B9jw-MJ8.js → routes-D9Mw1_VV.js} +297 -101
  91. package/dist/web/server/assets/{routes-BX2FV8rS.js → routes-DsuaDPTO.js} +2 -2
  92. package/dist/web/server/assets/{skills-Cd5Cfdaz.js → skills-BNbZ75am.js} +1 -1
  93. package/dist/web/server/assets/{skills-y3GsyKce.js → skills-BWwEFc4a.js} +1 -1
  94. package/dist/web/server/assets/{skills-BVAH93cd.js → skills-D5rnOmKJ.js} +7 -7
  95. package/dist/web/server/assets/{src-vrZVrV9u.js → src-BeMh8Fze.js} +11 -1
  96. package/dist/web/server/assets/{start-Dl8gQ-95.js → start-2MvkBRdC.js} +1 -1
  97. package/dist/web/server/assets/{style-BQ3H9I7Y.js → style-B3l0Wtlf.js} +1 -1
  98. package/dist/web/server/assets/{system-BJPKqM6b.js → system-Cr4C-YRw.js} +1 -1
  99. package/dist/web/server/assets/{system-C7mejQSc.js → system-DT7AU0e6.js} +3 -3
  100. package/dist/web/server/assets/{system-LsLcuVzY.js → system-DsmXkgqn.js} +1 -1
  101. package/dist/web/server/assets/{teams-CiX8LUQo.js → teams-BeStcDvQ.js} +1 -1
  102. package/dist/web/server/assets/{teams-B6gbflsZ.js → teams-CsEBLW8-.js} +11 -9
  103. package/dist/web/server/assets/{teams-D-XdIkCr.js → teams-Dix5XVIx.js} +1 -1
  104. package/dist/web/server/assets/{teams-C7kXMNgc.js → teams-DjE0swAZ.js} +8 -8
  105. package/dist/web/server/assets/{teams-CeLLd2Mf.js → teams-Rk_RED7X.js} +1 -1
  106. package/dist/web/server/assets/{teams-CPXoTggb.js → teams-u6m6JzuU.js} +1 -1
  107. package/dist/web/server/assets/{telegram-D8_V7_sW.js → telegram-BjqABrl-.js} +7 -7
  108. package/dist/web/server/assets/{telegram-D7TW3LNZ.js → telegram-CQpF3EHA.js} +1 -1
  109. package/dist/web/server/assets/{telegram-DA2dwLID.js → telegram-DhzHgDfg.js} +1 -1
  110. package/dist/web/server/assets/{tools-D1BBVkRh.js → tools-DC69leH7.js} +1 -1
  111. package/dist/web/server/assets/{tools-CluiJywK.js → tools-Dn6RnOFu.js} +1 -1
  112. package/dist/web/server/assets/{tools-CckcG9Jl.js → tools-x_DQTQtE.js} +5 -5
  113. package/dist/web/server/assets/{usage-PNNb3pPj.js → usage-4zMG0sab.js} +4 -4
  114. package/dist/web/server/assets/{usage-CrYyvPgf.js → usage-mvQegG4l.js} +1 -1
  115. package/dist/web/server/assets/{use-resource-BUA9qGGY.js → use-resource-BjN1uJoL.js} +9 -1
  116. package/dist/web/server/assets/{welcome-CwzLt6Rp.js → welcome-BuE9FRf4.js} +1 -1
  117. package/dist/web/server/assets/{welcome-CUTYf8UG.js → welcome-DYw35wl5.js} +1 -1
  118. package/dist/web/server/assets/{welcome-CYhh3iUU.js → welcome-DrYbWGd_.js} +5 -5
  119. package/dist/web/server/server.js +20 -20
  120. package/dist/worker.js +116 -12
  121. package/dist/worker.js.map +1 -1
  122. package/package.json +1 -1
  123. package/dist/web/client/assets/AddProviderDialog-DZ9mXFdq.js +0 -1
  124. package/dist/web/client/assets/AgentTemplateParts-BfG3a-ri.js +0 -1
  125. package/dist/web/client/assets/ConfirmDialog-B_jXAPmh.js +0 -1
  126. package/dist/web/client/assets/ConnectionsView-D1Liebtf.js +0 -1
  127. package/dist/web/client/assets/SectionTabs-Dc0bNn-J.js +0 -1
  128. package/dist/web/client/assets/SkillsParts-C5T7sYDA.js +0 -1
  129. package/dist/web/client/assets/SpawnTeamModal-DatFF4f_.js +0 -1
  130. package/dist/web/client/assets/TeamForm-l-N_PYeE.js +0 -1
  131. package/dist/web/client/assets/TeamThread-BWmIQiAh.js +0 -1
  132. package/dist/web/client/assets/agents-BtETzVIY.js +0 -1
  133. package/dist/web/client/assets/config-B2ZDYo52.js +0 -1
  134. package/dist/web/client/assets/index-B-N6NIX4.js +0 -14
  135. package/dist/web/client/assets/routes-DOoeKVwr.js +0 -85
  136. package/dist/web/client/assets/style-Bm9QsFpy.js +0 -7
  137. package/dist/web/client/assets/styles-B-kTTvCo.css +0 -2
  138. package/dist/web/client/assets/teams-7FEpSZg1.js +0 -1
  139. package/dist/web/client/assets/teams-ClirFbDV.js +0 -1
  140. package/dist/web/client/assets/telegram-BJnT5THs.js +0 -1
  141. package/dist/web/client/assets/use-resource-Bn0Sx7r6.js +0 -1
@@ -1,27 +1,27 @@
1
1
  import { a as apiFetch, i as api, n as useLive, o as errorMessage, r as ApiError } from "./live-DbJeq6KP.js";
2
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";
3
+ import { c as DEFAULT_TEAM_ID, i as isTextPreview, r as usageSummary, s as DEFAULT_PROFILE_ID, u as REASONING_LEVELS } from "./src-BeMh8Fze.js";
4
+ import { n as useMediaQuery, r as useResource, t as useHydrated } from "./use-resource-BjN1uJoL.js";
5
5
  import { t as AgentAvatar } from "./AgentAvatar-8gTAy_tP.js";
6
6
  import { t as Button } from "./Button-Dsnw22OF.js";
7
- import { l as modelName, n as ModelMenu, p as cn, t as MODELS_PATH } from "./ModelMenu-D-hTgYOO.js";
8
- import { n as DialogActions, t as Dialog$1 } from "./Dialog-DTeF-nOZ.js";
9
- import { t as ConfirmDialog } from "./ConfirmDialog-DAcSBHkT.js";
7
+ import { l as modelName, m as revealInStrip, n as ModelMenu, p as cn, t as MODELS_PATH } from "./ModelMenu-DEJoYASj.js";
8
+ import { i as restoreDialogFocus, n as DialogActions, r as getDialogFocusRestoreTarget, t as Dialog$1 } from "./Dialog-_Gt_Nt86.js";
9
+ import { t as ConfirmDialog } from "./ConfirmDialog-C89B8qKM.js";
10
10
  import { t as Segmented } from "./Segmented-3ZLdqa5U.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";
11
+ import { t as UnsavedChangesGuard } from "./UnsavedChangesGuard-CB_TugFF.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-gYV_ToRM.js";
13
13
  import { a as isAgentSection, i as PANEL_TABS, l as writePanelCookie, o as isTeamSection, r as PANEL_LABELS } from "./workspace-0XPILV1W.js";
14
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";
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-B0wbj_yK.js";
16
+ import { a as neighbour, i as isTyping, n as NEW_CONVERSATION_EVENT, t as Route } from "./routes-CVrH9qgo.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-Bwsyt9OY.js";
18
+ import { t as SpawnDialog } from "./SpawnDialog-BNKj2Lup.js";
19
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";
20
+ import { S as slugify, _ as skillState, x as slugProblem } from "./manage-C7ReF2ZZ.js";
21
+ import { t as SpawnTeamModal } from "./SpawnTeamModal-zcLxtFOO.js";
22
+ import { t as TeamForm } from "./TeamForm-XFP0l2TB.js";
23
+ import { n as isGroupOpen, r as writeOpenGroupsCookie } from "./open-groups-C89TEK85.js";
24
+ import { n as FindingsNotice, t as FindingLines } from "./SkillsParts-CqS2B45v.js";
25
25
  import { Fragment, Suspense, createContext, lazy, useCallback, useContext, useEffect, useId, useLayoutEffect, useMemo, useRef, useState, useSyncExternalStore } from "react";
26
26
  import { Link, useNavigate, useRouter } from "@tanstack/react-router";
27
27
  import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
@@ -596,11 +596,16 @@ function useReviewList(teamId, base) {
596
596
  const { turnsEnded } = useActivity();
597
597
  return useResource(async (signal) => {
598
598
  try {
599
+ const review = await api(reviewPath(teamId, {
600
+ authors: "1",
601
+ ...base ? { base } : {}
602
+ }), { signal });
603
+ if ("unavailable" in review) return {
604
+ review: null,
605
+ unavailable: review.unavailable
606
+ };
599
607
  return {
600
- review: await api(reviewPath(teamId, {
601
- authors: "1",
602
- ...base ? { base } : {}
603
- }), { signal }),
608
+ review,
604
609
  unavailable: null
605
610
  };
606
611
  } catch (cause) {
@@ -613,21 +618,19 @@ function useReviewList(teamId, base) {
613
618
  }
614
619
  };
615
620
  }
616
- }, [
617
- teamId,
618
- base,
619
- turnsEnded
620
- ]);
621
+ }, [teamId, base], { refreshOn: turnsEnded });
621
622
  }
622
623
  /** One file's diff; `path` null loads nothing. */
623
624
  function useFileDiff(teamId, base, path, revision) {
624
625
  return useResource(async (signal) => {
625
626
  if (!path) return null;
626
- const change = (await api(reviewPath(teamId, {
627
+ const response = await api(reviewPath(teamId, {
627
628
  patches: "1",
628
629
  path,
629
630
  ...base ? { base } : {}
630
- }), { signal })).changes.changes.find((entry) => entry.path === path);
631
+ }), { signal });
632
+ if ("unavailable" in response) throw new Error(response.unavailable.message);
633
+ const change = response.changes.changes.find((entry) => entry.path === path);
631
634
  return {
632
635
  path,
633
636
  patch: change?.patch ?? null,
@@ -637,9 +640,8 @@ function useFileDiff(teamId, base, path, revision) {
637
640
  }, [
638
641
  teamId,
639
642
  base,
640
- path,
641
- revision
642
- ]);
643
+ path
644
+ ], { refreshOn: revision });
643
645
  }
644
646
  var STATUS_LETTER = {
645
647
  added: "A",
@@ -996,12 +998,12 @@ function useTeamCounts(teamId) {
996
998
  files: null
997
999
  };
998
1000
  const team = encodeURIComponent(teamId);
999
- const [changes, files] = await Promise.all([api(`/api/teams/${team}/review`, { signal }).then((review) => review.changes.changes.length).catch(() => null), api(`/api/results?teamId=${team}&limit=1`, { signal }).then((list) => list.total).catch(() => null)]);
1001
+ const [changes, files] = await Promise.all([api(`/api/teams/${team}/review`, { signal }).then((review) => "unavailable" in review ? null : review.changes.changes.length).catch(() => null), api(`/api/results?teamId=${team}&limit=1`, { signal }).then((list) => list.total).catch(() => null)]);
1000
1002
  return {
1001
1003
  changes,
1002
1004
  files
1003
1005
  };
1004
- }, [teamId, turnsEnded]).data ?? {
1006
+ }, [teamId], { refreshOn: turnsEnded }).data ?? {
1005
1007
  changes: null,
1006
1008
  files: null
1007
1009
  };
@@ -1235,11 +1237,7 @@ function AgentPanel({ agent: resolved }) {
1235
1237
  proposals: proposals.proposals.filter((proposal) => proposal.status === "pending").length,
1236
1238
  unread: unread.messages.length
1237
1239
  };
1238
- }, [
1239
- base,
1240
- activity.turnsEnded,
1241
- search.section
1242
- ]);
1240
+ }, [base, search.section], { refreshOn: activity.turnsEnded });
1243
1241
  const telegram = useResource((signal) => api("/api/config/telegram", { signal }).catch(() => ({ configured: false })), []);
1244
1242
  async function restore() {
1245
1243
  setError(null);
@@ -1530,11 +1528,7 @@ function MoveTeam({ agentId, teamId: currentTeamId, teams }) {
1530
1528
  function ConnectionsPanel({ team }) {
1531
1529
  const { to, search, agentById } = useWorkspace();
1532
1530
  const { turnsEnded } = useActivity();
1533
- const policy = useResource((signal) => api(`/api/teams/${encodeURIComponent(team.id)}/policy`, { signal }), [
1534
- team.id,
1535
- turnsEnded,
1536
- search.view
1537
- ]);
1531
+ const policy = useResource((signal) => api(`/api/teams/${encodeURIComponent(team.id)}/policy`, { signal }), [team.id, search.view], { refreshOn: turnsEnded });
1538
1532
  const messages = useTeamMessages(team.id);
1539
1533
  if (policy.error) return /* @__PURE__ */ jsx("p", {
1540
1534
  role: "alert",
@@ -2014,11 +2008,7 @@ function useResults(teamId, filter, pageSize = 24) {
2014
2008
  results,
2015
2009
  total
2016
2010
  };
2017
- }, [
2018
- key,
2019
- wanted,
2020
- turnsEnded
2021
- ]);
2011
+ }, [key, wanted], { refreshOn: turnsEnded });
2022
2012
  const results = pages.data?.results ?? [];
2023
2013
  const total = pages.data?.total ?? 0;
2024
2014
  return {
@@ -2205,11 +2195,7 @@ var SMALL_ACTION = "inline-flex h-7 items-center gap-1 rounded-[10px] border bor
2205
2195
  function TeamPanel({ team }) {
2206
2196
  const { agents, profiles, teams, teamTemplates, agent: open, to, search } = useWorkspace();
2207
2197
  const { turnsEnded } = useActivity();
2208
- const fresh = useResource((signal) => api(`/api/teams/${encodeURIComponent(team.id)}`, { signal }), [
2209
- team.id,
2210
- turnsEnded,
2211
- search.section
2212
- ]);
2198
+ const fresh = useResource((signal) => api(`/api/teams/${encodeURIComponent(team.id)}`, { signal }), [team.id, search.section], { refreshOn: turnsEnded });
2213
2199
  const userMd = fresh.data?.id === team.id ? fresh.data.userMd : team.userMd;
2214
2200
  const activity = useActivity();
2215
2201
  const router = useRouter();
@@ -2255,7 +2241,7 @@ function TeamPanel({ team }) {
2255
2241
  children: [/* @__PURE__ */ jsx(Plus, {
2256
2242
  className: "size-3.5",
2257
2243
  "aria-hidden": "true"
2258
- }), "Add agent"]
2244
+ }), "Add an Agent"]
2259
2245
  })]
2260
2246
  }), members.length === 0 ? /* @__PURE__ */ jsxs("div", {
2261
2247
  className: "rounded-2xl border border-dashed border-border bg-muted/40 px-3 py-4 text-sm text-muted-foreground",
@@ -2430,11 +2416,7 @@ function MemoryGlance({ team }) {
2430
2416
  rows: [...entries].sort((a, b) => b.updatedAt - a.updatedAt).slice(0, 5).map((entry) => noteRow$1(entry.key, entry.content)),
2431
2417
  total: entries.length
2432
2418
  };
2433
- }, [
2434
- base,
2435
- debounced,
2436
- turnsEnded
2437
- ]);
2419
+ }, [base, debounced], { refreshOn: turnsEnded });
2438
2420
  const total = notes.data?.total;
2439
2421
  return /* @__PURE__ */ jsxs(Fragment$1, { children: [
2440
2422
  /* @__PURE__ */ jsxs("div", {
@@ -2498,6 +2480,8 @@ function MemoryGlance({ team }) {
2498
2480
  function SidePanel({ tab }) {
2499
2481
  const { agent, team, to } = useWorkspace();
2500
2482
  const counts = useTeamCounts(team?.id);
2483
+ const strip = useRef(null);
2484
+ useEffect(() => revealInStrip(strip.current, "[aria-selected=\"true\"]"), [tab]);
2501
2485
  const count = {
2502
2486
  changes: counts.changes,
2503
2487
  files: counts.files
@@ -2508,6 +2492,7 @@ function SidePanel({ tab }) {
2508
2492
  children: [/* @__PURE__ */ jsxs("div", {
2509
2493
  className: "flex items-center gap-1 border-b border-border bg-muted/60 p-2",
2510
2494
  children: [/* @__PURE__ */ jsx("div", {
2495
+ ref: strip,
2511
2496
  role: "tablist",
2512
2497
  "aria-label": "Side panel",
2513
2498
  className: "flex min-w-0 flex-1 items-center gap-1 overflow-x-auto [scrollbar-width:none]",
@@ -2990,10 +2975,102 @@ function useFindInTranscript(container, find, nth, done) {
2990
2975
  }, [find, nth]);
2991
2976
  }
2992
2977
  //#endregion
2978
+ //#region src/lib/transcript-scroll.ts
2979
+ var MESSAGE = "[data-message]";
2980
+ /** Enough for every conversation one sitting opens; the oldest place is dropped past it. */
2981
+ var KEEP = 200;
2982
+ var places = /* @__PURE__ */ new Map();
2983
+ function placeKey(agentId, conversationId) {
2984
+ return `${agentId}:${conversationId ?? ""}`;
2985
+ }
2986
+ function isAtEnd(log) {
2987
+ return log.scrollHeight - log.scrollTop - log.clientHeight < 40;
2988
+ }
2989
+ /** Where the reader is in `log`. */
2990
+ function readPlace(log) {
2991
+ if (isAtEnd(log)) return { atEnd: true };
2992
+ const top = log.getBoundingClientRect().top;
2993
+ const messages = log.querySelectorAll(MESSAGE);
2994
+ for (let index = 0; index < messages.length; index++) {
2995
+ const box = messages[index]?.getBoundingClientRect();
2996
+ if (box && box.bottom > top) return {
2997
+ atEnd: false,
2998
+ index,
2999
+ offset: box.top - top
3000
+ };
3001
+ }
3002
+ return { atEnd: true };
3003
+ }
3004
+ /** Put `log` back at `place`; false when the message it names is not there. */
3005
+ function applyPlace(log, place) {
3006
+ if (place.atEnd) {
3007
+ log.scrollTop = log.scrollHeight;
3008
+ return true;
3009
+ }
3010
+ const message = log.querySelectorAll(MESSAGE)[place.index];
3011
+ if (!message) return false;
3012
+ const top = log.getBoundingClientRect().top;
3013
+ log.scrollTop += message.getBoundingClientRect().top - top - place.offset;
3014
+ return true;
3015
+ }
3016
+ function rememberPlace(key, place) {
3017
+ places.delete(key);
3018
+ places.set(key, place);
3019
+ if (places.size > KEEP) {
3020
+ const oldest = places.keys().next().value;
3021
+ if (oldest !== void 0) places.delete(oldest);
3022
+ }
3023
+ }
3024
+ function rememberedPlace(key) {
3025
+ return places.get(key);
3026
+ }
3027
+ /**
3028
+ * Remember where the reader is in `log`, under `key()` as it is when they scroll, and put them
3029
+ * back there once `ready` (the messages are on screen), unless `skip` (a search result opens the
3030
+ * conversation at its message instead). `onRestored` hears of a place put back that is not the
3031
+ * end, so the caller stops following new output. Call it before the effect that follows the end.
3032
+ */
3033
+ function useTranscriptPlace(log, key, { ready, skip, onRestored }) {
3034
+ const keyRef = useRef(key);
3035
+ keyRef.current = key;
3036
+ const restored = useRef(false);
3037
+ useLayoutEffect(() => {
3038
+ const element = log.current;
3039
+ if (restored.current || !ready || !element) return;
3040
+ restored.current = true;
3041
+ if (skip) return;
3042
+ const place = rememberedPlace(keyRef.current());
3043
+ if (place && applyPlace(element, place) && !place.atEnd) onRestored?.();
3044
+ });
3045
+ const pending = useRef(0);
3046
+ const saveNow = useRef(() => {});
3047
+ useEffect(() => {
3048
+ const element = log.current;
3049
+ if (!element) return;
3050
+ saveNow.current = () => {
3051
+ pending.current = 0;
3052
+ if (element.isConnected) rememberPlace(keyRef.current(), readPlace(element));
3053
+ };
3054
+ const onScroll = () => {
3055
+ if (!restored.current) return;
3056
+ pending.current ||= window.requestAnimationFrame(() => saveNow.current());
3057
+ };
3058
+ element.addEventListener("scroll", onScroll, { passive: true });
3059
+ return () => element.removeEventListener("scroll", onScroll);
3060
+ }, []);
3061
+ useLayoutEffect(() => () => {
3062
+ if (!pending.current) return;
3063
+ window.cancelAnimationFrame(pending.current);
3064
+ saveNow.current();
3065
+ }, []);
3066
+ }
3067
+ //#endregion
2993
3068
  //#region src/components/chat/AgentQuestions.tsx
2994
3069
  /**
2995
3070
  * Questions the Agent is waiting on. The chat reloads them when it opens, when a turn starts or
2996
- * ends and when its stream carries a new question (`refreshKey` changes).
3071
+ * ends and when its stream carries a new question (`refreshKey` changes); the live feed's count
3072
+ * of the Agent's questions reloads them too, so a question asked or answered elsewhere (a turn
3073
+ * started from the terminal, an answer given there or in Telegram, a timeout) shows here at once.
2997
3074
  */
2998
3075
  function AgentQuestions({ agentId, agentName, refreshKey }) {
2999
3076
  const [items, setItems] = useState([]);
@@ -3001,7 +3078,11 @@ function AgentQuestions({ agentId, agentName, refreshKey }) {
3001
3078
  const controller = new AbortController();
3002
3079
  api(`/api/agents/${encodeURIComponent(agentId)}/questions`, { signal: controller.signal }).then((body) => setItems(body.questions)).catch(() => {});
3003
3080
  return () => controller.abort();
3004
- }, [agentId, refreshKey]);
3081
+ }, [
3082
+ agentId,
3083
+ refreshKey,
3084
+ useActivityOptional()?.byAgent.get(agentId)?.questions ?? 0
3085
+ ]);
3005
3086
  if (!items.length) return null;
3006
3087
  return /* @__PURE__ */ jsx("section", {
3007
3088
  "aria-label": "Agent questions",
@@ -3210,6 +3291,13 @@ function projectMessages(messages) {
3210
3291
  name: call.name,
3211
3292
  body: call.arguments
3212
3293
  });
3294
+ if (message.stopped) {
3295
+ openTool = null;
3296
+ entries.push({
3297
+ type: "stopped",
3298
+ reason: message.stopped
3299
+ });
3300
+ }
3213
3301
  } else if (message.role === "tool") {
3214
3302
  toolBox().items.push({
3215
3303
  kind: /^error:/i.test(message.content) ? "error" : "result",
@@ -3392,10 +3480,15 @@ function applyEvent(entries, event) {
3392
3480
  type: "result",
3393
3481
  resultId: event.result.resultId
3394
3482
  }];
3395
- case "error": return [...entries, {
3396
- type: "error",
3397
- content: `[error] ${event.error}`
3398
- }];
3483
+ case "error":
3484
+ if (event.error === "cancelled") return [...entries, {
3485
+ type: "stopped",
3486
+ reason: "cancelled"
3487
+ }];
3488
+ return [...entries, {
3489
+ type: "error",
3490
+ content: `[error] ${event.error}`
3491
+ }];
3399
3492
  default: return entries;
3400
3493
  }
3401
3494
  }
@@ -3458,15 +3551,15 @@ function Composer({ agentName, value, onChange, onSubmit, attachments, onAddFile
3458
3551
  if (!element) return;
3459
3552
  element.style.height = "auto";
3460
3553
  element.style.height = `${Math.min(element.scrollHeight, MAX_INPUT_HEIGHT)}px`;
3461
- }, [value]);
3554
+ }, [value, agentName]);
3462
3555
  return /* @__PURE__ */ jsxs(Fragment$1, { children: [
3463
3556
  editing && /* @__PURE__ */ jsxs("div", {
3464
3557
  className: "flex items-center gap-2 border-t border-frost bg-sapphire-glow px-5 py-2 text-[0.85em] text-sapphire-deep",
3465
- children: [/* @__PURE__ */ jsx("span", { children: "editing last message — submit to replace, or" }), /* @__PURE__ */ jsx("button", {
3558
+ children: [/* @__PURE__ */ jsx("span", { children: "Editing your last message: send to replace it." }), /* @__PURE__ */ jsx("button", {
3466
3559
  type: "button",
3467
3560
  onClick: onCancelEdit,
3468
3561
  className: "ml-auto rounded-sm border border-sapphire-light bg-transparent px-2 py-0.5 text-[0.92em] text-sapphire-deep hover:bg-snow",
3469
- children: "cancel"
3562
+ children: "Cancel"
3470
3563
  })]
3471
3564
  }),
3472
3565
  attachments.length > 0 && /* @__PURE__ */ jsx("div", {
@@ -3585,7 +3678,7 @@ function Composer({ agentName, value, onChange, onSubmit, attachments, onAddFile
3585
3678
  //#endregion
3586
3679
  //#region src/components/chat/FollowUps.tsx
3587
3680
  /** Follow-ups waiting for the Agent's current turn. Hidden while there are none. */
3588
- function FollowUps({ agentId, queue, onChanged, onViewConversation }) {
3681
+ function FollowUps({ agentId, queue, onChanged, onViewConversation, conversationId }) {
3589
3682
  const [editing, setEditing] = useState(null);
3590
3683
  const [busy, setBusy] = useState(false);
3591
3684
  const [error, setError] = useState("");
@@ -3637,11 +3730,11 @@ function FollowUps({ agentId, queue, onChanged, onViewConversation }) {
3637
3730
  className: "text-xs text-mocha",
3638
3731
  children: item.source === "telegram" ? "Telegram" : "Web / API"
3639
3732
  }),
3640
- /* @__PURE__ */ jsx(Button, {
3733
+ item.conversationId !== conversationId && /* @__PURE__ */ jsx(Button, {
3641
3734
  variant: "ghost",
3642
3735
  className: "ml-auto",
3643
3736
  onClick: () => onViewConversation(item.conversationId),
3644
- children: "View conversation"
3737
+ children: "View its conversation"
3645
3738
  })
3646
3739
  ]
3647
3740
  }),
@@ -4294,6 +4387,10 @@ function Bubble({ entry, markdownReady, onEdit, dropped = false, approvals }) {
4294
4387
  children: entry.content
4295
4388
  })]
4296
4389
  });
4390
+ case "stopped": return /* @__PURE__ */ jsx("p", {
4391
+ className: "my-2 px-1 text-[0.85em] italic text-muted-foreground",
4392
+ children: entry.reason === "cancelled" ? "Stopped." : "This reply failed."
4393
+ });
4297
4394
  case "error": return /* @__PURE__ */ jsx("div", {
4298
4395
  className: "my-3 rounded-r-sm border-l-[3px] border-danger bg-danger/10 px-3 py-1 text-[0.92em] text-danger",
4299
4396
  children: entry.content
@@ -4906,12 +5003,15 @@ function useChatSession({ agentId, initialMessages, initialSessionHead, onOpenLi
4906
5003
  cancelEdit: () => setEditing(false),
4907
5004
  refreshHistory: sync.refreshHistory,
4908
5005
  refreshQueue: sync.refreshQueue,
4909
- dismissStale: sync.dismissStale
5006
+ dismissStale: sync.dismissStale,
5007
+ /** The conversation on screen; null before the Agent's first turn. */
5008
+ conversationId: sync.knownConversationId
4910
5009
  };
4911
5010
  }
4912
5011
  //#endregion
4913
5012
  //#region src/components/chat/ChatPane.tsx
4914
- var AUTOSCROLL_THRESHOLD_PX = 40;
5013
+ /** Unsent text per Agent, kept while the page is open. */
5014
+ var drafts = /* @__PURE__ */ new Map();
4915
5015
  var CHAT_FRAME = "relative flex h-full flex-col overflow-hidden rounded-[16px] border border-frost bg-snow shadow-baziu-sm";
4916
5016
  /** One pane per Agent: switching Agents starts a fresh one. */
4917
5017
  function ChatPane(props) {
@@ -4928,7 +5028,19 @@ function AgentChat({ agentId, agentName, initialMessages, initialSessionHead, he
4928
5028
  onOpenLibrary: () => setConversationsOpen(true),
4929
5029
  onConversation: onConversationChange
4930
5030
  });
4931
- const [input, setInput] = useState("");
5031
+ const [input, setInputState] = useState(() => drafts.get(agentId) ?? "");
5032
+ const beforeEdit = useRef("");
5033
+ const editingRef = useRef(false);
5034
+ useEffect(() => {
5035
+ if (!chat.editing) editingRef.current = false;
5036
+ }, [chat.editing]);
5037
+ const setInput = (next) => setInputState((current) => {
5038
+ const value = typeof next === "function" ? next(current) : next;
5039
+ const kept = editingRef.current ? beforeEdit.current : value;
5040
+ if (kept) drafts.set(agentId, kept);
5041
+ else drafts.delete(agentId);
5042
+ return value;
5043
+ });
4932
5044
  const [attachments, setAttachments] = useState([]);
4933
5045
  const [dragging, setDragging] = useState(false);
4934
5046
  const inputRef = useRef(null);
@@ -4947,6 +5059,13 @@ function AgentChat({ agentId, agentName, initialMessages, initialSessionHead, he
4947
5059
  replace: true
4948
5060
  });
4949
5061
  });
5062
+ useTranscriptPlace(logRef, () => placeKey(agentId, chat.conversationId()), {
5063
+ ready: true,
5064
+ skip: Boolean(workspace?.search.find),
5065
+ onRestored: () => {
5066
+ nearBottomRef.current = false;
5067
+ }
5068
+ });
4950
5069
  useLayoutEffect(() => {
4951
5070
  const log = logRef.current;
4952
5071
  if (log && nearBottomRef.current) log.scrollTop = log.scrollHeight;
@@ -4961,18 +5080,23 @@ function AgentChat({ agentId, agentName, initialMessages, initialSessionHead, he
4961
5080
  attachments
4962
5081
  };
4963
5082
  if (!draft.text.trim() && draft.attachments.length === 0) return;
4964
- setInput("");
5083
+ const earlier = editingRef.current ? beforeEdit.current : "";
5084
+ editingRef.current = false;
5085
+ beforeEdit.current = "";
5086
+ setInput(earlier);
4965
5087
  setAttachments([]);
4966
5088
  const restore = await chat.send(draft);
4967
5089
  activity?.refresh();
4968
5090
  if (restore) {
4969
- setInput((current) => current || restore.text);
5091
+ setInput((current) => current && current !== earlier ? current : restore.text);
4970
5092
  setAttachments((current) => current.length > 0 ? current : restore.attachments);
4971
5093
  }
4972
5094
  }
4973
5095
  function edit() {
4974
5096
  const text = chat.startEdit();
4975
5097
  if (text === null) return;
5098
+ beforeEdit.current = input;
5099
+ editingRef.current = true;
4976
5100
  setInput(text);
4977
5101
  inputRef.current?.focus();
4978
5102
  }
@@ -5032,7 +5156,7 @@ function AgentChat({ agentId, agentName, initialMessages, initialSessionHead, he
5032
5156
  }),
5033
5157
  /* @__PURE__ */ jsx("span", {
5034
5158
  className: "flex-1",
5035
- children: chat.recoveredTurn ? "The recovered turn has new activity." : "There is new activity from another source (a follow-up, Telegram or a schedule)."
5159
+ children: chat.recoveredTurn ? "The recovered turn has new activity." : "There is new activity from elsewhere (the terminal, a follow-up, Telegram or a schedule)."
5036
5160
  }),
5037
5161
  /* @__PURE__ */ jsx("button", {
5038
5162
  type: "button",
@@ -5052,8 +5176,7 @@ function AgentChat({ agentId, agentName, initialMessages, initialSessionHead, he
5052
5176
  /* @__PURE__ */ jsx("div", {
5053
5177
  ref: logRef,
5054
5178
  onScroll: (event) => {
5055
- const log = event.currentTarget;
5056
- nearBottomRef.current = log.scrollHeight - log.scrollTop - log.clientHeight < AUTOSCROLL_THRESHOLD_PX;
5179
+ nearBottomRef.current = isAtEnd(event.currentTarget);
5057
5180
  },
5058
5181
  role: "log",
5059
5182
  "aria-label": `Conversation with ${agentName}`,
@@ -5103,7 +5226,8 @@ function AgentChat({ agentId, agentName, initialMessages, initialSessionHead, he
5103
5226
  agentId,
5104
5227
  queue: chat.queue,
5105
5228
  onChanged: () => void chat.refreshQueue(),
5106
- onViewConversation: (id) => onViewConversation?.(id)
5229
+ onViewConversation: (id) => onViewConversation?.(id),
5230
+ conversationId: chat.conversationId()
5107
5231
  }),
5108
5232
  /* @__PURE__ */ jsx(AgentQuestions, {
5109
5233
  agentId,
@@ -5119,7 +5243,12 @@ function AgentChat({ agentId, agentName, initialMessages, initialSessionHead, he
5119
5243
  onAddFiles: (files) => void addFiles(files),
5120
5244
  onRemoveAttachment: (index) => setAttachments((current) => current.filter((_, i) => i !== index)),
5121
5245
  editing: chat.editing,
5122
- onCancelEdit: chat.cancelEdit,
5246
+ onCancelEdit: () => {
5247
+ chat.cancelEdit();
5248
+ editingRef.current = false;
5249
+ setInput(beforeEdit.current);
5250
+ beforeEdit.current = "";
5251
+ },
5123
5252
  agentBusy: chat.agentBusy,
5124
5253
  onStop: () => void chat.stop(),
5125
5254
  inputRef
@@ -5492,7 +5621,7 @@ function Preview({ result }) {
5492
5621
  }
5493
5622
  //#endregion
5494
5623
  //#region src/components/workspace/ConversationHeader.tsx
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";
5624
+ var CHIP = "inline-flex h-[26px] min-w-0 max-w-[11rem] shrink 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";
5496
5625
  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";
5497
5626
  /** The model without its provider: `lmstudio:paper-coder-32b` reads as `paper-coder-32b`. */
5498
5627
  function shortModel(model) {
@@ -5519,6 +5648,7 @@ function ConversationHeader({ agent, chat, panel, lastPanel }) {
5519
5648
  size: 32
5520
5649
  }),
5521
5650
  /* @__PURE__ */ jsx("h1", {
5651
+ title: agent.agent.name,
5522
5652
  className: "m-0 min-w-0 max-w-[14rem] shrink-0 truncate font-display text-xl leading-tight text-charcoal",
5523
5653
  children: agent.agent.name
5524
5654
  }),
@@ -5528,8 +5658,12 @@ function ConversationHeader({ agent, chat, panel, lastPanel }) {
5528
5658
  panel: "team",
5529
5659
  section: void 0
5530
5660
  }),
5531
- className: CHIP,
5532
- children: agent.team.name
5661
+ title: agent.team.name,
5662
+ className: cn(CHIP, agent.team.name.length <= 16 && "shrink-0"),
5663
+ children: /* @__PURE__ */ jsx("span", {
5664
+ className: "min-w-0 truncate",
5665
+ children: agent.team.name
5666
+ })
5533
5667
  }),
5534
5668
  /* @__PURE__ */ jsxs(Link, {
5535
5669
  to: "/",
@@ -5538,14 +5672,17 @@ function ConversationHeader({ agent, chat, panel, lastPanel }) {
5538
5672
  section: void 0
5539
5673
  }),
5540
5674
  title: `Model: ${agent.model}`,
5541
- className: cn(CHIP, "hidden font-mono font-normal sm:inline-flex"),
5542
- children: [shortModel(agent.model), /* @__PURE__ */ jsx(ChevronDown, {
5543
- className: "size-[11px]",
5675
+ className: cn(CHIP, "hidden min-w-[4.5rem] shrink-[4] font-mono font-normal sm:inline-flex"),
5676
+ children: [/* @__PURE__ */ jsx("span", {
5677
+ className: "min-w-0 truncate",
5678
+ children: shortModel(agent.model)
5679
+ }), /* @__PURE__ */ jsx(ChevronDown, {
5680
+ className: "size-[11px] shrink-0",
5544
5681
  "aria-hidden": "true"
5545
5682
  })]
5546
5683
  }),
5547
5684
  /* @__PURE__ */ jsxs("div", {
5548
- className: "ml-auto flex min-w-16 shrink items-center justify-end gap-1.5",
5685
+ className: "ml-auto flex min-w-[7.75rem] shrink-[20] items-center justify-end gap-1.5",
5549
5686
  children: [/* @__PURE__ */ jsx(ConversationMenu, {
5550
5687
  agentId: agent.agent.id,
5551
5688
  chat
@@ -5577,7 +5714,7 @@ function ConversationMenu({ agentId, chat }) {
5577
5714
  const [ownOpen, setOwnOpen] = useState(false);
5578
5715
  const [renaming, setRenaming] = useState(null);
5579
5716
  const [error, setError] = useState("");
5580
- const list = useResource((signal) => api(`${base}?limit=20`, { signal }), [base, turnsEnded]);
5717
+ const list = useResource((signal) => api(`${base}?limit=20`, { signal }), [base], { refreshOn: turnsEnded });
5581
5718
  const open = chat ? chat.conversationsOpen : ownOpen;
5582
5719
  const setOpen = chat ? chat.setConversationsOpen : setOwnOpen;
5583
5720
  const conversations = list.data?.conversations ?? [];
@@ -5862,6 +5999,10 @@ function EarlierConversation({ agentId, agentName, conversationId, header }) {
5862
5999
  throw cause;
5863
6000
  }
5864
6001
  }, [path]);
6002
+ useTranscriptPlace(logRef, () => placeKey(agentId, conversationId), {
6003
+ ready: opened.data !== void 0,
6004
+ skip: Boolean(search.find)
6005
+ });
5865
6006
  async function continueHere() {
5866
6007
  setBusy(true);
5867
6008
  setError("");
@@ -5893,7 +6034,7 @@ function EarlierConversation({ agentId, agentName, conversationId, header }) {
5893
6034
  " ",
5894
6035
  title ? /* @__PURE__ */ jsx("strong", {
5895
6036
  className: "text-foreground",
5896
- children: title
6037
+ children: title.replace(/\.+$/, "")
5897
6038
  }) : "an earlier conversation",
5898
6039
  ". New messages go to the active conversation."
5899
6040
  ]
@@ -6090,7 +6231,7 @@ function Overview() {
6090
6231
  children: [/* @__PURE__ */ jsx(Plus, {
6091
6232
  className: "size-4",
6092
6233
  "aria-hidden": "true"
6093
- }), "Add your first agent"]
6234
+ }), "Add your first Agent"]
6094
6235
  })
6095
6236
  }),
6096
6237
  files.results.length > 0 && /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx("h2", {
@@ -6512,13 +6653,13 @@ function Rail({ initialOpenGroups }) {
6512
6653
  }),
6513
6654
  /* @__PURE__ */ jsx("p", {
6514
6655
  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."
6656
+ children: "Your default Team is ready. Add the first Agent to start a conversation."
6516
6657
  }),
6517
6658
  sortedProfiles[0] ? /* @__PURE__ */ jsx(Button, {
6518
6659
  variant: "primary",
6519
6660
  className: "mt-3",
6520
6661
  onClick: () => setSpawnProfile(sortedProfiles[0]?.id ?? "default"),
6521
- children: "Spawn first agent"
6662
+ children: "Add the first Agent"
6522
6663
  }) : /* @__PURE__ */ jsx("a", {
6523
6664
  href: "/templates/agents?new=1",
6524
6665
  className: "mt-3 text-xs font-semibold",
@@ -6586,6 +6727,7 @@ function Rail({ initialOpenGroups }) {
6586
6727
  refocusNewButton();
6587
6728
  },
6588
6729
  children: /* @__PURE__ */ jsx(TeamForm, {
6730
+ taken: teams.map((team) => team.id),
6589
6731
  onBusyChange: setCreateTeamBusy,
6590
6732
  onCreated: async (team) => {
6591
6733
  setCreateTeamOpen(false);
@@ -8316,6 +8458,16 @@ function AddSchedule({ agentId, agentName, onClose, onAdded }) {
8316
8458
  });
8317
8459
  }
8318
8460
  //#endregion
8461
+ //#region src/lib/memory-key.ts
8462
+ function noteKey(typed) {
8463
+ let key = typed.trim().replace(/^(\.\/)+/, "");
8464
+ if (!key) return { error: "Give the note a name." };
8465
+ if (key.startsWith("/") || key.includes("\\")) return { error: "A name is a path inside the memory folder, such as people/sam.md." };
8466
+ if (key.split("/").some((segment) => segment === "" || segment === "." || segment === "..")) return { error: "A name cannot have empty parts, “.” or “..” in its path." };
8467
+ key = `${key.replace(/\.md$/i, "")}.md`;
8468
+ return { key };
8469
+ }
8470
+ //#endregion
8319
8471
  //#region src/components/team/TeamMemory.tsx
8320
8472
  /** A note's name in the list: its first heading, else the last part of its path. */
8321
8473
  function noteRow(key, text) {
@@ -8389,8 +8541,12 @@ function TeamMemory({ team, openKey }) {
8389
8541
  async function save(event) {
8390
8542
  event.preventDefault();
8391
8543
  if (open.mode !== "edit" && open.mode !== "new") return;
8392
- const key = open.key.trim();
8393
- if (!key) return;
8544
+ const named = open.mode === "new" ? noteKey(open.key) : { key: open.key };
8545
+ if ("error" in named) {
8546
+ setError(named.error);
8547
+ return;
8548
+ }
8549
+ const { key } = named;
8394
8550
  setBusy(true);
8395
8551
  setError(null);
8396
8552
  try {
@@ -8549,7 +8705,7 @@ function TeamMemory({ team, openKey }) {
8549
8705
  mono: true,
8550
8706
  disabled: busy,
8551
8707
  placeholder: "decisions/launch-date.md",
8552
- hint: "A path: folders group notes, such as people/sam.md.",
8708
+ hint: "A path: folders group notes, such as people/sam. It ends in .md, added when left out.",
8553
8709
  onChange: (value) => setOpen({
8554
8710
  ...current,
8555
8711
  key: value
@@ -8596,12 +8752,12 @@ function TeamMemory({ team, openKey }) {
8596
8752
  }),
8597
8753
  /* @__PURE__ */ jsx(ConfirmDialog, {
8598
8754
  open: pending !== null,
8599
- title: "Drop your unsaved edit?",
8755
+ title: "Discard your unsaved edit?",
8600
8756
  description: /* @__PURE__ */ jsx("p", {
8601
8757
  className: "m-0",
8602
8758
  children: "What you changed in this note is lost."
8603
8759
  }),
8604
- confirmLabel: "Drop the edit",
8760
+ confirmLabel: "Discard the edit",
8605
8761
  onConfirm: () => {
8606
8762
  const action = pending;
8607
8763
  setPending(null);
@@ -9234,7 +9390,7 @@ function TeamHome({ team }) {
9234
9390
  children: [/* @__PURE__ */ jsx(Plus, {
9235
9391
  className: "size-4",
9236
9392
  "aria-hidden": "true"
9237
- }), "Add an agent"]
9393
+ }), "Add an Agent"]
9238
9394
  })
9239
9395
  ]
9240
9396
  }) : /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx("ul", {
@@ -9284,7 +9440,7 @@ function TeamHome({ team }) {
9284
9440
  children: [/* @__PURE__ */ jsx(Plus, {
9285
9441
  className: "size-4",
9286
9442
  "aria-hidden": "true"
9287
- }), "Add an agent"]
9443
+ }), "Add an Agent"]
9288
9444
  })
9289
9445
  })] }),
9290
9446
  /* @__PURE__ */ jsx("div", {
@@ -9418,7 +9574,7 @@ function WaitingRow({ agent, team, text }) {
9418
9574
  //#endregion
9419
9575
  //#region src/routes/index.tsx?tsr-split=component
9420
9576
  /** The rail's open/closed Teams; a bad cookie is ignored. */
9421
- var ConnectionsView = lazy(() => import("./ConnectionsView-Dy6uYSRI.js").then((module) => ({ default: module.ConnectionsView })));
9577
+ var ConnectionsView = lazy(() => import("./ConnectionsView-DslcKQmA.js").then((module) => ({ default: module.ConnectionsView })));
9422
9578
  function WorkspacePage() {
9423
9579
  const data = Route.useLoaderData();
9424
9580
  const search = Route.useSearch();
@@ -9488,6 +9644,43 @@ function WorkspacePage() {
9488
9644
  return () => window.removeEventListener("keydown", onKey);
9489
9645
  });
9490
9646
  const asked = search.panel !== void 0 && search.panel !== "none";
9647
+ const wide = useMediaQuery("(min-width: 1280px)");
9648
+ const shownPanel = panel !== "none" && (asked || wide) ? panel : "none";
9649
+ const overlay = shownPanel !== "none" && !wide;
9650
+ const overlayBox = useRef(null);
9651
+ const overlayOpener = useRef(null);
9652
+ useLayoutEffect(() => {
9653
+ if (!overlay) return;
9654
+ overlayOpener.current = getDialogFocusRestoreTarget(document);
9655
+ overlayBox.current?.querySelector("[role=\"tab\"][aria-selected=\"true\"]")?.focus();
9656
+ return () => {
9657
+ const opener = overlayOpener.current;
9658
+ overlayOpener.current = null;
9659
+ window.requestAnimationFrame(() => restoreDialogFocus(opener, document));
9660
+ };
9661
+ }, [overlay]);
9662
+ useEffect(() => {
9663
+ if (!overlay) return;
9664
+ const onKey = (event) => {
9665
+ if (event.key !== "Escape" || event.defaultPrevented) return;
9666
+ if (document.querySelector("[role=\"dialog\"], [role=\"alertdialog\"], [role=\"menu\"]")) return;
9667
+ event.preventDefault();
9668
+ router.navigate({
9669
+ to: "/",
9670
+ search: {
9671
+ ...search,
9672
+ panel: "none",
9673
+ section: void 0
9674
+ }
9675
+ });
9676
+ };
9677
+ window.addEventListener("keydown", onKey);
9678
+ return () => window.removeEventListener("keydown", onKey);
9679
+ }, [
9680
+ overlay,
9681
+ router,
9682
+ search
9683
+ ]);
9491
9684
  const [reported, setReported] = useState(null);
9492
9685
  const loadedConversation = selected?.head.conversationId ?? null;
9493
9686
  const activeConversation = open && reported?.agentId === open.agent.id && reported.loaded === loadedConversation ? reported.id : loadedConversation;
@@ -9515,7 +9708,7 @@ function WorkspacePage() {
9515
9708
  const header = (chat) => open && /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx(ConversationHeader, {
9516
9709
  agent: open,
9517
9710
  chat,
9518
- panel,
9711
+ panel: shownPanel,
9519
9712
  lastPanel: memory.tab
9520
9713
  }), open.agent.status === "archived" && /* @__PURE__ */ jsxs("p", {
9521
9714
  className: "m-0 flex flex-wrap items-center gap-2 border-b border-frost bg-warning/[0.07] px-4 py-2 text-sm text-chocolate",
@@ -9565,6 +9758,7 @@ function WorkspacePage() {
9565
9758
  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)]"}`,
9566
9759
  children: [
9567
9760
  /* @__PURE__ */ jsxs("div", {
9761
+ inert: overlay || void 0,
9568
9762
  className: `flex min-h-0 flex-col gap-3 ${open || team ? "hidden lg:flex" : ""}`,
9569
9763
  children: [/* @__PURE__ */ jsx(WaitingStrip, { className: "lg:hidden" }), /* @__PURE__ */ jsx("div", {
9570
9764
  className: "min-h-0 flex-1",
@@ -9572,6 +9766,7 @@ function WorkspacePage() {
9572
9766
  })]
9573
9767
  }),
9574
9768
  /* @__PURE__ */ jsx("div", {
9769
+ inert: overlay || void 0,
9575
9770
  className: `min-h-0 min-w-0 ${open || team ? "" : "hidden lg:block"}`,
9576
9771
  children: open && selected ? reading ? /* @__PURE__ */ jsx(EarlierConversation, {
9577
9772
  agentId: open.agent.id,
@@ -9608,6 +9803,7 @@ function WorkspacePage() {
9608
9803
  "aria-label": "Close the side panel",
9609
9804
  className: "fixed inset-0 z-30 bg-chocolate/30 xl:hidden"
9610
9805
  }), /* @__PURE__ */ jsx("div", {
9806
+ ref: overlayBox,
9611
9807
  className: asked ? "fixed inset-y-0 right-0 z-40 w-[min(27rem,100vw)] p-2 xl:static xl:z-auto xl:min-h-0 xl:w-auto xl:min-w-0 xl:p-0" : "hidden min-h-0 min-w-0 xl:block",
9612
9808
  children: /* @__PURE__ */ jsx(SidePanel, { tab: panel })
9613
9809
  })] })