@heyhuynhgiabuu/pi-oauth-antigravity 0.1.5 → 0.1.7
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 +16 -0
- package/README.md +12 -2
- package/dist/client/client.js +0 -9
- package/dist/image/image.d.ts +1 -1
- package/dist/image/image.js +2 -2
- package/dist/index.js +1 -1
- package/dist/models/models.d.ts +13 -4
- package/dist/models/models.js +111 -39
- package/dist/stream/provider-helpers.d.ts +4 -0
- package/dist/stream/provider-helpers.js +149 -0
- package/dist/stream/stream.d.ts +1 -1
- package/dist/stream/stream.js +106 -36
- package/package.json +4 -5
package/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,22 @@ All notable changes to this project will be documented in this file.
|
|
|
5
5
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
6
6
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
7
|
|
|
8
|
+
## [Unreleased]
|
|
9
|
+
|
|
10
|
+
## [0.1.7] - 2026-10-15
|
|
11
|
+
|
|
12
|
+
### Added
|
|
13
|
+
- Claude Opus 5.5 and Claude Sonnet 5.5 (Low / Medium / High) catalog entries. Context and output limits are provisional same-family estimates.
|
|
14
|
+
- Provisional `gemini-4-argon` (Low / Medium / High) catalog entry, inferred from runtime ids referenced by Antigravity IDE 2.23.0, with fallback to Gemini 3.8 Flash when the backend rejects it. Limits and pricing are unverified.
|
|
15
|
+
|
|
16
|
+
## [0.1.6] - 2026-10-01
|
|
17
|
+
|
|
18
|
+
### Fixed
|
|
19
|
+
- Kept the provider loadable in packaged Pi runtimes by moving pi-ai subpath helpers into a local module, matched to the resolved pi-ai 0.86.0 implementation.
|
|
20
|
+
- Excluded Gemini 3.5 Flash from the selectable catalog and added a pre-stream guard for the reported retirement notice so it is not emitted as assistant text.
|
|
21
|
+
- Defaulted image generation to `gemini-3.1-flash-image` while retaining older image models as explicit fallbacks.
|
|
22
|
+
- Made image path assertions portable across Windows and POSIX systems.
|
|
23
|
+
|
|
8
24
|
## [0.1.5] - 2026-09-26
|
|
9
25
|
|
|
10
26
|
### Fixed
|
package/README.md
CHANGED
|
@@ -22,16 +22,26 @@ Google Antigravity OAuth provider extension for [Pi](https://pi.dev). Connects P
|
|
|
22
22
|
|
|
23
23
|
| Public Model ID | Backend Wire ID | Max Output | Context Window |
|
|
24
24
|
| :--- | :--- | :--- | :--- |
|
|
25
|
+
| `antigravity/gemini-4-argon` | `gemini-4-argon-{low,medium,high}`† | 65,536† | 1,048,576† |
|
|
25
26
|
| `antigravity/gemini-3.8-flash` | `gemini-3.8-flash-{low,medium,high}` | 65,536 | 1,048,576 |
|
|
26
27
|
| `antigravity/gemini-3.7-flash` | `gemini-3.7-flash-{low,medium,high}` | 65,536 | 1,048,576 |
|
|
27
28
|
| `antigravity/gemini-3.7-flash-thinking` | `gemini-3.7-flash-thinking` | 65,536 | 1,048,576 |
|
|
28
29
|
| `antigravity/gemini-3.6-flash` | `gemini-3.6-flash-{low,medium,high}` | 65,536 | 1,048,576 |
|
|
29
|
-
| `antigravity/gemini-3.5-flash` | `gemini-3.5-flash` | 8,192 | 1,048,576 |
|
|
30
30
|
| `antigravity/gemini-3.1-pro` | `gemini-3.1-pro` | 65,536 | 1,048,576 |
|
|
31
|
-
| `antigravity/claude-sonnet-4-6` | `claude-sonnet-4-6` | 64,000 | 200,000 |
|
|
32
31
|
| `antigravity/claude-opus-4-6` | `claude-opus-4-6` | 64,000 | 200,000 |
|
|
32
|
+
| `antigravity/claude-opus-5-5-low` | `claude-opus-5-5-low` | 64,000* | 250,000* |
|
|
33
|
+
| `antigravity/claude-opus-5-5-medium` | `claude-opus-5-5-medium` | 64,000* | 250,000* |
|
|
34
|
+
| `antigravity/claude-opus-5-5-high` | `claude-opus-5-5-high` | 64,000* | 250,000* |
|
|
35
|
+
| `antigravity/claude-sonnet-4-6` | `claude-sonnet-4-6` | 64,000 | 200,000 |
|
|
36
|
+
| `antigravity/claude-sonnet-5-5-low` | `claude-sonnet-5-5-low` | 64,000* | 200,000* |
|
|
37
|
+
| `antigravity/claude-sonnet-5-5-medium` | `claude-sonnet-5-5-medium` | 64,000* | 200,000* |
|
|
38
|
+
| `antigravity/claude-sonnet-5-5-high` | `claude-sonnet-5-5-high` | 64,000* | 200,000* |
|
|
33
39
|
| `antigravity/gpt-oss-120b` | `gpt-oss-120b` | 8,192 | 131,072 |
|
|
34
40
|
|
|
41
|
+
† Inferred from runtime ids referenced by Antigravity IDE 2.23.0, not yet confirmed against a live model listing; limits and pricing are provisional, and requests fall back to Gemini 3.8 Flash if the backend rejects the model.
|
|
42
|
+
|
|
43
|
+
\* Provisional same-family estimates only; Claude 5.5 backend output/context limits have not been verified.
|
|
44
|
+
|
|
35
45
|
## Installation
|
|
36
46
|
|
|
37
47
|
Install directly into Pi via npm:
|
package/dist/client/client.js
CHANGED
|
@@ -208,9 +208,6 @@ function buildModelMatchRegex(requestedId) {
|
|
|
208
208
|
// gemini-3.6-flash-low → "Gemini 3.6 Flash (Low)"
|
|
209
209
|
// gemini-3.6-flash-medium → "Gemini 3.6 Flash (Medium)"
|
|
210
210
|
// gemini-3.6-flash-high → "Gemini 3.6 Flash (High)"
|
|
211
|
-
// gemini-3.5-flash-extra-low → "Gemini 3.5 Flash (Low)"
|
|
212
|
-
// gemini-3.5-flash-low → "Gemini 3.5 Flash (Medium)"
|
|
213
|
-
// gemini-3-flash-agent → "Gemini 3.5 Flash (High)"
|
|
214
211
|
if (req === "gemini-3.8-flash-low")
|
|
215
212
|
return /gemini[- ]3\.8[- ]flash \(low\)/i;
|
|
216
213
|
if (req === "gemini-3.8-flash-medium")
|
|
@@ -229,12 +226,6 @@ function buildModelMatchRegex(requestedId) {
|
|
|
229
226
|
return /gemini[- ]3\.6[- ]flash \(medium\)/i;
|
|
230
227
|
if (req === "gemini-3.6-flash-high")
|
|
231
228
|
return /gemini[- ]3\.6[- ]flash \(high\)/i;
|
|
232
|
-
if (req === "gemini-3.5-flash-extra-low")
|
|
233
|
-
return /gemini[- ]3\.5[- ]flash \(low\)/i;
|
|
234
|
-
if (req === "gemini-3.5-flash-low" || req === "gemini-3.5-flash-medium")
|
|
235
|
-
return /gemini[- ]3\.5[- ]flash \(medium\)/i;
|
|
236
|
-
if (req === "gemini-3.5-flash-high" || req === "gemini-3-flash-agent")
|
|
237
|
-
return /gemini[- ]3\.5[- ]flash \(high\)/i;
|
|
238
229
|
if (req.includes("claude-opus-4-6"))
|
|
239
230
|
return /claude.*opus.*4\.6/i;
|
|
240
231
|
if (req.includes("claude-sonnet-4-6"))
|
package/dist/image/image.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { AntigravityRequestType, AntigravityUserAgent, GeminiRole } from "../types/enums.js";
|
|
2
|
-
export declare const DEFAULT_IMAGE_MODEL = "gemini-3-
|
|
2
|
+
export declare const DEFAULT_IMAGE_MODEL = "gemini-3.1-flash-image";
|
|
3
3
|
export declare const IMAGE_ASPECT_RATIOS: readonly ["1:1", "2:3", "3:2", "3:4", "4:3", "4:5", "5:4", "9:16", "16:9", "21:9"];
|
|
4
4
|
export type ImageAspectRatio = (typeof IMAGE_ASPECT_RATIOS)[number];
|
|
5
5
|
export type GeneratedImage = {
|
package/dist/image/image.js
CHANGED
|
@@ -5,7 +5,7 @@ import { AntigravityRequestType, AntigravityUserAgent, GeminiRole } from "../typ
|
|
|
5
5
|
import { antigravityFetch } from "../utils/http.js";
|
|
6
6
|
import { safeError } from "../utils/security.js";
|
|
7
7
|
import { antigravityRequestEnvelope, sanitizeText } from "../utils/util.js";
|
|
8
|
-
export const DEFAULT_IMAGE_MODEL = "gemini-3-
|
|
8
|
+
export const DEFAULT_IMAGE_MODEL = "gemini-3.1-flash-image";
|
|
9
9
|
export const IMAGE_ASPECT_RATIOS = [
|
|
10
10
|
"1:1",
|
|
11
11
|
"2:3",
|
|
@@ -20,7 +20,7 @@ export const IMAGE_ASPECT_RATIOS = [
|
|
|
20
20
|
];
|
|
21
21
|
const IMAGE_MODEL_FALLBACKS = [
|
|
22
22
|
DEFAULT_IMAGE_MODEL,
|
|
23
|
-
"gemini-3
|
|
23
|
+
"gemini-3-pro-image",
|
|
24
24
|
"gemini-3-pro-image-preview",
|
|
25
25
|
];
|
|
26
26
|
const IMAGE_SYSTEM_INSTRUCTION = "You are an AI image generator. Generate images based on user descriptions. Focus on creating high-quality, visually appealing images that match the user's request.";
|
package/dist/index.js
CHANGED
|
@@ -102,7 +102,7 @@ export default function (pi) {
|
|
|
102
102
|
handler: async (args, ctx) => {
|
|
103
103
|
const parsed = parseImageCommandArgs(args || "");
|
|
104
104
|
if (!parsed.prompt) {
|
|
105
|
-
emitCommandOutput(ctx, "Usage: /antigravity.image [--ratio 16:9] [--model gemini-3-
|
|
105
|
+
emitCommandOutput(ctx, "Usage: /antigravity.image [--ratio 16:9] [--model gemini-3.1-flash-image] [--path file.png] <prompt>", "warning");
|
|
106
106
|
return;
|
|
107
107
|
}
|
|
108
108
|
try {
|
package/dist/models/models.d.ts
CHANGED
|
@@ -6,17 +6,26 @@ export declare const PROVIDER_NAME = "Antigravity";
|
|
|
6
6
|
* Public selectable model IDs → backend request model IDs by thinking effort.
|
|
7
7
|
*
|
|
8
8
|
* Catalog mirrors `agy models` (Antigravity CLI), which currently advertises:
|
|
9
|
+
* - Gemini 4 Argon (Low / Medium / High) — provisional, see below
|
|
9
10
|
* - Gemini 3.8 Flash (Low / Medium / High)
|
|
10
11
|
* - Gemini 3.7 Flash (Low / Medium / High)
|
|
11
12
|
* - Gemini 3.6 Flash (Low / Medium / High)
|
|
12
|
-
* - Gemini 3.5 Flash (Low / Medium / High)
|
|
13
13
|
* - Gemini 3.1 Pro (Low / High)
|
|
14
14
|
* - Claude Sonnet 4.6 (Thinking)
|
|
15
15
|
* - Claude Opus 4.6 (Thinking)
|
|
16
|
+
* - Claude Opus 5.5 (Low / Medium / High)
|
|
17
|
+
* - Claude Sonnet 5.5 (Low / Medium / High)
|
|
16
18
|
* - GPT-OSS 120B (Medium)
|
|
17
19
|
*
|
|
18
|
-
*
|
|
19
|
-
*
|
|
20
|
+
* Gemini 4 Argon is inferred from runtime ids referenced by Antigravity IDE 2.23.0
|
|
21
|
+
* (`gemini-4-argon-{low,medium,high}`); it is not yet confirmed against a live
|
|
22
|
+
* `fetchAvailableModels` or `agy models` listing, so its limits and pricing are
|
|
23
|
+
* provisional and requests fall back to Gemini 3.8 Flash when the backend rejects it.
|
|
24
|
+
*
|
|
25
|
+
* Gemini 3.5 Flash is intentionally omitted from the selectable catalog; the
|
|
26
|
+
* stream handler recognizes the reported retirement notice for old model IDs.
|
|
27
|
+
* Pi exposes the remaining models as public IDs and surfaces the exact thinking
|
|
28
|
+
* levels advertised by the backend for each model.
|
|
20
29
|
*/
|
|
21
30
|
export declare const ANTIGRAVITY_ROUTING: Record<string, AntigravityRouting>;
|
|
22
31
|
/**
|
|
@@ -25,7 +34,7 @@ export declare const ANTIGRAVITY_ROUTING: Record<string, AntigravityRouting>;
|
|
|
25
34
|
*/
|
|
26
35
|
export declare const RUNTIME_MAX_OUTPUT_TOKENS: Record<string, number>;
|
|
27
36
|
export declare function getMaxOutputTokens(modelId: string, runtimeModel?: string): number;
|
|
28
|
-
/**
|
|
37
|
+
/** Selectable provider models; effort variants share public IDs where routing supports them. */
|
|
29
38
|
export declare const ANTIGRAVITY_MODELS: ProviderModelConfig[];
|
|
30
39
|
/** Resolve public model id + thinking effort to Antigravity runtime model id. */
|
|
31
40
|
export declare function getAntigravityRequestModelId(modelId: string, effort: string | undefined): string;
|
package/dist/models/models.js
CHANGED
|
@@ -5,19 +5,39 @@ export const PROVIDER_NAME = "Antigravity";
|
|
|
5
5
|
* Public selectable model IDs → backend request model IDs by thinking effort.
|
|
6
6
|
*
|
|
7
7
|
* Catalog mirrors `agy models` (Antigravity CLI), which currently advertises:
|
|
8
|
+
* - Gemini 4 Argon (Low / Medium / High) — provisional, see below
|
|
8
9
|
* - Gemini 3.8 Flash (Low / Medium / High)
|
|
9
10
|
* - Gemini 3.7 Flash (Low / Medium / High)
|
|
10
11
|
* - Gemini 3.6 Flash (Low / Medium / High)
|
|
11
|
-
* - Gemini 3.5 Flash (Low / Medium / High)
|
|
12
12
|
* - Gemini 3.1 Pro (Low / High)
|
|
13
13
|
* - Claude Sonnet 4.6 (Thinking)
|
|
14
14
|
* - Claude Opus 4.6 (Thinking)
|
|
15
|
+
* - Claude Opus 5.5 (Low / Medium / High)
|
|
16
|
+
* - Claude Sonnet 5.5 (Low / Medium / High)
|
|
15
17
|
* - GPT-OSS 120B (Medium)
|
|
16
18
|
*
|
|
17
|
-
*
|
|
18
|
-
*
|
|
19
|
+
* Gemini 4 Argon is inferred from runtime ids referenced by Antigravity IDE 2.23.0
|
|
20
|
+
* (`gemini-4-argon-{low,medium,high}`); it is not yet confirmed against a live
|
|
21
|
+
* `fetchAvailableModels` or `agy models` listing, so its limits and pricing are
|
|
22
|
+
* provisional and requests fall back to Gemini 3.8 Flash when the backend rejects it.
|
|
23
|
+
*
|
|
24
|
+
* Gemini 3.5 Flash is intentionally omitted from the selectable catalog; the
|
|
25
|
+
* stream handler recognizes the reported retirement notice for old model IDs.
|
|
26
|
+
* Pi exposes the remaining models as public IDs and surfaces the exact thinking
|
|
27
|
+
* levels advertised by the backend for each model.
|
|
19
28
|
*/
|
|
20
29
|
export const ANTIGRAVITY_ROUTING = {
|
|
30
|
+
"gemini-4-argon": {
|
|
31
|
+
off: "gemini-4-argon-low",
|
|
32
|
+
routing: {
|
|
33
|
+
minimal: "gemini-4-argon-low",
|
|
34
|
+
low: "gemini-4-argon-low",
|
|
35
|
+
medium: "gemini-4-argon-medium",
|
|
36
|
+
high: "gemini-4-argon-high",
|
|
37
|
+
xhigh: "gemini-4-argon-high",
|
|
38
|
+
},
|
|
39
|
+
defaultRequestId: "gemini-4-argon-low",
|
|
40
|
+
},
|
|
21
41
|
"gemini-3.8-flash": {
|
|
22
42
|
off: "gemini-3.8-flash-low",
|
|
23
43
|
routing: {
|
|
@@ -38,6 +58,30 @@ export const ANTIGRAVITY_ROUTING = {
|
|
|
38
58
|
},
|
|
39
59
|
defaultRequestId: "claude-opus-4-6-thinking",
|
|
40
60
|
},
|
|
61
|
+
"claude-opus-5-5-low": {
|
|
62
|
+
routing: { low: "claude-opus-5-5-low" },
|
|
63
|
+
defaultRequestId: "claude-opus-5-5-low",
|
|
64
|
+
},
|
|
65
|
+
"claude-opus-5-5-medium": {
|
|
66
|
+
routing: { medium: "claude-opus-5-5-medium" },
|
|
67
|
+
defaultRequestId: "claude-opus-5-5-medium",
|
|
68
|
+
},
|
|
69
|
+
"claude-opus-5-5-high": {
|
|
70
|
+
routing: { high: "claude-opus-5-5-high" },
|
|
71
|
+
defaultRequestId: "claude-opus-5-5-high",
|
|
72
|
+
},
|
|
73
|
+
"claude-sonnet-5-5-low": {
|
|
74
|
+
routing: { low: "claude-sonnet-5-5-low" },
|
|
75
|
+
defaultRequestId: "claude-sonnet-5-5-low",
|
|
76
|
+
},
|
|
77
|
+
"claude-sonnet-5-5-medium": {
|
|
78
|
+
routing: { medium: "claude-sonnet-5-5-medium" },
|
|
79
|
+
defaultRequestId: "claude-sonnet-5-5-medium",
|
|
80
|
+
},
|
|
81
|
+
"claude-sonnet-5-5-high": {
|
|
82
|
+
routing: { high: "claude-sonnet-5-5-high" },
|
|
83
|
+
defaultRequestId: "claude-sonnet-5-5-high",
|
|
84
|
+
},
|
|
41
85
|
// Live fetchAvailableModels exposes `claude-sonnet-4-6` (display: Thinking), not a separate *-thinking id.
|
|
42
86
|
"claude-sonnet-4-6": {
|
|
43
87
|
off: "claude-sonnet-4-6",
|
|
@@ -86,17 +130,6 @@ export const ANTIGRAVITY_ROUTING = {
|
|
|
86
130
|
},
|
|
87
131
|
defaultRequestId: "gemini-3.6-flash-low",
|
|
88
132
|
},
|
|
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
133
|
"gpt-oss-120b": {
|
|
101
134
|
off: "gpt-oss-120b-medium",
|
|
102
135
|
routing: {
|
|
@@ -113,6 +146,11 @@ export const ANTIGRAVITY_ROUTING = {
|
|
|
113
146
|
* Requesting more than these limits returns a 400 Bad Request from the API.
|
|
114
147
|
*/
|
|
115
148
|
export const RUNTIME_MAX_OUTPUT_TOKENS = {
|
|
149
|
+
// Provisional: family fallback, not a verified Gemini 4 limit.
|
|
150
|
+
"gemini-4-argon": 65536,
|
|
151
|
+
"gemini-4-argon-low": 65536,
|
|
152
|
+
"gemini-4-argon-medium": 65536,
|
|
153
|
+
"gemini-4-argon-high": 65536,
|
|
116
154
|
"gemini-3.8-flash": 65536,
|
|
117
155
|
"gemini-3.8-flash-tiered": 65536,
|
|
118
156
|
"gemini-3.8-flash-low": 65536,
|
|
@@ -128,10 +166,6 @@ export const RUNTIME_MAX_OUTPUT_TOKENS = {
|
|
|
128
166
|
"gemini-3.6-flash-low": 65536,
|
|
129
167
|
"gemini-3.6-flash-medium": 65536,
|
|
130
168
|
"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
169
|
"gemini-3.1-pro": 65535,
|
|
136
170
|
"gemini-3.1-pro-low": 65535,
|
|
137
171
|
"gemini-3.1-pro-high": 65535,
|
|
@@ -150,6 +184,7 @@ export function getMaxOutputTokens(modelId, runtimeModel) {
|
|
|
150
184
|
return RUNTIME_MAX_OUTPUT_TOKENS[modelId];
|
|
151
185
|
}
|
|
152
186
|
if (runtimeModel) {
|
|
187
|
+
// Unlisted Claude models use a family fallback, not a verified per-model limit.
|
|
153
188
|
if (runtimeModel.startsWith("claude-"))
|
|
154
189
|
return 64000;
|
|
155
190
|
if (runtimeModel.startsWith("gpt-oss-"))
|
|
@@ -196,6 +231,15 @@ const thinkingLevelMaps = {
|
|
|
196
231
|
xhigh: null,
|
|
197
232
|
max: null,
|
|
198
233
|
},
|
|
234
|
+
low: {
|
|
235
|
+
off: null,
|
|
236
|
+
minimal: null,
|
|
237
|
+
low: "low",
|
|
238
|
+
medium: null,
|
|
239
|
+
high: null,
|
|
240
|
+
xhigh: null,
|
|
241
|
+
max: null,
|
|
242
|
+
},
|
|
199
243
|
medium: {
|
|
200
244
|
off: null,
|
|
201
245
|
minimal: null,
|
|
@@ -206,8 +250,46 @@ const thinkingLevelMaps = {
|
|
|
206
250
|
max: null,
|
|
207
251
|
},
|
|
208
252
|
};
|
|
209
|
-
|
|
253
|
+
const claude55ThinkingLevelMaps = {
|
|
254
|
+
low: thinkingLevelMaps.low,
|
|
255
|
+
medium: thinkingLevelMaps.medium,
|
|
256
|
+
high: thinkingLevelMaps.thinking,
|
|
257
|
+
};
|
|
258
|
+
/**
|
|
259
|
+
* Use existing same-family values as provisional estimates only; 5.5-specific
|
|
260
|
+
* cost, context-window, and output-token metadata has not been verified.
|
|
261
|
+
*/
|
|
262
|
+
function claude55Models(family) {
|
|
263
|
+
const familyName = family === "opus" ? "Opus" : "Sonnet";
|
|
264
|
+
const cost = family === "opus" ? claudeOpusCost : claudeSonnetCost;
|
|
265
|
+
const contextWindow = family === "opus" ? 250000 : 200000;
|
|
266
|
+
return ["low", "medium", "high"].map((tier) => {
|
|
267
|
+
const tierName = `${tier[0].toUpperCase()}${tier.slice(1)}`;
|
|
268
|
+
return {
|
|
269
|
+
id: `claude-${family}-5-5-${tier}`,
|
|
270
|
+
name: `Claude ${familyName} 5.5 (${tierName}) (Antigravity)`,
|
|
271
|
+
reasoning: true,
|
|
272
|
+
thinkingLevelMap: claude55ThinkingLevelMaps[tier],
|
|
273
|
+
input: ["text", "image"],
|
|
274
|
+
cost,
|
|
275
|
+
contextWindow,
|
|
276
|
+
maxTokens: 64000,
|
|
277
|
+
};
|
|
278
|
+
});
|
|
279
|
+
}
|
|
280
|
+
/** Selectable provider models; effort variants share public IDs where routing supports them. */
|
|
210
281
|
export const ANTIGRAVITY_MODELS = [
|
|
282
|
+
{
|
|
283
|
+
// Provisional: cost (Pro-tier estimate), context window, and max output are unverified.
|
|
284
|
+
id: "gemini-4-argon",
|
|
285
|
+
name: "Gemini 4 Argon (Antigravity)",
|
|
286
|
+
reasoning: true,
|
|
287
|
+
thinkingLevelMap: thinkingLevelMaps.lowMediumHigh,
|
|
288
|
+
input: ["text", "image"],
|
|
289
|
+
cost: geminiProCost,
|
|
290
|
+
contextWindow: 1048576,
|
|
291
|
+
maxTokens: 65536,
|
|
292
|
+
},
|
|
211
293
|
{
|
|
212
294
|
id: "gemini-3.8-flash",
|
|
213
295
|
name: "Gemini 3.8 Flash (Antigravity)",
|
|
@@ -248,6 +330,8 @@ export const ANTIGRAVITY_MODELS = [
|
|
|
248
330
|
contextWindow: 250000,
|
|
249
331
|
maxTokens: 64000,
|
|
250
332
|
},
|
|
333
|
+
...claude55Models("opus"),
|
|
334
|
+
...claude55Models("sonnet"),
|
|
251
335
|
{
|
|
252
336
|
id: "claude-sonnet-4-6",
|
|
253
337
|
name: "Claude Sonnet 4.6 (Antigravity)",
|
|
@@ -268,16 +352,6 @@ export const ANTIGRAVITY_MODELS = [
|
|
|
268
352
|
contextWindow: 1048576,
|
|
269
353
|
maxTokens: 65535,
|
|
270
354
|
},
|
|
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
355
|
{
|
|
282
356
|
id: "gpt-oss-120b",
|
|
283
357
|
name: "GPT-OSS 120B (Antigravity)",
|
|
@@ -319,6 +393,12 @@ export function getAntigravityRequestModelId(modelId, effort) {
|
|
|
319
393
|
* provide a fallback runtime model ID (e.g. Gemini 3.6 Flash) to maintain availability.
|
|
320
394
|
*/
|
|
321
395
|
export function getFallbackRuntimeModel(runtimeModel, effort) {
|
|
396
|
+
if (runtimeModel === "gemini-4-argon") {
|
|
397
|
+
return "gemini-3.8-flash-low";
|
|
398
|
+
}
|
|
399
|
+
if (runtimeModel.startsWith("gemini-4-argon-")) {
|
|
400
|
+
return runtimeModel.replace("gemini-4-argon-", "gemini-3.8-flash-");
|
|
401
|
+
}
|
|
322
402
|
if (runtimeModel === "gemini-3.8-flash-tiered") {
|
|
323
403
|
return getAntigravityRequestModelId("gemini-3.7-flash", effort);
|
|
324
404
|
}
|
|
@@ -340,9 +420,6 @@ export function getFallbackRuntimeModel(runtimeModel, effort) {
|
|
|
340
420
|
return undefined;
|
|
341
421
|
}
|
|
342
422
|
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
423
|
"gemini-3.1-pro-low": "MODEL_PLACEHOLDER_M36",
|
|
347
424
|
"gemini-pro-agent": "MODEL_PLACEHOLDER_M16",
|
|
348
425
|
};
|
|
@@ -354,17 +431,12 @@ function googleLevel(effort) {
|
|
|
354
431
|
return "LOW";
|
|
355
432
|
}
|
|
356
433
|
export function getThinkingConfig(modelId, effort) {
|
|
357
|
-
if (modelId === "gemini-
|
|
434
|
+
if (modelId === "gemini-4-argon" ||
|
|
435
|
+
modelId === "gemini-3.7-flash" ||
|
|
358
436
|
modelId === "gemini-3.6-flash" ||
|
|
359
437
|
modelId === "gemini-3.8-flash") {
|
|
360
438
|
return { includeThoughts: true, thinkingLevel: googleLevel(effort) };
|
|
361
439
|
}
|
|
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
440
|
if (modelId === "gemini-3.1-pro") {
|
|
369
441
|
if (!effort || effort === "off")
|
|
370
442
|
return { includeThoughts: false, thinkingBudget: 0 };
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { Tool } from "@earendil-works/pi-ai";
|
|
2
|
+
export declare function getJsonSchemaToolParameters(tool: Tool, strict: boolean | undefined): unknown;
|
|
3
|
+
export declare function resolveJsonSchemaStrictSampling(tool: Tool, supportsStrictMode: boolean): boolean | undefined;
|
|
4
|
+
export declare function requiresToolCallId(modelId: string): boolean;
|
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
class UnsupportedStrictJsonSchemaError extends Error {
|
|
2
|
+
}
|
|
3
|
+
const UNSUPPORTED_STRICT_SCHEMA_KEYS = [
|
|
4
|
+
"$ref",
|
|
5
|
+
"$defs",
|
|
6
|
+
"definitions",
|
|
7
|
+
"allOf",
|
|
8
|
+
"oneOf",
|
|
9
|
+
"patternProperties",
|
|
10
|
+
"dependentSchemas",
|
|
11
|
+
"dependencies",
|
|
12
|
+
"unevaluatedProperties",
|
|
13
|
+
"propertyNames",
|
|
14
|
+
"contains",
|
|
15
|
+
"prefixItems",
|
|
16
|
+
"not",
|
|
17
|
+
"if",
|
|
18
|
+
"then",
|
|
19
|
+
"else",
|
|
20
|
+
];
|
|
21
|
+
function isJsonSchemaObject(value) {
|
|
22
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
23
|
+
}
|
|
24
|
+
function isStructuredSchema(schema) {
|
|
25
|
+
if (!isJsonSchemaObject(schema))
|
|
26
|
+
return false;
|
|
27
|
+
const types = typeof schema.type === "string" ? [schema.type] : Array.isArray(schema.type) ? schema.type : [];
|
|
28
|
+
return (types.includes("object") ||
|
|
29
|
+
types.includes("array") ||
|
|
30
|
+
schema.properties !== undefined ||
|
|
31
|
+
schema.items !== undefined);
|
|
32
|
+
}
|
|
33
|
+
function schemaAllowsNull(schema) {
|
|
34
|
+
if (!isJsonSchemaObject(schema))
|
|
35
|
+
return false;
|
|
36
|
+
if (schema.type === "null" || (Array.isArray(schema.type) && schema.type.includes("null"))) {
|
|
37
|
+
return true;
|
|
38
|
+
}
|
|
39
|
+
if (schema.const === null || (Array.isArray(schema.enum) && schema.enum.includes(null))) {
|
|
40
|
+
return true;
|
|
41
|
+
}
|
|
42
|
+
return Array.isArray(schema.anyOf) && schema.anyOf.some((variant) => schemaAllowsNull(variant));
|
|
43
|
+
}
|
|
44
|
+
function makeJsonSchemaNodeStrict(schema) {
|
|
45
|
+
if (!isJsonSchemaObject(schema)) {
|
|
46
|
+
throw new UnsupportedStrictJsonSchemaError("boolean schemas are unsupported");
|
|
47
|
+
}
|
|
48
|
+
for (const key of UNSUPPORTED_STRICT_SCHEMA_KEYS) {
|
|
49
|
+
if (schema[key] !== undefined) {
|
|
50
|
+
throw new UnsupportedStrictJsonSchemaError(`${key} schemas are unsupported`);
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
if (schema.anyOf !== undefined) {
|
|
54
|
+
if (!Array.isArray(schema.anyOf) || schema.anyOf.length === 0) {
|
|
55
|
+
throw new UnsupportedStrictJsonSchemaError("anyOf must contain at least one schema");
|
|
56
|
+
}
|
|
57
|
+
for (const variant of schema.anyOf) {
|
|
58
|
+
if (isStructuredSchema(variant)) {
|
|
59
|
+
throw new UnsupportedStrictJsonSchemaError("object and array unions are unsupported");
|
|
60
|
+
}
|
|
61
|
+
makeJsonSchemaNodeStrict(variant);
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
if (schema.items !== undefined) {
|
|
65
|
+
if (Array.isArray(schema.items)) {
|
|
66
|
+
throw new UnsupportedStrictJsonSchemaError("tuple schemas are unsupported");
|
|
67
|
+
}
|
|
68
|
+
makeJsonSchemaNodeStrict(schema.items);
|
|
69
|
+
}
|
|
70
|
+
const isObjectSchema = schema.type === "object";
|
|
71
|
+
if (schema.properties !== undefined && !isObjectSchema) {
|
|
72
|
+
throw new UnsupportedStrictJsonSchemaError("properties require type object");
|
|
73
|
+
}
|
|
74
|
+
if (!isObjectSchema)
|
|
75
|
+
return;
|
|
76
|
+
if (schema.additionalProperties !== undefined && schema.additionalProperties !== false) {
|
|
77
|
+
throw new UnsupportedStrictJsonSchemaError("schema-valued or true additionalProperties is unsupported");
|
|
78
|
+
}
|
|
79
|
+
if (schema.properties !== undefined && !isJsonSchemaObject(schema.properties)) {
|
|
80
|
+
throw new UnsupportedStrictJsonSchemaError("object properties must be a schema map");
|
|
81
|
+
}
|
|
82
|
+
if (schema.required !== undefined &&
|
|
83
|
+
(!Array.isArray(schema.required) || schema.required.some((key) => typeof key !== "string"))) {
|
|
84
|
+
throw new UnsupportedStrictJsonSchemaError("object required must be a string array");
|
|
85
|
+
}
|
|
86
|
+
const properties = (schema.properties ?? {});
|
|
87
|
+
const propertyNames = Object.keys(properties);
|
|
88
|
+
const required = new Set(Array.isArray(schema.required) ? schema.required : []);
|
|
89
|
+
if ([...required].some((key) => !propertyNames.includes(key))) {
|
|
90
|
+
throw new UnsupportedStrictJsonSchemaError("required contains an unknown property");
|
|
91
|
+
}
|
|
92
|
+
for (const [key, property] of Object.entries(properties)) {
|
|
93
|
+
makeJsonSchemaNodeStrict(property);
|
|
94
|
+
if (!required.has(key) && !schemaAllowsNull(property)) {
|
|
95
|
+
properties[key] = { anyOf: [property, { type: "null" }] };
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
schema.required = propertyNames;
|
|
99
|
+
schema.additionalProperties = false;
|
|
100
|
+
}
|
|
101
|
+
/** Convert a tool schema to the strict subset expected by pi-ai 0.86.0. */
|
|
102
|
+
function makeStrictJsonSchema(schema) {
|
|
103
|
+
const cloned = structuredClone(schema);
|
|
104
|
+
if (!isJsonSchemaObject(cloned)) {
|
|
105
|
+
throw new UnsupportedStrictJsonSchemaError("root schema must have type object");
|
|
106
|
+
}
|
|
107
|
+
makeJsonSchemaNodeStrict(cloned);
|
|
108
|
+
if (cloned.type !== "object") {
|
|
109
|
+
throw new UnsupportedStrictJsonSchemaError("root schema must have type object");
|
|
110
|
+
}
|
|
111
|
+
return cloned;
|
|
112
|
+
}
|
|
113
|
+
export function getJsonSchemaToolParameters(tool, strict) {
|
|
114
|
+
const parameters = tool.parameters;
|
|
115
|
+
if (strict !== true)
|
|
116
|
+
return parameters;
|
|
117
|
+
return makeStrictJsonSchema(parameters);
|
|
118
|
+
}
|
|
119
|
+
export function resolveJsonSchemaStrictSampling(tool, supportsStrictMode) {
|
|
120
|
+
const samplingTool = tool;
|
|
121
|
+
const config = samplingTool.constrainedSampling;
|
|
122
|
+
if (!config || config.type !== "json_schema")
|
|
123
|
+
return undefined;
|
|
124
|
+
if (supportsStrictMode) {
|
|
125
|
+
try {
|
|
126
|
+
makeStrictJsonSchema(samplingTool.parameters);
|
|
127
|
+
return true;
|
|
128
|
+
}
|
|
129
|
+
catch (error) {
|
|
130
|
+
if (!(error instanceof UnsupportedStrictJsonSchemaError))
|
|
131
|
+
throw error;
|
|
132
|
+
if (config.strict !== "require")
|
|
133
|
+
return undefined;
|
|
134
|
+
throw new Error(`Tool "${tool.name}" requires JSON-schema constrained sampling, but ${error.message}.`);
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
if (config.strict === "require") {
|
|
138
|
+
throw new Error(`Tool "${tool.name}" requires JSON-schema constrained sampling, but strict tools are unsupported.`);
|
|
139
|
+
}
|
|
140
|
+
return undefined;
|
|
141
|
+
}
|
|
142
|
+
export function requiresToolCallId(modelId) {
|
|
143
|
+
if (modelId.startsWith("claude-") || modelId.startsWith("gpt-oss-"))
|
|
144
|
+
return true;
|
|
145
|
+
const match = modelId.toLowerCase().match(/^gemini(?:-live)?-(\d+)/);
|
|
146
|
+
if (!match)
|
|
147
|
+
return false;
|
|
148
|
+
return Number.parseInt(match[1], 10) >= 3;
|
|
149
|
+
}
|
package/dist/stream/stream.d.ts
CHANGED
|
@@ -34,5 +34,5 @@ export declare function extractAccountValidation(text: string): AccountValidatio
|
|
|
34
34
|
/** Exported for unit tests. */
|
|
35
35
|
export declare function friendlyAntigravityError(status: number | undefined, text: string): string;
|
|
36
36
|
/** Exported for unit tests. */
|
|
37
|
-
export declare function streamResponse(response: Response, stream: AssistantMessageEventStream, output: AssistantMessage, model?: Model<Api>, sessionState?: AntigravitySessionState): Promise<boolean>;
|
|
37
|
+
export declare function streamResponse(response: Response, stream: AssistantMessageEventStream, output: AssistantMessage, model?: Model<Api>, sessionState?: AntigravitySessionState, detectRetiredGemini35?: boolean): Promise<boolean>;
|
|
38
38
|
export declare function streamAntigravity(model: Model<Api>, context: TranscriptContext, options?: AntigravityStreamOptions): AssistantMessageEventStream;
|
package/dist/stream/stream.js
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { calculateCost, createAssistantMessageEventStream, } from "@earendil-works/pi-ai";
|
|
2
|
-
import { getJsonSchemaToolParameters, resolveJsonSchemaStrictSampling } from "
|
|
3
|
-
import { requiresToolCallId } from "@earendil-works/pi-ai/api/google-shared";
|
|
2
|
+
import { getJsonSchemaToolParameters, requiresToolCallId, resolveJsonSchemaStrictSampling, } from "./provider-helpers.js";
|
|
4
3
|
import { getCurrentSystemPrompt, getCurrentTools } from "./transcript.js";
|
|
5
4
|
import { antigravityHeaders, endpointCandidates, fetchAvailableRuntimeModel, formatRequestDiagnostics, jsonOrTextError, loadCodeAssist, parseApiKey, resolveProjectId, } from "../client/client.js";
|
|
6
5
|
import { getCurrentEndpoint, runWithDiagnostics, setLastEndpoint, setLastError, setLastLatencyMs, setLastProjectId, setLastResolvedRuntimeModel, setLastStatus, } from "../diagnostics/diagnostics.js";
|
|
@@ -496,6 +495,18 @@ export function mapStopReason(reason) {
|
|
|
496
495
|
return StopReason.Length;
|
|
497
496
|
return reason ? StopReason.Error : StopReason.Stop;
|
|
498
497
|
}
|
|
498
|
+
const RETIRED_GEMINI_35_NOTICE_PREFIX = "gemini 3.5 flash is no longer available. please switch to";
|
|
499
|
+
function isRetiredGemini35Runtime(runtimeModel) {
|
|
500
|
+
return /^(?:gemini-3\.5-flash(?:-|$)|gemini-3-flash-agent$)/i.test(runtimeModel);
|
|
501
|
+
}
|
|
502
|
+
function retiredNoticePrefixState(text) {
|
|
503
|
+
const normalized = text.trimStart().replace(/\s+/g, " ").toLowerCase();
|
|
504
|
+
if (normalized.startsWith(RETIRED_GEMINI_35_NOTICE_PREFIX))
|
|
505
|
+
return "match";
|
|
506
|
+
if (RETIRED_GEMINI_35_NOTICE_PREFIX.startsWith(normalized))
|
|
507
|
+
return "possible";
|
|
508
|
+
return "no-match";
|
|
509
|
+
}
|
|
499
510
|
/**
|
|
500
511
|
* The URL is printed for the user to click, so only Google-owned https hosts are
|
|
501
512
|
* allowed. A response body is untrusted input just like any other; a foreign host here
|
|
@@ -596,7 +607,7 @@ export function friendlyAntigravityError(status, text) {
|
|
|
596
607
|
}
|
|
597
608
|
if (status === 404) {
|
|
598
609
|
if (/Requested entity was not found/i.test(msg)) {
|
|
599
|
-
return "This model is not available right now. Next: switch to gemini-3.
|
|
610
|
+
return "This model is not available right now. Next: switch to gemini-3.8-flash, gemini-3.7-flash, gemini-3.6-flash, gemini-3.1-pro, or another working model.";
|
|
600
611
|
}
|
|
601
612
|
return `Antigravity could not find the requested resource. Next: retry or switch models. Backend said: ${msg}`;
|
|
602
613
|
}
|
|
@@ -657,7 +668,7 @@ function asToolCallArguments(args) {
|
|
|
657
668
|
return (args ?? {});
|
|
658
669
|
}
|
|
659
670
|
/** Exported for unit tests. */
|
|
660
|
-
export async function streamResponse(response, stream, output, model, sessionState) {
|
|
671
|
+
export async function streamResponse(response, stream, output, model, sessionState, detectRetiredGemini35 = false) {
|
|
661
672
|
if (!response.body)
|
|
662
673
|
throw new Error("No response body");
|
|
663
674
|
const reader = response.body.getReader();
|
|
@@ -670,6 +681,9 @@ export async function streamResponse(response, stream, output, model, sessionSta
|
|
|
670
681
|
let currentBlock = null;
|
|
671
682
|
let hasContent = false;
|
|
672
683
|
let lastResponseId;
|
|
684
|
+
let retiredNoticeCheck = detectRetiredGemini35
|
|
685
|
+
? { text: "", parts: [] }
|
|
686
|
+
: undefined;
|
|
673
687
|
const blocks = output.content;
|
|
674
688
|
const blockIndex = () => blocks.length - 1;
|
|
675
689
|
const ensureStarted = () => {
|
|
@@ -699,6 +713,58 @@ export async function streamResponse(response, stream, output, model, sessionSta
|
|
|
699
713
|
}
|
|
700
714
|
currentBlock = null;
|
|
701
715
|
};
|
|
716
|
+
const appendText = (text, thoughtSignature) => {
|
|
717
|
+
if (!currentBlock || currentBlock.type !== "text") {
|
|
718
|
+
finishCurrent();
|
|
719
|
+
currentBlock = { type: "text", text: "" };
|
|
720
|
+
blocks.push(currentBlock);
|
|
721
|
+
ensureStarted();
|
|
722
|
+
stream.push({ type: "text_start", contentIndex: blockIndex(), partial: output });
|
|
723
|
+
}
|
|
724
|
+
if (currentBlock.type === "text") {
|
|
725
|
+
currentBlock.text += text;
|
|
726
|
+
if (thoughtSignature)
|
|
727
|
+
currentBlock.textSignature = thoughtSignature;
|
|
728
|
+
stream.push({
|
|
729
|
+
type: "text_delta",
|
|
730
|
+
contentIndex: blockIndex(),
|
|
731
|
+
delta: text,
|
|
732
|
+
partial: output,
|
|
733
|
+
});
|
|
734
|
+
}
|
|
735
|
+
};
|
|
736
|
+
const appendThinking = (text, thoughtSignature) => {
|
|
737
|
+
if (!currentBlock || currentBlock.type !== "thinking") {
|
|
738
|
+
finishCurrent();
|
|
739
|
+
currentBlock = { type: "thinking", thinking: "", thinkingSignature: undefined };
|
|
740
|
+
blocks.push(currentBlock);
|
|
741
|
+
ensureStarted();
|
|
742
|
+
stream.push({ type: "thinking_start", contentIndex: blockIndex(), partial: output });
|
|
743
|
+
}
|
|
744
|
+
if (currentBlock.type === "thinking") {
|
|
745
|
+
currentBlock.thinking += text;
|
|
746
|
+
if (thoughtSignature)
|
|
747
|
+
currentBlock.thinkingSignature = thoughtSignature;
|
|
748
|
+
stream.push({
|
|
749
|
+
type: "thinking_delta",
|
|
750
|
+
contentIndex: blockIndex(),
|
|
751
|
+
delta: text,
|
|
752
|
+
partial: output,
|
|
753
|
+
});
|
|
754
|
+
}
|
|
755
|
+
};
|
|
756
|
+
const flushPendingRetiredNoticeParts = () => {
|
|
757
|
+
if (!retiredNoticeCheck?.parts.length)
|
|
758
|
+
return;
|
|
759
|
+
const pendingParts = retiredNoticeCheck.parts;
|
|
760
|
+
retiredNoticeCheck = undefined;
|
|
761
|
+
for (const part of pendingParts) {
|
|
762
|
+
if (part.type === "thinking")
|
|
763
|
+
appendThinking(part.text, part.thoughtSignature);
|
|
764
|
+
else
|
|
765
|
+
appendText(part.text, part.thoughtSignature);
|
|
766
|
+
}
|
|
767
|
+
};
|
|
702
768
|
while (true) {
|
|
703
769
|
const result = await reader.read();
|
|
704
770
|
if (result.done)
|
|
@@ -731,45 +797,48 @@ export async function streamResponse(response, stream, output, model, sessionSta
|
|
|
731
797
|
if (part.text !== undefined) {
|
|
732
798
|
hasContent = true;
|
|
733
799
|
const isThinking = part.thought === true;
|
|
734
|
-
const
|
|
735
|
-
if (!
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
stream.push({
|
|
743
|
-
type: isThinking ? "thinking_start" : "text_start",
|
|
744
|
-
contentIndex: blockIndex(),
|
|
745
|
-
partial: output,
|
|
800
|
+
const noticeCheck = retiredNoticeCheck;
|
|
801
|
+
if (!isThinking &&
|
|
802
|
+
noticeCheck &&
|
|
803
|
+
(part.text.length > 0 || noticeCheck.parts.length > 0)) {
|
|
804
|
+
noticeCheck.parts.push({
|
|
805
|
+
type: "text",
|
|
806
|
+
text: part.text,
|
|
807
|
+
thoughtSignature: part.thoughtSignature,
|
|
746
808
|
});
|
|
809
|
+
noticeCheck.text += part.text;
|
|
810
|
+
const noticeState = retiredNoticePrefixState(noticeCheck.text);
|
|
811
|
+
if (noticeState === "match") {
|
|
812
|
+
try {
|
|
813
|
+
await reader.cancel();
|
|
814
|
+
}
|
|
815
|
+
catch {
|
|
816
|
+
// The response is being discarded; cancellation is best-effort.
|
|
817
|
+
}
|
|
818
|
+
reader.releaseLock();
|
|
819
|
+
throw new Error("Antigravity reports that Gemini 3.5 Flash is no longer available. " +
|
|
820
|
+
"Next: switch to gemini-3.8-flash, gemini-3.7-flash, or another catalog model.");
|
|
821
|
+
}
|
|
822
|
+
if (noticeState !== "possible")
|
|
823
|
+
flushPendingRetiredNoticeParts();
|
|
747
824
|
}
|
|
748
|
-
if (isThinking &&
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
type: "thinking_delta",
|
|
754
|
-
contentIndex: blockIndex(),
|
|
755
|
-
delta: part.text,
|
|
756
|
-
partial: output,
|
|
825
|
+
else if (isThinking && noticeCheck?.parts.length) {
|
|
826
|
+
noticeCheck.parts.push({
|
|
827
|
+
type: "thinking",
|
|
828
|
+
text: part.text,
|
|
829
|
+
thoughtSignature: part.thoughtSignature,
|
|
757
830
|
});
|
|
758
831
|
}
|
|
759
|
-
else if (
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
type: "text_delta",
|
|
765
|
-
contentIndex: blockIndex(),
|
|
766
|
-
delta: part.text,
|
|
767
|
-
partial: output,
|
|
768
|
-
});
|
|
832
|
+
else if (isThinking) {
|
|
833
|
+
appendThinking(part.text, part.thoughtSignature);
|
|
834
|
+
}
|
|
835
|
+
else {
|
|
836
|
+
appendText(part.text, part.thoughtSignature);
|
|
769
837
|
}
|
|
770
838
|
}
|
|
771
839
|
if (part.functionCall) {
|
|
772
840
|
hasContent = true;
|
|
841
|
+
flushPendingRetiredNoticeParts();
|
|
773
842
|
finishCurrent();
|
|
774
843
|
const rawId = part.functionCall.id || "";
|
|
775
844
|
const toolCall = {
|
|
@@ -827,6 +896,7 @@ export async function streamResponse(response, stream, output, model, sessionSta
|
|
|
827
896
|
scanStart = 0;
|
|
828
897
|
}
|
|
829
898
|
}
|
|
899
|
+
flushPendingRetiredNoticeParts();
|
|
830
900
|
finishCurrent();
|
|
831
901
|
if (sessionState && lastResponseId) {
|
|
832
902
|
sessionState.lastExecutionId = lastResponseId;
|
|
@@ -985,7 +1055,7 @@ export function streamAntigravity(model, context, options) {
|
|
|
985
1055
|
cost: { input: 0, output: 0, cacheRead: 0, cacheWrite: 0, total: 0 },
|
|
986
1056
|
};
|
|
987
1057
|
output.stopReason = "stop";
|
|
988
|
-
received = await streamResponse(response, stream, output, model, sessionState);
|
|
1058
|
+
received = await streamResponse(response, stream, output, model, sessionState, isRetiredGemini35Runtime(runtimeModel));
|
|
989
1059
|
if (received)
|
|
990
1060
|
break;
|
|
991
1061
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@heyhuynhgiabuu/pi-oauth-antigravity",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.7",
|
|
4
4
|
"description": "Google Antigravity OAuth provider extension for Pi with Gemini 3.8, prompt cache session affinity, and trajectory chaining.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -59,12 +59,11 @@
|
|
|
59
59
|
"undici": "^8.10.0"
|
|
60
60
|
},
|
|
61
61
|
"devDependencies": {
|
|
62
|
-
"@earendil-works/pi-ai": "
|
|
63
|
-
"@earendil-works/pi-coding-agent": "
|
|
64
|
-
"@earendil-works/pi-server": "^0.86.0",
|
|
62
|
+
"@earendil-works/pi-ai": "1.2.0",
|
|
63
|
+
"@earendil-works/pi-coding-agent": "1.2.0",
|
|
65
64
|
"@types/node": "^22.20.1",
|
|
66
65
|
"tsx": "^4.20.6",
|
|
67
|
-
"typescript": "^
|
|
66
|
+
"typescript": "^7.0.2"
|
|
68
67
|
},
|
|
69
68
|
"pi": {
|
|
70
69
|
"extensions": [
|