From ae1b6ace485f15dadce9143da725de7c413e97ba Mon Sep 17 00:00:00 2001 From: Daniel Rispler Date: Sat, 28 Nov 2026 19:28:03 +0200 Subject: [PATCH 1/9] Studio map: a part's purpose draws code spans, and its hint shows no backticks (#826) Co-Authored-By: Claude Opus 5.5 --- docs/studio/behaviour/map.md | 2 +- ui/map-model.ts | 4 ++-- ui/map-sheet-folds.ts | 5 +++-- ui/tests/map-sheet-folds.test.mjs | 11 +++++++++++ ui/tests/map.test.mjs | 1 + 5 files changed, 18 insertions(+), 5 deletions(-) diff --git a/docs/studio/behaviour/map.md b/docs/studio/behaviour/map.md index d9111b71..3791336a 100644 --- a/docs/studio/behaviour/map.md +++ b/docs/studio/behaviour/map.md @@ -336,7 +336,7 @@ The window's Map view (`ui/map.ts`, `server/src/map.rs`) draws a project's map o - **No map.** A project without the file shows a calm empty state, and shows the drafting prompt to give to a session in the project, with a copy icon beside it (`ui/copy-button.ts`, the PR brief's): a press puts the prompt on the clipboard and the copy toast says "Prompt copied", or holds the prompt to copy by hand when the clipboard refuses. The page starts no session. - **Fog** (`server/src/fog.rs`). The first time the view opens a project, the server records the default branch's tip, so every part starts clear. After that it walks the new first-parent commits and files each part's changes in `map-state.json`: **thick** when a law on the part, a link at it (its id or ends), a flow through it or its `paths` changed, or the part was added; **thin** when files it owns changed (placed by the union of the commit's map and its parent's, so a moved file touches both parts) or only its name, caption, purpose or held items (their paths included) did, or the `kind` or `reason` of a link at it; nothing for `zone`, `ignored` or `tier`. A removed part leaves the live map. Each entry keeps its commit, its strength, the PR its subject names (`Title (#N)`, else none) and why it fogs the part (#495, `fog::Change`): "added", "paths", `law `, `link ` and `flow ` for each law, link or flow whose say on the part changed (a link's kind or reason too), each of the part's own words that changed (`name`, `caption`, `purpose`, `holds`), and the count of its files changed (`3 files`). An entry filed before #495 has neither PR nor why. What shows is by Daniel's effective tier: a Black box part never, an Interface-only part only thick. Strength is never a count. **Reading a brief clears it** (#342): a chapter is complete when its last step was seen (`watchSeen`) and its check was answered, right or wrong, when it holds one; a single story is one chapter over all its lit parts. Once every chapter of a PR's brief that lights a part is complete, that PR's entries leave that part at once and the mist lifts; a part no chapter lights keeps its fog, and leaving mid-chapter clears nothing. Completion is kept as "read at head X" per chapter in `map-state.json` (`fog.reads`). A PR read before it merges files fog at merge only for the parts touched by the diff from X to the squash commit, limited to the paths the squash commit itself changes (so main merged into the branch fogs nothing), at the strength that diff earns; none when nothing was pushed after the read. A read carried over to a new head (a pure rebase, or a push that fogs nothing; [Since you read](pr-briefs.md#ready-detection)) counts as read at that head, so fog at merge runs from it and a rebase does not pull main's edits into the PR's fog. "I know this" still clears a whole part, and so does reading its [part catch-up](pr-briefs.md#part-catch-ups) to the end, for the entries it covered. - **Mist.** A fogged plate has a cool-grey mist around it (#455): dense beyond the plate's edges and at its rim, thinning to nothing over its name, caption and marks, so they read at full contrast (4.5:1, measured by snap's contrast pass); the caption is not dimmed. Thin and thick still read apart: thick is denser, with a rim and a slow drift. "I know this" on the part's sheet clears that part's fog and lifts the mist (no motion under reduced motion), and is logged as its own event (Stop rules). -- **The part sheet** (`ui/map-sheet.ts`) opens over the map's top right, in the left panel's glass, on a click that was not a drag (a press on a session badge opens its list instead, and a press in that list never reaches the plate). First, under its name and caption, why its plate carries its marks (#495, `sheetMarks` in `ui/map-model.ts`), from this case's facts and only for the marks it carries: its fog as the newest thick entry (else the newest) with its PR (else its commit) and why, then "+N more" for the other entries, or an older entry's strength and commit alone; its staleness band's line (below); and a broken law's line (below). A past commit's sheet shows none. Then the catch-up card: for a fogged part, how many changes landed, the waiting [part catch-up](pr-briefs.md#part-catch-ups)'s outline and its main button (or the one PR brief chapter that lights it) with "I know this" as the quiet second; on a part with no fog, "Caught up" and the refresher (below). Then the purpose, clamped to two lines with "More" (shown only when it runs longer; "Less" clamps it again), and a row of chips (the tier, the laws, the links, and CI when the sheet shows CI), each opening its section and bringing it into view (#637). Then the sections, each a fold that opens on its own and shows a short value beside its title (none for History, whose rows load later), in this order: **Laws** (backed by a check or on trust), **Talks to** (every link at either end of the part, in the map's order: an arrow, → when the link runs from this part and ← when it runs to it, the other end, the link's kind and its reason when it has one; the sheet has no other list of links; "No link at this part" when there is none), **This session here** (below), **Holds** (the held items, each its name, its sentence and its key files, its `paths` as written; an item without paths is a note, its name in italics followed by "· note", then its sentence, so it never reads as a heading, #525; none when the part holds nothing), **Tier** (Core, Interface-only, Black box; changed in place and kept in `map-state.json`), **CI on main** (below, whenever the sheet shows CI) and **History** (the history strip, below). When a run on main breaks one of the part's laws, CI on main comes first, open. The folds Daniel opened stay open in this browser (`map-sheet-folds`, beside the sheet's width); a browser that keeps nothing starts with all folded. The first Esc closes it; the next closes the left panel, if open. × (named "Close") closes it too, and so does a click on the empty map (#445): a press on the background that moves 4 px or less between down and up closes the sheet and its drawer, while one that moves further pans and keeps them. A click on another part switches the sheet to that part. The not placed line, the sheet, the drawer under it and the background runs are one column at most the map's height less its insets, the line first, so it keeps the map's top right and an open sheet never pushes it down over a part (#466). The not placed line is one line of fixed height, and while a sheet is open its slot keeps that height even with no line in it, so sessions starting and stopping to need Daniel never move the sheet (#472, #694; in the event log the list changed about every 30 s while agents ran). The column scrolls as one: the sheet and the drawer never scroll on their own (a drawer's code block keeps its own short scroll), and a scroll past its end never moves the map. The sheet is 360 px wide at first; dragging its left edge resizes it between 300 px and half the map, and so do the left and right arrow keys while that edge has the focus. The width is kept in this browser, and a double-click on the edge puts it back to 360 px. **The sheet explains itself** (spec #520, #522): while the page-wide `explanations` setting is on (the default), each fold (Laws, Talks to, This session here, Holds, Tier, CI on main, History) has one muted line first in its body, shown when it is open, and the catch-up card one under its eyebrow; the selected tier's meaning sits under the tier buttons, and every tier button's hint is its meaning; in Talks to, a link kind's line follows only the first link of that kind, and "Not yet ratified"'s only the first unratified link; a fogged part has one line under its fog buttons saying what the buttons shown do: Part catch-up and I know this, the PR brief chapter's button and I know this, or I know this alone, each button described by it. Each fold's summary and the selected tier carry `aria-describedby` to their line; while off, no line is drawn and no attribute points at one. A `?` toggle beside the × (named "Explanations", with `aria-pressed`; hint "Hide explanations" or "Show explanations"; filled when on, a muted ring when off) flips the setting through the server's settings write (`set_explanations`), and so does the palette's `studio::ToggleExplanations`; the open sheet draws again at once, and a `?` that had the focus keeps it. A flip while a write is in flight waits for its reply, so a double click ends where it started and no write is refused as stale. Every text is in `ui/explanations.ts`, worded to "you", at most 12 words each. **This session here** (spec #549, #561): while a session's story is open in the left panel beside the sheet, a fold, third after Laws and Talks to, lists the open session's turns of the last 7 days (the page's cut: a turn's end, or its start if it never ended) that changed the part, Workers' files included, newest first, each its number in the story (from 1), its Headline (else its prompt's first line) and its age (minutes, hours, then days). With none it says "No turn of this session changed this part in the last 7 days", but nothing while `map_place` has yet to answer for a file of those turns; the section, and the newest turn's "Show on map", follow a new answer when it lands, and "Turns older than 7 days aren't listed" shows under it only when the session has older turns. Pressing a row scrolls the story to the turn, unfolds it, moves the focus to its line and flashes its outline once in the warm ring (held still for that second under reduced motion), then pans the turn's parts clear of the panel and the sheet (`revealParts`). The section follows the story as it changes, keeps a focused row's focus, and is not drawn for a subagent's view or on a past commit's sheet. Below 1007 px the sheet takes the panel's place, so the section never shows there, and no session is remembered for it. +- **The part sheet** (`ui/map-sheet.ts`) opens over the map's top right, in the left panel's glass, on a click that was not a drag (a press on a session badge opens its list instead, and a press in that list never reaches the plate). First, under its name and caption, why its plate carries its marks (#495, `sheetMarks` in `ui/map-model.ts`), from this case's facts and only for the marks it carries: its fog as the newest thick entry (else the newest) with its PR (else its commit) and why, then "+N more" for the other entries, or an older entry's strength and commit alone; its staleness band's line (below); and a broken law's line (below). A past commit's sheet shows none. Then the catch-up card: for a fogged part, how many changes landed, the waiting [part catch-up](pr-briefs.md#part-catch-ups)'s outline and its main button (or the one PR brief chapter that lights it) with "I know this" as the quiet second; on a part with no fog, "Caught up" and the refresher (below). Then the purpose, which draws a backtick span as code (a plate's hover text shows no backtick), clamped to two lines with "More" (shown only when it runs longer; "Less" clamps it again), and a row of chips (the tier, the laws, the links, and CI when the sheet shows CI), each opening its section and bringing it into view (#637). Then the sections, each a fold that opens on its own and shows a short value beside its title (none for History, whose rows load later), in this order: **Laws** (backed by a check or on trust), **Talks to** (every link at either end of the part, in the map's order: an arrow, → when the link runs from this part and ← when it runs to it, the other end, the link's kind and its reason when it has one; the sheet has no other list of links; "No link at this part" when there is none), **This session here** (below), **Holds** (the held items, each its name, its sentence and its key files, its `paths` as written; an item without paths is a note, its name in italics followed by "· note", then its sentence, so it never reads as a heading, #525; none when the part holds nothing), **Tier** (Core, Interface-only, Black box; changed in place and kept in `map-state.json`), **CI on main** (below, whenever the sheet shows CI) and **History** (the history strip, below). When a run on main breaks one of the part's laws, CI on main comes first, open. The folds Daniel opened stay open in this browser (`map-sheet-folds`, beside the sheet's width); a browser that keeps nothing starts with all folded. The first Esc closes it; the next closes the left panel, if open. × (named "Close") closes it too, and so does a click on the empty map (#445): a press on the background that moves 4 px or less between down and up closes the sheet and its drawer, while one that moves further pans and keeps them. A click on another part switches the sheet to that part. The not placed line, the sheet, the drawer under it and the background runs are one column at most the map's height less its insets, the line first, so it keeps the map's top right and an open sheet never pushes it down over a part (#466). The not placed line is one line of fixed height, and while a sheet is open its slot keeps that height even with no line in it, so sessions starting and stopping to need Daniel never move the sheet (#472, #694; in the event log the list changed about every 30 s while agents ran). The column scrolls as one: the sheet and the drawer never scroll on their own (a drawer's code block keeps its own short scroll), and a scroll past its end never moves the map. The sheet is 360 px wide at first; dragging its left edge resizes it between 300 px and half the map, and so do the left and right arrow keys while that edge has the focus. The width is kept in this browser, and a double-click on the edge puts it back to 360 px. **The sheet explains itself** (spec #520, #522): while the page-wide `explanations` setting is on (the default), each fold (Laws, Talks to, This session here, Holds, Tier, CI on main, History) has one muted line first in its body, shown when it is open, and the catch-up card one under its eyebrow; the selected tier's meaning sits under the tier buttons, and every tier button's hint is its meaning; in Talks to, a link kind's line follows only the first link of that kind, and "Not yet ratified"'s only the first unratified link; a fogged part has one line under its fog buttons saying what the buttons shown do: Part catch-up and I know this, the PR brief chapter's button and I know this, or I know this alone, each button described by it. Each fold's summary and the selected tier carry `aria-describedby` to their line; while off, no line is drawn and no attribute points at one. A `?` toggle beside the × (named "Explanations", with `aria-pressed`; hint "Hide explanations" or "Show explanations"; filled when on, a muted ring when off) flips the setting through the server's settings write (`set_explanations`), and so does the palette's `studio::ToggleExplanations`; the open sheet draws again at once, and a `?` that had the focus keeps it. A flip while a write is in flight waits for its reply, so a double click ends where it started and no write is refused as stale. Every text is in `ui/explanations.ts`, worded to "you", at most 12 words each. **This session here** (spec #549, #561): while a session's story is open in the left panel beside the sheet, a fold, third after Laws and Talks to, lists the open session's turns of the last 7 days (the page's cut: a turn's end, or its start if it never ended) that changed the part, Workers' files included, newest first, each its number in the story (from 1), its Headline (else its prompt's first line) and its age (minutes, hours, then days). With none it says "No turn of this session changed this part in the last 7 days", but nothing while `map_place` has yet to answer for a file of those turns; the section, and the newest turn's "Show on map", follow a new answer when it lands, and "Turns older than 7 days aren't listed" shows under it only when the session has older turns. Pressing a row scrolls the story to the turn, unfolds it, moves the focus to its line and flashes its outline once in the warm ring (held still for that second under reduced motion), then pans the turn's parts clear of the panel and the sheet (`revealParts`). The section follows the story as it changes, keeps a focused row's focus, and is not drawn for a subagent's view or on a past commit's sheet. Below 1007 px the sheet takes the panel's place, so the section never shows there, and no session is remembered for it. - **Keyboard** (#460). Each plate holds an open button over its name and caption, named by them, beside its session badge rather than around it. Tab reaches a part's button and then its badge (Enter or Space opens the badge's list and moves the focus into it; Esc closes it and puts the focus back on the badge), the parts in the map's reading order (top to bottom, then left to right; a plate within half a plate's height of a row's highest plate reads on that row; `readingOrder` in `ui/map-model.ts`), set when the map draws; a redraw keeps the focus on the same part's button, or on its new badge, also when the badges come after the map (a new commit asks `map_place` again); a focused badge that a spotlit chip replaces (its list's row opened that session's story) leaves the focus on its part's button. Enter or Space opens the part's sheet, as a click does, and the page's focus ring marks the part; in a brief's order question the same press counts as a tap. Actors take no focus, since a click on them does nothing. Plates cannot be moved from the keyboard, nor the camera panned or zoomed: placement is Daniel's own arrangement, and every action the map offers stays reachable without it (#452). - **Staleness bands** (`server/src/staleness.rs`, `ui/map-stale.ts`, #392). A part whose effective tier is Core carries a mild band along its plate's foot, in the muted text tone and firmer with each band, once Daniel has not engaged with it for 3 weeks (band 1), 6 (band 2) or 12 (band 3); its plate's hint adds "You last engaged with this part 3 weeks or more ago" (6, 12), and the top of its sheet gives the band with the UTC date of the last engagement, "6 weeks or more since you last engaged with this part, on ", or, with no engagement since tracking began (the baseline, or the part's first commit when later), "6 weeks or more: not engaged since tracking began on ". The server words that line (`staleness::lines`, `MapState.stale_why`). Interface-only and Black box parts never band; a past commit's map shows none. Staleness is the time since his last entered activity on the part, never since its last commit: a brief chapter read to its end that lights it (read from `fog.reads`, so a chapter read before staleness shipped counts, and kept in `staleness.parts` too as it is read, since a brief rewritten to light its parts differently clears its `fog.reads`), a part catch-up, the refresher, or "I know this". Any of them clears the band at once. A part's baseline is the first time this build showed the project's map (`staleness.since` in `map-state.json`) or, when later, the committer time of the first first-parent commit on the default branch whose `system-map.json` lists the part's id, so nothing is stale on day one and a part added to the map, a split's new parts included, starts with no band; a newer activity beats either. That time is read from git's history of the map file once per project and part while the server runs and is never stored (`staleness::births`, `history::part_births`); the other activities are kept there per part (`staleness.parts`, the last one's time and kind). The bands show on the map, on the part's sheet and at pre-flight only (`MapState.stale`, the band of each stale part), never anywhere else. - **The refresher** (#392). A part's sheet with no fog offers **Refresher** in its catch-up card: the part as the map has it now, drawn by code from the map file at once, never a writer call. The sheet already shows its caption, purpose, held items, laws with their backing and links; the refresher opens inside the catch-up card, under "Caught up", and adds the flows through the part (each flow's hops on a link at the part, in order), or "No flow of the map crosses this part". Entering it is an activity on the part (`map_refresher`), so its band clears, and is logged (Stop rules). diff --git a/ui/map-model.ts b/ui/map-model.ts index e8632343..4daf71c3 100644 --- a/ui/map-model.ts +++ b/ui/map-model.ts @@ -340,8 +340,8 @@ export function linkLines(links: MapLink[]): LinkLine[] { return [...lines.values()]; } -/** A plate's hover text: its name, caption and purpose, never the held items, so a glance stays a glance. */ -export const plateTitle = (part: Part): string => [part.name, part.caption, part.purpose].filter(Boolean).join("\n\n"); +/** A plate's hover text: its name, caption and purpose, never the held items, so a glance stays a glance. A hint is plain text, so backticks go. */ +export const plateTitle = (part: Part): string => [part.name, part.caption, part.purpose].filter(Boolean).join("\n\n").replaceAll("`", ""); /** * Broken laws and the drawer (ticket #312). The drawer is read-only and holds any content a ticket gives it: blocks of code or text and diff --git a/ui/map-sheet-folds.ts b/ui/map-sheet-folds.ts index 965c3892..bd1e9392 100644 --- a/ui/map-sheet-folds.ts +++ b/ui/map-sheet-folds.ts @@ -3,7 +3,7 @@ // side by side) with a short value beside its title. Which folds are open is kept in this browser's page store, as the sheet's width is; // a browser that keeps nothing starts with all folded and keeps them for as long as the page lives. `map-sheet.ts` fills each fold. -import { hint, pageStore, pressable, text } from "./dom.js"; +import { hint, pageStore, pressable, prose, text } from "./dom.js"; import { explainLine, SHEET_FOLDS } from "./explanations.js"; import { type FoldKey, foldTitles } from "./map-model.js"; @@ -82,7 +82,8 @@ export function chip(label: string, target: Fold, bad = false): HTMLElement { * sheet is in the page). */ export function purposeNodes(purpose: string, open: boolean, flipped: (open: boolean) => void): HTMLElement[] { - const words = text("p", purpose, "sheet-purpose"); + const words = prose("p", purpose); + words.className = "sheet-purpose"; words.id = "sheet-purpose"; const more = pressable(text("button", "", "btn quiet sheet-more"), null); more.setAttribute("aria-controls", words.id); diff --git a/ui/tests/map-sheet-folds.test.mjs b/ui/tests/map-sheet-folds.test.mjs index aaca9ff9..3dd0d4cc 100644 --- a/ui/tests/map-sheet-folds.test.mjs +++ b/ui/tests/map-sheet-folds.test.mjs @@ -234,3 +234,14 @@ test("the purpose sits under the card clamped to two lines with More, which show classed(again, "sheet-more")[0].listeners.click(); assert.ok(classed(sheetCard(view(), store).card, "sheet-purpose")[0].className.includes("clamped"), "Less clamps it again"); }); + +test("the purpose draws a backtick span as code, with no backtick left, and keeps its clamp and More", () => { + explanations(false); + const ticked = { ...store, purpose: "Serves the page that `plotkeeper` starts." }; + const { card } = sheetCard(view(), ticked); + const purpose = classed(card, "sheet-purpose")[0]; + assert.equal(all(purpose).filter((each) => each.nodeName === "CODE").map((each) => each.text).join(), "plotkeeper"); + assert.ok(!purpose.text.includes("`")); + assert.ok(purpose.className.includes("clamped")); + assert.equal(classed(card, "sheet-more")[0].text, "More"); +}); diff --git a/ui/tests/map.test.mjs b/ui/tests/map.test.mjs index 6ecc1b34..a73eb97d 100644 --- a/ui/tests/map.test.mjs +++ b/ui/tests/map.test.mjs @@ -207,6 +207,7 @@ test("a part's sheet gives its purpose, then each held item with its key files, { name: "Rules", text: "What must hold.", files: [] }, ]); assert.equal(plateTitle(core), "Core\n\nEvents to state\n\nPlain Rust."); + assert.equal(plateTitle(part("x", { name: "`X`", caption: "A `c`", purpose: "Runs `plotkeeper`." })), "X\n\nA c\n\nRuns plotkeeper."); }); test("a part's sheet names it, lists its laws by backing, and offers the three tiers with the effective one pressed", () => { From 4b20c89a84b2fcc8a8ed65e45337964084019927 Mon Sep 17 00:00:00 2001 From: Daniel Rispler Date: Sat, 28 Nov 2026 19:29:03 +0200 Subject: [PATCH 2/9] Studio: the subagent chip keeps its status, the drawer never scrolls the column sideways, the gear is a gear (#825) Co-Authored-By: Claude Opus 5.5 --- docs/studio/behaviour/map.md | 2 +- docs/studio/behaviour/rail.md | 2 +- scripts/snap/fixtures-map.ts | 4 +++- scripts/snap/rail-fixtures.ts | 23 +++++++++++++++++++++++ ui/index.html | 2 +- ui/style.css | 11 ++++++++--- 6 files changed, 37 insertions(+), 7 deletions(-) diff --git a/docs/studio/behaviour/map.md b/docs/studio/behaviour/map.md index d9111b71..cd2e50b9 100644 --- a/docs/studio/behaviour/map.md +++ b/docs/studio/behaviour/map.md @@ -336,7 +336,7 @@ The window's Map view (`ui/map.ts`, `server/src/map.rs`) draws a project's map o - **No map.** A project without the file shows a calm empty state, and shows the drafting prompt to give to a session in the project, with a copy icon beside it (`ui/copy-button.ts`, the PR brief's): a press puts the prompt on the clipboard and the copy toast says "Prompt copied", or holds the prompt to copy by hand when the clipboard refuses. The page starts no session. - **Fog** (`server/src/fog.rs`). The first time the view opens a project, the server records the default branch's tip, so every part starts clear. After that it walks the new first-parent commits and files each part's changes in `map-state.json`: **thick** when a law on the part, a link at it (its id or ends), a flow through it or its `paths` changed, or the part was added; **thin** when files it owns changed (placed by the union of the commit's map and its parent's, so a moved file touches both parts) or only its name, caption, purpose or held items (their paths included) did, or the `kind` or `reason` of a link at it; nothing for `zone`, `ignored` or `tier`. A removed part leaves the live map. Each entry keeps its commit, its strength, the PR its subject names (`Title (#N)`, else none) and why it fogs the part (#495, `fog::Change`): "added", "paths", `law `, `link ` and `flow ` for each law, link or flow whose say on the part changed (a link's kind or reason too), each of the part's own words that changed (`name`, `caption`, `purpose`, `holds`), and the count of its files changed (`3 files`). An entry filed before #495 has neither PR nor why. What shows is by Daniel's effective tier: a Black box part never, an Interface-only part only thick. Strength is never a count. **Reading a brief clears it** (#342): a chapter is complete when its last step was seen (`watchSeen`) and its check was answered, right or wrong, when it holds one; a single story is one chapter over all its lit parts. Once every chapter of a PR's brief that lights a part is complete, that PR's entries leave that part at once and the mist lifts; a part no chapter lights keeps its fog, and leaving mid-chapter clears nothing. Completion is kept as "read at head X" per chapter in `map-state.json` (`fog.reads`). A PR read before it merges files fog at merge only for the parts touched by the diff from X to the squash commit, limited to the paths the squash commit itself changes (so main merged into the branch fogs nothing), at the strength that diff earns; none when nothing was pushed after the read. A read carried over to a new head (a pure rebase, or a push that fogs nothing; [Since you read](pr-briefs.md#ready-detection)) counts as read at that head, so fog at merge runs from it and a rebase does not pull main's edits into the PR's fog. "I know this" still clears a whole part, and so does reading its [part catch-up](pr-briefs.md#part-catch-ups) to the end, for the entries it covered. - **Mist.** A fogged plate has a cool-grey mist around it (#455): dense beyond the plate's edges and at its rim, thinning to nothing over its name, caption and marks, so they read at full contrast (4.5:1, measured by snap's contrast pass); the caption is not dimmed. Thin and thick still read apart: thick is denser, with a rim and a slow drift. "I know this" on the part's sheet clears that part's fog and lifts the mist (no motion under reduced motion), and is logged as its own event (Stop rules). -- **The part sheet** (`ui/map-sheet.ts`) opens over the map's top right, in the left panel's glass, on a click that was not a drag (a press on a session badge opens its list instead, and a press in that list never reaches the plate). First, under its name and caption, why its plate carries its marks (#495, `sheetMarks` in `ui/map-model.ts`), from this case's facts and only for the marks it carries: its fog as the newest thick entry (else the newest) with its PR (else its commit) and why, then "+N more" for the other entries, or an older entry's strength and commit alone; its staleness band's line (below); and a broken law's line (below). A past commit's sheet shows none. Then the catch-up card: for a fogged part, how many changes landed, the waiting [part catch-up](pr-briefs.md#part-catch-ups)'s outline and its main button (or the one PR brief chapter that lights it) with "I know this" as the quiet second; on a part with no fog, "Caught up" and the refresher (below). Then the purpose, clamped to two lines with "More" (shown only when it runs longer; "Less" clamps it again), and a row of chips (the tier, the laws, the links, and CI when the sheet shows CI), each opening its section and bringing it into view (#637). Then the sections, each a fold that opens on its own and shows a short value beside its title (none for History, whose rows load later), in this order: **Laws** (backed by a check or on trust), **Talks to** (every link at either end of the part, in the map's order: an arrow, → when the link runs from this part and ← when it runs to it, the other end, the link's kind and its reason when it has one; the sheet has no other list of links; "No link at this part" when there is none), **This session here** (below), **Holds** (the held items, each its name, its sentence and its key files, its `paths` as written; an item without paths is a note, its name in italics followed by "· note", then its sentence, so it never reads as a heading, #525; none when the part holds nothing), **Tier** (Core, Interface-only, Black box; changed in place and kept in `map-state.json`), **CI on main** (below, whenever the sheet shows CI) and **History** (the history strip, below). When a run on main breaks one of the part's laws, CI on main comes first, open. The folds Daniel opened stay open in this browser (`map-sheet-folds`, beside the sheet's width); a browser that keeps nothing starts with all folded. The first Esc closes it; the next closes the left panel, if open. × (named "Close") closes it too, and so does a click on the empty map (#445): a press on the background that moves 4 px or less between down and up closes the sheet and its drawer, while one that moves further pans and keeps them. A click on another part switches the sheet to that part. The not placed line, the sheet, the drawer under it and the background runs are one column at most the map's height less its insets, the line first, so it keeps the map's top right and an open sheet never pushes it down over a part (#466). The not placed line is one line of fixed height, and while a sheet is open its slot keeps that height even with no line in it, so sessions starting and stopping to need Daniel never move the sheet (#472, #694; in the event log the list changed about every 30 s while agents ran). The column scrolls as one: the sheet and the drawer never scroll on their own (a drawer's code block keeps its own short scroll), and a scroll past its end never moves the map. The sheet is 360 px wide at first; dragging its left edge resizes it between 300 px and half the map, and so do the left and right arrow keys while that edge has the focus. The width is kept in this browser, and a double-click on the edge puts it back to 360 px. **The sheet explains itself** (spec #520, #522): while the page-wide `explanations` setting is on (the default), each fold (Laws, Talks to, This session here, Holds, Tier, CI on main, History) has one muted line first in its body, shown when it is open, and the catch-up card one under its eyebrow; the selected tier's meaning sits under the tier buttons, and every tier button's hint is its meaning; in Talks to, a link kind's line follows only the first link of that kind, and "Not yet ratified"'s only the first unratified link; a fogged part has one line under its fog buttons saying what the buttons shown do: Part catch-up and I know this, the PR brief chapter's button and I know this, or I know this alone, each button described by it. Each fold's summary and the selected tier carry `aria-describedby` to their line; while off, no line is drawn and no attribute points at one. A `?` toggle beside the × (named "Explanations", with `aria-pressed`; hint "Hide explanations" or "Show explanations"; filled when on, a muted ring when off) flips the setting through the server's settings write (`set_explanations`), and so does the palette's `studio::ToggleExplanations`; the open sheet draws again at once, and a `?` that had the focus keeps it. A flip while a write is in flight waits for its reply, so a double click ends where it started and no write is refused as stale. Every text is in `ui/explanations.ts`, worded to "you", at most 12 words each. **This session here** (spec #549, #561): while a session's story is open in the left panel beside the sheet, a fold, third after Laws and Talks to, lists the open session's turns of the last 7 days (the page's cut: a turn's end, or its start if it never ended) that changed the part, Workers' files included, newest first, each its number in the story (from 1), its Headline (else its prompt's first line) and its age (minutes, hours, then days). With none it says "No turn of this session changed this part in the last 7 days", but nothing while `map_place` has yet to answer for a file of those turns; the section, and the newest turn's "Show on map", follow a new answer when it lands, and "Turns older than 7 days aren't listed" shows under it only when the session has older turns. Pressing a row scrolls the story to the turn, unfolds it, moves the focus to its line and flashes its outline once in the warm ring (held still for that second under reduced motion), then pans the turn's parts clear of the panel and the sheet (`revealParts`). The section follows the story as it changes, keeps a focused row's focus, and is not drawn for a subagent's view or on a past commit's sheet. Below 1007 px the sheet takes the panel's place, so the section never shows there, and no session is remembered for it. +- **The part sheet** (`ui/map-sheet.ts`) opens over the map's top right, in the left panel's glass, on a click that was not a drag (a press on a session badge opens its list instead, and a press in that list never reaches the plate). First, under its name and caption, why its plate carries its marks (#495, `sheetMarks` in `ui/map-model.ts`), from this case's facts and only for the marks it carries: its fog as the newest thick entry (else the newest) with its PR (else its commit) and why, then "+N more" for the other entries, or an older entry's strength and commit alone; its staleness band's line (below); and a broken law's line (below). A past commit's sheet shows none. Then the catch-up card: for a fogged part, how many changes landed, the waiting [part catch-up](pr-briefs.md#part-catch-ups)'s outline and its main button (or the one PR brief chapter that lights it) with "I know this" as the quiet second; on a part with no fog, "Caught up" and the refresher (below). Then the purpose, clamped to two lines with "More" (shown only when it runs longer; "Less" clamps it again), and a row of chips (the tier, the laws, the links, and CI when the sheet shows CI), each opening its section and bringing it into view (#637). Then the sections, each a fold that opens on its own and shows a short value beside its title (none for History, whose rows load later), in this order: **Laws** (backed by a check or on trust), **Talks to** (every link at either end of the part, in the map's order: an arrow, → when the link runs from this part and ← when it runs to it, the other end, the link's kind and its reason when it has one; the sheet has no other list of links; "No link at this part" when there is none), **This session here** (below), **Holds** (the held items, each its name, its sentence and its key files, its `paths` as written; an item without paths is a note, its name in italics followed by "· note", then its sentence, so it never reads as a heading, #525; none when the part holds nothing), **Tier** (Core, Interface-only, Black box; changed in place and kept in `map-state.json`), **CI on main** (below, whenever the sheet shows CI) and **History** (the history strip, below). When a run on main breaks one of the part's laws, CI on main comes first, open. The folds Daniel opened stay open in this browser (`map-sheet-folds`, beside the sheet's width); a browser that keeps nothing starts with all folded. The first Esc closes it; the next closes the left panel, if open. × (named "Close") closes it too, and so does a click on the empty map (#445): a press on the background that moves 4 px or less between down and up closes the sheet and its drawer, while one that moves further pans and keeps them. A click on another part switches the sheet to that part. The not placed line, the sheet, the drawer under it and the background runs are one column at most the map's height less its insets, the line first, so it keeps the map's top right and an open sheet never pushes it down over a part (#466). The not placed line is one line of fixed height, and while a sheet is open its slot keeps that height even with no line in it, so sessions starting and stopping to need Daniel never move the sheet (#472, #694; in the event log the list changed about every 30 s while agents ran). The column scrolls as one: the sheet and the drawer never scroll on their own, except the two that keep a short scroll of their own: a drawer's code block and the History strip (which can hold thousands of pixels of commits); no drawer text gives the column a sideways scroll, and a scroll past its end never moves the map. The sheet is 360 px wide at first; dragging its left edge resizes it between 300 px and half the map, and so do the left and right arrow keys while that edge has the focus. The width is kept in this browser, and a double-click on the edge puts it back to 360 px. **The sheet explains itself** (spec #520, #522): while the page-wide `explanations` setting is on (the default), each fold (Laws, Talks to, This session here, Holds, Tier, CI on main, History) has one muted line first in its body, shown when it is open, and the catch-up card one under its eyebrow; the selected tier's meaning sits under the tier buttons, and every tier button's hint is its meaning; in Talks to, a link kind's line follows only the first link of that kind, and "Not yet ratified"'s only the first unratified link; a fogged part has one line under its fog buttons saying what the buttons shown do: Part catch-up and I know this, the PR brief chapter's button and I know this, or I know this alone, each button described by it. Each fold's summary and the selected tier carry `aria-describedby` to their line; while off, no line is drawn and no attribute points at one. A `?` toggle beside the × (named "Explanations", with `aria-pressed`; hint "Hide explanations" or "Show explanations"; filled when on, a muted ring when off) flips the setting through the server's settings write (`set_explanations`), and so does the palette's `studio::ToggleExplanations`; the open sheet draws again at once, and a `?` that had the focus keeps it. A flip while a write is in flight waits for its reply, so a double click ends where it started and no write is refused as stale. Every text is in `ui/explanations.ts`, worded to "you", at most 12 words each. **This session here** (spec #549, #561): while a session's story is open in the left panel beside the sheet, a fold, third after Laws and Talks to, lists the open session's turns of the last 7 days (the page's cut: a turn's end, or its start if it never ended) that changed the part, Workers' files included, newest first, each its number in the story (from 1), its Headline (else its prompt's first line) and its age (minutes, hours, then days). With none it says "No turn of this session changed this part in the last 7 days", but nothing while `map_place` has yet to answer for a file of those turns; the section, and the newest turn's "Show on map", follow a new answer when it lands, and "Turns older than 7 days aren't listed" shows under it only when the session has older turns. Pressing a row scrolls the story to the turn, unfolds it, moves the focus to its line and flashes its outline once in the warm ring (held still for that second under reduced motion), then pans the turn's parts clear of the panel and the sheet (`revealParts`). The section follows the story as it changes, keeps a focused row's focus, and is not drawn for a subagent's view or on a past commit's sheet. Below 1007 px the sheet takes the panel's place, so the section never shows there, and no session is remembered for it. - **Keyboard** (#460). Each plate holds an open button over its name and caption, named by them, beside its session badge rather than around it. Tab reaches a part's button and then its badge (Enter or Space opens the badge's list and moves the focus into it; Esc closes it and puts the focus back on the badge), the parts in the map's reading order (top to bottom, then left to right; a plate within half a plate's height of a row's highest plate reads on that row; `readingOrder` in `ui/map-model.ts`), set when the map draws; a redraw keeps the focus on the same part's button, or on its new badge, also when the badges come after the map (a new commit asks `map_place` again); a focused badge that a spotlit chip replaces (its list's row opened that session's story) leaves the focus on its part's button. Enter or Space opens the part's sheet, as a click does, and the page's focus ring marks the part; in a brief's order question the same press counts as a tap. Actors take no focus, since a click on them does nothing. Plates cannot be moved from the keyboard, nor the camera panned or zoomed: placement is Daniel's own arrangement, and every action the map offers stays reachable without it (#452). - **Staleness bands** (`server/src/staleness.rs`, `ui/map-stale.ts`, #392). A part whose effective tier is Core carries a mild band along its plate's foot, in the muted text tone and firmer with each band, once Daniel has not engaged with it for 3 weeks (band 1), 6 (band 2) or 12 (band 3); its plate's hint adds "You last engaged with this part 3 weeks or more ago" (6, 12), and the top of its sheet gives the band with the UTC date of the last engagement, "6 weeks or more since you last engaged with this part, on ", or, with no engagement since tracking began (the baseline, or the part's first commit when later), "6 weeks or more: not engaged since tracking began on ". The server words that line (`staleness::lines`, `MapState.stale_why`). Interface-only and Black box parts never band; a past commit's map shows none. Staleness is the time since his last entered activity on the part, never since its last commit: a brief chapter read to its end that lights it (read from `fog.reads`, so a chapter read before staleness shipped counts, and kept in `staleness.parts` too as it is read, since a brief rewritten to light its parts differently clears its `fog.reads`), a part catch-up, the refresher, or "I know this". Any of them clears the band at once. A part's baseline is the first time this build showed the project's map (`staleness.since` in `map-state.json`) or, when later, the committer time of the first first-parent commit on the default branch whose `system-map.json` lists the part's id, so nothing is stale on day one and a part added to the map, a split's new parts included, starts with no band; a newer activity beats either. That time is read from git's history of the map file once per project and part while the server runs and is never stored (`staleness::births`, `history::part_births`); the other activities are kept there per part (`staleness.parts`, the last one's time and kind). The bands show on the map, on the part's sheet and at pre-flight only (`MapState.stale`, the band of each stale part), never anywhere else. - **The refresher** (#392). A part's sheet with no fog offers **Refresher** in its catch-up card: the part as the map has it now, drawn by code from the map file at once, never a writer call. The sheet already shows its caption, purpose, held items, laws with their backing and links; the refresher opens inside the catch-up card, under "Caught up", and adds the flows through the part (each flow's hops on a link at the part, in order), or "No flow of the map crosses this part". Entering it is an activity on the part (`map_refresher`), so its band clears, and is logged (Stop rules). diff --git a/docs/studio/behaviour/rail.md b/docs/studio/behaviour/rail.md index baf60919..cbadff8d 100644 --- a/docs/studio/behaviour/rail.md +++ b/docs/studio/behaviour/rail.md @@ -11,7 +11,7 @@ The rail, on the window's left, tells the selected session's story, ranked by wh - Running: "You asked" with your prompt, then the intention, boxed, with its age and the step line. The intention is the latest thing the agent wrote in its own words; it shows only while the session runs, and small, as "Why it asks", while it needs you. At your turn the Headline says what happened, and the turn-end intention is the final response's first line, never the summary's. While it runs, the box's last line, under the step and set apart by a hair line, is a **Wait tip** (#523, spec #520): "Tip: …", muted and small, one line ending in "…" when cut, its full text scrolling into view on hover. It teaches one feature, naming its palette action with the key your keymap binds it to now ("in the palette" when unbound). One tip shows per Running stretch and stays for it; it is gone at Needs you, Your turn and Idle. Among the tips whose context holds (the shown project has a map, a PR brief waits in the tray, the agent records each turn's files) that have shown fewer than 5 times and are out of cooldown, the one shown longest ago, or never, wins. The cooldown is `max(1, min(4, eligible − 1))` Running stretches, counted at the start of every stretch while tips are on, so a tip never shows twice in a row and a lone eligible tip shows every other stretch. The list is in `ui/tips.ts`; the show history (the stretch counter and each tip's count and last stretch) is in the page's `localStorage`, so clearing it starts tips again. `"tips": false` in `settings.json` turns them off ([Settings files](../settings.md)). - Needs you: the docked question, plan or permission, then "Why it asks" and "So far this turn", the facts the hooks recorded. -- Your turn, idle or ended: "You asked", the **Headline**, the evidence line, the Body lines, one line for each subagent and its checks, and "Full response", folded. A session returned to after a while opens on "Where we were" (see [The Brief and Where we were](brief.md)). +- Your turn, idle or ended: "You asked", the **Headline**, the evidence line, the Body lines, one line for each subagent (a chip whose status, running, done or failed, always shows at its natural width, while its purpose and kind line take the rest and end in "…") and its checks, and "Full response", folded. A session returned to after a while opens on "Where we were" (see [The Brief and Where we were](brief.md)). **Full response** (spec #661) is the turn's whole reply: the newest turn's texts from the transcript, an earlier turn's final reply fetched when its fold first opens. When the Headline is the reply's first line (no stored Headline), that line is left out, so the fold never opens on the sentence the Headline already shows; a stored Headline, a writer's or one read from an older summary, leaves the reply whole. The newest turn has no Full response when nothing is left, and an earlier turn's fold, whose reply is not on hand until it opens, says "The reply was only its Headline." diff --git a/scripts/snap/fixtures-map.ts b/scripts/snap/fixtures-map.ts index 017e9e99..0fabcb99 100644 --- a/scripts/snap/fixtures-map.ts +++ b/scripts/snap/fixtures-map.ts @@ -573,6 +573,8 @@ export const mapBroken = (open: "none" | "sheet" | "proof" | "log"): Fixture => if (!code || !code.textContent.includes("@law: wire-types-agree")) return log("snap:fail the proof drawer does not show the tag"); const jumps = [...document.querySelectorAll("#map-drawer .drawer-jump")].map((b) => b.textContent); if (jumps.length) log("snap:fail the proof has jumps out of the page: " + jumps); + const side = document.querySelector(".map-side"); + if (side.scrollWidth > side.clientWidth) log("snap:fail the side column scrolls sideways: " + side.scrollWidth + " > " + side.clientWidth); document.dispatchEvent(new KeyboardEvent("keydown", { code: "Escape", key: "Escape", bubbles: true })); await wait(100); if (document.querySelector("#map-drawer .drawer") || !document.querySelector("#map-sheet .sheet")) log("snap:fail the first Esc did not close the drawer alone"); @@ -600,7 +602,7 @@ export const mapBroken = (open: "none" | "sheet" | "proof" | "log"): Fixture => log("broken " + marked.join());`, { map_state: mapState({ ci: brokenCi }), map_place: busyPlace(), - map_proof: [{ file: "workbench/tests/wire.rs", line: 11, test: "wire_types_match", first: 11, snippet: "// @law: wire-types-agree\n#[test]\nfn wire_types_match() {\n studio_test_support::assert_wire_types_agree();\n}" }], + map_proof: [{ file: "workbench/tests/wire.rs", line: 11, test: "studio_workbench::wire::the_wire_types_the_server_sends_match_the_types_the_page_reads_for_every_command", first: 11, snippet: "// @law: wire-types-agree\n#[test]\nfn wire_types_match() {\n studio_test_support::assert_wire_types_agree();\n}" }], }); return { ...f, sessions, selected: { session: sessions[6], agent: null } }; }; diff --git a/scripts/snap/rail-fixtures.ts b/scripts/snap/rail-fixtures.ts index edc7e8e1..176e587b 100644 --- a/scripts/snap/rail-fixtures.ts +++ b/scripts/snap/rail-fixtures.ts @@ -224,6 +224,8 @@ const barScript = ` if (box.right > room + 0.5) log("snap:fail the bar cuts #" + item.id + " at " + innerWidth); if (item.scrollWidth > item.clientWidth + 1 && item.id !== "bar-project") log("snap:fail #" + item.id + " is clipped at " + innerWidth); } + const gear = document.getElementById("settings-button").getBoundingClientRect(); + if (gear.width < 24 || gear.height < 24) log("snap:fail the Settings button is " + gear.width + " x " + gear.height + ", under 24 x 24"); if (document.getElementById("bar-project").hidden) log("snap:fail the project's name is missing"); log("bar at " + innerWidth + ": " + [...top.children].filter((i) => !i.hidden && i.id).map((i) => i.id).join(" "));`; @@ -530,8 +532,29 @@ const tipScript = ` if (tip.getBoundingClientRect().height >= 2 * parseFloat(style.fontSize) + parseFloat(style.paddingTop)) log("snap:fail the tip takes more than one line"); log("tip: " + tip.textContent);`; +// #825: a subagent's chip keeps its status at its natural width, its purpose and kind line cut, and the chip stays inside its card. +const chipScript = ` + await new Promise((resolve) => requestAnimationFrame(() => requestAnimationFrame(resolve))); + const chips = [...document.querySelectorAll(".turn .subagents button")]; + const chip = chips.find((b) => b.dataset.key?.endsWith("-a1")); + if (!chip) return log("snap:fail no chip for the long-named running subagent among " + chips.length); + const status = chip.children[chip.children.length - 2]; + if (!status || status.textContent !== "running") log("snap:fail the chip's second-to-last child is " + JSON.stringify(status?.textContent)); + else if (status.getBoundingClientRect().width < 20 || status.scrollWidth > status.clientWidth + 1) log("snap:fail the status is squeezed to " + status.getBoundingClientRect().width + "px"); + if (chip.scrollWidth > chip.clientWidth + 1) log("snap:fail the chip overflows: " + chip.scrollWidth + " > " + chip.clientWidth); + const card = chip.closest(".turn"); + if (chip.getBoundingClientRect().right > card.getBoundingClientRect().right + 0.5) log("snap:fail the chip leaves its card"); + log("chip: " + [...chip.children].map((c) => Math.round(c.getBoundingClientRect().width)).join(" "));`; +const withLongChip = () => { + const fixture = build("running"); + const agent = fixture.selected.session.agents.find((a) => a.id === "a1")!; + agent.name = "Review the whole diff on this branch against every token rule in the stylesheet and the tests that cover them"; + return { ...fixture, snapScript: chipScript }; +}; + export const railFixtures = { readmeTurn, + railSubagentChip: withLongChip, readmeWhere, railPlain: () => build("your_turn"), railDiff: () => ({ ...build("your_turn"), snapScript: diffScript }), diff --git a/ui/index.html b/ui/index.html index 98b9ae16..329f11ed 100644 --- a/ui/index.html +++ b/ui/index.html @@ -25,7 +25,7 @@

plotkeeper

- +