relay-eval: reshape phi API → /api/relays/* + events log
three changes based on phi-integration feedback:
1. drop the /api/phi/ namespace
- /api/phi/monitors → /api/relays
- /api/phi/history → /api/relays/history
these are a general observability surface, not phi-specific.
clean rename; no aliases kept. response shapes unchanged.
2. bound history with timestamps
GET /api/relays/history?name=<host>&since=<iso>&until=<iso>
answers "what was happening at 3am Tuesday" instead of only
"last N points". when since/until are set, returns every point
in the inclusive range (no cap); limit stays as the fallback
for recent-N queries. validates inputs before binding to SQL.
3. new /api/relays/events transition log
GET /api/relays/events?since=<iso>&until=<iso>&name=<host>
returns status-transition rows with from/to status and the
headline captured at transition time. added a monitor_transitions
table; /api/relays appends a row whenever a monitor's status
differs from its prior state. default window 24h; name filter
optional. sorted ascending by ts.
with all three, a caller can ask "what's the state now"
(/api/relays), "what did this host look like over time"
(/api/relays/history), and "what changed, when"
(/api/relays/events) without re-deriving state from raw points.
Co-Authored-By: Claude Opus 4 (1M context) <noreply@anthropic.com>