Repository navigation
feat: read-only operator dashboard served by the relay (#79) - #157
Merged
Merged
Conversation
The relay already owns every piece of state an operator needs, but observability was CLI-only. The relay now serves a self-contained read-only dashboard on loopback: - GET /dashboard — one embedded HTML page (no build step, no CDN, no external fonts; offline-safe). Operator-gated: the page requires the operator token via ?token= on first navigation; the page moves it to localStorage and strips it from the URL immediately. - GET /v1/operator/dashboard — auth-v2 proof-gated aggregate: project, participants, sessions (writer ownership/generation), per-role pending + oldest-stored + unanswered-acked aging, recent deliveries (metadata only; bodies behind includeText=1), audit tail. Zero writes. The page speaks auth-v2 from vanilla WebCrypto (challenge + HMAC proof); the math is verified against a live relay. Response proofs are not verified page-side: the view never writes, so a forged response can only paint wrong pixels — documented in the PR. Tests: page gated to operator (403 anonymous/role, 200 operator, no external refs); mutating methods on both paths rejected (409/404); aggregate shape without bodies; includeText opt-in is operator-only; unauthenticated data endpoint rejected. Bodies through the UI are a secret surface: operator-only, opt-in, and off by default.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Проблема (issue #79)
Relay владеет всем состоянием (HTTP API на loopback, SQLite, participants/sessions/audit), но наблюдаемость — только CLI
status/doctorпо запросу. Оператору негде посмотреть состояние команды глазами.Решение — read-only дашборд от самого relay
GET /dashboard— одна embedded HTML-страница (vanilla JS, ноль зависимостей, ноль билд-шага, без CDN/внешних шрифтов — loopback-машина может быть офлайн). Operator-gated: при первом заходе токен через?token=(прямойcredentials.authenticate), страница немедленно переносит его в localStorage и стирает из URL черезhistory.replaceState. Без токена/с ролевым токеном — 403.GET /v1/operator/dashboard— auth-v2 proof-gated агрегат: project, participants, sessions (writer-ownership/generation/state), per-role pending + oldest-stored + unanswered-acked (30 мин), лента последних 50 доставок (метаданные), audit tail (20). Ноль записей в БД.?includeText=1— opt-in на ленте доставок, тот же operator-гейт. Тела через UI = secret surface, operator-only — зафиксировано здесь по просьбе dev.Тесты (test/transport/dashboard.test.ts)
includeText=1отдаёт тела; ролевой токен с флагом — 403.Полный
pnpm verifyзелёный после rebase на свежий main: 137 файлов / 1229 тестов.Ограничения
Closes #79.