opencode-google-auth 0.0.3 → 0.0.5
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 +1 -1
- package/src/antigravity-spoof.txt +7 -1
- package/src/main.ts +114 -109
- package/src/services/config.ts +45 -52
package/package.json
CHANGED
|
@@ -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))
|
|
@@ -167,112 +172,112 @@ export const geminiCli: Plugin = async (context) => {
|
|
|
167
172
|
}
|
|
168
173
|
}
|
|
169
174
|
|
|
170
|
-
export const antigravity: Plugin = async (context) => {
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
}
|
|
175
|
+
// export const antigravity: Plugin = async (context) => {
|
|
176
|
+
// const runtime = makeRuntime({
|
|
177
|
+
// openCodeCtx: context,
|
|
178
|
+
// providerConfig: antigravityConfig(),
|
|
179
|
+
// })
|
|
180
|
+
|
|
181
|
+
// const config = await runtime.runPromise(
|
|
182
|
+
// Effect.gen(function* () {
|
|
183
|
+
// const providerConfig = yield* ProviderConfig
|
|
184
|
+
// const modelsDev = yield* fetchModelsDev
|
|
185
|
+
|
|
186
|
+
// return providerConfig.getConfig(modelsDev)
|
|
187
|
+
// }),
|
|
188
|
+
// )
|
|
189
|
+
|
|
190
|
+
// return {
|
|
191
|
+
// config: async (cfg) => {
|
|
192
|
+
// cfg.provider ??= {}
|
|
193
|
+
// cfg.provider[config.id as string] = config
|
|
194
|
+
// },
|
|
195
|
+
// auth: {
|
|
196
|
+
// provider: config.id as string,
|
|
197
|
+
// loader: async (getAuth) => {
|
|
198
|
+
// const auth = await getAuth()
|
|
199
|
+
// if (auth.type !== "oauth") return {}
|
|
200
|
+
|
|
201
|
+
// const credentials: Credentials = {
|
|
202
|
+
// access_token: auth.access,
|
|
203
|
+
// refresh_token: auth.refresh,
|
|
204
|
+
// expiry_date: auth.expires,
|
|
205
|
+
// }
|
|
206
|
+
|
|
207
|
+
// await runtime.runPromise(
|
|
208
|
+
// Effect.gen(function* () {
|
|
209
|
+
// const session = yield* Session
|
|
210
|
+
// yield* session.setCredentials(credentials)
|
|
211
|
+
// }),
|
|
212
|
+
// )
|
|
213
|
+
|
|
214
|
+
// return {
|
|
215
|
+
// apiKey: "",
|
|
216
|
+
// fetch: (async (input, init) => {
|
|
217
|
+
// const response = await runtime.runPromise(customFetch(input, init))
|
|
218
|
+
// return response
|
|
219
|
+
// }) as typeof fetch,
|
|
220
|
+
// } satisfies GoogleGenerativeAIProviderSettings
|
|
221
|
+
// },
|
|
222
|
+
// methods: [
|
|
223
|
+
// {
|
|
224
|
+
// type: "oauth",
|
|
225
|
+
// label: "OAuth with Google",
|
|
226
|
+
// authorize: async () => {
|
|
227
|
+
// const result = await runtime.runPromise(
|
|
228
|
+
// Effect.gen(function* () {
|
|
229
|
+
// const oauth = yield* OAuth
|
|
230
|
+
// return yield* oauth.authenticate
|
|
231
|
+
// }),
|
|
232
|
+
// )
|
|
233
|
+
|
|
234
|
+
// return {
|
|
235
|
+
// url: "",
|
|
236
|
+
// method: "auto",
|
|
237
|
+
// instructions: "You are now authenticated!",
|
|
238
|
+
// callback: async () => {
|
|
239
|
+
// const accessToken = result.access_token
|
|
240
|
+
// const refreshToken = result.refresh_token
|
|
241
|
+
// const expiryDate = result.expiry_date
|
|
242
|
+
|
|
243
|
+
// if (!accessToken || !refreshToken || !expiryDate) {
|
|
244
|
+
// return { type: "failed" }
|
|
245
|
+
// }
|
|
246
|
+
|
|
247
|
+
// return {
|
|
248
|
+
// type: "success",
|
|
249
|
+
// provider: config.id as string,
|
|
250
|
+
// access: accessToken,
|
|
251
|
+
// refresh: refreshToken,
|
|
252
|
+
// expires: expiryDate,
|
|
253
|
+
// }
|
|
254
|
+
// },
|
|
255
|
+
// }
|
|
256
|
+
// },
|
|
257
|
+
// },
|
|
258
|
+
// ],
|
|
259
|
+
// },
|
|
260
|
+
// "experimental.chat.system.transform": async (_input, output) => {
|
|
261
|
+
// // THIS IS REQUIRED OTHERWISE YOU'LL GET 429 OR 403 FOR SOME GODDAMN REASON
|
|
262
|
+
// output.system.unshift(antigravitySpoof)
|
|
263
|
+
// },
|
|
264
|
+
// "chat.params": async (input, output) => {
|
|
265
|
+
// await runtime.runPromise(
|
|
266
|
+
// Effect.log("chat.params event before:", input.model, output.options),
|
|
267
|
+
// )
|
|
268
|
+
|
|
269
|
+
// if (input.model.providerID === config.id) {
|
|
270
|
+
// output.options = {
|
|
271
|
+
// ...output.options,
|
|
272
|
+
// labels: {
|
|
273
|
+
// sessionId: input.sessionID,
|
|
274
|
+
// },
|
|
275
|
+
// } satisfies GoogleGenerativeAIProviderOptions
|
|
276
|
+
// }
|
|
277
|
+
|
|
278
|
+
// await runtime.runPromise(
|
|
279
|
+
// Effect.log("chat.params event after:", input.model, output.options),
|
|
280
|
+
// )
|
|
281
|
+
// },
|
|
282
|
+
// }
|
|
283
|
+
// }
|
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")<
|
|
@@ -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 => ({
|
|
@@ -193,11 +195,51 @@ export const antigravityConfig = (): ProviderConfigShape => ({
|
|
|
193
195
|
...claudeSonnet,
|
|
194
196
|
id: "claude-sonnet-4-5-thinking",
|
|
195
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
|
+
},
|
|
196
218
|
},
|
|
197
219
|
"claude-opus-4-5-thinking": {
|
|
198
220
|
...claudeOpus,
|
|
199
221
|
id: "claude-opus-4-5-thinking",
|
|
200
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
|
+
},
|
|
201
243
|
},
|
|
202
244
|
}
|
|
203
245
|
|
|
@@ -205,7 +247,8 @@ export const antigravityConfig = (): ProviderConfigShape => ({
|
|
|
205
247
|
...googleProvider,
|
|
206
248
|
id: antigravityConfig().SERVICE_NAME,
|
|
207
249
|
name: antigravityConfig().DISPLAY_NAME,
|
|
208
|
-
api: antigravityConfig().ENDPOINTS.at(
|
|
250
|
+
api: antigravityConfig().ENDPOINTS.at(0) as string,
|
|
251
|
+
npm: "google-antigravity-ai-provider",
|
|
209
252
|
models,
|
|
210
253
|
}
|
|
211
254
|
},
|
|
@@ -237,63 +280,12 @@ export const antigravityConfig = (): ProviderConfigShape => ({
|
|
|
237
280
|
const isThinking = body.model.toLowerCase().includes("thinking")
|
|
238
281
|
|
|
239
282
|
if (isClaude && body.request && typeof body.request === "object") {
|
|
240
|
-
const request = body.request as Record<string, unknown>
|
|
241
|
-
const generationConfig = request.generationConfig as
|
|
242
|
-
| Record<string, unknown>
|
|
243
|
-
| undefined
|
|
244
|
-
|
|
245
|
-
const tools = request.tools as
|
|
246
|
-
| Array<{ functionDeclarations?: Array<{ parameters?: unknown }> }>
|
|
247
|
-
| undefined
|
|
248
|
-
if (tools && Array.isArray(tools)) {
|
|
249
|
-
for (const tool of tools) {
|
|
250
|
-
if (
|
|
251
|
-
tool.functionDeclarations
|
|
252
|
-
&& Array.isArray(tool.functionDeclarations)
|
|
253
|
-
) {
|
|
254
|
-
for (const func of tool.functionDeclarations) {
|
|
255
|
-
if (!func.parameters) {
|
|
256
|
-
func.parameters = { type: "object", properties: {} }
|
|
257
|
-
}
|
|
258
|
-
}
|
|
259
|
-
}
|
|
260
|
-
}
|
|
261
|
-
}
|
|
262
|
-
|
|
263
283
|
innerRequest.toolConfig = {
|
|
264
284
|
functionCallingConfig: {
|
|
265
285
|
mode: "VALIDATED",
|
|
266
286
|
},
|
|
267
287
|
}
|
|
268
288
|
|
|
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
289
|
if (isThinking) {
|
|
298
290
|
headers.set("anthropic-beta", "interleaved-thinking-2025-05-14")
|
|
299
291
|
}
|
|
@@ -314,4 +306,5 @@ export const antigravityConfig = (): ProviderConfigShape => ({
|
|
|
314
306
|
},
|
|
315
307
|
}
|
|
316
308
|
}),
|
|
309
|
+
skipRequestTransform: true,
|
|
317
310
|
})
|