feat(desktop): ChatV3Pane — flagged chat pane on the new spine

Merged
SA
3mo ago
+1488-3

Chunk C of plans/chat-v3-pane-mount.md, stacked on #6205. New pane kind "chat-v3" (old pane untouched — swap is the flag-flip PR), registered only when the chat-v3 PostHog flag is on. Full §3 tree: anchor-user-turn transcript (content-visibility offscreen, zero streaming scroll writes except the anchor + approval force-scroll), turn-group collapsing with user-override-wins, toolKind-dispatched rows + open-union fallback, per-block memoized MarkdownView with fence-gated highlighting (Streamdown per block, never whole-message), plain-textarea composer with echo-confirmed draft clearing, harness picker + separate session-status/connection indicators. ai-elements reused per the four never-reuse rules. Wiring: workspace-client host URL, tRPC at /chat-v3/trpc (type-only ChatRouter via tsconfig paths — no runtime dep), WS with per-reconnect token per wsAuth. 117 desktop tests green.

Known merge-time reconciliations: adopt FEATURE_FLAGS.CHAT_V3 from #6203's shared constant (this branch couldn't see it); CDP checklist from the build report covers relay affinity (primeRelayAffinity), real line-diff rendering (follow-up), scroll/perf under live streaming.

https://claude.ai/code/session_01XRFCEPsfmJHu2SenDKYJ2h


Summary by cubic

Adds a new desktop pane for the chat v3 experience, gated by the PostHog chat-v3 flag (via FEATURE_FLAGS.CHAT_V3). Ships transcript/composer/session wiring to the new chat runtime and fixes draft persistence by registering the composer draft key.

  • New Features

    • Registers a new "chat-v3" pane only when the chat-v3 flag is enabled.
    • Transcript: grouped turns with offscreen content-visibility, anchor-to-latest user turn, and auto-scroll to first pending approval.
    • Rich rows: per-block streaming Markdown with fence-aware rendering, reasoning toggle, tool calls (diff/terminal/text), approvals (options + decisions), plans, and notices.
    • Composer: plain textarea with Enter-to-send, debounced local draft persisted under chat-v3-draft:* (key registered), echo-based draft clearing; cancel button while a turn is running.
    • Session UX: header badges for harness and live connection status, session picker listing workspace sessions, and new-session flow with harness selection.
    • Wiring: tRPC client to /chat-v3/trpc, WS streaming under /chat-v3 with token from the workspace client on reconnect.
    • useChatSession.sendPrompt now returns the created OutboxEntry used for echo-based draft clearing.
    • Tests: update subscribeToSession to use scope_id after the rename.
  • Migration

    • Update callers of useChatSession.sendPrompt to handle the returned OutboxEntry (was void).
    • Ensure the host exposes /chat-v3/trpc and WS under /chat-v3, and enable the chat-v3 PostHog flag for rollout.
    • New dependency: @superset/chat (and tsconfig path for @superset/chat-runtime).

Summary by CodeRabbit

  • New Features
    • Added a feature-flagged Chat experience for desktop workspaces.
    • Users can create and switch between sessions using Claude Code or Codex.
    • Added message composition with saved drafts, queued-send handling, cancellation, and retry options.
    • Added rich transcript rendering for Markdown, plans, reasoning, tool calls, diffs, terminal output, notices, and approvals.
    • Added connection and session status indicators, older-message loading, and automatic transcript scrolling.
  • Tests
    • Added coverage for streaming Markdown handling and transcript item classification.