export type AbortHandler = () => void; export interface AbortSignalLike { readonly aborted: boolean; addEventListener?: (type: "abort", listener: AbortHandler, options?: { once?: boolean; }) => void; removeEventListener?: (type: "abort", listener: AbortHandler) => void; onabort?: AbortHandler | null; } /** * Options controlling the shared token bucket limiter. */ export interface RateLimiterOptions { /** * Maximum number of tokens that can be consumed within a full interval. * Defaults to 100 requests per interval. */ tokensPerInterval?: number; /** * Duration of the interval in milliseconds. Defaults to 60 seconds. */ intervalMs?: number; } /** * Basic token-bucket rate limiter with FIFO queuing and optional abort support. * Defaults enforce the 100 requests per minute guidance required by the SDK. */ export declare class RateLimiter { private readonly tokensPerInterval; private readonly intervalMs; private readonly refillInterval; private tokens; private readonly queue; private refillHandle; /** * Create a token bucket limiter. * * @param options Override the bucket size or interval duration. */ constructor(options?: RateLimiterOptions); /** * Acquire a single token before proceeding. * The returned promise resolves when a token is allocated. * * @param signal Optional abort signal used to cancel the wait. * @returns Promise that resolves once a token is granted. * @throws {Error} Rejects with an `AbortError` if the signal aborts before a token is available. */ acquire(signal?: AbortSignalLike): Promise; /** * Stop the internal refill timer and clear queued waiters. * * Rejects all pending acquirers with a disposal error so callers can release resources gracefully. */ dispose(): void; private refill; private removeFromQueue; } //# sourceMappingURL=RateLimiter.d.ts.map