/** * Process Management Tools * * Revolutionary Desktop Commander process control absorbed into KERNL V2.0 * Provides terminal/REPL integration, process monitoring, and state tracking. * * Phase 2 Tools: * - sys_start_process: Launch terminals with smart detection * - sys_interact_with_process: Send commands to REPLs * - sys_read_process_output: Monitor process output with pagination * * Phase 5 Tools (V2.0 Completion): * - sys_list_sessions: List active KERNL terminal sessions * - sys_list_processes: List all system processes * - sys_kill_process: Terminate any system process by PID * - sys_force_terminate: Gracefully terminate KERNL session */ import { type Tool } from '@modelcontextprotocol/sdk/types.js'; import { ProjectDatabase } from '../storage/database.js'; interface StartProcessParams { command: string; timeout_ms: number; shell?: string; verbose_timing?: boolean; } interface InteractWithProcessParams { pid: number; input: string; timeout_ms?: number; wait_for_prompt?: boolean; verbose_timing?: boolean; } interface ReadProcessOutputParams { pid: number; offset?: number; length?: number; timeout_ms?: number; verbose_timing?: boolean; } export declare const processManagementTools: Tool[]; /** * Start Process Handler */ declare function startProcessHandler(params: StartProcessParams): Promise<{ success: boolean; pid: number; status: "running" | "failed" | "waiting" | "completed"; output: string; command: string; duration_ms: number; timing: { event: string; time: number; }[] | undefined; message: string; error?: undefined; } | { success: boolean; error: { code: string; message: string; }; pid?: undefined; status?: undefined; output?: undefined; command?: undefined; duration_ms?: undefined; timing?: undefined; message?: undefined; }>; /** * Interact With Process Handler */ declare function interactWithProcessHandler(params: InteractWithProcessParams): Promise<{ success: boolean; error: { code: string; message: string; }; pid?: undefined; message?: undefined; timing?: undefined; status?: undefined; output?: undefined; duration_ms?: undefined; } | { success: boolean; pid: number; message: string; timing: { event: string; time: number; }[] | undefined; error?: undefined; status?: undefined; output?: undefined; duration_ms?: undefined; } | { success: boolean; pid: number; status: "running" | "failed" | "waiting" | "completed"; output: string; duration_ms: number; timing: { event: string; time: number; }[] | undefined; error?: undefined; message?: undefined; }>; /** * Read Process Output Handler */ declare function readProcessOutputHandler(params: ReadProcessOutputParams): Promise<{ success: boolean; error: { code: string; message: string; }; pid?: undefined; status?: undefined; output?: undefined; linesRead?: undefined; totalLines?: undefined; readPosition?: undefined; remaining?: undefined; duration_ms?: undefined; timing?: undefined; } | { success: boolean; pid: number; status: "running" | "failed" | "waiting" | "completed"; output: string; linesRead: number; totalLines: number; readPosition: number; remaining: number; duration_ms: number; timing: { event: string; time: number; }[] | undefined; error?: undefined; }>; /** * List Sessions Handler - V2.0 Phase 5 */ declare function listSessionsHandler(): Promise<{ success: boolean; sessions: { pid: number; command: string; status: "running" | "failed" | "waiting" | "completed"; runtime: number; outputLines: number; exitCode: number | undefined; }[]; totalActive: number; totalSessions: number; error?: undefined; } | { success: boolean; error: { code: string; message: string; }; sessions?: undefined; totalActive?: undefined; totalSessions?: undefined; }>; /** * List Processes Handler - V2.0 Phase 5 */ declare function listProcessesHandler(): Promise<{ success: boolean; processes: { name: string; pid: number; memory: string; }[]; totalProcesses: number; platform: string; error?: undefined; } | { success: boolean; processes: { user: string; pid: number; cpu: number; memory: number; name: string; }[]; totalProcesses: number; platform: string; error?: undefined; } | { success: boolean; error: { code: string; message: string; }; processes?: undefined; totalProcesses?: undefined; platform?: undefined; }>; /** * Kill Process Handler - V2.0 Phase 5 */ declare function killProcessHandler(params: { pid: number; }): Promise<{ success: boolean; pid: number; message: string; error?: undefined; } | { success: boolean; error: { code: string; message: string; }; pid?: undefined; message?: undefined; }>; /** * Force Terminate Handler - V2.0 Phase 5 */ declare function forceTerminateHandler(params: { pid: number; }): Promise<{ success: boolean; error: { code: string; message: string; }; pid?: undefined; command?: undefined; runtime?: undefined; message?: undefined; } | { success: boolean; pid: number; command: string; runtime: number; message: string; error?: undefined; }>; export declare function createProcessManagementHandlers(db: ProjectDatabase): { sys_start_process: typeof startProcessHandler; sys_interact_with_process: typeof interactWithProcessHandler; sys_read_process_output: typeof readProcessOutputHandler; sys_list_sessions: typeof listSessionsHandler; sys_list_processes: typeof listProcessesHandler; sys_kill_process: typeof killProcessHandler; sys_force_terminate: typeof forceTerminateHandler; }; export {}; //# sourceMappingURL=process-management.d.ts.map