mirror of
https://github.com/NousResearch/hermes-agent.git
synced 2026-07-12 13:52:15 +00:00
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:
commit
91c68bf834
8 changed files with 93 additions and 16 deletions
|
|
@ -61,3 +61,10 @@ def test_serve_takes_the_same_runtime_flags_as_dashboard():
|
|||
def test_serve_supports_the_lifecycle_flags():
|
||||
for flag in ("--stop", "--status"):
|
||||
assert getattr(_parser().parse_args(["serve", flag]), flag.lstrip("-")) is True
|
||||
|
||||
|
||||
def test_serve_is_a_headless_backend_but_dashboard_is_not():
|
||||
# `headless_backend` is the flag cmd_dashboard reads to skip the web UI
|
||||
# build; only `serve` carries it.
|
||||
assert getattr(_parser().parse_args(["serve"]), "headless_backend", False) is True
|
||||
assert getattr(_parser().parse_args(["dashboard"]), "headless_backend", False) is False
|
||||
|
|
|
|||
|
|
@ -2527,6 +2527,27 @@ class TestWebServerEndpoints:
|
|||
|
||||
assert seen_encodings == {"index": "utf-8", "css": "utf-8"}
|
||||
|
||||
def test_headless_serve_disables_spa_even_with_a_dist(self, monkeypatch, tmp_path):
|
||||
"""`hermes serve` (HERMES_SERVE_HEADLESS) must NOT serve the SPA even
|
||||
when a built dist is present — only the API/WS surface is reachable."""
|
||||
from fastapi import FastAPI
|
||||
from starlette.testclient import TestClient
|
||||
import hermes_cli.web_server as ws
|
||||
|
||||
dist = tmp_path / "web_dist"
|
||||
(dist / "assets").mkdir(parents=True)
|
||||
(dist / "index.html").write_text("<html><body>UI</body></html>", encoding="utf-8")
|
||||
|
||||
monkeypatch.setattr(ws, "WEB_DIST", dist)
|
||||
monkeypatch.setenv("HERMES_SERVE_HEADLESS", "1")
|
||||
app_ = FastAPI()
|
||||
ws.mount_spa(app_)
|
||||
|
||||
for route in ("/", "/chat"):
|
||||
resp = TestClient(app_).get(route)
|
||||
assert resp.status_code == 404
|
||||
assert "web UI disabled" in resp.json()["error"]
|
||||
|
||||
def test_set_model_main_nous_applies_gateway_defaults(self, monkeypatch):
|
||||
"""Switching the main provider to Nous calls apply_nous_managed_defaults
|
||||
(mirroring the CLI's post-model-selection Tool Gateway routing) and
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue