hermes-agent/ui-tui/src/__tests__
ethernet a4bc1ca502
fix(timeline): persist typed display events (#69771)
* fix(desktop): hide persisted agent-only history scaffolding

Filter verification-stop nudges and context-compaction handoffs at the
stored-history mapper boundary. Preserve a real reply when a compaction
handoff shares its stored message.

* test(desktop): build persisted E2E sessions through the real agent

Drive tui_gateway.entry over its stdio JSON-RPC transport against the mock
provider, wait for real completion events, and persist normal session history
through AIAgent and SessionDB. Migrate resume and hidden-history coverage,
including real compression and live verify-on-stop scaffolding, then remove
the unused direct SessionDB import scripts.

* fix(desktop): use the provisioned Python for real-session E2Es

Run the stdio gateway through uv's synced project environment outside the
Nix dev shell, while retaining the fully provisioned Nix Python when the
shell advertises HERMES_PYTHON_SRC_ROOT.

* fix(nix): expose the provisioned Python environment to uv

Mark the Nix-built Python environment active in the dev shell so the shared
E2E session builder can always run through `uv run --active --no-sync`.

* fix(timeline): persist typed display events

* fix(timeline): strip display-only fields from provider payloads, preserve through rewrites, fix /resume display history

Three review findings from PR #69771:

1. Provider payload leak: display_kind and display_metadata were forwarded
   to the provider API as unknown message fields. Strict OpenAI-compatible
   backends can reject the next request after a model switch or resumed
   typed event. Strip both from the per-request api_msg copy in
   conversation_loop alongside the existing api_content pop.

2. Rewrite/import data loss: _insert_message_rows preserved display_kind
   but silently dropped display_metadata. After replace_messages,
   archive_and_compact, or session import, async-delegation completion
   events lost their task counts and fell back to generic display text.
   Add display_metadata to the INSERT columns and bind tuple.

3. CLI /resume stale recap: startup --resume A set _resume_display_history
   from A's lineage. A subsequent in-session /resume B loaded B only into
   conversation_history via get_messages_as_conversation, leaving the stale
   A display projection. _display_resumed_history preferentially read the
   stale attribute, showing A's recap for B. Switch /resume to
   get_resume_conversations and update _resume_display_history alongside
   conversation_history.

Tests: 890 Python (5 files), 35 desktop TS — all green.

* feat(tui): render typed display events as ◈ markers in the Ink TUI

The TUI was not handling display_kind at all — model switch markers and
async delegation completions rendered as opaque user messages with the
full [System: ...] text, and hidden compaction handoffs were visible.

Wire display_kind through the full TUI chain:

- _history_to_messages (tui_gateway/server.py) forwards display_kind
  and display_metadata to the gateway transcript payload.
- GatewayTranscriptMessage (gatewayTypes.ts) gains both fields.
- Msg.kind (types.ts) gains 'event' value.
- toTranscriptMessages (domain/messages.ts) maps:
  - hidden → skip entirely
  - model_switch → event "model changed"
  - async_delegation_complete → event "N background agents finished"
    (or "background agent work finished" without metadata)
- messageGroup (blockLayout.ts) routes event to its own group, with
  SELF_SPACED + PAINTS_TRAILING_GAP so it owns its margins.
- messageLine.tsx renders event-kind as a dim ◈ marker with no gutter,
  matching the CLI's ◈ event rendering.
- 4 new TUI tests for hidden/model_switch/async_delegation mapping.

TUI typecheck: clean. TUI lint: 0 errors (2 pre-existing warnings).
TUI tests: 9 passed (1 pre-existing failure on main, unrelated).
2026-07-23 14:46:24 -04:00
..
activeSessionSwitcher.test.ts feat(ui-tui): background-aware theme adaptation + paired palettes + /theme pin 2026-07-21 16:36:57 -05:00
appChromeStatusRule.test.tsx feat(status-bar): add /battery toggle for a color-coded battery read-out 2026-07-21 13:54:11 -05:00
appChromeStatusRuleDevCredits.test.tsx style(desktop,tui): fix all lint/type/formatting issues 2026-06-26 01:04:33 -05:00
approvalAction.test.ts fmt(js): npm run fix on merge (#65229) 2026-07-15 21:40:56 +00:00
asCommandDispatch.test.ts feat(tui): wire /rewind through command.dispatch + prefill payload (#21910) 2026-06-01 01:22:38 -07:00
billingStepUp.test.tsx fix(billing): rename user-facing "terminal billing" copy to Remote Spending (#68355) 2026-07-21 12:20:25 +05:30
blockLayout.test.ts style(desktop,tui): fix all lint/type/formatting issues 2026-06-26 01:04:33 -05:00
brandingMcpCount.test.ts fix(tui): MCP headline counts connected servers, not disabled ones (#48402) 2026-06-18 05:41:19 -07:00
bundleNoAsyncEsmDeadlock.test.ts fmt(js): npm run fix on merge (#65229) 2026-07-15 21:40:56 +00:00
charts.test.ts feat(ui-tui): widget primitives — charts, accordion, shimmer, stable streams 2026-07-21 20:59:54 -05:00
clipboard.test.ts style(desktop,tui): fix all lint/type/formatting issues 2026-06-26 01:04:33 -05:00
completionApply.test.ts fix(tui): don't make Enter swallow trailing-space-only slash completions (#48425) 2026-06-18 11:04:59 -05:00
constants.test.ts test(tui): tighten redraw hotkey review follow-ups 2026-04-27 12:30:40 -05:00
createGatewayEventHandler.test.ts feat(tui): billing wall opens a confirm dialog 2026-07-22 18:09:08 -05:00
createSlashHandler.test.ts feat(ui-tui): widget-app SDK — registry, host, dispatch; demos become apps 2026-07-21 20:59:52 -05:00
cursorDriftRegression.test.ts tests(tui): longer timeout for wrap ansi test 2026-07-13 17:22:17 -04:00
details.test.ts fix(tui): apply details mode live 2026-04-26 13:34:33 -05:00
emoji.test.ts fix(tui): inject VS16 so text-default emoji render as color glyphs 2026-04-21 15:52:39 -05:00
externalLink.test.ts style(desktop,tui): fix all lint/type/formatting issues 2026-06-26 01:04:33 -05:00
forceTruecolor.test.ts fix(tui): harden Terminal.app render behavior 2026-05-16 22:51:51 -05:00
gatewayClient.test.ts fix(tui): defer buffered gateway events to stop dashboard chat #301 (#36658) 2026-06-28 14:18:47 +05:30
gatewayRecovery.test.ts fix(tui): auto-recover session on unexpected gateway death (+ persist lifecycle breadcrumbs) (#35893) 2026-05-31 10:36:57 -05:00
gracefulExit.test.ts fix(tui): restart dashboard chat on idle exit hotkeys 2026-06-19 12:02:22 +05:30
journeyCommand.test.ts feat(journey): CLI + TUI learning timeline (/journey) 2026-06-30 04:44:58 -05:00
loaders.test.ts perf(ui-tui): shimmer loaders share one clock and stop after a bounded period 2026-07-21 20:29:48 -05:00
markdown.test.ts fix(tui): preserve dunder identifiers in markdown 2026-05-19 00:06:08 -07:00
mathUnicode.test.ts style(desktop,tui): fix all lint/type/formatting issues 2026-06-26 01:04:33 -05:00
memoryMonitor.test.ts style(desktop,tui): fix all lint/type/formatting issues 2026-06-26 01:04:33 -05:00
messageLine.test.ts fix(tui): delineate assistant responses from details (#31087) 2026-05-25 10:23:03 -05:00
messages.test.ts fix(timeline): persist typed display events (#69771) 2026-07-23 14:46:24 -04:00
modelPicker.test.ts fmt(js): npm run fix on merge (#65229) 2026-07-15 21:40:56 +00:00
orchestratorPromptSession.test.ts fix(tui): preserve picker session scope across all paths 2026-07-11 08:39:17 -07:00
osc52.test.ts fix(tui): raise picker selection contrast with inverse + bold 2026-04-21 14:31:21 -05:00
overlayPrimitives.test.ts fix(ui-tui): overlay width caps are absolute — clampOverlayWidth (Copilot review) 2026-07-21 16:36:58 -05:00
parentLog.test.ts style(desktop,tui): fix all lint/type/formatting issues 2026-06-26 01:04:33 -05:00
paths.test.ts feat: unify active-project identity in chat status (supersedes #64721) 2026-07-18 23:08:13 -04:00
petPane.test.tsx feat(tui): float petdex pet bottom-right with responsive text reservation 2026-06-30 15:41:44 -05:00
platform.test.ts style(desktop,tui): fix all lint/type/formatting issues 2026-06-26 01:04:33 -05:00
precisionWheel.test.ts fix(tui): steady transcript scrollbar (#20917) 2026-05-06 14:50:31 -07:00
prompt.test.ts fix(tui): termux-gate composer rendering tweaks for Ink TUI 2026-05-21 19:08:38 -07:00
providers.test.ts chore(tui): /clean pass — inline one-off locals, tighten ConfirmPrompt 2026-04-19 07:55:38 -05:00
reasoning.test.ts fix(tui): anchor splitReasoning unclosed-tag regex to start of input (#29426) 2026-05-20 14:09:38 -05:00
rpc.test.ts fix(ui-tui): surface RPC errors and guard invalid gateway responses 2026-04-13 14:17:52 -05:00
scroll.test.ts fix(tui): refresh scroll height at cached bottom 2026-05-07 05:48:19 -07:00
slashParity.test.ts test(tui): regression test for /q alias resolving to queue (#31983) 2026-05-25 12:48:46 +00:00
spawnHistoryStore.test.ts fix(tui): handle timeout/error subagent statuses in /agents (#26687) 2026-05-15 20:19:02 -05:00
stateIsolation.test.ts fix(tui): isolate turn state from app render 2026-04-26 15:40:38 -05:00
statusBarTicker.test.ts feat(tui): segment turns with rule above non-first user msgs; trim ticker dead space (#21846) 2026-05-08 05:12:09 -07:00
statusRule.test.ts fmt(js): npm run fix on merge (#65229) 2026-07-15 21:40:56 +00:00
streamingMarkdown.test.ts perf(tui): render streamed markdown incrementally per block 2026-07-18 21:14:05 -04:00
subagentTree.test.ts fix: stop reporting cache-hit rate and cost across all UI surfaces (#52717) 2026-06-25 15:21:22 -07:00
submissionCore.test.ts refactor(tui): drive the vibe heart from the core reaction event 2026-07-10 05:42:08 -05:00
subscriptionCommand.test.ts feat(tui+cli): change your Nous plan from the terminal (/subscription, /topup, terminal-billing UX) (#51639) 2026-07-18 14:30:24 +05:30
subscriptionOverlay.test.tsx feat(billing): plan chips and rows deep-link their tier (#68666) 2026-07-21 22:42:14 +05:30
syntax.test.ts fix(tui): restore macOS copy behavior and theme polish (#17131) 2026-04-28 18:47:14 -05:00
terminalModes.test.ts fix(ui-tui): skin owns BOTH terminal defaults — OSC-10 foreground beside the OSC-11 background 2026-07-22 16:28:57 -05:00
terminalParity.test.ts fix(tui): restore macOS copy behavior and theme polish (#17131) 2026-04-28 18:47:14 -05:00
terminalSetup.test.ts fix(ci): make tests, workflows, and attribution reliable under load (#66373) 2026-07-17 20:55:24 +00:00
termux.test.ts style(desktop,tui): fix all lint/type/formatting issues 2026-06-26 01:04:33 -05:00
termuxComposerLayout.test.ts fix(tui): termux-gate composer rendering tweaks for Ink TUI 2026-05-21 19:08:38 -07:00
text.test.ts fix(tui): stop persisting full tool output in trail lines (silent OOM death) 2026-06-03 06:00:22 -07:00
textInputBurstInput.test.ts style(desktop,tui): fix all lint/type/formatting issues 2026-06-26 01:04:33 -05:00
textInputCursorSourceOfTruth.test.ts fmt(js): npm run fix on merge (#65229) 2026-07-15 21:40:56 +00:00
textInputFastEcho.test.ts fix(ui-tui): themed input text — typed text tracked the HOST terminal's fg, not the skin's 2026-07-22 15:56:39 -05:00
textInputLineNav.test.ts fix(tui): up-arrow inside a multi-line buffer moves cursor, not history 2026-04-21 18:31:35 -05:00
textInputPassThrough.test.ts style(desktop,tui): fix all lint/type/formatting issues 2026-06-26 01:04:33 -05:00
textInputRightClick.test.ts fix(tui): right-click copies selection, only pastes when no selection 2026-05-10 16:06:33 -07:00
textInputWrap.test.ts review(tui): route cursorLayout through @hermes/ink wrapAnsi shim (Bun runtime parity) 2026-05-17 11:52:21 -05:00
theme.test.ts fix(ui-tui): a skin that authors a background owns its polarity 2026-07-22 18:11:27 -05:00
themeBoot.test.ts fmt(js): prettier pass on the new review tests 2026-07-21 20:29:48 -05:00
topupCommand.test.ts fix(billing): rename user-facing "terminal billing" copy to Remote Spending (#68355) 2026-07-21 12:20:25 +05:30
turnControllerNotice.test.ts fmt(js): npm run fix on merge (#66834) 2026-07-18 09:06:55 +00:00
turnStore.test.ts chore(tui): remove dead branch cleanup code 2026-04-26 21:54:24 -05:00
usageCommand.test.ts fmt(js): npm run fix on merge (#66834) 2026-07-18 09:06:55 +00:00
useBatteryPoll.test.ts feat(status-bar): add /battery toggle for a color-coded battery read-out 2026-07-21 13:54:11 -05:00
useCompletion.test.ts fix(tui): complete absolute paths as paths 2026-05-04 16:14:40 -07:00
useComposerState.test.ts fix(tui): raise picker selection contrast with inverse + bold 2026-04-21 14:31:21 -05:00
useConfigSync.test.ts fmt(js): prettier pass on the new review tests 2026-07-21 20:29:48 -05:00
useInputHandlers.test.ts feat(ui-tui): widget-app SDK — registry, host, dispatch; demos become apps 2026-07-21 20:59:52 -05:00
useQueue.test.ts fix(tui): copilot review on #16707 — naming, label consistency, esc priority 2026-04-27 15:37:54 -05:00
userWidgets.test.ts feat(ui-tui): self-authored widgets — user-widget loader, hot-load, skill 2026-07-21 20:59:54 -05:00
useSessionLifecycle.test.ts fix(tui): redraw dashboard after new session (#65239) 2026-07-15 21:23:08 -04:00
useVirtualHistoryHeights.test.ts perf(tui): lazily seed virtual history heights (#16523) 2026-04-27 07:55:45 -07:00
viewport.test.ts fix(tui): stabilize sticky prompt tracking 2026-04-28 22:10:40 -05:00
viewportStore.test.ts style(desktop,tui): fix all lint/type/formatting issues 2026-06-26 01:04:33 -05:00
virtualHeights.test.ts fix(js): fix long-time broken tests 2026-07-13 17:22:17 -04:00
virtualHistoryClamp.test.ts fix(tui): stabilize live progress rendering 2026-04-26 15:23:43 -05:00
virtualHistoryOffsetCache.test.ts style(desktop,tui): fix all lint/type/formatting issues 2026-06-26 01:04:33 -05:00
weatherApp.test.ts feat(ui-tui): ambient widget mode — registry-driven slash catalog + in-flow dock 2026-07-21 20:59:53 -05:00
wheelAccel.test.ts chore(tui): /clean recent perf work — KISS/DRY pass 2026-04-26 20:38:47 -05:00
widgetGrid.test.ts fmt(js): npm run fix on merge (#68976) 2026-07-21 22:59:05 +00:00
widgetGridComponent.test.tsx feat(ui-tui): widget-app SDK — registry, host, dispatch; demos become apps 2026-07-21 20:59:52 -05:00
widgetSdk.test.ts refactor(ui-tui): host placement router + grid-test width-floor fix 2026-07-21 20:59:55 -05:00