@aragon-agent/cli 0.6.8 → 0.6.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 +27 -0
- package/README.md +89 -44
- package/dist/agent/controller.d.ts +1 -1
- package/dist/agent/reducer.d.ts +31 -113
- package/dist/agent/reducer.js +41 -63
- package/dist/cli.js +53 -155
- package/dist/commands/builtins.d.ts +2 -1
- package/dist/commands/builtins.js +47 -2
- package/dist/commands/perf.d.ts +32 -2
- package/dist/commands/perf.js +32 -2
- package/dist/commands/registry.d.ts +2 -2
- package/dist/config/env.js +0 -130
- package/dist/config/load.d.ts +0 -2
- package/dist/config/load.js +2 -31
- package/dist/config/schema.d.ts +1 -14
- package/dist/config/schema.js +0 -1
- package/dist/config/store.js +2 -0
- package/dist/input/enter-sequences.d.ts +63 -0
- package/dist/input/enter-sequences.js +151 -0
- package/dist/input/limits.d.ts +11 -0
- package/dist/input/limits.js +11 -0
- package/dist/input/stdin-filter.js +19 -1
- package/dist/logging/install.d.ts +2 -2
- package/dist/logging/install.js +2 -2
- package/dist/session/persist.js +20 -0
- package/dist/todo/follow-through.d.ts +0 -4
- package/dist/todo/follow-through.js +0 -4
- package/dist/todo/limits.d.ts +0 -10
- package/dist/todo/limits.js +0 -10
- package/dist/todo/prompt.d.ts +0 -15
- package/dist/ui/ActivityLine.d.ts +26 -34
- package/dist/ui/ActivityLine.js +30 -19
- package/dist/ui/App.d.ts +1 -41
- package/dist/ui/App.js +94 -129
- package/dist/ui/BottomStatusRow.d.ts +1 -3
- package/dist/ui/BottomStatusRow.js +4 -8
- package/dist/ui/Composer.d.ts +28 -1
- package/dist/ui/Composer.js +46 -17
- package/dist/ui/Header.d.ts +2 -16
- package/dist/ui/Header.js +3 -18
- package/dist/ui/Logo.d.ts +1 -17
- package/dist/ui/Logo.js +0 -16
- package/dist/ui/ModeChip.d.ts +7 -18
- package/dist/ui/ModeChip.js +9 -0
- package/dist/ui/PromptInput.d.ts +2 -28
- package/dist/ui/PromptInput.js +38 -9
- package/dist/ui/StatusBar.d.ts +0 -11
- package/dist/ui/ToastStack.d.ts +2 -18
- package/dist/ui/ToastStack.js +4 -11
- package/dist/ui/Transcript.d.ts +5 -71
- package/dist/ui/Transcript.js +15 -199
- package/dist/ui/enter-frames.d.ts +63 -0
- package/dist/ui/enter-frames.js +136 -0
- package/dist/ui/entries/AssistantEntry.d.ts +0 -23
- package/dist/ui/entries/AssistantEntry.js +3 -4
- package/dist/ui/entries/DiffView.d.ts +1 -7
- package/dist/ui/entries/DiffView.js +2 -2
- package/dist/ui/entries/QueuedEntry.d.ts +27 -0
- package/dist/ui/entries/QueuedEntry.js +30 -0
- package/dist/ui/entries/ToolCard.d.ts +0 -6
- package/dist/ui/entries/ToolCard.js +4 -13
- package/dist/ui/frame-differ.d.ts +13 -0
- package/dist/ui/frame-differ.js +36 -6
- package/dist/ui/glyphs.d.ts +9 -0
- package/dist/ui/glyphs.js +2 -0
- package/dist/ui/ink-runtime.d.ts +1 -0
- package/dist/ui/ink-runtime.js +21 -0
- package/dist/ui/layout/AppShell.d.ts +1 -10
- package/dist/ui/layout/AppShell.js +2 -5
- package/dist/ui/layout/OverlayFrame.d.ts +1 -25
- package/dist/ui/layout/OverlayFrame.js +0 -24
- package/dist/ui/layout/ScrollViewport.d.ts +3 -0
- package/dist/ui/layout/ScrollViewport.js +17 -5
- package/dist/ui/layout/frame.d.ts +0 -22
- package/dist/ui/layout/frame.js +0 -36
- package/dist/ui/layout/todo-layout.d.ts +1 -3
- package/dist/ui/layout/todo-layout.js +7 -8
- package/dist/ui/layout/viewport-geometry.d.ts +1 -1
- package/dist/ui/layout/viewport-geometry.js +1 -1
- package/dist/ui/live-clamp.d.ts +1 -29
- package/dist/ui/live-clamp.js +1 -29
- package/dist/ui/overlays/HelpOverlay.js +3 -1
- package/dist/ui/overlays/PlanReviewOverlay.js +5 -1
- package/dist/ui/overlays/QuestionOverlay.js +7 -2
- package/dist/ui/overlays/SettingsScreen.js +8 -1
- package/dist/ui/run-status-row.d.ts +61 -0
- package/dist/ui/run-status-row.js +70 -0
- package/dist/ui/selection/selection-controller.d.ts +23 -7
- package/dist/ui/selection/selection-controller.js +68 -16
- package/dist/ui/transcript-text.d.ts +0 -8
- package/dist/ui/transcript-text.js +0 -8
- package/dist/ui/use-startup-notices.d.ts +6 -58
- package/dist/ui/use-startup-notices.js +10 -57
- package/dist/ui/use-wheel-routing.d.ts +1 -1
- package/package.json +2 -2
- package/dist/ui/TodoStrip.d.ts +0 -36
- package/dist/ui/TodoStrip.js +0 -32
package/dist/commands/perf.d.ts
CHANGED
|
@@ -16,6 +16,7 @@
|
|
|
16
16
|
* display would be self-defeating.
|
|
17
17
|
*/
|
|
18
18
|
import type { FrameWriterStats } from '../ui/frame-differ.js';
|
|
19
|
+
import type { ScrollbarBridge } from '../ui/scrollbar-controller.js';
|
|
19
20
|
import type { SlashCommand } from './registry.js';
|
|
20
21
|
export interface PerfSnapshot {
|
|
21
22
|
/** Governor rung, its resolved interval, and the last measured commit cost. */
|
|
@@ -33,10 +34,39 @@ export interface PerfSnapshot {
|
|
|
33
34
|
heightsEstimated: number;
|
|
34
35
|
cols: number;
|
|
35
36
|
/** Geometry. */
|
|
36
|
-
mode: 'fullscreen'
|
|
37
|
+
mode: 'fullscreen';
|
|
37
38
|
viewportRows: number;
|
|
38
39
|
offset: number;
|
|
40
|
+
/** Right-edge scrollbar diagnostics; read lazily so it reflects the live bridge. */
|
|
41
|
+
scrollbar?: ScrollbarPerf;
|
|
39
42
|
}
|
|
43
|
+
/**
|
|
44
|
+
* Why the right-edge scrollbar is or is not usable, in one record
|
|
45
|
+
* (tui-scrollbar-edge-and-run-row section 3.2). "Cannot see it" and "cannot drag
|
|
46
|
+
* it" had no self-check before; each field below separates one cause.
|
|
47
|
+
*/
|
|
48
|
+
export interface ScrollbarPerf {
|
|
49
|
+
/** 1-based terminal column of the track, or `null` before the first layout. */
|
|
50
|
+
trackCol: number | null;
|
|
51
|
+
trackRows: number | null;
|
|
52
|
+
/** Mouse capture is on. Off keeps the track visible but not draggable. */
|
|
53
|
+
mouseOn: boolean;
|
|
54
|
+
/** A full frame matching the geometry was observed, so pointer hits are trusted. */
|
|
55
|
+
frameReady: boolean;
|
|
56
|
+
thumb: {
|
|
57
|
+
start: number;
|
|
58
|
+
size: number;
|
|
59
|
+
} | null;
|
|
60
|
+
unicode: boolean;
|
|
61
|
+
/** `skipped`: the differ omits CSI K on full-width rows; `n/a`: diff render is off. */
|
|
62
|
+
edgeEl: 'skipped' | 'always' | 'n/a';
|
|
63
|
+
}
|
|
64
|
+
/** Build the diagnostics record from the live bridge (called at `/perf` time). */
|
|
65
|
+
export declare function readScrollbarPerf(opts: {
|
|
66
|
+
bridge: ScrollbarBridge | undefined;
|
|
67
|
+
diffRender: boolean;
|
|
68
|
+
unicode: boolean;
|
|
69
|
+
}): ScrollbarPerf | undefined;
|
|
40
70
|
/** Called by `App`. Passing `null` detaches. */
|
|
41
71
|
export declare function setPerfSnapshotProvider(fn: (() => PerfSnapshot | null) | null): void;
|
|
42
72
|
export declare function readPerfSnapshot(): PerfSnapshot | null;
|
|
@@ -44,6 +74,6 @@ export declare function setPerfResetHook(fn: (() => void) | null): void;
|
|
|
44
74
|
/** Called by `cli.tsx` after building the writer. Passing `null` detaches. */
|
|
45
75
|
export declare function setFrameStatsProvider(fn: (() => FrameWriterStats) | null): void;
|
|
46
76
|
export declare function readFrameStats(): FrameWriterStats | null;
|
|
47
|
-
/** Format a snapshot as the six-line block documented in §5.4. */
|
|
77
|
+
/** Format a snapshot as the six-line block documented in §5.4 (plus the scrollbar line). */
|
|
48
78
|
export declare function formatPerfReport(snap: PerfSnapshot): string;
|
|
49
79
|
export declare const perfCommand: SlashCommand;
|
package/dist/commands/perf.js
CHANGED
|
@@ -16,6 +16,23 @@
|
|
|
16
16
|
* display would be self-defeating.
|
|
17
17
|
*/
|
|
18
18
|
import { clearRenderCaches, renderCacheStats } from '../ui/render-cache.js';
|
|
19
|
+
/** Build the diagnostics record from the live bridge (called at `/perf` time). */
|
|
20
|
+
export function readScrollbarPerf(opts) {
|
|
21
|
+
const { bridge, diffRender, unicode } = opts;
|
|
22
|
+
if (!bridge)
|
|
23
|
+
return undefined;
|
|
24
|
+
const geometry = bridge.geometry;
|
|
25
|
+
return {
|
|
26
|
+
trackCol: geometry?.trackCol ?? null,
|
|
27
|
+
trackRows: geometry?.trackRows ?? null,
|
|
28
|
+
mouseOn: bridge.isEnabled(),
|
|
29
|
+
frameReady: bridge.frameReady,
|
|
30
|
+
thumb: geometry?.thumb ? { start: geometry.thumb.start, size: geometry.thumb.size } : null,
|
|
31
|
+
unicode,
|
|
32
|
+
// `cli.tsx` always wires `cols` when it builds the differ.
|
|
33
|
+
edgeEl: diffRender ? 'skipped' : 'n/a',
|
|
34
|
+
};
|
|
35
|
+
}
|
|
19
36
|
/** Cleared on unmount, so `/perf` in a torn-down tree says so instead of lying. */
|
|
20
37
|
let provider = null;
|
|
21
38
|
/** Called by `App`. Passing `null` detaches. */
|
|
@@ -39,7 +56,7 @@ export function setPerfResetHook(fn) {
|
|
|
39
56
|
* render — so routing them through a 1900-line component's props would buy
|
|
40
57
|
* nothing and cost `App.tsx` plus `app.test.tsx` churn (P1-2).
|
|
41
58
|
*
|
|
42
|
-
* `null` means the writer was never built — `--no-diff-render
|
|
59
|
+
* `null` means the writer was never built — `--no-diff-render` or
|
|
43
60
|
* a non-interactive path. `/perf` says so in words, so "the flag is off" and
|
|
44
61
|
* "the writer crashed" never look alike.
|
|
45
62
|
*/
|
|
@@ -74,11 +91,23 @@ function formatWriterLine() {
|
|
|
74
91
|
`lines/frame ${ratio(stats.linesWritten, stats.framesTotal)} - ` +
|
|
75
92
|
`bytes/frame ${bytesPerFrame} - fallbacks ${stats.fallbacks}`);
|
|
76
93
|
}
|
|
77
|
-
|
|
94
|
+
function formatScrollbarLine(bar) {
|
|
95
|
+
const thumb = bar.thumb ? `${bar.thumb.start}+${bar.thumb.size}` : 'none';
|
|
96
|
+
const line = `scrollbar col=${bar.trackCol ?? '-'} rows=${bar.trackRows ?? '-'} ` +
|
|
97
|
+
`mouse=${bar.mouseOn ? 'on' : 'off'} frameReady=${bar.frameReady ? 'yes' : 'no'} ` +
|
|
98
|
+
`thumb=${thumb} glyphs=${bar.unicode ? 'unicode' : 'ascii'} edge-el=${bar.edgeEl}`;
|
|
99
|
+
if (!bar.mouseOn || bar.frameReady)
|
|
100
|
+
return line;
|
|
101
|
+
const size = bar.trackCol !== null && bar.trackRows !== null
|
|
102
|
+
? `${bar.trackCol}x${bar.trackRows + 4}` : 'the terminal size';
|
|
103
|
+
return `${line}\n waiting for a full frame matching ${size}`;
|
|
104
|
+
}
|
|
105
|
+
/** Format a snapshot as the six-line block documented in §5.4 (plus the scrollbar line). */
|
|
78
106
|
export function formatPerfReport(snap) {
|
|
79
107
|
const caches = renderCacheStats();
|
|
80
108
|
const eco = snap.rung > 0 ? ' - eco' : '';
|
|
81
109
|
const governor = snap.governorEnabled ? '' : ' - governor off';
|
|
110
|
+
const scrollbar = snap.scrollbar ? [formatScrollbarLine(snap.scrollbar)] : [];
|
|
82
111
|
return [
|
|
83
112
|
`render rung ${snap.rung} - interval ${snap.intervalMs}ms - last commit ` +
|
|
84
113
|
`${Math.round(snap.lastCommitMs)}ms${eco}${governor}`,
|
|
@@ -91,6 +120,7 @@ export function formatPerfReport(snap) {
|
|
|
91
120
|
`lines ${caches.lineEntries}`,
|
|
92
121
|
`mode ${snap.mode} - viewport ${snap.viewportRows} rows - offset ${snap.offset}`,
|
|
93
122
|
formatWriterLine(),
|
|
123
|
+
...scrollbar,
|
|
94
124
|
].join('\n');
|
|
95
125
|
}
|
|
96
126
|
export const perfCommand = {
|
|
@@ -89,7 +89,7 @@ export interface CommandContext {
|
|
|
89
89
|
/**
|
|
90
90
|
* Mouse capture, for `/mouse` (tui-selection-and-scroll-follow §6.2 / G3).
|
|
91
91
|
*
|
|
92
|
-
* OPTIONAL, and legitimately absent:
|
|
92
|
+
* OPTIONAL, and legitimately absent: `--no-mouse`, a non-TTY, a
|
|
93
93
|
* Windows console that cannot deliver reports, and every test that builds this
|
|
94
94
|
* context by literal. `/mouse` has to have something honest to say when it is
|
|
95
95
|
* missing, which is the same reason `update` above it is optional.
|
|
@@ -101,7 +101,7 @@ export interface CommandContext {
|
|
|
101
101
|
* NOT `process.stdout.write`. In full-screen mode stdout is a `Proxy` in front
|
|
102
102
|
* of the frame differ, and an unrecognised chunk there is counted as a foreign
|
|
103
103
|
* write and prints a diagnostic at the user the first time they copy anything
|
|
104
|
-
* (P1-6). Absent
|
|
104
|
+
* (P1-6). Absent with `--no-diff-render`, where the real
|
|
105
105
|
* stream is handed over directly.
|
|
106
106
|
*/
|
|
107
107
|
writeForeign?: (text: string) => void;
|
package/dist/config/env.js
CHANGED
|
@@ -77,8 +77,6 @@ export function readEnvConfig() {
|
|
|
77
77
|
if (process.env.ARAGON_THINKING) {
|
|
78
78
|
partial.thinkingLevel = clampThinkingLevel(process.env.ARAGON_THINKING.trim(), 'off');
|
|
79
79
|
}
|
|
80
|
-
// Parsed by the POSITIVE list, like ARAGON_FULLSCREEN: anything else is left
|
|
81
|
-
// ABSENT so the config file underneath still wins.
|
|
82
80
|
const showThinking = process.env.ARAGON_SHOW_THINKING?.trim().toLowerCase();
|
|
83
81
|
if (showThinking !== undefined && showThinking.length > 0) {
|
|
84
82
|
partial.showThinking =
|
|
@@ -130,16 +128,7 @@ export function readEnvConfig() {
|
|
|
130
128
|
if (process.env.ARAGON_THEME) {
|
|
131
129
|
partial.theme = clampTheme(process.env.ARAGON_THEME.trim(), 'auto');
|
|
132
130
|
}
|
|
133
|
-
// ARAGON_FULLSCREEN=0|1 — the one channel that works where neither a flag nor
|
|
134
131
|
// a config file is reachable (containers, SSH, being spawned by another tool).
|
|
135
|
-
const fullscreen = process.env.ARAGON_FULLSCREEN?.trim().toLowerCase();
|
|
136
|
-
if (fullscreen !== undefined && fullscreen.length > 0) {
|
|
137
|
-
partial.fullscreen = fullscreen === '1' || fullscreen === 'true' || fullscreen === 'on' || fullscreen === 'yes';
|
|
138
|
-
}
|
|
139
|
-
// ARAGON_MOUSE=0 turns off wheel region routing. Parsed by the POSITIVE list
|
|
140
|
-
// above, exactly as ARAGON_FULLSCREEN is — NOT by `envBool` below, which uses
|
|
141
|
-
// a negative list. The two disagree on `ARAGON_MOUSE=disable`, and `mouse` is
|
|
142
|
-
// modelled on `--fullscreen`, so it uses the reader `--fullscreen` uses.
|
|
143
132
|
const mouse = process.env.ARAGON_MOUSE?.trim().toLowerCase();
|
|
144
133
|
if (mouse !== undefined && mouse.length > 0) {
|
|
145
134
|
partial.mouse = mouse === '1' || mouse === 'true' || mouse === 'on' || mouse === 'yes';
|
|
@@ -174,8 +163,6 @@ export function readEnvConfig() {
|
|
|
174
163
|
if (Number.isFinite(n) && n >= 0)
|
|
175
164
|
partial.scrollResumeMs = n;
|
|
176
165
|
}
|
|
177
|
-
// ARAGON_PLAN=1 starts the session in PLAN mode — the same channel story as
|
|
178
|
-
// ARAGON_FULLSCREEN, for terminals reached through a wrapper that owns argv.
|
|
179
166
|
const plan = process.env.ARAGON_PLAN?.trim().toLowerCase();
|
|
180
167
|
if (plan !== undefined && plan.length > 0) {
|
|
181
168
|
partial.planModeDefault = plan === '1' || plan === 'true' || plan === 'on' || plan === 'yes';
|
|
@@ -191,12 +178,6 @@ export function readEnvConfig() {
|
|
|
191
178
|
enabled: !(skills === '0' || skills === 'false' || skills === 'off' || skills === 'no'),
|
|
192
179
|
};
|
|
193
180
|
}
|
|
194
|
-
// ARAGON_TEAM=0 turns team mode off; ARAGON_TEAM_MAX=<n> overrides the fan-out
|
|
195
|
-
// width. Parsed by the POSITIVE list, exactly as ARAGON_FULLSCREEN /
|
|
196
|
-
// ARAGON_MOUSE / ARAGON_PLAN are — NOT by `envBool` below, which uses a
|
|
197
|
-
// negative list. The two readers disagree on `ARAGON_TEAM=disable`, and the
|
|
198
|
-
// documented-but-dead outcome of copying the wrong one is what `load.ts`
|
|
199
|
-
// records for `ARAGON_MOUSE`.
|
|
200
181
|
const team = process.env.ARAGON_TEAM?.trim().toLowerCase();
|
|
201
182
|
const teamMax = process.env.ARAGON_TEAM_MAX?.trim();
|
|
202
183
|
if ((team !== undefined && team.length > 0) || (teamMax !== undefined && teamMax.length > 0)) {
|
|
@@ -217,27 +198,6 @@ export function readEnvConfig() {
|
|
|
217
198
|
if (Object.keys(section).length > 0)
|
|
218
199
|
partial.team = section;
|
|
219
200
|
}
|
|
220
|
-
// ARAGON_TODO=0 turns todo planning off entirely (no tool, no rail). Parsed by
|
|
221
|
-
// the POSITIVE list, exactly as ARAGON_FULLSCREEN / ARAGON_MOUSE / ARAGON_PLAN
|
|
222
|
-
// / ARAGON_TEAM are — NOT by `envBool` below, which uses a negative list. The
|
|
223
|
-
// two readers disagree on values like `ARAGON_TODO=disable`, and this file
|
|
224
|
-
// already records that once for team mode.
|
|
225
|
-
//
|
|
226
|
-
// There is no `ARAGON_TODO_PANEL`: the panel is a per-machine display
|
|
227
|
-
// preference, which is what `config.json` is for, and every env var here
|
|
228
|
-
// exists because a flag and a config file are BOTH unreachable in the channel
|
|
229
|
-
// it serves (containers, SSH, being spawned by another tool).
|
|
230
|
-
//
|
|
231
|
-
// ARAGON_TODO_FOLLOW=notify|auto|off PASSES THAT SAME TEST (D-18), which is
|
|
232
|
-
// why it exists where `ARAGON_TODO_PANEL` does not: follow-through is exactly
|
|
233
|
-
// the knob an unattended `-p` run in a container with a fixed entrypoint needs
|
|
234
|
-
// and can reach no other way.
|
|
235
|
-
//
|
|
236
|
-
// ONE ACCUMULATED SECTION, ASSIGNED ONCE — the shape the `team` branch above
|
|
237
|
-
// already uses, and NOT two `if` blocks each assigning `partial.todo` (P1-4).
|
|
238
|
-
// THE CAST IS WHAT WOULD MAKE THAT MISTAKE SILENT: a second assignment
|
|
239
|
-
// compiles clean and drops `enabled`, so `ARAGON_TODO=0 ARAGON_TODO_FOLLOW=auto`
|
|
240
|
-
// would quietly re-enable the tool the user turned off.
|
|
241
201
|
const todo = process.env.ARAGON_TODO?.trim().toLowerCase();
|
|
242
202
|
const todoFollow = process.env.ARAGON_TODO_FOLLOW?.trim().toLowerCase();
|
|
243
203
|
if ((todo !== undefined && todo.length > 0) ||
|
|
@@ -260,24 +220,6 @@ export function readEnvConfig() {
|
|
|
260
220
|
if (Object.keys(section).length > 0)
|
|
261
221
|
partial.todo = section;
|
|
262
222
|
}
|
|
263
|
-
// ARAGON_BASH_BACKGROUND=0 turns background services off entirely (no
|
|
264
|
-
// `background` param, no `bash_output`/`bash_kill`, no prompt block, no chip);
|
|
265
|
-
// ARAGON_BASH_AUTO_BACKGROUND=0 keeps them but stops the classifier firing on
|
|
266
|
-
// an unset `background`. Parsed by the POSITIVE list, exactly as
|
|
267
|
-
// ARAGON_FULLSCREEN / ARAGON_MOUSE / ARAGON_PLAN / ARAGON_TEAM / ARAGON_TODO
|
|
268
|
-
// are - NOT by `envBool` below, which uses a negative list.
|
|
269
|
-
//
|
|
270
|
-
// Both pass the test every env var in this file has to pass: an unattended run
|
|
271
|
-
// in a container with a fixed entrypoint can reach neither a flag nor a config
|
|
272
|
-
// file, and "do not leave a dev server running in my CI job" is exactly the
|
|
273
|
-
// kind of decision that channel needs to make.
|
|
274
|
-
//
|
|
275
|
-
// ONE ACCUMULATED SECTION, ASSIGNED ONCE - the shape the `team` and `todo`
|
|
276
|
-
// branches above already use, and NOT two `if` blocks each assigning
|
|
277
|
-
// `partial.bash` (the `todo` P1-4 trap). THE CAST IS WHAT WOULD MAKE THAT
|
|
278
|
-
// MISTAKE SILENT: a second assignment compiles clean and drops the first key,
|
|
279
|
-
// so `ARAGON_BASH_BACKGROUND=0 ARAGON_BASH_AUTO_BACKGROUND=0` would quietly
|
|
280
|
-
// re-register the tools the user turned off.
|
|
281
223
|
const bashBackground = process.env.ARAGON_BASH_BACKGROUND?.trim().toLowerCase();
|
|
282
224
|
const bashAuto = process.env.ARAGON_BASH_AUTO_BACKGROUND?.trim().toLowerCase();
|
|
283
225
|
if ((bashBackground !== undefined && bashBackground.length > 0) ||
|
|
@@ -300,22 +242,6 @@ export function readEnvConfig() {
|
|
|
300
242
|
if (Object.keys(section).length > 0)
|
|
301
243
|
partial.bash = section;
|
|
302
244
|
}
|
|
303
|
-
// ARAGON_RETRY=0 is the kill switch for API retry; ARAGON_RETRY_MAX=<n>
|
|
304
|
-
// overrides the count. Parsed by the POSITIVE list, exactly as
|
|
305
|
-
// ARAGON_FULLSCREEN / ARAGON_MOUSE / ARAGON_PLAN / ARAGON_TEAM / ARAGON_TODO
|
|
306
|
-
// are — NOT by `envBool` below, which uses a negative list.
|
|
307
|
-
//
|
|
308
|
-
// TWO VARS ONLY, and no third for the delays: every env var in this file exists
|
|
309
|
-
// because a flag and a config file are BOTH unreachable in the channel it
|
|
310
|
-
// serves, and nobody tunes a backoff multiplier from a container entrypoint.
|
|
311
|
-
//
|
|
312
|
-
// `>= 0`, NOT `> 0`, and the difference is the whole point (R-16).
|
|
313
|
-
// `ARAGON_TEAM_MAX` above guards `parsed > 0`, which is right for a fan-out
|
|
314
|
-
// width and wrong here: `0` is this key's documented floor AND its kill switch,
|
|
315
|
-
// so a `> 0` guard would drop `ARAGON_RETRY_MAX=0` on the floor and leave the
|
|
316
|
-
// user with the default 10. "Left ABSENT when unparseable" still holds and
|
|
317
|
-
// still matters — an unparseable value must not look permanently supplied, or
|
|
318
|
-
// the config file can never win again.
|
|
319
245
|
const retry = process.env.ARAGON_RETRY?.trim().toLowerCase();
|
|
320
246
|
const retryMax = process.env.ARAGON_RETRY_MAX?.trim();
|
|
321
247
|
if ((retry !== undefined && retry.length > 0) || (retryMax !== undefined && retryMax.length > 0)) {
|
|
@@ -333,26 +259,6 @@ export function readEnvConfig() {
|
|
|
333
259
|
if (Object.keys(section).length > 0)
|
|
334
260
|
partial.retry = section;
|
|
335
261
|
}
|
|
336
|
-
// ARAGON_FAST=1 turns the fast model tier on; the other three name it
|
|
337
|
-
// (fast-model-tier §4.3). Parsed by the POSITIVE list, exactly as
|
|
338
|
-
// ARAGON_FULLSCREEN / ARAGON_MOUSE / ARAGON_PLAN / ARAGON_TEAM / ARAGON_TODO /
|
|
339
|
-
// ARAGON_RETRY are — NOT by `envBool` below, whose NEGATIVE list disagrees with
|
|
340
|
-
// it on values like `ARAGON_FAST=disable`.
|
|
341
|
-
//
|
|
342
|
-
// FOUR VARS, AND DELIBERATELY NO `ARAGON_FAST_REVIEW_EVERY` / `_MAX_CHARS` /
|
|
343
|
-
// `_DELEGATE` (D-14). The rule this file states is that an environment variable
|
|
344
|
-
// exists only where a flag AND a config file are BOTH unreachable — a
|
|
345
|
-
// container, an ssh session, being spawned by another tool. "Which model, and
|
|
346
|
-
// is it on" passes that test; tuning a review cadence does not, and every key
|
|
347
|
-
// that fails it is documentation debt plus a fifth place for the value to
|
|
348
|
-
// disagree with itself.
|
|
349
|
-
//
|
|
350
|
-
// ONE ACCUMULATED SECTION, ASSIGNED ONCE — the shape the `team`, `todo` and
|
|
351
|
-
// `retry` branches above all use, and NOT four `if` blocks each assigning
|
|
352
|
-
// `partial.fast`. THE CAST IS WHAT WOULD MAKE THAT MISTAKE SILENT: a second
|
|
353
|
-
// assignment compiles clean and drops `enabled`, so
|
|
354
|
-
// `ARAGON_FAST=1 ARAGON_FAST_MODEL=x` would quietly resolve with the tier off
|
|
355
|
-
// (the P1-4 defect this file records for `todo`).
|
|
356
262
|
const fast = process.env.ARAGON_FAST?.trim().toLowerCase();
|
|
357
263
|
const fastProvider = process.env.ARAGON_FAST_PROVIDER?.trim();
|
|
358
264
|
const fastModel = process.env.ARAGON_FAST_MODEL?.trim();
|
|
@@ -376,25 +282,6 @@ export function readEnvConfig() {
|
|
|
376
282
|
if (Object.keys(section).length > 0)
|
|
377
283
|
partial.fast = section;
|
|
378
284
|
}
|
|
379
|
-
// ARAGON_COMPACTION=0 turns context compaction off; the other two tune it
|
|
380
|
-
// (context-auto-compaction §4.3). Parsed by the POSITIVE list, exactly as
|
|
381
|
-
// ARAGON_FULLSCREEN / ARAGON_MOUSE / ARAGON_PLAN / ARAGON_TEAM / ARAGON_TODO /
|
|
382
|
-
// ARAGON_RETRY / ARAGON_FAST are — NOT by `envBool` below, whose NEGATIVE list
|
|
383
|
-
// disagrees with it on values like `ARAGON_COMPACTION=disable`.
|
|
384
|
-
//
|
|
385
|
-
// THREE VARS, AND DELIBERATELY NO `ARAGON_COMPACTION_ON_FAILURE` /
|
|
386
|
-
// `_USE_FAST_TIER` / `_WARN_THRESHOLD`. The rule this file states is that an
|
|
387
|
-
// environment variable exists only where a flag AND a config file are BOTH
|
|
388
|
-
// unreachable — a container, an ssh session, being spawned by another tool.
|
|
389
|
-
// "Is it on, when does it fire, and how much does it keep" passes that test;
|
|
390
|
-
// "what should it do if the summarizer 500s" does not, and every key that fails
|
|
391
|
-
// it is documentation debt plus a fifth place for the value to disagree with
|
|
392
|
-
// itself.
|
|
393
|
-
//
|
|
394
|
-
// ONE ACCUMULATED SECTION, ASSIGNED ONCE — the shape the four branches above
|
|
395
|
-
// all use, and NOT three `if` blocks each assigning `partial.compaction`. THE
|
|
396
|
-
// CAST IS WHAT WOULD MAKE THAT MISTAKE SILENT: a second assignment compiles
|
|
397
|
-
// clean and drops `enabled`.
|
|
398
285
|
const compaction = process.env.ARAGON_COMPACTION?.trim().toLowerCase();
|
|
399
286
|
const compactionThreshold = process.env.ARAGON_COMPACTION_THRESHOLD?.trim();
|
|
400
287
|
const compactionKeepTurns = process.env.ARAGON_COMPACTION_KEEP_TURNS?.trim();
|
|
@@ -471,23 +358,12 @@ export function readEnvConfig() {
|
|
|
471
358
|
partial.update = { mode };
|
|
472
359
|
}
|
|
473
360
|
}
|
|
474
|
-
// Render bounds (tui-render-performance §5.3). Same channel story as
|
|
475
|
-
// ARAGON_FULLSCREEN: a container or a wrapper that owns argv can reach neither
|
|
476
|
-
// a flag nor a config file, and a session that freezes is exactly the case
|
|
477
|
-
// where the user needs a knob they can turn from the outside.
|
|
478
|
-
//
|
|
479
|
-
// ARAGON_TRANSCRIPT_RETAIN / ARAGON_MAX_RENDER_INTERVAL_MS are left ABSENT
|
|
480
|
-
// when unparseable rather than written as a default, so the config file can
|
|
481
|
-
// still win — the rule `ARAGON_TEAM_MAX` above records.
|
|
482
361
|
const retain = process.env.ARAGON_TRANSCRIPT_RETAIN?.trim();
|
|
483
362
|
if (retain !== undefined && retain.length > 0) {
|
|
484
363
|
const parsed = Number.parseInt(retain, 10);
|
|
485
364
|
if (Number.isFinite(parsed) && parsed > 0)
|
|
486
365
|
partial.transcriptRetain = parsed;
|
|
487
366
|
}
|
|
488
|
-
// Parsed by the POSITIVE list, exactly as ARAGON_FULLSCREEN / ARAGON_MOUSE /
|
|
489
|
-
// ARAGON_PLAN / ARAGON_TEAM / ARAGON_TODO are — NOT by `envBool` below, which
|
|
490
|
-
// uses a negative list. The two readers disagree on `ARAGON_RENDER_GOVERNOR=disable`.
|
|
491
367
|
const governor = process.env.ARAGON_RENDER_GOVERNOR?.trim().toLowerCase();
|
|
492
368
|
if (governor !== undefined && governor.length > 0) {
|
|
493
369
|
partial.renderGovernor =
|
|
@@ -499,12 +375,6 @@ export function readEnvConfig() {
|
|
|
499
375
|
if (Number.isFinite(parsed) && parsed > 0)
|
|
500
376
|
partial.maxRenderIntervalMs = parsed;
|
|
501
377
|
}
|
|
502
|
-
// ARAGON_DIFF_RENDER=0 restores the pre-fix full-frame repaint;
|
|
503
|
-
// ARAGON_SYNC_OUTPUT=0 drops the DEC 2026 envelope (tui-input-flicker-fix
|
|
504
|
-
// §5.3). Parsed by the POSITIVE list, exactly as ARAGON_FULLSCREEN /
|
|
505
|
-
// ARAGON_MOUSE / ARAGON_PLAN / ARAGON_TEAM / ARAGON_TODO / ARAGON_RENDER_GOVERNOR
|
|
506
|
-
// are — NOT by `envBool` below, whose NEGATIVE list disagrees with it on values
|
|
507
|
-
// like `ARAGON_DIFF_RENDER=disable`.
|
|
508
378
|
const diffRender = process.env.ARAGON_DIFF_RENDER?.trim().toLowerCase();
|
|
509
379
|
if (diffRender !== undefined && diffRender.length > 0) {
|
|
510
380
|
partial.diffRender =
|
package/dist/config/load.d.ts
CHANGED
|
@@ -19,8 +19,6 @@ export interface CliFlags {
|
|
|
19
19
|
confirm?: boolean;
|
|
20
20
|
toolTimeout?: string | number;
|
|
21
21
|
idleTimeout?: string | number;
|
|
22
|
-
/** `--fullscreen` ⇒ true, `--no-fullscreen` ⇒ false, absent ⇒ undefined. */
|
|
23
|
-
fullscreen?: boolean;
|
|
24
22
|
/** `--no-exit-transcript` ⇒ false. */
|
|
25
23
|
exitTranscript?: boolean;
|
|
26
24
|
/** `--compact` ⇒ true, `--no-compact` ⇒ false, absent ⇒ undefined. */
|
package/dist/config/load.js
CHANGED
|
@@ -23,32 +23,11 @@ function envFlagTrue(value) {
|
|
|
23
23
|
const v = value.trim().toLowerCase();
|
|
24
24
|
return v === '1' || v === 'true' || v === 'on' || v === 'yes';
|
|
25
25
|
}
|
|
26
|
-
/**
|
|
27
|
-
* Resolve the tri-state full-screen preference (see `CliConfig.fullscreen`).
|
|
28
|
-
* Only a flag or the env var counts as an explicit FORCE; a config file holding
|
|
29
|
-
* the default `true` must not disable the automatic downgrades.
|
|
30
|
-
*/
|
|
31
|
-
function resolveFullscreen(flags, env, file) {
|
|
32
|
-
if (flags.fullscreen !== undefined)
|
|
33
|
-
return flags.fullscreen;
|
|
34
|
-
if (env.fullscreen !== undefined)
|
|
35
|
-
return env.fullscreen;
|
|
36
|
-
if (file.fullscreen === false)
|
|
37
|
-
return false;
|
|
38
|
-
return undefined;
|
|
39
|
-
}
|
|
40
26
|
/**
|
|
41
27
|
* Resolve wheel region routing: flag › env › file › default `true`.
|
|
42
28
|
*
|
|
43
|
-
*
|
|
44
|
-
*
|
|
45
|
-
* reads NO ENV AT ALL — copying that line would ship `ARAGON_MOUSE` as
|
|
46
|
-
* documented-but-dead (P1-9). Only `fullscreen` has an env layer, and only
|
|
47
|
-
* because `resolveFullscreen` above was written to give it one.
|
|
48
|
-
*
|
|
49
|
-
* Unlike `fullscreen` this is a plain boolean rather than a tri-state: there
|
|
50
|
-
* are no heuristics for an explicit `true` to override, so a persisted `true`
|
|
51
|
-
* is just a value and not an opinion that has to be told apart from silence.
|
|
29
|
+
* Unlike `hints`, mouse routing accepts an environment override. Keep that
|
|
30
|
+
* layer explicit so ARAGON_MOUSE works even when a wrapper owns the arguments.
|
|
52
31
|
*/
|
|
53
32
|
function resolveMouse(flags, env, file) {
|
|
54
33
|
if (flags.mouse !== undefined)
|
|
@@ -463,12 +442,6 @@ export function loadConfig(flags = {}) {
|
|
|
463
442
|
const read = readConfigFile();
|
|
464
443
|
const file = read.config ?? {};
|
|
465
444
|
const env = readEnvConfig();
|
|
466
|
-
// A config file that exists but will not parse used to reset EVERY setting
|
|
467
|
-
// with nothing anywhere explaining it. The fallback is unchanged; what is new
|
|
468
|
-
// is that it leaves a trace. The record alone is not the explanation, so the
|
|
469
|
-
// two owners of a user-visible channel say it too: `main()` writes one stderr
|
|
470
|
-
// line (headless, inline and every subcommand) and `App.tsx` raises a toast
|
|
471
|
-
// (full-screen, where the alternate screen wipes that line away).
|
|
472
445
|
if (read.parseError) {
|
|
473
446
|
getLogger().error('config', 'config_parse_failed', { error: read.parseError });
|
|
474
447
|
}
|
|
@@ -580,7 +553,6 @@ export function loadConfig(flags = {}) {
|
|
|
580
553
|
contextWindow,
|
|
581
554
|
theme,
|
|
582
555
|
reducedMotion,
|
|
583
|
-
fullscreen: resolveFullscreen(flags, env.partial, file),
|
|
584
556
|
exitTranscript: flags.exitTranscript !== undefined
|
|
585
557
|
? flags.exitTranscript
|
|
586
558
|
: file.exitTranscript ?? DEFAULT_CONFIG.exitTranscript,
|
|
@@ -658,7 +630,6 @@ function recordResolvedConfig(config) {
|
|
|
658
630
|
// "why is my output truncated" was unanswerable after the fact.
|
|
659
631
|
maxTokens: config.maxTokens ?? 'auto',
|
|
660
632
|
theme: config.theme,
|
|
661
|
-
fullscreen: config.fullscreen,
|
|
662
633
|
toolTimeoutMs: config.toolTimeoutMs,
|
|
663
634
|
idleTimeoutMs: config.idleTimeoutMs,
|
|
664
635
|
historyEnabled: config.historyEnabled,
|
package/dist/config/schema.d.ts
CHANGED
|
@@ -729,7 +729,6 @@ export interface PersistedConfig {
|
|
|
729
729
|
/** Replace spinners with a static glyph for calmer, low-motion output. */
|
|
730
730
|
reducedMotion: boolean;
|
|
731
731
|
/** Full-screen TUI (still subject to the automatic downgrades in §4.1). */
|
|
732
|
-
fullscreen: boolean;
|
|
733
732
|
/** Replay a plain-text session summary after leaving the alternate screen. */
|
|
734
733
|
exitTranscript: boolean;
|
|
735
734
|
/** Entries reachable by scrolling; older ones show the "collapsed" line (I-3). */
|
|
@@ -767,8 +766,7 @@ export interface PersistedConfig {
|
|
|
767
766
|
* transcript, whatever row the pointer is on (wheel-scrolls-transcript-only
|
|
768
767
|
* §4.1).
|
|
769
768
|
*
|
|
770
|
-
* A
|
|
771
|
-
* heuristics for an explicit `true` to override (D-10).
|
|
769
|
+
* A plain boolean: persisted values and per-run overrides use the same meaning.
|
|
772
770
|
*/
|
|
773
771
|
mouse: boolean;
|
|
774
772
|
/**
|
|
@@ -881,17 +879,6 @@ export interface CliConfig {
|
|
|
881
879
|
contextWindow: number | null;
|
|
882
880
|
theme: ThemeName;
|
|
883
881
|
reducedMotion: boolean;
|
|
884
|
-
/**
|
|
885
|
-
* TRI-STATE, and deliberately so (spec §4.1 vs §6.2):
|
|
886
|
-
* `false` — an explicit opt-out from any layer; always inline.
|
|
887
|
-
* `true` — an explicit FORCE, only from `--fullscreen` / `ARAGON_FULLSCREEN=1`;
|
|
888
|
-
* overrides the TERM/CI/size heuristics.
|
|
889
|
-
* `undefined` — no explicit choice (including a config file holding the
|
|
890
|
-
* default `true`); full-screen with the heuristics live.
|
|
891
|
-
* Folding the persisted default into `true` would turn every user's config
|
|
892
|
-
* file into a permanent "ignore the CI and TERM=dumb downgrades" switch.
|
|
893
|
-
*/
|
|
894
|
-
fullscreen?: boolean;
|
|
895
882
|
/** Replay a plain-text summary on exit (full-screen only — see §4.4). */
|
|
896
883
|
exitTranscript: boolean;
|
|
897
884
|
/** Entries reachable by scrolling; older ones show the "collapsed" line (I-3). */
|
package/dist/config/schema.js
CHANGED
package/dist/config/store.js
CHANGED
|
@@ -69,6 +69,8 @@ export function readConfigFile() {
|
|
|
69
69
|
const raw = readFileSync(file, 'utf-8');
|
|
70
70
|
const parsed = JSON.parse(raw);
|
|
71
71
|
if (parsed && typeof parsed === 'object') {
|
|
72
|
+
// Retired layout preference: tolerate old files without restoring a UI mode.
|
|
73
|
+
delete parsed.fullscreen;
|
|
72
74
|
return { config: parsed };
|
|
73
75
|
}
|
|
74
76
|
return { config: null, parseError: `${file} does not contain a JSON object` };
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Enter-family sequence recognition (tui-shift-enter-copy-queue §3.3) -- pure,
|
|
3
|
+
* stream-free, no node/React imports, callable from any test environment.
|
|
4
|
+
*
|
|
5
|
+
* WHY THIS LIVES BELOW INK. Ink 5's `parse-keypress.js` calls `parseKeypress`
|
|
6
|
+
* ONCE per stdin chunk and hard-codes `shift: false` for the exact string
|
|
7
|
+
* `'\r'`, so a component can never see `key.return && key.shift` -- the
|
|
8
|
+
* `PromptInput` branch for it is dead code. Worse, terminals that DO encode a
|
|
9
|
+
* distinct Shift+Enter send CSI-u (`\x1b[13;2u`), which Ink's `fnKeyRe` does
|
|
10
|
+
* not match: the ESC is stripped by `use-input.js` and `'[13;2u'` falls through
|
|
11
|
+
* to the PRINTABLE branch, typing garbage into the draft. The only layer that
|
|
12
|
+
* sees the bytes before Ink mangles them is the stdin filter, which is where
|
|
13
|
+
* the mouse-report and paste-marker dialects are already translated.
|
|
14
|
+
*
|
|
15
|
+
* THE CONTRACT: rewrite every recognized sequence to ONE normalized token --
|
|
16
|
+
* `ENTER_NEWLINE_FRAME` for "this was a modified Enter, the user wants a
|
|
17
|
+
* newline" and `'\r'` for the unmodified CSI-u Enter some other program left
|
|
18
|
+
* behind. No state, no partial-output: `rewriteEnterSequences` is idempotent
|
|
19
|
+
* because its output contains none of its inputs.
|
|
20
|
+
*/
|
|
21
|
+
/** What one recognized sequence means, for tests and `/terminal-setup` copy. */
|
|
22
|
+
export interface EnterSequenceSpec {
|
|
23
|
+
/** The exact byte sequence a terminal sends for this key. */
|
|
24
|
+
readonly seq: string;
|
|
25
|
+
/** The chord it names, e.g. `'shift+enter'`, `'ctrl+alt+enter'`, `'enter'`. */
|
|
26
|
+
readonly meaning: string;
|
|
27
|
+
/** What `rewriteEnterSequences` replaces it with. */
|
|
28
|
+
readonly to: string;
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* The recognition table (§3.3). CSI-u modifiers 2-8 cover Shift(2), Alt(3),
|
|
32
|
+
* Shift+Alt(4), Ctrl(5), Ctrl+Shift(6), Ctrl+Alt(7), Ctrl+Alt+Shift(8) as
|
|
33
|
+
* emitted by kitty/WezTerm keyboard-enhancement mode and by
|
|
34
|
+
* `modifyOtherKeys=2`; every one of them means "Enter with a modifier", and a
|
|
35
|
+
* modified Enter must NEVER submit the draft. `\x1b\r` / `\x1b\n` are the
|
|
36
|
+
* classic Alt+Enter encodings. `\x1b[13u` (no modifier field) is what a
|
|
37
|
+
* leftover kitty mode sends for a PLAIN Enter: it must submit, so it maps to
|
|
38
|
+
* `'\r'` rather than to a newline.
|
|
39
|
+
*/
|
|
40
|
+
export declare const ENTER_SEQUENCES: readonly EnterSequenceSpec[];
|
|
41
|
+
/**
|
|
42
|
+
* Rewrite every recognized Enter-family sequence to its normalized token.
|
|
43
|
+
*
|
|
44
|
+
* ONE ANCHORED REGEX, not a per-sequence scan and not a state machine: the
|
|
45
|
+
* CSI-u family shares one shape and the two literal Alt+Enter encodings cannot
|
|
46
|
+
* nest inside it, so a single left-to-right pass is unambiguous. `\x1b[13;9u`
|
|
47
|
+
* and other unknown modifiers are deliberately left untouched -- rewriting an
|
|
48
|
+
* unrecognized sequence would be guessing at a terminal dialect we have not
|
|
49
|
+
* seen.
|
|
50
|
+
*/
|
|
51
|
+
export declare function rewriteEnterSequences(text: string): string;
|
|
52
|
+
/**
|
|
53
|
+
* Length of the trailing run of `text` that is a proper prefix of an
|
|
54
|
+
* Enter-family sequence, or 0.
|
|
55
|
+
*
|
|
56
|
+
* LONGEST MATCH, not shortest: unlike the mouse and paste families, a torn
|
|
57
|
+
* CSI-u sequence diverges from its siblings only at the LAST byte
|
|
58
|
+
* (`\x1b[13;` + `2u`), so every byte before the divergence point must be held
|
|
59
|
+
* back for the next chunk or the sequence is destroyed a byte early. Feeding
|
|
60
|
+
* the result into the filter's `keep = max(...)` alongside the other two
|
|
61
|
+
* families keeps every family's hold intact.
|
|
62
|
+
*/
|
|
63
|
+
export declare function trailingEnterPrefixLength(text: string): number;
|