hermes-agent/ui-tui/src
brooklyn! 88f5186d35
fix(tui): anchor splitReasoning unclosed-tag regex to start of input (#29426)
`splitReasoning()` strips paired `<think>…</think>` blocks first, then runs
an unclosed-trailing regex to catch reasoning that hasn't yet streamed its
closer. That second regex was unanchored and greedy:

    new RegExp(`<${tag}>([\\s\\S]*)$`, 'i')

So any literal `<think>` somewhere in prose — a model quoting the tag, a
code example, or a stream-mid-tag before the closer arrives — consumed
every paragraph after it to EOF. User-visible symptom: "TUI eats last
paragraph of output," both during streaming and on settled turns.

Real reasoning streams always lead the message (that's the only place an
unclosed opener can legitimately appear during streaming). Anchor the
regex to `^\s*` so mid-prose mentions of the tag are preserved.

Empirical repro before the fix:

    splitReasoning('final answer paragraph one.\n\n<think>internal note\n\nfinal answer paragraph two.')
    → text: 'final answer paragraph one.'        ← paragraph two GONE

After:

    → text: 'final answer paragraph one.\n\n<think>internal note\n\nfinal answer paragraph two.'

Updated the existing trailing-unclosed test to lead with `<think>` (the
real-world shape) and added a regression test pinning the mid-text case.

ui-tui type-check clean, 808/808 vitest pass.
2026-05-20 14:09:38 -05:00
..
__tests__ fix(tui): anchor splitReasoning unclosed-tag regex to start of input (#29426) 2026-05-20 14:09:38 -05:00
app feat: auto-launch Chromium-family browser for CDP 2026-05-19 22:34:05 -07:00
components Merge pull request #28829 from NousResearch/bb/tui-no-history-truncation 2026-05-19 12:17:35 -05:00
config fix(tui): termux-gate scrollback preservation, touch-friendly defaults 2026-05-19 12:49:23 -07:00
content fix(tui): copilot review on #16707 — naming, label consistency, esc priority 2026-04-27 15:37:54 -05:00
domain fix(tui): stabilize sticky prompt tracking 2026-04-28 22:10:40 -05:00
hooks fix(tui): refresh virtual offsets after row resize (#20898) 2026-05-06 13:54:46 -07:00
lib fix(tui): anchor splitReasoning unclosed-tag regex to start of input (#29426) 2026-05-20 14:09:38 -05:00
protocol refactor(tui): /clean pass across ui-tui — 49 files, −217 LOC 2026-04-16 22:32:53 -05:00
types fix(tui): keep Ink displayCursor in sync with fast-echo writes so cursor stops drifting (#26717) 2026-05-16 00:28:12 -05:00
app.tsx fix(tui): apply ui-tui fix pass and restore type-check 2026-04-25 14:08:54 -05:00
banner.ts fix(tui): restore macOS copy behavior and theme polish (#17131) 2026-04-28 18:47:14 -05:00
entry.tsx fix(tui): termux-gate scrollback preservation, touch-friendly defaults 2026-05-19 12:49:23 -07:00
gatewayClient.ts feat(tui): support attaching to an existing gateway (#21978) 2026-05-08 12:12:38 -07:00
gatewayTypes.ts fix(tui): handle timeout/error subagent statuses in /agents (#26687) 2026-05-15 20:19:02 -05:00
theme.ts fix(tui): honor skin highlight colors (#20895) 2026-05-06 14:01:56 -07:00
types.ts fix(cli): show active profile in TUI prompt 2026-05-19 00:05:20 -07:00