mirror of
https://github.com/NousResearch/hermes-agent.git
synced 2026-05-08 03:01:47 +00:00
`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. |
||
|---|---|---|
| .. | ||
| slash | ||
| createGatewayEventHandler.ts | ||
| createSlashHandler.ts | ||
| delegationStore.ts | ||
| gatewayContext.tsx | ||
| inputSelectionStore.ts | ||
| interfaces.ts | ||
| overlayStore.ts | ||
| scroll.ts | ||
| setupHandoff.ts | ||
| spawnHistoryStore.ts | ||
| turnController.ts | ||
| turnStore.ts | ||
| uiStore.ts | ||
| useComposerState.ts | ||
| useConfigSync.ts | ||
| useInputHandlers.ts | ||
| useLongRunToolCharms.ts | ||
| useMainApp.ts | ||
| useSessionLifecycle.ts | ||
| useSubmission.ts | ||