hermes-agent/apps/desktop/scripts
brooklyn! d1c455acf7
bench(desktop): systematized perf harness; sunset 12 one-off scripts (#67466)
Replaces the dozen ad-hoc measure-*/profile-* scripts (each reinventing the
CDP client — 4 different copies — plus its own arg parsing, stats, output
path, and none with a baseline) with one framework under scripts/perf/:

- lib/cdp.mjs      one CDP client + target discovery + typing + CPU-profile wrapper + DOM selectors
- lib/stats.mjs    percentiles, histograms, CPU-profile self-time ranking
- lib/baseline.mjs load/compare/update baseline + regression gate (new capability)
- lib/launch.mjs   attach, OR spawn a fully ISOLATED instance
- scenarios/*      one module per measurement, registered in scenarios/index.mjs
- run.mjs / serve.mjs, baseline.json, README.md

Isolation solves the long-standing measurement blocker: a running `hgui` held
the Electron single-instance lock, so a second instance quit. `--spawn` /
`perf:serve` launch with their own --user-data-dir (separate lock scope), their
own HERMES_HOME (separate backend/sessions, config seeded from ~/.hermes so it
reaches a chat view without onboarding), and their own --remote-debugging-port.
Synthetic scenarios drive $messages via window.__PERF_DRIVE__, so no LLM credits.

Scenario -> sunset script mapping:
  stream            <- measure-synthetic-stream, profile-synth-stream, profile-long-stream
  stream --real     <- measure-real-stream, profile-real-stream
  keystroke         <- measure-latency, profile-typing, leak-typing
  transcript        <- (new: long-transcript mount cost)
  submit            <- measure-submit, measure-jump
  session-switch    <- profile-session-switch
  profile-switch    <- measure-profile-switch
CPU profiling is now a cross-cutting --cpuprofile flag, not 5 separate scripts.

CI-tier scenarios (stream, keystroke, transcript) need no backend/credits and
are gated against baseline.json (seed values; re-capture with --update-baseline
on a reference device). Backend-tier scenarios are report-only.

perf-probe.tsx gains loadTranscript() for the transcript scenario. No core
files touched; isolation is via CLI args, not env-gated app changes.

Verified: node --check all modules, tsc, eslint, and a unit smoke of the
stats + regression-gate logic. The end-to-end GUI run (which opens a window)
is left to run interactively via `npm run perf -- --spawn`.
2026-07-19 07:41:00 -04:00
..
perf bench(desktop): systematized perf harness; sunset 12 one-off scripts (#67466) 2026-07-19 07:41:00 -04:00
.gitignore feat(desktop): Memory Graph — playable radial timeline of memories + skills 2026-06-30 00:54:21 -05:00
after-pack.mjs feat(desktop): ts-ify everything 2026-07-08 16:24:16 -07:00
assert-dist-built.mjs cleanup(desktop): remove 'use strict' in ts & mjs 2026-07-13 17:22:17 -04:00
assert-dist-built.test.mjs test(desktop): run scripts/ tests in vitest 2026-07-13 17:22:17 -04:00
assert-root-install.mjs feat(desktop): ts-ify everything 2026-07-08 16:24:16 -07:00
before-build.mjs feat(desktop): ts-ify everything 2026-07-08 16:24:16 -07:00
before-pack.mjs cleanup(desktop): remove 'use strict' in ts & mjs 2026-07-13 17:22:17 -04:00
before-pack.test.mjs test(desktop): run scripts/ tests in vitest 2026-07-13 17:22:17 -04:00
bundle-electron-main.mjs fix(desktop): stop using tsx to boot Electron main in dev 2026-07-08 22:40:51 -05:00
click-session.mjs Add Hermes desktop app (#20059) 2026-05-31 17:46:56 -05:00
dev-no-hmr.mjs Add Hermes desktop app (#20059) 2026-05-31 17:46:56 -05:00
diag-jump.mjs Add Hermes desktop app (#20059) 2026-05-31 17:46:56 -05:00
diag-scroll-reset.mjs fix(desktop): stop chat scroll jumping by disabling native scroll anchoring 2026-06-02 23:08:01 -05:00
eval.mjs Add Hermes desktop app (#20059) 2026-05-31 17:46:56 -05:00
gen-share-codes.ts feat(desktop): Memory Graph — playable radial timeline of memories + skills 2026-06-30 00:54:21 -05:00
notarize-artifact.mjs feat(desktop): ts-ify everything 2026-07-08 16:24:16 -07:00
notarize.mjs feat(desktop): ts-ify everything 2026-07-08 16:24:16 -07:00
patch-electron-builder-mac-binary.mjs feat(desktop): ts-ify everything 2026-07-08 16:24:16 -07:00
probe-renderer.mjs Add Hermes desktop app (#20059) 2026-05-31 17:46:56 -05:00
probe-thread.mjs Add Hermes desktop app (#20059) 2026-05-31 17:46:56 -05:00
profile-typing-lag.md bench(desktop): systematized perf harness; sunset 12 one-off scripts (#67466) 2026-07-19 07:41:00 -04:00
rebuild-native.mjs feat(desktop): ts-ify everything 2026-07-08 16:24:16 -07:00
reload-renderer.mjs Add Hermes desktop app (#20059) 2026-05-31 17:46:56 -05:00
reload.mjs Add Hermes desktop app (#20059) 2026-05-31 17:46:56 -05:00
run-electron-builder.mjs feat(desktop): ts-ify everything 2026-07-08 16:24:16 -07:00
set-exe-identity.mjs feat(desktop): ts-ify everything 2026-07-08 16:24:16 -07:00
stage-native-deps.mjs fix(desktop): preserve node-pty helper in packaged app (#65611) 2026-07-16 11:58:50 +00:00
stage-native-deps.test.mjs fix(desktop): preserve node-pty helper in packaged app (#65611) 2026-07-16 11:58:50 +00:00
test-desktop.mjs change(ci/desktop): move desktop app build into check job 2026-07-13 17:22:17 -04:00
utils.mjs feat(desktop): ts-ify everything 2026-07-08 16:24:16 -07:00
write-build-stamp.mjs cleanup(desktop): remove 'use strict' in ts & mjs 2026-07-13 17:22:17 -04:00