# Type Alias RateLimitResult

RateLimitResult:
| { allowed: true; remainingTokens: number }
| { allowed: false; remainingTokens: number; retryAfterMs: number }

Result returned by RateLimiter.removeTokens.

Discriminated union: when `allowed` is `true`, tokens were consumed. When `allowed` is `false`, the wait would have exceeded the timeout and `retryAfterMs` is always present with a value ≥ 1 (milliseconds until the bucket is expected to have enough tokens; treat `1` as "retry immediately").

Note: `remainingTokens` is always a non-negative integer (`Math.floor` of the internal fractional bucket state). This differs from RateLimiter.getAvailableTokens, which may return a fractional value.

- Defined in utils/rateLimiter.ts:43