import { type ChildProcess } from "node:child_process";
export type CommandInvocation = {
    args: string[];
    command: string;
    windowsVerbatimArguments?: boolean;
};
export type ProcessStampShape = object;
export type ProcessStampField<TStamp extends ProcessStampShape> = Extract<keyof TStamp, string>;
export type ProcessStampContract<TStamp extends ProcessStampShape, TCriteria extends Partial<TStamp> = Partial<TStamp>> = {
    normalizeStamp(input: unknown): TStamp;
    normalizeStampCriteria(input?: unknown): TCriteria;
    stampFields: readonly ProcessStampField<TStamp>[];
    stampFlags: {
        readonly [K in ProcessStampField<TStamp>]: string;
    };
};
export type CommandInvocationRequest = {
    args?: string[];
    command: string;
    env?: NodeJS.ProcessEnv;
};
export type SpawnProcessRequest = CommandInvocationRequest & {
    cwd?: string;
    detached?: boolean;
    logFd?: number | null;
};
export type ProcessSnapshot = {
    command: string;
    pid: number;
    ppid: number;
};
export type StampedProcessMatchCriteria<TStamp extends ProcessStampShape> = Partial<TStamp>;
export type StopProcessesResult = {
    alreadyStopped: boolean;
    forcedPids: number[];
    matchedPids: number[];
    remainingPids: number[];
    stoppedPids: number[];
};
export type HttpWaitOptions = {
    timeoutMs?: number;
};
export declare function createProcessStampArgs<TStamp extends ProcessStampShape>(stamp: TStamp, contract: ProcessStampContract<TStamp>): string[];
export declare function readFlagValue(args: readonly string[], flagName: string): string | null;
export declare function readProcessStamp<TStamp extends ProcessStampShape>(args: readonly string[], contract: ProcessStampContract<TStamp>): TStamp | null;
export declare function readProcessStampFromCommand<TStamp extends ProcessStampShape>(command: string, contract: ProcessStampContract<TStamp>): TStamp | null;
export declare function matchesProcessStamp<TStamp extends ProcessStampShape, TCriteria extends Partial<TStamp> = Partial<TStamp>>(stamp: TStamp, criteria: TCriteria | undefined, contract: ProcessStampContract<TStamp, TCriteria>): boolean;
export declare function matchesStampedProcess<TStamp extends ProcessStampShape, TCriteria extends Partial<TStamp> = Partial<TStamp>>(processInfo: Pick<ProcessSnapshot, "command">, criteria: TCriteria | undefined, contract: ProcessStampContract<TStamp, TCriteria>): boolean;
export declare function createCommandInvocation({ args, command, env }: CommandInvocationRequest): CommandInvocation;
export declare function createPackageManagerInvocation(args: string[], env?: NodeJS.ProcessEnv): CommandInvocation;
export declare function spawnBackgroundProcess(request: SpawnProcessRequest): Promise<{
    pid: number;
}>;
export declare function spawnLoggedProcess(request: SpawnProcessRequest): Promise<ChildProcess>;
export declare function isProcessAlive(pid: number | null | undefined): boolean;
export declare function waitForProcessExit(pid: number | null | undefined, timeoutMs?: number): Promise<boolean>;
export declare function listProcessSnapshots(): Promise<ProcessSnapshot[]>;
export declare function collectProcessTreePids(processes: ProcessSnapshot[], rootPids: Array<number | null | undefined>): number[];
export declare function stopProcesses(pids: Array<number | null | undefined>): Promise<StopProcessesResult>;
export declare function waitForHttpOk(url: string, { timeoutMs }?: HttpWaitOptions): Promise<true>;
export declare function readLogTail(filePath: string, maxLines?: number): Promise<string[]>;
export type WellKnownUserToolchainOptions = {
    home?: string;
    includeSystemBins?: boolean;
    env?: NodeJS.ProcessEnv;
};
export declare function wellKnownUserToolchainBins(options?: WellKnownUserToolchainOptions): string[];
//# sourceMappingURL=index.d.ts.map