@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.
- package/dist/cli.js +13 -6
- package/dist/cli.js.map +3 -3
- package/dist/cli.meta.json +14 -14
- package/dist/index.js +125 -80
- package/dist/index.js.map +3 -3
- package/dist/index.meta.json +19 -19
- package/dist/server.js +125 -80
- package/dist/server.js.map +3 -3
- package/dist/server.meta.json +1 -1
- package/dist/src/common-auth-embedded/fs/canonical-file-path.js +6 -2
- package/dist/src/common-auth-embedded/source-output.json +22 -22
- package/dist/src/common-auth-embedded/store/index.d.ts +1 -1
- package/dist/src/common-auth-embedded/store/index.js +1 -1
- package/dist/src/common-auth-embedded/store/settings.d.ts +8 -0
- package/dist/src/common-auth-embedded/store/settings.js +14 -4
- package/dist/src/plugin/__fixtures__/verified-store.js +2 -2
- package/dist/src/plugin/shared/request-services.d.ts +1 -0
- package/dist/src/plugin/shared/request-services.d.ts.map +1 -1
- package/dist/src/plugin/shared/request-services.js +81 -24
- package/dist/src/plugin/shared/request-services.js.map +1 -1
- package/dist/tui-build-map.json +1 -1
- package/dist/tui-ga-build-map.json +1 -1
- package/dist/types/src/common-auth-embedded/store/index.d.ts +1 -1
- package/dist/types/src/common-auth-embedded/store/settings.d.ts +8 -0
- package/dist/types/src/plugin/shared/request-services.d.ts +1 -0
- package/dist/types/src/plugin/shared/request-services.d.ts.map +1 -1
- package/package.json +2 -2
- package/src/common-auth-embedded/fs/canonical-file-path.js +6 -2
- package/src/common-auth-embedded/source-output.json +22 -22
- package/src/common-auth-embedded/store/index.d.ts +1 -1
- package/src/common-auth-embedded/store/index.js +1 -1
- package/src/common-auth-embedded/store/settings.d.ts +8 -0
- package/src/common-auth-embedded/store/settings.js +14 -4
package/dist/index.meta.json
CHANGED
|
@@ -120,12 +120,12 @@
|
|
|
120
120
|
"format": "esm"
|
|
121
121
|
},
|
|
122
122
|
"../core/dist/rotation.js": {
|
|
123
|
-
"bytes":
|
|
123
|
+
"bytes": 16191,
|
|
124
124
|
"imports": [],
|
|
125
125
|
"format": "esm"
|
|
126
126
|
},
|
|
127
127
|
"../core/dist/account-selector.js": {
|
|
128
|
-
"bytes":
|
|
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":
|
|
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":
|
|
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":
|
|
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":
|
|
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":
|
|
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":
|
|
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":
|
|
3865
|
+
"bytes": 2287,
|
|
3866
3866
|
"imports": [
|
|
3867
3867
|
{
|
|
3868
3868
|
"path": "node:path",
|
|
@@ -7066,7 +7066,7 @@
|
|
|
7066
7066
|
"format": "esm"
|
|
7067
7067
|
},
|
|
7068
7068
|
"src/plugin/shared/request-services.ts": {
|
|
7069
|
-
"bytes":
|
|
7069
|
+
"bytes": 143457,
|
|
7070
7070
|
"imports": [
|
|
7071
7071
|
{
|
|
7072
7072
|
"path": "node:crypto",
|
|
@@ -7636,7 +7636,7 @@
|
|
|
7636
7636
|
"imports": [],
|
|
7637
7637
|
"exports": [],
|
|
7638
7638
|
"inputs": {},
|
|
7639
|
-
"bytes":
|
|
7639
|
+
"bytes": 5312550
|
|
7640
7640
|
},
|
|
7641
7641
|
"dist/index.js": {
|
|
7642
7642
|
"imports": [
|
|
@@ -9012,10 +9012,10 @@
|
|
|
9012
9012
|
"bytesInOutput": 18528
|
|
9013
9013
|
},
|
|
9014
9014
|
"../core/dist/rotation.js": {
|
|
9015
|
-
"bytesInOutput":
|
|
9015
|
+
"bytesInOutput": 12158
|
|
9016
9016
|
},
|
|
9017
9017
|
"../core/dist/account-selector.js": {
|
|
9018
|
-
"bytesInOutput":
|
|
9018
|
+
"bytesInOutput": 59930
|
|
9019
9019
|
},
|
|
9020
9020
|
"../core/dist/account-repository.js": {
|
|
9021
9021
|
"bytesInOutput": 81767
|
|
@@ -9168,16 +9168,16 @@
|
|
|
9168
9168
|
"bytesInOutput": 2113
|
|
9169
9169
|
},
|
|
9170
9170
|
"../core/dist/common-auth-embedded/store/settings.js": {
|
|
9171
|
-
"bytesInOutput":
|
|
9171
|
+
"bytesInOutput": 4211
|
|
9172
9172
|
},
|
|
9173
9173
|
"../core/dist/common-auth-embedded/store/pool.js": {
|
|
9174
9174
|
"bytesInOutput": 5229
|
|
9175
9175
|
},
|
|
9176
9176
|
"../core/dist/common-auth-embedded/store/index.js": {
|
|
9177
|
-
"bytesInOutput":
|
|
9177
|
+
"bytesInOutput": 1098
|
|
9178
9178
|
},
|
|
9179
9179
|
"../core/dist/common-auth-embedded/fs/canonical-file-path.js": {
|
|
9180
|
-
"bytesInOutput":
|
|
9180
|
+
"bytesInOutput": 1592
|
|
9181
9181
|
},
|
|
9182
9182
|
"../core/dist/common-auth-embedded/fs/lock-constants.js": {
|
|
9183
9183
|
"bytesInOutput": 476
|
|
@@ -9318,7 +9318,7 @@
|
|
|
9318
9318
|
"bytesInOutput": 8757
|
|
9319
9319
|
},
|
|
9320
9320
|
"../core/dist/harness-identity.js": {
|
|
9321
|
-
"bytesInOutput":
|
|
9321
|
+
"bytesInOutput": 3256
|
|
9322
9322
|
},
|
|
9323
9323
|
"../core/dist/model-types.js": {
|
|
9324
9324
|
"bytesInOutput": 93
|
|
@@ -9873,7 +9873,7 @@
|
|
|
9873
9873
|
"bytesInOutput": 7731
|
|
9874
9874
|
},
|
|
9875
9875
|
"src/plugin/shared/request-services.ts": {
|
|
9876
|
-
"bytesInOutput":
|
|
9876
|
+
"bytesInOutput": 95997
|
|
9877
9877
|
},
|
|
9878
9878
|
"src/common-auth-embedded/routing-accessor/handle.js": {
|
|
9879
9879
|
"bytesInOutput": 297
|
|
@@ -9930,7 +9930,7 @@
|
|
|
9930
9930
|
"bytesInOutput": 0
|
|
9931
9931
|
}
|
|
9932
9932
|
},
|
|
9933
|
-
"bytes":
|
|
9933
|
+
"bytes": 2406260
|
|
9934
9934
|
}
|
|
9935
9935
|
}
|
|
9936
9936
|
}
|
package/dist/server.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
|
-
|
|
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
|
-
|
|
18077
|
-
|
|
18078
|
-
|
|
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([
|
|
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
|
|
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
|
|
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
|
];
|
|
@@ -50661,11 +50677,23 @@ function createRequestExecutor(deps) {
|
|
|
50661
50677
|
};
|
|
50662
50678
|
}
|
|
50663
50679
|
const sender = options.transport ?? defaultTransport2;
|
|
50664
|
-
const transport = (url, sendInit, sendOptions) => deadline.open(() => {
|
|
50680
|
+
const transport = (url, sendInit, sendOptions, onSenderRejection) => deadline.open(() => {
|
|
50665
50681
|
waits.resumed();
|
|
50666
|
-
|
|
50682
|
+
const optionsWithSignal = {
|
|
50667
50683
|
...sendOptions,
|
|
50668
50684
|
signal: deadline.signal
|
|
50685
|
+
};
|
|
50686
|
+
if (!onSenderRejection) return sender(url, sendInit, optionsWithSignal);
|
|
50687
|
+
let pending;
|
|
50688
|
+
try {
|
|
50689
|
+
pending = sender(url, sendInit, optionsWithSignal);
|
|
50690
|
+
} catch (error) {
|
|
50691
|
+
onSenderRejection(error);
|
|
50692
|
+
throw error;
|
|
50693
|
+
}
|
|
50694
|
+
return pending.catch((error) => {
|
|
50695
|
+
onSenderRejection(error);
|
|
50696
|
+
throw error;
|
|
50669
50697
|
});
|
|
50670
50698
|
});
|
|
50671
50699
|
const requestSessionIdentity = options.session ?? extractOpenCodeSessionIdentity(init?.headers);
|
|
@@ -50714,8 +50742,38 @@ function createRequestExecutor(deps) {
|
|
|
50714
50742
|
`[Cache] ${label} model=${cachedStats.model} read=${cachedStats.read} total=${cachedStats.total} hitRate=${cachedStats.hitRate}%`
|
|
50715
50743
|
);
|
|
50716
50744
|
}
|
|
50717
|
-
let
|
|
50745
|
+
let retainedMainAttemptFailure = null;
|
|
50718
50746
|
let lastError = null;
|
|
50747
|
+
const retainMainTransportFailure = (error) => {
|
|
50748
|
+
retainedMainAttemptFailure = {
|
|
50749
|
+
kind: "transport",
|
|
50750
|
+
error: error instanceof Error ? error : new Error(String(error))
|
|
50751
|
+
};
|
|
50752
|
+
};
|
|
50753
|
+
const terminalMainAttemptFailure = async (fallbackMessage) => {
|
|
50754
|
+
const failure2 = retainedMainAttemptFailure;
|
|
50755
|
+
if (failure2?.kind === "http") {
|
|
50756
|
+
const context = failure2.context;
|
|
50757
|
+
return wire.transformResponse(
|
|
50758
|
+
context.response,
|
|
50759
|
+
context.streaming,
|
|
50760
|
+
context.debugContext,
|
|
50761
|
+
context.requestedModel,
|
|
50762
|
+
context.projectId,
|
|
50763
|
+
context.endpoint,
|
|
50764
|
+
context.effectiveModel,
|
|
50765
|
+
context.sessionId,
|
|
50766
|
+
context.toolDebugMissing,
|
|
50767
|
+
context.toolDebugSummary,
|
|
50768
|
+
debugLines,
|
|
50769
|
+
context.dumpContext
|
|
50770
|
+
);
|
|
50771
|
+
}
|
|
50772
|
+
throw terminalFetchError(
|
|
50773
|
+
lastError ?? (failure2?.kind === "transport" ? failure2.error : null),
|
|
50774
|
+
fallbackMessage
|
|
50775
|
+
);
|
|
50776
|
+
};
|
|
50719
50777
|
const abortSignal = init?.signal ?? void 0;
|
|
50720
50778
|
const routingSleep = (ms, reason, attempt) => waits.sleep(
|
|
50721
50779
|
ms,
|
|
@@ -51332,7 +51390,7 @@ function createRequestExecutor(deps) {
|
|
|
51332
51390
|
}
|
|
51333
51391
|
}
|
|
51334
51392
|
const selected = account;
|
|
51335
|
-
const sendPhysical = async (url, sendInit, admission, sendModel, requestKind) => {
|
|
51393
|
+
const sendPhysical = async (url, sendInit, admission, sendModel, requestKind, onMainTransportFailure) => {
|
|
51336
51394
|
const source = credentials.domain === "local" ? "local" : hasVaultHost2() ? "hosted" : "vault";
|
|
51337
51395
|
const message = `request-send source=${source} model=${sendModel} account=Account ${account.index + 1}`;
|
|
51338
51396
|
if (source === "local") log18.info(message);
|
|
@@ -51348,10 +51406,15 @@ function createRequestExecutor(deps) {
|
|
|
51348
51406
|
abortSignal
|
|
51349
51407
|
) : void 0;
|
|
51350
51408
|
try {
|
|
51351
|
-
const response = await transport(
|
|
51352
|
-
|
|
51353
|
-
|
|
51354
|
-
|
|
51409
|
+
const response = await transport(
|
|
51410
|
+
url,
|
|
51411
|
+
sendInit,
|
|
51412
|
+
{
|
|
51413
|
+
signal: abortSignal,
|
|
51414
|
+
onDebug: pushDebug
|
|
51415
|
+
},
|
|
51416
|
+
onMainTransportFailure
|
|
51417
|
+
);
|
|
51355
51418
|
return billing?.observe(response) ?? response;
|
|
51356
51419
|
} catch (error) {
|
|
51357
51420
|
billing?.end(false);
|
|
@@ -51613,6 +51676,12 @@ function createRequestExecutor(deps) {
|
|
|
51613
51676
|
toolDebugSummary: prepared.toolDebugSummary,
|
|
51614
51677
|
dumpContext
|
|
51615
51678
|
});
|
|
51679
|
+
const retainHttpFailure = (failureResponse) => {
|
|
51680
|
+
retainedMainAttemptFailure = {
|
|
51681
|
+
kind: "http",
|
|
51682
|
+
context: createFailureContext(failureResponse)
|
|
51683
|
+
};
|
|
51684
|
+
};
|
|
51616
51685
|
await runThinkingWarmup(prepared, sendProjectId);
|
|
51617
51686
|
await runCacheWarmupProbe(prepared);
|
|
51618
51687
|
if (config.request_jitter_max_ms > 0) {
|
|
@@ -51645,7 +51714,8 @@ function createRequestExecutor(deps) {
|
|
|
51645
51714
|
prepared.init,
|
|
51646
51715
|
sendAdmission,
|
|
51647
51716
|
prepared.effectiveModel ?? model ?? "unknown",
|
|
51648
|
-
kind ?? "primary"
|
|
51717
|
+
kind ?? "primary",
|
|
51718
|
+
retainMainTransportFailure
|
|
51649
51719
|
);
|
|
51650
51720
|
if (response.ok) deadline.acceptHeaders();
|
|
51651
51721
|
apiRequestCount++;
|
|
@@ -51773,13 +51843,35 @@ function createRequestExecutor(deps) {
|
|
|
51773
51843
|
"UNKNOWN",
|
|
51774
51844
|
delayMs
|
|
51775
51845
|
);
|
|
51846
|
+
const now = Date.now();
|
|
51847
|
+
const at = account.cachedQuotaUpdatedAt;
|
|
51848
|
+
const sameQuotaIdentity = credentials.domain === "vault" || account.cachedQuotaAccountId === quotaAccountIdentity(
|
|
51849
|
+
parseRefreshParts(
|
|
51850
|
+
credentials.toAuthDetails(account).refresh
|
|
51851
|
+
).refreshToken
|
|
51852
|
+
);
|
|
51853
|
+
const emptyUntil = sameQuotaIdentity && at !== void 0 && now - at <= softQuotaCacheTtlMs ? quotaExhaustedUntil(account, family, model, now) : 0;
|
|
51854
|
+
const quotaKey3 = getQuotaKey(family, model);
|
|
51855
|
+
const resets = account.rateLimitResetTimes;
|
|
51856
|
+
if (emptyUntil > (resets[quotaKey3] ?? 0))
|
|
51857
|
+
accountManager.markRateLimited(
|
|
51858
|
+
account,
|
|
51859
|
+
emptyUntil - now,
|
|
51860
|
+
family,
|
|
51861
|
+
model
|
|
51862
|
+
);
|
|
51776
51863
|
accountManager.requestSaveToDisk();
|
|
51864
|
+
if ((resets[quotaKey3] ?? 0) > now + delayMs) {
|
|
51865
|
+
switchedForUnconfirmed = true;
|
|
51866
|
+
shouldSwitchAccount = true;
|
|
51867
|
+
break;
|
|
51868
|
+
}
|
|
51777
51869
|
if (unconfirmedRetries >= MAX_UNCONFIRMED_RATE_LIMIT_RETRIES)
|
|
51778
51870
|
return terminal();
|
|
51779
51871
|
unconfirmedRetries++;
|
|
51780
51872
|
const ready = accountManager.getAccounts().some((entry) => {
|
|
51781
|
-
const
|
|
51782
|
-
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() && (
|
|
51873
|
+
const resets2 = entry.rateLimitResetTimes;
|
|
51874
|
+
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();
|
|
51783
51875
|
});
|
|
51784
51876
|
if (ready) {
|
|
51785
51877
|
switchedForUnconfirmed = true;
|
|
@@ -51787,6 +51879,11 @@ function createRequestExecutor(deps) {
|
|
|
51787
51879
|
break;
|
|
51788
51880
|
}
|
|
51789
51881
|
await routingSleep(delayMs, "rate_limited", unconfirmedRetries);
|
|
51882
|
+
if ((resets[quotaKey3] ?? 0) > now + delayMs) {
|
|
51883
|
+
switchedForUnconfirmed = true;
|
|
51884
|
+
shouldSwitchAccount = true;
|
|
51885
|
+
break;
|
|
51886
|
+
}
|
|
51790
51887
|
i -= 1;
|
|
51791
51888
|
continue;
|
|
51792
51889
|
}
|
|
@@ -51816,7 +51913,7 @@ function createRequestExecutor(deps) {
|
|
|
51816
51913
|
pushDebug(
|
|
51817
51914
|
`Total capacity retries (${MAX_TOTAL_CAPACITY_RETRIES}) exhausted, switching account`
|
|
51818
51915
|
);
|
|
51819
|
-
|
|
51916
|
+
retainHttpFailure(response);
|
|
51820
51917
|
shouldSwitchAccount = true;
|
|
51821
51918
|
break;
|
|
51822
51919
|
}
|
|
@@ -51966,7 +52063,7 @@ function createRequestExecutor(deps) {
|
|
|
51966
52063
|
backoff.attempt
|
|
51967
52064
|
);
|
|
51968
52065
|
}
|
|
51969
|
-
|
|
52066
|
+
retainHttpFailure(response);
|
|
51970
52067
|
shouldSwitchAccount = true;
|
|
51971
52068
|
break;
|
|
51972
52069
|
}
|
|
@@ -52028,7 +52125,7 @@ function createRequestExecutor(deps) {
|
|
|
52028
52125
|
`account-ineligible: disabled account ${account.index}`
|
|
52029
52126
|
);
|
|
52030
52127
|
trackers.health.recordFailure(account.index);
|
|
52031
|
-
|
|
52128
|
+
retainHttpFailure(response);
|
|
52032
52129
|
shouldSwitchAccount = true;
|
|
52033
52130
|
break;
|
|
52034
52131
|
}
|
|
@@ -52063,7 +52160,7 @@ function createRequestExecutor(deps) {
|
|
|
52063
52160
|
`verification-required: disabled account ${account.index}`
|
|
52064
52161
|
);
|
|
52065
52162
|
trackers.health.recordFailure(account.index);
|
|
52066
|
-
|
|
52163
|
+
retainHttpFailure(response);
|
|
52067
52164
|
shouldSwitchAccount = true;
|
|
52068
52165
|
break;
|
|
52069
52166
|
}
|
|
@@ -52071,7 +52168,7 @@ function createRequestExecutor(deps) {
|
|
|
52071
52168
|
const shouldRetryEndpoint = response.status === 404 || response.status >= 500;
|
|
52072
52169
|
if (shouldRetryEndpoint && i < ANTIGRAVITY_ENDPOINT_FALLBACKS.length - 1) {
|
|
52073
52170
|
await logResponseBody2(debugContext, response, response.status);
|
|
52074
|
-
|
|
52171
|
+
retainHttpFailure(response);
|
|
52075
52172
|
continue;
|
|
52076
52173
|
}
|
|
52077
52174
|
if (response.ok) {
|
|
@@ -52342,68 +52439,16 @@ function createRequestExecutor(deps) {
|
|
|
52342
52439
|
pushDebug(
|
|
52343
52440
|
`account-switch-cap: exceeded max_account_switches=${maxAccountSwitches}, giving up`
|
|
52344
52441
|
);
|
|
52345
|
-
|
|
52346
|
-
return wire.transformResponse(
|
|
52347
|
-
lastFailure.response,
|
|
52348
|
-
lastFailure.streaming,
|
|
52349
|
-
lastFailure.debugContext,
|
|
52350
|
-
lastFailure.requestedModel,
|
|
52351
|
-
lastFailure.projectId,
|
|
52352
|
-
lastFailure.endpoint,
|
|
52353
|
-
lastFailure.effectiveModel,
|
|
52354
|
-
lastFailure.sessionId,
|
|
52355
|
-
lastFailure.toolDebugMissing,
|
|
52356
|
-
lastFailure.toolDebugSummary,
|
|
52357
|
-
debugLines,
|
|
52358
|
-
lastFailure.dumpContext
|
|
52359
|
-
);
|
|
52360
|
-
}
|
|
52361
|
-
throw terminalFetchError(
|
|
52362
|
-
lastError,
|
|
52442
|
+
return terminalMainAttemptFailure(
|
|
52363
52443
|
`Exceeded max account switches (${maxAccountSwitches}). All accounts rate-limited.`
|
|
52364
52444
|
);
|
|
52365
52445
|
}
|
|
52366
52446
|
if (accountCount <= 1) {
|
|
52367
|
-
|
|
52368
|
-
return wire.transformResponse(
|
|
52369
|
-
lastFailure.response,
|
|
52370
|
-
lastFailure.streaming,
|
|
52371
|
-
lastFailure.debugContext,
|
|
52372
|
-
lastFailure.requestedModel,
|
|
52373
|
-
lastFailure.projectId,
|
|
52374
|
-
lastFailure.endpoint,
|
|
52375
|
-
lastFailure.effectiveModel,
|
|
52376
|
-
lastFailure.sessionId,
|
|
52377
|
-
lastFailure.toolDebugMissing,
|
|
52378
|
-
lastFailure.toolDebugSummary,
|
|
52379
|
-
debugLines,
|
|
52380
|
-
lastFailure.dumpContext
|
|
52381
|
-
);
|
|
52382
|
-
}
|
|
52383
|
-
throw terminalFetchError(
|
|
52384
|
-
lastError,
|
|
52385
|
-
"All Antigravity endpoints failed"
|
|
52386
|
-
);
|
|
52447
|
+
return terminalMainAttemptFailure("All Antigravity endpoints failed");
|
|
52387
52448
|
}
|
|
52388
52449
|
continue;
|
|
52389
52450
|
}
|
|
52390
|
-
|
|
52391
|
-
return wire.transformResponse(
|
|
52392
|
-
lastFailure.response,
|
|
52393
|
-
lastFailure.streaming,
|
|
52394
|
-
lastFailure.debugContext,
|
|
52395
|
-
lastFailure.requestedModel,
|
|
52396
|
-
lastFailure.projectId,
|
|
52397
|
-
lastFailure.endpoint,
|
|
52398
|
-
lastFailure.effectiveModel,
|
|
52399
|
-
lastFailure.sessionId,
|
|
52400
|
-
lastFailure.toolDebugMissing,
|
|
52401
|
-
lastFailure.toolDebugSummary,
|
|
52402
|
-
debugLines,
|
|
52403
|
-
lastFailure.dumpContext
|
|
52404
|
-
);
|
|
52405
|
-
}
|
|
52406
|
-
throw terminalFetchError(lastError, "All Antigravity accounts failed");
|
|
52451
|
+
return terminalMainAttemptFailure("All Antigravity accounts failed");
|
|
52407
52452
|
}
|
|
52408
52453
|
}
|
|
52409
52454
|
function drain() {
|