Repository navigation
Default Codex to full Leaf and prove direct MCP resource delivery - #208
Conversation
leaf-agent
left a comment
There was a problem hiding this comment.
The default inversion reads cleanly and the probe keeps Python as the only state authority — direct.py routes reads through PageStateService and writes through EventEndpoint.accept, so the direct resource adds a transport rather than a second projection. One thing the PR misses.
docs/how-it-works.html still carries the old ordering. Its <p id="wait-trick"> paragraph says "On Codex, an experimental bundled MCP App can put a compact review directly in the task ... Where a Codex build does not render MCP Apps — or the reader needs the full widget runtime — the loopback browser stays the surface". That is exactly the preference this PR inverts in README.md, skills/leaf/SKILL.md, and references/host-codex.md, and the page is published: docs/index.html links it from the nav and the body, so leaf.page/how-it-works.html will tell readers the browser is the fallback while the shipped host contract tells the agent it is the default.
The same paragraph also says the app "sends the complete pending batch as a follow-up turn", which host-codex.md now contradicts twice over — "the detached adapter below carries input back to this same task" and "A successful ui/message response is not a delivery receipt". Both sentences want the same rewrite.
Root CLAUDE.md asks for public docs affected by a feature to move with it, so I'd fold this into the PR rather than leave it for a follow-up. Happy to push that paragraph rewrite as a commit if you want it — say the word and I'll match the surrounding voice.
…diff: ten pieces from a UI and UX review (#209) A UI and UX review of the layer, run as a Leaf page, and the ten pieces picked from it as "Now", each built with a test. The review page is the record of what was found and why each piece was picked; this description is the map to the diff. ## What changed **The banner folds instead of clipping.** Its addresses fold into one overflow menu in a stated order when the row runs out of width, and the status line is the one thing that gives up width; the newest-version chip is marked urgent so the menu's door says when it holds news (`runtime/banner-shelf.js`, `runtime/chrome-style.js`). The versions menu hangs from the button that opens it, and its two ways out say their direction (`runtime/version.js`). **Every control has a box a reader can hit.** One theme rule gives every pressable in the layer a floor of 24px on a fine pointer and 44px on a coarse one, and one marker, the `data-lf-offer` value, says what a reader can press, so the cursor and the outline come from the theme rather than from each widget (`chrome-style.js`, `packages/default/theme.css`). A receipt is a flat Button, not a press (`runtime/living-margin.js`). **The margin rail is reserved before the first gesture**, so the page no longer narrows when the reader's first mark lands (`runtime/margin-layout.js`). The inline thread card has a floor, and it follows its marker when the page reflows under it (`living-margin.js`). **A reader who lands is handed their place and their way in.** The skip link rests transparent and stands where an ask arrival lands, an ask arrival stands on the decision rather than below the fold, an empty Asks tray says what it is empty of, and the resting key line shows only presses that say something back, with the priority no row declared cut from the register (`runtime/keyboard/`, `runtime/decisions/`, `runtime/trays.js`). **Diff basics.** A file header that pins under the banner while its rows scroll, `]` `[` `}` `{` hunk and file keys — from the diff itself, with nothing focused inside it, `]` lands on the first hunk and `[` on the last — and a Soft wrap switch that paper always takes (`packages/diff/widgets/lf-diff.js`, `packages/diff/theme.css`). A page with only a manifest loads the renderer when it first draws lines. **A page loads only the widget modules it uses**, and a version or a reply that carries a new tag imports its module before insertion (`runtime/widget-loader.js`, `runtime/version.js`, `runtime/state-application.js`). **The agent's path answers in sentences** where leaf was silent, `leaf edit` included, with `--json` for the tests that parse it (`scripts/leaf/cli.py`). **Polish sweep**: a reacted passage has a visible mark, every elevation shadow is cast in the scheme's own ink, every word on a surface names one thing, a sheet prints what it can show and nothing it can press, a reader can take an approval back, the diff tools row is declared as a control archetype, and the small-screen map reads its seat from the row's one order. ## Reading the diff The branch merges main seven times; #205 (banner notices, persisted keys) was dispatched from this review and is already on main. The #207 merge takes its single `runtime/version.js` and `diff` package: this branch's hunks in the four modules it folded and the theme block it moved are ported there, and `readingBlock` replaces the `blocksOnScreen` export as the one reading the decision walk and the keyboard reference start from. The fifth takes 17ed171, which moves each file's "Mark reviewed" press out of its `<summary>` into a `.lf-diff-file` row beside it. Two of this branch's rules met that row and are fixed in the merge commit: the pinned summary's z-index covered the press on every file, so the press now shares that level and paints above as the later sibling; and the soft-wrap switch reached its rows through `~ details`, which the wrapper broke, so it names the file rows. A review of that merge found the third meeting: once a long file's header pinned, the press stayed absolute at the file's top and drifted off it, its reserved column empty and out of pointer reach for the rest of the file. The press is now a block in the flow ahead of the disclosure, which is pulled back up over it by a negative top margin, and sticks with the summary where it pins; the pull is the disclosure's rather than the press's because a sticky box is held inside its containing block by its margin box, and a negative margin on the press let it outlive its file by 32px at every boundary. The pinned-header test reads the press on the pinned line, reaches it with a pointer, and reads it leaving with its file. The seventh takes #212 (Button states, receipts, overflow), which answers the same question this branch's "Sew a receipt Button flat" answered: what the Button beside a move already made should promise. #212 keeps it a pressable disclosure wearing its phase as a corner mark and states that a settled outcome is receipt text beside Undo, never an inert Button-shaped status; this branch had made it a flat `status` with no press. The merge takes main's model and drops the flat receipt, its theme rule, and its test; the accessible-name test beside it stays. The choice is flagged in the review page, where the pick that led to the flat receipt stands. The sixth merge takes #211, which lands `a` on the region that explains an ask, and 9a59df7's growing comment field. This branch focuses the decision itself on arrival, its controls the next Tab stops, so the walk keeps `arriveAt` in front of main's region travel, and #211's three arrival tests expect the suggestion focused rather than its Accept, as this branch's own arrival tests do. The tend review on 1708469 read the whole diff and asked for three things, all in ec55abb: `[` with nothing focused inside the diff answered no hunk anywhere and walked the whole file list opening and fetching each one — `beyond` now answers true in both directions, so the backward walk opens the last file and lands on its last hunk, with a test on a collapsed manifest that counts fetches and open files and fails on the old answer; a comment in twice in `served_state/conversation.py`; and `taken_back(events)` rebuilt per event inside the `done` comprehension, now hoisted as every other reader does. <details><summary>Verification</summary> On the branch head before the #207 merge (2fe649e): ten render suites 590 passed with one failure, main's own WCAG nested-interactive red on the pr-walkthrough diff review button (since fixed on main by 17ed171); everyday suite 793 passed; `pre-commit` clean. After merging #207 and #208 (fbc02fe), on a machine at load average 200 shared with another session's suite: everyday suite 797 passed, 1 failed — a test this branch added whose page carries an `lf-diagram` that #207 moved into the `diagram` package, fixed in 03cd748 by selecting the package. CI's lint caught an unread console capture in one new test, fixed in the same commit. An independent review of the merge resolution found every branch hunk ported and no defects; its one design note, the widget import spent inside the activation transition, is 3dea60b. A fourth commit dropped two `.lf-margin-action` minimums as dead under the aim floor and 1b66f16 restores them: the floor's rule sits inside the `@scope (.lf-chrome)` block and margin items are hoisted into `main`, outside it, which a margin shape test pins. The thread-card fix carries a test that fails with its listener removed. The b89560d merge ("Asks (3/7)" while standing in an ask) keeps this branch's landing on the decision in the one test both sides touched and takes main's count; the 17 ask and decision tests pass. After the 17ed171 merge and the review fixes, the 19 diff, hunk and control-sweep tests across four render modules pass, the Python sign-off tests pass, and the everyday suite passed on ec55abb (798). After the #211 merge the 27 ask, decision, arrival and response-field tests pass and the everyday suite passed again on the merge (a56cdeb, 798) and on the pinned press (4bf1bb7, 798); CI's lint wrapped one assertion in that test, 7dd0d41. CI on this PR is the clean-machine gate. </details> > _This was written by Claude Code on behalf of max-sixty_ 🤖 Generated with [Claude Code](https://claude.com/claude-code) --------- Co-authored-by: Claude Fable 5.1 <[email protected]>
Codex's tested inline sandbox blocks our nested HTTP Leaf frame, leaving only the comments-only snapshot. Make the canonical browser page the default Codex handoff, with the existing detached adapter carrying feedback into the same task. This preserves the normal theme, package controls, anchored comments, and version travel without claiming that a successful MCP tool call proves what rendered.
The other half is a developer-only experiment: bundle the real vendored Leaf runtime directly into a
ui://resource and carry state reads and events through MCP tools to the existing Python owners. It does not replace the installed MCP server or add another state authority.scripts/mcp-app/README.mdexplains the pinned reference-host runner; the numbered research records retain successful and failed attempts, screenshots, and source hashes.Verification covers the browser-pane reply/revision/reload/version loop, reference-host direct rendering, a durable keyboard choice and anchored comment, visible comment UI, accepted
ui/message, no nested Leaf frame or external resource requests, and HTTP host/origin rejection. The everyday suite passes 791 tests, the focused MCP browser suite passes 8, and the complete site suite passes 20. The public home and how-it-works pages describe the same browser default and detached delivery loop as the agent guidance.Actual Codex inline rendering and idle wake remain untested. The direct probe is fixed-page only: version/data transport, dynamic assets, and compact-layout parity remain open before a production cutover.