@kabmo-labs/kabmo 0.25.0 → 0.27.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 (241) hide show
  1. package/dist/client/index.html +1 -1
  2. package/dist/client/index.js +448 -444
  3. package/dist/client/static/js/index-32rpkj6b.css +1 -0
  4. package/dist/client/static/js/{index-ga8cbpt4.js → index-e3qh2yps.js} +950 -950
  5. package/package.json +1 -1
  6. package/src/client/components/common/Toast.test.tsx +28 -2
  7. package/src/client/components/common/Toast.tsx +21 -9
  8. package/src/client/components/common/session-actions-menu/index.tsx +38 -12
  9. package/src/client/components/common/session-branch/BranchGuides.tsx +93 -0
  10. package/src/client/components/common/session-branch/SubagentRow.tsx +77 -0
  11. package/src/client/components/common/session-branch/index.tsx +169 -0
  12. package/src/client/components/common/session-branch/session-branch.test.tsx +240 -0
  13. package/src/client/components/common/session-branch/style.ts +29 -0
  14. package/src/client/components/common/session-row/StatusSlot.tsx +15 -3
  15. package/src/client/components/common/session-row/index.tsx +24 -25
  16. package/src/client/components/common/session-row/session-row.test.tsx +11 -0
  17. package/src/client/components/common/session-state-provider/index.tsx +1 -1
  18. package/src/client/components/layout/desktop-layout/LeftColumn.tsx +2 -1
  19. package/src/client/components/layout/session-sidebar/CategoryItem.tsx +66 -69
  20. package/src/client/components/layout/session-sidebar/SessionItem.batch.test.ts +3 -3
  21. package/src/client/components/layout/session-sidebar/SessionItem.test.ts +25 -2
  22. package/src/client/components/layout/session-sidebar/SessionItem.tsx +33 -30
  23. package/src/client/components/layout/session-sidebar/SessionList.tsx +2 -1
  24. package/src/client/components/layout/session-sidebar/about-modal/HarnessRow.tsx +261 -0
  25. package/src/client/components/layout/session-sidebar/about-modal/HarnessTable.tsx +35 -225
  26. package/src/client/components/layout/session-sidebar/about-modal/HarnessTableLog.test.tsx +36 -16
  27. package/src/client/components/layout/session-sidebar/about-modal/UpdateLogDialog.tsx +11 -3
  28. package/src/client/components/layout/session-sidebar/about-modal/UpdateLogLine.tsx +13 -4
  29. package/src/client/components/layout/session-sidebar/about-modal/UpdateSection.tsx +3 -2
  30. package/src/client/components/layout/session-sidebar/about-modal/index.tsx +30 -14
  31. package/src/client/components/layout/session-sidebar/modern/RevealRow.tsx +56 -0
  32. package/src/client/components/layout/session-sidebar/modern/WorkspaceSection.tsx +69 -85
  33. package/src/client/components/layout/session-sidebar/modern/reveal-row.test.tsx +104 -0
  34. package/src/client/components/layout/session-sidebar/scheduler-modal/index.tsx +2 -1
  35. package/src/client/components/layout/session-sidebar/variant-props.ts +2 -1
  36. package/src/client/components/mobile/SessionSidebar.tsx +2 -1
  37. package/src/client/components/mobile/mobile-session-sidebar/ClassicDrawer.tsx +2 -1
  38. package/src/client/components/mobile/mobile-session-sidebar/Item.tsx +59 -62
  39. package/src/client/components/mobile/mobile-session-sidebar/List.tsx +2 -1
  40. package/src/client/components/mobile/mobile-session-sidebar/SessionRow.test.ts +5 -0
  41. package/src/client/components/mobile/mobile-session-sidebar/SessionRow.tsx +33 -30
  42. package/src/client/components/settings/Modal.tsx +1 -1
  43. package/src/client/components/settings/Sidebar.tsx +1 -1
  44. package/src/client/components/settings/categories/NotificationSettings.test.tsx +92 -0
  45. package/src/client/components/settings/categories/NotificationSettings.tsx +112 -2
  46. package/src/client/components/settings/categories/harness-settings/HarnessCard.tsx +1 -1
  47. package/src/client/components/settings/categories/project-settings/WorktreeSettings.tsx +2 -1
  48. package/src/client/components/settings/categories/usage-settings/LimitsSection.tsx +39 -19
  49. package/src/client/components/settings/categories/usage-settings/ProviderDetail.tsx +1 -0
  50. package/src/client/components/settings/categories/usage-settings/limit-groups.test.ts +94 -0
  51. package/src/client/components/settings/categories/usage-settings/limit-groups.ts +118 -0
  52. package/src/client/components/settings/categories/usage-settings/limits-section.test.tsx +118 -0
  53. package/src/client/components/workspace/chat-timeline/AiMessageFooter.fork.test.ts +94 -0
  54. package/src/client/components/workspace/chat-timeline/AiMessageFooter.tsx +31 -5
  55. package/src/client/components/workspace/chat-timeline/EmptyWorkspacePrompt.tsx +86 -93
  56. package/src/client/components/workspace/chat-timeline/MessageList.tsx +7 -5
  57. package/src/client/components/workspace/chat-timeline/PendingChatView.tsx +21 -1
  58. package/src/client/components/workspace/chat-timeline/PendingTranscript.tsx +130 -0
  59. package/src/client/components/workspace/chat-timeline/RunFooter.tsx +12 -3
  60. package/src/client/components/workspace/chat-timeline/chat-input/AttachmentToolbar.tsx +2 -0
  61. package/src/client/components/workspace/chat-timeline/chat-input/ModeToggles.tsx +15 -1
  62. package/src/client/components/workspace/chat-timeline/chat-input/SessionModeDropdown.test.tsx +85 -0
  63. package/src/client/components/workspace/chat-timeline/chat-input/SessionModeDropdown.tsx +84 -0
  64. package/src/client/components/workspace/chat-timeline/chat-input/Toolbar.tsx +2 -0
  65. package/src/client/components/workspace/chat-timeline/chat-input/modes-props.ts +5 -0
  66. package/src/client/components/workspace/chat-timeline/fork-preview.test.tsx +141 -0
  67. package/src/client/components/workspace/chat-timeline/index.tsx +16 -22
  68. package/src/client/components/workspace/chat-timeline/target-picker/DraftTargetRow.tsx +116 -0
  69. package/src/client/components/workspace/chat-timeline/target-picker/ParentSessionPicker.tsx +173 -0
  70. package/src/client/components/workspace/chat-timeline/target-picker/WorktreePicker.tsx +5 -4
  71. package/src/client/components/workspace/chat-timeline/target-picker/parent-session-options.test.ts +49 -0
  72. package/src/client/components/workspace/git-panel/index.tsx +2 -2
  73. package/src/client/components/workspace/terminal-panel/RealtimeTerminalView.tsx +8 -5
  74. package/src/client/components/workspace/terminal-panel/index.tsx +3 -0
  75. package/src/client/hooks/chat/composer/items.test.ts +19 -0
  76. package/src/client/hooks/chat/omp/folder-auto-expand.ts +1 -1
  77. package/src/client/hooks/chat/omp/pending-adoption.ts +51 -0
  78. package/src/client/hooks/chat/omp/pending-child.test.ts +73 -0
  79. package/src/client/hooks/chat/omp/pending-entry.ts +59 -0
  80. package/src/client/hooks/chat/omp/pending-rows.ts +6 -2
  81. package/src/client/hooks/chat/omp/pending-sessions.test.ts +1 -2
  82. package/src/client/hooks/chat/omp/pending-sessions.ts +45 -69
  83. package/src/client/hooks/chat/omp/pending-waiting.ts +1 -1
  84. package/src/client/hooks/chat/omp/run-switch.ts +1 -1
  85. package/src/client/hooks/chat/omp/session-list.tsx +9 -0
  86. package/src/client/hooks/chat/omp/sidebar-reload.test.ts +85 -0
  87. package/src/client/hooks/chat/omp/sidebar-reload.ts +30 -0
  88. package/src/client/hooks/chat/subagents/roster.ts +122 -0
  89. package/src/client/hooks/chat/timeline/child-spawn.test.ts +55 -0
  90. package/src/client/hooks/chat/timeline/child-spawn.ts +45 -0
  91. package/src/client/hooks/chat/timeline/fork-preview.test.ts +148 -0
  92. package/src/client/hooks/chat/timeline/fork-preview.ts +104 -0
  93. package/src/client/hooks/chat/timeline/fork-request.test.ts +54 -0
  94. package/src/client/hooks/chat/timeline/fork-request.ts +43 -0
  95. package/src/client/hooks/chat/timeline/fork-send.test.ts +139 -0
  96. package/src/client/hooks/chat/timeline/mode-availability.test.ts +1 -1
  97. package/src/client/hooks/chat/timeline/mode-availability.ts +33 -0
  98. package/src/client/hooks/chat/timeline/mode-markers.ts +7 -1
  99. package/src/client/hooks/chat/timeline/mode-post.ts +15 -3
  100. package/src/client/hooks/chat/timeline/modes-contract.ts +9 -4
  101. package/src/client/hooks/chat/timeline/modes.test.ts +56 -18
  102. package/src/client/hooks/chat/timeline/modes.ts +42 -29
  103. package/src/client/hooks/chat/timeline/pending-branch.ts +214 -0
  104. package/src/client/hooks/chat/timeline/pending-dispatch.ts +302 -0
  105. package/src/client/hooks/chat/timeline/send.ts +17 -103
  106. package/src/client/hooks/chat/timeline/session-harness.ts +6 -0
  107. package/src/client/hooks/chat/timeline/stop-with-queue.ts +42 -0
  108. package/src/client/hooks/chat/timeline/use-fork-session.ts +40 -31
  109. package/src/client/hooks/chat/waiting/cancel.ts +2 -1
  110. package/src/client/hooks/chat/waiting/dispatch.ts +5 -4
  111. package/src/client/hooks/chat/waiting/held.ts +2 -1
  112. package/src/client/hooks/models/use-harness-update.test.ts +137 -44
  113. package/src/client/hooks/models/use-harness-update.ts +133 -85
  114. package/src/client/hooks/settings/providers/actions.ts +3 -2
  115. package/src/client/hooks/settings/providers/messages.ts +9 -7
  116. package/src/client/hooks/settings/providers/model-actions.ts +2 -1
  117. package/src/client/hooks/ui/editor-error-toast.ts +2 -1
  118. package/src/client/hooks/ui/input-required-alert.ts +12 -5
  119. package/src/client/hooks/ui/notifications.ts +45 -0
  120. package/src/client/hooks/ui/run-outcome-alert.ts +48 -0
  121. package/src/client/hooks/workspace/batch-archive.test.ts +2 -2
  122. package/src/client/hooks/workspace/batch-archive.ts +4 -2
  123. package/src/client/hooks/workspace/expanded-sessions.ts +36 -7
  124. package/src/client/hooks/workspace/git-action-outcome.ts +4 -3
  125. package/src/client/hooks/workspace/navbar-session-actions.ts +2 -1
  126. package/src/client/hooks/workspace/session-actions.test.ts +2 -1
  127. package/src/client/hooks/workspace/session-actions.ts +2 -1
  128. package/src/client/hooks/workspace/terminal/connection.test.ts +63 -0
  129. package/src/client/hooks/workspace/terminal/connection.ts +47 -0
  130. package/src/client/hooks/workspace/terminal/index.ts +35 -4
  131. package/src/client/hooks/workspace/workspace-folder-actions.ts +2 -1
  132. package/src/client/lib/native/open-session.ts +33 -0
  133. package/src/client/lib/notifications/os.test.ts +125 -0
  134. package/src/client/lib/notifications/os.ts +130 -0
  135. package/src/client/lib/plugins/sidebar-bridge.ts +2 -20
  136. package/src/client/lib/router/open-session.test.ts +75 -0
  137. package/src/client/lib/router/open-session.ts +34 -0
  138. package/src/client/lib/signals.ts +5 -1
  139. package/src/client/main.tsx +6 -0
  140. package/src/server/lib/db/schema.ts +1 -0
  141. package/src/server/lib/harness/acp/calls.ts +15 -1
  142. package/src/server/lib/harness/acp/client-capabilities.test.ts +55 -0
  143. package/src/server/lib/harness/acp/client-capabilities.ts +61 -0
  144. package/src/server/lib/harness/acp/client-fs.test.ts +135 -0
  145. package/src/server/lib/harness/acp/client-fs.ts +131 -0
  146. package/src/server/lib/harness/acp/client-initialize.test.ts +70 -0
  147. package/src/server/lib/harness/acp/client-initialize.ts +84 -0
  148. package/src/server/lib/harness/acp/client.ts +31 -21
  149. package/src/server/lib/harness/acp/commands.test.ts +5 -5
  150. package/src/server/lib/harness/acp/commands.ts +14 -2
  151. package/src/server/lib/harness/acp/frames-timing.test.ts +68 -0
  152. package/src/server/lib/harness/acp/frames-v2.test.ts +85 -0
  153. package/src/server/lib/harness/acp/frames.ts +71 -158
  154. package/src/server/lib/harness/acp/mapper.test.ts +40 -0
  155. package/src/server/lib/harness/acp/mapper.ts +12 -0
  156. package/src/server/lib/harness/acp/permissions.ts +6 -0
  157. package/src/server/lib/harness/acp/protocol.ts +41 -2
  158. package/src/server/lib/harness/acp/session-facts.ts +1 -1
  159. package/src/server/lib/harness/acp/session-handshake.test.ts +90 -1
  160. package/src/server/lib/harness/acp/session-handshake.ts +83 -6
  161. package/src/server/lib/harness/acp/session-idle.ts +7 -6
  162. package/src/server/lib/harness/acp/session-notifications.ts +41 -2
  163. package/src/server/lib/harness/acp/session-observers.test.ts +63 -0
  164. package/src/server/lib/harness/acp/session-permissions.test.ts +29 -0
  165. package/src/server/lib/harness/acp/session-permissions.ts +36 -0
  166. package/src/server/lib/harness/acp/session-requests.test.ts +92 -0
  167. package/src/server/lib/harness/acp/session-requests.ts +48 -6
  168. package/src/server/lib/harness/acp/session-turns.ts +8 -3
  169. package/src/server/lib/harness/acp/session-usage.ts +4 -0
  170. package/src/server/lib/harness/acp/session-web-state.ts +30 -2
  171. package/src/server/lib/harness/acp/session.test-util.ts +19 -1
  172. package/src/server/lib/harness/acp/session.ts +60 -60
  173. package/src/server/lib/harness/acp/tool-calls.ts +223 -0
  174. package/src/server/lib/harness/acp/turn.test.ts +102 -0
  175. package/src/server/lib/harness/acp/turn.ts +81 -6
  176. package/src/server/lib/harness/acp/v2.test.ts +144 -0
  177. package/src/server/lib/harness/acp/v2.ts +220 -0
  178. package/src/server/lib/harness/acp/verbs.ts +46 -6
  179. package/src/server/lib/harness/launch.test.ts +25 -0
  180. package/src/server/lib/harness/launch.ts +21 -9
  181. package/src/server/lib/harness/session.ts +3 -0
  182. package/src/server/lib/harness/update-job-store.test.ts +37 -12
  183. package/src/server/lib/harness/update-job-store.ts +22 -16
  184. package/src/server/lib/harness/update-job.server.ts +66 -175
  185. package/src/server/lib/harness/update-queue.server.ts +292 -0
  186. package/src/server/lib/harness/update-queue.test.ts +265 -0
  187. package/src/server/lib/harness/update-spawn.server.ts +96 -0
  188. package/src/server/lib/harness/update-worker.ts +8 -3
  189. package/src/server/lib/lifecycle/after-listen.ts +9 -0
  190. package/src/server/lib/lifecycle/paths.ts +14 -9
  191. package/src/server/lib/omp/rpc/run-settle.server.ts +10 -1
  192. package/src/server/lib/omp/rpc/subagent-liveness.ts +5 -5
  193. package/src/server/lib/omp/rpc/terminal-settle.ts +5 -1
  194. package/src/server/lib/omp/session/delete-flow.server.ts +1 -0
  195. package/src/server/lib/omp/session/sidebar-data.server.ts +10 -12
  196. package/src/server/lib/sessions/fork.server.test.ts +68 -0
  197. package/src/server/lib/sessions/fork.server.ts +31 -6
  198. package/src/server/lib/sessions/spawn.server.test.ts +41 -0
  199. package/src/server/lib/sessions/spawn.server.ts +27 -2
  200. package/src/server/lib/usage/report.server.ts +57 -0
  201. package/src/server/routes/agent/harness-command.ts +6 -5
  202. package/src/server/routes/chat/stream.ts +7 -2
  203. package/src/server/routes/harness/update-status.ts +18 -12
  204. package/src/server/routes/harness/update.test.ts +53 -16
  205. package/src/server/routes/harness/update.ts +13 -8
  206. package/src/server/routes/sessions/body-readers.ts +43 -0
  207. package/src/server/routes/sessions/fork.ts +19 -4
  208. package/src/server/routes/sessions/routes.test.ts +1 -2
  209. package/src/server/routes/sessions/session.ts +19 -0
  210. package/src/server/routes/sessions/spawn.ts +16 -13
  211. package/src/shared/lib/chat/omp/agent-events.ts +11 -0
  212. package/src/shared/lib/chat/omp/session-modes-signal.test.ts +41 -0
  213. package/src/shared/lib/chat/timeline/fork-preview.test.ts +62 -0
  214. package/src/shared/lib/chat/timeline/fork-preview.ts +36 -0
  215. package/src/shared/lib/harness/mode-signal.ts +20 -0
  216. package/src/shared/lib/harness/session-modes.ts +24 -0
  217. package/src/shared/lib/harness/update-job.ts +53 -6
  218. package/src/shared/lib/icons/tint-hues.generated.ts +34 -34
  219. package/src/shared/lib/notifications/outcomes.test.ts +96 -0
  220. package/src/shared/lib/notifications/outcomes.ts +64 -0
  221. package/src/shared/lib/notifications/settings.test.ts +49 -0
  222. package/src/shared/lib/notifications/settings.ts +34 -0
  223. package/src/shared/lib/omp/session/default-title.ts +5 -4
  224. package/src/shared/lib/omp/session/prewarm-misc.test.ts +3 -2
  225. package/src/shared/lib/omp/session/schema-migrations.ts +4 -0
  226. package/src/shared/lib/omp/session/stream-state.server.test.ts +19 -0
  227. package/src/shared/lib/omp/session/stream-state.server.ts +24 -4
  228. package/src/shared/lib/settings/defaults.ts +3 -0
  229. package/src/shared/lib/ui/toast-duration.test.ts +25 -1
  230. package/src/shared/lib/ui/toast-duration.ts +22 -4
  231. package/src/shared/lib/workspace/session-state/store.ts +4 -0
  232. package/src/shared/types/harness-update.ts +24 -0
  233. package/src/shared/types/realtime.ts +2 -0
  234. package/src/shared/types/settings/state.ts +10 -0
  235. package/src/shared/types/workspace.ts +4 -0
  236. package/src/test-support/harness-table.test-util.ts +25 -9
  237. package/dist/client/static/js/index-bc9aa4mx.css +0 -1
  238. package/src/client/components/common/session-actions-menu/NewChildSessionDialog.tsx +0 -113
  239. package/src/client/components/common/subagent-list/index.tsx +0 -165
  240. package/src/client/components/layout/session-sidebar/ChildSessionList.tsx +0 -66
  241. package/src/client/hooks/workspace/child-expansion.ts +0 -33
@@ -153,10 +153,10 @@ describe('mobile row batch mode', () => {
153
153
  expect(calls.select).toBe(0);
154
154
  });
155
155
 
156
- test('hides the row actions and the roster toggle in select mode', async () => {
157
- const { el } = await mountMobile({ selectable: true, hasSubagents: true, onToggleExpand: () => {} });
156
+ test('hides the row actions and the branch chevron in select mode', async () => {
157
+ const { el } = await mountMobile({ selectable: true, expandable: true, onToggleExpand: () => {} });
158
158
  expect(el.querySelector('button[aria-label="Session actions"]')).toBeNull();
159
- expect(el.querySelector('button[aria-label*="subagents"]')).toBeNull();
159
+ expect(el.querySelector('button[aria-label*="sessions and subagents"]')).toBeNull();
160
160
  expect(checkbox(el)?.getAttribute('aria-label')).toBe('Select hello world');
161
161
  });
162
162
  });
@@ -68,6 +68,30 @@ function renameCue(el: HTMLElement): Element | null {
68
68
  return el.querySelector('[role="status"]');
69
69
  }
70
70
 
71
+ describe('child session mark', () => {
72
+ test('a leaf child fills the empty slot with the child mark', async () => {
73
+ const el = await mount({ isChild: true });
74
+ expect(el.querySelector('[data-testid="child-indicator"] svg')).not.toBeNull();
75
+ });
76
+
77
+ test('a child with a branch keeps its chevron instead', async () => {
78
+ const el = await mount({ isChild: true, expandable: true, onToggleExpand: () => {} });
79
+ expect(el.querySelector('[data-testid="child-indicator"]')).toBeNull();
80
+ expect(el.querySelector('button[aria-expanded]')).not.toBeNull();
81
+ });
82
+
83
+ test('a running child shows the run cue, not the mark', async () => {
84
+ const el = await mount({ isChild: true, status: 'stream' });
85
+ expect(el.querySelector('[data-testid="child-indicator"]')).toBeNull();
86
+ expect(el.querySelector('[role="status"]')?.getAttribute('aria-label')).toBe('Running');
87
+ });
88
+
89
+ test('a root row draws no child mark', async () => {
90
+ const el = await mount();
91
+ expect(el.querySelector('[data-testid="child-indicator"]')).toBeNull();
92
+ });
93
+ });
94
+
71
95
  describe('desktop session row rename cue', () => {
72
96
  test('draws a labelled spinner while the rename is in flight', async () => {
73
97
  setSessionRenaming('s1', true);
@@ -82,10 +106,9 @@ describe('desktop session row rename cue', () => {
82
106
  expect(renameCue(el)).toBeNull();
83
107
  });
84
108
 
85
- test('takes the slot from a roster chevron, which is hidden until hover', async () => {
109
+ test('takes the slot from the branch chevron, which is hidden until hover', async () => {
86
110
  setSessionRenaming('s1', true);
87
111
  const el = await mount({
88
- hasSubagents: true,
89
112
  expandable: true,
90
113
  onToggleExpand: () => {},
91
114
  });
@@ -1,13 +1,24 @@
1
1
  import type { TargetedMouseEvent } from 'preact';
2
- import { Boxes, Check, ChevronDown, ChevronRight, CircleQuestionMark, Hourglass, Loader2, MoreHorizontal } from 'lucide-preact';
2
+ import { Check, ChevronDown, ChevronRight, CircleQuestionMark, GitBranch, Hourglass, Loader2, MoreHorizontal } from 'lucide-preact';
3
3
  import { useInlineRename } from '@/client/hooks/ui/inline-rename';
4
4
  import { useSessionRenaming } from '@/client/hooks/workspace/renaming-sessions';
5
5
  import { SessionActionsMenu, useRowMenu } from '@/client/components/common/session-actions-menu';
6
6
  import { SelectionCheckbox } from '@/client/components/common/batch-selection/SelectionCheckbox';
7
7
  import { HarnessGlyph, HARNESS_GLYPH_SIZE } from '@/client/components/common/harness-glyph';
8
+ import type { BranchRowStyle } from '@/client/components/common/session-branch/style';
8
9
  import { WorktreeBadge } from '@/client/components/layout/session-sidebar/WorktreeBadge';
9
10
  import type { SessionWorktreeInfo } from '@/shared/lib/workspace/worktree/types';
10
11
 
12
+ /** What a subagent row under this chrome's rows borrows from it. */
13
+ export const SESSION_ITEM_BRANCH_STYLE: BranchRowStyle = {
14
+ inset: 'px-2',
15
+ insetPx: 8,
16
+ slotWidth: 16,
17
+ markGap: 8,
18
+ padding: 'py-1.5',
19
+ glyph: HARNESS_GLYPH_SIZE.compact,
20
+ };
21
+
11
22
  export interface SessionItemProps {
12
23
  /** The session this row draws; the key its in-flight rename is tracked under. */
13
24
  sessionId: string | number;
@@ -34,11 +45,12 @@ export interface SessionItemProps {
34
45
  onRenameWithAi?: () => void;
35
46
  expandable?: boolean;
36
47
  isExpanded?: boolean;
37
- hasSubagents?: boolean;
38
- /** Whether the subagent roster (a separate list) is open. */
39
- subagentsExpanded?: boolean;
40
- onToggleSubagents?: (e: TargetedMouseEvent<HTMLElement>) => void;
41
48
  onToggleExpand?: (e: TargetedMouseEvent<HTMLElement>) => void;
49
+ /** Drawn inside a parent's branch; a leaf child gets a child mark in its slot. */
50
+ isChild?: boolean;
51
+ /** The folder the row belongs to, so a child spawned from its menu lands in
52
+ * the right list before the server answers. */
53
+ folderId?: number | string;
42
54
  /**
43
55
  * The row's prompt is held until another session finishes. A pending row has
44
56
  * no transcript and no omp id, so this cue is the only thing on screen saying
@@ -75,10 +87,9 @@ export function SessionItem({
75
87
  onRenameWithAi,
76
88
  expandable = false,
77
89
  isExpanded = false,
78
- hasSubagents = false,
79
- subagentsExpanded = false,
80
- onToggleSubagents,
81
90
  onToggleExpand,
91
+ isChild = false,
92
+ folderId,
82
93
  waitingFor,
83
94
  onCancelWait,
84
95
  worktree,
@@ -96,7 +107,7 @@ export function SessionItem({
96
107
  // it at rest — the spinner, or the blocked-on-a-question cue, which says it
97
108
  // is YOUR turn. With nothing live to report the chevron is PINNED, collapsed
98
109
  // or expanded: it is the only affordance left worth showing, and making it
99
- // hover-only would leave the roster reachable only by hovering exactly the
110
+ // hover-only would leave the branch reachable only by hovering exactly the
100
111
  // right 16px.
101
112
  const waiting = Boolean(waitingFor);
102
113
  const liveRun = awaitingInput || status === 'stream' || waiting;
@@ -149,7 +160,7 @@ export function SessionItem({
149
160
  {/* One 16px slot owns both icons — never two side by side. A live run
150
161
  signal (blocked question, run spinner) holds the slot; otherwise the
151
162
  chevron is pinned, collapsed or expanded. While the signal holds it,
152
- hovering hands the slot to the chevron so the roster stays reachable
163
+ hovering hands the slot to the chevron so the branch stays reachable
153
164
  mid-run.
154
165
  Both layers are pointer-inert for the opposite state: the toggle
155
166
  while hidden, the status glyph ALWAYS (it is painted after the
@@ -164,7 +175,7 @@ export function SessionItem({
164
175
  e.stopPropagation();
165
176
  onToggleExpand(e);
166
177
  }}
167
- title={isExpanded ? 'Collapse child sessions' : 'Expand child sessions'}
178
+ title={isExpanded ? 'Collapse sessions and subagents' : 'Expand sessions and subagents'}
168
179
  aria-expanded={isExpanded}
169
180
  className={`peer absolute inset-0 flex items-center justify-center rounded cursor-pointer transition-opacity ${
170
181
  chevronPinned
@@ -211,6 +222,15 @@ export function SessionItem({
211
222
  )}
212
223
  </span>
213
224
  )}
225
+ {isChild && !showChevron && !showStatus && (
226
+ <span
227
+ data-testid="child-indicator"
228
+ aria-hidden="true"
229
+ className="pointer-events-none absolute inset-0 flex items-center justify-center text-ink/35"
230
+ >
231
+ <GitBranch size={12} aria-hidden="true" />
232
+ </span>
233
+ )}
214
234
  </span>
215
235
 
216
236
  {/* Gap between icon and text */}
@@ -267,25 +287,6 @@ export function SessionItem({
267
287
  <span className="shrink-0 ml-2 font-mono text-[10px] text-ink/40">{timeAgo}</span>
268
288
  )}
269
289
 
270
- {/* The roster is a tool-call list, not a tree: its trigger is a badge,
271
- never the chevron. Keeping the two controls apart is what stops a
272
- child session and a subagent from reading as the same thing. */}
273
- {!isEditing && hasSubagents && onToggleSubagents && !selectable && (
274
- <button
275
- type="button"
276
- onClick={(e) => {
277
- e.stopPropagation();
278
- onToggleSubagents(e);
279
- }}
280
- title="Subagents (tool calls)"
281
- aria-label="Subagents"
282
- aria-expanded={subagentsExpanded}
283
- className="shrink-0 ml-1 p-1 text-ink/40 hover:text-ink hover:bg-ink/10 rounded cursor-pointer"
284
- >
285
- <Boxes size={13} />
286
- </button>
287
- )}
288
-
289
290
  {/* One trigger, whatever the row can do — the menu grows, so a row with
290
291
  more actions costs no extra width. It is always drawn, the way the
291
292
  phone's row draws it: a hover-only trigger is invisible until the
@@ -315,6 +316,8 @@ export function SessionItem({
315
316
  <SessionActionsMenu
316
317
  anchor={menu.anchor}
317
318
  sessionId={sessionId}
319
+ {...(harness ? { harness } : {})}
320
+ {...(folderId !== undefined ? { folderId } : {})}
318
321
  isArchived={isArchived}
319
322
  onRename={onRename ? startRename : undefined}
320
323
  onRenameWithAi={onRenameWithAi}
@@ -1,6 +1,7 @@
1
1
  import { Category } from '@/client/components/layout/session-sidebar/CategoryItem';
2
2
  import type { BatchBinding } from '@/client/components/common/batch-selection/types';
3
3
  import type { WorkspaceFolderData } from '@/shared/types';
4
+ import type { ToastTone } from '@/shared/lib/ui/toast-duration';
4
5
 
5
6
  interface SessionSidebarSessionListProps {
6
7
  folders: WorkspaceFolderData[];
@@ -13,7 +14,7 @@ interface SessionSidebarSessionListProps {
13
14
  /** Start a chat in a worktree made from this folder. */
14
15
  onNewWorktreeSession?: (folderId: number, worktreePath: string) => void;
15
16
  /** Surfaces a refused folder action (the reveal endpoint's own reason). */
16
- onToast?: (message: string, type?: 'success' | 'error') => void;
17
+ onToast?: (message: string, type?: ToastTone) => void;
17
18
  /** Present only while a batch selection is active. */
18
19
  batch?: BatchBinding;
19
20
  onStartSessionSelection?: (folderId: number) => void;
@@ -0,0 +1,261 @@
1
+ /**
2
+ * @license
3
+ * SPDX-License-Identifier: MIT
4
+ */
5
+
6
+ /**
7
+ * ONE harness line in the About card: state, version, and the one action that
8
+ * harness can do — plus whatever its own update record says.
9
+ *
10
+ * Split out of `HarnessTable` when per-harness update records arrived: the row
11
+ * now reads three things (the catalog entry, the version row, and ITS OWN
12
+ * update record), and keeping that next to the section's tally and heading
13
+ * pushed the file past the 350-line ceiling. The section owns the list; this owns
14
+ * one line of it.
15
+ *
16
+ * Everything a row states, and why, is in `HarnessTable.tsx`'s header: this file
17
+ * is that row's markup and its three-column grid.
18
+ */
19
+
20
+ import { Download, Loader2 } from 'lucide-preact';
21
+ import { HarnessGlyph, HARNESS_GLYPH_SIZE } from '@/client/components/common/harness-glyph';
22
+ import { UpdateLogLine } from '@/client/components/layout/session-sidebar/about-modal/UpdateLogLine';
23
+ import { jobQueued, jobRunning, runningStepOf } from '@/shared/lib/harness/update-job';
24
+ import { harnessStatus, type HarnessState } from '@/shared/lib/harness/status';
25
+ import type { HarnessSummary } from '@/shared/types/harness';
26
+ import type { HarnessUpdateJob } from '@/shared/types/harness-update';
27
+ import type { HarnessVersionRow } from '@/shared/types/harness-version';
28
+
29
+ export interface HarnessRowProps {
30
+ entry: HarnessSummary;
31
+ version: HarnessVersionRow | null;
32
+ /** This harness's own update record — installing, waiting, or settled. */
33
+ job: HarnessUpdateJob | null;
34
+ /** A refusal from a press on THIS row, or null. */
35
+ problem: string | null;
36
+ onOpenHarness: () => void;
37
+ /** Starts this harness's update. */
38
+ onUpdate: () => void;
39
+ onOpenLog?: () => void;
40
+ }
41
+
42
+ /** The state mark. Shape carries the state, so tone is reinforcement only. */
43
+ function StateMark({ state }: { state: HarnessState }) {
44
+ if (state === 'ready') return <span aria-hidden="true" className="h-1.5 w-1.5 rounded-full bg-success" />;
45
+ if (state === 'not-installed') return <span aria-hidden="true" className="h-1.5 w-1.5 rounded-full border border-ink/35" />;
46
+ if (state === 'needs-setup') return <span aria-hidden="true" className="h-1.5 w-1.5 rounded-full bg-ink/45" />;
47
+ return <span aria-hidden="true" className="h-1.5 w-1.5 rounded-full bg-ink/15" />;
48
+ }
49
+
50
+ /**
51
+ * The three-column grid every data row uses.
52
+ *
53
+ * The widths are the point, and every earlier guess was wrong:
54
+ *
55
+ * - the ACTION column held `7rem` for a single icon, stealing space from the
56
+ * version cell — so `0.100.0 → 0.101.0` truncated while the action cell sat
57
+ * mostly empty. It is `1.75rem` now: one 24px button and nothing else.
58
+ * - the VERSION column held `7.5rem` (120px), which clipped the widest thing
59
+ * it ever holds — an adapter's `adapter 0.100.0 → 0.101.0` line, measured at
60
+ * 151px in this face. It is `9.5rem` (152px), the content's own width.
61
+ * - on a PHONE it is `7rem`: the About card is 512px at most, and the 152px
62
+ * track left the agent's own name ~130px, so `command-code` and
63
+ * `deepseek-harness` were the cells that truncated while the name is the one
64
+ * thing a reader is scanning for. The version line ellipsizes instead, and
65
+ * carries its full text in `title`.
66
+ *
67
+ * It stays a FIXED track rather than `auto`: every row is its own grid, so an
68
+ * `auto` track is measured per row and the version numbers stop lining up in a
69
+ * column (measured: a name cell of 352px on one row and 208px on the next).
70
+ *
71
+ * The name takes the slack and ellipsizes. The card's own width is FIXED
72
+ * (`md:w-[880px]`), so the name track cannot collapse the dialog — that only
73
+ * happened while the card was `w-auto`.
74
+ *
75
+ * `items-start`, not `items-center`: each cell holds two lines whose heights
76
+ * differ from row to row (a version cell is 16px alone and 31px with an
77
+ * `adapter …` line under it), and centering measured the number 7.5px BELOW the
78
+ * name it belongs to. Top-aligned, line one of every cell shares one baseline.
79
+ */
80
+ const COLUMNS = 'grid grid-cols-[minmax(0,1fr)_7rem_1.75rem] items-start gap-x-2 md:grid-cols-[minmax(0,1fr)_9.5rem_1.75rem]';
81
+
82
+ export function HarnessRow({
83
+ entry, version, job, problem, onOpenHarness, onUpdate, onOpenLog,
84
+ }: HarnessRowProps) {
85
+ const status = harnessStatus(entry);
86
+ // Three states, three answers: a worker is installing this one, this one is
87
+ // WAITING for the install ahead of it, or nothing is running and the record is
88
+ // the run that settled.
89
+ const isUpdating = jobRunning(job);
90
+ const isQueued = jobQueued(job);
91
+ const busy = isUpdating || isQueued;
92
+ const progress = isUpdating ? runningStepOf(job) : null;
93
+ // The row that owns the record gets the log line: while it waits or installs,
94
+ // and after it settles so the output is not lost with it.
95
+ const showLogLine = busy || job?.finishedAt != null;
96
+ // The number a reader calls "the version": the CLI when the harness is an
97
+ // adapter, otherwise the agent itself. Each part carries its own `latest` and
98
+ // its own ability to move, so the two are never compared across each other.
99
+ //
100
+ // A CLI part EXISTS for every adapter even when its `--version` could not be
101
+ // read (the binary is absent, or its launcher is broken). Taking that empty
102
+ // part as the lead painted `—` over a known adapter number: measured on
103
+ // `zcode` (adapter 0.82.3 probed, no `zcode` runtime) and `claude`
104
+ // (`claude --version` fails while the adapter answers). The part that HAS a
105
+ // number leads.
106
+ const cli = version?.cli ?? null;
107
+ const agent = version?.agent ?? null;
108
+ const lead = cli?.version ? cli : agent;
109
+ const showAdapterLine = Boolean(
110
+ cli?.version && agent?.version && agent.version !== cli.version,
111
+ );
112
+ // What the press would install, named: an adapter and a CLI are two different
113
+ // products, so the accessible name says which is moving.
114
+ const targets = version
115
+ ? [
116
+ version.agent.updateAvailable && version.agent.latest
117
+ ? version.cli ? `adapter ${version.agent.latest}` : version.agent.latest
118
+ : null,
119
+ version.cli?.updateAvailable && version.cli.latest
120
+ ? `${version.cli.name} ${version.cli.latest}`
121
+ : null,
122
+ ].filter((target): target is string => Boolean(target))
123
+ : [];
124
+ const updateLabel = `Update ${entry.label}${targets.length > 0 ? ` to ${targets.join(' + ')}` : ''}`;
125
+ // While the background worker runs, the button names the STEP it is on: one
126
+ // press can be an adapter install and then `claude update`, and "Updating…"
127
+ // alone would hide which half is moving. A run that is WAITING says so — it
128
+ // started when it was accepted, it installs when the queue reaches it.
129
+ const actionLabel = isQueued
130
+ ? `Queued: ${entry.label} update starts after the install that is running`
131
+ : isUpdating && progress ? `Updating ${entry.label}: ${progress}` : updateLabel;
132
+
133
+ return (
134
+ <div className={`${COLUMNS} border-b border-ink/5 py-1.5`}>
135
+ {/* The name is the link: one target per row, and the row's other
136
+ cells stay selectable text.
137
+ TWO lines per cell, and the same two line boxes on both
138
+ sides: the name and its version share row one (16px), the
139
+ state label and the adapter line share row two (15px). Every
140
+ cell is a flex COLUMN of those two rows, which is what makes
141
+ `ready` sit exactly under `2.1.318` and beside
142
+ `adapter 0.100.0 →` (measured 8px apart when the cells were
143
+ centered independently). */}
144
+ <button
145
+ type="button"
146
+ onClick={onOpenHarness}
147
+ title={status.detail ?? undefined}
148
+ aria-label={`${entry.label} — ${status.label}. Open its settings.`}
149
+ className="flex min-w-0 cursor-pointer items-start gap-1.5 text-left"
150
+ >
151
+ {/* The glyph rides the FIRST row, not the middle of the pair:
152
+ centered on both rows it landed between the name and the
153
+ state label. */}
154
+ <span className="flex h-4 shrink-0 items-center">
155
+ <HarnessGlyph harness={entry.id} size={HARNESS_GLYPH_SIZE.compact} />
156
+ </span>
157
+ {/* The state mark sits in the label's TOP-RIGHT CORNER, not in
158
+ the flow: as a trailing child it took a column of its own and
159
+ every agent name lost ~14px to a 6px dot. Positioned, the
160
+ label keeps its width and the mark still reads as a status
161
+ light on that name. */}
162
+ <span className="flex min-w-0 flex-1 flex-col">
163
+ {/* The mark sits at the top-right of the NAME ITSELF, so the
164
+ wrapper must HUG the text — a `flex-1` wrapper anchored the
165
+ dot to the column's edge instead, which read as a marker on
166
+ the version beside it. `max-w-full` keeps it on the name and
167
+ still allows the truncation. */}
168
+ <span className="flex max-w-full items-center gap-1.5">
169
+ <span className={`truncate text-[11px] leading-4 ${status.state === 'ready' ? 'font-medium text-ink' : 'text-ink/70'}`}>
170
+ {entry.label}
171
+ </span>
172
+ <StateMark state={status.state} />
173
+ </span>
174
+ <span className="block truncate text-[10px] leading-[15px] text-ink/40">{status.label}</span>
175
+ </span>
176
+ </button>
177
+
178
+ {/* TWO number lines, each with its OWN arrow.
179
+ A harness can be an adapter over a CLI, and the two move
180
+ independently: the row leads with the CLI's `2.1.318` and states
181
+ `adapter 0.101.0` underneath, so `→` may only ever join the two
182
+ numbers on ITS line. Joining `2.1.318` with the adapter's latest
183
+ would compare two different products — the fiction this cell
184
+ exists to prevent. */}
185
+ <span
186
+ className="flex min-w-0 flex-col items-end text-right font-mono text-[11px] leading-4 text-ink/70"
187
+ title={version?.note ?? undefined}
188
+ >
189
+ <span className="block max-w-full truncate">
190
+ {/* The CLI's version leads when the harness is an ADAPTER: it
191
+ is the number a user recognises (`claude --version` →
192
+ 2.1.318). */}
193
+ {lead?.version ?? <span className="text-ink/30">—</span>}
194
+ {lead?.updateAvailable && lead.latest && (
195
+ <>
196
+ <span aria-hidden="true" className="ml-1 text-ink/35">→</span>
197
+ <span className="ml-1 text-ink">{lead.latest}</span>
198
+ </>
199
+ )}
200
+ </span>
201
+ {/* The adapter's own number and its own move. It lives INSIDE
202
+ the version cell — as a fourth grid child it shifted every
203
+ row one track and moved the action button onto its own line. */}
204
+ {showAdapterLine && version && (
205
+ <span
206
+ className="block max-w-full truncate text-[10px] leading-[15px] text-ink/35"
207
+ title={`${version.cli?.name ?? 'CLI'} ${version.cli?.version ?? 'unknown'} · adapter ${version.agent.version}`}
208
+ >
209
+ adapter {version.agent.version}
210
+ {version.agent.updateAvailable && version.agent.latest
211
+ ? ` → ${version.agent.latest}`
212
+ : ''}
213
+ </span>
214
+ )}
215
+ </span>
216
+
217
+ <div className="flex min-w-0 justify-end">
218
+ {/* ICON ONLY, and only when there is something to move to.
219
+ A row with no newer version shows nothing: a permanent action
220
+ button claims work that does not exist. The label lives in
221
+ `title` + `aria-label`, so the meaning is not lost — it is just
222
+ not spent on every row. The icon is a DOWNLOAD arrow because
223
+ that is what the press does; it used to be `ArrowUpRight`, which
224
+ reads as "open this elsewhere". */}
225
+ {version?.updateAvailable ? (
226
+ <button
227
+ type="button"
228
+ onClick={onUpdate}
229
+ // Disabled for BOTH halves: a second press for a harness
230
+ // that is already waiting would only be refused, and the
231
+ // button's own state is the answer.
232
+ disabled={busy}
233
+ aria-label={actionLabel}
234
+ title={actionLabel}
235
+ className="inline-flex cursor-pointer items-center justify-center rounded border border-ink/25 p-1 text-ink transition-colors hover:border-ink/50 hover:bg-ink/5 disabled:cursor-not-allowed disabled:opacity-50"
236
+ >
237
+ {busy
238
+ ? <Loader2 size={11} className="animate-spin motion-reduce:animate-none" />
239
+ : <Download size={11} />}
240
+ </button>
241
+ ) : (
242
+ <span className="text-[10px] text-ink/25">—</span>
243
+ )}
244
+ </div>
245
+
246
+ {problem && (
247
+ <span className="col-span-3 pb-1 text-[10px] text-ink/70">{problem}</span>
248
+ )}
249
+
250
+ {showLogLine && (
251
+ <UpdateLogLine
252
+ running={isUpdating}
253
+ queued={isQueued}
254
+ progress={progress}
255
+ message={job?.message ?? null}
256
+ onOpenLog={onOpenLog}
257
+ />
258
+ )}
259
+ </div>
260
+ );
261
+ }