fix: accurate quota reporting with project ID and improved rate limit handling

- Pass project ID to fetchAvailableModels for accurate per-project quota
- Treat missing remainingFraction with resetTime as 0% (exhausted)
- Fix double-escaped regex in rate-limit-parser.js (\\d -> \d)
- Use ANTIGRAVITY_HEADERS for loadCodeAssist consistency
- Store actual reset time from API instead of capping at default
- Add getRateLimitInfo() for detailed rate limit state
- Handle disabled accounts in rate limit checks

Fixes issue where free tier accounts showed 100% quota but were actually exhausted.

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
Badri Narayanan S
2026-01-15 16:18:13 +05:30
parent a20cba90ee
commit 77363c679e
8 changed files with 252 additions and 163 deletions

View File

@@ -69,15 +69,16 @@ export const ONBOARD_USER_ENDPOINTS = ANTIGRAVITY_ENDPOINT_FALLBACKS;
// Hybrid headers specifically for loadCodeAssist
// Uses google-api-nodejs-client User-Agent (required for project discovery on some accounts)
export const LOAD_CODE_ASSIST_HEADERS = {
'User-Agent': 'google-api-nodejs-client/9.15.1',
'X-Goog-Api-Client': 'google-cloud-sdk vscode_cloudshelleditor/0.1',
'Client-Metadata': JSON.stringify({
ideType: 'IDE_UNSPECIFIED',
platform: 'PLATFORM_UNSPECIFIED',
pluginType: 'GEMINI'
})
};
// export const LOAD_CODE_ASSIST_HEADERS = {
// 'User-Agent': 'google-api-nodejs-client/9.15.1',
// 'X-Goog-Api-Client': 'google-cloud-sdk vscode_cloudshelleditor/0.1',
// 'Client-Metadata': JSON.stringify({
// ideType: 'IDE_UNSPECIFIED',
// platform: 'PLATFORM_UNSPECIFIED',
// pluginType: 'GEMINI'
// })
// };
export const LOAD_CODE_ASSIST_HEADERS = ANTIGRAVITY_HEADERS;
// Default project ID if none can be discovered
export const DEFAULT_PROJECT_ID = 'rising-fact-p41fc';