@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
@@ -0,0 +1,118 @@
1
+ /**
2
+ * @license
3
+ * SPDX-License-Identifier: MIT
4
+ */
5
+
6
+ /**
7
+ * Provider-aware grouping for the generic quota section.
8
+ *
9
+ * omp reports every provider's windows as one flat list, but three of them are
10
+ * not one list:
11
+ *
12
+ * - Anthropic mixes plan windows (5h, 7d, per-tier 7d) with a USD spend limit
13
+ * (`anthropic:extra`). Drawing the spend limit as a fourth quota window made
14
+ * it look like another reset window instead of "what happens after the
15
+ * windows run out".
16
+ * - Antigravity emits one entry per model family AND per window, so a Google
17
+ * bucket and the shared Claude/GPT bucket sat in one grid with no boundary;
18
+ * the rows even repeat the family in their label because there was nowhere
19
+ * else to put it.
20
+ * - Every other provider is one list, and stays one list.
21
+ *
22
+ * The grouping is a pure function of (provider slug, limit id) so it can be
23
+ * unit-tested without mounting the panel. Group order is first-seen order and
24
+ * rows keep omp's own order inside a group (omp sorts by remaining fraction).
25
+ */
26
+
27
+ import type { UsageLimitWindow } from '@/shared/types';
28
+
29
+ export interface LimitGroup {
30
+ /** Stable key inside one provider's section: `windows`, `balance`, `google`, … */
31
+ id: string;
32
+ /** The group's own heading; the panel draws one heading per group. */
33
+ title: string;
34
+ limits: UsageLimitWindow[];
35
+ }
36
+
37
+ const CLAUDE_EXTRA_ID = 'anthropic:extra';
38
+ const QUOTA_TITLE = 'Quota windows';
39
+
40
+ /** Push a row into the group named `id`, creating it on first use. */
41
+ function push(
42
+ groups: LimitGroup[],
43
+ id: string,
44
+ title: string,
45
+ limit: UsageLimitWindow,
46
+ ): void {
47
+ const existing = groups.find((group) => group.id === id);
48
+ if (existing) {
49
+ existing.limits.push(limit);
50
+ return;
51
+ }
52
+ groups.push({ id, title, limits: [limit] });
53
+ }
54
+
55
+ /**
56
+ * The model family Antigravity put in the second segment of the limit id:
57
+ * `${provider}:${counterKey}:${tier}:${windowId}`. `anthropic` and `openai`
58
+ * share one upstream bucket, which omp labels "Claude & GPT (shared)".
59
+ */
60
+ function antigravityBucket(id: string): { id: string; title: string } {
61
+ const counter = (id.split(':')[1] ?? '').toLowerCase();
62
+ if (counter === 'google') return { id: 'google', title: 'Google' };
63
+ if (counter === 'anthropic' || counter === 'openai') {
64
+ return { id: 'third-party', title: 'Claude & GPT (shared)' };
65
+ }
66
+ if (counter === 'default' || counter === '') return { id: 'default', title: 'Usage' };
67
+ // An unknown counter still has to be visible; naming it beats dropping it.
68
+ return { id: counter, title: counter };
69
+ }
70
+
71
+ /** Split Claude's plan windows from its USD spend limit. */
72
+ function groupClaude(limits: UsageLimitWindow[]): LimitGroup[] {
73
+ const groups: LimitGroup[] = [];
74
+ for (const limit of limits) {
75
+ if (limit.id === CLAUDE_EXTRA_ID) push(groups, 'balance', 'Balance', limit);
76
+ else push(groups, 'windows', QUOTA_TITLE, limit);
77
+ }
78
+ return groups;
79
+ }
80
+
81
+ /** Group Antigravity's rows by model family, merging the shared third-party bucket. */
82
+ function groupAntigravity(limits: UsageLimitWindow[]): LimitGroup[] {
83
+ const groups: LimitGroup[] = [];
84
+ for (const limit of limits) {
85
+ const bucket = antigravityBucket(limit.id);
86
+ // The quota-summary response emits the SAME shared bucket once for
87
+ // `anthropic:` and once for `openai:` — identical label, amount and reset,
88
+ // only the id differs. Rendering both would show the same number twice under
89
+ // one heading; the first row is the whole fact.
90
+ if (bucket.id === 'third-party') {
91
+ const shared = groups.find((group) => group.id === 'third-party');
92
+ if (shared?.limits.some((row) => isSameReading(row, limit))) continue;
93
+ }
94
+ push(groups, bucket.id, bucket.title, limit);
95
+ }
96
+ return groups;
97
+ }
98
+
99
+ /** Whether two rows describe the same reading of the same bucket. */
100
+ function isSameReading(a: UsageLimitWindow, b: UsageLimitWindow): boolean {
101
+ return a.unit === b.unit
102
+ && a.label === b.label
103
+ && a.usedFraction === b.usedFraction
104
+ && a.remaining === b.remaining
105
+ && a.resetsAt === b.resetsAt;
106
+ }
107
+
108
+ /**
109
+ * The panel's sections for one provider: one group for an ordinary provider,
110
+ * two for Claude (windows + balance), and one per model family for Antigravity.
111
+ */
112
+ export function groupProviderLimits(providerId: string, limits: UsageLimitWindow[]): LimitGroup[] {
113
+ if (limits.length === 0) return [];
114
+ const slug = providerId.trim().toLowerCase();
115
+ if (slug === 'anthropic') return groupClaude(limits);
116
+ if (slug === 'google-antigravity') return groupAntigravity(limits);
117
+ return [{ id: 'all', title: QUOTA_TITLE, limits: [...limits] }];
118
+ }
@@ -0,0 +1,118 @@
1
+ /**
2
+ * @license
3
+ * SPDX-License-Identifier: MIT
4
+ */
5
+
6
+ /**
7
+ * The quota section's two new shapes are asserted on the DOM, not on the
8
+ * grouping helper alone: a correct group list wired to the wrong prop renders
9
+ * one flat "Quota windows" grid, which is exactly the regression this covers.
10
+ */
11
+
12
+ import { afterEach, beforeEach, describe, expect, test } from 'bun:test';
13
+ import { Window } from 'happy-dom';
14
+ import { render } from 'preact';
15
+ import { act } from 'preact/test-utils';
16
+ import { LimitsSection } from '@/client/components/settings/categories/usage-settings/LimitsSection';
17
+ import { installDomGlobals, restoreDomGlobals } from '@/test-support/pristine-globals';
18
+ import type { UsageLimitWindow } from '@/shared/types';
19
+
20
+ let container: HTMLElement;
21
+
22
+ const limit = (id: string, overrides: Partial<UsageLimitWindow> = {}): UsageLimitWindow => ({
23
+ id,
24
+ label: id,
25
+ unit: 'percent',
26
+ status: 'ok',
27
+ ...overrides,
28
+ });
29
+
30
+ function mount(node: preact.ComponentChild): HTMLElement {
31
+ act(() => render(node, container));
32
+ return container;
33
+ }
34
+
35
+ function headings(dom: HTMLElement): string[] {
36
+ return [...dom.querySelectorAll('h4')].map((heading) => heading.textContent ?? '');
37
+ }
38
+
39
+ beforeEach(() => {
40
+ installDomGlobals(new Window());
41
+ container = document.createElement('div');
42
+ document.body.appendChild(container);
43
+ });
44
+
45
+ afterEach(() => {
46
+ act(() => render(null, container));
47
+ container.remove();
48
+ restoreDomGlobals();
49
+ });
50
+
51
+ describe('LimitsSection sections', () => {
52
+ test('Claude draws plan windows and its spend balance as separate sections', () => {
53
+ const dom = mount(
54
+ <LimitsSection
55
+ providerId="anthropic"
56
+ tracked
57
+ limits={[
58
+ limit('anthropic:5h', { label: 'Claude 5 Hour', usedFraction: 0.42 }),
59
+ limit('anthropic:extra', {
60
+ label: 'Claude Extra Usage',
61
+ unit: 'usd',
62
+ used: 4.2,
63
+ limit: 25,
64
+ remaining: 20.8,
65
+ usedFraction: 0.168,
66
+ }),
67
+ ]}
68
+ />,
69
+ );
70
+ expect(headings(dom)).toEqual(['Quota windows', 'Balance']);
71
+ expect(dom.textContent).toContain('Claude Extra Usage');
72
+ expect(dom.textContent).toContain('$4,20');
73
+ expect(dom.textContent).toContain('$20,80');
74
+ });
75
+
76
+ test('Antigravity draws one heading per model family and merges the shared bucket', () => {
77
+ const dom = mount(
78
+ <LimitsSection
79
+ providerId="google-antigravity"
80
+ tracked
81
+ limits={[
82
+ limit('google-antigravity:google:default:weekly', {
83
+ label: 'Gemini',
84
+ windowLabel: 'weekly',
85
+ usedFraction: 0.42,
86
+ }),
87
+ limit('google-antigravity:anthropic:default:5h', {
88
+ label: 'Claude & GPT (shared)',
89
+ usedFraction: 0.71,
90
+ }),
91
+ limit('google-antigravity:openai:default:5h', {
92
+ label: 'Claude & GPT (shared)',
93
+ usedFraction: 0.13,
94
+ }),
95
+ ]}
96
+ />,
97
+ );
98
+ expect(headings(dom)).toEqual(['Google', 'Claude & GPT (shared)']);
99
+ expect(dom.textContent).toContain('Gemini');
100
+ expect(dom.textContent).toContain('weekly');
101
+ // Two rows, one 5h row per third-party family, under ONE heading.
102
+ expect(dom.querySelectorAll('h4')).toHaveLength(2);
103
+ expect(dom.textContent?.match(/Claude & GPT \(shared\)/g)).toHaveLength(3);
104
+ });
105
+
106
+ test('an ordinary provider keeps the single Quota windows section', () => {
107
+ const dom = mount(
108
+ <LimitsSection providerId="openrouter" tracked limits={[limit('openrouter:credits', { unit: 'usd' })]} />,
109
+ );
110
+ expect(headings(dom)).toEqual(['Quota windows']);
111
+ });
112
+
113
+ test('an untracked provider with no rows keeps its explanation', () => {
114
+ const dom = mount(<LimitsSection providerId="kenari" tracked={false} limits={[]} />);
115
+ expect(headings(dom)).toEqual(['Quota windows']);
116
+ expect(dom.textContent).toContain('No quota source for this provider');
117
+ });
118
+ });
@@ -0,0 +1,94 @@
1
+ /**
2
+ * @license
3
+ * SPDX-License-Identifier: MIT
4
+ */
5
+
6
+ /**
7
+ * The assistant run footer's Fork action.
8
+ *
9
+ * The footer already carries a `msgId`, but it is the run's OPENING user row
10
+ * (Retry rewinds there). Forking at that anchor branches BEFORE the answer the
11
+ * button sits under, so the footer's fork has to use the run's owner row. These
12
+ * pin the anchor on both the desktop strip and the phone sheet — the same
13
+ * handler feeds both, and a future call site that passes only `msgId` must not
14
+ * silently fork at the wrong place.
15
+ */
16
+
17
+ import { afterAll, afterEach, beforeEach, describe, expect, test } from 'bun:test';
18
+ import { Window } from 'happy-dom';
19
+ import { h, render } from 'preact';
20
+ import { act } from 'preact/test-utils';
21
+
22
+ import { RunFooter } from '@/client/components/workspace/chat-timeline/RunFooter';
23
+ import { installDomGlobals, restoreDomGlobals } from '@/test-support/pristine-globals';
24
+ import type { ChatMessageData } from '@/shared/types';
25
+
26
+ let container: HTMLElement;
27
+
28
+ beforeEach(() => {
29
+ installDomGlobals(new Window({ url: 'http://localhost' }));
30
+ container = document.body.appendChild(document.createElement('div'));
31
+ });
32
+
33
+ afterEach(() => {
34
+ render(null, container);
35
+ container.remove();
36
+ });
37
+
38
+ afterAll(() => restoreDomGlobals());
39
+
40
+ function mount(node: preact.ComponentChild): HTMLElement {
41
+ act(() => {
42
+ render(node, container);
43
+ });
44
+ return container;
45
+ }
46
+
47
+ const answerRow: ChatMessageData = {
48
+ id: 'ai-7',
49
+ role: 'ai',
50
+ content: 'the answer',
51
+ model: 'gpt-5',
52
+ provider: 'openai',
53
+ };
54
+
55
+ describe('assistant footer fork', () => {
56
+ test('desktop forks at the run owner row, not the Retry anchor', () => {
57
+ const calls: string[] = [];
58
+ const el = mount(h(RunFooter, {
59
+ msg: answerRow,
60
+ retryTargetId: 'user-3',
61
+ onFork: (id) => calls.push(id),
62
+ }));
63
+
64
+ const fork = el.querySelector('button[aria-label="Fork session from this answer"]') as HTMLButtonElement | null;
65
+ expect(fork).not.toBeNull();
66
+ act(() => fork!.click());
67
+
68
+ expect(calls).toEqual(['ai-7']);
69
+ });
70
+
71
+ test('the phone sheet offers the same fork action', () => {
72
+ const calls: string[] = [];
73
+ const el = mount(h(RunFooter, {
74
+ msg: answerRow,
75
+ retryTargetId: 'user-3',
76
+ isMobile: true,
77
+ onFork: (id) => calls.push(id),
78
+ }));
79
+
80
+ act(() => {
81
+ (el.querySelector('button[aria-label="More actions"]') as HTMLButtonElement).click();
82
+ });
83
+ const fork = el.querySelector('button[aria-label="Fork session from this answer"]') as HTMLButtonElement | null;
84
+ expect(fork).not.toBeNull();
85
+ act(() => fork!.click());
86
+
87
+ expect(calls).toEqual(['ai-7']);
88
+ });
89
+
90
+ test('no onFork keeps the strip unchanged', () => {
91
+ const el = mount(h(RunFooter, { msg: answerRow, retryTargetId: 'user-3' }));
92
+ expect(el.querySelector('button[aria-label="Fork session from this answer"]')).toBeNull();
93
+ });
94
+ });
@@ -1,6 +1,6 @@
1
1
  import { useEffect, useState } from 'preact/hooks';
2
2
  import type { ReactNode } from 'preact/compat';
3
- import { Brain, Clock3, Coins, Hourglass, MessageSquarePlus, MoreHorizontal, RotateCcw, X } from 'lucide-preact';
3
+ import { Brain, Clock3, Coins, GitFork, Hourglass, MessageSquarePlus, MoreHorizontal, RotateCcw, X } from 'lucide-preact';
4
4
  import { CopyButton } from '@/client/components/common/CopyButton';
5
5
  import { RunMark } from '@/client/components/workspace/chat-timeline/RunMark';
6
6
  import { PluginMessageActions } from '@/client/components/workspace/chat-timeline/PluginMessageActions';
@@ -33,12 +33,20 @@ interface AiMessageFooterProps {
33
33
  msgId: string;
34
34
  onRetry?: (msgId: string) => void;
35
35
  onNewChat?: (content: string) => void;
36
+ /**
37
+ * Anchor row for Fork. Separate from `msgId`, which Retry resolves to the
38
+ * run's OPENING user row: forking there branches before the answer this
39
+ * footer sits under. The anchor is the run's owner row instead, so the fork
40
+ * keeps the answer.
41
+ */
42
+ forkTargetId?: string;
43
+ onFork?: (msgId: string) => void;
36
44
  isMobile?: boolean;
37
45
  /**
38
- * Whether the row offers Retry / New-chat. Both act on the CHAT (re-run a chat
39
- * turn, branch a chat session from an answer), so a footer that describes a
40
- * row the chat does not own — the BTW panel's side answer — turns them off
41
- * instead of rendering buttons that do nothing.
46
+ * Whether the row offers Retry / Fork / New-chat. All of them act on the
47
+ * CHAT (re-run a chat turn, branch a session from it), so a footer that
48
+ * describes a row the chat does not own — the BTW panel's side answer —
49
+ * turns them off instead of rendering buttons that do nothing.
42
50
  */
43
51
  showActions?: boolean;
44
52
  }
@@ -56,6 +64,8 @@ export function AiMessageFooter({
56
64
  harness,
57
65
  onRetry,
58
66
  onNewChat,
67
+ forkTargetId,
68
+ onFork,
59
69
  isMobile = false,
60
70
  showActions = true,
61
71
  }: AiMessageFooterProps) {
@@ -71,6 +81,11 @@ export function AiMessageFooter({
71
81
  onNewChat?.(content);
72
82
  };
73
83
 
84
+ const handleFork = () => {
85
+ setIsMenuOpen(false);
86
+ if (forkTargetId) onFork?.(forkTargetId);
87
+ };
88
+
74
89
  useEffect(() => {
75
90
  if (!isMenuOpen) return;
76
91
  const handleKeyDown = (event: globalThis.KeyboardEvent) => {
@@ -221,6 +236,12 @@ export function AiMessageFooter({
221
236
  <RotateCcw size={20} className="shrink-0 text-ink/55" />
222
237
  <span>Retry response</span>
223
238
  </button>
239
+ {onFork && forkTargetId && (
240
+ <button type="button" aria-label="Fork session from this answer" onClick={handleFork} className="flex min-h-12 w-full items-center gap-3 rounded-lg px-3 text-left text-sm text-ink transition-colors hover:bg-ink/5 cursor-pointer">
241
+ <GitFork size={20} className="shrink-0 text-ink/55" />
242
+ <span>Fork from this answer</span>
243
+ </button>
244
+ )}
224
245
  <button type="button" aria-label="Start new chat from this answer" onClick={handleNewChat} className="flex min-h-12 w-full items-center gap-3 rounded-lg px-3 text-left text-sm text-ink transition-colors hover:bg-ink/5 cursor-pointer">
225
246
  <MessageSquarePlus size={20} className="shrink-0 text-ink/55" />
226
247
  <span>Start new chat from this answer</span>
@@ -267,6 +288,11 @@ export function AiMessageFooter({
267
288
  ariaLabel="Copy response"
268
289
  emptyTitle="Nothing to copy — this run produced no text"
269
290
  />
291
+ {showActions && onFork && forkTargetId && (
292
+ <button type="button" className="flex items-center hover:text-ink transition-colors p-1 rounded hover:bg-ink/5 cursor-pointer" title="Fork from here" aria-label="Fork session from this answer" onClick={handleFork}>
293
+ <GitFork size={12} />
294
+ </button>
295
+ )}
270
296
  {showActions && (
271
297
  <button type="button" className="flex items-center hover:text-ink transition-colors p-1 rounded hover:bg-ink/5 cursor-pointer" title="New Chat from here" aria-label="Start new chat from this answer" onClick={handleNewChat}>
272
298
  <MessageSquarePlus size={12} />
@@ -1,23 +1,21 @@
1
1
  import type { SetStateAction } from 'preact/compat';
2
- import { Fragment } from 'preact';
3
2
  import { useEffect, useMemo, useRef } from 'preact/hooks';
4
3
  import type { Attachment, ChatMessageData, WorkspaceFolderData } from '@/shared/types';
5
4
  import { ChatInput } from '@/client/components/workspace/chat-timeline/chat-input/index';
6
- import { ChatMessageItem } from '@/client/components/workspace/chat-timeline/MessageItem';
7
- import { RunFooter } from '@/client/components/workspace/chat-timeline/RunFooter';
5
+ import { PendingTranscript } from '@/client/components/workspace/chat-timeline/PendingTranscript';
8
6
  import { ComposerDockFrame } from '@/client/components/workspace/chat-timeline/ComposerDockFrame';
9
7
  import { GeneratingIndicator } from '@/client/components/workspace/chat-timeline/GeneratingIndicator';
10
- import { resolveRunFooters, streamingRowIndex } from '@/shared/lib/chat/timeline/run-footer';
11
8
  import type { ApprovalMode } from '@/shared/lib/omp/config/access-mode';
12
9
  import {
13
- WaitingDependencyPicker,
14
10
  waitingCandidates,
15
11
  type WaitingCandidate,
16
12
  } from '@/client/components/workspace/chat-timeline/chat-input/WaitingDependencyPicker';
17
13
  import { Hourglass } from 'lucide-preact';
18
- import { WorkspacePicker } from '@/client/components/workspace/chat-timeline/target-picker/WorkspacePicker';
19
- import { WorktreePicker } from '@/client/components/workspace/chat-timeline/target-picker/WorktreePicker';
14
+ import { DraftTargetRow } from '@/client/components/workspace/chat-timeline/target-picker/DraftTargetRow';
15
+ import { ParentSessionPicker } from '@/client/components/workspace/chat-timeline/target-picker/ParentSessionPicker';
20
16
  import type { SpawnTarget } from '@/client/hooks/chat/timeline/spawn-target';
17
+ import type { ForkPreview } from '@/client/hooks/chat/timeline/fork-preview';
18
+ import type { ToastTone } from '@/shared/lib/ui/toast-duration';
21
19
 
22
20
  interface EmptyWorkspacePromptProps {
23
21
  className?: string;
@@ -74,8 +72,23 @@ interface EmptyWorkspacePromptProps {
74
72
  */
75
73
  spawnTarget?: SpawnTarget | null;
76
74
  onSpawnTargetChange?: (next: SpawnTarget | null) => void;
75
+ /** The session this chat runs UNDER, or null for a top-level chat. */
76
+ parentSessionId?: string | null;
77
+ onParentSessionChange?: (sessionId: string | null) => void;
78
+ /** "Parent session" for a child, "Fork from" for a fork. */
79
+ branchLabel?: string;
80
+ branchAllowNone?: boolean;
81
+ /**
82
+ * The source transcript this FORK will carry.
83
+ *
84
+ * Present only for a fork that has not been created yet (the branch is built
85
+ * on the first send), so it both draws the history above the composer and
86
+ * marks the view as docked — which is what keeps the branch picker reachable
87
+ * while switching "Fork from".
88
+ */
89
+ branchPreview?: ForkPreview | null;
77
90
  /** Reports a worktree the composer created or failed to create. */
78
- onWorktreeReport?: (message: string) => void;
91
+ onWorktreeReport?: (message: string, tone?: ToastTone) => void;
79
92
  /** The "wait for session" pick, persisted per chat. */
80
93
  waitingFor?: WaitingCandidate | null;
81
94
  onWaitingForChange?: (candidate: WaitingCandidate | null) => void;
@@ -126,6 +139,11 @@ export function EmptyWorkspacePrompt({
126
139
  titleForSession,
127
140
  spawnTarget = null,
128
141
  onSpawnTargetChange,
142
+ parentSessionId = null,
143
+ onParentSessionChange,
144
+ branchLabel,
145
+ branchAllowNone,
146
+ branchPreview = null,
129
147
  onWorktreeReport,
130
148
  waitingFor = null,
131
149
  onWaitingForChange,
@@ -144,21 +162,16 @@ export function EmptyWorkspacePrompt({
144
162
  [folders, streamStatusMap, titleForSession],
145
163
  );
146
164
 
147
- // Run footers are boundary rows: emitted after the run's last row, so a
148
- // trailing notice never separates the footer from the next user message.
149
- const { streamingIdx, footers } = useMemo(
150
- () => ({
151
- streamingIdx: streamingRowIndex(messages),
152
- footers: resolveRunFooters(messages, isGenerating),
153
- }),
154
- [messages, isGenerating],
155
- );
165
+ // The rows the fork will carry, above the composer. A fork is composed on an
166
+ // empty `new-…` chat, so without this the operator chose the branch's first
167
+ // turn with none of the history it continues in sight.
168
+ const previewLength = branchPreview?.messages.length ?? 0;
156
169
 
157
170
  useEffect(() => {
158
171
  if (timelineRef.current) {
159
172
  timelineRef.current.scrollTop = timelineRef.current.scrollHeight;
160
173
  }
161
- }, [messages.length]);
174
+ }, [messages.length, previewLength]);
162
175
 
163
176
  const isMobile = variant === 'mobile';
164
177
  // A chat with rows to show (or a prompt in flight) draws the SAME dock the
@@ -168,7 +181,11 @@ export function EmptyWorkspacePrompt({
168
181
  // pane's bottom) than once the run streamed in the real timeline
169
182
  // (`Thinking…`, 113px). The row jumped at the moment the chat was adopted,
170
183
  // which read as two different indicators.
171
- const docked = messages.length > 0 || isGenerating;
184
+ //
185
+ // A fork's preview docks from the FIRST frame, with or without rows: the
186
+ // "Fork from" picker must stay reachable while the source is being changed,
187
+ // and it lives in the docked branch.
188
+ const docked = messages.length > 0 || isGenerating || Boolean(branchPreview);
172
189
 
173
190
  const heldPrompt = heldWait ? (
174
191
  <div className="flex items-center gap-2 rounded-lg border border-ink/15 bg-ink/[0.03] px-3 py-2 text-xs text-ink/70">
@@ -216,8 +233,9 @@ export function EmptyWorkspacePrompt({
216
233
  variant={variant}
217
234
  expandable
218
235
  // A brand-new chat has no turns: the `stage` composer style draws its
219
- // wider, taller card here and nowhere else.
220
- hero={messages.length === 0}
236
+ // wider, taller card here and nowhere else. A fork's preview is history,
237
+ // so its composer docks like any chat that already has rows.
238
+ hero={messages.length === 0 && previewLength === 0}
221
239
  />
222
240
  );
223
241
 
@@ -228,6 +246,21 @@ export function EmptyWorkspacePrompt({
228
246
  >
229
247
  {docked ? (
230
248
  <>
249
+ {/* A fork is composed, not created: the source it branches from is
250
+ still switchable, so its picker stays above the transcript the
251
+ preview draws. Every other pending chat loses the row once docked
252
+ because its first send already dispatched the spawn. */}
253
+ {branchPreview && onParentSessionChange && (
254
+ <div className={`shrink-0 flex items-center gap-1 flex-wrap ${isMobile ? 'pl-4 pr-3 pt-3' : 'px-4 pt-3'}`}>
255
+ <ParentSessionPicker
256
+ folders={folders as WorkspaceFolderData[]}
257
+ value={parentSessionId}
258
+ onChange={onParentSessionChange}
259
+ label={branchLabel ?? 'Fork from'}
260
+ allowNone={branchAllowNone ?? false}
261
+ />
262
+ </div>
263
+ )}
231
264
  {/* The pending transcript reserves the box the real timeline's own
232
265
  scroller does (`TimelineBody`), so adoption moves no text either. */}
233
266
  <div
@@ -236,42 +269,21 @@ export function EmptyWorkspacePrompt({
236
269
  isMobile ? 'pl-4 pr-3 py-3 pb-8' : 'p-4 pb-10'
237
270
  }`}
238
271
  >
239
- <div className="chat-column">
240
- {messages.map((msg, idx) => {
241
- const prev = messages[idx - 1];
242
- const isLoading = isGenerating && idx === streamingIdx && msg.role === 'ai';
243
- const isAiFragment = msg.role !== 'user' && prev && prev.role !== 'user';
244
- const footer = footers[idx];
245
- return (
246
- <Fragment key={msg.id}>
247
- <ChatMessageItem
248
- msg={msg}
249
- isStreaming={isLoading}
250
- onUndo={onUndo}
251
- onNewChat={onNewChat}
252
- isMobile={isMobile}
253
- className={isAiFragment ? 'mt-1' : 'mt-8'}
254
- />
255
- {footer && (
256
- <RunFooter
257
- msg={footer.msg}
258
- provider={provider}
259
- providerNames={providerNames}
260
- modelName={modelName}
261
- modelNames={modelNames}
262
- thinkingLevel={sessionThinkingLevel ?? undefined}
263
- {...(harness ? { harness } : {})}
264
- durationMs={footer.durationMs}
265
- answerText={footer.answerText}
266
- retryTargetId={footer.runUserId}
267
- onRetry={onRetry}
268
- onNewChat={onNewChat}
269
- />
270
- )}
271
- </Fragment>
272
- );
273
- })}
274
- </div>
272
+ <PendingTranscript
273
+ messages={messages}
274
+ preview={branchPreview}
275
+ isGenerating={isGenerating}
276
+ isMobile={isMobile}
277
+ {...(provider ? { provider } : {})}
278
+ {...(providerNames ? { providerNames } : {})}
279
+ {...(modelName ? { modelName } : {})}
280
+ {...(modelNames ? { modelNames } : {})}
281
+ sessionThinkingLevel={sessionThinkingLevel}
282
+ {...(harness ? { harness } : {})}
283
+ {...(onUndo ? { onUndo } : {})}
284
+ {...(onRetry ? { onRetry } : {})}
285
+ {...(onNewChat ? { onNewChat } : {})}
286
+ />
275
287
  </div>
276
288
 
277
289
  {/* One frame with the real dock (`ComposerDock`), so the indicator and
@@ -295,42 +307,23 @@ export function EmptyWorkspacePrompt({
295
307
  {/* Workspace Selection Seamless Dropdown (No border, transparent
296
308
  background). A chat with rows keeps its target and drops the
297
309
  picker; this branch is only the chat that has not started. */}
298
- <div className="flex items-center gap-1 flex-wrap">
299
- {/* Two controls, because they answer two questions: the workspace
300
- (which project) and the worktree (which checkout of it). The
301
- worktree control draws itself only for a git repository, and it
302
- reads its list on mount because its own trigger names the branch
303
- the project root holds. */}
304
- <WorkspacePicker
305
- folders={folders as WorkspaceFolderData[]}
306
- selectedFolderId={selectedFolderId}
307
- setSelectedFolderId={setSelectedFolderId}
308
- onClearWorktree={() => onSpawnTargetChange?.(null)}
309
- />
310
- {onSpawnTargetChange && (
311
- <WorktreePicker
312
- folders={folders as WorkspaceFolderData[]}
313
- selectedFolderId={selectedFolderId}
314
- target={spawnTarget}
315
- setTarget={onSpawnTargetChange}
316
- onReport={onWorktreeReport}
317
- />
318
- )}
319
- {/* The wait picker sits BESIDE the workspace picker, because both
320
- answer the same question about the chat that has not started:
321
- where it runs, and what it waits for. It only appears while
322
- there is something to wait for (or a pick already made). */}
323
- {onWaitingForChange && (waitingFor || candidates.length > 0) && (
324
- <WaitingDependencyPicker
325
- folders={folders}
326
- streamStatusMap={streamStatusMap}
327
- sessionId={null}
328
- titleFor={titleForSession}
329
- value={waitingFor}
330
- onChange={onWaitingForChange}
331
- />
332
- )}
333
- </div>
310
+ <DraftTargetRow
311
+ folders={folders as WorkspaceFolderData[]}
312
+ selectedFolderId={selectedFolderId}
313
+ setSelectedFolderId={setSelectedFolderId}
314
+ spawnTarget={spawnTarget}
315
+ onSpawnTargetChange={onSpawnTargetChange}
316
+ onWorktreeReport={onWorktreeReport}
317
+ parentSessionId={parentSessionId}
318
+ onParentSessionChange={onParentSessionChange}
319
+ branchLabel={branchLabel}
320
+ branchAllowNone={branchAllowNone}
321
+ waitingFor={waitingFor}
322
+ onWaitingForChange={onWaitingForChange}
323
+ streamStatusMap={streamStatusMap}
324
+ titleForSession={titleForSession}
325
+ candidates={candidates}
326
+ />
334
327
  {/* A held prompt owns this chat until it is released: there is no
335
328
  session to send a second prompt to, and a composer that looked live
336
329
  would accept one that could not be delivered. */}