Commit Graph

6 Commits

Author SHA1 Message Date
Teknium
b459f2c6dd feat(desktop): one UI preferences store per machine, shared by Desktop and its Webapp (#145213)
Desktop/Webapp UI preferences lived only in each browser's localStorage, so
every device and every origin (LAN IP vs public URL) of the Webapp had its own
settings. They now live once on the machine that runs the app, beside the root
Hermes home (`<root>/ui-preferences.json`), independent of gateway connection
and profile:

- Python store `hermes_cli/ui_preferences.py` + `/api/ui-preferences`
  (GET/PATCH, Webapp surface only, behind the existing session/sign-in gate).
- Electron twin `electron/ui-preferences.ts`: typed preload capability
  (sync first-paint snapshot, read, validated per-key write, change push incl.
  writes the Webapp's server makes).
- Shared on-disk contract: per-key merge under a `<store>.lock` directory
  lock, temp+rename, revision counter; `seed` imports a window's existing
  localStorage once and never overwrites an existing store.
- Renderer: allowlisted preference keys (no credentials, grants, drafts or
  per-window state) sync both ways; localStorage stays the synchronous cache;
  persistent atoms for shared keys follow changes live.
2026-10-27 14:02:54 -07:00
Adolanium
17b56cbbea feat(webapp): serve the host's desktop plugins to the Webapp's plugin loader
Native Desktop reads <root>/desktop-plugins from its own disk. A Webapp tab's
only disk is the server, and /api/fs is the wrong reader for it: it follows the
profile's SSH workspace and truncates at the 512 KiB preview cap.

/api/desktop-plugins/{root,list,read} answer exactly the loader's reads: the
app-level root, its plugin folders, and each folder's plugin.js and
.hermes-package.json, resolved through symlinks to inside the root, whole up
to Electron's 16 MiB plugin-source cap. Webapp surface only.
2026-10-27 16:08:52 -04:00
emozilla
3895357a6a fix(webapp): the Webapp's routes exist only on the surfaces that use them
The Web Access routes, the browser's file-upload staging route and the file-ticket route were
mounted on every app, so the standalone `hermes dashboard` and `hermes serve` answered them too:
any loopback dashboard tab could turn on Web Access for the gateway (writing its config and .env
and restarting it), and pastes on the dashboard met the Webapp's pre-parse body cap. Only native
Desktop's Web Access pane (on the gateway's own listener) and the Webapp's browser use them.

The surface policy gains web_access (the gateway's listener, private or Webapp) and browser_files
(the Webapp only); an app with no recorded surface reads as the gateway's listener when a gateway
runner is bound to it, else as the dashboard. Each of those routes answers 404 where its surface
does not use it, and the chat upload body cap applies only where the browser's file routes do.
Tests that reached these routes on the dashboard surface now reach them on the surface that serves
them; native Desktop's Web Access calls in tests carry a real one-use native grant per request.
2026-10-25 03:22:40 -07:00
emozilla
22103f58a8 fix(dashboard): a gated dashboard behind a proxy takes its own page's cookie writes as on main
With the Webapp off, `hermes dashboard` behind its sign-in gate answered 403 to every write its own
page made through a plain-HTTP reverse proxy that forwards with the upstream's Host and no
dashboard.public_url: the browser sends no Fetch Metadata to a plain-HTTP origin, and the
cookie-origin check carried for the Webapp compared the page's Origin with the server's own URL.
Main admitted those writes, and sign-out through /auth/logout stayed a plain public path.

The check, and the sign-out's place in it, now belong to the gateway's Webapp listener only: the
surface policy gains own_origin_cookie_writes, true for the Webapp and false for the dashboard and
`hermes serve`, and the gate asks for it before refusing a cookie write. The Webapp's refusal names
webapp.public_url. Tests that pinned the check on the dashboard now run on the Webapp surface, and
the dashboard's parity is pinned in test_dashboard_auth_middleware.
2026-10-25 03:22:40 -07:00
emozilla
c7bab35d08 refactor(webapp): one route mints every Webapp socket ticket
A Webapp page minted its one-use socket tickets from three routes that did the same thing with a
different socket name: /api/webapp/gateway-ticket for /api/ws, /api/webapp/terminal-ticket for the
host terminal and /api/webapp/audio-ticket?socket= for the voice streams, each with its own copy of
the surface check, and the renderer had a helper for each.

POST /api/webapp/socket-ticket?socket= now mints them all. A table names each socket (gateway,
host-terminal, speak-stream, transcribe-stream), the surface policy that lets a surface mint it, and
whether the mint checks the profile the page will dial (the gateway socket, as before). An unknown
socket gets 400 and a surface that does not serve the socket gets 404, as before. In the renderer,
ticketedWebsocketUrl() mints the ticket and builds the URL for any of the four sockets. Main's
/api/auth/ws-ticket is unchanged. The tests, fixtures and code comments that named the old routes
now name the new one.
2026-10-25 03:22:37 -07:00
Bear Huddleston
b5eb5ee7a8 feat(webapp): carry the browser-hosted Desktop's server pieces from #93508
Carried from BearHuddleston's #93508 onto main. The Webapp relay and the
profile-incarnation fence stay out: carried code follows main's
named-profile rule and refuses a missing or deleted profile home.

- Webapp routes: one-use launch tickets, window handoff, and gateway
  WebSocket tickets minted for the signed-in browser
- Browser surface policy and the SPA document policy
- A host terminal for the browser that survives reconnects
- Staged browser uploads and file tickets; file.attach takes a staged upload
- hermes sessions adopt
- Webapp bundle build helpers and the renderer freshness check
- Regenerated gateway contracts

Co-authored-by: emozilla <emozilla@nousresearch.com>
2026-10-25 03:22:14 -07:00