@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
|
@@ -26,15 +26,18 @@
|
|
|
26
26
|
* A row is a LINK first: clicking it opens that harness's settings page. Editing
|
|
27
27
|
* lives there; About is where you learn which page to open and whether anything
|
|
28
28
|
* needs doing first.
|
|
29
|
+
*
|
|
30
|
+
* The mark*up* of one row lives in `HarnessRow.tsx`; this file owns the heading,
|
|
31
|
+
* the tally, and the list. It also owns the one handler a press goes through, so
|
|
32
|
+
* a refusal is shown under the row it belongs to and never under a neighbour.
|
|
29
33
|
*/
|
|
30
34
|
|
|
31
35
|
import { useState } from 'preact/hooks';
|
|
32
|
-
import {
|
|
33
|
-
import {
|
|
34
|
-
import { UpdateLogLine } from '@/client/components/layout/session-sidebar/about-modal/UpdateLogLine';
|
|
35
|
-
import { harnessStatus, type HarnessState } from '@/shared/lib/harness/status';
|
|
36
|
+
import { HarnessRow } from '@/client/components/layout/session-sidebar/about-modal/HarnessRow';
|
|
37
|
+
import { harnessStatus } from '@/shared/lib/harness/status';
|
|
36
38
|
import { harnessCategoryId } from '@/shared/lib/harness/menu';
|
|
37
39
|
import type { HarnessSummary } from '@/shared/types/harness';
|
|
40
|
+
import type { HarnessUpdateJob } from '@/shared/types/harness-update';
|
|
38
41
|
import type { HarnessVersionRow } from '@/shared/types/harness-version';
|
|
39
42
|
|
|
40
43
|
interface HarnessTableProps {
|
|
@@ -43,71 +46,33 @@ interface HarnessTableProps {
|
|
|
43
46
|
loading?: boolean;
|
|
44
47
|
onOpenHarness: (id: string) => void;
|
|
45
48
|
/** Starts one harness's update as a background job and follows it; resolves
|
|
46
|
-
* to a refusal (a busy server, an unknown harness), or null when it began
|
|
49
|
+
* to a refusal (a busy server, an unknown harness), or null when it began —
|
|
50
|
+
* immediately, or queued behind the install already running. */
|
|
47
51
|
onUpdate: (id: string) => Promise<string | null>;
|
|
48
|
-
/** Which harness is mid-update, and the step it is on (an adapter install,
|
|
49
|
-
* `claude update`, …). The step comes from the background job's record. */
|
|
50
|
-
updating: string | null;
|
|
51
|
-
progress?: string | null;
|
|
52
52
|
/**
|
|
53
|
-
* The last update record
|
|
53
|
+
* The last known update record PER HARNESS: waiting its turn, installing, or
|
|
54
|
+
* the run that settled.
|
|
54
55
|
*
|
|
55
|
-
*
|
|
56
|
-
*
|
|
57
|
-
* once the run has settled, because a failure is exactly when the output is
|
|
58
|
-
* worth reading.
|
|
56
|
+
* Per harness, not one: two presses are two records, and a row may only ever
|
|
57
|
+
* show its own run (`jobQueued`, `jobRunning`, `runningStepOf`).
|
|
59
58
|
*/
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
if (state === 'ready') return <span aria-hidden="true" className="h-1.5 w-1.5 rounded-full bg-success" />;
|
|
67
|
-
if (state === 'not-installed') return <span aria-hidden="true" className="h-1.5 w-1.5 rounded-full border border-ink/35" />;
|
|
68
|
-
if (state === 'needs-setup') return <span aria-hidden="true" className="h-1.5 w-1.5 rounded-full bg-ink/45" />;
|
|
69
|
-
return <span aria-hidden="true" className="h-1.5 w-1.5 rounded-full bg-ink/15" />;
|
|
59
|
+
jobs?: HarnessUpdateJob[];
|
|
60
|
+
/**
|
|
61
|
+
* Opens the log of ONE harness's record. It takes the id because there can be
|
|
62
|
+
* a waiting run and an installing one at the same time; the row names its own.
|
|
63
|
+
*/
|
|
64
|
+
onOpenLog?: (harness: string) => void;
|
|
70
65
|
}
|
|
71
66
|
|
|
72
|
-
/**
|
|
73
|
-
* The three-column grid every data row uses.
|
|
74
|
-
*
|
|
75
|
-
* The widths are the point, and every earlier guess was wrong:
|
|
76
|
-
*
|
|
77
|
-
* - the ACTION column held `7rem` for a single icon, stealing space from the
|
|
78
|
-
* version cell — so `0.100.0 → 0.101.0` truncated while the action cell sat
|
|
79
|
-
* mostly empty. It is `1.75rem` now: one 24px button and nothing else.
|
|
80
|
-
* - the VERSION column held `7.5rem` (120px), which clipped the widest thing
|
|
81
|
-
* it ever holds — an adapter's `adapter 0.100.0 → 0.101.0` line, measured at
|
|
82
|
-
* 151px in this face. It is `9.5rem` (152px), the content's own width.
|
|
83
|
-
* - on a PHONE it is `7rem`: the About card is 512px at most, and the 152px
|
|
84
|
-
* track left the agent's own name ~130px, so `command-code` and
|
|
85
|
-
* `deepseek-harness` were the cells that truncated while the name is the one
|
|
86
|
-
* thing a reader is scanning for. The version line ellipsizes instead, and
|
|
87
|
-
* carries its full text in `title`.
|
|
88
|
-
*
|
|
89
|
-
* It stays a FIXED track rather than `auto`: every row is its own grid, so an
|
|
90
|
-
* `auto` track is measured per row and the version numbers stop lining up in a
|
|
91
|
-
* column (measured: a name cell of 352px on one row and 208px on the next).
|
|
92
|
-
*
|
|
93
|
-
* The name takes the slack and ellipsizes. The card's own width is FIXED
|
|
94
|
-
* (`md:w-[880px]`), so the name track cannot collapse the dialog — that only
|
|
95
|
-
* happened while the card was `w-auto`.
|
|
96
|
-
*
|
|
97
|
-
* `items-start`, not `items-center`: each cell holds two lines whose heights
|
|
98
|
-
* differ from row to row (a version cell is 16px alone and 31px with an
|
|
99
|
-
* `adapter …` line under it), and centering measured the number 7.5px BELOW the
|
|
100
|
-
* name it belongs to. Top-aligned, line one of every cell shares one baseline.
|
|
101
|
-
*/
|
|
102
|
-
const COLUMNS = 'grid grid-cols-[minmax(0,1fr)_7rem_1.75rem] items-start gap-x-2 md:grid-cols-[minmax(0,1fr)_9.5rem_1.75rem]';
|
|
103
|
-
|
|
104
67
|
export function HarnessTable({
|
|
105
|
-
harnesses, versions, loading = false, onOpenHarness, onUpdate,
|
|
106
|
-
|
|
68
|
+
harnesses, versions, loading = false, onOpenHarness, onUpdate, jobs = [],
|
|
69
|
+
onOpenLog,
|
|
107
70
|
}: HarnessTableProps) {
|
|
108
71
|
const [problem, setProblem] = useState<{ id: string; message: string } | null>(null);
|
|
109
72
|
|
|
110
73
|
const byId = new Map(versions.map((row) => [row.id, row]));
|
|
74
|
+
// ONE record per harness: the row renders its own run, never a neighbour's.
|
|
75
|
+
const jobById = new Map(jobs.map((job) => [job.harness, job]));
|
|
111
76
|
// The built-in transport is the default every discovered session runs on, with
|
|
112
77
|
// nothing to install, probe or update; listing it would inflate the count with
|
|
113
78
|
// the one entry nobody has to decide about.
|
|
@@ -162,175 +127,20 @@ export function HarnessTable({
|
|
|
162
127
|
// scrollers, and the inner one had no reason to exist. The About panel's
|
|
163
128
|
// own body is the single scroller now, so the list simply grows.
|
|
164
129
|
<div data-harness-rows="" className="grid grid-cols-1 gap-x-6 md:grid-cols-2">
|
|
165
|
-
{entries.map((entry) =>
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
// A CLI part EXISTS for every adapter even when its `--version` could
|
|
178
|
-
// not be read (the binary is absent, or its launcher is broken). Taking
|
|
179
|
-
// that empty part as the lead painted `—` over a known adapter number:
|
|
180
|
-
// measured on `zcode` (adapter 0.82.3 probed, no `zcode` runtime) and
|
|
181
|
-
// `claude` (`claude --version` fails while the adapter answers). The
|
|
182
|
-
// part that HAS a number leads.
|
|
183
|
-
const cli = version?.cli ?? null;
|
|
184
|
-
const agent = version?.agent ?? null;
|
|
185
|
-
const lead = cli?.version ? cli : agent;
|
|
186
|
-
const showAdapterLine = Boolean(
|
|
187
|
-
cli?.version && agent?.version && agent.version !== cli.version,
|
|
188
|
-
);
|
|
189
|
-
// What the press would install, named: an adapter and a CLI are two
|
|
190
|
-
// different products, so the accessible name says which is moving.
|
|
191
|
-
const targets = version
|
|
192
|
-
? [
|
|
193
|
-
version.agent.updateAvailable && version.agent.latest
|
|
194
|
-
? version.cli ? `adapter ${version.agent.latest}` : version.agent.latest
|
|
195
|
-
: null,
|
|
196
|
-
version.cli?.updateAvailable && version.cli.latest
|
|
197
|
-
? `${version.cli.name} ${version.cli.latest}`
|
|
198
|
-
: null,
|
|
199
|
-
].filter((target): target is string => Boolean(target))
|
|
200
|
-
: [];
|
|
201
|
-
const updateLabel = `Update ${entry.label}${targets.length > 0 ? ` to ${targets.join(' + ')}` : ''}`;
|
|
202
|
-
// While the background worker runs, the button names the STEP it is
|
|
203
|
-
// on: one press can be an adapter install and then `claude update`,
|
|
204
|
-
// and "Updating…" alone would hide which half is moving.
|
|
205
|
-
const actionLabel = isUpdating && progress ? `Updating ${entry.label}: ${progress}` : updateLabel;
|
|
206
|
-
return (
|
|
207
|
-
<div key={entry.id} className={`${COLUMNS} border-b border-ink/5 py-1.5`}>
|
|
208
|
-
{/* The name is the link: one target per row, and the row's other
|
|
209
|
-
cells stay selectable text.
|
|
210
|
-
TWO lines per cell, and the same two line boxes on both
|
|
211
|
-
sides: the name and its version share row one (16px), the
|
|
212
|
-
state label and the adapter line share row two (15px). Every
|
|
213
|
-
cell is a flex COLUMN of those two rows, which is what makes
|
|
214
|
-
`ready` sit exactly under `2.1.318` and beside
|
|
215
|
-
`adapter 0.100.0 →` (measured 8px apart when the cells were
|
|
216
|
-
centered independently). */}
|
|
217
|
-
<button
|
|
218
|
-
type="button"
|
|
219
|
-
onClick={() => onOpenHarness(entry.id)}
|
|
220
|
-
title={status.detail ?? undefined}
|
|
221
|
-
aria-label={`${entry.label} — ${status.label}. Open its settings.`}
|
|
222
|
-
className="flex min-w-0 cursor-pointer items-start gap-1.5 text-left"
|
|
223
|
-
>
|
|
224
|
-
{/* The glyph rides the FIRST row, not the middle of the pair:
|
|
225
|
-
centered on both rows it landed between the name and the
|
|
226
|
-
state label. */}
|
|
227
|
-
<span className="flex h-4 shrink-0 items-center">
|
|
228
|
-
<HarnessGlyph harness={entry.id} size={HARNESS_GLYPH_SIZE.compact} />
|
|
229
|
-
</span>
|
|
230
|
-
{/* The state mark sits in the label's TOP-RIGHT CORNER, not in
|
|
231
|
-
the flow: as a trailing child it took a column of its own and
|
|
232
|
-
every agent name lost ~14px to a 6px dot. Positioned, the
|
|
233
|
-
label keeps its width and the mark still reads as a status
|
|
234
|
-
light on that name. */}
|
|
235
|
-
<span className="flex min-w-0 flex-1 flex-col">
|
|
236
|
-
{/* The mark sits at the top-right of the NAME ITSELF, so the
|
|
237
|
-
wrapper must HUG the text — a `flex-1` wrapper anchored the
|
|
238
|
-
dot to the column's edge instead, which read as a marker on
|
|
239
|
-
the version beside it. `max-w-full` keeps it on the name and
|
|
240
|
-
still allows the truncation. */}
|
|
241
|
-
<span className="flex max-w-full items-center gap-1.5">
|
|
242
|
-
<span className={`truncate text-[11px] leading-4 ${status.state === 'ready' ? 'font-medium text-ink' : 'text-ink/70'}`}>
|
|
243
|
-
{entry.label}
|
|
244
|
-
</span>
|
|
245
|
-
<StateMark state={status.state} />
|
|
246
|
-
</span>
|
|
247
|
-
<span className="block truncate text-[10px] leading-[15px] text-ink/40">{status.label}</span>
|
|
248
|
-
</span>
|
|
249
|
-
</button>
|
|
250
|
-
|
|
251
|
-
{/* TWO number lines, each with its OWN arrow.
|
|
252
|
-
A harness can be an adapter over a CLI, and the two move
|
|
253
|
-
independently: the row leads with the CLI's `2.1.318` and states
|
|
254
|
-
`adapter 0.101.0` underneath, so `→` may only ever join the two
|
|
255
|
-
numbers on ITS line. Joining `2.1.318` with the adapter's latest
|
|
256
|
-
would compare two different products — the fiction this cell
|
|
257
|
-
exists to prevent. */}
|
|
258
|
-
<span
|
|
259
|
-
className="flex min-w-0 flex-col items-end text-right font-mono text-[11px] leading-4 text-ink/70"
|
|
260
|
-
title={version?.note ?? undefined}
|
|
261
|
-
>
|
|
262
|
-
<span className="block max-w-full truncate">
|
|
263
|
-
{/* The CLI's version leads when the harness is an ADAPTER: it
|
|
264
|
-
is the number a user recognises (`claude --version` →
|
|
265
|
-
2.1.318). */}
|
|
266
|
-
{lead?.version ?? <span className="text-ink/30">—</span>}
|
|
267
|
-
{lead?.updateAvailable && lead.latest && (
|
|
268
|
-
<>
|
|
269
|
-
<span aria-hidden="true" className="ml-1 text-ink/35">→</span>
|
|
270
|
-
<span className="ml-1 text-ink">{lead.latest}</span>
|
|
271
|
-
</>
|
|
272
|
-
)}
|
|
273
|
-
</span>
|
|
274
|
-
{/* The adapter's own number and its own move. It lives INSIDE
|
|
275
|
-
the version cell — as a fourth grid child it shifted every
|
|
276
|
-
row one track and moved the action button onto its own line. */}
|
|
277
|
-
{showAdapterLine && version && (
|
|
278
|
-
<span
|
|
279
|
-
className="block max-w-full truncate text-[10px] leading-[15px] text-ink/35"
|
|
280
|
-
title={`${version.cli?.name ?? 'CLI'} ${version.cli?.version ?? 'unknown'} · adapter ${version.agent.version}`}
|
|
281
|
-
>
|
|
282
|
-
adapter {version.agent.version}
|
|
283
|
-
{version.agent.updateAvailable && version.agent.latest
|
|
284
|
-
? ` → ${version.agent.latest}`
|
|
285
|
-
: ''}
|
|
286
|
-
</span>
|
|
287
|
-
)}
|
|
288
|
-
</span>
|
|
289
|
-
|
|
290
|
-
<div className="flex min-w-0 justify-end">
|
|
291
|
-
{/* ICON ONLY, and only when there is something to move to.
|
|
292
|
-
A row with no newer version shows nothing: a permanent action
|
|
293
|
-
button claims work that does not exist. The label lives in
|
|
294
|
-
`title` + `aria-label`, so the meaning is not lost — it is just
|
|
295
|
-
not spent on every row. The icon is a DOWNLOAD arrow because
|
|
296
|
-
that is what the press does; it used to be `ArrowUpRight`, which
|
|
297
|
-
reads as "open this elsewhere". */}
|
|
298
|
-
{version?.updateAvailable ? (
|
|
299
|
-
<button
|
|
300
|
-
type="button"
|
|
301
|
-
onClick={() => void runUpdate(entry.id)}
|
|
302
|
-
disabled={isUpdating}
|
|
303
|
-
aria-label={actionLabel}
|
|
304
|
-
title={actionLabel}
|
|
305
|
-
className="inline-flex cursor-pointer items-center justify-center rounded border border-ink/25 p-1 text-ink transition-colors hover:border-ink/50 hover:bg-ink/5 disabled:cursor-not-allowed disabled:opacity-50"
|
|
306
|
-
>
|
|
307
|
-
{isUpdating
|
|
308
|
-
? <Loader2 size={11} className="animate-spin motion-reduce:animate-none" />
|
|
309
|
-
: <Download size={11} />}
|
|
310
|
-
</button>
|
|
311
|
-
) : (
|
|
312
|
-
<span className="text-[10px] text-ink/25">—</span>
|
|
313
|
-
)}
|
|
314
|
-
</div>
|
|
315
|
-
|
|
316
|
-
{problem?.id === entry.id && (
|
|
317
|
-
<span className="col-span-3 pb-1 text-[10px] text-ink/70">{problem.message}</span>
|
|
318
|
-
)}
|
|
319
|
-
|
|
320
|
-
{showLogLine && (
|
|
321
|
-
<UpdateLogLine
|
|
322
|
-
running={isUpdating}
|
|
323
|
-
progress={progress}
|
|
324
|
-
message={log?.message ?? null}
|
|
325
|
-
onOpenLog={onOpenLog}
|
|
326
|
-
/>
|
|
327
|
-
)}
|
|
328
|
-
</div>
|
|
329
|
-
);
|
|
330
|
-
})}
|
|
130
|
+
{entries.map((entry) => (
|
|
131
|
+
<HarnessRow
|
|
132
|
+
key={entry.id}
|
|
133
|
+
entry={entry}
|
|
134
|
+
version={byId.get(entry.id) ?? null}
|
|
135
|
+
job={jobById.get(entry.id) ?? null}
|
|
136
|
+
problem={problem?.id === entry.id ? problem.message : null}
|
|
137
|
+
onOpenHarness={() => onOpenHarness(entry.id)}
|
|
138
|
+
onUpdate={() => void runUpdate(entry.id)}
|
|
139
|
+
onOpenLog={onOpenLog ? () => onOpenLog(entry.id) : undefined}
|
|
140
|
+
/>
|
|
141
|
+
))}
|
|
331
142
|
</div>
|
|
332
143
|
)}
|
|
333
|
-
|
|
334
144
|
</section>
|
|
335
145
|
);
|
|
336
146
|
}
|
|
@@ -4,15 +4,15 @@
|
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
|
-
* The row's link to its update log.
|
|
7
|
+
* The row's link to its update log, in the three states a record can be in.
|
|
8
8
|
*
|
|
9
9
|
* A harness update runs in a background worker, so the row can only show *that*
|
|
10
|
-
* something is installing — never what it printed. That output lives in the
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
-
* that does not own it.
|
|
10
|
+
* something is installing — never what it printed. That output lives in the job
|
|
11
|
+
* record, and these cases pin the row's half of the deal: while the worker runs
|
|
12
|
+
* the row names the step and offers `View log`; a run WAITING behind another one
|
|
13
|
+
* says so instead of claiming to install; once a run settles the row keeps
|
|
14
|
+
* offering the log with the run's own sentence; and a record never leaks onto a
|
|
15
|
+
* row that does not own it.
|
|
16
16
|
*/
|
|
17
17
|
|
|
18
18
|
import { afterAll, afterEach, beforeAll, beforeEach, describe, expect, test } from 'bun:test';
|
|
@@ -25,6 +25,7 @@ import {
|
|
|
25
25
|
mountHarnessTable,
|
|
26
26
|
restoreHarnessTableDom,
|
|
27
27
|
summary,
|
|
28
|
+
updateJob,
|
|
28
29
|
version,
|
|
29
30
|
} from '@/test-support/harness-table.test-util';
|
|
30
31
|
|
|
@@ -48,7 +49,7 @@ afterAll(() => {
|
|
|
48
49
|
restoreHarnessTableDom();
|
|
49
50
|
});
|
|
50
51
|
|
|
51
|
-
/** The claude row, with
|
|
52
|
+
/** The claude row, with update records attached. */
|
|
52
53
|
function mountClaude(state: Parameters<typeof mountHarnessTable>[5]): HTMLElement {
|
|
53
54
|
return mountHarnessTable(
|
|
54
55
|
container,
|
|
@@ -62,24 +63,43 @@ function mountClaude(state: Parameters<typeof mountHarnessTable>[5]): HTMLElemen
|
|
|
62
63
|
|
|
63
64
|
describe('harness row update log', () => {
|
|
64
65
|
test('while the worker runs, the row names the step and offers the log', () => {
|
|
65
|
-
|
|
66
|
+
const opened: string[] = [];
|
|
66
67
|
const el = mountClaude({
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
log: { harness: 'claude', message: null },
|
|
70
|
-
onOpenLog: () => { opened += 1; },
|
|
68
|
+
jobs: [updateJob()],
|
|
69
|
+
onOpenLog: (harness) => { opened.push(harness); },
|
|
71
70
|
});
|
|
72
71
|
const row = harnessRows(el)[0];
|
|
73
72
|
expect(row.textContent).toContain('Installing adapter…');
|
|
74
73
|
const log = row.querySelector<HTMLButtonElement>('[data-update-log]');
|
|
75
74
|
expect(log?.textContent).toBe('View log');
|
|
76
75
|
act(() => log!.click());
|
|
77
|
-
|
|
76
|
+
// The opener names the harness: two records can be on screen at once.
|
|
77
|
+
expect(opened).toEqual(['claude']);
|
|
78
|
+
});
|
|
79
|
+
|
|
80
|
+
test('a run waiting behind another one says it is queued, and does not spin', () => {
|
|
81
|
+
const el = mountClaude({
|
|
82
|
+
jobs: [updateJob({ pid: null, queuedAt: Date.now() })],
|
|
83
|
+
onOpenLog: () => {},
|
|
84
|
+
});
|
|
85
|
+
const row = harnessRows(el)[0];
|
|
86
|
+
expect(row.textContent).toContain('Queued — starts when the install running now finishes');
|
|
87
|
+
expect(row.textContent).not.toContain('Installing');
|
|
88
|
+
const button = row.querySelector<HTMLButtonElement>('button[aria-label^="Queued:"]');
|
|
89
|
+
expect(button).not.toBeNull();
|
|
90
|
+
expect(button?.disabled).toBe(true);
|
|
78
91
|
});
|
|
79
92
|
|
|
80
93
|
test('after the run settles the log stays, with the run’s sentence', () => {
|
|
81
94
|
const el = mountClaude({
|
|
82
|
-
|
|
95
|
+
jobs: [updateJob({
|
|
96
|
+
pid: null,
|
|
97
|
+
finishedAt: Date.now(),
|
|
98
|
+
ok: false,
|
|
99
|
+
applied: true,
|
|
100
|
+
message: 'claude update failed (exit 3)',
|
|
101
|
+
steps: [{ part: 'adapter', command: 'npm install -g x', argv: ['npm'], state: 'failed', code: 3 }],
|
|
102
|
+
})],
|
|
83
103
|
onOpenLog: () => {},
|
|
84
104
|
});
|
|
85
105
|
const row = harnessRows(el)[0];
|
|
@@ -88,7 +108,7 @@ describe('harness row update log', () => {
|
|
|
88
108
|
});
|
|
89
109
|
|
|
90
110
|
test('a record for another harness does not appear on this row', () => {
|
|
91
|
-
const el = mountClaude({
|
|
111
|
+
const el = mountClaude({ jobs: [updateJob({ harness: 'codex', label: 'codex', message: 'codex updated' })] });
|
|
92
112
|
expect(harnessRows(el)[0].querySelector('[data-update-log]')).toBeNull();
|
|
93
113
|
});
|
|
94
114
|
});
|
|
@@ -22,6 +22,7 @@ import { useEffect, useRef } from 'preact/hooks';
|
|
|
22
22
|
import { createPortal } from 'preact/compat';
|
|
23
23
|
import { Ban, CheckCircle2, CircleDashed, Loader2 } from 'lucide-preact';
|
|
24
24
|
import { Modal } from '@/client/components/common/Modal';
|
|
25
|
+
import { jobQueued, jobRunning } from '@/shared/lib/harness/update-job';
|
|
25
26
|
import type { HarnessUpdateJob, HarnessUpdateJobStep } from '@/shared/types/harness-update';
|
|
26
27
|
|
|
27
28
|
export interface UpdateLogDialogProps {
|
|
@@ -39,13 +40,17 @@ function StepMark({ state }: { state: HarnessUpdateJobStep['state'] }) {
|
|
|
39
40
|
|
|
40
41
|
/** How the panel describes the run, in the same words the toast uses. */
|
|
41
42
|
function phaseLabel(job: HarnessUpdateJob): string {
|
|
43
|
+
if (jobQueued(job)) return 'Queued — starts when the install running now finishes';
|
|
42
44
|
if (job.finishedAt === null) return 'Installing…';
|
|
43
45
|
return job.ok ? 'Finished' : 'Failed';
|
|
44
46
|
}
|
|
45
47
|
|
|
46
48
|
export function UpdateLogDialog({ job, onClose }: UpdateLogDialogProps) {
|
|
47
49
|
const output = useRef<HTMLPreElement | null>(null);
|
|
48
|
-
|
|
50
|
+
// A QUEUED record has no worker yet: it must not spin, because nothing is
|
|
51
|
+
// happening to it until the run ahead of it settles.
|
|
52
|
+
const running = jobRunning(job);
|
|
53
|
+
const unfinished = job.finishedAt === null;
|
|
49
54
|
|
|
50
55
|
// Pin to the newest line while the worker streams. Without it the panel shows
|
|
51
56
|
// the top of npm's output and the reason for a failure is always below the
|
|
@@ -66,7 +71,10 @@ export function UpdateLogDialog({ job, onClose }: UpdateLogDialogProps) {
|
|
|
66
71
|
<div className="flex min-w-0 items-center gap-3">
|
|
67
72
|
{running
|
|
68
73
|
? <Loader2 size={15} className="shrink-0 animate-spin text-ink/70 motion-reduce:animate-none" />
|
|
69
|
-
|
|
74
|
+
// A waiting run is neither a success nor a failure: `ok` is null, and
|
|
75
|
+
// reading that as `failed` painted a red ban over a run that had not
|
|
76
|
+
// started.
|
|
77
|
+
: <StepMark state={job.finishedAt === null ? 'pending' : job.ok ? 'ok' : 'failed'} />}
|
|
70
78
|
<div className="min-w-0">
|
|
71
79
|
<h2 className="truncate text-sm font-semibold text-ink">Updating {job.label}</h2>
|
|
72
80
|
<p className="truncate font-mono text-[11px] text-ink/50">
|
|
@@ -111,7 +119,7 @@ export function UpdateLogDialog({ job, onClose }: UpdateLogDialogProps) {
|
|
|
111
119
|
ref={output}
|
|
112
120
|
className="max-h-[38vh] min-h-[8rem] overflow-auto rounded-lg border border-ink/10 bg-ink/[0.03] px-3 py-2 font-mono text-[10px] leading-[15px] whitespace-pre-wrap break-all text-ink/75"
|
|
113
121
|
>
|
|
114
|
-
{job.output || (
|
|
122
|
+
{job.output || (unfinished ? 'Waiting for output…' : 'The commands printed nothing.')}
|
|
115
123
|
</pre>
|
|
116
124
|
</div>
|
|
117
125
|
</Modal>,
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* The in-flow line an updating harness row carries: what the background worker
|
|
8
|
-
* is doing
|
|
8
|
+
* is doing — or that it is still waiting its turn — and the way into its log.
|
|
9
9
|
*
|
|
10
10
|
* It is a LINE under the row rather than a second icon in the action cell,
|
|
11
11
|
* because that cell is a fixed `1.75rem` track measured for one 24px button —
|
|
@@ -13,14 +13,21 @@
|
|
|
13
13
|
* caused in the other direction. In flow it can also carry the step's name,
|
|
14
14
|
* which a bare icon cannot.
|
|
15
15
|
*
|
|
16
|
+
* **Waiting is a state of its own.** Two presses are one install at a time: the
|
|
17
|
+
* second harness's record carries `queuedAt`, and a line that said "Updating…"
|
|
18
|
+
* there would claim an install that has not started. It says what it is waiting
|
|
19
|
+
* for, because the queue is invisible otherwise.
|
|
20
|
+
*
|
|
16
21
|
* After the run settles the line stays, showing what happened and keeping
|
|
17
22
|
* `View log` available: the failure case is exactly when the output matters, and
|
|
18
|
-
* the record it lives in survives until
|
|
23
|
+
* the record it lives in survives until that harness is updated again.
|
|
19
24
|
*/
|
|
20
25
|
|
|
21
26
|
export interface UpdateLogLineProps {
|
|
22
27
|
/** Is the worker still installing? */
|
|
23
28
|
running: boolean;
|
|
29
|
+
/** Is this run waiting for the install ahead of it? */
|
|
30
|
+
queued?: boolean;
|
|
24
31
|
/** The step it is on (`adapter`, `Claude Code`, …), when the record says. */
|
|
25
32
|
progress: string | null;
|
|
26
33
|
/** The finished run's sentence, once it has one. */
|
|
@@ -28,12 +35,14 @@ export interface UpdateLogLineProps {
|
|
|
28
35
|
onOpenLog?: () => void;
|
|
29
36
|
}
|
|
30
37
|
|
|
31
|
-
export function UpdateLogLine({ running, progress, message, onOpenLog }: UpdateLogLineProps) {
|
|
38
|
+
export function UpdateLogLine({ running, queued = false, progress, message, onOpenLog }: UpdateLogLineProps) {
|
|
32
39
|
return (
|
|
33
40
|
<span className="col-span-3 flex items-center gap-2 pb-1 text-[10px] text-ink/60">
|
|
34
41
|
{running
|
|
35
42
|
? <span>{progress ? `Installing ${progress}…` : 'Updating…'}</span>
|
|
36
|
-
:
|
|
43
|
+
: queued
|
|
44
|
+
? <span>Queued — starts when the install running now finishes</span>
|
|
45
|
+
: <span className="min-w-0 truncate">{message ?? 'Update finished'}</span>}
|
|
37
46
|
<button
|
|
38
47
|
type="button"
|
|
39
48
|
data-update-log
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import { AlertCircle, Check, Download, Loader2, RefreshCw, Sparkles } from 'lucide-preact';
|
|
2
2
|
import type { UpdateTarget, UpdateTargetInfo } from '@/shared/types/updates';
|
|
3
|
+
import { updateOutcomeTone, type ToastTone } from '@/shared/lib/ui/toast-duration';
|
|
3
4
|
import type { UseUpdatesResult } from '@/client/hooks/ui/updates';
|
|
4
5
|
import { UpdateLog } from '@/client/components/common/UpdateLog';
|
|
5
6
|
import { UPDATE_POPUP_OPEN_EVENT } from '@/shared/lib/updates/popup-state';
|
|
6
7
|
|
|
7
8
|
interface UpdateSectionProps {
|
|
8
9
|
updates: UseUpdatesResult;
|
|
9
|
-
onToast?: (message: string, type?:
|
|
10
|
+
onToast?: (message: string, type?: ToastTone) => void;
|
|
10
11
|
}
|
|
11
12
|
|
|
12
13
|
interface UpdateRowProps {
|
|
@@ -70,7 +71,7 @@ export function UpdateSection({ updates, onToast }: UpdateSectionProps) {
|
|
|
70
71
|
|
|
71
72
|
// `manual` means the environment cannot self-update and the message is the
|
|
72
73
|
// command to run — action required, not a success.
|
|
73
|
-
onToast(result.message, result
|
|
74
|
+
onToast(result.message, updateOutcomeTone(result));
|
|
74
75
|
};
|
|
75
76
|
|
|
76
77
|
const showResult = Boolean(updates.info && !updates.checking && !updates.error);
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import { useRef, useState } from 'preact/hooks';
|
|
1
|
+
import { useEffect, useRef, useState } from 'preact/hooks';
|
|
2
2
|
import { createPortal } from 'preact/compat';
|
|
3
3
|
import { Heart, X } from 'lucide-preact';
|
|
4
4
|
import packageJson from '@/../package.json';
|
|
5
5
|
import type { UseUpdatesResult } from '@/client/hooks/ui/updates';
|
|
6
|
+
import type { ToastTone } from '@/shared/lib/ui/toast-duration';
|
|
6
7
|
import { BrandWordmark } from '@/client/components/common/brand-wordmark';
|
|
7
8
|
import { NotesDialog } from '@/client/components/layout/session-sidebar/about-modal/NotesDialog';
|
|
8
9
|
import { SocialLinks } from '@/client/components/layout/session-sidebar/about-modal/SocialLinks';
|
|
@@ -24,16 +25,14 @@ export interface AboutModalProps {
|
|
|
24
25
|
isOpen: boolean;
|
|
25
26
|
onClose: () => void;
|
|
26
27
|
updates: UseUpdatesResult;
|
|
27
|
-
onToast?: (message: string, type?:
|
|
28
|
+
onToast?: (message: string, type?: ToastTone) => void;
|
|
28
29
|
}
|
|
29
30
|
|
|
30
31
|
export function AboutModal({ isOpen, onClose, updates, onToast }: AboutModalProps) {
|
|
31
32
|
// Which product's "what am I running" notes are open. The dialog draws above
|
|
32
33
|
// this panel instead of replacing it, so closing it returns here.
|
|
33
34
|
const [notesTarget, setNotesTarget] = useState<UpdateTarget | null>(null);
|
|
34
|
-
// The update log panel
|
|
35
|
-
// at a time, and the record the hook holds IS the one that was opened.
|
|
36
|
-
const [logOpen, setLogOpen] = useState(false);
|
|
35
|
+
// The update log panel, opened for a harness id.
|
|
37
36
|
// The About sheet is a dialog to assistive tech and to the keyboard. It had
|
|
38
37
|
// neither: measured in the running console it carried no `role`, no
|
|
39
38
|
// `aria-modal`, and Escape did nothing while focus sat inside it.
|
|
@@ -43,9 +42,22 @@ export function AboutModal({ isOpen, onClose, updates, onToast }: AboutModalProp
|
|
|
43
42
|
// made in either appears here without a reload.
|
|
44
43
|
const { harnesses, isLoading: harnessesLoading } = useHarnesses();
|
|
45
44
|
const versions = useHarnessVersions();
|
|
46
|
-
//
|
|
47
|
-
//
|
|
48
|
-
//
|
|
45
|
+
// The rows name what is on disk NOW. A run that settled while the card was
|
|
46
|
+
// closed — or a probe that answered after the last read — leaves the shared
|
|
47
|
+
// store holding the number the update replaced, and its `loaded` flag makes a
|
|
48
|
+
// remount skip the read. Re-reading on OPEN is what makes "updated" and the
|
|
49
|
+
// version beside it agree; it does not force the registry, so the cheap path.
|
|
50
|
+
const refreshVersions = versions.refresh;
|
|
51
|
+
useEffect(() => {
|
|
52
|
+
if (isOpen) refreshVersions();
|
|
53
|
+
}, [isOpen, refreshVersions]);
|
|
54
|
+
// Which harness's log is open. The run is a background worker and there can be
|
|
55
|
+
// MORE THAN ONE record (one installing, one waiting its turn), so the panel is
|
|
56
|
+
// opened for a harness id and renders THAT harness's record.
|
|
57
|
+
const [logHarness, setLogHarness] = useState<string | null>(null);
|
|
58
|
+
// Which harnesses have a record — installing, waiting, or settled. The run is a
|
|
59
|
+
// BACKGROUND worker, so this hook also ADOPTS runs that are still going when
|
|
60
|
+
// the card opens — a reload no longer loses an update's state.
|
|
49
61
|
const update = useHarnessUpdate(
|
|
50
62
|
(message, ok) => {
|
|
51
63
|
// The hook re-reads the version rows itself once a run settles (the update
|
|
@@ -67,6 +79,10 @@ export function AboutModal({ isOpen, onClose, updates, onToast }: AboutModalProp
|
|
|
67
79
|
|
|
68
80
|
if (!isOpen) return null;
|
|
69
81
|
|
|
82
|
+
// The record the open log panel renders. Looked up per harness, so a settled
|
|
83
|
+
// row keeps its log while another harness installs.
|
|
84
|
+
const logJob = logHarness ? update.jobs.find((job) => job.harness === logHarness) ?? null : null;
|
|
85
|
+
|
|
70
86
|
// Rendered through a portal, for the reason the update popup is: this dialog
|
|
71
87
|
// is mounted inside whichever sidebar is on screen, and that sidebar is not
|
|
72
88
|
// always laid out — the phone's drawer hides its whole screen with
|
|
@@ -162,10 +178,8 @@ export function AboutModal({ isOpen, onClose, updates, onToast }: AboutModalProp
|
|
|
162
178
|
versions={versions.rows}
|
|
163
179
|
loading={harnessesLoading}
|
|
164
180
|
onUpdate={update.start}
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
log={update.job ? { harness: update.job.harness, message: update.job.message } : null}
|
|
168
|
-
onOpenLog={() => setLogOpen(true)}
|
|
181
|
+
jobs={update.jobs}
|
|
182
|
+
onOpenLog={setLogHarness}
|
|
169
183
|
onOpenHarness={(id) => {
|
|
170
184
|
onClose();
|
|
171
185
|
// The settings modal is the frame that owns harness pages; the
|
|
@@ -203,8 +217,10 @@ export function AboutModal({ isOpen, onClose, updates, onToast }: AboutModalProp
|
|
|
203
217
|
{notesTarget && <NotesDialog target={notesTarget} onClose={() => setNotesTarget(null)} />}
|
|
204
218
|
{/* The log draws ABOVE About and does not replace it — the card it was
|
|
205
219
|
opened from keeps its glanceable state. It is not gated on a run being
|
|
206
|
-
in flight: a finished (or failed) record is what a reader came for
|
|
207
|
-
|
|
220
|
+
in flight: a finished (or failed) record is what a reader came for, and
|
|
221
|
+
a WAITING one is what says where the queue is. It renders the record of
|
|
222
|
+
the harness whose line was clicked — two runs can exist at once. */}
|
|
223
|
+
{logJob && <UpdateLogDialog job={logJob} onClose={() => setLogHarness(null)} />}
|
|
208
224
|
</>,
|
|
209
225
|
document.body,
|
|
210
226
|
);
|