hermes-agent/ui-tui/src/app
brooklyn! 8d591fe3c7
fix(tui): prefer raw text over Rich-rendered ANSI in TUI message display (#17111)
`turnController.recordMessageComplete` and `recordMessageDelta` both
prioritised `payload.rendered` over `payload.text`.  `payload.rendered`
is the Rich-Console output `tui_gateway` builds for terminals that
can't render markdown themselves; the TUI already renders markdown via
`<Md>`.  Two real bugs follow:

1. **Final answer garbled when `display.final_response_markdown: render`
   is set** (#16391).  Raw ANSI escape sequences pass through into the
   React tree and the user sees overlapping coloured text instead of
   their answer.

2. **Streaming silently drops content.**  Per-delta `rendered` is an
   *incremental* Rich fragment.  The previous code did
   `this.bufRef = rendered ?? this.bufRef + text`, which on every tick
   replaced the whole accumulated buffer with the latest mid-sequence
   ANSI fragment.  Long replies arrived truncated and looked
   half-painted — easy to miss as "model is being terse" instead of a
   client bug.

Fix:

* `recordMessageComplete` now prefers `payload.text`, falling back to
  `payload.rendered` only when the gateway elected not to send any.
* `recordMessageDelta` always accumulates `text`; `rendered` is ignored
  on the streaming path entirely (Ink does its own markdown render via
  `<Md>` / `streamingMarkdown.tsx`).

Tests:

* `prefers raw text over Rich-rendered ANSI on message.complete` —
  the assistant message reflects raw markdown, not ANSI.
* `falls back to payload.rendered when text is missing` — preserves
  the legacy "no `text`, only ANSI" path used by some adapters.
* `always accumulates raw text in message.delta and ignores rendered` —
  pre-fix code would have made this assertion fail because each delta
  overwrote the buffer.

Validation: `npm run type-check` clean, `npm test --run` 392/392 pass.
2026-04-28 17:47:50 -05:00
..
slash fix(tui): make /browser connect actually take effect on the live agent (#17120) 2026-04-28 17:46:57 -05:00
createGatewayEventHandler.ts feat(tui): opt-in auto-resume of the most recent session (#17130) 2026-04-28 16:53:38 -05:00
createSlashHandler.ts fix(tui): prefer exact slash command matches (#15813) 2026-04-28 12:22:26 -05:00
delegationStore.ts feat(tui): subagent spawn observability overlay 2026-04-22 10:38:17 -05:00
gatewayContext.tsx feat: add inline token count etc and fix venv 2026-04-15 10:20:56 -05:00
inputSelectionStore.ts fix(tui): mouse + keyboard text selection in the composer (#16732) 2026-04-27 16:43:48 -07:00
interfaces.ts fix(tui): mouse + keyboard text selection in the composer (#16732) 2026-04-27 16:43:48 -07:00
overlayStore.ts feat(tui): subagent spawn observability overlay 2026-04-22 10:38:17 -05:00
scroll.ts fix(tui): keep stream cadence responsive while typing 2026-04-26 04:32:55 -05:00
setupHandoff.ts feat(tui): /model and /setup slash commands with in-place CLI handoff 2026-04-17 10:58:18 -05:00
spawnHistoryStore.ts feat(tui): subagent spawn observability overlay 2026-04-22 10:38:17 -05:00
turnController.ts fix(tui): prefer raw text over Rich-rendered ANSI in TUI message display (#17111) 2026-04-28 17:47:50 -05:00
turnStore.ts chore(tui): remove dead branch cleanup code 2026-04-26 21:54:24 -05:00
uiStore.ts fix(tui): apply details mode live 2026-04-26 13:34:33 -05:00
useComposerState.ts feat(tui): delete queued message while editing with ctrl-x / cancel with esc 2026-04-27 15:24:14 -05:00
useConfigSync.ts fix(tui): apply details mode live 2026-04-26 13:34:33 -05:00
useInputHandlers.ts fix(tui): copilot review on #16707 — naming, label consistency, esc priority 2026-04-27 15:37:54 -05:00
useLongRunToolCharms.ts chore(tui): clean live progress lint 2026-04-26 15:42:07 -05:00
useMainApp.ts fix(tui): mouse + keyboard text selection in the composer (#16732) 2026-04-27 16:43:48 -07:00
useSessionLifecycle.ts fix(tui): report actual session on exit 2026-04-27 08:52:12 -07:00
useSubmission.ts chore(tui): remove dead branch cleanup code 2026-04-26 21:54:24 -05:00