Alexander Whitestone
|
8cd511266b
|
feat: add sovereignty metrics emitter and SQLite store (#954)
Tests / lint (pull_request) Has been cancelled
Tests / test (pull_request) Has been cancelled
- Create src/timmy/sovereignty/metrics.py with:
- SovereigntyMetricsStore backed by SQLite (events + sessions tables)
- metrics.record(event_type, metadata) for all 9 sovereignty event types
- get_sovereignty_pct(layer, time_window) for perception/decision/narration
- get_cost_per_hour(time_window) extrapolated from api_cost events
- get_skills_crystallized(session_id) count
- get_snapshot() for dashboard widgets
- emit_sovereignty_event() async helper using event bus
- Add /ws/sovereignty WebSocket endpoint (dashboard/routes/sovereignty_ws.py)
that pushes metric snapshots every 5s to connected clients
- Register sovereignty_ws_router in dashboard/app.py
- Add 34 unit tests (all passing)
Fixes #954
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
|
2026-03-23 15:50:21 -04:00 |
|