Skip to content

Look up any address with elementById(address, from) and any registry entry with layerFact, and take four lookups out of the package API - #6999

Merged
max-sixty merged 5 commits into
mainfrom
agent-acd0fccc4ebce8029
Nov 24, 2026
Merged

max-sixty merged 5 commits into
mainfrom
agent-acd0fccc4ebce8029

Conversation

@max-sixty

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

Copy link
Copy Markdown
Owner

One step of the package-interface redesign: a package finds an element with elementById(address, from) whether it holds an id, a widget's id:key or a fragment, passing the element that wrote the address as from, so an address in an agent's message names that message's element first. It reads any registry entry with layerFact(name), and finds Leaf's chrome by its .lf-chrome class. authoredScope, fragmentTarget, declarationFor and inChrome leave the package API: 105 names become 101.

What the diff doesn't show:

  • Left. phrasing stays: folded into layerFact, its one caller would restate Leaf's phrasing rule.
  • Page first. An address names the page's element before a reply's copy of its id; an id the page lacks still names what Leaf draws, so the contents list's On Me count and the feed's links probe identical to base.
  • Cost. elementById(id, root) asks getElementById first and walks root only behind a duplicate id.

Max approved the redesign and asked for small steps; he hasn't read this diff, which a fresh agent reviewed.

Tests: pnpm run check, pre-commit, 63 browser tests and 6 render-gate pages by node id, and leaf-dev probe --base of comments in lf-diff's shadow tree, Chromium and Firefox: arms alike.

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

leaf-agent
leaf-agent previously approved these changes Nov 24, 2026

@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.

One wording fix in browser/AGENTS.md, inline. "The element an id an element gives names" stacks two relative clauses with no relative pronoun, so the row parses only on a second read.

Comment thread browser/AGENTS.md Resolved
leaf-agent
leaf-agent previously approved these changes Nov 24, 2026
…till counts an obligation in a reply seated in the page
@max-sixty
max-sixty merged commit 0ff5679 into main Nov 24, 2026
6 checks passed
@max-sixty
max-sixty deleted the agent-acd0fccc4ebce8029 branch November 24, 2026 11:13
max-sixty added a commit that referenced this pull request Nov 24, 2026
Brings in #6999 (0ff5679). In it, a package module looks up any
address with `elementById(address, from)` and any registry entry with
`layerFact`, and four lookups leave the package API.

One conflict, in browser/runtime/check-api.js's exports from
ui-marks.js:

- #6999 added `inChrome` beside `uiInside`.
- This branch added the line after it, `export { anchoringIsReady } from
  "./anchor-resolution.js";`, which the readiness tests ask the check API
  for.

The resolution keeps both: `export { inChrome, uiInside } from
"./ui-marks.js";` followed by the `anchoringIsReady` export.

#6999 also changes the runtime's `elementById` in passages.js to look a
root's id up through the root's tree first, under the same contract.
This branch's callers, carry.js `restoreCarry` and version.js's
arrival filter, pass `pageDocument()` and get the same answers. The
merge touches nothing else this branch changed.

> _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