import type { IssueInfo, PRInfo } from '../../shared/github/pull-request-types' import type { WorkspaceSessionPatch, WorkspaceSessionState } from '../../shared/workspace-session-state-types' import type { ExecutionHostId } from '../../shared/execution-host' import type { TerminalSurfaceCloseTarget } from '../../shared/terminal-surface-close-target' import type { RemoteWorkspaceChangedEvent, RemoteWorkspaceConnectedClient, RemoteWorkspaceObservedPatchResult, RemoteWorkspaceObservedSnapshot } from '../../shared/remote-workspace-types' export type WorkspaceSessionApi = { session: { // hostId defaults to the 'local' partition on main, so omitting it stays backward-compatible. get: (hostId?: ExecutionHostId) => Promise /** Partitions persistence holds, so boot reads them all instead of guessing from the catalog. */ listHostIds: () => Promise set: (args: WorkspaceSessionState, hostId?: ExecutionHostId) => Promise patch: (args: WorkspaceSessionPatch, hostId?: ExecutionHostId) => Promise /** Commits a terminal tab or split-pane close into main's membership. */ closeTerminalSurface: (args: { worktreeId: string target: TerminalSurfaceCloseTarget reason?: 'user' | 'cleanup' }) => Promise flush: () => Promise readTerminalScrollback: (args: { ref: string }) => string | null setSync: (args: WorkspaceSessionState, hostId?: ExecutionHostId) => void } cache: { getGitHub: () => Promise<{ pr: Record issue: Record }> setGitHub: (args: { cache: { pr: Record issue: Record } }) => Promise } remoteWorkspace: { get: (args: { targetId: string }) => Promise setForConnectedTargets: (args: { session?: WorkspaceSessionState hydratedTargetIds?: string[] expectedRevisionsByTargetId: Record expectedHostObservationTokensByTargetId: Record }) => Promise<{ targetId: string; result: RemoteWorkspaceObservedPatchResult }[]> listEnabledConnectedTargets: () => Promise listConnectedClients: (args?: { targetIds?: string[] }) => Promise<{ targetId: string; clients: RemoteWorkspaceConnectedClient[] }[]> clientId: () => Promise onChanged: (callback: (event: RemoteWorkspaceChangedEvent) => void) => () => void } }