fix: improve loadCodeAssist for Google One AI Pro accounts
- Add separate LOAD_CODE_ASSIST_ENDPOINTS (prod first) and LOAD_CODE_ASSIST_HEADERS (google-api-nodejs-client User-Agent) - Add duetProject to metadata for project discovery - Silent fallback when API returns success but no project (matches opencode-antigravity-auth behavior) - Only warn when all endpoints fail with actual errors Fixes #114, addresses discussion #113 Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -57,6 +57,25 @@ export const ANTIGRAVITY_HEADERS = {
|
||||
})
|
||||
};
|
||||
|
||||
// Endpoint order for loadCodeAssist (prod first)
|
||||
// loadCodeAssist works better on prod for fresh/unprovisioned accounts
|
||||
export const LOAD_CODE_ASSIST_ENDPOINTS = [
|
||||
ANTIGRAVITY_ENDPOINT_PROD,
|
||||
ANTIGRAVITY_ENDPOINT_DAILY
|
||||
];
|
||||
|
||||
// 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'
|
||||
})
|
||||
};
|
||||
|
||||
// Default project ID if none can be discovered
|
||||
export const DEFAULT_PROJECT_ID = 'rising-fact-p41fc';
|
||||
|
||||
@@ -171,6 +190,8 @@ export const MODEL_FALLBACK_MAP = {
|
||||
export default {
|
||||
ANTIGRAVITY_ENDPOINT_FALLBACKS,
|
||||
ANTIGRAVITY_HEADERS,
|
||||
LOAD_CODE_ASSIST_ENDPOINTS,
|
||||
LOAD_CODE_ASSIST_HEADERS,
|
||||
DEFAULT_PROJECT_ID,
|
||||
TOKEN_REFRESH_INTERVAL_MS,
|
||||
REQUEST_BODY_LIMIT,
|
||||
|
||||
Reference in New Issue
Block a user