返回 DeepSeek-Reasonix
draftLandingTarget.ts
根目录 / desktop / frontend / src / app-runtime / draftLandingTarget.ts
1 export type DraftLandingTarget = { scope: "global" | "project"; workspaceRoot: string };
2
3 type SurfaceTab = { scope?: string; workspaceRoot?: string; remote?: unknown };
4
5 /**
6 * The draft a formal surface hands over to, when it goes away or when the user
7 * asks it for a new session. The workspace root is the surface's actual
8 * directory (UI preferences key on it); global draft requests drop it on the
9 * wire. Remote tabs have no local draft workspace.
10 */
11 export function draftLandingTargetForTab(tab?: SurfaceTab | null): DraftLandingTarget {
12 if (!tab || tab.remote) return { scope: "global", workspaceRoot: "" };
13 const workspaceRoot = tab.workspaceRoot || "";
14 return { scope: tab.scope === "project" && workspaceRoot ? "project" : "global", workspaceRoot };
15 }
16
16 lines TYPESCRIPT