/** * Process-local rate limiter for outbound provider calls. Use to prevent * a fleet of agents from stampeding a single API key when the host runs * many sessions in parallel. The default token-bucket implementation is * in-memory; `@fabric-harness/node` exports `redisRateLimiter` for shared * limits across processes. * * fabric-harness ships this as a generic primitive — the same limiter can * be reused for outbound HTTP calls inside connectors, webhook fan-out, * or anywhere else throttling is useful. */ export interface RateLimiterAcquireOptions { /** Tokens to acquire (default 1). Use for variable-cost requests (e.g. token-priced calls). */ cost?: number; /** Optional abort signal. Aborts the wait when triggered. */ signal?: AbortSignal; } export interface RateLimiter { /** Block until `cost` tokens are available for `key`, then consume them. */ acquire(key: string, options?: RateLimiterAcquireOptions): Promise; /** Inspect current bucket state (mostly for tests / observability). */ inspect?(key: string): { availableTokens: number; capacity: number; }; } export interface TokenBucketRateLimiterOptions { /** Sustained throughput (tokens per second). */ tokensPerSecond: number; /** Burst capacity. Defaults to tokensPerSecond * 5. */ burst?: number; } /** * In-memory token-bucket rate limiter. Each key has its own bucket — keys * are independent (waiting on one key doesn't block another). Buckets * refill continuously at `tokensPerSecond`. */ export declare function tokenBucketRateLimiter(options: TokenBucketRateLimiterOptions): RateLimiter; //# sourceMappingURL=rate-limiter.d.ts.map