/**
 * Bulkhead — bound concurrent execution of an async operation.
 *
 * Sprint-468. Wrap a function so at most `maxConcurrent` invocations
 * are active at once; additional calls queue up to `maxQueued` before
 * rejecting with BulkheadFullError. Prevents a slow backend from
 * exhausting the agent's event loop or memory.
 *
 * Usage:
 *   const safeArchive = bulkhead(brain.archiveKnowledge.bind(brain), {
 *     name: "brain.archive",
 *     maxConcurrent: 5,
 *     maxQueued: 50,
 *   });
 */
export interface BulkheadOptions {
    /** Label for BulkheadFullError messages. */
    name: string;
    /** In-flight invocation cap. Default 5. */
    maxConcurrent?: number;
    /** Queue depth cap. Reject once full. Default 50. */
    maxQueued?: number;
}
export declare class BulkheadFullError extends Error {
    readonly bulkheadName: string;
    constructor(bulkheadName: string, queueDepth: number);
}
export interface BulkheadStats {
    active: number;
    queued: number;
}
export interface Bulkhead<TArgs extends unknown[], TResult> {
    (...args: TArgs): Promise<TResult>;
    readonly stats: BulkheadStats;
}
export declare function bulkhead<TArgs extends unknown[], TResult>(fn: (...args: TArgs) => Promise<TResult>, options: BulkheadOptions): Bulkhead<TArgs, TResult>;
//# sourceMappingURL=bulkhead.d.ts.map