sumo-agents 0.5.0 → 0.6.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -2,6 +2,38 @@
2
2
 
3
3
  What each release changed for you. The commit of each version has the full detail.
4
4
 
5
+ ## 0.6.1 — 2026-11-11
6
+
7
+ 0.6.0 was never published: its build typed `[I` and `[O` into the box when you switched tabs. 0.6.1 is it, fixed.
8
+
9
+ ### The chat screen from 0.4.0, back and tidied (Nov 11)
10
+ - **The look you had before the ledger.** The name in sunset block letters, each step as `⏺ Bash(npm test)` with
11
+ what came back under `⎿`, your messages behind an orange bar, a rounded box to type in, a question to approve in
12
+ a yellow frame, the sunset flowing through the working line. The ledger of 0.5.0 is gone.
13
+ - **A failed run shows why it failed:** the lines that say what failed (a test's `✖`, an assertion, an error — never
14
+ a passing test whose name says "error") come first, then its last two lines (the exit code, why it was stopped,
15
+ what you said declining it), the rest counted. Before, its banner and its counts were shown and the failing test
16
+ folded away. Six lines or fewer still show whole.
17
+ - **A test run that passed is one row:** `✓ 14 passed` (node, TAP, jest/vitest, pytest, cargo, mocha), not seven
18
+ rows of `ℹ tests / pass / fail` — only for a command that runs tests, and never when its count has a failure in
19
+ it (a run piped to `tail` exits 0 all the same). A grep's output still shows whole.
20
+ - **The header's second row names the project and its branch** — `shop-api (main) · ~/code/shop-api` — before the
21
+ folder.
22
+ - **No stray rows:** a blank line at the end of a reply is the row before what follows, never two blank rows; `+3`
23
+ not `+3 −0`; which guide rode in with your message is in the pager, not under your words; the empty box says
24
+ `Ask anything` and the keys stay in the row under it.
25
+ - **The question box is laid out:** why it asks, faint, under the question; what would run set in; each key bold.
26
+ In a short window it gives up the blank rows around what would run before anything else, and a menu half-typed in
27
+ the box steps aside while it waits.
28
+ - **Switching tabs no longer types `[I` and `[O` into the box.** The terminal's word that its window came to the front
29
+ or went behind is taken out before the keys are read, even when it arrives in two pieces — which made it the Esc key
30
+ (stopping a turn) and the rest text in the box. On a terminal with the kitty keyboard protocol (Ghostty, kitty,
31
+ WezTerm) a bare ESC waits for the rest; elsewhere Esc acts at once, as before.
32
+ - Kept from 0.5.0: a question never wipes the screen or your scrollback, Ink 8, the pager folding long lines, a
33
+ failed call marked `✗` in a job's record.
34
+ The flowing sunset writes more than the ledger's spinner did (34.5 KB against 9.2 KB over 5 s of work at 100×34);
35
+ `chat.screen still` keeps it still (2.0 KB).
36
+
5
37
  ## 0.5.0 — 2026-10-28
6
38
 
7
39
  Newest first:
package/README.md CHANGED
@@ -50,9 +50,9 @@ are covered in [Install](https://github.com/sumododda/sumo-agents/wiki/Install).
50
50
  - `/new` starts a fresh session, and a new task deserves one. `/handoff` has the model write a hand-off of
51
51
  the piece in hand first, and the fresh session starts from it. `/resume` picks an old one up. `/help` lists
52
52
  the rest, and `?` on an empty box shows the keys you reach for most.
53
- - The screen reads like a ledger: each row is named on its left edge in a word — `you`, `read`, `edit`, `run`,
54
- `sumo`, `ask` — so a turn is scanned down one column. Colour only repeats what the words say: your theme's cyan
55
- is Sumo's own, yellow asks, red fails.
53
+ - Each step shows as `⏺ Bash(npm test)` with what came back under it: a failed run by the lines that say what
54
+ failed, a test run that passed in one row (`✓ 14 passed`). Your messages stand behind a bar, a question to
55
+ approve in a yellow frame. `chat.screen still` stops the colours flowing through the working line.
56
56
  - Ctrl-R searches what you sent before. `/context` shows how full the context is and what the session has cost.
57
57
  `/export` writes the conversation to a Markdown file.
58
58
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sumo-agents",
3
- "version": "0.5.0",
3
+ "version": "0.6.1",
4
4
  "description": "One repo you talk to: a local memory engine and working process for coding agents.",
5
5
  "license": "MIT",
6
6
  "type": "module",
package/src/chat.mjs CHANGED
@@ -27,7 +27,7 @@ import { currentProject, describeSaved, findSaved, loadState, lockFile, noteSess
27
27
  import { ASK_TOOL, BASH_TOOL, cap, capRedacted, DELEGATE_TOOL, EDITOR_TOOL, INTERRUPTED, nextUndoTurn, runCommand, undoLast } from './tools.mjs';
28
28
  import { CONFIG_DEFAULTS } from './setup.mjs';
29
29
  import { closest, estimateTokens, head } from './text.mjs';
30
- import { colourEnabled, createRenderer, explained, header, ledger, OUT_AT, pathFrom, prompt, renderBlock, safeForTerminal, styles, TEXT_AT, tilde, toolView, widthOf, wrap } from './tty.mjs';
30
+ import { colourEnabled, createRenderer, explained, header, pathFrom, prompt, renderBlock, safeForTerminal, styles, tilde, toolView, widthOf, wrap } from './tty.mjs';
31
31
  import { hasCommit } from './verify.mjs';
32
32
  import { isWebTool, sourcesOf, WEB_FETCH_TOOL, WEB_SEARCH_TOOL, WEB_TOOLS } from './web.mjs';
33
33
 
@@ -216,33 +216,33 @@ function parseRoute(args, current, db) {
216
216
  * break a secret apart where the redaction after it would no longer see it whole.
217
217
  */
218
218
  export function jobPrinter(write, s, { width = 98, clean = (text) => text, cwd = null } = {}) {
219
- // Each call as the chat's ledger names it — run npm test, read src/cart.js — a file from the project the job works in.
219
+ // Each call as the chat names it — Bash(npm test), Read(src/cart.js) — a file from the project the job works in.
220
220
  const at = () => (typeof cwd === 'function' ? cwd() : cwd);
221
221
  return {
222
- onStart: (job) => write(`${s.bold(ledger(`j${job.id}`))}${job.agent} · ${routeOf(job)} — ${job.title}\n`),
222
+ onStart: (job) => write(`⏺ ${s.bold(`j${job.id}`)} ${job.agent} · ${routeOf(job)} — ${job.title}\n`),
223
223
  onTool: (call) => {
224
224
  const view = toolView(call, null, { cwd: at() });
225
225
  // One line, and where more was cut away, the ellipsis that says so.
226
226
  const [first, ...rest] = clean(view.detail).split('\n');
227
227
  const line = first.length > 160 ? `${first.slice(0, 159)}…` : rest.length > 0 && !first.endsWith('…') ? `${first} …` : first;
228
- write(`${s.dim(ledger(view.title))}${line}\n`);
228
+ write(` ⏺ ${s.bold(view.title)}(${line})\n`);
229
229
  },
230
- onRetry: (r) => write(`${' '.repeat(TEXT_AT)}${s.dim(retryLine(r))}\n`),
231
- onCompact: (c) => write(`${' '.repeat(TEXT_AT)}${s.dim(compactLine(c))}\n`),
230
+ onRetry: (r) => write(` ${s.dim(retryLine(r))}\n`),
231
+ onCompact: (c) => write(` ${s.dim(compactLine(c))}\n`),
232
232
  onResult: (call, result) => {
233
- // The line that says how it went, as the chat's screen would show it: what a command printed first, a read's size, an
234
- // edit's first change — under the step's words; a failure with its mark, which says so without the colour.
233
+ // The line that says how it went, as the chat's screen would show it: what a command printed first, a read's size, an edit's first change.
235
234
  const first = toolView(call, { content: String(result.content ?? ''), isError: Boolean(result.isError), edit: result.edit }, { cwd: at() }).lines[0]?.text ?? '';
236
- write(`${' '.repeat(OUT_AT - 2)}${result.isError ? `${s.red('✗')} ` : ' '}${s.dim(clean(first).slice(0, 160))}\n`);
235
+ // A failure has its mark: the record is written without colour, so the colour alone would say nothing.
236
+ write(` ⎿ ${result.isError ? `${s.red('✗')} ` : ''}${s.dim(clean(first).slice(0, 160))}\n`);
237
237
  },
238
238
  onTurn: (response) => {
239
239
  const text = textOf(response.content);
240
240
  if (!text) return;
241
241
  const drawn = [];
242
- const reply = createRenderer((t) => drawn.push(t), s, { width: width - TEXT_AT });
242
+ const reply = createRenderer((t) => drawn.push(t), s, { width });
243
243
  reply.write(clean(text));
244
244
  reply.flush();
245
- write(`${drawn.join('').split('\n').map((l, i) => (i === 0 ? `${s.bold(ledger('sumo'))}${l}` : l ? `${' '.repeat(TEXT_AT)}${l}` : l)).join('\n')}\n`);
245
+ write(`${drawn.join('').split('\n').map((l) => (l ? ` ${l}` : l)).join('\n')}\n`);
246
246
  },
247
247
  };
248
248
  }
@@ -1266,7 +1266,7 @@ export async function chat(db, { model, effort, resume = null, send, input = pro
1266
1266
  // Piped, nobody answers a question: one of the model's is not asked, an MCP call not on the allow list is refused, and a server that failed is said.
1267
1267
  watch: (e) => {
1268
1268
  if (e.type === 'retry' && e.job === undefined) return write(`${s.dim(` › ${retryLine(e)}`)}\n`);
1269
- if (e.type === 'sources') return write(`\n${e.sources.map((page) => s.dim(` ${safeForTerminal(`${page.title} — ${page.url}`).replace(/\s+/g, ' ')}`)).join('\n')}\n`);
1269
+ if (e.type === 'sources') return write(`\n${e.sources.map((page) => s.dim(` ⎿ ${safeForTerminal(`${page.title} — ${page.url}`).replace(/\s+/g, ' ')}`)).join('\n')}\n`);
1270
1270
  if (e.type !== 'mcp') return;
1271
1271
  if (e.error) write(`${s.red(`mcp: ${e.error}`)}\n`);
1272
1272
  for (const server of e.servers.filter((x) => !x.ok)) write(`${s.red(`mcp ${server.name}: ${server.error}`)}\n`);
@@ -1274,7 +1274,7 @@ export async function chat(db, { model, effort, resume = null, send, input = pro
1274
1274
  });
1275
1275
  const rule = () => write(`\n${s.dim('─'.repeat(width))}\n\n`);
1276
1276
  /** A line under what the user typed, as a tool's result is drawn: what a command did. */
1277
- const result = (text) => write(`${s.dim(` ${text}`)}\n`);
1277
+ const result = (text) => write(`${s.dim(` ⎿ ${text}`)}\n`);
1278
1278
  /** The header, then the memory block of a fresh session or the line that says what a resumed one is. */
1279
1279
  const show = (block, after = '') => {
1280
1280
  write(`${header({ route: routeLine(session), cwd: process.cwd() }, s)}\n\n`);
@@ -1328,7 +1328,7 @@ export async function chat(db, { model, effort, resume = null, send, input = pro
1328
1328
  continue;
1329
1329
  }
1330
1330
  if (control === 'model' || control === 'memory' || control === 'mcp' || control === 'undo') {
1331
- result(control === 'model' ? session.route(args) : control === 'undo' ? session.undo() : control === 'mcp' ? (await session.mcp()).join('\n ') : await session.memoryPage());
1331
+ result(control === 'model' ? session.route(args) : control === 'undo' ? session.undo() : control === 'mcp' ? (await session.mcp()).join('\n ') : await session.memoryPage());
1332
1332
  continue;
1333
1333
  }
1334
1334
  if (control === 'context') {
package/src/herdr.mjs CHANGED
@@ -78,9 +78,7 @@ const screen = (herdr, pane) => {
78
78
  */
79
79
  export async function startWatcher(herdr, { pane, job, command, sleep = pause, tries = TRIES }) {
80
80
  const watching = new RegExp(`job watch ${job}(?!\\d)`);
81
- // The record's first line: the job named in the ledger's gutter, then who works on it.
82
- const shown = new RegExp(`(?:^|\\n) *j${job} {2,}\\S`);
83
- const started = (info) => info.foreground_processes?.some((p) => watching.test(String(p.cmdline))) || shown.test(screen(herdr, pane) ?? '');
81
+ const started = (info) => info.foreground_processes?.some((p) => watching.test(String(p.cmdline))) || screen(herdr, pane)?.includes(`⏺ j${job} `);
84
82
  for (let attempt = 0; attempt < tries; attempt++) {
85
83
  let last = null;
86
84
  for (let waited = 0; waited < READY_MS; waited += POLL_MS) {
package/src/setup.mjs CHANGED
@@ -735,7 +735,7 @@ export function config(key, value) {
735
735
  if (key === 'chat.effort' && !CHAT_EFFORTS.includes(value)) throw new UsageError(`no such effort "${value}" — one of: ${CHAT_EFFORTS.join(', ')}`);
736
736
  if (key === 'chat.notify' && value !== 'on' && value !== 'off') throw new UsageError('chat.notify is on or off: the bell and the notification when a long turn ends behind another window');
737
737
  if (key === 'chat.screen' && !['full', 'still', 'plain'].includes(value)) {
738
- throw new UsageError('chat.screen is full, still or plain: a spinner turning on the working line, the same standing still, or drawn for a screen reader — plain marks, no frames, nothing moving');
738
+ throw new UsageError('chat.screen is full, still or plain: colours flowing through the working line, the same standing still, or drawn for a screen reader — plain marks, no frames, nothing moving');
739
739
  }
740
740
  // A word would be no budget at all, and the line it holds back would never be said.
741
741
  if (key === 'chat.budget' && !/^\d+(\.\d+)?$/.test(value)) throw new UsageError('chat.budget is a sum in US dollars, like 5 or 2.50 (0 for never): what a chat session costs before the screen says so, once');
package/src/tty.mjs CHANGED
@@ -20,29 +20,17 @@ const CODES = { bold: ['1', '22'], dim: ['2', '22'], italic: ['3', '23'], underl
20
20
 
21
21
  /**
22
22
  * The marks the screen draws with. Plain, for a screen reader or a terminal that draws only ASCII, each is a character a
23
- * reader says as itself: no box drawing, no symbol spelled out by its Unicode name. What a row is, the ledger says in
24
- * words; these are only its state — failed, at work, picked, waiting on you — and the markdown's own.
23
+ * reader says as itself: no box drawing, no symbol spelled out by its Unicode name.
25
24
  */
26
25
  const GLYPHS = {
27
- fail: '✗', pick: '›', ask: '?', live: '•', spin: ['⠋', '⠙', '⠹', '⠸', '⠼', '⠴', '⠦', '⠧', '⠇', '⠏'], bar: '│', quote: '│', rule: '─', fenceOpen: '┌─', fenceClose: '└─', todo: '☐', done: '☑', bullet: '•',
26
+ tool: '⏺', fail: '✗', pick: '❯', under: '⎿', bar: '┃', quote: '│', rule: '─', fenceOpen: '┌─', fenceClose: '└─', todo: '☐', done: '☑', bullet: '•', warn: '⚠', thought: '✻',
28
27
  box: { h: '─', v: '│', tl: '┌', tm: '┬', tr: '┐', ml: '├', mm: '┼', mr: '┤', bl: '└', bm: '┴', br: '┘' },
29
28
  };
30
29
  const PLAIN_GLYPHS = {
31
- fail: 'x', pick: '>', ask: '?', live: '*', spin: ['*'], bar: '|', quote: '|', rule: '-', fenceOpen: '+-', fenceClose: '+-', todo: '[ ]', done: '[x]', bullet: '-',
30
+ tool: '*', fail: 'x', pick: '>', under: '|', bar: '>', quote: '|', rule: '-', fenceOpen: '+-', fenceClose: '+-', todo: '[ ]', done: '[x]', bullet: '-', warn: '!', thought: '*',
32
31
  box: { h: '-', v: '|', tl: '+', tm: '+', tr: '+', ml: '+', mm: '+', mr: '+', bl: '+', bm: '+', br: '+' },
33
32
  };
34
33
 
35
- /**
36
- * The ledger the conversation is set in: each row named in a gutter on the left — you, sumo, read, edit, run, ask — in
37
- * words, so what a row is never rests on a colour or a mark; beside the name a column for the row's state; the words from
38
- * there on. What came back from a step stands two columns further in, under the words of the step.
39
- */
40
- export const GUTTER = 6;
41
- export const TEXT_AT = GUTTER + 3;
42
- export const OUT_AT = TEXT_AT + 2;
43
- /** A row's start, as text: its name set right in the gutter, its state beside it. */
44
- export const ledger = (label = '', mark = ' ') => `${String(label).slice(0, GUTTER).padStart(GUTTER)} ${mark} `;
45
-
46
34
  const MAX_WIDTH = 100;
47
35
  const MIN_WIDTH = 40;
48
36
 
@@ -489,6 +477,24 @@ const MESSAGE_MS = 5000;
489
477
  /** The working message `elapsed` ms into work that opened on `first`: the next in the file every five seconds, round and round. */
490
478
  export const messageAt = (messages, first, elapsed) => messages[(Math.max(0, messages.indexOf(first)) + Math.floor(elapsed / MESSAGE_MS)) % messages.length];
491
479
 
480
+ /** The chat's colours: gold, into orange, into crimson. */
481
+ const SUNSET = [[0xff, 0xd1, 0x66], [0xf7, 0x7f, 0x00], [0xd6, 0x28, 0x28]];
482
+
483
+ /** The colour `t` of the way through the sunset, 0 its gold and 1 its crimson. */
484
+ export function sunset(t) {
485
+ const at = Math.min(Math.max(t, 0), 1) * (SUNSET.length - 1);
486
+ const i = Math.min(Math.floor(at), SUNSET.length - 2);
487
+ return `#${SUNSET[i].map((v, k) => Math.round(v + (SUNSET[i + 1][k] - v) * (at - i)).toString(16).padStart(2, '0')).join('')}`;
488
+ }
489
+
490
+ const FLOW_LENGTH = 24;
491
+
492
+ /** The colour of character `i` at `frame` of a sunset flowing through words: gold to crimson and back, a step a character, moving on a character a frame. */
493
+ export function flow(i, frame) {
494
+ const step = (((i - frame) % FLOW_LENGTH) + FLOW_LENGTH) % FLOW_LENGTH;
495
+ return sunset(1 - Math.abs(1 - (2 * step) / FLOW_LENGTH));
496
+ }
497
+
492
498
  /** What the chat draws faint in the empty room above the box you type in: yours, in logo.txt at the top of the repo. */
493
499
  const LOGO_FILE = join(REPO_ROOT, 'logo.txt');
494
500
 
@@ -646,6 +652,47 @@ function readable(text, cwd = null, { headings = 'drop' } = {}) {
646
652
  return lines;
647
653
  }
648
654
 
655
+ /** The most of a failed command's failing lines a folded result shows. */
656
+ const SHOWN_FAILING_LINES = 4;
657
+ /** The last lines of a failed command, always shown: the exit code, why it was stopped, what the user said declining it. */
658
+ const SHOWN_FAILED_TAIL = 2;
659
+ /** A line that says what failed: a test runner's cross, an assertion, an error, a panic, a rejection. */
660
+ const FAILING = /[✖✗×]|^\s*not ok\b|\bFAIL(?:ED|S)?\b|\b(?:failed|failing|failure|rejected)\b|\b(?:Error|Exception|panic)\b|\berror(?:\[|:)|\bexpected\b.+\bto\b/;
661
+ /** A line a runner marks as passed: never a line that says what failed, whatever the test's name says. */
662
+ const PASSING = /^\s*(?:[✔✓√]|ok\b|PASS\b)/;
663
+ /** A command that runs tests: only its count is read as how a run went — a grep that finds "12 passed" is a grep. */
664
+ const TESTS = /\b(?:test|tests|spec|pytest|jest|vitest|mocha|ava|rspec|phpunit|check)\b/;
665
+ /** How test runners count what passed: node --test, TAP, jest/vitest/pytest/cargo, mocha. */
666
+ const PASSED = [/^ℹ pass (\d+)$/m, /^# pass (\d+)$/m, /\b(\d+) passed\b/, /\b(\d+) passing\b/];
667
+ /** A count of what failed beside it: a run that exits 0 — piped to tail, `|| true` — may still have failed. */
668
+ const FAILED = /^ℹ fail [1-9]|^# fail [1-9]|\b[1-9]\d* (?:failed|failing|errors?)\b|\bFAILED\b/m;
669
+ /** The last lines of what a command printed where a test runner's count is looked for. */
670
+ const COUNT_LINES = 8;
671
+
672
+ /**
673
+ * What a command printed, folded to what says how it went. A failure shows the lines that say what failed — a test's
674
+ * cross, an assertion, an error — and its last lines, not its banner; a test run that passed is its count, one row.
675
+ * A few lines are shown whole, and anything else shows both ends, as it always did.
676
+ */
677
+ function ranLines(said, failed, command) {
678
+ if (failed) {
679
+ if (said.length <= SHOWN_HEAD_LINES + SHOWN_TAIL_LINES + 1) return said;
680
+ const tail = said.length - SHOWN_FAILED_TAIL;
681
+ const failing = said.slice(0, tail).filter((line) => FAILING.test(line.text) && !PASSING.test(line.text)).slice(0, SHOWN_FAILING_LINES);
682
+ if (failing.length === 0) return ends(said, false);
683
+ return [...failing, more(tail - failing.length), ...said.slice(tail)];
684
+ }
685
+ // A runner prints its count at the end: a count further up is something the command printed, not how it went.
686
+ const text = said.slice(-COUNT_LINES).map((line) => line.text).join('\n');
687
+ if (TESTS.test(command) && !FAILED.test(text)) {
688
+ for (const passed of PASSED) {
689
+ const n = Number(passed.exec(text)?.[1] ?? 0);
690
+ if (n > 0) return [{ text: `✓ ${n} passed`, tone: 'add' }];
691
+ }
692
+ }
693
+ return ends(said, false);
694
+ }
695
+
649
696
  /**
650
697
  * A tool call for the screen: what ran, and under it the part of the result
651
698
  * worth a glance — both ends of a command's output, an edit as a diff, a read
@@ -661,7 +708,7 @@ export function toolView(call, result = null, { full = false, cwd = null } = {})
661
708
  if (!full && typeof result?.shown === 'string') result = { ...result, content: result.shown };
662
709
  const input = call.input ?? {};
663
710
  // Folded, the empty lines of what came back are not shown: three of five lines spent on nothing say nothing.
664
- const output = (content = result.content) => {
711
+ const output = (content = result.content, folded = (said) => ends(said, false)) => {
665
712
  const lines = toned(content, result.isError ? 'error' : 'plain');
666
713
  // What reads as a diff — `git diff`, a patch — is drawn as one: what went red, what came green.
667
714
  if (!result.isError && /^(?:diff --git |@@ -\d)/m.test(content)) for (const line of lines) line.tone = /^\+(?!\+\+ )/.test(line.text) ? 'add' : /^-(?!-- )/.test(line.text) ? 'del' : line.tone;
@@ -669,7 +716,7 @@ export function toolView(call, result = null, { full = false, cwd = null } = {})
669
716
  // One very long line — a list of paths, a minified file — is cut to a few rows, not left to fill the window.
670
717
  for (const line of lines) if (line.text.length > LONG_LINE) line.text = `${line.text.slice(0, LONG_LINE - 2)} …`;
671
718
  const said = lines.filter((line) => line.text.trim() !== '');
672
- return said.length === 0 ? [{ text: '(no output)', tone: 'dim' }] : ends(said, false);
719
+ return said.length === 0 ? [{ text: '(no output)', tone: 'dim' }] : folded(said);
673
720
  };
674
721
  if (call.name === BASH_TOOL.name) {
675
722
  // Folded, the command is its first lines; asked for in full, it is all there: nothing else on the screen says what ran.
@@ -679,13 +726,13 @@ export function toolView(call, result = null, { full = false, cwd = null } = {})
679
726
  const command = (there && whole.replace(there, '')) || whole;
680
727
  const start = command.split('\n').slice(0, SHOWN_COMMAND_LINES).join('\n').slice(0, SHOWN_COMMAND_CHARS);
681
728
  const detail = full || start.length === command.length ? command : `${start} …`;
682
- if (!result) return { title: 'run', detail, lines: [] };
683
- if (result.content === '') return { title: 'run', detail, lines: [{ text: '(no output)', tone: 'dim' }] };
684
- return { title: 'run', detail, lines: output() };
729
+ if (!result) return { title: 'Bash', detail, lines: [] };
730
+ if (result.content === '') return { title: 'Bash', detail, lines: [{ text: '(no output)', tone: 'dim' }] };
731
+ return { title: 'Bash', detail, lines: output(result.content, (said) => ranLines(said, result.isError, command)) };
685
732
  }
686
733
  if (call.name === DELEGATE_TOOL.name) {
687
734
  // A report a job in the background sent back is titled as one, by who sent it; a call is the delegation itself.
688
- const title = input.report ? 'report' : 'job';
735
+ const title = input.report ? 'Report' : 'Delegate';
689
736
  const detail = input.job !== undefined ? `j${input.job}${input.report && input.agent ? ` ${input.agent} · ${input.title ?? ''}` : ''}` : `${input.agent ?? 'worker'} · ${input.title ?? ''}`;
690
737
  if (!result) return { title, detail, lines: [] };
691
738
  // Started in the background: what the call answered is for the model — how to wait, what not to guess. The screen says the one thing it means.
@@ -706,37 +753,35 @@ export function toolView(call, result = null, { full = false, cwd = null } = {})
706
753
  return { title, detail, lines: [{ text: summary, tone }, ...top(report.map((text) => ({ text, tone: 'plain' })), SHOWN_REPORT_LINES)] };
707
754
  }
708
755
  if (isMcpTool(call.name)) {
709
- // A server's tool: the server and the tool with its input as the detail, what came back under it.
756
+ // A server's tool: the server as the title, the tool with its input as the detail, what came back under it.
710
757
  const { server, tool } = splitMcpName(call.name);
711
- const detail = `${server} · ${tool}(${compactInput(input)})`;
712
- if (!result) return { title: 'mcp', detail, lines: [] };
713
- // The line that tells the model whose data this is: here the detail says it.
714
- return { title: 'mcp', detail, lines: output(unlabeled(result.content)) };
758
+ const detail = `${tool}(${compactInput(input)})`;
759
+ if (!result) return { title: server, detail, lines: [] };
760
+ // The line that tells the model whose data this is: here the title says it.
761
+ return { title: server, detail, lines: output(unlabeled(result.content)) };
715
762
  }
716
763
  if (isWebTool(call)) {
717
764
  // The web: what was searched for or which page was read, and under it the pages found or the page and its size.
718
765
  const detail = String(input.query ?? input.url ?? '').slice(0, SHOWN_COMMAND_CHARS);
719
- return { title: call.name === WEB_SEARCH_TOOL.name ? 'search' : 'fetch', detail, lines: result ? output() : [] };
766
+ return { title: call.name === WEB_SEARCH_TOOL.name ? 'Search' : 'Fetch', detail, lines: result ? output() : [] };
720
767
  }
721
768
  if (isAdvisorTool(call)) {
722
769
  // The advisor: who was asked. The advice is the model's alone to read, so under it only that it came, or why it did not.
723
- return { title: 'advise', detail: String(input.asked ?? ''), lines: result ? output() : [] };
770
+ return { title: 'Advisor', detail: String(input.asked ?? ''), lines: result ? output() : [] };
724
771
  }
725
772
  if (call.name === ASK_TOOL.name) {
726
773
  // A question put to the user: the question, and under it what they answered.
727
774
  const question = String(input.question ?? '').split('\n')[0];
728
- return { title: 'asked', detail: question, lines: result ? output() : [] };
775
+ return { title: 'Question', detail: question, lines: result ? output() : [] };
729
776
  }
730
777
  if (call.name !== EDITOR_TOOL.name) {
731
778
  // A job's own tools: what it was given in a line, what came back under it.
732
- // Named in the gutter by the first word of the tool's name: `search_memory` is search.
733
779
  const given = String(input.status ?? input.query ?? input.question ?? input.text ?? '').split('\n')[0].slice(0, 80);
734
- const title = String(call.name).split(/[_-]/)[0];
735
- if (!result) return { title, detail: given, lines: [] };
736
- return { title, detail: given, lines: output() };
780
+ if (!result) return { title: call.name, detail: given, lines: [] };
781
+ return { title: call.name, detail: given, lines: output() };
737
782
  }
738
783
  const range = Array.isArray(input.view_range) ? `:${input.view_range.join('-')}` : '';
739
- const title = input.command === 'view' ? 'read' : input.command === 'create' ? 'write' : input.command === 'str_replace' || input.command === 'insert' ? 'edit' : 'editor';
784
+ const title = input.command === 'view' ? 'Read' : input.command === 'create' ? 'Write' : input.command === 'str_replace' || input.command === 'insert' ? 'Update' : call.name;
740
785
  const detail = `${pathFrom(input.path ?? '', cwd)}${range}`;
741
786
  if (!result) return { title, detail, lines: [] };
742
787
  // Folded, a failure names the file as the title does; in full, it is every word as the model read it.
@@ -788,49 +833,43 @@ const helpLines = (rows, s) => {
788
833
  * The conversation as text for a pager: every entry of the chat's log in full — the whole command, all a tool gave back,
789
834
  * a reply as it is drawn — in the terminal's colours. What the screen folds, this does not; a pager scrolls and searches it.
790
835
  */
791
- /** A failure's words as the ledger sets them: the row is already named `error`, and does not say it twice. */
792
- export const unnamed = (text) => String(text).replace(/^error: /, '');
793
-
794
836
  export function transcript(log, s, { width = MAX_WIDTH, cwd = null } = {}) {
795
837
  const tones = { plain: (t) => t, dim: s.dim, error: s.red, add: s.green, del: s.red, ask: s.yellow };
796
838
  const { g } = s;
797
- // The ledger, as the screen sets it: a row's name in the gutter, coloured as the screen colours it; the words after.
798
- const at = (label, paint = s.dim, mark = ' ') => `${paint(label.slice(0, GUTTER).padStart(GUTTER))} ${mark} `;
799
- // Folded here, as the screen folds them, so a long line goes on under its own words and never back at the edge;
800
- // each row painted on its own, so a colour never runs on into the gutter.
801
- const rows = (t, from = TEXT_AT, paint = (r) => r) =>
802
- String(t)
803
- .split('\n')
804
- .flatMap((line) => fold(line, Math.max(20, width - from - 1)))
805
- .map(paint);
806
- const words = (t, paint) => rows(t, TEXT_AT, paint).join(`\n${' '.repeat(TEXT_AT)}`);
807
- const under = (lines) => lines.flatMap((line) => rows(withSpan(line, s), OUT_AT, tones[line.tone] ?? tones.plain).map((row) => `${' '.repeat(OUT_AT)}${row}`));
839
+ // Folded here, at the window's width, so a long line goes on under its own words and never back at the edge; each row
840
+ // painted on its own, so a colour never runs on into the margin.
841
+ const under = (lines) =>
842
+ lines
843
+ .flatMap((line) => fold(withSpan(line, s), Math.max(20, width - 6)).map(tones[line.tone] ?? tones.plain))
844
+ .map((row, i) => `${i === 0 ? ` ${g.under} ` : ' '}${row}`);
808
845
  const out = [];
809
846
  for (const entry of log) {
810
- if (entry.kind === 'user') out.push('', `${at('you', (t) => s.bold(s.cyan(t)))}${words(untab(entry.text))}`);
847
+ if (entry.kind === 'user') out.push('', ...untab(entry.text).split('\n').map((line) => `${s.yellow(g.bar)} ${line}`));
811
848
  else if (entry.kind === 'reply') {
812
849
  const drawn = [];
813
- const reply = createRenderer((t) => drawn.push(t), s, { width: Math.max(MIN_WIDTH, width - TEXT_AT) });
850
+ const reply = createRenderer((text) => drawn.push(text), s, { width: Math.max(MIN_WIDTH, width - 3) });
814
851
  reply.write(entry.raw);
815
852
  reply.flush();
816
- out.push('', ...drawn.join('').replace(/\n$/, '').split('\n').map((line, i) => (i === 0 ? `${at('sumo', s.bold)}${line}` : line ? `${' '.repeat(TEXT_AT)}${line}` : '')));
853
+ out.push('', ...drawn.join('').replace(/\n$/, '').split('\n').map((line, i) => `${i === 0 ? `${g.tool} ` : ' '}${line}`));
817
854
  } else if (entry.kind === 'tool') {
818
855
  const view = toolView(entry.call, entry.result, { full: true, cwd });
819
- const stat = view.stat ? ` ${s.green(`+${view.stat.added}`)} ${s.red(`−${view.stat.removed}`)}` : '';
856
+ const stat = statOf(view.stat, s);
820
857
  // A failure has a mark of its own: colour alone does not tell it to someone who cannot see the colour.
821
- const failed = entry.result.isError;
822
- out.push('', `${at(view.title, failed ? s.red : s.dim, failed ? s.red(g.fail) : ' ')}${words(`${untab(view.detail)}${stat}`)}`, ...under(view.lines));
858
+ out.push('', `${entry.result.isError ? s.red(g.fail) : s.green(g.tool)} ${s.bold(view.title)}(${untab(view.detail).split('\n').join('\n ')})${stat}`, ...under(view.lines));
823
859
  } else if (entry.kind === 'shell') out.push(...under(toolView({ name: BASH_TOOL.name }, entry.result, { full: true }).lines));
824
- else if (entry.kind === 'job') out.push('', `${at(`j${entry.id}`, s.bold)}${words(`${entry.agent} · ${entry.route} — ${entry.title}`)}`);
825
- else if (entry.kind === 'error') out.push('', `${at('error', s.red, s.red(g.fail))}${words(unnamed(entry.text), s.red)}`, ...(entry.detail ? [`${' '.repeat(TEXT_AT)}${words(entry.detail, s.dim)}`] : []));
826
- else if (entry.kind === 'thought') out.push('', `${at('think')}${s.dim(`for ${elapsed(entry.ms)}`)}`, ...String(entry.text ?? '').trim().split('\n').filter(Boolean).flatMap((line) => rows(line, OUT_AT, (r) => s.dim(s.italic(r))).map((row) => `${' '.repeat(OUT_AT)}${row}`)));
827
- else if (entry.kind === 'footer') out.push(`${' '.repeat(TEXT_AT)}${words(entry.text, s.dim)}`);
860
+ else if (entry.kind === 'job') out.push('', `${g.tool} ${s.bold(`j${entry.id}`)} ${entry.agent} · ${entry.route} — ${entry.title}`);
861
+ else if (entry.kind === 'error') out.push('', s.red(`${g.fail} ${entry.text}`), ...(entry.detail ? [s.dim(` ${entry.detail}`)] : []));
862
+ else if (entry.kind === 'thought') out.push('', s.dim(`${g.thought} Thought for ${elapsed(entry.ms)}`), ...String(entry.text ?? '').trim().split('\n').filter(Boolean).map((line) => s.dim(s.italic(` ${line}`))));
863
+ else if (entry.kind === 'footer') out.push('', s.dim(` ${entry.text}`));
828
864
  else if (entry.kind === 'help') out.push('', ...helpLines(entry.rows, s));
829
- else if (entry.kind === 'note') out.push(`${' '.repeat(TEXT_AT)}${words(entry.text, s.dim)}`);
865
+ else if (entry.kind === 'note') out.push(s.dim(` ${g.under} ${entry.text.split('\n').join('\n ')}`));
830
866
  }
831
867
  return `${out.join('\n').replace(/^\n/, '')}\n`;
832
868
  }
833
869
 
870
+ /** How much an edit added and took away, `+2 −1`: a side that is nothing is not said. */
871
+ export const statOf = (stat, s) => (stat ? [stat.added > 0 ? s.green(`+${stat.added}`) : '', stat.removed > 0 ? s.red(`−${stat.removed}`) : ''].filter(Boolean).map((part) => ` ${part}`).join('') : '');
872
+
834
873
  /** A fence for text that may hold fences of its own: longer than any run of backticks in it. */
835
874
  const fenceFor = (text) => '`'.repeat(Math.max(3, ...[...String(text).matchAll(/`+/g)].map((m) => m[0].length + 1)));
836
875
 
@@ -849,7 +888,7 @@ export function markdownOf(log, { cwd = null, title = 'Sumo' } = {}) {
849
888
  else if (entry.kind === 'reply') out.push('', entry.raw.trim());
850
889
  else if (entry.kind === 'tool') {
851
890
  const view = toolView(entry.call, entry.result, { full: true, cwd });
852
- folded(`${view.title} ${view.detail.split('\n')[0]}${entry.result.isError ? ' — failed' : ''}`, view.lines.map((line) => line.text).join('\n'));
891
+ folded(`${view.title}(${view.detail.split('\n')[0]})${entry.result.isError ? ' — failed' : ''}`, view.lines.map((line) => line.text).join('\n'));
853
892
  } else if (entry.kind === 'shell') folded('! command', String(entry.result.content));
854
893
  else if (entry.kind === 'thought') folded(`Thought for ${elapsed(entry.ms)}`, String(entry.text ?? '').trim());
855
894
  else if (entry.kind === 'job') out.push('', `**j${entry.id}** ${entry.agent} · ${entry.route} — ${entry.title}`);
@@ -888,13 +927,13 @@ export function renderBlock(block, s, { width = MAX_WIDTH } = {}) {
888
927
 
889
928
  /** The line above the memory block: which model is answering, how hard it thinks, where the work is. */
890
929
  export function header({ route, cwd }, s) {
891
- return `${s.bold(s.cyan('sumo'.padStart(GUTTER)))} ${route}${s.dim(`${VERSION ? ` · ${VERSION}` : ''} · ${cwd}`)}`;
930
+ return `${s.bold(s.green('sumo'))} ${s.dim('route')} ${route} ${s.dim(cwd)}`;
892
931
  }
893
932
 
894
933
  /** The prompt: the model and effort kept in view, the size of the context once it matters. */
895
934
  export function prompt({ route, contextTokens }, s) {
896
935
  const k = contextTokens >= 1000 ? ` ${Math.round(contextTokens / 1000)}k` : '';
897
- return `${s.bold(s.cyan('sumo'))}${s.dim(` ${route}${k}`)}${s.bold('>')} `;
936
+ return `${s.bold(s.green('sumo'))}${s.dim(` ${route}${k}`)}${s.bold('>')} `;
898
937
  }
899
938
 
900
939
  /**