hermes-agent/apps/desktop/src/lib
brooklyn! 3139a30e52
perf(desktop): multi-tile grids stop lagging — evict leaked session states, index lineage aliases, split the turn journal (#83133)
* fix(desktop): evict settled session states nothing on screen references

Closing a tile never removed its runtime's entry from $sessionStates, so
every tile ever closed parked its full transcript in the map for the life
of the process. Each leftover entry taxes every subsequent stream flush —
the map is spread-copied per delta and the busy/attention/draft projections
walk every entry per publish — so the app got slower the longer it ran,
which users read as "I need to clean my sessions/dbs".

Publish now evicts a settling state when no tile and not the primary view
holds its runtime (transition side effects still fire, so the settle keeps
its unread dot), and closing a tile drops an already-settled state on the
spot. Busy and needs-input states stay: background turns feed the sidebar
dots, and a first publish always lands because a resume can publish a beat
before the surface binds the runtime.

16 tiles streaming in a 2x2 grid with a day's worth of closed-tile residue:
worst-second 34 -> 58 fps, p99 frame 90 -> 28 ms, longtasks 37 -> 0.

* perf(desktop): index lineage aliases per sessions-list reference

lineageAliases scanned the whole recents list per call, and it is called
per cached session state per status projection per message delta — with a
populated sessions DB and a few busy sessions that multiplied out to
millions of row checks a second during streaming. Build the alias index
once per list reference (the list is replaced wholesale, never mutated)
and look aliases up in O(1).

* perf(desktop): journal each in-flight turn under its own storage key

The v1 journal kept every session's tail in one localStorage key, so each
throttled write re-parsed and re-stringified EVERY busy session's snapshot
— a grid of concurrent streams turned that into a whole-store JSON round
trip dozens of times a second, all on the main thread. Per-session keys
make a write O(own tail) no matter how many other sessions are streaming.
A v1 store migrates on first touch; expired/overflow crash residue is
pruned once per renderer.

* perf(desktop): stress the multitab scenario across grid/streaming/DB axes

The one-stack multitab run hid every cost this round of fixes removed: it
drove hook.publish (store only — no journal, no wiring cache), with an
empty recents list and no closed-tile residue. Streaming now routes through
hook.update (the real gateway write path), and the scenario grows axes for
the workloads users actually hit: --zones splits tiles across visible grid
zones, --streaming caps how many sessions are mid-turn (zone leaders
first), --sessions seeds a lived-in recents list, --dead models settled
sessions no surface references. launch.mjs pins HERMES_DESKTOP_CDP_PORT so
a non-default --port survives the app's own dev-CDP flag.
2026-08-10 10:45:43 +00:00
..
keybinds fix(desktop): list HUD snap chord in keyboard shortcuts panel 2026-08-10 05:21:07 -05:00
ansi.test.ts
…
ansi.ts
…
artifact-detect.test.ts
…
artifact-detect.ts
…
brand-icon.test.ts
…
brand-icon.ts
…
chat-messages.test.ts fmt(js): `npm run fix` on merge (#82962) 2026-08-10 05:40:43 +00:00
chat-messages.ts fix(gateway): keep the personality pivot out of the truncate ordinal space (#82756) 2026-08-10 11:01:15 +05:30
chat-runtime.test.ts
…
chat-runtime.ts fix(personality): single-owner personality state + one-time reset migration 2026-08-09 10:33:58 -07:00
clipboard.ts
…
commit-changelog.test.ts
…
commit-changelog.ts
…
completion-sound.ts
…
composer-input-sanitize.test.ts
…
composer-input-sanitize.ts
…
desktop-fs.test.ts
…
desktop-fs.ts
…
desktop-git.test.ts
…
desktop-git.ts feat(desktop): resolve a session's pull request 2026-08-09 06:21:04 -05:00
desktop-remote-auth.test.ts
…
desktop-remote-auth.ts
…
desktop-slash-commands.test.ts
…
desktop-slash-commands.ts
…
desktop-toolsets.test.ts
…
desktop-toolsets.ts
…
display-path.test.ts
…
display-path.ts
…
download-text.ts
…
draft-title.ts fmt(js): `npm run fix` on merge (#82417) 2026-08-09 09:51:41 +00:00
drag-ghost.ts
…
embedded-images.test.ts
…
embedded-images.ts
…
escape-layers.test.ts
…
escape-layers.ts
…
excluded-paths.ts
…
external-link.test.tsx
…
external-link.tsx
…
find-in-page.ts
…
format.ts
…
gateway-events.test.ts
…
gateway-events.ts
…
gateway-rpc.test.ts
…
gateway-rpc.ts
…
gateway-ws-url.test.ts
…
generated-images.test.ts
…
generated-images.ts
…
guest-pointer-guard.ts fix(desktop): don't let webview guests swallow drag gestures 2026-08-10 04:52:19 -05:00
haptics.ts
…
icons.ts
…
incremental-external-store-runtime.test.ts
…
incremental-external-store-runtime.ts
…
inflight-turn-journal.test.ts perf(desktop): multi-tile grids stop lagging — evict leaked session states, index lineage aliases, split the turn journal (#83133) 2026-08-10 10:45:43 +00:00
inflight-turn-journal.ts perf(desktop): multi-tile grids stop lagging — evict leaked session states, index lineage aliases, split the turn journal (#83133) 2026-08-10 10:45:43 +00:00
input-modality.test.ts
…
input-modality.ts
…
json-format.test.ts
…
json-format.ts
…
json-rpc-gateway-url-guard.test.ts
…
katex-memo.ts
…
loadout.ts
…
local-preview.test.ts
…
local-preview.ts
…
markdown-blocks.test.ts
…
markdown-blocks.ts
…
markdown-code.test.ts
…
markdown-code.ts
…
markdown-preprocess.ts
…
mcp-dashboard-oauth.test.ts
…
mcp-dashboard-oauth.ts
…
mcp-tool-filter.test.ts
…
mcp-tool-filter.ts
…
media.remote.test.ts
…
media.ts
…
middle-click.test.tsx
…
middle-click.ts
…
model-options.test.ts
…
model-options.ts
…
model-search-text.ts
…
model-status-label.test.ts
…
model-status-label.ts
…
mutable-ref.ts
…
oneshot.ts
…
path-compare.test.ts refactor(desktop): one path-comparison helper instead of two 2026-08-08 14:50:43 -05:00
path-compare.ts refactor(desktop): one path-comparison helper instead of two 2026-08-08 14:50:43 -05:00
persisted.ts
…
personalities.ts fix(personality): single-owner personality state + one-time reset migration 2026-08-09 10:33:58 -07:00
pool.test.ts
…
pool.ts
…
preview-targets.test.ts
…
preview-targets.ts
…
profile-color.ts
…
project-idea-templates.ts
…
provider-setup-errors.test.ts
…
provider-setup-errors.ts
…
query-client.test.ts
…
query-client.ts
…
raf-coalesce.ts
…
reasoning-blocks.test.ts
…
reasoning-blocks.ts
…
reasoning-effort.test.ts
…
reasoning-effort.ts
…
reconnect-backoff.test.ts
…
reconnect-backoff.ts
…
remote-url.test.ts
…
remote-url.ts
…
render-weight.test.ts
…
render-weight.ts
…
renderer-loop-pause.ts
…
reorder.ts
…
runtime-readiness.test.ts
…
runtime-readiness.ts
…
sanitize.test.ts
…
sanitize.ts
…
selectable-card.ts
…
session-branch-tree.test.ts
…
session-branch-tree.ts
…
session-date-groups.test.ts
…
session-date-groups.ts feat(desktop): sidebar filter menu 2026-08-09 06:21:15 -05:00
session-export.ts
…
session-ids.test.ts
…
session-ids.ts
…
session-link-title.test.ts
…
session-link-title.ts
…
session-refs.test.ts
…
session-refs.ts
…
session-search.test.ts
…
session-search.ts
…
session-signatures.test.ts
…
session-signatures.ts
…
session-source.test.ts
…
session-source.ts
…
slash-completion-cache.ts
…
speech-text.test.ts
…
speech-text.ts
…
stable-array.ts refactor(desktop): give the status dot one source of truth and a quieter look 2026-08-08 16:26:48 -05:00
statusbar.tsx
…
storage.test.ts
…
storage.ts
…
summarize-command.test.ts
…
summarize-command.ts
…
svg-image.ts
…
text.ts
…
thinking-sound.test.ts
…
thinking-sound.ts
…
time.test.ts fmt(js): `npm run fix` on merge (#82000) 2026-08-08 20:29:52 +00:00
time.ts
…
todos.test.ts
…
todos.ts
…
tool-render-class.ts
…
tool-result-summary.test.ts
…
tool-result-summary.ts
…
tool-run-continuity.test.ts
…
trackpad-gestures.ts
…
update-copy.test.ts
…
update-copy.ts
…
use-enter-animation.test.tsx
…
use-enter-animation.ts
…
use-session-slice.ts
…
utils.ts
…
version-status.test.ts
…
version-status.ts
…
voice-barge-in.ts
…
voice-playback.ts
…
voice-stop-word.test.ts
…
voice-stop-word.ts
…
wake-client-capture.ts
…
wake-indicator.test.ts
…
wake-indicator.ts
…
wake-sound.test.ts
…
wake-sound.ts
…
yolo-session.ts
…