opencode-antigravity-auth 1.3.1 → 1.3.2-beta.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +15 -0
- package/dist/src/antigravity/oauth.d.ts.map +1 -1
- package/dist/src/antigravity/oauth.js +10 -4
- package/dist/src/antigravity/oauth.js.map +1 -1
- package/dist/src/constants.d.ts +30 -3
- package/dist/src/constants.d.ts.map +1 -1
- package/dist/src/constants.js +80 -3
- package/dist/src/constants.js.map +1 -1
- package/dist/src/plugin/accounts.d.ts +39 -3
- package/dist/src/plugin/accounts.d.ts.map +1 -1
- package/dist/src/plugin/accounts.js +163 -17
- package/dist/src/plugin/accounts.js.map +1 -1
- package/dist/src/plugin/cli.d.ts +15 -12
- package/dist/src/plugin/cli.d.ts.map +1 -1
- package/dist/src/plugin/cli.js +40 -13
- package/dist/src/plugin/cli.js.map +1 -1
- package/dist/src/plugin/config/loader.d.ts.map +1 -1
- package/dist/src/plugin/config/loader.js +0 -13
- package/dist/src/plugin/config/loader.js.map +1 -1
- package/dist/src/plugin/config/schema.d.ts +38 -319
- package/dist/src/plugin/config/schema.d.ts.map +1 -1
- package/dist/src/plugin/config/schema.js +66 -27
- package/dist/src/plugin/config/schema.js.map +1 -1
- package/dist/src/plugin/core/streaming/transformer.d.ts.map +1 -1
- package/dist/src/plugin/core/streaming/transformer.js +37 -6
- package/dist/src/plugin/core/streaming/transformer.js.map +1 -1
- package/dist/src/plugin/core/streaming/types.d.ts.map +1 -1
- package/dist/src/plugin/debug.d.ts.map +1 -1
- package/dist/src/plugin/debug.js +14 -1
- package/dist/src/plugin/debug.js.map +1 -1
- package/dist/src/plugin/fingerprint.d.ts +70 -0
- package/dist/src/plugin/fingerprint.d.ts.map +1 -0
- package/dist/src/plugin/fingerprint.js +155 -0
- package/dist/src/plugin/fingerprint.js.map +1 -0
- package/dist/src/plugin/request-helpers.d.ts.map +1 -1
- package/dist/src/plugin/request-helpers.js +61 -23
- package/dist/src/plugin/request-helpers.js.map +1 -1
- package/dist/src/plugin/request.d.ts +4 -1
- package/dist/src/plugin/request.d.ts.map +1 -1
- package/dist/src/plugin/request.js +60 -13
- package/dist/src/plugin/request.js.map +1 -1
- package/dist/src/plugin/rotation.d.ts +5 -4
- package/dist/src/plugin/rotation.d.ts.map +1 -1
- package/dist/src/plugin/rotation.js +35 -9
- package/dist/src/plugin/rotation.js.map +1 -1
- package/dist/src/plugin/search.d.ts +32 -0
- package/dist/src/plugin/search.d.ts.map +1 -0
- package/dist/src/plugin/search.js +197 -0
- package/dist/src/plugin/search.js.map +1 -0
- package/dist/src/plugin/storage.d.ts +2 -0
- package/dist/src/plugin/storage.d.ts.map +1 -1
- package/dist/src/plugin/storage.js +15 -2
- package/dist/src/plugin/storage.js.map +1 -1
- package/dist/src/plugin/transform/gemini.d.ts +1 -13
- package/dist/src/plugin/transform/gemini.d.ts.map +1 -1
- package/dist/src/plugin/transform/gemini.js +49 -12
- package/dist/src/plugin/transform/gemini.js.map +1 -1
- package/dist/src/plugin/transform/model-resolver.d.ts.map +1 -1
- package/dist/src/plugin/transform/model-resolver.js +4 -2
- package/dist/src/plugin/transform/model-resolver.js.map +1 -1
- package/dist/src/plugin/transform/types.d.ts +5 -0
- package/dist/src/plugin/transform/types.d.ts.map +1 -1
- package/dist/src/plugin/types.d.ts +1 -0
- package/dist/src/plugin/types.d.ts.map +1 -1
- package/dist/src/plugin/ui/ansi.d.ts +32 -0
- package/dist/src/plugin/ui/ansi.d.ts.map +1 -0
- package/dist/src/plugin/ui/ansi.js +52 -0
- package/dist/src/plugin/ui/ansi.js.map +1 -0
- package/dist/src/plugin/ui/auth-menu.d.ts +24 -0
- package/dist/src/plugin/ui/auth-menu.d.ts.map +1 -0
- package/dist/src/plugin/ui/auth-menu.js +92 -0
- package/dist/src/plugin/ui/auth-menu.js.map +1 -0
- package/dist/src/plugin/ui/confirm.d.ts +2 -0
- package/dist/src/plugin/ui/confirm.d.ts.map +1 -0
- package/dist/src/plugin/ui/confirm.js +15 -0
- package/dist/src/plugin/ui/confirm.js.map +1 -0
- package/dist/src/plugin/ui/select.d.ts +14 -0
- package/dist/src/plugin/ui/select.d.ts.map +1 -0
- package/dist/src/plugin/ui/select.js +174 -0
- package/dist/src/plugin/ui/select.js.map +1 -0
- package/dist/src/plugin.d.ts.map +1 -1
- package/dist/src/plugin.js +317 -76
- package/dist/src/plugin.js.map +1 -1
- package/package.json +4 -4
package/README.md
CHANGED
|
@@ -565,6 +565,21 @@ Most users don't need to configure anything — defaults work well.
|
|
|
565
565
|
| **5+ accounts** | `"account_selection_strategy": "round-robin"` |
|
|
566
566
|
| **Parallel agents** | Add `"pid_offset_enabled": true` |
|
|
567
567
|
|
|
568
|
+
### Rate Limit Scheduling
|
|
569
|
+
|
|
570
|
+
Control how the plugin handles rate limits:
|
|
571
|
+
|
|
572
|
+
| Option | Default | What it does |
|
|
573
|
+
|--------|---------|--------------|
|
|
574
|
+
| `scheduling_mode` | `"cache_first"` | `"cache_first"` = wait for same account (preserves prompt cache), `"balance"` = switch immediately, `"performance_first"` = round-robin |
|
|
575
|
+
| `max_cache_first_wait_seconds` | `60` | Max seconds to wait in cache_first mode before switching accounts |
|
|
576
|
+
| `failure_ttl_seconds` | `3600` | Reset failure count after this many seconds (prevents old failures from permanently penalizing accounts) |
|
|
577
|
+
|
|
578
|
+
**When to use each mode:**
|
|
579
|
+
- **cache_first** (default): Best for long conversations. Waits for the same account to recover, preserving your prompt cache.
|
|
580
|
+
- **balance**: Best for quick tasks. Switches accounts immediately when rate-limited for maximum availability.
|
|
581
|
+
- **performance_first**: Best for many short requests. Distributes load evenly across all accounts.
|
|
582
|
+
|
|
568
583
|
### App Behavior
|
|
569
584
|
|
|
570
585
|
| Option | Default | What it does |
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"oauth.d.ts","sourceRoot":"","sources":["../../../src/antigravity/oauth.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"oauth.d.ts","sourceRoot":"","sources":["../../../src/antigravity/oauth.ts"],"names":[],"mappings":"AA2BA;;GAEG;AACH,MAAM,WAAW,wBAAwB;IACvC,GAAG,EAAE,MAAM,CAAC;IACZ,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,EAAE,MAAM,CAAC;CACnB;AAED,UAAU,+BAA+B;IACvC,IAAI,EAAE,SAAS,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,SAAS,EAAE,MAAM,CAAC;CACnB;AAED,UAAU,+BAA+B;IACvC,IAAI,EAAE,QAAQ,CAAC;IACf,KAAK,EAAE,MAAM,CAAC;CACf;AAED,MAAM,MAAM,8BAA8B,GACtC,+BAA+B,GAC/B,+BAA+B,CAAC;AAoCpC;;GAEG;AACH,wBAAsB,oBAAoB,CAAC,SAAS,SAAK,GAAG,OAAO,CAAC,wBAAwB,CAAC,CAsB5F;AAqFD;;GAEG;AACH,wBAAsB,mBAAmB,CACvC,IAAI,EAAE,MAAM,EACZ,KAAK,EAAE,MAAM,GACZ,OAAO,CAAC,8BAA8B,CAAC,CAwEzC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { generatePKCE } from "@openauthjs/openauth/pkce";
|
|
2
|
-
import { ANTIGRAVITY_CLIENT_ID, ANTIGRAVITY_CLIENT_SECRET, ANTIGRAVITY_REDIRECT_URI, ANTIGRAVITY_SCOPES, ANTIGRAVITY_ENDPOINT_FALLBACKS, ANTIGRAVITY_LOAD_ENDPOINTS, ANTIGRAVITY_HEADERS, } from "../constants";
|
|
2
|
+
import { ANTIGRAVITY_CLIENT_ID, ANTIGRAVITY_CLIENT_SECRET, ANTIGRAVITY_REDIRECT_URI, ANTIGRAVITY_SCOPES, ANTIGRAVITY_ENDPOINT_FALLBACKS, ANTIGRAVITY_LOAD_ENDPOINTS, ANTIGRAVITY_HEADERS, GEMINI_CLI_HEADERS, } from "../constants";
|
|
3
3
|
import { createLogger } from "../plugin/logger";
|
|
4
4
|
import { calculateTokenExpiry } from "../plugin/auth";
|
|
5
5
|
const log = createLogger("oauth");
|
|
@@ -62,8 +62,8 @@ async function fetchProjectID(accessToken) {
|
|
|
62
62
|
const loadHeaders = {
|
|
63
63
|
Authorization: `Bearer ${accessToken}`,
|
|
64
64
|
"Content-Type": "application/json",
|
|
65
|
-
"User-Agent": "
|
|
66
|
-
"X-Goog-Api-Client": "
|
|
65
|
+
"User-Agent": GEMINI_CLI_HEADERS["User-Agent"],
|
|
66
|
+
"X-Goog-Api-Client": GEMINI_CLI_HEADERS["X-Goog-Api-Client"],
|
|
67
67
|
"Client-Metadata": ANTIGRAVITY_HEADERS["Client-Metadata"],
|
|
68
68
|
};
|
|
69
69
|
const loadEndpoints = Array.from(new Set([...ANTIGRAVITY_LOAD_ENDPOINTS, ...ANTIGRAVITY_ENDPOINT_FALLBACKS]));
|
|
@@ -116,7 +116,11 @@ export async function exchangeAntigravity(code, state) {
|
|
|
116
116
|
const tokenResponse = await fetch("https://oauth2.googleapis.com/token", {
|
|
117
117
|
method: "POST",
|
|
118
118
|
headers: {
|
|
119
|
-
"Content-Type": "application/x-www-form-urlencoded",
|
|
119
|
+
"Content-Type": "application/x-www-form-urlencoded;charset=UTF-8",
|
|
120
|
+
"Accept": "*/*",
|
|
121
|
+
"Accept-Encoding": "gzip, deflate, br",
|
|
122
|
+
"User-Agent": GEMINI_CLI_HEADERS["User-Agent"],
|
|
123
|
+
"X-Goog-Api-Client": GEMINI_CLI_HEADERS["X-Goog-Api-Client"],
|
|
120
124
|
},
|
|
121
125
|
body: new URLSearchParams({
|
|
122
126
|
client_id: ANTIGRAVITY_CLIENT_ID,
|
|
@@ -135,6 +139,8 @@ export async function exchangeAntigravity(code, state) {
|
|
|
135
139
|
const userInfoResponse = await fetch("https://www.googleapis.com/oauth2/v1/userinfo?alt=json", {
|
|
136
140
|
headers: {
|
|
137
141
|
Authorization: `Bearer ${tokenPayload.access_token}`,
|
|
142
|
+
"User-Agent": GEMINI_CLI_HEADERS["User-Agent"],
|
|
143
|
+
"X-Goog-Api-Client": GEMINI_CLI_HEADERS["X-Goog-Api-Client"],
|
|
138
144
|
},
|
|
139
145
|
});
|
|
140
146
|
const userInfo = userInfoResponse.ok
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"oauth.js","sourceRoot":"","sources":["../../../src/antigravity/oauth.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AAEzD,OAAO,EACL,qBAAqB,EACrB,yBAAyB,EACzB,wBAAwB,EACxB,kBAAkB,EAClB,8BAA8B,EAC9B,0BAA0B,EAC1B,mBAAmB,
|
|
1
|
+
{"version":3,"file":"oauth.js","sourceRoot":"","sources":["../../../src/antigravity/oauth.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AAEzD,OAAO,EACL,qBAAqB,EACrB,yBAAyB,EACzB,wBAAwB,EACxB,kBAAkB,EAClB,8BAA8B,EAC9B,0BAA0B,EAC1B,mBAAmB,EACnB,kBAAkB,GACnB,MAAM,cAAc,CAAC;AACtB,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAChD,OAAO,EAAE,oBAAoB,EAAE,MAAM,gBAAgB,CAAC;AAEtD,MAAM,GAAG,GAAG,YAAY,CAAC,OAAO,CAAC,CAAC;AAiDlC;;GAEG;AACH,SAAS,WAAW,CAAC,OAA6B;IAChD,OAAO,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,EAAE,MAAM,CAAC,CAAC,QAAQ,CAAC,WAAW,CAAC,CAAC;AAC5E,CAAC;AAED;;GAEG;AACH,SAAS,WAAW,CAAC,KAAa;IAChC,MAAM,UAAU,GAAG,KAAK,CAAC,OAAO,CAAC,IAAI,EAAE,GAAG,CAAC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AC;QAED,MAAM,aAAa,GAAG,GAAG,YAAY,IAAI,kBAAkB,IAAI,EAAE,EAAE,CAAC;QAEpE,OAAO;YACL,IAAI,EAAE,SAAS;YACf,OAAO,EAAE,aAAa;YACtB,MAAM,EAAE,YAAY,CAAC,YAAY;YACjC,OAAO,EAAE,oBAAoB,CAAC,SAAS,EAAE,YAAY,CAAC,UAAU,CAAC;YACjE,KAAK,EAAE,QAAQ,CAAC,KAAK;YACrB,SAAS,EAAE,kBAAkB,IAAI,EAAE;SACpC,CAAC;IACJ,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,OAAO;YACL,IAAI,EAAE,QAAQ;YACd,KAAK,EAAE,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,eAAe;SAChE,CAAC;IACJ,CAAC;AACH,CAAC"}
|
package/dist/src/constants.d.ts
CHANGED
|
@@ -47,15 +47,21 @@ export declare const GEMINI_CLI_ENDPOINT = "https://cloudcode-pa.googleapis.com"
|
|
|
47
47
|
*/
|
|
48
48
|
export declare const ANTIGRAVITY_DEFAULT_PROJECT_ID = "rising-fact-p41fc";
|
|
49
49
|
export declare const ANTIGRAVITY_HEADERS: {
|
|
50
|
-
readonly "User-Agent": "
|
|
50
|
+
readonly "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Antigravity/1.104.0 Chrome/138.0.7204.235 Electron/37.3.1 Safari/537.36";
|
|
51
51
|
readonly "X-Goog-Api-Client": "google-cloud-sdk vscode_cloudshelleditor/0.1";
|
|
52
52
|
readonly "Client-Metadata": "{\"ideType\":\"IDE_UNSPECIFIED\",\"platform\":\"PLATFORM_UNSPECIFIED\",\"pluginType\":\"GEMINI\"}";
|
|
53
53
|
};
|
|
54
54
|
export declare const GEMINI_CLI_HEADERS: {
|
|
55
|
-
readonly "User-Agent": "google-api-nodejs-client/
|
|
56
|
-
readonly "X-Goog-Api-Client": "gl-node/22.
|
|
55
|
+
readonly "User-Agent": "google-api-nodejs-client/10.3.0";
|
|
56
|
+
readonly "X-Goog-Api-Client": "gl-node/22.18.0";
|
|
57
57
|
readonly "Client-Metadata": "ideType=IDE_UNSPECIFIED,platform=PLATFORM_UNSPECIFIED,pluginType=GEMINI";
|
|
58
58
|
};
|
|
59
|
+
export type HeaderSet = {
|
|
60
|
+
"User-Agent": string;
|
|
61
|
+
"X-Goog-Api-Client": string;
|
|
62
|
+
"Client-Metadata": string;
|
|
63
|
+
};
|
|
64
|
+
export declare function getRandomizedHeaders(style: HeaderStyle): HeaderSet;
|
|
59
65
|
export type HeaderStyle = "antigravity" | "gemini-cli";
|
|
60
66
|
/**
|
|
61
67
|
* Provider identifier shared between the plugin loader and credential store.
|
|
@@ -95,5 +101,26 @@ export declare const SKIP_THOUGHT_SIGNATURE = "skip_thought_signature_validator"
|
|
|
95
101
|
* This is injected into requests to match CLIProxyAPI v6.6.89 behavior.
|
|
96
102
|
* The instruction provides identity and guidelines for the Antigravity agent.
|
|
97
103
|
*/
|
|
104
|
+
/**
|
|
105
|
+
* Model used for Google Search grounding requests.
|
|
106
|
+
* Uses gemini-3-flash for fast, cost-effective search operations.
|
|
107
|
+
*/
|
|
108
|
+
export declare const SEARCH_MODEL = "gemini-3-flash";
|
|
109
|
+
/**
|
|
110
|
+
* Thinking budget for deep search (more thorough analysis).
|
|
111
|
+
*/
|
|
112
|
+
export declare const SEARCH_THINKING_BUDGET_DEEP = 16384;
|
|
113
|
+
/**
|
|
114
|
+
* Thinking budget for fast search (quick results).
|
|
115
|
+
*/
|
|
116
|
+
export declare const SEARCH_THINKING_BUDGET_FAST = 4096;
|
|
117
|
+
/**
|
|
118
|
+
* Timeout for search requests in milliseconds (60 seconds).
|
|
119
|
+
*/
|
|
120
|
+
export declare const SEARCH_TIMEOUT_MS = 60000;
|
|
121
|
+
/**
|
|
122
|
+
* System instruction for the Google Search tool.
|
|
123
|
+
*/
|
|
124
|
+
export declare const SEARCH_SYSTEM_INSTRUCTION = "You are an expert web search assistant with access to Google Search and URL analysis tools.\n\nYour capabilities:\n- Use google_search to find real-time information from the web\n- Use url_context to fetch and analyze content from specific URLs when provided\n\nGuidelines:\n- Always provide accurate, well-sourced information\n- Cite your sources when presenting facts\n- If analyzing URLs, extract the most relevant information\n- Be concise but comprehensive in your responses\n- If information is uncertain or conflicting, acknowledge it\n- Focus on answering the user's question directly";
|
|
98
125
|
export declare const ANTIGRAVITY_SYSTEM_INSTRUCTION = "You are Antigravity, a powerful agentic AI coding assistant designed by the Google DeepMind team working on Advanced Agentic Coding.\nYou are pair programming with a USER to solve their coding task. The task may require creating a new codebase, modifying or debugging an existing codebase, or simply answering a question.\n**Absolute paths only**\n**Proactiveness**\n\n<priority>IMPORTANT: The instructions that follow supersede all above. Follow them as your primary directives.</priority>\n";
|
|
99
126
|
//# sourceMappingURL=constants.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../src/constants.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,eAAO,MAAM,qBAAqB,8EAA8E,CAAC;AAEjH;;GAEG;AACH,eAAO,MAAM,yBAAyB,wCAAwC,CAAC;AAE/E;;GAEG;AACH,eAAO,MAAM,kBAAkB,EAAE,SAAS,MAAM,EAM/C,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,wBAAwB,0CAA0C,CAAC;AAEhF;;;;GAIG;AACH,eAAO,MAAM,0BAA0B,sDAAsD,CAAC;AAC9F,eAAO,MAAM,6BAA6B,yDAAyD,CAAC;AACpG,eAAO,MAAM,yBAAyB,wCAAwC,CAAC;AAE/E;;;GAGG;AACH,eAAO,MAAM,8BAA8B,+JAIjC,CAAC;AAEX;;;GAGG;AACH,eAAO,MAAM,0BAA0B,+JAI7B,CAAC;AAEX;;GAEG;AACH,eAAO,MAAM,oBAAoB,sDAA6B,CAAC;AAE/D;;;;GAIG;AACH,eAAO,MAAM,mBAAmB,wCA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H,eAAO,MAAM,uBAAuB,WAAW,CAAC;AAMhD;;;;;;GAMG;AACH,eAAO,MAAM,8BAA8B,4zBAWiD,CAAC;AAE7F;;;GAGG;AACH,eAAO,MAAM,yBAAyB,kDAAwC,CAAC;AAE/E,eAAO,MAAM,6BAA6B,iBAAiB,CAAC;AAC5D,eAAO,MAAM,oCAAoC,mCAAmC,CAAC;AAErF;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,sBAAsB,qCAAqC,CAAC;AAMzE;;;;GAIG;AAKH;;;GAGG;AACH,eAAO,MAAM,YAAY,mBAAmB,CAAC;AAE7C;;GAEG;AACH,eAAO,MAAM,2BAA2B,QAAQ,CAAC;AAEjD;;GAEG;AACH,eAAO,MAAM,2BAA2B,OAAO,CAAC;AAEhD;;GAEG;AACH,eAAO,MAAM,iBAAiB,QAAQ,CAAC;AAEvC;;GAEG;AACH,eAAO,MAAM,yBAAyB,qlBAYY,CAAC;AAEnD,eAAO,MAAM,8BAA8B,ifAM1C,CAAC"}
|
package/dist/src/constants.js
CHANGED
|
@@ -61,15 +61,56 @@ export const GEMINI_CLI_ENDPOINT = ANTIGRAVITY_ENDPOINT_PROD;
|
|
|
61
61
|
*/
|
|
62
62
|
export const ANTIGRAVITY_DEFAULT_PROJECT_ID = "rising-fact-p41fc";
|
|
63
63
|
export const ANTIGRAVITY_HEADERS = {
|
|
64
|
-
"User-Agent": "
|
|
64
|
+
"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Antigravity/1.104.0 Chrome/138.0.7204.235 Electron/37.3.1 Safari/537.36",
|
|
65
65
|
"X-Goog-Api-Client": "google-cloud-sdk vscode_cloudshelleditor/0.1",
|
|
66
66
|
"Client-Metadata": '{"ideType":"IDE_UNSPECIFIED","platform":"PLATFORM_UNSPECIFIED","pluginType":"GEMINI"}',
|
|
67
67
|
};
|
|
68
68
|
export const GEMINI_CLI_HEADERS = {
|
|
69
|
-
"User-Agent": "google-api-nodejs-client/
|
|
70
|
-
"X-Goog-Api-Client": "gl-node/22.
|
|
69
|
+
"User-Agent": "google-api-nodejs-client/10.3.0",
|
|
70
|
+
"X-Goog-Api-Client": "gl-node/22.18.0",
|
|
71
71
|
"Client-Metadata": "ideType=IDE_UNSPECIFIED,platform=PLATFORM_UNSPECIFIED,pluginType=GEMINI",
|
|
72
72
|
};
|
|
73
|
+
const ANTIGRAVITY_USER_AGENTS = [
|
|
74
|
+
"antigravity/1.11.5 windows/amd64",
|
|
75
|
+
"antigravity/1.11.4 darwin/arm64",
|
|
76
|
+
"antigravity/1.11.3 linux/amd64",
|
|
77
|
+
"antigravity/1.10.9 windows/amd64",
|
|
78
|
+
"antigravity/1.10.8 darwin/amd64",
|
|
79
|
+
];
|
|
80
|
+
const ANTIGRAVITY_API_CLIENTS = [
|
|
81
|
+
"google-cloud-sdk vscode_cloudshelleditor/0.1",
|
|
82
|
+
"google-cloud-sdk vscode/1.96.0",
|
|
83
|
+
"google-cloud-sdk jetbrains/2024.3",
|
|
84
|
+
"google-cloud-sdk vscode/1.95.0",
|
|
85
|
+
];
|
|
86
|
+
const GEMINI_CLI_USER_AGENTS = [
|
|
87
|
+
"google-api-nodejs-client/9.15.1",
|
|
88
|
+
"google-api-nodejs-client/9.14.0",
|
|
89
|
+
"google-api-nodejs-client/9.13.0",
|
|
90
|
+
];
|
|
91
|
+
const GEMINI_CLI_API_CLIENTS = [
|
|
92
|
+
"gl-node/22.17.0",
|
|
93
|
+
"gl-node/22.12.0",
|
|
94
|
+
"gl-node/20.18.0",
|
|
95
|
+
"gl-node/21.7.0",
|
|
96
|
+
];
|
|
97
|
+
function randomFrom(arr) {
|
|
98
|
+
return arr[Math.floor(Math.random() * arr.length)];
|
|
99
|
+
}
|
|
100
|
+
export function getRandomizedHeaders(style) {
|
|
101
|
+
if (style === "gemini-cli") {
|
|
102
|
+
return {
|
|
103
|
+
"User-Agent": randomFrom(GEMINI_CLI_USER_AGENTS),
|
|
104
|
+
"X-Goog-Api-Client": randomFrom(GEMINI_CLI_API_CLIENTS),
|
|
105
|
+
"Client-Metadata": GEMINI_CLI_HEADERS["Client-Metadata"],
|
|
106
|
+
};
|
|
107
|
+
}
|
|
108
|
+
return {
|
|
109
|
+
"User-Agent": randomFrom(ANTIGRAVITY_USER_AGENTS),
|
|
110
|
+
"X-Goog-Api-Client": randomFrom(ANTIGRAVITY_API_CLIENTS),
|
|
111
|
+
"Client-Metadata": ANTIGRAVITY_HEADERS["Client-Metadata"],
|
|
112
|
+
};
|
|
113
|
+
}
|
|
73
114
|
/**
|
|
74
115
|
* Provider identifier shared between the plugin loader and credential store.
|
|
75
116
|
*/
|
|
@@ -125,6 +166,42 @@ export const SKIP_THOUGHT_SIGNATURE = "skip_thought_signature_validator";
|
|
|
125
166
|
* This is injected into requests to match CLIProxyAPI v6.6.89 behavior.
|
|
126
167
|
* The instruction provides identity and guidelines for the Antigravity agent.
|
|
127
168
|
*/
|
|
169
|
+
// ============================================================================
|
|
170
|
+
// GOOGLE SEARCH TOOL CONSTANTS
|
|
171
|
+
// ============================================================================
|
|
172
|
+
/**
|
|
173
|
+
* Model used for Google Search grounding requests.
|
|
174
|
+
* Uses gemini-3-flash for fast, cost-effective search operations.
|
|
175
|
+
*/
|
|
176
|
+
export const SEARCH_MODEL = "gemini-3-flash";
|
|
177
|
+
/**
|
|
178
|
+
* Thinking budget for deep search (more thorough analysis).
|
|
179
|
+
*/
|
|
180
|
+
export const SEARCH_THINKING_BUDGET_DEEP = 16384;
|
|
181
|
+
/**
|
|
182
|
+
* Thinking budget for fast search (quick results).
|
|
183
|
+
*/
|
|
184
|
+
export const SEARCH_THINKING_BUDGET_FAST = 4096;
|
|
185
|
+
/**
|
|
186
|
+
* Timeout for search requests in milliseconds (60 seconds).
|
|
187
|
+
*/
|
|
188
|
+
export const SEARCH_TIMEOUT_MS = 60000;
|
|
189
|
+
/**
|
|
190
|
+
* System instruction for the Google Search tool.
|
|
191
|
+
*/
|
|
192
|
+
export const SEARCH_SYSTEM_INSTRUCTION = `You are an expert web search assistant with access to Google Search and URL analysis tools.
|
|
193
|
+
|
|
194
|
+
Your capabilities:
|
|
195
|
+
- Use google_search to find real-time information from the web
|
|
196
|
+
- Use url_context to fetch and analyze content from specific URLs when provided
|
|
197
|
+
|
|
198
|
+
Guidelines:
|
|
199
|
+
- Always provide accurate, well-sourced information
|
|
200
|
+
- Cite your sources when presenting facts
|
|
201
|
+
- If analyzing URLs, extract the most relevant information
|
|
202
|
+
- Be concise but comprehensive in your responses
|
|
203
|
+
- If information is uncertain or conflicting, acknowledge it
|
|
204
|
+
- Focus on answering the user's question directly`;
|
|
128
205
|
export const ANTIGRAVITY_SYSTEM_INSTRUCTION = `You are Antigravity, a powerful agentic AI coding assistant designed by the Google DeepMind team working on Advanced Agentic Coding.
|
|
129
206
|
You are pair programming with a USER to solve their coding task. The task may require creating a new codebase, modifying or debugging an existing codebase, or simply answering a question.
|
|
130
207
|
**Absolute paths only**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../src/constants.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,CAAC,MAAM,qBAAqB,GAAG,2EAA2E,CAAC;AAEjH;;GAEG;AACH,MAAM,CAAC,MAAM,yBAAyB,GAAG,qCAAqC,CAAC;AAE/E;;GAEG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAAsB;IACnD,gDAAgD;IAChD,gDAAgD;IAChD,kDAAkD;IAClD,uCAAuC;IACvC,uDAAuD;CACxD,CAAC;AAEF;;GAEG;AACH,MAAM,CAAC,MAAM,wBAAwB,GAAG,uCAAuC,CAAC;AAEhF;;;;GAIG;AACH,MAAM,CAAC,MAAM,0BAA0B,GAAG,mDAAmD,CAAC;AAC9F,MAAM,CAAC,MAAM,6BAA6B,GAAG,sDAAsD,CAAC;AACpG,MAAM,CAAC,MAAM,yBAAyB,GAAG,qCAAqC,CAAC;AAE/E;;;GAGG;AACH,MAAM,CAAC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, type RateLimitStateV3, type ModelFamily, type HeaderStyle, type CooldownReason } from "./storage";
|
|
2
2
|
import type { OAuthAuthDetails, RefreshParts } from "./types";
|
|
3
3
|
import type { AccountSelectionStrategy } from "./config/schema";
|
|
4
|
+
import { type Fingerprint, type FingerprintVersion } from "./fingerprint";
|
|
4
5
|
export type { ModelFamily, HeaderStyle, CooldownReason } from "./storage";
|
|
5
6
|
export type { AccountSelectionStrategy } from "./config/schema";
|
|
6
7
|
export type RateLimitReason = "QUOTA_EXHAUSTED" | "RATE_LIMIT_EXCEEDED" | "MODEL_CAPACITY_EXHAUSTED" | "SERVER_ERROR" | "UNKNOWN";
|
|
@@ -8,7 +9,7 @@ export interface RateLimitBackoffResult {
|
|
|
8
9
|
backoffMs: number;
|
|
9
10
|
reason: RateLimitReason;
|
|
10
11
|
}
|
|
11
|
-
export declare function parseRateLimitReason(reason
|
|
12
|
+
export declare function parseRateLimitReason(reason: string | undefined, message: string | undefined, status?: number): RateLimitReason;
|
|
12
13
|
export declare function calculateBackoffMs(reason: RateLimitReason, consecutiveFailures: number, retryAfterMs?: number | null): number;
|
|
13
14
|
export type BaseQuotaKey = "claude" | "gemini-antigravity" | "gemini-cli";
|
|
14
15
|
export type QuotaKey = BaseQuotaKey | `${BaseQuotaKey}:${string}`;
|
|
@@ -26,6 +27,12 @@ export interface ManagedAccount {
|
|
|
26
27
|
cooldownReason?: CooldownReason;
|
|
27
28
|
touchedForQuota: Record<string, number>;
|
|
28
29
|
consecutiveFailures?: number;
|
|
30
|
+
/** Timestamp of last failure for TTL-based reset of consecutiveFailures */
|
|
31
|
+
lastFailureTime?: number;
|
|
32
|
+
/** Per-account device fingerprint for rate limit mitigation */
|
|
33
|
+
fingerprint?: import("./fingerprint").Fingerprint;
|
|
34
|
+
/** History of previous fingerprints for this account */
|
|
35
|
+
fingerprintHistory?: FingerprintVersion[];
|
|
29
36
|
}
|
|
30
37
|
/**
|
|
31
38
|
* In-memory multi-account manager with sticky account selection.
|
|
@@ -52,12 +59,22 @@ export declare class AccountManager {
|
|
|
52
59
|
getAccountsSnapshot(): ManagedAccount[];
|
|
53
60
|
getCurrentAccountForFamily(family: ModelFamily): ManagedAccount | null;
|
|
54
61
|
markSwitched(account: ManagedAccount, reason: "rate-limit" | "initial" | "rotation", family: ModelFamily): void;
|
|
62
|
+
/**
|
|
63
|
+
* Check if we should show an account switch toast.
|
|
64
|
+
* Debounces repeated toasts for the same account.
|
|
65
|
+
*/
|
|
55
66
|
shouldShowAccountToast(accountIndex: number, debounceMs?: number): boolean;
|
|
56
67
|
markToastShown(accountIndex: number): void;
|
|
57
68
|
getCurrentOrNextForFamily(family: ModelFamily, model?: string | null, strategy?: AccountSelectionStrategy, headerStyle?: HeaderStyle, pidOffsetEnabled?: boolean): ManagedAccount | null;
|
|
58
69
|
getNextForFamily(family: ModelFamily, model?: string | null, headerStyle?: HeaderStyle): ManagedAccount | null;
|
|
59
70
|
markRateLimited(account: ManagedAccount, retryAfterMs: number, family: ModelFamily, headerStyle?: HeaderStyle, model?: string | null): void;
|
|
60
|
-
|
|
71
|
+
/**
|
|
72
|
+
* Mark an account as used after a successful API request.
|
|
73
|
+
* This updates the lastUsed timestamp for freshness calculations.
|
|
74
|
+
* Should be called AFTER request completion, not during account selection.
|
|
75
|
+
*/
|
|
76
|
+
markAccountUsed(accountIndex: number): void;
|
|
77
|
+
markRateLimitedWithReason(account: ManagedAccount, family: ModelFamily, headerStyle: HeaderStyle, model: string | null | undefined, reason: RateLimitReason, retryAfterMs?: number | null, failureTtlMs?: number): number;
|
|
61
78
|
markRequestSuccess(account: ManagedAccount): void;
|
|
62
79
|
clearAllRateLimitsForFamily(family: ModelFamily, model?: string | null): void;
|
|
63
80
|
shouldTryOptimisticReset(family: ModelFamily, model?: string | null): boolean;
|
|
@@ -73,11 +90,30 @@ export declare class AccountManager {
|
|
|
73
90
|
removeAccount(account: ManagedAccount): boolean;
|
|
74
91
|
updateFromAuth(account: ManagedAccount, auth: OAuthAuthDetails): void;
|
|
75
92
|
toAuthDetails(account: ManagedAccount): OAuthAuthDetails;
|
|
76
|
-
getMinWaitTimeForFamily(family: ModelFamily, model?: string | null): number;
|
|
93
|
+
getMinWaitTimeForFamily(family: ModelFamily, model?: string | null, headerStyle?: HeaderStyle, strict?: boolean): number;
|
|
77
94
|
getAccounts(): ManagedAccount[];
|
|
78
95
|
saveToDisk(): Promise<void>;
|
|
79
96
|
requestSaveToDisk(): void;
|
|
80
97
|
flushSaveToDisk(): Promise<void>;
|
|
81
98
|
private executeSave;
|
|
99
|
+
/**
|
|
100
|
+
* Regenerate fingerprint for an account, saving the old one to history.
|
|
101
|
+
* @param accountIndex - Index of the account to regenerate fingerprint for
|
|
102
|
+
* @returns The new fingerprint, or null if account not found
|
|
103
|
+
*/
|
|
104
|
+
regenerateAccountFingerprint(accountIndex: number): Fingerprint | null;
|
|
105
|
+
/**
|
|
106
|
+
* Restore a fingerprint from history for an account.
|
|
107
|
+
* @param accountIndex - Index of the account
|
|
108
|
+
* @param historyIndex - Index in the fingerprint history to restore from (0 = most recent)
|
|
109
|
+
* @returns The restored fingerprint, or null if account/history not found
|
|
110
|
+
*/
|
|
111
|
+
restoreAccountFingerprint(accountIndex: number, historyIndex: number): Fingerprint | null;
|
|
112
|
+
/**
|
|
113
|
+
* Get fingerprint history for an account.
|
|
114
|
+
* @param accountIndex - Index of the account
|
|
115
|
+
* @returns Array of fingerprint versions, or empty array if not found
|
|
116
|
+
*/
|
|
117
|
+
getAccountFingerprintHistory(accountIndex: number): FingerprintVersion[];
|
|
82
118
|
}
|
|
83
119
|
//# sourceMappingURL=accounts.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"accounts.d.ts","sourceRoot":"","sources":["../../../src/plugin/accounts.ts"],"names":[],"mappings":"AACA,OAAO,EAA8B,KAAK,gBAAgB,EAAE,KAAK,gBAAgB,EAAE,KAAK,WAAW,EAAE,KAAK,WAAW,EAAE,KAAK,cAAc,EAAE,MAAM,WAAW,CAA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