@0perator/operator 0.1.345 → 0.1.347
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.js +4 -3
- package/dist/autonomy/session-factory.js +2 -1
- package/dist/autonomy/subagent-model.js +20 -0
- package/dist/background/commands.js +7 -0
- package/dist/background/index.js +135 -14
- package/dist/background/notices.js +25 -3
- package/dist/cli.js +64 -32
- package/dist/config/persona.js +29 -16
- package/dist/engine/agent.js +40 -18
- package/dist/engine/anthropic-chat.js +2 -2
- package/dist/engine/aurora.js +8 -4
- package/dist/engine/continuation.js +30 -5
- package/dist/engine/grandmaster.js +18 -1
- package/dist/engine/loop-guard.js +58 -24
- package/dist/session.js +48 -26
- package/dist/tools/executor.js +2 -1
- package/dist/ui/ActivitySpinner.js +11 -16
- package/dist/ui/BgPanel.js +35 -24
- package/dist/ui/PlanPane.js +26 -2
- package/dist/ui/ToolStep.js +16 -2
- package/package.json +1 -1
package/dist/ui/BgPanel.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { Box, Text } from "ink";
|
|
3
3
|
import { OrbitGlyph } from "./ActivitySpinner.js";
|
|
4
4
|
import { theme } from "./theme.js";
|
|
@@ -20,9 +20,7 @@ function metrics(a) {
|
|
|
20
20
|
parts.push(`${(ms / 1000).toFixed(ms < 10000 ? 1 : 0)}s`);
|
|
21
21
|
return parts.join(" · ");
|
|
22
22
|
}
|
|
23
|
-
//
|
|
24
|
-
// verified badge + malformed warning. Terminals have no hover, so the verify failure
|
|
25
|
-
// reason is shown inline (capped) instead of as a tooltip; success collapses to a bare ✓.
|
|
23
|
+
// Cap a string to n chars with an ellipsis (lines in the dynamic frame must never wrap).
|
|
26
24
|
const cap = (s, n = 60) => (s.length > n ? `${s.slice(0, n - 1)}…` : s);
|
|
27
25
|
// Humanize a tool name into the verb an owner reads at a glance ("editing cli.py", not "file_edit cli.py").
|
|
28
26
|
// Falls back to the raw name (underscores→spaces) for anything not in the table, so a new/MCP tool never
|
|
@@ -54,27 +52,40 @@ export function roundActivity(a) {
|
|
|
54
52
|
export function missionLine(a) {
|
|
55
53
|
return a.progress?.trim() || roundActivity(a);
|
|
56
54
|
}
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
const
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
55
|
+
/** The ledger line (pure, testable): role title · model · what it has done — "wrote 2 (a.md, b.md) · read 14 · ran 3". */
|
|
56
|
+
export function ledgerLine(a) {
|
|
57
|
+
const done = [
|
|
58
|
+
a.written?.length ? `wrote ${a.written.length} (${a.written.slice(-2).map((p) => p.split("/").pop()).join(", ")})` : "",
|
|
59
|
+
a.reads ? `read ${a.reads}` : "",
|
|
60
|
+
a.commands ? `ran ${a.commands}` : "",
|
|
61
|
+
].filter(Boolean).join(" · ");
|
|
62
|
+
const verify = a.verified == null ? "" : a.verified ? "✓ verified" : `✗ unverified${a.verifyDetail ? `: ${cap(a.verifyDetail, 30)}` : ""}`;
|
|
63
|
+
return [a.title ?? "assistant", a.model, done || (a.status === "working" ? "nothing written yet" : ""), verify, a.malformed ? "⚠ malformed" : ""]
|
|
64
|
+
.filter(Boolean).join(" · ");
|
|
63
65
|
}
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
66
|
+
/** The third row (pure, testable): a stuck agent shows WHY and the exact commands to re-steer or stop it; a working one
|
|
67
|
+
* its current steps or thought; a finished one where its result went. Always exactly one line. */
|
|
68
|
+
export function detailLine(a) {
|
|
69
|
+
if (a.status === "working" && a.stuck)
|
|
70
|
+
return { text: `⚠ stuck: ${a.stuck} — /agents ${a.id} msg <steer> · /agents ${a.id} stop`, tone: "stuck" };
|
|
71
|
+
if (a.status === "idle")
|
|
72
|
+
return { text: "result posted — scroll up or /agents to review", tone: "dim" };
|
|
73
|
+
if (a.status === "stopped")
|
|
74
|
+
return { text: "errored — check transcript for details", tone: "dim" };
|
|
75
|
+
if (a.status === "queued")
|
|
76
|
+
return { text: "waiting for a free slot", tone: "dim" };
|
|
70
77
|
const steps = a.steps ?? [];
|
|
71
|
-
const stepLine = steps
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
+
const stepLine = steps.slice(-3).map((s) => s.name + (s.arg ? `(${s.arg})` : "") + (s.running ? " …" : "")).join(" · ");
|
|
79
|
+
const head = stepLine ? `↳ ${stepLine}` : a.thought ? `⋮ ${a.thought.replace(/^…/, "").trim()}` : "";
|
|
80
|
+
const tail = a.lastOutput ? `⤷ ${a.lastOutput}` : "";
|
|
81
|
+
return { text: [head, tail].filter(Boolean).join(" ") || "starting…", tone: "dim" };
|
|
82
|
+
}
|
|
83
|
+
// One agent = exactly THREE rows, whatever its state: name line, ledger line, detail line. A fixed height keeps Ink's
|
|
84
|
+
// in-place redraw anchored — rows that appeared and vanished as thoughts/outputs came and went changed the frame height
|
|
85
|
+
// every tick, and Ink repainted the whole frame (the flashing, 10/31).
|
|
86
|
+
function AgentRows({ a }) {
|
|
87
|
+
const d = detailLine(a);
|
|
88
|
+
return (_jsxs(Box, { flexDirection: "column", children: [_jsxs(Box, { children: [_jsx(Box, { flexGrow: 1, flexShrink: 1, children: _jsxs(Text, { wrap: "truncate-end", children: [a.status === "working" ? _jsx(OrbitGlyph, {}) : _jsx(Text, { color: COLOR[a.status], children: GLYPH[a.status] }), " ", _jsx(Text, { bold: true, children: a.name ?? a.label }), a.name ? _jsx(Text, { dimColor: true, children: ` · ${cap(a.label, 40)}` }) : null, a.round != null ? ` · round ${a.round}` : "", a.status === "working" && missionLine(a) ? _jsxs(Text, { color: theme.accent, children: [" \u00B7 ", cap(missionLine(a), 36)] }) : null] }) }), _jsx(Box, { flexShrink: 0, marginLeft: 1, children: _jsx(Text, { dimColor: true, children: (() => { const m = metrics(a); const ds = DISPLAY_STATUS[a.status]; return m ? `${m} · ${ds}` : ds; })() }) })] }), _jsx(Box, { paddingLeft: 2, children: _jsx(Text, { dimColor: true, wrap: "truncate-end", children: ledgerLine(a) }) }), _jsx(Box, { paddingLeft: 2, children: d.tone === "stuck" ? _jsx(Text, { color: theme.error, wrap: "truncate-end", children: d.text }) : _jsx(Text, { dimColor: true, wrap: "truncate-end", children: cap(d.text, 110) }) })] }));
|
|
78
89
|
}
|
|
79
90
|
// Cap how many agent rows the DYNAMIC panel renders. Each agent is ~3 lines; a full fan-out (6–8 agents)
|
|
80
91
|
// makes the non-Static frame tall AND it re-renders on every sub-agent token — so when it sits near the
|
|
@@ -125,5 +136,5 @@ export function BgPanel({ agents, jobs = [], title = "sub-agents" }) {
|
|
|
125
136
|
// frame SHORT — BG_MAX_VISIBLE caps rows, activity lines are capped — so the box stays a few rows tall.
|
|
126
137
|
// If stray border rows ever reappear on a very long turn, drop `borderStyle`/`borderColor` for the
|
|
127
138
|
// borderless column (the label line alone still heads it).
|
|
128
|
-
return (_jsxs(Box, { flexDirection: "column", marginTop: 1, borderStyle: "round", borderColor: theme.muted, paddingX: 1, children: [_jsx(Text, { dimColor: true, children: label }), shown.map((a) =>
|
|
139
|
+
return (_jsxs(Box, { flexDirection: "column", marginTop: 1, borderStyle: "round", borderColor: theme.muted, paddingX: 1, children: [_jsx(Text, { dimColor: true, children: label }), shown.map((a) => _jsx(AgentRows, { a: a }, a.id)), hidden > 0 ? _jsx(Text, { dimColor: true, children: ` +${hidden} more running` }) : null, _jsx(ShellJobs, { jobs: jobs })] }));
|
|
129
140
|
}
|
package/dist/ui/PlanPane.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
2
|
import { Box, Text } from "ink";
|
|
3
3
|
import { theme } from "./theme.js";
|
|
4
4
|
import { bar } from "./chart.js";
|
|
@@ -10,6 +10,27 @@ export function planProgress(tasks) {
|
|
|
10
10
|
const done = tasks.filter((t) => t.status === "done").length;
|
|
11
11
|
return `${done}/${tasks.length} done`;
|
|
12
12
|
}
|
|
13
|
+
/** Rows the pane may take in the DYNAMIC frame. Uncapped, a 16-item plan plus the sub-agent box made the live frame
|
|
14
|
+
* taller than the terminal, and Ink then clears and redraws the whole screen on every tick — the flashing (10/31). */
|
|
15
|
+
export const PLAN_MAX_ROWS = 6;
|
|
16
|
+
/** The rows to show (pure, testable): in-progress first, then the next pending, then the most recent finished — in plan
|
|
17
|
+
* order — capped at `max`, plus how many were left out. */
|
|
18
|
+
export function visiblePlan(tasks, max = PLAN_MAX_ROWS) {
|
|
19
|
+
if (tasks.length <= max)
|
|
20
|
+
return { shown: tasks, hidden: 0 };
|
|
21
|
+
const pick = new Set();
|
|
22
|
+
for (const t of tasks)
|
|
23
|
+
if (t.status === "in_progress" && pick.size < max)
|
|
24
|
+
pick.add(t);
|
|
25
|
+
for (const t of tasks)
|
|
26
|
+
if (t.status === "pending" && pick.size < max)
|
|
27
|
+
pick.add(t);
|
|
28
|
+
for (const t of [...tasks].reverse())
|
|
29
|
+
if (finished(t) && pick.size < max)
|
|
30
|
+
pick.add(t);
|
|
31
|
+
const shown = tasks.filter((t) => pick.has(t));
|
|
32
|
+
return { shown, hidden: tasks.length - shown.length };
|
|
33
|
+
}
|
|
13
34
|
export function PlanPane({ tasks, title = "plan" }) {
|
|
14
35
|
if (!tasks.length)
|
|
15
36
|
return null;
|
|
@@ -20,5 +41,8 @@ export function PlanPane({ tasks, title = "plan" }) {
|
|
|
20
41
|
// Borderless: this pane renders in Ink's DYNAMIC region; a box border there orphans its rows into
|
|
21
42
|
// scrollback whenever the Static transcript grows during a long turn (the v0.1.92 line-flood). The
|
|
22
43
|
// dim header labels the group without a border.
|
|
23
|
-
return (_jsxs(Box, { flexDirection: "column", paddingLeft: 1, children: [_jsxs(Text, { dimColor: true, children: [`${title} · ${planProgress(tasks)} `, _jsx(Text, { color: theme.success, children: bar(tasks.filter((t) => t.status === "done").length, tasks.length, 8) })] }),
|
|
44
|
+
return (_jsxs(Box, { flexDirection: "column", paddingLeft: 1, children: [_jsxs(Text, { dimColor: true, children: [`${title} · ${planProgress(tasks)} `, _jsx(Text, { color: theme.success, children: bar(tasks.filter((t) => t.status === "done").length, tasks.length, 8) })] }), (() => {
|
|
45
|
+
const { shown, hidden } = visiblePlan(tasks);
|
|
46
|
+
return (_jsxs(_Fragment, { children: [shown.map((t) => (_jsxs(Text, { wrap: "truncate-end", children: [_jsxs(Text, { color: COLOR[t.status], children: [GLYPH[t.status], " "] }), _jsx(Text, { dimColor: finished(t), strikethrough: finished(t), children: t.text })] }, t.id))), hidden > 0 ? _jsx(Text, { dimColor: true, children: ` +${hidden} more` }) : null] }));
|
|
47
|
+
})()] }));
|
|
24
48
|
}
|
package/dist/ui/ToolStep.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
1
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { Box, Text } from "ink";
|
|
3
3
|
import { formatDuration } from "./format.js";
|
|
4
4
|
import { fileLink } from "./osc.js";
|
|
@@ -56,6 +56,16 @@ export function argsPreview(args) {
|
|
|
56
56
|
}
|
|
57
57
|
return parts.join(", ");
|
|
58
58
|
}
|
|
59
|
+
/** The call's title. A shell call reads as the command itself — "$ ls -la /path" — like a terminal prompt (owner, 10/31:
|
|
60
|
+
* "bash needs to just show $"); every other tool reads name(args). `note` is the shell call's description, shown dim. */
|
|
61
|
+
export function stepTitle(step) {
|
|
62
|
+
if (SHELL_TOOLS.has(step.name) && typeof step.args?.command === "string") {
|
|
63
|
+
const cmd = step.args.command.replace(/\s+/g, " ").trim();
|
|
64
|
+
const desc = typeof step.args.description === "string" && step.args.description.trim() ? step.args.description.trim() : undefined;
|
|
65
|
+
return { head: "$", body: cmd.length > 160 ? cmd.slice(0, 157) + "..." : cmd, note: desc };
|
|
66
|
+
}
|
|
67
|
+
return { head: step.name, body: `(${argsPreview(step.args)})` };
|
|
68
|
+
}
|
|
59
69
|
/** For shell tools with a description, the command is shown dim beneath the description line. */
|
|
60
70
|
export function shellCommandHint(step) {
|
|
61
71
|
if (!SHELL_TOOLS.has(step.name) || !step.args?.description)
|
|
@@ -86,5 +96,9 @@ export function ToolStep({ step }) {
|
|
|
86
96
|
// lands. Only RUNNING media rows get the bar — everything else renders exactly as before.
|
|
87
97
|
const isRunningMedia = toolKind(step.name) === "media" && step.status === "running";
|
|
88
98
|
const mediaFraction = isRunningMedia && elapsed != null ? mediaProgressFraction(elapsed, mediaEtaMs(step.name, step.args)) : undefined;
|
|
89
|
-
return (_jsxs(Box, { flexDirection: "column", children: [_jsxs(Text, { children: [_jsx(Text, { color: step.status === "running" ? KIND_HUE[toolKind(step.name)] : COLOR[step.status], bold: true, children: glyphFor(step.name, step.status, frame) }), " ",
|
|
99
|
+
return (_jsxs(Box, { flexDirection: "column", children: [_jsxs(Text, { children: [_jsx(Text, { color: step.status === "running" ? KIND_HUE[toolKind(step.name)] : COLOR[step.status], bold: true, children: glyphFor(step.name, step.status, frame) }), " ", (() => {
|
|
100
|
+
const t = stepTitle(step);
|
|
101
|
+
const head = step.status === "running" ? _jsx(ShimmerText, { text: t.head, frame: frame, palette: huePalette(KIND_HUE[toolKind(step.name)]) }) : t.head;
|
|
102
|
+
return _jsxs(_Fragment, { children: [head, t.head === "$" ? " " : "", t.body, t.note ? _jsx(Text, { dimColor: true, children: ` · ${t.note}` }) : null] });
|
|
103
|
+
})(), mediaFraction != null ? (_jsxs(Text, { children: [" ", _jsx(Text, { color: theme.mediaProgress, children: renderBar(mediaFraction) }), " ", Math.round(mediaFraction * 100), "%"] })) : null, elapsed != null ? _jsxs(Text, { dimColor: true, children: [" ", formatDuration(elapsed)] }) : 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, { dimColor: true, children: [" ", rowBackgroundHint(step, now)] }) : null, step.summary ? step.summary.split("\n").map((l, i) => (_jsxs(Text, { dimColor: true, 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)))] }));
|
|
90
104
|
}
|