/** * Navidrome MCP Server - Per-key token buckets * Copyright (C) 2025 * SPDX-License-Identifier: AGPL-3.0-or-later */ /** Each key holds up to `capacity` tokens, which refill evenly across `windowMs`. */ export declare class TokenBuckets { private readonly capacity; private readonly windowMs; private readonly now; private readonly buckets; constructor(capacity: number, windowMs: number, now?: () => number); /** Returns 0 when the key holds a token, or the wait in milliseconds until it does. */ waitMs(key: string): number; /** Call only after `waitMs` returned 0. */ take(key: string): void; /** Spends a token when the key holds one. Returns 0 then, or the wait in milliseconds. */ tryTake(key: string): number; /** A full bucket holds no state worth keeping, so dropping it bounds the map. */ prune(): void; private refill; } //# sourceMappingURL=token-bucket.d.ts.map