fix(input): centralize and persist terminal input - #188
Conversation
Ark0N
commented
Aug 5, 2026
Hi Lior, closing this one as part of a cleanup of the seventeen PRs currently open from you. The full explanation is in #173, and I would rather you read that one than this note, because it is the honest version and it is not a dismissal of your work. The short form: sixteen PRs opened in a single day, roughly 42,000 added lines in total, landing mostly on the same few files (nine touch Going forward, please keep no more than three open PRs at a time, each one a single behavior change that stands on its own, with a test that fails on master and passes with the fix. #214 and #215, merged today, are good models. If this particular change fixes something that genuinely annoys you in daily use, it is a good candidate to be the first one you reopen on its own, rebased on current master. I will review it properly. Thanks for the effort you put in, and sorry to close it this way. |
Summary
TerminalInputControllerthe single pre-delivery owner for native xtermdata, Android helper-textarea mutations, IME composition, CJK/voice input,
paste, accessory controls, and modified Enter.
page reloads, browser minimization/tab discard, and phone sleep without
submitting restored text.
WebSocket/HTTP reconnects, and remove frames only after the server confirms an
accepted PTY write.
xterm-zerolag-inputat its source package with serializable,grapheme-aware multiline state and atomic restoration against stale terminal
frames.
User-visible fixes
cdcdandhomecd.autocomplete/helper-textarea buffer first.
framing for large payloads.
lifecycle or session transitions.
selection controls.
coherent while terminal output arrives.
Delivery model
Each browser has a stable
clientId; each session gets monotonic input sequencenumbers. Pending frames are stored before delivery and retried after reconnect.
The WebSocket route ACKs tagged input only after the PTY accepts it, while the
HTTP route uses a successful response as its ACK. Duplicate
(clientId, seq)frames are acknowledged without a second write.
Deduplication is intentionally server-memory-only. A server restart in the
narrow interval between a successful write and client ACK can produce a retry;
the design favors retaining user input over losing it.
Review scope
This is the IME, paste, draft, and input-delivery slice requested in the review
of #173. It does not include the mobile navigation pad, shutdown endpoint,
repository viewer, response viewer, history streaming, hook changes, or case
actions; those are separate PRs.
The diff is 45 files and +7,283/-1,006. Of the added lines, 4,032 (55%) are
focused tests. Generated
dist/and vendor bundles are not committed; thezero-lag overlay remains sourced from
packages/xterm-zerolag-input/.Commit structure
feat(zerolag): add serializable multiline input statefeat(input): add per-session terminal draft storerefactor(input): centralize terminal input arbitrationfeat(input): integrate persistent terminal draftsrefactor(input): route producers through controllertest(mobile): cover persistent terminal inputfix(input): acknowledge only accepted terminal writesdocs(input): document persistent delivery invariantsValidation
xterm-zerolag-input: 5 files, 194 tests passed; typecheck and package buildpassed
checks (45 files): passed
assets: passed
harness from test: isolate runtime state and PTY integration #175: 190 files passed, 1 skipped; 3,860 tests passed, 12 skipped
Related