feat(web): wire WebSocket chat with streaming and conversation switching (#120) #136

Merged
jason.woltje merged 2 commits from feat/p7-009-web-chat-ws into main 2026-03-15 18:09:15 +00:00

2 Commits

Author SHA1 Message Date
d468e248c2 chore: exclude .claude/ worktree docs from Prettier formatting check
All checks were successful
ci/woodpecker/push/ci Pipeline was successful
The .claude/worktrees/ directory contains auto-generated markdown reports
from the QA automation system that are not authored code and should not
be subject to Prettier style enforcement.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-15 12:57:00 -05:00
c73ed440de feat(web): wire WebSocket chat with streaming and conversation switching (#120)
- Fix socket singleton lifecycle: add destroySocket() and auto-reset on disconnect
  so page remounts always get a fresh authenticated connection
- Add explicit WebSocket transport preference to avoid polling fallback
- Filter socket events by conversationId to prevent cross-conversation bleed
  when switching between conversations mid-stream
- Use activeIdRef pattern so event handlers see current activeId without
  stale closures or listener re-registration on every render
- On agent:end, append accumulated text as assistant message to local state
  (matching TUI pattern; Pi session is in-memory so DB reload would miss it)
- Preserve REST persist of user messages for conversation history on reload
- Clear streaming state on conversation switch
- StreamingMessage: show animated typing indicator before first token arrives

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-15 12:56:14 -05:00