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; } 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}`; }