HarnessRouter Community Edition: the self-hosted, Apache-2.0 edition of the unified interface for agent harnesses. Run Codex, Claude Code, Hermes, PI, DSH, and more through one API, with sessions, streaming, files, cancellation, and failure handling. Implements the Unified Harness Protocol (UHP), an open standard. Your keys, your infrastructure.
Python agent-apiagent-frameworkagent-harnessai-agentsai-infrastructurecoding-agentconformance-testingdeepseek-harnessharness-engineeringhermesllmopen-protocolopen-sourceopen-standardpi-coding-agentself-hosteduhpunified-apiunified-harness-protocolunified-interface
feat: the hosted HarnessRouter service as a provider, with the key handed over from the console (#151)
github-actions[bot]4037063f8816
diff --git a/gateway/app.py b/gateway/app.pyindex 311fbc78..9197429d 100644--- a/gateway/app.py+++ b/gateway/app.py@@ -996,6 +996,14 @@ _IMAGE_MODEL_MAP_KEY = "harness-image-model-map"_MEDIA_POLICY_KEY = "harness-media-policy"_IMAGE_MODEL_MAP_PREV_KEY = "harness-image-model-map.prev"_INTEGRATION_SECRET_FIELDS = ("api_key", "aws_bearer_token", "aws_secret_access_key", "aws_session_token")+# The hosted HarnessRouter service as a model provider. One origin, three routes: the provider+# front door the runners call (OpenAI and Anthropic shapes and Gemini's native path, all under one+# base), the model list it serves, and the connect flow that hands a key to this instance.+HR_HOSTED_BASE = os.environ.get("HR_HOSTED_BASE", "https://api.harnessrouter.ai").rstrip("/")+HR_HOSTED_PROVIDER_BASE = f"{HR_HOSTED_BASE}/v1/provider"+HR_HOSTED_MODELS_URL = f"{HR_HOSTED_BASE}/v1/models"+HR_HOSTED_BALANCE_URL = f"{HR_HOSTED_BASE}/v1/balance"+HR_HOSTED_CONNECT_URL = f"{HR_HOSTED_BASE}/v1/connect"# integration provider type × runner backend -> the runner-side provider that carries it.# Absent pair = that backend can't use the integration (mapping falls through to the chain)._INTEGRATION_WIRING: dict[tuple[str, str], str] = {@@ -1092,6 +1100,14 @@ _INTEGRATION_WIRING: dict[tuple[str, str], str] = {# the gemini backend too; the runner still builds gemini as provider google and routes the CLI# through its relay when the connection is TokenRouter.("tokenrouter", "gemini"): "google",+ # The hosted service serves the same shapes from one base and one key as TokenRouter does+ # ("tokenrouter" on the runner means OpenAI/Anthropic-compatible, api by model family, base on+ # the connection), so its rows mirror TokenRouter's row for row.+ ("harnessrouter", "claude"): "tokenrouter", ("harnessrouter", "codex"): "tokenrouter",+ ("harnessrouter", "hermes"): "openai-api", ("harnessrouter", "pi"): "tokenrouter",+ ("harnessrouter", "omp"): "tokenrouter", ("harnessrouter", "dsh"): "tokenrouter",+ ("harnessrouter", "opencode"): "tokenrouter", ("harnessrouter", "qwen"): "tokenrouter",+ ("harnessrouter", "cline"): "tokenrouter", ("harnessrouter", "gemini"): "google",}@@ -3455,6 +3471,10 @@ def _provider_base_url(provider: str, base_url: str) -> str:under /openai/v1, and a bare base forwarded as-is 404s on every call ("Resource not found",the matrix's Azure column, 2026-09-06). Any other provider's base is used as given."""base = (base_url or "").strip().rstrip("/")+ if provider.lower() == "harnessrouter":+ # The hand-off's payload names the endpoint and the console stores it; a connection+ # without one (a pasted key) gets this gateway's constant. A person never types it.+ return base if base.endswith("/v1/provider") else HR_HOSTED_PROVIDER_BASEif base and provider.lower() in ("azure", "azure-foundry") and "/openai/" not in base:base += "/openai/v1"return base@@ -4360,6 +4380,17 @@ _PROVIDER_CATALOG: dict[str, dict] = {"secret": "api_key","secret_label": "API Key",},+ # The hosted service as a provider: one key, every model on its list at listed prices, the+ # endpoint fixed by this gateway (the person never types it). The key comes from the hosted+ # "get a key" flow through /v1/admin/connect, or is pasted. Keys read sk-hr-<64 hex>.+ "harnessrouter": {+ "label": "HarnessRouter API",+ "base_url": HR_HOSTED_PROVIDER_BASE,+ "fields": [],+ "secret": "api_key",+ "secret_label": "API Key",+ "key_hint": "sk-hr-…",+ },"vercel": {"label": "Vercel AI Gateway","base_url": "https://ai-gateway.vercel.sh/v1",@@ -4567,7 +4598,20 @@ async def _media_chains_public() -> list[dict]:@app.get("/v1/admin/integrations")async def admin_integrations_get(request: Request) -> dict:await _require_integrations_admin(request)- return {"integrations": [_integration_public(i) for i in await _integrations_doc()],+ integrations = await _integrations_doc()+ hosted = next((i for i in integrations if str(i.get("provider") or "").lower() == "harnessrouter"), None)+ hosted_cfg = (hosted or {}).get("config") or {}+ await _hosted_models_refresh(str(hosted_cfg.get("api_key") or ""), models_url=str(hosted_cfg.get("models_url") or ""))+ public = [_integration_public(i) for i in integrations]+ if hosted:+ # What is left to spend on the hosted account, read here with the stored key so the key never+ # reaches the browser; absent (never a stale or made-up figure) when the read fails.+ bal = await _hosted_balance(str(hosted_cfg.get("api_key") or ""), str(hosted_cfg.get("balance_url") or ""))+ if bal is not None:+ for row in public:+ if row.get("name") == hosted.get("name"):+ row["balance"] = bal+ return {"integrations": public,"model_map": await _effective_model_map(),"image_model_map": await _effective_image_model_map(),"providers": sorted({p for p, _ in _INTEGRATION_WIRING}),@@ -4576,6 +4620,107 @@ async def admin_integrations_get(request: Request) -> dict:"media_policy": await _media_policy_doc()}+async def _hosted_balance(api_key: str, balance_url: str = "") -> dict | None:+ """GET <balance_url> with the stored key → {"usd", "is_deficit", "as_of"} or None. The hosted side+ holds the figure for up to a minute; 401 (bad key) and 503 (ledger not answering) both mean+ "show nothing", so does any other failure."""+ if not api_key:+ return None+ try:+ async with httpx.AsyncClient(timeout=6.0) as c:+ r = await c.get(balance_url or HR_HOSTED_BALANCE_URL, headers={"authorization": f"Bearer {api_key}"})+ if r.status_code != 200:+ return None+ j = r.json()+ usd = j.get("balance_usd")+ if not isinstance(usd, (int, float)):+ return None+ return {"usd": round(float(usd), 2), "is_deficit": bool(j.get("is_deficit")), "as_of": str(j.get("as_of") or "")}+ except Exception: # noqa: BLE001+ return None+++# Codes this instance opened with the hosted service, and the secret each poll must carry. In+# memory: a code lives thirty minutes and a ready key is readable once, so there is nothing to keep.+_CONNECTS: dict[str, dict] = {}+_CONNECT_TTL = 1800.0 # the hosted code's own lifetime; a delivered body is dropped with it+++def _connects_sweep() -> None:+ now = time.time()+ for c in [c for c, e in _CONNECTS.items() if now - float(e.get("at") or 0) > _CONNECT_TTL]:+ _CONNECTS.pop(c, None)+++class ConnectBody(BaseModel):+ instance: str = ""++[email protected]("/v1/admin/connect")+async def admin_connect_start(body: ConnectBody, request: Request) -> dict:+ """Open a key hand-off with the hosted service: the console opens the returned url in a new+ tab and polls the code here; the secret never leaves this gateway."""+ await _require_integrations_admin(request)+ instance = (body.instance or "").strip() or (request.headers.get("host") or "this instance")+ try:+ async with httpx.AsyncClient(timeout=15.0) as c:+ r = await c.post(HR_HOSTED_CONNECT_URL, json={"instance": instance})+ except Exception as e: # noqa: BLE001+ raise HTTPException(502, f"HarnessRouter could not be reached: {type(e).__name__}")+ if r.status_code >= 400:+ raise HTTPException(502, f"HarnessRouter refused to start the key hand-off (HTTP {r.status_code}).")+ j = r.json() if r.headers.get("content-type", "").startswith("application/json") else {}+ code, secret = str(j.get("code") or ""), str(j.get("secret") or "")+ if not code or not secret or not j.get("url"):+ raise HTTPException(502, "HarnessRouter answered without a code, a secret or a url.")+ now = time.time()+ for k, v in list(_CONNECTS.items()): # forget codes older than an hour+ if now - v["at"] > 3600:+ _CONNECTS.pop(k, None)+ _connects_sweep()+ _CONNECTS[code] = {"secret": secret, "at": now}+ return {"code": code, "url": str(j["url"]), "expires_in": j.get("expires_in")}++[email protected]("/v1/admin/connect/{code}")+async def admin_connect_poll(code: str, request: Request):+ """One poll of the hand-off: 202 while the person is still on the hosted page, 200 once with+ the key and the endpoints (then the hosted model list is refreshed with that key), 410 when+ the code expired or was already read."""+ await _require_integrations_admin(request)+ _connects_sweep()+ entry = _CONNECTS.get(code)+ if not entry:+ raise HTTPException(410, "That key hand-off is not open. Get a key again.")+ if entry.get("ready"):+ # The hosted side hands the key over once; this side answers every poll after that with the+ # same body until the code expires, so a slow or dropped answer costs nothing.+ return entry["ready"]+ try:+ async with httpx.AsyncClient(timeout=15.0) as c:+ r = await c.get(f"{HR_HOSTED_CONNECT_URL}/{code}", headers={"X-Connect-Secret": entry["secret"]})+ except Exception as e: # noqa: BLE001+ raise HTTPException(502, f"HarnessRouter could not be reached: {type(e).__name__}")+ j = r.json() if r.headers.get("content-type", "").startswith("application/json") else {}+ if r.status_code == 202:+ return JSONResponse({"status": "pending"}, status_code=202)+ if r.status_code == 410:+ _CONNECTS.pop(code, None)+ raise HTTPException(410, "That key hand-off expired or was already used. Get a key again.")+ if r.status_code >= 400:+ raise HTTPException(502, f"HarnessRouter answered HTTP {r.status_code} on the key hand-off.")+ key = str(j.get("api_key") or "")+ endpoint = str(j.get("endpoint") or HR_HOSTED_PROVIDER_BASE)+ models_url = str(j.get("models_url") or HR_HOSTED_MODELS_URL)+ balance_url = str(j.get("balance_url") or HR_HOSTED_BALANCE_URL)+ if key:+ await _hosted_models_refresh(key, force=True, models_url=models_url)+ entry["ready"] = {"status": "ready", "api_key": key, "endpoint": endpoint, "models_url": models_url,+ "balance_url": balance_url, "org": j.get("org") or "", "name": str(j.get("name") or ""),+ "models": list(_HOSTED_MODELS["ids"])}+ return entry["ready"]++class IntegrationsBody(BaseModel):integrations: list[dict]model_map: dict@@ -5386,6 +5531,57 @@ _IMAGE_VENDOR_MODELS: dict[str, dict[str, str]] = {}+# HarnessRouter serves canonical ids and its list is maintained there, not here: the gateway reads+# it (at start, on a connect that handed over a key, and hourly on the admin read), keeps the last+# good read, and the vendor table is that read. An empty read is empty: nothing is listed unprobed.+_HOSTED_MODELS: dict = {"ids": [], "at": 0.0}+_HOSTED_MODELS_TTL = 3600.0+++def _hosted_models_parse(doc) -> list[str]:+ """Canonical ids from either shape the hosted list may take: this gateway's own /v1/models+ ({"backends": {b: {"models": [{"id": ...}]}}}) or a flat OpenAI-style {"data": [{"id": ...}]}."""+ ids: list[str] = []+ if isinstance(doc, dict) and isinstance(doc.get("backends"), dict):+ for c in doc["backends"].values():+ for m in (c or {}).get("models") or []:+ if isinstance(m, dict):+ if m.get("id") and m.get("available", True):+ ids.append(str(m["id"]))+ elif m:+ ids.append(str(m))+ elif isinstance(doc, dict) and isinstance(doc.get("data"), list):+ ids = [str(m.get("id")) for m in doc["data"] if isinstance(m, dict) and m.get("id")]+ elif isinstance(doc, list):+ ids = [str(m.get("id") if isinstance(m, dict) else m) for m in doc if m]+ return sorted(set(ids))+++async def _hosted_models_refresh(api_key: str = "", force: bool = False, models_url: str = "") -> list[str]:+ """Read the hosted model list (the union of every backend's available ids for this key's+ org) and make it this provider's vendor table. Keeps the last good read on any failure; the+ key is sent when one is known (the list is computed for the key's org)."""+ if not force and _HOSTED_MODELS["ids"] and time.time() - _HOSTED_MODELS["at"] < _HOSTED_MODELS_TTL:+ return _HOSTED_MODELS["ids"]+ headers = {"authorization": f"Bearer {api_key}"} if api_key else {}+ try:+ async with httpx.AsyncClient(timeout=15.0) as c:+ r = await c.get(models_url or HR_HOSTED_MODELS_URL, headers=headers)+ if r.status_code >= 400:+ print(f"[hosted] model list answered HTTP {r.status_code}", flush=True)+ return _HOSTED_MODELS["ids"]+ ids = _hosted_models_parse(r.json())+ except Exception as e: # noqa: BLE001+ print(f"[hosted] model list unreachable: {type(e).__name__}: {str(e)[:120]}", flush=True)+ return _HOSTED_MODELS["ids"]+ if ids:+ _HOSTED_MODELS.update({"ids": ids, "at": time.time()})+ _VENDOR_MODELS["harnessrouter"] = {m: m for m in ids}+ return _HOSTED_MODELS["ids"]+++_VENDOR_MODELS["harnessrouter"] = {} # filled by _hosted_models_refresh+_VENDOR_MODELS["tokenrouter"] = {c: v for c, v in _VENDOR_MODELS["openrouter"].items()if c not in _TOKENROUTER_NO_CHANNEL}diff --git a/gateway/tests/test_harnessrouter_provider.py b/gateway/tests/test_harnessrouter_provider.pynew file mode 100644index 00000000..85ed85e4--- /dev/null+++ b/gateway/tests/test_harnessrouter_provider.py@@ -0,0 +1,107 @@+"""The hosted service as a provider: one key, every model on its list, the endpoint fixed by the+gateway, the key handed over through a connect flow the browser never has to reach directly."""+import asyncio+import os+import pathlib+import sys++import pytest++sys.path.insert(0, str(pathlib.Path(__file__).resolve().parents[1]))+os.environ.setdefault("HR_BACKING", "local")+import app as A # noqa: E402+++def test_it_is_wired_wherever_tokenrouter_is():+ tr = {b: v for (p, b), v in A._INTEGRATION_WIRING.items() if p == "tokenrouter"}+ hr = {b: v for (p, b), v in A._INTEGRATION_WIRING.items() if p == "harnessrouter"}+ assert hr == tr and "claude" in hr and "codex" in hr and "dsh" in hr+++def test_the_catalog_entry_and_the_fixed_endpoint():+ meta = A._PROVIDER_CATALOG["harnessrouter"]+ assert meta["label"] == "HarnessRouter API" and meta["fields"] == [] and meta["secret"] == "api_key"+ assert meta["base_url"] == A.HR_HOSTED_PROVIDER_BASE and meta["key_hint"].startswith("sk-hr-")+ assert A._provider_base_url("harnessrouter", "") == A.HR_HOSTED_PROVIDER_BASE+ assert A._provider_base_url("harnessrouter", "https://example.com/anything") == A.HR_HOSTED_PROVIDER_BASE+ assert A._provider_base_url("harnessrouter", "https://api.harnessrouter.ai/v1/provider/") == "https://api.harnessrouter.ai/v1/provider"+ assert any(c["id"] == "harnessrouter" for c in A._provider_catalog_public())+++def test_the_model_list_is_read_in_both_shapes_and_only_available_ids():+ ours = {"backends": {"codex": {"models": [{"id": "gpt-5.4", "available": True}, {"id": "gpt-6-astra", "available": False}]},+ "claude": {"models": [{"id": "claude-opus-4.8", "available": True}]}}}+ assert A._hosted_models_parse(ours) == ["claude-opus-4.8", "gpt-5.4"]+ assert A._hosted_models_parse({"data": [{"id": "b"}, {"id": "a"}]}) == ["a", "b"]+ assert A._hosted_models_parse({}) == []+++class _R:+ def __init__(self, status, body):+ self.status_code, self._body = status, body+ self.headers = {"content-type": "application/json"}+ def json(self):+ return self._body+++def test_the_connect_flow_is_proxied_and_the_secret_stays_here(monkeypatch):+ calls = []+ class _Client:+ def __init__(self, *a, **k): pass+ async def __aenter__(self): return self+ async def __aexit__(self, *a): return False+ async def post(self, url, json=None, headers=None):+ calls.append(("POST", url, json)); return _R(200, {"code": "c1", "secret": "s1", "url": "https://app.harnessrouter.ai/get-key?code=c1", "expires_in": 1800})+ async def get(self, url, headers=None):+ calls.append(("GET", url, headers))+ if url.endswith("/v1/connect/c1"):+ return _R(202, {"status": "pending"}) if len([c for c in calls if c[0] == "GET" and "connect" in c[1]]) == 1 else \+ _R(200, {"status": "ready", "api_key": "sk-hr-" + "a" * 64, "endpoint": "https://api.harnessrouter.ai/v1/provider",+ "models_url": "https://api.harnessrouter.ai/v1/models", "org": "org1"})+ return _R(200, {"backends": {"codex": {"models": [{"id": "gpt-5.4", "available": True}]}}})+ monkeypatch.setattr(A.httpx, "AsyncClient", _Client)+ async def admin(req): return None+ monkeypatch.setattr(A, "_require_integrations_admin", admin)+ class Req:+ headers = {"host": "console.local"}+ start = asyncio.run(A.admin_connect_start(A.ConnectBody(instance="console.local"), Req()))+ assert start == {"code": "c1", "url": "https://app.harnessrouter.ai/get-key?code=c1", "expires_in": 1800}+ assert "secret" not in start and A._CONNECTS["c1"]["secret"] == "s1"+ pending = asyncio.run(A.admin_connect_poll("c1", Req()))+ assert pending.status_code == 202+ ready = asyncio.run(A.admin_connect_poll("c1", Req()))+ assert ready["status"] == "ready" and ready["api_key"].startswith("sk-hr-") and ready["endpoint"].endswith("/v1/provider")+ assert ready["balance_url"] == "https://api.harnessrouter.ai/v1/balance" # the hosted default when the payload has none+ assert ready["models"] == ["gpt-5.4"] and A._VENDOR_MODELS["harnessrouter"] == {"gpt-5.4": "gpt-5.4"}+ assert [c for c in calls if c[0] == "GET" and "connect" in c[1]][0][2] == {"X-Connect-Secret": "s1"}+ # The hosted side hands the key over once; this side answers every later poll with the same+ # body (no second hosted read), so a poll that overtook a slow one cannot lose the key.+ n_hosted = len([c for c in calls if c[0] == "GET" and "connect" in c[1]])+ again = asyncio.run(A.admin_connect_poll("c1", Req()))+ assert again == ready and len([c for c in calls if c[0] == "GET" and "connect" in c[1]]) == n_hosted+ # ...until the code's own lifetime is over.+ A._CONNECTS["c1"]["at"] -= A._CONNECT_TTL + 1+ with pytest.raises(A.HTTPException) as ei:+ asyncio.run(A.admin_connect_poll("c1", Req()))+ assert ei.value.status_code == 410 and "c1" not in A._CONNECTS+++def test_the_balance_is_read_here_with_the_stored_key_and_absent_when_the_read_fails(monkeypatch):+ seen = []+ answers = {"code": 200, "body": {"org": "o1", "plan": "free", "balance_usd": 41.22, "is_deficit": False, "currency": "usd", "as_of": "2026-09-11T03:20:00Z"}}+ class _Client:+ def __init__(self, *a, **k): pass+ async def __aenter__(self): return self+ async def __aexit__(self, *a): return False+ async def get(self, url, headers=None):+ seen.append((url, headers)); return _R(answers["code"], answers["body"])+ monkeypatch.setattr(A.httpx, "AsyncClient", _Client)+ bal = asyncio.run(A._hosted_balance("sk-hr-" + "b" * 64, "https://api.harnessrouter.ai/v1/balance"))+ assert bal == {"usd": 41.22, "is_deficit": False, "as_of": "2026-09-11T03:20:00Z"}+ assert seen[-1] == ("https://api.harnessrouter.ai/v1/balance", {"authorization": "Bearer sk-hr-" + "b" * 64})+ assert asyncio.run(A._hosted_balance("", "")) is None and len(seen) == 1 # no key, no call+ for code in (401, 503):+ answers["code"] = code; answers["body"] = {"error": "x"}+ assert asyncio.run(A._hosted_balance("sk-hr-" + "b" * 64)) is None # nothing, never a stale figure+ answers["code"] = 200; answers["body"] = {"balance_usd": "41.22"}+ assert asyncio.run(A._hosted_balance("sk-hr-" + "b" * 64)) is None # a figure that is not a number is no figurediff --git a/runner/server.py b/runner/server.pyindex 9701b41b..245126d7 100644--- a/runner/server.py+++ b/runner/server.py@@ -2516,8 +2516,17 @@ _GOOGLE_SIG_SKIP = "skip_thought_signature_validator"_GOOGLE_HOST = "generativelanguage.googleapis.com"-# The relay's route carries no provider, only the upstream: TokenRouter's channels are the host.-_STRICT_GEMINI_HOST = "api.tokenrouter.com"+# The relay's route carries no provider, only the upstream: a Gemini channel is known by its host.+# TokenRouter serves Google's native API under its own root, and the hosted HarnessRouter service+# (HR_HOSTED_BASE, the same knob the gateway reads) fronts TokenRouter's channel for Gemini.+_STRICT_GEMINI_HOSTS = tuple(h for h in (+ "api.tokenrouter.com",+ urllib.parse.urlsplit(os.environ.get("HR_HOSTED_BASE", "https://api.harnessrouter.ai")).netloc) if h)+++def _gemini_channel(base: str) -> bool:+ """Whether `base` is a provider that serves Google's native API under its own root."""+ return any(h in base for h in _STRICT_GEMINI_HOSTS)# ── Gemini function declarations through a strict channel ────────────────────────────────# Google's native API validates function declarations against its own Schema (type, format,# description, nullable, enum, properties, required, items, min/max, anyOf and a few more) and@@ -2756,7 +2765,7 @@ class _HermesRelayHandler(http.server.BaseHTTPRequestHandler):if google and body is not None and self.path.endswith("/chat/completions"):body = _google_with_signatures(body, flags.setdefault("google_sigs", {}))headers["content-length"] = str(len(body))- if (_STRICT_GEMINI_HOST in base and "gemini" in str(_body_model).lower()+ if (_gemini_channel(base) and "gemini" in str(_body_model).lower()and body is not None and self.path.endswith("/chat/completions")):# TokenRouter's Gemini channels hand a harness's JSON-schema tool declarations to Google's# validator as sent; the broker does the same normalisation for brokered traffic@@ -3007,10 +3016,11 @@ def _relay_base_with_version(base_url: str) -> str:def _gemini_relay_route(host_root: str, api_key: str, model: str = "", native_model: str = "") -> tuple[str, str]:"""Register one gemini turn's upstream for Google's native API on a provider that serves it: the- host root, no version segment, since the CLI appends /v1beta/models/<id>:... itself and names the- model the way the gateway resolved it through the connection's vendor table (google/<id> on- TokenRouter). The same shape as the hosted broker's native path: re-rooted at the provider's host,- the key in x-goog-api-key. → (GOOGLE_GEMINI_BASE_URL for the CLI, placeholder key)."""+ connection's base without its /v1 version segment (TokenRouter's host root, the hosted service's+ /v1/provider door), since the CLI appends /v1beta/models/<id>:... itself and names the model the+ way the gateway resolved it through the connection's vendor table (google/<id> on TokenRouter,+ the canonical id on the hosted door). The same shape as the hosted broker's native path: re-rooted+ at the provider's base, the key in x-goog-api-key. → (GOOGLE_GEMINI_BASE_URL, placeholder key)."""with _HERMES_RELAY["lock"]:if _HERMES_RELAY["server"] is None:srv = http.server.ThreadingHTTPServer(("127.0.0.1", 0), _HermesRelayHandler)@@ -3341,13 +3351,13 @@ def _build_gemini(provider: str, auth: Auth, model: str, prompt: str, cwd: str,home = pathlib.Path(cwd) / ".harness" / "home"home.mkdir(parents=True, exist_ok=True)env["HOME"] = str(home) # sessions/skills/settings live INSIDE the workspace- if auth.base_url and _STRICT_GEMINI_HOST in auth.base_url:- # A TokenRouter connection: it serves Google's native API under the vendor prefix (measured- # 2026-09-07 for the seven Gemini ids its table carries), so the CLI is pointed at the- # loopback relay, which owns the prefix and the real key; the CLI keeps its own model id, so- # the pinned resolutions and the served-model check below are unchanged.- root = urllib.parse.urlsplit(auth.base_url)- relay_base, relay_tok = _gemini_relay_route(f"{root.scheme}://{root.netloc}", auth.api_key, model, native_model or "")+ if auth.base_url and _gemini_channel(auth.base_url):+ # A TokenRouter or hosted connection: it serves Google's native API under its own root and+ # its own name for the model (TokenRouter's vendor prefix, measured 2026-09-07 for the seven+ # Gemini ids its table carries; the hosted door takes the canonical id), so the CLI is pointed+ # at the loopback relay, which owns that name and the real key; the CLI keeps its own model+ # id, so the pinned resolutions and the served-model check below are unchanged.+ relay_base, relay_tok = _gemini_relay_route(auth.base_url.rstrip("/").removesuffix("/v1"), auth.api_key, model, native_model or "")env["GOOGLE_GEMINI_BASE_URL"] = relay_baseenv["GEMINI_API_KEY"] = relay_tokelse:diff --git a/runner/tests/test_gemini_build.py b/runner/tests/test_gemini_build.pyindex aa4da49f..fa3bbf48 100644--- a/runner/tests/test_gemini_build.py+++ b/runner/tests/test_gemini_build.py@@ -272,6 +272,20 @@ def test_a_tokenrouter_connection_points_the_cli_at_the_relay_which_names_the_moassert "GOOGLE_GEMINI_BASE_URL" not in env2 and env2["GEMINI_API_KEY"] == "AIza-t" # Google direct, as before+def test_a_hosted_connection_points_the_cli_at_the_relay_rooted_at_the_provider_door():+ """The hosted HarnessRouter service serves Google's native API under its /v1/provider door with+ the CANONICAL id on the path (<base>/v1beta/models/gemini-3.8-flash:...): the relay keeps the+ door as the root (only a trailing /v1 version segment is dropped, TokenRouter's case) and, the+ gateway having resolved the same id, rewrites nothing on the path."""+ d = tempfile.mkdtemp(); env: dict = {}+ _build_gemini("google", Auth(api_key="sk-hr-real", base_url="https://api.harnessrouter.ai/v1/provider"), "gemini-3.8-flash", "hi", d, env, native_model="gemini-3.8-flash")+ assert env["GOOGLE_GEMINI_BASE_URL"].startswith("http://127.0.0.1:")+ assert env["GEMINI_API_KEY"] != "sk-hr-real"+ base, key, flags = _HERMES_RELAY["routes"][env["GEMINI_API_KEY"]]+ assert base == "https://api.harnessrouter.ai/v1/provider" and key == "sk-hr-real"+ assert flags == {"google_native": True, "model": "gemini-3.8-flash", "native_model": "gemini-3.8-flash"}++def test_the_helper_model_tiers_are_the_turns_own_model():"""The CLI's routing, plan, compression and loop checks use its flash or pro classifier tier; aturn's stats then name that helper model too, which read as a substitution (2026-09-07)."""diff --git a/ui/public/brand/harnessrouter-logo-mark-dark.png b/ui/public/brand/harnessrouter-logo-mark-dark.pngnew file mode 100644index 00000000..f8d0966cBinary files /dev/null and b/ui/public/brand/harnessrouter-logo-mark-dark.png differdiff --git a/ui/src/app/(app)/integrations/page.tsx b/ui/src/app/(app)/integrations/page.tsxindex 276a1e5c..3c58966d 100644--- a/ui/src/app/(app)/integrations/page.tsx+++ b/ui/src/app/(app)/integrations/page.tsx@@ -26,6 +26,9 @@ interface Integration {/** Image models this integration can serve. Separate from `models`: an image model offered in* a chat picker is a choice that cannot work. */image_models?: ModelRow[];+ /** What is left to spend on the hosted account, read by the server with the stored key; absent+ * while unknown, so nothing is shown rather than a stale figure. */+ balance?: { usd: number; is_deficit: boolean; as_of: string };}interface ProviderField { key: string; label: string; placeholder?: string }interface ProviderMeta {@@ -84,6 +87,11 @@ export default function IntegrationsPage() {const [editing, setEditing] = useState<Integration | null>(null); // panel draftconst [editingOriginal, setEditingOriginal] = useState<string | null>(null); // name being edited, null = newconst [confirmDelete, setConfirmDelete] = useState<string | null>(null);+ // The hosted key hand-off: this console asks its own gateway to open one (the secret stays+ // there), opens the hosted page in a new tab, and polls the code until the key is ready. The+ // poll is the mechanism, so a localhost install and a blocked popup both work; the hosted page+ // may also post the same payload to its opener, which lands the key a beat sooner.+ const [handoff, setHandoff] = useState<{ code: string; url: string; state: 'waiting' | 'ready' | 'failed'; frame: boolean; note: string } | null>(null);const reload = useCallback(() => {harnessFetch('/api/harness/v1/admin/integrations', { headers: authHeaders() })@@ -118,6 +126,71 @@ export default function IntegrationsPage() {} finally { setBusy(false); }}+ const receiveKey = useCallback((payload: { api_key?: string; endpoint?: string; models_url?: string; balance_url?: string; models?: string[]; name?: string }) => {+ const key = payload?.api_key;+ if (!key) return;+ const ids = Array.isArray(payload.models) ? payload.models : null;+ if (ids) {+ // The model list is per key, so it arrives with the key: the catalog entry the open modal+ // reads is refreshed in place rather than after a reload.+ setDoc((cur) => cur ? { ...cur, catalog: cur.catalog.map((c) => c.id === 'harnessrouter'+ ? { ...c, models: ids.map((m) => ({ canonical: m, provider_id: m })) } : c) } : cur);+ }+ setEditing((cur) => cur ? {+ ...cur,+ name: cur.name.trim() || (typeof payload.name === 'string' && payload.name.trim()) || 'HarnessRouter API',+ provider: 'harnessrouter',+ config: { ...cur.config, api_key: key,+ ...(payload.endpoint ? { base_url: payload.endpoint } : {}),+ ...(payload.models_url ? { models_url: payload.models_url } : {}),+ ...(payload.balance_url ? { balance_url: payload.balance_url } : {}) },+ } : cur);+ setHandoff((h) => h ? { ...h, state: 'ready', note: 'Key received. Create the integration to finish.' } : h);+ }, []);++ async function getKey() {+ setErr('');+ try {+ const r = await harnessFetch('/api/harness/v1/admin/connect', {+ method: 'POST', headers: authHeaders(),+ body: JSON.stringify({ instance: typeof window !== 'undefined' ? window.location.host : '' }),+ });+ if (!r.ok) throw new Error((await r.json().catch(() => null))?.detail || `${r.status}`);+ const j = await r.json() as { code: string; url: string };+ // The hosted steps run inside this window, in a dialog over the form; the poll below carries the key.+ setHandoff({ code: j.code, url: j.url, state: 'waiting', frame: true, note: 'Finish in the HarnessRouter window. The key lands here on its own.' });+ } catch (e) {+ // The answer belongs under the card the click came from; the page notice sits behind the modal.+ setHandoff({ code: '', url: '', state: 'failed', frame: false,+ note: (e instanceof Error && e.message) || 'HarnessRouter could not be reached. Get a key again.' });+ }+ }++ // Poll the open hand-off every two seconds until it is ready or gone; stop when the modal closes.+ // This is the one path the key takes: the ready body is the record (key, endpoint, models_url,+ // name, models), and a message from the hosted page could only carry less and land first.+ useEffect(() => {+ if (!handoff || handoff.state !== 'waiting' || !editing) return;+ // One poll in flight at a time: the next is scheduled when the previous has answered, so a+ // slow answer is never overtaken by a later poll (the ready body is handed over once).+ let alive = true; let timer: ReturnType<typeof setTimeout> | null = null;+ const tick = async () => {+ try {+ const r = await harnessFetch(`/api/harness/v1/admin/connect/${encodeURIComponent(handoff.code)}`, { headers: authHeaders() });+ if (!alive) return;+ if (r.status !== 202) {+ const j = await r.json().catch(() => null);+ if (r.ok && j?.status === 'ready') { receiveKey(j); return; }+ setHandoff((h) => h ? { ...h, state: 'failed', note: j?.detail || `The hand-off answered ${r.status}. Get a key again.` } : h);+ return;+ }+ } catch { /* the next tick asks again */ }+ if (alive) timer = setTimeout(tick, 2000);+ };+ timer = setTimeout(tick, 2000);+ return () => { alive = false; if (timer) clearTimeout(timer); };+ }, [handoff, editing, receiveKey]);+const catalog = useMemo(() => doc?.catalog || [], [doc]);const metaFor = useCallback((id: string) => catalog.find((c) => c.id === id), [catalog]);@@ -174,7 +247,15 @@ export default function IntegrationsPage() {{doc.integrations.map((i) => (<tr key={i.name} className="object-row" style={{ cursor: 'pointer' }}onClick={() => { setEditing(JSON.parse(JSON.stringify(i))); setEditingOriginal(i.name); }}>- <td><strong>{i.name}</strong></td>+ <td><strong>{i.name}</strong>+ {i.balance && (+ <div className="itg-balance-row">+ <span className={'itg-balance' + (i.balance.usd <= 0 ? ' out' : '')}>+ {i.balance.usd <= 0 ? '$0.00 left, top up' : `$${i.balance.usd.toFixed(2)} left`}+ </span>+ </div>+ )}+ </td><td>{labelFor(i.provider)}</td><td className="itg-desktop-col"><span className="itg-models">{i.models.map((m) => m.canonical).join(', ') || '—'}</span></td><td className="itg-row-actions">@@ -239,7 +320,7 @@ export default function IntegrationsPage() {<div className="modal-header"><div><h2 id="itgTitle">{editingOriginal ? 'Edit Integration' : 'Add Integration'}</h2><p>A provider connection plus the models it serves.</p></div>- <button className="icon-button modal-close" type="button" aria-label="Close dialog" onClick={() => setEditing(null)}><iconify-icon icon="tabler:x"></iconify-icon></button>+ <button className="icon-button modal-close" type="button" aria-label="Close dialog" onClick={() => { setEditing(null); setHandoff(null); }}><iconify-icon icon="tabler:x"></iconify-icon></button></div><div className="modal-body"><div className="field-stack">@@ -247,8 +328,23 @@ export default function IntegrationsPage() {<input id="itgName" value={editing.name} placeholder="OpenRouter production"onChange={(e) => setEditing({ ...editing, name: e.target.value })} /></div><div className="field"><label>Provider</label>+ {catalog.some((c) => c.id === 'harnessrouter') && (+ <button type="button" className={'itg-hosted' + (editing.provider === 'harnessrouter' ? ' on' : '')}+ disabled={Boolean(editingOriginal)}+ onClick={() => setEditing({ ...editing, provider: 'harnessrouter', config: {} })}>+ <span className="itg-hosted-head">+ <strong>HarnessRouter API</strong>+ <a className="itg-hosted-link" href="#get-key"+ onClick={(e) => { e.preventDefault(); e.stopPropagation(); setEditing({ ...editing, provider: 'harnessrouter', config: editing.provider === 'harnessrouter' ? editing.config : {} }); void getKey(); }}>+ Get a key ↗</a>+ </span>+ <span className="itg-hosted-accent">Every model at its listed price, no markup</span>+ <span className="itg-hosted-muted">One universal key, every model on the list.</span>+ </button>+ )}+ {catalog.some((c) => c.id === 'harnessrouter') && <div className="itg-or"><span>OR BRING YOUR OWN</span></div>}<div className="itg-provider-list">- {catalog.map((c) => (+ {catalog.filter((c) => c.id !== 'harnessrouter').map((c) => (<button key={c.id} type="button"className={'itg-provider' + (editing.provider === c.id ? ' on' : '')}disabled={Boolean(editingOriginal)}@@ -347,7 +443,10 @@ export default function IntegrationsPage() {);})}{meta.base_url ? (- <p className="field-help">Endpoint: <code>{meta.base_url}</code></p>+ <p className="field-help">Endpoint: <code>{editing.config.base_url || meta.base_url}</code></p>+ ) : null}+ {editing.provider === 'harnessrouter' && handoff ? (+ <p className={'field-help itg-handoff ' + handoff.state} role="status">{handoff.note}</p>) : null}</div>);@@ -367,6 +466,18 @@ export default function IntegrationsPage() {</div>);}+ if (!models.length) {+ return (+ <div className="field">+ <label>Supported models</label>+ <p className="field-help">+ {editing.provider === 'harnessrouter'+ ? 'Maintained here, not by you: the list of models arrives with your key.'+ : 'Maintained here, not by you: no models are listed for this provider yet.'}+ </p>+ </div>+ );+ }return (<div className="field"><label>Supported models</label>@@ -405,6 +516,19 @@ export default function IntegrationsPage() {</div>)}+ {editing && handoff && handoff.state === 'waiting' && handoff.frame && (+ <div className="modal-backdrop itg-frame-backdrop" onClick={(e) => e.stopPropagation()}>+ <section className="itg-frame" role="dialog" aria-modal="true" aria-label="Get a key">+ <button type="button" className="itg-frame-close" aria-label="Close"+ onClick={() => setHandoff((h) => h ? { ...h, frame: false } : h)}>+ <iconify-icon icon="tabler:x"></iconify-icon>+ </button>+ <iframe className="itg-frame-view" title="HarnessRouter" allow="clipboard-write"+ src={handoff.url + (handoff.url.includes('?') ? '&' : '?') + 'embed=1'} />+ </section>+ </div>+ )}+{confirmDelete && doc && (<div className="modal-backdrop"><section className="modal" role="dialog" aria-modal="true" onClick={(e) => e.stopPropagation()}>diff --git a/ui/src/app/revamp.css b/ui/src/app/revamp.cssindex e9e3a647..7230f3e5 100644--- a/ui/src/app/revamp.css+++ b/ui/src/app/revamp.css@@ -1654,6 +1654,37 @@ main .hr-wrap { max-width: 1320px; margin: 0 auto; padding: 28px 32px 64px; }.itg-addmap .select { width: 260px; }.itg-panel { max-width: 560px; }.itg-provider-list { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 8px; }+ /* the hosted service as a provider: a card above the grid, then "or bring your own" */+ .itg-hosted { display: grid; gap: 4px; width: 100%; text-align: left; padding: 12px 14px; margin-bottom: 10px;+ border: 1px solid var(--line); border-radius: 10px; background: var(--surface); cursor: pointer; }+ .itg-hosted.on { border-color: var(--accent); background: var(--accent-soft); }+ .itg-hosted:disabled { opacity: .55; cursor: default; }+ .itg-hosted-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; font-size: 14px; }+ .itg-hosted-link { font-size: 12.5px; font-weight: 600; color: var(--accent); text-decoration: none; white-space: nowrap; }+ .itg-hosted-link:hover { text-decoration: underline; }+ .itg-hosted-accent { font-size: 12.5px; font-weight: 600; color: var(--accent); }+ .itg-hosted-muted { font-size: 12px; color: var(--muted); }+ .itg-or { display: flex; align-items: center; gap: 10px; margin: 2px 0 10px; color: var(--muted);+ font-size: 10.5px; font-weight: 700; letter-spacing: .08em; }+ .itg-or::before, .itg-or::after { content: ''; flex: 1; border-top: 1px solid var(--line); }+ /* what is left to spend on the hosted account: an amber pill on its own row under the name */+ .itg-balance-row { margin-top: 5px; }+ .itg-balance { display: inline-block; padding: 2px 9px; border-radius: 999px;+ font-size: 11.5px; font-weight: 600; line-height: 16px; color: #8a5a00;+ background: #fff3cf; border: 1px solid rgba(214, 150, 0, .38); white-space: nowrap; }+ .itg-balance.out { color: var(--red); background: var(--red-soft); border-color: rgba(180, 70, 15, .28); }+ .itg-handoff.ready { color: var(--accent); }+ .itg-handoff.failed { color: var(--red); }+ /* the hosted steps (sign in, top up, key) in a dialog over the form: a white sheet holding the+ hosted page in a frame, a close X in its corner; the poll on the form carries the key */+ .itg-frame-backdrop { z-index: 1001; }+ .itg-frame { position: relative; width: min(560px, 94vw); background: #fff; border-radius: 18px;+ overflow: hidden; box-shadow: 0 24px 64px rgba(0,0,0,.28); }+ .itg-frame-view { display: block; width: 100%; height: min(760px, 88vh); border: 0; }+ .itg-frame-close { position: absolute; top: 10px; right: 10px; width: 32px; height: 32px; display: inline-flex;+ align-items: center; justify-content: center; border: 0; border-radius: 8px; background: transparent;+ color: var(--muted); font-size: 18px; cursor: pointer; }+ .itg-frame-close:hover { background: var(--surface); color: var(--fg); }.itg-provider { padding: 9px 12px; border: 1px solid var(--line); border-radius: 8px;background: var(--surface); font-size: 13px; font-weight: 600; cursor: pointer; text-align: left; }.itg-provider.on { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); }diff --git a/ui/src/app/v2.css b/ui/src/app/v2.cssindex 50eeb6bd..0675b44e 100644--- a/ui/src/app/v2.css+++ b/ui/src/app/v2.css@@ -794,6 +794,28 @@ body {.v2-socials { display: flex; align-items: center; gap: 2px; padding: 0 8px 4px; }.v2-social { display: grid; place-items: center; width: 26px; height: 26px; border-radius: 6px; color: var(--v2-cap); font-size: 16px; text-decoration: none; }.v2-social:hover { background: var(--v2-row); color: var(--v2-ink); }+button.v2-social { border: 0; background: none; padding: 0; cursor: pointer; font: inherit; }+button.v2-social:hover { background: var(--v2-row); }+/* Book a call: the homepage's dialog (harnessrouter.ai globals.css, .book-demo-*), the Calendly page in a+ frame with our mark until it is running. */+.book-demo-dialog { margin: auto; width: min(720px, calc(100vw - 32px)); height: min(780px, calc(100dvh - 48px));+ padding: 0; border: none; border-radius: 16px; overflow: hidden; background: #fff; position: relative; }+.book-demo-dialog::backdrop { background: rgba(12, 14, 20, 0.55); }+.book-demo-close { position: absolute; top: 10px; right: 10px; z-index: 3; display: inline-flex; align-items: center;+ justify-content: center; width: 36px; height: 36px; border: none; border-radius: 50%; background: rgba(12, 14, 20, 0.06);+ color: var(--v2-ink); font-size: 18px; cursor: pointer; }+.book-demo-close:hover { background: rgba(12, 14, 20, 0.12); }+.book-demo-frame { width: 100%; height: 100%; border: none; display: block; }+.book-demo-loading { z-index: 2; position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center;+ justify-content: center; gap: 6px; background: #fff; text-align: center; padding: 24px; opacity: 1; transition: opacity 320ms ease-out; }+.book-demo-loading-done { opacity: 0; pointer-events: none; }+.book-demo-loading-mark { margin-bottom: 16px; animation: book-demo-pulse 1.6s ease-in-out infinite; }+.book-demo-loading-title { max-width: 360px; margin: 0; font-size: 22px; line-height: 1.3; font-weight: 650; letter-spacing: -0.01em;+ color: var(--v2-ink); text-wrap: balance; }+.book-demo-loading-title em { color: var(--v2-accent); font-family: Georgia, "Times New Roman", serif; font-style: italic; font-weight: 400; }+.book-demo-loading-subtitle { margin: 10px 0 0; font-size: 13px; color: var(--v2-cap); }+@keyframes book-demo-pulse { 0%, 100% { opacity: 1; transform: scale(1); } 50% { opacity: 0.45; transform: scale(0.92); } }+@media (prefers-reduced-motion: reduce) { .book-demo-loading-mark { animation: none; } }/* ── Quickstart, per the design: four steps on a rail ── */.qs { display: flex; flex-direction: column; min-height: 100%; }diff --git a/ui/src/components/BookCallDialog.tsx b/ui/src/components/BookCallDialog.tsxnew file mode 100644index 00000000..eda43d87--- /dev/null+++ b/ui/src/components/BookCallDialog.tsx@@ -0,0 +1,64 @@+'use client';+// A call with us, booked without leaving the console: the homepage's dialog (harnessrouter.ai,+// BookDemoLink), the Calendly page in a frame with our mark shown until it is running. The+// sidebar opens it from the calendar mark beside the community links.+import { useCallback, useEffect, useRef, useState } from 'react';++export const BOOK_CALL_URL = 'https://calendly.com/contact-harnessrouter/30min';++export function BookCallDialog({ open, onClose }: { open: boolean; onClose: () => void }) {+ const ref = useRef<HTMLDialogElement>(null);+ const [frameMounted, setFrameMounted] = useState(false);+ const [frameLoaded, setFrameLoaded] = useState(false);+ const [embedUrl, setEmbedUrl] = useState('');++ useEffect(() => {+ const d = ref.current;+ if (!d) return;+ if (open) {+ // embed_domain is the host the page is on, as Calendly asks; computed here, never at render.+ setEmbedUrl(`${BOOK_CALL_URL}?embed_domain=${encodeURIComponent(window.location.hostname)}&embed_type=PopupWidget&hide_gdpr_banner=1`);+ setFrameMounted(true);+ if (!d.open) d.showModal();+ } else if (d.open) {+ d.close();+ }+ }, [open]);++ // The frame's onLoad fires when Calendly's document arrives, well before its app renders.+ // Calendly posts `calendly.*` messages once it is running, so the first one is the accurate+ // hide signal; onLoad only arms a late fallback in case messaging is unavailable.+ useEffect(() => {+ if (!frameMounted || frameLoaded) return;+ const onMessage = (e: MessageEvent) => {+ const data: unknown = e.data;+ if (!(e.origin.endsWith('.calendly.com') || e.origin === 'https://calendly.com')) return;+ if (typeof data === 'object' && data !== null && 'event' in data && typeof (data as { event: unknown }).event === 'string'+ && ((data as { event: string }).event.startsWith('calendly.') || (data as { event: string }).event.startsWith('calendly:'))) {+ setFrameLoaded(true);+ }+ };+ window.addEventListener('message', onMessage);+ return () => window.removeEventListener('message', onMessage);+ }, [frameMounted, frameLoaded]);++ const onBackdrop = useCallback((e: React.MouseEvent<HTMLDialogElement>) => { if (e.target === ref.current) onClose(); }, [onClose]);++ return (+ <dialog aria-label="Book a call" className="book-demo-dialog" ref={ref} onClick={onBackdrop} onClose={onClose}>+ <button aria-label="Close" className="book-demo-close" type="button" onClick={onClose}>+ <iconify-icon icon="tabler:x"></iconify-icon>+ </button>+ {frameMounted && embedUrl ? (+ <iframe className="book-demo-frame" src={embedUrl} title="Schedule a meeting with HarnessRouter"+ onLoad={() => { window.setTimeout(() => setFrameLoaded(true), 4000); }} />+ ) : null}+ <div aria-hidden={frameLoaded} className={frameLoaded ? 'book-demo-loading book-demo-loading-done' : 'book-demo-loading'}>+ {/* eslint-disable-next-line @next/next/no-img-element -- static brand asset */}+ <img alt="" className="book-demo-loading-mark" src="/brand/harnessrouter-logo-mark-dark.png" width={56} height={56} />+ <p className="book-demo-loading-title">The best agent harnesses as your infrastructure, <em>one conversation away.</em></p>+ <p className="book-demo-loading-subtitle">Finding the best time slots for you…</p>+ </div>+ </dialog>+ );+}diff --git a/ui/src/components/revamp/Shell.tsx b/ui/src/components/revamp/Shell.tsxindex f2209fad..a1a857fc 100644--- a/ui/src/components/revamp/Shell.tsx+++ b/ui/src/components/revamp/Shell.tsx@@ -7,6 +7,7 @@import 'iconify-icon';import { useCallback, useEffect, useMemo, useRef, useState } from 'react';import { useQuickstart, quickstartDone } from '@/lib/quickstart';+import { BookCallDialog } from '@/components/BookCallDialog';import Link from 'next/link';import { usePathname, useRouter } from 'next/navigation';import { getSession, logout } from '@/lib/auth';@@ -43,7 +44,8 @@ function highlight(text: string, q: string): React.ReactNode {// the owner's direction the current chat workbench is embedded untouched until he guides that// migration, and it must stay reachable. Unbuilt pages (Benchmark) are not listed at all.type NavItem = { href?: string; icon?: string; img?: string; label: string; soon?: boolean };-/** Where the community is. Shown as a row of marks in the expanded sidebar; as menu entries on the rail. */+/** Where the community is. Shown as a row of marks in the expanded sidebar; as menu entries on the rail.+ * A fifth mark, the calendar, books a call with us in a dialog (the homepage's). */const SOCIALS = [{ label: 'Discord', href: 'https://discord.gg/nPcbwqVPb2', icon: 'tabler:brand-discord' },{ label: 'GitHub', href: 'https://github.com/HarnessRouter', icon: 'tabler:brand-github' },@@ -89,6 +91,7 @@ export function Shell({ children, credits }: { children: React.ReactNode; creditconst [wsBusy, setWsBusy] = useState(false);const [wsErr, setWsErr] = useState('');const [acctMenu, setAcctMenu] = useState(false);+ const [bookCall, setBookCall] = useState(false); // the Book a call dialog// Not a build-time constant: the image is built once and credentials are set when it runs.const [selfHostUser, setSelfHostUser] = useState('');useEffect(() => {@@ -475,6 +478,9 @@ export function Shell({ children, credits }: { children: React.ReactNode; credit<iconify-icon icon={x.icon}></iconify-icon></a>))}+ <button type="button" className="v2-social" title="Book a call" aria-label="Book a call" onClick={() => setBookCall(true)}>+ <iconify-icon icon="tabler:calendar"></iconify-icon>+ </button></div>)}<button className="v2-account" type="button" aria-expanded={acctMenu}@@ -505,6 +511,9 @@ export function Shell({ children, credits }: { children: React.ReactNode; credit{railed && SOCIALS.map((x) => (<a key={x.label} className="menu-item" href={x.href} target="_blank" rel="noreferrer"><iconify-icon icon={x.icon}></iconify-icon>{x.label}</a>))}+ {railed && (+ <button className="menu-item" type="button" onClick={() => { setAcctMenu(false); setBookCall(true); }}><iconify-icon icon="tabler:calendar"></iconify-icon>Book a call</button>+ )}{SELF_HOSTED ? (<button className="menu-item" type="button" onClick={async () => {setAcctMenu(false);@@ -518,6 +527,7 @@ export function Shell({ children, credits }: { children: React.ReactNode; credit</div>)}</div>+ <BookCallDialog open={bookCall} onClose={() => setBookCall(false)} /></aside>{/* Cmd+K search: the v2 chrome has no header, so search lives in a palette overlay. All