Spaces:
Paused

Farhan Beg commited on
Commit
dc9f435
Β·
1 Parent(s): da1c88e

feat: stable dashboard session token for desktop app persistence

Browse files

The Hermes desktop app connects via /hmd using the dashboard's session
token. Hermes v0.17.0 generates a random token per process start
(web_server.py:216):
_SESSION_TOKEN = os.environ.get('HERMES_DASHBOARD_SESSION_TOKEN') or secrets.token_urlsafe(32)

Without a stable value, the token changed on every Space restart, forcing
the user to re-scrape it from /hmd/ HTML and reconfigure the desktop app
each time.

start.sh:
- If HERMES_DASHBOARD_SESSION_TOKEN is set as an HF Space Secret, use it
(power users can pin an explicit value).
- Otherwise generate once and persist to
$HERMES_HOME/.huggingmes-dashboard-session-token (backed up to the HF
Dataset via hermes-sync.py β€” it's not in EXCLUDED_TOP_LEVEL).
- On every boot, read the saved token and export it. The dashboard then
uses this stable value instead of generating a fresh random one.

health-server.js:
- Add dashboardSessionToken to the statusPayload (auth-gated via
/hm/status) so the token is visible without scraping HTML.
- Add /hm/desktop-app-setup endpoint: a copy-pasteable HTML page showing
the Remote Gateway URL + session token + setup steps. Also available
as JSON for programmatic access.
- Add a 'Desktop App' tile to the /hm status page showing token status
+ a link to the setup guide.

The user configures the desktop app ONCE; the token persists across
restarts via the HF Dataset backup. The handover doc's env var name
(HERMES_DASHBOARD_BASIC_AUTH_SECRET) was wrong β€” the actual v0.17.0 var
is HERMES_DASHBOARD_SESSION_TOKEN, verified in the upstream source.

2 files changed +94
Files changed (2)
health-server.js+69
start.sh+25