mcp-subagents
Version:
Multi-Agent AI Orchestration via Model Context Protocol - Access specialized CLI AI agents (Aider, Qwen, Gemini, Goose, etc.) with intelligent fallback and configuration
82 lines • 2.01 kB
TypeScript
/**
* Process Manager
*
* Handles proper process spawning, management, and cleanup to prevent
* zombie processes and ensure all child processes are terminated.
*/
export interface SpawnOptions {
command: string;
args: string[];
env?: NodeJS.ProcessEnv;
cwd?: string | undefined;
timeout?: number;
}
export interface ProcessResult {
output: string[];
exitCode: number | null;
signal: NodeJS.Signals | null;
}
/**
* Spawn a process with proper management and cleanup
*/
export declare class ManagedProcess {
private process;
private output;
private killed;
private cleanupTimer?;
private earlyFailCallback?;
spawn(options: SpawnOptions): Promise<ProcessResult>;
/**
* Send input to the process via stdin
*/
sendInput(input: string): void;
/**
* Terminate the process and all its children
*/
terminate(): Promise<void>;
private killUnixProcessGroup;
private killWindowsProcessTree;
/**
* Get the process ID
*/
getPid(): number | undefined;
/**
* Check if the process is still running
*/
isRunning(): boolean;
/**
* Check output lines for patterns that indicate early failure
*/
private checkForEarlyErrors;
}
/**
* Check if we're running as a child of an MCP server
*/
export declare function isSpawnedByMCPServer(): boolean;
/**
* Process pool to manage concurrent processes
*/
export declare class ProcessPool {
private processes;
/**
* Add a process to the pool
*/
add(id: string, process: ManagedProcess): void;
/**
* Remove a process from the pool
*/
remove(id: string): void;
/**
* Get a process by ID
*/
get(id: string): ManagedProcess | undefined;
/**
* Terminate all processes in the pool
*/
terminateAll(): Promise<void>;
/**
* Get the number of running processes
*/
getRunningCount(): number;
}
//# sourceMappingURL=process-manager.d.ts.map