Skip to content

The agent that grows with you

refactor(web): delete dead web_server helpers (_demo, _ws_request_reason, _TERMINAL_BACKEND_NAMES, _mcp_oauth_callback_url_from_base)

Teknium5c7096e7cff8
diff --git a/hermes_cli/web_server.py b/hermes_cli/web_server.py
index 9c8a3cae0b1..49575c4534d 100644
--- a/hermes_cli/web_server.py
+++ b/hermes_cli/web_server.py
@@ -6327,12 +6327,6 @@ _mcp_oauth_transactions: dict[tuple[str, str], threading.Lock] = {}
_mcp_oauth_transactions_lock = threading.Lock()
-def _mcp_oauth_callback_url_from_base(base_url: str, server_name: str) -> str:
- from urllib.parse import quote
-
- return f"{base_url.rstrip('/')}/api/mcp/oauth/callback/{quote(server_name, safe='')}"
-
-
def _mcp_oauth_transaction(flow) -> threading.Lock:
key = (flow.hermes_home, flow.server_name)
with _mcp_oauth_transactions_lock:
@@ -6859,8 +6853,6 @@ _TERMINAL_BACKENDS: List[Dict[str, str]] = [
},
]
-_TERMINAL_BACKEND_NAMES = {row["name"] for row in _TERMINAL_BACKENDS}
-
def _plugin_terminal_backend_rows() -> List[Dict[str, str]]:
"""Picker rows for plugin-registered terminal backends (fail-soft)."""
@@ -7286,11 +7278,6 @@ def _ws_host_origin_is_allowed(ws: "WebSocket") -> bool:
return _ws_host_origin_reason(ws) is None
-def _ws_request_reason(ws: "WebSocket") -> Optional[str]:
- """First Host/Origin or peer-IP rejection reason, or None when allowed."""
- return _ws_host_origin_reason(ws) or _ws_client_reason(ws)
-
-
def _ws_request_is_allowed(ws: "WebSocket") -> bool:
"""Return True when the WebSocket upgrade matches dashboard boundaries."""
return _ws_host_origin_is_allowed(ws) and _ws_client_is_allowed(ws)
@@ -9037,12 +9024,6 @@ def _start_parent_death_watchdog() -> None:
threading.Thread(target=_loop, daemon=True, name="serve-parent-watchdog").start()
-def _demo() -> None:
- assert _is_serve_orphaned(999999999, pid_exists=lambda _pid: False) is True
- assert _is_serve_orphaned(42, pid_exists=lambda _pid: True) is False
- print("web_server parent-death watchdog self-check: OK")
-
-
# ── Port-conflict sentinel (#93608) ─────────────────────────────────────────
# When the requested port is already bound, uvicorn's ``bind_socket()``
# catches the OSError itself and does ``logger.error(exc); sys.exit(1)`` — a