feat(listen): deliver cloud-generated proactive messages to desktop over listen websocket

Merged
AR
2mo ago
+680-0

What changed and why

Delivers cloud-generated proactive messages (mentor prompts, realtime third-party app interjections) directly to the desktop macOS app in real time over the active /v4/listen WebSocket stream. Previously, mid-session proactive interjections from utils/app_integrations.py only reached mobile FCM notifications/webhooks, leaving the desktop ambient listener disconnected from realtime suggestions.

Product invariants affected

none

How it was verified

  1. Ran backend unit tests covering ProactiveMessageEvent serialization, Redis pub/sub dispatching, and process-local session registry:
    python3 -m pytest tests/unit/test_proactive_listen_delivery.py -v -> 10 passed
  2. Ran integration regression suite:
    python3 -m pytest tests/unit/test_async_app_integrations.py -v -> 18 passed
  3. Built and executed desktop Swift unit tests covering event decoding, empty body gating, type recognition, and TTS delivery policy:
    swift test --filter ProactiveListenEventTests -> 9 passed
  4. Formatted modified Python files with black and verified zero regressions.

Tests

  • Backend: backend/tests/unit/test_proactive_listen_delivery.py (10 unit tests)
  • Integration: backend/tests/unit/test_async_app_integrations.py (18 integration tests)
  • Desktop: desktop/macos/Desktop/Tests/ProactiveListenEventTests.swift (9 Swift unit tests)

Failure class (fixes)

Failure-Class: none