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