hermes-agent/apps/desktop/src
David Metcalfe 7bbb063c71 feat(desktop): port find-in-page bridge to TypeScript Electron
The original PR targeted the CJS Electron files
(apps/desktop/electron/main.cjs and preload.cjs), but commit
39d09453f "feat(desktop): ts-ify everything" renamed them to
main.ts and preload.ts on current main. The PR's diff therefore
targeted files that no longer exist on main.

Brings the bridge forward to the current TypeScript Electron
files and extracts the IPC bridge helpers into a focused
pure-helpers module:

- apps/desktop/electron/find-in-page.ts (new):
  - performFind(webContents, query, options) — wraps
    webContents.findInPage with default-coercing options.
  - stopFind(webContents, action) — clears highlights.
  - formatFoundInPage(result) — pure projection of
    Electron's FoundInPageResult onto the wire payload shape
    ({ activeMatchOrdinal, count }).
  - installFoundInPageForwarder(webContents) — wires a
    sender-scoped 'found-in-page' forwarder; returns an
    uninstall function. Returns a no-op uninstall for null
    or destroyed webContents so callers don't need guards.

- apps/desktop/electron/main.ts:
  - ipcMain.handle('hermes:find-in-page', event => ...)
    resolves the requesting window via
    BrowserWindow.fromWebContents(event.sender) and routes
    the search to THAT window, not the global primary. This
    fixes a multi-window bug where Cmd+F pressed in a
    secondary session window (one per chat, spawned via
    hermes🪟openSession) searched the primary window
    instead of the focused surface.
  - ipcMain.handle('hermes:stop-find-in-page', event => ...)
    routes stopFind through the requesting window for
    multi-window correctness.
  - A per-sender lazy forwarder registry
    (foundInPageForwarders: Map<webContentsId, () => void>)
    installs installFoundInPageForwarder on first
    findInPage call, scoped to the sender's webContents.
    Cleans up automatically via webContents.once('destroyed',
    ...). The forwarder sends results back to the SAME
    renderer that initiated the search, never the global
    primary — so a secondary session window's Cmd+F shows
    matches from THAT window and the match counter reports
    matches from THAT window's DOM.

- apps/desktop/electron/preload.ts:
  - hermesDesktop.findInPage(query, options) — invokes
    the IPC handler.
  - hermesDesktop.stopFindInPage() — invokes the IPC
    handler.
  - hermesDesktop.onFoundInPage(callback) — subscribes to
    'hermes:found-in-page' results from the sender;
    returns an unsubscribe function so the FindBar can
    clean up on unmount.

- apps/desktop/src/global.d.ts:
  - Three new hermesDesktop method declarations:
    findInPage, stopFindInPage, onFoundInPage. The new
    forwarder install registers a 'found-in-page' listener
    bound to the sender's webContents and emits
    'hermes:found-in-page' results back to the sender.

The multi-window fix is part of the same port — the old
PR's behavior (Cmd+F in a secondary session window searched
the global primary) was a bug present in the CJS files,
not a design constraint we wanted to preserve. The new
helper module uses event.sender by design, so the
multi-window correctness lands with the TS port.

Fixes #46169
2026-07-26 17:48:05 -07:00
..
app fix(desktop): hydrate goal indicator on /goal set and controls, full locale copy 2026-07-26 17:47:38 -07:00
assets/tiers feat(desktop): Billing page revamp — current-plan card, in-app plans view, tier art (#68722) 2026-07-22 08:07:52 +05:30
components Merge pull request #72308 from NousResearch/bb/tool-group-bounding 2026-07-26 19:13:22 -05:00
contrib feat(desktop): expose ctx.i18n on the plugin SDK 2026-07-19 00:05:08 -04:00
debug fix(desktop): make render-churn measure streaming, not boot churn 2026-07-26 15:54:18 -05:00
fonts fix(desktop): crisp terminal text via opaque xterm canvas 2026-06-12 19:36:30 -05:00
hooks perf(desktop): kill the layout-thrash cascade on session switch (#66033) 2026-07-16 22:46:08 -04:00
i18n fix(desktop): hydrate goal indicator on /goal set and controls, full locale copy 2026-07-26 17:47:38 -07:00
lib perf(desktop): cache short markdown parses too 2026-07-26 17:02:59 -05:00
plugins feat(desktop): plugin manager, runtime loader, and plugins settings 2026-07-13 17:57:53 -04:00
sdk feat(desktop): expose ctx.i18n on the plugin SDK 2026-07-19 00:05:08 -04:00
store Add desktop goal status display 2026-07-26 17:47:38 -07:00
themes fix(themes): repaint the desktop on an in-place edit of the active skin 2026-07-22 15:07:03 -05:00
types feat(desktop): auto-continue turns interrupted by a crash 2026-07-24 23:31:56 -05:00
global.d.ts feat(desktop): port find-in-page bridge to TypeScript Electron 2026-07-26 17:48:05 -07:00
hermes-cron-scope.test.ts fix(desktop): scope the cron jobs list to the active profile 2026-07-19 12:19:22 -07:00
hermes-parity.test.ts feat(desktop): CLI/dashboard parity — skills hub, MCP test/toggle/catalog, maintenance ops, log filters (#57441) 2026-07-03 01:02:47 -07:00
hermes-profile-scope.test.ts fix(memory): profile-scope the provider config endpoints 2026-07-07 10:53:43 -04:00
hermes.test.ts fix(desktop): extend read aloud + transcription timeouts (salvage of #39286) (#68056) 2026-07-20 09:51:31 -04:00
hermes.ts feat(desktop): add Cron Blueprints to the GUI (#70066) 2026-07-24 14:22:43 -04:00
main.tsx feat(desktop): dev-only render + store churn counters 2026-07-26 06:10:54 -05:00
styles.css fix(desktop): restore the pane tab strip's bottom rule 2026-07-26 04:25:29 -05:00
vite-env.d.ts
webhooks-rest.test.ts feat(desktop): add Webhooks page for subscription CRUD (#69687) 2026-07-24 14:06:10 -04:00