opencode-antigravity-auth 1.2.0 → 1.2.2

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.
Files changed (48) hide show
  1. package/README.md +212 -98
  2. package/dist/src/constants.d.ts +6 -0
  3. package/dist/src/constants.d.ts.map +1 -1
  4. package/dist/src/constants.js +5 -0
  5. package/dist/src/constants.js.map +1 -1
  6. package/dist/src/hooks/auto-update-checker/cache.d.ts +3 -0
  7. package/dist/src/hooks/auto-update-checker/cache.d.ts.map +1 -0
  8. package/dist/src/hooks/auto-update-checker/cache.js +71 -0
  9. package/dist/src/hooks/auto-update-checker/cache.js.map +1 -0
  10. package/dist/src/hooks/auto-update-checker/checker.d.ts +16 -0
  11. package/dist/src/hooks/auto-update-checker/checker.d.ts.map +1 -0
  12. package/dist/src/hooks/auto-update-checker/checker.js +237 -0
  13. package/dist/src/hooks/auto-update-checker/checker.js.map +1 -0
  14. package/dist/src/hooks/auto-update-checker/constants.d.ts +9 -0
  15. package/dist/src/hooks/auto-update-checker/constants.d.ts.map +1 -0
  16. package/dist/src/hooks/auto-update-checker/constants.js +23 -0
  17. package/dist/src/hooks/auto-update-checker/constants.js.map +1 -0
  18. package/dist/src/hooks/auto-update-checker/index.d.ts +34 -0
  19. package/dist/src/hooks/auto-update-checker/index.d.ts.map +1 -0
  20. package/dist/src/hooks/auto-update-checker/index.js +121 -0
  21. package/dist/src/hooks/auto-update-checker/index.js.map +1 -0
  22. package/dist/src/hooks/auto-update-checker/types.d.ts +25 -0
  23. package/dist/src/hooks/auto-update-checker/types.d.ts.map +1 -0
  24. package/dist/src/hooks/auto-update-checker/types.js +1 -0
  25. package/dist/src/hooks/auto-update-checker/types.js.map +1 -0
  26. package/dist/src/plugin/accounts.d.ts +25 -11
  27. package/dist/src/plugin/accounts.d.ts.map +1 -1
  28. package/dist/src/plugin/accounts.js +161 -55
  29. package/dist/src/plugin/accounts.js.map +1 -1
  30. package/dist/src/plugin/debug.d.ts +32 -0
  31. package/dist/src/plugin/debug.d.ts.map +1 -1
  32. package/dist/src/plugin/debug.js +140 -12
  33. package/dist/src/plugin/debug.js.map +1 -1
  34. package/dist/src/plugin/request.d.ts +6 -2
  35. package/dist/src/plugin/request.d.ts.map +1 -1
  36. package/dist/src/plugin/request.js +361 -21
  37. package/dist/src/plugin/request.js.map +1 -1
  38. package/dist/src/plugin/storage.d.ts +52 -9
  39. package/dist/src/plugin/storage.d.ts.map +1 -1
  40. package/dist/src/plugin/storage.js +91 -10
  41. package/dist/src/plugin/storage.js.map +1 -1
  42. package/dist/src/plugin/types.d.ts +8 -0
  43. package/dist/src/plugin/types.d.ts.map +1 -1
  44. package/dist/src/plugin.d.ts +3 -3
  45. package/dist/src/plugin.d.ts.map +1 -1
  46. package/dist/src/plugin.js +865 -486
  47. package/dist/src/plugin.js.map +1 -1
  48. package/package.json +1 -1
package/README.md CHANGED
@@ -8,6 +8,7 @@ Enable Opencode to authenticate against **Antigravity** (Google's IDE) via OAuth
8
8
 
9
9
  - **Google OAuth sign-in** (multi-account via `opencode auth login`) with automatic token refresh
10
10
  - **Multi-account load balancing** Automatically cycle through multiple Google accounts to maximize rate limits
11
+ - **Dual Gemini quota pools** Gemini models automatically fallback to a second quota pool when the first is exhausted, effectively doubling your Gemini quota per account
11
12
  - **Real-time SSE streaming** including thinking blocks and incremental output
12
13
  - **Advanced Claude support** Interleaved thinking, stable multi-turn signatures, and validated tool calling
13
14
  - **Automatic endpoint fallback** between Antigravity API endpoints (daily → autopush → prod)
@@ -15,132 +16,227 @@ Enable Opencode to authenticate against **Antigravity** (Google's IDE) via OAuth
15
16
  - **Debug logging** for requests and responses
16
17
  - **Drop-in setup** Opencode auto-installs the plugin from config
17
18
 
18
- ## Quick start
19
+ ## Installation
19
20
 
20
- ### Step 1: Create your config file
21
+ ### For Humans
21
22
 
22
- If this is your first time using Opencode, create the config directory first:
23
+ **Option A: Let an LLM do it for you**
24
+
25
+ Paste this into any LLM agent (Claude Code, OpenCode, Cursor, etc.):
26
+
27
+ ```
28
+ Install the opencode-antigravity-auth plugin and add the Antigravity model definitions (see "Available models") to ~/.config/opencode/opencode.json by following: https://raw.githubusercontent.com/NoeFabris/opencode-antigravity-auth/main/README.md
29
+ ```
30
+
31
+ If the agent only installs the plugin, ask it to also add models under `provider.google.models`.
32
+
33
+ **Option B: Do it yourself**
34
+
35
+ 1. **Add the plugin to your config:**
36
+
37
+ ```bash
38
+ mkdir -p ~/.config/opencode
39
+ ```
40
+
41
+ Create or edit `~/.config/opencode/opencode.json`:
42
+
43
+ ```json
44
+ {
45
+ "plugin": ["opencode-antigravity-auth@1.2.2"]
46
+ }
47
+ ```
48
+
49
+ 2. **Authenticate:**
50
+
51
+ ```bash
52
+ opencode auth login
53
+ ```
54
+
55
+ Select **Google** → **OAuth with Google (Antigravity)** → Press Enter to skip Project ID → Sign in via browser.
56
+
57
+ 3. **Add models to your config:**
58
+
59
+ Add the models you want to use to the same config file:
60
+
61
+ ```json
62
+ {
63
+ "plugin": ["opencode-antigravity-auth@1.2.2"],
64
+ "provider": {
65
+ "google": {
66
+ "models": {
67
+ "gemini-3-pro-high": {
68
+ "name": "Gemini 3 Pro High (Antigravity)",
69
+ "limit": { "context": 1048576, "output": 65535 },
70
+ "modalities": { "input": ["text", "image", "pdf"], "output": ["text"] }
71
+ },
72
+ "claude-sonnet-4-5": {
73
+ "name": "Claude Sonnet 4.5 (Antigravity)",
74
+ "limit": { "context": 200000, "output": 64000 },
75
+ "modalities": { "input": ["text", "image", "pdf"], "output": ["text"] }
76
+ }
77
+ }
78
+ }
79
+ }
80
+ }
81
+ ```
82
+
83
+ > See [Available models](#available-models) for the full list.
84
+
85
+ 4. **Use it:**
86
+
87
+ ```bash
88
+ opencode run "Hello" --model=google/gemini-3-pro-high
89
+ ```
90
+
91
+ ---
92
+
93
+ ### For LLMs
94
+
95
+ <details>
96
+ <summary><b>🤖 Detailed Installation Guide for LLM Agents</b> (click to expand)</summary>
97
+
98
+ If you're an LLM agent helping a user set up this plugin, follow these steps:
99
+
100
+ #### Step 1: Verify OpenCode is installed
23
101
 
24
102
  ```bash
25
- mkdir -p ~/.config/opencode
103
+ command -v opencode && opencode --version || echo "OpenCode not installed - see https://opencode.ai/docs"
26
104
  ```
27
105
 
28
- Then create or edit the config file at `~/.config/opencode/opencode.json`:
106
+ #### Step 2: Create or update the config
29
107
 
30
- ```json
31
- {
32
- "plugin": ["opencode-antigravity-auth@1.2.0"]
33
- }
108
+ ```bash
109
+ mkdir -p ~/.config/opencode
110
+
111
+ if [ -f ~/.config/opencode/opencode.json ]; then
112
+ if command -v jq &> /dev/null; then
113
+ jq '.plugin = ((.plugin // []) + ["opencode-antigravity-auth@1.2.2"] | unique)' \
114
+ ~/.config/opencode/opencode.json > /tmp/oc.json && \
115
+ mv /tmp/oc.json ~/.config/opencode/opencode.json
116
+ else
117
+ echo "Add \"opencode-antigravity-auth@1.2.2\" to the plugin array manually"
118
+ fi
119
+ else
120
+ echo '{"plugin":["opencode-antigravity-auth@1.2.2"]}' > ~/.config/opencode/opencode.json
121
+ fi
34
122
  ```
35
123
 
36
- > **Note:** You can also use a project-local `.opencode.json` file in your project root instead. The global config at `~/.config/opencode/opencode.json` applies to all projects.
124
+ #### Step 3: Ask user about multi-account setup
125
+
126
+ Before running `opencode auth login`, ask the user:
37
127
 
38
- ### Step 2: Authenticate
128
+ > **Do you want to add multiple Google accounts for load balancing?**
129
+ > - Adding 2-10 accounts maximizes rate limits and provides automatic failover
130
+ > - You can always add more accounts later
39
131
 
40
- Run the authentication command:
132
+ Based on their answer:
133
+ - **Yes, multiple accounts** → After first login, prompt: "Sign in complete. Add another account? (up to 10 supported)"
134
+ - **No, just one** → Single account is fine, they can add more later with `opencode auth login`
135
+
136
+ #### Step 4: Run authentication
137
+
138
+ Tell the user to run:
41
139
 
42
140
  ```bash
43
141
  opencode auth login
44
142
  ```
45
143
 
144
+ Guide them through the prompts:
46
145
  1. Select **Google** as the provider
47
146
  2. Select **OAuth with Google (Antigravity)**
48
- 3. **Project ID prompt:** You'll see this prompt:
49
- ```
50
- Project ID (leave blank to use your default project):
51
- ```
52
- **Just press Enter to skip this** — it's optional and only needed if you want to use a specific Google Cloud project. Most users can leave it blank.
53
- 4. Sign in via the browser and return to Opencode. If the browser doesn't open, copy the displayed URL manually.
54
- 5. After signing in, you can add more Google accounts (up to 10) for load balancing, or press Enter to finish.
147
+ 3. **Project ID prompt** → Tell user: "Press Enter to skip (most users don't need this)"
148
+ 4. Browser opens for Google sign-in
149
+ 5. If multi-account: repeat for additional accounts, or press Enter to finish
150
+
151
+ #### Step 5: Add models to config
152
+
153
+ Merge model definitions into the user's config file (`~/.config/opencode/opencode.json`):
154
+
155
+ ```bash
156
+ # If jq is available, merge models programmatically
157
+ if command -v jq &> /dev/null; then
158
+ jq '.provider.google.models = {
159
+ "gemini-3-pro-high": {"name": "Gemini 3 Pro High (Antigravity)", "limit": {"context": 1048576, "output": 65535}, "modalities": {"input": ["text", "image", "pdf"], "output": ["text"]}},
160
+ "gemini-3-pro-low": {"name": "Gemini 3 Pro Low (Antigravity)", "limit": {"context": 1048576, "output": 65535}, "modalities": {"input": ["text", "image", "pdf"], "output": ["text"]}},
161
+ "gemini-3-flash": {"name": "Gemini 3 Flash (Antigravity)", "limit": {"context": 1048576, "output": 65536}, "modalities": {"input": ["text", "image", "pdf"], "output": ["text"]}},
162
+ "claude-sonnet-4-5": {"name": "Claude Sonnet 4.5 (Antigravity)", "limit": {"context": 200000, "output": 64000}, "modalities": {"input": ["text", "image", "pdf"], "output": ["text"]}},
163
+ "claude-sonnet-4-5-thinking": {"name": "Claude Sonnet 4.5 Thinking (Antigravity)", "limit": {"context": 200000, "output": 64000}, "modalities": {"input": ["text", "image", "pdf"], "output": ["text"]}},
164
+ "claude-opus-4-5-thinking": {"name": "Claude Opus 4.5 Thinking (Antigravity)", "limit": {"context": 200000, "output": 64000}, "modalities": {"input": ["text", "image", "pdf"], "output": ["text"]}},
165
+ "gpt-oss-120b-medium": {"name": "GPT-OSS 120B Medium (Antigravity)", "limit": {"context": 131072, "output": 32768}, "modalities": {"input": ["text", "image", "pdf"], "output": ["text"]}}
166
+ } + (.provider.google.models // {})' ~/.config/opencode/opencode.json > /tmp/oc.json && mv /tmp/oc.json ~/.config/opencode/opencode.json
167
+ fi
168
+ ```
169
+
170
+ Or edit the file manually and add the models from the [Available models](#available-models) section.
171
+
172
+ #### Step 6: Verify setup
173
+
174
+ ```bash
175
+ opencode run "Hello" --model=google/gemini-3-pro-high
176
+ ```
177
+
178
+ If successful, tell the user: **"Setup complete! You can now use Antigravity models in OpenCode."**
179
+
180
+ </details>
181
+
182
+ ---
55
183
 
56
- > **Alternative:** For a quick single-account setup without project ID options, open `opencode` and use the `/connect` command instead.
184
+ ## Available models
57
185
 
58
- ### Step 3: Add the models you want to use
186
+ Add these models to your `~/.config/opencode/opencode.json` under `provider.google.models`:
59
187
 
60
- Open the **same config file** you created in Step 1 (`~/.config/opencode/opencode.json`) and add the models under `provider.google.models`:
188
+ | Model ID | Description |
189
+ |----------|-------------|
190
+ | `gemini-3-pro-high` | Gemini 3 Pro High |
191
+ | `gemini-3-pro-low` | Gemini 3 Pro Low |
192
+ | `gemini-3-flash` | Gemini 3 Flash |
193
+ | `claude-sonnet-4-5` | Claude Sonnet 4.5 |
194
+ | `claude-sonnet-4-5-thinking` | Claude Sonnet 4.5 with thinking |
195
+ | `claude-opus-4-5-thinking` | Claude Opus 4.5 with thinking |
196
+ | `gpt-oss-120b-medium` | GPT-OSS 120B Medium |
197
+
198
+ <details>
199
+ <summary><b>Full model configuration</b> (click to expand)</summary>
61
200
 
62
201
  ```json
63
202
  {
64
- "plugin": ["opencode-antigravity-auth@1.2.0"],
65
203
  "provider": {
66
204
  "google": {
67
205
  "models": {
68
206
  "gemini-3-pro-high": {
69
207
  "name": "Gemini 3 Pro High (Antigravity)",
70
- "limit": {
71
- "context": 1048576,
72
- "output": 65535
73
- },
74
- "modalities": {
75
- "input": ["text", "image", "pdf"],
76
- "output": ["text"]
77
- }
208
+ "limit": { "context": 1048576, "output": 65535 },
209
+ "modalities": { "input": ["text", "image", "pdf"], "output": ["text"] }
78
210
  },
79
211
  "gemini-3-pro-low": {
80
212
  "name": "Gemini 3 Pro Low (Antigravity)",
81
- "limit": {
82
- "context": 1048576,
83
- "output": 65535
84
- },
85
- "modalities": {
86
- "input": ["text", "image", "pdf"],
87
- "output": ["text"]
88
- }
213
+ "limit": { "context": 1048576, "output": 65535 },
214
+ "modalities": { "input": ["text", "image", "pdf"], "output": ["text"] }
89
215
  },
90
216
  "gemini-3-flash": {
91
217
  "name": "Gemini 3 Flash (Antigravity)",
92
- "limit": {
93
- "context": 1048576,
94
- "output": 65536
95
- },
96
- "modalities": {
97
- "input": ["text", "image", "pdf"],
98
- "output": ["text"]
99
- }
218
+ "limit": { "context": 1048576, "output": 65536 },
219
+ "modalities": { "input": ["text", "image", "pdf"], "output": ["text"] }
100
220
  },
101
221
  "claude-sonnet-4-5": {
102
222
  "name": "Claude Sonnet 4.5 (Antigravity)",
103
- "limit": {
104
- "context": 200000,
105
- "output": 64000
106
- },
107
- "modalities": {
108
- "input": ["text", "image", "pdf"],
109
- "output": ["text"]
110
- }
223
+ "limit": { "context": 200000, "output": 64000 },
224
+ "modalities": { "input": ["text", "image", "pdf"], "output": ["text"] }
111
225
  },
112
226
  "claude-sonnet-4-5-thinking": {
113
227
  "name": "Claude Sonnet 4.5 Thinking (Antigravity)",
114
- "limit": {
115
- "context": 200000,
116
- "output": 64000
117
- },
118
- "modalities": {
119
- "input": ["text", "image", "pdf"],
120
- "output": ["text"]
121
- }
228
+ "limit": { "context": 200000, "output": 64000 },
229
+ "modalities": { "input": ["text", "image", "pdf"], "output": ["text"] }
122
230
  },
123
231
  "claude-opus-4-5-thinking": {
124
232
  "name": "Claude Opus 4.5 Thinking (Antigravity)",
125
- "limit": {
126
- "context": 200000,
127
- "output": 64000
128
- },
129
- "modalities": {
130
- "input": ["text", "image", "pdf"],
131
- "output": ["text"]
132
- }
233
+ "limit": { "context": 200000, "output": 64000 },
234
+ "modalities": { "input": ["text", "image", "pdf"], "output": ["text"] }
133
235
  },
134
236
  "gpt-oss-120b-medium": {
135
237
  "name": "GPT-OSS 120B Medium (Antigravity)",
136
- "limit": {
137
- "context": 131072,
138
- "output": 32768
139
- },
140
- "modalities": {
141
- "input": ["text", "image", "pdf"],
142
- "output": ["text"]
143
- }
238
+ "limit": { "context": 131072, "output": 32768 },
239
+ "modalities": { "input": ["text", "image", "pdf"], "output": ["text"] }
144
240
  }
145
241
  }
146
242
  }
@@ -148,31 +244,45 @@ Open the **same config file** you created in Step 1 (`~/.config/opencode/opencod
148
244
  }
149
245
  ```
150
246
 
151
- > **Tip:** You only need to add the models you plan to use. The example above includes all available models, but you can remove any you don't need. The `modalities` field enables image and PDF support in the TUI.
247
+ </details>
152
248
 
153
- ### Step 4: Use a model
249
+ ## Multi-account load balancing
154
250
 
155
- ```bash
156
- opencode run "Hello world" --model=google/gemini-3-pro-high
157
- ```
251
+ The plugin supports multiple Google accounts to maximize rate limits and provide automatic failover.
158
252
 
159
- Or start the interactive TUI and select a model from the model picker:
253
+ ### How it works
160
254
 
161
- ```bash
162
- opencode
163
- ```
255
+ - **Sticky account selection:** The plugin sticks to the same account for all requests until it hits a rate limit. This preserves Anthropic's prompt cache, which is organization-scoped.
256
+ - **Per-model-family rate limits:** Rate limits are tracked separately for Claude and Gemini models. If an account is rate-limited for Claude, it can still be used for Gemini requests.
257
+ - **Dual quota pools for Gemini:** Gemini models have access to two separate quota pools (Antigravity and Gemini CLI). When one pool is exhausted, the plugin automatically switches to the other before trying a different account.
258
+ - **Smart retry threshold:** Short rate limits (≤5s) are retried on the same account to avoid unnecessary switching.
259
+ - **Exponential backoff:** Consecutive rate limits trigger exponential backoff with increasing delays.
260
+ - **Quota-aware messages:** Rate limit toasts show quota reset times when available from the API.
261
+ - **Automatic failover:** On HTTP `429` (rate limit), the plugin automatically switches to the next available account for that model family.
262
+ - **Smart cooldown:** Rate-limited accounts are temporarily cooled down and automatically become available again after the cooldown expires.
263
+ - **Single-account retry:** If you only have one account, the plugin waits for the rate limit to reset and retries automatically.
264
+ - **Debounced notifications:** Toast notifications are debounced to avoid spam during streaming responses.
164
265
 
165
- ## Multi-account load balancing
266
+ ### Dual quota pools (Gemini only)
166
267
 
167
- The plugin supports multiple Google accounts to maximize rate limits and provide automatic failover.
268
+ For Gemini models, the plugin can access two independent quota pools using the same Google account:
168
269
 
169
- ### How it works
270
+ | Quota Pool | Headers Used | When Used |
271
+ |------------|--------------|-----------|
272
+ | Antigravity | Antigravity headers | Primary (tried first) |
273
+ | Gemini CLI | Gemini CLI headers | Fallback when Antigravity is rate-limited |
274
+
275
+ This effectively **doubles your Gemini quota** per account. The fallback is seamless — conversation context is preserved when switching between quota pools.
276
+
277
+ > **Note:** Claude models only work with Antigravity headers, so this dual-pool fallback only applies to Gemini models.
170
278
 
171
- - **Round-robin selection:** Each request uses the next account in the pool
172
- - **Automatic failover:** On HTTP `429` (rate limit), the plugin automatically switches to the next available account
173
- - **Smart cooldown:** Rate-limited accounts are temporarily cooled down and automatically become available again after the cooldown expires
174
- - **Single-account retry:** If you only have one account, the plugin waits for the rate limit to reset and retries automatically
175
- - **Toast notifications:** The TUI shows which account is being used and when switching occurs
279
+ ### Quiet mode
280
+
281
+ To suppress account-related toast notifications (useful for streaming/recording):
282
+
283
+ ```bash
284
+ export OPENCODE_ANTIGRAVITY_QUIET=1
285
+ ```
176
286
 
177
287
  ### Adding accounts
178
288
 
@@ -231,13 +341,17 @@ For models like `claude-opus-4-5-thinking`:
231
341
 
232
342
  ## Debugging
233
343
 
234
- Enable verbose logging:
344
+ Enable debug logging via environment variable:
235
345
 
236
346
  ```bash
237
347
  export OPENCODE_ANTIGRAVITY_DEBUG=1
238
348
  ```
239
349
 
240
- Logs are written to the current directory (e.g., `antigravity-debug-<timestamp>.log`).
350
+ - **Level 1 (`1` or `true`):** Basic logging of URLs, headers, status codes, and request/response previews.
351
+ - **Level 2 (`2` or `verbose`):** Verbose logging including full request and response bodies (up to 50KB).
352
+ - **TUI Reasoning View:** Debug logs are injected into the model's "thinking/reasoning" blocks in the Opencode TUI (requires thinking-capable models).
353
+ - **Log Files:** Logs are written to `~/.config/opencode/antigravity-logs/antigravity-debug-<timestamp>.log`. Override with `OPENCODE_ANTIGRAVITY_LOG_DIR`.
354
+ - **Auto-Stripping:** Injected debug blocks are automatically stripped from outgoing requests to prevent leaking into conversation history.
241
355
 
242
356
  ## Development
243
357
 
@@ -45,6 +45,12 @@ export declare const ANTIGRAVITY_HEADERS: {
45
45
  readonly "X-Goog-Api-Client": "google-cloud-sdk vscode_cloudshelleditor/0.1";
46
46
  readonly "Client-Metadata": "{\"ideType\":\"IDE_UNSPECIFIED\",\"platform\":\"PLATFORM_UNSPECIFIED\",\"pluginType\":\"GEMINI\"}";
47
47
  };
48
+ export declare const GEMINI_CLI_HEADERS: {
49
+ readonly "User-Agent": "google-api-nodejs-client/9.15.1";
50
+ readonly "X-Goog-Api-Client": "gl-node/22.17.0";
51
+ readonly "Client-Metadata": "ideType=IDE_UNSPECIFIED,platform=PLATFORM_UNSPECIFIED,pluginType=GEMINI";
52
+ };
53
+ export type HeaderStyle = "antigravity" | "gemini-cli";
48
54
  /**
49
55
  * Provider identifier shared between the plugin loader and credential store.
50
56
  */
@@ -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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HEADERS = {
59
59
  "X-Goog-Api-Client": "google-cloud-sdk vscode_cloudshelleditor/0.1",
60
60
  "Client-Metadata": '{"ideType":"IDE_UNSPECIFIED","platform":"PLATFORM_UNSPECIFIED","pluginType":"GEMINI"}',
61
61
  };
62
+ export const GEMINI_CLI_HEADERS = {
63
+ "User-Agent": "google-api-nodejs-client/9.15.1",
64
+ "X-Goog-Api-Client": "gl-node/22.17.0",
65
+ "Client-Metadata": "ideType=IDE_UNSPECIFIED,platform=PLATFORM_UNSPECIFIED,pluginType=GEMINI",
66
+ };
62
67
  /**
63
68
  * Provider identifier shared between the plugin loader and credential store.
64
69
  */
@@ -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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E,MAAM,CAAC,MAAM,mBAAmB,GAAG;IACjC,YAAY,EAAE,kCAAkC;IAChD,mBAAmB,EAAE,8CAA8C;IACnE,iBAAiB,EAAE,uFAAuF;CAClG,CAAC;AAEX,MAAM,CAAC,MAAM,kBAAkB,GAAG;IAChC,YAAY,EAAE,iCAAiC;IAC/C,mBAAmB,EAAE,iBAAiB;IACtC,iBAAiB,EAAE,yEAAyE;CACpF,CAAC;AAIX;;GAEG;AACH,MAAM,CAAC,MAAM,uBAAuB,GAAG,QAAQ,CAAC"}
@@ -0,0 +1,3 @@
1
+ export declare function invalidatePackage(packageName?: string): boolean;
2
+ export declare function invalidateCache(): boolean;
3
+ //# sourceMappingURL=cache.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cache.d.ts","sourceRoot":"","sources":["../../../../src/hooks/auto-update-checker/cache.ts"],"names":[],"mappings":"AA+CA,wBAAgB,iBAAiB,CAAC,WAAW,GAAE,MAAqB,GAAG,OAAO,CAsC7E;AAED,wBAAgB,eAAe,IAAI,OAAO,CAGzC"}
@@ -0,0 +1,71 @@
1
+ import * as fs from "node:fs";
2
+ import * as path from "node:path";
3
+ import { CACHE_DIR, PACKAGE_NAME } from "./constants";
4
+ function stripTrailingCommas(json) {
5
+ return json.replace(/,(\s*[}\]])/g, "$1");
6
+ }
7
+ function removeFromBunLock(packageName) {
8
+ const lockPath = path.join(CACHE_DIR, "bun.lock");
9
+ if (!fs.existsSync(lockPath))
10
+ return false;
11
+ try {
12
+ const content = fs.readFileSync(lockPath, "utf-8");
13
+ const lock = JSON.parse(stripTrailingCommas(content));
14
+ let modified = false;
15
+ if (lock.workspaces?.[""]?.dependencies?.[packageName]) {
16
+ delete lock.workspaces[""].dependencies[packageName];
17
+ modified = true;
18
+ }
19
+ if (lock.packages?.[packageName]) {
20
+ delete lock.packages[packageName];
21
+ modified = true;
22
+ }
23
+ if (modified) {
24
+ fs.writeFileSync(lockPath, JSON.stringify(lock, null, 2));
25
+ console.log(`[auto-update-checker] Removed from bun.lock: ${packageName}`);
26
+ }
27
+ return modified;
28
+ }
29
+ catch {
30
+ return false;
31
+ }
32
+ }
33
+ export function invalidatePackage(packageName = PACKAGE_NAME) {
34
+ try {
35
+ const pkgDir = path.join(CACHE_DIR, "node_modules", packageName);
36
+ const pkgJsonPath = path.join(CACHE_DIR, "package.json");
37
+ let packageRemoved = false;
38
+ let dependencyRemoved = false;
39
+ let lockRemoved = false;
40
+ if (fs.existsSync(pkgDir)) {
41
+ fs.rmSync(pkgDir, { recursive: true, force: true });
42
+ console.log(`[auto-update-checker] Package removed: ${pkgDir}`);
43
+ packageRemoved = true;
44
+ }
45
+ if (fs.existsSync(pkgJsonPath)) {
46
+ const content = fs.readFileSync(pkgJsonPath, "utf-8");
47
+ const pkgJson = JSON.parse(content);
48
+ if (pkgJson.dependencies?.[packageName]) {
49
+ delete pkgJson.dependencies[packageName];
50
+ fs.writeFileSync(pkgJsonPath, JSON.stringify(pkgJson, null, 2));
51
+ console.log(`[auto-update-checker] Dependency removed from package.json: ${packageName}`);
52
+ dependencyRemoved = true;
53
+ }
54
+ }
55
+ lockRemoved = removeFromBunLock(packageName);
56
+ if (!packageRemoved && !dependencyRemoved && !lockRemoved) {
57
+ console.log(`[auto-update-checker] Package not found, nothing to invalidate: ${packageName}`);
58
+ return false;
59
+ }
60
+ return true;
61
+ }
62
+ catch (err) {
63
+ console.error("[auto-update-checker] Failed to invalidate package:", err);
64
+ return false;
65
+ }
66
+ }
67
+ export function invalidateCache() {
68
+ console.warn("[auto-update-checker] WARNING: invalidateCache is deprecated, use invalidatePackage");
69
+ return invalidatePackage();
70
+ }
71
+ //# sourceMappingURL=cache.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cache.js","sourceRoot":"","sources":["../../../../src/hooks/auto-update-checker/cache.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,SAAS,CAAC;AAC9B,OAAO,KAAK,IAAI,MAAM,WAAW,CAAC;AAClC,OAAO,E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H,CAAC;QAED,WAAW,GAAG,iBAAiB,CAAC,WAAW,CAAC,CAAC;QAE7C,IAAI,CAAC,cAAc,IAAI,CAAC,iBAAiB,IAAI,CAAC,WAAW,EAAE,CAAC;YAC1D,OAAO,CAAC,GAAG,CAAC,mEAAmE,WAAW,EAAE,CAAC,CAAC;YAC9F,OAAO,KAAK,CAAC;QACf,CAAC;QAED,OAAO,IAAI,CAAC;IACd,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACb,OAAO,CAAC,KAAK,CAAC,qDAAqD,EAAE,GAAG,CAAC,CAAC;QAC1E,OAAO,KAAK,CAAC;IACf,CAAC;AACH,CAAC;AAED,MAAM,UAAU,eAAe;IAC7B,OAAO,CAAC,IAAI,CAAC,qFAAqF,CAAC,CAAC;IACpG,OAAO,iBAAiB,EAAE,CAAC;AAC7B,CAAC"}
@@ -0,0 +1,16 @@
1
+ import type { UpdateCheckResult } from "./types";
2
+ export declare function isLocalDevMode(directory: string): boolean;
3
+ export declare function getLocalDevPath(directory: string): string | null;
4
+ export declare function getLocalDevVersion(directory: string): string | null;
5
+ export interface PluginEntryInfo {
6
+ entry: string;
7
+ isPinned: boolean;
8
+ pinnedVersion: string | null;
9
+ configPath: string;
10
+ }
11
+ export declare function findPluginEntry(directory: string): PluginEntryInfo | null;
12
+ export declare function getCachedVersion(): string | null;
13
+ export declare function updatePinnedVersion(configPath: string, oldEntry: string, newVersion: string): boolean;
14
+ export declare function getLatestVersion(): Promise<string | null>;
15
+ export declare function checkForUpdate(directory: string): Promise<UpdateCheckResult>;
16
+ //# sourceMappingURL=checker.d.ts.map
@@ -0,0 +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;AAe3F,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"}