fix(quota): match the Claude Code integration provider to Claude quota

The opencode-claude integration registers its provider as `claude-code`, which
never matched the `claude` quota provider, so the collapsed Usage section in
the work status panel showed no limit for a model from that integration.

Claude windows also reported no duration, leaving the headline to fall back to
whichever row came first instead of the limit that runs out soonest. The
session and weekly windows now carry their length; extra usage stays without
one because it is a monthly spend cap.
This commit is contained in:
Bohdan Triapitsyn
2026-08-14 21:07:55 +03:00
parent b77a30cd88
commit 72cd861eb8
4 changed files with 31 additions and 7 deletions
@@ -36,6 +36,10 @@ describe('resolveQuotaProviderId', () => {
expect(resolveQuotaProviderId('anthropic')).toBe('claude');
});
test('maps the opencode-claude integration provider onto Claude quota', () => {
expect(resolveQuotaProviderId('claude-code')).toBe('claude');
});
test('is case and whitespace tolerant, and rejects empties', () => {
expect(resolveQuotaProviderId(' OpenAI ')).toBe('codex');
expect(resolveQuotaProviderId('')).toBeNull();
@@ -13,11 +13,15 @@ import type { UsageProviderGroup, UsageLimitRow } from '@/components/usage/usage
/**
* Quota provider ids mostly match OpenCode provider ids; these are the ones
* that do not. Unmatched providers simply produce no headline.
*
* `claude-code` is the provider the opencode-claude integration registers, and
* it bills against the same Claude subscription the `claude` quota reports.
*/
const QUOTA_PROVIDER_ALIASES = new Map<string, string>([
['openai', 'codex'],
['chatgpt', 'codex'],
['anthropic', 'claude'],
['claude-code', 'claude'],
['gemini', 'google'],
]);