/** * ADO Token Bucket Rate Limiter * * Simple token bucket that prevents exceeding Azure DevOps API rate limits. * ADO's documented limit is ~200 requests per minute for PAT-based auth. * * Supports Retry-After header handling: when ADO returns 429, call * applyRetryAfter(seconds) to block consumption until the cooldown expires. * * @module ado-rate-limiter */ export interface AdoRateLimiterOptions { /** Max tokens per window (default: 200) */ capacity?: number; /** Window duration in ms (default: 60000 = 1 minute) */ windowMs?: number; } export declare class AdoRateLimiter { private readonly capacity; private readonly windowMs; private tokens; private windowStart; private retryAfterUntil; constructor(options?: AdoRateLimiterOptions); /** * Try to consume one token. Returns true if allowed, false if exhausted. */ consume(): boolean; /** * Number of tokens remaining in the current window. */ remaining(): number; /** * Whether the bucket is fully exhausted (0 tokens remaining). */ isExhausted(): boolean; /** * Apply a Retry-After delay (from ADO 429 response). * Blocks all consumption until the delay expires. * * @param seconds - Number of seconds to wait */ applyRetryAfter(seconds: number): void; private refillIfWindowExpired; } //# sourceMappingURL=ado-rate-limiter.d.ts.map