koneck 2.128.29 → 2.128.30
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 +28 -0
- package/dist/ink-chat.d.ts.map +1 -1
- package/dist/ink-chat.js +144 -9
- package/dist/ink-chat.js.map +1 -1
- package/package.json +1 -1
package/dist/ink-chat.d.ts
CHANGED
|
@@ -469,6 +469,34 @@ export declare function DiffPanel({ files, width, height, activity, activityRows
|
|
|
469
469
|
* Typechecking passes on that code and no test could reach it, because nothing in the suite mounted
|
|
470
470
|
* an Ink app. Something does now.
|
|
471
471
|
*/
|
|
472
|
+
/**
|
|
473
|
+
* Where each visual row of the composer begins and ends, as offsets into the draft.
|
|
474
|
+
*
|
|
475
|
+
* Not `wrapToWidth`, which normalises runs of whitespace and so cannot be mapped back to the
|
|
476
|
+
* text it was given. Moving a caret between rows needs the opposite property: every character
|
|
477
|
+
* accounted for, in its original position, so that row-and-column can be converted to an index
|
|
478
|
+
* and back without drifting.
|
|
479
|
+
*
|
|
480
|
+
* Greedy word wrap, breaking at the last space that fits and hard-splitting a word too long for
|
|
481
|
+
* a row — the same rule the composer is drawn with, so the rows here are the rows on screen.
|
|
482
|
+
*/
|
|
483
|
+
export declare function composerRows(text: string, width: number): {
|
|
484
|
+
start: number;
|
|
485
|
+
end: number;
|
|
486
|
+
}[];
|
|
487
|
+
/**
|
|
488
|
+
* The caret one visual row up or down, or null when there is no such row.
|
|
489
|
+
*
|
|
490
|
+
* Null is the useful half: with nothing above, Up is free to mean "the previous prompt", which
|
|
491
|
+
* is what it has always meant and what a shell does. So a one-line draft keeps its history
|
|
492
|
+
* recall and a wrapped or multi-line one becomes editable in the middle, which is what was asked
|
|
493
|
+
* for — "must be able to move in lines/rows for easy editing/correcting when need to write in
|
|
494
|
+
* between".
|
|
495
|
+
*
|
|
496
|
+
* The column is kept where it can be and clamped to the end of a shorter row, as every editor
|
|
497
|
+
* does.
|
|
498
|
+
*/
|
|
499
|
+
export declare function caretRowMove(text: string, caret: number, width: number, direction: -1 | 1): number | null;
|
|
472
500
|
/**
|
|
473
501
|
* The selected span of the composer, or null when nothing is selected.
|
|
474
502
|
*
|
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;AA4B3D,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,MAAM,GAAG,MAAM,CAE/D;AAED;;;;;;;GAOG;AACH,wBAAgB,cAAc,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM,EAAE,CA+BpE;AAED,qFAAqF;AACrF;;;;;GAKG;AASH,eAAO,MAAM,YAAY,mBAAuB,CAAC;AAEjD,+CAA+C;AAC/C,MAAM,WAAW,iBAAiB;IAChC,IAAI,EAAE,MAAM,GAAG,KAAK,GAAG,OAAO,GAAG,SAAS,CAAC;IAC3C,IAAI,EAAE,MAAM,CAAC;IACb,GAAG,EAAE,MAAM,CAAC;IAC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at.js
CHANGED
|
@@ -502,6 +502,22 @@ export const WORD_HOLD_MS = 60_000;
|
|
|
502
502
|
* appears frozen for seven seconds is worse than either.
|
|
503
503
|
*/
|
|
504
504
|
export const HEARTBEAT_MS = 1_000;
|
|
505
|
+
/**
|
|
506
|
+
* The cursor, drawn as a painted cell rather than as a character.
|
|
507
|
+
*
|
|
508
|
+
* It was a literal U+2588 FULL BLOCK. Every other glyph in the interface goes through the glyph
|
|
509
|
+
* set, which drops to ASCII on Windows precisely because the console there cannot be relied on
|
|
510
|
+
* for them — and this one bypassed it, so on Windows the cursor was a character the font had no
|
|
511
|
+
* picture for and simply did not appear. Reported as exactly that: visible on Linux, absent on
|
|
512
|
+
* Windows.
|
|
513
|
+
*
|
|
514
|
+
* A space with a background colour needs no glyph from any font, and it is already how the
|
|
515
|
+
* cursor is drawn when it sits on a character mid-string. Now both cases are the same thing: a
|
|
516
|
+
* painted cell, in the same place, whatever the terminal has to draw with.
|
|
517
|
+
*/
|
|
518
|
+
function Cursor() {
|
|
519
|
+
return _jsx(Text, { backgroundColor: CYAN, children: " " });
|
|
520
|
+
}
|
|
505
521
|
/**
|
|
506
522
|
* Whether the terminal should report the wheel to KONECK, when nothing has been saved either way.
|
|
507
523
|
*
|
|
@@ -1506,6 +1522,63 @@ export function DiffPanel({ files, width, height, activity, activityRows = 0 })
|
|
|
1506
1522
|
* Typechecking passes on that code and no test could reach it, because nothing in the suite mounted
|
|
1507
1523
|
* an Ink app. Something does now.
|
|
1508
1524
|
*/
|
|
1525
|
+
/**
|
|
1526
|
+
* Where each visual row of the composer begins and ends, as offsets into the draft.
|
|
1527
|
+
*
|
|
1528
|
+
* Not `wrapToWidth`, which normalises runs of whitespace and so cannot be mapped back to the
|
|
1529
|
+
* text it was given. Moving a caret between rows needs the opposite property: every character
|
|
1530
|
+
* accounted for, in its original position, so that row-and-column can be converted to an index
|
|
1531
|
+
* and back without drifting.
|
|
1532
|
+
*
|
|
1533
|
+
* Greedy word wrap, breaking at the last space that fits and hard-splitting a word too long for
|
|
1534
|
+
* a row — the same rule the composer is drawn with, so the rows here are the rows on screen.
|
|
1535
|
+
*/
|
|
1536
|
+
export function composerRows(text, width) {
|
|
1537
|
+
const w = Math.max(1, width);
|
|
1538
|
+
const rows = [];
|
|
1539
|
+
let lineStart = 0;
|
|
1540
|
+
for (const line of text.split('\n')) {
|
|
1541
|
+
let from = 0;
|
|
1542
|
+
while (from <= line.length) {
|
|
1543
|
+
if (line.length - from <= w) {
|
|
1544
|
+
rows.push({ start: lineStart + from, end: lineStart + line.length });
|
|
1545
|
+
break;
|
|
1546
|
+
}
|
|
1547
|
+
// The last space that still fits, so a word is not split when it need not be.
|
|
1548
|
+
const slice = line.slice(from, from + w + 1);
|
|
1549
|
+
const space = slice.lastIndexOf(' ');
|
|
1550
|
+
const take = space > 0 ? space : w;
|
|
1551
|
+
rows.push({ start: lineStart + from, end: lineStart + from + take });
|
|
1552
|
+
from += space > 0 ? take + 1 : take; // the break space belongs to neither row
|
|
1553
|
+
}
|
|
1554
|
+
lineStart += line.length + 1; // + the newline
|
|
1555
|
+
}
|
|
1556
|
+
return rows;
|
|
1557
|
+
}
|
|
1558
|
+
/**
|
|
1559
|
+
* The caret one visual row up or down, or null when there is no such row.
|
|
1560
|
+
*
|
|
1561
|
+
* Null is the useful half: with nothing above, Up is free to mean "the previous prompt", which
|
|
1562
|
+
* is what it has always meant and what a shell does. So a one-line draft keeps its history
|
|
1563
|
+
* recall and a wrapped or multi-line one becomes editable in the middle, which is what was asked
|
|
1564
|
+
* for — "must be able to move in lines/rows for easy editing/correcting when need to write in
|
|
1565
|
+
* between".
|
|
1566
|
+
*
|
|
1567
|
+
* The column is kept where it can be and clamped to the end of a shorter row, as every editor
|
|
1568
|
+
* does.
|
|
1569
|
+
*/
|
|
1570
|
+
export function caretRowMove(text, caret, width, direction) {
|
|
1571
|
+
const rows = composerRows(text, width);
|
|
1572
|
+
if (rows.length < 2)
|
|
1573
|
+
return null;
|
|
1574
|
+
const here = rows.findIndex((r, i) => caret <= r.end || i === rows.length - 1);
|
|
1575
|
+
const target = here + direction;
|
|
1576
|
+
if (target < 0 || target >= rows.length)
|
|
1577
|
+
return null;
|
|
1578
|
+
const column = caret - rows[here].start;
|
|
1579
|
+
const to = rows[target];
|
|
1580
|
+
return Math.min(to.start + column, to.end);
|
|
1581
|
+
}
|
|
1509
1582
|
/**
|
|
1510
1583
|
* The selected span of the composer, or null when nothing is selected.
|
|
1511
1584
|
*
|
|
@@ -4415,18 +4488,38 @@ export function App({ config: initialConfig, clearFrame, synchronizedFrames = fa
|
|
|
4415
4488
|
addSystem('Usage: `/diff` opens the live panel; `/diff off` closes it.');
|
|
4416
4489
|
return;
|
|
4417
4490
|
}
|
|
4418
|
-
|
|
4419
|
-
|
|
4420
|
-
|
|
4491
|
+
/*
|
|
4492
|
+
* Bare `/diff` toggles, as every other switch in here does.
|
|
4493
|
+
*
|
|
4494
|
+
* It used to mean "open", always — so pressing it a second time to put the panel away
|
|
4495
|
+
* did nothing at all, and the only way to close it was to know the word `off`. Reported
|
|
4496
|
+
* as "/diff does open side panel but does not close it", which was precisely true.
|
|
4497
|
+
* `/altscreen`, `/thinking`, `/animate` and `/mouse` have all toggled on a bare call
|
|
4498
|
+
* since they were written; this was the odd one out.
|
|
4499
|
+
*/
|
|
4421
4500
|
/*
|
|
4422
4501
|
* The side panel needs a fixed frame, and `altScreen: false` is a decision.
|
|
4423
4502
|
*
|
|
4424
|
-
* This used to switch the alternate screen on regardless, which is the same override
|
|
4425
|
-
*
|
|
4426
|
-
* turned it off had already said so. Where it is off,
|
|
4503
|
+
* This used to switch the alternate screen on regardless, which is the same override
|
|
4504
|
+
* removed from startup for the same reason: it is the expensive path, and somebody who
|
|
4505
|
+
* turned it off had already said so. Where it is off, changes are drawn inline in the
|
|
4427
4506
|
* conversation instead — which is where they were before the panel existed.
|
|
4428
4507
|
*/
|
|
4429
4508
|
const canPin = cfg.altScreen !== false;
|
|
4509
|
+
/*
|
|
4510
|
+
* A bare `/diff` toggles what is on screen, not the flag behind it.
|
|
4511
|
+
*
|
|
4512
|
+
* It used to mean "open", always, so pressing it again to put the panel away did nothing
|
|
4513
|
+
* — reported as "/diff does open side panel but does not close it". Toggling the flag
|
|
4514
|
+
* was not enough either: `showDiffPanel` is true by default while the panel is not
|
|
4515
|
+
* visible at all, so the first press would have closed something that was never open.
|
|
4516
|
+
* What has to flip is what can actually be seen — the panel where there is a frame for
|
|
4517
|
+
* one, the inline changes where there is not.
|
|
4518
|
+
*/
|
|
4519
|
+
const showingNow = canPin ? diffPanelOpen : showDiffPanel;
|
|
4520
|
+
const want = panel === 'on' ? true : panel === 'off' ? false : !showingNow;
|
|
4521
|
+
setShowDiffPanel(want);
|
|
4522
|
+
diffPanelTouchedRef.current = true;
|
|
4430
4523
|
if (want && canPin && !altScreen)
|
|
4431
4524
|
setAltScreen(true);
|
|
4432
4525
|
if (!want && !(cfg.altScreen ?? false)
|
|
@@ -5733,11 +5826,45 @@ export function App({ config: initialConfig, clearFrame, synchronizedFrames = fa
|
|
|
5733
5826
|
// The composer used to be append-and-backspace only, so fixing a typo near the start of a
|
|
5734
5827
|
// long prompt meant deleting everything after it. Everything below is the readline set a
|
|
5735
5828
|
// shell gives you, so an edit costs one keystroke rather than a retype.
|
|
5829
|
+
/*
|
|
5830
|
+
* Up and down move between the rows of the draft before they reach for history.
|
|
5831
|
+
*
|
|
5832
|
+
* A one-line draft has no row above or below, so `caretRowMove` returns null and Up still
|
|
5833
|
+
* means "the previous prompt" — which is what it has always meant and what a shell does.
|
|
5834
|
+
* Once the draft wraps or contains a newline, the same keys become what they are in every
|
|
5835
|
+
* text box, which is the only way to correct something in the middle of a long prompt
|
|
5836
|
+
* without deleting back to it.
|
|
5837
|
+
*/
|
|
5736
5838
|
const historyDirection = draftHistoryDirection(input, key);
|
|
5737
5839
|
if (historyDirection) {
|
|
5738
5840
|
recallDraft(historyDirection);
|
|
5739
5841
|
return;
|
|
5740
5842
|
}
|
|
5843
|
+
/*
|
|
5844
|
+
* Up and down move the caret between the rows of the draft.
|
|
5845
|
+
*
|
|
5846
|
+
* They did nothing at all before — history is on Ctrl+P and Ctrl+N, as in a shell — so a
|
|
5847
|
+
* long prompt could only be corrected by deleting back to the mistake. Asked for directly:
|
|
5848
|
+
* "must be able to move in lines/rows for easy editing/correcting when need to write in
|
|
5849
|
+
* between".
|
|
5850
|
+
*
|
|
5851
|
+
* Rows here are visual rows, wrapped exactly as the composer draws them, so the caret goes
|
|
5852
|
+
* where the eye expects rather than to the next newline. With Shift held they extend the
|
|
5853
|
+
* selection instead, which is the same bargain the left and right arrows already make.
|
|
5854
|
+
*/
|
|
5855
|
+
if (key.upArrow || key.downArrow) {
|
|
5856
|
+
const moved = caretRowMove(draft, caret, composerTextWidth, key.upArrow ? -1 : 1);
|
|
5857
|
+
if (moved === null)
|
|
5858
|
+
return; // one row: nothing above or below to go to
|
|
5859
|
+
if (key.shift) {
|
|
5860
|
+
if (selAnchor === null)
|
|
5861
|
+
setSelAnchor(caret);
|
|
5862
|
+
}
|
|
5863
|
+
else
|
|
5864
|
+
setSelAnchor(null);
|
|
5865
|
+
setCaret(moved);
|
|
5866
|
+
return;
|
|
5867
|
+
}
|
|
5741
5868
|
/*
|
|
5742
5869
|
* Shift with an arrow selects, the way it does in every other text box.
|
|
5743
5870
|
*
|
|
@@ -6103,6 +6230,14 @@ export function App({ config: initialConfig, clearFrame, synchronizedFrames = fa
|
|
|
6103
6230
|
// window empty. A cap is still available through `maxWidth` in config for anyone who
|
|
6104
6231
|
// prefers a narrow measure on a very wide screen, but nothing is capped by default.
|
|
6105
6232
|
const uiWidth = computeUiWidth(termCols, configMaxWidth);
|
|
6233
|
+
/**
|
|
6234
|
+
* The width the draft actually wraps at inside the composer.
|
|
6235
|
+
*
|
|
6236
|
+
* The box is `uiWidth - 5` wide, one cell of padding each side, and the "> " marker takes two
|
|
6237
|
+
* more. Caret movement between rows has to use the same number the text is drawn with, or the
|
|
6238
|
+
* caret lands a column or two away from where the eye says it should.
|
|
6239
|
+
*/
|
|
6240
|
+
const composerTextWidth = Math.max(10, uiWidth - 9);
|
|
6106
6241
|
// uiWidth minus the container's paddingX={2} on both sides, and then one column of slack.
|
|
6107
6242
|
//
|
|
6108
6243
|
// Without the slack a full-width box draws a line exactly as wide as the terminal. Ink counts
|
|
@@ -6716,8 +6851,8 @@ export function App({ config: initialConfig, clearFrame, synchronizedFrames = fa
|
|
|
6716
6851
|
: addProv.step === 'model' ? { label: 'default model', hint: 'optional — enter to skip' }
|
|
6717
6852
|
: { label: 'repoint ' + addProv.name + '? (y/n)',
|
|
6718
6853
|
hint: `it ships with KONECK, pointing at ${shadowed?.baseURL}` };
|
|
6719
|
-
return (_jsxs(Box, { flexDirection: "column", borderStyle: "round", borderColor: CYAN, paddingX: 1, marginTop: 1, width: barWidth, children: [_jsx(Text, { color: CYAN, bold: true, children: "Declare a provider" }), _jsxs(Text, { color: MUTED, children: [ask.hint, " \u00B7 esc to cancel"] }), addProv.name !== '' && (_jsxs(Text, { color: DIM, children: [addProv.name, addProv.url ? ' ' + addProv.url : ''] })), addProv.error && _jsx(Text, { color: CRIMSON, children: addProv.error }), _jsxs(Box, { marginTop: 1, children: [_jsxs(Text, { color: MUTED, children: [ask.label, ": "] }), _jsx(Text, { color: INK, children: addProv.value }), _jsx(
|
|
6720
|
-
})(), keyPrompt && (_jsxs(Box, { flexDirection: "column", borderStyle: "round", borderColor: AMBER, paddingX: 1, marginTop: 1, width: barWidth, children: [_jsxs(Text, { color: AMBER, bold: true, children: ["API key for ", keyPrompt.provider] }), _jsx(Text, { color: MUTED, children: "Paste it and press enter, or ctrl+v to read the clipboard. Held in memory for this session only; esc to cancel." }), keyPrompt.note && _jsx(Text, { color: CYAN, children: keyPrompt.note }), _jsxs(Box, { marginTop: 1, children: [_jsxs(Text, { color: MUTED, children: [keyPrompt.env, ": "] }), _jsx(Text, { color: INK, children: '*'.repeat(Math.min(keyPrompt.value.length, 48)) }), _jsx(
|
|
6854
|
+
return (_jsxs(Box, { flexDirection: "column", borderStyle: "round", borderColor: CYAN, paddingX: 1, marginTop: 1, width: barWidth, children: [_jsx(Text, { color: CYAN, bold: true, children: "Declare a provider" }), _jsxs(Text, { color: MUTED, children: [ask.hint, " \u00B7 esc to cancel"] }), addProv.name !== '' && (_jsxs(Text, { color: DIM, children: [addProv.name, addProv.url ? ' ' + addProv.url : ''] })), addProv.error && _jsx(Text, { color: CRIMSON, children: addProv.error }), _jsxs(Box, { marginTop: 1, children: [_jsxs(Text, { color: MUTED, children: [ask.label, ": "] }), _jsx(Text, { color: INK, children: addProv.value }), _jsx(Cursor, {})] })] }));
|
|
6855
|
+
})(), keyPrompt && (_jsxs(Box, { flexDirection: "column", borderStyle: "round", borderColor: AMBER, paddingX: 1, marginTop: 1, width: barWidth, children: [_jsxs(Text, { color: AMBER, bold: true, children: ["API key for ", keyPrompt.provider] }), _jsx(Text, { color: MUTED, children: "Paste it and press enter, or ctrl+v to read the clipboard. Held in memory for this session only; esc to cancel." }), keyPrompt.note && _jsx(Text, { color: CYAN, children: keyPrompt.note }), _jsxs(Box, { marginTop: 1, children: [_jsxs(Text, { color: MUTED, children: [keyPrompt.env, ": "] }), _jsx(Text, { color: INK, children: '*'.repeat(Math.min(keyPrompt.value.length, 48)) }), _jsx(Cursor, {}), keyPrompt.value.length > 0 && (_jsxs(Text, { color: DIM, children: [" ", keyPrompt.value.length, " characters"] }))] })] })), ask && (() => {
|
|
6721
6856
|
let detail = '';
|
|
6722
6857
|
let isCommand = false;
|
|
6723
6858
|
try {
|
|
@@ -6773,7 +6908,7 @@ export function App({ config: initialConfig, clearFrame, synchronizedFrames = fa
|
|
|
6773
6908
|
? _jsx(Text, { color: INK, children: draft.slice(caret) })
|
|
6774
6909
|
: caret < draft.length
|
|
6775
6910
|
? _jsxs(_Fragment, { children: [_jsx(Text, { backgroundColor: CYAN, color: "#10222A", children: draft[caret] }), _jsx(Text, { color: INK, children: draft.slice(caret + 1) })] })
|
|
6776
|
-
: _jsx(
|
|
6911
|
+
: _jsx(Cursor, {})] }));
|
|
6777
6912
|
})()] }) }), copyNotice && _jsx(Text, { color: CYAN, children: copyNotice }), _jsx(Box, { marginTop: 1, paddingX: 1, width: uiWidth - 4, flexShrink: 0, children: _jsxs(Text, { wrap: "truncate", backgroundColor: "#24343B", children: [repaint % 2 === 1 ? '\u200b' : '', _jsx(Text, { color: MUTED, children: "TAB " }), _jsx(Text, { color: INK, children: "Analytics" }), _jsx(Text, { color: MUTED, children: " / " }), _jsx(Text, { color: CYAN, children: "/HELP" }), _jsx(Text, { color: INK, children: " Commands" }), _jsx(Text, { color: MUTED, children: " / SHIFT+TAB " }), _jsx(Text, { color: INK, children: "Mode" }), _jsx(Text, { color: MUTED, children: " / " }), _jsx(Text, { color: statusColor, children: statusLabel.toLowerCase() }), plan && planSummary(plan) && (_jsxs(_Fragment, { children: [_jsx(Text, { color: MUTED, children: " / PLAN: " }), _jsx(Text, { color: CYAN, children: planSummary(plan) })] })), _jsx(Text, { color: MUTED, children: " / MODE: " }), _jsx(Text, { color: mode === 'auto' ? INK : AMBER, children: modeSpec(mode).label }), _jsx(Text, { color: MUTED, children: " / EFFORT: " }), _jsx(Text, { color: effort === 'medium' ? INK : AMBER, children: effort }), autoUpdated && (_jsxs(_Fragment, { children: [_jsx(Text, { color: MUTED, children: " / " }), _jsxs(Text, { color: GREEN, children: [G.ok, " Update installed \u00B7 restart to use it"] })] })), mouse && (_jsxs(_Fragment, { children: [_jsx(Text, { color: MUTED, children: " / " }), _jsx(Text, { color: AMBER, children: "WHEEL: on \u2014 shift to select \u00B7 /mouse off" })] })), _jsx(Text, { color: MUTED, children: " / MODEL: " }), _jsx(Text, { color: INK, children: modelShort }), _jsx(Text, { color: MUTED, children: " / v" }), _jsx(Text, { color: updatePane?.behind ? AMBER : INK, children: VERSION }), updatePane?.behind && _jsx(Text, { color: AMBER, children: " \u2191" }), pasteCount > 0 && (_jsxs(_Fragment, { children: [_jsx(Text, { color: MUTED, children: " / " }), _jsxs(Text, { color: AMBER, children: [pasteCount, " paste", pasteCount === 1 ? '' : 's', " held, sent in full"] })] })), ' '.repeat(uiWidth)] }) })] }));
|
|
6778
6913
|
}
|
|
6779
6914
|
export async function runInkChatMode(config) {
|