import type { Project } from './types'; export type DesktopTaskScope = { projectId: string; sessionId: string; taskId: string }; export type DesktopHostStatus = { state: 'ready' | 'stopping' | 'not-running'; identity?: { pid: number; createdAt: string; instanceId: string; runtimeIdentity: string; version: string; dataRoot: string; runtimeRoot: string }; activity?: { active: boolean; counts: Record; unresolvedTools: number }; desktopWindows?: { count: number }; }; type DesktopWorkbench = { protocol: 'agent-workbench-desktop-v1'; status(): Promise; pickProject(): Promise; projectFolder(projectId: string): Promise<{ opened: boolean }>; openFilePreview?(input: { projectId: string; url: string }): Promise<{ opened: boolean }>; reviewTask(input: DesktopTaskScope): Promise; revealFile(input: DesktopTaskScope & { path: string; sha256: string }): Promise<{ revealed: boolean }>; stopHost(): Promise<{ cancelled?: boolean; state?: string; processExited?: boolean }>; browsingLayout?(input: {projectId?:string;sessionId?:string;taskId?:string;tabId?:string;visible:boolean;bounds?:{x:number;y:number;width:number;height:number}}): Promise<{visible:boolean}>; }; declare global { interface Window { desktopWorkbench?: DesktopWorkbench } } export const desktop = window.desktopWorkbench?.protocol === 'agent-workbench-desktop-v1' ? window.desktopWorkbench : undefined;