hermes-agent/apps
xxxigm 8b84d82227
fix(desktop): send on Enter from live editor text, not stale composer state (#39639)
* fix(desktop): send on Enter from live editor text, not stale composer state

Pressing Enter often did nothing (~90% with IME / fast typing); adding a
trailing space "fixed" it. The composer's submit path read the draft from the
AUI composer state (`useAuiState(s => s.composer.text)`) and the derived
`hasComposerPayload`, both of which lag the contentEditable DOM by a render. On
fast typing or IME composition the final keystroke(s) weren't in state yet, so
`submitDraft()` saw an empty draft and dropped the message. A trailing space
only worked around it by forcing an extra input event that flushed the state.

submitDraft() now refreshes draftRef from the editor node and submits/queues
based on the live DOM text, and the Enter handler decides the queue-drain vs
submit branch from the DOM too. draftRef is already synced on every input
event, so this just closes the in-flight-keystroke gap.

Fixes #39630. Also addresses the "typing + Enter does nothing" reports in

#39623.

* test(desktop): cover Enter-submit from live editor text (#39630)

Pin the contract that the composer's Enter path reads the live DOM editor
text, not the render-lagged composer state: a just-typed message sends even
when state hasn't synced; while busy it queues (never drains the queue or
cancels); an empty Enter while busy is a no-op; and an empty idle Enter
drains the next queued prompt. Faithful DOM-event repro mirroring
handleEditorKeyDown + submitDraft.
2026-06-10 00:51:23 +00:00
..
bootstrap-installer test(bootstrap-installer): cover PowerShell path layout cross-platform 2026-06-06 19:59:16 -07:00
desktop fix(desktop): send on Enter from live editor text, not stale composer state (#39639) 2026-06-10 00:51:23 +00:00
shared fix(desktop): guard reconnect sockets and keep branch search precise 2026-06-03 13:13:21 -05:00