import { Channel, type JobConsole, JobOutput, type OwnedStream } from '../console/index.ts';
import type { Job } from './types.ts';
/**
 * The background jobs started inside a capture (`$( )`, a pipe stage),
 * which the capture waits for before it ends: bash reads the pipe until
 * every writer has closed it, and a job holds it open for as long as one
 * of its streams leads into it.
 */
export declare class JobWaits {
    readonly output: JobOutput;
    readonly channels: ReadonlySet<Channel>;
    readonly jobs: Job[];
    /**
     * @param output where the capture's jobs write, at its edge.
     * @param channels what the capture reads there: stdout, and stderr too
     *   for a stage piped with `|&`.
     */
    constructor(output: JobOutput, channels?: ReadonlySet<Channel>);
    /**
     * Whether a job writing `streams` where `from` leads writes into the
     * capture. A redirect on the way (`JobRoute`) may send them elsewhere;
     * a stream that no level on the way owns is counted, as it may be the
     * capture's.
     */
    reaches(from: JobConsole, streams: ReadonlySet<Channel | OwnedStream>): boolean;
    /** Count a job the capture has to outlast. */
    add(job: Job): void;
    /**
     * Return once every job writing into the capture has ended; what the
     * capture's other jobs write from then on goes to `rest`, where the
     * capture's caller writes.
     */
    join(rest: JobConsole): Promise<void>;
}
//# sourceMappingURL=waits.d.ts.map