import type { Context } from '../../../commands/config.ts';
import type { RuntimeFiles } from '../../files.ts';
import type { OutputFn, Program, RunResult } from '../../types.ts';
/**
 * Runs on pooled monty workers: the process's shared pool, or one of its own
 * for a run nested in another, which must not queue behind its parent's
 * worker.
 */
export declare class MontyExecution {
    private readonly shared;
    private readonly name;
    private readonly limits;
    private module;
    private pool;
    private poolPromise;
    /**
     * Args:
     *   maxMemory: the heap one run may use, in bytes; null for no cap.
     *   shared: run on the process's shared pool.
     */
    constructor(maxMemory?: number | null, shared?: boolean);
    /**
     * Run one program on a pooled worker.
     *
     * @param program the source and argv to run.
     * @param ctx the run's context: working directory, environment, signal
     *   and limit.
     * @param files the run's file adapter; null outside a workspace.
     * @param output receives stdout as it is printed; absent returns it in
     *   the result.
     * @param errors the same for stderr.
     * @param externalLookup the host functions the program may call by name.
     */
    run(program: Program, ctx: Context, files: RuntimeFiles | null, output?: OutputFn, errors?: OutputFn, externalLookup?: Readonly<Record<string, (...args: never[]) => unknown>>): Promise<RunResult>;
    private interrupted;
    private installInterruption;
    close(): Promise<void>;
    private ensurePool;
    private loadPool;
    private loadModule;
    private checkout;
    /** Feed the program to a worker; its status and what to add to its stderr. */
    private feedOne;
}
//# sourceMappingURL=execution.d.ts.map