export declare class Semaphore { private _running; private _queue; private readonly _max; private readonly _timeoutMs; constructor(max?: number, timeoutMs?: number); /** How many slots are currently occupied */ get running(): number; /** How many callers are waiting for a slot */ get pending(): number; /** The concurrency cap */ get max(): number; /** Acquire a concurrency slot. Resolves immediately if available, otherwise queues. */ acquire(): Promise; /** Release a concurrency slot. Transfers directly to the next queued waiter if any. */ release(): void; } /** Module-level singleton */ export declare const semaphore: Semaphore; /** * Execute `fn` with a global concurrency slot. * Acquires before running, releases in `finally` (guaranteed even on error/timeout). */ export declare function withConcurrencyLimit(fn: () => Promise): Promise;