docs/plans/2026-08-28-standalone-pr5-webshell-context.md
Make the daemon React provider represent and switch workspace, standalone, and Live sessions explicitly while keeping current WebShell entry points unchanged. The implementation starts from main, where WebShell consumes the provider through @qwen-code/webui/daemon-react-sdk. It does not copy the in-flight WebShell cutover; a later rename can carry the provider changes unchanged.
type DaemonProductSessionContext =
| { kind: 'workspace'; cwd: string }
| { kind: 'standalone' }
| { kind: 'live' };
sessionContext is the product and routing authority. connection.context remains the existing model context-window snapshot. connection.workspaceCwd is set only for a product workspace; the internal Conversations runtime cwd is never exposed as a project.
Legacy callers may continue supplying workspaceCwd. The provider converts it once to a workspace context. An explicit workspace context must match a simultaneously supplied legacy cwd after path normalization. Standalone and Live contexts reject a supplied legacy cwd. If neither value is supplied, existing primary-workspace behavior is preserved.
| Product context | Create | Load and resume | Ownership proof |
|---|---|---|---|
| Workspace | Existing generic create with exact cwd | Existing generic load/resume with exact cwd | Exact ordinary runtime selected by the caller/provider |
| Standalone | DaemonSessionClient.createStandalone | loadStandalone / resumeStandalone | SDK runtime validation of the dedicated standalone response |
| Live | Not created by this provider | Generic load/resume against the one trusted kind: 'live' runtime | Capability runtime identity plus daemon-side persisted-source validation |
An explicit context never falls back to the primary workspace. A missing standalone capability, a missing/untrusted/ambiguous Live runtime, or a context/cwd conflict fails before a session request is sent.
The provider retains the post-#9129 loading-skeleton model:
Reload, reconnect, live-journal repair, and invalid-client reattachment reuse the stored context. They never reconstruct context from an absent cwd.
Successful standalone create/load stores the SDK-provided projectlessOutputDirectory and workingDirectory under a standalone-specific connection field. A recreated warning belongs only to that target and is discarded if another transition supersedes it.
DaemonStandaloneCreationOutcomeUnknownError is rethrown intact. When the create owns an empty connection, the generated UUID and exact-lookup recovery result are also recorded in connection state. A detached create beside an active session leaves that active connection untouched and carries recovery only on the structured error. The provider does not retry create. It does not wrap standalone create in the generic 30-second action timeout because that could reject before the SDK's required exact lookup completes.
Standalone directory error codes are copied from structured daemon error bodies into connection state so PR6 can present repair or terminal guidance without parsing strings.
For standalone and Live sessions, the provider skips session-less workspace providers, skills, ACP preheat, Git status, and workspace event invalidation. Session-scoped supported commands, context/model status, Goal state, transcript replay, prompts, permissions, and heartbeat remain available.
The current visible WebShell has no standalone entry point in PR5. PR6 must gate App-level workspace features before wiring Global New Chat and Recents to the new context. PR5 nevertheless exposes enough typed state for that gating without interpreting the internal runtime cwd as a workspace.
Focused tests cover:
Run the focused WebUI provider/action tests, WebUI build/typecheck/lint, WebShell provider integration tests, WebShell build/typecheck/lint/format, root build and typecheck, and the SDK/WebShell public-surface and browser-bundle checks.
PR5 does not add Global New Chat, Recents, lifecycle menus, archive/delete/repair controls, deep links, standalone uploads, or project-control hiding. Those visible product flows remain PR6. It does not change daemon lifecycle behavior or recreate the reverted transactional session-switch coordinator.