export type ProcessStatus = 'running' | 'stopped' | 'error'; export type ProcessSpawnResult = { pid: number; onExit: (callback: (code: number | null) => void) => void; onError: (callback: (error: Error) => void) => void; onStdout: (callback: (data: Buffer) => void) => void; onStderr: (callback: (data: Buffer) => void) => void; }; export type ProcessSpawnConfig = { command: string; args?: string[]; cwd?: string; env?: Record; }; export declare const ProcessControllerTag: unique symbol; /** * ProcessController interface * Functions as a wrapper for child_process, responsible only for starting and stopping processes */ export interface ProcessController { spawn: (config: ProcessSpawnConfig) => Promise; kill: (pid: number, force?: boolean) => boolean; waitForExit: (pid: number, timeoutMs?: number) => Promise; } /** * Process control service * Functions as a wrapper for child_process */ export declare class ProcessControllerImpl implements ProcessController { private readonly processes; /** * Start a process * @param config Process configuration * @returns Process spawn result */ spawn(config: ProcessSpawnConfig): Promise; private getStartError; /** * Terminate a process * @param pid Process ID * @param force Force termination flag * @returns Whether the termination signal was successfully sent */ kill(pid: number, force?: boolean): boolean; /** * Wait for process to exit * @param pid Process ID * @param timeoutMs Timeout in milliseconds */ waitForExit(pid: number, timeoutMs?: number): Promise; }