@aragon-agent/cli 0.5.6 → 0.5.9
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 +356 -0
- package/README.md +1429 -1105
- 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/entry-limits.d.ts +65 -0
- package/dist/agent/entry-limits.js +133 -0
- package/dist/agent/headless.d.ts +8 -0
- package/dist/agent/headless.js +40 -0
- package/dist/agent/reducer.d.ts +253 -3
- package/dist/agent/reducer.js +553 -28
- 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/cli.js +122 -4
- package/dist/commands/builtins.d.ts +1 -1
- package/dist/commands/builtins.js +313 -2
- package/dist/commands/perf.d.ts +45 -0
- package/dist/commands/perf.js +78 -0
- package/dist/config/cli-commands.d.ts +53 -2
- package/dist/config/cli-commands.js +136 -3
- package/dist/config/env.d.ts +6 -1
- package/dist/config/env.js +131 -1
- package/dist/config/load.d.ts +63 -0
- package/dist/config/load.js +125 -2
- package/dist/config/schema.d.ts +273 -10
- package/dist/config/schema.js +250 -7
- package/dist/config/store.js +20 -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/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 +1 -4
- package/dist/ui/App.js +357 -44
- package/dist/ui/BottomStatusRow.d.ts +43 -0
- package/dist/ui/BottomStatusRow.js +14 -0
- package/dist/ui/Composer.d.ts +1 -6
- package/dist/ui/Composer.js +2 -2
- package/dist/ui/Markdown.d.ts +7 -1
- package/dist/ui/Markdown.js +15 -48
- package/dist/ui/PromptInput.d.ts +1 -15
- package/dist/ui/PromptInput.js +1 -38
- package/dist/ui/StatusBar.d.ts +50 -0
- package/dist/ui/StatusBar.js +7 -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 +80 -5
- package/dist/ui/Transcript.js +179 -11
- package/dist/ui/activity-phrases.d.ts +33 -0
- package/dist/ui/activity-phrases.js +50 -0
- package/dist/ui/entries/AssistantEntry.d.ts +38 -1
- package/dist/ui/entries/AssistantEntry.js +34 -3
- 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.d.ts +9 -1
- package/dist/ui/entries/TeamCard.js +28 -2
- package/dist/ui/entries/TodoCard.d.ts +9 -1
- package/dist/ui/entries/TodoCard.js +23 -1
- package/dist/ui/entries/ToolCard.d.ts +50 -1
- package/dist/ui/entries/ToolCard.js +104 -7
- package/dist/ui/entries/ToolPreview.d.ts +2 -2
- package/dist/ui/entries/UserEntry.d.ts +9 -1
- package/dist/ui/entries/UserEntry.js +17 -1
- package/dist/ui/exit-snapshot.d.ts +7 -0
- 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/MeasuredEntry.d.ts +21 -0
- package/dist/ui/layout/MeasuredEntry.js +30 -0
- package/dist/ui/layout/ScrollViewport.js +8 -2
- package/dist/ui/layout/viewport-geometry.d.ts +28 -0
- package/dist/ui/layout/viewport-geometry.js +27 -0
- package/dist/ui/layout/virtual-window.d.ts +100 -0
- package/dist/ui/layout/virtual-window.js +308 -0
- package/dist/ui/live-clamp.d.ts +42 -0
- package/dist/ui/live-clamp.js +74 -0
- package/dist/ui/markdown-blocks.d.ts +25 -1
- package/dist/ui/markdown-blocks.js +43 -0
- 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/render-cache.d.ts +81 -0
- package/dist/ui/render-cache.js +195 -0
- package/dist/ui/render-governor.d.ts +54 -0
- package/dist/ui/render-governor.js +78 -0
- package/dist/ui/transcript-text.d.ts +11 -0
- package/dist/ui/transcript-text.js +32 -0
- package/dist/ui/use-height-store.d.ts +31 -0
- package/dist/ui/use-height-store.js +76 -0
- package/dist/ui/use-render-governor.d.ts +39 -0
- package/dist/ui/use-render-governor.js +57 -0
- package/dist/ui/use-startup-notices.d.ts +9 -1
- package/dist/ui/use-startup-notices.js +35 -1
- package/dist/ui/use-wheel-routing.d.ts +16 -32
- package/dist/ui/use-wheel-routing.js +21 -38
- package/package.json +2 -2
- package/dist/ui/layout/regions.d.ts +0 -55
- package/dist/ui/layout/regions.js +0 -52
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Retry presentation — pure, React-free, unit-tested (llm-api-retry-backoff
|
|
3
|
+
* §6.5 / §6.6).
|
|
4
|
+
*
|
|
5
|
+
* ASCII ONLY: `src/agent/**` is inside the glyph scanner's scope
|
|
6
|
+
* (`glyphs.test.ts`). Every non-ASCII character in the rendered line comes from
|
|
7
|
+
* the `Glyphs` set the caller passes in, never from a literal here.
|
|
8
|
+
*
|
|
9
|
+
* The COUNTDOWN is derived from `resumeAt`, an absolute instant, and never from
|
|
10
|
+
* `delayMs`. Core deliberately sends the instant rather than a tick stream, so
|
|
11
|
+
* the clock belongs to whoever renders — and a card that recomputed from
|
|
12
|
+
* `delayMs` would freeze at the announced number the moment a frame was skipped.
|
|
13
|
+
*/
|
|
14
|
+
import type { Glyphs } from '../ui/glyphs.js';
|
|
15
|
+
/**
|
|
16
|
+
* Presentation bounds. NAMED `RETRY_UI`, NOT `RETRY_LIMITS_UI`: core's
|
|
17
|
+
* `RETRY_LIMITS` bounds what the mechanism can physically do, this is a column
|
|
18
|
+
* breakpoint, and a name that read as its sibling would invite the next reader to
|
|
19
|
+
* look here for the missing keys.
|
|
20
|
+
*/
|
|
21
|
+
export declare const RETRY_UI: {
|
|
22
|
+
/** Below this many columns the status-bar chip degrades to `[r3]`. */
|
|
23
|
+
readonly statusCompactCols: 100;
|
|
24
|
+
};
|
|
25
|
+
/** The five phases of the one card a turn gets. */
|
|
26
|
+
export type RetryPhase = 'waiting' | 'retrying' | 'recovered' | 'exhausted' | 'interrupted';
|
|
27
|
+
/** The shape `formatRetryLine` reads — the `kind: 'retry'` entry, structurally. */
|
|
28
|
+
export interface RetryLineInput {
|
|
29
|
+
attempt: number;
|
|
30
|
+
maxRetries: number;
|
|
31
|
+
errorType: string;
|
|
32
|
+
phase: RetryPhase;
|
|
33
|
+
resumeAt?: number;
|
|
34
|
+
totalRetries?: number;
|
|
35
|
+
elapsedMs?: number;
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Whole seconds until `resumeAt`, floored at 0.
|
|
39
|
+
*
|
|
40
|
+
* `Math.ceil` rather than `round`: a countdown that shows `0s` for half a second
|
|
41
|
+
* before firing reads as a stall, and showing `1s` for slightly too long does
|
|
42
|
+
* not.
|
|
43
|
+
*/
|
|
44
|
+
export declare function secondsLeft(resumeAt: number | undefined, now: number): number;
|
|
45
|
+
/**
|
|
46
|
+
* A short headline for a provider failure.
|
|
47
|
+
*
|
|
48
|
+
* Deliberately shorter than `formatStreamError`'s: that one is a standalone
|
|
49
|
+
* notice and has to explain what to do, while this shares one line with a
|
|
50
|
+
* counter and a countdown. Derived from `errorType` ONLY — nothing here parses
|
|
51
|
+
* the provider's message, because a human-facing sentence must never become a
|
|
52
|
+
* machine-readable contract (the rule `SubagentRun.retryable` records).
|
|
53
|
+
*/
|
|
54
|
+
export declare function retryHeadline(errorType: string): string;
|
|
55
|
+
/**
|
|
56
|
+
* The card's single line, WITHOUT the rail glyph — `EntryView` supplies that, the
|
|
57
|
+
* same way it does for every other entry kind.
|
|
58
|
+
*
|
|
59
|
+
* `now` is a parameter rather than a `Date.now()` call so the function stays pure
|
|
60
|
+
* and the render can be asserted without a clock.
|
|
61
|
+
*/
|
|
62
|
+
export declare function formatRetryLine(entry: RetryLineInput, glyphs: Glyphs, now: number): string;
|
|
63
|
+
/** The status-bar chip text: full at width, `[r3]` when the row is tight. */
|
|
64
|
+
export declare function formatRetryChip(active: {
|
|
65
|
+
attempt: number;
|
|
66
|
+
max: number;
|
|
67
|
+
secondsLeft: number;
|
|
68
|
+
}, cols: number): string;
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Retry presentation — pure, React-free, unit-tested (llm-api-retry-backoff
|
|
3
|
+
* §6.5 / §6.6).
|
|
4
|
+
*
|
|
5
|
+
* ASCII ONLY: `src/agent/**` is inside the glyph scanner's scope
|
|
6
|
+
* (`glyphs.test.ts`). Every non-ASCII character in the rendered line comes from
|
|
7
|
+
* the `Glyphs` set the caller passes in, never from a literal here.
|
|
8
|
+
*
|
|
9
|
+
* The COUNTDOWN is derived from `resumeAt`, an absolute instant, and never from
|
|
10
|
+
* `delayMs`. Core deliberately sends the instant rather than a tick stream, so
|
|
11
|
+
* the clock belongs to whoever renders — and a card that recomputed from
|
|
12
|
+
* `delayMs` would freeze at the announced number the moment a frame was skipped.
|
|
13
|
+
*/
|
|
14
|
+
import { formatDuration } from './usage.js';
|
|
15
|
+
/**
|
|
16
|
+
* Presentation bounds. NAMED `RETRY_UI`, NOT `RETRY_LIMITS_UI`: core's
|
|
17
|
+
* `RETRY_LIMITS` bounds what the mechanism can physically do, this is a column
|
|
18
|
+
* breakpoint, and a name that read as its sibling would invite the next reader to
|
|
19
|
+
* look here for the missing keys.
|
|
20
|
+
*/
|
|
21
|
+
export const RETRY_UI = {
|
|
22
|
+
/** Below this many columns the status-bar chip degrades to `[r3]`. */
|
|
23
|
+
statusCompactCols: 100,
|
|
24
|
+
};
|
|
25
|
+
/**
|
|
26
|
+
* Whole seconds until `resumeAt`, floored at 0.
|
|
27
|
+
*
|
|
28
|
+
* `Math.ceil` rather than `round`: a countdown that shows `0s` for half a second
|
|
29
|
+
* before firing reads as a stall, and showing `1s` for slightly too long does
|
|
30
|
+
* not.
|
|
31
|
+
*/
|
|
32
|
+
export function secondsLeft(resumeAt, now) {
|
|
33
|
+
if (resumeAt === undefined)
|
|
34
|
+
return 0;
|
|
35
|
+
return Math.max(0, Math.ceil((resumeAt - now) / 1000));
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* A short headline for a provider failure.
|
|
39
|
+
*
|
|
40
|
+
* Deliberately shorter than `formatStreamError`'s: that one is a standalone
|
|
41
|
+
* notice and has to explain what to do, while this shares one line with a
|
|
42
|
+
* counter and a countdown. Derived from `errorType` ONLY — nothing here parses
|
|
43
|
+
* the provider's message, because a human-facing sentence must never become a
|
|
44
|
+
* machine-readable contract (the rule `SubagentRun.retryable` records).
|
|
45
|
+
*/
|
|
46
|
+
export function retryHeadline(errorType) {
|
|
47
|
+
switch (errorType) {
|
|
48
|
+
case 'rate_limit':
|
|
49
|
+
return 'Rate limited by the provider';
|
|
50
|
+
case 'overloaded':
|
|
51
|
+
return 'Provider overloaded';
|
|
52
|
+
case 'server_error':
|
|
53
|
+
return 'Provider error';
|
|
54
|
+
case 'network_error':
|
|
55
|
+
return 'Network error reaching the provider';
|
|
56
|
+
case 'timeout':
|
|
57
|
+
return 'The request timed out';
|
|
58
|
+
default:
|
|
59
|
+
return 'Provider call failed';
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
function plural(n) {
|
|
63
|
+
return n === 1 ? 'retry' : 'retries';
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* The card's single line, WITHOUT the rail glyph — `EntryView` supplies that, the
|
|
67
|
+
* same way it does for every other entry kind.
|
|
68
|
+
*
|
|
69
|
+
* `now` is a parameter rather than a `Date.now()` call so the function stays pure
|
|
70
|
+
* and the render can be asserted without a clock.
|
|
71
|
+
*/
|
|
72
|
+
export function formatRetryLine(entry, glyphs, now) {
|
|
73
|
+
const dot = ` ${glyphs.midDot} `;
|
|
74
|
+
const counter = `retry ${entry.attempt}/${entry.maxRetries}`;
|
|
75
|
+
const settled = entry.totalRetries ?? entry.attempt;
|
|
76
|
+
switch (entry.phase) {
|
|
77
|
+
case 'waiting':
|
|
78
|
+
return `${retryHeadline(entry.errorType)}${dot}${counter} in ${secondsLeft(entry.resumeAt, now)}s`;
|
|
79
|
+
case 'retrying':
|
|
80
|
+
return `${retryHeadline(entry.errorType)}${dot}${counter} ${glyphs.ellipsis}`;
|
|
81
|
+
case 'recovered':
|
|
82
|
+
return `recovered after ${settled} ${plural(settled)}${entry.elapsedMs === undefined ? '' : `${dot}${formatDuration(entry.elapsedMs)}`}`;
|
|
83
|
+
case 'exhausted':
|
|
84
|
+
return `${retryHeadline(entry.errorType)}${dot}gave up after ${settled} ${plural(settled)}${entry.elapsedMs === undefined ? '' : `${dot}${formatDuration(entry.elapsedMs)}`}`;
|
|
85
|
+
case 'interrupted':
|
|
86
|
+
return `interrupted after ${settled} ${plural(settled)}`;
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
/** The status-bar chip text: full at width, `[r3]` when the row is tight. */
|
|
90
|
+
export function formatRetryChip(active, cols) {
|
|
91
|
+
if (cols >= RETRY_UI.statusCompactCols) {
|
|
92
|
+
return `retry ${active.attempt}/${active.max} ${active.secondsLeft}s`;
|
|
93
|
+
}
|
|
94
|
+
return `[r${active.attempt}]`;
|
|
95
|
+
}
|
|
@@ -61,6 +61,17 @@ export interface SystemPromptParams {
|
|
|
61
61
|
* (and `--no-todo`) produce the pre-todo prompt BYTE FOR BYTE.
|
|
62
62
|
*/
|
|
63
63
|
todoBlock?: string;
|
|
64
|
+
/**
|
|
65
|
+
* The rendered `<fast_tier>` block, or `''` (fast-model-tier §3.8).
|
|
66
|
+
*
|
|
67
|
+
* Spliced conditionally exactly as `skillsBlock`, the plan block, `teamBlock`
|
|
68
|
+
* and `todoBlock` are, which is what keeps I-2 true: `fast.enabled: false`
|
|
69
|
+
* (and `--no-fast`) produce the pre-feature prompt BYTE FOR BYTE.
|
|
70
|
+
*
|
|
71
|
+
* A CHILD'S PROMPT NEVER CARRIES IT: children cannot delegate and are not
|
|
72
|
+
* reviewed, so `buildSubagentBlock`'s caller leaves this unset.
|
|
73
|
+
*/
|
|
74
|
+
fastBlock?: string;
|
|
64
75
|
}
|
|
65
76
|
/** Describe the active shell so the model does not emit incompatible syntax. */
|
|
66
77
|
export declare function describeShell(): {
|
|
@@ -40,6 +40,7 @@ export function buildSystemPrompt(params) {
|
|
|
40
40
|
const teamBlock = params.teamBlock ?? '';
|
|
41
41
|
const subagentBlock = params.subagentBlock ?? '';
|
|
42
42
|
const todoBlock = params.todoBlock ?? '';
|
|
43
|
+
const fastBlock = params.fastBlock ?? '';
|
|
43
44
|
return [
|
|
44
45
|
'You are AragonAgent, an autonomous coding assistant operating inside a terminal (TUI).',
|
|
45
46
|
'You help the user accomplish software-engineering tasks by reasoning step by step and using the provided tools.',
|
|
@@ -56,6 +57,7 @@ export function buildSystemPrompt(params) {
|
|
|
56
57
|
...(teamBlock ? ['', teamBlock] : []),
|
|
57
58
|
...(subagentBlock ? ['', subagentBlock] : []),
|
|
58
59
|
...(todoBlock ? ['', todoBlock] : []),
|
|
60
|
+
...(fastBlock ? ['', fastBlock] : []),
|
|
59
61
|
'',
|
|
60
62
|
'Operating guidance:',
|
|
61
63
|
'- Prefer reading files and inspecting the workspace before making changes.',
|
package/dist/cli.js
CHANGED
|
@@ -23,11 +23,11 @@ import { formatMigrationNotice, migrateLegacyState } from './config/migrate-lega
|
|
|
23
23
|
import { formatHomeMigrationNotice, migrateToHome } from './config/migrate-home.js';
|
|
24
24
|
import { migrateStateOutOfConfig } from './config/migrate-state-out-of-config.js';
|
|
25
25
|
import { runHistoryCommand } from './config/history-commands.js';
|
|
26
|
-
import { LOG_CONFIG_SET_KEYS, TEAM_CONFIG_SET_KEYS, applyLogConfigSet, applyTeamConfigSet, runConfigEdit, runConfigGet, runConfigHome, runConfigList, warnIfRedactionDisabled, } from './config/cli-commands.js';
|
|
26
|
+
import { FAST_CONFIG_SET_KEYS, LOG_CONFIG_SET_KEYS, RETRY_CONFIG_SET_KEYS, TEAM_CONFIG_SET_KEYS, applyFastConfigSet, applyLogConfigSet, applyRetryConfigSet, applyTeamConfigSet, runConfigEdit, runConfigGet, runConfigHome, runConfigList, warnIfRedactionDisabled, } from './config/cli-commands.js';
|
|
27
27
|
import { attachAgentEvents, attachTeamEvents, installLogging, setScreenRestore, setSignalTerminator, } from './logging/install.js';
|
|
28
28
|
import { getLogger } from './logging/logger.js';
|
|
29
29
|
import { runLogsCommand } from './logging/cli-commands.js';
|
|
30
|
-
import { ADAPTER_PROVIDERS, clampDensity, clampTheme, clampThinkingLevel, clampAskRounds, clampHumanTimeout, clampSkillsIntegrity, clampSkillsToolPolicy, clampTranscriptWindow, coercePositiveInt, isAdapterProvider, parseMaxTokensInput, DEFAULT_MAX_TOKENS, DEFAULT_PLAN_HUMAN_TIMEOUT_MS, DEFAULT_PLAN_MAX_ASK_ROUNDS, DEFAULT_SKILLS_CONFIG, } from './config/schema.js';
|
|
30
|
+
import { ADAPTER_PROVIDERS, clampDensity, clampTheme, clampThinkingLevel, clampAskRounds, clampHumanTimeout, clampSkillsIntegrity, clampSkillsToolPolicy, clampMaxRenderInterval, clampTranscriptRetain, clampTranscriptWindow, coercePositiveInt, isAdapterProvider, parseMaxTokensInput, DEFAULT_MAX_RENDER_INTERVAL_MS, DEFAULT_MAX_TOKENS, DEFAULT_PLAN_HUMAN_TIMEOUT_MS, DEFAULT_PLAN_MAX_ASK_ROUNDS, DEFAULT_SKILLS_CONFIG, DEFAULT_TRANSCRIPT_RETAIN, DEFAULT_TRANSCRIPT_WINDOW, } from './config/schema.js';
|
|
31
31
|
import { makeGetApiKey } from './config/load.js';
|
|
32
32
|
import { AgentController, DENY_ALL_APPROVAL } from './agent/controller.js';
|
|
33
33
|
import { runSkillsCommand } from './skills/cli-commands.js';
|
|
@@ -73,6 +73,14 @@ function toFlags(opts) {
|
|
|
73
73
|
exitTranscript: opts.exitTranscript,
|
|
74
74
|
compact: opts.compact,
|
|
75
75
|
hints: opts.hints,
|
|
76
|
+
// Without this line the flag never reaches `CliFlags` and `--show-thinking`
|
|
77
|
+
// is inert -- the failure the `mouse` note below records (P1-2).
|
|
78
|
+
showThinking: opts.showThinking,
|
|
79
|
+
// And again for the live tail, one feature later. The pair is declared in
|
|
80
|
+
// both directions below because `liveToolOutput` is PERSISTED and defaults
|
|
81
|
+
// to `true`: a lone `--no-live-tool-output` would make commander default
|
|
82
|
+
// `opts.liveToolOutput` to `true`, which is indistinguishable from silence.
|
|
83
|
+
liveToolOutput: opts.liveToolOutput,
|
|
76
84
|
// Without this line the flag never reaches `CliFlags` and `--no-mouse` is
|
|
77
85
|
// inert — a failure with no compile error and no runtime error (P1-2).
|
|
78
86
|
mouse: opts.mouse,
|
|
@@ -97,11 +105,32 @@ function toFlags(opts) {
|
|
|
97
105
|
// C-9). A value flag is no less inert than a boolean one when this line is
|
|
98
106
|
// missing.
|
|
99
107
|
todoFollow: opts.todoFollow,
|
|
108
|
+
// Site three of three for `--retry` / `--retry-max` — five features, same
|
|
109
|
+
// trap (`mouse` P1-2, `team` P1-4, `todo` C-9, render L4, now retry). A flag
|
|
110
|
+
// needs the `.option()` declaration below, a field on `CliFlags`, AND a line
|
|
111
|
+
// here; miss this one and the flag is inert with no compile or runtime error.
|
|
112
|
+
retry: opts.retry,
|
|
113
|
+
retryMax: opts.retryMax,
|
|
114
|
+
// Site three of three for the four `--fast*` flags — SIX features, one trap
|
|
115
|
+
// (`mouse` P1-2, `team` P1-4, `todo` C-9, render L4, retry, now fast). It
|
|
116
|
+
// bites hardest here: the tier is OFF by default, so a missing line would
|
|
117
|
+
// make `--fast` a flag that reports nothing and does nothing.
|
|
118
|
+
fast: opts.fast,
|
|
119
|
+
fastModel: opts.fastModel,
|
|
120
|
+
fastProvider: opts.fastProvider,
|
|
121
|
+
fastReview: opts.fastReview,
|
|
100
122
|
// `--verbose` is just a shorthand for `--log-level debug`; an explicit
|
|
101
123
|
// `--log-level` still wins, so the two can be combined without surprise.
|
|
102
124
|
logLevel: opts.logLevel ?? (opts.verbose ? 'debug' : undefined),
|
|
103
125
|
logFile: opts.logFile,
|
|
104
126
|
logDir: opts.logDir,
|
|
127
|
+
// Site three of three for the render-performance flags. A flag needs the
|
|
128
|
+
// `.option()` declaration below, a field on `CliFlags`, AND a line here;
|
|
129
|
+
// miss this one and it is inert with no compile error and no runtime error
|
|
130
|
+
// (`mouse` P1-2, `team` P1-4, `todo` C-9 -- four features, same trap).
|
|
131
|
+
transcriptRetain: opts.transcriptRetain,
|
|
132
|
+
renderGovernor: opts.renderGovernor,
|
|
133
|
+
maxRenderInterval: opts.maxRenderInterval,
|
|
105
134
|
};
|
|
106
135
|
}
|
|
107
136
|
// ---------------------------------------------------------------------------
|
|
@@ -239,6 +268,10 @@ function runInteractive(flags, extras = {}) {
|
|
|
239
268
|
provider: snapshot.provider,
|
|
240
269
|
model: snapshot.model,
|
|
241
270
|
elapsedMs: Date.now() - snapshot.startedAt,
|
|
271
|
+
// Names what the retain ring removed, so a long session's replay never
|
|
272
|
+
// starts mid-conversation without saying why (tui-render-performance
|
|
273
|
+
// L1 / K-6).
|
|
274
|
+
...(snapshot.droppedEntries ? { droppedEntries: snapshot.droppedEntries } : {}),
|
|
242
275
|
}));
|
|
243
276
|
};
|
|
244
277
|
if (mode === 'fullscreen') {
|
|
@@ -393,10 +426,22 @@ const CONFIG_SET_KEYS = new Set([
|
|
|
393
426
|
'fullscreen',
|
|
394
427
|
'exitTranscript',
|
|
395
428
|
'transcriptWindow',
|
|
429
|
+
// tui-render-performance L1 / L4. Listed here AND cased in the switch
|
|
430
|
+
// below: a key present here but absent there falls through, writes
|
|
431
|
+
// nothing, and still prints `Set <key> = <value>` (P1-2).
|
|
432
|
+
'transcriptRetain',
|
|
433
|
+
'renderGovernor',
|
|
434
|
+
'maxRenderIntervalMs',
|
|
396
435
|
// Without these two, `density` and `hints` would be settable only as one-shot
|
|
397
436
|
// flags and never persist -- inconsistent with every other config field.
|
|
398
437
|
'density',
|
|
399
438
|
'hints',
|
|
439
|
+
// agent-activity-presentation §4.1. Listed here AND cased in the switch below,
|
|
440
|
+
// for the reason `transcriptRetain` records above.
|
|
441
|
+
'showThinking',
|
|
442
|
+
// agent-activity-presentation-live §4.1. Listed here AND cased in the switch
|
|
443
|
+
// below, for the reason `transcriptRetain` and `showThinking` both record.
|
|
444
|
+
'liveToolOutput',
|
|
400
445
|
// MEMBERSHIP HERE ONLY DECIDES THAT THE KEY IS NOT REJECTED. The `switch`
|
|
401
446
|
// below is what builds the patch, and a key present here but absent there
|
|
402
447
|
// falls through every case, writes nothing, and still prints
|
|
@@ -422,6 +467,10 @@ const CONFIG_SET_KEYS = new Set([
|
|
|
422
467
|
// ceiling, and a key listed here but forgotten there writes nothing while
|
|
423
468
|
// still printing `Set team.enabled = false`.
|
|
424
469
|
...TEAM_CONFIG_SET_KEYS,
|
|
470
|
+
// `retry.*` keys are handled by `applyRetryConfigSet`, same reasoning again.
|
|
471
|
+
...RETRY_CONFIG_SET_KEYS,
|
|
472
|
+
// `fast.*` keys are handled by `applyFastConfigSet`, same reasoning again.
|
|
473
|
+
...FAST_CONFIG_SET_KEYS,
|
|
425
474
|
]);
|
|
426
475
|
/**
|
|
427
476
|
* `aragon config set maxTokens <n|auto|default>`.
|
|
@@ -476,6 +525,27 @@ function runConfigSet(key, value) {
|
|
|
476
525
|
process.stdout.write(`Set ${key} = ${String(merged.team[field])}\n`);
|
|
477
526
|
return;
|
|
478
527
|
}
|
|
528
|
+
const retryPatch = applyRetryConfigSet(key, value);
|
|
529
|
+
if (retryPatch) {
|
|
530
|
+
// Echoed from the STORED value for the same reason `team.*` is, and it matters
|
|
531
|
+
// more here: `config set retry.maxRetries 0` used to be the value that
|
|
532
|
+
// silently became 10, so reporting the input would have hidden the bug rather
|
|
533
|
+
// than the fix (R-16).
|
|
534
|
+
const merged = updatePersistedConfig(retryPatch);
|
|
535
|
+
const field = key.slice('retry.'.length);
|
|
536
|
+
process.stdout.write(`Set ${key} = ${String(merged.retry[field])}\n`);
|
|
537
|
+
return;
|
|
538
|
+
}
|
|
539
|
+
const fastPatch = applyFastConfigSet(key, value);
|
|
540
|
+
if (fastPatch) {
|
|
541
|
+
// Echoed from the STORED value, so `config set fast.reviewEveryTurns 400`
|
|
542
|
+
// prints the clamped 50 rather than reporting a number that was never
|
|
543
|
+
// written (AC-13) — the rule `team.*` and `retry.*` each state above.
|
|
544
|
+
const merged = updatePersistedConfig(fastPatch);
|
|
545
|
+
const field = key.slice('fast.'.length);
|
|
546
|
+
process.stdout.write(`Set ${key} = ${String(merged.fast[field])}\n`);
|
|
547
|
+
return;
|
|
548
|
+
}
|
|
479
549
|
const patch = {};
|
|
480
550
|
switch (key) {
|
|
481
551
|
case 'provider':
|
|
@@ -509,11 +579,26 @@ function runConfigSet(key, value) {
|
|
|
509
579
|
patch.exitTranscript = value === 'true' || value === '1';
|
|
510
580
|
break;
|
|
511
581
|
case 'transcriptWindow':
|
|
512
|
-
patch.transcriptWindow = clampTranscriptWindow(value,
|
|
582
|
+
patch.transcriptWindow = clampTranscriptWindow(value, DEFAULT_TRANSCRIPT_WINDOW);
|
|
583
|
+
break;
|
|
584
|
+
case 'transcriptRetain':
|
|
585
|
+
patch.transcriptRetain = clampTranscriptRetain(value, DEFAULT_TRANSCRIPT_RETAIN);
|
|
586
|
+
break;
|
|
587
|
+
case 'renderGovernor':
|
|
588
|
+
patch.renderGovernor = value === 'true' || value === '1';
|
|
589
|
+
break;
|
|
590
|
+
case 'maxRenderIntervalMs':
|
|
591
|
+
patch.maxRenderIntervalMs = clampMaxRenderInterval(value, DEFAULT_MAX_RENDER_INTERVAL_MS);
|
|
513
592
|
break;
|
|
514
593
|
case 'density':
|
|
515
594
|
patch.density = clampDensity(value, 'comfortable');
|
|
516
595
|
break;
|
|
596
|
+
case 'showThinking':
|
|
597
|
+
patch.showThinking = value === 'true' || value === '1';
|
|
598
|
+
break;
|
|
599
|
+
case 'liveToolOutput':
|
|
600
|
+
patch.liveToolOutput = value === 'true' || value === '1';
|
|
601
|
+
break;
|
|
517
602
|
case 'hints':
|
|
518
603
|
patch.hints = value === 'true' || value === '1';
|
|
519
604
|
break;
|
|
@@ -607,7 +692,16 @@ function buildProgram() {
|
|
|
607
692
|
.option('--hints', 'Always show the composer hint row')
|
|
608
693
|
.option('--no-hints', 'Hide the composer hint row')
|
|
609
694
|
// Positive form first, same tri-state reason as `--fullscreen` above.
|
|
610
|
-
.option('--
|
|
695
|
+
.option('--show-thinking', 'Show the reasoning blocks the model returns')
|
|
696
|
+
.option('--no-show-thinking', 'Hide reasoning blocks (the default)')
|
|
697
|
+
// Positive form first, same tri-state reason as `--fullscreen` above. The
|
|
698
|
+
// pair matters more here than for its neighbour because this key defaults to
|
|
699
|
+
// ON: a lone negative form would let commander synthesize `true` and
|
|
700
|
+
// overwrite a stored `false` on every run that passed no flag at all.
|
|
701
|
+
.option('--live-tool-output', 'Show a running command output tail (the default)')
|
|
702
|
+
.option('--no-live-tool-output', 'Keep a running tool card to one line')
|
|
703
|
+
// Positive form first, same tri-state reason as `--fullscreen` above.
|
|
704
|
+
.option('--mouse', 'Wheel scrolls the transcript (full-screen mode)')
|
|
611
705
|
.option('--no-mouse', 'Leave the mouse to the terminal (the wheel does nothing)')
|
|
612
706
|
// Declaring `--fullscreen` BEFORE `--no-fullscreen` keeps the default
|
|
613
707
|
// `undefined` instead of `true`, which is what makes the tri-state work:
|
|
@@ -641,6 +735,22 @@ function buildProgram() {
|
|
|
641
735
|
// passed, so `!== undefined` in `resolveTodoConfig` already distinguishes it
|
|
642
736
|
// from silence. An unrecognized mode is clamped to `notify`, not rejected.
|
|
643
737
|
.option('--todo-follow <mode>', 'What to do when a run ends with unfinished steps: notify (default) | auto | off')
|
|
738
|
+
// BOTH FORMS, positive first, for the reason recorded five times above:
|
|
739
|
+
// `retry.enabled` is PERSISTED, so a lone `--no-retry` would make commander
|
|
740
|
+
// default `opts.retry` to `true` and silently overwrite a stored `false`.
|
|
741
|
+
.option('--retry', 'Retry failed provider calls with backoff (the default)')
|
|
742
|
+
.option('--no-retry', 'Do not retry a failed provider call (fail on the first error)')
|
|
743
|
+
.option('--retry-max <n>', 'Retries after the first attempt for this run (0-20; 0 = off)')
|
|
744
|
+
// BOTH FORMS, positive first, for the reason recorded six times above — and
|
|
745
|
+
// with the polarity reversed from every other pair here: `fast.enabled`
|
|
746
|
+
// defaults to FALSE, so a lone `--fast` would be indistinguishable from
|
|
747
|
+
// silence and the off-by-default guarantee (R-d) would rest on a commander
|
|
748
|
+
// detail rather than on the config layer.
|
|
749
|
+
.option('--fast', 'Enable the fast model tier for this session')
|
|
750
|
+
.option('--no-fast', 'Disable the fast model tier (the default)')
|
|
751
|
+
.option('--fast-model <id>', 'The fast model id (implies nothing about --fast)')
|
|
752
|
+
.option('--fast-provider <id>', 'Provider for the fast model (default: the main provider)')
|
|
753
|
+
.option('--fast-review <n|off>', 'Turns between automatic fast reviews, or "off"')
|
|
644
754
|
.option('--no-skills', 'Disable the skill system entirely (no catalog, no skill tools)')
|
|
645
755
|
.option('--skill <name>', 'Force-load a skill at Level 2 for this run (repeatable)', (value, previous = []) => [...previous, value])
|
|
646
756
|
.option('--skills-yes', 'Approve skill installs for this run (CI / headless)')
|
|
@@ -654,6 +764,14 @@ function buildProgram() {
|
|
|
654
764
|
// No short form: `-v` is already `--version`.
|
|
655
765
|
.option('--verbose', 'Shorthand for --log-level debug')
|
|
656
766
|
.option('--log-dir <dir>', 'Absolute log directory for this run')
|
|
767
|
+
// Render performance (tui-render-performance §5.2). `--render-governor` is
|
|
768
|
+
// declared BEFORE its negative form for the tri-state reason recorded four
|
|
769
|
+
// times above: `renderGovernor` is persisted, so negative-only would default
|
|
770
|
+
// `opts.renderGovernor` to `true` and silently overwrite a stored `false`.
|
|
771
|
+
.option('--transcript-retain <n>', 'Entries kept in memory (200-20000, default 1000)')
|
|
772
|
+
.option('--render-governor', 'Adapt the frame interval under load (the default)')
|
|
773
|
+
.option('--no-render-governor', 'Pin the frame interval at 33ms however expensive a frame is')
|
|
774
|
+
.option('--max-render-interval <ms>', 'Governor ceiling in ms (33-1000, default 320)')
|
|
657
775
|
.option('--no-color', 'Disable ANSI color')
|
|
658
776
|
.option('--quiet', '(print mode) suppress tool/usage lines on stderr')
|
|
659
777
|
.action(async (prompt, opts) => {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Built-in slash commands (spec §5.2):
|
|
3
3
|
* /help /model /settings /thinking /max-tokens /tools /clear /reset /cwd /save
|
|
4
|
-
* /resume /copy /exit (/quit).
|
|
4
|
+
* /resume /copy /exit (/quit), plus the /team, /fast and /todo subsystems.
|
|
5
5
|
*/
|
|
6
6
|
import { CommandRegistry } from './registry.js';
|
|
7
7
|
export declare function registerBuiltinCommands(registry: CommandRegistry): void;
|