@0perator/operator 0.2.2-next.1 → 0.2.5

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 (65) hide show
  1. package/dist/autonomy/index.js +14 -5
  2. package/dist/autonomy/session-factory.js +7 -1
  3. package/dist/cli.js +90 -19
  4. package/dist/config/features.js +7 -0
  5. package/dist/config/persona.js +6 -3
  6. package/dist/config/settings.js +17 -0
  7. package/dist/engine/agent.js +8 -0
  8. package/dist/engine/aurora.js +51 -12
  9. package/dist/engine/batch-hints.js +45 -0
  10. package/dist/engine/batch-scheduler.js +23 -7
  11. package/dist/engine/compaction.js +8 -1
  12. package/dist/engine/messages.js +5 -0
  13. package/dist/engine/native-vision-node.js +88 -10
  14. package/dist/engine/native-vision.js +25 -7
  15. package/dist/engine/rolling-summary.js +3 -2
  16. package/dist/engine/router-adapter.js +1 -0
  17. package/dist/engine/speed-compaction.js +7 -0
  18. package/dist/engine/token-meter.js +1 -1
  19. package/dist/mcp/index.js +2 -2
  20. package/dist/products/voice.js +44 -9
  21. package/dist/router/activation.js +132 -0
  22. package/dist/router/discovery.js +4 -3
  23. package/dist/router/model-list.js +79 -0
  24. package/dist/router/models.js +12 -1
  25. package/dist/router/router.js +0 -11
  26. package/dist/session.js +239 -33
  27. package/dist/tools/classes.js +2 -0
  28. package/dist/tools/deferred.js +11 -6
  29. package/dist/tools/executor.js +17 -3
  30. package/dist/tools/micro-assist.js +105 -0
  31. package/dist/tools/read-ledger.js +4 -0
  32. package/dist/tools/readonly-shell.js +92 -0
  33. package/dist/tools/registry.js +68 -61
  34. package/dist/tools/sandbox.js +1 -1
  35. package/dist/tools/semantic-compress.js +1 -9
  36. package/dist/tools/shell-session.js +56 -1
  37. package/dist/tools/tool-output-spill.js +1 -1
  38. package/dist/ui/ActivitySpinner.js +2 -2
  39. package/dist/ui/App.js +8 -8
  40. package/dist/ui/ApprovalPrompt.js +5 -4
  41. package/dist/ui/ArtifactPicker.js +4 -3
  42. package/dist/ui/AuthScreen.js +2 -1
  43. package/dist/ui/BgPanel.js +6 -6
  44. package/dist/ui/Composer.js +4 -3
  45. package/dist/ui/Header.js +2 -2
  46. package/dist/ui/Markdown.js +50 -77
  47. package/dist/ui/PlanPane.js +5 -5
  48. package/dist/ui/QuestionPrompt.js +2 -1
  49. package/dist/ui/SecretPrompt.js +2 -1
  50. package/dist/ui/SessionPicker.js +4 -3
  51. package/dist/ui/SkillFinder.js +3 -2
  52. package/dist/ui/StatsCard.js +2 -2
  53. package/dist/ui/StatusRule.js +2 -2
  54. package/dist/ui/SummaryCard.js +2 -2
  55. package/dist/ui/Table.js +25 -24
  56. package/dist/ui/ThinkingSpinner.js +2 -1
  57. package/dist/ui/ToolBatch.js +3 -3
  58. package/dist/ui/ToolStep.js +4 -4
  59. package/dist/ui/Transcript.js +12 -12
  60. package/dist/ui/UpdatePrompt.js +2 -1
  61. package/dist/ui/activationFlow.js +126 -0
  62. package/dist/ui/inline.js +109 -0
  63. package/dist/ui/modelPicker.js +12 -7
  64. package/dist/ui/theme.js +4 -0
  65. package/package.json +1 -1
@@ -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, { dimColor: true, children: ` ${summaryLine(summary)}` })] }), summary.time ? ledgerLines(summary.time, summary.time, termCols() - 5).map((l, i) => (_jsxs(Text, { dimColor: true, children: [" ", _jsx(Text, { color: i === 0 ? theme.info : undefined, children: l.slice(0, 4) }), l.slice(4)] }, `t${i}`))) : null, summary.lastRound ? _jsx(Text, { dimColor: true, 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] }));
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; the width math reuses cellWidth/truncateToWidth (the same conservative accounting that
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 { cellWidth, truncateToWidth } from "./StatusRule.js";
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 (keeps "…" legible)
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
- /** Natural column widths = the widest cell (header or body) per column, measured in terminal cells. */
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(cellWidth(h), ...t.rows.map((r) => cellWidth(r[c] ?? ""))));
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
- /** Fit one cell to a column: truncate to width, then pad per alignment. Pure string op. */
89
- export function padCell(text, width, align) {
90
- const t = truncateToWidth(text, width);
91
- const gap = width - cellWidth(t);
92
- if (gap <= 0)
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 ≤ U+257F, so cellWidth counts them as one cell — no column skew).
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 cols = termCols();
108
- const widths = fitWidths(naturalWidths(table), Math.max(20, cols - 1));
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, bold, key) => (_jsxs(Text, { children: [_jsx(Text, { color: theme.muted, children: "\u2502" }), widths.map((w, c) => (_jsxs(React.Fragment, { children: [_jsx(Text, { children: " " }), _jsx(Text, { bold: bold, children: padCell(cells[c] ?? "", w, table.aligns[c] ?? "left") }), _jsx(Text, { children: " " }), _jsx(Text, { color: theme.muted, children: "\u2502" })] }, c)))] }, key));
113
- 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) => dataRow(r, false, `tr${i}`)), _jsx(Text, { color: theme.muted, children: bot })] }));
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, { dimColor: true, children: " " + metrics }) : null] }));
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
  }
@@ -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, { dimColor: true, children: ` ${fmtDur(durationMs)}` })] }), steps.map((step) => _jsx(ToolStep, { step: step }, step.id))] }));
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, { dimColor: true, 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, { dimColor: true, 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))] }));
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
  }
@@ -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, { dimColor: true, children: line.slice(1) })] });
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, { dimColor: true, children: ` · ${t.note}` }) : null] });
126
- })(), isRunningMedia ? _jsxs(Text, { children: [" ", _jsx(Text, { color: theme.mediaProgress, children: renderSweepBar(frame) })] }) : null, elapsed != null ? _jsxs(Text, { dimColor: true, 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, { 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)))] }));
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
  }
@@ -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, { dimColor: true, children: ` ${beamDropHint(drop)} · ${hhmm(at)}` })] }) }));
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, { dimColor: true, children: ` ${lead}${hhmm(at)}` })] }), shown.map((l, i) => _jsx(Text, { dimColor: true, children: " " + l }, i)), clipped > 0 ? _jsx(Text, { dimColor: true, children: ` ⋯ +${clipped} more line${clipped === 1 ? "" : "s"}` }) : null] }));
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, { dimColor: true, children: body.slice(name.length) }), hint ? _jsx(Text, { color: theme.info, children: hint }) : null] }));
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, { dimColor: true, children: ` ${message.tag}` }) : null] });
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, { dimColor: true, children: message.content }); // slash-command output / status notes
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 stays plain text (a half-open ``` fence can't swallow it) AND is height-bounded: while
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, { dimColor: true, children: `⋯ +${r.clipped} more thinking line${r.clipped === 1 ? "" : "s"} above` }) : null, r ? _jsx(Text, { dimColor: true, children: r.text }) : null, a && a.clipped > 0 ? _jsx(Text, { dimColor: true, children: `⋯ +${a.clipped} more line${a.clipped === 1 ? "" : "s"} above (full text shown when complete)` }) : null, a ? _jsx(Text, { children: a.text }) : null] }));
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, { dimColor: true, children: `⋯ ${thoughts.hidden} earlier thinking line${thoughts.hidden === 1 ? "" : "s"} hidden` }) : null, thoughts ? _jsx(Text, { dimColor: true, children: thoughts.text }) : null, message.content ? _jsx(Markdown, { content: message.content }) : null] }));
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, { dimColor: true, children: `⋯ ${olderOff} earlier line(s) scrolled off` })) : null, tail.map((entry) => _jsx(TranscriptRow, { entry: entry, cols: cols }, entryKey(entry))), newerOff > 0
209
- ? _jsx(Text, { dimColor: true, children: `⋯ ${newerOff} newer line(s) below — scroll down (new output jumps here)` })
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] }));
@@ -4,6 +4,7 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
4
4
  // its row, Esc or ctrl+c skips this launch.
5
5
  import { useState } from "react";
6
6
  import { Box, Text, useInput } from "ink";
7
+ import { secondary } from "./theme.js";
7
8
  const CHOICES = ["update", "skip", "skip-version"];
8
9
  export function choiceLabels(p) {
9
10
  return [`Update now (runs \`${p.command}\`)`, "Skip", "Skip until next version"];
@@ -36,5 +37,5 @@ export function UpdatePrompt({ pending, suspended = false }) {
36
37
  }, { isActive: !!pending && !suspended });
37
38
  if (!pending)
38
39
  return null;
39
- return (_jsxs(Box, { flexDirection: "column", marginTop: 1, marginBottom: 1, borderStyle: "round", borderColor: "cyan", paddingX: 1, children: [_jsxs(Text, { bold: true, children: ["Update available · ", _jsx(Text, { dimColor: true, children: pending.current }), " → ", _jsx(Text, { color: "green", children: pending.version })] }), _jsx(Text, { dimColor: true, children: "Release notes: " + pending.notes }), _jsx(Text, { children: " " }), choiceLabels(pending).map((label, i) => (_jsxs(Text, { children: [i === sel ? _jsx(Text, { color: "cyan", bold: true, children: "› " }) : " ", _jsx(Text, { bold: i === sel, children: `${i + 1}. ${label}` })] }, label))), _jsx(Text, { children: " " }), _jsx(Text, { dimColor: true, children: suspended ? "waiting · another prompt has the keyboard" : "enter continue · esc skip" })] }));
40
+ return (_jsxs(Box, { flexDirection: "column", marginTop: 1, marginBottom: 1, borderStyle: "round", borderColor: "cyan", paddingX: 1, children: [_jsxs(Text, { bold: true, children: ["Update available · ", _jsx(Text, { ...secondary, children: pending.current }), " → ", _jsx(Text, { color: "green", children: pending.version })] }), _jsx(Text, { ...secondary, children: "Release notes: " + pending.notes }), _jsx(Text, { children: " " }), choiceLabels(pending).map((label, i) => (_jsxs(Text, { children: [i === sel ? _jsx(Text, { color: "cyan", bold: true, children: "› " }) : " ", _jsx(Text, { bold: i === sel, children: `${i + 1}. ${label}` })] }, label))), _jsx(Text, { children: " " }), _jsx(Text, { ...secondary, children: suspended ? "waiting · another prompt has the keyboard" : "enter continue · esc skip" })] }));
40
41
  }
@@ -0,0 +1,126 @@
1
+ // /model on a row with `activation` (router/activation.ts): check, show the plan, run on the owner's yes, and hand back
2
+ // to /model only once the command has succeeded. cli.tsx supplies the picker slot and the session.
3
+ import { activationLogPath, checkActivation, commandLine, ownerActivation, startActivation } from "../router/activation.js";
4
+ import { fmtWait } from "../router/read-rates.js";
5
+ export function createActivationFlow(deps) {
6
+ const read = deps.read ?? ownerActivation;
7
+ const tickMs = deps.tickMs ?? 1000;
8
+ let wanted = ""; // the id of the owner's latest pick: a finishing switch never overrides a later choice
9
+ let picks = 0;
10
+ let running;
11
+ const stay = (id, why) => deps.sys(`${id}: ${why} — stayed on ${deps.current()}`);
12
+ function ask(id, a, plan, refusal, proceed) {
13
+ if (refusal && !a.force) {
14
+ stay(id, refusal);
15
+ return;
16
+ }
17
+ const choice = refusal ? "force" : "run";
18
+ const argv = refusal ? a.force : a.command;
19
+ const first = refusal ? "Force the switch · interrupts the answer in progress" : "Switch · takes a few minutes, can be left running";
20
+ deps.open(`${id} is not being served. ${plan}${refusal ? ` — ${refusal}` : ""} · runs: ${commandLine(argv)}`, [first, `Cancel · stay on ${deps.current()}`], [choice, "stay"], (c) => { if (c !== "stay")
21
+ start(id, a, argv, c === "force", proceed); });
22
+ }
23
+ function start(id, a, argv, forced, proceed) {
24
+ if (running) {
25
+ running.show();
26
+ return;
27
+ }
28
+ let run;
29
+ try {
30
+ run = startActivation(argv, activationLogPath(id));
31
+ }
32
+ catch (e) {
33
+ stay(id, `could not start: ${e.message}`);
34
+ return;
35
+ }
36
+ const from = deps.current();
37
+ wanted = id;
38
+ let panel;
39
+ const question = () => `Switching to ${id} · ${fmtWait(run.elapsedMs() / 1000)}${run.lines().slice(-4).map((l) => `\n${l}`).join("")}`;
40
+ const rows = ["Leave it running (Esc) · /model " + id + " shows it again", "Stop the command · the switch may be left half done"];
41
+ const choices = ["leave", "stop"];
42
+ const show = () => { panel = deps.open(question(), rows, choices, (c) => { if (c === "stop")
43
+ run.stop(); }); };
44
+ running = { id, run, show };
45
+ show();
46
+ const timer = setInterval(() => { if (panel?.isOpen())
47
+ panel.update(question(), rows, choices); }, tickMs);
48
+ timer.unref();
49
+ void run.done.then(async (r) => {
50
+ clearInterval(timer);
51
+ running = undefined;
52
+ const watched = !!panel?.isOpen();
53
+ if (watched)
54
+ panel.close();
55
+ const took = fmtWait(run.elapsedMs() / 1000);
56
+ if (r.stopped) {
57
+ stay(id, `stopped after ${took} (log ${run.log})`);
58
+ return;
59
+ }
60
+ if (!r.ok) {
61
+ stay(id, `not switched after ${took}: ${r.refusal ?? r.reason} (log ${run.log})`);
62
+ if (r.refusal && a.force && !forced) {
63
+ if (watched && wanted === id)
64
+ ask(id, a, "The command refused.", r.refusal, proceed);
65
+ else
66
+ deps.sys(`/model ${id} offers to force it`);
67
+ }
68
+ return;
69
+ }
70
+ deps.sys(`${id}: ready after ${took} · ${r.reason}`);
71
+ const moved = () => wanted !== id || deps.current() !== from;
72
+ if (!deps.idle())
73
+ deps.sys(`${id}: the session switches when this turn ends`);
74
+ while (!deps.idle() && !moved())
75
+ await new Promise((done) => setTimeout(done, tickMs));
76
+ if (moved()) {
77
+ deps.sys(`${id} is ready; the session stays on ${deps.current()} — /model ${id} to use it`);
78
+ return;
79
+ }
80
+ proceed(watched);
81
+ });
82
+ }
83
+ return {
84
+ /** The owner picked `id`. False: the row has no activation, /model goes on as usual. True: handled here, and
85
+ * `proceed` runs once the model is served (`watched`: the progress panel was still open). */
86
+ pick(id, proceed) {
87
+ const mine = ++picks;
88
+ const entry = read(id);
89
+ if (entry.error) {
90
+ stay(id, entry.error);
91
+ return true;
92
+ }
93
+ const a = entry.activation;
94
+ if (!a) {
95
+ wanted = id;
96
+ return false;
97
+ }
98
+ if (running) { // one switch at a time; asking for a second one changes nothing about the first
99
+ if (running.id === id)
100
+ wanted = id;
101
+ else
102
+ deps.sys(`a switch to ${running.id} is still running — wait for it, or stop it, before ${id}`);
103
+ running.show();
104
+ return true;
105
+ }
106
+ wanted = id;
107
+ if (!a.check && id === deps.current()) {
108
+ proceed(true);
109
+ return true;
110
+ }
111
+ if (a.check)
112
+ deps.sys(`${id}: checking whether it is being served…`);
113
+ void checkActivation(a).then((c) => {
114
+ if (mine !== picks)
115
+ return;
116
+ if (c.state === "serving")
117
+ proceed(true);
118
+ else if (c.state === "error")
119
+ stay(id, `activation check failed: ${c.reason}`);
120
+ else
121
+ ask(id, a, c.plan, c.refusal, proceed);
122
+ });
123
+ return true;
124
+ },
125
+ };
126
+ }
@@ -0,0 +1,109 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { Text } from "ink";
3
+ import { link, hyperlinksEnabled } from "./osc.js";
4
+ import { theme, secondary } from "./theme.js";
5
+ // Alternatives in order: `code`, [label](url), ***both***, **bold**, ~~strike~~, *italic*, _italic_, bare URL.
6
+ // The emphasis lookarounds keep identifiers and globs literal (snake_case, __init__, src/*.ts, 2 * 3).
7
+ const MARKS = /(`+)((?:(?!\1).)+)\1|\[((?:`[^`]*`|[^\]`])+)\]\(([^)\s]+)\)|\*\*\*(?!\s)((?:`[^`]*`|[^`])+?)(?<!\s)\*\*\*|\*\*(?!\s)((?:`[^`]*`|[^`])+?)(?<!\s)\*\*(?!\*)|~~(?!\s)((?:`[^`]*`|[^`])+?)(?<!\s)~~|(?<![\w*/\\])\*(?![\s*])((?:`[^`]*`|\*\*[^*]+\*\*|[^*`])+?)(?<!\s)\*(?![\w*])|(?<![\w\\])_(?![\s_])([^_]+?)(?<!\s)_(?!\w)|(https?:\/\/[^\s)`]+?)(?=\*\*|[\s)`]|$)/g;
8
+ export function parseInline(text, style = {}) {
9
+ const out = [];
10
+ let last = 0;
11
+ for (const m of text.matchAll(MARKS)) {
12
+ if (m.index > last)
13
+ out.push({ ...style, t: text.slice(last, m.index) });
14
+ const [tok, , code, label, url, both, bold, strike, star, under, bare] = m;
15
+ if (code !== undefined)
16
+ out.push({ ...style, code: true, t: code });
17
+ else if (label !== undefined) {
18
+ if (hyperlinksEnabled())
19
+ out.push(...parseInline(label, { ...style, url }));
20
+ else
21
+ out.push(...parseInline(label, { ...style, url }), { ...style, aside: true, t: " " + url });
22
+ }
23
+ else if (both !== undefined)
24
+ out.push(...parseInline(both, { ...style, bold: true, italic: true }));
25
+ else if (bold !== undefined)
26
+ out.push(...parseInline(bold, { ...style, bold: true }));
27
+ else if (strike !== undefined)
28
+ out.push(...parseInline(strike, { ...style, strike: true }));
29
+ else if (bare !== undefined)
30
+ out.push({ ...style, url: bare, t: bare });
31
+ else
32
+ out.push(...parseInline(star ?? under, { ...style, italic: true }));
33
+ last = m.index + tok.length;
34
+ }
35
+ if (last < text.length)
36
+ out.push({ ...style, t: text.slice(last) });
37
+ return out;
38
+ }
39
+ export function renderSpans(spans, kp) {
40
+ return spans.map((s, i) => (_jsx(Text, { bold: s.bold, italic: s.italic, strikethrough: s.strike, underline: !!s.url, ...(s.aside ? secondary : s.code || s.url ? { color: theme.info } : {}), children: s.url && hyperlinksEnabled() ? link(s.t, s.url) : s.t }, `${kp}s${i}`)));
41
+ }
42
+ export const renderInline = (text, kp) => renderSpans(parseInline(text), kp);
43
+ /** While a line is still streaming, close the bold or code marker it has opened (or drop a bare trailing one),
44
+ * so the half-typed span reads styled instead of showing the marker. */
45
+ export function closeOpen(line) {
46
+ for (const mark of ["`", "**"]) {
47
+ const rest = line.replace(/`[^`]*`|\*\*(?!\s)(?:`[^`]*`|[^`])+?(?<!\s)\*\*/g, "");
48
+ if (!new RegExp(`(?<=^|[\\s(|])${mark === "`" ? "`" : "\\*\\*"}(?!\\s)`).test(rest))
49
+ continue;
50
+ line = line.endsWith(mark) ? line.slice(0, -mark.length) : line.trimEnd() + mark;
51
+ }
52
+ return line;
53
+ }
54
+ // Cell widths as Ink measures them (East Asian wide and emoji two, combining marks none), so a table's right edge
55
+ // lines up. StatusRule's cellWidth over-counts symbols on purpose, which would leave a row with a ✓ one cell short.
56
+ const WIDE = /[ᄀ-ᅟ⺀-〾ぁ-㏿㐀-䶿一-鿿ꀀ-꓏가-힣豈-﫿︰-﹏＀-⦆¢-₩\u{20000}-\u{3fffd}]|\p{Emoji_Presentation}|️/u;
57
+ const ZERO = /^[\p{Mn}\p{Me}\p{Cf}]+$/u;
58
+ const segmenter = new Intl.Segmenter();
59
+ const graphemes = (s) => Array.from(segmenter.segment(s), (g) => g.segment);
60
+ const graphemeWidth = (g) => (ZERO.test(g) ? 0 : WIDE.test(g) ? 2 : 1);
61
+ export const textWidth = (s) => graphemes(s).reduce((w, g) => w + graphemeWidth(g), 0);
62
+ export const spansWidth = (spans) => spans.reduce((w, s) => w + textWidth(s.t), 0);
63
+ /** Word-wrap styled spans into lines of at most `width` cells; a word longer than the line is split. */
64
+ export function wrapSpans(spans, width) {
65
+ const words = [[]];
66
+ for (const s of spans) {
67
+ for (const part of s.t.split(/( +)/)) {
68
+ if (!part)
69
+ continue;
70
+ if (part.startsWith(" "))
71
+ words.push([{ ...s, t: part }], []);
72
+ else
73
+ words[words.length - 1].push({ ...s, t: part });
74
+ }
75
+ }
76
+ const lines = [[]];
77
+ let used = 0;
78
+ const newline = () => { lines.push([]); used = 0; };
79
+ const put = (s, w) => { lines[lines.length - 1].push(s); used += w; };
80
+ for (const word of words) {
81
+ const w = spansWidth(word);
82
+ if (!w)
83
+ continue;
84
+ const space = word[0].t.startsWith(" ");
85
+ if (used && used + w > width) {
86
+ newline();
87
+ if (space)
88
+ continue;
89
+ }
90
+ if (w <= width) {
91
+ lines[lines.length - 1].push(...word);
92
+ used += w;
93
+ continue;
94
+ }
95
+ for (const s of word) {
96
+ for (const g of graphemes(s.t)) {
97
+ if (used && used + graphemeWidth(g) > width)
98
+ newline();
99
+ put({ ...s, t: g }, graphemeWidth(g));
100
+ }
101
+ }
102
+ }
103
+ return lines.map((l) => {
104
+ const end = [...l];
105
+ while (end.length && !end[end.length - 1].t.trim())
106
+ end.pop();
107
+ return end;
108
+ });
109
+ }
@@ -17,8 +17,9 @@ export const FREE_ROW_PRESETS = ["operator"];
17
17
  /** Sign-in providers whose rows /model reads from their own /models once signed in (router/provider-models.ts). Unlike
18
18
  * 0perator Free they are listed under "+ Connect a provider key", where picking one points at the sign-in. */
19
19
  export const PROVIDER_ROW_PRESETS = ["portal"];
20
- /** The /model main rows, in this order; everything else sits behind MORE_ROW. operator-dense left 2026-11-30 (its
21
- * gateway route was retired: the registry only offers what is served). */
20
+ /** The /model main rows while the gateway publishes no list (router/model-list.ts), in this order; everything else sits
21
+ * behind MORE_ROW. operator-dense left 2026-11-30 (its gateway route was retired: the registry only offers what is
22
+ * served). */
22
23
  export const MAIN_MODEL_IDS = ["operator-flash", "kimi-linear-48b"];
23
24
  /** The last main row: an action that opens the rest (other fleet rows, connected providers, free rows, MOA, connect). */
24
25
  export const MORE_ROW = "More models…";
@@ -55,24 +56,28 @@ export function modelPickerView(models, o) {
55
56
  entries: [...ordered.map((profile) => ({ kind: "model", profile })), { kind: "connect" }],
56
57
  };
57
58
  }
58
- /** The first /model screen: the main rows present in `models` (MAIN_MODEL_IDS order), then "More models…". */
59
+ /** The first screen's ids: the gateway's list when the registry has any of it, else MAIN_MODEL_IDS. */
60
+ export function mainIds(models, listed = []) {
61
+ return listed.some((id) => models.some((m) => m.id === id)) ? listed : MAIN_MODEL_IDS;
62
+ }
63
+ /** The first /model screen: the main rows present in `models` (mainIds order), then "More models…". */
59
64
  export function mainPickerView(models, o) {
60
- const main = MAIN_MODEL_IDS.flatMap((id) => models.filter((m) => m.id === id));
65
+ const main = mainIds(models, o.main).flatMap((id) => models.filter((m) => m.id === id));
61
66
  return {
62
67
  rows: [...modelRows(main, o), MORE_ROW],
63
68
  entries: [...main.map((profile) => ({ kind: "model", profile })), { kind: "more" }],
64
69
  };
65
70
  }
66
71
  /** Whether a row is one of the main /model rows (and so not repeated under "More models…"). */
67
- export function isMainModel(m) {
68
- return MAIN_MODEL_IDS.includes(m.id);
72
+ export function isMainModel(m, ids = MAIN_MODEL_IDS) {
73
+ return ids.includes(m.id);
69
74
  }
70
75
  function modelRows(ordered, o) {
71
76
  return ordered.map((m) => {
72
77
  const active = m.id === o.active;
73
78
  const row = pickerRow(m, { servedCtx: active && m.kind === "single" ? o.servedCtx : undefined });
74
79
  const cost = active ? [] : costParts(o.cost?.(m), o.now);
75
- const tail = `${o.staleFree && m.tier === "free" ? " · cached" : ""}${active ? " (active)" : ""}`;
80
+ const tail = `${o.down?.has(m.id) ? " · unavailable" : ""}${o.staleFree && m.tier === "free" ? " · cached" : ""}${active ? " (active)" : ""}`;
76
81
  if (!cost.length)
77
82
  return `${row}${tail}`;
78
83
  const segs = [seg(row), ...cost, ...(tail ? [seg(tail)] : [])];
package/dist/ui/theme.js CHANGED
@@ -24,6 +24,7 @@ const PALETTE = {
24
24
  starBright: { hex: "#ffe2a0", ansi: "yellowBright", hc: "whiteBright" }, // the star's bright burst
25
25
  textBright: { hex: "#ffffff", ansi: "whiteBright", hc: "whiteBright" }, // emphasized foreground
26
26
  muted: { hex: "#8a8a8a", ansi: "gray", hc: "white" }, // borders, idle glyphs (a POSITIVE gray, not dimColor)
27
+ secondary: { hex: "#949494", ansi: "gray", hc: "white" }, // reasoning, previews, hints: a gray that reads on dark and light backgrounds (exact in 256-color)
27
28
  mediaProgress: { hex: "#e6c84a", ansi: "yellow", hc: "yellowBright" }, // media-gen progress bar (image/video_generate) — James: yellow, not amber
28
29
  compactProgress: { hex: "#ff6ac1", ansi: "magenta", hc: "magentaBright" }, // compaction/recovery sweep bar — James: pink, not amber (no ANSI-16 pink, magenta is the closest low-color fallback)
29
30
  };
@@ -61,3 +62,6 @@ export function makeTheme(level = detectLevel(), mode = detectMode()) {
61
62
  return out;
62
63
  }
63
64
  export const theme = makeTheme();
65
+ /** Props for secondary text: its own gray, not SGR dim, which terminals fade too far to read. Without color, dim.
66
+ * High contrast uses the default foreground, which reads on dark and light alike. */
67
+ export const secondary = detectMode() === "high-contrast" ? {} : theme.secondary ? { color: theme.secondary } : { dimColor: true };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@0perator/operator",
3
- "version": "0.2.2-next.1",
3
+ "version": "0.2.5",
4
4
  "type": "module",
5
5
  "bin": {
6
6
  "operator": "dist/cli.js",