Open the complete working comparison in a desktop workspace tab while preserving inline sidebar diffs when the tab is closed. Working and commit comparisons share one diff panel, and workspace layout is the sole owner of live tab persistence and identity. Refs #1520
47 lines
1.3 KiB
TypeScript
47 lines
1.3 KiB
TypeScript
import type { AgentProvider } from "@getpaseo/protocol/agent-types";
|
|
import type { WorkspaceFileTabTarget } from "@/workspace/file-open";
|
|
|
|
export interface WorkspaceDraftTabSetup {
|
|
provider: AgentProvider;
|
|
cwd: string;
|
|
modeId: string | null;
|
|
model: string | null;
|
|
thinkingOptionId: string | null;
|
|
featureValues: Record<string, unknown>;
|
|
}
|
|
|
|
export interface WorkspaceWorkingDiffTabTarget {
|
|
kind: "working_diff";
|
|
focusPath?: string;
|
|
focusRequestId?: number;
|
|
}
|
|
|
|
export type WorkspaceTabTarget =
|
|
| { kind: "draft"; draftId: string; setup?: WorkspaceDraftTabSetup }
|
|
| { kind: "agent"; agentId: string }
|
|
| { kind: "provider_subagent"; parentAgentId: string; subagentId: string }
|
|
| { kind: "terminal"; terminalId: string }
|
|
| { kind: "browser"; browserId: string }
|
|
| WorkspaceFileTabTarget
|
|
| WorkspaceWorkingDiffTabTarget
|
|
| { kind: "setup"; workspaceId: string }
|
|
| { kind: "commit_diff"; sha: string };
|
|
|
|
export interface WorkspaceTab {
|
|
tabId: string;
|
|
target: WorkspaceTabTarget;
|
|
createdAt: number;
|
|
}
|
|
|
|
export function buildWorkspaceTabPersistenceKey(input: {
|
|
serverId: string;
|
|
workspaceId: string;
|
|
}): string | null {
|
|
const serverId = input.serverId.trim();
|
|
const workspaceId = input.workspaceId.trim();
|
|
if (!serverId || !workspaceId) {
|
|
return null;
|
|
}
|
|
return `${serverId}:${workspaceId}`;
|
|
}
|