hermes-agent/apps/desktop/src/lib
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
..
keybinds fix(desktop): let clarify choices and overlays keep their keys from type-to-focus (#69869) 2026-07-23 00:04:12 -05:00
ansi.test.ts fix(desktop): triage batch of GUI quality-of-life fixes (#37536) 2026-06-02 16:33:22 -04:00
ansi.ts desktop: registry-driven slash commands + first-class /resume & /handoff (#42351) 2026-06-11 01:49:24 +00:00
chat-messages.test.ts fix(timeline): persist typed display events (#69771) 2026-07-23 14:46:24 -04:00
chat-messages.ts fix(timeline): persist typed display events (#69771) 2026-07-23 14:46:24 -04:00
chat-runtime.test.ts fix(desktop): parse multiline slash commands + hand degenerate payloads back 2026-07-02 11:36:21 -05:00
chat-runtime.ts fix(desktop): no per-paragraph action bars on sealed interim messages 2026-07-22 11:31:03 -05:00
clipboard.ts Add Hermes desktop app (#20059) 2026-05-31 17:46:56 -05:00
commit-changelog.test.ts Add Hermes desktop app (#20059) 2026-05-31 17:46:56 -05:00
commit-changelog.ts refactor(desktop): adopt shared utils + app-wide cleanups 2026-07-03 13:48:44 -05:00
completion-sound.ts refactor(desktop): tidy the cross-window deduper 2026-07-20 18:36:05 -05:00
composer-input-sanitize.test.ts test(input): preservation regressions and prompt.submit boundary (#62557) 2026-07-15 07:39:42 -07:00
composer-input-sanitize.ts fix(desktop): resolve eslint errors in composer-input-sanitize.ts 2026-07-16 01:42:02 +05:30
desktop-fs.test.ts style(desktop): satisfy merged eslint/prettier config 2026-07-20 23:01:49 +02:00
desktop-fs.ts style(desktop): satisfy merged eslint/prettier config 2026-07-20 23:01:49 +02:00
desktop-git.test.ts fix(desktop): salvage /compress cluster — session.compress RPC + dedicated RPC routing (#68229) 2026-07-22 16:40:06 -04:00
desktop-git.ts fix(desktop): salvage /compress cluster — session.compress RPC + dedicated RPC routing (#68229) 2026-07-22 16:40:06 -04:00
desktop-slash-commands.test.ts fix(desktop): salvage /compress cluster — session.compress RPC + dedicated RPC routing (#68229) 2026-07-22 16:40:06 -04:00
desktop-slash-commands.ts fmt(js): npm run fix on merge (#69644) 2026-07-22 21:56:16 +00:00
desktop-toolsets.test.ts fix(desktop): hide platform/internal toolsets from the Skills & Tools list 2026-06-24 19:18:29 -05:00
desktop-toolsets.ts fix(desktop): hide platform/internal toolsets from the Skills & Tools list 2026-06-24 19:18:29 -05:00
drag-ghost.ts fix(desktop): session-tab drag, focus sync, and pop-out isolation 2026-07-15 03:13:33 -04:00
embedded-images.test.ts fix(desktop): avoid stack overflow on embedded image replay 2026-06-22 18:19:36 -05:00
embedded-images.ts style(desktop,tui): fix all lint/type/formatting issues 2026-06-26 01:04:33 -05:00
escape-layers.test.ts feat(desktop): store + lib — layout/preview/session atoms, escape-layers, keybind helpers 2026-07-13 17:57:54 -04:00
escape-layers.ts feat(desktop): store + lib — layout/preview/session atoms, escape-layers, keybind helpers 2026-07-13 17:57:54 -04:00
excluded-paths.ts style(desktop,tui): fix all lint/type/formatting issues 2026-06-26 01:04:33 -05:00
external-link.test.tsx fix(desktop): render debug-report paste URLs as real clickable links 2026-06-08 21:35:21 -04:00
external-link.tsx fix(desktop): render debug-report paste URLs as real clickable links 2026-06-08 21:35:21 -04:00
format.ts feat(desktop): Capabilities foundation — shared utils, master-detail, editors, primitives 2026-07-03 05:08:13 -05:00
gateway-events.test.ts fix(desktop, ink): don't wipe messages before final message (#65919) 2026-07-20 11:42:29 -04:00
gateway-events.ts fix(desktop, ink): don't wipe messages before final message (#65919) 2026-07-20 11:42:29 -04:00
gateway-rpc.test.ts fix(desktop): dismiss stale prompt overlays 2026-07-08 16:52:10 +02:00
gateway-rpc.ts fix(desktop): dismiss stale prompt overlays 2026-07-08 16:52:10 +02:00
gateway-ws-url.test.ts fix(desktop): avoid false remote gateway reauthentication (#68250) 2026-07-20 20:54:36 -04:00
generated-images.test.ts style(desktop,tui): fix all lint/type/formatting issues 2026-06-26 01:04:33 -05:00
generated-images.ts style(desktop,tui): fix all lint/type/formatting issues 2026-06-26 01:04:33 -05:00
haptics.ts feat(desktop): drag sessions into chat as @session links + spawn loader 2026-06-04 19:41:51 -05:00
icons.ts polish(desktop/billing): auto-poll, no-card notice, grouped card layout 2026-07-22 16:48:04 -05:00
incremental-external-store-runtime.ts fmt(js): npm run fix on merge (#65229) 2026-07-15 21:40:56 +00:00
json-format.test.ts feat(desktop): Capabilities foundation — shared utils, master-detail, editors, primitives 2026-07-03 05:08:13 -05:00
json-format.ts feat(desktop): Capabilities foundation — shared utils, master-detail, editors, primitives 2026-07-03 05:08:13 -05:00
json-rpc-gateway-url-guard.test.ts fmt(js): npm run fix on merge (#69562) 2026-07-22 19:01:09 +00:00
katex-memo.ts Add Hermes desktop app (#20059) 2026-05-31 17:46:56 -05:00
loadout.ts refactor(desktop): adopt shared utils + app-wide cleanups 2026-07-03 13:48:44 -05:00
local-preview.ts style(desktop,tui): fix all lint/type/formatting issues 2026-06-26 01:04:33 -05:00
markdown-blocks.test.ts test(desktop): raise timeout on markdown-blocks property fuzz 2026-07-18 18:53:41 -04:00
markdown-blocks.ts fix(desktop): correct incremental markdown split boundary (setext merge) 2026-07-18 18:21:58 -04:00
markdown-code.test.ts Add Hermes desktop app (#20059) 2026-05-31 17:46:56 -05:00
markdown-code.ts refactor(desktop): adopt shared utils + app-wide cleanups 2026-07-03 13:48:44 -05:00
markdown-preprocess.ts fix(desktop): preserve numeric and display LaTeX (#66173) 2026-07-17 19:02:18 -04:00
mcp-dashboard-oauth.test.ts fmt(js): npm run fix on merge (#66348) 2026-07-17 14:30:29 +00:00
mcp-dashboard-oauth.ts fmt(js): npm run fix on merge (#66348) 2026-07-17 14:30:29 +00:00
mcp-tool-filter.test.ts feat(mcp): first-class MCP tab — catalog, GUI auth/probe/logs, per-tool gating 2026-07-03 05:08:28 -05:00
mcp-tool-filter.ts feat(mcp): first-class MCP tab — catalog, GUI auth/probe/logs, per-tool gating 2026-07-03 05:08:28 -05:00
media.remote.test.ts fix(desktop): render remote markdown images in chat (#57944) 2026-07-23 00:16:20 -05:00
media.ts fix(desktop): render remote markdown images in chat (#57944) 2026-07-23 00:16:20 -05:00
model-options.test.ts fix(desktop): scope model options by profile (#62795) 2026-07-22 09:40:50 -04:00
model-options.ts fix(desktop): scope model options by profile (#62795) 2026-07-22 09:40:50 -04:00
model-status-label.test.ts feat(reasoning): add max and ultra effort levels (#62650) 2026-07-12 00:26:49 -07:00
model-status-label.ts feat(reasoning): add max and ultra effort levels (#62650) 2026-07-12 00:26:49 -07:00
mutable-ref.ts chore(desktop): zero eslint/typecheck debt + prettier pass (#39100) 2026-06-04 14:10:38 +00:00
oneshot.ts feat(desktop): add shared project UI primitives 2026-06-25 16:40:27 -05:00
persisted.ts feat(desktop): add shared project UI primitives 2026-06-25 16:40:27 -05:00
pool.test.ts style(desktop,tui): fix all lint/type/formatting issues 2026-06-26 01:04:33 -05:00
pool.ts feat(desktop): add shared project UI primitives 2026-06-25 16:40:27 -05:00
preview-targets.test.ts Add Hermes desktop app (#20059) 2026-05-31 17:46:56 -05:00
preview-targets.ts Add Hermes desktop app (#20059) 2026-05-31 17:46:56 -05:00
profile-color.ts style(desktop,tui): fix all lint/type/formatting issues 2026-06-26 01:04:33 -05:00
project-idea-templates.ts style(desktop,tui): fix all lint/type/formatting issues 2026-06-26 01:04:33 -05:00
provider-setup-errors.test.ts fix(desktop): stop spurious provider onboarding from credential warnings 2026-07-23 00:18:21 -05:00
provider-setup-errors.ts fix(desktop): stop spurious provider onboarding from credential warnings 2026-07-23 00:18:21 -05:00
query-client.test.ts perf(desktop): scope tool-diff subscriptions + narrow profile query invalidation 2026-07-18 19:15:57 -04:00
query-client.ts perf(desktop): scope tool-diff subscriptions + narrow profile query invalidation 2026-07-18 19:15:57 -04:00
raf-coalesce.ts refactor(desktop): extract shared rafCoalesce helper for sash drags 2026-07-19 22:38:57 -05:00
reorder.ts feat(desktop): store + lib — layout/preview/session atoms, escape-layers, keybind helpers 2026-07-13 17:57:54 -04:00
runtime-readiness.test.ts style(desktop,tui): fix all lint/type/formatting issues 2026-06-26 01:04:33 -05:00
runtime-readiness.ts style(desktop,tui): fix all lint/type/formatting issues 2026-06-26 01:04:33 -05:00
sanitize.test.ts feat(desktop): add shared project UI primitives 2026-06-25 16:40:27 -05:00
sanitize.ts feat(desktop): add shared project UI primitives 2026-06-25 16:40:27 -05:00
selectable-card.ts feat(desktop): floating pet, pop-out overlay + Cmd+K picker 2026-06-20 14:18:40 -05:00
session-branch-tree.test.ts feat(desktop): add shared project UI primitives 2026-06-25 16:40:27 -05:00
session-branch-tree.ts style(desktop,tui): fix all lint/type/formatting issues 2026-06-26 01:04:33 -05:00
session-export.ts fix(desktop): route profile session reads 2026-06-11 18:09:24 -05:00
session-ids.test.ts test(desktop): cover runtime->stored notification id resolution 2026-06-19 17:50:35 +05:30
session-ids.ts fix(desktop): resume stored session id on notification click 2026-06-19 17:50:35 +05:30
session-search.test.ts fix(desktop): match sessions by git branch in ctrl-k palette and sidebar search (#65172) 2026-07-15 15:37:12 -04:00
session-search.ts fix(desktop): match sessions by git branch in ctrl-k palette and sidebar search (#65172) 2026-07-15 15:37:12 -04:00
session-signatures.test.ts fmt(js): npm run fix on merge (#65229) 2026-07-15 21:40:56 +00:00
session-signatures.ts feat(desktop): store + lib — layout/preview/session atoms, escape-layers, keybind helpers 2026-07-13 17:57:54 -04:00
session-source.ts refactor(desktop): adopt shared utils + app-wide cleanups 2026-07-03 13:48:44 -05:00
speech-text.ts Add Hermes desktop app (#20059) 2026-05-31 17:46:56 -05:00
stable-array.ts refactor(desktop): DRY the computed-dedup into stableArray + freeze 2026-07-19 19:46:09 -05:00
statusbar.tsx fix(desktop): prevent timers from shifting as they count (#68131) 2026-07-20 16:39:20 +00:00
storage.test.ts fix(desktop): keep recents sorted unless manually reordered (#45404) 2026-06-13 00:38:10 -05:00
storage.ts feat(desktop): store + lib — layout/preview/session atoms, escape-layers, keybind helpers 2026-07-13 17:57:54 -04:00
summarize-command.test.ts style(desktop,tui): fix all lint/type/formatting issues 2026-06-26 01:04:33 -05:00
summarize-command.ts fix(desktop): compact tool row titles 2026-06-25 00:01:11 -05:00
svg-image.ts feat(desktop): zoomable primitive — open full, pan/zoom, copy 2026-06-26 03:40:49 -05:00
text.ts feat(desktop): Capabilities foundation — shared utils, master-detail, editors, primitives 2026-07-03 05:08:13 -05:00
time.test.ts fmt(js): npm run fix on merge (#69562) 2026-07-22 19:01:09 +00:00
time.ts refine inline message actions: fork icon, sine-wave read-aloud, shared age util 2026-07-22 12:18:59 -05:00
todos.test.ts feat(desktop): composer status stack, live subagent windows, editable prompts (#44630) 2026-06-12 08:30:06 -05:00
todos.ts feat(desktop): composer status stack, live subagent windows, editable prompts (#44630) 2026-06-12 08:30:06 -05:00
tool-result-summary.test.ts Add Hermes desktop app (#20059) 2026-05-31 17:46:56 -05:00
tool-result-summary.ts refactor(desktop): adopt shared utils + app-wide cleanups 2026-07-03 13:48:44 -05:00
trackpad-gestures.ts feat(desktop): Memory Graph — playable radial timeline of memories + skills 2026-06-30 00:54:21 -05:00
update-copy.test.ts fix(desktop): name the update target in the overlay; honest no-changelog copy 2026-06-08 08:58:26 -07:00
update-copy.ts fix(desktop): name the update target in the overlay; honest no-changelog copy 2026-06-08 08:58:26 -07:00
use-enter-animation.ts fix(desktop): prevent IME Enter from splitting messages and viewport resize from disarming scroll anchor (#38333) 2026-06-03 20:14:52 +00:00
use-session-slice.ts perf(desktop): stop ChatBar re-rendering on cross-session status/queue churn 2026-06-30 04:19:10 -05:00
utils.ts Add Hermes desktop app (#20059) 2026-05-31 17:46:56 -05:00
voice-barge-in.ts feat(voice): desktop speech-stream sessions with barge-in capture 2026-07-22 17:47:25 -05:00
voice-playback.ts feat(voice): desktop flags interrupted submits 2026-07-22 17:53:06 -05:00
yolo-session.ts style(desktop,tui): fix all lint/type/formatting issues 2026-06-26 01:04:33 -05:00