Candidate 1
Deepen the conversation event stream module
- Files
-
frontend/src/contexts/conversation-websocket-context.tsx,frontend/src/hooks/mutation/conversation-mutation-utils.ts, conversation stores, terminal store, browser store, metrics store. - Problem
- The WebSocket provider has a shallow interface: connection state, event parsing, cache mutation, terminal output, browser observations, optimistic message cleanup, planning-agent handling, and error banners are in one implementation.
- Solution
- Create a deep in-process module that owns event interpretation and hides store/cache implementation behind adapters. The provider becomes a small transport adapter.
- Benefits/Wins
- Higher locality for event behavior, better leverage from one test surface, and a real seam for replaying observations without mounting the whole provider.
Before
flowchart TD
WS["WebSocket provider"]
WS --> Conn["connection state"]
WS --> Parse["JSON parsing"]
WS --> Chat["event store"]
WS --> Cache["query cache"]
WS --> Term["terminal store"]
WS --> Browser["browser store"]
WS --> Metrics["metrics store"]
WS --> Errors["error banners"]
After
flowchart TD
WS["transport adapter"] --> Stream["deep event stream module"]
Stream --> Model["event interpretation"]
Stream --> Effects["effect plan"]
Effects --> CacheA["cache adapter"]
Effects --> StoreA["store adapter"]
Effects --> ObsA["observation adapters"]
Tests["replay tests"] --> Stream