import { type ExecFileSyncOptionsWithStringEncoding } from 'child_process'; export interface ProcessEntry { pid: number; ppid: number; command: string; } export interface CleanupCandidate extends ProcessEntry { reason: 'ppid=1' | 'outside-current-session' | 'duplicate-sibling'; } export interface CleanupResult { dryRun: boolean; candidates: CleanupCandidate[]; terminatedCount: number; forceKilledCount: number; failedPids: number[]; } export interface CleanupDependencies { currentPid?: number; listProcesses?: () => ProcessEntry[]; selectCandidates?: (processes: readonly ProcessEntry[], currentPid: number) => CleanupCandidate[]; isPidAlive?: (pid: number) => boolean; sendSignal?: (pid: number, signal: NodeJS.Signals) => void; sleep?: (ms: number) => Promise; now?: () => number; writeLine?: (line: string) => void; } interface TmpDirectoryEntry { name: string; isDirectory(): boolean; } export interface TmpCleanupDependencies { tmpRoot?: string; listTmpEntries?: (tmpRoot: string) => Promise; statPath?: (path: string) => Promise<{ mtimeMs: number; }>; removePath?: (path: string) => Promise; now?: () => number; writeLine?: (line: string) => void; } export interface CleanupCommandDependencies { cleanupProcesses?: (args: readonly string[]) => Promise; cleanupTmpDirectories?: (args: readonly string[]) => Promise; } type ProcessListCommandRunner = (file: string, args: readonly string[], options: ExecFileSyncOptionsWithStringEncoding) => string; export declare function isOmxMcpProcess(command: string): boolean; export declare function extractOmxMcpEntrypoint(command: string): string | null; export declare function parsePsOutput(output: string): ProcessEntry[]; export declare function listOmxProcesses(runCommand?: ProcessListCommandRunner): ProcessEntry[]; export declare function buildProtectedPidSet(processes: readonly ProcessEntry[], currentPid: number): Set; export declare function findDuplicateSiblingCleanupCandidates(processes: readonly ProcessEntry[]): CleanupCandidate[]; export declare function findCleanupCandidates(processes: readonly ProcessEntry[], currentPid: number): CleanupCandidate[]; export declare function findLaunchSafeCleanupCandidates(processes: readonly ProcessEntry[], currentPid: number): CleanupCandidate[]; export declare function cleanupOmxMcpProcesses(args: readonly string[], dependencies?: CleanupDependencies): Promise; export declare function cleanupStaleTmpDirectories(args: readonly string[], dependencies?: TmpCleanupDependencies): Promise; export declare function cleanupCommand(args: string[], dependencies?: CleanupCommandDependencies): Promise; export {}; //# sourceMappingURL=cleanup.d.ts.map