export declare const CF_CALL_TIMEOUT_MS = 45000;
export declare const STDOUT_CAP_BYTES: number;
/** `rulesets get` bodies can be large managed rulesets. */
export declare const RULESET_STDOUT_CAP_BYTES: number;
export declare const STDERR_CAP_BYTES: number;
/**
 * Flags that skip confirmations, switch cf to local simulation or project
 * config, or send a request body. No allowlisted argv contains them; the
 * runner refuses to spawn one that does.
 */
export declare const FORBIDDEN_CF_FLAGS: readonly string[];
export declare function assertSafeCfArgv(argv: readonly string[]): void;
export type CfProcessResult = {
    exitCode: number | null;
    stdout: string;
    stderr: string;
    timedOut: boolean;
    stdoutTooLarge: boolean;
    /** Set when the process could not be started at all. */
    spawnFailed: boolean;
};
export type CfRunOptions = {
    env: Record<string, string>;
    timeoutMs?: number;
    stdoutCapBytes?: number;
};
/** Owns the private working directory and every live cf child. */
export declare class CfProcessRunner {
    readonly entry: string;
    readonly privateDir: string;
    private readonly active;
    private disposed;
    /** Set once the runner kills its children (abort or shutdown), so those kills are not read as timeouts. */
    private terminating;
    private constructor();
    static create(entry: string): Promise<CfProcessRunner>;
    run(argv: readonly string[], options: CfRunOptions): Promise<CfProcessResult>;
    /**
     * The only interactive cf passthroughs: `cf auth create` (sign-in) and
     * `cf auth delete` (logout). With `stdoutToStderr` (`--json`), cf's stdout
     * is sent to stderr so the CLI's stdout stays a single JSON object.
     */
    runInteractive(argv: readonly string[], env: Record<string, string>, options?: {
        stdoutToStderr?: boolean;
    }): Promise<number>;
    get activeCount(): number;
    /** SIGTERM every live child, then SIGKILL whatever is still running after 2 s. */
    terminateAll(): Promise<void>;
    dispose(): Promise<void>;
}
/**
 * Run `work` with a private cf runner; the directory is removed afterwards and
 * on SIGINT, when live children get SIGTERM and then SIGKILL.
 */
export declare function withCfRunner<T>(entry: string, work: (runner: CfProcessRunner) => Promise<T>): Promise<T>;
export type CfFailure = {
    kind: 'node_unsupported';
} | {
    kind: 'command_unavailable';
} | {
    kind: 'auth';
} | {
    kind: 'http';
    status: number;
} | {
    kind: 'network';
} | {
    kind: 'cf_error';
};
/** ANSI and box-drawing characters removed; lines kept. */
export declare function cleanCfStderr(stderr: string): string;
/**
 * Classify a failed cf call from its stderr, in order: Node version, unknown
 * command, auth without an HTTP status, the HTTP status line
 * (`${status} ${text}[ · HTTP <path>]`), network, anything else. cf wraps
 * messages at the terminal width, so word patterns run over collapsed text.
 */
export declare function classifyCfStderr(stderr: string): CfFailure;
/**
 * Parse cf stdout: lists print a bare JSON array, gets a bare object. cf prints
 * nothing for a `null` result, so an empty get is `null` (the projectors decide).
 */
export declare function parseCfJson(stdout: string, shape: 'array' | 'object'): {
    ok: true;
    value: unknown;
} | {
    ok: false;
};
