relay-eval: add /api/phi/monitors endpoint
per-relay monitor objects designed for phi (bluesky bot) to poll
and post about meaningful status transitions. shape:
[{
"name": "...",
"status": "nominal"|"degraded"|"critical",
"headline": "...",
"metrics": { ... },
"last_changed": "<iso8601>",
"checked_at": "<iso8601>"
}, ...]
status logic:
- critical: no connection in recent runs OR short/baseline < 0.70
- degraded: short/baseline < 0.90
- nominal: otherwise
coverage is computed as unique_dids / max(unique_dids) per run
(self-normalizing — replay-heavy relays inflate only their own
coverage above 1.0 instead of deflating everyone else's).
short window = last 3 valid runs (~15 min); baseline = last 24
(~2h). disconnected runs excluded from the mean.
status transitions are tracked in a new monitor_state table so
phi can judge "is this old news" via last_changed.
public read, no auth. adding a monitored relay happens naturally
when a host appears in a run — no phi-side config change needed.
Co-Authored-By: Claude Opus 4 (1M context) <noreply@anthropic.com>