@heyhuynhgiabuu/pi-oauth-antigravity 0.1.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/CHANGELOG.md +24 -0
- package/LICENSE +21 -0
- package/README.md +91 -0
- package/dist/auth/index.d.ts +2 -0
- package/dist/auth/index.js +1 -0
- package/dist/auth/oauth.d.ts +18 -0
- package/dist/auth/oauth.js +374 -0
- package/dist/client/client.d.ts +35 -0
- package/dist/client/client.js +448 -0
- package/dist/client/index.d.ts +1 -0
- package/dist/client/index.js +1 -0
- package/dist/diagnostics/diagnostics.d.ts +31 -0
- package/dist/diagnostics/diagnostics.js +68 -0
- package/dist/diagnostics/index.d.ts +1 -0
- package/dist/diagnostics/index.js +1 -0
- package/dist/image/image.d.ts +62 -0
- package/dist/image/image.js +244 -0
- package/dist/image/index.d.ts +1 -0
- package/dist/image/index.js +1 -0
- package/dist/index.d.ts +12 -0
- package/dist/index.js +182 -0
- package/dist/models/index.d.ts +1 -0
- package/dist/models/index.js +1 -0
- package/dist/models/models.d.ts +44 -0
- package/dist/models/models.js +377 -0
- package/dist/stream/index.d.ts +1 -0
- package/dist/stream/index.js +1 -0
- package/dist/stream/stream.d.ts +24 -0
- package/dist/stream/stream.js +879 -0
- package/dist/types/enums.d.ts +41 -0
- package/dist/types/enums.js +49 -0
- package/dist/types/index.d.ts +2 -0
- package/dist/types/index.js +2 -0
- package/dist/types/types.d.ts +259 -0
- package/dist/types/types.js +2 -0
- package/dist/usage/index.d.ts +1 -0
- package/dist/usage/index.js +1 -0
- package/dist/usage/usage.d.ts +8 -0
- package/dist/usage/usage.js +388 -0
- package/dist/utils/http.d.ts +7 -0
- package/dist/utils/http.js +81 -0
- package/dist/utils/index.d.ts +3 -0
- package/dist/utils/index.js +3 -0
- package/dist/utils/security.d.ts +8 -0
- package/dist/utils/security.js +60 -0
- package/dist/utils/util.d.ts +40 -0
- package/dist/utils/util.js +176 -0
- package/package.json +73 -0
|
@@ -0,0 +1,377 @@
|
|
|
1
|
+
import { ThinkingEffort } from "../types/enums.js";
|
|
2
|
+
export const PROVIDER_ID = "antigravity";
|
|
3
|
+
export const PROVIDER_NAME = "Antigravity";
|
|
4
|
+
/**
|
|
5
|
+
* Public selectable model IDs → backend request model IDs by thinking effort.
|
|
6
|
+
*
|
|
7
|
+
* Catalog mirrors `agy models` (Antigravity CLI), which currently advertises:
|
|
8
|
+
* - Gemini 3.8 Flash (Low / Medium / High)
|
|
9
|
+
* - Gemini 3.7 Flash (Low / Medium / High)
|
|
10
|
+
* - Gemini 3.6 Flash (Low / Medium / High)
|
|
11
|
+
* - Gemini 3.5 Flash (Low / Medium / High)
|
|
12
|
+
* - Gemini 3.1 Pro (Low / High)
|
|
13
|
+
* - Claude Sonnet 4.6 (Thinking)
|
|
14
|
+
* - Claude Opus 4.6 (Thinking)
|
|
15
|
+
* - GPT-OSS 120B (Medium)
|
|
16
|
+
*
|
|
17
|
+
* Pi exposes those as public model IDs and only surfaces the exact thinking levels
|
|
18
|
+
* advertised by the backend for each model.
|
|
19
|
+
*/
|
|
20
|
+
export const ANTIGRAVITY_ROUTING = {
|
|
21
|
+
"gemini-3.8-flash": {
|
|
22
|
+
off: "gemini-3.8-flash-low",
|
|
23
|
+
routing: {
|
|
24
|
+
minimal: "gemini-3.8-flash-low",
|
|
25
|
+
low: "gemini-3.8-flash-low",
|
|
26
|
+
medium: "gemini-3.8-flash-medium",
|
|
27
|
+
high: "gemini-3.8-flash-high",
|
|
28
|
+
xhigh: "gemini-3.8-flash-high",
|
|
29
|
+
},
|
|
30
|
+
defaultRequestId: "gemini-3.8-flash-low",
|
|
31
|
+
},
|
|
32
|
+
"claude-opus-4-6": {
|
|
33
|
+
routing: {
|
|
34
|
+
minimal: "claude-opus-4-6-thinking",
|
|
35
|
+
low: "claude-opus-4-6-thinking",
|
|
36
|
+
medium: "claude-opus-4-6-thinking",
|
|
37
|
+
high: "claude-opus-4-6-thinking",
|
|
38
|
+
},
|
|
39
|
+
defaultRequestId: "claude-opus-4-6-thinking",
|
|
40
|
+
},
|
|
41
|
+
// Live fetchAvailableModels exposes `claude-sonnet-4-6` (display: Thinking), not a separate *-thinking id.
|
|
42
|
+
"claude-sonnet-4-6": {
|
|
43
|
+
off: "claude-sonnet-4-6",
|
|
44
|
+
routing: {
|
|
45
|
+
minimal: "claude-sonnet-4-6",
|
|
46
|
+
low: "claude-sonnet-4-6",
|
|
47
|
+
medium: "claude-sonnet-4-6",
|
|
48
|
+
high: "claude-sonnet-4-6",
|
|
49
|
+
xhigh: "claude-sonnet-4-6",
|
|
50
|
+
},
|
|
51
|
+
defaultRequestId: "claude-sonnet-4-6",
|
|
52
|
+
},
|
|
53
|
+
"gemini-3.1-pro": {
|
|
54
|
+
// `gemini-3.1-pro-high` is advertised but currently 400s for agent streamGenerateContent;
|
|
55
|
+
// `gemini-pro-agent` is the working High runtime id (same display name in fetchAvailableModels).
|
|
56
|
+
off: "gemini-3.1-pro-low",
|
|
57
|
+
routing: {
|
|
58
|
+
minimal: "gemini-3.1-pro-low",
|
|
59
|
+
low: "gemini-3.1-pro-low",
|
|
60
|
+
medium: "gemini-3.1-pro-low",
|
|
61
|
+
high: "gemini-pro-agent",
|
|
62
|
+
xhigh: "gemini-pro-agent",
|
|
63
|
+
},
|
|
64
|
+
defaultRequestId: "gemini-3.1-pro-low",
|
|
65
|
+
},
|
|
66
|
+
"gemini-3.7-flash": {
|
|
67
|
+
off: "gemini-3.7-flash-low",
|
|
68
|
+
routing: {
|
|
69
|
+
minimal: "gemini-3.7-flash-low",
|
|
70
|
+
low: "gemini-3.7-flash-low",
|
|
71
|
+
medium: "gemini-3.7-flash-medium",
|
|
72
|
+
high: "gemini-3.7-flash-high",
|
|
73
|
+
xhigh: "gemini-3.7-flash-high",
|
|
74
|
+
},
|
|
75
|
+
defaultRequestId: "gemini-3.7-flash-low",
|
|
76
|
+
},
|
|
77
|
+
"gemini-3.6-flash": {
|
|
78
|
+
// agy models: gemini-3.6-flash-low / -medium / -high
|
|
79
|
+
off: "gemini-3.6-flash-low",
|
|
80
|
+
routing: {
|
|
81
|
+
minimal: "gemini-3.6-flash-low",
|
|
82
|
+
low: "gemini-3.6-flash-low",
|
|
83
|
+
medium: "gemini-3.6-flash-medium",
|
|
84
|
+
high: "gemini-3.6-flash-high",
|
|
85
|
+
xhigh: "gemini-3.6-flash-high",
|
|
86
|
+
},
|
|
87
|
+
defaultRequestId: "gemini-3.6-flash-low",
|
|
88
|
+
},
|
|
89
|
+
"gemini-3.5-flash": {
|
|
90
|
+
off: "gemini-3.5-flash-extra-low",
|
|
91
|
+
routing: {
|
|
92
|
+
minimal: "gemini-3.5-flash-extra-low",
|
|
93
|
+
low: "gemini-3.5-flash-extra-low",
|
|
94
|
+
medium: "gemini-3.5-flash-low",
|
|
95
|
+
high: "gemini-3-flash-agent",
|
|
96
|
+
xhigh: "gemini-3-flash-agent",
|
|
97
|
+
},
|
|
98
|
+
defaultRequestId: "gemini-3.5-flash-extra-low",
|
|
99
|
+
},
|
|
100
|
+
"gpt-oss-120b": {
|
|
101
|
+
off: "gpt-oss-120b-medium",
|
|
102
|
+
routing: {
|
|
103
|
+
minimal: "gpt-oss-120b-medium",
|
|
104
|
+
low: "gpt-oss-120b-medium",
|
|
105
|
+
medium: "gpt-oss-120b-medium",
|
|
106
|
+
high: "gpt-oss-120b-medium",
|
|
107
|
+
},
|
|
108
|
+
defaultRequestId: "gpt-oss-120b-medium",
|
|
109
|
+
},
|
|
110
|
+
};
|
|
111
|
+
/**
|
|
112
|
+
* Verified maximum output tokens accepted by the Cloud Code Assist backend per model/runtime ID.
|
|
113
|
+
* Requesting more than these limits returns a 400 Bad Request from the API.
|
|
114
|
+
*/
|
|
115
|
+
export const RUNTIME_MAX_OUTPUT_TOKENS = {
|
|
116
|
+
"gemini-3.8-flash": 65536,
|
|
117
|
+
"gemini-3.8-flash-tiered": 65536,
|
|
118
|
+
"gemini-3.8-flash-low": 65536,
|
|
119
|
+
"gemini-3.8-flash-medium": 65536,
|
|
120
|
+
"gemini-3.8-flash-high": 65536,
|
|
121
|
+
"gemini-3.7-flash": 65536,
|
|
122
|
+
"gemini-3.7-flash-tiered": 65536,
|
|
123
|
+
// Retain rollout-era IDs for compatibility with pinned runtime overrides.
|
|
124
|
+
"gemini-3.7-flash-low": 65536,
|
|
125
|
+
"gemini-3.7-flash-medium": 65536,
|
|
126
|
+
"gemini-3.7-flash-high": 65536,
|
|
127
|
+
"gemini-3.6-flash": 65536,
|
|
128
|
+
"gemini-3.6-flash-low": 65536,
|
|
129
|
+
"gemini-3.6-flash-medium": 65536,
|
|
130
|
+
"gemini-3.6-flash-high": 65536,
|
|
131
|
+
"gemini-3.5-flash": 65536,
|
|
132
|
+
"gemini-3.5-flash-extra-low": 65536,
|
|
133
|
+
"gemini-3.5-flash-low": 65536,
|
|
134
|
+
"gemini-3-flash-agent": 65536,
|
|
135
|
+
"gemini-3.1-pro": 65535,
|
|
136
|
+
"gemini-3.1-pro-low": 65535,
|
|
137
|
+
"gemini-3.1-pro-high": 65535,
|
|
138
|
+
"gemini-pro-agent": 65535,
|
|
139
|
+
"claude-opus-4-6": 64000,
|
|
140
|
+
"claude-opus-4-6-thinking": 64000,
|
|
141
|
+
"claude-sonnet-4-6": 64000,
|
|
142
|
+
"gpt-oss-120b": 32768,
|
|
143
|
+
"gpt-oss-120b-medium": 32768,
|
|
144
|
+
};
|
|
145
|
+
export function getMaxOutputTokens(modelId, runtimeModel) {
|
|
146
|
+
if (runtimeModel && RUNTIME_MAX_OUTPUT_TOKENS[runtimeModel] !== undefined) {
|
|
147
|
+
return RUNTIME_MAX_OUTPUT_TOKENS[runtimeModel];
|
|
148
|
+
}
|
|
149
|
+
if (RUNTIME_MAX_OUTPUT_TOKENS[modelId] !== undefined) {
|
|
150
|
+
return RUNTIME_MAX_OUTPUT_TOKENS[modelId];
|
|
151
|
+
}
|
|
152
|
+
if (runtimeModel) {
|
|
153
|
+
if (runtimeModel.startsWith("claude-"))
|
|
154
|
+
return 64000;
|
|
155
|
+
if (runtimeModel.startsWith("gpt-oss-"))
|
|
156
|
+
return 32768;
|
|
157
|
+
if (runtimeModel.startsWith("gemini-3.1-pro") || runtimeModel === "gemini-pro-agent")
|
|
158
|
+
return 65535;
|
|
159
|
+
if (runtimeModel.startsWith("gemini-"))
|
|
160
|
+
return 65536;
|
|
161
|
+
}
|
|
162
|
+
return 8192;
|
|
163
|
+
}
|
|
164
|
+
const geminiFlashCost = { input: 0.1, output: 0.4, cacheRead: 0.025, cacheWrite: 0.1 };
|
|
165
|
+
const geminiProCost = { input: 1.25, output: 5.0, cacheRead: 0.3125, cacheWrite: 1.25 };
|
|
166
|
+
const claudeSonnetCost = { input: 3.0, output: 15.0, cacheRead: 0.3, cacheWrite: 3.75 };
|
|
167
|
+
const claudeOpusCost = { input: 15.0, output: 75.0, cacheRead: 1.5, cacheWrite: 18.75 };
|
|
168
|
+
const gptOssCost = { input: 0.6, output: 2.4, cacheRead: 0.15, cacheWrite: 0.6 };
|
|
169
|
+
// A null entry is intentionally hidden by Pi. Do not collapse levels that happen to
|
|
170
|
+
// route to the same runtime ID: the UI must reflect the levels the backend advertises.
|
|
171
|
+
const thinkingLevelMaps = {
|
|
172
|
+
lowMediumHigh: {
|
|
173
|
+
off: null,
|
|
174
|
+
minimal: null,
|
|
175
|
+
low: "low",
|
|
176
|
+
medium: "medium",
|
|
177
|
+
high: "high",
|
|
178
|
+
xhigh: null,
|
|
179
|
+
max: null,
|
|
180
|
+
},
|
|
181
|
+
lowHigh: {
|
|
182
|
+
off: null,
|
|
183
|
+
minimal: null,
|
|
184
|
+
low: "low",
|
|
185
|
+
medium: null,
|
|
186
|
+
high: "high",
|
|
187
|
+
xhigh: null,
|
|
188
|
+
max: null,
|
|
189
|
+
},
|
|
190
|
+
thinking: {
|
|
191
|
+
off: null,
|
|
192
|
+
minimal: null,
|
|
193
|
+
low: null,
|
|
194
|
+
medium: null,
|
|
195
|
+
high: "high",
|
|
196
|
+
xhigh: null,
|
|
197
|
+
max: null,
|
|
198
|
+
},
|
|
199
|
+
medium: {
|
|
200
|
+
off: null,
|
|
201
|
+
minimal: null,
|
|
202
|
+
low: null,
|
|
203
|
+
medium: "medium",
|
|
204
|
+
high: null,
|
|
205
|
+
xhigh: null,
|
|
206
|
+
max: null,
|
|
207
|
+
},
|
|
208
|
+
};
|
|
209
|
+
/** Same set as `agy models`, collapsed to public Pi model IDs. */
|
|
210
|
+
export const ANTIGRAVITY_MODELS = [
|
|
211
|
+
{
|
|
212
|
+
id: "gemini-3.8-flash",
|
|
213
|
+
name: "Gemini 3.8 Flash (Antigravity)",
|
|
214
|
+
reasoning: true,
|
|
215
|
+
thinkingLevelMap: thinkingLevelMaps.lowMediumHigh,
|
|
216
|
+
input: ["text", "image"],
|
|
217
|
+
cost: geminiFlashCost,
|
|
218
|
+
contextWindow: 1048576,
|
|
219
|
+
maxTokens: 65536,
|
|
220
|
+
},
|
|
221
|
+
{
|
|
222
|
+
id: "gemini-3.7-flash",
|
|
223
|
+
name: "Gemini 3.7 Flash (Antigravity)",
|
|
224
|
+
reasoning: true,
|
|
225
|
+
thinkingLevelMap: thinkingLevelMaps.lowMediumHigh,
|
|
226
|
+
input: ["text", "image"],
|
|
227
|
+
cost: geminiFlashCost,
|
|
228
|
+
contextWindow: 1048576,
|
|
229
|
+
maxTokens: 65536,
|
|
230
|
+
},
|
|
231
|
+
{
|
|
232
|
+
id: "gemini-3.6-flash",
|
|
233
|
+
name: "Gemini 3.6 Flash (Antigravity)",
|
|
234
|
+
reasoning: true,
|
|
235
|
+
thinkingLevelMap: thinkingLevelMaps.lowMediumHigh,
|
|
236
|
+
input: ["text", "image"],
|
|
237
|
+
cost: geminiFlashCost,
|
|
238
|
+
contextWindow: 1048576,
|
|
239
|
+
maxTokens: 65536,
|
|
240
|
+
},
|
|
241
|
+
{
|
|
242
|
+
id: "claude-opus-4-6",
|
|
243
|
+
name: "Claude Opus 4.6 (Antigravity)",
|
|
244
|
+
reasoning: true,
|
|
245
|
+
thinkingLevelMap: thinkingLevelMaps.thinking,
|
|
246
|
+
input: ["text", "image"],
|
|
247
|
+
cost: claudeOpusCost,
|
|
248
|
+
contextWindow: 250000,
|
|
249
|
+
maxTokens: 64000,
|
|
250
|
+
},
|
|
251
|
+
{
|
|
252
|
+
id: "claude-sonnet-4-6",
|
|
253
|
+
name: "Claude Sonnet 4.6 (Antigravity)",
|
|
254
|
+
reasoning: true,
|
|
255
|
+
thinkingLevelMap: thinkingLevelMaps.thinking,
|
|
256
|
+
input: ["text", "image"],
|
|
257
|
+
cost: claudeSonnetCost,
|
|
258
|
+
contextWindow: 200000,
|
|
259
|
+
maxTokens: 64000,
|
|
260
|
+
},
|
|
261
|
+
{
|
|
262
|
+
id: "gemini-3.1-pro",
|
|
263
|
+
name: "Gemini 3.1 Pro (Antigravity)",
|
|
264
|
+
reasoning: true,
|
|
265
|
+
thinkingLevelMap: thinkingLevelMaps.lowHigh,
|
|
266
|
+
input: ["text", "image"],
|
|
267
|
+
cost: geminiProCost,
|
|
268
|
+
contextWindow: 1048576,
|
|
269
|
+
maxTokens: 65535,
|
|
270
|
+
},
|
|
271
|
+
{
|
|
272
|
+
id: "gemini-3.5-flash",
|
|
273
|
+
name: "Gemini 3.5 Flash (Antigravity)",
|
|
274
|
+
reasoning: true,
|
|
275
|
+
thinkingLevelMap: thinkingLevelMaps.lowMediumHigh,
|
|
276
|
+
input: ["text", "image"],
|
|
277
|
+
cost: geminiFlashCost,
|
|
278
|
+
contextWindow: 1048576,
|
|
279
|
+
maxTokens: 65536,
|
|
280
|
+
},
|
|
281
|
+
{
|
|
282
|
+
id: "gpt-oss-120b",
|
|
283
|
+
name: "GPT-OSS 120B (Antigravity)",
|
|
284
|
+
reasoning: true,
|
|
285
|
+
thinkingLevelMap: thinkingLevelMaps.medium,
|
|
286
|
+
input: ["text"],
|
|
287
|
+
cost: gptOssCost,
|
|
288
|
+
contextWindow: 131072,
|
|
289
|
+
maxTokens: 32768,
|
|
290
|
+
},
|
|
291
|
+
];
|
|
292
|
+
/** Resolve public model id + thinking effort to Antigravity runtime model id. */
|
|
293
|
+
export function getAntigravityRequestModelId(modelId, effort) {
|
|
294
|
+
const r = ANTIGRAVITY_ROUTING[modelId];
|
|
295
|
+
if (!r)
|
|
296
|
+
return modelId;
|
|
297
|
+
if (effort === undefined || effort === "off") {
|
|
298
|
+
return r.off ?? r.routing?.minimal ?? r.routing?.low ?? r.defaultRequestId ?? modelId;
|
|
299
|
+
}
|
|
300
|
+
const effortKey = effort;
|
|
301
|
+
if (effortKey === ThinkingEffort.Xhigh) {
|
|
302
|
+
return (r.routing?.xhigh ??
|
|
303
|
+
r.routing?.high ??
|
|
304
|
+
r.routing?.low ??
|
|
305
|
+
r.routing?.minimal ??
|
|
306
|
+
r.off ??
|
|
307
|
+
r.defaultRequestId ??
|
|
308
|
+
modelId);
|
|
309
|
+
}
|
|
310
|
+
return (r.routing?.[effortKey] ??
|
|
311
|
+
r.routing?.low ??
|
|
312
|
+
r.routing?.minimal ??
|
|
313
|
+
r.off ??
|
|
314
|
+
r.defaultRequestId ??
|
|
315
|
+
modelId);
|
|
316
|
+
}
|
|
317
|
+
/**
|
|
318
|
+
* If a next-gen model (e.g. Gemini 3.7 Flash) is not yet available on the backend,
|
|
319
|
+
* provide a fallback runtime model ID (e.g. Gemini 3.6 Flash) to maintain availability.
|
|
320
|
+
*/
|
|
321
|
+
export function getFallbackRuntimeModel(runtimeModel, effort) {
|
|
322
|
+
if (runtimeModel === "gemini-3.8-flash-tiered") {
|
|
323
|
+
return getAntigravityRequestModelId("gemini-3.7-flash", effort);
|
|
324
|
+
}
|
|
325
|
+
if (runtimeModel.startsWith("gemini-3.8-flash-")) {
|
|
326
|
+
return runtimeModel.replace("gemini-3.8-flash-", "gemini-3.7-flash-");
|
|
327
|
+
}
|
|
328
|
+
if (runtimeModel === "gemini-3.8-flash") {
|
|
329
|
+
return "gemini-3.7-flash-low";
|
|
330
|
+
}
|
|
331
|
+
if (runtimeModel === "gemini-3.7-flash-tiered") {
|
|
332
|
+
return getAntigravityRequestModelId("gemini-3.6-flash", effort);
|
|
333
|
+
}
|
|
334
|
+
if (runtimeModel.startsWith("gemini-3.7-flash-")) {
|
|
335
|
+
return runtimeModel.replace("gemini-3.7-flash-", "gemini-3.6-flash-");
|
|
336
|
+
}
|
|
337
|
+
if (runtimeModel === "gemini-3.7-flash") {
|
|
338
|
+
return "gemini-3.6-flash-low";
|
|
339
|
+
}
|
|
340
|
+
return undefined;
|
|
341
|
+
}
|
|
342
|
+
export const ANTIGRAVITY_MODEL_ENUM = {
|
|
343
|
+
"gemini-3.5-flash-extra-low": "MODEL_PLACEHOLDER_M187",
|
|
344
|
+
"gemini-3.5-flash-low": "MODEL_PLACEHOLDER_M20",
|
|
345
|
+
"gemini-3-flash-agent": "MODEL_PLACEHOLDER_M132",
|
|
346
|
+
"gemini-3.1-pro-low": "MODEL_PLACEHOLDER_M36",
|
|
347
|
+
"gemini-pro-agent": "MODEL_PLACEHOLDER_M16",
|
|
348
|
+
};
|
|
349
|
+
function googleLevel(effort) {
|
|
350
|
+
if (effort === "high" || effort === "xhigh")
|
|
351
|
+
return "HIGH";
|
|
352
|
+
if (effort === "medium")
|
|
353
|
+
return "MEDIUM";
|
|
354
|
+
return "LOW";
|
|
355
|
+
}
|
|
356
|
+
export function getThinkingConfig(modelId, effort) {
|
|
357
|
+
if (modelId === "gemini-3.7-flash" ||
|
|
358
|
+
modelId === "gemini-3.6-flash" ||
|
|
359
|
+
modelId === "gemini-3.8-flash") {
|
|
360
|
+
return { includeThoughts: true, thinkingLevel: googleLevel(effort) };
|
|
361
|
+
}
|
|
362
|
+
if (modelId === "gemini-3.5-flash") {
|
|
363
|
+
if (!effort || effort === "off")
|
|
364
|
+
return { includeThoughts: false, thinkingBudget: 0 };
|
|
365
|
+
const thinkingBudget = effort === "high" || effort === "xhigh" ? 10_000 : effort === "medium" ? 4_000 : 1_000;
|
|
366
|
+
return { includeThoughts: true, thinkingBudget };
|
|
367
|
+
}
|
|
368
|
+
if (modelId === "gemini-3.1-pro") {
|
|
369
|
+
if (!effort || effort === "off")
|
|
370
|
+
return { includeThoughts: false, thinkingBudget: 0 };
|
|
371
|
+
return {
|
|
372
|
+
includeThoughts: true,
|
|
373
|
+
thinkingBudget: effort === "high" || effort === "xhigh" ? 10_001 : 1_001,
|
|
374
|
+
};
|
|
375
|
+
}
|
|
376
|
+
return undefined;
|
|
377
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./stream.js";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./stream.js";
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { type Api, type AssistantMessage, type AssistantMessageEventStream, type Context, type Model, type Tool } from "@earendil-works/pi-ai";
|
|
2
|
+
import { StopReason } from "../types/enums.js";
|
|
3
|
+
import { ANTIGRAVITY_API, type AntigravityGenerateRequest, type AntigravityStreamOptions, type GeminiContent, type GeminiFunctionDeclaration } from "../types/types.js";
|
|
4
|
+
import { type AntigravitySessionState } from "../utils/util.js";
|
|
5
|
+
export { ANTIGRAVITY_API };
|
|
6
|
+
/** Exported for unit tests. */
|
|
7
|
+
export declare function convertMessages(model: Model<Api>, context: Context, runtimeModel: string): GeminiContent[];
|
|
8
|
+
/**
|
|
9
|
+
* Gemini accepts JSON Schema through parametersJsonSchema. Claude and GPT-OSS
|
|
10
|
+
* use Cloud Code Assist's custom-tool bridge, which requires a compatible
|
|
11
|
+
* Draft 2020-12 subset in the legacy parameters field.
|
|
12
|
+
*/
|
|
13
|
+
export declare function convertTools(tools: Tool[] | undefined, useLegacyParameters?: boolean): {
|
|
14
|
+
functionDeclarations: GeminiFunctionDeclaration[];
|
|
15
|
+
}[] | undefined;
|
|
16
|
+
/** Exported for unit tests. */
|
|
17
|
+
export declare function buildRequest(model: Model<Api>, context: Context, projectId: string, options: AntigravityStreamOptions, runtimeModel: string, sessionState?: AntigravitySessionState): AntigravityGenerateRequest;
|
|
18
|
+
/** Exported for unit tests. */
|
|
19
|
+
export declare function mapStopReason(reason: string | undefined): StopReason;
|
|
20
|
+
/** Exported for unit tests. */
|
|
21
|
+
export declare function friendlyAntigravityError(status: number | undefined, text: string): string;
|
|
22
|
+
/** Exported for unit tests. */
|
|
23
|
+
export declare function streamResponse(response: Response, stream: AssistantMessageEventStream, output: AssistantMessage, model?: Model<Api>, sessionState?: AntigravitySessionState): Promise<boolean>;
|
|
24
|
+
export declare function streamAntigravity(model: Model<Api>, context: Context, options?: AntigravityStreamOptions): AssistantMessageEventStream;
|