@0perator/operator 0.2.4 → 0.2.6
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/autonomy/delegate-mode.js +4 -1
- package/dist/autonomy/delegate.js +3 -13
- package/dist/background/index.js +7 -10
- package/dist/background/notices.js +1 -1
- package/dist/cli.js +31 -14
- package/dist/config/persona.js +20 -3
- package/dist/engine/agent.js +62 -7
- package/dist/engine/aurora.js +30 -30
- package/dist/engine/batch-hints.js +45 -0
- package/dist/engine/batch-scheduler.js +23 -7
- package/dist/engine/decision-points.js +12 -2
- package/dist/engine/delegate-turn.js +24 -0
- package/dist/engine/grandmaster.js +28 -11
- package/dist/mcp/index.js +2 -2
- package/dist/permissions/modes.js +7 -3
- package/dist/session.js +65 -12
- package/dist/tools/classes.js +4 -0
- package/dist/tools/deferred.js +11 -6
- package/dist/tools/readonly-shell.js +92 -0
- package/dist/tools/registry.js +3 -3
- package/dist/tools/shell-session.js +56 -1
- package/dist/ui/ActivitySpinner.js +2 -2
- package/dist/ui/App.js +9 -9
- package/dist/ui/ApprovalPrompt.js +5 -4
- package/dist/ui/ArtifactPicker.js +4 -3
- package/dist/ui/AuthScreen.js +2 -1
- package/dist/ui/BgPanel.js +11 -8
- package/dist/ui/Composer.js +4 -3
- package/dist/ui/Header.js +2 -2
- package/dist/ui/Markdown.js +50 -77
- package/dist/ui/PlanPane.js +5 -5
- package/dist/ui/QuestionPrompt.js +2 -1
- package/dist/ui/SecretPrompt.js +2 -1
- package/dist/ui/SessionPicker.js +4 -3
- package/dist/ui/SkillFinder.js +3 -2
- package/dist/ui/StatsCard.js +2 -2
- package/dist/ui/StatusRule.js +2 -2
- package/dist/ui/SummaryCard.js +2 -2
- package/dist/ui/Table.js +25 -24
- package/dist/ui/ThinkingSpinner.js +2 -1
- package/dist/ui/ToolBatch.js +3 -3
- package/dist/ui/ToolStep.js +4 -4
- package/dist/ui/Transcript.js +12 -12
- package/dist/ui/UpdatePrompt.js +2 -1
- package/dist/ui/inline.js +109 -0
- package/dist/ui/reportLine.js +2 -0
- package/dist/ui/slashCommands.js +2 -2
- package/dist/ui/theme.js +4 -0
- package/package.json +1 -1
package/dist/ui/Markdown.js
CHANGED
|
@@ -2,49 +2,60 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
2
2
|
import { Box, Text } from "ink";
|
|
3
3
|
import { termCols } from "./term.js";
|
|
4
4
|
import { parseTable, MarkdownTable } from "./Table.js";
|
|
5
|
-
import {
|
|
6
|
-
import { theme } from "./theme.js";
|
|
5
|
+
import { renderInline, closeOpen } from "./inline.js";
|
|
6
|
+
import { theme, secondary } from "./theme.js";
|
|
7
7
|
import { tokenize } from "./highlight.js";
|
|
8
8
|
import { renderTree } from "./tree.js";
|
|
9
|
-
// Map a highlighter token kind to a theme color (undefined = default fg). Comments
|
|
9
|
+
// Map a highlighter token kind to a theme color (undefined = default fg). Comments render secondary.
|
|
10
10
|
const TOKEN_COLOR = {
|
|
11
11
|
comment: theme.muted, string: theme.success, number: theme.running,
|
|
12
12
|
keyword: theme.accent, call: theme.info, plain: undefined,
|
|
13
13
|
};
|
|
14
|
-
//
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
? _jsx(Text, { color: theme.info, underline: true, children: link(label, url) }, `${kp}l${i++}`)
|
|
33
|
-
: _jsxs(Text, { children: [_jsx(Text, { color: theme.info, underline: true, children: label }), _jsx(Text, { dimColor: true, children: " " + url })] }, `${kp}l${i++}`));
|
|
34
|
-
}
|
|
35
|
-
else if (tok.startsWith("**"))
|
|
36
|
-
nodes.push(_jsx(Text, { bold: true, children: tok.slice(2, -2) }, `${kp}b${i++}`));
|
|
37
|
-
else if (tok.startsWith("`"))
|
|
38
|
-
nodes.push(_jsx(Text, { color: theme.info, children: tok.slice(1, -1) }, `${kp}c${i++}`));
|
|
39
|
-
else if (tok.startsWith("http"))
|
|
40
|
-
nodes.push(_jsx(Text, { color: theme.info, underline: true, children: hyperlinksEnabled() ? link(tok, tok) : tok }, `${kp}u${i++}`));
|
|
41
|
-
else
|
|
42
|
-
nodes.push(_jsx(Text, { italic: true, children: tok.slice(1, -1) }, `${kp}i${i++}`));
|
|
43
|
-
last = m.index + tok.length;
|
|
14
|
+
// One line outside a fence or table: heading, rule, quote, list item or paragraph.
|
|
15
|
+
function renderLine(line, k) {
|
|
16
|
+
const h = /^(#{1,6})\s+(.*?)(?:\s+#+)?\s*$/.exec(line);
|
|
17
|
+
if (h)
|
|
18
|
+
return _jsx(Text, { bold: true, color: theme.accent, children: renderInline(h[2], `h${k}`) }, `h${k}`);
|
|
19
|
+
// Horizontal rule: ---, ***, ___ (3+), possibly spaced. A full-width dim divider.
|
|
20
|
+
if (/^\s*([-*_])(\s*\1){2,}\s*$/.test(line)) {
|
|
21
|
+
return _jsx(Text, { dimColor: true, children: "─".repeat(Math.max(1, termCols() - 1)) }, `hr${k}`);
|
|
22
|
+
}
|
|
23
|
+
// Blockquote: > text (one level; nested > collapse to a single bar). Muted bar + secondary text.
|
|
24
|
+
const q = /^\s*>\s?(.*)$/.exec(line);
|
|
25
|
+
if (q)
|
|
26
|
+
return _jsxs(Text, { children: [_jsx(Text, { color: theme.muted, children: "\u258F " }), _jsx(Text, { ...secondary, children: renderInline(q[1].replace(/^>\s?/, ""), `q${k}`) })] }, `q${k}`);
|
|
27
|
+
// Task list: - [ ] / - [x] (checkbox), before the plain bullet rule.
|
|
28
|
+
const t = /^(\s*)[-*+]\s+\[([ xX])\]\s+(.*)$/.exec(line);
|
|
29
|
+
if (t) {
|
|
30
|
+
const done = t[2].toLowerCase() === "x";
|
|
31
|
+
return _jsxs(Text, { children: [t[1], _jsx(Text, { color: done ? theme.success : theme.muted, children: done ? "☑ " : "☐ " }), renderInline(t[3], `t${k}`)] }, `t${k}`);
|
|
44
32
|
}
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
33
|
+
const b = /^(\s*)[-*+]\s+(.*)$/.exec(line);
|
|
34
|
+
if (b)
|
|
35
|
+
return _jsxs(Text, { children: [b[1], _jsx(Text, { color: theme.info, children: "\u2022 " }), renderInline(b[2], `b${k}`)] }, `b${k}`);
|
|
36
|
+
const n = /^(\s*)(\d+)\.\s+(.*)$/.exec(line);
|
|
37
|
+
if (n)
|
|
38
|
+
return _jsxs(Text, { children: [n[1], _jsxs(Text, { bold: true, children: [n[2], "."] }), " ", renderInline(n[3], `n${k}`)] }, `n${k}`);
|
|
39
|
+
if (line.trim() === "")
|
|
40
|
+
return _jsx(Text, { children: " " }, `s${k}`);
|
|
41
|
+
return _jsx(Text, { children: renderInline(line, `p${k}`) }, `p${k}`);
|
|
42
|
+
}
|
|
43
|
+
const FENCE = /^\s*```/;
|
|
44
|
+
/** A tail of streaming text, styled line for line. It never takes more rows than the raw text, which is what the
|
|
45
|
+
* live frame was measured on. `full` is the whole text the tail ends, to know whether the tail starts in a fence. */
|
|
46
|
+
export function LiveMarkdown({ text, full }) {
|
|
47
|
+
let inFence = full.slice(0, full.length - text.length).split("\n").filter((l) => FENCE.test(l)).length % 2 === 1;
|
|
48
|
+
const lines = text.split("\n");
|
|
49
|
+
return (_jsx(Text, { children: lines.map((line, i) => {
|
|
50
|
+
let node = line;
|
|
51
|
+
if (FENCE.test(line)) {
|
|
52
|
+
inFence = !inFence;
|
|
53
|
+
node = "";
|
|
54
|
+
}
|
|
55
|
+
else if (!inFence)
|
|
56
|
+
node = renderLine(i === lines.length - 1 ? closeOpen(line) : line, i);
|
|
57
|
+
return _jsxs(Text, { children: [node, i < lines.length - 1 ? "\n" : ""] }, i);
|
|
58
|
+
}) }));
|
|
48
59
|
}
|
|
49
60
|
export function Markdown({ content }) {
|
|
50
61
|
const lines = content.split("\n");
|
|
@@ -58,12 +69,12 @@ export function Markdown({ content }) {
|
|
|
58
69
|
const lang = fenceLang;
|
|
59
70
|
if (lang === "tree") {
|
|
60
71
|
// A ```tree block: render the indented outline with box-drawing connectors (dim), not highlighted.
|
|
61
|
-
blocks.push(_jsx(Box, { flexDirection: "column", paddingLeft: 1, children: renderTree(fence.join("\n")).map((l, idx) => _jsx(Text, {
|
|
72
|
+
blocks.push(_jsx(Box, { flexDirection: "column", paddingLeft: 1, children: renderTree(fence.join("\n")).map((l, idx) => _jsx(Text, { ...secondary, children: l.length ? l : " " }, idx)) }, `f${k++}`));
|
|
62
73
|
fence = [];
|
|
63
74
|
fenceLang = "";
|
|
64
75
|
return;
|
|
65
76
|
}
|
|
66
|
-
blocks.push(_jsx(Box, { flexDirection: "column", paddingLeft: 1, children: fence.map((l, idx) => l.length === 0 ? (_jsx(Text, { children: " " }, idx)) : (_jsx(Text, { children: tokenize(l, lang).map((tok, ti) => (_jsx(Text, { color: TOKEN_COLOR[tok.k],
|
|
77
|
+
blocks.push(_jsx(Box, { flexDirection: "column", paddingLeft: 1, children: fence.map((l, idx) => l.length === 0 ? (_jsx(Text, { children: " " }, idx)) : (_jsx(Text, { children: tokenize(l, lang).map((tok, ti) => (_jsx(Text, { color: TOKEN_COLOR[tok.k], ...(tok.k === "comment" ? secondary : {}), children: tok.t }, ti))) }, idx))) }, `f${k++}`));
|
|
67
78
|
fence = [];
|
|
68
79
|
fenceLang = "";
|
|
69
80
|
};
|
|
@@ -91,45 +102,7 @@ export function Markdown({ content }) {
|
|
|
91
102
|
li += table.consumed - 1; // -1: the loop's li++ advances past the last consumed line
|
|
92
103
|
continue;
|
|
93
104
|
}
|
|
94
|
-
|
|
95
|
-
if (h) {
|
|
96
|
-
blocks.push(_jsx(Text, { bold: true, color: theme.accent, children: renderInline(h[2], `h${k}`) }, `h${k++}`));
|
|
97
|
-
continue;
|
|
98
|
-
}
|
|
99
|
-
// Horizontal rule: ---, ***, ___ (3+), possibly spaced. A full-width dim divider.
|
|
100
|
-
if (/^\s*([-*_])(\s*\1){2,}\s*$/.test(line)) {
|
|
101
|
-
const cols = termCols();
|
|
102
|
-
blocks.push(_jsx(Text, { dimColor: true, children: "─".repeat(Math.max(1, cols - 1)) }, `hr${k++}`));
|
|
103
|
-
continue;
|
|
104
|
-
}
|
|
105
|
-
// Blockquote: > text (one level; nested > collapse to a single bar). Dim bar + dim text.
|
|
106
|
-
const q = /^\s*>\s?(.*)$/.exec(line);
|
|
107
|
-
if (q) {
|
|
108
|
-
blocks.push(_jsxs(Text, { children: [_jsx(Text, { color: theme.muted, children: "\u258F " }), _jsx(Text, { dimColor: true, children: renderInline(q[1].replace(/^>\s?/, ""), `q${k}`) })] }, `q${k++}`));
|
|
109
|
-
continue;
|
|
110
|
-
}
|
|
111
|
-
// Task list: - [ ] / - [x] (checkbox), before the plain bullet rule.
|
|
112
|
-
const t = /^(\s*)[-*+]\s+\[([ xX])\]\s+(.*)$/.exec(line);
|
|
113
|
-
if (t) {
|
|
114
|
-
const done = t[2].toLowerCase() === "x";
|
|
115
|
-
blocks.push(_jsxs(Text, { children: [t[1], _jsx(Text, { color: done ? theme.success : theme.muted, children: done ? "☑ " : "☐ " }), renderInline(t[3], `t${k}`)] }, `t${k++}`));
|
|
116
|
-
continue;
|
|
117
|
-
}
|
|
118
|
-
const b = /^(\s*)[-*+]\s+(.*)$/.exec(line);
|
|
119
|
-
if (b) {
|
|
120
|
-
blocks.push(_jsxs(Text, { children: [b[1], _jsx(Text, { color: theme.info, children: "\u2022 " }), renderInline(b[2], `b${k}`)] }, `b${k++}`));
|
|
121
|
-
continue;
|
|
122
|
-
}
|
|
123
|
-
const n = /^(\s*)(\d+)\.\s+(.*)$/.exec(line);
|
|
124
|
-
if (n) {
|
|
125
|
-
blocks.push(_jsxs(Text, { children: [n[1], _jsxs(Text, { bold: true, children: [n[2], "."] }), " ", renderInline(n[3], `n${k}`)] }, `n${k++}`));
|
|
126
|
-
continue;
|
|
127
|
-
}
|
|
128
|
-
if (line.trim() === "") {
|
|
129
|
-
blocks.push(_jsx(Text, { children: " " }, `s${k++}`));
|
|
130
|
-
continue;
|
|
131
|
-
}
|
|
132
|
-
blocks.push(_jsx(Text, { children: renderInline(line, `p${k}`) }, `p${k++}`));
|
|
105
|
+
blocks.push(renderLine(line, k++));
|
|
133
106
|
}
|
|
134
107
|
if (inFence && fence.length)
|
|
135
108
|
flushFence();
|
package/dist/ui/PlanPane.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { Box, Text } from "ink";
|
|
3
|
-
import { theme } from "./theme.js";
|
|
3
|
+
import { theme, secondary } from "./theme.js";
|
|
4
4
|
import { termCols } from "./term.js";
|
|
5
5
|
import { cellWidth, truncateToWidth } from "./StatusRule.js";
|
|
6
6
|
import { fitSegments, seg } from "./fit.js";
|
|
@@ -100,13 +100,13 @@ export function PlanPane({ tasks, title = "plan", now = Date.now() }) {
|
|
|
100
100
|
return null;
|
|
101
101
|
const cols = termCols();
|
|
102
102
|
if (cols < PLAN_ONE_LINE_COLS)
|
|
103
|
-
return _jsx(Text, {
|
|
103
|
+
return _jsx(Text, { ...secondary, children: planOneLine(tasks, cols) });
|
|
104
104
|
// Borderless: this pane renders in Ink's DYNAMIC region; a box border there orphans its rows into
|
|
105
105
|
// scrollback whenever the Static transcript grows during a long turn (the v0.1.92 line-flood). The
|
|
106
106
|
// dim header labels the group without a border.
|
|
107
107
|
const { shown, hidden } = visiblePlan(tasks);
|
|
108
|
-
return (_jsxs(Box, { flexDirection: "column", paddingLeft: 1, children: [_jsx(Text, {
|
|
108
|
+
return (_jsxs(Box, { flexDirection: "column", paddingLeft: 1, children: [_jsx(Text, { ...secondary, children: `${title} · ${planProgress(tasks)}` }), shown.map((t) => {
|
|
109
109
|
const { text, pad, dur } = planRow(t, cols, now);
|
|
110
|
-
return (_jsxs(Text, { wrap: "truncate-end", children: [_jsxs(Text, { color: COLOR[t.status], children: [GLYPH[t.status], " "] }), _jsx(Text, {
|
|
111
|
-
}), hidden > 0 ? _jsx(Text, {
|
|
110
|
+
return (_jsxs(Text, { wrap: "truncate-end", children: [_jsxs(Text, { color: COLOR[t.status], children: [GLYPH[t.status], " "] }), _jsx(Text, { ...(finished(t) ? secondary : {}), strikethrough: finished(t), children: text }), dur ? _jsxs(Text, { ...secondary, children: [pad, dur] }) : null] }, t.id));
|
|
111
|
+
}), hidden > 0 ? _jsx(Text, { ...secondary, children: ` +${hidden} more` }) : null] }));
|
|
112
112
|
}
|
|
@@ -8,6 +8,7 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
8
8
|
import { useEffect, useRef, useState } from "react";
|
|
9
9
|
import { Box, Text, useInput, measureElement } from "ink";
|
|
10
10
|
import { useClickList } from "./MouseProvider.js";
|
|
11
|
+
import { secondary } from "./theme.js";
|
|
11
12
|
// The always-present final choice. Selecting it lets the owner type their own reply (or just talk it
|
|
12
13
|
// through) instead of picking one of the model's options — so every prompt has an out.
|
|
13
14
|
export const CHAT_LABEL = "Chat about it — type your own reply";
|
|
@@ -128,5 +129,5 @@ export function QuestionPrompt({ pending, suspended = false, waiting }) {
|
|
|
128
129
|
if (!pending)
|
|
129
130
|
return null;
|
|
130
131
|
const chatIndex = pending.options.length; // 0-based highlight index for the chat escape
|
|
131
|
-
return (_jsxs(Box, { flexDirection: "column", marginTop: 1, marginBottom: 1, borderStyle: "round", borderColor: "cyan", paddingX: 1, children: [_jsx(Box, { ref: qRef, children: _jsxs(Text, { color: "cyan", bold: true, children: ["? ", _jsx(Text, { color: "white", children: pending.question })] }) }), pending.options.map((o, i) => (_jsxs(Text, { children: [" ", st.mode === "choose" && st.highlight === i ? _jsx(Text, { color: "cyan", bold: true, children: "❯ " }) : _jsx(Text, { children: " " }), _jsx(Text, { color: "cyan", children: multi ? (st.selected?.includes(i) ? "[x]" : "[ ]") : `[${i + 1}]` }), " ", _jsx(Text, { bold: st.mode === "choose" && st.highlight === i, children: o })] }, i))), _jsxs(Text, { children: [" ", st.mode === "choose" && st.highlight === chatIndex ? _jsx(Text, { color: "cyan", bold: true, children: "❯ " }) : _jsx(Text, { children: " " }), _jsxs(Text, { color: "cyan", children: ["[", chatIndex + 1, "]"] }), " ", _jsx(Text, { color: "magenta", bold: st.mode === "choose" && st.highlight === chatIndex, children: CHAT_LABEL })] }), suspended ? (_jsx(Text, {
|
|
132
|
+
return (_jsxs(Box, { flexDirection: "column", marginTop: 1, marginBottom: 1, borderStyle: "round", borderColor: "cyan", paddingX: 1, children: [_jsx(Box, { ref: qRef, children: _jsxs(Text, { color: "cyan", bold: true, children: ["? ", _jsx(Text, { color: "white", children: pending.question })] }) }), pending.options.map((o, i) => (_jsxs(Text, { children: [" ", st.mode === "choose" && st.highlight === i ? _jsx(Text, { color: "cyan", bold: true, children: "❯ " }) : _jsx(Text, { children: " " }), _jsx(Text, { color: "cyan", children: multi ? (st.selected?.includes(i) ? "[x]" : "[ ]") : `[${i + 1}]` }), " ", _jsx(Text, { bold: st.mode === "choose" && st.highlight === i, children: o })] }, i))), _jsxs(Text, { children: [" ", st.mode === "choose" && st.highlight === chatIndex ? _jsx(Text, { color: "cyan", bold: true, children: "❯ " }) : _jsx(Text, { children: " " }), _jsxs(Text, { color: "cyan", children: ["[", chatIndex + 1, "]"] }), " ", _jsx(Text, { color: "magenta", bold: st.mode === "choose" && st.highlight === chatIndex, children: CHAT_LABEL })] }), suspended ? (_jsx(Text, { ...secondary, children: " waiting · " + (waiting ?? "another prompt has the keyboard") })) : st.mode === "type" ? (_jsxs(Box, { flexDirection: "column", marginTop: 1, children: [_jsxs(Text, { children: [_jsx(Text, { color: "magenta", children: "› " }), st.buffer, _jsx(Text, { color: "cyan", children: "\u258C" })] }), _jsx(Text, { ...secondary, children: " type your reply · Enter to send · Esc for the menu" })] })) : multi ? (_jsxs(Text, { ...secondary, children: [" ↑/↓ to move · Space (or 1-", chatIndex, ") to toggle · Enter to confirm · ", chatIndex + 1, " to type your own · Esc to close"] })) : (_jsxs(Text, { ...secondary, children: [" ↑/↓ to move · Enter to pick · or press 1-", chatIndex + 1, " to jump · Esc to close"] }))] }));
|
|
132
133
|
}
|
package/dist/ui/SecretPrompt.js
CHANGED
|
@@ -6,6 +6,7 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
6
6
|
// the audit trail or a log, and the frame is drawn from its LENGTH alone, so no character of it can ever be shown.
|
|
7
7
|
import { useEffect, useRef, useState } from "react";
|
|
8
8
|
import { Box, Text, useInput } from "ink";
|
|
9
|
+
import { secondary } from "./theme.js";
|
|
9
10
|
// A paste arrives inside bracketed-paste markers (Ink strips a chunk's leading ESC, so "[200~" can lead it), often with a
|
|
10
11
|
// trailing newline; no vendor key carries whitespace or a control character, so all of that is dropped.
|
|
11
12
|
const PASTE_MARKER = /\x1b?\[20[01]~/g;
|
|
@@ -78,5 +79,5 @@ export function SecretPrompt({ pending, suspended = false }) {
|
|
|
78
79
|
}, { isActive: !!pending && !suspended });
|
|
79
80
|
if (!pending)
|
|
80
81
|
return null;
|
|
81
|
-
return (_jsxs(Box, { flexDirection: "column", marginTop: 1, marginBottom: 1, borderStyle: "round", borderColor: "cyan", paddingX: 1, children: [_jsxs(Text, { color: "cyan", bold: true, children: ["? ", _jsx(Text, { color: "white", children: pending.title })] }), _jsxs(Text, { children: [" ", _jsx(Text, { color: "magenta", children: "› " }), maskFor(size), _jsx(Text, { color: "cyan", children: "\u258C" }), size ? _jsx(Text, {
|
|
82
|
+
return (_jsxs(Box, { flexDirection: "column", marginTop: 1, marginBottom: 1, borderStyle: "round", borderColor: "cyan", paddingX: 1, children: [_jsxs(Text, { color: "cyan", bold: true, children: ["? ", _jsx(Text, { color: "white", children: pending.title })] }), _jsxs(Text, { children: [" ", _jsx(Text, { color: "magenta", children: "› " }), maskFor(size), _jsx(Text, { color: "cyan", children: "\u258C" }), size ? _jsx(Text, { ...secondary, children: ` ${size} characters` }) : null] }), _jsx(Text, { ...secondary, children: " Enter to store · Esc to cancel · ctrl+u to clear — the key is never shown or logged" })] }));
|
|
82
83
|
}
|
package/dist/ui/SessionPicker.js
CHANGED
|
@@ -8,6 +8,7 @@ import { jsxs as _jsxs, jsx as _jsx } from "react/jsx-runtime";
|
|
|
8
8
|
import { useEffect, useRef, useState } from "react";
|
|
9
9
|
import { Box, Text, useInput } from "ink";
|
|
10
10
|
import { SESSION_SCOPES, metaLine, roleLabel } from "../memory/session-catalog.js";
|
|
11
|
+
import { secondary } from "./theme.js";
|
|
11
12
|
const VISIBLE = 5; // sessions on screen (3 lines each); the list scrolls within it
|
|
12
13
|
const SCOPE_LABEL = { workspace: "Workspace", project: "Project", all: "All" };
|
|
13
14
|
// Pure keystroke reducer: next state and/or an intent. Any query or scope change re-runs the search.
|
|
@@ -79,8 +80,8 @@ export function SessionPicker({ pending, suspended = false }) {
|
|
|
79
80
|
return null;
|
|
80
81
|
const { loading, error, note } = pending;
|
|
81
82
|
const { start, end } = windowFor(n, hi);
|
|
82
|
-
return (_jsxs(Box, { flexDirection: "column", marginTop: 1, marginBottom: 1, borderStyle: "round", borderColor: "cyan", paddingX: 1, children: [_jsxs(Text, { color: "cyan", bold: true, children: ["◆ Agent sessions ", SESSION_SCOPES.map((sc) => (_jsxs(Text, { color: sc === st.scope ? "cyan" : undefined, bold: sc === st.scope, dimColor: sc !== st.scope, children: [sc === st.scope ? `[${SCOPE_LABEL[sc]}]` : ` ${SCOPE_LABEL[sc]} `, " "] }, sc))), _jsx(Text, {
|
|
83
|
+
return (_jsxs(Box, { flexDirection: "column", marginTop: 1, marginBottom: 1, borderStyle: "round", borderColor: "cyan", paddingX: 1, children: [_jsxs(Text, { color: "cyan", bold: true, children: ["◆ Agent sessions ", SESSION_SCOPES.map((sc) => (_jsxs(Text, { color: sc === st.scope ? "cyan" : undefined, bold: sc === st.scope, dimColor: sc !== st.scope, children: [sc === st.scope ? `[${SCOPE_LABEL[sc]}]` : ` ${SCOPE_LABEL[sc]} `, " "] }, sc))), _jsx(Text, { ...secondary, children: loading ? "indexing…" : `${n} session${n === 1 ? "" : "s"} · newest first` })] }), _jsxs(Text, { children: [_jsx(Text, { color: "magenta", children: "search› " }), st.query, _jsx(Text, { color: "cyan", children: "\u258C" })] }), error ? _jsx(Text, { color: "red", children: " " + error }) : null, !loading && !error && n === 0 ? (_jsx(Text, { ...secondary, children: st.query ? ` no session in ${SCOPE_LABEL[st.scope]} mentions "${st.query}" — Tab widens the scope` : ` no sessions in ${SCOPE_LABEL[st.scope]} yet — Tab widens the scope` })) : null, items.slice(start, end).map((it, i) => {
|
|
83
84
|
const sel = start + i === hi;
|
|
84
|
-
return (_jsxs(Box, { flexDirection: "column", children: [_jsxs(Text, { children: [sel ? _jsx(Text, { color: "cyan", bold: true, children: "❯ " }) : _jsx(Text, { children: " " }), _jsx(Text, { bold: sel, children: it.title }), _jsx(Text, {
|
|
85
|
-
}), n > end ? _jsx(Text, {
|
|
85
|
+
return (_jsxs(Box, { flexDirection: "column", children: [_jsxs(Text, { children: [sel ? _jsx(Text, { color: "cyan", bold: true, children: "❯ " }) : _jsx(Text, { children: " " }), _jsx(Text, { bold: sel, children: it.title }), _jsx(Text, { ...secondary, children: " " + metaLine(it) })] }), _jsx(Text, { ...secondary, wrap: "truncate-end", children: " " + (it.snippet ? `${roleLabel(it.role)}${it.role ? ": " : ""}${it.snippet}` : "") }), _jsxs(Text, { ...secondary, wrap: "truncate-end", children: [" " + (it.cwd ?? ""), it.gone ? _jsx(Text, { color: "yellow", children: " folder gone" }) : null] })] }, it.id));
|
|
86
|
+
}), n > end ? _jsx(Text, { ...secondary, children: ` ⋯ +${n - end} more` }) : null, note ? _jsx(Text, { color: "green", children: " " + note }) : null, _jsx(Text, { ...secondary, children: " type to search · Tab scope · ↑/↓ move · Enter open · Esc clear/close" })] }));
|
|
86
87
|
}
|
package/dist/ui/SkillFinder.js
CHANGED
|
@@ -11,6 +11,7 @@ import { fitSegments, seg } from "./fit.js";
|
|
|
11
11
|
import { fitWithTail } from "./fitTail.js";
|
|
12
12
|
import { termCols } from "./term.js";
|
|
13
13
|
import { typedText } from "./SecretPrompt.js";
|
|
14
|
+
import { secondary } from "./theme.js";
|
|
14
15
|
export const FINDER_ROWS = 7;
|
|
15
16
|
const PREVIEW_ROWS = 4;
|
|
16
17
|
/** A typed or pasted chunk as one-line field text: the paste markers and terminal reports out (review F9), line breaks
|
|
@@ -144,10 +145,10 @@ export function SkillFinder({ pending }) {
|
|
|
144
145
|
const shown = items.slice(start, start + FINDER_ROWS);
|
|
145
146
|
const pad = FINDER_ROWS - shown.length;
|
|
146
147
|
const creating = st.mode !== "search";
|
|
147
|
-
return (_jsxs(Box, { flexDirection: "column", marginTop: 1, marginBottom: 1, borderStyle: "round", borderColor: "cyan", paddingX: 1, children: [_jsx(Text, { color: "cyan", bold: true, children: fitSegments([seg("◆ Skills & tools"), seg(pending.sizes ? ` ${pending.sizes}` : "", 1)], width + 1, { sep: "" }) }), creating ? (_jsxs(_Fragment, { children: [_jsxs(Text, { children: [_jsx(Text, { color: "magenta", children: "new skill› " }), st.mode === "name" ? _jsxs(_Fragment, { children: [st.name, _jsx(Text, { color: "cyan", children: "\u258C" })] }) : st.name] }), _jsxs(Text, { children: [_jsx(Text, { color: "magenta", children: " what for› " }), st.mode === "desc" ? _jsxs(_Fragment, { children: [st.desc, _jsx(Text, { color: "cyan", children: "\u258C" })] }) : _jsx(Text, {
|
|
148
|
+
return (_jsxs(Box, { flexDirection: "column", marginTop: 1, marginBottom: 1, borderStyle: "round", borderColor: "cyan", paddingX: 1, children: [_jsx(Text, { color: "cyan", bold: true, children: fitSegments([seg("◆ Skills & tools"), seg(pending.sizes ? ` ${pending.sizes}` : "", 1)], width + 1, { sep: "" }) }), creating ? (_jsxs(_Fragment, { children: [_jsxs(Text, { children: [_jsx(Text, { color: "magenta", children: "new skill› " }), st.mode === "name" ? _jsxs(_Fragment, { children: [st.name, _jsx(Text, { color: "cyan", children: "\u258C" })] }) : st.name] }), _jsxs(Text, { children: [_jsx(Text, { color: "magenta", children: " what for› " }), st.mode === "desc" ? _jsxs(_Fragment, { children: [st.desc, _jsx(Text, { color: "cyan", children: "\u258C" })] }) : _jsx(Text, { ...secondary, children: st.desc || "(Enter to write what it is for)" })] })] })) : (_jsxs(Text, { children: [_jsx(Text, { color: "magenta", children: "search› " }), st.query, _jsx(Text, { color: "cyan", children: "\u258C" })] })), shown.map((it, i) => {
|
|
148
149
|
const sel = start + i === hi && !creating;
|
|
149
150
|
return _jsx(Text, { bold: sel, color: sel ? "cyan" : undefined, dimColor: !sel && it.source === "tool", children: finderRow(it, sel, width) }, `${it.source}:${it.id}`);
|
|
150
|
-
}), Array.from({ length: pad }, (_, i) => _jsx(Text, { children: i === 0 && n === 0 ? (st.query ? ` nothing matches "${st.query}" yet` : " type to search") : " " }, `pad${i}`)), _jsx(Text, {
|
|
151
|
+
}), Array.from({ length: pad }, (_, i) => _jsx(Text, { children: i === 0 && n === 0 ? (st.query ? ` nothing matches "${st.query}" yet` : " type to search") : " " }, `pad${i}`)), _jsx(Text, { ...secondary, children: fitSegments([seg(pending.status ? ` ${pending.status}` : " "), seg(n > FINDER_ROWS ? ` · ${hi + 1}/${n}` : "")], width + 1, { sep: "" }) }), previewLines(creating ? undefined : items[hi], pending.preview, st.expanded, width).map((l, i) => _jsx(Text, { ...(!st.expanded ? secondary : {}), children: l || " " }, `pv${i}`)), pending.note ? _jsx(Text, { color: "green", children: fitSegments([seg(pending.note)], width + 1, { lead: " " }) }) : _jsx(Text, { children: " " }), _jsx(Text, { ...secondary, children: fitSegments([seg(creating
|
|
151
152
|
? (st.mode === "name" ? "name it · Enter next · Esc back" : "what it is for · Enter: I draft it with the model · Tab: save the skeleton now · Esc back")
|
|
152
153
|
: "type to search · ↑/↓ move · → preview · ⏎ use · ctrl+r run with your words · ctrl+n new skill · esc close")], width + 1, { lead: " " }) })] }));
|
|
153
154
|
}
|
package/dist/ui/StatsCard.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { Box, Text } from "ink";
|
|
3
|
-
import { theme } from "./theme.js";
|
|
3
|
+
import { theme, secondary } from "./theme.js";
|
|
4
4
|
import { sparkline, bar } from "./chart.js";
|
|
5
5
|
const fmtTok = (n) => (n >= 1_000_000 ? `${(n / 1e6).toFixed(1)}M` : n >= 1000 ? `${(n / 1000).toFixed(1)}k` : `${n}`);
|
|
6
6
|
/** The one-line summary (pure, testable): turns · tools · tokens · avg tok/s. */
|
|
@@ -11,5 +11,5 @@ export function statsLine(s) {
|
|
|
11
11
|
export function StatsCard({ stats }) {
|
|
12
12
|
const tps = stats.tokPerSec;
|
|
13
13
|
const last = tps.length ? tps[tps.length - 1] : 0;
|
|
14
|
-
return (_jsxs(Box, { flexDirection: "column", borderStyle: "round", borderColor: theme.muted, paddingX: 1, children: [_jsxs(Text, { children: [_jsx(Text, { color: theme.accent, children: "\u2726 " }), _jsx(Text, { bold: true, children: "session stats" }), _jsx(Text, {
|
|
14
|
+
return (_jsxs(Box, { flexDirection: "column", borderStyle: "round", borderColor: theme.muted, paddingX: 1, children: [_jsxs(Text, { children: [_jsx(Text, { color: theme.accent, children: "\u2726 " }), _jsx(Text, { bold: true, children: "session stats" }), _jsx(Text, { ...secondary, children: ` ${statsLine(stats)}` })] }), tps.length > 1 ? (_jsxs(Text, { ...secondary, children: ["throughput ", _jsx(Text, { color: theme.info, children: sparkline(tps) }), ` ${last} tok/s now`] })) : null, _jsxs(Text, { ...secondary, children: ["context ", _jsx(Text, { color: stats.ctxPct > 80 ? theme.warn : theme.success, children: bar(stats.ctxPct, 100, 12) }), ` ${Math.round(stats.ctxPct)}%`] })] }));
|
|
15
15
|
}
|
package/dist/ui/StatusRule.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { Box, Text } from "ink";
|
|
3
3
|
import { termCols } from "./term.js";
|
|
4
|
-
import { theme } from "./theme.js";
|
|
4
|
+
import { theme, secondary } from "./theme.js";
|
|
5
5
|
import { ring } from "./chart.js";
|
|
6
6
|
import { opsModeOn } from "./opsMode.js";
|
|
7
7
|
import { shownModelLabel } from "../engine/identity.js";
|
|
@@ -95,5 +95,5 @@ export function StatusRule(props) {
|
|
|
95
95
|
const fill = ruleFill(right, cols);
|
|
96
96
|
// Enterprise header: a dim rule sweeping to a magenta ✷ mark + bright OPERATOR wordmark + dim info,
|
|
97
97
|
// sitting just above the composer (the input is bounded between this and the InputRule below).
|
|
98
|
-
return (_jsxs(Box, { children: [_jsx(Text, { dimColor: true, children: "─".repeat(fill) + " " }), _jsx(Text, { color: theme.accent, children: "\u2737 " }), _jsx(Text, { bold: true, children: ops ? "OPS" : "OPERATOR" }), _jsx(Text, {
|
|
98
|
+
return (_jsxs(Box, { children: [_jsx(Text, { dimColor: true, children: "─".repeat(fill) + " " }), _jsx(Text, { color: theme.accent, children: "\u2737 " }), _jsx(Text, { bold: true, children: ops ? "OPS" : "OPERATOR" }), _jsx(Text, { ...secondary, children: ` · ${info} ─` })] }));
|
|
99
99
|
}
|
package/dist/ui/SummaryCard.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { Box, Text } from "ink";
|
|
3
|
-
import { theme } from "./theme.js";
|
|
3
|
+
import { theme, secondary } from "./theme.js";
|
|
4
4
|
import { termCols } from "./term.js";
|
|
5
5
|
import { ledgerLines, repetitionLine } from "./turnLedger.js";
|
|
6
6
|
const fmtDur = (ms) => (ms < 1000 ? `${Math.round(ms)}ms` : ms < 60_000 ? `${(ms / 1000).toFixed(1)}s` : `${Math.floor(ms / 60_000)}m ${Math.round((ms % 60_000) / 1000)}s`);
|
|
@@ -16,5 +16,5 @@ export function summaryLine(s) {
|
|
|
16
16
|
return parts.join(" · ");
|
|
17
17
|
}
|
|
18
18
|
export function SummaryCard({ summary }) {
|
|
19
|
-
return (_jsxs(Box, { flexDirection: "column", borderStyle: "round", borderColor: theme.muted, paddingX: 1, children: [_jsxs(Text, { children: [_jsx(Text, { color: theme.accent, children: "\u2726 " }), _jsx(Text, { bold: true, children: "turn complete" }), _jsx(Text, {
|
|
19
|
+
return (_jsxs(Box, { flexDirection: "column", borderStyle: "round", borderColor: theme.muted, paddingX: 1, children: [_jsxs(Text, { children: [_jsx(Text, { color: theme.accent, children: "\u2726 " }), _jsx(Text, { bold: true, children: "turn complete" }), _jsx(Text, { ...secondary, children: ` ${summaryLine(summary)}` })] }), summary.time ? ledgerLines(summary.time, summary.time, termCols() - 5).map((l, i) => (_jsxs(Text, { ...secondary, children: [" ", _jsx(Text, { color: i === 0 ? theme.info : undefined, children: l.slice(0, 4) }), l.slice(4)] }, `t${i}`))) : null, summary.lastRound ? _jsx(Text, { ...secondary, children: " " + repetitionLine(summary.lastRound.chars, summary.lastRound.ms, termCols() - 6) }) : null, summary.unverified ? (_jsx(Text, { color: theme.warn, children: "\u26A0 changed files \u00B7 not verified (no passing check ran)" })) : null] }));
|
|
20
20
|
}
|
package/dist/ui/Table.js
CHANGED
|
@@ -3,14 +3,13 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
3
3
|
// present structured comparisons — flags, options, before/after, cost breakdowns — and prose bullet-soup
|
|
4
4
|
// buries that. This renders a `| a | b |` / `|---|` block as a box-drawn, column-aligned Ink table.
|
|
5
5
|
// Rendered ONLY on settled transcript entries (Markdown is), so it never fights the live per-token stream.
|
|
6
|
-
// Dependency-free;
|
|
7
|
-
// keeps the status rule from wrapping) so a double-width glyph never skews a column. CLI-only.
|
|
6
|
+
// Dependency-free; cells are parsed as inline markdown and measured and wrapped on their visible text. CLI-only.
|
|
8
7
|
import React from "react";
|
|
9
8
|
import { Box, Text } from "ink";
|
|
10
9
|
import { termCols } from "./term.js";
|
|
11
|
-
import {
|
|
10
|
+
import { parseInline, renderSpans, spansWidth, wrapSpans } from "./inline.js";
|
|
12
11
|
import { theme } from "./theme.js";
|
|
13
|
-
const MIN_COL = 3; // never shrink a column below this many cells
|
|
12
|
+
const MIN_COL = 3; // never shrink a column below this many cells
|
|
14
13
|
// A line is table-ish if it has at least one unescaped pipe with content around it.
|
|
15
14
|
function looksLikeRow(line) {
|
|
16
15
|
return line.includes("|") && line.trim().length > 0;
|
|
@@ -60,9 +59,10 @@ export function parseTable(lines, start) {
|
|
|
60
59
|
}
|
|
61
60
|
return { header, aligns, rows, consumed: i - start };
|
|
62
61
|
}
|
|
63
|
-
|
|
62
|
+
const visibleWidth = (cell) => spansWidth(parseInline(cell));
|
|
63
|
+
/** Natural column widths = the widest visible cell (header or body) per column, measured in terminal cells. */
|
|
64
64
|
export function naturalWidths(t) {
|
|
65
|
-
return t.header.map((h, c) => Math.max(
|
|
65
|
+
return t.header.map((h, c) => Math.max(visibleWidth(h), ...t.rows.map((r) => visibleWidth(r[c] ?? ""))));
|
|
66
66
|
}
|
|
67
67
|
/** Shrink column widths so the whole table fits `maxWidth` terminal cells, trimming the widest columns
|
|
68
68
|
* first and never below MIN_COL. Pure so the fit is unit-testable. Frame per row = 1 leading '│' plus
|
|
@@ -85,30 +85,31 @@ export function fitWidths(natural, maxWidth) {
|
|
|
85
85
|
}
|
|
86
86
|
return w;
|
|
87
87
|
}
|
|
88
|
-
/**
|
|
89
|
-
export function
|
|
90
|
-
const
|
|
91
|
-
const
|
|
92
|
-
|
|
93
|
-
return t;
|
|
94
|
-
if (align === "right")
|
|
95
|
-
return " ".repeat(gap) + t;
|
|
96
|
-
if (align === "center") {
|
|
97
|
-
const left = Math.floor(gap / 2);
|
|
98
|
-
return " ".repeat(left) + t + " ".repeat(gap - left);
|
|
99
|
-
}
|
|
100
|
-
return t + " ".repeat(gap);
|
|
88
|
+
/** The blanks left and right of a `used`-cell line in a `width`-cell column. */
|
|
89
|
+
export function padding(used, width, align) {
|
|
90
|
+
const gap = Math.max(0, width - used);
|
|
91
|
+
const left = align === "right" ? gap : align === "center" ? Math.floor(gap / 2) : 0;
|
|
92
|
+
return [" ".repeat(left), " ".repeat(gap - left)];
|
|
101
93
|
}
|
|
102
|
-
// Box-drawing rule pieces (all
|
|
94
|
+
// Box-drawing rule pieces (all one cell wide).
|
|
103
95
|
function rule(widths, left, mid, right, fill = "─") {
|
|
104
96
|
return left + widths.map((w) => fill.repeat(w + 2)).join(mid) + right;
|
|
105
97
|
}
|
|
106
98
|
export function MarkdownTable({ table }) {
|
|
107
|
-
const
|
|
108
|
-
const widths = fitWidths(naturalWidths(table),
|
|
99
|
+
const room = Math.max(20, termCols() - 1);
|
|
100
|
+
const widths = fitWidths(naturalWidths(table), room);
|
|
109
101
|
const top = rule(widths, "┌", "┬", "┐");
|
|
102
|
+
const fits = top.length <= room; // too many columns for the window: Ink wraps the grid, so leave the extra rules out
|
|
110
103
|
const sep = rule(widths, "├", "┼", "┤");
|
|
111
104
|
const bot = rule(widths, "└", "┴", "┘");
|
|
112
|
-
const dataRow = (cells,
|
|
113
|
-
|
|
105
|
+
const dataRow = (cells, head, key) => {
|
|
106
|
+
const wrapped = widths.map((w, c) => wrapSpans(parseInline(cells[c] ?? "", head ? { bold: true } : {}), w));
|
|
107
|
+
const height = Math.max(...wrapped.map((lines) => lines.length));
|
|
108
|
+
return Array.from({ length: height }, (_, l) => (_jsxs(Text, { children: [_jsx(Text, { color: theme.muted, children: "\u2502" }), widths.map((w, c) => {
|
|
109
|
+
const spans = wrapped[c][l] ?? [];
|
|
110
|
+
const [left, right] = padding(spansWidth(spans), w, head ? "center" : table.aligns[c] ?? "left");
|
|
111
|
+
return (_jsxs(React.Fragment, { children: [_jsx(Text, { children: " " + left }), renderSpans(spans, `${key}.${l}.${c}`), _jsx(Text, { children: right + " " }), _jsx(Text, { color: theme.muted, children: "\u2502" })] }, c));
|
|
112
|
+
})] }, `${key}.${l}`)));
|
|
113
|
+
};
|
|
114
|
+
return (_jsxs(Box, { flexDirection: "column", children: [_jsx(Text, { color: theme.muted, children: top }), dataRow(table.header, true, "th"), _jsx(Text, { color: theme.muted, children: sep }), table.rows.map((r, i) => (_jsxs(React.Fragment, { children: [i > 0 && fits ? _jsx(Text, { color: theme.muted, children: sep }) : null, dataRow(r, false, `tr${i}`)] }, `tr${i}`))), _jsx(Text, { color: theme.muted, children: bot })] }));
|
|
114
115
|
}
|
|
@@ -9,6 +9,7 @@ import { Box, Text } from "ink";
|
|
|
9
9
|
import { ShimmerText, PEARL } from "./shimmer.js";
|
|
10
10
|
import { termCols } from "./term.js";
|
|
11
11
|
import { cellWidth, truncateToWidth } from "./StatusRule.js";
|
|
12
|
+
import { secondary } from "./theme.js";
|
|
12
13
|
const DEFAULT_VERBS = [
|
|
13
14
|
"Thinking", "Reasoning", "Noodling", "Synthesizing", "Percolating", "Untangling", "Weighing",
|
|
14
15
|
];
|
|
@@ -73,5 +74,5 @@ metrics, }) {
|
|
|
73
74
|
const label = spinnerLabel(verb ?? verbs[verbIdx % verbs.length], termCols(), metrics);
|
|
74
75
|
// Star keeps its amber tone animation; the VERB now carries a pearl (slate→white) shimmer sweep driven by the
|
|
75
76
|
// same tick — the continuous light replaces the old tone-flash as the "alive" cue.
|
|
76
|
-
return (_jsxs(Box, { children: [_jsxs(Text, { color: style.color, bold: style.bold, dimColor: style.dim, children: [glyph, " "] }), _jsx(ShimmerText, { text: label, frame: tick, palette: PEARL }), metrics ? _jsx(Text, {
|
|
77
|
+
return (_jsxs(Box, { children: [_jsxs(Text, { color: style.color, bold: style.bold, dimColor: style.dim, children: [glyph, " "] }), _jsx(ShimmerText, { text: label, frame: tick, palette: PEARL }), metrics ? _jsx(Text, { ...secondary, children: " " + metrics }) : null] }));
|
|
77
78
|
}
|
package/dist/ui/ToolBatch.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { Box, Text } from "ink";
|
|
3
|
-
import { theme } from "./theme.js";
|
|
3
|
+
import { theme, secondary } from "./theme.js";
|
|
4
4
|
import { ToolStep } from "./ToolStep.js";
|
|
5
5
|
import { termCols } from "./term.js";
|
|
6
6
|
import { batchChips } from "./batchLine.js";
|
|
@@ -13,9 +13,9 @@ export function batchHeader(count, durationMs) {
|
|
|
13
13
|
const TONE = { done: theme.success, error: theme.error, blocked: theme.blocked, cancelled: theme.muted };
|
|
14
14
|
export function ToolBatch({ steps, durationMs, expanded }) {
|
|
15
15
|
if (expanded) {
|
|
16
|
-
return (_jsxs(Box, { flexDirection: "column", borderStyle: "round", borderColor: theme.muted, paddingX: 1, children: [_jsxs(Text, { children: [_jsx(Text, { color: theme.accent, children: "\u21C9 " }), _jsx(Text, { bold: true, children: `${steps.length} tools in parallel` }), _jsx(Text, {
|
|
16
|
+
return (_jsxs(Box, { flexDirection: "column", borderStyle: "round", borderColor: theme.muted, paddingX: 1, children: [_jsxs(Text, { children: [_jsx(Text, { color: theme.accent, children: "\u21C9 " }), _jsx(Text, { bold: true, children: `${steps.length} tools in parallel` }), _jsx(Text, { ...secondary, children: ` ${fmtDur(durationMs)}` })] }), steps.map((step) => _jsx(ToolStep, { step: step }, step.id))] }));
|
|
17
17
|
}
|
|
18
18
|
const { head, chips, folded, hint } = batchChips(steps, durationMs, termCols());
|
|
19
19
|
const broken = steps.filter((s) => s.status === "error");
|
|
20
|
-
return (_jsxs(Box, { flexDirection: "column", children: [_jsxs(Text, { children: [_jsx(Text, { color: theme.accent, children: head.slice(0, 2) }), _jsx(Text, {
|
|
20
|
+
return (_jsxs(Box, { flexDirection: "column", children: [_jsxs(Text, { children: [_jsx(Text, { color: theme.accent, children: head.slice(0, 2) }), _jsx(Text, { ...secondary, children: head.slice(2) }), chips.map((c, i) => (_jsxs(Text, { children: [" ", _jsx(Text, { color: TONE[c.tone], children: c.glyph }), " ", _jsx(Text, { color: KIND_HUE[toolKind(c.name)], children: c.label })] }, i))), folded ? _jsx(Text, { ...secondary, children: ` ${folded}` }) : null, hint ? _jsx(Text, { color: theme.info, children: ` ${hint}` }) : null] }), broken.map((s) => _jsx(Box, { paddingLeft: 2, children: _jsx(ToolStep, { step: s }) }, s.id))] }));
|
|
21
21
|
}
|
package/dist/ui/ToolStep.js
CHANGED
|
@@ -2,7 +2,7 @@ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-run
|
|
|
2
2
|
import { Box, Text } from "ink";
|
|
3
3
|
import { formatDuration } from "./format.js";
|
|
4
4
|
import { fileLink } from "./osc.js";
|
|
5
|
-
import { theme } from "./theme.js";
|
|
5
|
+
import { theme, secondary } from "./theme.js";
|
|
6
6
|
import { computeEditDiff } from "./editdiff.js";
|
|
7
7
|
import { useTick } from "./tick.js";
|
|
8
8
|
import { SHELL_ANY } from "../tools/classes.js";
|
|
@@ -90,7 +90,7 @@ export function ToolStep({ step }) {
|
|
|
90
90
|
// A settled fold (ui/fold.ts): N more identical rounds as one counting line, ↻ in muted amber, the rest dim.
|
|
91
91
|
function FoldRow({ step }) {
|
|
92
92
|
const line = foldLine(step, termCols());
|
|
93
|
-
return _jsxs(Text, { children: [_jsx(Text, { color: theme.blocked, children: line.slice(0, 1) }), _jsx(Text, {
|
|
93
|
+
return _jsxs(Text, { children: [_jsx(Text, { color: theme.blocked, children: line.slice(0, 1) }), _jsx(Text, { ...secondary, children: line.slice(1) })] });
|
|
94
94
|
}
|
|
95
95
|
function CallRow({ step }) {
|
|
96
96
|
// ONE shared animation clock (tick.ts) drives both the per-action icon animation AND the live elapsed timer,
|
|
@@ -122,6 +122,6 @@ function CallRow({ step }) {
|
|
|
122
122
|
// The tool's name (or "$") always takes its kind's color — the same everywhere a tool row appears (TUI plan #12):
|
|
123
123
|
// shimmering while it runs, solid once settled; the glyph before it carries the outcome.
|
|
124
124
|
const head = step.status === "running" ? _jsx(ShimmerText, { text: t.head, frame: frame, palette: huePalette(KIND_HUE[toolKind(step.name)]) }) : _jsx(Text, { color: KIND_HUE[toolKind(step.name)], children: t.head });
|
|
125
|
-
return _jsxs(_Fragment, { children: [head, t.head === "$" ? " " : "", t.body, t.note ? _jsx(Text, {
|
|
126
|
-
})(), isRunningMedia ? _jsxs(Text, { children: [" ", _jsx(Text, { color: theme.mediaProgress, children: renderSweepBar(frame) })] }) : null, elapsed != null ? _jsxs(Text, {
|
|
125
|
+
return _jsxs(_Fragment, { children: [head, t.head === "$" ? " " : "", t.body, t.note ? _jsx(Text, { ...secondary, children: ` · ${t.note}` }) : null] });
|
|
126
|
+
})(), isRunningMedia ? _jsxs(Text, { children: [" ", _jsx(Text, { color: theme.mediaProgress, children: renderSweepBar(frame) })] }) : null, elapsed != null ? _jsxs(Text, { ...secondary, children: [" ", formatDuration(elapsed)] }) : null, step.exitCode !== undefined ? _jsx(Text, { color: theme.error, children: ` · exit ${step.exitCode}` }) : null, editDiff ? (_jsxs(Text, { children: [" ", _jsxs(Text, { color: theme.success, children: ["+", editDiff.added] }), " ", _jsxs(Text, { color: theme.error, children: ["-", editDiff.removed] })] })) : null] }), rowBackgroundHint(step, now) ? _jsxs(Text, { ...secondary, children: [" ", rowBackgroundHint(step, now)] }) : null, step.summary ? step.summary.split("\n").map((l, i) => (_jsxs(Text, { ...secondary, children: [" ", l] }, `sm${i}`))) : null, editDiff?.preview?.map((l, i) => (_jsxs(Text, { color: l.kind === "add" ? theme.success : theme.error, children: [" ", l.kind === "add" ? "+ " : "- ", l.text] }, i)))] }));
|
|
127
127
|
}
|
package/dist/ui/Transcript.js
CHANGED
|
@@ -6,7 +6,7 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
6
6
|
import React from "react";
|
|
7
7
|
import { Box, Static, Text } from "ink";
|
|
8
8
|
import { ToolStep } from "./ToolStep.js";
|
|
9
|
-
import { Markdown } from "./Markdown.js";
|
|
9
|
+
import { Markdown, LiveMarkdown } from "./Markdown.js";
|
|
10
10
|
import { SummaryCard } from "./SummaryCard.js";
|
|
11
11
|
import { StatsCard } from "./StatsCard.js";
|
|
12
12
|
import { ToolBatch } from "./ToolBatch.js";
|
|
@@ -14,7 +14,7 @@ import { SB_MARK, SB_IN, SB_OUT } from "./brand.js";
|
|
|
14
14
|
import { beamDrop, beamDropHint, beamDropLine } from "../bus/beam-drop.js";
|
|
15
15
|
import { termCols, termRows } from "./term.js";
|
|
16
16
|
import { reportLine } from "./reportLine.js";
|
|
17
|
-
import { theme } from "./theme.js";
|
|
17
|
+
import { theme, secondary } from "./theme.js";
|
|
18
18
|
// In fullscreen we can't use <Static> (it targets the scrollback the alt-screen buffer hides), so render
|
|
19
19
|
// the last N entries as a plain column the parent region clips to the visible height. N is generous — the
|
|
20
20
|
// parent's overflow:hidden + justifyContent:flex-end shows only what fits, bottom-anchored.
|
|
@@ -97,7 +97,7 @@ function BusCard({ entry }) {
|
|
|
97
97
|
const { msg, direction, at } = entry;
|
|
98
98
|
const drop = direction === "in" ? beamDrop(msg) : null;
|
|
99
99
|
if (drop) {
|
|
100
|
-
return (_jsx(Box, { marginBottom: 1, children: _jsxs(Text, { color: "cyan", children: [beamDropLine(drop), _jsx(Text, {
|
|
100
|
+
return (_jsx(Box, { marginBottom: 1, children: _jsxs(Text, { color: "cyan", children: [beamDropLine(drop), _jsx(Text, { ...secondary, children: ` ${beamDropHint(drop)} · ${hhmm(at)}` })] }) }));
|
|
101
101
|
}
|
|
102
102
|
const who = direction === "in" ? msg.from : msg.to;
|
|
103
103
|
const arrow = direction === "in" ? SB_IN : SB_OUT;
|
|
@@ -105,7 +105,7 @@ function BusCard({ entry }) {
|
|
|
105
105
|
const all = msg.body.split("\n").flatMap((l) => wrapLine(l, termCols() - 2));
|
|
106
106
|
const shown = all.slice(0, BUS_BODY_MAX);
|
|
107
107
|
const clipped = all.length - shown.length;
|
|
108
|
-
return (_jsxs(Box, { flexDirection: "column", marginBottom: 1, children: [_jsxs(Text, { color: "cyan", children: [SB_MARK, " ", arrow, " ", _jsx(Text, { bold: true, children: who }), msg.subject ? ` [${msg.subject}]` : "", _jsx(Text, {
|
|
108
|
+
return (_jsxs(Box, { flexDirection: "column", marginBottom: 1, children: [_jsxs(Text, { color: "cyan", children: [SB_MARK, " ", arrow, " ", _jsx(Text, { bold: true, children: who }), msg.subject ? ` [${msg.subject}]` : "", _jsx(Text, { ...secondary, children: ` ${lead}${hhmm(at)}` })] }), shown.map((l, i) => _jsx(Text, { ...secondary, children: " " + l }, i)), clipped > 0 ? _jsx(Text, { ...secondary, children: ` ⋯ +${clipped} more line${clipped === 1 ? "" : "s"}` }) : null] }));
|
|
109
109
|
}
|
|
110
110
|
// A settled "thinking" transcript can be a wall of text — worse when a reasoning model circles before
|
|
111
111
|
// answering (the answer below is what matters). Show only the last REASONING_TAIL_LINES, dimmed, with a
|
|
@@ -122,7 +122,7 @@ function ReportRow({ agent }) {
|
|
|
122
122
|
const { tone, line, hint } = reportLine(agent, termCols());
|
|
123
123
|
const body = line.slice(2, hint ? line.length - hint.length : undefined);
|
|
124
124
|
const name = body.split(" · ")[0];
|
|
125
|
-
return (_jsxs(Text, { children: [_jsx(Text, { color: tone === "done" ? theme.success : tone === "stopped" ? theme.blocked : theme.error, children: line.slice(0, 2) }), _jsx(Text, { bold: true, children: name }), _jsx(Text, {
|
|
125
|
+
return (_jsxs(Text, { children: [_jsx(Text, { color: tone === "done" ? theme.success : tone === "stopped" ? theme.blocked : theme.error, children: line.slice(0, 2) }), _jsx(Text, { bold: true, children: name }), _jsx(Text, { ...secondary, children: body.slice(name.length) }), hint ? _jsx(Text, { color: theme.info, children: hint }) : null] }));
|
|
126
126
|
}
|
|
127
127
|
function renderEntry(entry, live = false, liveRows) {
|
|
128
128
|
if (entry.kind === "summary")
|
|
@@ -138,13 +138,13 @@ function renderEntry(entry, live = false, liveRows) {
|
|
|
138
138
|
if (entry.kind === "message") {
|
|
139
139
|
const { message } = entry;
|
|
140
140
|
if (message.role === "user") {
|
|
141
|
-
return _jsxs(Text, { children: ["❯ ", message.content, message.tag ? _jsx(Text, {
|
|
141
|
+
return _jsxs(Text, { children: ["❯ ", message.content, message.tag ? _jsx(Text, { ...secondary, children: ` ${message.tag}` }) : null] });
|
|
142
142
|
}
|
|
143
143
|
if (message.role === "system") {
|
|
144
|
-
return _jsx(Text, {
|
|
144
|
+
return _jsx(Text, { ...secondary, children: message.content }); // slash-command output / status notes
|
|
145
145
|
}
|
|
146
146
|
// Settled answers render as markdown (bold/code/lists/headers formatted, not raw `**`/backticks); the
|
|
147
|
-
// LIVE stream
|
|
147
|
+
// LIVE stream is styled line by line only (a half-open ``` fence can't swallow it) AND is height-bounded: while
|
|
148
148
|
// streaming we show only the tail that fits the window, so the dynamic frame can't overflow. Once the
|
|
149
149
|
// message settles it leaves `live` and renders in full via <Static> below, into scrollback.
|
|
150
150
|
if (live) {
|
|
@@ -178,12 +178,12 @@ function renderEntry(entry, live = false, liveRows) {
|
|
|
178
178
|
}
|
|
179
179
|
if (!r && !a)
|
|
180
180
|
return _jsx(Box, { marginBottom: 1 });
|
|
181
|
-
return (_jsxs(Box, { flexDirection: "column", marginBottom: 1, children: [r && r.clipped > 0 ? _jsx(Text, {
|
|
181
|
+
return (_jsxs(Box, { flexDirection: "column", marginBottom: 1, children: [r && r.clipped > 0 ? _jsx(Text, { ...secondary, children: `⋯ +${r.clipped} more thinking line${r.clipped === 1 ? "" : "s"} above` }) : null, r ? _jsx(Text, { ...secondary, children: _jsx(LiveMarkdown, { text: r.text, full: reasoning }) }) : null, a && a.clipped > 0 ? _jsx(Text, { ...secondary, children: `⋯ +${a.clipped} more line${a.clipped === 1 ? "" : "s"} above (full text shown when complete)` }) : null, a ? _jsx(LiveMarkdown, { text: a.text, full: message.content }) : null] }));
|
|
182
182
|
}
|
|
183
183
|
// Thought process first, dimmed and tail-bounded (the answer below is what matters); the real answer
|
|
184
184
|
// follows at full weight.
|
|
185
185
|
const thoughts = message.reasoning ? clampReasoning(message.reasoning) : null;
|
|
186
|
-
return (_jsxs(Box, { flexDirection: "column", marginBottom: 1, children: [thoughts && thoughts.hidden > 0 ? _jsx(Text, {
|
|
186
|
+
return (_jsxs(Box, { flexDirection: "column", marginBottom: 1, children: [thoughts && thoughts.hidden > 0 ? _jsx(Text, { ...secondary, children: `⋯ ${thoughts.hidden} earlier thinking line${thoughts.hidden === 1 ? "" : "s"} hidden` }) : null, thoughts ? _jsx(Text, { ...secondary, children: _jsx(LiveMarkdown, { text: thoughts.text, full: message.reasoning }) }) : null, message.content ? _jsx(Markdown, { content: message.content }) : null] }));
|
|
187
187
|
}
|
|
188
188
|
return _jsx(ToolStep, { step: entry.step });
|
|
189
189
|
}
|
|
@@ -205,8 +205,8 @@ export function Transcript({ entries, live, bounded, scrollBack = 0, liveRows })
|
|
|
205
205
|
const { start, end, olderOff, newerOff } = boundedWindow(entries.length, scrollBack);
|
|
206
206
|
const tail = entries.slice(start, end);
|
|
207
207
|
const cols = termCols(); // memo key: a resize re-wraps settled rows, a per-tick re-render does not
|
|
208
|
-
return (_jsxs(Box, { flexDirection: "column", children: [olderOff > 0 ? (_jsx(Text, {
|
|
209
|
-
? _jsx(Text, {
|
|
208
|
+
return (_jsxs(Box, { flexDirection: "column", children: [olderOff > 0 ? (_jsx(Text, { ...secondary, children: `⋯ ${olderOff} earlier line(s) scrolled off` })) : null, tail.map((entry) => _jsx(TranscriptRow, { entry: entry, cols: cols }, entryKey(entry))), newerOff > 0
|
|
209
|
+
? _jsx(Text, { ...secondary, children: `⋯ ${newerOff} newer line(s) below — scroll down (new output jumps here)` })
|
|
210
210
|
: (live ? _jsx(Box, { children: renderEntry(live, true) }) : null)] }));
|
|
211
211
|
}
|
|
212
212
|
return (_jsxs(Box, { flexDirection: "column", children: [_jsx(Static, { items: entries, children: (entry) => _jsx(Box, { children: renderEntry(entry) }, entryKey(entry)) }), live ? _jsx(Box, { children: renderEntry(live, true, liveRows) }) : null] }));
|