// Mock rate limits for testing [internal-only] // The external build keeps this module as a stable no-op surface so imports // remain valid without exposing internal-only rate-limit simulation behavior. import { setMockBillingAccessOverride } from '../utils/billing.js' import type { OverageDisabledReason } from './claudeAiLimits.js' type SubscriptionType = string type MockHeaders = { 'anthropic-ratelimit-unified-status'?: | 'allowed' | 'allowed_warning' | 'rejected' 'anthropic-ratelimit-unified-reset'?: string 'anthropic-ratelimit-unified-representative-claim'?: | 'five_hour' | 'seven_day' | 'seven_day_opus' | 'seven_day_sonnet' 'anthropic-ratelimit-unified-overage-status'?: | 'allowed' | 'allowed_warning' | 'rejected' 'anthropic-ratelimit-unified-overage-reset'?: string 'anthropic-ratelimit-unified-overage-disabled-reason'?: OverageDisabledReason 'anthropic-ratelimit-unified-fallback'?: 'available' 'anthropic-ratelimit-unified-fallback-percentage'?: string 'retry-after'?: string 'anthropic-ratelimit-unified-5h-utilization'?: string 'anthropic-ratelimit-unified-5h-reset'?: string 'anthropic-ratelimit-unified-5h-surpassed-threshold'?: string 'anthropic-ratelimit-unified-7d-utilization'?: string 'anthropic-ratelimit-unified-7d-reset'?: string 'anthropic-ratelimit-unified-7d-surpassed-threshold'?: string 'anthropic-ratelimit-unified-overage-utilization'?: string 'anthropic-ratelimit-unified-overage-surpassed-threshold'?: string } export type MockHeaderKey = | 'status' | 'reset' | 'claim' | 'overage-status' | 'overage-reset' | 'overage-disabled-reason' | 'fallback' | 'fallback-percentage' | 'retry-after' | '5h-utilization' | '5h-reset' | '5h-surpassed-threshold' | '7d-utilization' | '7d-reset' | '7d-surpassed-threshold' export type MockScenario = | 'normal' | 'session-limit-reached' | 'approaching-weekly-limit' | 'weekly-limit-reached' | 'overage-active' | 'overage-warning' | 'overage-exhausted' | 'out-of-credits' | 'org-zero-credit-limit' | 'org-spend-cap-hit' | 'member-zero-credit-limit' | 'seat-tier-zero-credit-limit' | 'opus-limit' | 'opus-warning' | 'sonnet-limit' | 'sonnet-warning' | 'fast-mode-limit' | 'fast-mode-short-limit' | 'extra-usage-required' | 'clear' export function setMockHeader( _key: MockHeaderKey, _value: string | undefined, ): void {} export function addExceededLimit( _type: 'five_hour' | 'seven_day' | 'seven_day_opus' | 'seven_day_sonnet', _hoursFromNow: number, ): void {} export function setMockEarlyWarning( _claimAbbrev: '5h' | '7d' | 'overage', _utilization: number, _hoursFromNow?: number, ): void {} export function clearMockEarlyWarning(): void {} export function setMockRateLimitScenario(_scenario: MockScenario): void {} export function getMockHeaderless429Message(): string | null { return null } export function getMockHeaders(): MockHeaders | null { return null } export function getMockStatus(): string { return 'No mock headers active (using real limits)' } export function clearMockHeaders(): void { setMockBillingAccessOverride(null) } export function applyMockHeaders( headers: globalThis.Headers, ): globalThis.Headers { return headers } export function shouldProcessMockLimits(): boolean { return false } export function getCurrentMockScenario(): MockScenario | null { return null } export function getScenarioDescription(scenario: MockScenario): string { switch (scenario) { case 'normal': return 'Normal usage, no limits' case 'session-limit-reached': return 'Session rate limit exceeded' case 'approaching-weekly-limit': return 'Approaching weekly aggregate limit' case 'weekly-limit-reached': return 'Weekly aggregate limit exceeded' case 'overage-active': return 'Using extra usage (overage active)' case 'overage-warning': return 'Approaching extra usage limit' case 'overage-exhausted': return 'Both subscription and extra usage limits exhausted' case 'out-of-credits': return 'Out of extra usage credits (wallet empty)' case 'org-zero-credit-limit': return 'Org spend cap is zero (no extra usage budget)' case 'org-spend-cap-hit': return 'Org spend cap hit for the month' case 'member-zero-credit-limit': return 'Member limit is zero (admin can allocate more)' case 'seat-tier-zero-credit-limit': return 'Seat tier limit is zero (admin can allocate more)' case 'opus-limit': return 'Opus limit reached' case 'opus-warning': return 'Approaching Opus limit' case 'sonnet-limit': return 'Sonnet limit reached' case 'sonnet-warning': return 'Approaching Sonnet limit' case 'fast-mode-limit': return 'Fast mode rate limit' case 'fast-mode-short-limit': return 'Fast mode rate limit (short)' case 'extra-usage-required': return 'Headerless 429: Extra usage required for 1M context' case 'clear': return 'Clear mock headers (use real limits)' default: return 'Unknown scenario' } } export function setMockSubscriptionType( _subscriptionType: SubscriptionType | null, ): void {} export function getMockSubscriptionType(): SubscriptionType | null { return null } export function shouldUseMockSubscription(): boolean { return false } export function setMockBillingAccess(_hasAccess: boolean | null): void { // External build: internal mock billing access overrides are disabled. } export function isMockFastModeRateLimitScenario(): boolean { return false } export function checkMockFastModeRateLimit( _isFastModeActive?: boolean, ): MockHeaders | null { return null }