@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.
- package/dist/client/index.html +1 -1
- package/dist/client/index.js +448 -444
- package/dist/client/static/js/index-32rpkj6b.css +1 -0
- package/dist/client/static/js/{index-ga8cbpt4.js → index-e3qh2yps.js} +950 -950
- package/package.json +1 -1
- package/src/client/components/common/Toast.test.tsx +28 -2
- package/src/client/components/common/Toast.tsx +21 -9
- package/src/client/components/common/session-actions-menu/index.tsx +38 -12
- package/src/client/components/common/session-branch/BranchGuides.tsx +93 -0
- package/src/client/components/common/session-branch/SubagentRow.tsx +77 -0
- package/src/client/components/common/session-branch/index.tsx +169 -0
- package/src/client/components/common/session-branch/session-branch.test.tsx +240 -0
- package/src/client/components/common/session-branch/style.ts +29 -0
- package/src/client/components/common/session-row/StatusSlot.tsx +15 -3
- package/src/client/components/common/session-row/index.tsx +24 -25
- package/src/client/components/common/session-row/session-row.test.tsx +11 -0
- package/src/client/components/common/session-state-provider/index.tsx +1 -1
- package/src/client/components/layout/desktop-layout/LeftColumn.tsx +2 -1
- package/src/client/components/layout/session-sidebar/CategoryItem.tsx +66 -69
- package/src/client/components/layout/session-sidebar/SessionItem.batch.test.ts +3 -3
- package/src/client/components/layout/session-sidebar/SessionItem.test.ts +25 -2
- package/src/client/components/layout/session-sidebar/SessionItem.tsx +33 -30
- package/src/client/components/layout/session-sidebar/SessionList.tsx +2 -1
- package/src/client/components/layout/session-sidebar/about-modal/HarnessRow.tsx +261 -0
- package/src/client/components/layout/session-sidebar/about-modal/HarnessTable.tsx +35 -225
- package/src/client/components/layout/session-sidebar/about-modal/HarnessTableLog.test.tsx +36 -16
- package/src/client/components/layout/session-sidebar/about-modal/UpdateLogDialog.tsx +11 -3
- package/src/client/components/layout/session-sidebar/about-modal/UpdateLogLine.tsx +13 -4
- package/src/client/components/layout/session-sidebar/about-modal/UpdateSection.tsx +3 -2
- package/src/client/components/layout/session-sidebar/about-modal/index.tsx +30 -14
- package/src/client/components/layout/session-sidebar/modern/RevealRow.tsx +56 -0
- package/src/client/components/layout/session-sidebar/modern/WorkspaceSection.tsx +69 -85
- package/src/client/components/layout/session-sidebar/modern/reveal-row.test.tsx +104 -0
- package/src/client/components/layout/session-sidebar/scheduler-modal/index.tsx +2 -1
- package/src/client/components/layout/session-sidebar/variant-props.ts +2 -1
- package/src/client/components/mobile/SessionSidebar.tsx +2 -1
- package/src/client/components/mobile/mobile-session-sidebar/ClassicDrawer.tsx +2 -1
- package/src/client/components/mobile/mobile-session-sidebar/Item.tsx +59 -62
- package/src/client/components/mobile/mobile-session-sidebar/List.tsx +2 -1
- package/src/client/components/mobile/mobile-session-sidebar/SessionRow.test.ts +5 -0
- package/src/client/components/mobile/mobile-session-sidebar/SessionRow.tsx +33 -30
- package/src/client/components/settings/Modal.tsx +1 -1
- package/src/client/components/settings/Sidebar.tsx +1 -1
- package/src/client/components/settings/categories/NotificationSettings.test.tsx +92 -0
- package/src/client/components/settings/categories/NotificationSettings.tsx +112 -2
- package/src/client/components/settings/categories/harness-settings/HarnessCard.tsx +1 -1
- package/src/client/components/settings/categories/project-settings/WorktreeSettings.tsx +2 -1
- package/src/client/components/settings/categories/usage-settings/LimitsSection.tsx +39 -19
- package/src/client/components/settings/categories/usage-settings/ProviderDetail.tsx +1 -0
- package/src/client/components/settings/categories/usage-settings/limit-groups.test.ts +94 -0
- package/src/client/components/settings/categories/usage-settings/limit-groups.ts +118 -0
- package/src/client/components/settings/categories/usage-settings/limits-section.test.tsx +118 -0
- package/src/client/components/workspace/chat-timeline/AiMessageFooter.fork.test.ts +94 -0
- package/src/client/components/workspace/chat-timeline/AiMessageFooter.tsx +31 -5
- package/src/client/components/workspace/chat-timeline/EmptyWorkspacePrompt.tsx +86 -93
- package/src/client/components/workspace/chat-timeline/MessageList.tsx +7 -5
- package/src/client/components/workspace/chat-timeline/PendingChatView.tsx +21 -1
- package/src/client/components/workspace/chat-timeline/PendingTranscript.tsx +130 -0
- package/src/client/components/workspace/chat-timeline/RunFooter.tsx +12 -3
- package/src/client/components/workspace/chat-timeline/chat-input/AttachmentToolbar.tsx +2 -0
- package/src/client/components/workspace/chat-timeline/chat-input/ModeToggles.tsx +15 -1
- package/src/client/components/workspace/chat-timeline/chat-input/SessionModeDropdown.test.tsx +85 -0
- package/src/client/components/workspace/chat-timeline/chat-input/SessionModeDropdown.tsx +84 -0
- package/src/client/components/workspace/chat-timeline/chat-input/Toolbar.tsx +2 -0
- package/src/client/components/workspace/chat-timeline/chat-input/modes-props.ts +5 -0
- package/src/client/components/workspace/chat-timeline/fork-preview.test.tsx +141 -0
- package/src/client/components/workspace/chat-timeline/index.tsx +16 -22
- package/src/client/components/workspace/chat-timeline/target-picker/DraftTargetRow.tsx +116 -0
- package/src/client/components/workspace/chat-timeline/target-picker/ParentSessionPicker.tsx +173 -0
- package/src/client/components/workspace/chat-timeline/target-picker/WorktreePicker.tsx +5 -4
- package/src/client/components/workspace/chat-timeline/target-picker/parent-session-options.test.ts +49 -0
- package/src/client/components/workspace/git-panel/index.tsx +2 -2
- package/src/client/components/workspace/terminal-panel/RealtimeTerminalView.tsx +8 -5
- package/src/client/components/workspace/terminal-panel/index.tsx +3 -0
- package/src/client/hooks/chat/composer/items.test.ts +19 -0
- package/src/client/hooks/chat/omp/folder-auto-expand.ts +1 -1
- package/src/client/hooks/chat/omp/pending-adoption.ts +51 -0
- package/src/client/hooks/chat/omp/pending-child.test.ts +73 -0
- package/src/client/hooks/chat/omp/pending-entry.ts +59 -0
- package/src/client/hooks/chat/omp/pending-rows.ts +6 -2
- package/src/client/hooks/chat/omp/pending-sessions.test.ts +1 -2
- package/src/client/hooks/chat/omp/pending-sessions.ts +45 -69
- package/src/client/hooks/chat/omp/pending-waiting.ts +1 -1
- package/src/client/hooks/chat/omp/run-switch.ts +1 -1
- package/src/client/hooks/chat/omp/session-list.tsx +9 -0
- package/src/client/hooks/chat/omp/sidebar-reload.test.ts +85 -0
- package/src/client/hooks/chat/omp/sidebar-reload.ts +30 -0
- package/src/client/hooks/chat/subagents/roster.ts +122 -0
- package/src/client/hooks/chat/timeline/child-spawn.test.ts +55 -0
- package/src/client/hooks/chat/timeline/child-spawn.ts +45 -0
- package/src/client/hooks/chat/timeline/fork-preview.test.ts +148 -0
- package/src/client/hooks/chat/timeline/fork-preview.ts +104 -0
- package/src/client/hooks/chat/timeline/fork-request.test.ts +54 -0
- package/src/client/hooks/chat/timeline/fork-request.ts +43 -0
- package/src/client/hooks/chat/timeline/fork-send.test.ts +139 -0
- package/src/client/hooks/chat/timeline/mode-availability.test.ts +1 -1
- package/src/client/hooks/chat/timeline/mode-availability.ts +33 -0
- package/src/client/hooks/chat/timeline/mode-markers.ts +7 -1
- package/src/client/hooks/chat/timeline/mode-post.ts +15 -3
- package/src/client/hooks/chat/timeline/modes-contract.ts +9 -4
- package/src/client/hooks/chat/timeline/modes.test.ts +56 -18
- package/src/client/hooks/chat/timeline/modes.ts +42 -29
- package/src/client/hooks/chat/timeline/pending-branch.ts +214 -0
- package/src/client/hooks/chat/timeline/pending-dispatch.ts +302 -0
- package/src/client/hooks/chat/timeline/send.ts +17 -103
- package/src/client/hooks/chat/timeline/session-harness.ts +6 -0
- package/src/client/hooks/chat/timeline/stop-with-queue.ts +42 -0
- package/src/client/hooks/chat/timeline/use-fork-session.ts +40 -31
- package/src/client/hooks/chat/waiting/cancel.ts +2 -1
- package/src/client/hooks/chat/waiting/dispatch.ts +5 -4
- package/src/client/hooks/chat/waiting/held.ts +2 -1
- package/src/client/hooks/models/use-harness-update.test.ts +137 -44
- package/src/client/hooks/models/use-harness-update.ts +133 -85
- package/src/client/hooks/settings/providers/actions.ts +3 -2
- package/src/client/hooks/settings/providers/messages.ts +9 -7
- package/src/client/hooks/settings/providers/model-actions.ts +2 -1
- package/src/client/hooks/ui/editor-error-toast.ts +2 -1
- package/src/client/hooks/ui/input-required-alert.ts +12 -5
- package/src/client/hooks/ui/notifications.ts +45 -0
- package/src/client/hooks/ui/run-outcome-alert.ts +48 -0
- package/src/client/hooks/workspace/batch-archive.test.ts +2 -2
- package/src/client/hooks/workspace/batch-archive.ts +4 -2
- package/src/client/hooks/workspace/expanded-sessions.ts +36 -7
- package/src/client/hooks/workspace/git-action-outcome.ts +4 -3
- package/src/client/hooks/workspace/navbar-session-actions.ts +2 -1
- package/src/client/hooks/workspace/session-actions.test.ts +2 -1
- package/src/client/hooks/workspace/session-actions.ts +2 -1
- package/src/client/hooks/workspace/terminal/connection.test.ts +63 -0
- package/src/client/hooks/workspace/terminal/connection.ts +47 -0
- package/src/client/hooks/workspace/terminal/index.ts +35 -4
- package/src/client/hooks/workspace/workspace-folder-actions.ts +2 -1
- package/src/client/lib/native/open-session.ts +33 -0
- package/src/client/lib/notifications/os.test.ts +125 -0
- package/src/client/lib/notifications/os.ts +130 -0
- package/src/client/lib/plugins/sidebar-bridge.ts +2 -20
- package/src/client/lib/router/open-session.test.ts +75 -0
- package/src/client/lib/router/open-session.ts +34 -0
- package/src/client/lib/signals.ts +5 -1
- package/src/client/main.tsx +6 -0
- package/src/server/lib/db/schema.ts +1 -0
- package/src/server/lib/harness/acp/calls.ts +15 -1
- package/src/server/lib/harness/acp/client-capabilities.test.ts +55 -0
- package/src/server/lib/harness/acp/client-capabilities.ts +61 -0
- package/src/server/lib/harness/acp/client-fs.test.ts +135 -0
- package/src/server/lib/harness/acp/client-fs.ts +131 -0
- package/src/server/lib/harness/acp/client-initialize.test.ts +70 -0
- package/src/server/lib/harness/acp/client-initialize.ts +84 -0
- package/src/server/lib/harness/acp/client.ts +31 -21
- package/src/server/lib/harness/acp/commands.test.ts +5 -5
- package/src/server/lib/harness/acp/commands.ts +14 -2
- package/src/server/lib/harness/acp/frames-timing.test.ts +68 -0
- package/src/server/lib/harness/acp/frames-v2.test.ts +85 -0
- package/src/server/lib/harness/acp/frames.ts +71 -158
- package/src/server/lib/harness/acp/mapper.test.ts +40 -0
- package/src/server/lib/harness/acp/mapper.ts +12 -0
- package/src/server/lib/harness/acp/permissions.ts +6 -0
- package/src/server/lib/harness/acp/protocol.ts +41 -2
- package/src/server/lib/harness/acp/session-facts.ts +1 -1
- package/src/server/lib/harness/acp/session-handshake.test.ts +90 -1
- package/src/server/lib/harness/acp/session-handshake.ts +83 -6
- package/src/server/lib/harness/acp/session-idle.ts +7 -6
- package/src/server/lib/harness/acp/session-notifications.ts +41 -2
- package/src/server/lib/harness/acp/session-observers.test.ts +63 -0
- package/src/server/lib/harness/acp/session-permissions.test.ts +29 -0
- package/src/server/lib/harness/acp/session-permissions.ts +36 -0
- package/src/server/lib/harness/acp/session-requests.test.ts +92 -0
- package/src/server/lib/harness/acp/session-requests.ts +48 -6
- package/src/server/lib/harness/acp/session-turns.ts +8 -3
- package/src/server/lib/harness/acp/session-usage.ts +4 -0
- package/src/server/lib/harness/acp/session-web-state.ts +30 -2
- package/src/server/lib/harness/acp/session.test-util.ts +19 -1
- package/src/server/lib/harness/acp/session.ts +60 -60
- package/src/server/lib/harness/acp/tool-calls.ts +223 -0
- package/src/server/lib/harness/acp/turn.test.ts +102 -0
- package/src/server/lib/harness/acp/turn.ts +81 -6
- package/src/server/lib/harness/acp/v2.test.ts +144 -0
- package/src/server/lib/harness/acp/v2.ts +220 -0
- package/src/server/lib/harness/acp/verbs.ts +46 -6
- package/src/server/lib/harness/launch.test.ts +25 -0
- package/src/server/lib/harness/launch.ts +21 -9
- package/src/server/lib/harness/session.ts +3 -0
- package/src/server/lib/harness/update-job-store.test.ts +37 -12
- package/src/server/lib/harness/update-job-store.ts +22 -16
- package/src/server/lib/harness/update-job.server.ts +66 -175
- package/src/server/lib/harness/update-queue.server.ts +292 -0
- package/src/server/lib/harness/update-queue.test.ts +265 -0
- package/src/server/lib/harness/update-spawn.server.ts +96 -0
- package/src/server/lib/harness/update-worker.ts +8 -3
- package/src/server/lib/lifecycle/after-listen.ts +9 -0
- package/src/server/lib/lifecycle/paths.ts +14 -9
- package/src/server/lib/omp/rpc/run-settle.server.ts +10 -1
- package/src/server/lib/omp/rpc/subagent-liveness.ts +5 -5
- package/src/server/lib/omp/rpc/terminal-settle.ts +5 -1
- package/src/server/lib/omp/session/delete-flow.server.ts +1 -0
- package/src/server/lib/omp/session/sidebar-data.server.ts +10 -12
- package/src/server/lib/sessions/fork.server.test.ts +68 -0
- package/src/server/lib/sessions/fork.server.ts +31 -6
- package/src/server/lib/sessions/spawn.server.test.ts +41 -0
- package/src/server/lib/sessions/spawn.server.ts +27 -2
- package/src/server/lib/usage/report.server.ts +57 -0
- package/src/server/routes/agent/harness-command.ts +6 -5
- package/src/server/routes/chat/stream.ts +7 -2
- package/src/server/routes/harness/update-status.ts +18 -12
- package/src/server/routes/harness/update.test.ts +53 -16
- package/src/server/routes/harness/update.ts +13 -8
- package/src/server/routes/sessions/body-readers.ts +43 -0
- package/src/server/routes/sessions/fork.ts +19 -4
- package/src/server/routes/sessions/routes.test.ts +1 -2
- package/src/server/routes/sessions/session.ts +19 -0
- package/src/server/routes/sessions/spawn.ts +16 -13
- package/src/shared/lib/chat/omp/agent-events.ts +11 -0
- package/src/shared/lib/chat/omp/session-modes-signal.test.ts +41 -0
- package/src/shared/lib/chat/timeline/fork-preview.test.ts +62 -0
- package/src/shared/lib/chat/timeline/fork-preview.ts +36 -0
- package/src/shared/lib/harness/mode-signal.ts +20 -0
- package/src/shared/lib/harness/session-modes.ts +24 -0
- package/src/shared/lib/harness/update-job.ts +53 -6
- package/src/shared/lib/icons/tint-hues.generated.ts +34 -34
- package/src/shared/lib/notifications/outcomes.test.ts +96 -0
- package/src/shared/lib/notifications/outcomes.ts +64 -0
- package/src/shared/lib/notifications/settings.test.ts +49 -0
- package/src/shared/lib/notifications/settings.ts +34 -0
- package/src/shared/lib/omp/session/default-title.ts +5 -4
- package/src/shared/lib/omp/session/prewarm-misc.test.ts +3 -2
- package/src/shared/lib/omp/session/schema-migrations.ts +4 -0
- package/src/shared/lib/omp/session/stream-state.server.test.ts +19 -0
- package/src/shared/lib/omp/session/stream-state.server.ts +24 -4
- package/src/shared/lib/settings/defaults.ts +3 -0
- package/src/shared/lib/ui/toast-duration.test.ts +25 -1
- package/src/shared/lib/ui/toast-duration.ts +22 -4
- package/src/shared/lib/workspace/session-state/store.ts +4 -0
- package/src/shared/types/harness-update.ts +24 -0
- package/src/shared/types/realtime.ts +2 -0
- package/src/shared/types/settings/state.ts +10 -0
- package/src/shared/types/workspace.ts +4 -0
- package/src/test-support/harness-table.test-util.ts +25 -9
- package/dist/client/static/js/index-bc9aa4mx.css +0 -1
- package/src/client/components/common/session-actions-menu/NewChildSessionDialog.tsx +0 -113
- package/src/client/components/common/subagent-list/index.tsx +0 -165
- package/src/client/components/layout/session-sidebar/ChildSessionList.tsx +0 -66
- 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.
|
|
39
|
-
* turn, branch a
|
|
40
|
-
* row the chat does not own — the BTW panel's side answer —
|
|
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 {
|
|
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 {
|
|
19
|
-
import {
|
|
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
|
-
//
|
|
148
|
-
//
|
|
149
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
<
|
|
240
|
-
{messages
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
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
|
-
<
|
|
299
|
-
{
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
{
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
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. */}
|