@aragon-agent/cli 0.6.31 → 0.6.33
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 +119 -0
- package/README.md +2970 -2826
- package/dist/agent/controller.d.ts +46 -0
- package/dist/agent/controller.js +175 -7
- package/dist/agent/job-notices.d.ts +143 -0
- package/dist/agent/job-notices.js +182 -0
- package/dist/agent/reducer.d.ts +21 -1
- package/dist/agent/reducer.js +7 -0
- package/dist/agent/system-prompt.d.ts +12 -0
- package/dist/agent/system-prompt.js +2 -0
- package/dist/cli.js +236 -8
- package/dist/commands/builtins.js +23 -8
- package/dist/commands/perf.d.ts +77 -1
- package/dist/commands/perf.js +37 -5
- package/dist/config/cli-commands.d.ts +27 -0
- package/dist/config/cli-commands.js +54 -1
- package/dist/config/env.js +38 -0
- package/dist/config/load.js +50 -1
- package/dist/config/schema.d.ts +73 -0
- package/dist/config/schema.js +34 -0
- package/dist/config/store.js +14 -1
- package/dist/exec/events.d.ts +29 -3
- package/dist/exec/events.js +3 -12
- package/dist/exec/runner.d.ts +24 -0
- package/dist/exec/runner.js +79 -0
- package/dist/input/cursor-report.d.ts +61 -0
- package/dist/input/cursor-report.js +97 -0
- package/dist/input/stdin-filter.d.ts +22 -0
- package/dist/input/stdin-filter.js +48 -3
- package/dist/proc/limits.d.ts +76 -2
- package/dist/proc/limits.js +83 -2
- package/dist/proc/log-mirror.d.ts +59 -0
- package/dist/proc/log-mirror.js +203 -0
- package/dist/proc/log-ring.d.ts +22 -0
- package/dist/proc/log-ring.js +20 -1
- package/dist/proc/notices.d.ts +57 -0
- package/dist/proc/notices.js +101 -0
- package/dist/proc/progress.d.ts +40 -0
- package/dist/proc/progress.js +135 -0
- package/dist/proc/prompt.d.ts +24 -2
- package/dist/proc/prompt.js +51 -2
- package/dist/proc/supervisor.d.ts +35 -2
- package/dist/proc/supervisor.js +142 -43
- package/dist/proc/types.d.ts +89 -1
- package/dist/proc/wait.d.ts +57 -0
- package/dist/proc/wait.js +133 -0
- package/dist/session/persist.js +3 -1
- package/dist/session/validate-session.js +17 -0
- package/dist/tools/bash-tool.d.ts +12 -1
- package/dist/tools/bash-tool.js +100 -13
- package/dist/tools/index.d.ts +26 -2
- package/dist/tools/index.js +43 -2
- package/dist/tools/job-tools.d.ts +54 -0
- package/dist/tools/job-tools.js +329 -0
- package/dist/tools/proc-tools.d.ts +1 -1
- package/dist/tools/proc-tools.js +49 -17
- package/dist/ui/ActivityLine.js +7 -0
- package/dist/ui/App.js +98 -12
- package/dist/ui/ScrollbackShell.d.ts +62 -11
- package/dist/ui/ScrollbackShell.js +11 -3
- package/dist/ui/StatusBar.d.ts +5 -0
- package/dist/ui/StatusBar.js +1 -0
- package/dist/ui/Transcript.d.ts +14 -0
- package/dist/ui/Transcript.js +14 -2
- package/dist/ui/entries/ServiceCard.d.ts +17 -1
- package/dist/ui/entries/ServiceCard.js +39 -4
- package/dist/ui/layout/status-layout.d.ts +13 -1
- package/dist/ui/layout/status-layout.js +10 -0
- package/dist/ui/layout/virtual-window.js +14 -1
- package/dist/ui/run-status-row.d.ts +12 -0
- package/dist/ui/screen.d.ts +17 -4
- package/dist/ui/screen.js +14 -6
- package/dist/ui/scrollback/LiveTail.d.ts +79 -0
- package/dist/ui/scrollback/LiveTail.js +32 -0
- package/dist/ui/scrollback/band.d.ts +114 -0
- package/dist/ui/scrollback/band.js +130 -0
- package/dist/ui/scrollback/budget.d.ts +51 -10
- package/dist/ui/scrollback/budget.js +69 -20
- package/dist/ui/scrollback/canvas.d.ts +99 -0
- package/dist/ui/scrollback/canvas.js +113 -0
- package/dist/ui/scrollback/cursor-probe.d.ts +71 -0
- package/dist/ui/scrollback/cursor-probe.js +133 -0
- package/dist/ui/scrollback/limits.d.ts +61 -4
- package/dist/ui/scrollback/limits.js +61 -4
- package/dist/ui/scrollback/live-preview.d.ts +18 -10
- package/dist/ui/scrollback/live-preview.js +14 -11
- package/dist/ui/scrollback/scrollback-writer.d.ts +104 -16
- package/dist/ui/scrollback/scrollback-writer.js +368 -82
- package/dist/ui/scrollback/tail-window.d.ts +60 -0
- package/dist/ui/scrollback/tail-window.js +73 -0
- package/dist/ui/scrollback/use-scrollback-view.d.ts +34 -15
- package/dist/ui/scrollback/use-scrollback-view.js +110 -59
- package/dist/ui/scrollback/writer-shapes.d.ts +68 -2
- package/dist/ui/scrollback/writer-shapes.js +53 -8
- package/package.json +3 -3
|
@@ -1,32 +1,64 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* ScrollbackWriter — the byte contract of native-scroll mode
|
|
3
|
-
* (tui-native-terminal-scroll §4.3
|
|
3
|
+
* (tui-native-terminal-scroll §4.3, extended by tui-bottom-anchored-live-region
|
|
4
|
+
* and re-based on a CANVAS by tui-canvas-bottom-anchor).
|
|
4
5
|
*
|
|
5
6
|
* It implements `FrameDiffer`, so `stdout-frame-writer.ts::wrapStdoutForFrames`
|
|
6
7
|
* binds it to a real stream exactly as it binds the full-screen differ. What it
|
|
7
8
|
* does differently: the screen is NOT the app's. Settled conversation rows are
|
|
8
9
|
* printed into the host terminal's own scrollback, and Ink's frame is only a small
|
|
9
|
-
* LIVE REGION parked
|
|
10
|
+
* LIVE REGION parked under the last printed row.
|
|
10
11
|
*
|
|
11
|
-
* GEOMETRY IS RELATIVE (D2). A batch is `CUU(
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
* terminal that scrolls underneath
|
|
12
|
+
* GEOMETRY IS RELATIVE (D2/D4). A batch is `CUU(canvasRows)` to the top of the
|
|
13
|
+
* previous CANVAS, erase down, skip the gap, print the content rows, print the
|
|
14
|
+
* region, park on the last row. Nothing needs the terminal's absolute row count, so
|
|
15
|
+
* a terminal that scrolls underneath cannot misplace anything.
|
|
16
|
+
*
|
|
17
|
+
* THE CANVAS (tui-canvas-bottom-anchor D1/D3). The `rows - 1` rows above the parked
|
|
18
|
+
* row belong to the writer and are always laid out top-down as
|
|
19
|
+
* `[gap][content][region]`. The previous feature put its blank rows between the
|
|
20
|
+
* content and the region (`[content][pad][region]`), which is why a short
|
|
21
|
+
* conversation left a reply floating far above the composer. The blank space now
|
|
22
|
+
* lives above every visible content row, so the newest printed row always touches
|
|
23
|
+
* the top row of the live region, while the composer stays on the last two rows.
|
|
24
|
+
* The gap is SKIPPED with CUD and never written, so a blank row can never be pushed
|
|
25
|
+
* into the scrollback (I-B3).
|
|
26
|
+
*
|
|
27
|
+
* THE PRICE, and it is the only one: the content rows still on the canvas can be
|
|
28
|
+
* re-drawn when the layout changes (a region collapse, a longer draft), because the
|
|
29
|
+
* rows that the region gives back have to move onto the canvas top. That is why the
|
|
30
|
+
* writer keeps a bounded cache of them (`held`, at most `capacity - H` rows). A row
|
|
31
|
+
* that leaves the canvas — pushed into the scrollback or erased at exit — is never
|
|
32
|
+
* written again, so the history the user scrolls through is exactly what was
|
|
33
|
+
* printed, once (I-B5). `anchor: unknown` (nothing measured: no TTY, no filter, no
|
|
34
|
+
* CPR answer) keeps the pre-feature bytes exactly, which is what keeps the old byte
|
|
35
|
+
* tests meaningful (I-B7).
|
|
15
36
|
*
|
|
16
37
|
* THE INVARIANTS THAT FAIL SILENTLY IF DROPPED:
|
|
17
|
-
* - I-S4 · every batch parks the cursor
|
|
18
|
-
* place Ink's `previousLineCount = H + 1` expects
|
|
19
|
-
* write is still correct.
|
|
38
|
+
* - I-S4 · every batch parks the cursor one row below the region, column 0, the
|
|
39
|
+
* same place Ink's `previousLineCount = H + 1` expects.
|
|
20
40
|
* - I-S8 · geometry in doubt (foreign write, unparseable chunk) => `prev = null`
|
|
21
|
-
* => next batch is a SEED. Never keep erasing on a stale
|
|
22
|
-
* - I-S14 · after `finalize` EVERY Ink write is swallowed.
|
|
23
|
-
* once more (and a 32 ms trailing throttle call can follow); passed through,
|
|
24
|
-
* its `eraseLines(H + 1)` would erase the summary and the end of the
|
|
25
|
-
* conversation. With an unknown or sub-2-row terminal the frame is still
|
|
26
|
-
* parsed so `prev`/`H0` track Ink's own `previousLineCount`.
|
|
41
|
+
* => next batch is a SEED. Never keep erasing on a stale height.
|
|
42
|
+
* - I-S14 · after `finalize` EVERY Ink write is swallowed.
|
|
27
43
|
* - I-S13 · no emitted row is wider than `cols - 1` (clipped, counted).
|
|
44
|
+
* - I-B1 · a batch ends parked on `rows - 1`, which is what the next `CUU` assumes.
|
|
45
|
+
* - I-B3 · blank rows only ever exist as SKIPPED rows, and a batch that scrolls has
|
|
46
|
+
* `gap = 0`, so the scrollback never receives an empty row from this file.
|
|
47
|
+
* - I-B5 · `held` is a contiguous suffix of the printed content, and `dropped` is
|
|
48
|
+
* exactly the number of rows this batch pushed off the top. The BYTES carry the
|
|
49
|
+
* untrimmed content: the terminal can only scroll away rows it was given.
|
|
50
|
+
* - I-B14 · a re-measurement re-derives `capacity` from `spaceBelow + canvasRows`,
|
|
51
|
+
* never from `spaceBelow` alone: the canvas itself still owns the rows above the
|
|
52
|
+
* cursor, and forgetting them makes the next batch read its own screen as an
|
|
53
|
+
* overflow and print every visible row a second time.
|
|
54
|
+
* - I-B15 · every batch starts by reconciling `top + capacity` with the live
|
|
55
|
+
* `rows - 1` (a resize event can arrive one frame late), and a column change
|
|
56
|
+
* resets before it writes.
|
|
57
|
+
* - I-A9 · the writer never writes a probe byte; it only asks the host, which owns
|
|
58
|
+
* deferral, coalescing and the death switch.
|
|
28
59
|
*/
|
|
29
60
|
import type { FrameDiffer } from '../frame-differ.js';
|
|
61
|
+
import { type AnchorSource } from './canvas.js';
|
|
30
62
|
import type { ScrollbackDrain } from './drain.js';
|
|
31
63
|
export interface ScrollbackWriterOptions {
|
|
32
64
|
rows: () => number | undefined;
|
|
@@ -45,6 +77,17 @@ export interface ScrollbackWriterOptions {
|
|
|
45
77
|
* arrive without a new Ink frame, and to flush the rest of an oversized feed.
|
|
46
78
|
*/
|
|
47
79
|
requestRepaint?: () => void;
|
|
80
|
+
/**
|
|
81
|
+
* Ask the host for one more cursor measurement (resize settled, geometry lost).
|
|
82
|
+
*
|
|
83
|
+
* CONTRACT (P0-3), and the writer does NOT implement any of it: the call can
|
|
84
|
+
* arrive from inside Ink's `stdout.write` (`invalidate` is called by
|
|
85
|
+
* `transform`), so the host MUST defer it with `setImmediate`, MUST coalesce
|
|
86
|
+
* everything inside the window into one `ESC[6n`, and MUST drop it after
|
|
87
|
+
* `finalize`/`dispose`/`exit` — a probe written at a terminal already handed
|
|
88
|
+
* back to the shell leaks `^[[12;1R` onto the user's prompt (I-A9).
|
|
89
|
+
*/
|
|
90
|
+
requestAnchorProbe?: () => void;
|
|
48
91
|
/** Injected clock for the resize grace window. */
|
|
49
92
|
now?: () => number;
|
|
50
93
|
}
|
|
@@ -63,12 +106,57 @@ export interface ScrollbackWriterStats {
|
|
|
63
106
|
elidedEntries: number;
|
|
64
107
|
resizes: number;
|
|
65
108
|
repaints: number;
|
|
109
|
+
/** Where the anchor came from: `probe`, one-off `fill`, or never measured. */
|
|
110
|
+
anchorSource: AnchorSource;
|
|
111
|
+
/** Canvas height of the most recent batch — the next erase distance (0 = unknown). */
|
|
112
|
+
anchorCanvasRows: number;
|
|
113
|
+
/** Content rows inside that canvas. */
|
|
114
|
+
anchorHeldRows: number;
|
|
115
|
+
/** Blank rows above the content in that canvas. */
|
|
116
|
+
anchorGapRows: number;
|
|
117
|
+
/** Rows this session pushed into the scrollback (the "is it scrolling" signal). */
|
|
118
|
+
anchorScrollRows: number;
|
|
119
|
+
/** Times the geometry was dropped on purpose (column change, shrink, gap lost). */
|
|
120
|
+
anchorResets: number;
|
|
121
|
+
/** Measurements accepted AFTER the first one — the re-probe count (not resize events). */
|
|
122
|
+
anchorReprobes: number;
|
|
123
|
+
}
|
|
124
|
+
export interface CanvasStats {
|
|
125
|
+
/** `'pinned'` = measured, drawing a canvas; `'unknown'` = legacy append path. */
|
|
126
|
+
state: 'pinned' | 'unknown';
|
|
127
|
+
/** Probe / fill origin; `'none'` = never measured. */
|
|
128
|
+
source: AnchorSource;
|
|
129
|
+
/** Rows of the most recent canvas (0 while unknown). */
|
|
130
|
+
canvasRows: number;
|
|
131
|
+
/** Content rows inside it. */
|
|
132
|
+
heldRows: number;
|
|
133
|
+
/** Blank rows above the content. */
|
|
134
|
+
gapRows: number;
|
|
135
|
+
/** Canvas top row (0 = the canvas starts at the first screen row). */
|
|
136
|
+
top: number;
|
|
66
137
|
}
|
|
67
138
|
export interface ScrollbackWriter extends FrameDiffer {
|
|
68
139
|
/** Idempotent. Returns the exit bytes; afterwards every Ink write is swallowed. */
|
|
69
140
|
finalize(summary: readonly string[]): string;
|
|
70
|
-
/**
|
|
141
|
+
/**
|
|
142
|
+
* Rows of the LIVE REGION as last parked — the frame height `H`, NOT the canvas
|
|
143
|
+
* (P1-4). `/perf` prints this as "scrollback region N rows", and it has to keep
|
|
144
|
+
* meaning the same number; the canvas height is `anchorStats().canvasRows`.
|
|
145
|
+
*/
|
|
71
146
|
regionRows(): number;
|
|
72
147
|
scrollbackStats(): ScrollbackWriterStats;
|
|
148
|
+
/**
|
|
149
|
+
* The host measured how many blank rows are left below the parked cursor
|
|
150
|
+
* (`0` = already on the last row). Writes no bytes; the next batch — or the
|
|
151
|
+
* `repaint()` the host schedules right after — consumes it.
|
|
152
|
+
*
|
|
153
|
+
* Idempotent and overwritable: the post-resize re-probe calls it again, and it
|
|
154
|
+
* must then arrive at the SAME capacity the resize delta did (I-B14). Side
|
|
155
|
+
* effect: sets `anchorDirty`, which is what lets `repaint()` redraw while the
|
|
156
|
+
* feed is idle (P0-2).
|
|
157
|
+
*/
|
|
158
|
+
setAnchorSpaceBelow(spaceBelow: number, source: AnchorSource): void;
|
|
159
|
+
/** For `/perf` and tests. Produces no bytes. */
|
|
160
|
+
anchorStats(): CanvasStats;
|
|
73
161
|
}
|
|
74
162
|
export declare function createScrollbackWriter(o: ScrollbackWriterOptions): ScrollbackWriter;
|