@alexwkleung/reika 0.7.0 → 0.9.0
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/README.md +15 -0
- package/README.zh-CN.md +15 -0
- package/dist/agent/compaction.js +82 -27
- package/dist/agent/loop.js +84 -20
- package/dist/agent/prefillcost.js +16 -0
- package/dist/agent/prompt.js +5 -2
- package/dist/cli.js +5 -11
- package/dist/context/bootstrap.js +1 -1
- package/dist/debug.js +15 -0
- package/dist/{headless.js → headless/headless.js} +185 -48
- package/dist/{headlessargs.js → headless/headlessargs.js} +12 -2
- package/dist/headless/headlessprompt.js +132 -0
- package/dist/mcp/client.js +97 -5
- package/dist/mcp/manager.js +15 -2
- package/dist/provider/client.js +13 -0
- package/dist/session.js +12 -1
- package/dist/{skills.js → skills/skills.js} +93 -13
- package/dist/store/sessions.js +40 -3
- package/dist/store/transcript.js +38 -1
- package/dist/tools/_carriers.js +119 -0
- package/dist/tools/_danger.js +305 -82
- package/dist/tools/_readonly.js +13 -12
- package/dist/tools/_sandbox.js +13 -5
- package/dist/ui/App.js +288 -83
- package/dist/ui/Approval.js +80 -33
- package/dist/ui/Confirm.js +1 -27
- package/dist/ui/DiffView.js +24 -14
- package/dist/ui/Question.js +152 -19
- package/dist/ui/ResumeSelect.js +13 -6
- package/dist/ui/Scrollback.js +44 -8
- package/dist/ui/Status.js +35 -10
- package/dist/ui/commands.js +1 -1
- package/dist/ui/dialogspecs.js +38 -0
- package/dist/ui/layout.js +149 -6
- package/dist/ui/markdown.js +6 -5
- package/dist/ui/pr.js +15 -9
- package/dist/ui/reactbuild.js +15 -0
- package/dist/ui/summary.js +3 -2
- package/dist/ui/termtext.js +5 -1
- package/dist/ui/theme.js +5 -0
- package/dist/ui/tui.js +9 -0
- package/package.json +1 -1
- /package/dist/{skillmatch.js → skills/skillmatch.js} +0 -0
package/dist/ui/Scrollback.js
CHANGED
|
@@ -2,7 +2,6 @@ import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-run
|
|
|
2
2
|
import { useMemo, useRef } from 'react';
|
|
3
3
|
import { Box, Static, Text } from 'ink';
|
|
4
4
|
import chalk from 'chalk';
|
|
5
|
-
import wrapAnsi from 'wrap-ansi';
|
|
6
5
|
import stringWidth from 'string-width';
|
|
7
6
|
import { hideDanglingMarkers, renderMarkdown, renderReasoningMarkdown } from './markdown.js';
|
|
8
7
|
import { glyphs } from './glyphs.js';
|
|
@@ -11,10 +10,10 @@ import { scrubGeneration } from './identity.js';
|
|
|
11
10
|
import { scrubDisplay, scrubOutput } from './scrub.js';
|
|
12
11
|
import { DiffView } from './DiffView.js';
|
|
13
12
|
import { changeLabel, formatDurationMs, toolLabel, toolTimer, toolVerb } from './format.js';
|
|
14
|
-
import { contentWidth, hangingWrap } from './layout.js';
|
|
13
|
+
import { contentWidth, hangingWrap, wrapLines } from './layout.js';
|
|
15
14
|
import { foldedAssistantFields, foldedLiveFields } from './reasoningfold.js';
|
|
16
15
|
import { OUTPUT_TAIL_LINES } from '../tools/bash.js';
|
|
17
|
-
export function Scrollback({ messages, streaming, streamingReasoning, streamingTool, streamingNested = false, streamingNote = false, streamingCommand = false, pendingTool = '', pendingToolMs = 0, chromeRows = 0, showHeldWorked = true, }) {
|
|
16
|
+
export function Scrollback({ messages, streaming, streamingReasoning, streamingTool, streamingNested = false, streamingNote = false, streamingCommand = false, pendingTool = '', pendingToolMs = 0, pendingCommand = '', chromeRows = 0, showHeldWorked = true, }) {
|
|
18
17
|
// The live (non-Static) region must never grow taller than the viewport: Ink can't
|
|
19
18
|
// erase a frame taller than the screen, which is what produces the "duplicated
|
|
20
19
|
// terminal" on long streamed output and breaks native scrollback. Each active stream
|
|
@@ -55,14 +54,25 @@ export function Scrollback({ messages, streaming, streamingReasoning, streamingT
|
|
|
55
54
|
}
|
|
56
55
|
const { log: scrollback, held } = useScrollbackLog(messages);
|
|
57
56
|
const pendingGap = pendingTool ? pendingToolGap(pendingTool, scrollback.at(-1)) : 0;
|
|
58
|
-
const
|
|
57
|
+
const commandWidth = contentWidth(COMMAND_MARGIN + indent);
|
|
58
|
+
const commandLines = pendingTool && pendingCommand
|
|
59
|
+
? hangingWrap(scrubOutput(pendingCommand), commandWidth, SHELL_MARKER.length).split('\n')
|
|
60
|
+
: [];
|
|
61
|
+
const poolBeforeCommand = region - (pendingTool ? 1 + pendingGap : 0) - blocks.reduce((sum, b) => sum + b.fixed, 0);
|
|
62
|
+
// The output tail keeps its room (the rows the chip will show), and a long command gives up
|
|
63
|
+
// its rows past that, ending in `…` — the chip draws all of it once it commits.
|
|
64
|
+
const commandRows = commandLines.length === 0
|
|
65
|
+
? 0
|
|
66
|
+
: Math.min(commandLines.length, Math.max(1, poolBeforeCommand - 1 - OUTPUT_TAIL_LINES));
|
|
67
|
+
const commandCut = commandRows < commandLines.length;
|
|
68
|
+
const pool = poolBeforeCommand - (commandRows ? 1 + commandRows : 0);
|
|
59
69
|
// A running command's tail is held to the rows its committed chip shows: grown to the pool, it
|
|
60
70
|
// pushed the input to the bottom and then dropped it by the difference when the chip replaced it.
|
|
61
71
|
const shares = allocateLiveRows(blocks.map(b => {
|
|
62
72
|
const need = b.live.cut ? Infinity : b.live.rows.length;
|
|
63
73
|
return b.kind === 'tool' && streamingCommand ? Math.min(need, OUTPUT_TAIL_LINES) : need;
|
|
64
74
|
}), pool);
|
|
65
|
-
const live = (_jsxs(_Fragment, { children: [pendingTool ? (_jsx(Box, { marginTop: pendingGap, children: _jsxs(Text, { color: theme.secondary, children: [_jsx(Text, { color: theme.tool, children: TOOL_MARKER }), `${toolVerb(pendingTool)}…`, _jsx(Text, { color: theme.muted, children: toolTimer(pendingTool, pendingToolMs) })] }) })) : null, blocks.map((b, i) => b.kind === 'reasoning' ? (_jsx(Box, { marginTop: 1, children: _jsx(ReasoningBlock, { lines: b.live.rows.slice(-shares[i]), barColor: streamingNote ? theme.info : undefined }) }, b.kind)) : b.kind === 'content' && streamingNote ? (_jsx(NoteBody, { tail: fitTail(b.live, shares[i]), joined: blocks[i - 1]?.kind === 'reasoning' }, b.kind)) : (_jsx(StreamingTail, { tail: fitTail(b.live, shares[i]), muted: b.kind === 'tool',
|
|
75
|
+
const live = (_jsxs(_Fragment, { children: [pendingTool ? (_jsx(Box, { marginTop: pendingGap, children: _jsxs(Text, { color: theme.secondary, children: [_jsx(Text, { color: theme.tool, children: TOOL_MARKER }), `${toolVerb(pendingTool)}…`, _jsx(Text, { color: theme.muted, children: toolTimer(pendingTool, pendingToolMs) })] }) })) : null, commandRows ? (_jsxs(Box, { flexDirection: "column", marginTop: 1, marginLeft: COMMAND_MARGIN, children: [_jsxs(Text, { children: [_jsx(Text, { color: theme.success, children: SHELL_MARKER }), _jsx(Text, { children: commandLines.slice(0, commandCut ? commandRows - 1 : commandRows).join('\n') })] }), commandCut ? _jsx(Text, { color: theme.muted, children: "\u2026" }) : null] })) : null, blocks.map((b, i) => b.kind === 'reasoning' ? (_jsx(Box, { marginTop: 1, children: _jsx(ReasoningBlock, { lines: b.live.rows.slice(-shares[i]), barColor: streamingNote ? theme.info : undefined }) }, b.kind)) : b.kind === 'content' && streamingNote ? (_jsx(NoteBody, { tail: fitTail(b.live, shares[i]), joined: blocks[i - 1]?.kind === 'reasoning' }, b.kind)) : (_jsx(StreamingTail, { tail: fitTail(b.live, shares[i]), muted: b.kind === 'tool',
|
|
66
76
|
// Relative to the live wrapper (which already pays `indent`), so a command's output
|
|
67
77
|
// lands where the committed one will: inside the chip's margin, or flush left.
|
|
68
78
|
offset: b.kind === 'tool' ? toolOffset : 0 }, b.kind)))] }));
|
|
@@ -126,7 +136,7 @@ function liveContentWidth(indent = 0) {
|
|
|
126
136
|
// exceeds the viewport. Wrapped with the exact wrap-ansi options Ink uses (build/wrap-text.js), so
|
|
127
137
|
// the count matches and Ink's own re-wrap of a row is a no-op (rows are already ≤ width).
|
|
128
138
|
export function displayRows(text, width) {
|
|
129
|
-
return
|
|
139
|
+
return wrapLines(text, width).split('\n');
|
|
130
140
|
}
|
|
131
141
|
// The block's last rows that fit `allowance`, the "…" marker counted inside it.
|
|
132
142
|
export function fitTail(block, allowance) {
|
|
@@ -285,6 +295,29 @@ const liveReasoningRows = lastCall(streamingReasoningRows, paintKey);
|
|
|
285
295
|
const liveContentRows = lastCall(streamingContentRows, paintKey);
|
|
286
296
|
const liveNoteRows = lastCall(streamingNoteRows, paintKey);
|
|
287
297
|
const liveToolRows = lastCall(streamingToolRows, paintKey);
|
|
298
|
+
// A discarded stream, drawn as its live tail was: the same builders and row split, so the committed
|
|
299
|
+
// rows take the live rows' place one for one and the input stays where it was. At least as tall as
|
|
300
|
+
// what was on screen, since the live region it was split against also paid for any dialog chrome.
|
|
301
|
+
function FrozenStream({ reasoning, content, note, indent, }) {
|
|
302
|
+
const region = liveRegionRows();
|
|
303
|
+
const folded = note ? { reasoning, content } : foldedLiveFields(reasoning, content);
|
|
304
|
+
const blocks = [];
|
|
305
|
+
if (folded.reasoning) {
|
|
306
|
+
const columns = process.stdout.columns || 80;
|
|
307
|
+
const live = streamingReasoningRows(folded.reasoning, indent, region, columns);
|
|
308
|
+
blocks.push({ kind: 'reasoning', live, fixed: 2 });
|
|
309
|
+
}
|
|
310
|
+
if (folded.content.trim()) {
|
|
311
|
+
const width = liveContentWidth(indent);
|
|
312
|
+
const live = note
|
|
313
|
+
? streamingNoteRows(folded.content, width, region)
|
|
314
|
+
: streamingContentRows(folded.content, width, region);
|
|
315
|
+
blocks.push({ kind: 'content', live, fixed: note ? 3 : 1 });
|
|
316
|
+
}
|
|
317
|
+
const pool = region - blocks.reduce((sum, b) => sum + b.fixed, 0);
|
|
318
|
+
const shares = allocateLiveRows(blocks.map(b => (b.live.cut ? Infinity : b.live.rows.length)), pool);
|
|
319
|
+
return (_jsx(Box, { flexDirection: "column", children: blocks.map((b, i) => b.kind === 'reasoning' ? (_jsx(Box, { marginTop: 1, children: _jsx(ReasoningBlock, { lines: b.live.rows.slice(-shares[i]), barColor: note ? theme.info : undefined }) }, b.kind)) : note ? (_jsx(NoteBody, { tail: fitTail(b.live, shares[i]), joined: i > 0 }, b.kind)) : (_jsx(StreamingTail, { tail: fitTail(b.live, shares[i]) }, b.kind))) }));
|
|
320
|
+
}
|
|
288
321
|
// `offset` is how far inside the live wrapper the committed row will sit (the command chip's
|
|
289
322
|
// margin), so the tail doesn't jump sideways when it commits (#461).
|
|
290
323
|
function StreamingTail({ tail, muted = false, offset = 0, }) {
|
|
@@ -305,7 +338,7 @@ function NoteBody({ tail, joined }) {
|
|
|
305
338
|
return (_jsxs(Box, { flexDirection: "column", marginTop: joined ? 0 : 1, children: [joined ? _jsx(NoteBarRow, {}) : null, _jsx(NoteBarRow, { children: _jsx(Text, { color: theme.info, bold: true, children: NOTE_LABEL }) }), _jsx(NoteBarRow, {}), tail.marker ? (_jsx(NoteBarRow, { children: _jsx(Text, { color: theme.muted, children: '…' }) })) : null, tail.text.split('\n').map((row, i) => (_jsx(NoteBarRow, { children: row }, i)))] }));
|
|
306
339
|
}
|
|
307
340
|
function CompactionNoteBlock({ note, reasoning, indent, }) {
|
|
308
|
-
return (_jsxs(Box, { flexDirection: "column", marginTop: 1, children: [reasoning ? (_jsx(ReasoningBlock, { lines: reasoningLines(reasoning, indent), barColor: theme.info })) : null, _jsx(NoteBody, { tail: { text: noteBodyRows(note, contentWidth(indent)).join('\n'), marker: false }, joined: !!reasoning })] }));
|
|
341
|
+
return (_jsxs(Box, { flexDirection: "column", marginTop: reasoning ? 1 : 0, children: [reasoning ? (_jsx(ReasoningBlock, { lines: reasoningLines(reasoning, indent), barColor: theme.info })) : null, _jsx(NoteBody, { tail: { text: noteBodyRows(note, contentWidth(indent)).join('\n'), marker: false }, joined: !!reasoning })] }));
|
|
309
342
|
}
|
|
310
343
|
function plural(n, word) {
|
|
311
344
|
return `${n} ${word}${n === 1 ? '' : 's'}`;
|
|
@@ -515,6 +548,9 @@ function renderMessage(msg, indent = 0, ctx = {}) {
|
|
|
515
548
|
// The transcript already redacts shell messages on save; this brings the UI in line with it.
|
|
516
549
|
return (_jsxs(Box, { flexDirection: "column", marginTop: 1, children: [_jsxs(Text, { children: [_jsx(Text, { color: theme.success, children: SHELL_MARKER }), _jsx(Text, { children: hangingWrap(scrubOutput(msg.command), contentWidth(indent), SHELL_MARKER.length) })] }), msg.output.trimEnd() ? (_jsx(Text, { color: theme.muted, children: hangingWrap(scrubOutput(msg.output.trimEnd()), contentWidth(indent), 0) })) : null] }));
|
|
517
550
|
}
|
|
551
|
+
if (msg.role === 'assistant' && msg.discarded) {
|
|
552
|
+
return (_jsx(FrozenStream, { reasoning: msg.reasoning ?? '', content: msg.content, note: msg.discarded === 'note', indent: indent }));
|
|
553
|
+
}
|
|
518
554
|
if (msg.role === 'assistant' && msg.compactionNote) {
|
|
519
555
|
return (_jsx(CompactionNoteBlock, { note: msg.content ?? '', reasoning: msg.reasoning, indent: indent }));
|
|
520
556
|
}
|
|
@@ -636,7 +672,7 @@ function UserBubble({ text, indent = 0, nested = false, }) {
|
|
|
636
672
|
function wrapText(text, width) {
|
|
637
673
|
const out = [];
|
|
638
674
|
for (const raw of text.split('\n')) {
|
|
639
|
-
const rows =
|
|
675
|
+
const rows = wrapLines(raw, width).split('\n');
|
|
640
676
|
// The space a break landed on heads the next row; a leading space on a real line is content.
|
|
641
677
|
rows.forEach((row, i) => out.push(i === 0 ? row : row.replace(/^ +/, '')));
|
|
642
678
|
}
|
package/dist/ui/Status.js
CHANGED
|
@@ -6,13 +6,31 @@ import { supportsHyperlink } from 'supports-hyperlinks';
|
|
|
6
6
|
import { theme } from './theme.js';
|
|
7
7
|
import { contextFill, formatElapsed, formatShrink, formatTokensPerSecond, kFormat, } from './format.js';
|
|
8
8
|
import { useContentWidth } from './layout.js';
|
|
9
|
-
|
|
9
|
+
// Rows the status bar takes at `width` — App budgets the live region with it, since a narrow
|
|
10
|
+
// pane wraps the bar onto several rows and an unbudgeted frame reaches the viewport height.
|
|
11
|
+
// A chip wider than the pane gets a line of its own that Ink hard-wraps, so it counts its rows.
|
|
12
|
+
export function statusRows(props, width) {
|
|
13
|
+
return packChips(statusChips(props), width).reduce((n, line) => {
|
|
14
|
+
const w = line.reduce((sum, chip) => sum + chipWidth(chip), 0) + SEP.length * (line.length - 1);
|
|
15
|
+
return n + Math.max(1, Math.ceil(w / Math.max(1, width)));
|
|
16
|
+
}, 0);
|
|
17
|
+
}
|
|
18
|
+
export function Status(props) {
|
|
10
19
|
const width = useContentWidth();
|
|
20
|
+
// One <Text> per packed line, chips as nested runs rather than siblings: a row Box of sibling
|
|
21
|
+
// <Text>s hands each its own column when the row overflows, and every chip wraps in place into
|
|
22
|
+
// a stack of two-to-four-character shards (#295). Packing here is what decides where the line
|
|
23
|
+
// breaks; Ink's own wrap only ever sees a line that already fits, except for a single chip
|
|
24
|
+
// wider than the terminal, which it hard-wraps as a last resort.
|
|
25
|
+
return (_jsx(Box, { flexDirection: "column", children: packChips(statusChips(props), width).map((line, i) => (_jsx(Text, { children: line.map((chip, j) => (_jsxs(Fragment, { children: [j > 0 ? _jsx(Text, { color: theme.muted, children: SEP }) : null, chip.map((seg, k) => (_jsx(Text, { color: seg.color, underline: seg.underline, children: seg.text }, k)))] }, j))) }, i))) }));
|
|
26
|
+
}
|
|
27
|
+
export function statusChips({ model, turns, status, elapsed, usage, contextTokens, contextWindow, contextUsable, sheds, folds, cachedTokens, decodeRate, pr, autoApprove, unattended, modeTag, exitArmed, }) {
|
|
11
28
|
const busy = elapsed !== null;
|
|
12
29
|
const timer = busy ? ` · ${formatElapsed(elapsed)}` : '';
|
|
13
30
|
const keys = busy ? 'ctrl-c to abort' : 'ctrl-c to exit';
|
|
31
|
+
const approx = usage.estimated ? '~' : '';
|
|
14
32
|
const tokens = usage.promptTokens > 0 || usage.completionTokens > 0
|
|
15
|
-
? `${kFormat(usage.promptTokens)}↑ ${kFormat(usage.completionTokens)}↓`
|
|
33
|
+
? `${approx}${kFormat(usage.promptTokens)}↑ ${approx}${kFormat(usage.completionTokens)}↓`
|
|
16
34
|
: '';
|
|
17
35
|
// Current context size and how full the window is. The fill % drives the color so a
|
|
18
36
|
// long run that's approaching the limit is visible at a glance.
|
|
@@ -68,12 +86,7 @@ export function Status({ model, turns, status, elapsed, usage, contextTokens, co
|
|
|
68
86
|
chips.push(exitArmed
|
|
69
87
|
? [{ text: 'press ctrl-c again to exit', color: theme.tool }]
|
|
70
88
|
: [{ text: keys, color: theme.muted }]);
|
|
71
|
-
|
|
72
|
-
// <Text>s hands each its own column when the row overflows, and every chip wraps in place into
|
|
73
|
-
// a stack of two-to-four-character shards (#295). Packing here is what decides where the line
|
|
74
|
-
// breaks; Ink's own wrap only ever sees a line that already fits, except for a single chip
|
|
75
|
-
// wider than the terminal, which it hard-wraps as a last resort.
|
|
76
|
-
return (_jsx(Box, { flexDirection: "column", children: packChips(chips, width).map((line, i) => (_jsx(Text, { children: line.map((chip, j) => (_jsxs(Fragment, { children: [j > 0 ? _jsx(Text, { color: theme.muted, children: SEP }) : null, chip.map((seg, k) => (_jsx(Text, { color: seg.color, underline: seg.underline, children: seg.text }, k)))] }, j))) }, i))) }));
|
|
89
|
+
return chips;
|
|
77
90
|
}
|
|
78
91
|
const SEP = ' · ';
|
|
79
92
|
function muted(text) {
|
|
@@ -153,7 +166,9 @@ export function formatCache(cachedTokens, contextTokens) {
|
|
|
153
166
|
const pct = Math.round((cachedTokens / contextTokens) * 100);
|
|
154
167
|
return cachedTokens > 0 ? `${pct}% cached (${kFormat(cachedTokens)})` : `${pct}% cached`;
|
|
155
168
|
}
|
|
156
|
-
// `PR #12` when the branch has an open PR,
|
|
169
|
+
// `PR #12` when the branch has an open PR, `PR #12 draft` or `PR #12 merged` when that changes
|
|
170
|
+
// what the branch is for, empty when there is none (or we couldn't tell). Merged gets a color of
|
|
171
|
+
// its own: it is the one state where the next commit on this branch goes nowhere. The
|
|
157
172
|
// number is the click target, the `PR` label is not, so the chip comes in two segments — and the
|
|
158
173
|
// separating space rides on the *label*, not the number: a segment's underline runs the whole
|
|
159
174
|
// width of the segment it is on, so a leading space inside the number would draw a column of
|
|
@@ -172,11 +187,21 @@ export function prChip(pr, links = supportsHyperlink(process.stdout)) {
|
|
|
172
187
|
const label = { text: 'PR ', color: theme.secondary };
|
|
173
188
|
const shown = `#${number}`;
|
|
174
189
|
const url = pr?.url;
|
|
190
|
+
// Outside the link, or the underline would run under the word and past the click target.
|
|
191
|
+
const suffix = pr?.state
|
|
192
|
+
? [
|
|
193
|
+
{
|
|
194
|
+
text: ` ${pr.state}`,
|
|
195
|
+
color: pr.state === 'merged' ? theme.prMerged : theme.secondary,
|
|
196
|
+
},
|
|
197
|
+
]
|
|
198
|
+
: [];
|
|
175
199
|
if (url && links) {
|
|
176
200
|
return [
|
|
177
201
|
label,
|
|
178
202
|
{ text: `\x1b]8;;${url}\x07${shown}\x1b]8;;\x07`, color: theme.link, underline: true },
|
|
203
|
+
...suffix,
|
|
179
204
|
];
|
|
180
205
|
}
|
|
181
|
-
return [label, { text: shown, color: url ? theme.link : theme.secondary }];
|
|
206
|
+
return [label, { text: shown, color: url ? theme.link : theme.secondary }, ...suffix];
|
|
182
207
|
}
|
package/dist/ui/commands.js
CHANGED
|
@@ -122,7 +122,7 @@ export const COMMANDS = [
|
|
|
122
122
|
},
|
|
123
123
|
{
|
|
124
124
|
name: 'resume',
|
|
125
|
-
desc: 'resume a saved session — this project auto-saves as you go (root: the /save files)',
|
|
125
|
+
desc: 'resume a saved session — this project auto-saves as you go (chat mode: chats; all; root: the /save files)',
|
|
126
126
|
},
|
|
127
127
|
{ name: 'exit', desc: 'exit Reika' },
|
|
128
128
|
{ name: 'quit', desc: 'alias of /exit' },
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
// The dialogs' rows and specs, apart from the Ink components that draw them: headless asks the
|
|
2
|
+
// same questions on a terminal line (#872) and must not load Ink to do it.
|
|
3
|
+
// The last row declines with a reason the user types into the input box below. Last, not beside
|
|
4
|
+
// Decline, so the rows Approval-trained fingers already know keep their places.
|
|
5
|
+
export const APPROVAL_OPTIONS = [
|
|
6
|
+
'Approve',
|
|
7
|
+
'Decline',
|
|
8
|
+
'Always (this session)',
|
|
9
|
+
'Decline, and say what to do instead',
|
|
10
|
+
];
|
|
11
|
+
export const APPROVAL_FEEDBACK_INDEX = 3;
|
|
12
|
+
// Row 0 is "send as typed" and starts selected — the inverse of Approval, where Approve is row 0.
|
|
13
|
+
// There the model has already committed to an action; here nothing has happened yet and the
|
|
14
|
+
// literal prompt is what was asked for. A wrong default that acts costs a turn (or a request
|
|
15
|
+
// nobody meant); a wrong default that doesn't costs a keystroke.
|
|
16
|
+
export const CONFIRM_DECLINE = 0;
|
|
17
|
+
export const CONFIRM_ACCEPT = 1;
|
|
18
|
+
export function skillConfirmSpec(match) {
|
|
19
|
+
return {
|
|
20
|
+
title: 'Skill',
|
|
21
|
+
subtitle: `/${match.skill.name} — ${match.skill.description}`,
|
|
22
|
+
details: [`matched: ${match.matched.join(', ')}`],
|
|
23
|
+
options: ['Send as typed', `Apply /${match.skill.name}`],
|
|
24
|
+
accept: 'apply',
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
// A long URL wraps the frame; the user just typed it, so the head is enough to recognize it.
|
|
28
|
+
const URL_DISPLAY_CHARS = 90;
|
|
29
|
+
export function pastedUrlConfirmSpec(urls) {
|
|
30
|
+
const n = urls.length;
|
|
31
|
+
return {
|
|
32
|
+
title: n > 1 ? 'Pasted links' : 'Pasted link',
|
|
33
|
+
subtitle: `the prompt doesn't read as a request to open ${n > 1 ? 'them' : 'it'} — fetch before the turn?`,
|
|
34
|
+
details: urls.map(u => u.length > URL_DISPLAY_CHARS ? `${u.slice(0, URL_DISPLAY_CHARS)}…` : u),
|
|
35
|
+
options: ['Send as typed', `Fetch ${n > 1 ? `${n} links` : 'the link'}`],
|
|
36
|
+
accept: 'fetch',
|
|
37
|
+
};
|
|
38
|
+
}
|
package/dist/ui/layout.js
CHANGED
|
@@ -32,6 +32,152 @@ export function useContentWidth(indent = 0) {
|
|
|
32
32
|
}, [indent]);
|
|
33
33
|
return width;
|
|
34
34
|
}
|
|
35
|
+
// wrap-ansi measures every word with string-width (a grapheme segmenter plus an emoji regex),
|
|
36
|
+
// which was ~45% of drawing a resumed 1.3MB session, mostly on rows that already fit. A line of
|
|
37
|
+
// printable ASCII under CSI codes that fits comes back from it byte-for-byte, so it is returned
|
|
38
|
+
// as is; anything else (wide or combining text, tabs, hyperlinks, a trim that would bite) goes
|
|
39
|
+
// to wrap-ansi. Same options as Ink's wrap, so the rows are the ones Ink would draw.
|
|
40
|
+
// The punctuation models write most (`→`, `—`, `✓`, `…`, `•`: a fifth of a measured session's
|
|
41
|
+
// rows held one) passes too: each is one code unit, one string-width cell and NFC-stable, which is
|
|
42
|
+
// all the shortcut assumes — `layout.test.ts` checks every one.
|
|
43
|
+
export const NARROW_PUNCTUATION = '→←↑↓—–…•·×✓≠≤≥‘’“”│─';
|
|
44
|
+
const STYLED_ASCII = new RegExp(`^[\\x20-\\x7e\\x1b${NARROW_PUNCTUATION}]*$`);
|
|
45
|
+
const CSI_SEQUENCE = /\x1b\[[0-9;]*[A-Za-z]/g;
|
|
46
|
+
function fitsUnwrapped(line, width, trim) {
|
|
47
|
+
if (!STYLED_ASCII.test(line))
|
|
48
|
+
return false;
|
|
49
|
+
const plain = line.includes('\x1b') ? line.replace(CSI_SEQUENCE, '') : line;
|
|
50
|
+
if (plain.length > width || plain.includes('\x1b'))
|
|
51
|
+
return false;
|
|
52
|
+
return !trim || !(plain.startsWith(' ') || plain.endsWith(' '));
|
|
53
|
+
}
|
|
54
|
+
export function wrapLines(text, width, trim = false) {
|
|
55
|
+
const lines = text.split('\n');
|
|
56
|
+
if (lines.every(line => fitsUnwrapped(line, width, trim)))
|
|
57
|
+
return text;
|
|
58
|
+
return lines
|
|
59
|
+
.map(line => fitsUnwrapped(line, width, trim) ? line : wrapAnsi(line, width, { trim, hard: true }))
|
|
60
|
+
.join('\n');
|
|
61
|
+
}
|
|
62
|
+
// Display rows `text` takes at `width` columns — the unit Ink measures a frame in when it decides
|
|
63
|
+
// the frame is as tall as the viewport. Wrapped with the exact options Ink wraps with
|
|
64
|
+
// (build/wrap-text.js), so a row count measured here is the row count that gets drawn.
|
|
65
|
+
export function wrappedRows(text, width) {
|
|
66
|
+
return wrapLines(text, Math.max(1, width)).split('\n').length;
|
|
67
|
+
}
|
|
68
|
+
// Wrap styled text into rows that each carry every style active where they start (#852).
|
|
69
|
+
//
|
|
70
|
+
// wrap-ansi re-opens only ONE code at a break — the last it saw — so stacked styles lose all but
|
|
71
|
+
// the innermost: a comment is gray then italic, and its continuation rows came back italic in the
|
|
72
|
+
// default foreground; a changed word in a diff is a background then a foreground, and lost its
|
|
73
|
+
// highlight the same way. So the state at each row's end is replayed at the next row's start, and
|
|
74
|
+
// closed at the row's end so a row never leaks a style into whatever Ink draws after it. Same
|
|
75
|
+
// options as Ink's own wrap, so the break points and row count are unchanged. `trim` is for a caller
|
|
76
|
+
// that wraps prose itself (markdown), where wrap-ansi's default drops the space a break lands on.
|
|
77
|
+
export function wrapStyledRows(text, width, trim = false) {
|
|
78
|
+
const rows = wrapLines(text, Math.max(1, width), trim).split('\n');
|
|
79
|
+
let open = new Map();
|
|
80
|
+
return rows.map(row => {
|
|
81
|
+
const lead = [...open.values()].join('');
|
|
82
|
+
open = sgrStateAfter(row, open);
|
|
83
|
+
const close = [...open.keys()].map(slot => SGR_CLOSE[slot]).join('');
|
|
84
|
+
return lead + row + close;
|
|
85
|
+
});
|
|
86
|
+
}
|
|
87
|
+
// The styled text whose plain characters are `[start, end)`, opening with the styles active at
|
|
88
|
+
// `start` and closing what is still open at `end`, so the slice stands on its own. Lets a caller
|
|
89
|
+
// style a whole line in one pass and cut it afterwards: a fragment styled alone loses its context,
|
|
90
|
+
// as a run of words from the middle of a comment does without the `//` that made it one (#852).
|
|
91
|
+
export function sliceStyled(text, start, end) {
|
|
92
|
+
const sgr = /\x1b\[[0-9;]*m/y;
|
|
93
|
+
let open = new Map();
|
|
94
|
+
let out = '';
|
|
95
|
+
let plain = 0;
|
|
96
|
+
let i = 0;
|
|
97
|
+
while (i < text.length && plain < end) {
|
|
98
|
+
sgr.lastIndex = i;
|
|
99
|
+
const code = sgr.exec(text);
|
|
100
|
+
if (code) {
|
|
101
|
+
if (plain < start)
|
|
102
|
+
open = sgrStateAfter(code[0], open);
|
|
103
|
+
else
|
|
104
|
+
out += code[0];
|
|
105
|
+
i += code[0].length;
|
|
106
|
+
continue;
|
|
107
|
+
}
|
|
108
|
+
if (plain === start)
|
|
109
|
+
out = [...open.values()].join('') + out;
|
|
110
|
+
if (plain >= start)
|
|
111
|
+
out += text[i];
|
|
112
|
+
plain++;
|
|
113
|
+
i++;
|
|
114
|
+
}
|
|
115
|
+
const after = sgrStateAfter(out, new Map());
|
|
116
|
+
return out + [...after.keys()].map(slot => SGR_CLOSE[slot]).join('');
|
|
117
|
+
}
|
|
118
|
+
const SGR_CLOSE = {
|
|
119
|
+
fg: '\x1b[39m',
|
|
120
|
+
bg: '\x1b[49m',
|
|
121
|
+
weight: '\x1b[22m',
|
|
122
|
+
italic: '\x1b[23m',
|
|
123
|
+
underline: '\x1b[24m',
|
|
124
|
+
inverse: '\x1b[27m',
|
|
125
|
+
strike: '\x1b[29m',
|
|
126
|
+
};
|
|
127
|
+
const SIMPLE_SLOTS = {
|
|
128
|
+
1: ['weight', true],
|
|
129
|
+
2: ['weight', true],
|
|
130
|
+
3: ['italic', true],
|
|
131
|
+
4: ['underline', true],
|
|
132
|
+
7: ['inverse', true],
|
|
133
|
+
9: ['strike', true],
|
|
134
|
+
22: ['weight', false],
|
|
135
|
+
23: ['italic', false],
|
|
136
|
+
24: ['underline', false],
|
|
137
|
+
27: ['inverse', false],
|
|
138
|
+
29: ['strike', false],
|
|
139
|
+
39: ['fg', false],
|
|
140
|
+
49: ['bg', false],
|
|
141
|
+
};
|
|
142
|
+
// Which styles are open after `row`, starting from `before`. Each open slot holds the sequence that
|
|
143
|
+
// re-opens it; a compound sequence (`38;2;r;g;b`) is split into its own per-slot sequence.
|
|
144
|
+
function sgrStateAfter(row, before) {
|
|
145
|
+
const state = new Map(before);
|
|
146
|
+
for (const match of row.matchAll(/\x1b\[([0-9;]*)m/g)) {
|
|
147
|
+
const params = match[1] === '' ? [0] : match[1].split(';').map(Number);
|
|
148
|
+
for (let i = 0; i < params.length; i++) {
|
|
149
|
+
const p = params[i];
|
|
150
|
+
if (p === 0) {
|
|
151
|
+
state.clear();
|
|
152
|
+
}
|
|
153
|
+
else if (p === 38 || p === 48) {
|
|
154
|
+
// 38;5;n and 38;2;r;g;b carry their color in the params that follow.
|
|
155
|
+
const span = params[i + 1] === 5 ? 2 : params[i + 1] === 2 ? 4 : 0;
|
|
156
|
+
const code = params.slice(i, i + 1 + span).join(';');
|
|
157
|
+
state.set(p === 38 ? 'fg' : 'bg', `\x1b[${code}m`);
|
|
158
|
+
i += span;
|
|
159
|
+
}
|
|
160
|
+
else if ((p >= 30 && p <= 37) || (p >= 90 && p <= 97)) {
|
|
161
|
+
state.set('fg', `\x1b[${p}m`);
|
|
162
|
+
}
|
|
163
|
+
else if ((p >= 40 && p <= 47) || (p >= 100 && p <= 107)) {
|
|
164
|
+
state.set('bg', `\x1b[${p}m`);
|
|
165
|
+
}
|
|
166
|
+
else if (SIMPLE_SLOTS[p]) {
|
|
167
|
+
const [slot, opens] = SIMPLE_SLOTS[p];
|
|
168
|
+
if (opens)
|
|
169
|
+
state.set(slot, `\x1b[${p}m`);
|
|
170
|
+
else
|
|
171
|
+
state.delete(slot);
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
return state;
|
|
176
|
+
}
|
|
177
|
+
// `hangingWrap`'s row count for the same text at the same width.
|
|
178
|
+
export function hangingRows(text, width, hang) {
|
|
179
|
+
return hangingWrap(text, width, hang).split('\n').length;
|
|
180
|
+
}
|
|
35
181
|
// Wrap `text` so that a marker-prefixed line (" ↳ Ran: …", "$ …", "⏺︎ Bash(…)") keeps a HANGING
|
|
36
182
|
// INDENT: every row after the first lands under the text, not back at column 0.
|
|
37
183
|
//
|
|
@@ -54,12 +200,9 @@ export function hangingWrap(text, width, hang, first = hang) {
|
|
|
54
200
|
const out = [];
|
|
55
201
|
let atStart = true;
|
|
56
202
|
for (const line of text.split('\n')) {
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
trim: false,
|
|
61
|
-
hard: true,
|
|
62
|
-
}).split('\n');
|
|
203
|
+
// Ink's own options (build/wrap-text.js), so the break points match what Ink would have
|
|
204
|
+
// chosen and this stays a re-formatting of Ink's wrap rather than a second, different one.
|
|
205
|
+
const rows = wrapLines(atStart ? lead + line : line, wrapAt).split('\n');
|
|
63
206
|
rows.forEach((row, i) => {
|
|
64
207
|
// trim:false leaves the whitespace wrap-ansi broke on at the head of the continuation row —
|
|
65
208
|
// the whole run of it, so a line that breaks inside expanded tabs staggers further right on
|
package/dist/ui/markdown.js
CHANGED
|
@@ -3,11 +3,10 @@ import { Lexer } from 'marked';
|
|
|
3
3
|
import stringWidth from 'string-width';
|
|
4
4
|
import stripAnsi from 'strip-ansi';
|
|
5
5
|
import { supportsHyperlink } from 'supports-hyperlinks';
|
|
6
|
-
import wrapAnsi from 'wrap-ansi';
|
|
7
6
|
import { theme, themeChalk } from './theme.js';
|
|
8
7
|
import { highlightCode } from './highlight.js';
|
|
9
8
|
import { drawnWidth, sanitizeTerminalText } from './termtext.js';
|
|
10
|
-
import { contentWidth } from './layout.js';
|
|
9
|
+
import { contentWidth, wrapStyledRows } from './layout.js';
|
|
11
10
|
// Left indent of a top-level list.
|
|
12
11
|
const TAB_WIDTH = 2;
|
|
13
12
|
// Narrowest a nested block wraps at, however deep it sits: below this a line holds a word or two.
|
|
@@ -15,9 +14,11 @@ const MIN_PROSE_WIDTH = 20;
|
|
|
15
14
|
function proseWidth(ctx) {
|
|
16
15
|
return Math.max(MIN_PROSE_WIDTH, ctx.width);
|
|
17
16
|
}
|
|
18
|
-
// `hard` splits a bare URL longer than the line instead of letting it overflow.
|
|
17
|
+
// `hard` splits a bare URL longer than the line instead of letting it overflow. Styled rows, not
|
|
18
|
+
// bare wrap-ansi: it re-opens a named color at a break but not a hex one, so an inline code span
|
|
19
|
+
// that wrapped lost its color from the second row on.
|
|
19
20
|
function wrapProse(text, ctx) {
|
|
20
|
-
return
|
|
21
|
+
return wrapStyledRows(text, proseWidth(ctx), true).join('\n');
|
|
21
22
|
}
|
|
22
23
|
function renderBlocks(tokens, ctx) {
|
|
23
24
|
return tokens
|
|
@@ -115,7 +116,7 @@ function renderTable(table, ctx) {
|
|
|
115
116
|
const border = themeChalk(theme.muted);
|
|
116
117
|
const rule = (left, mid, right) => border(left + widths.map(w => '─'.repeat(w)).join(mid) + right);
|
|
117
118
|
const drawRow = (row, paint) => {
|
|
118
|
-
const wrapped = widths.map((w, col) =>
|
|
119
|
+
const wrapped = widths.map((w, col) => wrapStyledRows(row[col] ?? '', Math.max(1, w - 2), true));
|
|
119
120
|
const height = Math.max(...wrapped.map(lines => lines.length));
|
|
120
121
|
const lines = [];
|
|
121
122
|
for (let r = 0; r < height; r++) {
|
package/dist/ui/pr.js
CHANGED
|
@@ -7,8 +7,8 @@ import { execFile } from 'node:child_process';
|
|
|
7
7
|
// shows, the URL is what makes it click (ui/Status.tsx opens an OSC 8 hyperlink on it).
|
|
8
8
|
const GIT_TIMEOUT_MS = 2_000;
|
|
9
9
|
const GH_TIMEOUT_MS = 4_000;
|
|
10
|
-
// A PR opened mid-session should appear without a restart; a
|
|
11
|
-
//
|
|
10
|
+
// A PR opened mid-session should appear without a restart; a merge should reach the badge
|
|
11
|
+
// eventually. Neither is urgent, so both TTLs sit well above the poll interval.
|
|
12
12
|
const MISS_TTL_MS = 60_000;
|
|
13
13
|
const HIT_TTL_MS = 300_000;
|
|
14
14
|
const cache = new Map();
|
|
@@ -36,13 +36,13 @@ export async function currentBranch(cwd) {
|
|
|
36
36
|
return out?.trim() || null;
|
|
37
37
|
}
|
|
38
38
|
async function lookupPr(cwd, branch) {
|
|
39
|
-
const out = await run('gh', ['pr', 'view', branch, '--json', 'number,state,url'], cwd, GH_TIMEOUT_MS);
|
|
39
|
+
const out = await run('gh', ['pr', 'view', branch, '--json', 'number,state,isDraft,url'], cwd, GH_TIMEOUT_MS);
|
|
40
40
|
return out ? parsePrView(out) : null;
|
|
41
41
|
}
|
|
42
|
-
// `gh` reports the newest PR for the branch whatever its state
|
|
43
|
-
//
|
|
44
|
-
//
|
|
45
|
-
//
|
|
42
|
+
// `gh` reports the newest PR for the branch whatever its state. Merged stays on the badge: people
|
|
43
|
+
// stay on a branch after it lands, a commit there goes nowhere, and a badge that just vanishes
|
|
44
|
+
// reads the same as `gh` failing. Closed does not, since it says nothing about what to do next.
|
|
45
|
+
// Draft isn't a state to `gh` (drafts are OPEN + isDraft).
|
|
46
46
|
// The URL rides along only when `gh` gave us a usable one: it is the click target, never the
|
|
47
47
|
// label, so its absence costs the hyperlink and nothing else.
|
|
48
48
|
export function parsePrView(stdout) {
|
|
@@ -50,10 +50,16 @@ export function parsePrView(stdout) {
|
|
|
50
50
|
const data = JSON.parse(stdout);
|
|
51
51
|
if (typeof data.number !== 'number')
|
|
52
52
|
return null;
|
|
53
|
-
|
|
53
|
+
const state = typeof data.state === 'string' ? data.state.toUpperCase() : 'OPEN';
|
|
54
|
+
if (state !== 'OPEN' && state !== 'MERGED')
|
|
54
55
|
return null;
|
|
55
56
|
const url = typeof data.url === 'string' && data.url ? data.url : undefined;
|
|
56
|
-
|
|
57
|
+
const pr = url ? { number: data.number, url } : { number: data.number };
|
|
58
|
+
if (state === 'MERGED')
|
|
59
|
+
pr.state = 'merged';
|
|
60
|
+
else if (data.isDraft === true)
|
|
61
|
+
pr.state = 'draft';
|
|
62
|
+
return pr;
|
|
57
63
|
}
|
|
58
64
|
catch {
|
|
59
65
|
return null;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
// React, its JSX runtime and Ink's reconciler each pick a build from NODE_ENV when first loaded, so
|
|
2
|
+
// the TUI ran the development ones (~12% slower resume, ~10% more CPU). Scoped to the load because
|
|
3
|
+
// bash and every other child inherit process.env: `npm install` under production skips
|
|
4
|
+
// devDependencies. An explicit NODE_ENV is the user's and is left alone.
|
|
5
|
+
export async function loadWithProductionReact(load) {
|
|
6
|
+
if (process.env.NODE_ENV !== undefined)
|
|
7
|
+
return load();
|
|
8
|
+
process.env.NODE_ENV = 'production';
|
|
9
|
+
try {
|
|
10
|
+
return await load();
|
|
11
|
+
}
|
|
12
|
+
finally {
|
|
13
|
+
delete process.env.NODE_ENV;
|
|
14
|
+
}
|
|
15
|
+
}
|
package/dist/ui/summary.js
CHANGED
|
@@ -3,7 +3,7 @@ import { formatElapsed } from './format.js';
|
|
|
3
3
|
export function buildSummary(messages, usage, startedAt, approvals) {
|
|
4
4
|
const elapsed = Math.floor((Date.now() - startedAt) / 1000);
|
|
5
5
|
const userTurns = messages.filter(m => m.role === 'user' && !m.nested && !m.meta).length;
|
|
6
|
-
const assistantTurns = messages.filter(m => m.role === 'assistant' && !m.nested && !m.compactionNote).length;
|
|
6
|
+
const assistantTurns = messages.filter(m => m.role === 'assistant' && !m.nested && !m.compactionNote && !m.discarded).length;
|
|
7
7
|
const toolCounts = {};
|
|
8
8
|
const files = new Set();
|
|
9
9
|
for (const m of messages) {
|
|
@@ -36,6 +36,7 @@ export function buildSummary(messages, usage, startedAt, approvals) {
|
|
|
36
36
|
.sort()
|
|
37
37
|
.map(f => scrubPaths(f))
|
|
38
38
|
.join(', ');
|
|
39
|
+
const approx = usage.estimated ? '~' : '';
|
|
39
40
|
return [
|
|
40
41
|
'Session summary',
|
|
41
42
|
'─'.repeat(40),
|
|
@@ -43,7 +44,7 @@ export function buildSummary(messages, usage, startedAt, approvals) {
|
|
|
43
44
|
`Turns: ${userTurns} user · ${assistantTurns} assistant`,
|
|
44
45
|
`Tools: ${totalTools}${breakdown}`,
|
|
45
46
|
`Subagents: ${subagentCount}`,
|
|
46
|
-
`Tokens: ${usage.promptTokens.toLocaleString()} ↑ ${usage.completionTokens.toLocaleString()} ↓`,
|
|
47
|
+
`Tokens: ${approx}${usage.promptTokens.toLocaleString()} ↑ ${approx}${usage.completionTokens.toLocaleString()} ↓`,
|
|
47
48
|
...(usage.cachedTokens && usage.promptTokens > 0
|
|
48
49
|
? [
|
|
49
50
|
`Cache hits: ${usage.cachedTokens.toLocaleString()} (${Math.round((usage.cachedTokens / usage.promptTokens) * 100)}% of prompt)`,
|
package/dist/ui/termtext.js
CHANGED
|
@@ -98,10 +98,14 @@ const ASKS_FOR_EMOJI = /\uFE0F/;
|
|
|
98
98
|
const ASKS_FOR_TEXT = /\uFE0E/;
|
|
99
99
|
const segmenter = new Intl.Segmenter();
|
|
100
100
|
export function drawnWidth(text) {
|
|
101
|
+
const plain = stripAnsi(text);
|
|
102
|
+
// Printable ASCII is one cell a character on every path below; skip the segmenter for it.
|
|
103
|
+
if (/^[\x20-\x7e]*$/.test(plain))
|
|
104
|
+
return plain.length;
|
|
101
105
|
let width = 0;
|
|
102
106
|
// Grapheme by grapheme, the way string-width counts: a ZWJ sequence is one glyph on screen and
|
|
103
107
|
// a combining mark spends no cell of its own.
|
|
104
|
-
for (const { segment } of segmenter.segment(
|
|
108
|
+
for (const { segment } of segmenter.segment(plain)) {
|
|
105
109
|
const measured = stringWidth(segment);
|
|
106
110
|
const textPresentation = measured === 2 &&
|
|
107
111
|
PICTOGRAPHIC.test(segment) &&
|
package/dist/ui/theme.js
CHANGED
|
@@ -58,6 +58,10 @@ const truecolor = {
|
|
|
58
58
|
// that marks the Thinking bar. Underlined only on terminals that take OSC 8 hyperlinks
|
|
59
59
|
// (markdown.ts): an underline promises a click, and elsewhere there is none to deliver.
|
|
60
60
|
link: '#aac0f0',
|
|
61
|
+
// `merged` on the status line's PR chip. GitHub's merged purple, so it reads without a legend.
|
|
62
|
+
// Not `warning`, which the context gauge on the same line turns at 80% fill, and more saturated
|
|
63
|
+
// than the agent tag's soft magenta at the other end of that line.
|
|
64
|
+
prMerged: '#b48cf0',
|
|
61
65
|
};
|
|
62
66
|
// A 16-color terminal (the Linux console, TERM=vt100/ansi, an old ssh client) gets named colors in
|
|
63
67
|
// place of the pastels. Chalk downsamples a hex to the nearest of 16, and nearly every pastel above
|
|
@@ -83,6 +87,7 @@ const ansi16 = {
|
|
|
83
87
|
modeGrind: 'magenta',
|
|
84
88
|
modeChat: 'cyan',
|
|
85
89
|
modeShell: 'greenBright',
|
|
90
|
+
prMerged: 'magenta',
|
|
86
91
|
link: 'blueBright',
|
|
87
92
|
};
|
|
88
93
|
export function themeForLevel(level) {
|
package/dist/ui/tui.js
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { render } from 'ink';
|
|
3
|
+
import { App } from './App.js';
|
|
4
|
+
import { createSyncedStdout } from './syncframe.js';
|
|
5
|
+
export function startTui() {
|
|
6
|
+
// Frames go out as one synchronized write each (#345) so a swapped-out process can't leave the
|
|
7
|
+
// terminal painting a half-erased screen between Ink's writes.
|
|
8
|
+
render(_jsx(App, {}), { exitOnCtrlC: false, stdout: createSyncedStdout(process.stdout) });
|
|
9
|
+
}
|
package/package.json
CHANGED
|
File without changes
|