@kabmo-labs/kabmo 0.25.0 → 0.26.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 +440 -436
- package/dist/client/static/js/{index-ga8cbpt4.js → index-95b3n20k.js} +945 -945
- package/dist/client/static/js/index-p2yw9ywf.css +1 -0
- package/package.json +1 -1
- 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/session-sidebar/CategoryItem.tsx +64 -68
- 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/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/index.tsx +28 -13
- package/src/client/components/layout/session-sidebar/modern/WorkspaceSection.tsx +59 -57
- package/src/client/components/mobile/mobile-session-sidebar/Item.tsx +57 -61
- 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/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/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 +28 -39
- package/src/client/components/workspace/chat-timeline/MessageList.tsx +7 -5
- package/src/client/components/workspace/chat-timeline/PendingChatView.tsx +10 -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/index.tsx +10 -21
- package/src/client/components/workspace/chat-timeline/target-picker/DraftTargetRow.tsx +115 -0
- package/src/client/components/workspace/chat-timeline/target-picker/ParentSessionPicker.tsx +173 -0
- package/src/client/components/workspace/chat-timeline/target-picker/parent-session-options.test.ts +49 -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 +4 -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-request.test.ts +54 -0
- package/src/client/hooks/chat/timeline/fork-request.ts +43 -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 +205 -0
- package/src/client/hooks/chat/timeline/pending-dispatch.ts +253 -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/models/use-harness-update.test.ts +137 -44
- package/src/client/hooks/models/use-harness-update.ts +133 -85
- 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/expanded-sessions.ts +36 -7
- 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/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/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/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
|
@@ -107,6 +107,17 @@ describe('modern session row', () => {
|
|
|
107
107
|
expect(el.querySelector('[role="status"]')?.getAttribute('aria-label')).toBe('Generating a name…');
|
|
108
108
|
});
|
|
109
109
|
|
|
110
|
+
test('a leaf child fills its empty slot with the child mark', async () => {
|
|
111
|
+
const el = await mount({ isChild: true });
|
|
112
|
+
expect(el.querySelector('[data-testid="child-indicator"] svg')).not.toBeNull();
|
|
113
|
+
});
|
|
114
|
+
|
|
115
|
+
test('a child with a branch keeps the chevron, not the mark', async () => {
|
|
116
|
+
const el = await mount({ isChild: true, expandable: true, onToggleExpand: () => {} });
|
|
117
|
+
expect(el.querySelector('[data-testid="child-indicator"]')).toBeNull();
|
|
118
|
+
expect(el.querySelector('button[aria-expanded]')).not.toBeNull();
|
|
119
|
+
});
|
|
120
|
+
|
|
110
121
|
test('the actions trigger is drawn and named, and is not hidden from the keyboard', async () => {
|
|
111
122
|
const el = await mount({ onRename: () => {} });
|
|
112
123
|
const trigger = el.querySelector('[aria-label="Session actions"]');
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { useEffect, useMemo, useRef, useState } from 'preact/hooks';
|
|
2
2
|
import type { ReactNode } from 'preact/compat';
|
|
3
3
|
import { flushSession, loadSession, migrateSessionState, recordSessionOpen } from '@/shared/lib/workspace/session-state/store';
|
|
4
|
-
import { consumeAdoption } from '@/client/hooks/chat/omp/pending-
|
|
4
|
+
import { consumeAdoption } from '@/client/hooks/chat/omp/pending-adoption';
|
|
5
5
|
import { SessionStateContext } from '@/client/hooks/workspace/session-state/context';
|
|
6
6
|
|
|
7
7
|
/**
|
|
@@ -6,18 +6,18 @@ import { useShowMore } from '@/client/hooks/ui/show-more';
|
|
|
6
6
|
import { useWorkspaceFolderActions } from '@/client/hooks/workspace/workspace-folder-actions';
|
|
7
7
|
import { useSessionDelete } from '@/client/hooks/workspace/session-delete';
|
|
8
8
|
import { SessionDeleteModal } from '@/client/components/common/session-delete-modal';
|
|
9
|
-
import { SessionItem } from '@/client/components/layout/session-sidebar/SessionItem';
|
|
9
|
+
import { SessionItem, SESSION_ITEM_BRANCH_STYLE } from '@/client/components/layout/session-sidebar/SessionItem';
|
|
10
10
|
import { CategoryHeader } from '@/client/components/layout/session-sidebar/CategoryHeader';
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
11
|
+
import { SessionBranch, branchControlFor } from '@/client/components/common/session-branch';
|
|
12
|
+
import type { BranchControl } from '@/client/components/common/session-branch';
|
|
13
13
|
import { buildSessionTree } from '@/client/lib/session-tree';
|
|
14
14
|
import { useExpandedSessions } from '@/client/hooks/workspace/expanded-sessions';
|
|
15
|
-
import { useChildExpansion } from '@/client/hooks/workspace/child-expansion';
|
|
16
15
|
import { relativeTimeAgo } from '@/shared/lib/workspace/relative-time';
|
|
16
|
+
import { isPendingSessionId } from '@/shared/lib/omp/session/default-title';
|
|
17
17
|
import { useSidebarData } from '@/client/hooks/chat/omp/session-list';
|
|
18
18
|
import type { BatchBinding } from '@/client/components/common/batch-selection/types';
|
|
19
19
|
import { folderBatchState } from '@/client/components/common/batch-selection/folder-state';
|
|
20
|
-
import type { WorkspaceFolderData } from '@/shared/types';
|
|
20
|
+
import type { SessionItemData, WorkspaceFolderData } from '@/shared/types';
|
|
21
21
|
|
|
22
22
|
export { SessionItem };
|
|
23
23
|
|
|
@@ -58,10 +58,9 @@ export function Category({
|
|
|
58
58
|
const urlSubagentId = searchParams.get('subagent');
|
|
59
59
|
const urlSessionId = searchParams.get('sessionId');
|
|
60
60
|
|
|
61
|
-
//
|
|
62
|
-
//
|
|
61
|
+
// ONE expansion set for the whole branch: child sessions and the subagent
|
|
62
|
+
// roster are the same disclosure now, so they cannot disagree.
|
|
63
63
|
const { expandedSessionIds, toggleSession } = useExpandedSessions();
|
|
64
|
-
const { expandedChildIds, toggleChild } = useChildExpansion();
|
|
65
64
|
|
|
66
65
|
useEffect(() => {
|
|
67
66
|
if (typeof folder.isExpanded === 'boolean') setIsOpen(folder.isExpanded);
|
|
@@ -155,6 +154,53 @@ export function Category({
|
|
|
155
154
|
const listOpen = isActuallyOpen || sessionCheckboxes;
|
|
156
155
|
const hasMore = hiddenCount > 0;
|
|
157
156
|
|
|
157
|
+
// One row renderer for roots and for every descendant: a child session is
|
|
158
|
+
// the same row as a root, so a rule fixed on one is fixed on both.
|
|
159
|
+
const renderSessionRow = (session: SessionItemData, control: BranchControl) => {
|
|
160
|
+
const sessionKey = String(session.id);
|
|
161
|
+
const isActive = activeSessionId !== null
|
|
162
|
+
? String(activeSessionId) === sessionKey
|
|
163
|
+
: session.is_active === 1;
|
|
164
|
+
// While one of its subagents is being viewed, the row dims so the
|
|
165
|
+
// highlighted leaf reads as the active one.
|
|
166
|
+
const isViewingSubagent = isActive && urlSessionId === sessionKey && Boolean(urlSubagentId);
|
|
167
|
+
const pending = isPendingSessionId(sessionKey);
|
|
168
|
+
return (
|
|
169
|
+
<SessionItem
|
|
170
|
+
sessionId={session.id}
|
|
171
|
+
title={session.title}
|
|
172
|
+
harness={session.harness}
|
|
173
|
+
folderId={session.folder_id}
|
|
174
|
+
isActive={isActive && !isViewingSubagent}
|
|
175
|
+
isArchived={session.is_archived === 1}
|
|
176
|
+
status={sessionStatus[sessionKey]}
|
|
177
|
+
awaitingInput={Boolean(session.awaitingInput)}
|
|
178
|
+
worktree={session.worktree}
|
|
179
|
+
timeAgo={relativeTimeAgo(session.updated_at ?? session.created_at)}
|
|
180
|
+
onClick={() => onSelectSession(session.id)}
|
|
181
|
+
onArchive={() => handleArchive(session)}
|
|
182
|
+
// A pending `new-…` chat has no transcript anywhere yet — there is
|
|
183
|
+
// nothing to delete, and the server refuses it.
|
|
184
|
+
onDelete={pending ? undefined : () => sessionDelete.requestDelete(session)}
|
|
185
|
+
onRename={pending ? undefined : (name) => void handleRename(session, name)}
|
|
186
|
+
onRenameWithAi={pending ? undefined : () => void handleRenameWithAi(session)}
|
|
187
|
+
expandable={control.expandable} isChild={control.isChild}
|
|
188
|
+
isExpanded={control.isExpanded}
|
|
189
|
+
onToggleExpand={control.onToggleExpand}
|
|
190
|
+
waitingFor={session.waitingFor ? { title: session.waitingFor.title } : undefined}
|
|
191
|
+
onCancelWait={
|
|
192
|
+
session.waitingFor ? () => onCancelWait?.(session.waitingFor!.waitId) : undefined
|
|
193
|
+
}
|
|
194
|
+
selectable={sessionCheckboxes}
|
|
195
|
+
selected={Boolean(batch?.selected.includes(sessionKey))}
|
|
196
|
+
onToggleSelect={batch ? () => batch.toggle(sessionKey) : undefined}
|
|
197
|
+
/>
|
|
198
|
+
);
|
|
199
|
+
};
|
|
200
|
+
|
|
201
|
+
const controlFor = (session: SessionItemData): BranchControl =>
|
|
202
|
+
branchControlFor(session, tree.childrenOf, expandedSessionIds, toggleSession);
|
|
203
|
+
|
|
158
204
|
return (
|
|
159
205
|
<div className="space-y-1">
|
|
160
206
|
<CategoryHeader
|
|
@@ -195,72 +241,22 @@ export function Category({
|
|
|
195
241
|
<div className="space-y-0.5">
|
|
196
242
|
{tree.roots.map((session) => {
|
|
197
243
|
const sessionKey = String(session.id);
|
|
198
|
-
const
|
|
199
|
-
? String(activeSessionId) === sessionKey
|
|
200
|
-
: session.is_active === 1;
|
|
201
|
-
// While one of its subagents is being viewed, the parent session
|
|
202
|
-
// row dims so the highlighted roster entry reads as the active one.
|
|
203
|
-
const isViewingSubagent = isActive && urlSessionId === sessionKey && Boolean(urlSubagentId);
|
|
204
|
-
const canExpandActive = activeSessionId !== null && sessionKey === String(activeSessionId);
|
|
205
|
-
// Two independent disclosures: children (the tree) and subagents
|
|
206
|
-
// (a tool-call roster). The chevron belongs to the first, the badge
|
|
207
|
-
// to the second.
|
|
208
|
-
const hasChildren = (tree.childrenOf.get(sessionKey)?.length ?? 0) > 0;
|
|
209
|
-
const hasSubagents = Boolean(session.hasSubagents);
|
|
210
|
-
const childrenExpanded = hasChildren && expandedChildIds.has(sessionKey);
|
|
211
|
-
const rosterExpanded = hasSubagents && expandedSessionIds.has(sessionKey);
|
|
212
|
-
|
|
244
|
+
const control = controlFor(session);
|
|
213
245
|
return (
|
|
214
246
|
<div key={session.id} className="space-y-0.5">
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
harness={session.harness}
|
|
219
|
-
isActive={isActive && !isViewingSubagent}
|
|
220
|
-
isArchived={session.is_archived === 1}
|
|
221
|
-
status={sessionStatus[sessionKey]}
|
|
222
|
-
awaitingInput={Boolean(session.awaitingInput)}
|
|
223
|
-
worktree={session.worktree}
|
|
224
|
-
timeAgo={relativeTimeAgo(session.updated_at ?? session.created_at)}
|
|
225
|
-
onClick={() => onSelectSession(session.id)}
|
|
226
|
-
onArchive={() => handleArchive(session)}
|
|
227
|
-
onDelete={
|
|
228
|
-
// A pending `new-…` chat has no transcript anywhere yet —
|
|
229
|
-
// there is nothing to delete, and the server refuses it.
|
|
230
|
-
String(session.id).startsWith('new-')
|
|
231
|
-
? undefined
|
|
232
|
-
: () => sessionDelete.requestDelete(session)
|
|
233
|
-
}
|
|
234
|
-
onRename={String(session.id).startsWith('new-') ? undefined : (name) => void handleRename(session, name)}
|
|
235
|
-
onRenameWithAi={
|
|
236
|
-
String(session.id).startsWith('new-') ? undefined : () => void handleRenameWithAi(session)
|
|
237
|
-
}
|
|
238
|
-
expandable={hasChildren}
|
|
239
|
-
hasSubagents={hasSubagents}
|
|
240
|
-
isExpanded={childrenExpanded}
|
|
241
|
-
onToggleExpand={() => toggleChild(sessionKey)}
|
|
242
|
-
subagentsExpanded={rosterExpanded}
|
|
243
|
-
onToggleSubagents={() => toggleSession(sessionKey)}
|
|
244
|
-
waitingFor={session.waitingFor ? { title: session.waitingFor.title } : undefined}
|
|
245
|
-
onCancelWait={
|
|
246
|
-
session.waitingFor
|
|
247
|
-
? () => onCancelWait?.(session.waitingFor!.waitId)
|
|
248
|
-
: undefined
|
|
249
|
-
}
|
|
250
|
-
selectable={sessionCheckboxes}
|
|
251
|
-
selected={Boolean(batch?.selected.includes(sessionKey))}
|
|
252
|
-
onToggleSelect={batch ? () => batch.toggle(sessionKey) : undefined}
|
|
253
|
-
/>
|
|
254
|
-
{childrenExpanded && (
|
|
255
|
-
<ChildSessionList
|
|
247
|
+
{renderSessionRow(session, control)}
|
|
248
|
+
{control.isExpanded && (
|
|
249
|
+
<SessionBranch
|
|
256
250
|
parentId={sessionKey}
|
|
251
|
+
hasSubagents={Boolean(session.hasSubagents)}
|
|
257
252
|
childrenOf={tree.childrenOf}
|
|
258
|
-
|
|
253
|
+
expandedIds={expandedSessionIds}
|
|
254
|
+
onToggle={toggleSession}
|
|
255
|
+
activeSessionId={activeSessionId === null ? null : String(activeSessionId)}
|
|
256
|
+
renderSession={renderSessionRow}
|
|
257
|
+
style={SESSION_ITEM_BRANCH_STYLE}
|
|
259
258
|
/>
|
|
260
259
|
)}
|
|
261
|
-
{rosterExpanded && (
|
|
262
|
-
<SubagentList sessionId={session.id} isActiveSession={canExpandActive} />
|
|
263
|
-
)}
|
|
264
260
|
</div>
|
|
265
261
|
);
|
|
266
262
|
})}
|
|
@@ -153,10 +153,10 @@ describe('mobile row batch mode', () => {
|
|
|
153
153
|
expect(calls.select).toBe(0);
|
|
154
154
|
});
|
|
155
155
|
|
|
156
|
-
test('hides the row actions and the
|
|
157
|
-
const { el } = await mountMobile({ selectable: true,
|
|
156
|
+
test('hides the row actions and the branch chevron in select mode', async () => {
|
|
157
|
+
const { el } = await mountMobile({ selectable: true, expandable: true, onToggleExpand: () => {} });
|
|
158
158
|
expect(el.querySelector('button[aria-label="Session actions"]')).toBeNull();
|
|
159
|
-
expect(el.querySelector('button[aria-label*="subagents"]')).toBeNull();
|
|
159
|
+
expect(el.querySelector('button[aria-label*="sessions and subagents"]')).toBeNull();
|
|
160
160
|
expect(checkbox(el)?.getAttribute('aria-label')).toBe('Select hello world');
|
|
161
161
|
});
|
|
162
162
|
});
|
|
@@ -68,6 +68,30 @@ function renameCue(el: HTMLElement): Element | null {
|
|
|
68
68
|
return el.querySelector('[role="status"]');
|
|
69
69
|
}
|
|
70
70
|
|
|
71
|
+
describe('child session mark', () => {
|
|
72
|
+
test('a leaf child fills the empty slot with the child mark', async () => {
|
|
73
|
+
const el = await mount({ isChild: true });
|
|
74
|
+
expect(el.querySelector('[data-testid="child-indicator"] svg')).not.toBeNull();
|
|
75
|
+
});
|
|
76
|
+
|
|
77
|
+
test('a child with a branch keeps its chevron instead', async () => {
|
|
78
|
+
const el = await mount({ isChild: true, expandable: true, onToggleExpand: () => {} });
|
|
79
|
+
expect(el.querySelector('[data-testid="child-indicator"]')).toBeNull();
|
|
80
|
+
expect(el.querySelector('button[aria-expanded]')).not.toBeNull();
|
|
81
|
+
});
|
|
82
|
+
|
|
83
|
+
test('a running child shows the run cue, not the mark', async () => {
|
|
84
|
+
const el = await mount({ isChild: true, status: 'stream' });
|
|
85
|
+
expect(el.querySelector('[data-testid="child-indicator"]')).toBeNull();
|
|
86
|
+
expect(el.querySelector('[role="status"]')?.getAttribute('aria-label')).toBe('Running');
|
|
87
|
+
});
|
|
88
|
+
|
|
89
|
+
test('a root row draws no child mark', async () => {
|
|
90
|
+
const el = await mount();
|
|
91
|
+
expect(el.querySelector('[data-testid="child-indicator"]')).toBeNull();
|
|
92
|
+
});
|
|
93
|
+
});
|
|
94
|
+
|
|
71
95
|
describe('desktop session row rename cue', () => {
|
|
72
96
|
test('draws a labelled spinner while the rename is in flight', async () => {
|
|
73
97
|
setSessionRenaming('s1', true);
|
|
@@ -82,10 +106,9 @@ describe('desktop session row rename cue', () => {
|
|
|
82
106
|
expect(renameCue(el)).toBeNull();
|
|
83
107
|
});
|
|
84
108
|
|
|
85
|
-
test('takes the slot from
|
|
109
|
+
test('takes the slot from the branch chevron, which is hidden until hover', async () => {
|
|
86
110
|
setSessionRenaming('s1', true);
|
|
87
111
|
const el = await mount({
|
|
88
|
-
hasSubagents: true,
|
|
89
112
|
expandable: true,
|
|
90
113
|
onToggleExpand: () => {},
|
|
91
114
|
});
|
|
@@ -1,13 +1,24 @@
|
|
|
1
1
|
import type { TargetedMouseEvent } from 'preact';
|
|
2
|
-
import {
|
|
2
|
+
import { Check, ChevronDown, ChevronRight, CircleQuestionMark, GitBranch, Hourglass, Loader2, MoreHorizontal } from 'lucide-preact';
|
|
3
3
|
import { useInlineRename } from '@/client/hooks/ui/inline-rename';
|
|
4
4
|
import { useSessionRenaming } from '@/client/hooks/workspace/renaming-sessions';
|
|
5
5
|
import { SessionActionsMenu, useRowMenu } from '@/client/components/common/session-actions-menu';
|
|
6
6
|
import { SelectionCheckbox } from '@/client/components/common/batch-selection/SelectionCheckbox';
|
|
7
7
|
import { HarnessGlyph, HARNESS_GLYPH_SIZE } from '@/client/components/common/harness-glyph';
|
|
8
|
+
import type { BranchRowStyle } from '@/client/components/common/session-branch/style';
|
|
8
9
|
import { WorktreeBadge } from '@/client/components/layout/session-sidebar/WorktreeBadge';
|
|
9
10
|
import type { SessionWorktreeInfo } from '@/shared/lib/workspace/worktree/types';
|
|
10
11
|
|
|
12
|
+
/** What a subagent row under this chrome's rows borrows from it. */
|
|
13
|
+
export const SESSION_ITEM_BRANCH_STYLE: BranchRowStyle = {
|
|
14
|
+
inset: 'px-2',
|
|
15
|
+
insetPx: 8,
|
|
16
|
+
slotWidth: 16,
|
|
17
|
+
markGap: 8,
|
|
18
|
+
padding: 'py-1.5',
|
|
19
|
+
glyph: HARNESS_GLYPH_SIZE.compact,
|
|
20
|
+
};
|
|
21
|
+
|
|
11
22
|
export interface SessionItemProps {
|
|
12
23
|
/** The session this row draws; the key its in-flight rename is tracked under. */
|
|
13
24
|
sessionId: string | number;
|
|
@@ -34,11 +45,12 @@ export interface SessionItemProps {
|
|
|
34
45
|
onRenameWithAi?: () => void;
|
|
35
46
|
expandable?: boolean;
|
|
36
47
|
isExpanded?: boolean;
|
|
37
|
-
hasSubagents?: boolean;
|
|
38
|
-
/** Whether the subagent roster (a separate list) is open. */
|
|
39
|
-
subagentsExpanded?: boolean;
|
|
40
|
-
onToggleSubagents?: (e: TargetedMouseEvent<HTMLElement>) => void;
|
|
41
48
|
onToggleExpand?: (e: TargetedMouseEvent<HTMLElement>) => void;
|
|
49
|
+
/** Drawn inside a parent's branch; a leaf child gets a child mark in its slot. */
|
|
50
|
+
isChild?: boolean;
|
|
51
|
+
/** The folder the row belongs to, so a child spawned from its menu lands in
|
|
52
|
+
* the right list before the server answers. */
|
|
53
|
+
folderId?: number | string;
|
|
42
54
|
/**
|
|
43
55
|
* The row's prompt is held until another session finishes. A pending row has
|
|
44
56
|
* no transcript and no omp id, so this cue is the only thing on screen saying
|
|
@@ -75,10 +87,9 @@ export function SessionItem({
|
|
|
75
87
|
onRenameWithAi,
|
|
76
88
|
expandable = false,
|
|
77
89
|
isExpanded = false,
|
|
78
|
-
hasSubagents = false,
|
|
79
|
-
subagentsExpanded = false,
|
|
80
|
-
onToggleSubagents,
|
|
81
90
|
onToggleExpand,
|
|
91
|
+
isChild = false,
|
|
92
|
+
folderId,
|
|
82
93
|
waitingFor,
|
|
83
94
|
onCancelWait,
|
|
84
95
|
worktree,
|
|
@@ -96,7 +107,7 @@ export function SessionItem({
|
|
|
96
107
|
// it at rest — the spinner, or the blocked-on-a-question cue, which says it
|
|
97
108
|
// is YOUR turn. With nothing live to report the chevron is PINNED, collapsed
|
|
98
109
|
// or expanded: it is the only affordance left worth showing, and making it
|
|
99
|
-
// hover-only would leave the
|
|
110
|
+
// hover-only would leave the branch reachable only by hovering exactly the
|
|
100
111
|
// right 16px.
|
|
101
112
|
const waiting = Boolean(waitingFor);
|
|
102
113
|
const liveRun = awaitingInput || status === 'stream' || waiting;
|
|
@@ -149,7 +160,7 @@ export function SessionItem({
|
|
|
149
160
|
{/* One 16px slot owns both icons — never two side by side. A live run
|
|
150
161
|
signal (blocked question, run spinner) holds the slot; otherwise the
|
|
151
162
|
chevron is pinned, collapsed or expanded. While the signal holds it,
|
|
152
|
-
hovering hands the slot to the chevron so the
|
|
163
|
+
hovering hands the slot to the chevron so the branch stays reachable
|
|
153
164
|
mid-run.
|
|
154
165
|
Both layers are pointer-inert for the opposite state: the toggle
|
|
155
166
|
while hidden, the status glyph ALWAYS (it is painted after the
|
|
@@ -164,7 +175,7 @@ export function SessionItem({
|
|
|
164
175
|
e.stopPropagation();
|
|
165
176
|
onToggleExpand(e);
|
|
166
177
|
}}
|
|
167
|
-
title={isExpanded ? 'Collapse
|
|
178
|
+
title={isExpanded ? 'Collapse sessions and subagents' : 'Expand sessions and subagents'}
|
|
168
179
|
aria-expanded={isExpanded}
|
|
169
180
|
className={`peer absolute inset-0 flex items-center justify-center rounded cursor-pointer transition-opacity ${
|
|
170
181
|
chevronPinned
|
|
@@ -211,6 +222,15 @@ export function SessionItem({
|
|
|
211
222
|
)}
|
|
212
223
|
</span>
|
|
213
224
|
)}
|
|
225
|
+
{isChild && !showChevron && !showStatus && (
|
|
226
|
+
<span
|
|
227
|
+
data-testid="child-indicator"
|
|
228
|
+
aria-hidden="true"
|
|
229
|
+
className="pointer-events-none absolute inset-0 flex items-center justify-center text-ink/35"
|
|
230
|
+
>
|
|
231
|
+
<GitBranch size={12} aria-hidden="true" />
|
|
232
|
+
</span>
|
|
233
|
+
)}
|
|
214
234
|
</span>
|
|
215
235
|
|
|
216
236
|
{/* Gap between icon and text */}
|
|
@@ -267,25 +287,6 @@ export function SessionItem({
|
|
|
267
287
|
<span className="shrink-0 ml-2 font-mono text-[10px] text-ink/40">{timeAgo}</span>
|
|
268
288
|
)}
|
|
269
289
|
|
|
270
|
-
{/* The roster is a tool-call list, not a tree: its trigger is a badge,
|
|
271
|
-
never the chevron. Keeping the two controls apart is what stops a
|
|
272
|
-
child session and a subagent from reading as the same thing. */}
|
|
273
|
-
{!isEditing && hasSubagents && onToggleSubagents && !selectable && (
|
|
274
|
-
<button
|
|
275
|
-
type="button"
|
|
276
|
-
onClick={(e) => {
|
|
277
|
-
e.stopPropagation();
|
|
278
|
-
onToggleSubagents(e);
|
|
279
|
-
}}
|
|
280
|
-
title="Subagents (tool calls)"
|
|
281
|
-
aria-label="Subagents"
|
|
282
|
-
aria-expanded={subagentsExpanded}
|
|
283
|
-
className="shrink-0 ml-1 p-1 text-ink/40 hover:text-ink hover:bg-ink/10 rounded cursor-pointer"
|
|
284
|
-
>
|
|
285
|
-
<Boxes size={13} />
|
|
286
|
-
</button>
|
|
287
|
-
)}
|
|
288
|
-
|
|
289
290
|
{/* One trigger, whatever the row can do — the menu grows, so a row with
|
|
290
291
|
more actions costs no extra width. It is always drawn, the way the
|
|
291
292
|
phone's row draws it: a hover-only trigger is invisible until the
|
|
@@ -315,6 +316,8 @@ export function SessionItem({
|
|
|
315
316
|
<SessionActionsMenu
|
|
316
317
|
anchor={menu.anchor}
|
|
317
318
|
sessionId={sessionId}
|
|
319
|
+
{...(harness ? { harness } : {})}
|
|
320
|
+
{...(folderId !== undefined ? { folderId } : {})}
|
|
318
321
|
isArchived={isArchived}
|
|
319
322
|
onRename={onRename ? startRename : undefined}
|
|
320
323
|
onRenameWithAi={onRenameWithAi}
|
|
@@ -0,0 +1,261 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* SPDX-License-Identifier: MIT
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* ONE harness line in the About card: state, version, and the one action that
|
|
8
|
+
* harness can do — plus whatever its own update record says.
|
|
9
|
+
*
|
|
10
|
+
* Split out of `HarnessTable` when per-harness update records arrived: the row
|
|
11
|
+
* now reads three things (the catalog entry, the version row, and ITS OWN
|
|
12
|
+
* update record), and keeping that next to the section's tally and heading
|
|
13
|
+
* pushed the file past the 350-line ceiling. The section owns the list; this owns
|
|
14
|
+
* one line of it.
|
|
15
|
+
*
|
|
16
|
+
* Everything a row states, and why, is in `HarnessTable.tsx`'s header: this file
|
|
17
|
+
* is that row's markup and its three-column grid.
|
|
18
|
+
*/
|
|
19
|
+
|
|
20
|
+
import { Download, Loader2 } from 'lucide-preact';
|
|
21
|
+
import { HarnessGlyph, HARNESS_GLYPH_SIZE } from '@/client/components/common/harness-glyph';
|
|
22
|
+
import { UpdateLogLine } from '@/client/components/layout/session-sidebar/about-modal/UpdateLogLine';
|
|
23
|
+
import { jobQueued, jobRunning, runningStepOf } from '@/shared/lib/harness/update-job';
|
|
24
|
+
import { harnessStatus, type HarnessState } from '@/shared/lib/harness/status';
|
|
25
|
+
import type { HarnessSummary } from '@/shared/types/harness';
|
|
26
|
+
import type { HarnessUpdateJob } from '@/shared/types/harness-update';
|
|
27
|
+
import type { HarnessVersionRow } from '@/shared/types/harness-version';
|
|
28
|
+
|
|
29
|
+
export interface HarnessRowProps {
|
|
30
|
+
entry: HarnessSummary;
|
|
31
|
+
version: HarnessVersionRow | null;
|
|
32
|
+
/** This harness's own update record — installing, waiting, or settled. */
|
|
33
|
+
job: HarnessUpdateJob | null;
|
|
34
|
+
/** A refusal from a press on THIS row, or null. */
|
|
35
|
+
problem: string | null;
|
|
36
|
+
onOpenHarness: () => void;
|
|
37
|
+
/** Starts this harness's update. */
|
|
38
|
+
onUpdate: () => void;
|
|
39
|
+
onOpenLog?: () => void;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
/** The state mark. Shape carries the state, so tone is reinforcement only. */
|
|
43
|
+
function StateMark({ state }: { state: HarnessState }) {
|
|
44
|
+
if (state === 'ready') return <span aria-hidden="true" className="h-1.5 w-1.5 rounded-full bg-success" />;
|
|
45
|
+
if (state === 'not-installed') return <span aria-hidden="true" className="h-1.5 w-1.5 rounded-full border border-ink/35" />;
|
|
46
|
+
if (state === 'needs-setup') return <span aria-hidden="true" className="h-1.5 w-1.5 rounded-full bg-ink/45" />;
|
|
47
|
+
return <span aria-hidden="true" className="h-1.5 w-1.5 rounded-full bg-ink/15" />;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* The three-column grid every data row uses.
|
|
52
|
+
*
|
|
53
|
+
* The widths are the point, and every earlier guess was wrong:
|
|
54
|
+
*
|
|
55
|
+
* - the ACTION column held `7rem` for a single icon, stealing space from the
|
|
56
|
+
* version cell — so `0.100.0 → 0.101.0` truncated while the action cell sat
|
|
57
|
+
* mostly empty. It is `1.75rem` now: one 24px button and nothing else.
|
|
58
|
+
* - the VERSION column held `7.5rem` (120px), which clipped the widest thing
|
|
59
|
+
* it ever holds — an adapter's `adapter 0.100.0 → 0.101.0` line, measured at
|
|
60
|
+
* 151px in this face. It is `9.5rem` (152px), the content's own width.
|
|
61
|
+
* - on a PHONE it is `7rem`: the About card is 512px at most, and the 152px
|
|
62
|
+
* track left the agent's own name ~130px, so `command-code` and
|
|
63
|
+
* `deepseek-harness` were the cells that truncated while the name is the one
|
|
64
|
+
* thing a reader is scanning for. The version line ellipsizes instead, and
|
|
65
|
+
* carries its full text in `title`.
|
|
66
|
+
*
|
|
67
|
+
* It stays a FIXED track rather than `auto`: every row is its own grid, so an
|
|
68
|
+
* `auto` track is measured per row and the version numbers stop lining up in a
|
|
69
|
+
* column (measured: a name cell of 352px on one row and 208px on the next).
|
|
70
|
+
*
|
|
71
|
+
* The name takes the slack and ellipsizes. The card's own width is FIXED
|
|
72
|
+
* (`md:w-[880px]`), so the name track cannot collapse the dialog — that only
|
|
73
|
+
* happened while the card was `w-auto`.
|
|
74
|
+
*
|
|
75
|
+
* `items-start`, not `items-center`: each cell holds two lines whose heights
|
|
76
|
+
* differ from row to row (a version cell is 16px alone and 31px with an
|
|
77
|
+
* `adapter …` line under it), and centering measured the number 7.5px BELOW the
|
|
78
|
+
* name it belongs to. Top-aligned, line one of every cell shares one baseline.
|
|
79
|
+
*/
|
|
80
|
+
const COLUMNS = 'grid grid-cols-[minmax(0,1fr)_7rem_1.75rem] items-start gap-x-2 md:grid-cols-[minmax(0,1fr)_9.5rem_1.75rem]';
|
|
81
|
+
|
|
82
|
+
export function HarnessRow({
|
|
83
|
+
entry, version, job, problem, onOpenHarness, onUpdate, onOpenLog,
|
|
84
|
+
}: HarnessRowProps) {
|
|
85
|
+
const status = harnessStatus(entry);
|
|
86
|
+
// Three states, three answers: a worker is installing this one, this one is
|
|
87
|
+
// WAITING for the install ahead of it, or nothing is running and the record is
|
|
88
|
+
// the run that settled.
|
|
89
|
+
const isUpdating = jobRunning(job);
|
|
90
|
+
const isQueued = jobQueued(job);
|
|
91
|
+
const busy = isUpdating || isQueued;
|
|
92
|
+
const progress = isUpdating ? runningStepOf(job) : null;
|
|
93
|
+
// The row that owns the record gets the log line: while it waits or installs,
|
|
94
|
+
// and after it settles so the output is not lost with it.
|
|
95
|
+
const showLogLine = busy || job?.finishedAt != null;
|
|
96
|
+
// The number a reader calls "the version": the CLI when the harness is an
|
|
97
|
+
// adapter, otherwise the agent itself. Each part carries its own `latest` and
|
|
98
|
+
// its own ability to move, so the two are never compared across each other.
|
|
99
|
+
//
|
|
100
|
+
// A CLI part EXISTS for every adapter even when its `--version` could not be
|
|
101
|
+
// read (the binary is absent, or its launcher is broken). Taking that empty
|
|
102
|
+
// part as the lead painted `—` over a known adapter number: measured on
|
|
103
|
+
// `zcode` (adapter 0.82.3 probed, no `zcode` runtime) and `claude`
|
|
104
|
+
// (`claude --version` fails while the adapter answers). The part that HAS a
|
|
105
|
+
// number leads.
|
|
106
|
+
const cli = version?.cli ?? null;
|
|
107
|
+
const agent = version?.agent ?? null;
|
|
108
|
+
const lead = cli?.version ? cli : agent;
|
|
109
|
+
const showAdapterLine = Boolean(
|
|
110
|
+
cli?.version && agent?.version && agent.version !== cli.version,
|
|
111
|
+
);
|
|
112
|
+
// What the press would install, named: an adapter and a CLI are two different
|
|
113
|
+
// products, so the accessible name says which is moving.
|
|
114
|
+
const targets = version
|
|
115
|
+
? [
|
|
116
|
+
version.agent.updateAvailable && version.agent.latest
|
|
117
|
+
? version.cli ? `adapter ${version.agent.latest}` : version.agent.latest
|
|
118
|
+
: null,
|
|
119
|
+
version.cli?.updateAvailable && version.cli.latest
|
|
120
|
+
? `${version.cli.name} ${version.cli.latest}`
|
|
121
|
+
: null,
|
|
122
|
+
].filter((target): target is string => Boolean(target))
|
|
123
|
+
: [];
|
|
124
|
+
const updateLabel = `Update ${entry.label}${targets.length > 0 ? ` to ${targets.join(' + ')}` : ''}`;
|
|
125
|
+
// While the background worker runs, the button names the STEP it is on: one
|
|
126
|
+
// press can be an adapter install and then `claude update`, and "Updating…"
|
|
127
|
+
// alone would hide which half is moving. A run that is WAITING says so — it
|
|
128
|
+
// started when it was accepted, it installs when the queue reaches it.
|
|
129
|
+
const actionLabel = isQueued
|
|
130
|
+
? `Queued: ${entry.label} update starts after the install that is running`
|
|
131
|
+
: isUpdating && progress ? `Updating ${entry.label}: ${progress}` : updateLabel;
|
|
132
|
+
|
|
133
|
+
return (
|
|
134
|
+
<div className={`${COLUMNS} border-b border-ink/5 py-1.5`}>
|
|
135
|
+
{/* The name is the link: one target per row, and the row's other
|
|
136
|
+
cells stay selectable text.
|
|
137
|
+
TWO lines per cell, and the same two line boxes on both
|
|
138
|
+
sides: the name and its version share row one (16px), the
|
|
139
|
+
state label and the adapter line share row two (15px). Every
|
|
140
|
+
cell is a flex COLUMN of those two rows, which is what makes
|
|
141
|
+
`ready` sit exactly under `2.1.318` and beside
|
|
142
|
+
`adapter 0.100.0 →` (measured 8px apart when the cells were
|
|
143
|
+
centered independently). */}
|
|
144
|
+
<button
|
|
145
|
+
type="button"
|
|
146
|
+
onClick={onOpenHarness}
|
|
147
|
+
title={status.detail ?? undefined}
|
|
148
|
+
aria-label={`${entry.label} — ${status.label}. Open its settings.`}
|
|
149
|
+
className="flex min-w-0 cursor-pointer items-start gap-1.5 text-left"
|
|
150
|
+
>
|
|
151
|
+
{/* The glyph rides the FIRST row, not the middle of the pair:
|
|
152
|
+
centered on both rows it landed between the name and the
|
|
153
|
+
state label. */}
|
|
154
|
+
<span className="flex h-4 shrink-0 items-center">
|
|
155
|
+
<HarnessGlyph harness={entry.id} size={HARNESS_GLYPH_SIZE.compact} />
|
|
156
|
+
</span>
|
|
157
|
+
{/* The state mark sits in the label's TOP-RIGHT CORNER, not in
|
|
158
|
+
the flow: as a trailing child it took a column of its own and
|
|
159
|
+
every agent name lost ~14px to a 6px dot. Positioned, the
|
|
160
|
+
label keeps its width and the mark still reads as a status
|
|
161
|
+
light on that name. */}
|
|
162
|
+
<span className="flex min-w-0 flex-1 flex-col">
|
|
163
|
+
{/* The mark sits at the top-right of the NAME ITSELF, so the
|
|
164
|
+
wrapper must HUG the text — a `flex-1` wrapper anchored the
|
|
165
|
+
dot to the column's edge instead, which read as a marker on
|
|
166
|
+
the version beside it. `max-w-full` keeps it on the name and
|
|
167
|
+
still allows the truncation. */}
|
|
168
|
+
<span className="flex max-w-full items-center gap-1.5">
|
|
169
|
+
<span className={`truncate text-[11px] leading-4 ${status.state === 'ready' ? 'font-medium text-ink' : 'text-ink/70'}`}>
|
|
170
|
+
{entry.label}
|
|
171
|
+
</span>
|
|
172
|
+
<StateMark state={status.state} />
|
|
173
|
+
</span>
|
|
174
|
+
<span className="block truncate text-[10px] leading-[15px] text-ink/40">{status.label}</span>
|
|
175
|
+
</span>
|
|
176
|
+
</button>
|
|
177
|
+
|
|
178
|
+
{/* TWO number lines, each with its OWN arrow.
|
|
179
|
+
A harness can be an adapter over a CLI, and the two move
|
|
180
|
+
independently: the row leads with the CLI's `2.1.318` and states
|
|
181
|
+
`adapter 0.101.0` underneath, so `→` may only ever join the two
|
|
182
|
+
numbers on ITS line. Joining `2.1.318` with the adapter's latest
|
|
183
|
+
would compare two different products — the fiction this cell
|
|
184
|
+
exists to prevent. */}
|
|
185
|
+
<span
|
|
186
|
+
className="flex min-w-0 flex-col items-end text-right font-mono text-[11px] leading-4 text-ink/70"
|
|
187
|
+
title={version?.note ?? undefined}
|
|
188
|
+
>
|
|
189
|
+
<span className="block max-w-full truncate">
|
|
190
|
+
{/* The CLI's version leads when the harness is an ADAPTER: it
|
|
191
|
+
is the number a user recognises (`claude --version` →
|
|
192
|
+
2.1.318). */}
|
|
193
|
+
{lead?.version ?? <span className="text-ink/30">—</span>}
|
|
194
|
+
{lead?.updateAvailable && lead.latest && (
|
|
195
|
+
<>
|
|
196
|
+
<span aria-hidden="true" className="ml-1 text-ink/35">→</span>
|
|
197
|
+
<span className="ml-1 text-ink">{lead.latest}</span>
|
|
198
|
+
</>
|
|
199
|
+
)}
|
|
200
|
+
</span>
|
|
201
|
+
{/* The adapter's own number and its own move. It lives INSIDE
|
|
202
|
+
the version cell — as a fourth grid child it shifted every
|
|
203
|
+
row one track and moved the action button onto its own line. */}
|
|
204
|
+
{showAdapterLine && version && (
|
|
205
|
+
<span
|
|
206
|
+
className="block max-w-full truncate text-[10px] leading-[15px] text-ink/35"
|
|
207
|
+
title={`${version.cli?.name ?? 'CLI'} ${version.cli?.version ?? 'unknown'} · adapter ${version.agent.version}`}
|
|
208
|
+
>
|
|
209
|
+
adapter {version.agent.version}
|
|
210
|
+
{version.agent.updateAvailable && version.agent.latest
|
|
211
|
+
? ` → ${version.agent.latest}`
|
|
212
|
+
: ''}
|
|
213
|
+
</span>
|
|
214
|
+
)}
|
|
215
|
+
</span>
|
|
216
|
+
|
|
217
|
+
<div className="flex min-w-0 justify-end">
|
|
218
|
+
{/* ICON ONLY, and only when there is something to move to.
|
|
219
|
+
A row with no newer version shows nothing: a permanent action
|
|
220
|
+
button claims work that does not exist. The label lives in
|
|
221
|
+
`title` + `aria-label`, so the meaning is not lost — it is just
|
|
222
|
+
not spent on every row. The icon is a DOWNLOAD arrow because
|
|
223
|
+
that is what the press does; it used to be `ArrowUpRight`, which
|
|
224
|
+
reads as "open this elsewhere". */}
|
|
225
|
+
{version?.updateAvailable ? (
|
|
226
|
+
<button
|
|
227
|
+
type="button"
|
|
228
|
+
onClick={onUpdate}
|
|
229
|
+
// Disabled for BOTH halves: a second press for a harness
|
|
230
|
+
// that is already waiting would only be refused, and the
|
|
231
|
+
// button's own state is the answer.
|
|
232
|
+
disabled={busy}
|
|
233
|
+
aria-label={actionLabel}
|
|
234
|
+
title={actionLabel}
|
|
235
|
+
className="inline-flex cursor-pointer items-center justify-center rounded border border-ink/25 p-1 text-ink transition-colors hover:border-ink/50 hover:bg-ink/5 disabled:cursor-not-allowed disabled:opacity-50"
|
|
236
|
+
>
|
|
237
|
+
{busy
|
|
238
|
+
? <Loader2 size={11} className="animate-spin motion-reduce:animate-none" />
|
|
239
|
+
: <Download size={11} />}
|
|
240
|
+
</button>
|
|
241
|
+
) : (
|
|
242
|
+
<span className="text-[10px] text-ink/25">—</span>
|
|
243
|
+
)}
|
|
244
|
+
</div>
|
|
245
|
+
|
|
246
|
+
{problem && (
|
|
247
|
+
<span className="col-span-3 pb-1 text-[10px] text-ink/70">{problem}</span>
|
|
248
|
+
)}
|
|
249
|
+
|
|
250
|
+
{showLogLine && (
|
|
251
|
+
<UpdateLogLine
|
|
252
|
+
running={isUpdating}
|
|
253
|
+
queued={isQueued}
|
|
254
|
+
progress={progress}
|
|
255
|
+
message={job?.message ?? null}
|
|
256
|
+
onOpenLog={onOpenLog}
|
|
257
|
+
/>
|
|
258
|
+
)}
|
|
259
|
+
</div>
|
|
260
|
+
);
|
|
261
|
+
}
|