Skip to content

Commit 2d719f7

Browse files
authored
💄 Draw the REPL as the things it is showing (#878)
* 💄 Read a REPL row's meaning out of the cells it was drawn in Much of this screen shared one foreground, one weight and one background, so a recorded output read exactly like a fact about the event beside it and a settled entry read like a failed one. The application knew the difference the whole time — it has the record's kind, the entry's terminal status and the route's selection while it builds the row — and threw that away before anything was drawn. `presentation-style.ts` is where meaning becomes a cell. It declares the closed set of roles a row can have, the accepted palette as plain 24-bit values, and a pure mapping from role, selection and historical reading to a foreground, a weight and a surface. It holds no operation, no host Api, no Journal access and no mutable state. `application.ts` assigns those roles where the typed facts are, and carries them on `Described`, on candidates and on boxes alongside the text and the control identity. Nothing infers a role from a finished string, a path suffix or how a key is spelled, so document output holding the word `failed` is still output. The manifest gains no focused node and no second focus store. Keyboard focus is not a fact about the reading, so it arrives later: after reconciliation `commitReplFrame` passes the actual focused mounted node id to `committedOps` for that frame alone, matched by exact mounted identity and discarded with the ops it decorated. Focus changes a foreground and its attributes and never geometry, and selection keeps an independent surface — so moving focus away from a selected row no longer erases that it is selected. One builder decorates both passes, so a measured region and the region drawn into it still cannot disagree. Strings, routes, controls, admission and outer geometry are unchanged; headings, pane edges, the draft label and the hidden location are not in this change. The fixture's persistent terminal grid now retains each cell's foreground, background and attributes while keeping its character and rectangle API, and publishes geometry for a drawn row that is not a control — so an assertion about a failure is an assertion about that row's cells rather than about a colour found somewhere in the stream. * 🐛 Draw a recorded document as its result, not as its outcome A root close draws two different things, and one role was chosen for both. When a root records a result, `describeRow` shows that result rather than the words `closed ok` — so the rendered document itself was arriving under the successful-outcome accent, and every line of an entry's output came out green. The captured pairs show it plainly: the durable `# Ledger review` was #5aa87c while the live overlay of the identical text was #e6ecf1, which is what output reads as. The role is now decided for each line as that line is built, from the record's own typed fields. A nonempty `terminal.output` is the document's result and takes the output role; a root that recorded nothing to show draws `closed <status>` and keeps the outcome accent there; a separately recorded failure reason stays a failure. Nothing reads the finished string, so a document whose own output holds the word `failed` is still output and a root that closed `err` is still a failure whatever it rendered. `transcriptLines` replaces `transcriptStyle` and the terminal branch of `describeRow`, which now takes only the records that draw one thing. Every string, key, row order, measurement constraint, route and control is unchanged — the same lines are produced in the same order under the same keys. The G1 regression that missed this covered only an eval block's explicit `output(…)` record. Two cases now cover the common path through actual journals: a settled document's nonempty recorded result, read with its entry selected and nothing live, so no bright overlay of the same text can stand in for it; and a root that recorded nothing, whose `closed err` and recorded reason both keep the failure accent. * 💄 Give the REPL its panes, and take the location off the screen Three columns shared one surface and ran into each other, the footer's last row was a bare prompt, and the longest thing on the screen was a URL nobody reads there. This gives each reading a pane it can be recognized by, and gives the `xmd://` location back to the one place it is useful. Each shared column now carries its own surface and a one-cell edge on the side it begins at, so two columns are parted by a single rule rather than by each one's own. Transcript and Bindings are named by measured rows inside the panes they name, present while the pane is empty, and described only where there is a pane to put them in — a narrow frame routes one outlet, and its two surface controls are its headings. The body closes along the bottom where those edges exist. An edge is part of the pane and not part of the room inside it, so each bordered pane holds a border-free content box, the manifest carries those ids beside the unchanged outer regions, and `widthsOf` reads the inside for row widths. Nothing subtracts a border count anywhere: the engine measures the space and admission spends it. That exposed a row that had never been bounded by its own region. `guidance` was fitted to the width of the terminal while being drawn into a column, and the engine clips no text — so a long sentence was drawn over the row beneath it. It is now fitted to the room it was measured to have. The draft says what it is. Its prompt is `> Draft: `, so the row reads `>> Draft: …` while it holds focus and ` > Draft: ` while it does not, with `fieldText` and the multiline count unchanged. The History band says which band it is on the first of its own five rows. The application's dedicated location display is gone, with the narrow omission summary and the formatting they owned. `ReplView.location`, the route encoding and `exitLocation` are untouched: the complete reopenable location is still printed on the way out, and ordinary source, provider text and origin metadata are not filtered. Three black-box suites observed the route by reading that display off the screen, so they now read what the screen still shows — a usable measured frame for readiness, a new catalog row beside an emptied draft for submission, the marked row for selection, filter and surface, a drawer's own controls for a drawer — and assert the canonical route where it is still published, on the location the command returns when it ends. * ✅ Assert the checkpoint and the conversation these two journeys came to Both scenarios used to read their canonical identity off the location the screen drew. When that display went, they kept the part of the claim the screen can still show and lost the part only the route carries: `[live]` says a recorded prefix is being read but not which one, and the presence of a `session=` term says a filter is set but not which conversation it names. J3 now keeps the location its command returns, decodes it, and asserts the exact checkpoint the last marker encoded — `yield:root:3` — with its read-only state, its surface and its locus. Every intermediate prefix-content check, the return live action and the provider count are unchanged. TL10 settles the conversation's full provider key before it clicks anything, from this run's own fixture and the row it is about to choose, so the expectation never comes from the value under test. A 32-column row shows as much of a key as it holds; the row names it and the fixture supplies the rest. The live process's returned location is then compared field by field — the full key, the draft byte for byte, the surface, the locus and the live head — and the cold process's own returned location is compared with the reading it was given. The visible filter, draft and children comparisons, the provider tripwires and the unchanged Journal all stay. Production is untouched: `packages/cli/src` is byte-identical to 407e2bb. * 💄 Say which reading a drawer is showing, and which rows act A drawer titled `plan` says nothing about whether it holds a binding or an answer, and one titled with a URL says only where a record came from. Each title now leads with the kind of reading it is — `Binding · plan`, `Recorded answer · <origin>`, `Permission · <tool>`, `Answer`, `History` — with the record's own name beside it, elided before the word it belongs to so that losing the end of a long name costs a reader less than losing what they are looking at. Long titles are fitted the way every other row of this screen is. Controls carry the surface the draft carries, wherever they are. A drawer's choices sit among the lines explaining what they decide, and a reader has to be able to tell those apart before reading either; the footer's controls gain the same treatment, because what acts should look the same everywhere. Only the mounted focused control still takes the focus foreground and its textual cue, and nothing gained a row, a margin or a border — the drawer holds exactly the rows it held. A Sessions turn now takes its role from how far the turn itself has got rather than from being a turn: queued and streaming read as waiting, a failure reads as a failure, and a finished turn reads as the result a reader came for. The provider's session key, the path and the stop reason stay the subordinate rows beneath it, and every label keeps its existing wording. Nothing here changes a title's ownership, a choice's name, order or authority, the modal rectangle, or which rows a drawer admits. * 📝 Describe the screen this REPL now draws The specification still described a location drawn in full wherever there was room for it, a guidance row as wide as the terminal beside that location, and a draft row with nothing to say it was one. It also named "the emphasis" among the things this command computes and never said what the emphasis tells a reader. The size table now names the panes — a Sessions/Entries sidebar, a Transcript pane and a Bindings pane, each with its own surface and the edge that starts it. The location section says what is true: no row carries it and none is kept for it, the command prints the whole thing when it ends, and source text, provider output and an event's own origin are content shown as written, URLs included. The band says which band it is; the draft says `Draft:`; and the guidance is as wide as the region it is drawn in rather than as wide as the terminal. A new section says what the emphasis says: rows drawn as the things they are, outcomes told apart from each other, a drawer naming which kind of reading it is showing, selection and keyboard focus independent and both visible at once, and a colourless reading that still loses nothing — every state the emphasis distinguishes is also said in words. `architecture.md` records the accepted boundary: roles assigned once from typed facts and never inferred from a finished string, a pure private module mapping them to colour, weight and surface, focus passed transiently to the ops builder after reconciliation and never stored, one builder decorating both passes, and a bordered pane's rows built to the engine-reported interior rather than its outer bound. * 🐛 Keep a row's name inside the pane it was measured for The complete gallery caught an Active transcript row wrapping over the row beneath it: `agent` alone on its own row, and the tail of the agent's path written across the cells of the row below. This engine clips nothing, so a row built wider than the interior it was measured for does not stop at the edge — it continues on the next line, over whatever was already there. The spec already says what should happen: a row is as wide as the region the frame measured for it, and so is its text, so a name nobody bounded is shortened with an ellipsis and what the row is about stays on it. Three rows were built without asking: an entry's path, a scope's name and an agent's identity. They now go through the same `fitLine` the rest of the screen uses, against the interior width the row was already given. An agent row keeps its status whatever the name costs. A row that said which agent and not how it ended would have kept the part nobody bounded and lost the part the row exists to carry. What a document or a provider said is still written whole. That text is the thing a reader came for, and a generated fragment's source is read the same way: the Agent journey reads the branch a program did *not* take off this screen, which only whole source can show. Bounding that is a decision about what the screen owes a reader, and it is reported rather than taken. The new case runs the real frame over a real Journal whose entry was submitted by its host path, and reads the cells: every such row holds what its own node contributed, is as wide as the interior and ends where the interior ends. Against the production this corrects, it fails with the row's own cells holding `entry` and nothing else. * 🐛 Say what this row must say in the room it was measured for Three medium captures read `entry <eval>e`. The guidance row's required parts came to seventy-one columns in a sixty-three column transcript pane, `fitted` checked the length of the optional parts and never of the required ones, and this engine clips nothing — so `draft to type` was written across the thirteen cells of the row beneath, and the entry row repainted all but the last of them. The row already has two vocabularies for the same facts. Which one it speaks was decided by the terminal profile, and the medium profile is wide enough for the long phrases while its transcript column is not. It is now decided by the room the row was actually measured for, so the medium frame says `Ready for Entry 3 · Enter activates · Tab to draft` where it used to say something it had nowhere to put. A narrow frame is unchanged: it is already compact, and a profile that has chosen the short phrases does not un-choose them because its one column happens to be wide. A wide frame is unchanged: the long phrases fit it. `fitted` also gains a floor, which the supported sizes never reach. Choosing the vocabulary by room is what keeps the required parts whole; the floor only refuses the one outcome that is worse than a shortened sentence, which is a row longer than its own width. The new case commits a real frame with a mounted control focused — the branch with the most to say, and the one the gallery caught — and reads the cells: the row fits the width it was measured for, still carries the state, what Enter does here and the way back to the draft, each whole and with no ellipsis, and every transcript row beneath it holds only what it contributed. Against the production this corrects it fails at 120 with seventy-one characters in sixty-three cells. * 🐛 Take a shifted Tab as going back, whichever way it is spelled This screen asks the terminal for progressive keyboard input, and under that protocol a terminal reports a physical key and its modifiers rather than a sequence naming the pair: Shift+Tab arrives as `Tab` carrying a shift, not as the legacy `ESC [ Z` the decoder reports as `Backtab`. The mapping here read the code and ignored the shift, so that spelling became a forward Tab and Shift+Tab moved focus the wrong way — which is worse than doing nothing, because a reader pressing it watches focus run away from them. The decoder was already right about both. Verified against the installed @bomb.sh/tty 0.9.0: `ESC [ Z` is `{code: "Backtab"}`, `ESC [ 9 ; 2 u` is `{code: "Tab", shift: true}`, and the keyrepeat form `ESC [ 9 ; 2 : 2 u` says the same with `keyrepeat`. Only the normalization disagreed, so only the normalization changes: a shifted Tab is Backtab at the boundary where spelling stops mattering, for a press and for a repeat alike. Control is not consulted, because a chord is dropped before this is asked. Control-Tab and Control-Shift-Tab stay chords nothing claims rather than becoming new ways to traverse, and a key release stays not a press. Three cases, all through the production decoder and screen. The first feeds every spelling as real bytes and pins the whole normalized sequence, so a Shift+Tab that normalized correctly and a chord that stopped being dropped would both show. The second dispatches the result into a real mounted tree, because a key that normalized to `Backtab` and then moved focus forward would satisfy a name check and still be the defect. The third holds the drawer's own containment, which belongs to the drawer and not to this key. Against the parent the first fails with both progressive forms reading `Tab`.
1 parent 6575508 commit 2d719f7

14 files changed

Lines changed: 3236 additions & 702 deletions

‎architecture.md‎

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5859,6 +5859,37 @@ resolved view on the way to a frame, they are in no location and no record, and
58595859
replay neither produces nor consumes them. A screen that explained itself
58605860
differently would still be the same execution.
58615861

5862+
**What a row means is decided once, where the facts are.** The application
5863+
assigns each row one immutable presentation role, and separately whether it is
5864+
selected and whether it is being read as history, from the typed reading that
5865+
produced it — a record's kind, an entry's terminal status, the resolved route.
5866+
Nothing infers a role from a finished string, a path suffix or how a key is
5867+
spelled, so arbitrary document and provider text is drawn as ordinary prose
5868+
whatever words it happens to contain. Candidates and boxes carry those facts
5869+
beside the text and the control identity; they carry no mounted node, no Journal
5870+
record and no focus authority, and the manifest holds no focused node.
5871+
5872+
A private module maps a role and those two flags to a colour, a weight and a
5873+
surface. It is pure: no operation, no contextual Api, no Journal access, no
5874+
mutable state and no export beyond this feature, so a role owns nothing that can
5875+
outlive the frame that computed it. The palette lives there and nowhere else.
5876+
5877+
**Keyboard focus is not a fact about the reading**, so it arrives later. After
5878+
reconciliation the commit boundary passes the actual focused mounted node's id to
5879+
the ops builder for that frame alone, matched by exact mounted identity and
5880+
discarded with the ops it decorated. Focus changes a foreground and its attributes
5881+
and never geometry; selection keeps an independent surface. Neither repairs,
5882+
stores or grants focus.
5883+
5884+
**One builder decorates both passes.** The measurement pass and the committed
5885+
pass run through the same op builder, so pane edges, surfaces and headings
5886+
participate in measurement and a measured region cannot disagree with the region
5887+
drawn into it. A pane's own edges are not part of the room inside it: a bordered
5888+
pane carries a border-free content box, and rows are built to the width the engine
5889+
reports for that box rather than to the pane's outer bound. The renderer stays
5890+
model-blind — it receives ops and geometry, classifies no row text, and no
5891+
production string carries an escape sequence.
5892+
58625893
Placement owns where things are, and the footer's seven rows are fixed in one
58635894
order: the contextual status and action row, the five History rows, and the draft.
58645895
Each is stated as geometry rather than inferred from a list's length, because the

0 commit comments

Comments
 (0)