mirror of
https://github.com/NousResearch/hermes-agent.git
synced 2026-07-31 19:16:29 +00:00
Electron-free module that brings up (or reuses) a desktop-dedicated Hermes dashboard on the remote host and a tunnel to it. Composes an injected SshConnection with injected HTTP probes + served-token adoption so it stays node --test-able. - locateHermes(): profile path -> login-shell `command -v hermes` -> conventional venv path. The login-shell probe is load-bearing (non-login ssh PATH misses user installs). Clear hermes-not-found error with an install one-liner. - probeRemotePlatform(): uname -s/-m gate to Linux/macOS; anything else fails with an unsupported-platform error before spawning. - Lockfile on the remote (~/.hermes/desktop-ssh/<client>.lock.json, schemaVersion guarded). Reuse requires ALL of: schema parses, pid alive, the stored token's fingerprint matches the lockfile, AND an authenticated /api/status probe through the tunnel succeeds. PID liveness alone is insufficient (recycled pid, wedged dashboard, rotated token) — the probe is the deciding test. - Spawn fresh: detached setsid `hermes dashboard --isolated --no-open --host 127.0.0.1 --port 0`, sentinel-marked log so we scrape only THIS spawn's HERMES_DASHBOARD_READY port=<n>. --isolated keeps it off the host's unified machine dashboard. - Served-token adoption against the tunneled baseUrl; the SERVED token's fingerprint lands in the lockfile so reuse checks the credential that actually authenticates /api/ws. - Stale cleanup kills a pid ONLY when provably ours (cmdline carries hermes + dashboard + --isolated); always drops the lockfile. 24 node --test cases cover locate ordering, platform gate, lockfile parse/ write, pid-aliveness, provably-ours cleanup, spawn-command shape, readiness scrape (incl. timeout + dead-process), and connect() fresh-spawn / reuse / killed-respawn / wedged-respawn / unsupported-platform paths. Wired into test:desktop:platforms. |
||
|---|---|---|
| .. | ||
| bootstrap-installer | ||
| desktop | ||
| shared | ||