/** * Minimal FIFO counting semaphore for bounding concurrent runtime runs. * * Admission-control only: a caller acquires immediately before starting work * and releases when done. Callers waiting for a permit hold nothing, so a * queued follow-up (waiting in the live-session queue) never occupies a slot — * which is what keeps `maxConcurrentRuns` from deadlocking against the * per-conversation queue. */ export interface Semaphore { /** * Acquire a permit. If `signal` aborts while waiting for admission, the * returned promise rejects with {@link SemaphoreAcquireAbortedError} and the * waiter is dropped from the queue without ever consuming a permit. */ acquire(signal?: AbortSignal): Promise; release(): void; /** Permits currently held. */ inUse(): number; } /** Thrown by {@link Semaphore.acquire} when the wait is aborted before admission. */ export declare class SemaphoreAcquireAbortedError extends Error { constructor(); } export declare function createSemaphore(maxConcurrent: number): Semaphore; //# sourceMappingURL=semaphore.d.ts.map