@aragon-agent/cli 0.5.8 → 0.5.10
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/CHANGELOG.md +1157 -747
- package/README.md +1552 -1163
- package/dist/agent/coalesce.d.ts +13 -0
- package/dist/agent/coalesce.js +50 -11
- package/dist/agent/controller.d.ts +141 -2
- package/dist/agent/controller.js +396 -4
- package/dist/agent/headless.d.ts +8 -0
- package/dist/agent/headless.js +40 -0
- package/dist/agent/reducer.d.ts +245 -3
- package/dist/agent/reducer.js +490 -17
- package/dist/agent/retry-view.d.ts +68 -0
- package/dist/agent/retry-view.js +95 -0
- package/dist/agent/system-prompt.d.ts +11 -0
- package/dist/agent/system-prompt.js +2 -0
- package/dist/boot/guard.d.ts +135 -0
- package/dist/boot/guard.js +218 -0
- package/dist/boot/rollback.d.ts +86 -0
- package/dist/boot/rollback.js +185 -0
- package/dist/cli.js +368 -3
- package/dist/commands/builtins.d.ts +1 -1
- package/dist/commands/builtins.js +426 -2
- package/dist/commands/registry.d.ts +17 -0
- package/dist/config/app-paths.d.ts +31 -0
- package/dist/config/app-paths.js +37 -0
- package/dist/config/cli-commands.d.ts +79 -2
- package/dist/config/cli-commands.js +185 -3
- package/dist/config/env.d.ts +15 -3
- package/dist/config/env.js +143 -3
- package/dist/config/load.d.ts +66 -0
- package/dist/config/load.js +107 -1
- package/dist/config/schema.d.ts +268 -2
- package/dist/config/schema.js +288 -1
- package/dist/config/store.js +32 -1
- package/dist/fast/critique.d.ts +43 -0
- package/dist/fast/critique.js +62 -0
- package/dist/fast/digest.d.ts +42 -0
- package/dist/fast/digest.js +85 -0
- package/dist/fast/frames.d.ts +99 -0
- package/dist/fast/frames.js +180 -0
- package/dist/fast/limits.d.ts +98 -0
- package/dist/fast/limits.js +98 -0
- package/dist/fast/prompt.d.ts +72 -0
- package/dist/fast/prompt.js +94 -0
- package/dist/fast/resolve.d.ts +43 -0
- package/dist/fast/resolve.js +105 -0
- package/dist/fast/review-call.d.ts +99 -0
- package/dist/fast/review-call.js +130 -0
- package/dist/fast/reviewer.d.ts +248 -0
- package/dist/fast/reviewer.js +664 -0
- package/dist/fast/types.d.ts +128 -0
- package/dist/fast/types.js +14 -0
- package/dist/fast/wiring.d.ts +170 -0
- package/dist/fast/wiring.js +316 -0
- package/dist/launcher.d.ts +14 -0
- package/dist/launcher.js +43 -0
- package/dist/logging/install.d.ts +15 -1
- package/dist/logging/install.js +37 -4
- package/dist/logging/logger.d.ts +1 -1
- package/dist/session/persist.js +57 -1
- package/dist/team/normalize.d.ts +26 -1
- package/dist/team/normalize.js +23 -3
- package/dist/team/prompt.d.ts +11 -0
- package/dist/team/prompt.js +10 -0
- package/dist/team/report.d.ts +18 -0
- package/dist/team/report.js +27 -1
- package/dist/team/runtime.d.ts +13 -2
- package/dist/team/runtime.js +33 -6
- package/dist/team/subagent.d.ts +19 -1
- package/dist/team/subagent.js +72 -10
- package/dist/team/task-tool.d.ts +26 -0
- package/dist/team/task-tool.js +48 -4
- package/dist/team/types.d.ts +80 -1
- package/dist/tools/bash-tool.js +19 -3
- package/dist/tools/diff.d.ts +25 -5
- package/dist/tools/diff.js +72 -41
- package/dist/tools/file-change-store.d.ts +34 -0
- package/dist/tools/file-change-store.js +57 -0
- package/dist/tools/fs-tools.d.ts +26 -0
- package/dist/tools/fs-tools.js +62 -5
- package/dist/tools/index.d.ts +31 -0
- package/dist/tools/index.js +7 -1
- package/dist/tools/patch.d.ts +115 -0
- package/dist/tools/patch.js +453 -0
- package/dist/tools/terminal-output.d.ts +107 -0
- package/dist/tools/terminal-output.js +198 -0
- package/dist/tools/tool-output-store.d.ts +68 -0
- package/dist/tools/tool-output-store.js +102 -0
- package/dist/ui/ActivityLine.d.ts +48 -0
- package/dist/ui/ActivityLine.js +22 -0
- package/dist/ui/App.d.ts +11 -4
- package/dist/ui/App.js +359 -37
- package/dist/ui/BottomStatusRow.d.ts +65 -0
- package/dist/ui/BottomStatusRow.js +17 -0
- package/dist/ui/Composer.d.ts +1 -6
- package/dist/ui/Composer.js +2 -2
- package/dist/ui/PromptInput.d.ts +1 -15
- package/dist/ui/PromptInput.js +1 -38
- package/dist/ui/StatusBar.d.ts +37 -0
- package/dist/ui/StatusBar.js +5 -3
- package/dist/ui/TeamPanel.d.ts +5 -4
- package/dist/ui/TeamPanel.js +1 -1
- package/dist/ui/TodoPanel.d.ts +5 -4
- package/dist/ui/Transcript.d.ts +26 -3
- package/dist/ui/Transcript.js +76 -10
- package/dist/ui/UpdateLine.d.ts +44 -0
- package/dist/ui/UpdateLine.js +129 -0
- package/dist/ui/activity-phrases.d.ts +33 -0
- package/dist/ui/activity-phrases.js +50 -0
- package/dist/ui/entries/AssistantEntry.d.ts +20 -0
- package/dist/ui/entries/AssistantEntry.js +3 -2
- package/dist/ui/entries/DiffView.d.ts +67 -0
- package/dist/ui/entries/DiffView.js +103 -0
- package/dist/ui/entries/FastCard.d.ts +53 -0
- package/dist/ui/entries/FastCard.js +87 -0
- package/dist/ui/entries/RetryCard.d.ts +56 -0
- package/dist/ui/entries/RetryCard.js +60 -0
- package/dist/ui/entries/TeamCard.js +6 -1
- package/dist/ui/entries/ToolCard.d.ts +38 -1
- package/dist/ui/entries/ToolCard.js +68 -5
- package/dist/ui/glyphs.d.ts +9 -0
- package/dist/ui/glyphs.js +2 -0
- package/dist/ui/layout/AppShell.d.ts +13 -22
- package/dist/ui/layout/AppShell.js +3 -38
- package/dist/ui/layout/virtual-window.d.ts +1 -1
- package/dist/ui/layout/virtual-window.js +109 -5
- package/dist/ui/overlays/HelpOverlay.js +16 -2
- package/dist/ui/overlays/SettingsScreen.d.ts +82 -1
- package/dist/ui/overlays/SettingsScreen.js +147 -1
- package/dist/ui/transcript-text.js +27 -0
- package/dist/ui/use-wheel-routing.d.ts +16 -32
- package/dist/ui/use-wheel-routing.js +21 -38
- package/dist/update/classify-failure.d.ts +32 -0
- package/dist/update/classify-failure.js +60 -0
- package/dist/update/install-lock.d.ts +55 -0
- package/dist/update/install-lock.js +184 -0
- package/dist/update/install-source.d.ts +97 -0
- package/dist/update/install-source.js +218 -0
- package/dist/update/installer.d.ts +108 -0
- package/dist/update/installer.js +242 -0
- package/dist/update/limits.d.ts +111 -0
- package/dist/update/limits.js +111 -0
- package/dist/update/npm-view.d.ts +62 -0
- package/dist/update/npm-view.js +133 -0
- package/dist/update/registry.d.ts +52 -0
- package/dist/update/registry.js +161 -0
- package/dist/update/semver.d.ts +89 -0
- package/dist/update/semver.js +295 -0
- package/dist/update/service.d.ts +193 -0
- package/dist/update/service.js +636 -0
- package/dist/update/state.d.ts +103 -0
- package/dist/update/state.js +142 -0
- package/dist/update/types.d.ts +169 -0
- package/dist/update/types.js +68 -0
- package/package.json +3 -3
- package/dist/ui/layout/regions.d.ts +0 -55
- package/dist/ui/layout/regions.js +0 -52
package/dist/agent/reducer.d.ts
CHANGED
|
@@ -13,7 +13,10 @@
|
|
|
13
13
|
import type { AgentEvent, ModelCost, ToolResult, TokenUsage } from '@aragon-agent/core';
|
|
14
14
|
import type { AgentMode } from './agent-mode.js';
|
|
15
15
|
import type { DispatchOutcome, SubagentRun, SubagentSpec, TeamSnapshot } from '../team/types.js';
|
|
16
|
+
import type { FastReview, FastSnapshot } from '../fast/types.js';
|
|
16
17
|
import type { TodoItem, TodoSnapshot } from '../todo/types.js';
|
|
18
|
+
import type { RetryPhase } from './retry-view.js';
|
|
19
|
+
import type { FilePatch } from '../tools/patch.js';
|
|
17
20
|
export type NoticeLevel = 'info' | 'warn' | 'error';
|
|
18
21
|
export type ToastLevel = NoticeLevel | 'success';
|
|
19
22
|
export type Overlay = null | 'settings' | 'model' | 'help' | 'confirm' | 'question' | 'plan';
|
|
@@ -40,6 +43,21 @@ export type Entry = {
|
|
|
40
43
|
streaming: boolean;
|
|
41
44
|
aborted?: boolean;
|
|
42
45
|
usage?: TokenUsage;
|
|
46
|
+
/**
|
|
47
|
+
* Epoch ms the turn started reasoning (agent-activity-presentation §3.1.2).
|
|
48
|
+
* Set by `thinkingStart`, cleared by `streamRestart`.
|
|
49
|
+
*/
|
|
50
|
+
thinkingStartedAt?: number;
|
|
51
|
+
/**
|
|
52
|
+
* Wall-clock reasoning time, SEALED ONCE — at the first text delta, or at
|
|
53
|
+
* turn/run end for a turn that thought and then called a tool without
|
|
54
|
+
* emitting any text.
|
|
55
|
+
*
|
|
56
|
+
* With thinking hidden this is the only thing the collapsed marker can say
|
|
57
|
+
* that the user could not otherwise know, which is the whole argument for
|
|
58
|
+
* having a marker at all (§1.2).
|
|
59
|
+
*/
|
|
60
|
+
thinkingMs?: number;
|
|
43
61
|
} | {
|
|
44
62
|
id: string;
|
|
45
63
|
kind: 'tool';
|
|
@@ -52,6 +70,44 @@ export type Entry = {
|
|
|
52
70
|
preview?: string;
|
|
53
71
|
durationMs?: number;
|
|
54
72
|
isError?: boolean;
|
|
73
|
+
/**
|
|
74
|
+
* The structured file diff (agent-activity-presentation §3.3), or absent.
|
|
75
|
+
*
|
|
76
|
+
* IMMUTABLE AND WRITTEN ONCE, by `toolExecEnd`. `ToolCard` is `React.memo`'d
|
|
77
|
+
* with the DEFAULT comparator, so this object is only free while its
|
|
78
|
+
* reference is stable — which it is, because the reducer never rebuilds it
|
|
79
|
+
* and `mapEntry` preserves identity for untouched entries. A future action
|
|
80
|
+
* that recomputed or normalized a patch would turn that memo boundary into
|
|
81
|
+
* a no-op WITH NOTHING FAILING (P2-9).
|
|
82
|
+
*
|
|
83
|
+
* Needs no clause in `normalizeLoadedEntries` (D-9): the four that exist
|
|
84
|
+
* are all about a LIVE flag that would never settle, and a patch is settled
|
|
85
|
+
* by construction.
|
|
86
|
+
*/
|
|
87
|
+
patch?: FilePatch;
|
|
88
|
+
/**
|
|
89
|
+
* The sanitised live tail while the tool runs
|
|
90
|
+
* (agent-activity-presentation-live §3.3.1). Cleared at settle (D-23), and
|
|
91
|
+
* cleared again by EVERY path that reaches `status: 'idle'` (D-35).
|
|
92
|
+
*
|
|
93
|
+
* REDUCER STATE RATHER THAN A STORE READ DURING RENDER, and that is the
|
|
94
|
+
* load-bearing decision of the round (D-22): `entryRevision` is what tells
|
|
95
|
+
* the height cache an entry's rendered output changed, and an entry mutated
|
|
96
|
+
* outside `ViewState` keeps its revision and freezes at a stale height AND
|
|
97
|
+
* a stale subtree with nothing anywhere reporting it (I-L3-1).
|
|
98
|
+
*/
|
|
99
|
+
live?: readonly string[];
|
|
100
|
+
/**
|
|
101
|
+
* Monotonic counter -- the revision term for a NON-APPEND mutation (D-22).
|
|
102
|
+
*
|
|
103
|
+
* A COUNTER AND NOT `live.length`: a fixed-size tail evicting its oldest
|
|
104
|
+
* row while appending a new one of the same width leaves the joined length
|
|
105
|
+
* unchanged, which is exactly the lossy case `virtual-window.ts` says the
|
|
106
|
+
* reducer cannot produce today and that this round introduces.
|
|
107
|
+
*/
|
|
108
|
+
liveSeq?: number;
|
|
109
|
+
/** Epoch ms of the last output row, for the stall row (§3.3.4). */
|
|
110
|
+
lastOutputAt?: number;
|
|
55
111
|
} | {
|
|
56
112
|
id: string;
|
|
57
113
|
kind: 'notice';
|
|
@@ -107,12 +163,85 @@ export type Entry = {
|
|
|
107
163
|
* card this session produced.
|
|
108
164
|
*/
|
|
109
165
|
interrupted?: boolean;
|
|
166
|
+
}
|
|
167
|
+
/**
|
|
168
|
+
* The turn's retry story (llm-api-retry-backoff §6.4). ONE per turn, REWRITTEN
|
|
169
|
+
* IN PLACE — ten retries rendered as ten notices would bury the transcript in
|
|
170
|
+
* the one moment the user most needs it legible.
|
|
171
|
+
*
|
|
172
|
+
* JSON-SERIALIZABLE by construction, so `/save` needs no format change.
|
|
173
|
+
*
|
|
174
|
+
* `phase: 'waiting' | 'retrying'` is normalized away ON LOAD, in
|
|
175
|
+
* `session/persist.ts`, exactly as the team entry's `active` and the todo
|
|
176
|
+
* card's `live` are (R-10): `Transcript`'s settled boundary is MONOTONIC, so a
|
|
177
|
+
* card that never settles never reaches `<Static>` and is re-rendered on every
|
|
178
|
+
* frame for the rest of the session.
|
|
179
|
+
*/
|
|
180
|
+
| {
|
|
181
|
+
id: string;
|
|
182
|
+
kind: 'retry';
|
|
183
|
+
/** 1-based retry index of the LATEST attempt this card has seen. */
|
|
184
|
+
attempt: number;
|
|
185
|
+
maxRetries: number;
|
|
186
|
+
errorType: string;
|
|
187
|
+
message: string;
|
|
188
|
+
delayMs: number;
|
|
189
|
+
/** Epoch ms the next attempt fires; the UI ticks against this. */
|
|
190
|
+
resumeAt?: number;
|
|
191
|
+
phase: RetryPhase;
|
|
192
|
+
startedAt: number;
|
|
193
|
+
/** Filled on settle. */
|
|
194
|
+
totalRetries?: number;
|
|
195
|
+
elapsedMs?: number;
|
|
196
|
+
}
|
|
197
|
+
/**
|
|
198
|
+
* One fast-model review (fast-model-tier §5.4). ONE CARD PER REVIEW, never
|
|
199
|
+
* rewritten across reviews — a critique is a single event, unlike the todo
|
|
200
|
+
* card's per-turn checklist.
|
|
201
|
+
*
|
|
202
|
+
* JSON-SERIALIZABLE by construction, so `/save` needs no format change.
|
|
203
|
+
*
|
|
204
|
+
* `live: true` is normalized away ON LOAD, in `session/persist.ts`, next to
|
|
205
|
+
* `team.active`, `todo.live` and the retry card's phase, and for the identical
|
|
206
|
+
* reason (C-5): `Transcript`'s settled boundary is MONOTONIC, so an entry that
|
|
207
|
+
* never settles never reaches `<Static>` and is re-rendered on every frame for
|
|
208
|
+
* the rest of the session. The reducer never legitimately sees a stale-live
|
|
209
|
+
* entry — only the file does.
|
|
210
|
+
*/
|
|
211
|
+
| {
|
|
212
|
+
id: string;
|
|
213
|
+
kind: 'fast';
|
|
214
|
+
/** 1-based within the session, so the card can name itself. */
|
|
215
|
+
reviewIndex: number;
|
|
216
|
+
model: string;
|
|
217
|
+
status: 'running' | 'ok' | 'advice' | 'empty' | 'failed' | 'dropped';
|
|
218
|
+
/** Present only for `advice`. */
|
|
219
|
+
text?: string;
|
|
220
|
+
/** Failure / drop reason, shown as one muted line. */
|
|
221
|
+
detail?: string;
|
|
222
|
+
turn: number;
|
|
223
|
+
durationMs?: number;
|
|
224
|
+
live: boolean;
|
|
110
225
|
};
|
|
111
226
|
export interface UsageTotal {
|
|
112
227
|
inputTokens: number;
|
|
113
228
|
outputTokens: number;
|
|
114
229
|
costUsd: number;
|
|
115
230
|
}
|
|
231
|
+
/**
|
|
232
|
+
* The ephemeral retry projection held in `ViewState.retry` (§9).
|
|
233
|
+
*
|
|
234
|
+
* Only the two IN-FLIGHT phases exist here: once a card settles the projection is
|
|
235
|
+
* `null`, because the settled card IS the history and a chip that reported a
|
|
236
|
+
* finished retry would never go away.
|
|
237
|
+
*/
|
|
238
|
+
export interface RetrySnapshot {
|
|
239
|
+
attempt: number;
|
|
240
|
+
maxRetries: number;
|
|
241
|
+
resumeAt?: number;
|
|
242
|
+
phase: 'waiting' | 'retrying';
|
|
243
|
+
errorType: string;
|
|
244
|
+
}
|
|
116
245
|
export interface ViewState {
|
|
117
246
|
entries: Entry[];
|
|
118
247
|
status: 'idle' | 'running';
|
|
@@ -150,11 +279,32 @@ export interface ViewState {
|
|
|
150
279
|
* build (AC-24).
|
|
151
280
|
*/
|
|
152
281
|
todos: TodoSnapshot | null;
|
|
282
|
+
/**
|
|
283
|
+
* The live retry projection, or `null` when nothing is retrying.
|
|
284
|
+
*
|
|
285
|
+
* NEVER PERSISTED — `entries` is the history and the settled card is the
|
|
286
|
+
* record. It drives the status-bar chip and the 1 Hz tick, and it is nulled on
|
|
287
|
+
* every settle path. Same contract as `team`.
|
|
288
|
+
*/
|
|
289
|
+
retry: RetrySnapshot | null;
|
|
290
|
+
/**
|
|
291
|
+
* The live fast-tier projection, or `null` when the tier is off for this
|
|
292
|
+
* session (fast-model-tier §5.2).
|
|
293
|
+
*
|
|
294
|
+
* NEVER PERSISTED — `entries` is the history and the settled cards are the
|
|
295
|
+
* record. It drives the status chip and `/fast status`'s totals. `null` is
|
|
296
|
+
* what leaves an ordinary session's status bar byte-identical (AC-4).
|
|
297
|
+
*/
|
|
298
|
+
fast: FastSnapshot | null;
|
|
153
299
|
seq: number;
|
|
154
300
|
/** The `kind: 'team'` entry the live dispatch is writing into. */
|
|
155
301
|
teamEntryId?: string;
|
|
156
302
|
/** The `kind: 'todo'` entry this turn is writing into. */
|
|
157
303
|
todoEntryId?: string;
|
|
304
|
+
/** The `kind: 'retry'` entry this turn is writing into. */
|
|
305
|
+
retryEntryId?: string;
|
|
306
|
+
/** The `kind: 'fast'` entry the in-flight review is writing into. */
|
|
307
|
+
fastEntryId?: string;
|
|
158
308
|
streamingId?: string;
|
|
159
309
|
turnProduced: boolean;
|
|
160
310
|
errorNoticed: boolean;
|
|
@@ -169,7 +319,24 @@ export interface ViewState {
|
|
|
169
319
|
*/
|
|
170
320
|
droppedEntries: number;
|
|
171
321
|
}
|
|
172
|
-
export
|
|
322
|
+
export interface ViewStateSeed {
|
|
323
|
+
/** Start with thinking blocks expanded. Defaults to FALSE, the product default. */
|
|
324
|
+
thinkingVisible?: boolean;
|
|
325
|
+
}
|
|
326
|
+
/**
|
|
327
|
+
* The initial view state, optionally seeded from config.
|
|
328
|
+
*
|
|
329
|
+
* THE DEFAULT IS `false`, NOT `true`, AND THAT IS THE WHOLE SAFETY ARGUMENT
|
|
330
|
+
* (D-2). There is exactly one production call site — `App`'s `useReducer`, which
|
|
331
|
+
* passes `cfg.showThinking`. Every other caller is a test. A future call site
|
|
332
|
+
* that forgets the seed fails CLOSED, toward the product default, rather than
|
|
333
|
+
* silently restoring the reasoning firehose for one code path with nothing
|
|
334
|
+
* reporting it.
|
|
335
|
+
*
|
|
336
|
+
* The seed is a PARAMETER rather than a post-mount dispatch so that `/resume`
|
|
337
|
+
* cannot flash a restored thinking block on frame 1.
|
|
338
|
+
*/
|
|
339
|
+
export declare function initialViewState(seed?: ViewStateSeed): ViewState;
|
|
173
340
|
export type ViewAction = {
|
|
174
341
|
type: 'submit';
|
|
175
342
|
text: string;
|
|
@@ -207,6 +374,22 @@ export type ViewAction = {
|
|
|
207
374
|
isError: boolean;
|
|
208
375
|
duration: number;
|
|
209
376
|
preview: string;
|
|
377
|
+
/** A fully-built, immutable diff, so the reducer stays pure (§3.3.7). */
|
|
378
|
+
patch?: FilePatch;
|
|
379
|
+
}
|
|
380
|
+
/**
|
|
381
|
+
* A running tool's live tail (agent-activity-presentation-live §3.3.1).
|
|
382
|
+
*
|
|
383
|
+
* `rows` IS THE WHOLE TAIL, not an increment: the store replaces it on every
|
|
384
|
+
* chunk, which is what lets `mergeDeltas` keep only the last action per
|
|
385
|
+
* `toolCallId` (D-30). `at` is read in `App`'s listener rather than here, so
|
|
386
|
+
* this reducer stays pure.
|
|
387
|
+
*/
|
|
388
|
+
| {
|
|
389
|
+
type: 'toolOutputDelta';
|
|
390
|
+
toolCallId: string;
|
|
391
|
+
rows: readonly string[];
|
|
392
|
+
at: number;
|
|
210
393
|
} | {
|
|
211
394
|
type: 'turnEnd';
|
|
212
395
|
usage: TokenUsage;
|
|
@@ -266,6 +449,54 @@ export type ViewAction = {
|
|
|
266
449
|
snapshot: TodoSnapshot;
|
|
267
450
|
} | {
|
|
268
451
|
type: 'todoCleared';
|
|
452
|
+
} | {
|
|
453
|
+
type: 'retryScheduled';
|
|
454
|
+
attempt: number;
|
|
455
|
+
maxRetries: number;
|
|
456
|
+
delayMs: number;
|
|
457
|
+
resumeAt: number;
|
|
458
|
+
errorType: string;
|
|
459
|
+
message: string;
|
|
460
|
+
} | {
|
|
461
|
+
type: 'retryAttempt';
|
|
462
|
+
attempt: number;
|
|
463
|
+
maxRetries: number;
|
|
464
|
+
} | {
|
|
465
|
+
type: 'streamRestart';
|
|
466
|
+
discardedToolCallIds: string[];
|
|
467
|
+
}
|
|
468
|
+
/**
|
|
469
|
+
* The 1 Hz countdown tick. NO STATE OF ITS OWN — it bumps `seq` so the frame
|
|
470
|
+
* re-renders and the card recomputes `resumeAt - Date.now()`. `App` runs the
|
|
471
|
+
* interval ONLY while `state.retry?.phase === 'waiting'`, so an idle session has
|
|
472
|
+
* no timer at all.
|
|
473
|
+
*/
|
|
474
|
+
| {
|
|
475
|
+
type: 'retryTick';
|
|
476
|
+
} | {
|
|
477
|
+
type: 'fastStart';
|
|
478
|
+
index: number;
|
|
479
|
+
turn: number;
|
|
480
|
+
model: string;
|
|
481
|
+
} | {
|
|
482
|
+
type: 'fastEnd';
|
|
483
|
+
review: FastReview;
|
|
484
|
+
}
|
|
485
|
+
/**
|
|
486
|
+
* Review spend.
|
|
487
|
+
*
|
|
488
|
+
* `costDelta` IS PRECOMPUTED BY THE CALLER, exactly as `teamUsage`'s is: the
|
|
489
|
+
* reducer stays pure and cost-table-free, which is the property that makes it
|
|
490
|
+
* testable — and the fast tier has a DIFFERENT cost table from the lead, so a
|
|
491
|
+
* reducer that computed its own would have to know about both (§3.6 / R-7).
|
|
492
|
+
*/
|
|
493
|
+
| {
|
|
494
|
+
type: 'fastUsage';
|
|
495
|
+
usage: TokenUsage;
|
|
496
|
+
costDelta: number;
|
|
497
|
+
} | {
|
|
498
|
+
type: 'fastTier';
|
|
499
|
+
snapshot: FastSnapshot;
|
|
269
500
|
};
|
|
270
501
|
export declare const STORED_PREVIEW_CHARS = 8000;
|
|
271
502
|
export declare const STORED_PREVIEW_LINES = 200;
|
|
@@ -284,12 +515,23 @@ export declare const PREVIEW_TRUNCATION_MARK = "...";
|
|
|
284
515
|
* over-promises how much more is expandable.
|
|
285
516
|
*/
|
|
286
517
|
export declare function buildToolPreview(result: ToolResult): string;
|
|
518
|
+
/**
|
|
519
|
+
* Where a `FilePatch` is collected from on `tool_execution_end`.
|
|
520
|
+
*
|
|
521
|
+
* Supplying one makes `reduceEvent` CONSUME-ONCE rather than pure, which is safe
|
|
522
|
+
* because `App.tsx` calls it exactly once per event and `mergeDeltas` only ever
|
|
523
|
+
* merges `textDelta` / `thinkingDelta`, never `toolExecEnd`.
|
|
524
|
+
*/
|
|
525
|
+
export interface PatchSource {
|
|
526
|
+
take(toolCallId: string): FilePatch | undefined;
|
|
527
|
+
}
|
|
287
528
|
/**
|
|
288
529
|
* Map one core `AgentEvent` to view actions. `cost` (the active model's cost
|
|
289
530
|
* table) lets `turn_end` accumulate USD cost; omit it in tests that only assert
|
|
290
|
-
* token totals.
|
|
531
|
+
* token totals. `patches` is the CLI-local diff side channel (§3.3.7); omitting
|
|
532
|
+
* it — every existing test, and headless mode — produces byte-identical actions.
|
|
291
533
|
*/
|
|
292
|
-
export declare function reduceEvent(event: AgentEvent, cost?: ModelCost): ViewAction[];
|
|
534
|
+
export declare function reduceEvent(event: AgentEvent, cost?: ModelCost, patches?: PatchSource): ViewAction[];
|
|
293
535
|
/** Turn a provider error into a friendly banner, mapping LLMError.errorType. */
|
|
294
536
|
export declare function formatStreamError(error: Error): string;
|
|
295
537
|
export declare function viewReducer(state: ViewState, action: ViewAction): ViewState;
|