/** * Rate Limiter - Prevent overwhelming APIs during testing. * * Token-bucket algorithm with per-provider and global rate limits. */ export interface RateLimitConfig { /** Requests per minute per provider, e.g. { openai: 60, anthropic: 40 } */ [provider: string]: number; } export interface RateLimiterOptions { /** Per-provider limits (requests per minute) */ limits: RateLimitConfig; /** Global limit across all providers (requests per minute) */ global?: number; } /** * Token-bucket rate limiter for API calls during testing. */ export declare class RateLimiter { private buckets; private globalBucket?; constructor(options: RateLimiterOptions); private createBucket; private refillBucket; private tryConsume; private waitTimeMs; /** * Acquire a rate limit token for the given provider. * Blocks (via promise) if rate limit is exceeded. */ acquire(provider: string): Promise; /** * Check if a request can proceed without waiting. */ canProceed(provider: string): boolean; /** * Get remaining tokens for a provider. */ remaining(provider: string): number; /** * Get remaining global tokens. */ globalRemaining(): number; /** * Get estimated wait time in ms for a provider. */ estimatedWait(provider: string): number; /** * Reset all buckets to full capacity. */ reset(): void; /** * Get status of all rate limiters. */ status(): Record; private sleep; } /** * Create a rate limiter from YAML-style config. * Accepts strings like "60/min" or plain numbers (interpreted as per-minute). */ export declare function createRateLimiter(config: Record): RateLimiter; /** * Parse a rate string like "60/min" into requests per minute. */ export declare function parseRate(rate: string | number): number; //# sourceMappingURL=rate-limiter.d.ts.map