opencode-antigravity-auth-mf 1.4.1-8 → 1.6.0-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 +97 -35
- package/dist/src/antigravity/oauth.d.ts.map +1 -1
- package/dist/src/antigravity/oauth.js +10 -7
- package/dist/src/antigravity/oauth.js.map +1 -1
- package/dist/src/constants.d.ts +42 -2
- package/dist/src/constants.d.ts.map +1 -1
- package/dist/src/constants.js +87 -2
- package/dist/src/constants.js.map +1 -1
- package/dist/src/hooks/auto-update-checker/checker.d.ts.map +1 -1
- package/dist/src/hooks/auto-update-checker/checker.js +11 -14
- package/dist/src/hooks/auto-update-checker/checker.js.map +1 -1
- package/dist/src/hooks/auto-update-checker/index.d.ts.map +1 -1
- package/dist/src/hooks/auto-update-checker/index.js +14 -17
- package/dist/src/hooks/auto-update-checker/index.js.map +1 -1
- package/dist/src/hooks/auto-update-checker/logging.d.ts +3 -0
- package/dist/src/hooks/auto-update-checker/logging.d.ts.map +1 -0
- package/dist/src/hooks/auto-update-checker/logging.js +9 -0
- package/dist/src/hooks/auto-update-checker/logging.js.map +1 -0
- package/dist/src/plugin/accounts.d.ts +97 -22
- package/dist/src/plugin/accounts.d.ts.map +1 -1
- package/dist/src/plugin/accounts.js +461 -116
- package/dist/src/plugin/accounts.js.map +1 -1
- package/dist/src/plugin/cache/signature-cache.d.ts.map +1 -1
- package/dist/src/plugin/cache/signature-cache.js +4 -0
- package/dist/src/plugin/cache/signature-cache.js.map +1 -1
- package/dist/src/plugin/cli.d.ts +19 -12
- package/dist/src/plugin/cli.d.ts.map +1 -1
- package/dist/src/plugin/cli.js +75 -15
- package/dist/src/plugin/cli.js.map +1 -1
- package/dist/src/plugin/config/loader.d.ts +1 -2
- package/dist/src/plugin/config/loader.d.ts.map +1 -1
- package/dist/src/plugin/config/loader.js +10 -92
- package/dist/src/plugin/config/loader.js.map +1 -1
- package/dist/src/plugin/config/models.d.ts +27 -0
- package/dist/src/plugin/config/models.d.ts.map +1 -0
- package/dist/src/plugin/config/models.js +80 -0
- package/dist/src/plugin/config/models.js.map +1 -0
- package/dist/src/plugin/config/schema.d.ts +47 -17
- package/dist/src/plugin/config/schema.d.ts.map +1 -1
- package/dist/src/plugin/config/schema.js +152 -84
- package/dist/src/plugin/config/schema.js.map +1 -1
- package/dist/src/plugin/config/updater.d.ts +55 -0
- package/dist/src/plugin/config/updater.d.ts.map +1 -0
- package/dist/src/plugin/config/updater.js +125 -0
- package/dist/src/plugin/config/updater.js.map +1 -0
- package/dist/src/plugin/core/streaming/transformer.d.ts +2 -3
- package/dist/src/plugin/core/streaming/transformer.d.ts.map +1 -1
- package/dist/src/plugin/core/streaming/transformer.js +39 -42
- package/dist/src/plugin/core/streaming/transformer.js.map +1 -1
- package/dist/src/plugin/core/streaming/types.d.ts +0 -14
- package/dist/src/plugin/core/streaming/types.d.ts.map +1 -1
- package/dist/src/plugin/debug.d.ts +27 -1
- package/dist/src/plugin/debug.d.ts.map +1 -1
- package/dist/src/plugin/debug.js +192 -131
- package/dist/src/plugin/debug.js.map +1 -1
- package/dist/src/plugin/fingerprint.d.ts +8 -8
- package/dist/src/plugin/fingerprint.d.ts.map +1 -1
- package/dist/src/plugin/fingerprint.js +29 -44
- package/dist/src/plugin/fingerprint.js.map +1 -1
- package/dist/src/plugin/lease-manager.d.ts.map +1 -1
- package/dist/src/plugin/lease-manager.js +11 -1
- package/dist/src/plugin/lease-manager.js.map +1 -1
- package/dist/src/plugin/logger.d.ts +5 -23
- package/dist/src/plugin/logger.d.ts.map +1 -1
- package/dist/src/plugin/logger.js +23 -72
- package/dist/src/plugin/logger.js.map +1 -1
- package/dist/src/plugin/logging-utils.d.ts +23 -0
- package/dist/src/plugin/logging-utils.d.ts.map +1 -0
- package/dist/src/plugin/logging-utils.js +92 -0
- package/dist/src/plugin/logging-utils.js.map +1 -0
- package/dist/src/plugin/project.js +5 -5
- package/dist/src/plugin/project.js.map +1 -1
- package/dist/src/plugin/quota.d.ts +10 -0
- package/dist/src/plugin/quota.d.ts.map +1 -1
- package/dist/src/plugin/quota.js +90 -9
- package/dist/src/plugin/quota.js.map +1 -1
- package/dist/src/plugin/recovery.d.ts.map +1 -1
- package/dist/src/plugin/recovery.js +6 -1
- package/dist/src/plugin/recovery.js.map +1 -1
- package/dist/src/plugin/refresh-queue.d.ts +1 -5
- package/dist/src/plugin/refresh-queue.d.ts.map +1 -1
- package/dist/src/plugin/refresh-queue.js +5 -9
- package/dist/src/plugin/refresh-queue.js.map +1 -1
- package/dist/src/plugin/request-helpers.d.ts +5 -1
- package/dist/src/plugin/request-helpers.d.ts.map +1 -1
- package/dist/src/plugin/request-helpers.js +126 -51
- package/dist/src/plugin/request-helpers.js.map +1 -1
- package/dist/src/plugin/request.d.ts +7 -6
- package/dist/src/plugin/request.d.ts.map +1 -1
- package/dist/src/plugin/request.js +256 -106
- 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.map +1 -1
- package/dist/src/plugin/search.js +4 -6
- package/dist/src/plugin/search.js.map +1 -1
- package/dist/src/plugin/storage.d.ts +47 -5
- package/dist/src/plugin/storage.d.ts.map +1 -1
- package/dist/src/plugin/storage.js +190 -15
- package/dist/src/plugin/storage.js.map +1 -1
- package/dist/src/plugin/token.d.ts +2 -1
- package/dist/src/plugin/token.d.ts.map +1 -1
- package/dist/src/plugin/token.js +74 -72
- package/dist/src/plugin/token.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/index.d.ts +1 -1
- package/dist/src/plugin/transform/index.d.ts.map +1 -1
- package/dist/src/plugin/transform/index.js +1 -1
- package/dist/src/plugin/transform/index.js.map +1 -1
- package/dist/src/plugin/transform/model-resolver.d.ts +14 -16
- package/dist/src/plugin/transform/model-resolver.d.ts.map +1 -1
- package/dist/src/plugin/transform/model-resolver.js +43 -59
- package/dist/src/plugin/transform/model-resolver.js.map +1 -1
- package/dist/src/plugin/transform/types.d.ts +6 -1
- 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/auth-menu.d.ts +7 -3
- package/dist/src/plugin/ui/auth-menu.d.ts.map +1 -1
- package/dist/src/plugin/ui/auth-menu.js +28 -15
- package/dist/src/plugin/ui/auth-menu.js.map +1 -1
- package/dist/src/plugin/ui/select.d.ts +9 -0
- package/dist/src/plugin/ui/select.d.ts.map +1 -1
- package/dist/src/plugin/ui/select.js +104 -24
- package/dist/src/plugin/ui/select.js.map +1 -1
- package/dist/src/plugin/version.d.ts +19 -0
- package/dist/src/plugin/version.d.ts.map +1 -0
- package/dist/src/plugin/version.js +80 -0
- package/dist/src/plugin/version.js.map +1 -0
- package/dist/src/plugin.d.ts +22 -0
- package/dist/src/plugin.d.ts.map +1 -1
- package/dist/src/plugin.js +1309 -399
- package/dist/src/plugin.js.map +1 -1
- package/package.json +7 -7
package/README.md
CHANGED
|
@@ -6,11 +6,11 @@
|
|
|
6
6
|
[](LICENSE)
|
|
7
7
|
[](https://x.com/dopesalmon)
|
|
8
8
|
|
|
9
|
-
Enable Opencode to authenticate against **Antigravity** (Google's IDE) via OAuth so you can use Antigravity rate limits and access models like `gemini-3-pro` and `claude-opus-4-
|
|
9
|
+
Enable Opencode to authenticate against **Antigravity** (Google's IDE) via OAuth so you can use Antigravity rate limits and access models like `gemini-3-pro` and `claude-opus-4-6-thinking` with your Google credentials.
|
|
10
10
|
|
|
11
11
|
## What You Get
|
|
12
12
|
|
|
13
|
-
- **Claude Opus 4.
|
|
13
|
+
- **Claude Opus 4.6, Sonnet 4.6** and **Gemini 3 Pro/Flash** via Google OAuth
|
|
14
14
|
- **Multi-account support** — add multiple Google accounts, auto-rotates when rate-limited
|
|
15
15
|
- **Dual quota system** — access both Antigravity and Gemini CLI quotas from one plugin
|
|
16
16
|
- **Thinking models** — extended thinking for Claude and Gemini 3 with configurable budgets
|
|
@@ -72,12 +72,14 @@ Install the opencode-antigravity-auth plugin and add the Antigravity model defin
|
|
|
72
72
|
opencode auth login
|
|
73
73
|
```
|
|
74
74
|
|
|
75
|
-
3. **Add models** —
|
|
75
|
+
3. **Add models** — choose one:
|
|
76
|
+
- Run `opencode auth login` → select **"Configure models in opencode.json"** (auto-configures all models)
|
|
77
|
+
- Or manually copy the [full configuration](#models) below
|
|
76
78
|
|
|
77
79
|
4. **Use it:**
|
|
78
80
|
|
|
79
81
|
```bash
|
|
80
|
-
opencode run "Hello" --model=google/antigravity-claude-
|
|
82
|
+
opencode run "Hello" --model=google/antigravity-claude-opus-4-6-thinking --variant=max
|
|
81
83
|
```
|
|
82
84
|
|
|
83
85
|
</details>
|
|
@@ -100,7 +102,7 @@ Install the opencode-antigravity-auth plugin and add the Antigravity model defin
|
|
|
100
102
|
### Verification
|
|
101
103
|
|
|
102
104
|
```bash
|
|
103
|
-
opencode run "Hello" --model=google/antigravity-claude-
|
|
105
|
+
opencode run "Hello" --model=google/antigravity-claude-opus-4-6-thinking --variant=max
|
|
104
106
|
```
|
|
105
107
|
|
|
106
108
|
</details>
|
|
@@ -111,18 +113,17 @@ opencode run "Hello" --model=google/antigravity-claude-sonnet-4-5-thinking --var
|
|
|
111
113
|
|
|
112
114
|
### Model Reference
|
|
113
115
|
|
|
114
|
-
**Antigravity quota** (Claude
|
|
116
|
+
**Antigravity quota** (default routing for Claude and Gemini):
|
|
115
117
|
|
|
116
118
|
| Model | Variants | Notes |
|
|
117
119
|
|-------|----------|-------|
|
|
118
120
|
| `antigravity-gemini-3-pro` | low, high | Gemini 3 Pro with thinking |
|
|
121
|
+
| `antigravity-gemini-3.1-pro` | low, high | Gemini 3.1 Pro with thinking (rollout-dependent) |
|
|
119
122
|
| `antigravity-gemini-3-flash` | minimal, low, medium, high | Gemini 3 Flash with thinking |
|
|
120
|
-
| `antigravity-claude-sonnet-4-
|
|
121
|
-
| `antigravity-claude-sonnet-4-5-thinking` | low, max | Claude Sonnet with extended thinking |
|
|
122
|
-
| `antigravity-claude-opus-4-5-thinking` | low, max | Claude Opus 4.5 with extended thinking |
|
|
123
|
+
| `antigravity-claude-sonnet-4-6` | — | Claude Sonnet 4.6 |
|
|
123
124
|
| `antigravity-claude-opus-4-6-thinking` | low, max | Claude Opus 4.6 with extended thinking |
|
|
124
125
|
|
|
125
|
-
**Gemini CLI quota** (separate from Antigravity):
|
|
126
|
+
**Gemini CLI quota** (separate from Antigravity; used when `cli_first` is true or as fallback):
|
|
126
127
|
|
|
127
128
|
| Model | Notes |
|
|
128
129
|
|-------|-------|
|
|
@@ -130,10 +131,19 @@ opencode run "Hello" --model=google/antigravity-claude-sonnet-4-5-thinking --var
|
|
|
130
131
|
| `gemini-2.5-pro` | Gemini 2.5 Pro |
|
|
131
132
|
| `gemini-3-flash-preview` | Gemini 3 Flash (preview) |
|
|
132
133
|
| `gemini-3-pro-preview` | Gemini 3 Pro (preview) |
|
|
134
|
+
| `gemini-3.1-pro-preview` | Gemini 3.1 Pro (preview, rollout-dependent) |
|
|
135
|
+
| `gemini-3.1-pro-preview-customtools` | Gemini 3.1 Pro Preview Custom Tools (preview, rollout-dependent) |
|
|
136
|
+
|
|
137
|
+
> **Routing Behavior:**
|
|
138
|
+
> - **Antigravity-first (default):** Gemini models use Antigravity quota across accounts.
|
|
139
|
+
> - **CLI-first (`cli_first: true`):** Gemini models use Gemini CLI quota first.
|
|
140
|
+
> - When a Gemini quota pool is exhausted, the plugin automatically falls back to the other pool.
|
|
141
|
+
> - Claude and image models always use Antigravity.
|
|
142
|
+
> Model names are automatically transformed for the target API (e.g., `antigravity-gemini-3-flash` → `gemini-3-flash-preview` for CLI).
|
|
133
143
|
|
|
134
144
|
**Using variants:**
|
|
135
145
|
```bash
|
|
136
|
-
opencode run "Hello" --model=google/antigravity-claude-
|
|
146
|
+
opencode run "Hello" --model=google/antigravity-claude-opus-4-6-thinking --variant=max
|
|
137
147
|
```
|
|
138
148
|
|
|
139
149
|
For details on variant configuration and thinking levels, see [docs/MODEL-VARIANTS.md](docs/MODEL-VARIANTS.md).
|
|
@@ -159,6 +169,15 @@ Add this to your `~/.config/opencode/opencode.json`:
|
|
|
159
169
|
"high": { "thinkingLevel": "high" }
|
|
160
170
|
}
|
|
161
171
|
},
|
|
172
|
+
"antigravity-gemini-3.1-pro": {
|
|
173
|
+
"name": "Gemini 3.1 Pro (Antigravity)",
|
|
174
|
+
"limit": { "context": 1048576, "output": 65535 },
|
|
175
|
+
"modalities": { "input": ["text", "image", "pdf"], "output": ["text"] },
|
|
176
|
+
"variants": {
|
|
177
|
+
"low": { "thinkingLevel": "low" },
|
|
178
|
+
"high": { "thinkingLevel": "high" }
|
|
179
|
+
}
|
|
180
|
+
},
|
|
162
181
|
"antigravity-gemini-3-flash": {
|
|
163
182
|
"name": "Gemini 3 Flash (Antigravity)",
|
|
164
183
|
"limit": { "context": 1048576, "output": 65536 },
|
|
@@ -170,29 +189,11 @@ Add this to your `~/.config/opencode/opencode.json`:
|
|
|
170
189
|
"high": { "thinkingLevel": "high" }
|
|
171
190
|
}
|
|
172
191
|
},
|
|
173
|
-
"antigravity-claude-sonnet-4-
|
|
174
|
-
"name": "Claude Sonnet 4.
|
|
192
|
+
"antigravity-claude-sonnet-4-6": {
|
|
193
|
+
"name": "Claude Sonnet 4.6 (Antigravity)",
|
|
175
194
|
"limit": { "context": 200000, "output": 64000 },
|
|
176
195
|
"modalities": { "input": ["text", "image", "pdf"], "output": ["text"] }
|
|
177
196
|
},
|
|
178
|
-
"antigravity-claude-sonnet-4-5-thinking": {
|
|
179
|
-
"name": "Claude Sonnet 4.5 Thinking (Antigravity)",
|
|
180
|
-
"limit": { "context": 200000, "output": 64000 },
|
|
181
|
-
"modalities": { "input": ["text", "image", "pdf"], "output": ["text"] },
|
|
182
|
-
"variants": {
|
|
183
|
-
"low": { "thinkingConfig": { "thinkingBudget": 8192 } },
|
|
184
|
-
"max": { "thinkingConfig": { "thinkingBudget": 32768 } }
|
|
185
|
-
}
|
|
186
|
-
},
|
|
187
|
-
"antigravity-claude-opus-4-5-thinking": {
|
|
188
|
-
"name": "Claude Opus 4.5 Thinking (Antigravity)",
|
|
189
|
-
"limit": { "context": 200000, "output": 64000 },
|
|
190
|
-
"modalities": { "input": ["text", "image", "pdf"], "output": ["text"] },
|
|
191
|
-
"variants": {
|
|
192
|
-
"low": { "thinkingConfig": { "thinkingBudget": 8192 } },
|
|
193
|
-
"max": { "thinkingConfig": { "thinkingBudget": 32768 } }
|
|
194
|
-
}
|
|
195
|
-
},
|
|
196
197
|
"antigravity-claude-opus-4-6-thinking": {
|
|
197
198
|
"name": "Claude Opus 4.6 Thinking (Antigravity)",
|
|
198
199
|
"limit": { "context": 200000, "output": 64000 },
|
|
@@ -221,6 +222,16 @@ Add this to your `~/.config/opencode/opencode.json`:
|
|
|
221
222
|
"name": "Gemini 3 Pro Preview (Gemini CLI)",
|
|
222
223
|
"limit": { "context": 1048576, "output": 65535 },
|
|
223
224
|
"modalities": { "input": ["text", "image", "pdf"], "output": ["text"] }
|
|
225
|
+
},
|
|
226
|
+
"gemini-3.1-pro-preview": {
|
|
227
|
+
"name": "Gemini 3.1 Pro Preview (Gemini CLI)",
|
|
228
|
+
"limit": { "context": 1048576, "output": 65535 },
|
|
229
|
+
"modalities": { "input": ["text", "image", "pdf"], "output": ["text"] }
|
|
230
|
+
},
|
|
231
|
+
"gemini-3.1-pro-preview-customtools": {
|
|
232
|
+
"name": "Gemini 3.1 Pro Preview Custom Tools (Gemini CLI)",
|
|
233
|
+
"limit": { "context": 1048576, "output": 65535 },
|
|
234
|
+
"modalities": { "input": ["text", "image", "pdf"], "output": ["text"] }
|
|
224
235
|
}
|
|
225
236
|
}
|
|
226
237
|
}
|
|
@@ -228,6 +239,8 @@ Add this to your `~/.config/opencode/opencode.json`:
|
|
|
228
239
|
}
|
|
229
240
|
```
|
|
230
241
|
|
|
242
|
+
> **Backward Compatibility:** Legacy model names with `antigravity-` prefix (e.g., `antigravity-gemini-3-flash`) still work. The plugin automatically handles model name transformation for both Antigravity and Gemini CLI APIs.
|
|
243
|
+
|
|
231
244
|
</details>
|
|
232
245
|
|
|
233
246
|
---
|
|
@@ -240,6 +253,11 @@ Add multiple Google accounts for higher combined quotas. The plugin automaticall
|
|
|
240
253
|
opencode auth login # Run again to add more accounts
|
|
241
254
|
```
|
|
242
255
|
|
|
256
|
+
**Account management options (via `opencode auth login`):**
|
|
257
|
+
- **Configure models** — Auto-configure all plugin models in opencode.json
|
|
258
|
+
- **Check quotas** — View remaining API quota for each account
|
|
259
|
+
- **Manage accounts** — Enable/disable specific accounts for rotation
|
|
260
|
+
|
|
243
261
|
For details on load balancing, dual quota pools, and account storage, see [docs/MULTI-ACCOUNT.md](docs/MULTI-ACCOUNT.md).
|
|
244
262
|
|
|
245
263
|
---
|
|
@@ -261,6 +279,10 @@ OpenCode uses `~/.config/opencode/` on **all platforms** including Windows.
|
|
|
261
279
|
|
|
262
280
|
> **Windows users**: `~` resolves to your user home directory (e.g., `C:\Users\YourName`). Do NOT use `%APPDATA%`.
|
|
263
281
|
|
|
282
|
+
> **Custom path**: Set `OPENCODE_CONFIG_DIR` environment variable to use a custom location.
|
|
283
|
+
|
|
284
|
+
> **Windows migration**: If upgrading from plugin v1.3.x or earlier, the plugin will automatically find your existing config in `%APPDATA%\opencode\` and use it. New installations use `~/.config/opencode/`.
|
|
285
|
+
|
|
264
286
|
---
|
|
265
287
|
|
|
266
288
|
### Multi-Account Auth Issues
|
|
@@ -357,6 +379,18 @@ Invalid JSON payload received. Unknown name "parameters" at 'request.tools[0]'
|
|
|
357
379
|
|
|
358
380
|
Some MCP servers have schemas incompatible with Antigravity's strict JSON format.
|
|
359
381
|
|
|
382
|
+
**Common symptom:**
|
|
383
|
+
```bash
|
|
384
|
+
Invalid function name must start with a letter or underscore
|
|
385
|
+
```
|
|
386
|
+
|
|
387
|
+
Sometimes it shows up as:
|
|
388
|
+
```bash
|
|
389
|
+
GenerateContentRequest.tools[0].function_declarations[12].name: Invalid function name must start with a letter or underscore
|
|
390
|
+
```
|
|
391
|
+
|
|
392
|
+
This usually means an MCP tool name starts with a number (for example, a 1mcp key like `1mcp_*`). Rename the MCP key to start with a letter (e.g., `gw`) or disable that MCP entry for Antigravity models.
|
|
393
|
+
|
|
360
394
|
**Diagnosis:**
|
|
361
395
|
1. Disable all MCP servers in your config
|
|
362
396
|
2. Enable one-by-one until error reappears
|
|
@@ -564,7 +598,7 @@ Most users don't need to configure anything — defaults work well.
|
|
|
564
598
|
|--------|---------|--------------
|
|
565
599
|
| `keep_thinking` | `false` | Preserve Claude's thinking across turns. **Warning:** enabling may degrade model stability. |
|
|
566
600
|
| `session_recovery` | `true` | Auto-recover from tool errors |
|
|
567
|
-
| `
|
|
601
|
+
| `cli_first` | `false` | Route Gemini models to Gemini CLI first (Claude and image models stay on Antigravity). |
|
|
568
602
|
|
|
569
603
|
### Account Rotation
|
|
570
604
|
|
|
@@ -575,20 +609,48 @@ Most users don't need to configure anything — defaults work well.
|
|
|
575
609
|
| **5+ accounts** | `"account_selection_strategy": "round-robin"` |
|
|
576
610
|
| **Parallel agents** | Add `"pid_offset_enabled": true` |
|
|
577
611
|
|
|
612
|
+
### Quota Protection
|
|
613
|
+
|
|
614
|
+
| Option | Default | What it does |
|
|
615
|
+
|--------|---------|--------------|
|
|
616
|
+
| `soft_quota_threshold_percent` | `90` | Skip account when quota usage exceeds this percentage. Prevents Google from penalizing accounts that fully exhaust quota. Set to `100` to disable. |
|
|
617
|
+
| `quota_refresh_interval_minutes` | `15` | Background quota refresh interval. After successful API requests, refreshes quota cache if older than this interval. Set to `0` to disable. |
|
|
618
|
+
| `soft_quota_cache_ttl_minutes` | `"auto"` | How long quota cache is considered fresh. `"auto"` = max(2 × refresh interval, 10 minutes). Set a number (1-120) for fixed TTL. |
|
|
619
|
+
|
|
620
|
+
> **How it works**: Quota cache is refreshed automatically after API requests (when older than `quota_refresh_interval_minutes`) and manually via "Check quotas" in `opencode auth login`. The threshold check uses `soft_quota_cache_ttl_minutes` to determine cache freshness - if cache is older, the account is considered "unknown" and allowed (fail-open). When ALL accounts exceed the threshold, the plugin waits for the earliest quota reset time (like rate limit behavior). If wait time exceeds `max_rate_limit_wait_seconds`, it errors immediately.
|
|
621
|
+
|
|
622
|
+
### Rate Limit Scheduling
|
|
623
|
+
|
|
624
|
+
Control how the plugin handles rate limits:
|
|
625
|
+
|
|
626
|
+
| Option | Default | What it does |
|
|
627
|
+
|--------|---------|--------------|
|
|
628
|
+
| `scheduling_mode` | `"cache_first"` | `"cache_first"` = wait for same account (preserves prompt cache), `"balance"` = switch immediately, `"performance_first"` = round-robin |
|
|
629
|
+
| `max_cache_first_wait_seconds` | `60` | Max seconds to wait in cache_first mode before switching accounts |
|
|
630
|
+
| `failure_ttl_seconds` | `3600` | Reset failure count after this many seconds (prevents old failures from permanently penalizing accounts) |
|
|
631
|
+
|
|
632
|
+
**When to use each mode:**
|
|
633
|
+
- **cache_first** (default): Best for long conversations. Waits for the same account to recover, preserving your prompt cache.
|
|
634
|
+
- **balance**: Best for quick tasks. Switches accounts immediately when rate-limited for maximum availability.
|
|
635
|
+
- **performance_first**: Best for many short requests. Distributes load evenly across all accounts.
|
|
636
|
+
|
|
578
637
|
### App Behavior
|
|
579
638
|
|
|
580
639
|
| Option | Default | What it does |
|
|
581
640
|
|--------|---------|--------------|
|
|
582
641
|
| `quiet_mode` | `false` | Hide toast notifications |
|
|
583
|
-
| `debug` | `false` | Enable debug logging |
|
|
642
|
+
| `debug` | `false` | Enable debug file logging (`~/.config/opencode/antigravity-logs/`) |
|
|
643
|
+
| `debug_tui` | `false` | Show debug logs in the TUI log panel (independent from `debug`) |
|
|
584
644
|
| `auto_update` | `true` | Auto-update plugin |
|
|
585
645
|
|
|
586
646
|
For all options, see [docs/CONFIGURATION.md](docs/CONFIGURATION.md).
|
|
587
647
|
|
|
588
648
|
**Environment variables:**
|
|
589
649
|
```bash
|
|
590
|
-
|
|
591
|
-
OPENCODE_ANTIGRAVITY_DEBUG=
|
|
650
|
+
OPENCODE_CONFIG_DIR=/path/to/config opencode # Custom config directory
|
|
651
|
+
OPENCODE_ANTIGRAVITY_DEBUG=1 opencode # Enable debug file logging
|
|
652
|
+
OPENCODE_ANTIGRAVITY_DEBUG=2 opencode # Verbose debug file logging
|
|
653
|
+
OPENCODE_ANTIGRAVITY_DEBUG_TUI=1 opencode # Enable TUI log panel debug output
|
|
592
654
|
```
|
|
593
655
|
|
|
594
656
|
---
|
|
@@ -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;AAoFD;;GAEG;AACH,wBAAsB,mBAAmB,CACvC,IAAI,EAAE,MAAM,EACZ,KAAK,EAAE,MAAM,GACZ,OAAO,CAAC,8BAA8B,CAAC,CAsEzC"}
|
|
@@ -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,
|
|
2
|
+
import { ANTIGRAVITY_CLIENT_ID, ANTIGRAVITY_CLIENT_SECRET, ANTIGRAVITY_REDIRECT_URI, ANTIGRAVITY_SCOPES, ANTIGRAVITY_ENDPOINT_FALLBACKS, ANTIGRAVITY_LOAD_ENDPOINTS, getAntigravityHeaders, 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,9 +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
|
-
"
|
|
67
|
-
"Client-Metadata": ANTIGRAVITY_HEADERS["Client-Metadata"],
|
|
65
|
+
"User-Agent": GEMINI_CLI_HEADERS["User-Agent"],
|
|
66
|
+
"Client-Metadata": getAntigravityHeaders()["Client-Metadata"],
|
|
68
67
|
};
|
|
69
68
|
const loadEndpoints = Array.from(new Set([...ANTIGRAVITY_LOAD_ENDPOINTS, ...ANTIGRAVITY_ENDPOINT_FALLBACKS]));
|
|
70
69
|
for (const baseEndpoint of loadEndpoints) {
|
|
@@ -75,8 +74,8 @@ async function fetchProjectID(accessToken) {
|
|
|
75
74
|
headers: loadHeaders,
|
|
76
75
|
body: JSON.stringify({
|
|
77
76
|
metadata: {
|
|
78
|
-
ideType: "
|
|
79
|
-
platform: "
|
|
77
|
+
ideType: "ANTIGRAVITY",
|
|
78
|
+
platform: process.platform === "win32" ? "WINDOWS" : "MACOS",
|
|
80
79
|
pluginType: "GEMINI",
|
|
81
80
|
},
|
|
82
81
|
}),
|
|
@@ -116,7 +115,10 @@ export async function exchangeAntigravity(code, state) {
|
|
|
116
115
|
const tokenResponse = await fetch("https://oauth2.googleapis.com/token", {
|
|
117
116
|
method: "POST",
|
|
118
117
|
headers: {
|
|
119
|
-
"Content-Type": "application/x-www-form-urlencoded",
|
|
118
|
+
"Content-Type": "application/x-www-form-urlencoded;charset=UTF-8",
|
|
119
|
+
"Accept": "*/*",
|
|
120
|
+
"Accept-Encoding": "gzip, deflate, br",
|
|
121
|
+
"User-Agent": GEMINI_CLI_HEADERS["User-Agent"],
|
|
120
122
|
},
|
|
121
123
|
body: new URLSearchParams({
|
|
122
124
|
client_id: ANTIGRAVITY_CLIENT_ID,
|
|
@@ -135,6 +137,7 @@ export async function exchangeAntigravity(code, state) {
|
|
|
135
137
|
const userInfoResponse = await fetch("https://www.googleapis.com/oauth2/v1/userinfo?alt=json", {
|
|
136
138
|
headers: {
|
|
137
139
|
Authorization: `Bearer ${tokenPayload.access_token}`,
|
|
140
|
+
"User-Agent": GEMINI_CLI_HEADERS["User-Agent"],
|
|
138
141
|
},
|
|
139
142
|
});
|
|
140
143
|
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,EAC9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constants.d.ts
CHANGED
|
@@ -46,16 +46,35 @@ export declare const GEMINI_CLI_ENDPOINT = "https://cloudcode-pa.googleapis.com"
|
|
|
46
46
|
* Hardcoded project id used when Antigravity does not return one (e.g., business/workspace accounts).
|
|
47
47
|
*/
|
|
48
48
|
export declare const ANTIGRAVITY_DEFAULT_PROJECT_ID = "rising-fact-p41fc";
|
|
49
|
+
export declare const ANTIGRAVITY_VERSION_FALLBACK = "1.18.3";
|
|
50
|
+
export declare function getAntigravityVersion(): string;
|
|
51
|
+
/**
|
|
52
|
+
* Set the runtime Antigravity version. Can only be called once (at startup).
|
|
53
|
+
* Subsequent calls are silently ignored to prevent accidental mutation.
|
|
54
|
+
*/
|
|
55
|
+
export declare function setAntigravityVersion(version: string): void;
|
|
56
|
+
/** @deprecated Use getAntigravityVersion() for runtime access. */
|
|
57
|
+
export declare const ANTIGRAVITY_VERSION = "1.18.3";
|
|
58
|
+
export declare function getAntigravityHeaders(): HeaderSet & {
|
|
59
|
+
"Client-Metadata": string;
|
|
60
|
+
};
|
|
61
|
+
/** @deprecated Use getAntigravityHeaders() for runtime access. */
|
|
49
62
|
export declare const ANTIGRAVITY_HEADERS: {
|
|
50
|
-
readonly "User-Agent": "
|
|
63
|
+
readonly "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Antigravity/1.18.3 Chrome/138.0.7204.235 Electron/37.3.1 Safari/537.36";
|
|
51
64
|
readonly "X-Goog-Api-Client": "google-cloud-sdk vscode_cloudshelleditor/0.1";
|
|
52
|
-
readonly "Client-Metadata": "{\"ideType\":\"
|
|
65
|
+
readonly "Client-Metadata": "{\"ideType\":\"ANTIGRAVITY\",\"platform\":\"WINDOWS\",\"pluginType\":\"GEMINI\"}" | "{\"ideType\":\"ANTIGRAVITY\",\"platform\":\"MACOS\",\"pluginType\":\"GEMINI\"}";
|
|
53
66
|
};
|
|
54
67
|
export declare const GEMINI_CLI_HEADERS: {
|
|
55
68
|
readonly "User-Agent": "google-api-nodejs-client/9.15.1";
|
|
56
69
|
readonly "X-Goog-Api-Client": "gl-node/22.17.0";
|
|
57
70
|
readonly "Client-Metadata": "ideType=IDE_UNSPECIFIED,platform=PLATFORM_UNSPECIFIED,pluginType=GEMINI";
|
|
58
71
|
};
|
|
72
|
+
export type HeaderSet = {
|
|
73
|
+
"User-Agent": string;
|
|
74
|
+
"X-Goog-Api-Client"?: string;
|
|
75
|
+
"Client-Metadata"?: string;
|
|
76
|
+
};
|
|
77
|
+
export declare function getRandomizedHeaders(style: HeaderStyle, model?: string): HeaderSet;
|
|
59
78
|
export type HeaderStyle = "antigravity" | "gemini-cli";
|
|
60
79
|
/**
|
|
61
80
|
* Provider identifier shared between the plugin loader and credential store.
|
|
@@ -95,5 +114,26 @@ export declare const SKIP_THOUGHT_SIGNATURE = "skip_thought_signature_validator"
|
|
|
95
114
|
* This is injected into requests to match CLIProxyAPI v6.6.89 behavior.
|
|
96
115
|
* The instruction provides identity and guidelines for the Antigravity agent.
|
|
97
116
|
*/
|
|
117
|
+
/**
|
|
118
|
+
* Model used for Google Search grounding requests.
|
|
119
|
+
* Uses gemini-2.5-flash for fast, cost-effective search operations. (3-flash is always at capacity and doesn't support souce citation).
|
|
120
|
+
*/
|
|
121
|
+
export declare const SEARCH_MODEL = "gemini-2.5-flash";
|
|
122
|
+
/**
|
|
123
|
+
* Thinking budget for deep search (more thorough analysis).
|
|
124
|
+
*/
|
|
125
|
+
export declare const SEARCH_THINKING_BUDGET_DEEP = 16384;
|
|
126
|
+
/**
|
|
127
|
+
* Thinking budget for fast search (quick results).
|
|
128
|
+
*/
|
|
129
|
+
export declare const SEARCH_THINKING_BUDGET_FAST = 4096;
|
|
130
|
+
/**
|
|
131
|
+
* Timeout for search requests in milliseconds (60 seconds).
|
|
132
|
+
*/
|
|
133
|
+
export declare const SEARCH_TIMEOUT_MS = 60000;
|
|
134
|
+
/**
|
|
135
|
+
* System instruction for the Google Search tool.
|
|
136
|
+
*/
|
|
137
|
+
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
138
|
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
139
|
//# 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,eA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mB;;;;CAItB,CAAC;AAEX,eAAO,MAAM,kBAAkB;;;;CAIrB,CAAC;AAcX,MAAM,MAAM,SAAS,GAAG;IACtB,YAAY,EAAE,MAAM,CAAC;IACrB,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAC7B,iBAAiB,CAAC,EAAE,MAAM,CAAC;CAC5B,CAAC;AAEF,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,WAAW,EAAE,KAAK,CAAC,EAAE,MAAM,GAAG,SAAS,CAelF;AAED,MAAM,MAAM,WAAW,GAAG,aAAa,GAAG,YAAY,CAAC;AAEvD;;GAEG;AACH,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,qBAAqB,CAAC;AAE/C;;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
|
@@ -60,16 +60,65 @@ export const GEMINI_CLI_ENDPOINT = ANTIGRAVITY_ENDPOINT_PROD;
|
|
|
60
60
|
* Hardcoded project id used when Antigravity does not return one (e.g., business/workspace accounts).
|
|
61
61
|
*/
|
|
62
62
|
export const ANTIGRAVITY_DEFAULT_PROJECT_ID = "rising-fact-p41fc";
|
|
63
|
+
export const ANTIGRAVITY_VERSION_FALLBACK = "1.18.3";
|
|
64
|
+
let antigravityVersion = ANTIGRAVITY_VERSION_FALLBACK;
|
|
65
|
+
let versionLocked = false;
|
|
66
|
+
export function getAntigravityVersion() { return antigravityVersion; }
|
|
67
|
+
/**
|
|
68
|
+
* Set the runtime Antigravity version. Can only be called once (at startup).
|
|
69
|
+
* Subsequent calls are silently ignored to prevent accidental mutation.
|
|
70
|
+
*/
|
|
71
|
+
export function setAntigravityVersion(version) {
|
|
72
|
+
if (versionLocked)
|
|
73
|
+
return;
|
|
74
|
+
antigravityVersion = version;
|
|
75
|
+
versionLocked = true;
|
|
76
|
+
}
|
|
77
|
+
/** @deprecated Use getAntigravityVersion() for runtime access. */
|
|
78
|
+
export const ANTIGRAVITY_VERSION = ANTIGRAVITY_VERSION_FALLBACK;
|
|
79
|
+
export function getAntigravityHeaders() {
|
|
80
|
+
return {
|
|
81
|
+
"User-Agent": `Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Antigravity/${getAntigravityVersion()} Chrome/138.0.7204.235 Electron/37.3.1 Safari/537.36`,
|
|
82
|
+
"X-Goog-Api-Client": "google-cloud-sdk vscode_cloudshelleditor/0.1",
|
|
83
|
+
"Client-Metadata": `{"ideType":"ANTIGRAVITY","platform":"${process.platform === "win32" ? "WINDOWS" : "MACOS"}","pluginType":"GEMINI"}`,
|
|
84
|
+
};
|
|
85
|
+
}
|
|
86
|
+
/** @deprecated Use getAntigravityHeaders() for runtime access. */
|
|
63
87
|
export const ANTIGRAVITY_HEADERS = {
|
|
64
|
-
"User-Agent":
|
|
88
|
+
"User-Agent": `Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Antigravity/${ANTIGRAVITY_VERSION} Chrome/138.0.7204.235 Electron/37.3.1 Safari/537.36`,
|
|
65
89
|
"X-Goog-Api-Client": "google-cloud-sdk vscode_cloudshelleditor/0.1",
|
|
66
|
-
"Client-Metadata":
|
|
90
|
+
"Client-Metadata": `{"ideType":"ANTIGRAVITY","platform":"${process.platform === "win32" ? "WINDOWS" : "MACOS"}","pluginType":"GEMINI"}`,
|
|
67
91
|
};
|
|
68
92
|
export const GEMINI_CLI_HEADERS = {
|
|
69
93
|
"User-Agent": "google-api-nodejs-client/9.15.1",
|
|
70
94
|
"X-Goog-Api-Client": "gl-node/22.17.0",
|
|
71
95
|
"Client-Metadata": "ideType=IDE_UNSPECIFIED,platform=PLATFORM_UNSPECIFIED,pluginType=GEMINI",
|
|
72
96
|
};
|
|
97
|
+
const ANTIGRAVITY_PLATFORMS = ["windows/amd64", "darwin/arm64", "darwin/amd64"];
|
|
98
|
+
const ANTIGRAVITY_API_CLIENTS = [
|
|
99
|
+
"google-cloud-sdk vscode_cloudshelleditor/0.1",
|
|
100
|
+
"google-cloud-sdk vscode/1.96.0",
|
|
101
|
+
"google-cloud-sdk vscode/1.95.0",
|
|
102
|
+
];
|
|
103
|
+
function randomFrom(arr) {
|
|
104
|
+
return arr[Math.floor(Math.random() * arr.length)];
|
|
105
|
+
}
|
|
106
|
+
export function getRandomizedHeaders(style, model) {
|
|
107
|
+
if (style === "gemini-cli") {
|
|
108
|
+
return {
|
|
109
|
+
"User-Agent": GEMINI_CLI_HEADERS["User-Agent"],
|
|
110
|
+
"X-Goog-Api-Client": GEMINI_CLI_HEADERS["X-Goog-Api-Client"],
|
|
111
|
+
"Client-Metadata": GEMINI_CLI_HEADERS["Client-Metadata"],
|
|
112
|
+
};
|
|
113
|
+
}
|
|
114
|
+
const platform = randomFrom(ANTIGRAVITY_PLATFORMS);
|
|
115
|
+
const metadataPlatform = platform.startsWith("windows") ? "WINDOWS" : "MACOS";
|
|
116
|
+
return {
|
|
117
|
+
"User-Agent": `antigravity/${getAntigravityVersion()} ${platform}`,
|
|
118
|
+
"X-Goog-Api-Client": randomFrom(ANTIGRAVITY_API_CLIENTS),
|
|
119
|
+
"Client-Metadata": `{"ideType":"ANTIGRAVITY","platform":"${metadataPlatform}","pluginType":"GEMINI"}`,
|
|
120
|
+
};
|
|
121
|
+
}
|
|
73
122
|
/**
|
|
74
123
|
* Provider identifier shared between the plugin loader and credential store.
|
|
75
124
|
*/
|
|
@@ -125,6 +174,42 @@ export const SKIP_THOUGHT_SIGNATURE = "skip_thought_signature_validator";
|
|
|
125
174
|
* This is injected into requests to match CLIProxyAPI v6.6.89 behavior.
|
|
126
175
|
* The instruction provides identity and guidelines for the Antigravity agent.
|
|
127
176
|
*/
|
|
177
|
+
// ============================================================================
|
|
178
|
+
// GOOGLE SEARCH TOOL CONSTANTS
|
|
179
|
+
// ============================================================================
|
|
180
|
+
/**
|
|
181
|
+
* Model used for Google Search grounding requests.
|
|
182
|
+
* Uses gemini-2.5-flash for fast, cost-effective search operations. (3-flash is always at capacity and doesn't support souce citation).
|
|
183
|
+
*/
|
|
184
|
+
export const SEARCH_MODEL = "gemini-2.5-flash";
|
|
185
|
+
/**
|
|
186
|
+
* Thinking budget for deep search (more thorough analysis).
|
|
187
|
+
*/
|
|
188
|
+
export const SEARCH_THINKING_BUDGET_DEEP = 16384;
|
|
189
|
+
/**
|
|
190
|
+
* Thinking budget for fast search (quick results).
|
|
191
|
+
*/
|
|
192
|
+
export const SEARCH_THINKING_BUDGET_FAST = 4096;
|
|
193
|
+
/**
|
|
194
|
+
* Timeout for search requests in milliseconds (60 seconds).
|
|
195
|
+
*/
|
|
196
|
+
export const SEARCH_TIMEOUT_MS = 60000;
|
|
197
|
+
/**
|
|
198
|
+
* System instruction for the Google Search tool.
|
|
199
|
+
*/
|
|
200
|
+
export const SEARCH_SYSTEM_INSTRUCTION = `You are an expert web search assistant with access to Google Search and URL analysis tools.
|
|
201
|
+
|
|
202
|
+
Your capabilities:
|
|
203
|
+
- Use google_search to find real-time information from the web
|
|
204
|
+
- Use url_context to fetch and analyze content from specific URLs when provided
|
|
205
|
+
|
|
206
|
+
Guidelines:
|
|
207
|
+
- Always provide accurate, well-sourced information
|
|
208
|
+
- Cite your sources when presenting facts
|
|
209
|
+
- If analyzing URLs, extract the most relevant information
|
|
210
|
+
- Be concise but comprehensive in your responses
|
|
211
|
+
- If information is uncertain or conflicting, acknowledge it
|
|
212
|
+
- Focus on answering the user's question directly`;
|
|
128
213
|
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
214
|
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
215
|
**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,MAAM,8BAA8B,GAAG;IAC5C,0BAA0B;IAC1B,6BAA6B;IAC7B,yBAAyB;CACjB,CAAC;AAEX;;;GAGG;AACH,MAAM,CAAC,MAAM,0BAA0B,GAAG;IACxC,yBAAyB;IACzB,0BAA0B;IAC1B,6BAA6B;CACrB,CAAC;AAEX;;GAEG;AACH,MAAM,CAAC,MAAM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+EAA+E;AAC/E,mEAAmE;AACnE,+EAA+E;AAE/E;;;;GAIG;AACH,+EAA+E;AAC/E,+BAA+B;AAC/B,+EAA+E;AAE/E;;;GAGG;AACH,MAAM,CAAC,MAAM,YAAY,GAAG,kBAAkB,CAAC;AAE/C;;GAEG;AACH,MAAM,CAAC,MAAM,2BAA2B,GAAG,KAAK,CAAC;AAEjD;;GAEG;AACH,MAAM,CAAC,MAAM,2BAA2B,GAAG,IAAI,CAAC;AAEhD;;GAEG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAG,KAAK,CAAC;AAEvC;;GAEG;AACH,MAAM,CAAC,MAAM,yBAAyB,GAAG;;;;;;;;;;;;kDAYS,CAAC;AAEnD,MAAM,CAAC,MAAM,8BAA8B,GAAG;;;;;;CAM7C,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"checker.d.ts","sourceRoot":"","sources":["../../../../src/hooks/auto-update-checker/checker.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAA4C,iBAAiB,EAAE,MAAM,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"checker.d.ts","sourceRoot":"","sources":["../../../../src/hooks/auto-update-checker/checker.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAA4C,iBAAiB,EAAE,MAAM,SAAS,CAAC;AAW3F,wBAAgB,cAAc,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAEzD;AAkBD,wBAAgB,eAAe,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAuBhE;AA4BD,wBAAgB,kBAAkB,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAanE;AAED,MAAM,WAAW,eAAe;IAC9B,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,OAAO,CAAC;IAClB,aAAa,EAAE,MAAM,GAAG,IAAI,CAAC;IAC7B,UAAU,EAAE,MAAM,CAAC;CACpB;AAED,wBAAgB,eAAe,CAAC,SAAS,EAAE,MAAM,GAAG,eAAe,GAAG,IAAI,CA2BzE;AAED,wBAAgB,gBAAgB,IAAI,MAAM,GAAG,IAAI,CAwBhD;AAED,wBAAgB,mBAAmB,CAAC,UAAU,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,GAAG,OAAO,CAgDrG;AAED,wBAAsB,gBAAgB,IAAI,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAmB/D;AAED,wBAAsB,cAAc,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,iBAAiB,CAAC,CA2BlF"}
|
|
@@ -2,10 +2,7 @@ import * as fs from "node:fs";
|
|
|
2
2
|
import * as path from "node:path";
|
|
3
3
|
import { fileURLToPath } from "node:url";
|
|
4
4
|
import { PACKAGE_NAME, NPM_REGISTRY_URL, NPM_FETCH_TIMEOUT, INSTALLED_PACKAGE_JSON, USER_OPENCODE_CONFIG, USER_OPENCODE_CONFIG_JSONC, } from "./constants";
|
|
5
|
-
import {
|
|
6
|
-
function debugLog(message) {
|
|
7
|
-
debugLogToFile(message);
|
|
8
|
-
}
|
|
5
|
+
import { logAutoUpdate } from "./logging";
|
|
9
6
|
export function isLocalDevMode(directory) {
|
|
10
7
|
return getLocalDevPath(directory) !== null;
|
|
11
8
|
}
|
|
@@ -143,7 +140,7 @@ export function getCachedVersion() {
|
|
|
143
140
|
}
|
|
144
141
|
}
|
|
145
142
|
catch (err) {
|
|
146
|
-
|
|
143
|
+
logAutoUpdate(`Failed to resolve version from current directory: ${err}`);
|
|
147
144
|
}
|
|
148
145
|
return null;
|
|
149
146
|
}
|
|
@@ -153,7 +150,7 @@ export function updatePinnedVersion(configPath, oldEntry, newVersion) {
|
|
|
153
150
|
const newEntry = `${PACKAGE_NAME}@${newVersion}`;
|
|
154
151
|
const pluginMatch = content.match(/"plugin"\s*:\s*\[/);
|
|
155
152
|
if (!pluginMatch || pluginMatch.index === undefined) {
|
|
156
|
-
|
|
153
|
+
logAutoUpdate(`No "plugin" array found in ${configPath}`);
|
|
157
154
|
return false;
|
|
158
155
|
}
|
|
159
156
|
const startIdx = pluginMatch.index + pluginMatch[0].length;
|
|
@@ -172,17 +169,17 @@ export function updatePinnedVersion(configPath, oldEntry, newVersion) {
|
|
|
172
169
|
const escapedOldEntry = oldEntry.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
173
170
|
const regex = new RegExp(`["']${escapedOldEntry}["']`);
|
|
174
171
|
if (!regex.test(pluginArrayContent)) {
|
|
175
|
-
|
|
172
|
+
logAutoUpdate(`Entry "${oldEntry}" not found in plugin array of ${configPath}`);
|
|
176
173
|
return false;
|
|
177
174
|
}
|
|
178
175
|
const updatedPluginArray = pluginArrayContent.replace(regex, `"${newEntry}"`);
|
|
179
176
|
const updatedContent = before + updatedPluginArray + after;
|
|
180
177
|
if (updatedContent === content) {
|
|
181
|
-
|
|
178
|
+
logAutoUpdate(`No changes made to ${configPath}`);
|
|
182
179
|
return false;
|
|
183
180
|
}
|
|
184
181
|
fs.writeFileSync(configPath, updatedContent, "utf-8");
|
|
185
|
-
|
|
182
|
+
logAutoUpdate(`Updated ${configPath}: ${oldEntry} → ${newEntry}`);
|
|
186
183
|
return true;
|
|
187
184
|
}
|
|
188
185
|
catch (err) {
|
|
@@ -212,26 +209,26 @@ export async function getLatestVersion() {
|
|
|
212
209
|
}
|
|
213
210
|
export async function checkForUpdate(directory) {
|
|
214
211
|
if (isLocalDevMode(directory)) {
|
|
215
|
-
|
|
212
|
+
logAutoUpdate("Local dev mode detected, skipping update check");
|
|
216
213
|
return { needsUpdate: false, currentVersion: null, latestVersion: null, isLocalDev: true, isPinned: false };
|
|
217
214
|
}
|
|
218
215
|
const pluginInfo = findPluginEntry(directory);
|
|
219
216
|
if (!pluginInfo) {
|
|
220
|
-
|
|
217
|
+
logAutoUpdate("Plugin not found in config");
|
|
221
218
|
return { needsUpdate: false, currentVersion: null, latestVersion: null, isLocalDev: false, isPinned: false };
|
|
222
219
|
}
|
|
223
220
|
const currentVersion = getCachedVersion() ?? pluginInfo.pinnedVersion;
|
|
224
221
|
if (!currentVersion) {
|
|
225
|
-
|
|
222
|
+
logAutoUpdate("No version found (cached or pinned)");
|
|
226
223
|
return { needsUpdate: false, currentVersion: null, latestVersion: null, isLocalDev: false, isPinned: pluginInfo.isPinned };
|
|
227
224
|
}
|
|
228
225
|
const latestVersion = await getLatestVersion();
|
|
229
226
|
if (!latestVersion) {
|
|
230
|
-
|
|
227
|
+
logAutoUpdate("Failed to fetch latest version");
|
|
231
228
|
return { needsUpdate: false, currentVersion, latestVersion: null, isLocalDev: false, isPinned: pluginInfo.isPinned };
|
|
232
229
|
}
|
|
233
230
|
const needsUpdate = currentVersion !== latestVersion;
|
|
234
|
-
|
|
231
|
+
logAutoUpdate(`Current: ${currentVersion}, Latest: ${latestVersion}, NeedsUpdate: ${needsUpdate}`);
|
|
235
232
|
return { needsUpdate, currentVersion, latestVersion, isLocalDev: false, isPinned: pluginInfo.isPinned };
|
|
236
233
|
}
|
|
237
234
|
//# sourceMappingURL=checker.js.map
|