mirror of
https://github.com/nesquena/hermes-webui.git
synced 2026-06-01 06:30:22 +00:00
932694aec6
Replaces the 1.5s HTTP polling loop with a Server-Sent Events endpoint at /api/approval/stream that pushes approval events to the browser instantly. The backend uses a thread-safe subscriber registry (_approval_sse_subscribers) with bounded queues to prevent memory leaks from slow clients. Frontend uses EventSource with automatic fallback to 3s HTTP polling on SSE error. - Backend: subscribe/unsubscribe/notify lifecycle in api/routes.py - New route: GET /api/approval/stream?session_id= - submit_pending() now calls _approval_sse_notify() after queue append - Frontend: EventSource with onerror -> _startApprovalFallbackPoll() - 30s keepalive comments, _CLIENT_DISCONNECT_ERRORS handling - 42 new tests (static analysis + unit + concurrency) Co-authored-by: jasonjcwu <jasonjcwu@users.noreply.github.com>