Skip to content

The agent that grows with you

refactor(desktop): use dashboard late-binding seam

杨瑾1538c8bd9456
diff --git a/hermes_cli/web_server_dashboard.py b/hermes_cli/web_server_dashboard.py
index c0bc261ca0b..510d9906e08 100644
--- a/hermes_cli/web_server_dashboard.py
+++ b/hermes_cli/web_server_dashboard.py
@@ -102,8 +102,8 @@ def mount_spa(application: FastAPI):
with a missing dist per-request (404 JSON / ``check_dir=False``), so a long-lived
``--skip-build`` process recovers the moment a build appears on disk — no restart.
"""
- from hermes_cli import web_server as _web_server
from hermes_cli.web_server import WEB_DIST, _DASHBOARD_EMBEDDED_CHAT_ENABLED, app
+ from hermes_cli.web_deps import _server
# `hermes serve` is the headless backend: it must NEVER serve the browser SPA, even if a
# dist is lying around, so only the JSON-RPC/WS/API surface is reachable.
@@ -121,7 +121,7 @@ def mount_spa(application: FastAPI):
if full_path == "" and not gated:
return HTMLResponse(
"<!doctype html><html><head><script>"
- f"window.__HERMES_SESSION_TOKEN__={json.dumps(_web_server._SESSION_TOKEN)};"
+ f"window.__HERMES_SESSION_TOKEN__={json.dumps(_server()._SESSION_TOKEN)};"
"window.__HERMES_AUTH_REQUIRED__=false;"
f"</script></head><body>{_HEADLESS_MSG}</body></html>",
headers=_NO_STORE,
@@ -152,7 +152,7 @@ def mount_spa(application: FastAPI):
return JSONResponse({"error": "Frontend not built. Run: cd web && npm run build"}, status_code=404)
chat_js = "true" if _DASHBOARD_EMBEDDED_CHAT_ENABLED else "false"
gated = bool(getattr(app.state, "auth_required", False))
- token_js = "" if gated else f'window.__HERMES_SESSION_TOKEN__="{_web_server._SESSION_TOKEN}";'
+ token_js = "" if gated else f'window.__HERMES_SESSION_TOKEN__="{_server()._SESSION_TOKEN}";'
bootstrap_script = (
f"<script>{token_js}"
f"window.__HERMES_DASHBOARD_EMBEDDED_CHAT__={chat_js};"