Skip to content

feat(remote): log pages and text-page controls on remote sessions, page rows on agterm-server - #978

Merged
umputun merged 27 commits into
masterfrom
remote-log-follow
Nov 12, 2026
Merged

umputun merged 27 commits into
masterfrom
remote-log-follow

Conversation

@umputun

@umputun umputun commented Nov 12, 2026 •

Copy link
Copy Markdown
Owner

A text page shown for a remote session was a static copy: a session attached from another Mac or served by an agterm-server Linux host got no log page, and following, searching, wrapping and stepping a diff's changes were unavailable through the control API. A remote text page now behaves like a local one, for a Mac origin and a Linux origin. agterm-server also gets page sessions, shown in a Mac's remote window.

Remote text pages

  • a log page (--tail, --follow-file, a clicked .log) opens on the presenting Mac and follows the file over the page channel
  • session overlay follow, search, wrap and changes work on the origin and on the presenting Mac, from the page's own bar and from the control API, and read back on both
  • a presenter lists the new page.text kind in its hello. With an older presenter, an explicit log open is refused with the Mac presenting this session cannot show a log page, a clicked log opens as the plain static page, and search, wrap and changes answer remote page: ... on the Mac that shows it
  • the agterm-linux fork must not list page.text until it implements log reads and rendering, the controls and the mirrored text state

Page rows on agterm-server

  • session overlay open --page|--companion --html FILE|--url URL makes a page session or page companion on the host; the catalog lists it, and a remote window shows it as a page row, each Mac claiming its own view over ssh (session overlay page-attach)
  • a row without a view shows a failed page naming why (waiting for the host, host unreachable, connection ended) and retries; a refusal from the server stays shown
  • the same command aimed at a remote window's row is created by the server under an operation id; --block and overlay result --page read the page's outcome from the server, after the window closed too
  • session overlay close on a server page row closes it on the server
  • a GUI ask or a pick on a server page row shows on the Mac presenting the row, through the same presentation stream a terminal row has; a terminal ask on a page row is refused, as it is locally
  • older viewers are sent no page rows
  • a loopback --url page row is refused on agterm-server, as a Mac's loopback page row already is when another Mac attaches it: page rows have no loopback forwarding path

Copilot AI balanced review requested due to automatic review settings November 12, 2026 13:10

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.

@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Nov 12, 2026 •

Copy link
Copy Markdown

Deploying agterm with  Cloudflare Pages  Cloudflare Pages

Latest commit: ccfc8f7
Status: ✅  Deploy successful!
Preview URL: https://badec7ac.agterm.pages.dev
Branch Preview URL: https://remote-log-follow.agterm.pages.dev

View logs

…ext pages

Add the page.text presentation kind, the follow/search/wrap/changes page
actions with their toggle, query and step fields, the pageResult answer, and
the text state carried by page state, a re-offer seed and a log request on
the page frame. TextLog, TextLogReport and TextChanges become Codable and
ControlToggleMode gets its wire spellings. Both presenter-frame receivers
route pageResult; the presenter refuses the text actions until they are
implemented.
…e result

a text action answers with a correlated pageResult, so a refusal on the presenter sends one with
ok false and leaves appliedSeq alone; the query cap comment describes the truncation it performs.
a log page's channel answers log.tail with the raw tail bytes, its stamp and offset, or log.unchanged
when the stamp still matches; the presenter builds the snapshot with the same LogRead a local page
uses, so truncation, rotation and binary tails read alike. RemotePageChannel.logTail is the client.
the cancel goes out after the head and first chunk arrive, so the test fails if the loop stops
honoring it; two comments that restated the code are gone.
the reader may suspend, as a replica page's will on its channel; the default reader detaches the
file read itself. A pause or stop while a read is suspended drops it, as it does for a blocking one.
a text page shown for another Mac searches, wraps, steps its changes and follows its log like a
local one: the store's text paths accept it, its bridge reads text over the page channel and a log
through log.tail, so a log past the text cap opens, and every change reaches the origin in the
page state. A re-offered page opens with the following, query and wrap it had.
the wire state cut only the query, so an over-limit query could report
counts the presenter found for a longer one. the model now stores the
cut query and the page field holds the same limit.
also lowercases the query limit comment in text.js.
follow, search, wrap and diff change steps on a page shown on the
presenting Mac now go there as page commands and wait for its result,
at most five seconds. the presenter runs each origin action as the local
command, in order per page, and answers with the page's text state,
which the origin mirrors before replying. a presenter without live text
pages is sent nothing and keeps the existing refusals; a log page now
opens on one that has them.
a log clicked on a presented pane opens as a log page on a presenting Mac
that lists live text pages, and as the plain text page on an older one.
removing the page's message handlers leaves the native commit as the only
way a step's counts, pause or change reach the model. also restores the
step lines' indentation and trims comments the review flagged.
the server probes a log through its tail, holds a log page for the next
Mac, and refuses one only while a Mac without live text pages is
connected. a clicked log becomes a log page for a presenter that can
follow it. follow, search, wrap and changes are served through the shared
store path, answered by the presenting Mac.
agterm-server's catalog carries page rows, with their page and the endpoint a
Mac reaches them through. A Mac that declares page rows in its hello mirrors
them as page rows; an older viewer gets the catalog without them, with skip
deltas keeping its revisions contiguous and a page root's companions shown
top-level.

A page row claims a view of its server page through page-attach and shows it
over a page channel. Each claim is tied to the row instance the window holds,
so a row detached, removed or replaced during the ssh wait is never shown and a
replaced one is claimed again. A lost channel or an unreachable server shows
the row's failed page and claims again while the catalog lists the row.

session.page and session.companion.page in a remote window are created by the
server under an operation id, through session overlay open --page|--companion,
which now takes --op-id and --epoch.
…elease their lease

A page row's page-attach and its page channel each wait for the pooled ssh
connection before they run, so a slot being started is never joined by a
second connection; an unreachable one shows the row's failed page and the
claim retries. The channel starts after the claim ends, so a channel that
fails to start claims again.

A replica page keeps the pool its channel leased from: a closed or detached
row is gone from its store before its page is released, which left the lease
held. A page row's binding follows a catalog change of its endpoint, and its
failed page reads back as failed with its reason before any view renders it.
The skill, the command reference, the user guide and the control rules state
that log pages and follow, search, wrap and changes work on a presenting Mac
with live text pages, the replies an older presenter gives, page sessions on
agterm-server and the page rows a Mac's remote window shows, and page rows a
remote window creates through its server under an operation id.
A page a remote window created keeps its outcome on agterm-server, so the
Mac remembers which host holds each such page for the app's lifetime and
sends `session overlay result --page` there; `--block` from a remote window
no longer polls an id only the server knows. The read runs off the accept
thread like every other forwarded request.

`session overlay close` on a server page row closes the row on its server,
as its page's own close does, instead of removing it on the Mac alone.

agterm-server refuses `ask open` on a page row because no presentation
stream can show the ask.
A text page posted a diff's first changes count and a seeded search's first
match count before it reported ready. A caller that waited for those counts
in the model, a script polling `tree` for `text.changes` included, could
step while the bridge still held the document as pending and get
`page not loaded`. The page now holds the counts it reports during setup
and sends them right after ready; later reports go out at once.

A remote page test counted state frames before its restricted-port URL had
finished failing to load, so the load's own reports landed in the count on
a slow runner. It now waits for the failed load before its baseline.
Both causes are recorded in docs/ci-flakes.md.
…network

The refused-text-action test waited for its restricted-port URL to report a
failed load before taking its baseline, and on the CI runner that load
never reported failed within 10 s. The test now shows an HTML file page
through the fixture's channel and waits for the loaded report carrying the
hide's sequence; the frame count assertion is unchanged.
GUI asks and picks on server page rows had no presentation stream to reach a
Mac. Open that stream alongside the page view for headless origins.
@umputun
umputun merged commit 696edcf into master Nov 12, 2026
10 checks passed
@umputun
umputun deleted the remote-log-follow branch November 12, 2026 21:50
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