Repository navigation
fix(web): forward the wheel for any CLI whose registry entry asks for it - #831
JDProfresh wants to merge 2 commits into
Conversation
The browser's wheel gate named copilot, pi, claude and codex by id, so a custom clis.json entry that launches pi could not get the forwarding Ark0N#771 gave stock pi: after every tab switch or reload its wheel scrolled an empty local buffer. Copying pi's altScreen value into such an entry made it worse, since the mouse DECSETs were then stripped while nothing forwarded the wheel. The server now publishes every CLI's wheelForward rule as window.__codemanWheelForward, disabled entries included because disabling a CLI leaves its sessions running, and _shouldForwardWheelToApp reads that map instead of an id list. Stock CLIs keep their behaviour, and a minVersion that is not MAJOR.MINOR.PATCH refuses forwarding instead of comparing as passing.
|
Thank you @JDProfresh, this is a clean fix. The wheel gate now reads each CLI's I compared the old and new Three small things, none of them blocking:
If you would rather not push these yourself, I will apply them at merge time. About your offer to make the Settings form keep the fields it does not edit: if you send that, please make it its own PR. |
…ward A version-gated rule reads the session's cliVersion, which the server probes only for an entry that declares capabilities.gates, so a custom entry with version-gated and no gates never forwards. Also brings the claude and copilot comments in line with the code that now reads them.
|
Thanks for checking every combination. All three are in
Docs and comments only. Typecheck, lint and the 20 test files that read the registry files pass (527 tests). On the Settings form: understood, that will be its own PR if I send it. |
|
Thank you @JDProfresh for the follow-up on this PR, which makes the wheel gate read each CLI's I re-ran the old and new This is ready to merge as it stands. Thanks again for tracking the custom-entry case down to the gate, and for the measured before/after table. |
A custom
clis.jsonentry that starts pi under its own id never gets the wheel forwarding #771 gave stock pi, because_shouldForwardWheelToAppnames copilot, pi, claude and codex by id and the registry'swheelForwardis still declared-for-later, read by nothing.What happens
Take a custom CLI entry that starts pi. Its pane is fullscreen pi with mouse tracking on (tmux:
alternate_on=1,mouse_any_flag=1,mouse_sgr_flag=1,history_size=0). With the custom-entry defaults (altScreen: strip-mux-only,wheelForward: never) pi's mouse DECSETs reach xterm only as live output: every select, reload and tab switch loads thefull=1capture, which carries no mouse mode, so xterm comes back withmouseTrackingMode: noneover a one-screen buffer and the wheel scrolls nothing. That is the bug #771 fixed for stock pi.Giving the entry pi's own values does not help today and makes it worse: with
strip-mux-and-mousethe server strips the DECSETs and publishescliMouseTracking: true, but the gate does not know the id, so nothing forwards the wheel even in a tab that was watching when pi started.What changes
renderIndexHtmlpublisheswindow.__codemanWheelForward: CLI id to itswheelForwardrule, for every registry entry whose mode is notnever. Disabled entries are included, since disabling a CLI leaves its running sessions open and their wheel has to keep working after a reload.minVersionis a free string fromclis.json, so the JSON goes throughescapeScriptJson()._shouldForwardWheelToAppreads that map instead of the id list. No rule (ornever) means no forwarding,version-gatedcomparescliVersionagainstminVersion, andcliMouseTrackingmust be true as before. A page rendered without the map forwards nothing._cliVersionAtLeastparses the minimum as strictly as the version (MAJOR.MINOR.PATCH, optional leadingv) and refuses either side it cannot read. Before, a minimum such as"","0"or"2.0"compared as passing. Claude's version reaches the browser through(\d+\.\d+\.\d+)matches only (the--versionprobe and the banner), so its 2.1.187 gate is unaffected.cliMouseTrackingis true. The paging fallback (transcriptPageKeys) and the touch gate are untouched.wheelForwardleaves the declared-for-later list (theCliEntryheader,test/cli-registry-no-id-branching.test.ts,docs/cli-registry.md, the invariants), the direction that test asks for when a field gets wired up.docs/cli-registry.mdgains a short section on the two values a custom full-screen TUI needs.Invariants: the CLI registry rule that nothing outside
stock.tsbranches on a CLI id now also holds for the wheel gate. Terminal scrollback strip and wheel/touch forwarding keeps its behaviour and now names the map.Known limits
__codemanTranscriptPageKeys, the map is built when the page renders, so a registry change applies from the next page load. In practice nothing changes it mid-page: a custom entry made in the Settings form getswheelForward: never, enabling or disabling no longer touches the map, and a hand edit ofclis.jsonneeds a server restart.altScreenorwheelForwardis lost after an edit there. The new docs section says so. I can send a separate fix if you want the form to keep the fields it does not edit.Tests
test/terminal-scroll-routing.test.ts: a custom id listed asalwaysforwards only while it tracks the mouse and never on Shift; a version-gated custom rule forwards at and aboveminVersionand never with an unknown session version; a malformed or missingminVersionnever forwards ('','0','2.0','1.2.3.4','0.bad.999','x.y.z','2..0','+2.0.0','0x1.0.0') while'v2.0.0'and' 2.0.0 'still do; an id left out of the map, aneverrule and a page without the map forward nothing. The harness now injects the map built fromSTOCK_CLIS, so every existing stock case runs through it.test/render-index-html.test.ts: with a pi-shaped custom entry and copilot disabled inclis.json, the main page and a/session/:idwindow both carry exactly the claude, codex, pi, copilot and custom rules.test/terminal-tile-scroll.test.tsandtest/terminal-touch-tap.test.tsinject the same map their pages get, andtest/server-index-title.test.tsstrips the new script like the other injected ones.minVersionthrew aTypeErroronce its guard was taken out.npm testpasses apart fromtest/agent-skill-local-model.test.ts, whose 30 failures happen on unmodified master on my machine too, run withtest/docker-start-setup.test.tsexcluded (the WSL mirrored-networking hang from #797).typecheck,lint,format:check,check:frontend-syntaxandcheck:browser-excludespass, and the four browser files that drive the wheel (codex-wheel-routing,terminal-touch-paging,fullscreen-tab-switch-capture,terminal-tile-scroll) pass in headless Chromium.Verified
On a throwaway instance with real pi 1.4.0 and a custom entry that starts
pi, driven in headless Chromium through a first select, a reload and three same-size tab switches. "Before" is 1.49.0; the gate, the strip, the mouse-mode recorder and the replay query are unchanged on current master.mouseTrackingMode: none,baseY: 0, gate false: the wheel scrolls nothingstrip-mux-and-mouse+alwayscliMouseTracking: truebut gate false: the wheel scrolls nothingstrip-mux-and-mouse+always\x1b[<64;88;20Mreports to the sessionpi