feat(host-service): mount chat-v3 runtime — scope_id rename + tRPC/WS routes behind flag
Chunk A of plans/chat-v3-pane-mount.md (doc included). scope_id rename per §D: the runtime's command layer .omit()s workspaceId and .extend()s scopeId, making workspace vocabulary unrepresentable inside chat-runtime — the mapping exists only at the router binding; migration regenerated in place, generate no-op verified. Mount: packages/host-service/src/chat-v3/ behind SUPERSET_CHAT_V3=1 (ACP gate pattern) — lazy runtime (memoized handler, chat.db untouched until first request), resolveCwd off the workspaces read model, wsAuth reused for both routes, WSContext wraps directly into createWsSink. Also fixes the harness barrel (claude now exported; createClaudeAdapter factory keeps the SDK dep out of host-service). chat-runtime 136 green; host-service 951 green.
https://claude.ai/code/session_01XRFCEPsfmJHu2SenDKYJ2h
Summary by cubic
Mounts the chat-v3 runtime in host-service with tRPC and streaming WS routes, and switches the runtime to group sessions by scope_id (router maps workspaceId → scopeId). Routes are always registered; the desktop gates the pane with the FEATURE_FLAGS.CHAT_V3 flag.
-
New Features
- Routes: tRPC at
/chat-v3/trpcand stream at/chat-v3/sessions/:sessionId/stream?since=&deltas=, both behindwsAuth. - Rollout: routes are unconditional; the UI uses
FEATURE_FLAGS.CHAT_V3to show the pane. No host restart needed. - Lazy runtime: builds on first request; disposed on shutdown.
chat.dbis untouched until then. - CWD resolution:
resolveCwd(workspaceId)reads the hostworkspacestable; throwsChatWorkspaceNotFoundError. - Harnesses: registry with
"claude-code"and"codex";createClaudeAdapterkeeps the SDK out ofhost-serviceand now derives query input types from the Claude SDK (removes an unsafe cast).
- Routes: tRPC at
-
Migration
- Ship the runtime migrations folder; set
SUPERSET_CHAT_V3_MIGRATIONSto override path if needed. - No
host.dbchanges;chat.dblives besidehost.dband is created lazily. - External API still uses
workspaceId; the router maps it toscopeIdinternally (no client changes required).
- Ship the runtime migrations folder; set
Summary by CodeRabbit
- New Features
- Added Chat v3 host-service integration with authenticated chat and streaming routes.
- Added support for Claude-powered chat sessions.
- Added live feature-flag control for the rebuilt chat experience without requiring a host restart.
- Improvements
- Chat sessions now support scope-based grouping and filtering.
- Chat runtime and database setup are deferred until the first request to improve startup behavior.
- Documentation
- Clarified chat data storage, scope labels, routing, authentication, and rollout behavior.