fix(web): the mirror carries scrollback, and held scrollback stops the tick
Every read is `recent`. The source was decided per pane -- `recent` wherever `scrollback` was non-zero, `visible` where it was 0 -- on the belief that an agent pane never has a ring, because its TUI runs on the alternate screen. The rule survived on a cost that is not there: measured on this host (herdr 0.8.2, all 35 live panes, ansi, `recent` 200 against `visible` at the pane's own height), all 9 agent panes report no ring, so the two reads come back byte-identical. The panes opened most paid for the narrow source and got nothing back. Where the two do differ -- shell panes holding a ring, +1.4KB to +52KB -- the extra bytes ARE the scrollback the reader opened the pane to see, so `visible` there is not a saving but a missing feature. Nor can the choice be split by read rather than by pane: mirrorPatch reconciles the whole buffer, so priming one `recent` read on open and then following with `visible` would show the history for exactly one tick before the 3s pass deleted every line the viewport no longer holds. The follow read is bounded at PANE_LINES_BASE instead, and loadMore stops the tick before paneLines can grow past it. Two leaks fall out of the same path. The tick reused whatever paneLines had grown to, so one tap on "load more" put a 600-line read on a 3s timer and the ceiling put a 1000-line one there -- 125.7KB per tick, 42KB/s, re-fetching output the reader had already scrolled away from, and the next tick would have replaced their page anyway. Only follow mode auto-refreshes now. That makes the refresh button the only way back to live, so it is followPane rather than a bare re-read, which in held mode would just fetch the same page again. openTerminal is re-entered on every blocked event for the pane already in front of you, and it reset paneLines unconditionally. With a follow flag beside it that reads: the reader is pulled back to the live screen the moment their agent asks a question, which is the one moment they are most likely to be reading. paneLines, paneFollowing and userScrolledUp now sit inside the same `activePane !== paneId` guard the panels do. The scrollback field keeps its one honest job -- whether a scrollback read could return anything, which is all canLoadMore wants -- and the comment beside it now says outright that it is not a way to tell an agent pane from a terminal. It is not even stable per pane: an earlier measurement on this host had 9 of 10 agent panes reporting a ring (151, 434, 594, 938, 1262, 1267, 1400, 1662, 8439), a later one had all 9 reporting 0. The font-asset test grepped for `format:'ansi'` literally and is whitespace-tolerant now; it pins that the mirror asks for colour, not how the request object is laid out.
N
Nick007 committed
58055a45ddb0739b010f6528604d11539550b0bd
Parent: 0c0cbda