@benjamolina/pi-antigravity-guard 0.5.1 → 0.6.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.
@@ -3,7 +3,8 @@ type AuthErrorKind = "aborted" | "authentication" | "response" | "transport";
3
3
  export declare class AuthHttpError extends Error {
4
4
  readonly kind: AuthErrorKind;
5
5
  readonly status?: number;
6
- constructor(kind: AuthErrorKind, message: string, status?: number);
6
+ readonly code?: string;
7
+ constructor(kind: AuthErrorKind, message: string, status?: number, code?: string);
7
8
  }
8
9
  export interface ExchangeAuthorizationCodeOptions extends AuthHttpDependencies {
9
10
  code: string;
package/dist/auth-http.js CHANGED
@@ -4,10 +4,12 @@ const REQUEST_TIMEOUT_MS = 10_000;
4
4
  export class AuthHttpError extends Error {
5
5
  kind;
6
6
  status;
7
- constructor(kind, message, status) {
7
+ code;
8
+ constructor(kind, message, status, code) {
8
9
  super(message);
9
10
  this.kind = kind;
10
11
  this.status = status;
12
+ this.code = code;
11
13
  }
12
14
  }
13
15
  export async function exchangeAuthorizationCode(options) {
@@ -125,7 +127,7 @@ function credentialsFrom(value, requestTime, priorRefresh) {
125
127
  }
126
128
  function responseError(status, value) {
127
129
  if (isRecord(value) && (value.error === "invalid_grant" || (isRecord(value.error) && value.error.error === "invalid_grant"))) {
128
- return new AuthHttpError("authentication", "Authentication expired. Run /login antigravity-guard.", status);
130
+ return new AuthHttpError("authentication", "Authentication expired. Run /login antigravity-guard.", status, "invalid_grant");
129
131
  }
130
132
  return new AuthHttpError("authentication", status >= 500 ? "Authentication service is unavailable." : "Authentication request was rejected.", status);
131
133
  }
package/dist/catalog.d.ts CHANGED
@@ -124,6 +124,64 @@ declare const CATALOG: readonly [{
124
124
  readonly kind: "gemini-envelope";
125
125
  readonly family: "gemini";
126
126
  };
127
+ }, {
128
+ readonly publicId: "antigravity-gemini-3.8-flash-tiered";
129
+ readonly descriptor: {
130
+ readonly name: "Gemini 3.8 Flash Tiered (Antigravity)";
131
+ readonly thinkingLevelMap: {
132
+ readonly minimal: null;
133
+ readonly low: "low";
134
+ readonly medium: "medium";
135
+ readonly high: "high";
136
+ };
137
+ readonly contextWindow: 1048576;
138
+ readonly maxTokens: 65536;
139
+ };
140
+ readonly routes: {
141
+ readonly off: {
142
+ readonly wireModel: "gemini-3.8-flash-tiered";
143
+ readonly thinking: {
144
+ readonly kind: "budget";
145
+ readonly budget: 0;
146
+ readonly includeThoughts: false;
147
+ };
148
+ readonly tools: ToolCapability;
149
+ };
150
+ readonly low: {
151
+ readonly wireModel: "gemini-3.8-flash-tiered";
152
+ readonly thinking: {
153
+ readonly kind: "budget";
154
+ readonly budget: 1000;
155
+ readonly includeThoughts: true;
156
+ };
157
+ readonly tools: ToolCapability;
158
+ };
159
+ readonly medium: {
160
+ readonly wireModel: "gemini-3.8-flash-tiered";
161
+ readonly thinking: {
162
+ readonly kind: "budget";
163
+ readonly budget: 4000;
164
+ readonly includeThoughts: true;
165
+ };
166
+ readonly tools: ToolCapability;
167
+ };
168
+ readonly high: {
169
+ readonly wireModel: "gemini-3.8-flash-tiered";
170
+ readonly thinking: {
171
+ readonly kind: "budget";
172
+ readonly budget: -1;
173
+ readonly includeThoughts: true;
174
+ };
175
+ readonly tools: ToolCapability;
176
+ };
177
+ };
178
+ readonly replay: {
179
+ readonly kind: "same-public-model";
180
+ };
181
+ readonly response: {
182
+ readonly kind: "gemini-envelope";
183
+ readonly family: "gemini";
184
+ };
127
185
  }, {
128
186
  readonly publicId: "antigravity-gemini-3.7-flash";
129
187
  readonly descriptor: {
@@ -182,6 +240,64 @@ declare const CATALOG: readonly [{
182
240
  readonly kind: "gemini-envelope";
183
241
  readonly family: "gemini";
184
242
  };
243
+ }, {
244
+ readonly publicId: "antigravity-gemini-3.7-flash-tiered";
245
+ readonly descriptor: {
246
+ readonly name: "Gemini 3.7 Flash Tiered (Antigravity)";
247
+ readonly thinkingLevelMap: {
248
+ readonly minimal: null;
249
+ readonly low: "low";
250
+ readonly medium: "medium";
251
+ readonly high: "high";
252
+ };
253
+ readonly contextWindow: 1048576;
254
+ readonly maxTokens: 65536;
255
+ };
256
+ readonly routes: {
257
+ readonly off: {
258
+ readonly wireModel: "gemini-3.7-flash-tiered";
259
+ readonly thinking: {
260
+ readonly kind: "budget";
261
+ readonly budget: 0;
262
+ readonly includeThoughts: false;
263
+ };
264
+ readonly tools: ToolCapability;
265
+ };
266
+ readonly low: {
267
+ readonly wireModel: "gemini-3.7-flash-tiered";
268
+ readonly thinking: {
269
+ readonly kind: "budget";
270
+ readonly budget: 1000;
271
+ readonly includeThoughts: true;
272
+ };
273
+ readonly tools: ToolCapability;
274
+ };
275
+ readonly medium: {
276
+ readonly wireModel: "gemini-3.7-flash-tiered";
277
+ readonly thinking: {
278
+ readonly kind: "budget";
279
+ readonly budget: 4000;
280
+ readonly includeThoughts: true;
281
+ };
282
+ readonly tools: ToolCapability;
283
+ };
284
+ readonly high: {
285
+ readonly wireModel: "gemini-3.7-flash-tiered";
286
+ readonly thinking: {
287
+ readonly kind: "budget";
288
+ readonly budget: -1;
289
+ readonly includeThoughts: true;
290
+ };
291
+ readonly tools: ToolCapability;
292
+ };
293
+ };
294
+ readonly replay: {
295
+ readonly kind: "same-public-model";
296
+ };
297
+ readonly response: {
298
+ readonly kind: "gemini-envelope";
299
+ readonly family: "gemini";
300
+ };
185
301
  }, {
186
302
  readonly publicId: "antigravity-gemini-3.6-flash";
187
303
  readonly descriptor: {
@@ -238,6 +354,62 @@ declare const CATALOG: readonly [{
238
354
  readonly kind: "gemini-envelope";
239
355
  readonly family: "gemini";
240
356
  };
357
+ }, {
358
+ readonly publicId: "antigravity-gemini-3.6-flash-tiered";
359
+ readonly descriptor: {
360
+ readonly name: "Gemini 3.6 Flash Tiered (Antigravity)";
361
+ readonly thinkingLevelMap: {
362
+ readonly minimal: null;
363
+ readonly low: "low";
364
+ readonly medium: "medium";
365
+ readonly high: "high";
366
+ };
367
+ readonly contextWindow: 1048576;
368
+ readonly maxTokens: 65536;
369
+ };
370
+ readonly routes: {
371
+ readonly off: {
372
+ readonly wireModel: "gemini-3.6-flash-tiered";
373
+ readonly thinking: {
374
+ readonly kind: "omit";
375
+ };
376
+ readonly tools: ToolCapability;
377
+ };
378
+ readonly low: {
379
+ readonly wireModel: "gemini-3.6-flash-tiered";
380
+ readonly thinking: {
381
+ readonly kind: "budget";
382
+ readonly budget: 1000;
383
+ readonly includeThoughts: true;
384
+ };
385
+ readonly tools: ToolCapability;
386
+ };
387
+ readonly medium: {
388
+ readonly wireModel: "gemini-3.6-flash-tiered";
389
+ readonly thinking: {
390
+ readonly kind: "budget";
391
+ readonly budget: 4000;
392
+ readonly includeThoughts: true;
393
+ };
394
+ readonly tools: ToolCapability;
395
+ };
396
+ readonly high: {
397
+ readonly wireModel: "gemini-3.6-flash-tiered";
398
+ readonly thinking: {
399
+ readonly kind: "budget";
400
+ readonly budget: -1;
401
+ readonly includeThoughts: true;
402
+ };
403
+ readonly tools: ToolCapability;
404
+ };
405
+ };
406
+ readonly replay: {
407
+ readonly kind: "same-public-model";
408
+ };
409
+ readonly response: {
410
+ readonly kind: "gemini-envelope";
411
+ readonly family: "gemini";
412
+ };
241
413
  }, {
242
414
  readonly publicId: "antigravity-gemini-3.1-pro";
243
415
  readonly descriptor: {
@@ -655,6 +827,96 @@ declare const CATALOG: readonly [{
655
827
  readonly kind: "gemini-envelope";
656
828
  readonly family: "gemini";
657
829
  };
830
+ }, {
831
+ readonly publicId: "antigravity-gemini-4-hydrogen-tiered";
832
+ readonly descriptor: {
833
+ readonly name: "Gemini 4 Hydrogen Tiered (Antigravity)";
834
+ readonly thinkingLevelMap: {
835
+ readonly minimal: null;
836
+ readonly low: null;
837
+ readonly medium: null;
838
+ readonly high: "high";
839
+ readonly xhigh: "xhigh";
840
+ };
841
+ readonly contextWindow: 1048576;
842
+ readonly maxTokens: 262144;
843
+ };
844
+ readonly routes: {
845
+ readonly off: {
846
+ readonly wireModel: "gemini-4-hydrogen-tiered-high";
847
+ readonly thinking: {
848
+ readonly kind: "budget";
849
+ readonly budget: 0;
850
+ readonly includeThoughts: false;
851
+ };
852
+ readonly tools: ToolCapability;
853
+ };
854
+ readonly high: {
855
+ readonly wireModel: "gemini-4-hydrogen-tiered-high";
856
+ readonly thinking: {
857
+ readonly kind: "budget";
858
+ readonly budget: -1;
859
+ readonly includeThoughts: true;
860
+ };
861
+ readonly tools: ToolCapability;
862
+ };
863
+ readonly xhigh: {
864
+ readonly wireModel: "gemini-4-hydrogen-tiered-xhigh";
865
+ readonly thinking: {
866
+ readonly kind: "budget";
867
+ readonly budget: -1;
868
+ readonly includeThoughts: true;
869
+ };
870
+ readonly tools: ToolCapability;
871
+ };
872
+ };
873
+ readonly replay: {
874
+ readonly kind: "same-public-model";
875
+ };
876
+ readonly response: {
877
+ readonly kind: "gemini-envelope";
878
+ readonly family: "gemini";
879
+ };
880
+ }, {
881
+ readonly publicId: "antigravity-gemini-4-hydrogen-sonar";
882
+ readonly descriptor: {
883
+ readonly name: "Gemini 4 Hydrogen Sonar (Antigravity)";
884
+ readonly thinkingLevelMap: {
885
+ readonly minimal: null;
886
+ readonly low: null;
887
+ readonly medium: null;
888
+ readonly high: "high";
889
+ };
890
+ readonly contextWindow: 1048576;
891
+ readonly maxTokens: 262144;
892
+ };
893
+ readonly routes: {
894
+ readonly off: {
895
+ readonly wireModel: "gemini-4-hydrogen-sonar";
896
+ readonly thinking: {
897
+ readonly kind: "budget";
898
+ readonly budget: 0;
899
+ readonly includeThoughts: false;
900
+ };
901
+ readonly tools: ToolCapability;
902
+ };
903
+ readonly high: {
904
+ readonly wireModel: "gemini-4-hydrogen-sonar";
905
+ readonly thinking: {
906
+ readonly kind: "budget";
907
+ readonly budget: -1;
908
+ readonly includeThoughts: true;
909
+ };
910
+ readonly tools: ToolCapability;
911
+ };
912
+ };
913
+ readonly replay: {
914
+ readonly kind: "same-public-model";
915
+ };
916
+ readonly response: {
917
+ readonly kind: "gemini-envelope";
918
+ readonly family: "gemini";
919
+ };
658
920
  }, {
659
921
  readonly publicId: "antigravity-gemini-3.5-flash-lite";
660
922
  readonly descriptor: {
@@ -699,6 +961,12 @@ declare const CATALOG: readonly [{
699
961
  type Catalog = typeof CATALOG;
700
962
  export type AntigravityPublicModelId = Catalog[number]["publicId"];
701
963
  export type AntigravityWireModelId = Catalog[number]["routes"][keyof Catalog[number]["routes"]]["wireModel"];
964
+ export interface DiscoveredAntigravityModel {
965
+ displayName?: string;
966
+ modelName?: string;
967
+ }
968
+ export declare function registerDiscoveredCatalogEntries(models: Readonly<Record<string, DiscoveredAntigravityModel>>): readonly CatalogEntry[];
969
+ export declare function clearDynamicCatalogEntries(): void;
702
970
  /** Constructs deterministic capability data for hermetic serializer tests only. */
703
971
  export declare function createEnabledToolCapability(evidence: ToolEvidenceRef, schemaProfile?: ToolSchemaProfile): Extract<ToolCapability, {
704
972
  readonly state: "enabled";
package/dist/catalog.js CHANGED
@@ -17,6 +17,22 @@ const CATALOG = freeze(defineCatalog([{
17
17
  },
18
18
  replay: { kind: "same-public-model" },
19
19
  response: { kind: "gemini-envelope", family: "gemini" },
20
+ }, {
21
+ publicId: "antigravity-gemini-3.8-flash-tiered",
22
+ descriptor: {
23
+ name: "Gemini 3.8 Flash Tiered (Antigravity)",
24
+ thinkingLevelMap: { minimal: null, low: "low", medium: "medium", high: "high" },
25
+ contextWindow: 1_048_576,
26
+ maxTokens: 65_536,
27
+ },
28
+ routes: {
29
+ off: { wireModel: "gemini-3.8-flash-tiered", thinking: { kind: "budget", budget: 0, includeThoughts: false }, tools: enabled({ record: "pi-json-tool-loop", revision: "gemini-3.8-flash-tiered-off-v1", publicModelId: "antigravity-gemini-3.8-flash-tiered", reasoning: "off", wireModel: "gemini-3.8-flash-tiered" }, GEMINI_PARAMETERS_JSON_SCHEMA_PROFILE) },
30
+ low: { wireModel: "gemini-3.8-flash-tiered", thinking: { kind: "budget", budget: 1000, includeThoughts: true }, tools: enabled({ record: "pi-json-tool-loop", revision: "gemini-3.8-flash-tiered-low-v1", publicModelId: "antigravity-gemini-3.8-flash-tiered", reasoning: "low", wireModel: "gemini-3.8-flash-tiered" }, GEMINI_PARAMETERS_JSON_SCHEMA_PROFILE) },
31
+ medium: { wireModel: "gemini-3.8-flash-tiered", thinking: { kind: "budget", budget: 4000, includeThoughts: true }, tools: enabled({ record: "pi-json-tool-loop", revision: "gemini-3.8-flash-tiered-medium-v1", publicModelId: "antigravity-gemini-3.8-flash-tiered", reasoning: "medium", wireModel: "gemini-3.8-flash-tiered" }, GEMINI_PARAMETERS_JSON_SCHEMA_PROFILE) },
32
+ high: { wireModel: "gemini-3.8-flash-tiered", thinking: { kind: "budget", budget: -1, includeThoughts: true }, tools: enabled({ record: "pi-json-tool-loop", revision: "gemini-3.8-flash-tiered-high-v1", publicModelId: "antigravity-gemini-3.8-flash-tiered", reasoning: "high", wireModel: "gemini-3.8-flash-tiered" }, GEMINI_PARAMETERS_JSON_SCHEMA_PROFILE) },
33
+ },
34
+ replay: { kind: "same-public-model" },
35
+ response: { kind: "gemini-envelope", family: "gemini" },
20
36
  }, {
21
37
  publicId: "antigravity-gemini-3.7-flash",
22
38
  descriptor: {
@@ -33,6 +49,22 @@ const CATALOG = freeze(defineCatalog([{
33
49
  },
34
50
  replay: { kind: "same-public-model" },
35
51
  response: { kind: "gemini-envelope", family: "gemini" },
52
+ }, {
53
+ publicId: "antigravity-gemini-3.7-flash-tiered",
54
+ descriptor: {
55
+ name: "Gemini 3.7 Flash Tiered (Antigravity)",
56
+ thinkingLevelMap: { minimal: null, low: "low", medium: "medium", high: "high" },
57
+ contextWindow: 1_048_576,
58
+ maxTokens: 65_536,
59
+ },
60
+ routes: {
61
+ off: { wireModel: "gemini-3.7-flash-tiered", thinking: { kind: "budget", budget: 0, includeThoughts: false }, tools: enabled({ record: "pi-json-tool-loop", revision: "gemini-3.7-flash-tiered-off-v1", publicModelId: "antigravity-gemini-3.7-flash-tiered", reasoning: "off", wireModel: "gemini-3.7-flash-tiered" }, GEMINI_PARAMETERS_JSON_SCHEMA_PROFILE) },
62
+ low: { wireModel: "gemini-3.7-flash-tiered", thinking: { kind: "budget", budget: 1000, includeThoughts: true }, tools: enabled({ record: "pi-json-tool-loop", revision: "gemini-3.7-flash-tiered-low-v1", publicModelId: "antigravity-gemini-3.7-flash-tiered", reasoning: "low", wireModel: "gemini-3.7-flash-tiered" }, GEMINI_PARAMETERS_JSON_SCHEMA_PROFILE) },
63
+ medium: { wireModel: "gemini-3.7-flash-tiered", thinking: { kind: "budget", budget: 4000, includeThoughts: true }, tools: enabled({ record: "pi-json-tool-loop", revision: "gemini-3.7-flash-tiered-medium-v1", publicModelId: "antigravity-gemini-3.7-flash-tiered", reasoning: "medium", wireModel: "gemini-3.7-flash-tiered" }, GEMINI_PARAMETERS_JSON_SCHEMA_PROFILE) },
64
+ high: { wireModel: "gemini-3.7-flash-tiered", thinking: { kind: "budget", budget: -1, includeThoughts: true }, tools: enabled({ record: "pi-json-tool-loop", revision: "gemini-3.7-flash-tiered-high-v1", publicModelId: "antigravity-gemini-3.7-flash-tiered", reasoning: "high", wireModel: "gemini-3.7-flash-tiered" }, GEMINI_PARAMETERS_JSON_SCHEMA_PROFILE) },
65
+ },
66
+ replay: { kind: "same-public-model" },
67
+ response: { kind: "gemini-envelope", family: "gemini" },
36
68
  }, {
37
69
  publicId: "antigravity-gemini-3.6-flash",
38
70
  descriptor: {
@@ -49,6 +81,22 @@ const CATALOG = freeze(defineCatalog([{
49
81
  },
50
82
  replay: { kind: "same-public-model" },
51
83
  response: { kind: "gemini-envelope", family: "gemini" },
84
+ }, {
85
+ publicId: "antigravity-gemini-3.6-flash-tiered",
86
+ descriptor: {
87
+ name: "Gemini 3.6 Flash Tiered (Antigravity)",
88
+ thinkingLevelMap: { minimal: null, low: "low", medium: "medium", high: "high" },
89
+ contextWindow: 1_048_576,
90
+ maxTokens: 65_536,
91
+ },
92
+ routes: {
93
+ off: { wireModel: "gemini-3.6-flash-tiered", thinking: { kind: "omit" }, tools: enabled({ record: "pi-json-tool-loop", revision: "gemini-3.6-flash-tiered-off-v1", publicModelId: "antigravity-gemini-3.6-flash-tiered", reasoning: "off", wireModel: "gemini-3.6-flash-tiered" }, GEMINI_PARAMETERS_JSON_SCHEMA_PROFILE) },
94
+ low: { wireModel: "gemini-3.6-flash-tiered", thinking: { kind: "budget", budget: 1000, includeThoughts: true }, tools: enabled({ record: "pi-json-tool-loop", revision: "gemini-3.6-flash-tiered-low-v1", publicModelId: "antigravity-gemini-3.6-flash-tiered", reasoning: "low", wireModel: "gemini-3.6-flash-tiered" }, GEMINI_PARAMETERS_JSON_SCHEMA_PROFILE) },
95
+ medium: { wireModel: "gemini-3.6-flash-tiered", thinking: { kind: "budget", budget: 4000, includeThoughts: true }, tools: enabled({ record: "pi-json-tool-loop", revision: "gemini-3.6-flash-tiered-medium-v1", publicModelId: "antigravity-gemini-3.6-flash-tiered", reasoning: "medium", wireModel: "gemini-3.6-flash-tiered" }, GEMINI_PARAMETERS_JSON_SCHEMA_PROFILE) },
96
+ high: { wireModel: "gemini-3.6-flash-tiered", thinking: { kind: "budget", budget: -1, includeThoughts: true }, tools: enabled({ record: "pi-json-tool-loop", revision: "gemini-3.6-flash-tiered-high-v1", publicModelId: "antigravity-gemini-3.6-flash-tiered", reasoning: "high", wireModel: "gemini-3.6-flash-tiered" }, GEMINI_PARAMETERS_JSON_SCHEMA_PROFILE) },
97
+ },
98
+ replay: { kind: "same-public-model" },
99
+ response: { kind: "gemini-envelope", family: "gemini" },
52
100
  }, {
53
101
  publicId: "antigravity-gemini-3.1-pro",
54
102
  descriptor: {
@@ -172,6 +220,35 @@ const CATALOG = freeze(defineCatalog([{
172
220
  },
173
221
  replay: { kind: "same-public-model" },
174
222
  response: { kind: "gemini-envelope", family: "gemini" },
223
+ }, {
224
+ publicId: "antigravity-gemini-4-hydrogen-tiered",
225
+ descriptor: {
226
+ name: "Gemini 4 Hydrogen Tiered (Antigravity)",
227
+ thinkingLevelMap: { minimal: null, low: null, medium: null, high: "high", xhigh: "xhigh" },
228
+ contextWindow: 1_048_576,
229
+ maxTokens: 262_144,
230
+ },
231
+ routes: {
232
+ off: { wireModel: "gemini-4-hydrogen-tiered-high", thinking: { kind: "budget", budget: 0, includeThoughts: false }, tools: enabled({ record: "pi-json-tool-loop", revision: "gemini-4-hydrogen-tiered-off-v1", publicModelId: "antigravity-gemini-4-hydrogen-tiered", reasoning: "off", wireModel: "gemini-4-hydrogen-tiered-high" }, GEMINI_PARAMETERS_JSON_SCHEMA_PROFILE) },
233
+ high: { wireModel: "gemini-4-hydrogen-tiered-high", thinking: { kind: "budget", budget: -1, includeThoughts: true }, tools: enabled({ record: "pi-json-tool-loop", revision: "gemini-4-hydrogen-tiered-high-v1", publicModelId: "antigravity-gemini-4-hydrogen-tiered", reasoning: "high", wireModel: "gemini-4-hydrogen-tiered-high" }, GEMINI_PARAMETERS_JSON_SCHEMA_PROFILE) },
234
+ xhigh: { wireModel: "gemini-4-hydrogen-tiered-xhigh", thinking: { kind: "budget", budget: -1, includeThoughts: true }, tools: enabled({ record: "pi-json-tool-loop", revision: "gemini-4-hydrogen-tiered-xhigh-v1", publicModelId: "antigravity-gemini-4-hydrogen-tiered", reasoning: "xhigh", wireModel: "gemini-4-hydrogen-tiered-xhigh" }, GEMINI_PARAMETERS_JSON_SCHEMA_PROFILE) },
235
+ },
236
+ replay: { kind: "same-public-model" },
237
+ response: { kind: "gemini-envelope", family: "gemini" },
238
+ }, {
239
+ publicId: "antigravity-gemini-4-hydrogen-sonar",
240
+ descriptor: {
241
+ name: "Gemini 4 Hydrogen Sonar (Antigravity)",
242
+ thinkingLevelMap: { minimal: null, low: null, medium: null, high: "high" },
243
+ contextWindow: 1_048_576,
244
+ maxTokens: 262_144,
245
+ },
246
+ routes: {
247
+ off: { wireModel: "gemini-4-hydrogen-sonar", thinking: { kind: "budget", budget: 0, includeThoughts: false }, tools: enabled({ record: "pi-json-tool-loop", revision: "gemini-4-hydrogen-sonar-off-v1", publicModelId: "antigravity-gemini-4-hydrogen-sonar", reasoning: "off", wireModel: "gemini-4-hydrogen-sonar" }, GEMINI_PARAMETERS_JSON_SCHEMA_PROFILE) },
248
+ high: { wireModel: "gemini-4-hydrogen-sonar", thinking: { kind: "budget", budget: -1, includeThoughts: true }, tools: enabled({ record: "pi-json-tool-loop", revision: "gemini-4-hydrogen-sonar-high-v1", publicModelId: "antigravity-gemini-4-hydrogen-sonar", reasoning: "high", wireModel: "gemini-4-hydrogen-sonar" }, GEMINI_PARAMETERS_JSON_SCHEMA_PROFILE) },
249
+ },
250
+ replay: { kind: "same-public-model" },
251
+ response: { kind: "gemini-envelope", family: "gemini" },
175
252
  }, {
176
253
  publicId: "antigravity-gemini-3.5-flash-lite",
177
254
  descriptor: {
@@ -188,6 +265,191 @@ const CATALOG = freeze(defineCatalog([{
188
265
  response: { kind: "gemini-envelope", family: "gemini" },
189
266
  }]));
190
267
  const lookup = new Map(CATALOG.map((entry) => [entry.publicId, entry]));
268
+ const dynamicLookup = new Map();
269
+ function titleFromModelId(modelId) {
270
+ return modelId
271
+ .split("-")
272
+ .filter(Boolean)
273
+ .map((part) => part.charAt(0).toUpperCase() + part.slice(1))
274
+ .join(" ");
275
+ }
276
+ function defaultLimitsForDiscoveredModel(modelId) {
277
+ const lower = modelId.toLowerCase();
278
+ if (lower.includes("claude")) {
279
+ return { contextWindow: 250_000, maxTokens: 64_000 };
280
+ }
281
+ if (lower.includes("gpt-oss")) {
282
+ return { contextWindow: 131_072, maxTokens: 32_768 };
283
+ }
284
+ if (lower.includes("gemini-4-carbon") ||
285
+ lower.includes("gemini-4-neon") ||
286
+ lower.includes("gemini-4-hydrogen")) {
287
+ return { contextWindow: 1_048_576, maxTokens: 262_144 };
288
+ }
289
+ if (lower.includes("gemini-3.5-flash-lite") || lower.includes("gemini-3.1-pro")) {
290
+ return { contextWindow: 1_048_576, maxTokens: 65_535 };
291
+ }
292
+ return { contextWindow: 1_048_576, maxTokens: 65_536 };
293
+ }
294
+ function inferDiscoveredFamily(wireModel) {
295
+ const lower = wireModel.toLowerCase();
296
+ if (lower.includes("claude"))
297
+ return "claude";
298
+ if (lower.includes("gpt-oss"))
299
+ return "gpt-oss";
300
+ return "gemini";
301
+ }
302
+ export function registerDiscoveredCatalogEntries(models) {
303
+ const discoveredEntries = [];
304
+ for (const [sourceId, rawEntry] of Object.entries(models)) {
305
+ const rawId = (rawEntry?.modelName || sourceId).trim();
306
+ if (!rawId)
307
+ continue;
308
+ const wireBase = rawId.replace(/^models\//, "").replace(/^antigravity-/, "");
309
+ if (!wireBase)
310
+ continue;
311
+ const publicId = `antigravity-${wireBase}`;
312
+ if (publicId === "antigravity-gemini-3.5-flash")
313
+ continue;
314
+ const staticEntry = lookup.get(publicId);
315
+ if (staticEntry) {
316
+ discoveredEntries.push(staticEntry);
317
+ continue;
318
+ }
319
+ const family = inferDiscoveredFamily(wireBase);
320
+ const schemaProfile = family === "gemini" ? GEMINI_PARAMETERS_JSON_SCHEMA_PROFILE : CLAUDE_CUSTOM_PARAMETERS_PROFILE;
321
+ const limits = defaultLimitsForDiscoveredModel(publicId);
322
+ const labelBase = rawEntry?.displayName?.trim() || titleFromModelId(wireBase);
323
+ const name = labelBase.endsWith("(Antigravity)") ? labelBase : `${labelBase} (Antigravity)`;
324
+ const revisionPrefix = wireBase;
325
+ const entry = freeze({
326
+ publicId,
327
+ descriptor: {
328
+ name,
329
+ thinkingLevelMap: family === "claude"
330
+ ? { minimal: null, low: null, medium: null, high: "high" }
331
+ : family === "gpt-oss"
332
+ ? { minimal: null, low: null, medium: "medium", high: null }
333
+ : { minimal: null, low: "low", medium: "medium", high: "high" },
334
+ contextWindow: limits.contextWindow,
335
+ maxTokens: limits.maxTokens,
336
+ },
337
+ routes: family === "claude"
338
+ ? {
339
+ off: {
340
+ wireModel: wireBase,
341
+ thinking: { kind: "budget", budget: 0, includeThoughts: false },
342
+ tools: enabled({
343
+ record: "pi-json-tool-loop",
344
+ revision: `${revisionPrefix}-off-v1`,
345
+ publicModelId: publicId,
346
+ reasoning: "off",
347
+ wireModel: wireBase,
348
+ }, schemaProfile),
349
+ },
350
+ high: {
351
+ wireModel: wireBase,
352
+ thinking: { kind: "budget", budget: 1024, includeThoughts: true },
353
+ tools: enabled({
354
+ record: "pi-json-tool-loop",
355
+ revision: `${revisionPrefix}-high-v1`,
356
+ publicModelId: publicId,
357
+ reasoning: "high",
358
+ wireModel: wireBase,
359
+ }, schemaProfile),
360
+ },
361
+ }
362
+ : family === "gpt-oss"
363
+ ? {
364
+ off: {
365
+ wireModel: wireBase,
366
+ thinking: { kind: "omit" },
367
+ tools: enabled({
368
+ record: "pi-json-tool-loop",
369
+ revision: `${revisionPrefix}-off-v1`,
370
+ publicModelId: publicId,
371
+ reasoning: "off",
372
+ wireModel: wireBase,
373
+ }, schemaProfile),
374
+ },
375
+ medium: {
376
+ wireModel: wireBase,
377
+ thinking: { kind: "budget", budget: 8192, includeThoughts: true },
378
+ tools: enabled({
379
+ record: "pi-json-tool-loop",
380
+ revision: `${revisionPrefix}-medium-v1`,
381
+ publicModelId: publicId,
382
+ reasoning: "medium",
383
+ wireModel: wireBase,
384
+ }, schemaProfile),
385
+ },
386
+ }
387
+ : {
388
+ off: {
389
+ wireModel: wireBase,
390
+ thinking: { kind: "budget", budget: 0, includeThoughts: false },
391
+ tools: enabled({
392
+ record: "pi-json-tool-loop",
393
+ revision: `${revisionPrefix}-off-v1`,
394
+ publicModelId: publicId,
395
+ reasoning: "off",
396
+ wireModel: wireBase,
397
+ }, schemaProfile),
398
+ },
399
+ low: {
400
+ wireModel: wireBase,
401
+ thinking: { kind: "budget", budget: 1000, includeThoughts: true },
402
+ tools: enabled({
403
+ record: "pi-json-tool-loop",
404
+ revision: `${revisionPrefix}-low-v1`,
405
+ publicModelId: publicId,
406
+ reasoning: "low",
407
+ wireModel: wireBase,
408
+ }, schemaProfile),
409
+ },
410
+ medium: {
411
+ wireModel: wireBase,
412
+ thinking: { kind: "budget", budget: 4000, includeThoughts: true },
413
+ tools: enabled({
414
+ record: "pi-json-tool-loop",
415
+ revision: `${revisionPrefix}-medium-v1`,
416
+ publicModelId: publicId,
417
+ reasoning: "medium",
418
+ wireModel: wireBase,
419
+ }, schemaProfile),
420
+ },
421
+ high: {
422
+ wireModel: wireBase,
423
+ thinking: { kind: "budget", budget: -1, includeThoughts: true },
424
+ tools: enabled({
425
+ record: "pi-json-tool-loop",
426
+ revision: `${revisionPrefix}-high-v1`,
427
+ publicModelId: publicId,
428
+ reasoning: "high",
429
+ wireModel: wireBase,
430
+ }, schemaProfile),
431
+ },
432
+ },
433
+ replay: { kind: "same-public-model" },
434
+ response: { kind: "gemini-envelope", family },
435
+ });
436
+ dynamicLookup.set(publicId, entry);
437
+ discoveredEntries.push(entry);
438
+ }
439
+ const merged = new Map();
440
+ for (const entry of CATALOG) {
441
+ merged.set(entry.publicId, entry);
442
+ }
443
+ for (const entry of discoveredEntries) {
444
+ if (!merged.has(entry.publicId)) {
445
+ merged.set(entry.publicId, entry);
446
+ }
447
+ }
448
+ return [...merged.values()];
449
+ }
450
+ export function clearDynamicCatalogEntries() {
451
+ dynamicLookup.clear();
452
+ }
191
453
  function disabled(reason) {
192
454
  return { state: "disabled", contractRevision: 1, reason };
193
455
  }
@@ -236,7 +498,9 @@ export function listCatalogEntries() {
236
498
  return CATALOG;
237
499
  }
238
500
  export function getCatalogEntry(publicId) {
239
- return typeof publicId === "string" ? lookup.get(publicId) : undefined;
501
+ if (typeof publicId !== "string")
502
+ return undefined;
503
+ return lookup.get(publicId) ?? dynamicLookup.get(publicId);
240
504
  }
241
505
  export function resolveGenerationRoute(entry, reasoning) {
242
506
  return resolveGenerationSelection(entry, reasoning).route;
@@ -0,0 +1,13 @@
1
+ import type { ExtensionAPI } from "@earendil-works/pi-coding-agent";
2
+ import { type PiAccountPool } from "./accounts.ts";
3
+ import type { SharedGuardConfig } from "@benjamolina/antigravity-guard-core";
4
+ export interface PiCommandRegistrationHost {
5
+ registerCommand?: ExtensionAPI["registerCommand"];
6
+ sendMessage?: ExtensionAPI["sendMessage"];
7
+ }
8
+ export interface RegisterPiGuardCommandsOptions {
9
+ pool: PiAccountPool;
10
+ getConfig: () => SharedGuardConfig;
11
+ now?: () => number;
12
+ }
13
+ export declare function registerPiGuardCommands(pi: PiCommandRegistrationHost, options: RegisterPiGuardCommandsOptions): void;