fix(client): inherit current workspace for new sessions

This commit is contained in:
_Kerman
2026-08-11 14:19:51 +08:00
parent a46a7bf912
commit 4ce51888be
6 changed files with 24 additions and 16 deletions

View File

@@ -91,9 +91,9 @@ export type DirectoryPickingHooks = {
*/
export type WorkspaceBrowserInjected = DirectoryPickingInjected & {
/**
* Start a New Session in a Workspace: reuse-or-create its blank session
* and open it; with no workspace, clear the selection into the New Session
* pure view state (the conversation.empty seat).
* Start a New Session in a Workspace: reuse-or-create its blank session and
* open it; without an explicit workspace, inherit the current Session
* Workspace, then the recent Workspace, or clear into the New Session view.
*/
startSession: (workspaceId?: WorkspaceId) => void
/** Open a real Session. */

View File

@@ -68,8 +68,8 @@ export function apply(ctx: ClientContext): void {
const browserFlowSource = flowSource('sidebar.workspaces.directoryFlow')
const pickerFlowSource = flowSource('conversation.hero.workspace.directoryFlow')
const browserInjected = (): WorkspaceBrowserInjected => ({
// Explicit group actions keep their target; unscoped New Session rides
// the runtime's shared action (recent-Workspace projection inside).
// Explicit group actions keep their target; unscoped New Session inherits
// the current Session Workspace before the recent-Workspace fallback.
startSession: (workspaceId) => { ctx.workspaces.startSession(workspaceId) },
open: (sessionId) => { ctx.sessions.open(sessionId) },
searchSessions,