- asr_usage.py (stdlib-only): append-only JSONL ledger, per-call/window audio
seconds counted from actually-sent frames (sample-rate aware, resend counted),
connect attempt/failure/retry semantics (normal per-utterance reconnects are
not retries), fail-closed default (real cap=0 unless a window is armed),
pre-send blocking so no byte crosses the cap, ledger replay for restart
recovery and cross-window isolation, resumable summarize CLI
- stt_funasr.py: guard hooks on the real send path (check_connect before
open_utt, precheck before send, count after send, recv-side death recorded,
per-utterance flush aggregation); usage=None keeps prior behavior
- worker.py: entrypoint builds guard from env per job, room name as call id,
on_exhausted -> ctx.shutdown ends the call, window summary in start log
- tests: 17 deterministic offline tests incl. fake livekit/websockets SDK
driving the real _run seam, sample-rate variants, silence/cancel/failure/
reconnect/repeated-end, cap rejection before crossing, ledger persistence
across restart, room deletion keeps history, other windows unaffected
Co-authored-by: multica-agent <github@multica.ai>