feat(desktop): wire gateway support

Add the backend session, cwd, and attachment plumbing needed by the desktop shell while keeping generated build state out of git.
This commit is contained in:
Brooklyn Nicholson
2026-05-01 12:50:41 -05:00
parent 7b61f86529
commit 6c624f197c
3 changed files with 211 additions and 29 deletions
+5 -1
View File
@@ -70,8 +70,12 @@ app = FastAPI(title="Hermes Agent", version=__version__)
# Session token for protecting sensitive endpoints (reveal).
# Generated fresh on every server start — dies when the process exits.
# Injected into the SPA HTML so only the legitimate web UI can use it.
# Native desktop shells can pre-seed the token because they own the local
# child process and do not need to scrape index.html before opening /api/ws.
# ---------------------------------------------------------------------------
_SESSION_TOKEN = secrets.token_urlsafe(32)
_SESSION_TOKEN = os.environ.get("HERMES_DASHBOARD_SESSION_TOKEN") or secrets.token_urlsafe(
32
)
_SESSION_HEADER_NAME = "X-Hermes-Session-Token"
# In-browser Chat tab (/chat, /api/pty, …). Off unless ``hermes dashboard --tui``