caelum0x cda90fcef4 feat(gateway): add a judge-facing live web dashboard
STRATEGY-2026-10-23.md names the exact risk this closes: "Ration's
actual differentiators... are invisible in a UI-less terminal demo
unless explicitly called out on screen." A judge can now open a
shareable gateway URL instead of running the TUI locally.

Add gateway.proto's GetDashboardSnapshot RPC (aggregates ListTenants +
per-tenant GetBalance/CheckReserveFloor + ListAgentDecisions into one
round trip — the same ledger-core data services/tui already fetches
per-tenant, just server-side aggregated for a browser) and three new
httpapi routes: GET /v1/dashboard (a single self-contained HTML/CSS/JS
page, zero external dependencies so it renders on a network-isolated
judging box), GET /v1/dashboard/snapshot (polled every 3s for
per-tenant reserve-floor headroom gauges and recent agent-decision
rationale), and GET /v1/dashboard/activity/stream (a true
text/event-stream SSE framing of StreamActivity for the page's
EventSource, separate from the existing NDJSON /v1/activity).

The dashboard is deliberately credential-free (GetDashboardSnapshot
carries no tenant_id/card_id, which internal/tenantauth's own
documented behavior already passes through unscoped); its activity SSE
stream presents gateway's own operator-scoped credential
(Handler.SetDashboardOperatorToken) specifically because
internal/tenantauth's StreamServerInterceptor requires some credential
on every streaming call — scoped narrowly to this one new route so the
existing, still-credentialed /v1/activity route's security posture is
unchanged.

Verified live: snapshot JSON returns correct per-tenant
available/held/headroom; the SSE stream delivers a real simulated-
deposit event end-to-end with zero auth errors; the page itself serves
at 200 text/html.
2026-10-23 19:38:22 +03:00
..