dashboard: build same-origin /agent/<name>/ links when gateway is up (closes #842)
When `services.hyperhive.gateway.enable` is on (default), the c0re NixOS module now sets `HIVE_GATEWAY_ENABLED=1` on the service env. `/api/state` exposes the flag as `gateway_enabled`; the SW4RM tab's container-row renderer flips three link sites (primary agent-name link, favicon fetch, `container`-kind nav-strip links) from the legacy `http://<host>:<port>/` direct TCP shape to same-origin `/agent/<name>/` URLs — the gateway proxies them to the per-agent harness via `agent-ports.json` or `agent-sockets.json` (#784 / #815). Gateway-off deploys keep the direct TCP fallback so local-dev / operator opt-out keeps working. `forge`-kind nav-strip links still resolve against `:3000` (separate sub-domain transition, tracked by `forge.behindGateway`); `external`-kind links are already absolute. Mirrors the `HIVE_MATRIX_GUI_ENABLED` env→snapshot-flag pattern. Docs updated: `docs/web-ui.md::Container row` + new `docs/gateway.md::Dashboard link shape` section.
This commit is contained in:
parent
b50f182396
commit
fbc41d42a6
5 changed files with 72 additions and 4 deletions
|
|
@ -104,6 +104,22 @@ appear in `agent-ports.json` (the legacy TCP map) and the gateway
|
|||
falls back to TCP for them. Step 4 of #784 will drop the TCP map +
|
||||
the harness's TCP bind once every agent's flipped.
|
||||
|
||||
## Dashboard link shape (gateway vs direct)
|
||||
|
||||
When the gateway is in front, the SW4RM tab builds per-agent links
|
||||
as same-origin `/agent/<name>/…` URLs instead of the legacy direct
|
||||
`http://<host>:<container.port>/` TCP shape. The signal comes from
|
||||
`StateSnapshot.gateway_enabled`, sourced from the
|
||||
`HIVE_GATEWAY_ENABLED` env the c0re NixOS module sets when
|
||||
`services.hyperhive.gateway.enable = true`. Three render sites
|
||||
flip together: the primary agent-name link, the favicon fetch
|
||||
(`<url>/icon`), and the nav-strip `container`-kind links from
|
||||
`/api/agent/<name>/links`. `forge`-kind nav-strip links still
|
||||
resolve against `http://<host>:3000` (separate sub-domain transition
|
||||
tracked by `forge.behindGateway`); `external`-kind links are
|
||||
already absolute. See `docs/web-ui.md::Container row` for the
|
||||
frontend-side derivation.
|
||||
|
||||
## Sequencing history
|
||||
|
||||
- #15 v0 (per-agent routing, #740) — first sub-app behind the gateway, JSON port table from c0re.
|
||||
|
|
|
|||
|
|
@ -514,8 +514,18 @@ fetch entirely.
|
|||
`GET /api/agent/{name}/links`, a same-origin passthrough proxy
|
||||
that forwards the agent's own link list; the agent backend is
|
||||
the single source of truth. The frontend resolves each
|
||||
`AgentLink.kind` (`container` → `http://host:<container.port>`,
|
||||
`forge` → `http://host:3000`, `external` → already absolute).
|
||||
`AgentLink.kind` against a per-agent base URL that depends on
|
||||
whether hive-gateway is in front (`StateSnapshot.gateway_enabled`,
|
||||
sourced from the `HIVE_GATEWAY_ENABLED` env the c0re NixOS
|
||||
module sets when `services.hyperhive.gateway.enable = true`).
|
||||
Gateway-on (default): `container` → `/agent/<name>/<url>` (same
|
||||
origin, gateway proxies to the per-agent harness — TCP or
|
||||
unix-domain per #784). Gateway-off (legacy / local dev):
|
||||
`container` → `http://<host>:<container.port>/<url>` (direct TCP
|
||||
fallback). Forge links resolve against `http://<host>:3000`,
|
||||
external links are already absolute. The same flag drives the
|
||||
primary agent-name link + favicon fetch (`<url>/icon`), so the
|
||||
whole row routes through the gateway as a unit.
|
||||
**When the container is stopped** (`ContainerView.running = false`),
|
||||
the host clears live-only fields before emitting the state, so
|
||||
the dashboard never renders stale data: the badge chain is
|
||||
|
|
|
|||
Loading…
Reference in a new issue