koneck 2.128.18 → 2.128.20
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/frame-sync.d.ts +32 -0
- package/dist/frame-sync.d.ts.map +1 -1
- package/dist/frame-sync.js +75 -7
- package/dist/frame-sync.js.map +1 -1
- package/dist/ink-chat.d.ts +27 -0
- package/dist/ink-chat.d.ts.map +1 -1
- package/dist/ink-chat.js +109 -12
- package/dist/ink-chat.js.map +1 -1
- package/package.json +1 -1
package/dist/frame-sync.d.ts
CHANGED
|
@@ -39,6 +39,38 @@ export declare function synchronizedFrame(chunk: string): string;
|
|
|
39
39
|
* `write` is read from — and every method bound to — the real stream, so `on('resize')` registers
|
|
40
40
|
* on the stream the terminal actually resizes rather than on a copy that never hears about it.
|
|
41
41
|
*/
|
|
42
|
+
/** True when a chunk only moves the cursor and erases: it paints nothing at all. */
|
|
43
|
+
export declare function isErasureOnly(chunk: string): boolean;
|
|
44
|
+
/**
|
|
45
|
+
* The same stream, with each frame presented atomically.
|
|
46
|
+
*
|
|
47
|
+
* A Proxy rather than a subclass or a prototype clone because Ink both writes to this object and
|
|
48
|
+
* listens on it, and an EventEmitter keeps its listeners on the instance. Every member other than
|
|
49
|
+
* `write` is read from — and every method bound to — the real stream, so `on('resize')` registers
|
|
50
|
+
* on the stream the terminal actually resizes rather than on a copy that never hears about it.
|
|
51
|
+
*
|
|
52
|
+
* ── Why a render is sometimes more than one write ──
|
|
53
|
+
*
|
|
54
|
+
* Ink usually paints in a single write: `eraseLines(n) + output`. Bracketing that is enough, and
|
|
55
|
+
* it stays synchronous here.
|
|
56
|
+
*
|
|
57
|
+
* But when <Static> has new rows to commit — which is every time a reply or a tool result is
|
|
58
|
+
* finished, so constantly while the agent works — it takes a different path:
|
|
59
|
+
*
|
|
60
|
+
* this.log.clear(); // write #1: erase the live region, print nothing
|
|
61
|
+
* this.options.stdout.write(staticOutput); // write #2: the newly finished rows
|
|
62
|
+
* this.log(output); // write #3: the live region again
|
|
63
|
+
*
|
|
64
|
+
* Bracketing those separately is worse than not bracketing at all: write #1 contains no printable
|
|
65
|
+
* output, so it instructs the terminal to present, as a completed frame, the state in which the
|
|
66
|
+
* composer and the status bar have been erased and nothing has replaced them. A guaranteed blank
|
|
67
|
+
* flash, once per committed row. Reported as blinking "when the model is working".
|
|
68
|
+
*
|
|
69
|
+
* So a write that only erases starts a batch instead of being sent. Everything written for the
|
|
70
|
+
* rest of the tick joins it, and the whole render leaves as one frame — erase, new rows and live
|
|
71
|
+
* region together, which is the picture that was wanted in the first place. A render that is a
|
|
72
|
+
* single write never enters the batch and is sent immediately, so ordinary typing is unchanged.
|
|
73
|
+
*/
|
|
42
74
|
export declare function withSynchronizedFrames<T extends NodeJS.WriteStream>(stream: T): T;
|
|
43
75
|
/**
|
|
44
76
|
* Whether this terminal really implements synchronized output, asked rather than assumed.
|
package/dist/frame-sync.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"frame-sync.d.ts","sourceRoot":"","sources":["../src/frame-sync.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AAOH,4EAA4E;AAC5E,wBAAgB,uBAAuB,CACrC,MAAM,GAAE;IAAE,KAAK,CAAC,EAAE,OAAO,CAAA;CAAmB,EAC5C,GAAG,GAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAe,GACpD,OAAO,CAMT;AAED,kFAAkF;AAClF,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAKvD;AAED;;;;;;;GAOG;AACH,wBAAgB,sBAAsB,CAAC,CAAC,SAAS,MAAM,CAAC,WAAW,EAAE,MAAM,EAAE,CAAC,GAAG,CAAC,
|
|
1
|
+
{"version":3,"file":"frame-sync.d.ts","sourceRoot":"","sources":["../src/frame-sync.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AAOH,4EAA4E;AAC5E,wBAAgB,uBAAuB,CACrC,MAAM,GAAE;IAAE,KAAK,CAAC,EAAE,OAAO,CAAA;CAAmB,EAC5C,GAAG,GAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAe,GACpD,OAAO,CAMT;AAED,kFAAkF;AAClF,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAKvD;AAED;;;;;;;GAOG;AACH,oFAAoF;AACpF,wBAAgB,aAAa,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAGpD;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AACH,wBAAgB,sBAAsB,CAAC,CAAC,SAAS,MAAM,CAAC,WAAW,EAAE,MAAM,EAAE,CAAC,GAAG,CAAC,CAkDjF;AAED;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,wBAAsB,uBAAuB,CAC3C,MAAM,GAAE;IAAE,KAAK,CAAC,EAAE,OAAO,CAAC;IAAC,KAAK,CAAC,EAAE,CAAC,CAAC,EAAE,MAAM,KAAK,OAAO,CAAA;CAAmB,EAC5E,KAAK,GAAE,MAAM,CAAC,UAA0B,EACxC,GAAG,GAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAe,EACrD,SAAS,SAAM,GACd,OAAO,CAAC,OAAO,CAAC,CAmClB"}
|
package/dist/frame-sync.js
CHANGED
|
@@ -56,20 +56,88 @@ export function synchronizedFrame(chunk) {
|
|
|
56
56
|
* `write` is read from — and every method bound to — the real stream, so `on('resize')` registers
|
|
57
57
|
* on the stream the terminal actually resizes rather than on a copy that never hears about it.
|
|
58
58
|
*/
|
|
59
|
+
/** True when a chunk only moves the cursor and erases: it paints nothing at all. */
|
|
60
|
+
export function isErasureOnly(chunk) {
|
|
61
|
+
if (chunk === '')
|
|
62
|
+
return false;
|
|
63
|
+
return chunk.replace(/\u001b\[[0-9;]*[A-Za-z]/g, '') === '';
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* The same stream, with each frame presented atomically.
|
|
67
|
+
*
|
|
68
|
+
* A Proxy rather than a subclass or a prototype clone because Ink both writes to this object and
|
|
69
|
+
* listens on it, and an EventEmitter keeps its listeners on the instance. Every member other than
|
|
70
|
+
* `write` is read from — and every method bound to — the real stream, so `on('resize')` registers
|
|
71
|
+
* on the stream the terminal actually resizes rather than on a copy that never hears about it.
|
|
72
|
+
*
|
|
73
|
+
* ── Why a render is sometimes more than one write ──
|
|
74
|
+
*
|
|
75
|
+
* Ink usually paints in a single write: `eraseLines(n) + output`. Bracketing that is enough, and
|
|
76
|
+
* it stays synchronous here.
|
|
77
|
+
*
|
|
78
|
+
* But when <Static> has new rows to commit — which is every time a reply or a tool result is
|
|
79
|
+
* finished, so constantly while the agent works — it takes a different path:
|
|
80
|
+
*
|
|
81
|
+
* this.log.clear(); // write #1: erase the live region, print nothing
|
|
82
|
+
* this.options.stdout.write(staticOutput); // write #2: the newly finished rows
|
|
83
|
+
* this.log(output); // write #3: the live region again
|
|
84
|
+
*
|
|
85
|
+
* Bracketing those separately is worse than not bracketing at all: write #1 contains no printable
|
|
86
|
+
* output, so it instructs the terminal to present, as a completed frame, the state in which the
|
|
87
|
+
* composer and the status bar have been erased and nothing has replaced them. A guaranteed blank
|
|
88
|
+
* flash, once per committed row. Reported as blinking "when the model is working".
|
|
89
|
+
*
|
|
90
|
+
* So a write that only erases starts a batch instead of being sent. Everything written for the
|
|
91
|
+
* rest of the tick joins it, and the whole render leaves as one frame — erase, new rows and live
|
|
92
|
+
* region together, which is the picture that was wanted in the first place. A render that is a
|
|
93
|
+
* single write never enters the batch and is sent immediately, so ordinary typing is unchanged.
|
|
94
|
+
*/
|
|
59
95
|
export function withSynchronizedFrames(stream) {
|
|
60
96
|
if (!wantsSynchronizedFrames(stream))
|
|
61
97
|
return stream;
|
|
98
|
+
// Called on `target`, not lifted off it: a stream's write reaches into `this._writableState`,
|
|
99
|
+
// so a detached reference throws "Cannot read properties of undefined". Found by running the
|
|
100
|
+
// real binary on a pty, which a fake stream in a unit test had not needed to expose.
|
|
101
|
+
const raw = (chunk, ...rest) => {
|
|
102
|
+
const write = stream.write;
|
|
103
|
+
return write.call(stream, chunk, ...rest);
|
|
104
|
+
};
|
|
105
|
+
let batch = '';
|
|
106
|
+
let batching = false;
|
|
107
|
+
const flush = () => {
|
|
108
|
+
batching = false;
|
|
109
|
+
if (batch === '')
|
|
110
|
+
return;
|
|
111
|
+
const frame = batch;
|
|
112
|
+
batch = '';
|
|
113
|
+
raw(synchronizedFrame(frame));
|
|
114
|
+
};
|
|
115
|
+
// A batch lives for one tick, so an ordinary exit drains it first. This is for the abrupt ones.
|
|
116
|
+
process.once('exit', flush);
|
|
62
117
|
return new Proxy(stream, {
|
|
63
118
|
get(target, prop) {
|
|
64
119
|
if (prop === 'write') {
|
|
65
|
-
// Called on `target`, not lifted off it: a stream's write reaches into `this._writableState`,
|
|
66
|
-
// so a detached reference throws "Cannot read properties of undefined". Found by running
|
|
67
|
-
// the real binary on a pty, which a fake stream in a unit test had not needed to expose.
|
|
68
120
|
return (chunk, ...rest) => {
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
121
|
+
// Anything that is not a plain string — a Buffer, or a write with a callback that must
|
|
122
|
+
// actually be called — is sent as it is, after whatever is queued, so nothing is
|
|
123
|
+
// reordered around it.
|
|
124
|
+
if (typeof chunk !== 'string' || rest.some(a => typeof a === 'function')) {
|
|
125
|
+
flush();
|
|
126
|
+
return raw(chunk, ...rest);
|
|
127
|
+
}
|
|
128
|
+
if (batching) {
|
|
129
|
+
batch += chunk;
|
|
130
|
+
return true;
|
|
131
|
+
}
|
|
132
|
+
if (isErasureOnly(chunk)) {
|
|
133
|
+
batch = chunk;
|
|
134
|
+
batching = true;
|
|
135
|
+
// A microtask, so it runs the moment Ink's synchronous render returns and never
|
|
136
|
+
// leaves a frame waiting on I/O.
|
|
137
|
+
queueMicrotask(flush);
|
|
138
|
+
return true;
|
|
139
|
+
}
|
|
140
|
+
return raw(synchronizedFrame(chunk));
|
|
73
141
|
};
|
|
74
142
|
}
|
|
75
143
|
const value = Reflect.get(target, prop, target);
|
package/dist/frame-sync.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"frame-sync.js","sourceRoot":"","sources":["../src/frame-sync.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AAEH,sFAAsF;AACtF,MAAM,KAAK,GAAG,aAAa,CAAC;AAC5B,2DAA2D;AAC3D,MAAM,GAAG,GAAG,aAAa,CAAC;AAE1B,4EAA4E;AAC5E,MAAM,UAAU,uBAAuB,CACrC,SAA8B,OAAO,CAAC,MAAM,EAC5C,MAA0C,OAAO,CAAC,GAAG;IAErD,IAAI,CAAC,MAAM,CAAC,KAAK;QAAE,OAAO,KAAK,CAAC;IAChC,IAAI,GAAG,CAAC,qBAAqB,KAAK,GAAG;QAAE,OAAO,KAAK,CAAC;IACpD,qFAAqF;IACrF,IAAI,CAAC,GAAG,CAAC,IAAI,IAAI,GAAG,CAAC,IAAI,KAAK,MAAM;QAAE,OAAO,KAAK,CAAC;IACnD,OAAO,IAAI,CAAC;AACd,CAAC;AAED,kFAAkF;AAClF,MAAM,UAAU,iBAAiB,CAAC,KAAa;IAC7C,0FAA0F;IAC1F,kBAAkB;IAClB,IAAI,KAAK,KAAK,EAAE;QAAE,OAAO,KAAK,CAAC;IAC/B,OAAO,KAAK,GAAG,KAAK,GAAG,GAAG,CAAC;AAC7B,CAAC;AAED;;;;;;;GAOG;AACH,MAAM,UAAU,sBAAsB,CAA+B,MAAS;IAC5E,IAAI,CAAC,uBAAuB,CAAC,MAAM,CAAC;QAAE,OAAO,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"frame-sync.js","sourceRoot":"","sources":["../src/frame-sync.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AAEH,sFAAsF;AAC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AAM,CAAC,CAAC,wBAAwB,CAAC,CAAC;YAChF,IAAI,CAAC,MAAM;gBAAE,KAAK,CAAC,KAAK,EAAE,CAAC;YAC3B,OAAO,CAAC,MAAM,CAAC,CAAC;QAClB,CAAC,CAAC;QACF,MAAM,MAAM,GAAG,CAAC,KAAa,EAAQ,EAAE;YACrC,IAAI,IAAI,KAAK,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC;YACjC,4FAA4F;YAC5F,MAAM,CAAC,GAAG,yBAAyB,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;YAC/C,IAAI,CAAC;gBAAE,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,KAAK,GAAG,IAAI,CAAC,CAAC,CAAC,CAAC,KAAK,GAAG,CAAC,CAAC;YAC5C,2FAA2F;YAC3F,mEAAmE;QACrE,CAAC,CAAC;QACF,MAAM,KAAK,GAAG,UAAU,CAAC,GAAG,EAAE,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE,SAAS,CAAC,CAAC;QACzD,IAAI,CAAC;YACH,KAAK,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC;YACvB,KAAK,CAAC,MAAM,EAAE,CAAC;YACf,KAAK,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;YACzB,MAAM,CAAC,KAAK,EAAE,CAAC,cAAc,CAAC,CAAC;QACjC,CAAC;QAAC,MAAM,CAAC;YACP,MAAM,CAAC,KAAK,CAAC,CAAC;QAChB,CAAC;IACH,CAAC,CAAC,CAAC;AACL,CAAC"}
|
package/dist/ink-chat.d.ts
CHANGED
|
@@ -67,6 +67,33 @@ export declare function pasteForDisplay(text: string, maxRows?: number): string;
|
|
|
67
67
|
* only ever holds the fragment of the current block that has not been committed yet — the text a
|
|
68
68
|
* reader is watching appear, rather than the whole reply waiting for the turn to end.
|
|
69
69
|
*/
|
|
70
|
+
/** At most this many files are previewed while a tool is still running. */
|
|
71
|
+
export declare const LIVE_DIFF_FILES = 2;
|
|
72
|
+
/**
|
|
73
|
+
* How many lines of each file's diff may be drawn while the tool writing it still runs.
|
|
74
|
+
*
|
|
75
|
+
* Zero is a valid and common answer, and that is the point of the function.
|
|
76
|
+
*
|
|
77
|
+
* Ink paints by erasing the lines it last wrote and printing the new ones, which it cannot do for
|
|
78
|
+
* lines that have scrolled off — so when the live region is at least as tall as the terminal it
|
|
79
|
+
* writes `clearTerminal + fullStaticOutput + output` instead: wipe the screen, wipe the
|
|
80
|
+
* scrollback, repaint the entire session, on every render. Type while that is the state of the
|
|
81
|
+
* world and every keystroke wipes the terminal.
|
|
82
|
+
*
|
|
83
|
+
* A running tool's diff is the only part of the live region with no natural ceiling — a large
|
|
84
|
+
* edit is a large diff — and off the alternate screen it is drawn inline rather than in the side
|
|
85
|
+
* panel. So on a short terminal it is the difference between a calm screen and a strobing one.
|
|
86
|
+
*
|
|
87
|
+
* An 80x24 window, which is the default almost everywhere, has no room for it at all: the chrome
|
|
88
|
+
* above already accounts for nineteen of those twenty-four lines. There the preview is dropped
|
|
89
|
+
* and only the file and its summary are shown while the write is in flight. Nothing is lost —
|
|
90
|
+
* the step is committed to scrollback the instant it finishes, and drawn there in full.
|
|
91
|
+
*
|
|
92
|
+
* A terminal that cannot composite a redraw gets half of what it could otherwise afford. The
|
|
93
|
+
* height rule above is what avoids the wipe; this is about how much is repainted when a frame is
|
|
94
|
+
* shown as an erase followed by a redraw rather than as one picture.
|
|
95
|
+
*/
|
|
96
|
+
export declare function liveDiffLineBudget(termRows: number | undefined, composites?: boolean, files?: number): number;
|
|
70
97
|
export declare function liveReplyLines(termRows: number | undefined): number;
|
|
71
98
|
/**
|
|
72
99
|
* How long one animation frame lasts.
|
package/dist/ink-chat.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ink-chat.d.ts","sourceRoot":"","sources":["../src/ink-chat.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAsC,MAAM,OAAO,CAAC;AA2B3D,OAAO,EAAyB,KAAK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AAM,EAAE,aAAa,EAAE,UAAU,EAAE,kBAA0B,EAAE,EACxE;IAAE,MAAM,EAAE,WAAW,CAAC;IAAC,UAAU,CAAC,EAAE,MAAM,IAAI,CAAC;IAC7C,oEAAoE;IACpE,kBAAkB,CAAC,EAAE,OAAO,CAAA;CAAE,GAAG,KAAK,CAAC,GAAG,CAAC,OAAO,CAs5KhE;AAED,wBAAsB,cAAc,CAAC,MAAM,EAAE,WAAW,GAAG,OAAO,CAAC,IAAI,CAAC,CAoCvE"}
|
package/dist/ink-chat.js
CHANGED
|
@@ -383,6 +383,49 @@ function tailLines(text, maxLines, width) {
|
|
|
383
383
|
* only ever holds the fragment of the current block that has not been committed yet — the text a
|
|
384
384
|
* reader is watching appear, rather than the whole reply waiting for the turn to end.
|
|
385
385
|
*/
|
|
386
|
+
/** At most this many files are previewed while a tool is still running. */
|
|
387
|
+
export const LIVE_DIFF_FILES = 2;
|
|
388
|
+
/** Below this a preview says nothing useful, so the lines are better spent elsewhere. */
|
|
389
|
+
const MIN_DIFF_PREVIEW = 3;
|
|
390
|
+
/**
|
|
391
|
+
* What the rest of the live region needs, at its tallest, before a diff gets a single line.
|
|
392
|
+
*
|
|
393
|
+
* Measured against the real interface at 80x24 rather than estimated: the composer, status bar
|
|
394
|
+
* and footer come to seven lines idle and nine once the draft wraps. On top of that the reply
|
|
395
|
+
* tail is two lines plus its marker, the reasoning tail is four plus its heading, and a running
|
|
396
|
+
* step's own heading is two.
|
|
397
|
+
*/
|
|
398
|
+
const LIVE_CHROME_ROWS = 9 + 3 + 5 + 2;
|
|
399
|
+
/**
|
|
400
|
+
* How many lines of each file's diff may be drawn while the tool writing it still runs.
|
|
401
|
+
*
|
|
402
|
+
* Zero is a valid and common answer, and that is the point of the function.
|
|
403
|
+
*
|
|
404
|
+
* Ink paints by erasing the lines it last wrote and printing the new ones, which it cannot do for
|
|
405
|
+
* lines that have scrolled off — so when the live region is at least as tall as the terminal it
|
|
406
|
+
* writes `clearTerminal + fullStaticOutput + output` instead: wipe the screen, wipe the
|
|
407
|
+
* scrollback, repaint the entire session, on every render. Type while that is the state of the
|
|
408
|
+
* world and every keystroke wipes the terminal.
|
|
409
|
+
*
|
|
410
|
+
* A running tool's diff is the only part of the live region with no natural ceiling — a large
|
|
411
|
+
* edit is a large diff — and off the alternate screen it is drawn inline rather than in the side
|
|
412
|
+
* panel. So on a short terminal it is the difference between a calm screen and a strobing one.
|
|
413
|
+
*
|
|
414
|
+
* An 80x24 window, which is the default almost everywhere, has no room for it at all: the chrome
|
|
415
|
+
* above already accounts for nineteen of those twenty-four lines. There the preview is dropped
|
|
416
|
+
* and only the file and its summary are shown while the write is in flight. Nothing is lost —
|
|
417
|
+
* the step is committed to scrollback the instant it finishes, and drawn there in full.
|
|
418
|
+
*
|
|
419
|
+
* A terminal that cannot composite a redraw gets half of what it could otherwise afford. The
|
|
420
|
+
* height rule above is what avoids the wipe; this is about how much is repainted when a frame is
|
|
421
|
+
* shown as an erase followed by a redraw rather than as one picture.
|
|
422
|
+
*/
|
|
423
|
+
export function liveDiffLineBudget(termRows, composites = true, files = LIVE_DIFF_FILES) {
|
|
424
|
+
const rows = termRows && termRows > 0 ? termRows : 24;
|
|
425
|
+
const spare = rows - LIVE_CHROME_ROWS - 1;
|
|
426
|
+
const each = Math.floor(spare / Math.max(1, files)) * (composites ? 1 : 0.5);
|
|
427
|
+
return each >= MIN_DIFF_PREVIEW ? Math.floor(each) : 0;
|
|
428
|
+
}
|
|
386
429
|
export function liveReplyLines(termRows) {
|
|
387
430
|
const rows = termRows && termRows > 0 ? termRows : 24;
|
|
388
431
|
return rows < 12 ? 1 : 2;
|
|
@@ -5787,23 +5830,64 @@ export function App({ config: initialConfig, clearFrame, synchronizedFrames = fa
|
|
|
5787
5830
|
* itself on a tinted band. Every rendered line is padded to the same width so the tint forms a
|
|
5788
5831
|
* solid block rather than a ragged edge, which is what makes an added run legible at a glance.
|
|
5789
5832
|
*/
|
|
5790
|
-
const
|
|
5833
|
+
const liveDiffBudget = liveDiffLineBudget(termRows, syncedFramesRef.current);
|
|
5834
|
+
/**
|
|
5835
|
+
* One file's diff, with a ceiling on how many lines it may draw.
|
|
5836
|
+
*
|
|
5837
|
+
* The ceiling exists because of how Ink puts a frame on screen. It normally erases the lines it
|
|
5838
|
+
* last wrote and prints the new ones, but when the live region is at least as tall as the
|
|
5839
|
+
* terminal it cannot do that — lines that scrolled off cannot be erased — so it falls back to
|
|
5840
|
+
*
|
|
5841
|
+
* stdout.write(ansiEscapes.clearTerminal + fullStaticOutput + output) // ink/build/ink.js
|
|
5842
|
+
*
|
|
5843
|
+
* `clearTerminal` is ESC[2J ESC[3J ESC[H: wipe the screen, wipe the scrollback, home the cursor.
|
|
5844
|
+
* Then the entire session is written again. That happens on *every* render — so once the live
|
|
5845
|
+
* region outgrows the window, every keystroke wipes and repaints the whole terminal, and it gets
|
|
5846
|
+
* heavier as the session grows because the static output it rewrites only ever accumulates.
|
|
5847
|
+
* Measured with a recording stdout: a six-line live region gave three 466-byte frames for three
|
|
5848
|
+
* keystrokes; a forty-five-line one in a forty-row terminal gave three full clear-and-rewrites.
|
|
5849
|
+
*
|
|
5850
|
+
* That is the blinking. Not the animation, not the terminal, not the machine.
|
|
5851
|
+
*
|
|
5852
|
+
* A running tool's diff was the thing that made the region that tall: it is drawn in full, and
|
|
5853
|
+
* with the side panel shut — which it always is off the alternate screen — it is drawn inline.
|
|
5854
|
+
* A two-hundred-line edit therefore guaranteed the clear-and-rewrite path for as long as the
|
|
5855
|
+
* write took. Nothing is lost by capping it: this is the live preview of a diff that is written
|
|
5856
|
+
* to scrollback in full the moment the step finishes.
|
|
5857
|
+
*/
|
|
5858
|
+
const renderDiff = (d, key, maxLines = Infinity) => {
|
|
5791
5859
|
const numbers = d.hunks.flatMap(h => h.lines.map(l => l.after ?? l.before ?? 0));
|
|
5792
5860
|
const gutter = Math.max(2, String(Math.max(0, ...numbers)).length);
|
|
5793
5861
|
const width = Math.max(24, barWidth - gutter - 8);
|
|
5794
5862
|
const header = d.created ? 'new file' : d.deleted ? 'deleted' : diffSummary(d);
|
|
5863
|
+
const all = [];
|
|
5864
|
+
for (const [hi, hunk] of d.hunks.entries()) {
|
|
5865
|
+
if (hi > 0)
|
|
5866
|
+
all.push({ key: `g${hi}`, gap: true });
|
|
5867
|
+
for (const [li, l] of hunk.lines.entries()) {
|
|
5868
|
+
all.push({ key: `${hi}-${li}`, gap: false, kind: l.kind,
|
|
5869
|
+
shown: (l.kind === 'del' ? l.before : l.after) ?? undefined,
|
|
5870
|
+
sign: l.kind === 'add' ? '+' : l.kind === 'del' ? '-' : ' ',
|
|
5871
|
+
text: l.text });
|
|
5872
|
+
}
|
|
5873
|
+
}
|
|
5874
|
+
// A budget of zero is meaningful: show the file and what happened to it, and none of the
|
|
5875
|
+
// body. On a short terminal those lines are the difference between a calm screen and one
|
|
5876
|
+
// that wipes itself on every keystroke.
|
|
5877
|
+
const shownLines = all.slice(0, Math.max(0, maxLines));
|
|
5878
|
+
const clipped = all.length - shownLines.length;
|
|
5795
5879
|
return (_jsxs(Box, { flexDirection: "column", paddingLeft: 2, children: [_jsxs(Box, { gap: 1, children: [_jsx(Text, { color: DIM, children: "\u2514" }), _jsx(Text, { color: CYAN, children: d.path }), _jsx(Text, { color: d.created ? DIFF_ADD : d.deleted ? DIFF_DEL : MUTED, children: header })] }), d.binary
|
|
5796
5880
|
? _jsx(Text, { color: DIM, children: ' binary file - not shown' })
|
|
5797
|
-
:
|
|
5798
|
-
|
|
5799
|
-
|
|
5800
|
-
|
|
5801
|
-
|
|
5802
|
-
|
|
5803
|
-
|
|
5804
|
-
|
|
5805
|
-
|
|
5806
|
-
|
|
5881
|
+
: shownLines.map(l => l.gap
|
|
5882
|
+
// A gap between hunks stands for the untouched lines that were skipped.
|
|
5883
|
+
? _jsxs(Text, { color: DIM, children: [' '.repeat(gutter), " ..."] }, l.key)
|
|
5884
|
+
: (() => {
|
|
5885
|
+
const fg = l.kind === 'add' ? DIFF_ADD : l.kind === 'del' ? DIFF_DEL : MUTED;
|
|
5886
|
+
const bg = l.kind === 'add' ? DIFF_ADD_BG : l.kind === 'del' ? DIFF_DEL_BG : undefined;
|
|
5887
|
+
// Tabs would make the tinted block a ragged width, so they are expanded.
|
|
5888
|
+
const body = `${l.sign} ${l.text}`.replace(/\t/g, ' ');
|
|
5889
|
+
return (_jsxs(Box, { children: [_jsxs(Text, { color: DIM, children: [String(l.shown ?? '').padStart(gutter), " "] }), _jsx(Text, { color: fg, ...(bg ? { backgroundColor: bg } : {}), children: fitCells(body, width, true) })] }, l.key));
|
|
5890
|
+
})()), clipped > 0 && (_jsxs(Text, { color: DIM, children: [' '.repeat(gutter), " ", shownLines.length === 0 ? '' : '... ', clipped, " ", shownLines.length === 0 ? 'changed lines' : 'more lines', ", shown in full when this finishes"] })), d.hiddenLines > 0 && (_jsxs(Text, { color: DIM, children: [' '.repeat(gutter), " ... ", d.hiddenLines, " more changed lines"] }))] }, key));
|
|
5807
5891
|
};
|
|
5808
5892
|
const renderStep = (step, key) => {
|
|
5809
5893
|
if (step.kind === 'say') {
|
|
@@ -5813,7 +5897,20 @@ export function App({ config: initialConfig, clearFrame, synchronizedFrames = fa
|
|
|
5813
5897
|
const ms = (step.endedAt ?? Date.now()) - step.startedAt;
|
|
5814
5898
|
const glyph = running ? SPINNER[spinFrame] : step.ok === false ? G.fail : G.ok;
|
|
5815
5899
|
const color = running ? AMBER : step.ok === false ? CRIMSON : GREEN;
|
|
5816
|
-
return (_jsxs(Box, { marginTop: 1, flexDirection: "column", children: [_jsxs(Box, { gap: 1, children: [_jsx(Text, { color: color, children: glyph }), _jsx(Text, { color: AMBER, bold: true, children: step.name }), _jsx(Text, { color: DIM, children: "\u00B7" }), _jsx(Text, { color: MUTED, children: fmtElapsed(ms) })] }), step.detail !== '' && (step.diffs ?? []).length === 0 && (_jsxs(Box, { paddingLeft: 2, gap: 1, children: [_jsx(Text, { color: DIM, children: "\u2514" }), _jsx(Text, { color: MUTED, children: step.detail })] })), step.ok === false && step.error && (_jsxs(Box, { paddingLeft: 2, gap: 1, children: [_jsx(Text, { color: DIM, children: "\u2514" }), _jsx(Text, { color: CRIMSON, children: fitCells(step.error, Math.max(20, barWidth - 6)) })] })), running && step.output && (_jsx(Box, { paddingLeft: 4, children: _jsx(Text, { color: DIM, children: fitCells(step.output, Math.max(20, barWidth - 6)) }) })), !diffPanelOpenRef.current && (
|
|
5900
|
+
return (_jsxs(Box, { marginTop: 1, flexDirection: "column", children: [_jsxs(Box, { gap: 1, children: [_jsx(Text, { color: color, children: glyph }), _jsx(Text, { color: AMBER, bold: true, children: step.name }), _jsx(Text, { color: DIM, children: "\u00B7" }), _jsx(Text, { color: MUTED, children: fmtElapsed(ms) })] }), step.detail !== '' && (step.diffs ?? []).length === 0 && (_jsxs(Box, { paddingLeft: 2, gap: 1, children: [_jsx(Text, { color: DIM, children: "\u2514" }), _jsx(Text, { color: MUTED, children: step.detail })] })), step.ok === false && step.error && (_jsxs(Box, { paddingLeft: 2, gap: 1, children: [_jsx(Text, { color: DIM, children: "\u2514" }), _jsx(Text, { color: CRIMSON, children: fitCells(step.error, Math.max(20, barWidth - 6)) })] })), running && step.output && (_jsx(Box, { paddingLeft: 4, children: _jsx(Text, { color: DIM, children: fitCells(step.output, Math.max(20, barWidth - 6)) }) })), !diffPanelOpenRef.current && (running
|
|
5901
|
+
/*
|
|
5902
|
+
* While the tool is still working this is a preview, and it has to stay small.
|
|
5903
|
+
*
|
|
5904
|
+
* It is the one part of the live region with no natural ceiling — a large edit is a
|
|
5905
|
+
* large diff — and the live region going past the window height is what makes Ink wipe
|
|
5906
|
+
* and repaint the whole terminal on every render. See renderDiff for the mechanism.
|
|
5907
|
+
*
|
|
5908
|
+
* Nothing is hidden by this. The step is committed to scrollback the moment it
|
|
5909
|
+
* finishes, and the branch below draws it there in full.
|
|
5910
|
+
*/
|
|
5911
|
+
? (step.diffs ?? []).slice(0, LIVE_DIFF_FILES)
|
|
5912
|
+
.map((d, i) => renderDiff(d, i, liveDiffBudget))
|
|
5913
|
+
: (step.diffs ?? []).map((d, i) => renderDiff(d, i)))] }, key));
|
|
5817
5914
|
};
|
|
5818
5915
|
/**
|
|
5819
5916
|
* One transcript row.
|