Skip to content

Share a widget's value as a property and change, ask it by invoker command, and drop role-typed references - #5981

Merged
max-sixty merged 26 commits into
mainfrom
fable-composition
Nov 23, 2026
Merged

max-sixty merged 26 commits into
mainfrom
fable-composition

Conversation

@max-sixty

@max-sixty max-sixty commented Nov 14, 2026 •

Copy link
Copy Markdown
Owner

Widgets from separate packages can now work together with nothing but the platform: a widget holds a value as a property of its element and dispatches change, another reads it through an input bound by contract (inputs, for="id"), and asks it to act with an HTML invoker command, from a button (commandfor, command="--name") or from code. A recorded answer stays with its owner, which turns a command into its own verb, so the log holds one action whichever widget the user pressed. skills/leaf/references/package-data.md, "Widgets working together", is the contract; browser/runtime/data.js (heldOutput) is the reader.

Removes. publishOutput, the lf-output event, widget-output.js and outputs in the application state; an input's output field; a reference's via, where and owns, the $diff table and six findings; in examples/wt-merge, film-frame, announce() and seekChapter(). No registry key or export is added. With keyed references already gone from main, refers maps an attribute to {} and nothing else.

Adds. Composition holds each $work.widgets entry to its tag's declaration (a misspelt on used to pass and silently drop a worker's goal). page check refuses an authored commandfor that names no element or a command the browser won't deliver. A message may no longer reference an id in another thread's message, which resolved to nothing. leaf page instructions --use returns a contract's instructions for a widget that holds its value, as it did for one that reads it. The reference says how to check a pair of packages, on a page that selects both.

Costs. A consumer draws just after the producer's change, where a hand-wired listener drew inside it. That ended the merge film's glide at phone width, so the film now starts it on the next frame, with a test; Leaf's glide still ends when layout moves the page during it, as on main. A consumer's redraw costs 0.75–0.90 ms against 0.11 ms hand-wired (21 November), most of it the key-hint repaint any LeafElement draw requests. A widget holds a new value to change one: the object it already held reads as unchanged, which keeps a large value free while another output moves. lf-call-diff no longer checks that its diff names an lf-diff, and owns is not rebuilt: a reference names any element, and a reader's contract-bound input types what it reads. The render check misses a producer inside a closed shadow stage. A page's own module that calls publishOutput breaks; page check --render reports it.

Current with main as of 23 November. The rule is carried onto main's renamed declarations (inputs, outputs, refers, attributes) and onto its removal of unique, shows and awaits.key, which met this branch's removal of typed references in the same checks. packages/file-editor, written on main with publishOutput, holds its files and says change, as lf-diff does.

Users see no difference on bundled pages.

Decided by Max. A value travels as a held property and change, and a reference names any element, with a reader's input typing what it reads (both picked on 23 November); page check holds an authored command only to what HTML rules out (14 November). He asked for this to land on 23 November without having read the diff in full; a review of the design for simplicity follows the merge. His two follow-up picks, a contract listing its commands and a refusal when two packages' copies of a contract differ, are separate pull requests.

Tests. tests/browser/test_widget_composition.py runs two packages written apart across Undo, a revision, an exported file and a page without Leaf. Six more packages, written in pairs by fresh agents from the shipped references and each other's registries, were run on a live page by hand; they are not in the tree. pnpm run check, the runtime tests and the focused model and browser tests pass.

This was written by Claude Code on behalf of max-sixty

@leaf-agent leaf-agent left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Every producer arrival makes every reader resolve its id again. standing is one signal for the whole page, and watchProducers ticks it whenever any element of any x-output tag arrives or leaves. Each heldOutput computed reads standing.value, so each tick makes every bound reader call referencedProjection again, even though only readers of that one id can be affected. Loading a page with P producers and R readers does P × R resolutions, and a revision that replaces producers does the same. That is the square growth root AGENTS.md Responsiveness rules out for loading ("a step that walks one of those collections for each member of another"). share stops the redraws, but every reader still resolves its id again. The bundled pages have only a handful of producers, so the bench probably won't catch this yet. A page of many diffs, each with a file tree reading it, would.

Keying the signal by id would make the cost depend on what changed. A Map<id, signal> ticked with the element's id on arrive/leave would do it, and heldOutput would read only the signal for its bound widget. A keyed reference resolves by member key, not by id. It could fall back to the page-wide signal, or key on its key attribute's value.

Comment thread browser/runtime/data.js Resolved
Each bound reader read one page-wide signal, so every arriving producer made every
reader resolve its name again: producers times readers on load and on a revision.
The signal is now kept per name (an id, or a keyed member's unique attribute), and an
arrival or departure moves only the names the element answers to.
A reader copied and compared every output it reads on each change its producer said,
so a large value held beside one that changes often cost each reader its whole size
per change: 5.8 ms a drag step with 10,000 events beside a selection. A producer holds
a new value to change one, as the shipped text already asked, so the object it held
at the last reading is now taken as unchanged without reading into it (0.05 ms).
A value that cannot be copied names its producer and contract.
A reference typed by a package's role table went earlier on this branch; a plain
reference then accepted any element, so lf-call-diff's diff could name a heading and
its links went nowhere. A reference now says what kind of target it needs in the
vocabulary a reader's input already uses: {contract} names any widget holding a value
of that contract, whatever its tag or package. lf-call-diff declares file-list.

@leaf-agent leaf-agent left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The {contract} reference checks something lf-call-diff doesn't use. lf-call-diff never reads its target's file-list value. It sends navigateToDatum(owner, "diff", diffLocationKey(path, side, line)), so what it needs from the target is a datum element for each patch line, keyed the way lf-diff keys them. Holding a file-list output promises neither. The test already shows the gap: lf-tree, which holds file-list and has no patch lines, passes the check. Once a second widget holds a file list (a file browser, say), a call diff pointing at it would pass page check, and every one of its links would fall through to "not present in the exact patch". The reference_errors docstring says the referrer "may rely on the target being that kind of thing", but a value contract doesn't say that.

This adds a schema field, a registry-door check, two findings and a reference section, and its only consumer is this one reference, which it doesn't protect. Going back to "diff": {} keeps everything this change has to keep, costs less, and matches the PR description's Costs paragraph (still unchanged, along with "whether references stay typed by role" under Left for Max). If the target's kind should be checked, what's missing is a declaration of the datum keys a widget answers, which this mechanism doesn't express.

Comment thread packages/diff/registry.json Resolved
The shipped text says how a module sends a request no button makes, with its element
as the command's source, and how the target refuses one so the asker hears it. A
browser test holds the two-package pair reading the recorded pick in an exported file.
@max-sixty max-sixty changed the title Share a widget's value as a property and change, ask it by invoker command, and drop role-typed references Share a widget's value as a property and change, ask it by invoker command, and type references by contract Nov 15, 2026
lf-call-diff never reads its target's file-list: it sends the user to patch lines by
keys only lf-diff answers, so a file tree holding a file-list passed the check and
every link would have failed. Every reference that crossed packages in the trials read
a value, which the reader's contract-bound input already types; the field had no other
consumer. A reference names any element again.
@max-sixty max-sixty changed the title Share a widget's value as a property and change, ask it by invoker command, and type references by contract Share a widget's value as a property and change, ask it by invoker command, and drop role-typed references Nov 15, 2026
…uctions

`leaf page instructions --use <tag>` added a contract's instructions only for
a tag that reads it (x-data), so an agent writing the widget that holds the
value never got what the contract asks of it. It now selects from x-output too.
The fixture pair's audience is `producer`, the name the diff, playwright and
visual-review contracts already use for whoever supplies a value.
leaf-agent pushed a commit that referenced this pull request Nov 17, 2026
…up ask with no attribute (#6234)

A registry entry now holds its attributes' JSON Schema under
`attributes`, which every declaration must have, and groups its other
facts by what they cover: `state`, `markup`, `words`, `paint`, `data`
and `author`. Each fact is declared because some part of Leaf needs it
without running the widget's module. The `x-` prefix is gone, a fact's
name is its path (`state.verbs`), and `$keys` documents each fact and
each group by that path. The page also takes HTML's attribute names, as
#5968 had them: `needed` on `lf-draft` becomes `required` and `chosen`
on `lf-option` becomes `selected`. And an option group now asks with no
attribute at all: an `lf-options` stands on On Me unless it is `settled`
or quoted in a sample, which Max chose over #5968's `required`. Max
chose to do all of it as one sweep, so the interface changes once. This
supersedes #5968.

## One entry, before and after

`lf-options` on `main`:

```json
"lf-options": {
  "description": "Alternatives the user can choose individually or as a set to answer a question.",
  "x-instructions": "…",
  "type": "object",
  "properties": { "id": …, "choose": { "type": "boolean" }, "multiple": …, "closed": …, "across": …, "settled": …, "restated": … },
  "dependentRequired": { "settled": ["id"], "multiple": ["choose"] },
  "additionalProperties": false,
  "x-content": "members",
  "x-awaits": { "value": "choose", "when": { "choose": [true], "settled": [false] }, "retired": "settled", "key": "value", "answered": { … } },
  "x-state": { "choose": { "unit": "widget", "record": { "kind": "attribute", "attr": "chosen" } }, "add": { … }, "answer": { … } },
  "x-example": "…"
}
```

On this branch:

```json
"lf-options": {
  "description": "Alternatives the user can choose individually or as a set to answer a question.",
  "attributes": {
    "type": "object",
    "properties": { "id": …, "multiple": …, "closed": …, "across": …, "settled": …, "restated": … },
    "required": ["id"],
    "additionalProperties": false
  },
  "content": "members",
  "state": {
    "awaits": { "value": "choose", "when": { "settled": [false] }, "retired": "settled", "key": "value", "answered": { … } },
    "verbs": { "choose": { "unit": "widget", "record": { "kind": "attribute", "attr": "selected" } }, "add": { … }, "answer": { … } }
  },
  "author": { "instructions": "…", "example": "…" }
}
```

The verb is still `choose`.

## The groups as built

| Key | What it covers | Declared because, without running the module |
| --- | --- | --- |
| `description` | what the element is for | every reader shows it |
| `attributes` | the attributes' JSON Schema | `page check` and message
markup hold each occurrence to it |
| `content` | `markup`, `members`, `data` or `empty` | the server, `page
check`, the passage reader and first paint all read it |
| `state` | `verbs`, `awaits`, `retired-when`, `encloses`, `exhibit`,
`shows`, `work`, `history`: the widget's verbs, what it asks the user
and how their answers retire | the server admits actions and keeps the
On lists and can't run the module; the browser reads them too |
| `markup` | `owners`, `unique`, `refers`, `reading-role`: where the
element stands and what it names | `page check` and message markup
refuse markup; the server and browser read them too |
| `words` | `says`, `verbatim`, `shadow`, `inline`, `visual`,
`text-format`, `word`: how its words read | the server's passage reader,
the render check, and the browser reading an element no module drew |
| `paint` | `views`, `space`, `height`, `bound`, `spine`, `flow`,
`prepaint`: how its box is laid out before the module draws | the first
paint comes before any module runs; delivery paints most as marks |
| `data` | `inputs`, `outputs`: the typed values it reads and publishes
| the server checks bindings and the browser delivers values |
| `author` | `example`, `instructions` | the agent reads them after
choosing the element |

The group first built as `server`, after one of its readers, is named by
what it covers, and its fact `state` became `verbs`, so no path reads
`state.state`; it sits beside the layer's `$state`, which documents each
verb's fields. `paint.flow` takes `main`'s new conditional form (#6237):
`lf-tabs` declares `{"when": {"flow": ["page"]}}`.

`$keys` is keyed by path (`"state.verbs"`), with an entry of its own for
each group, so its lint is the same set comparison `main` has. `$marks`
names each mark by its fact's path (`paint.space`). Python reads a fact
with `registry.contract.declared_fact(entry, "state.verbs")`, the
browser with `entry.state?.verbs`, and `declarationFor(el)` returns the
whole entry. Two facts read through others are checked explicitly. On
`main` a missing one read "registry extensions are invalid: 'x-owners'
is a dependency of 'x-retired-when'"; it now reads "state.retired-when
needs markup.owners", and a view without its reference "state.shows
needs markup.refers".

## An option group asks with no attribute

The trap #5968's reviewer found is gone: in HTML a group without
`required` can still be picked, while in Leaf it drew cards nobody could
press, and `page check` passed the page. Now `state.awaits.when` for
`lf-options` is `{"settled": [false]}`, `lf-options.js` wires the pick
unless the group is quoted, and `required` on a group is refused as
undeclared. Every group needs an `id`, which the schema now requires in
place of the `dependentRequired` that asked for one on a settled group,
and `multiple` depends on nothing. `required` on `lf-draft` and
`selected` on `lf-option` keep their meaning. This ports
`fable-options-ask-by-default-trial` (da66b7d) onto the grouped
shape; about 580 tags lose the attribute across registries, examples,
docs, notes, evals, instructions, dev tools and tests.

`options.css` drops `[required]` from each selector and gives the
exhibit guard an attribute's specificity, so every rule keeps its
weight. On feature-gallery, alert-review and ship-review, every computed
property of every group and every element inside it (cells, marks,
badges, the add field, their `::before` and `::after`) is the same
before and after: 257, 241 and 43 elements, read with `leaf-dev probe
--authored --base`. The `lf-options` instructions and
`authoring-on-me.md` now say a group asks with no attribute and that
`settled` records the decision and stops it asking.

## Single-declarer keys

| Key | Declared by | Verdict |
| --- | --- | --- |
| `state.encloses` | `lf-ask` | kept: a form or survey widget from
another package can frame questions, and without it core would name
`lf-ask` |
| `state.exhibit` | `lf-sample`, and the feature gallery's page widget |
kept: already has a second declarer |
| `state.shows` | `lf-card` | kept: a timeline or roadmap card could
show an answer the same way |
| `state.work` | `lf-card` | kept: any task-list widget could take the
agent's to-dos |
| `state.history` | `lf-activity` | kept: the server needs it to serve
the history reading only to pages that show it |
| `markup.reading-role` | `lf-pane` | kept: its own contract says
packages contribute panes under their own tags |
| `words.text-format` | `lf-draft` | kept: any widget whose body is
Markdown words needs the server to read it rendered |
| `paint.prepaint` | `lf-text-document` | kept, moved to `paint`: a file
viewer from another package could draw Markdown at first paint |
| `paint.spine` | `lf-toc` | kept: removing it takes away the automatic
narrow sidebar |
| `data.outputs` | `lf-diff`, and three example pages' widgets | kept:
#5981, which replaces it with a property and a `change` event, hasn't
landed |

`paint.flow`, single-declarer when this started, now has `lf-ask`,
`lf-tab` and conditional `lf-tabs`.

## Calls to reverse

- No single-declarer key is removed (table above).
- `elementsDeclaring` is gone from the public API: nothing called it,
and it was `declaredElements` without its root.
- Finding codes: `invalid-declaration` replaces `invalid-extensions` and
`no-description`, which the declaration schema now covers, and
`attributes-schema` replaces `declaration-schema`.
- `attributes` is required, so a declaration without it fails `page
check`.
- Prose that called a verb "a server.state verb" now says "a verb
(state.verbs)", and finding texts name "verb `move` (state.verbs)".
- No page protocol bump: the layer's entries come from the Leaf that
serves the page, and a page's own `page/registry.json` in the old shape
fails `page check` with `invalid-declaration`, which the agent fixes
like any check failure.

## Checks

- `pnpm run check`: pass (998 runtime tests, worker 91, types, build
check).
- `uv run pytest tests/model`: 3,601 passed after each commit and merge.
- Browser, by file or node id: after ask-by-default, the option,
obligation and On panel tests (159 passed); after `main`'s #6237 merged
in, both tab-set files and the three probe tests #6242 touched (48
passed); after the rename, the option, obligation, On panel, board,
playground and command-route files and every browser test whose fixture
the rename changed (247 passed), and the journey tests it changed, by
node id (16 passed). Earlier in the sweep, about 1,300 more across the
files the shape change touched.
- `page check` on all 47 authored sources, built as pages, and `leaf
package check --render` on the 13 bundled packages with a registry: all
pass. No `server.` fact path is left in the tree.
- Evals for ask-by-default, Claude Code, the branch beside the commit
before it, two runs per arm: `thread-choice-takes-a-press`,
`proposals-get-individual-decisions` and
`decision-record-after-its-work` pass 6 of 6 on each arm, $2.67 for the
authors plus grading. No head output writes `required` on a group;
base's proposals pages wrote it on all six groups. In
`thread-choice-takes-a-press`, base's replies wrote `<lf-options
id="yoy-baseline">` without `required` in both runs, which on base draws
cards nobody can press (the rubric is head's, so it passed them). Only
the proposals runs opened the changed instructions (`leaf page
instructions`, `authoring-on-me.md`, `threads.md`), on both arms; the
decision-record runs settled every answered group, and the thread runs
used no tools.
- Evals for the shape, earlier: `package-text-widget-keeps-the-measure`,
`recorded-effect-payloads` and `widget-checked-before-handoff` pass 12
of 12 across both arms, $3.14.

Not run: the rest of the journeys tier and `tests/browser`, Codex evals,
`leaf-dev bench`, Firefox.
max-sixty added a commit that referenced this pull request Nov 18, 2026
A package that splits a sheet with `@import "./styles/tabs.css"`, as
`packages.md` documents, broke any page that selected it by path: `page
init --package ./pkg` passed, and every later read of the page refused
with "cannot compose the page's layer … imports './styles/x.css', which
is no file". `package check --render`, which starts such a page, refused
the same way while plain `package check` passed. The page's copy took
the package's top files and directories and left a sheet imported from
anywhere else behind.

The install copy already followed imports, in a second listing of what a
layer input reads. `layer.package_files` is now the one listing,
imported sheets included, and both the page's copy and the install copy
write it. The install copy no longer preserves file times or modes
outside `scripts/`.

Found by a package author working from the shipped references in #5981's
trials. One model test composes the source, an installed copy and a
page's copy and holds them equal; it fails without the imported sheets.

> _This was written by Claude Code on behalf of max-sixty_
max-sixty pushed a commit that referenced this pull request Nov 18, 2026
…share one accept-all helper, and drop an old-record test (#6362)

Five findings from the nightly sweep, each a test that could not fail or
that repeated another.

`test_a_card_repaint_keeps_the_user_on_the_control_they_reached`
(tests/browser/threads/test_resolving.py) dispatched `lf-actions`, an
event nothing in browser/, packages/ or src/ listens for, so no repaint
happened and its focus check proved nothing. It now has the agent's
reply land in the open margin card's thread, waits until the card shows
the reply, and then asserts focus is still on Resolve and Enter resolves
the thread. It protects this: a repaint of an open card leaves the user
on the control they reached. As a control, making the card's render
rebuild its settlement button (`render(nothing, ...)` before the
settlement render in thread-card.js) fails it on `to_be_focused`.

`test_revendoring_serializes_with_a_worker_report_entering_the_log`
(tests/model/interact_contract/test_revendoring.py) checked for `verbs`
under a `state` key that no registry entry has any more, so it always
passed. It now checks the entry itself. It protects this: the overlay
that drops `lf-test-task`'s verbs takes effect once the revendor waits
out the report. Keeping `verbs` in the overlay now fails it. PR #5981
edits other lines of this test.

tests/journeys/test_render_widgets.py had its own copy of
`expect_accept_all`. It now uses the shared helper in
tests/browser/widgets/__init__.py, so it checks the same Accept all row,
now by count. The commit also removes a duplicate `import pytest`
partway through the file, and a `shifts_unsurveyed` marker the module's
`pytestmark` already applies.

The
`test_the_render_gate_reads_widgets_in_the_page_and_in_replies_alike`
docstring named `RELATIVE_REPLAYS`, which exists nowhere. It now names
the `relativeReplays` probe (src/leaf/render-checks/replay.js).

The commit deletes
`test_an_action_an_earlier_runtime_logged_is_left_out_of_the_fold`
(tests/model/interact_contract/test_vocabulary.py). It protected only
records in an earlier runtime's payload shape, which root AGENTS.md
"Stage" rules out. The current rule it also exercised, that a logged
action whose state operation no longer matches its verb folds as absent
and `leaf page state` still reads, is held by the `slot` case of
`test_revised_state_definitions_keep_original_history_and_admit_new_typed_state`.

Ran by node id: the resolving test (passes, and fails with the control
applied), the revendoring test (passes, and fails with `verbs` kept),
`test_a_decision_travels_between_tabs_and_the_log_has_the_last_word`,
the five
`test_revised_state_definitions_keep_original_history_and_admit_new_typed_state`
cases, and collection of
`test_focus_reactions_keep_a_projected_data_target` under `-m
shifts_unsurveyed`.

Co-authored-by: leaf-agent <[email protected]>
leaf-agent added a commit that referenced this pull request Nov 18, 2026
…re-exports of them (#6366)

`browser/runtime/shadow.js` re-exported sixteen helpers that
`browser/runtime/shadow-tree.js` owns (`under`, `upFrom`,
`renderedUnder`, `renderedOrder`, `renderedOrdering`, `byRenderedOrder`,
`hostIn`, `composedParentNode`, `renderedParent`, `shadowHost`,
`excludedByInert`, `overIn`, `SAID`, `UI_MARKS`, `uiInside`, `inUi`).
This PR deletes those re-exports and points every import of them in
`browser/` and `tests/runtime/` at `shadow-tree.js`, including
`widget-api.js`'s public `under`. Now `shadow.js` keeps only its own
exports.

Why: `browser/AGENTS.md` ("One answer for each question") names
`shadow-tree.js` as the owner of these helpers, but callers were split
between the two import paths (for example, 23 imported `under` through
`shadow.js` and 7 imported it directly). Importing through `shadow.js`
also pulled `registry.js` and `arrivals.js` into modules that need
neither. No package imports `shadow.js`.

Verification: `pnpm run check` passes; it includes `test:runtime`,
1050/1050 on the head merged with current `main`. Pre-commit passes on
the changed files, including eslint, prettier, dependency-cruiser and
knip (unused exports and import cycles). A grep finds no import from
`shadow.js` that names a shadow-tree helper. Behavior is unchanged, so
no new test.

Open PRs #6008, #5981 and #5979 touch some of these files; each overlap
is a one-line import change.

---------

Co-authored-by: leaf-agent <[email protected]>
Co-authored-by: leaf-agent <[email protected]>
Main renamed every registry key (`x-data` to `inputs`, `x-output` to
`outputs`, `x-refers` to `refers`, a tag's attributes under `attributes`),
moved Lit's names to /vendor/lit.js, declared per finding whether it refuses,
and yielded message checks stage by stage. The composition rule is carried
onto that format:

- `refers` maps an attribute to `{}` and nothing else. Main had already
  dropped the keyed `{tag, key}` relation, so with `via`, `where` and `owns`
  gone the reference schema is the empty object, and the reader's keyed
  standing signal in data.js goes with it.
- An input reads the one output of its contract (`reference`, no `output`),
  and an output is a property of its element named by `outputs`.
- packages/file-editor, new on main, called `publishOutput`; it now holds its
  `files` and says `change`, as lf-diff does.
- `shows-reference` holds only that the attribute is one `refers` declares,
  since a reference has one shape.
- The work-role check reads `attributes` and `verbs`; its finding words name
  them. The command-hub test composes the example as a layer, since a verb now
  needs its module.
- module-input.md keeps main's text: it stands 13 characters under the
  30,000-character cap, so the pointer to invoker commands this branch added
  there is dropped; package-data.md, which owns the topic, keeps it.
- The typed-reference advice and its two tests, new on main, are removed with
  the relation they advised on.

@leaf-agent leaf-agent left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

packages.md still says --use selects only the widget's inputs contracts. In skills/leaf/references/packages.md, the paragraph under the leaf page instructions PAGE --contract unified-diff example says: "Each --use ENTRY adds that entry's instructions to author, along with the entries its example uses and its inputs contracts". Since dba5a759f, instruction_selection also selects each outputs contract. A package author reading this reference won't expect --use on a widget that holds a value to return that contract's producer text. package-data.md now says the opposite, so the two references disagree. Change "its inputs contracts" to "the contracts its inputs and outputs name", or drop the clause and point to package-data.md, "Widgets working together", which now states it.

The review bot found the sentence still naming only `inputs`, against
package-data.md and `instruction_selection`.
@max-sixty

Copy link
Copy Markdown
Owner Author

Fixed in 68ca992: packages.md now says --use adds "the contracts its inputs and outputs name".

This was written by Claude Code on behalf of max-sixty

Six authors writing package pairs from the references found no route:
`package check` reads one package, and `page init` refuses a page inside one.
A page outside both that selects them by path takes the pair, and its render
check draws it; run on the two fixture packages.
max-sixty added a commit that referenced this pull request Nov 23, 2026
…e answer it shows (#6759)

`shows` stops being a declared fact. The board's module already placed a
card by the answer it shows and refused a drop the other widget can't
take, while the server kept rules of its own about the same cards. This
deletes the server's copy: `shown_answers.py`, the `shows` and
`awaits.key` schema, nine findings and the public `shownAnswer`, which
moves into the board. That leaves 27 facts and 229 fewer lines of
production code. `browser/AGENTS.md` now states the rule this applies:
add a fact only where some part of Leaf must act on it without running
the widget's module, and the module can't keep the same rule itself.

A correctly written board draws and records the same as on `main`. What
changes is what an author is told:

- `page check` no longer refuses a card whose `shows` names an element
with no answer. The board reports it when the page draws, so `page check
--render` fails on it, and it also reports a card whose question gives
its options no `value`.
- In a thread message nothing draws the board before the user opens the
thread, so a card there that names a page's widget, which admission
refused, is first met by the user. The agent then hears of it as the
page's error.
- Three pieces of `page check` advice about valid cards go: a card
written apart from its authored answer, which moves when the page draws;
a board with no column for an unanswered question; and a column whose
value the question can't answer.
- The server admits a board move of a `shows` card that a command writes
to the log. The page ignores it, and the board never sends one.

Max picked this rule on the run's Leaf page, with the first and last of
those costs in front of him; the other two came out of review and he
hasn't seen them or the diff. A typed `refers` contract for `shows`
would bring the static refusal back without core code, at the cost of a
registry map listing each widget a card may show.

It conflicts with #5981 in five files and with #6690 in the generated
`contract.d.ts`; whichever lands second carries the merge.

Tests: four browser tests of cards that show an answer, 825 registry and
vocabulary model tests, and `pnpm run check`. The `AGENTS.md` passage
was scored in a scratch A/B and changed nothing on a plainly stated case
(the module, 3 of 3 on both arms). The new sentences in `lf-card`'s
instructions and `packages.md` are unscored, since no eval covers a
board or what a package declares.

> _This was written by Claude Code on behalf of max-sixty_
max-sixty added a commit that referenced this pull request Nov 23, 2026
…der that the user chose the greyed Send (#6706)

Four small corrections that a survey of the shipped instructions turned
up.

- `page-checkpoints.md`, "Ending", listed two of the five conditions on
which `leaf page close` refuses. It now gives the command's own list,
from `leaf page close --help`: an unread update, worker's report or page
error, an update that still owes its answer, or an open to-do.
- `module-authoring.md` gave `mountSample` a signature without `source`,
which `browser/runtime/sample.js` takes in place of `template`. It now
names it and points to `live-samples.md`, "Generated samples".
- `module-state.md` said Leaf doesn't set the property of an `lf-diff`
showing its inline patch. `ElementData.initialize()` in
`browser/runtime/element-data.js` sets it once, to the text of the
widget's `<pre>`, as `package-data.md` and `module-reading.md` already
say.
- The header of `browser/runtime/composing/input.js` now records one of
Max's calls. Where the browser can't dictate, an empty comment box keeps
Send, grey and unavailable; he chose that on #3287 over a box that shows
no Send until it holds words. A fresh agent given the root guidance and
that choice ships the hidden Send in three answers of three, so the
decision needs to stand where the next change to the box reads it.

**To weigh.** #5981, an open draft, edits the paragraph after the
`module-state.md` sentence and leaves the sentence itself, so whichever
lands second may have a one-line conflict there.

No behaviour changes. The three reference edits correct facts, so none
was scored.

Asked for by Max. `pre-commit` passes.

> _This was written by Claude Code on behalf of max-sixty_
# Conflicts:
#	browser/registry.json
#	browser/types/contract.d.ts
#	skills/leaf/references/package-data.md
#	src/leaf/findings.py
#	src/leaf/registry/widgets.py
#	src/leaf/validation/instances.py
#	tests/model/interact_contract/test_registry_door.py
@max-sixty
max-sixty marked this pull request as ready for review November 23, 2026 18:02

@leaf-agent leaf-agent left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Holding the verdict on the PR body's Still his: the value channel and whether references stay plain are listed as Max's calls, and this PR is the answer to both, so merging it settles them. Once Max accepts that answer here, nothing else in the diff holds it back. The focused model tests (627) and pnpm run test:runtime (1085) pass on the merged tree.

@max-sixty

Copy link
Copy Markdown
Owner Author

The two calls this review held on are made. On 23 November Max picked "Hold a property and say change" for the value channel and "References name any element, and an input types what it reads" for references on the decision page, and asked for this pull request to be merged. The description now records both.

This was written by Claude Code on behalf of max-sixty

@max-sixty
max-sixty merged commit 0335686 into main Nov 23, 2026
7 checks passed
@max-sixty
max-sixty deleted the fable-composition branch November 23, 2026 18:17
max-sixty added a commit that referenced this pull request Nov 23, 2026
**What it does.** The sort film holds the slice.rs lines its step runs
as its `playhead` output (contract `source-lines`, declared by the
default package). Each `lf-code` names the film in `for` and marks those
lines. `for` rather than the experiment's `follows`, since `for` is the
rule's attribute for reading another widget's output.

**What a reader sees.** The running line gets an accent bar and number.
When it leaves view, the code pane glides it to its middle; the page
never moves. A single step elsewhere, such as insert_head's call site,
moves nothing. Scrolling or clicking in the pane stops the following;
pressing the film resumes it.

**Measured** on 21 November, the default film at 1440×900, one journey
on this branch and on #6690, which lights the same line and follows
every one. While the film plays its minute, the pane moves 42 times here
against 116, travels about 42,600 px against about 99,000, and shows the
lit line 76% of the time against 100%, never out of view for more than
0.7 s. The right line is lit at each of the 451 key steps that run one.
Chromium, Firefox and WebKit agree on those counts. A page of 200 code
blocks is presented about 750 ms after load here and on main: a median 6
ms slower over 12 paired runs, slower in 7.

**Costs.** lf-code is a LeafElement on every page. A data widget's
`<pre>` feeds only its `value` input. `scrollIntoView` bounded `within`
a box applies `block` and `behavior` there. `scrollersOf`,
`alreadyShown` and `onUserInput` join portable-api; the block reads the
reader's hand in its pane from `onUserInput`, with no listener of its
own.

**Instructions scored** on 21 November against the base branch, three
samples an arm on Claude Code. Asked to make an excerpt show the line a
page-owned stepper is on, authors bound `for` to a declared
`source-lines` output in 3/3 with the new lf-code instructions and 0/3
without, where each reached the excerpt from the stepper's module. The
three passing replies run as real pages. The task's three other lf-code
contexts passed 8/9 and 9/9; the one failure used no lf-code. The case
is `source-code-readable/lines-follow-a-widget`.

**Current with main as of 23 November**, through #5981: the block stands
on main's reworked lf-code (a language named by a class on `<code>`, the
notes toolbar), main's declaration names (`inputs`, `outputs`, `refers`)
and its reworked `landing-scroll.js`, and its colours use the prefixed
tokens.

**Asked for by Max**, who picked lighting the line on 14 November and
asked for this to land with #5981 on 23 November without having read the
diff in full. The quieter follower costs 150 lines in lf-code against 73
for #6690's, which follows every line; that call is his to reverse.

> _This was written by Claude Code on behalf of max-sixty_
max-sixty added a commit that referenced this pull request Nov 23, 2026
… start the merge film's glide at once (#6893)

A glide, the smooth scroll Leaf drives itself (`glideTo` in
`browser/runtime/scrolling.js`), read any move of its box away from
where it last wrote it as another hand's scroll and stopped. Scroll
anchoring makes such a move whenever content grows above what the reader
sees, so a widget that lands something smoothly in the same task as a
redraw lost its landing. On the wt-merge film at phone width, with the
next-frame workaround from #5981 taken out, a step's press grew the step
list 22px, anchoring moved the page 799 → 821, and the film ended 786px
out of view in 3 of 3 runs. Now a glide keeps its box through anchoring
(a move equal to the box's scroll-height change) and a clamp (the box
moved back to its new end), and goes on from where layout left it; any
other move is still a hand's. The film lands with its top at 39px in
Chromium and Firefox, so this also drops its workaround and the
`package-data.md` sentence telling a producer to scroll in the next
frame.

To weigh: the goal is still the offset computed at the press, so a
destination the growth itself moves (one below it) lands off by the
growth, as on main when the box doesn't move. Geometry can't separate
every hand from layout: a script's scroll in the same frame that matches
the height change exactly reads as layout's. Codex reviewed three
rounds; an earlier draft that re-asked each landing's goal was dropped
for the gaps it left.

Max asked for this on the widget-composition page. Tests:
`test_glides.py` (Chromium, Firefox) and the film's phone test fail on
main's `scrolling.js` and pass here; `scrolling.test.mjs` covers
anchoring, a clamp and a hand. Navigation, geometry, thread, margin,
widget and control browser tests and the glide journeys pass.

> _This was written by Claude Code on behalf of max-sixty_
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants