@cortexkit/opencode-antigravity-auth 2.1.0 → 2.2.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/dist/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  // src/plugin/index.ts
2
- import { createHash as createHash10 } from "node:crypto";
2
+ import { createHash as createHash11 } from "node:crypto";
3
3
  import { join as join19 } from "node:path";
4
4
 
5
5
  // ../core/dist/account-manager.js
@@ -893,8 +893,8 @@ function calculateTokenExpiry(requestTimeMs, expiresInSeconds) {
893
893
 
894
894
  // ../core/dist/fingerprint.js
895
895
  import * as crypto from "node:crypto";
896
- var AGY_CLI_VERSION = "1.1.13";
897
- var AGY_CLI_CHANGE_LIST = "964361259";
896
+ var AGY_CLI_VERSION = "1.1.24";
897
+ var AGY_CLI_CHANGE_LIST = "974782877";
898
898
  var ANTIGRAVITY_API_CLIENT = "antigravity-cli";
899
899
  var MAX_FINGERPRINT_HISTORY = 5;
900
900
  function normalizeHarnessPlatform(platform = process.platform) {
@@ -1008,6 +1008,16 @@ var ALL_MODEL_DEFINITIONS = {
1008
1008
  high: { thinkingLevel: "high" }
1009
1009
  }
1010
1010
  }),
1011
+ "antigravity-gemini-3.8-flash": defineModel("antigravity-gemini-3.8-flash", {
1012
+ name: "Gemini 3.8 Flash (Antigravity)",
1013
+ reasoning: true,
1014
+ limit: { context: 1048576, output: 65536 },
1015
+ modalities: DEFAULT_MODALITIES,
1016
+ variants: {
1017
+ low: { thinkingLevel: "low" },
1018
+ high: { thinkingLevel: "high" }
1019
+ }
1020
+ }),
1011
1021
  "antigravity-gemini-3.7-flash": defineModel("antigravity-gemini-3.7-flash", {
1012
1022
  name: "Gemini 3.7 Flash (Antigravity)",
1013
1023
  reasoning: true,
@@ -1143,6 +1153,9 @@ var RESOLVER_ALIASES = {
1143
1153
  "gemini-3.7-flash-low": "gemini-3.7-flash",
1144
1154
  "gemini-3.7-flash-medium": "gemini-3.7-flash",
1145
1155
  "gemini-3.7-flash-high": "gemini-3.7-flash",
1156
+ "gemini-3.8-flash-low": "gemini-3.8-flash",
1157
+ "gemini-3.8-flash-medium": "gemini-3.8-flash",
1158
+ "gemini-3.8-flash-high": "gemini-3.8-flash",
1146
1159
  "gemini-claude-opus-4-6-thinking-low": "claude-opus-4-6-thinking",
1147
1160
  "gemini-claude-opus-4-6-thinking-medium": "claude-opus-4-6-thinking",
1148
1161
  "gemini-claude-opus-4-6-thinking-high": "claude-opus-4-6-thinking",
@@ -1183,6 +1196,14 @@ var GEMINI_37_FLASH_ROUTES = {
1183
1196
  high: "gemini-3.7-flash-high"
1184
1197
  }
1185
1198
  };
1199
+ var GEMINI_38_FLASH_ROUTES = {
1200
+ defaultModel: "gemini-3.8-flash-medium",
1201
+ byTier: {
1202
+ low: "gemini-3.8-flash-low",
1203
+ medium: "gemini-3.8-flash-medium",
1204
+ high: "gemini-3.8-flash-high"
1205
+ }
1206
+ };
1186
1207
  var QUOTA_GROUP_BY_MODEL_ID = {
1187
1208
  "claude-opus-4-6-thinking": "non-gemini",
1188
1209
  "claude-opus-4-6": "non-gemini",
@@ -1204,11 +1225,16 @@ var QUOTA_GROUP_BY_MODEL_ID = {
1204
1225
  "gemini-3.7-flash-medium": "gemini",
1205
1226
  "gemini-3.7-flash-high": "gemini",
1206
1227
  "gemini-3.7-flash-tiered": "gemini",
1228
+ "gemini-3.8-flash-low": "gemini",
1229
+ "gemini-3.8-flash-medium": "gemini",
1230
+ "gemini-3.8-flash-high": "gemini",
1231
+ "gemini-3.8-flash-tiered": "gemini",
1207
1232
  "gemini-3.1-flash-image": "gemini",
1208
1233
  "gpt-oss-120b": "non-gemini",
1209
1234
  "gpt-oss-120b-medium": "non-gemini"
1210
1235
  };
1211
1236
  var ANTIGRAVITY_OPENCODE_MODEL_IDS = [
1237
+ "antigravity-gemini-3.8-flash",
1212
1238
  "antigravity-gemini-3.7-flash",
1213
1239
  "antigravity-gemini-3.6-flash",
1214
1240
  "antigravity-gemini-3.5-flash",
@@ -1246,6 +1272,9 @@ function getGemini36FlashAntigravityModel(tier) {
1246
1272
  function getGemini37FlashAntigravityModel(tier) {
1247
1273
  return getTieredAntigravityModel(GEMINI_37_FLASH_ROUTES, tier);
1248
1274
  }
1275
+ function getGemini38FlashAntigravityModel(tier) {
1276
+ return getTieredAntigravityModel(GEMINI_38_FLASH_ROUTES, tier);
1277
+ }
1249
1278
  function getQuotaGroupForModel(modelId) {
1250
1279
  const normalized = modelId.toLowerCase();
1251
1280
  return QUOTA_GROUP_BY_MODEL_ID[normalized] ?? // Check Claude / GPT-OSS substrings BEFORE the `gemini` substring so
@@ -2909,6 +2938,9 @@ var AGY_MODEL_ENUM_BY_WIRE_MODEL = {
2909
2938
  "gemini-3.7-flash-low": "MODEL_PLACEHOLDER_M300",
2910
2939
  "gemini-3.7-flash-medium": "MODEL_PLACEHOLDER_M299",
2911
2940
  "gemini-3.7-flash-high": "MODEL_PLACEHOLDER_M298",
2941
+ "gemini-3.8-flash-low": "MODEL_PLACEHOLDER_M320",
2942
+ "gemini-3.8-flash-medium": "MODEL_PLACEHOLDER_M319",
2943
+ "gemini-3.8-flash-high": "MODEL_PLACEHOLDER_M318",
2912
2944
  "gemini-3.1-pro-low": "MODEL_PLACEHOLDER_M36",
2913
2945
  "gemini-pro-agent": "MODEL_PLACEHOLDER_M16",
2914
2946
  "claude-sonnet-4-6": "MODEL_PLACEHOLDER_M35",
@@ -3538,7 +3570,7 @@ async function connectTlsWithAbort(targetUrl, timeoutMs, signal, onDebug) {
3538
3570
  }
3539
3571
 
3540
3572
  // ../core/dist/antigravity/oauth.js
3541
- import { generatePKCE } from "@openauthjs/openauth/pkce";
3573
+ import { createHash as createHash2, randomBytes as randomBytes2 } from "node:crypto";
3542
3574
 
3543
3575
  // ../core/dist/constants.js
3544
3576
  var ANTIGRAVITY_CLIENT_ID = "1071006060591-tmhssin2h21lcre235vtolojh4g403ep.apps.googleusercontent.com";
@@ -3663,6 +3695,13 @@ async function fetchWithActiveTimeout(input2, init = {}, options = {}) {
3663
3695
 
3664
3696
  // ../core/dist/antigravity/oauth.js
3665
3697
  var log2 = createLogger("oauth");
3698
+ function generatePkcePair() {
3699
+ const verifier = randomBytes2(32).toString("base64url");
3700
+ return {
3701
+ verifier,
3702
+ challenge: createHash2("sha256").update(verifier).digest("base64url")
3703
+ };
3704
+ }
3666
3705
  function encodeState(payload) {
3667
3706
  return Buffer.from(JSON.stringify(payload), "utf8").toString("base64url");
3668
3707
  }
@@ -3680,7 +3719,7 @@ function decodeState(state) {
3680
3719
  };
3681
3720
  }
3682
3721
  async function authorizeAntigravity(projectId = "") {
3683
- const pkce = await generatePKCE();
3722
+ const pkce = generatePkcePair();
3684
3723
  const url = new URL("https://accounts.google.com/o/oauth2/v2/auth");
3685
3724
  url.searchParams.set("client_id", ANTIGRAVITY_CLIENT_ID);
3686
3725
  url.searchParams.set("response_type", "code");
@@ -4040,7 +4079,7 @@ async function ensureProjectContext(auth) {
4040
4079
  }
4041
4080
 
4042
4081
  // ../core/dist/quota-manager.js
4043
- import { createHash as createHash2 } from "node:crypto";
4082
+ import { createHash as createHash3 } from "node:crypto";
4044
4083
  var log4 = createLogger("quota-manager");
4045
4084
  var QUOTA_MANAGER_DEFAULT_BASE_BACKOFF_MS = 3e4;
4046
4085
  var QUOTA_MANAGER_DEFAULT_MAX_BACKOFF_MS = 10 * 60 * 1e3;
@@ -4049,7 +4088,7 @@ function defaultKeyOf(account) {
4049
4088
  if (account.email)
4050
4089
  return `e:${account.email.toLowerCase()}`;
4051
4090
  const token = account.refreshToken || "";
4052
- return `t:${createHash2("sha256").update(token).digest("hex").slice(0, 16)}`;
4091
+ return `t:${createHash3("sha256").update(token).digest("hex").slice(0, 16)}`;
4053
4092
  }
4054
4093
  function createQuotaManager(options) {
4055
4094
  const now = options.now ?? (() => Date.now());
@@ -4252,7 +4291,7 @@ function createQuotaManager(options) {
4252
4291
  };
4253
4292
  }
4254
4293
  function hashKey(key) {
4255
- return createHash2("sha256").update(key).digest("hex").slice(0, 8);
4294
+ return createHash3("sha256").update(key).digest("hex").slice(0, 8);
4256
4295
  }
4257
4296
  function classifyQuotaGroup(modelName, displayName) {
4258
4297
  const registryGroup = getQuotaGroupForModel(modelName);
@@ -5145,19 +5184,16 @@ function isGemini35FlashModel(model) {
5145
5184
  function resolveGemini35FlashAntigravityModel(tier) {
5146
5185
  return getGemini35FlashAntigravityModel(tier);
5147
5186
  }
5148
- function getAgyGeminiFlashThinkingBudget(tier) {
5187
+ function getAgyGeminiFlashThinkingBudget(tier, highBudget = 1e4) {
5149
5188
  switch (tier) {
5150
5189
  case "low":
5151
5190
  return 1e3;
5152
5191
  case "high":
5153
- return 1e4;
5192
+ return highBudget;
5154
5193
  default:
5155
5194
  return 4e3;
5156
5195
  }
5157
5196
  }
5158
- function getAgyGemini37FlashThinkingBudget(tier) {
5159
- return tier === "high" ? -1 : getAgyGeminiFlashThinkingBudget(tier);
5160
- }
5161
5197
  function getAgyGemini31ProModel(tier) {
5162
5198
  return tier === "high" ? "gemini-pro-agent" : "gemini-3.1-pro-low";
5163
5199
  }
@@ -5182,6 +5218,7 @@ function resolveModelWithTier(requestedModel, options = {}) {
5182
5218
  const isGemini35Flash = /^gemini-3\.5-flash/i.test(baseName);
5183
5219
  const isGemini36Flash = /^gemini-3\.6-flash/i.test(baseName);
5184
5220
  const isGemini37Flash = /^gemini-3\.7-flash/i.test(baseName);
5221
+ const isGemini38Flash = /^gemini-3\.8-flash/i.test(baseName);
5185
5222
  const isGptOss120b = /^gpt-oss-120b(?:-medium)?$/i.test(baseName);
5186
5223
  if (isGemini31Pro && quotaPreference === "antigravity") {
5187
5224
  return {
@@ -5216,7 +5253,17 @@ function resolveModelWithTier(requestedModel, options = {}) {
5216
5253
  if (isGemini37Flash && quotaPreference === "antigravity") {
5217
5254
  return {
5218
5255
  actualModel: getGemini37FlashAntigravityModel(tier ?? "medium"),
5219
- thinkingBudget: getAgyGemini37FlashThinkingBudget(tier),
5256
+ thinkingBudget: getAgyGeminiFlashThinkingBudget(tier, -1),
5257
+ tier: tier ?? "medium",
5258
+ isThinkingModel: true,
5259
+ quotaPreference,
5260
+ explicitQuota
5261
+ };
5262
+ }
5263
+ if (isGemini38Flash && quotaPreference === "antigravity") {
5264
+ return {
5265
+ actualModel: getGemini38FlashAntigravityModel(tier ?? "medium"),
5266
+ thinkingBudget: getAgyGeminiFlashThinkingBudget(tier, -1),
5220
5267
  tier: tier ?? "medium",
5221
5268
  isThinkingModel: true,
5222
5269
  quotaPreference,
@@ -6655,7 +6702,7 @@ function isTuiConnected(sessionId) {
6655
6702
  }
6656
6703
 
6657
6704
  // src/rpc/rpc-dir.ts
6658
- import { createHash as createHash3 } from "node:crypto";
6705
+ import { createHash as createHash4 } from "node:crypto";
6659
6706
  import { homedir as homedir4, tmpdir } from "node:os";
6660
6707
  import { isAbsolute, join as join7, resolve } from "node:path";
6661
6708
  var RPC_DIR_ENV = "ANTIGRAVITY_AUTH_RPC_DIR";
@@ -6664,13 +6711,13 @@ function getRpcDir(projectDirectory) {
6664
6711
  if (override) {
6665
6712
  return isAbsolute(override) ? override : resolve(projectDirectory, override);
6666
6713
  }
6667
- const projectHash = createHash3("sha256").update(resolve(projectDirectory)).digest("hex").slice(0, 16);
6714
+ const projectHash = createHash4("sha256").update(resolve(projectDirectory)).digest("hex").slice(0, 16);
6668
6715
  const stateHome = process.env.XDG_STATE_HOME ?? join7(homedir4(), ".local", "state");
6669
6716
  return join7(stateHome, "cortexkit", "antigravity-auth", "rpc", projectHash);
6670
6717
  }
6671
6718
 
6672
6719
  // src/rpc/rpc-server.ts
6673
- import { randomBytes as randomBytes3, timingSafeEqual } from "node:crypto";
6720
+ import { randomBytes as randomBytes4, timingSafeEqual } from "node:crypto";
6674
6721
  import { unlink as unlink4 } from "node:fs/promises";
6675
6722
  import {
6676
6723
  createServer
@@ -6678,7 +6725,7 @@ import {
6678
6725
  import { join as join9 } from "node:path";
6679
6726
 
6680
6727
  // src/rpc/port-file.ts
6681
- import { randomBytes as randomBytes2 } from "node:crypto";
6728
+ import { randomBytes as randomBytes3 } from "node:crypto";
6682
6729
  import {
6683
6730
  chmod as chmod2,
6684
6731
  mkdir as mkdir4,
@@ -6697,7 +6744,7 @@ async function writePortFile(dir, entry) {
6697
6744
  await chmod2(dir, DIR_MODE);
6698
6745
  const full = { ...entry, startedAt: Date.now() };
6699
6746
  const target = join8(dir, `port-${entry.pid}.json`);
6700
- const temporary = `${target}.${process.pid}.${randomBytes2(8).toString("hex")}.tmp`;
6747
+ const temporary = `${target}.${process.pid}.${randomBytes3(8).toString("hex")}.tmp`;
6701
6748
  try {
6702
6749
  await writeFile3(temporary, JSON.stringify(full), {
6703
6750
  encoding: "utf8",
@@ -6744,7 +6791,7 @@ var HttpError = class extends Error {
6744
6791
  status;
6745
6792
  };
6746
6793
  async function startRpcServer(options) {
6747
- const token = randomBytes3(32).toString("hex");
6794
+ const token = randomBytes4(32).toString("hex");
6748
6795
  const server = createServer((request, response) => {
6749
6796
  void handleRequest(request, response, token, options).catch((error) => {
6750
6797
  if (response.headersSent || response.writableEnded) return;
@@ -7416,7 +7463,7 @@ async function setSidebarMachineState(next, options = {}) {
7416
7463
  }
7417
7464
 
7418
7465
  // src/plugin/cache.ts
7419
- import { createHash as createHash4 } from "node:crypto";
7466
+ import { createHash as createHash5 } from "node:crypto";
7420
7467
 
7421
7468
  // src/plugin/cache/signature-cache.ts
7422
7469
  import {
@@ -7795,7 +7842,7 @@ async function shutdownDiskSignatureCache() {
7795
7842
  }
7796
7843
  }
7797
7844
  function hashText(text) {
7798
- return createHash4("sha256").update(text, "utf8").digest("hex").slice(0, SIGNATURE_TEXT_HASH_HEX_LEN);
7845
+ return createHash5("sha256").update(text, "utf8").digest("hex").slice(0, SIGNATURE_TEXT_HASH_HEX_LEN);
7799
7846
  }
7800
7847
  function makeDiskKey(sessionId, textHash) {
7801
7848
  return `${sessionId}:${textHash}`;
@@ -11825,7 +11872,7 @@ function createAccountCommandOAuthService(options) {
11825
11872
  }
11826
11873
 
11827
11874
  // src/plugin/auth-loader.ts
11828
- import { createHash as createHash5 } from "node:crypto";
11875
+ import { createHash as createHash6 } from "node:crypto";
11829
11876
 
11830
11877
  // src/plugin/accounts.ts
11831
11878
  var openCodeStore = {
@@ -12094,7 +12141,7 @@ function createProactiveRefreshQueue(client, providerId, config) {
12094
12141
  // src/plugin/auth-loader.ts
12095
12142
  var log10 = createLogger2("auth-loader");
12096
12143
  function refreshTokenIdentity(refreshToken) {
12097
- return createHash5("sha256").update(refreshToken).digest("hex").slice(0, 16);
12144
+ return createHash6("sha256").update(refreshToken).digest("hex").slice(0, 16);
12098
12145
  }
12099
12146
  function createAuthLoader({
12100
12147
  client,
@@ -12284,9 +12331,9 @@ function createAuthLoader({
12284
12331
  }
12285
12332
 
12286
12333
  // src/plugin/background-quota-refresh.ts
12287
- import { createHash as createHash6 } from "node:crypto";
12334
+ import { createHash as createHash7 } from "node:crypto";
12288
12335
  function quotaAccountIdentity2(refreshToken) {
12289
- return createHash6("sha256").update(refreshToken).digest("hex").slice(0, 16);
12336
+ return createHash7("sha256").update(refreshToken).digest("hex").slice(0, 16);
12290
12337
  }
12291
12338
  var MIN_INTERVAL_MS = 6e4;
12292
12339
  var STARTUP_JITTER_MS = 3e4;
@@ -12521,7 +12568,7 @@ var BackgroundQuotaRefresh = class {
12521
12568
  };
12522
12569
 
12523
12570
  // src/plugin/gemini-dump.ts
12524
- import { createHash as createHash7 } from "node:crypto";
12571
+ import { createHash as createHash8 } from "node:crypto";
12525
12572
  import { appendFileSync as appendFileSync2, mkdirSync as mkdirSync6, writeFileSync as writeFileSync6 } from "node:fs";
12526
12573
  import { tmpdir as tmpdir3 } from "node:os";
12527
12574
  import { join as join13 } from "node:path";
@@ -12590,7 +12637,7 @@ function executeGeminiDumpCommand(input2) {
12590
12637
  ].join("\n");
12591
12638
  }
12592
12639
  function hashText2(value) {
12593
- return createHash7("sha256").update(value).digest("hex");
12640
+ return createHash8("sha256").update(value).digest("hex");
12594
12641
  }
12595
12642
  function maskIdentifier(value) {
12596
12643
  if (typeof value !== "string" || value.length === 0) return void 0;
@@ -13600,7 +13647,7 @@ function registerAntigravityCommands(config) {
13600
13647
  }
13601
13648
 
13602
13649
  // src/plugin/command-data.ts
13603
- import { createHash as createHash8 } from "node:crypto";
13650
+ import { createHash as createHash9 } from "node:crypto";
13604
13651
  var QUOTA_GROUP_LABELS = {
13605
13652
  gemini: "Gemini",
13606
13653
  "non-gemini": "Non-Gemini"
@@ -13655,7 +13702,7 @@ function toCommandAccountRow(entry) {
13655
13702
  };
13656
13703
  }
13657
13704
  function quotaAccountIdentity3(refreshToken) {
13658
- return createHash8("sha256").update(refreshToken).digest("hex").slice(0, 16);
13705
+ return createHash9("sha256").update(refreshToken).digest("hex").slice(0, 16);
13659
13706
  }
13660
13707
  function projectCommandAccountRows(storage) {
13661
13708
  if (!storage) return [];
@@ -15590,7 +15637,7 @@ function isExplicitQuotaFromUrl(urlString) {
15590
15637
  }
15591
15638
 
15592
15639
  // src/plugin/killswitch.ts
15593
- import { createHash as createHash9 } from "node:crypto";
15640
+ import { createHash as createHash10 } from "node:crypto";
15594
15641
  var DEFAULT_CACHE_TTL_MS = 5 * 60 * 1e3;
15595
15642
  var QUOTA_GROUP_BY_FAMILY = {
15596
15643
  claude: ["non-gemini"],
@@ -15609,7 +15656,7 @@ function quotaGroupForModel(family, model) {
15609
15656
  return null;
15610
15657
  }
15611
15658
  function accountKeyForRefreshToken(refreshToken) {
15612
- return createHash9("sha256").update(refreshToken).digest("hex").slice(0, 12);
15659
+ return createHash10("sha256").update(refreshToken).digest("hex").slice(0, 12);
15613
15660
  }
15614
15661
  function evaluateKillswitchForAccount(account, family, settings, options = {}) {
15615
15662
  if (!settings.killswitch.enabled) {
@@ -18171,7 +18218,7 @@ function getImageModelLocalTitle(input2, init) {
18171
18218
  }
18172
18219
  function getAgyMaxOutputTokens(model) {
18173
18220
  const lower = model.toLowerCase();
18174
- if (lower === "gemini-3.5-flash-low" || lower === "gemini-3.5-flash-extra-low" || lower === "gemini-3-flash-agent" || lower === "gemini-3.6-flash-low" || lower === "gemini-3.6-flash-medium" || lower === "gemini-3.6-flash-high" || lower === "gemini-3.7-flash-low" || lower === "gemini-3.7-flash-medium" || lower === "gemini-3.7-flash-high") {
18221
+ if (lower === "gemini-3.5-flash-low" || lower === "gemini-3.5-flash-extra-low" || lower === "gemini-3-flash-agent" || lower === "gemini-3.6-flash-low" || lower === "gemini-3.6-flash-medium" || lower === "gemini-3.6-flash-high" || lower === "gemini-3.7-flash-low" || lower === "gemini-3.7-flash-medium" || lower === "gemini-3.7-flash-high" || lower === "gemini-3.8-flash-low" || lower === "gemini-3.8-flash-medium" || lower === "gemini-3.8-flash-high") {
18175
18222
  return 65536;
18176
18223
  }
18177
18224
  if (lower === "gemini-3.1-pro-low" || lower === "gemini-pro-agent") {
@@ -21591,8 +21638,12 @@ function parseDurationToMs(duration) {
21591
21638
  return matchFound ? totalMs : null;
21592
21639
  }
21593
21640
 
21594
- // src/plugin/google-search-tool.ts
21595
- import { tool } from "@opencode-ai/plugin";
21641
+ // ../../node_modules/.bun/@opencode-ai+plugin@1.17.13+b766ee0bec30d060/node_modules/@opencode-ai/plugin/dist/tool.js
21642
+ import { z as z5 } from "zod";
21643
+ function tool(input2) {
21644
+ return input2;
21645
+ }
21646
+ tool.schema = z5;
21596
21647
 
21597
21648
  // src/plugin/search.ts
21598
21649
  import crypto3 from "node:crypto";
@@ -22004,7 +22055,7 @@ async function persistAccountPool(results, replaceAll = false) {
22004
22055
  // src/plugin/index.ts
22005
22056
  var logger = createLogger2("plugin");
22006
22057
  function quotaAccountIdentity4(refreshToken) {
22007
- return createHash10("sha256").update(refreshToken).digest("hex").slice(0, 16);
22058
+ return createHash11("sha256").update(refreshToken).digest("hex").slice(0, 16);
22008
22059
  }
22009
22060
  function registerQuotaManagerProducer(lifecycle, quotaManager) {
22010
22061
  lifecycle.register({ dispose: () => quotaManager.dispose() }, "producer");