hermes-agent/ui-tui/src/lib
teknium1 e76d8bf5aa
fix(tui): stop persisting full tool output in trail lines (silent OOM death)
A heavy --tui session (browser snapshots, large tool outputs) silently
OOM-killed the Node parent within minutes — closing the gateway child's
stdin, which the user saw only as a bare "gateway exited" / stdin EOF.
CLI was immune. Root cause: each completed tool's verbose trail line
embedded up to 16KB of result_text, persisted in transcript Msg.tools[]
for the whole session and rendered EXPANDED by default, so an Ink
render-node tree was built for every one of up to 800 messages at once.
That tree blew past Node's heap at a few hundred MB — far below the 2.5GB
memory-monitor exit threshold, so the death was never even attributed.

- text.ts: persisted verbose tool-trail blocks now cap to a small preview
  (VERBOSE_TRAIL_MAX_CHARS=800/12 lines), not the 16KB live-render budget.
  Retained trail strings drop ~17x (12.2MB -> 0.7MB at 800 msgs); the live
  streaming tail still uses the larger LIVE_RENDER budget.
- tui_gateway/server.py: lower the gateway-side verbose text cap to match
  (1KB/16 lines) so we stop shipping output the TUI no longer renders.
- memoryMonitor.ts: derive critical/high thresholds from the real V8 heap
  ceiling (~88%/70%) instead of the hardcoded 2.5GB that killed the process
  at 31% of an 8GB ceiling; add a one-shot onWarn early-warning on fast
  sub-threshold heap growth so the next such death is diagnosable, not silent.
- entry.tsx: wire onWarn to a crash-log breadcrumb + stderr line.

Full tool output is unchanged in the agent context and SQLite session — this
is display/transport only, no behavior or context change.

Fixes #34095. Related #27282.

Tests: ui-tui text + new memoryMonitor suites (33 pass), python verbose-cap
guard (5 pass); full ui-tui suite shows no new failures vs pristine main.
E2E repro confirms the retention drop.
2026-06-03 06:00:22 -07:00
..
circularBuffer.ts
clipboard.ts refactor(tui): simplify base64 clipboard write to a stdin flag 2026-05-30 01:40:44 -07:00
editor.test.ts
editor.ts
emoji.ts
externalCli.ts
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
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
history.ts
inputMetrics.ts fix(tui): preserve transcript tail across resizes 2026-05-23 17:37:42 -05:00
liveProgress.test.ts
liveProgress.ts
mathUnicode.ts
memory.ts
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
messages.ts
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
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
platform.ts
precisionWheel.ts
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
syntax.ts
terminalModes.ts
terminalParity.ts
terminalSetup.ts
termux.ts fix(tui): termux-gate scrollback preservation, touch-friendly defaults 2026-05-19 12:49:23 -07:00
text.test.ts
text.ts fix(tui): stop persisting full tool output in trail lines (silent OOM death) 2026-06-03 06:00:22 -07:00
todo.test.ts
todo.ts
viewportStore.ts
virtualHeights.ts fix(tui): clear selection on right-click copy + group transcript blocks 2026-06-02 22:03:38 -05:00
wheelAccel.ts