MCPcopy Create free account
hub / github.com/codeaashu/claude-code / getCurrentMockScenario

Function getCurrentMockScenario

src/services/mockRateLimits.ts:720–756  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

718}
719
720export function getCurrentMockScenario(): MockScenario | null {
721 if (!mockEnabled) {
722 return null
723 }
724
725 // Reverse lookup the scenario from current headers
726 if (!mockHeaders) return null
727
728 const status = mockHeaders['anthropic-ratelimit-unified-status']
729 const overage = mockHeaders['anthropic-ratelimit-unified-overage-status']
730 const claim = mockHeaders['anthropic-ratelimit-unified-representative-claim']
731
732 if (claim === 'seven_day_opus') {
733 return status === 'rejected' ? 'opus-limit' : 'opus-warning'
734 }
735
736 if (claim === 'seven_day_sonnet') {
737 return status === 'rejected' ? 'sonnet-limit' : 'sonnet-warning'
738 }
739
740 if (overage === 'rejected') return 'overage-exhausted'
741 if (overage === 'allowed_warning') return 'overage-warning'
742 if (overage === 'allowed') return 'overage-active'
743
744 if (status === 'rejected') {
745 if (claim === 'five_hour') return 'session-limit-reached'
746 if (claim === 'seven_day') return 'weekly-limit-reached'
747 }
748
749 if (status === 'allowed_warning') {
750 if (claim === 'seven_day') return 'approaching-weekly-limit'
751 }
752
753 if (status === 'allowed') return 'normal'
754
755 return null
756}
757
758export function getScenarioDescription(scenario: MockScenario): string {
759 switch (scenario) {

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected