/** * Runner Types * Common interfaces and types for process runners (native, docker, docker-compose, etc.) */ export type RunnerType = 'native' | 'docker' | 'docker-compose'; export interface RunnerStartOptions { command: string; cwd: string; id: string; env?: Record; port?: number; } export interface RunnerStartResult { /** Process ID (for native) or container ID (for docker) */ pid: number; /** Container ID for docker runners */ containerId?: string; /** Detected port, if any */ port?: number; } export interface RunnerStopOptions { /** Timeout in ms before force kill */ timeout?: number; } export interface RunnerLogOptions { type?: 'stdout' | 'stderr' | 'all'; lines?: number; /** For native runner: return lines since cursor */ since?: number; /** Follow mode (tail -f style) - not implemented yet */ follow?: boolean; } export interface RunnerStatus { running: boolean; pid: number; containerId?: string; port?: number; startedAt?: Date; /** Additional status info from docker inspect, etc. */ details?: Record; } /** * Runner interface - abstraction over different process models */ export interface Runner { readonly type: RunnerType; /** * Start the process/container */ start(options: RunnerStartOptions): Promise; /** * Stop the process/container */ stop(options?: RunnerStopOptions): Promise; /** * Check if process/container is running */ isRunning(): Promise; /** * Get current status */ getStatus(): Promise; /** * Get logs from the process/container */ getLogs(options?: RunnerLogOptions): Promise; /** * Detect port from logs or container inspection */ detectPort(): Promise; /** * Clean up resources (close file handles, etc.) */ cleanup(): Promise; /** * Restore state from persisted data (for recovery after MCP restart) */ restore(data: PersistedRunnerState): void; /** * Get the command used to start this runner */ getCommand(): string; /** * Get the working directory for this runner */ getCwd(): string; /** * Clear logs (optional - only native runner supports this) */ clearLogs?(): Promise<{ logDir: string; stdoutPath: string; stderrPath: string; }>; /** * Get log access info - file paths for native runner, command for docker */ getLogAccess?(): { type: 'file'; logDir: string; stdoutPath: string; stderrPath: string; } | { type: 'command'; command: string; }; } /** * Runner state that can be persisted and restored */ export interface PersistedRunnerState { type: RunnerType; id: string; command: string; cwd: string; pid: number; containerId?: string; port?: number; autoRun: boolean; startedAt: string; monitorPort?: boolean; /** Whether this server is stored in global ~/.cdp-tools/ */ global?: boolean; } /** * Auto-detect runner type from command string */ export declare function detectRunnerType(command: string): RunnerType; //# sourceMappingURL=types.d.ts.map