Repository navigation
Markdown reading position: Back, Forward and headings through dehydrate - #1972
Merged
Merged
Conversation
Back/Forward and heading links in the Markdown editor now ride the dehydrate protocol. A navigation keeps the payload its outgoing run writes as Ctrl+C stops it on the history entry it leaves, and holds the destination's payload and the link's fragment for the next run, which asks once with the new `dor tool --rehydrate`. The Markdown page reports its mode and scroll offset to its process, which writes it as its payload and hands what it was given back to the page. The reading-position channel goes: dor-tools-lib's protocol and frame entries, the host's toolView/connectToolView and its ToolPanel and IframePanel wiring, and the screencast host's tool-view operation. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
A Markdown link naming its own file with a fragment now gets `here` from the viewer process, which sends no OSC 367 `open`, and the page scrolls to the heading itself, as for a bare `#x`. The playground's Markdown viewer asks for its state and writes its position as it stops, so Back/Forward and cross-document headings work there too. Every file view now writes a `false` payload as it stops, so leaving one never waits the settle. S150 and the terminal-output prose name the new reading-position POST and the Back/Forward path. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
# Conflicts: # scripts/spec-word-budgets.json
Deploying mouseterm with
|
| Latest commit: |
2de36f8
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://e6597d7a.mouseterm.pages.dev |
| Branch Preview URL: | https://tool-reading-position.mouseterm.pages.dev |
dormouse-bot
approved these changes
Dec 1, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Back, Forward and heading links in the Markdown editor now run on
dehydrate/rehydrate, the protocol any Tool already has, in place of a private page channel. A copy of the built-in run as a user Tool gets the same behavior, which closes the last name check separating a copy from the bundled one. The change removes more than it adds: 59 files, +560/−726 overall, and +251/−344 of source.What a user sees
Nothing changes for the bundled editor, with one gain and a few small losses:
other.md#headinglands on the heading, and "Heading not found" still shows.How it works
The old way: the host asked the page for its position before navigating and told the next page where to go, over a
postMessagechannel in an iframe and an evaluated script under a screencast, both switched on by the built-in's name.The new way:
dor tool --rehydrateprints one JSON line,{"v":1,"state":…,"fragment":"…"}, or nothing, and answers once, for the caller's own Surface. The fragment is the heading a link named.DORMOUSE_DEHYDRATE.A navigation cannot use the environment variable because it types the next command into the shell already there (a take-over Tool runs in the user's own shell; a preview slot retargets in place), and a typed command cannot be given one.
The new request rides the existing
surface.toolcontrol method, so no host changed: not the sidecar, the Rust bridge, or the VS Code host.Deleted
dor-tools-lib'sprotocolandframemodules, their exports and tests. The package is now OSC 367 only.tool-viewoperation and thewindow.__dorToolViewglobal.Security
Two wording edits in
docs/specs/security-local.md, both to keep audited text accurate:S150lists the file viewer's POST requests. The page's position report is added to the list. It goes through the same guard as the page's other requests: its own Origin, the capability prefix, a JSON body capped at 1 KiB.dehydratereaches only its own next run now adds the run a Back or Forward starts for that document on the same Surface.No rule is added or removed. As with every
dorrequest, the caller asserts its Surface id; the control socket does not bound processes running as the same user, whichsecurity-local.mdalready states.Notes for review
falseas their payload when stopped, so a navigation away from a text, code or image view does not wait 100 ms for a payload that never comes. The host keeps it like any payload and every reader restores nothing from it.scripts/outbound-lint-selftest.mjsmutated the deletedprotocol.ts; it now mutatessanitize.ts, the smallest file left in that package.Verified
second.md#deeplanded on the heading. Back returned the first document to the lines it had been scrolled to, and Forward returned the second to its heading.dor-tools-builtin/dormouse.yml(node …/dist/main.js file …): the same link and the same Back and Forward. The screenshot of the first document before leaving and after returning is byte-identical, so the copy read its state by runningdor tool --rehydrateitself.mainmerged in):pnpm test:checks,pnpm test:audit,pnpm test:packages, andpnpm test:lib(7,493 passed, 24 skipped), run one after another. The firsttest:librun failed one test,IframePanel.test.tsx"hides the frame until its first load, then reports ready a frame later"; it passes alone three times in three and the full rerun was clean. It has failed the same way on unrelated branches.lib,dor-tools-builtin,dorand the playground; each turned its test red. One (the page's scroll listener) first passed, and the test was fixed until it failed.Not verified
dorthere; VS Code and Tauri, live; the playground in a browser (tests only).🤖 Generated with Claude Code