hermes-agent/ui-tui/src/lib
Ben 825629424d fix(tui): persist timed-out/cancelled clarify prompts in transcript
When a clarify prompt times out (backend _block returns an empty answer
after the configured timeout) or is dismissed with Esc/Ctrl+C, the live
ClarifyPrompt overlay was torn down by turnController.idle() ->
resetFlowOverlays() with no persistent transcript record. The question and
options vanished from the screen while the agent's follow-up still referred
to "the options above".

The answered path already persists the question + answer; only the
unanswered exits left no trace. This asymmetry is the bug.

Fix (TUI layer only, no Python/protocol change):
- formatAbandonedClarify() in lib/text.ts renders the question + the same
  1-based numbered option list shown by ClarifyPrompt, plus a reason
  ('timed out' / 'cancelled').
- Timeout: createGatewayEventHandler flushes a still-live clarify into the
  transcript as a plain system line when the clarify tool's own tool.complete
  fires. A live capture of the event stream confirmed this is the only point
  where the overlay is still set after a timeout: the sequence is
  clarify.request -> (timeout) -> tool.complete -> message.complete, with NO
  intervening message.start/tool.start. On a real answer, answerClarify()
  clears the overlay before tool.complete arrives, so the hook no-ops there
  (no double-write); a per-requestId guard set is belt-and-braces.
- Explicit cancel: answerClarify('') persists the prompt as a system line
  instead of a transient 'prompt cancelled' flash.

System lines always render (unlike trail lines, which /details can hide),
so the record reliably survives on screen as standard output.

Verified live in the TUI: an Esc-cancelled clarify now leaves the question +
options + '(cancelled - no selection)' in the transcript after the turn ends.

Tests: formatAbandonedClarify unit cases + gateway-handler behavioral cases
(persist on clarify tool.complete, no flush on a non-clarify tool.complete,
no double-persist on repeat tool.complete, no-op when the overlay was already
cleared by an answer).
2026-06-04 16:25:54 -07:00
..
circularBuffer.ts fix(tui): address PR #13231 review comments 2026-04-20 19:09:09 -05:00
clipboard.ts refactor(tui): simplify base64 clipboard write to a stdin flag 2026-05-30 01:40:44 -07:00
editor.test.ts fix(tui): address Copilot review on editor handoff 2026-04-25 20:34:24 -05:00
editor.ts fix(tui): address Copilot review on editor handoff 2026-04-25 20:34:24 -05:00
emoji.ts fix(tui): inject VS16 so text-default emoji render as color glyphs 2026-04-21 15:52:39 -05:00
externalCli.ts feat(tui): /model and /setup slash commands with in-place CLI handoff 2026-04-17 10:58:18 -05:00
externalLink.ts Add Hermes desktop app (#20059) 2026-05-31 17:46:56 -05:00
forceTruecolor.ts fix(tui): harden Terminal.app render behavior 2026-05-16 22:51:51 -05:00
fpsStore.ts chore(tui): /clean recent perf work — KISS/DRY pass 2026-04-26 20:38:47 -05:00
fuzzy.test.ts feat: fuzzy search for the model picker (WebUI + TUI) 2026-06-01 16:58:58 -07:00
fuzzy.ts feat: fuzzy search for the model picker (WebUI + TUI) 2026-06-01 16:58:58 -07:00
gracefulExit.ts refactor(tui): /clean pass on memory + resize helpers 2026-04-20 18:58:44 -05:00
history.ts refactor(tui): /clean pass across ui-tui — 49 files, −217 LOC 2026-04-16 22:32:53 -05:00
inputMetrics.ts fix(tui): preserve transcript tail across resizes 2026-05-23 17:37:42 -05:00
liveProgress.test.ts chore(tui): /clean recent perf work — KISS/DRY pass 2026-04-26 20:38:47 -05:00
liveProgress.ts chore(tui): /clean recent perf work — KISS/DRY pass 2026-04-26 20:38:47 -05:00
mathUnicode.ts docs: clarify wrapForFrac and streaming math-fence rationale 2026-04-28 21:43:32 -04:00
memory.ts fix(tui): address PR #13231 review comments 2026-04-20 19:09:09 -05:00
memoryMonitor.ts fix(tui): stop persisting full tool output in trail lines (silent OOM death) 2026-06-03 06:00:22 -07:00
messages.test.ts fix(tui): stabilize live todo progress 2026-04-26 15:55:38 -05:00
messages.ts fix(tui): stabilize live todo progress 2026-04-26 15:55:38 -05:00
openExternalUrl.test.ts tui: make URLs clickable + hover-highlight in any terminal (#25071) 2026-05-13 13:52:10 -07:00
openExternalUrl.ts tui: make URLs clickable + hover-highlight in any terminal (#25071) 2026-05-13 13:52:10 -07:00
osc52.ts fix(tui): raise picker selection contrast with inverse + bold 2026-04-21 14:31:21 -05:00
parentLog.ts fix(tui): auto-recover session on unexpected gateway death (+ persist lifecycle breadcrumbs) (#35893) 2026-05-31 10:36:57 -05:00
perfPane.tsx fix(tui): address virtual row and perf log review notes 2026-04-26 21:37:43 -05:00
platform.ts fix(tui): respect voice.record_key config (supersedes #19028, #19339) (#19835) 2026-05-04 15:49:28 -07:00
precisionWheel.ts fix(tui): steady transcript scrollbar (#20917) 2026-05-06 14:50:31 -07:00
prompt.ts fix(tui): termux-gate composer rendering tweaks for Ink TUI 2026-05-21 19:08:38 -07:00
reasoning.ts fix(tui): anchor splitReasoning unclosed-tag regex to start of input (#29426) 2026-05-20 14:09:38 -05:00
rpc.ts feat(tui): wire /rewind through command.dispatch + prefill payload (#21910) 2026-06-01 01:22:38 -07:00
subagentTree.ts refactor(tui): consolidate agents overlay — share duration/root helpers via lib 2026-04-22 12:10:21 -05:00
syntax.ts fix(tui): restore macOS copy behavior and theme polish (#17131) 2026-04-28 18:47:14 -05:00
terminalModes.ts fix(tui): tighten SGR fragment matching 2026-04-30 17:50:49 -05:00
terminalParity.ts fix(tui): raise picker selection contrast with inverse + bold 2026-04-21 14:31:21 -05:00
terminalSetup.ts style(tui): apply npm run fix 2026-04-28 22:18:26 -05:00
termux.ts fix(tui): termux-gate scrollback preservation, touch-friendly defaults 2026-05-19 12:49:23 -07:00
text.test.ts fix(tui): persist timed-out/cancelled clarify prompts in transcript 2026-06-04 16:25:54 -07:00
text.ts fix(tui): persist timed-out/cancelled clarify prompts in transcript 2026-06-04 16:25:54 -07:00
todo.test.ts fix(tui): pin todo panel above live output 2026-04-26 15:27:31 -05:00
todo.ts fix(tui): pin todo panel above live output 2026-04-26 15:27:31 -05:00
viewportStore.ts fix(tui): steady transcript scrollbar (#20917) 2026-05-06 14:50:31 -07:00
virtualHeights.ts fix(tui): clear selection on right-click copy + group transcript blocks 2026-06-02 22:03:38 -05:00
wheelAccel.ts chore(tui): /clean recent perf work — KISS/DRY pass 2026-04-26 20:38:47 -05:00