Files
tty7/mobile/src
ae05b25530 fix(mobile): deliver choice taps as separate keys and drop stale ones (#1315)
The option buttons shown when an agent asks a question worked only some
of the time. An arrow-menu pick went out as one write (N arrows plus CR),
which the gateway hands to the pane as one input, so the TUI read it as
a single chunk and could miss the move or the Enter. The arrows were
always CSI, ignoring DECCKM. Buttons stayed tappable until the next
parse, so a second tap, or a tap after the prompt was answered on the
desktop, typed a stray digit or Enter into whatever came next. Taps while
reconnecting were dropped without a word.

Each key is now its own write, 15ms apart with 50ms before Enter (the
desktop composer's KEY_GAP and SETTLE), with ESC O A/B in application
cursor mode. Each choice set gets an identity (question, options,
selection, buffer row); after a tap the buttons dim and take no other
tap until the screen shows a different set or 2s pass, and a tap whose
set is no longer on screen is dropped. A tap that cannot be sent buzzes,
shows the banner and leaves the buttons live. A numbered run that does
not start at 1 is accepted when the agent's selection mark is in it, so
a scrolled menu still gets buttons.

Detection and key building move to mobile/src/choices.ts as pure
functions.

Co-authored-by: Morpheus <morpheus@Morpheuss-MacBook-Pro.local>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-14 20:46:40 +08:00
..