Repository navigation
feat(overlay): show HTML pages on the Mac presenting a session - #793
Merged
Merged
Conversation
Add HtmlPageSchemeHandler, which serves agterm-page://<page-id>/<path> from an async source, so a page whose files live on another Mac loads in WebKit as if they were local. Each request runs in its own task and is cancelled when WebKit stops it; a request for another page id never reaches the source. The hosted tests prove the transport the remote page design relies on: relative stylesheets, images and ES modules, fetch, pushState and back/forward all work on the custom scheme. Adds the implementation plan for showing HTML overlays on a presenting Mac.
Add the page frames a presentation stream carries (request, rejected, close, closed, command, state), with the page's full source separate from its display identity, sequence-numbered commands and bounded state. Add the page channel's own frames and codec: resource transfers and bridge calls multiplexed by request id, bridge payloads carried as raw JSON so only the origin decodes them, chunk bodies capped at 64 KiB. Add session.overlay.page.serve, the claim a presenter's helper makes for a page's channel, refused from a page's bridge and unsupported by default for other hosts. Add the replica page source a presenter shows, allowed to load only from its own agterm-page origin, and the tree fields that mark a remote page, a replica and a reservation's page id. Until the presenter side exists, a page request is answered with page.rejected.
A page opened on a session another Mac presents now goes to that Mac under the program overlay placement rule: the slot is reserved here, the page's outcome registered pending, and a page.request sent with a single-use claim token. When the rule keeps the page here (this Mac leads, or roles are unknown or mixed) it opens locally; a presenter without page support keeps the old refusal, and a loopback URL is refused because it names a server on this Mac. The origin mirrors what the presenter reports into htmlOverlays (marked remote) and remoteOverlays (pageID). Hide, show and toggle on a remote page are requests with sequence numbers: the reply and the next toggle use a pending request until the presenter echoes it, then the reported state. Close, resize, presenter loss, rejection and session removal end or update the page, keeping an answer already submitted. claimRemotePage admits a channel token once, within its deadline and for the presenter it was handed to; RemotePageResources limits a channel's file reads to the page's grant.
the origin adopts the helper's claimed connection as a page channel: it serves the page file and files inside its grant off the main actor in bounded chunks, relays bridge requests against the page's live place, and ends only that page on helper loss, bad input or overload, keeping the presenter. resource and bridge requests have separate nonblocking limits, and every admitted transfer ends in one terminal frame.
`agtermctl session overlay page-serve <token>` claims a handed-over page and copies its channel between stdio and the app untouched; a refused claim exits 1. RemoteSession.pageServeCommand builds the `ssh -T` argv with the same PATH chain as the presentation stream.
…g Mac the presenter places a handed-over page in the mapped slot under its own page id. a file page loads through the agterm-page scheme, its files and bridge requests carried by a page-serve channel to the origin; a URL page loads directly with no helper. origin commands (hide/show, reload, back/forward, browser, resize) are applied and mirrored back as page state with the applied sequence, and every way the page leaves its slot tells the origin once. a socket submit on a replica is refused.
…g Mac reload and back/forward on the origin reach the presenter; browser does for a URL page, while finder and browser on a file page are refused with "page is shown on another Mac". a gone presenter answers viewerGone. bare overlay result answers the page's noResult, and overlay text/copy its noRead, ahead of the remote program answers.
both roles run in one process over the real zmx present stream and the real page-serve helper: a --js --cwd file page loads its stylesheet and submits through its channel into the origin's ledger, the origin reads the viewer's page state, presenter loss dismisses the page and tears down the replica and helper, and a presenter without the page kinds keeps the refusal.
control-api rules, the bundled skill, the site guide and command reference, and ARCHITECTURE describe the page handoff: placement, the page-serve channel, the origin's per-command answers for a remote page, the remote/replica/pageID read-back and failure handling. the plan moves to completed.
a page whose open request did not fit one presentation frame failed the offer, so the hub dropped the presenter with every page it showed while the open answered ok. The request is now encoded first and refused with "page too large to show on another Mac" before anything is reserved. replica sources lose their unread grant flag, and the page-serve resource frame and mirrored page state lose revision fields nothing consumed. The cancel-before-head test now holds the origin's answer, so a slot freed at cancel time or released twice fails it.
Deploying agterm with
|
| Latest commit: |
ab3c7eb
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://81c4ef40.agterm.pages.dev |
| Branch Preview URL: | https://remote-html-overlays.agterm.pages.dev |
the test waited for a real WebKit load of http://127.0.0.1:9/a to fail before measuring, and on the CI runner that load did not settle in 10 s. A file replica served by the fake page origin gives the same baseline without the network; the measured writes and assertions are unchanged.
zmx binds a new session's socket path and then listens, and zmx list, attach and the commands that connect to a session delete a path that refuses a connection as stale. A probe between bind and listen can unlink the new socket and leave the daemon running unreachable; the session host lists right after it spawns a creator, so supervised creation is exposed. This is a candidate cause of the intermittent SessionHostFishSeamTests failures on CI. Patch 0003 binds and listens in .s/<pid> beside the sessions, a directory listing in every zmx version skips, then hard-links the socket to the session name. The link refuses an existing name, so a losing creator gets the AddressInUse a bind gave it and never removes the winner's socket. A staged path too long for sockaddr_un keeps the old direct bind. Upstream HEAD still has the window.
This was referenced Nov 4, 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.
an HTML page opened on a session another Mac presents now opens on the presenting Mac, the same way a program overlay already does. Before this, a page on such a session was refused with
OverlayHtmlError.presenter.The placement rule is the program overlay's: the page goes to the presenter when its target pane reports follower on the origin (every existing pane for a session-wide page), and stays local otherwise. Pages already open stay where they are.
--url) load directly on the presenting Mac, with its own--persistentstorage. A loopback URL is refused, since it names a server on the origin.--html) are served from the origin. The presenting Mac runsssh -T <origin> agtermctl session overlay page-serve <token>, a single-use claim bound to the page and the presenter, and loads the page and the files inside its--cwdgrant through anagterm-page://scheme handler, on demand, in bounded chunks. The page'sdata-agtermtags andagterm.requestcalls go over the same channel. Commands execute on the origin, using the page's origin-side defaults, andoverlay submitanswers the caller there.result --pageand--html --blockwork unchanged.closeends the origin reservation immediately and asks the presenter to close the page;resize,reload,navigate back|forwardandhide|show|toggleare sent to the presenter as requests.treelists the page withremote: trueand the state the presenter reports back (load state, address, title, history, hidden).dismissedon the origin, keeping an answer already submitted. Losing the page channel or missing the 30 second claim window ends only the page.The new command is
session.overlay.page.serve, plumbing for the presenting Mac and refused from a page bridge. The user guide, command reference, agent skill,ARCHITECTURE.mdand the control API rules are updated, and the plan is indocs/plans/completed/20261021-remote-html-overlays.md.ControlServerRemotePresentationTestscovers a file page handed to the presenter end to end, with both app roles in one process using the realagtermctlhelpers: the page's stylesheet fetched through the channel, a bridge submit recorded as the origin page's result, state mirrored back, presenter loss, and an older presenter keeping the refusal.the branch also carries a zmx fix found through a flaky CI test: zmx binds a new session's socket and then listens, and
zmx listdeletes a socket that refuses a connection as stale, so a probe in between (the session host lists right after it starts session creation) can leave the daemon running but unreachable.scripts/zmx-patches/0003-atomic-socket-publish.patchstages the socket in.s/<pid>, which listing skips, and hard-links it to the session name once it listens. Upstream 7f0ffdb still has the window. This is a candidate cause of the intermittentSessionHostFishSeamTestsfailures, not a proven one.