opencode-google-auth 0.0.4 → 0.0.6
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/package.json +2 -2
- package/src/antigravity-spoof.txt +7 -1
- package/src/main.ts +5 -0
- package/src/services/config.ts +66 -54
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "opencode-google-auth",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.6",
|
|
4
4
|
"description": "_description_",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"opencode-google-auth"
|
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
"scripts": {
|
|
29
29
|
"deploy": "bun build ./src/main.ts --target bun --outfile .opencode/plugin/opencode-google-auth.js",
|
|
30
30
|
"format": "prettier --write .",
|
|
31
|
-
"lint": "oxlint",
|
|
31
|
+
"lint": "oxlint --type-aware",
|
|
32
32
|
"release": "bumpp && npm publish",
|
|
33
33
|
"typecheck": "tsgo"
|
|
34
34
|
},
|
|
@@ -1 +1,7 @@
|
|
|
1
|
-
You are Antigravity, a powerful agentic AI coding assistant designed by the Google
|
|
1
|
+
You are Antigravity, a powerful agentic AI coding assistant designed by the Google DeepMind team working on Advanced Agentic Coding.
|
|
2
|
+
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.
|
|
3
|
+
|
|
4
|
+
**Absolute paths only**
|
|
5
|
+
**Proactiveness**
|
|
6
|
+
|
|
7
|
+
The USER will send you requests, which you must always prioritize addressing.
|
package/src/main.ts
CHANGED
|
@@ -69,6 +69,11 @@ const customFetch = Effect.fn(function* (
|
|
|
69
69
|
)
|
|
70
70
|
}
|
|
71
71
|
|
|
72
|
+
if (config.skipRequestTransform) {
|
|
73
|
+
yield* Effect.log("Skipping response transformation")
|
|
74
|
+
return response
|
|
75
|
+
}
|
|
76
|
+
|
|
72
77
|
return result.streaming ?
|
|
73
78
|
transformStreamingResponse(response)
|
|
74
79
|
: yield* Effect.promise(() => transformNonStreamingResponse(response))
|
package/src/services/config.ts
CHANGED
|
@@ -33,6 +33,7 @@ export interface ProviderConfigShape {
|
|
|
33
33
|
headers: Headers
|
|
34
34
|
url: URL
|
|
35
35
|
}>
|
|
36
|
+
readonly skipRequestTransform?: boolean
|
|
36
37
|
}
|
|
37
38
|
|
|
38
39
|
export class ProviderConfig extends Context.Tag("ProviderConfig")<
|
|
@@ -49,8 +50,8 @@ export const CLIENT_METADATA = {
|
|
|
49
50
|
} as const
|
|
50
51
|
|
|
51
52
|
export const GEMINI_CLI_MODELS = [
|
|
52
|
-
|
|
53
|
-
|
|
53
|
+
"gemini-2.5-pro",
|
|
54
|
+
"gemini-2.5-flash",
|
|
54
55
|
"gemini-2.5-flash-lite",
|
|
55
56
|
"gemini-3-pro-preview",
|
|
56
57
|
"gemini-3-flash-preview",
|
|
@@ -103,6 +104,7 @@ export const geminiCliConfig = (): ProviderConfigShape => ({
|
|
|
103
104
|
models: filteredModels as Record<string, OpenCodeModel>,
|
|
104
105
|
}
|
|
105
106
|
},
|
|
107
|
+
skipRequestTransform: false,
|
|
106
108
|
})
|
|
107
109
|
|
|
108
110
|
export const antigravityConfig = (): ProviderConfigShape => ({
|
|
@@ -179,26 +181,66 @@ export const antigravityConfig = (): ProviderConfigShape => ({
|
|
|
179
181
|
},
|
|
180
182
|
} satisfies GoogleGenerativeAIProviderOptions,
|
|
181
183
|
},
|
|
182
|
-
"claude-sonnet-4-5": {
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
},
|
|
192
|
-
"claude-sonnet-4-5-thinking": {
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
},
|
|
184
|
+
// "claude-sonnet-4-5": {
|
|
185
|
+
// ...claudeSonnet,
|
|
186
|
+
// id: "claude-sonnet-4-5",
|
|
187
|
+
// reasoning: false,
|
|
188
|
+
// options: {
|
|
189
|
+
// thinkingConfig: {
|
|
190
|
+
// includeThoughts: false,
|
|
191
|
+
// },
|
|
192
|
+
// } satisfies GoogleGenerativeAIProviderOptions,
|
|
193
|
+
// },
|
|
194
|
+
// "claude-sonnet-4-5-thinking": {
|
|
195
|
+
// ...claudeSonnet,
|
|
196
|
+
// id: "claude-sonnet-4-5-thinking",
|
|
197
|
+
// name: "Claude Sonnet 4.5 (Thinking)",
|
|
198
|
+
// options: {
|
|
199
|
+
// thinkingConfig: {
|
|
200
|
+
// includeThoughts: true,
|
|
201
|
+
// thinkingBudget: 31999,
|
|
202
|
+
// },
|
|
203
|
+
// } satisfies GoogleGenerativeAIProviderOptions,
|
|
204
|
+
// variants: {
|
|
205
|
+
// high: {
|
|
206
|
+
// thinkingConfig: {
|
|
207
|
+
// includeThoughts: true,
|
|
208
|
+
// thinkingBudget: 16000,
|
|
209
|
+
// },
|
|
210
|
+
// } satisfies GoogleGenerativeAIProviderOptions,
|
|
211
|
+
// max: {
|
|
212
|
+
// thinkingConfig: {
|
|
213
|
+
// includeThoughts: true,
|
|
214
|
+
// thinkingBudget: 31999,
|
|
215
|
+
// },
|
|
216
|
+
// } satisfies GoogleGenerativeAIProviderOptions,
|
|
217
|
+
// },
|
|
218
|
+
// },
|
|
219
|
+
// "claude-opus-4-5-thinking": {
|
|
220
|
+
// ...claudeOpus,
|
|
221
|
+
// id: "claude-opus-4-5-thinking",
|
|
222
|
+
// name: "Claude Opus 4.5 (Thinking)",
|
|
223
|
+
// options: {
|
|
224
|
+
// thinkingConfig: {
|
|
225
|
+
// includeThoughts: true,
|
|
226
|
+
// thinkingBudget: 31999,
|
|
227
|
+
// },
|
|
228
|
+
// } satisfies GoogleGenerativeAIProviderOptions,
|
|
229
|
+
// variants: {
|
|
230
|
+
// high: {
|
|
231
|
+
// thinkingConfig: {
|
|
232
|
+
// includeThoughts: true,
|
|
233
|
+
// thinkingBudget: 16000,
|
|
234
|
+
// },
|
|
235
|
+
// } satisfies GoogleGenerativeAIProviderOptions,
|
|
236
|
+
// max: {
|
|
237
|
+
// thinkingConfig: {
|
|
238
|
+
// includeThoughts: true,
|
|
239
|
+
// thinkingBudget: 31999,
|
|
240
|
+
// },
|
|
241
|
+
// } satisfies GoogleGenerativeAIProviderOptions,
|
|
242
|
+
// },
|
|
243
|
+
// },
|
|
202
244
|
}
|
|
203
245
|
|
|
204
246
|
return {
|
|
@@ -206,6 +248,7 @@ export const antigravityConfig = (): ProviderConfigShape => ({
|
|
|
206
248
|
id: antigravityConfig().SERVICE_NAME,
|
|
207
249
|
name: antigravityConfig().DISPLAY_NAME,
|
|
208
250
|
api: antigravityConfig().ENDPOINTS.at(0) as string,
|
|
251
|
+
npm: "google-antigravity-ai-provider",
|
|
209
252
|
models,
|
|
210
253
|
}
|
|
211
254
|
},
|
|
@@ -238,10 +281,6 @@ export const antigravityConfig = (): ProviderConfigShape => ({
|
|
|
238
281
|
|
|
239
282
|
if (isClaude && body.request && typeof body.request === "object") {
|
|
240
283
|
const request = body.request as Record<string, unknown>
|
|
241
|
-
const generationConfig = request.generationConfig as
|
|
242
|
-
| Record<string, unknown>
|
|
243
|
-
| undefined
|
|
244
|
-
|
|
245
284
|
const tools = request.tools as
|
|
246
285
|
| Array<{ functionDeclarations?: Array<{ parameters?: unknown }> }>
|
|
247
286
|
| undefined
|
|
@@ -266,34 +305,6 @@ export const antigravityConfig = (): ProviderConfigShape => ({
|
|
|
266
305
|
},
|
|
267
306
|
}
|
|
268
307
|
|
|
269
|
-
// For non-thinking Claude, remove thinkingConfig entirely
|
|
270
|
-
if (!isThinking && generationConfig?.thinkingConfig) {
|
|
271
|
-
delete generationConfig.thinkingConfig
|
|
272
|
-
}
|
|
273
|
-
|
|
274
|
-
// For thinking Claude, convert camelCase to snake_case and add default budget
|
|
275
|
-
if (isThinking && generationConfig?.thinkingConfig) {
|
|
276
|
-
const thinkingConfig = generationConfig.thinkingConfig as Record<
|
|
277
|
-
string,
|
|
278
|
-
unknown
|
|
279
|
-
>
|
|
280
|
-
|
|
281
|
-
if (thinkingConfig.includeThoughts !== undefined) {
|
|
282
|
-
thinkingConfig.include_thoughts = thinkingConfig.includeThoughts
|
|
283
|
-
delete thinkingConfig.includeThoughts
|
|
284
|
-
}
|
|
285
|
-
|
|
286
|
-
if (thinkingConfig.thinkingBudget !== undefined) {
|
|
287
|
-
thinkingConfig.thinking_budget = thinkingConfig.thinkingBudget
|
|
288
|
-
delete thinkingConfig.thinkingBudget
|
|
289
|
-
}
|
|
290
|
-
|
|
291
|
-
// Add default thinking_budget if not present (required for Claude thinking)
|
|
292
|
-
if (thinkingConfig.thinking_budget === undefined) {
|
|
293
|
-
thinkingConfig.thinking_budget = 32768 // Default to high tier
|
|
294
|
-
}
|
|
295
|
-
}
|
|
296
|
-
|
|
297
308
|
if (isThinking) {
|
|
298
309
|
headers.set("anthropic-beta", "interleaved-thinking-2025-05-14")
|
|
299
310
|
}
|
|
@@ -314,4 +325,5 @@ export const antigravityConfig = (): ProviderConfigShape => ({
|
|
|
314
325
|
},
|
|
315
326
|
}
|
|
316
327
|
}),
|
|
328
|
+
skipRequestTransform: true,
|
|
317
329
|
})
|