/** * Wraps a task so it only runs once a slot is free. */ type Limiter = (fn: () => Promise) => Promise; type TrackedLimiter = Limiter & { /** Whether no task is running or waiting for this limiter. */ isIdle: () => boolean; }; /** * A FIFO semaphore. Tasks beyond `maxConcurrent` queue and start as slots free up. * * Deliberately applied at the tool layer rather than inside the SDK's * `customFetch`: the SDK installs its request-timeout `AbortSignal` *before* * calling `customFetch`, so gating there would charge queue time against the * request timeout and fail long-queued requests that never actually ran. * * That same property is why queued tasks need their own deadline. A task's request * timeout only starts once it reaches the front of the queue, so without one a task * can wait indefinitely — long past the point its caller gave up — and then still * issue its request. `queueTimeoutMs` bounds the wait instead, failing the task with * a reason that says the request was never sent. */ declare function createLimiter(maxConcurrent: number, { queueTimeoutMs }?: { queueTimeoutMs?: number; }): TrackedLimiter; /** Records the account key so each limited operation can resolve its current pair. */ declare function registerClientLimiters(client: object, apiKey: string): void; declare function getMoveLimiter(client: object): Limiter; declare function getWriteLimiter(client: object): Limiter; /** Test-only: drops all registered limiters so cases start from a clean slate. */ declare function resetLimitersForTesting({ maxAccountLimiters, }?: { maxAccountLimiters?: number; }): void; export { createLimiter, getMoveLimiter, getWriteLimiter, type Limiter, registerClientLimiters, resetLimitersForTesting, }; //# sourceMappingURL=concurrency.d.ts.map