feat: live status dashboard for the voice loop

Add a stdlib-only observability site so you can open a browser and watch,
step by step: whether it is listening, what it heard, what the brain thought
and answered, how long each stage took, and whether anything errored.

- wsai/monitor.py: thread-safe telemetry hub (per-turn timed steps, status
  header, error log) with a pub/sub for live push.
- wsai/dashboard.py: stdlib http.server serving a self-contained page plus an
  SSE (/events) live stream; /api/state snapshot fallback.
- Pipeline emits step-by-step turn telemetry (화면 맥락 → 두뇌 → 응답) and
  listening/running status; optional monitor, so existing paths are untouched.
- `python -m wsai --dashboard` starts the site (0.0.0.0:8787, WSAI_DASHBOARD_PORT)
  and loops the mock voice demo so there is always live activity to watch.
- Tests cover turn recording, per-step timing, error marking, and live push.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
EJClaw
2026-08-16 20:24:13 +09:00
parent 3d76cd6c52
commit 6b0755e1ff
7 changed files with 780 additions and 21 deletions

View File

@@ -4,18 +4,32 @@ concrete class each config name maps to, so adding a backend = one line here."""
from __future__ import annotations
from .config import Settings
from .monitor import Monitor
from .pipeline import Pipeline
def build(settings: Settings) -> Pipeline:
return Pipeline(
def build(settings: Settings, monitor: Monitor | None = None) -> Pipeline:
pipe = Pipeline(
source=_source(settings),
vision=_vision(settings),
brain=_brain(settings),
stt=_stt(settings),
tts=_tts(settings),
text_channel=_text(settings),
monitor=monitor,
)
if monitor is not None:
monitor.set_components(
{
"source": settings.source or "none",
"vision": settings.vision or "none",
"stt": settings.stt or "none",
"brain": settings.brain,
"tts": settings.tts or "none",
"text": settings.text or "none",
}
)
return pipe
def _source(s: Settings):