koneck 2.128.19 → 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/ink-chat.d.ts +23 -17
- package/dist/ink-chat.d.ts.map +1 -1
- package/dist/ink-chat.js +40 -18
- package/dist/ink-chat.js.map +1 -1
- package/package.json +1 -1
package/dist/ink-chat.d.ts
CHANGED
|
@@ -70,24 +70,30 @@ export declare function pasteForDisplay(text: string, maxRows?: number): string;
|
|
|
70
70
|
/** At most this many files are previewed while a tool is still running. */
|
|
71
71
|
export declare const LIVE_DIFF_FILES = 2;
|
|
72
72
|
/**
|
|
73
|
-
* How many lines of each file's diff may be drawn while the tool
|
|
74
|
-
*
|
|
75
|
-
*
|
|
76
|
-
*
|
|
77
|
-
*
|
|
78
|
-
*
|
|
79
|
-
*
|
|
80
|
-
*
|
|
81
|
-
*
|
|
82
|
-
*
|
|
83
|
-
*
|
|
84
|
-
*
|
|
85
|
-
*
|
|
86
|
-
*
|
|
87
|
-
*
|
|
88
|
-
*
|
|
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.
|
|
89
95
|
*/
|
|
90
|
-
export declare function liveDiffLineBudget(termRows: number | undefined, files?: number): number;
|
|
96
|
+
export declare function liveDiffLineBudget(termRows: number | undefined, composites?: boolean, files?: number): number;
|
|
91
97
|
export declare function liveReplyLines(termRows: number | undefined): number;
|
|
92
98
|
/**
|
|
93
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,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAuCtE,OAAO,KAAK,EAAY,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAiB5D,OAAO,EAA6C,KAAK,YAAY,EAAE,MAAM,aAAa,CAAC;AAG3F,OAAO,KAAK,EAAE,WAAW,EAAiB,MAAM,YAAY,CAAC;AAoD7D,KAAK,MAAM,GAAG,KAAK,GAAG,QAAQ,GAAG,MAAM,GAAG,KAAK,CAAC;AAGhD,mFAAmF;AACnF,wBAAgB,WAAW,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,GAAG,SAAS,CAI9D;AAyED,6FAA6F;AAC7F,wBAAgB,UAAU,CAAC,EAAE,EAAE,MAAM,GAAG,MAAM,CAM7C;AA0BD,gGAAgG;AAChG,wBAAgB,WAAW,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MA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
|
package/dist/ink-chat.js
CHANGED
|
@@ -385,27 +385,46 @@ function tailLines(text, maxLines, width) {
|
|
|
385
385
|
*/
|
|
386
386
|
/** At most this many files are previewed while a tool is still running. */
|
|
387
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;
|
|
388
390
|
/**
|
|
389
|
-
*
|
|
391
|
+
* What the rest of the live region needs, at its tallest, before a diff gets a single line.
|
|
390
392
|
*
|
|
391
|
-
*
|
|
392
|
-
*
|
|
393
|
-
*
|
|
394
|
-
*
|
|
395
|
-
|
|
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.
|
|
396
413
|
*
|
|
397
|
-
*
|
|
398
|
-
*
|
|
399
|
-
*
|
|
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.
|
|
400
418
|
*
|
|
401
|
-
*
|
|
402
|
-
*
|
|
403
|
-
*
|
|
404
|
-
* problem than clearing the screen sixty times a minute.
|
|
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.
|
|
405
422
|
*/
|
|
406
|
-
export function liveDiffLineBudget(termRows, files = LIVE_DIFF_FILES) {
|
|
423
|
+
export function liveDiffLineBudget(termRows, composites = true, files = LIVE_DIFF_FILES) {
|
|
407
424
|
const rows = termRows && termRows > 0 ? termRows : 24;
|
|
408
|
-
|
|
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;
|
|
409
428
|
}
|
|
410
429
|
export function liveReplyLines(termRows) {
|
|
411
430
|
const rows = termRows && termRows > 0 ? termRows : 24;
|
|
@@ -5811,7 +5830,7 @@ export function App({ config: initialConfig, clearFrame, synchronizedFrames = fa
|
|
|
5811
5830
|
* itself on a tinted band. Every rendered line is padded to the same width so the tint forms a
|
|
5812
5831
|
* solid block rather than a ragged edge, which is what makes an added run legible at a glance.
|
|
5813
5832
|
*/
|
|
5814
|
-
const liveDiffBudget = liveDiffLineBudget(termRows);
|
|
5833
|
+
const liveDiffBudget = liveDiffLineBudget(termRows, syncedFramesRef.current);
|
|
5815
5834
|
/**
|
|
5816
5835
|
* One file's diff, with a ceiling on how many lines it may draw.
|
|
5817
5836
|
*
|
|
@@ -5852,7 +5871,10 @@ export function App({ config: initialConfig, clearFrame, synchronizedFrames = fa
|
|
|
5852
5871
|
text: l.text });
|
|
5853
5872
|
}
|
|
5854
5873
|
}
|
|
5855
|
-
|
|
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));
|
|
5856
5878
|
const clipped = all.length - shownLines.length;
|
|
5857
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
|
|
5858
5880
|
? _jsx(Text, { color: DIM, children: ' binary file - not shown' })
|
|
@@ -5865,7 +5887,7 @@ export function App({ config: initialConfig, clearFrame, synchronizedFrames = fa
|
|
|
5865
5887
|
// Tabs would make the tinted block a ragged width, so they are expanded.
|
|
5866
5888
|
const body = `${l.sign} ${l.text}`.replace(/\t/g, ' ');
|
|
5867
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));
|
|
5868
|
-
})()), clipped > 0 && (_jsxs(Text, { color: DIM, children: [' '.repeat(gutter), " ...
|
|
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));
|
|
5869
5891
|
};
|
|
5870
5892
|
const renderStep = (step, key) => {
|
|
5871
5893
|
if (step.kind === 'say') {
|