@cortexkit/opencode-antigravity-auth 3.1.2 → 3.1.4

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.
Files changed (33) hide show
  1. package/dist/cli.js +13 -6
  2. package/dist/cli.js.map +3 -3
  3. package/dist/cli.meta.json +14 -14
  4. package/dist/index.js +125 -80
  5. package/dist/index.js.map +3 -3
  6. package/dist/index.meta.json +19 -19
  7. package/dist/server.js +125 -80
  8. package/dist/server.js.map +3 -3
  9. package/dist/server.meta.json +1 -1
  10. package/dist/src/common-auth-embedded/fs/canonical-file-path.js +6 -2
  11. package/dist/src/common-auth-embedded/source-output.json +22 -22
  12. package/dist/src/common-auth-embedded/store/index.d.ts +1 -1
  13. package/dist/src/common-auth-embedded/store/index.js +1 -1
  14. package/dist/src/common-auth-embedded/store/settings.d.ts +8 -0
  15. package/dist/src/common-auth-embedded/store/settings.js +14 -4
  16. package/dist/src/plugin/__fixtures__/verified-store.js +2 -2
  17. package/dist/src/plugin/shared/request-services.d.ts +1 -0
  18. package/dist/src/plugin/shared/request-services.d.ts.map +1 -1
  19. package/dist/src/plugin/shared/request-services.js +81 -24
  20. package/dist/src/plugin/shared/request-services.js.map +1 -1
  21. package/dist/tui-build-map.json +1 -1
  22. package/dist/tui-ga-build-map.json +1 -1
  23. package/dist/types/src/common-auth-embedded/store/index.d.ts +1 -1
  24. package/dist/types/src/common-auth-embedded/store/settings.d.ts +8 -0
  25. package/dist/types/src/plugin/shared/request-services.d.ts +1 -0
  26. package/dist/types/src/plugin/shared/request-services.d.ts.map +1 -1
  27. package/package.json +2 -2
  28. package/src/common-auth-embedded/fs/canonical-file-path.js +6 -2
  29. package/src/common-auth-embedded/source-output.json +22 -22
  30. package/src/common-auth-embedded/store/index.d.ts +1 -1
  31. package/src/common-auth-embedded/store/index.js +1 -1
  32. package/src/common-auth-embedded/store/settings.d.ts +8 -0
  33. package/src/common-auth-embedded/store/settings.js +14 -4
@@ -120,12 +120,12 @@
120
120
  "format": "esm"
121
121
  },
122
122
  "../core/dist/rotation.js": {
123
- "bytes": 16060,
123
+ "bytes": 16191,
124
124
  "imports": [],
125
125
  "format": "esm"
126
126
  },
127
127
  "../core/dist/account-selector.js": {
128
- "bytes": 69159,
128
+ "bytes": 69500,
129
129
  "imports": [
130
130
  {
131
131
  "path": "../core/dist/fingerprint.js",
@@ -290,7 +290,7 @@
290
290
  "format": "esm"
291
291
  },
292
292
  "../core/dist/account-manager.js": {
293
- "bytes": 71287,
293
+ "bytes": 71540,
294
294
  "imports": [
295
295
  {
296
296
  "path": "node:crypto",
@@ -1260,7 +1260,7 @@
1260
1260
  "format": "esm"
1261
1261
  },
1262
1262
  "../core/dist/common-auth-embedded/store/settings.js": {
1263
- "bytes": 6395,
1263
+ "bytes": 6839,
1264
1264
  "imports": [
1265
1265
  {
1266
1266
  "path": "node:util",
@@ -1372,7 +1372,7 @@
1372
1372
  "format": "esm"
1373
1373
  },
1374
1374
  "../core/dist/common-auth-embedded/store/index.js": {
1375
- "bytes": 534,
1375
+ "bytes": 554,
1376
1376
  "imports": [
1377
1377
  {
1378
1378
  "path": "../core/dist/common-auth-embedded/store/errors.js",
@@ -1413,7 +1413,7 @@
1413
1413
  "format": "esm"
1414
1414
  },
1415
1415
  "../core/dist/common-auth-embedded/fs/canonical-file-path.js": {
1416
- "bytes": 2058,
1416
+ "bytes": 2287,
1417
1417
  "imports": [
1418
1418
  {
1419
1419
  "path": "node:path",
@@ -2515,7 +2515,7 @@
2515
2515
  "format": "esm"
2516
2516
  },
2517
2517
  "../core/dist/harness-identity.js": {
2518
- "bytes": 3577,
2518
+ "bytes": 3687,
2519
2519
  "imports": [],
2520
2520
  "format": "esm"
2521
2521
  },
@@ -2782,7 +2782,7 @@
2782
2782
  "format": "esm"
2783
2783
  },
2784
2784
  "../core/dist/index.js": {
2785
- "bytes": 2014,
2785
+ "bytes": 2037,
2786
2786
  "imports": [
2787
2787
  {
2788
2788
  "path": "../core/dist/abort-forwarding.js",
@@ -3862,7 +3862,7 @@
3862
3862
  "format": "esm"
3863
3863
  },
3864
3864
  "src/common-auth-embedded/fs/canonical-file-path.js": {
3865
- "bytes": 2058,
3865
+ "bytes": 2287,
3866
3866
  "imports": [
3867
3867
  {
3868
3868
  "path": "node:path",
@@ -4645,7 +4645,7 @@
4645
4645
  "imports": [],
4646
4646
  "exports": [],
4647
4647
  "inputs": {},
4648
- "bytes": 3387251
4648
+ "bytes": 3388977
4649
4649
  },
4650
4650
  "dist/cli.js": {
4651
4651
  "imports": [
@@ -5641,16 +5641,16 @@
5641
5641
  "bytesInOutput": 2113
5642
5642
  },
5643
5643
  "../core/dist/common-auth-embedded/store/settings.js": {
5644
- "bytesInOutput": 4143
5644
+ "bytesInOutput": 4211
5645
5645
  },
5646
5646
  "../core/dist/common-auth-embedded/store/pool.js": {
5647
5647
  "bytesInOutput": 5221
5648
5648
  },
5649
5649
  "../core/dist/common-auth-embedded/store/index.js": {
5650
- "bytesInOutput": 1050
5650
+ "bytesInOutput": 1098
5651
5651
  },
5652
5652
  "../core/dist/common-auth-embedded/fs/canonical-file-path.js": {
5653
- "bytesInOutput": 1452
5653
+ "bytesInOutput": 1592
5654
5654
  },
5655
5655
  "../core/dist/common-auth-embedded/fs/lock-constants.js": {
5656
5656
  "bytesInOutput": 476
@@ -6037,7 +6037,7 @@
6037
6037
  "bytesInOutput": 292
6038
6038
  }
6039
6039
  },
6040
- "bytes": 1271860
6040
+ "bytes": 1272116
6041
6041
  }
6042
6042
  }
6043
6043
  }
package/dist/index.js CHANGED
@@ -4577,6 +4577,8 @@ function parseRateLimitReason(reason, message, status) {
4577
4577
  return normalized;
4578
4578
  }
4579
4579
  }
4580
+ if (status === 429)
4581
+ return "UNKNOWN";
4580
4582
  if (message) {
4581
4583
  const normalized = message.toLowerCase();
4582
4584
  if (normalized.includes("capacity") || normalized.includes("overloaded") || normalized.includes("resource exhausted")) {
@@ -5692,7 +5694,10 @@ var init_account_selector = __esm({
5692
5694
  const now = this.now();
5693
5695
  if (reason === "UNKNOWN") {
5694
5696
  const backoffMs2 = calculateBackoffMs(reason, 0, retryAfterMs);
5695
- this.setRateLimit(account, getQuotaKey(family, model), now + backoffMs2);
5697
+ const key2 = getQuotaKey(family, model);
5698
+ const resetAt = Math.max(account.rateLimitResetTimes[key2] ?? 0, now + backoffMs2);
5699
+ if (resetAt !== account.rateLimitResetTimes[key2])
5700
+ this.setRateLimit(account, key2, resetAt);
5696
5701
  return backoffMs2;
5697
5702
  }
5698
5703
  if (account.lastFailureTime !== void 0 && now - account.lastFailureTime > failureTtlMs) {
@@ -18073,14 +18078,17 @@ function settingsRefusal(message) {
18073
18078
  message
18074
18079
  });
18075
18080
  }
18076
- async function readPoolSettings(rt) {
18077
- const read = async ([configPath = rt.ctx.configPath] = []) => {
18078
- const result2 = await readPoolConfig(configPath);
18081
+ function readPoolSettings(rt) {
18082
+ return readPoolSettingsAt(rt.ctx.configPath);
18083
+ }
18084
+ async function readPoolSettingsAt(configPath) {
18085
+ const read = async ([path5 = configPath] = []) => {
18086
+ const result2 = await readPoolConfig(path5);
18079
18087
  if (result2.status === "error")
18080
18088
  return { status: "error", file: "config", reason: result2.reason };
18081
18089
  return { status: result2.status, settings: settingsOf2(result2.config) };
18082
18090
  };
18083
- const result = windowsPrivateFiles ? await read() : await settingsCache.read([rt.ctx.configPath], read);
18091
+ const result = windowsPrivateFiles ? await read() : await settingsCache.read([configPath], read);
18084
18092
  return structuredClone(result);
18085
18093
  }
18086
18094
  async function updatePoolSettings(rt, mutator, options = {}) {
@@ -18293,6 +18301,7 @@ __export(store_exports, {
18293
18301
  countUnknownIdentityRows: () => countUnknownIdentityRows,
18294
18302
  fingerprintOf: () => fingerprintOf,
18295
18303
  openPoolStore: () => openPoolStore,
18304
+ readPoolSettingsAt: () => readPoolSettingsAt,
18296
18305
  rowLockKey: () => rowLockKey
18297
18306
  });
18298
18307
  var init_store = __esm({
@@ -18310,6 +18319,9 @@ var init_store = __esm({
18310
18319
 
18311
18320
  // ../core/dist/common-auth-embedded/fs/canonical-file-path.js
18312
18321
  import { basename as basename4, dirname as dirname9, join as join7, resolve as resolve7 } from "node:path";
18322
+ function symlinkLoop(file) {
18323
+ return Object.assign(new Error(`ELOOP: too many symbolic links encountered, realpath '${file}'`), { code: "ELOOP", syscall: "realpath", path: file });
18324
+ }
18313
18325
  async function canonicalFilePath(file, fs7) {
18314
18326
  let target = file;
18315
18327
  for (let hops = 0; ; hops++) {
@@ -18325,7 +18337,7 @@ async function canonicalFilePath(file, fs7) {
18325
18337
  if (!isSymlink)
18326
18338
  return target;
18327
18339
  if (hops >= maxSymlinkHops)
18328
- throw new Error("Too many file symlink hops");
18340
+ throw symlinkLoop(file);
18329
18341
  target = resolve7(dirname9(target), await fs7.readlink(target));
18330
18342
  }
18331
18343
  }
@@ -18344,7 +18356,7 @@ function canonicalFilePathSync(file, fs7) {
18344
18356
  if (!isSymlink)
18345
18357
  return target;
18346
18358
  if (hops >= maxSymlinkHops)
18347
- throw new Error("Too many file symlink hops");
18359
+ throw symlinkLoop(file);
18348
18360
  target = resolve7(dirname9(target), fs7.readlinkSync(target));
18349
18361
  }
18350
18362
  }
@@ -27622,6 +27634,10 @@ var init_harness_identity = __esm({
27622
27634
  "opencode.ai/docs"
27623
27635
  ];
27624
27636
  HARNESS_IDENTITY_REWRITES = [
27637
+ {
27638
+ pattern: /\btools\.opencode\b/g,
27639
+ replacement: "tools['opencode']"
27640
+ },
27625
27641
  {
27626
27642
  pattern: /You are opencode, /gi,
27627
27643
  replacement: "You are "
@@ -27643,11 +27659,11 @@ var init_harness_identity = __esm({
27643
27659
  replacement: "running inside your development environment"
27644
27660
  },
27645
27661
  {
27646
- pattern: /running inside opencode, a coding agent harness/gi,
27662
+ pattern: /running (?:inside|in) opencode, a coding agent harness/gi,
27647
27663
  replacement: "running inside your development environment"
27648
27664
  },
27649
27665
  {
27650
- pattern: /\brunning inside (?:pi-bolt|pi|opencode)(?!\.\w)(?=$|\s|[.,;:!?])/gi,
27666
+ pattern: /\brunning (?:inside|in) (?:pi-bolt|pi|opencode)(?!\.\w)(?=$|\s|[.,;:!?])/gi,
27651
27667
  replacement: "running inside your development environment"
27652
27668
  }
27653
27669
  ];
@@ -60803,11 +60819,23 @@ function createRequestExecutor(deps) {
60803
60819
  };
60804
60820
  }
60805
60821
  const sender = options.transport ?? defaultTransport2;
60806
- const transport = (url, sendInit, sendOptions) => deadline.open(() => {
60822
+ const transport = (url, sendInit, sendOptions, onSenderRejection) => deadline.open(() => {
60807
60823
  waits.resumed();
60808
- return sender(url, sendInit, {
60824
+ const optionsWithSignal = {
60809
60825
  ...sendOptions,
60810
60826
  signal: deadline.signal
60827
+ };
60828
+ if (!onSenderRejection) return sender(url, sendInit, optionsWithSignal);
60829
+ let pending;
60830
+ try {
60831
+ pending = sender(url, sendInit, optionsWithSignal);
60832
+ } catch (error) {
60833
+ onSenderRejection(error);
60834
+ throw error;
60835
+ }
60836
+ return pending.catch((error) => {
60837
+ onSenderRejection(error);
60838
+ throw error;
60811
60839
  });
60812
60840
  });
60813
60841
  const requestSessionIdentity = options.session ?? extractOpenCodeSessionIdentity(init?.headers);
@@ -60856,8 +60884,38 @@ function createRequestExecutor(deps) {
60856
60884
  `[Cache] ${label} model=${cachedStats.model} read=${cachedStats.read} total=${cachedStats.total} hitRate=${cachedStats.hitRate}%`
60857
60885
  );
60858
60886
  }
60859
- let lastFailure = null;
60887
+ let retainedMainAttemptFailure = null;
60860
60888
  let lastError = null;
60889
+ const retainMainTransportFailure = (error) => {
60890
+ retainedMainAttemptFailure = {
60891
+ kind: "transport",
60892
+ error: error instanceof Error ? error : new Error(String(error))
60893
+ };
60894
+ };
60895
+ const terminalMainAttemptFailure = async (fallbackMessage) => {
60896
+ const failure2 = retainedMainAttemptFailure;
60897
+ if (failure2?.kind === "http") {
60898
+ const context = failure2.context;
60899
+ return wire.transformResponse(
60900
+ context.response,
60901
+ context.streaming,
60902
+ context.debugContext,
60903
+ context.requestedModel,
60904
+ context.projectId,
60905
+ context.endpoint,
60906
+ context.effectiveModel,
60907
+ context.sessionId,
60908
+ context.toolDebugMissing,
60909
+ context.toolDebugSummary,
60910
+ debugLines,
60911
+ context.dumpContext
60912
+ );
60913
+ }
60914
+ throw terminalFetchError(
60915
+ lastError ?? (failure2?.kind === "transport" ? failure2.error : null),
60916
+ fallbackMessage
60917
+ );
60918
+ };
60861
60919
  const abortSignal = init?.signal ?? void 0;
60862
60920
  const routingSleep = (ms, reason, attempt) => waits.sleep(
60863
60921
  ms,
@@ -61474,7 +61532,7 @@ function createRequestExecutor(deps) {
61474
61532
  }
61475
61533
  }
61476
61534
  const selected = account;
61477
- const sendPhysical = async (url, sendInit, admission, sendModel, requestKind) => {
61535
+ const sendPhysical = async (url, sendInit, admission, sendModel, requestKind, onMainTransportFailure) => {
61478
61536
  const source = credentials.domain === "local" ? "local" : hasVaultHost2() ? "hosted" : "vault";
61479
61537
  const message = `request-send source=${source} model=${sendModel} account=Account ${account.index + 1}`;
61480
61538
  if (source === "local") log18.info(message);
@@ -61490,10 +61548,15 @@ function createRequestExecutor(deps) {
61490
61548
  abortSignal
61491
61549
  ) : void 0;
61492
61550
  try {
61493
- const response = await transport(url, sendInit, {
61494
- signal: abortSignal,
61495
- onDebug: pushDebug
61496
- });
61551
+ const response = await transport(
61552
+ url,
61553
+ sendInit,
61554
+ {
61555
+ signal: abortSignal,
61556
+ onDebug: pushDebug
61557
+ },
61558
+ onMainTransportFailure
61559
+ );
61497
61560
  return billing?.observe(response) ?? response;
61498
61561
  } catch (error) {
61499
61562
  billing?.end(false);
@@ -61755,6 +61818,12 @@ function createRequestExecutor(deps) {
61755
61818
  toolDebugSummary: prepared.toolDebugSummary,
61756
61819
  dumpContext
61757
61820
  });
61821
+ const retainHttpFailure = (failureResponse) => {
61822
+ retainedMainAttemptFailure = {
61823
+ kind: "http",
61824
+ context: createFailureContext(failureResponse)
61825
+ };
61826
+ };
61758
61827
  await runThinkingWarmup(prepared, sendProjectId);
61759
61828
  await runCacheWarmupProbe(prepared);
61760
61829
  if (config.request_jitter_max_ms > 0) {
@@ -61787,7 +61856,8 @@ function createRequestExecutor(deps) {
61787
61856
  prepared.init,
61788
61857
  sendAdmission,
61789
61858
  prepared.effectiveModel ?? model ?? "unknown",
61790
- kind ?? "primary"
61859
+ kind ?? "primary",
61860
+ retainMainTransportFailure
61791
61861
  );
61792
61862
  if (response.ok) deadline.acceptHeaders();
61793
61863
  apiRequestCount++;
@@ -61915,13 +61985,35 @@ function createRequestExecutor(deps) {
61915
61985
  "UNKNOWN",
61916
61986
  delayMs
61917
61987
  );
61988
+ const now = Date.now();
61989
+ const at = account.cachedQuotaUpdatedAt;
61990
+ const sameQuotaIdentity = credentials.domain === "vault" || account.cachedQuotaAccountId === quotaAccountIdentity(
61991
+ parseRefreshParts(
61992
+ credentials.toAuthDetails(account).refresh
61993
+ ).refreshToken
61994
+ );
61995
+ const emptyUntil = sameQuotaIdentity && at !== void 0 && now - at <= softQuotaCacheTtlMs ? quotaExhaustedUntil(account, family, model, now) : 0;
61996
+ const quotaKey3 = getQuotaKey(family, model);
61997
+ const resets = account.rateLimitResetTimes;
61998
+ if (emptyUntil > (resets[quotaKey3] ?? 0))
61999
+ accountManager.markRateLimited(
62000
+ account,
62001
+ emptyUntil - now,
62002
+ family,
62003
+ model
62004
+ );
61918
62005
  accountManager.requestSaveToDisk();
62006
+ if ((resets[quotaKey3] ?? 0) > now + delayMs) {
62007
+ switchedForUnconfirmed = true;
62008
+ shouldSwitchAccount = true;
62009
+ break;
62010
+ }
61919
62011
  if (unconfirmedRetries >= MAX_UNCONFIRMED_RATE_LIMIT_RETRIES)
61920
62012
  return terminal();
61921
62013
  unconfirmedRetries++;
61922
62014
  const ready = accountManager.getAccounts().some((entry) => {
61923
- const resets = entry.rateLimitResetTimes;
61924
- return entry.index !== account.index && entry.enabled !== false && !entry.accountIneligible && !entry.verificationRequired && !allowlistExcluded?.has(entry.index) && !unavailableIndexes.has(entry.index) && (eligibleIndexes === null || eligibleIndexes.has(entry.index)) && (entry.coolingDownUntil ?? 0) <= Date.now() && (resets[family] ?? 0) <= Date.now() && (resets[getQuotaKey(family, model)] ?? 0) <= Date.now();
62015
+ const resets2 = entry.rateLimitResetTimes;
62016
+ return entry.index !== account.index && entry.enabled !== false && !entry.accountIneligible && !entry.verificationRequired && !allowlistExcluded?.has(entry.index) && !unavailableIndexes.has(entry.index) && (eligibleIndexes === null || eligibleIndexes.has(entry.index)) && (entry.coolingDownUntil ?? 0) <= Date.now() && (resets2[family] ?? 0) <= Date.now() && (resets2[getQuotaKey(family, model)] ?? 0) <= Date.now();
61925
62017
  });
61926
62018
  if (ready) {
61927
62019
  switchedForUnconfirmed = true;
@@ -61929,6 +62021,11 @@ function createRequestExecutor(deps) {
61929
62021
  break;
61930
62022
  }
61931
62023
  await routingSleep(delayMs, "rate_limited", unconfirmedRetries);
62024
+ if ((resets[quotaKey3] ?? 0) > now + delayMs) {
62025
+ switchedForUnconfirmed = true;
62026
+ shouldSwitchAccount = true;
62027
+ break;
62028
+ }
61932
62029
  i -= 1;
61933
62030
  continue;
61934
62031
  }
@@ -61958,7 +62055,7 @@ function createRequestExecutor(deps) {
61958
62055
  pushDebug(
61959
62056
  `Total capacity retries (${MAX_TOTAL_CAPACITY_RETRIES}) exhausted, switching account`
61960
62057
  );
61961
- lastFailure = createFailureContext(response);
62058
+ retainHttpFailure(response);
61962
62059
  shouldSwitchAccount = true;
61963
62060
  break;
61964
62061
  }
@@ -62108,7 +62205,7 @@ function createRequestExecutor(deps) {
62108
62205
  backoff.attempt
62109
62206
  );
62110
62207
  }
62111
- lastFailure = createFailureContext(response);
62208
+ retainHttpFailure(response);
62112
62209
  shouldSwitchAccount = true;
62113
62210
  break;
62114
62211
  }
@@ -62170,7 +62267,7 @@ function createRequestExecutor(deps) {
62170
62267
  `account-ineligible: disabled account ${account.index}`
62171
62268
  );
62172
62269
  trackers.health.recordFailure(account.index);
62173
- lastFailure = createFailureContext(response);
62270
+ retainHttpFailure(response);
62174
62271
  shouldSwitchAccount = true;
62175
62272
  break;
62176
62273
  }
@@ -62205,7 +62302,7 @@ function createRequestExecutor(deps) {
62205
62302
  `verification-required: disabled account ${account.index}`
62206
62303
  );
62207
62304
  trackers.health.recordFailure(account.index);
62208
- lastFailure = createFailureContext(response);
62305
+ retainHttpFailure(response);
62209
62306
  shouldSwitchAccount = true;
62210
62307
  break;
62211
62308
  }
@@ -62213,7 +62310,7 @@ function createRequestExecutor(deps) {
62213
62310
  const shouldRetryEndpoint = response.status === 404 || response.status >= 500;
62214
62311
  if (shouldRetryEndpoint && i < ANTIGRAVITY_ENDPOINT_FALLBACKS.length - 1) {
62215
62312
  await logResponseBody2(debugContext, response, response.status);
62216
- lastFailure = createFailureContext(response);
62313
+ retainHttpFailure(response);
62217
62314
  continue;
62218
62315
  }
62219
62316
  if (response.ok) {
@@ -62484,68 +62581,16 @@ function createRequestExecutor(deps) {
62484
62581
  pushDebug(
62485
62582
  `account-switch-cap: exceeded max_account_switches=${maxAccountSwitches}, giving up`
62486
62583
  );
62487
- if (lastFailure) {
62488
- return wire.transformResponse(
62489
- lastFailure.response,
62490
- lastFailure.streaming,
62491
- lastFailure.debugContext,
62492
- lastFailure.requestedModel,
62493
- lastFailure.projectId,
62494
- lastFailure.endpoint,
62495
- lastFailure.effectiveModel,
62496
- lastFailure.sessionId,
62497
- lastFailure.toolDebugMissing,
62498
- lastFailure.toolDebugSummary,
62499
- debugLines,
62500
- lastFailure.dumpContext
62501
- );
62502
- }
62503
- throw terminalFetchError(
62504
- lastError,
62584
+ return terminalMainAttemptFailure(
62505
62585
  `Exceeded max account switches (${maxAccountSwitches}). All accounts rate-limited.`
62506
62586
  );
62507
62587
  }
62508
62588
  if (accountCount <= 1) {
62509
- if (lastFailure) {
62510
- return wire.transformResponse(
62511
- lastFailure.response,
62512
- lastFailure.streaming,
62513
- lastFailure.debugContext,
62514
- lastFailure.requestedModel,
62515
- lastFailure.projectId,
62516
- lastFailure.endpoint,
62517
- lastFailure.effectiveModel,
62518
- lastFailure.sessionId,
62519
- lastFailure.toolDebugMissing,
62520
- lastFailure.toolDebugSummary,
62521
- debugLines,
62522
- lastFailure.dumpContext
62523
- );
62524
- }
62525
- throw terminalFetchError(
62526
- lastError,
62527
- "All Antigravity endpoints failed"
62528
- );
62589
+ return terminalMainAttemptFailure("All Antigravity endpoints failed");
62529
62590
  }
62530
62591
  continue;
62531
62592
  }
62532
- if (lastFailure) {
62533
- return wire.transformResponse(
62534
- lastFailure.response,
62535
- lastFailure.streaming,
62536
- lastFailure.debugContext,
62537
- lastFailure.requestedModel,
62538
- lastFailure.projectId,
62539
- lastFailure.endpoint,
62540
- lastFailure.effectiveModel,
62541
- lastFailure.sessionId,
62542
- lastFailure.toolDebugMissing,
62543
- lastFailure.toolDebugSummary,
62544
- debugLines,
62545
- lastFailure.dumpContext
62546
- );
62547
- }
62548
- throw terminalFetchError(lastError, "All Antigravity accounts failed");
62593
+ return terminalMainAttemptFailure("All Antigravity accounts failed");
62549
62594
  }
62550
62595
  }
62551
62596
  function drain() {