/** SDK-owned platform module. This implementation is maintained in goodvibes-sdk. */
/**
 * ProcessManager — tracks background processes for a single GoodVibes runtime.
 *
 * Extracted from tools/exec/index.ts so that other modules (UI, agent system,
 * live-tail) can query running processes without importing the exec tool.
 */
export interface BackgroundProcess {
    id: string;
    pid: number;
    cmd: string;
    startTime: number;
    stdout: string[];
    stderr: string[];
    exitCode: number | null;
    done: boolean;
    /**
     * Timestamp (ms since epoch) when SIGKILL was scheduled after a timeout.
     * Null if the process completed normally or SIGKILL was never scheduled.
     */
    killDeadline: number | null;
    completedAt?: number | undefined;
}
export interface SpawnOptions {
    /** Abort the process if it hasn't completed within this many ms. Default: 60000. */
    timeout_ms?: number | undefined;
    /** Grace period (ms) between SIGTERM and SIGKILL after timeout. Default: 5000. */
    sigterm_grace_ms?: number | undefined;
}
export interface BgCommandResult {
    cmd: string;
    exit_code: number | null;
    stdout: string;
    stderr: string;
    success: boolean;
    process_id?: string | undefined;
    pid?: number | undefined;
}
export declare class ProcessManager {
    private _counter;
    private _processes;
    private _procs;
    private newId;
    /**
     * Spawn a background process and start collecting its output.
     *
     * @param cmd  Shell command to run via /bin/sh -c.
     * @param cwd  Working directory (undefined = inherit).
     * @param env  Extra env vars merged with the current process env.
     * @param opts Timeout and SIGKILL grace configuration.
     *
     * @returns A BgCommandResult with the process_id and pid, or rejects if
     *          the binary is missing (ENOENT) or exec permission is denied (EACCES).
     */
    spawn(cmd: string, cwd: string | undefined, env: Record<string, string> | undefined, opts?: SpawnOptions): Promise<BgCommandResult>;
    /** Get the status record for a background process, or undefined if not found. */
    getStatus(id: string): BackgroundProcess | undefined;
    /** Get the accumulated stdout/stderr for a background process. */
    getOutput(id: string): {
        stdout: string;
        stderr: string;
    } | undefined;
    /**
     * Stop a background process by ID.
     * Returns true if the process was found and stopped, false if unknown.
     */
    stop(id: string): boolean;
    /** List all tracked background processes with their status summaries. */
    list(): Array<{
        id: string;
        pid: number;
        cmd: string;
        status: string;
    }>;
    /**
     * Handle bg_status / bg_output / bg_stop / bg_list special commands.
     * Returns a BgCommandResult if the command was handled, null otherwise.
     */
    handleCommand(cmd: string): BgCommandResult | null;
    private pruneCompletedProcesses;
}
//# sourceMappingURL=process-manager.d.ts.map