hermes-agent/apps/desktop/scripts
Brooklyn Nicholson 99f2a9503c chore(desktop): synthetic-stream perf harness + scripts
Drops the React `<Profiler>` approach (no-op because Vite is currently
serving the production React build) in favor of an externally-observable
measurement stack: rAF frame intervals, `PerformanceObserver({entryTypes:
['longtask']})`, and a `MutationObserver` on the live streaming message.

Adds a synthetic stream driver — `window.__PERF_DRIVE__.stream({...})` —
that pushes tokens through the live `$messages` atom at a controlled rate,
so the assistant-ui runtime, incremental repository, and Streamdown
markdown pipeline see the same workload they'd see during a real LLM
stream, without the LLM cost.

The driver lives in `src/app/chat/perf-probe.tsx`; `main.tsx` side-imports
it under `import.meta.env.MODE !== 'production'` so it tree-shakes out of
prod builds. (Using `MODE` rather than `DEV` because our Vite setup
currently reports `DEV=false` even under `vite dev` — see the dev-build
note in `profile-typing-lag.md`.)

Scripts:
  - measure-synthetic-stream.mjs  drive synthetic + record frame/longtask/mutation
  - profile-synth-stream.mjs      CPU profile + top self-time during synthetic
  - measure-real-stream.mjs       same harness, real LLM stream
  - profile-real-stream.mjs       CPU profile bracketing the real stream window
  - eval.mjs / reload.mjs         small CDP helpers

A real-LLM measurement on Cloud Shadows (gpt-4o-mini, 39 s window) showed
12 longtasks in the same 75-127 ms range the synthetic predicted, so the
synthetic is a faithful proxy.
2026-05-21 19:38:26 -05:00
..
assert-root-install.cjs Improve desktop runtime UX by surfacing inference readiness in gateway status and hardening WSL link opening. 2026-05-15 16:33:04 -05:00
before-build.cjs feat(desktop): thin installer + first-launch install.ps1 bootstrap 2026-05-18 02:26:46 -04:00
click-session.mjs Revert "Revert "perf(desktop): cut per-keystroke layout + listener churn in chat composer"" 2026-05-21 18:57:18 -05:00
dev-no-hmr.mjs Revert "Revert "perf(desktop): cut per-keystroke layout + listener churn in chat composer"" 2026-05-21 18:57:18 -05:00
diag-jump.mjs perf(desktop): fix "Enter jumps up" on long threads 2026-05-21 17:45:55 -05:00
eval.mjs chore(desktop): synthetic-stream perf harness + scripts 2026-05-21 19:38:26 -05:00
leak-typing.mjs Revert "Revert "perf(desktop): cut per-keystroke layout + listener churn in chat composer"" 2026-05-21 18:57:18 -05:00
measure-jump.mjs perf(desktop): fix "Enter jumps up" on long threads 2026-05-21 17:45:55 -05:00
measure-latency.mjs Revert "Revert "perf(desktop): cut per-keystroke layout + listener churn in chat composer"" 2026-05-21 18:57:18 -05:00
measure-real-stream.mjs chore(desktop): synthetic-stream perf harness + scripts 2026-05-21 19:38:26 -05:00
measure-submit.mjs Revert "Revert "perf(desktop): cut per-keystroke layout + listener churn in chat composer"" 2026-05-21 18:57:18 -05:00
measure-synthetic-stream.mjs chore(desktop): synthetic-stream perf harness + scripts 2026-05-21 19:38:26 -05:00
notarize-artifact.cjs fix(desktop): address CodeQL alerts on PR #20059 2026-05-11 16:52:32 -04:00
notarize.cjs ci(desktop): automate desktop releases 2026-05-05 13:04:33 -05:00
probe-renderer.mjs Revert "Revert "perf(desktop): cut per-keystroke layout + listener churn in chat composer"" 2026-05-21 18:57:18 -05:00
probe-thread.mjs perf(desktop): fix "Enter jumps up" on long threads 2026-05-21 17:45:55 -05:00
profile-long-stream.mjs perf(desktop): rate-limit thread auto-pin during streaming 2026-05-21 18:02:26 -05:00
profile-real-stream.mjs chore(desktop): synthetic-stream perf harness + scripts 2026-05-21 19:38:26 -05:00
profile-synth-stream.mjs chore(desktop): synthetic-stream perf harness + scripts 2026-05-21 19:38:26 -05:00
profile-typing-lag.md chore(desktop): synthetic-stream perf harness + scripts 2026-05-21 19:38:26 -05:00
profile-typing.mjs Revert "Revert "perf(desktop): cut per-keystroke layout + listener churn in chat composer"" 2026-05-21 18:57:18 -05:00
reload-renderer.mjs Revert "Revert "perf(desktop): cut per-keystroke layout + listener churn in chat composer"" 2026-05-21 18:57:18 -05:00
reload.mjs chore(desktop): synthetic-stream perf harness + scripts 2026-05-21 19:38:26 -05:00
stage-native-deps.cjs desktop: swap node-pty fork for upstream microsoft/node-pty 1.1.0 2026-05-18 21:50:53 -07:00
test-desktop.mjs desktop: swap node-pty fork for upstream microsoft/node-pty 1.1.0 2026-05-18 21:50:53 -07:00
write-build-stamp.cjs feat(desktop): thin installer + first-launch install.ps1 bootstrap 2026-05-18 02:26:46 -04:00