@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.
Files changed (49) hide show
  1. package/dist/autonomy/delegate-mode.js +4 -1
  2. package/dist/autonomy/delegate.js +3 -13
  3. package/dist/background/index.js +7 -10
  4. package/dist/background/notices.js +1 -1
  5. package/dist/cli.js +31 -14
  6. package/dist/config/persona.js +20 -3
  7. package/dist/engine/agent.js +62 -7
  8. package/dist/engine/aurora.js +30 -30
  9. package/dist/engine/batch-hints.js +45 -0
  10. package/dist/engine/batch-scheduler.js +23 -7
  11. package/dist/engine/decision-points.js +12 -2
  12. package/dist/engine/delegate-turn.js +24 -0
  13. package/dist/engine/grandmaster.js +28 -11
  14. package/dist/mcp/index.js +2 -2
  15. package/dist/permissions/modes.js +7 -3
  16. package/dist/session.js +65 -12
  17. package/dist/tools/classes.js +4 -0
  18. package/dist/tools/deferred.js +11 -6
  19. package/dist/tools/readonly-shell.js +92 -0
  20. package/dist/tools/registry.js +3 -3
  21. package/dist/tools/shell-session.js +56 -1
  22. package/dist/ui/ActivitySpinner.js +2 -2
  23. package/dist/ui/App.js +9 -9
  24. package/dist/ui/ApprovalPrompt.js +5 -4
  25. package/dist/ui/ArtifactPicker.js +4 -3
  26. package/dist/ui/AuthScreen.js +2 -1
  27. package/dist/ui/BgPanel.js +11 -8
  28. package/dist/ui/Composer.js +4 -3
  29. package/dist/ui/Header.js +2 -2
  30. package/dist/ui/Markdown.js +50 -77
  31. package/dist/ui/PlanPane.js +5 -5
  32. package/dist/ui/QuestionPrompt.js +2 -1
  33. package/dist/ui/SecretPrompt.js +2 -1
  34. package/dist/ui/SessionPicker.js +4 -3
  35. package/dist/ui/SkillFinder.js +3 -2
  36. package/dist/ui/StatsCard.js +2 -2
  37. package/dist/ui/StatusRule.js +2 -2
  38. package/dist/ui/SummaryCard.js +2 -2
  39. package/dist/ui/Table.js +25 -24
  40. package/dist/ui/ThinkingSpinner.js +2 -1
  41. package/dist/ui/ToolBatch.js +3 -3
  42. package/dist/ui/ToolStep.js +4 -4
  43. package/dist/ui/Transcript.js +12 -12
  44. package/dist/ui/UpdatePrompt.js +2 -1
  45. package/dist/ui/inline.js +109 -0
  46. package/dist/ui/reportLine.js +2 -0
  47. package/dist/ui/slashCommands.js +2 -2
  48. package/dist/ui/theme.js +4 -0
  49. package/package.json +1 -1
@@ -0,0 +1,92 @@
1
+ // Is a shell command plainly read-only? Only scheduling asks (engine/batch-scheduler.ts): a yes lets the call overlap
2
+ // other reads. Permissions and approvals never read this. Any doubt is a no, which keeps the call serial.
3
+ // Refused anywhere, quoted or not: expansion, substitution, escapes, redirects, background/and/or, sequencing, newlines.
4
+ const NEVER = /[$`\\\n\r;&<>]/;
5
+ const UNQUOTED_NEVER = /[(){}#]/;
6
+ const GLOB = /[*?[]/;
7
+ // A file name that expands into a flag could change what these two do; the others have no flag that writes or runs.
8
+ const GLOB_OK = new Set(["ls", "cat", "head", "tail", "grep"]);
9
+ function pipeline(command) {
10
+ const stages = [[]];
11
+ let word;
12
+ const end = () => { if (word)
13
+ stages[stages.length - 1].push(word); word = undefined; };
14
+ for (let i = 0; i < command.length; i++) {
15
+ const ch = command[i];
16
+ if (ch === "'" || ch === '"') {
17
+ const close = command.indexOf(ch, i + 1);
18
+ if (close < 0)
19
+ return undefined;
20
+ word ??= { text: "", glob: false, quoted: false };
21
+ word.text += command.slice(i + 1, close);
22
+ word.quoted = true;
23
+ i = close;
24
+ }
25
+ else if (ch === " " || ch === "\t")
26
+ end();
27
+ else if (ch === "|") {
28
+ end();
29
+ stages.push([]);
30
+ }
31
+ else if (UNQUOTED_NEVER.test(ch))
32
+ return undefined;
33
+ else {
34
+ word ??= { text: "", glob: false, quoted: false };
35
+ word.text += ch;
36
+ if (GLOB.test(ch))
37
+ word.glob = true;
38
+ }
39
+ }
40
+ end();
41
+ return stages.every((s) => s.length > 0) ? stages : undefined;
42
+ }
43
+ const FIND_BARE = new Set(["-print", "-print0", "-prune", "-empty", "-not", "-o", "-a", "-and", "-or"]);
44
+ const FIND_VALUE = new Set(["-name", "-iname", "-path", "-ipath", "-regex", "-iregex", "-type", "-maxdepth", "-mindepth", "-mtime", "-mmin", "-newer", "-size"]);
45
+ function findReads(args) {
46
+ for (let i = 0; i < args.length; i++) {
47
+ const a = args[i];
48
+ if (!a.startsWith("-") || FIND_BARE.has(a))
49
+ continue;
50
+ if (!FIND_VALUE.has(a))
51
+ return false;
52
+ i++;
53
+ }
54
+ return true;
55
+ }
56
+ // git takes abbreviated long options, so a prefix of one of these counts as it.
57
+ const GIT_REFUSED = ["--output", "--ext-diff", "--textconv"];
58
+ function gitReads(args) {
59
+ let i = 0;
60
+ while (args[i] === "--no-pager" || args[i] === "-C")
61
+ i += args[i] === "-C" ? 2 : 1;
62
+ if (!["status", "log", "diff", "show"].includes(args[i] ?? ""))
63
+ return false;
64
+ return args.slice(i + 1).every((a) => {
65
+ const flag = a.split("=")[0];
66
+ return !flag.startsWith("--") || flag.length < 4 || !GIT_REFUSED.some((r) => r.startsWith(flag) || flag.startsWith(r));
67
+ });
68
+ }
69
+ function stageReads([head, ...rest]) {
70
+ if (!head || head.quoted || head.glob)
71
+ return false;
72
+ const cmd = head.text;
73
+ if (!GLOB_OK.has(cmd) && rest.some((w) => w.glob))
74
+ return false;
75
+ const args = rest.map((w) => w.text);
76
+ switch (cmd) {
77
+ case "ls":
78
+ case "cat":
79
+ case "head":
80
+ case "grep": return true;
81
+ case "tail": return !args.some((a) => /^-[^-]*[fF]|^--f|^--retry/.test(a)); // following never ends
82
+ case "rg": return !args.some((a) => /^--(pre|hostname-bin|search-zip)|^-[^-]*z/.test(a)); // these start programs
83
+ case "find": return findReads(args);
84
+ case "git": return gitReads(args);
85
+ default: return false;
86
+ }
87
+ }
88
+ export function isReadOnlyCommand(command) {
89
+ if (typeof command !== "string" || !command.trim() || NEVER.test(command))
90
+ return false;
91
+ return pipeline(command.trim())?.every(stageReads) === true;
92
+ }
@@ -2395,7 +2395,7 @@ const TOOLS = [
2395
2395
  {
2396
2396
  name: "bash", safe: false,
2397
2397
  contract: { v: 1, effects: ["exec"], bins: ["bash", "sandbox-exec", "bwrap", "ps", "lsof"] },
2398
- description: "Run a command in a PERSISTENT bash session: `cd`, exported variables, an activated venv and functions carry over — set up once, don't re-`cd` or re-activate every call. stdout+stderr merged, with the exit code; pipelines run with `set -o pipefail`. Anything that may run over ~2 minutes (server, build, watcher, full test suite) goes to shell_background, not a bigger timeout_ms; ctrl+b moves a running command to the background and you are told when it ends — don't poll. Prefer SINGLE quotes for patterns and paths: a raw double-quote can break tool-call serialization.",
2398
+ description: "Run a command in a PERSISTENT bash session: `cd`, variables, venvs and functions carry over. To search, read or list files use search / file_read / list_directory, not grep/cat/sed/ls. stdout+stderr merged, with the exit code; pipelines run with `set -o pipefail`. Anything that may run over ~2 minutes (server, build, watcher, full test suite) goes to shell_background, not a bigger timeout_ms. Prefer SINGLE quotes for patterns and paths: a raw double-quote can break tool-call serialization.",
2399
2399
  parameters: { type: "object", properties: {
2400
2400
  command: { type: "string", description: "the command to run" },
2401
2401
  description: { type: "string", description: "short label for the UI" },
@@ -2505,7 +2505,7 @@ const TOOLS = [
2505
2505
  {
2506
2506
  name: "file_read", safe: true,
2507
2507
  contract: { v: 3, effects: ["read"], bins: ["osascript", "textutil", "unzip"] },
2508
- description: "Read a file, optionally a line range, with line numbers. Without offset/limit, only the first 2000 lines are returned — pass offset/limit to page through a larger file. For very long lines (minified code, one-line JSON or logs) page by character instead: start_char (and max_chars, up to 38000) returns the exact raw text with no line numbers.",
2508
+ description: "Read a file (not cat/sed), optionally a line range, with line numbers. Without offset/limit, only the first 2000 lines are returned — pass offset/limit to page through a larger file. For very long lines (minified code, one-line JSON or logs) page by character instead: start_char (and max_chars, up to 38000) returns the exact raw text with no line numbers.",
2509
2509
  parameters: { type: "object", properties: {
2510
2510
  path: { type: "string" }, offset: { type: "number" }, limit: { type: "number" }, force: { type: "boolean" },
2511
2511
  start_char: { type: "number", description: "raw mode: character offset to start at (0-based); the reply names the next start_char" },
@@ -2578,7 +2578,7 @@ const TOOLS = [
2578
2578
  {
2579
2579
  name: "search", safe: true,
2580
2580
  contract: { v: 1, effects: ["read"], bins: ["rg", "grep"] },
2581
- description: "Fast content search (ripgrep: parallel, .gitignore-aware, skips binaries) — prefer it over `find … | grep`. Scope with `path` (default: current dir). HARD REFUSAL: path may not be $HOME, /, /Users or another machine-wide root (they hang for minutes) — use find_files (on demand) for names, a narrow subtree for content. `glob` filters filenames; files_with_matches returns just the paths (locate before you read).",
2581
+ description: "Fast content search (ripgrep: parallel, .gitignore-aware, skips binaries) — use it, not shell grep/rg. Scope with `path` (default: current dir). HARD REFUSAL: path may not be $HOME, /, /Users or another machine-wide root (they hang for minutes) — use find_files (on demand) for names, a narrow subtree for content. `glob` filters filenames; files_with_matches returns just the paths (locate before you read).",
2582
2582
  parameters: { type: "object", properties: {
2583
2583
  pattern: { type: "string", description: "regex" },
2584
2584
  path: { type: "string", description: "directory scope (default current dir; not $HOME or /)" },
@@ -443,6 +443,54 @@ const MISSING_MANIFEST = [
443
443
  export function missingManifest(lowerOutput) {
444
444
  return MISSING_MANIFEST.find(([re]) => re.test(lowerOutput))?.[1];
445
445
  }
446
+ /** The words of a command that is one plain call, optionally piped into `head`. null for anything else: chains,
447
+ * redirects, expansions and unquoted globs mean the shell is doing real work. */
448
+ function plainWords(command) {
449
+ const body = command.trim().replace(/^cd\s+[^;&|<>$`\n]+?\s*(?:&&|;|\n)\s*/, "").replace(/\s2>(?:\/dev\/null|&1)(?=\s|$)/g, "")
450
+ .replace(/\s*\|\s*head(?:\s+-(?:n\s*)?\d+)?\s*$/, "");
451
+ if (body.includes("\n"))
452
+ return null;
453
+ const words = [];
454
+ const token = /\s*(?:((?:'[^']*'|"(?:\\.|[^"\\$`])*"|[^\s'"\x5c;&|<>$`(){}*?[\]])+)|$)/y;
455
+ while (token.lastIndex < body.length) {
456
+ const m = token.exec(body);
457
+ if (!m)
458
+ return null;
459
+ if (m[1])
460
+ words.push(m[1]);
461
+ }
462
+ return words;
463
+ }
464
+ /** One line naming the native tool when it does the same job as this command; undefined when in doubt (a hint the
465
+ * tool cannot honour teaches the model to ignore them all). */
466
+ export function nativeToolHint(command) {
467
+ const [bin, ...rest] = plainWords(command) ?? [];
468
+ const flags = rest.filter((w) => w.startsWith("-"));
469
+ const args = rest.filter((w) => !w.startsWith("-"));
470
+ const hint = (tool, how) => `[native tool: ${tool} ${how}; pass the full path]`;
471
+ const read = () => hint("file_read", "reads this (offset/limit for a range), instead of cat/sed/head");
472
+ if (bin === "grep" || bin === "rg") {
473
+ const known = flags.every((f) => (bin === "grep" ? /^-[nrREHIsl]+$/ : /^-[nHl]+$/).test(f));
474
+ const recursive = bin === "rg" || flags.some((f) => /[rR]/.test(f));
475
+ if (known && (args.length === 2 || (args.length === 1 && recursive)))
476
+ return hint("search", "does this search (files_with_matches for -l), instead of shell grep/rg");
477
+ }
478
+ else if (bin === "cat" && !flags.length && args.length) {
479
+ return args.length === 1 ? read() : hint("read_files", "reads these in one call, instead of cat");
480
+ }
481
+ else if (bin === "head") {
482
+ if (/^(?:-\d+ |-n ?\d+ )?[^- ]\S*$/.test(rest.join(" ")))
483
+ return read();
484
+ }
485
+ else if (bin === "sed") {
486
+ if (rest.length === 3 && rest[0] === "-n" && /^(['"]?)\d+(?:,\d+)?p\1$/.test(rest[1]))
487
+ return read();
488
+ }
489
+ else if (bin === "ls" && flags.every((f) => /^-[a1]+$/.test(f)) && args.length <= 1) {
490
+ return hint("list_directory", "lists this, instead of ls");
491
+ }
492
+ return undefined;
493
+ }
446
494
  export function shellResultNotes(command, exitCode, output) {
447
495
  const notes = [];
448
496
  let code = exitCode;
@@ -455,7 +503,7 @@ export function shellResultNotes(command, exitCode, output) {
455
503
  if (code) {
456
504
  const out = output.toLowerCase();
457
505
  if (/invalid option|illegal option|unrecognized option|invalid command code|usage: sed|usage: grep|gnu_/.test(out)) {
458
- notes.push("[hint: macOS ships BSD sed/grep/awk — GNU-isms fail here: `sed -n 'X,+Np'` (use a computed 'X,Yp' range or `awk 'NR>=X&&NR<X+N'`), `grep -P` (use grep -E), `date -d` (use date -j -f). Rewrite and retry.]");
506
+ notes.push("[hint: macOS ships BSD sed/grep/awk — GNU-isms fail here: `sed -n 'X,+Np'` (use a computed 'X,Yp' range or `awk 'NR>=X&&NR<X+N'`), `grep -P` (use grep -E, or `rg -P` if rg is installed), `cat -A` (use cat -vet), `date -d` (use date -j -f). Rewrite and retry.]");
459
507
  }
460
508
  if (out.includes("command not found") && /\btimeout\b|\bsed -i\b|\brealpath\b|\breadlink -f\b/.test(command)) {
461
509
  notes.push("[hint: not installed on macOS by default — use `gtimeout` (brew coreutils), `sed -i ''`, or a python one-liner.]");
@@ -471,5 +519,12 @@ export function shellResultNotes(command, exitCode, output) {
471
519
  notes.push("[hint: git can't resolve that ref HERE — either the name shadows a path (disambiguate: `git <cmd> <rev> -- <path>`), or the branch doesn't exist in THIS checkout (worktrees/other clones hold their own local branches). Check first with `git rev-parse --verify <ref>` or `git branch -a`; don't retry variants blind.]");
472
520
  }
473
521
  }
522
+ if (/zsh:(?:\d+:)? no matches found/.test(output)) {
523
+ notes.push("[hint: zsh (a Mac's login shell, e.g. over ssh) fails a command on an unmatched glob: quote the glob, or use `find`.]");
524
+ }
525
+ // Success with output only: a failed run's exit trailer has to stay last (engine/loop-guard.ts).
526
+ const native = code === 0 && output ? nativeToolHint(command) : undefined;
527
+ if (native)
528
+ notes.push(native);
474
529
  return { exitForTrailer: code, notes };
475
530
  }
@@ -7,7 +7,7 @@ import { jsxs as _jsxs, jsx as _jsx } from "react/jsx-runtime";
7
7
  // • OrbitSpinner — a background sub-agent is working (rotating arc, violet)
8
8
  import { useEffect, useRef } from "react";
9
9
  import { Text } from "ink";
10
- import { theme } from "./theme.js";
10
+ import { theme, secondary } from "./theme.js";
11
11
  import { useTick } from "./tick.js";
12
12
  import { renderSweepBar } from "./progressbar.js";
13
13
  import { fmtElapsed } from "./format.js";
@@ -60,5 +60,5 @@ export function RecoverSpinner({ active, label, cols = termCols() }) {
60
60
  const room = cols - 1 - cellWidth(glyph) - 1 - 2 - cellWidth(time);
61
61
  const text = `${label ?? "adjusting"}…`;
62
62
  const withBar = cellWidth(text) + 2 + cellWidth(bar) <= room;
63
- return (_jsxs(Text, { color: theme.compactProgress, children: [glyph, " ", withBar ? text : truncateToWidth(text, Math.max(1, room)), withBar ? _jsxs(Text, { color: theme.compactProgress, children: [" ", bar] }) : null, " ", _jsx(Text, { dimColor: true, children: time })] }));
63
+ return (_jsxs(Text, { color: theme.compactProgress, children: [glyph, " ", withBar ? text : truncateToWidth(text, Math.max(1, room)), withBar ? _jsxs(Text, { color: theme.compactProgress, children: [" ", bar] }) : null, " ", _jsx(Text, { ...secondary, children: time })] }));
64
64
  }
package/dist/ui/App.js CHANGED
@@ -23,7 +23,7 @@ import { phaseLine, phaseWord } from "./phase.js";
23
23
  import { KIND_HUE } from "./toolicons.js";
24
24
  import { foldLine } from "./fold.js";
25
25
  import { isExpandKey } from "./expand.js";
26
- import { theme } from "./theme.js";
26
+ import { theme, secondary } from "./theme.js";
27
27
  import { ApprovalPrompt } from "./ApprovalPrompt.js";
28
28
  import { QuestionPrompt } from "./QuestionPrompt.js";
29
29
  import { SecretPrompt } from "./SecretPrompt.js";
@@ -38,7 +38,7 @@ import { cellWidth } from "./StatusRule.js";
38
38
  import { ACT_NOW_NARROW, actNowLine } from "./actNow.js";
39
39
  import { fitSegments, seg } from "./fit.js";
40
40
  // The footer's mode badge. Gated is outside the shift+tab cycle (permissions/modes.ts); shift+tab leaves it.
41
- const MODE_BADGE = { auto: "⎈ Autonomous", manual: "⊙ Manual", plan: "◑ Plan", gated: "⊘ Gated" };
41
+ const MODE_BADGE = { auto: "⎈ Autonomous", delegate: "⇉ Delegate", manual: "⊙ Manual", plan: "◑ Plan", gated: "⊘ Gated" };
42
42
  // Cap on live rows shown at once for a parallel tool batch — keeps the dynamic (non-Static) frame
43
43
  // bounded (same render-collapse concern liveTail guards in Transcript.tsx: Ink corrupts the frame once
44
44
  // the non-Static portion approaches the terminal height). A batch rarely runs more than a handful of
@@ -53,7 +53,7 @@ function LiveRow({ step }) {
53
53
  const hue = KIND_HUE[toolKind(step.name)];
54
54
  const glyph = step.status === "running" ? glyphFor(step.name, "running", frame) : step.status === "selected" ? "○" : step.outcome ? "⊘" : step.status === "error" ? "✗" : "✓";
55
55
  const color = step.status === "running" ? hue : step.status === "selected" ? theme.muted : step.outcome === "blocked" ? theme.blocked : step.outcome ? theme.muted : step.status === "error" ? theme.error : theme.success;
56
- return (_jsxs(Text, { children: [_jsx(Text, { color: color, bold: true, children: glyph }), " ", _jsx(Text, { color: hue, children: head }), _jsx(Text, { dimColor: step.status !== "running", children: rest })] }));
56
+ return (_jsxs(Text, { children: [_jsx(Text, { color: color, bold: true, children: glyph }), " ", _jsx(Text, { color: hue, children: head }), _jsx(Text, { ...(step.status !== "running" ? secondary : {}), children: rest })] }));
57
57
  }
58
58
  // Which running delegate_task row a child's progress belongs to: the one whose task matches (whitespace aside — the
59
59
  // emitter trims it, live 11/04), else the only one running (delegate_task is a scheduler barrier, so one runs at a time).
@@ -65,7 +65,7 @@ export function delegateRow(rows, view) {
65
65
  // The specialist's live line under its running delegate_task (TUI plan #9), led by the delegation's own relay motion.
66
66
  function DelegateChild({ view }) {
67
67
  const frame = useTick(true);
68
- return (_jsxs(Text, { children: [" ", _jsx(Text, { color: KIND_HUE.agent, children: relayFrame(frame) }), " ", _jsx(Text, { dimColor: true, children: delegateLine(view, termCols()) })] }));
68
+ return (_jsxs(Text, { children: [" ", _jsx(Text, { color: KIND_HUE.agent, children: relayFrame(frame) }), " ", _jsx(Text, { ...secondary, children: delegateLine(view, termCols()) })] }));
69
69
  }
70
70
  // The phase line (ui/phase.ts): one dim row naming what the turn is measurably doing, then the keys that act on it
71
71
  // (Enter steers, Tab queues, Esc stops), fitted to cols−1. It ticks on the shared clock only while it has something
@@ -78,10 +78,10 @@ function PhaseLine({ view, rows, offer = null }) {
78
78
  const frame = useTick(watchingShell || (view.phase === "reading" && !!view.read));
79
79
  const act = actNowLine(phaseWord(view.phase), offer);
80
80
  if (act)
81
- return _jsx(Text, { dimColor: true, children: cols < 45 ? ACT_NOW_NARROW : fitSegments(act, cols, { sep: "" }) });
81
+ return _jsx(Text, { ...secondary, children: cols < 45 ? ACT_NOW_NARROW : fitSegments(act, cols, { sep: "" }) });
82
82
  // No steer keys while compacting: a manual /compact is no turn to steer — what is typed waits for it.
83
83
  const { meter, text } = phaseLine({ ...view, hint: view.phase === "tools" ? backgroundHint(rows) : null, keys: view.phase === "compacting" ? undefined : turnKeySegs() }, cols, frame);
84
- return (_jsxs(Text, { dimColor: true, children: [" ", meter ? _jsx(Text, { color: KIND_HUE.read, children: `${meter} ` }) : null, text] }));
84
+ return (_jsxs(Text, { ...secondary, children: [" ", meter ? _jsx(Text, { color: KIND_HUE.read, children: `${meter} ` }) : null, text] }));
85
85
  }
86
86
  // ctrl+o appends the newest collapsed item (a sub-agent report, a settled batch). Its own listener, so the composer only
87
87
  // has to swallow the key; inactive while an overlay owns the keyboard.
@@ -112,7 +112,7 @@ export function App(props) {
112
112
  // The live activity band (spinner / parallel-tool view) and the bg-agents panel — shared by both layouts.
113
113
  const activity = (_jsxs(_Fragment, { children: [showSpinner && (_jsx(Box, { marginTop: 1, marginBottom: showLiveRows ? 0 : 1, children: status === "recovering" || status === "compacting" ? _jsx(RecoverSpinner, { active: true, label: stepLabel })
114
114
  : status === "executing" && !showLiveRows ? _jsx(StepSpinner, { active: true, label: stepLabel })
115
- : _jsx(ThinkingSpinner, { active: true, verb: status === "executing" ? thinkingVerb ?? "Running" : thinkingVerb, verbs: verbs, metrics: metrics }) })), showLiveRows && (_jsxs(Box, { flexDirection: "column", marginTop: 1, marginBottom: 1, paddingLeft: 1, children: [_jsx(Text, { dimColor: true, children: batchHeader(liveTools, termCols()) }), liveTools.slice(0, MAX_LIVE_TOOL_ROWS).map((step) => (_jsxs(React.Fragment, { children: [_jsx(LiveRow, { step: step }), delegate && step.id === delegateRow(liveTools, delegate) ? _jsx(DelegateChild, { view: delegate }) : null] }, step.id))), liveTools.length > MAX_LIVE_TOOL_ROWS ? _jsxs(Text, { dimColor: true, children: [" +", liveTools.length - MAX_LIVE_TOOL_ROWS, " more\u2026"] }) : null] })), fold ? (() => { const line = foldLine(fold, termCols(), true); return _jsxs(Text, { children: [_jsx(Text, { color: theme.blocked, children: line.slice(0, 1) }), _jsx(Text, { dimColor: true, children: line.slice(1) })] }); })() : null, _jsx(PlanPane, { tasks: tasks, now: planNow }), liveWorkers(mainLane, bgAgents, shellJobs) >= 2
115
+ : _jsx(ThinkingSpinner, { active: true, verb: status === "executing" ? thinkingVerb ?? "Running" : thinkingVerb, verbs: verbs, metrics: metrics }) })), showLiveRows && (_jsxs(Box, { flexDirection: "column", marginTop: 1, marginBottom: 1, paddingLeft: 1, children: [_jsx(Text, { ...secondary, children: batchHeader(liveTools, termCols()) }), liveTools.slice(0, MAX_LIVE_TOOL_ROWS).map((step) => (_jsxs(React.Fragment, { children: [_jsx(LiveRow, { step: step }), delegate && step.id === delegateRow(liveTools, delegate) ? _jsx(DelegateChild, { view: delegate }) : null] }, step.id))), liveTools.length > MAX_LIVE_TOOL_ROWS ? _jsxs(Text, { ...secondary, children: [" +", liveTools.length - MAX_LIVE_TOOL_ROWS, " more\u2026"] }) : null] })), fold ? (() => { const line = foldLine(fold, termCols(), true); return _jsxs(Text, { children: [_jsx(Text, { color: theme.blocked, children: line.slice(0, 1) }), _jsx(Text, { ...secondary, children: line.slice(1) })] }); })() : null, _jsx(PlanPane, { tasks: tasks, now: planNow }), liveWorkers(mainLane, bgAgents, shellJobs) >= 2
116
116
  ? _jsx(Lanes, { main: mainLane, agents: bgAgents, jobs: shellJobs, mainServing: mainServing, maxRunning: maxRunning, pool: lanePool, warnings: laneWarnings })
117
117
  : _jsx(BgPanel, { agents: bgAgents, jobs: shellJobs }), (thinking || status === "executing" || status === "recovering" || status === "compacting") && (_jsx(PhaseLine, { view: phase ?? { phase: status === "executing" ? "tools" : status === "recovering" ? "recovering" : status === "compacting" ? "compacting" : status === "streaming" ? "writing" : "waiting", label: stepLabel }, rows: liveTools, offer: actOffer }))] }));
118
118
  // One input owner at a time. An open overlay — the finder, the focused switcher — keeps the keyboard; a prompt that
@@ -131,10 +131,10 @@ export function App(props) {
131
131
  const modeText = opMode ? ` ${MODE_BADGE[opMode]} · shift+tab to cycle` : "";
132
132
  const rcText = `${caffeinated ? "☕ " : ""}${rcConnected ? "▮ rc live" : rcActive ? "▮ rc on" : "▯ rc"} `;
133
133
  const centre = switcher ? switcherLine(conversations, switcher, Math.max(0, cols - 1 - cellWidth(modeText) - cellWidth(rcText) - 2)) : "";
134
- const bottom = (_jsxs(_Fragment, { children: [_jsx(SwitcherKeys, { active: owner === "switcher", onKey: onSwitcher }), conversationPane ? (_jsxs(Box, { flexDirection: "column", children: [_jsx(Text, { color: "magenta", children: conversationPane.header }), conversationPane.lines.map((l, i) => _jsx(Text, { dimColor: !l.startsWith("⏺") && !l.startsWith("❯"), children: l || " " }, i))] })) : null, _jsx(StatusRule, { route: route, ctxPct: ctxPct, ctxWindow: ctxWindow, version: version, build: build, user: authUser, tier: tier, planMode: planMode, thinkMode: thinkMode, sessionTokens: sessionTokens }), owner === "composer" && status === "idle" && nextSteps?.length ? _jsx(Text, { color: "cyan", children: nextStepLine(nextSteps, cols) }) : null, pendingLines(pending, cols, phase ? phaseWord(phase.phase) : undefined).map((line, i) => _jsx(Text, { color: "yellow", children: line }, i)), voice ? _jsx(Text, { color: voice.recording ? "red" : undefined, bold: voice.recording, dimColor: !voice.recording, children: fitSegments([seg(voice.line)], cols) }) : null, onExpand ? _jsx(ExpandKey, { onExpand: onExpand, active: owner === "composer" }) : null, _jsx(Composer, { onSubmit: onSubmit, onQueue: onQueue, onSteer: onSteer, queued: pending.length, nextSteps: owner === "composer" && status === "idle" ? nextSteps?.length ?? 0 : 0, onPickNext: onPickNext, onDismissNext: onDismissNext, agents: agents, onAgentMessage: onAgentMessage, onSendTo: conversationPane ? onSendTo : undefined, onFocusSwitcher: onFocusSwitcher, onActNow: onActNow, onOpenFinder: onOpenFinder, onVoiceKey: onVoiceKey, prompt: conversationPane ? `${conversationPane.target} › ` : undefined, onEditQueued: onEditQueued, onDropQueued: onDropQueued, onInterrupt: onInterrupt, onBackground: onBackground, onCycleMode: onCycleMode, onCycleContext: onCycleContext, disabled: status !== "idle", suspended: owner !== "composer" }), _jsx(InputRule, {}), opMode && (_jsxs(Box, { justifyContent: "space-between", children: [_jsx(Text, { dimColor: true, children: modeText }), centre ? (() => {
134
+ const bottom = (_jsxs(_Fragment, { children: [_jsx(SwitcherKeys, { active: owner === "switcher", onKey: onSwitcher }), conversationPane ? (_jsxs(Box, { flexDirection: "column", children: [_jsx(Text, { color: "magenta", children: conversationPane.header }), conversationPane.lines.map((l, i) => _jsx(Text, { ...(!l.startsWith("⏺") && !l.startsWith("❯") ? secondary : {}), children: l || " " }, i))] })) : null, _jsx(StatusRule, { route: route, ctxPct: ctxPct, ctxWindow: ctxWindow, version: version, build: build, user: authUser, tier: tier, planMode: planMode, thinkMode: thinkMode, sessionTokens: sessionTokens }), owner === "composer" && status === "idle" && nextSteps?.length ? _jsx(Text, { color: "cyan", children: nextStepLine(nextSteps, cols) }) : null, pendingLines(pending, cols, phase ? phaseWord(phase.phase) : undefined).map((line, i) => _jsx(Text, { color: "yellow", children: line }, i)), voice ? _jsx(Text, { color: voice.recording ? "red" : undefined, bold: voice.recording, dimColor: !voice.recording, children: fitSegments([seg(voice.line)], cols) }) : null, onExpand ? _jsx(ExpandKey, { onExpand: onExpand, active: owner === "composer" }) : null, _jsx(Composer, { onSubmit: onSubmit, onQueue: onQueue, onSteer: onSteer, queued: pending.length, nextSteps: owner === "composer" && status === "idle" ? nextSteps?.length ?? 0 : 0, onPickNext: onPickNext, onDismissNext: onDismissNext, agents: agents, onAgentMessage: onAgentMessage, onSendTo: conversationPane ? onSendTo : undefined, onFocusSwitcher: onFocusSwitcher, onActNow: onActNow, onOpenFinder: onOpenFinder, onVoiceKey: onVoiceKey, prompt: conversationPane ? `${conversationPane.target} › ` : undefined, onEditQueued: onEditQueued, onDropQueued: onDropQueued, onInterrupt: onInterrupt, onBackground: onBackground, onCycleMode: onCycleMode, onCycleContext: onCycleContext, disabled: status !== "idle", suspended: owner !== "composer" }), _jsx(InputRule, {}), opMode && (_jsxs(Box, { justifyContent: "space-between", children: [_jsx(Text, { ...secondary, children: modeText }), centre ? (() => {
135
135
  const pad = centreLayout(cellWidth(modeText), cellWidth(centre), cellWidth(rcText), cols);
136
136
  return _jsx(Text, { color: switcher?.focused ? "cyan" : undefined, dimColor: !switcher?.focused, children: " ".repeat(pad.before) + centre + " ".repeat(Math.max(0, pad.after - 1)) });
137
- })() : null, _jsx(Text, { color: rcConnected ? "green" : rcActive ? "yellow" : "gray", bold: rcConnected || rcActive, dimColor: !rcConnected && !rcActive, children: rcText })] }))] }));
137
+ })() : null, _jsx(Text, { color: rcConnected ? "green" : rcActive ? "yellow" : theme.secondary, bold: rcConnected || rcActive, children: rcText })] }))] }));
138
138
  // Fullscreen (opt-in): a full-terminal-height column. The transcript fills a clipped, bottom-anchored
139
139
  // region (non-Static tail) so the newest output sits just above a composer pinned to the very bottom —
140
140
  // no dead space. Off by default: inline keeps the terminal's native scrollback (mouse-scroll + copy).
@@ -1,5 +1,6 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { Box, Text, useInput } from "ink";
3
+ import { secondary } from "./theme.js";
3
4
  // A short, human summary of what the tool is about to do — the args that matter, truncated. Keeps the
4
5
  // prompt to a couple of lines instead of dumping raw JSON.
5
6
  function summarize(name, args) {
@@ -45,9 +46,9 @@ export function ApprovalPrompt({ approval, onDecide, suspended = false, waiting
45
46
  if (!approval)
46
47
  return null;
47
48
  const detail = summarize(approval.name, approval.args);
48
- return (_jsxs(Box, { flexDirection: "column", marginTop: 1, marginBottom: 1, borderStyle: "round", borderColor: "yellow", paddingX: 1, children: [_jsxs(Text, { color: "yellow", bold: true, children: ["⚠ Operator wants to run ", _jsx(Text, { color: "magenta", children: approval.name })] }), detail ? _jsx(Text, { dimColor: true, children: " " + detail }) : null, approval.ctx ? _jsx(Text, { color: "red", bold: true, children: ` ${approval.ctx.line} — a human signs this one, every time` }) : null, approval.ctx?.preview ? _jsx(Text, { children: " the screen it will act on: " + approval.ctx.preview }) : null, suspended
49
- ? _jsx(Text, { dimColor: true, children: " waiting · " + (waiting ?? "another prompt has the keyboard") })
49
+ return (_jsxs(Box, { flexDirection: "column", marginTop: 1, marginBottom: 1, borderStyle: "round", borderColor: "yellow", paddingX: 1, children: [_jsxs(Text, { color: "yellow", bold: true, children: ["⚠ Operator wants to run ", _jsx(Text, { color: "magenta", children: approval.name })] }), detail ? _jsx(Text, { ...secondary, children: " " + detail }) : null, approval.ctx ? _jsx(Text, { color: "red", bold: true, children: ` ${approval.ctx.line} — a human signs this one, every time` }) : null, approval.ctx?.preview ? _jsx(Text, { children: " the screen it will act on: " + approval.ctx.preview }) : null, suspended
50
+ ? _jsx(Text, { ...secondary, children: " waiting · " + (waiting ?? "another prompt has the keyboard") })
50
51
  : approval.ctx?.once
51
- ? _jsxs(Text, { children: [" ", _jsx(Text, { color: "green", children: "[a]" }), " allow once ", _jsx(Text, { color: "red", children: "[d]" }), " deny ", _jsx(Text, { dimColor: true, children: "(Enter=allow \u00B7 Esc=deny)" })] })
52
- : _jsxs(Text, { children: [" ", _jsx(Text, { color: "green", children: "[a]" }), " allow once ", _jsx(Text, { color: "cyan", children: "[s]" }), " allow always ", _jsx(Text, { color: "red", children: "[d]" }), " deny ", _jsx(Text, { dimColor: true, children: "(Enter=allow \u00B7 Esc=deny)" })] })] }));
52
+ ? _jsxs(Text, { children: [" ", _jsx(Text, { color: "green", children: "[a]" }), " allow once ", _jsx(Text, { color: "red", children: "[d]" }), " deny ", _jsx(Text, { ...secondary, children: "(Enter=allow \u00B7 Esc=deny)" })] })
53
+ : _jsxs(Text, { children: [" ", _jsx(Text, { color: "green", children: "[a]" }), " allow once ", _jsx(Text, { color: "cyan", children: "[s]" }), " allow always ", _jsx(Text, { color: "red", children: "[d]" }), " deny ", _jsx(Text, { ...secondary, children: "(Enter=allow \u00B7 Esc=deny)" })] })] }));
53
54
  }
@@ -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 } from "ink";
10
10
  import { useClickList } from "./MouseProvider.js";
11
+ import { secondary } from "./theme.js";
11
12
  const VISIBLE_ROWS = 12; // window height; longer libraries scroll within it (narrow with / search)
12
13
  // Pure keystroke reducer: returns the next state and/or an intent to dispatch. No React, no I/O — the whole
13
14
  // selection / search / delete-confirm behavior is unit-tested against this directly.
@@ -98,12 +99,12 @@ export function ArtifactPicker({ pending, suspended = false }) {
98
99
  if (!pending)
99
100
  return null;
100
101
  const { loading, error, note } = pending;
101
- return (_jsxs(Box, { flexDirection: "column", marginTop: 1, marginBottom: 1, borderStyle: "round", borderColor: "cyan", paddingX: 1, children: [_jsxs(Text, { color: "cyan", bold: true, children: ["◆ Artifacts ", _jsx(Text, { color: "cyan", bold: true, children: "[Mine]" }), _jsx(Text, { dimColor: true, children: " All Shared (soon)" })] }), st.mode === "search" ? (_jsxs(Text, { children: [_jsx(Text, { color: "magenta", children: "search› " }), st.query, _jsx(Text, { color: "cyan", children: "\u258C" })] })) : null, loading ? _jsx(Text, { dimColor: true, children: " loading…" }) : null, error ? _jsx(Text, { color: "red", children: " " + error }) : null, !loading && !error && n === 0 ? (_jsx(Text, { dimColor: true, children: st.query ? ` no artifacts match "${st.query}"` : " no artifacts yet — ask Operator to make one" })) : null, !loading && !error && items.slice(start, end).map((it, i) => {
102
+ return (_jsxs(Box, { flexDirection: "column", marginTop: 1, marginBottom: 1, borderStyle: "round", borderColor: "cyan", paddingX: 1, children: [_jsxs(Text, { color: "cyan", bold: true, children: ["◆ Artifacts ", _jsx(Text, { color: "cyan", bold: true, children: "[Mine]" }), _jsx(Text, { ...secondary, children: " All Shared (soon)" })] }), st.mode === "search" ? (_jsxs(Text, { children: [_jsx(Text, { color: "magenta", children: "search› " }), st.query, _jsx(Text, { color: "cyan", children: "\u258C" })] })) : null, loading ? _jsx(Text, { ...secondary, children: " loading…" }) : null, error ? _jsx(Text, { color: "red", children: " " + error }) : null, !loading && !error && n === 0 ? (_jsx(Text, { ...secondary, children: st.query ? ` no artifacts match "${st.query}"` : " no artifacts yet — ask Operator to make one" })) : null, !loading && !error && items.slice(start, end).map((it, i) => {
102
103
  const idx = start + i;
103
104
  const sel = idx === hi;
104
105
  const armed = st.confirmDeleteId === it.id;
105
- return (_jsxs(Text, { children: [" ", sel ? _jsx(Text, { color: "cyan", bold: true, children: "❯ " }) : _jsx(Text, { children: " " }), _jsx(Text, { bold: sel, children: it.title || "(untitled)" }), armed ? _jsx(Text, { color: "red", children: " delete? press d again" }) : _jsx(Text, { dimColor: true, children: ` compose${it.content_type ? " · " + it.content_type : ""}` })] }, it.id));
106
- }), n > end ? _jsx(Text, { dimColor: true, children: ` ⋯ +${n - end} more · / to search` }) : null, note ? _jsx(Text, { color: "green", children: " " + note }) : null, _jsx(Text, { dimColor: true, children: st.mode === "search"
106
+ return (_jsxs(Text, { children: [" ", sel ? _jsx(Text, { color: "cyan", bold: true, children: "❯ " }) : _jsx(Text, { children: " " }), _jsx(Text, { bold: sel, children: it.title || "(untitled)" }), armed ? _jsx(Text, { color: "red", children: " delete? press d again" }) : _jsx(Text, { ...secondary, children: ` compose${it.content_type ? " · " + it.content_type : ""}` })] }, it.id));
107
+ }), n > end ? _jsx(Text, { ...secondary, children: ` ⋯ +${n - end} more · / to search` }) : null, note ? _jsx(Text, { color: "green", children: " " + note }) : null, _jsx(Text, { ...secondary, children: st.mode === "search"
107
108
  ? " type to filter · Enter to search · Esc for the list"
108
109
  : " ↑/↓ move · Enter attach · c copy url · d delete · r refresh · / search · esc close" })] }));
109
110
  }
@@ -1,6 +1,7 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
2
  import { Box, Text, useInput } from "ink";
3
3
  import { Masthead } from "./Masthead.js";
4
+ import { secondary } from "./theme.js";
4
5
  export function AuthScreen({ version, ctxWindow, authBase, pending, error, onChoice }) {
5
6
  useInput((input, key) => {
6
7
  if (pending)
@@ -13,5 +14,5 @@ export function AuthScreen({ version, ctxWindow, authBase, pending, error, onCho
13
14
  else if (key.return || c === "g")
14
15
  onChoice("guest");
15
16
  });
16
- return (_jsxs(Box, { flexDirection: "column", children: [_jsx(Masthead, { info: `Operator${ctxWindow ? ` · ${ctxWindow >= 1_000_000 ? "1M" : `${Math.round(ctxWindow / 1024)}K`}` : ""} · v${version}` }), _jsx(Box, { marginTop: 1, flexDirection: "column", paddingLeft: 1, children: pending ? (_jsxs(_Fragment, { children: [_jsxs(Text, { children: ["Signing in \u2014 open ", _jsx(Text, { color: "cyanBright", children: pending.url })] }), _jsxs(Text, { children: ["and enter code ", _jsx(Text, { bold: true, color: "whiteBright", children: pending.userCode })] }), _jsx(Text, { dimColor: true, children: "Waiting for approval in your browser\u2026 (Esc to cancel)" })] })) : (_jsxs(_Fragment, { children: [_jsx(Text, { color: "whiteBright", children: "Welcome to Operator." }), _jsx(Text, { dimColor: true, children: "A local terminal coding agent on your own model." }), _jsxs(Box, { marginTop: 1, flexDirection: "column", children: [_jsxs(Text, { children: [_jsx(Text, { color: "magentaBright", bold: true, children: " s" }), " Sign in ", _jsx(Text, { dimColor: true, children: "\u2014 connect your account (browser approval)" })] }), _jsxs(Text, { children: [_jsx(Text, { color: "magentaBright", bold: true, children: " u" }), " Create account ", _jsxs(Text, { dimColor: true, children: ["\u2014 register at ", authBase.replace(/^https?:\/\//, "")] })] }), _jsxs(Text, { children: [_jsx(Text, { color: "magentaBright", bold: true, children: " \u21B5" }), " Continue as guest ", _jsx(Text, { dimColor: true, children: "\u2014 no account needed; sign in later with /login" })] })] }), error ? _jsx(Box, { marginTop: 1, children: _jsx(Text, { color: "red", children: error }) }) : null] })) })] }));
17
+ return (_jsxs(Box, { flexDirection: "column", children: [_jsx(Masthead, { info: `Operator${ctxWindow ? ` · ${ctxWindow >= 1_000_000 ? "1M" : `${Math.round(ctxWindow / 1024)}K`}` : ""} · v${version}` }), _jsx(Box, { marginTop: 1, flexDirection: "column", paddingLeft: 1, children: pending ? (_jsxs(_Fragment, { children: [_jsxs(Text, { children: ["Signing in \u2014 open ", _jsx(Text, { color: "cyanBright", children: pending.url })] }), _jsxs(Text, { children: ["and enter code ", _jsx(Text, { bold: true, color: "whiteBright", children: pending.userCode })] }), _jsx(Text, { ...secondary, children: "Waiting for approval in your browser\u2026 (Esc to cancel)" })] })) : (_jsxs(_Fragment, { children: [_jsx(Text, { color: "whiteBright", children: "Welcome to Operator." }), _jsx(Text, { ...secondary, children: "A local terminal coding agent on your own model." }), _jsxs(Box, { marginTop: 1, flexDirection: "column", children: [_jsxs(Text, { children: [_jsx(Text, { color: "magentaBright", bold: true, children: " s" }), " Sign in ", _jsx(Text, { ...secondary, children: "\u2014 connect your account (browser approval)" })] }), _jsxs(Text, { children: [_jsx(Text, { color: "magentaBright", bold: true, children: " u" }), " Create account ", _jsxs(Text, { ...secondary, children: ["\u2014 register at ", authBase.replace(/^https?:\/\//, "")] })] }), _jsxs(Text, { children: [_jsx(Text, { color: "magentaBright", bold: true, children: " \u21B5" }), " Continue as guest ", _jsx(Text, { ...secondary, children: "\u2014 no account needed; sign in later with /login" })] })] }), error ? _jsx(Box, { marginTop: 1, children: _jsx(Text, { color: "red", children: error }) }) : null] })) })] }));
17
18
  }
@@ -1,7 +1,10 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ // Background sub-agents list: working / idle / stopped (SPEC §7). idle never means dead —
3
+ // spawn_background keeps full state and just stops burning rounds.
4
+ import { stopReasonOf } from "./reportLine.js";
2
5
  import { Box, Text } from "ink";
3
6
  import { OrbitGlyph } from "./ActivitySpinner.js";
4
- import { theme } from "./theme.js";
7
+ import { theme, secondary } from "./theme.js";
5
8
  import { useTick } from "./tick.js";
6
9
  import { termCols, termRows } from "./term.js";
7
10
  import { cellWidth, truncateToWidth } from "./StatusRule.js";
@@ -86,7 +89,7 @@ export function detailLine(a) {
86
89
  if (a.status === "idle")
87
90
  return { text: "result posted — scroll up or /agents to review", tone: "dim" };
88
91
  if (a.status === "stopped")
89
- return { text: a.endReason ?? "errored — check transcript for details", tone: "dim" };
92
+ return { text: stopReasonOf(a) ?? "errored — check transcript for details", tone: "dim" };
90
93
  if (a.status === "queued")
91
94
  return { text: a.queueReason ? `waiting: ${a.queueReason}` : "waiting for a free slot", tone: "dim" };
92
95
  const steps = a.steps ?? [];
@@ -100,7 +103,7 @@ export function detailLine(a) {
100
103
  // every tick, and Ink repainted the whole frame (the flashing, 10/31).
101
104
  function AgentRows({ a }) {
102
105
  const d = detailLine(a);
103
- 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: colorOf(a), children: glyphOf(a) }), " ", _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 = statusOf(a); 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) }) })] }));
106
+ 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: colorOf(a), children: glyphOf(a) }), " ", _jsx(Text, { bold: true, children: a.name ?? a.label }), a.name ? _jsx(Text, { ...secondary, 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, { ...secondary, children: (() => { const m = metrics(a); const ds = statusOf(a); return m ? `${m} · ${ds}` : ds; })() }) })] }), _jsx(Box, { paddingLeft: 2, children: _jsx(Text, { ...secondary, 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, { ...secondary, wrap: "truncate-end", children: cap(d.text, 110) }) })] }));
104
107
  }
105
108
  // Cap how many agent rows the DYNAMIC panel renders. Each agent is ~3 lines; a full fan-out (6–8 agents)
106
109
  // makes the non-Static frame tall AND it re-renders on every sub-agent token — so when it sits near the
@@ -121,7 +124,7 @@ function ShellJobs({ jobs }) {
121
124
  const hidden = jobs.length - shown.length;
122
125
  const done = jobs.length - running.length;
123
126
  const counts = [running.length ? `${running.length} running` : "", done ? `${done} finished` : ""].filter(Boolean).join(" · ");
124
- return (_jsxs(Box, { flexDirection: "column", children: [_jsx(Text, { dimColor: true, children: `shell jobs · ${counts}` }), shown.map((j) => (_jsxs(Box, { justifyContent: "space-between", children: [_jsxs(Text, { children: [j.status === "running" ? _jsx(OrbitGlyph, {}) : _jsx(Text, { color: j.status === "done" ? theme.success : j.status === "failed" ? theme.error : theme.muted, children: j.status === "done" ? "✓" : "✗" }), " ", j.id, " ", _jsx(Text, { dimColor: true, children: cap(j.cmd.replace(/\s+/g, " "), 40) })] }), _jsx(Text, { dimColor: true, children: `${fmtJobTime(j.status === "running" ? Date.now() - j.startedAt : j.elapsedMs)} · ${j.status === "failed" ? `exit ${j.code ?? "?"}` : j.status}` })] }, j.id))), hidden > 0 ? _jsx(Text, { dimColor: true, children: ` +${hidden} more · /jobs` }) : null] }));
127
+ return (_jsxs(Box, { flexDirection: "column", children: [_jsx(Text, { ...secondary, children: `shell jobs · ${counts}` }), shown.map((j) => (_jsxs(Box, { justifyContent: "space-between", children: [_jsxs(Text, { children: [j.status === "running" ? _jsx(OrbitGlyph, {}) : _jsx(Text, { color: j.status === "done" ? theme.success : j.status === "failed" ? theme.error : theme.muted, children: j.status === "done" ? "✓" : "✗" }), " ", j.id, " ", _jsx(Text, { ...secondary, children: cap(j.cmd.replace(/\s+/g, " "), 40) })] }), _jsx(Text, { ...secondary, children: `${fmtJobTime(j.status === "running" ? Date.now() - j.startedAt : j.elapsedMs)} · ${j.status === "failed" ? `exit ${j.code ?? "?"}` : j.status}` })] }, j.id))), hidden > 0 ? _jsx(Text, { ...secondary, children: ` +${hidden} more · /jobs` }) : null] }));
125
128
  }
126
129
  export function BgPanel({ agents, jobs = [], title = "sub-agents" }) {
127
130
  if (agents.length === 0 && jobs.length === 0)
@@ -152,7 +155,7 @@ export function BgPanel({ agents, jobs = [], title = "sub-agents" }) {
152
155
  // frame SHORT — BG_MAX_VISIBLE caps rows, activity lines are capped — so the box stays a few rows tall.
153
156
  // If stray border rows ever reappear on a very long turn, drop `borderStyle`/`borderColor` for the
154
157
  // borderless column (the label line alone still heads it).
155
- 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 })] }));
158
+ return (_jsxs(Box, { flexDirection: "column", marginTop: 1, borderStyle: "round", borderColor: theme.muted, paddingX: 1, children: [_jsx(Text, { ...secondary, children: label }), shown.map((a) => _jsx(AgentRows, { a: a }, a.id)), hidden > 0 ? _jsx(Text, { ...secondary, children: ` +${hidden} more running` }) : null, _jsx(ShellJobs, { jobs: jobs })] }));
156
159
  }
157
160
  const LANE_GLYPH = {
158
161
  main: "✷", working: "◠", waiting: "◌", queued: "◌", done: "✓", stopped: "■", error: "✗", stuck: "⚠", job: "▶", jobDone: "✓", jobFailed: "✗",
@@ -180,7 +183,7 @@ export function agentLaneOf(a, now, ctx = {}) {
180
183
  return { ...base, tone: "done", mission: join("done", a.verified === true ? "✓ verified" : a.verified === false ? "✗ unverified" : undefined, a.written?.length ? `wrote ${a.written.slice(-1).map((p) => p.split("/").pop()).join("")}` : undefined, "report delivered") };
181
184
  if (a.status === "stopped") {
182
185
  const err = a.endKind === "failed" || a.endKind === "error" || !a.endKind;
183
- return { ...base, tone: err ? "error" : "stopped", mission: join(a.endReason ?? "errored", a.headline?.startsWith("partial:") ? "partial notes delivered" : undefined) };
186
+ return { ...base, tone: err ? "error" : "stopped", mission: join(stopReasonOf(a) ?? "errored", a.headline?.startsWith("partial:") ? "partial notes delivered" : undefined) };
184
187
  }
185
188
  if (a.stuck)
186
189
  return { ...base, tone: "stuck", mission: `stuck: ${a.stuck} · /agents ${(a.name ?? a.id).toLowerCase()} msg | stop` };
@@ -226,7 +229,7 @@ export function laneHeader(lanes, cols, pool) {
226
229
  export const LANES_SHORT_ROWS = 30;
227
230
  function LaneRow({ lane, cols }) {
228
231
  const { left, mission, right } = laneRow(lane, cols);
229
- return (_jsxs(Text, { children: [" ", lane.tone === "working" ? _jsx(OrbitGlyph, {}) : _jsx(Text, { color: LANE_COLOR[lane.tone], children: LANE_GLYPH[lane.tone] }), " ", _jsx(Text, { bold: true, children: left.slice(0, 6) }), _jsx(Text, { dimColor: true, children: left.slice(6) }), _jsx(Text, { color: lane.tone === "stuck" ? theme.warn : undefined, dimColor: lane.tone !== "stuck" && lane.tone !== "main" && lane.tone !== "working", children: mission }), right ? _jsx(Text, { dimColor: true, children: ` ${right}` }) : null] }));
232
+ return (_jsxs(Text, { children: [" ", lane.tone === "working" ? _jsx(OrbitGlyph, {}) : _jsx(Text, { color: LANE_COLOR[lane.tone], children: LANE_GLYPH[lane.tone] }), " ", _jsx(Text, { bold: true, children: left.slice(0, 6) }), _jsx(Text, { ...secondary, children: left.slice(6) }), _jsx(Text, { color: lane.tone === "stuck" ? theme.warn : undefined, dimColor: lane.tone !== "stuck" && lane.tone !== "main" && lane.tone !== "working", children: mission }), right ? _jsx(Text, { ...secondary, children: ` ${right}` }) : null] }));
230
233
  }
231
234
  /** The lanes view: one row per live worker, finished agents lingering until they are reaped. */
232
235
  export function Lanes({ main, agents, jobs, mainServing, maxRunning, pool, warnings = [] }) {
@@ -241,5 +244,5 @@ export function Lanes({ main, agents, jobs, mainServing, maxRunning, pool, warni
241
244
  ];
242
245
  const cap = termRows() < LANES_SHORT_ROWS ? 3 : 8;
243
246
  const shown = lanes.slice(0, cap);
244
- return (_jsxs(Box, { flexDirection: "column", marginTop: 1, children: [_jsx(Text, { dimColor: true, children: laneHeader(lanes, cols, pool) }), shown.map((l) => _jsx(LaneRow, { lane: l, cols: cols }, l.key)), warnings.slice(0, 1).map((w) => _jsx(Text, { color: theme.warn, wrap: "truncate-end", children: ` ⚠ ${w}` }, w)), lanes.length > shown.length ? _jsx(Text, { dimColor: true, children: ` +${lanes.length - shown.length} more · /agents` }) : null] }));
247
+ return (_jsxs(Box, { flexDirection: "column", marginTop: 1, children: [_jsx(Text, { ...secondary, children: laneHeader(lanes, cols, pool) }), shown.map((l) => _jsx(LaneRow, { lane: l, cols: cols }, l.key)), warnings.slice(0, 1).map((w) => _jsx(Text, { color: theme.warn, wrap: "truncate-end", children: ` ⚠ ${w}` }, w)), lanes.length > shown.length ? _jsx(Text, { ...secondary, children: ` +${lanes.length - shown.length} more · /agents` }) : null] }));
245
248
  }
@@ -24,6 +24,7 @@ import { touchInput } from "../idle/activity.js";
24
24
  import { isSlashCommand } from "../util/slash.js";
25
25
  import { agentMention, matchAgentMentions, mentionCompletion, mentionMenuLine } from "./conversations.js";
26
26
  import { termCols } from "./term.js";
27
+ import { secondary } from "./theme.js";
27
28
  const PASTE_START = "\x1b[200~";
28
29
  const PASTE_END = "\x1b[201~";
29
30
  export function Composer({ onSubmit, onInterrupt, onQueue, onSteer, disabled, suspended, onCycleMode, onCycleContext, onBackground, queued = 0, onEditQueued, onDropQueued, nextSteps = 0, onPickNext, onDismissNext, agents = [], onAgentMessage, onSendTo, onFocusSwitcher, onActNow, onOpenFinder, onVoiceKey, prompt = "› " }) {
@@ -329,11 +330,11 @@ export function Composer({ onSubmit, onInterrupt, onQueue, onSteer, disabled, su
329
330
  // Surface any image/video paths in the draft as attachment chips so the user can see multiple
330
331
  // media are attached (dragged/pasted paths land in the text). De-duped, basename only.
331
332
  const attachments = Array.from(new Set(value.match(MEDIA_RE) ?? []));
332
- return (_jsxs(Box, { flexDirection: "column", children: [lines.map((line, i) => (_jsxs(Text, { children: [i === 0 ? prompt : " ", line, i === lines.length - 1 ? "▌" : ""] }, i))), value.length > LONG_DRAFT && _jsx(Text, { dimColor: true, children: " ctrl+u clear" }), attachments.length > 0 && (_jsx(Text, { dimColor: true, children: " " + attachments.map((a) => `${VIDEO_RE.test(a) ? "▷ vid" : "◇ img"}:${a.split("/").pop()}`).join(" ") })), menuMatches.length > 0 && (_jsxs(Box, { flexDirection: "column", children: [menuMatches.slice(0, 10).map((c, i) => {
333
+ return (_jsxs(Box, { flexDirection: "column", children: [lines.map((line, i) => (_jsxs(Text, { children: [i === 0 ? prompt : " ", line, i === lines.length - 1 ? "▌" : ""] }, i))), value.length > LONG_DRAFT && _jsx(Text, { ...secondary, children: " ctrl+u clear" }), attachments.length > 0 && (_jsx(Text, { ...secondary, children: " " + attachments.map((a) => `${VIDEO_RE.test(a) ? "▷ vid" : "◇ img"}:${a.split("/").pop()}`).join(" ") })), menuMatches.length > 0 && (_jsxs(Box, { flexDirection: "column", children: [menuMatches.slice(0, 10).map((c, i) => {
333
334
  const on = i === menuSel;
334
335
  const label = `/${c.name}${c.args ? " " + c.args : ""}`.padEnd(24);
335
- return (_jsxs(Text, { children: [_jsx(Text, { color: on ? "green" : undefined, bold: on, children: (on ? "▸ " : " ") + label }), _jsx(Text, { dimColor: true, children: c.description })] }, c.name));
336
- }), menuMatches.length > 10 && _jsx(Text, { dimColor: true, children: ` …and ${menuMatches.length - 10} more` })] })), atMatches ? _jsx(Text, { dimColor: true, children: mentionMenuLine(atMatches, atSel, termCols()) }) : null] }));
336
+ return (_jsxs(Text, { children: [_jsx(Text, { color: on ? "green" : undefined, bold: on, children: (on ? "▸ " : " ") + label }), _jsx(Text, { ...secondary, children: c.description })] }, c.name));
337
+ }), menuMatches.length > 10 && _jsx(Text, { ...secondary, children: ` …and ${menuMatches.length - 10} more` })] })), atMatches ? _jsx(Text, { ...secondary, children: mentionMenuLine(atMatches, atSel, termCols()) }) : null] }));
337
338
  }
338
339
  // A draft this long (an injected or recalled message) shows the one-key way out under it.
339
340
  const LONG_DRAFT = 500;
package/dist/ui/Header.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 { prettyRoute } from "./StatusRule.js"; // the ONE outward-name rule, shared with the status rule
6
6
  const STAR = "✷"; // ✷ — the AXE signal star (brand glyph, matches ThinkingSpinner)
7
7
  function tierLabel(ctx) {
@@ -21,5 +21,5 @@ export function Header({ version, route = "operator", ctxWindow, user, build })
21
21
  const left = ` ${STAR} OPERATOR`;
22
22
  const right = `${model} · v${version}${build ? ` ·${build}` : ""} · ${who} `;
23
23
  const gap = Math.max(1, cols - left.length - right.length);
24
- return (_jsxs(Box, { flexDirection: "column", children: [_jsxs(Box, { children: [_jsx(Text, { color: theme.accent, bold: true, children: ` ${STAR} ` }), _jsx(Text, { bold: true, color: theme.textBright, children: "OPERATOR" }), _jsx(Text, { children: " ".repeat(gap) }), _jsx(Text, { dimColor: true, children: `${model} · v${version}${build ? ` ·${build}` : ""} · ` }), _jsx(Text, { color: user ? theme.success : undefined, dimColor: !user, children: who + " " })] }), _jsx(Text, { dimColor: true, children: "─".repeat(cols) })] }));
24
+ return (_jsxs(Box, { flexDirection: "column", children: [_jsxs(Box, { children: [_jsx(Text, { color: theme.accent, bold: true, children: ` ${STAR} ` }), _jsx(Text, { bold: true, color: theme.textBright, children: "OPERATOR" }), _jsx(Text, { children: " ".repeat(gap) }), _jsx(Text, { ...secondary, children: `${model} · v${version}${build ? ` ·${build}` : ""} · ` }), _jsx(Text, { color: user ? theme.success : undefined, dimColor: !user, children: who + " " })] }), _jsx(Text, { dimColor: true, children: "─".repeat(cols) })] }));
25
25
  }