@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
|
@@ -77,6 +77,25 @@ describe('run model on the stream row', () => {
|
|
|
77
77
|
expect((await loadStreamStates()).s1?.model).toEqual({ provider: 'openai', modelId: 'gpt-5' });
|
|
78
78
|
});
|
|
79
79
|
|
|
80
|
+
test('a failed finish keeps its reason, and the next run clears it', async () => {
|
|
81
|
+
await markStreamStatus('s1', 'stream');
|
|
82
|
+
await markStreamStatus('s1', 'finish', undefined, ' 401 invalid api key ');
|
|
83
|
+
expect((await loadStreamStates()).s1).toEqual({
|
|
84
|
+
status: 'finish',
|
|
85
|
+
failure: '401 invalid api key',
|
|
86
|
+
});
|
|
87
|
+
|
|
88
|
+
// A new run must not inherit the previous run's failure: otherwise its
|
|
89
|
+
// normal end would be announced as an error.
|
|
90
|
+
await markStreamStatus('s1', 'stream');
|
|
91
|
+
expect((await loadStreamStates()).s1).toEqual({ status: 'stream' });
|
|
92
|
+
});
|
|
93
|
+
|
|
94
|
+
test('a reason is stored only on a finish row', async () => {
|
|
95
|
+
await markStreamStatus('s1', 'abort', undefined, 'not a finish');
|
|
96
|
+
expect((await loadStreamStates()).s1).toEqual({ status: 'abort' });
|
|
97
|
+
});
|
|
98
|
+
|
|
80
99
|
test('a row written without a model reports none, and the status view is status-only', async () => {
|
|
81
100
|
await markStreamStatus('s2', 'abort');
|
|
82
101
|
expect((await loadStreamStates()).s2).toEqual({ status: 'abort' });
|
|
@@ -29,6 +29,11 @@
|
|
|
29
29
|
* second instance opening its sidebar judged the first instance's live run by
|
|
30
30
|
* its own empty registry and cleared a spinner that was still working.
|
|
31
31
|
*
|
|
32
|
+
* A terminal `finish` may also carry `failure` — the agent's own reason when
|
|
33
|
+
* the run failed. It rides this row for the same reason the model does: a tab
|
|
34
|
+
* that never opened the session has no other durable source, and the failure
|
|
35
|
+
* notification is only useful with the reason. A new `stream` write clears it.
|
|
36
|
+
*
|
|
32
37
|
* Every write raises the realtime `stream-status` signal, which is what the
|
|
33
38
|
* socket's `sidebar:status` topic publishes from. All writes are
|
|
34
39
|
* fire-and-forget: a status write must never fail a prompt.
|
|
@@ -49,6 +54,13 @@ export interface SessionRunModel {
|
|
|
49
54
|
export interface SessionStreamState {
|
|
50
55
|
status: SessionStreamStatus;
|
|
51
56
|
model?: SessionRunModel;
|
|
57
|
+
/**
|
|
58
|
+
* Why a terminal `finish` run failed, when the agent said. NULL/absent is a
|
|
59
|
+
* normal stop. It rides this row because a tab that never opened the session
|
|
60
|
+
* has no other durable source for the reason, and the notification that says
|
|
61
|
+
* "this run failed" is only useful with it.
|
|
62
|
+
*/
|
|
63
|
+
failure?: string;
|
|
52
64
|
}
|
|
53
65
|
|
|
54
66
|
/**
|
|
@@ -64,6 +76,7 @@ export async function markStreamStatus(
|
|
|
64
76
|
sessionId: string,
|
|
65
77
|
status: SessionStreamStatus,
|
|
66
78
|
model?: SessionRunModel | null,
|
|
79
|
+
failure?: string | null,
|
|
67
80
|
): Promise<void> {
|
|
68
81
|
try {
|
|
69
82
|
const db = await getDb();
|
|
@@ -71,16 +84,20 @@ export async function markStreamStatus(
|
|
|
71
84
|
// belongs to no process, and leaving a pid on it would invite a later read
|
|
72
85
|
// to judge the badge by the liveness of a process it never concerned.
|
|
73
86
|
const ownerPid = status === 'stream' ? process.pid : null;
|
|
87
|
+
// A live or aborted row never carries a reason, and a new `stream` write
|
|
88
|
+
// clears the previous run's: the next terminal settle must not inherit it.
|
|
89
|
+
const reason = status === 'finish' && typeof failure === 'string' ? failure.trim() : '';
|
|
74
90
|
await db.run(
|
|
75
|
-
`INSERT INTO session_stream_state (session_id, status, owner_pid, model_provider, model_id, updated_at)
|
|
76
|
-
VALUES (?, ?, ?, ?, ?, CURRENT_TIMESTAMP)
|
|
91
|
+
`INSERT INTO session_stream_state (session_id, status, owner_pid, model_provider, model_id, failure, updated_at)
|
|
92
|
+
VALUES (?, ?, ?, ?, ?, ?, CURRENT_TIMESTAMP)
|
|
77
93
|
ON CONFLICT(session_id) DO UPDATE SET
|
|
78
94
|
status = excluded.status,
|
|
79
95
|
owner_pid = excluded.owner_pid,
|
|
80
96
|
model_provider = COALESCE(excluded.model_provider, session_stream_state.model_provider),
|
|
81
97
|
model_id = COALESCE(excluded.model_id, session_stream_state.model_id),
|
|
98
|
+
failure = excluded.failure,
|
|
82
99
|
updated_at = excluded.updated_at`,
|
|
83
|
-
[sessionId, status, ownerPid, model?.provider ?? null, model?.modelId ?? null],
|
|
100
|
+
[sessionId, status, ownerPid, model?.provider ?? null, model?.modelId ?? null, reason || null],
|
|
84
101
|
);
|
|
85
102
|
// The signal bus has no imports of its own, so this edge cannot close a
|
|
86
103
|
// cycle: the realtime layer subscribes to it, and this module only raises.
|
|
@@ -168,20 +185,23 @@ export async function markStreamSeen(sessionId: string): Promise<boolean> {
|
|
|
168
185
|
export async function loadStreamStates(): Promise<Record<string, SessionStreamState>> {
|
|
169
186
|
try {
|
|
170
187
|
const db = await getDb();
|
|
171
|
-
const rows = (await db.all('SELECT session_id, status, model_provider, model_id FROM session_stream_state')) as {
|
|
188
|
+
const rows = (await db.all('SELECT session_id, status, model_provider, model_id, failure FROM session_stream_state')) as {
|
|
172
189
|
session_id: string;
|
|
173
190
|
status: string;
|
|
174
191
|
model_provider: string | null;
|
|
175
192
|
model_id: string | null;
|
|
193
|
+
failure: string | null;
|
|
176
194
|
}[];
|
|
177
195
|
const map: Record<string, SessionStreamState> = {};
|
|
178
196
|
for (const row of rows) {
|
|
179
197
|
if (row.status !== 'stream' && row.status !== 'finish' && row.status !== 'abort') continue;
|
|
198
|
+
const failure = typeof row.failure === 'string' ? row.failure.trim() : '';
|
|
180
199
|
map[row.session_id] = {
|
|
181
200
|
status: row.status,
|
|
182
201
|
...(row.model_provider && row.model_id
|
|
183
202
|
? { model: { provider: row.model_provider, modelId: row.model_id } }
|
|
184
203
|
: {}),
|
|
204
|
+
...(failure ? { failure } : {}),
|
|
185
205
|
};
|
|
186
206
|
}
|
|
187
207
|
return map;
|
|
@@ -36,6 +36,9 @@ export const DEFAULT_SETTINGS = {
|
|
|
36
36
|
autoSessionTitle: true,
|
|
37
37
|
soundAlerts: true,
|
|
38
38
|
chatCompletionSound: true,
|
|
39
|
+
notifyOnFinish: false,
|
|
40
|
+
notifyOnAsk: false,
|
|
41
|
+
notifyOnError: false,
|
|
39
42
|
goalAuditEnabled: true,
|
|
40
43
|
goalAuditModel: '',
|
|
41
44
|
goalDefaultBudget: null,
|
|
@@ -37,6 +37,19 @@ export interface HarnessUpdateJob {
|
|
|
37
37
|
startedAt: number;
|
|
38
38
|
/** Null while running: this is the field that says whether to poll. */
|
|
39
39
|
finishedAt: number | null;
|
|
40
|
+
/**
|
|
41
|
+
* When this run was ACCEPTED while another harness was already installing.
|
|
42
|
+
*
|
|
43
|
+
* Two presses are no longer one press refused: the record carries this stamp
|
|
44
|
+
* and the queue starts the install when the one ahead of it finishes. A record
|
|
45
|
+
* with `pid: null`, `finishedAt: null` and this set is WAITING — not a worker
|
|
46
|
+
* that died — and must never be settled as a failure. The worker clears it
|
|
47
|
+
* when it takes the run over.
|
|
48
|
+
*
|
|
49
|
+
* Optional because a record written before the queue existed has no such
|
|
50
|
+
* field; readers normalize with `jobQueued`.
|
|
51
|
+
*/
|
|
52
|
+
queuedAt?: number | null;
|
|
40
53
|
/** The WORKER process, used to tell a run that is still alive from one that
|
|
41
54
|
* died without writing its result (a crash, a kill, a reboot). */
|
|
42
55
|
pid: number | null;
|
|
@@ -51,6 +64,17 @@ export interface HarnessUpdateJob {
|
|
|
51
64
|
* probe and CLI version caches, repoint the launch line). The worker cannot
|
|
52
65
|
* do those: they read the database, which the server owns. */
|
|
53
66
|
applied: boolean;
|
|
67
|
+
/**
|
|
68
|
+
* The post-install PROBE: the freshly installed agent is asked what it is, so
|
|
69
|
+
* the row stops quoting the version that was just replaced.
|
|
70
|
+
*
|
|
71
|
+
* `pending` while that probe runs (it spawns an agent process, so the
|
|
72
|
+
* install's own report is not held up by it), `done` once its answer is in the
|
|
73
|
+
* probe cache, and null when this run has nothing to probe — it failed, or the
|
|
74
|
+
* vendor owns the install. A polling dialog keys its "keep going" on this, and
|
|
75
|
+
* re-reads the version rows when it turns `done`.
|
|
76
|
+
*/
|
|
77
|
+
probe?: 'pending' | 'done' | null;
|
|
54
78
|
/** The launch command a successful install left behind, when it moved it. */
|
|
55
79
|
repointed: string | null;
|
|
56
80
|
}
|
|
@@ -28,6 +28,8 @@ export interface SidebarStatusEntry {
|
|
|
28
28
|
streamStatus?: 'stream' | 'finish' | 'abort';
|
|
29
29
|
awaitingInput?: boolean;
|
|
30
30
|
runModel?: SessionRunModel;
|
|
31
|
+
/** Present only on a failed terminal run; the notification's own reason. */
|
|
32
|
+
runFailure?: string;
|
|
31
33
|
}
|
|
32
34
|
|
|
33
35
|
/** `sidebar:status` — keyed by session id. Absent id means "no volatile fields". */
|
|
@@ -81,6 +81,16 @@ export interface SettingsState {
|
|
|
81
81
|
autoSessionTitle: boolean;
|
|
82
82
|
soundAlerts: boolean;
|
|
83
83
|
chatCompletionSound: boolean;
|
|
84
|
+
/**
|
|
85
|
+
* System notification when a run finishes. Off by default: a fresh install
|
|
86
|
+
* never asks for notification permission until one of these is turned on.
|
|
87
|
+
* Shown only while Kabmo is not the focused window.
|
|
88
|
+
*/
|
|
89
|
+
notifyOnFinish: boolean;
|
|
90
|
+
/** System notification when an agent blocks on an ask/approval dialog. */
|
|
91
|
+
notifyOnAsk: boolean;
|
|
92
|
+
/** System notification when a run ends in failure. */
|
|
93
|
+
notifyOnError: boolean;
|
|
84
94
|
/**
|
|
85
95
|
* Whether Kabmo's goal loop runs at all: an independent auditor decides
|
|
86
96
|
* after every finished turn whether the goal continues. Off means a goal
|
|
@@ -31,6 +31,10 @@ export interface SessionItemData {
|
|
|
31
31
|
* waiting for a user answer. Derived from the running process registry, never
|
|
32
32
|
* persisted — the process it describes is the same thing that owns the flag. */
|
|
33
33
|
awaitingInput?: boolean;
|
|
34
|
+
/** Set on a terminal `finish` row whose run ended in failure, with the
|
|
35
|
+
* agent's own reason when it reported one. Rides the status topic beside
|
|
36
|
+
* `streamStatus` so a background tab can announce the failure. */
|
|
37
|
+
runFailure?: string;
|
|
34
38
|
/** Model serving the session's current run — persisted beside `streamStatus`
|
|
35
39
|
* (session_stream_state) so the generating indicator names the real
|
|
36
40
|
* provider/model in every tab and Kabmo instances. Absent for a session
|
|
@@ -15,6 +15,7 @@ import { Window } from 'happy-dom';
|
|
|
15
15
|
import { h, render } from 'preact';
|
|
16
16
|
import { act } from 'preact/test-utils';
|
|
17
17
|
import { HarnessTable } from '@/client/components/layout/session-sidebar/about-modal/HarnessTable';
|
|
18
|
+
import type { HarnessUpdateJob } from '@/shared/types/harness-update';
|
|
18
19
|
import type { HarnessVersionRow } from '@/shared/types/harness-version';
|
|
19
20
|
import { installDomGlobals, restoreDomGlobals } from '@/test-support/pristine-globals';
|
|
20
21
|
import type { HarnessSummary } from '@/shared/types/harness';
|
|
@@ -83,15 +84,13 @@ export function mountHarnessTable(
|
|
|
83
84
|
onOpen?: (id: string) => void,
|
|
84
85
|
onUpdate?: (id: string) => Promise<string | null>,
|
|
85
86
|
/**
|
|
86
|
-
* The
|
|
87
|
-
* arguments because only the log cases need
|
|
87
|
+
* The update records and the log opener. Kept apart from the positional
|
|
88
|
+
* arguments because only the log cases need them, and the earlier callers are
|
|
88
89
|
* about the row's layout.
|
|
89
90
|
*/
|
|
90
91
|
state?: {
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
log?: { harness: string; message: string | null } | null;
|
|
94
|
-
onOpenLog?: () => void;
|
|
92
|
+
jobs?: HarnessUpdateJob[];
|
|
93
|
+
onOpenLog?: (harness: string) => void;
|
|
95
94
|
},
|
|
96
95
|
): HTMLElement {
|
|
97
96
|
act(() =>
|
|
@@ -101,9 +100,7 @@ export function mountHarnessTable(
|
|
|
101
100
|
versions,
|
|
102
101
|
onOpenHarness: onOpen ?? (() => {}),
|
|
103
102
|
onUpdate: onUpdate ?? (async () => null),
|
|
104
|
-
|
|
105
|
-
progress: state?.progress ?? null,
|
|
106
|
-
log: state?.log ?? null,
|
|
103
|
+
jobs: state?.jobs ?? [],
|
|
107
104
|
onOpenLog: state?.onOpenLog,
|
|
108
105
|
}),
|
|
109
106
|
container,
|
|
@@ -112,6 +109,25 @@ export function mountHarnessTable(
|
|
|
112
109
|
return container;
|
|
113
110
|
}
|
|
114
111
|
|
|
112
|
+
/** An update record: installing by default, queued or settled by override. */
|
|
113
|
+
export function updateJob(overrides: Partial<HarnessUpdateJob> = {}): HarnessUpdateJob {
|
|
114
|
+
return {
|
|
115
|
+
harness: 'claude',
|
|
116
|
+
label: 'claude',
|
|
117
|
+
startedAt: Date.now(),
|
|
118
|
+
finishedAt: null,
|
|
119
|
+
queuedAt: null,
|
|
120
|
+
pid: 4242,
|
|
121
|
+
steps: [{ part: 'adapter', command: 'npm install -g x', argv: ['npm', 'install', '-g', 'x'], state: 'running', code: null }],
|
|
122
|
+
output: '',
|
|
123
|
+
ok: null,
|
|
124
|
+
message: null,
|
|
125
|
+
applied: false,
|
|
126
|
+
repointed: null,
|
|
127
|
+
...overrides,
|
|
128
|
+
};
|
|
129
|
+
}
|
|
130
|
+
|
|
115
131
|
/** The rows, which are the direct children of the grid that draws them. */
|
|
116
132
|
export function harnessRows(el: HTMLElement): HTMLElement[] {
|
|
117
133
|
// `data-harness-rows`, not the grid's scrollbar class: the list stopped being
|