Merge pull request #55923 from NousResearch/bb/serve-headless-no-web-build

feat(cli): make hermes serve a real headless backend (no web UI build/mount, neutral ready sentinel)
This commit is contained in:
brooklyn! 2026-07-06 13:18:00 -05:00 committed by GitHub
commit 91c68bf834
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
8 changed files with 93 additions and 16 deletions

View file

@ -11928,6 +11928,11 @@ def cmd_dashboard(args):
remaining = _find_stale_dashboard_pids()
sys.exit(1 if remaining else 0)
# `serve` is the headless backend: no UI build, no SPA mount, neutral
# ready sentinel. Resolved once and threaded through the re-exec, the
# build gate, and start_server.
_headless_backend = getattr(args, "headless_backend", False)
# ── Unified profile launch routing ────────────────────────────────
# The dashboard is a MACHINE management surface: it can read/write any
# profile via the per-request ?profile= scoping. Running one dashboard
@ -11973,7 +11978,9 @@ def cmd_dashboard(args):
reexec_argv = [
sys.executable, "-m", "hermes_cli.main",
"-p", "default",
"dashboard",
# Preserve the lean serve path across the re-exec so a named-profile
# `serve` doesn't silently rebuild the UI as `dashboard`.
"serve" if _headless_backend else "dashboard",
"--port", str(args.port),
"--host", args.host,
"--open-profile", _launch_profile,
@ -12042,7 +12049,11 @@ def cmd_dashboard(args):
# backend is the desktop's primary entrypoint and needs the same.
_sync_bundled_skills_quietly()
if "HERMES_WEB_DIST" not in os.environ and not getattr(args, "skip_build", False):
if _headless_backend:
# Don't build the SPA, and tell mount_spa() (read at web_server import
# below) to disable it even if a stray dist exists. Set it first.
os.environ["HERMES_SERVE_HEADLESS"] = "1"
elif "HERMES_WEB_DIST" not in os.environ and not getattr(args, "skip_build", False):
if not _build_web_ui(PROJECT_ROOT / "web", fatal=True):
sys.exit(1)
elif getattr(args, "skip_build", False):
@ -12115,6 +12126,7 @@ def cmd_dashboard(args):
open_browser=not args.no_open,
allow_public=getattr(args, "insecure", False),
initial_profile=getattr(args, "open_profile", "") or "",
headless=_headless_backend,
)