/** * Sliding Window Rate Limiter * * Implements the sliding window counter algorithm for rate limiting. * Uses two adjacent fixed-window counters with weighted interpolation * to approximate a true sliding window with O(1) storage per check. * * Built entirely on StorageAdapter interface (incr, mget, expire) — * works with Memory, Redis, Vercel KV, Upstash backends. */ import type { StorageAdapter } from '@frontmcp/utils'; import type { RateLimitResult } from './types'; export declare class SlidingWindowRateLimiter { private readonly storage; constructor(storage: StorageAdapter); /** * Check whether a request is allowed under the rate limit. * If allowed, the counter is atomically incremented. */ check(key: string, maxRequests: number, windowMs: number): Promise; /** * Reset the rate limit counters for a key. */ reset(key: string, windowMs: number): Promise; }