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
scout/forge:scout/4226-a-run-log-s-lines-on-runs-draw-5-s-row-a → main 13 commits fork 2 threads · 2 unresolved
10 files
changed +102
−44
docs/DESIGN.md +2 −1
| @@ -201,6 +201,7 @@ specification. | ||
| 201 | 201 | | **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 | |
| 202 | 202 | | **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 | |
| 203 | 203 | | **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 | | |
| 204 | 205 | | **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 | |
| 205 | 206 | | **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` | |
| 206 | 207 | | **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. | ||
| 399 | 400 | - **`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` |
| 400 | 401 | - **`style/content.ts`, prose (markdown)** — table cell alignment, built by `markdown.ts` as `ta-${align}`: `.ta-c` `.ta-r` |
| 401 | 402 | - **`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` | |
| 403 | 404 | - **`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` |
| 404 | 405 | - **`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 |
| 405 | 406 | - **`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 @@ | ||
| 1 | 1 | # Runs |
| 2 | 2 | |
| 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 | ||
| 3 | 5 | - `.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 */ ` | ||
| 196 | 196 | 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: )/; |
| 197 | 197 | function line(kind, speaker, fill) { |
| 198 | 198 | 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'; | |
| 200 | 203 | 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'); | |
| 202 | 206 | w.textContent = speaker; |
| 207 | lead.appendChild(w); | |
| 208 | var main = document.createElement('span'); | |
| 209 | main.className = 'row-main'; | |
| 203 | 210 | var t = document.createElement('span'); |
| 204 | t.className = 'txt'; | |
| 211 | t.className = 'txt break'; | |
| 205 | 212 | fill(t); |
| 206 | el.appendChild(w); | |
| 207 | el.appendChild(t); | |
| 213 | main.appendChild(t); | |
| 214 | el.appendChild(lead); | |
| 215 | el.appendChild(main); | |
| 208 | 216 | return el; |
| 209 | 217 | } |
| 210 | 218 | function draw(text) { |
| 211 | 219 | if (text.indexOf('you: ') === 0) return line('you', 'you', function (t) { t.textContent = text.slice(5); }); |
| 212 | 220 | if (text.indexOf('\\u2192 ') === 0) { |
| 213 | 221 | var rest = text.slice(2), at = rest.indexOf(' '); |
| 214 | return line('tool', '', function (t) { | |
| 222 | return line('tool', 'tool', function (t) { | |
| 215 | 223 | var b = document.createElement('b'); |
| 216 | 224 | b.textContent = at === -1 ? rest : rest.slice(0, at); |
| 217 | 225 | t.appendChild(b); |
src/web/pages/runs.ts +16 −14
| @@ -153,29 +153,31 @@ export function lineKind(line: string): LineKind { | ||
| 153 | 153 | return "say"; |
| 154 | 154 | } |
| 155 | 155 | |
| 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 | */ | |
| 157 | 163 | export function logLine(line: string, who = "agent"): Html { |
| 158 | 164 | 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> | |
| 162 | 170 | </div>`; |
| 171 | if (kind === "you") return shell("success", "you", line.slice(5)); | |
| 163 | 172 | if (kind === "tool") { |
| 164 | 173 | const rest = line.slice(2); |
| 165 | 174 | const at = rest.indexOf(" "); |
| 166 | 175 | const tool = at === -1 ? rest : rest.slice(0, at); |
| 167 | 176 | 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}`); | |
| 171 | 178 | } |
| 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); | |
| 179 | 181 | } |
| 180 | 182 | |
| 181 | 183 | /** |
src/web/studio/log.ts +6 −3
| @@ -98,9 +98,12 @@ export function logBox(opts: { | ||
| 98 | 98 | ${when( |
| 99 | 99 | opts.pulse === true, |
| 100 | 100 | () => |
| 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 | > | |
| 104 | 107 | </div>`, |
| 105 | 108 | )} |
| 106 | 109 | ${opts.extra ?? null} |
src/web/style/content.ts +20 −18
| @@ -726,23 +726,25 @@ form.inline { display: inline; margin-left: auto; } | ||
| 726 | 726 | font-size: 14px; line-height: 1.5; overflow-wrap: anywhere; tab-size: 4; |
| 727 | 727 | } |
| 728 | 728 | #run-live:has(#run-steer) .run-log { border-radius: var(--radius) var(--radius) 0 0; } |
| 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; } | |
| 731 | 732 | .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; } | |
| 746 | 748 | @keyframes run-pulse { 0%, 80%, 100% { opacity: .25; } 40% { opacity: 1; } } |
| 747 | 749 | #run-jump { |
| 748 | 750 | 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; } | ||
| 1110 | 1112 | /* Reduced motion: the pulses hold still at a legible level, the scroll-tied |
| 1111 | 1113 | fade stays at its resting width, and these transitions land at once. */ |
| 1112 | 1114 | @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; } | |
| 1115 | 1117 | .explore-filters { animation: none; } |
| 1116 | 1118 | .ex-dir > summary > .ico, .code-layout > #code-main[aria-busy="true"], .code-layout > [data-split]::after { transition: none; } |
| 1117 | 1119 | } |
test/app-tail-events.test.ts +4
| @@ -13,6 +13,10 @@ function node(tag: string) { | ||
| 13 | 13 | className: "", |
| 14 | 14 | textContent: "", |
| 15 | 15 | children: [] as unknown[], |
| 16 | attrs: {} as Record<string, string>, | |
| 17 | setAttribute(n: string, v: string) { | |
| 18 | el.attrs[n] = v; | |
| 19 | }, | |
| 16 | 20 | appendChild(c: unknown) { |
| 17 | 21 | el.children.push(c); |
| 18 | 22 | 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", () => { | ||
| 794 | 794 | // The deploy speaks for itself: the box, and every line in it — never |
| 795 | 795 | // "an agent", which is nobody that was actually there. |
| 796 | 796 | expect(page).toContain('data-who="the deploy"'); |
| 797 | expect(page).toContain('class="who">the deploy<'); | |
| 797 | expect(page).toContain('data-variant="secondary">the deploy<'); | |
| 798 | 798 | expect(page).not.toContain("an agent"); |
| 799 | 799 | // A deploy that finished with nothing else to show reads as done, not |
| 800 | 800 | // 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", () => { | ||
| 465 | 465 | expect(page).not.toContain("issue-meta"); |
| 466 | 466 | // The log is drawn line by line, each by what kind of line it is: the |
| 467 | 467 | // 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"'); | |
| 469 | 469 | expect(page).toContain('id="run-elapsed"'); |
| 470 | 470 | |
| 471 | 471 | const door = await web(alice, `/runs/${run!.id}`); |
new above
offline
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.