Public: anyone can read this; the crew can change it.

A run log's lines on /runs draw §5's row and badge for their kind, and the .ln-* classes leave the markup #4377

Parked opened this
Closed without merging

scout/forge:scout/4226-a-run-log-s-lines-on-runs-draw-5-s-row-a → main 13 commits fork 2 threads · 2 unresolved

  • Closed without merging. Nothing was applied to main.

Review

Sign in to review this change.
10 files changed +102 −44
docs/DESIGN.md +2 −1
@@ -201,6 +201,7 @@ specification.
201201 | **review thread** | `.dc-review` (`.rc-resolved`, `.rc-hidden`, `.rc-resolve`) | — | open: the comments, then Resolve. Settled: **one line** — `✓ resolved by alice · 2h ago` — with the conversation behind a `<details>` and Unresolve beside it. Resolving is for getting an answered question out of the way of the unanswered ones | a folded thread with a `✓` header |
202202 | **propose card** | `fieldset.editor-target.propose` (`.propose-line`) | — | replaces "Where this lands" when the change is a contribution: the whole outcome in one sentence with **both** repository names, then branch, pull title and pull body. There is no "commit directly" radio, because there is no such option | the same sentence above the commit prompt |
203203 | **run state badge** `runStateBadge()` | `.badge` | `queued` · `running` (attn) · `ok` (success: _Passed_, or _Done_ for an agent run) · `failed` (danger) · `cancelled` (outline) | the one badge a check wears on a pull, a run wears in a list, and a log page wears in its head; the log page's script repaints it on `done` | `[✓ passed]` / `[✗ failed]` / `[· running]` |
204 | **run log line** `logLine()` | `.row.ln[data-line]` with a `.badge` in `.row-lead` and `.txt.break` in `.row-main`, inside `.run-log` | `data-line=you\|tool\|forge\|say\|pulse` — the kind; the badge names it (`you`, `tool`, `forge`, the agent) | a badge repeating the line above is `visibility: hidden`, so readers do not hear it twice; the live script draws the same markup | a faint word, then the line; tool lines mono, forge lines italic, `you` tinted |
204205 | **env state badge** `envStateBadge()` | `.badge` | `stopped` (outline) · `deploying` (attn) · `running` (success) · `failed` (danger) | what production, or a preview, is doing now; `envTone()` is the same answer as a `dot()` for a list row | the same word in the same tone after the environment's name |
205206 | **app strip** | `.app-strip` | — | one line under the repo header of a repository that runs: env state badge, `sha`, the production URL as a link **through `…/app/production/open`** (never the bare hostname — a private app would 404), the preview count, the pace (`first preview 2m 14s after New app · in production 9m`, each part once it exists), App (the studio app page)| one line under the where strip: `● running abc1234 · hello.localhost` |
206207 | **environment card** | `.card.env-card` (`.env-facts`, `.env-error`) | `data-tone=danger` when failed | name and state in the head; `envFacts()` in the body — commit, how fast it came up, uptime, a link to the deploy run, and the deployment's own note and error, each on its own line; Open (or Wake it) below. It is a pull's preview card; the facts and `envActions()` (Redeploy / Stop, writers only) are functions, not markup, so the studio head and its preview rows render the same ones | a box per environment with the same three lines |
@@ -399,7 +400,7 @@ gone, so this list only shrinks.
399400 - **`style/content.ts`, code view** — the source view and the syntax-highlight token classes `highlight-html.ts` builds as `tok-${kind}`: `.blob-view` `.ln` `.tok-attribute` `.tok-comment` `.tok-constant` `.tok-decorator` `.tok-deleted` `.tok-emphasis` `.tok-function` `.tok-heading` `.tok-inserted` `.tok-keyword` `.tok-link` `.tok-meta` `.tok-number` `.tok-operator` `.tok-plain` `.tok-property` `.tok-punctuation` `.tok-regex` `.tok-string` `.tok-tag` `.tok-type` `.tok-variable`
400401 - **`style/content.ts`, prose (markdown)** — table cell alignment, built by `markdown.ts` as `ta-${align}`: `.ta-c` `.ta-r`
401402 - **`style/content.ts`, diff viewer** — the diff table: its gutters, line kinds, file head and inline review comments: `.add` `.del` `.dh` `.diff` `.diff-body` `.diff-head` `.diff-note` `.diff-path` `.diff-stat` `.diff-stub` `.diff-summary` `.diff-table` `.dl` `.dl-review` `.dn` `.dn-comment` `.nonl` `.rc-hidden` `.rc-resolve` `.rc-resolved` `.wd`
402 - **`style/content.ts`, apps, runs, and the crew** — run pages, their logs and checks (a pull's look is §5's **look**): `.ln-forge` `.ln-pulse` `.ln-say` `.ln-tool` `.ln-you` `.txt` `.who`
403 - **`style/content.ts`, apps, runs, and the crew** — run pages, their logs and checks (a pull's look is §5's **look**): `.txt`
403404 - **`style/content.ts`, search results** — search results, the inbox's ask cards: `.ask-acts` `.ask-card` `.ask-group` `.ask-kind` `.ask-meta` `.ask-more-acts` `.ask-pick` `.ask-pick-hit` `.ask-short` `.ask-waiting` `.live-toggle`
404405 - **`pages/board.ts`** — the board itself is §5's **board**; the spend tables `spend.ts` draws wear §5's `.table` and `.stack`, no class of their own
405406 - **`pages/map.ts`** — the map of what waits for what: `.map-ask` `.map-breath` `.map-canvas` `.map-card` `.map-counts` `.map-dot` `.map-edge` `.map-edge-crit` `.map-edge-done` `.map-empty` `.map-list` `.map-main` `.map-meta` `.map-node` `.map-rule` `.map-svg` `.map-title` `.map-tool` `.map-tools` `.map-who` `.map-who-i` `.map-who-n` `.map-word` `.map-wrap`
docs/design/areas/runs.md +2
@@ -1,3 +1,5 @@
11 # Runs
22
3 A run log's line is §5's `.row` (class `ln` keeps the dense grid inside `.run-log`) with a `.badge` in `.row-lead` and the text as `.txt.break` in `.row-main`. `data-line` is the hook for its kind: `you`, `tool`, `forge`, `say` or `pulse`. The server (`logLine()` in `pages/runs.ts`, the pulse in `studio/log.ts`) and the live script (`client.ts`) draw the same markup.
4
35 - `.check-words` — the run page's live tests line under the step list: reserves one line of height (1.4em) so the pin slot and log never move as the words arrive.
src/web/client.ts +14 −6
@@ -196,22 +196,30 @@ const logLineJs = /* js */ `
196196 var FORGE = /^(claude:|done:|failed:|paused|declined:|cloning |branch |forked |pushing |push refused|clone kept|nothing to propose|opened pull|updated pull|committed the|could not|checking out|deploy |data: |\\$ |session |the session|interrupted|passed in|install |test |start |ready |process |timing: )/;
197197 function line(kind, speaker, fill) {
198198 var el = document.createElement('div');
199 el.className = 'ln ln-' + kind;
199 el.className = 'row ln';
200 el.setAttribute('data-line', kind);
201 var lead = document.createElement('span');
202 lead.className = 'row-lead';
200203 var w = document.createElement('span');
201 w.className = 'who';
204 w.className = 'badge';
205 w.setAttribute('data-variant', kind === 'you' ? 'success' : kind === 'say' ? 'secondary' : 'outline');
202206 w.textContent = speaker;
207 lead.appendChild(w);
208 var main = document.createElement('span');
209 main.className = 'row-main';
203210 var t = document.createElement('span');
204 t.className = 'txt';
211 t.className = 'txt break';
205212 fill(t);
206 el.appendChild(w);
207 el.appendChild(t);
213 main.appendChild(t);
214 el.appendChild(lead);
215 el.appendChild(main);
208216 return el;
209217 }
210218 function draw(text) {
211219 if (text.indexOf('you: ') === 0) return line('you', 'you', function (t) { t.textContent = text.slice(5); });
212220 if (text.indexOf('\\u2192 ') === 0) {
213221 var rest = text.slice(2), at = rest.indexOf(' ');
214 return line('tool', '', function (t) {
222 return line('tool', 'tool', function (t) {
215223 var b = document.createElement('b');
216224 b.textContent = at === -1 ? rest : rest.slice(0, at);
217225 t.appendChild(b);
src/web/pages/runs.ts +16 −14
@@ -153,29 +153,31 @@ export function lineKind(line: string): LineKind {
153153 return "say";
154154 }
155155
156 /** One line of a run's log, as the page draws it. */
156 /**
157 * One line of a run's log, as the page draws it: §5's `row()` shape (a lead,
158 * a main column) whose lead is a `badge()` naming who spoke — `you`, `forge`,
159 * `tool`, or the agent — so each kind reads differently by its word, with
160 * the tone only a second cue. `data-line` carries the kind; the script that
161 * appends live lines (`client.ts`) draws the very same markup.
162 */
157163 export function logLine(line: string, who = "agent"): Html {
158164 const kind = lineKind(line);
159 if (kind === "you")
160 return html`<div class="ln ln-you">
161 <span class="who">you</span><span class="txt">${line.slice(5)}</span>
165 const shell = (variant: string, word: string, text: Html | string): Html =>
166 html`<div class="row ln" data-line="${kind}">
167 <span class="row-lead"
168 ><span class="badge" data-variant="${variant}">${word}</span></span
169 ><span class="row-main"><span class="txt break">${text}</span></span>
162170 </div>`;
171 if (kind === "you") return shell("success", "you", line.slice(5));
163172 if (kind === "tool") {
164173 const rest = line.slice(2);
165174 const at = rest.indexOf(" ");
166175 const tool = at === -1 ? rest : rest.slice(0, at);
167176 const args = at === -1 ? "" : rest.slice(at + 1);
168 return html`<div class="ln ln-tool">
169 <span class="who"></span><span class="txt"><b>${tool}</b> ${args}</span>
170 </div>`;
177 return shell("outline", "tool", html`<b>${tool}</b> ${args}`);
171178 }
172 if (kind === "forge")
173 return html`<div class="ln ln-forge">
174 <span class="who">forge</span><span class="txt">${line}</span>
175 </div>`;
176 return html`<div class="ln ln-say">
177 <span class="who">${who}</span><span class="txt">${line}</span>
178 </div>`;
179 if (kind === "forge") return shell("outline", "forge", line);
180 return shell("secondary", who, line);
179181 }
180182
181183 /**
src/web/studio/log.ts +6 −3
@@ -98,9 +98,12 @@ export function logBox(opts: {
9898 ${when(
9999 opts.pulse === true,
100100 () =>
101 html`<div class="ln ln-pulse" id="${opts.id}-pulse">
102 <span class="who">${opts.who}</span
103 ><span class="txt"><i></i><i></i><i></i></span>
101 html`<div class="row ln" data-line="pulse" id="${opts.id}-pulse">
102 <span class="row-lead"
103 ><span class="badge" data-variant="secondary">${opts.who}</span></span
104 ><span class="row-main"
105 ><span class="txt break"><i></i><i></i><i></i></span></span
106 >
104107 </div>`,
105108 )}
106109 ${opts.extra ?? null}
src/web/style/content.ts +20 −18
@@ -726,23 +726,25 @@ form.inline { display: inline; margin-left: auto; }
726726 font-size: 14px; line-height: 1.5; overflow-wrap: anywhere; tab-size: 4;
727727 }
728728 #run-live:has(#run-steer) .run-log { border-radius: var(--radius) var(--radius) 0 0; }

auto sizes the lead per row, so text starts at a different x for each kind and speaker. Use a fixed lead width shared by all rows, and let the badge ellipsize inside it.

729 .run-log .ln { display: grid; grid-template-columns: 64px minmax(0, 1fr); gap: 10px; padding: 2px 0; }
730 .run-log .who { color: var(--faint); font-size: 12.5px; font-weight: 600; padding-top: 2px; user-select: none; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
729 .run-log .ln { display: grid; grid-template-columns: 5.5rem minmax(0, 1fr); gap: 8px; padding: 1px 0; min-height: 0; align-items: start; }
730 .run-log .row-lead { padding-top: 1px; user-select: none; min-width: 0; }
731 .run-log .row-lead .badge { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
731732 .run-log .txt { white-space: pre-wrap; }
732 .run-log .ln-say .who { color: var(--fg); }
733 .run-log .ln-say + .ln-say > .who, .run-log .ln-say + .ln-tool > .who, .run-log .ln-tool + .ln-tool > .who,
734 .run-log .ln-tool + .ln-say > .who, .run-log .ln-forge + .ln-forge > .who, .run-log .ln-say + .ln-pulse > .who,
735 .run-log .ln-tool + .ln-pulse > .who { visibility: hidden; }
736 .run-log .ln-tool .txt { font-family: var(--mono); font-size: 12.5px; color: var(--faint); }
737 .run-log .ln-tool b { color: var(--fg); font-weight: 600; }
738 .run-log .ln-forge .txt { color: var(--faint); font-style: italic; }
739 .run-log .ln-you { margin: 6px 0; }
740 .run-log .ln-you .who { color: var(--accent); }
741 .run-log .ln-you .txt { background: color-mix(in srgb, var(--accent) 10%, transparent); border-left: 2px solid var(--accent); padding: 4px 10px; border-radius: 0 var(--radius) var(--radius) 0; }
742 .run-log .ln-pulse .txt { padding-top: 6px; }
743 .run-log .ln-pulse i { display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: var(--faint); margin-right: 4px; animation: run-pulse 1.2s infinite ease-in-out; }
744 .run-log .ln-pulse i:nth-child(2) { animation-delay: .2s; }
745 .run-log .ln-pulse i:nth-child(3) { animation-delay: .4s; }
733 /* A badge names who speaks; the next line of the same kind (or the pulse
734 after the agent) says nothing new, so it is hidden from sight and readers. */
735 .run-log [data-line="say"] + [data-line="say"] .badge, .run-log [data-line="say"] + [data-line="tool"] .badge,
736 .run-log [data-line="tool"] + [data-line="tool"] .badge, .run-log [data-line="tool"] + [data-line="say"] .badge,
737 .run-log [data-line="forge"] + [data-line="forge"] .badge, .run-log [data-line="say"] + [data-line="pulse"] .badge,
738 .run-log [data-line="tool"] + [data-line="pulse"] .badge { visibility: hidden; }
739 .run-log [data-line="tool"] .txt { font-family: var(--mono); font-size: 12.5px; color: var(--faint); }
740 .run-log [data-line="tool"] b { color: var(--fg); font-weight: 600; }
741 .run-log [data-line="forge"] .txt { color: var(--faint); font-style: italic; }
742 .run-log [data-line="you"] { margin: 6px 0; }
743 .run-log [data-line="you"] .txt { background: color-mix(in srgb, var(--accent) 10%, transparent); border-left: 2px solid var(--accent); padding: 4px 10px; border-radius: 0 var(--radius) var(--radius) 0; }
744 .run-log [data-line="pulse"] .txt { padding-top: 6px; }
745 .run-log [data-line="pulse"] i { display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: var(--faint); margin-right: 4px; animation: run-pulse 1.2s infinite ease-in-out; }
746 .run-log [data-line="pulse"] i:nth-child(2) { animation-delay: .2s; }
747 .run-log [data-line="pulse"] i:nth-child(3) { animation-delay: .4s; }
746748 @keyframes run-pulse { 0%, 80%, 100% { opacity: .25; } 40% { opacity: 1; } }
747749 #run-jump {
748750 position: sticky; bottom: 6px; float: right; margin-top: 6px; border-radius: 999px; box-shadow: var(--shadow-2);
@@ -1110,8 +1112,8 @@ textarea.editor:focus-visible { outline: none; }
11101112 /* Reduced motion: the pulses hold still at a legible level, the scroll-tied
11111113 fade stays at its resting width, and these transitions land at once. */
11121114 @media (prefers-reduced-motion: reduce) {
1113 .front-live, .run-log .ln-pulse i { animation: none; }
1114 .run-log .ln-pulse i { opacity: .6; }
1115 .front-live, .run-log [data-line="pulse"] i { animation: none; }
1116 .run-log [data-line="pulse"] i { opacity: .6; }
11151117 .explore-filters { animation: none; }
11161118 .ex-dir > summary > .ico, .code-layout > #code-main[aria-busy="true"], .code-layout > [data-split]::after { transition: none; }
11171119 }
test/app-tail-events.test.ts +4
@@ -13,6 +13,10 @@ function node(tag: string) {
1313 className: "",
1414 textContent: "",
1515 children: [] as unknown[],
16 attrs: {} as Record<string, string>,
17 setAttribute(n: string, v: string) {
18 el.attrs[n] = v;
19 },
1620 appendChild(c: unknown) {
1721 el.children.push(c);
1822 return c;
test/run-log-lines.test.ts added +36
@@ -0,0 +1,36 @@
1 import { expect, test } from "bun:test";
2 import { logLine } from "../src/web/pages/runs.ts";
3 import { logBox } from "../src/web/studio/log.ts";
4 import { studioRunJs } from "../src/web/client.ts";
5
6 const OLD = ["ln-forge", "ln-pulse", "ln-say", "ln-tool", "ln-you"];
7
8 test("each kind is a §5 row with a badge naming it, and the old names are gone", () => {
9 const cases: [string, string, string[]][] = [
10 ["you: stop here", "you", [">you<", "stop here"]],
11 ["→ Bash ls -la", "tool", [">tool<", "<b>Bash</b>", "ls -la"]],
12 ["cloning trevato/forge", "forge", [">forge<", "cloning trevato/forge"]],
13 ["I will fix it", "say", [">scout<", "I will fix it"]],
14 ];
15 for (const [line, kind, words] of cases) {
16 const out = String(logLine(line, "scout"));
17 expect(out).toContain('class="row ln"');
18 expect(out).toContain(`data-line="${kind}"`);
19 expect(out).toContain('class="badge"');
20 expect(out).toContain("break");
21 for (const w of words) expect(out).toContain(w);
22 for (const o of OLD) expect(out).not.toContain(o);
23 }
24 });
25
26 test("the live script draws the same markup, without the old names", () => {
27 for (const o of OLD) expect(studioRunJs).not.toContain(o);
28 expect(studioRunJs).toContain("'row ln'");
29 });
30
31 test("the pulse line keeps the speaker and drops the old name", () => {
32 const out = String(logBox({ id: "run", who: "scout", cap: 10, lines: [], pulse: true } as never));
33 expect(out).toContain('data-line="pulse"');
34 expect(out).toContain(">scout<");
35 for (const o of OLD) expect(out).not.toContain(o);
36 });
test/studio-runs.test.ts +1 −1
@@ -794,7 +794,7 @@ describe("working: a run's own page in the studio", () => {
794794 // The deploy speaks for itself: the box, and every line in it — never
795795 // "an agent", which is nobody that was actually there.
796796 expect(page).toContain('data-who="the deploy"');
797 expect(page).toContain('class="who">the deploy<');
797 expect(page).toContain('data-variant="secondary">the deploy<');
798798 expect(page).not.toContain("an agent");
799799 // A deploy that finished with nothing else to show reads as done, not
800800 // as a run that has not started yet.
test/web-apps.test.ts +1 −1
@@ -465,7 +465,7 @@ describe("apps, runs and the crew on the web", () => {
465465 expect(page).not.toContain("issue-meta");
466466 // The log is drawn line by line, each by what kind of line it is: the
467467 // forge's own words ("checking out …") are marked as such.
468 expect(page).toContain('class="ln ln-forge"');
468 expect(page).toContain('data-line="forge"');
469469 expect(page).toContain('id="run-elapsed"');
470470
471471 const door = await web(alice, `/runs/${run!.id}`);

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs