/** * VSCode Detector for OpenCode Diff Plugin * * Detects if VSCode is running and if the extension is active. * Used to determine whether to show diffs in VSCode or fall back to TUI. */ /** * Detection method that was successful */ export type DetectionMethod = 'vscode-dir' | 'cli' | 'process' | 'none'; /** * Result of VSCode detection */ export interface VSCodeDetectionResult { /** Whether VSCode is detected as running */ isRunning: boolean; /** Which detection method succeeded */ method: DetectionMethod; /** Additional details about the detection */ details?: string; /** Whether the VSCode extension is active */ extensionActive?: boolean; } /** * Default timeout for detection operations in milliseconds */ export declare const DEFAULT_DETECTION_TIMEOUT_MS = 2000; /** * VSCode Detector * * Detects VSCode presence and status using multiple methods: * 1. Check for .vscode/ directory in workspace root (fastest) * 2. Run `code --status` CLI command (reliable if CLI installed) * 3. Check for VSCode process (platform-specific fallback) */ export declare class VSCodeDetector { private workspaceRoot; private timeoutMs; /** * Create a new VSCodeDetector * @param workspaceRoot - The workspace root directory to check for .vscode/ * @param timeoutMs - Timeout for detection operations (default: 2000ms) */ constructor(workspaceRoot?: string, timeoutMs?: number); /** * Check if VSCode process is running * Tries multiple detection methods in order of reliability * @returns Promise - true if VSCode is detected as running */ isVSCodeRunning(): Promise; /** * Check if the VSCode extension is active * This checks if the extension's state file exists and is recent * @returns Promise - true if extension appears to be active */ isVSCodeExtensionActive(): Promise; /** * Check if .vscode/ directory exists in the workspace root * This is a fast synchronous check * @returns boolean - true if .vscode/ directory exists */ isVSCodeWorkspace(): boolean; /** * Comprehensive VSCode detection * Tries multiple methods in order and returns detailed results * @param timeoutMs - Optional override for timeout (uses constructor value if not provided) * @returns Promise - detailed detection result */ detect(timeoutMs?: number): Promise; /** * Detects if VSCode has crashed or is unresponsive * @param timeoutMs - Timeout for detection * @returns Promise - true if VSCode appears crashed */ hasVSCodeCrashed(timeoutMs?: number): Promise; /** * Gets the age of the last VSCode extension activity * @returns Age in milliseconds, or null if no state file */ getLastActivityAge(): number | null; /** * Checks if VSCode extension appears to be healthy * @returns boolean - true if extension appears healthy */ isExtensionHealthy(): boolean; /** * Detect VSCode via CLI command * @param timeoutMs - Timeout for the command * @returns Promise - true if VSCode CLI responds */ private detectViaCli; /** * Detect VSCode by checking running processes * Platform-specific implementation for macOS, Linux, and Windows * @param timeoutMs - Timeout for the command * @returns Promise - true if VSCode process is found */ private detectViaProcess; /** * Detect VSCode process on macOS * @param timeoutMs - Timeout for the command * @returns Promise - true if VSCode process is found */ private detectMacOSProcess; /** * Detect VSCode process on Linux * @param timeoutMs - Timeout for the command * @returns Promise - true if VSCode process is found */ private detectLinuxProcess; /** * Detect VSCode process on Windows * @param timeoutMs - Timeout for the command * @returns Promise - true if VSCode process is found */ private detectWindowsProcess; /** * Update the workspace root for detection * @param workspaceRoot - New workspace root directory */ setWorkspaceRoot(workspaceRoot: string): void; /** * Update the timeout for detection operations * @param timeoutMs - New timeout in milliseconds */ setTimeout(timeoutMs: number): void; /** * Get the current workspace root * @returns string - Current workspace root directory */ getWorkspaceRoot(): string; /** * Get the current timeout setting * @returns number - Current timeout in milliseconds */ getTimeout(): number; } export default VSCodeDetector; //# sourceMappingURL=vscode-detector.d.ts.map