Phase 3 of switching the three dashboard resources from REST polling to
SSE push.
- New pure helper packages/core/src/webui/state-stream.ts owns the
debounce/snapshot/fan-out logic, decoupled from Hono so it's unit-testable
with fake timers (7 tests cover initial-snapshot, single-publish coalesce,
per-resource independent debounce, dispose-cancels-pending, snapshot
rejection isolation, send() throw isolation).
- /api/state/stream handler in server.ts mirrors the /api/debug/stream
pattern: ReadableStream + createFramePusher (drop-under-backpressure with
the same {kind:'dropped'} marker), 15s heartbeats, abort-signal teardown.
On connect: one frame per resource. After: a fresh-snapshot frame per
StateBus invalidation, 50ms per-resource debounce.
- The endpoint 503s when stateBus is absent (build without state-wiring),
so clients can still fall back to the REST endpoints; the existing
GET /api/processes etc remain in place for initial fetch + reconcile.
44 test files, 426/426 core suite green.