@cortexkit/opencode-antigravity-auth 3.0.42 → 3.1.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/README.md +11 -0
- package/dist/cli.js +191 -6
- package/dist/cli.js.map +3 -3
- package/dist/cli.meta.json +19 -19
- package/dist/index.js +725 -264
- package/dist/index.js.map +4 -4
- package/dist/index.meta.json +88 -80
- package/dist/server.js +778 -317
- package/dist/server.js.map +4 -4
- package/dist/server.meta.json +1 -1
- package/dist/src/common-auth-embedded/claustrum/custody.d.ts +4 -0
- package/dist/src/common-auth-embedded/claustrum/custody.js +147 -2
- package/dist/src/common-auth-embedded/claustrum/hub.js +47 -1
- package/dist/src/common-auth-embedded/claustrum/index.d.ts +1 -1
- package/dist/src/common-auth-embedded/claustrum/index.js +1 -1
- package/dist/src/common-auth-embedded/routing-accessor/index.d.ts +34 -9
- package/dist/src/common-auth-embedded/routing-accessor/index.js +65 -8
- package/dist/src/common-auth-embedded/settings/edit.d.ts +1 -0
- package/dist/src/common-auth-embedded/settings/edit.js +48 -2
- package/dist/src/common-auth-embedded/settings/handle.d.ts +2 -1
- package/dist/src/common-auth-embedded/settings/index.d.ts +1 -0
- package/dist/src/common-auth-embedded/settings/update.d.ts +14 -0
- package/dist/src/common-auth-embedded/settings/update.js +28 -9
- package/dist/src/common-auth-embedded/source-output.json +52 -43
- package/dist/src/plugin/__fixtures__/release-model-ids.d.ts.map +1 -1
- package/dist/src/plugin/__fixtures__/release-model-ids.js +1 -0
- package/dist/src/plugin/__fixtures__/release-model-ids.js.map +1 -1
- package/dist/src/plugin/__fixtures__/verified-store.d.ts +1 -1
- package/dist/src/plugin/__fixtures__/verified-store.js +4 -4
- package/dist/src/plugin/account-access.js +1 -1
- package/dist/src/plugin/account-access.js.map +1 -1
- package/dist/src/plugin/catalog.d.ts.map +1 -1
- package/dist/src/plugin/catalog.js +4 -2
- package/dist/src/plugin/catalog.js.map +1 -1
- package/dist/src/plugin/config/models.d.ts +9 -0
- package/dist/src/plugin/config/models.d.ts.map +1 -1
- package/dist/src/plugin/config/models.js +18 -0
- package/dist/src/plugin/config/models.js.map +1 -1
- package/dist/src/plugin/config/updater.js +2 -2
- package/dist/src/plugin/config/updater.js.map +1 -1
- package/dist/src/plugin/core/streaming/terminal-event.d.ts +14 -0
- package/dist/src/plugin/core/streaming/terminal-event.d.ts.map +1 -0
- package/dist/src/plugin/core/streaming/terminal-event.js +39 -0
- package/dist/src/plugin/core/streaming/terminal-event.js.map +1 -0
- package/dist/src/plugin/core/streaming/transformer.d.ts.map +1 -1
- package/dist/src/plugin/core/streaming/transformer.js +1 -13
- package/dist/src/plugin/core/streaming/transformer.js.map +1 -1
- package/dist/src/plugin/ga-location-services.js +1 -1
- package/dist/src/plugin/ga-location-services.js.map +1 -1
- package/dist/src/plugin/index.js +1 -1
- package/dist/src/plugin/index.js.map +1 -1
- package/dist/src/plugin/request.d.ts.map +1 -1
- package/dist/src/plugin/request.js +101 -47
- package/dist/src/plugin/request.js.map +1 -1
- package/dist/src/plugin/search.d.ts +7 -0
- package/dist/src/plugin/search.d.ts.map +1 -1
- package/dist/src/plugin/search.js +9 -15
- package/dist/src/plugin/search.js.map +1 -1
- package/dist/src/plugin/session-context.d.ts +1 -1
- package/dist/src/plugin/session-context.d.ts.map +1 -1
- package/dist/src/plugin/session-context.js +2 -5
- package/dist/src/plugin/session-context.js.map +1 -1
- package/dist/src/plugin/shared/request-services.d.ts.map +1 -1
- package/dist/src/plugin/shared/request-services.js +59 -11
- package/dist/src/plugin/shared/request-services.js.map +1 -1
- package/dist/src/plugin/shared/vault-routing.d.ts +9 -1
- package/dist/src/plugin/shared/vault-routing.d.ts.map +1 -1
- package/dist/src/plugin/shared/vault-routing.js +34 -12
- package/dist/src/plugin/shared/vault-routing.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/claustrum/custody.d.ts +4 -0
- package/dist/types/src/common-auth-embedded/claustrum/index.d.ts +1 -1
- package/dist/types/src/common-auth-embedded/routing-accessor/index.d.ts +34 -9
- package/dist/types/src/plugin/catalog.d.ts.map +1 -1
- package/dist/types/src/plugin/config/models.d.ts +9 -0
- package/dist/types/src/plugin/config/models.d.ts.map +1 -1
- package/dist/types/src/plugin/core/streaming/terminal-event.d.ts +14 -0
- package/dist/types/src/plugin/core/streaming/terminal-event.d.ts.map +1 -0
- package/dist/types/src/plugin/core/streaming/transformer.d.ts.map +1 -1
- package/dist/types/src/plugin/request.d.ts.map +1 -1
- package/dist/types/src/plugin/search.d.ts +7 -0
- package/dist/types/src/plugin/search.d.ts.map +1 -1
- package/dist/types/src/plugin/session-context.d.ts +1 -1
- package/dist/types/src/plugin/session-context.d.ts.map +1 -1
- package/dist/types/src/plugin/shared/request-services.d.ts.map +1 -1
- package/dist/types/src/plugin/shared/vault-routing.d.ts +9 -1
- package/dist/types/src/plugin/shared/vault-routing.d.ts.map +1 -1
- package/package.json +2 -2
- package/src/common-auth-embedded/claustrum/custody.d.ts +4 -0
- package/src/common-auth-embedded/claustrum/custody.js +147 -2
- package/src/common-auth-embedded/claustrum/hub.js +47 -1
- package/src/common-auth-embedded/claustrum/index.d.ts +1 -1
- package/src/common-auth-embedded/claustrum/index.js +1 -1
- package/src/common-auth-embedded/routing-accessor/index.d.ts +34 -9
- package/src/common-auth-embedded/routing-accessor/index.js +65 -8
- package/src/common-auth-embedded/settings/edit.d.ts +1 -0
- package/src/common-auth-embedded/settings/edit.js +48 -2
- package/src/common-auth-embedded/settings/handle.d.ts +2 -1
- package/src/common-auth-embedded/settings/index.d.ts +1 -0
- package/src/common-auth-embedded/settings/update.d.ts +14 -0
- package/src/common-auth-embedded/settings/update.js +28 -9
- package/src/common-auth-embedded/source-output.json +52 -43
package/dist/server.js
CHANGED
|
@@ -5873,8 +5873,8 @@ var AGY_CLI_VERSION, AGY_CLI_CHANGE_LIST, ANTIGRAVITY_API_CLIENT, MAX_FINGERPRIN
|
|
|
5873
5873
|
var init_fingerprint = __esm({
|
|
5874
5874
|
"../core/dist/fingerprint.js"() {
|
|
5875
5875
|
"use strict";
|
|
5876
|
-
AGY_CLI_VERSION = "1.
|
|
5877
|
-
AGY_CLI_CHANGE_LIST = "
|
|
5876
|
+
AGY_CLI_VERSION = "1.5.8";
|
|
5877
|
+
AGY_CLI_CHANGE_LIST = "1020628950";
|
|
5878
5878
|
ANTIGRAVITY_API_CLIENT = "antigravity-cli";
|
|
5879
5879
|
MAX_FINGERPRINT_HISTORY = 5;
|
|
5880
5880
|
sessionFingerprint = null;
|
|
@@ -5933,6 +5933,8 @@ function getGemini38FlashAntigravityModel(tier) {
|
|
|
5933
5933
|
}
|
|
5934
5934
|
function getQuotaGroupForModel(modelId, hasArgonPool = false) {
|
|
5935
5935
|
const normalized = modelId.toLowerCase();
|
|
5936
|
+
if (isGeminiHydrogenModel(normalized))
|
|
5937
|
+
return "gemini";
|
|
5936
5938
|
if (isGeminiCarbonModel(normalized))
|
|
5937
5939
|
return "gemini";
|
|
5938
5940
|
if (isGeminiArgonModel(normalized))
|
|
@@ -5950,6 +5952,20 @@ function isGeminiArgonModel(model) {
|
|
|
5950
5952
|
function isGeminiCarbonModel(model) {
|
|
5951
5953
|
return /^(?:antigravity-)?gemini-4-carbon(?:-(?:low|medium|high))?$/.test(model.toLowerCase());
|
|
5952
5954
|
}
|
|
5955
|
+
function isGeminiHydrogenModel(model) {
|
|
5956
|
+
return /^(?:antigravity-)?gemini-4-hydrogen(?:-(?:low|medium|high|xhigh))?$/.test(model.toLowerCase());
|
|
5957
|
+
}
|
|
5958
|
+
function getGeminiHydrogenAntigravityModel(tier) {
|
|
5959
|
+
return getTieredAntigravityModel({
|
|
5960
|
+
defaultModel: "gemini-4-hydrogen-high",
|
|
5961
|
+
byTier: {
|
|
5962
|
+
low: "gemini-4-hydrogen-low",
|
|
5963
|
+
medium: "gemini-4-hydrogen-medium",
|
|
5964
|
+
high: "gemini-4-hydrogen-high",
|
|
5965
|
+
xhigh: "gemini-4-hydrogen-xhigh"
|
|
5966
|
+
}
|
|
5967
|
+
}, tier);
|
|
5968
|
+
}
|
|
5953
5969
|
function getGeminiCarbonAntigravityModel(tier) {
|
|
5954
5970
|
return getTieredAntigravityModel({
|
|
5955
5971
|
defaultModel: "gemini-4-carbon-medium",
|
|
@@ -5982,6 +5998,36 @@ var init_model_registry = __esm({
|
|
|
5982
5998
|
DEFAULT_COST = { input: 0, output: 0 };
|
|
5983
5999
|
DEFAULT_OPTIONS = {};
|
|
5984
6000
|
AGY_NATIVE_MODEL_DEFINITIONS = {
|
|
6001
|
+
// Context: Google's "Introducing Gemini 4 Hydrogen" announcement (12 Nov 2026).
|
|
6002
|
+
// Output caps and route enums: native CLI 1.5.5 capture (13 Nov 2026).
|
|
6003
|
+
"gemini-4-hydrogen-low": {
|
|
6004
|
+
displayName: "Gemini 4 Hydrogen (Low)",
|
|
6005
|
+
maxTokens: 1048576,
|
|
6006
|
+
maxOutputTokens: 262144,
|
|
6007
|
+
model: "MODEL_PLACEHOLDER_M527",
|
|
6008
|
+
supportsThinking: true
|
|
6009
|
+
},
|
|
6010
|
+
"gemini-4-hydrogen-medium": {
|
|
6011
|
+
displayName: "Gemini 4 Hydrogen (Medium)",
|
|
6012
|
+
maxTokens: 1048576,
|
|
6013
|
+
maxOutputTokens: 262144,
|
|
6014
|
+
model: "MODEL_PLACEHOLDER_M526",
|
|
6015
|
+
supportsThinking: true
|
|
6016
|
+
},
|
|
6017
|
+
"gemini-4-hydrogen-high": {
|
|
6018
|
+
displayName: "Gemini 4 Hydrogen (High)",
|
|
6019
|
+
maxTokens: 1048576,
|
|
6020
|
+
maxOutputTokens: 262144,
|
|
6021
|
+
model: "MODEL_PLACEHOLDER_M525",
|
|
6022
|
+
supportsThinking: true
|
|
6023
|
+
},
|
|
6024
|
+
"gemini-4-hydrogen-xhigh": {
|
|
6025
|
+
displayName: "Gemini 4 Hydrogen (XHigh)",
|
|
6026
|
+
maxTokens: 1048576,
|
|
6027
|
+
maxOutputTokens: 262144,
|
|
6028
|
+
model: "MODEL_PLACEHOLDER_M528",
|
|
6029
|
+
supportsThinking: true
|
|
6030
|
+
},
|
|
5985
6031
|
"gemini-4-carbon-low": {
|
|
5986
6032
|
displayName: "Gemini 4 Carbon (Low)",
|
|
5987
6033
|
maxTokens: 1048576,
|
|
@@ -6136,6 +6182,18 @@ var init_model_registry = __esm({
|
|
|
6136
6182
|
};
|
|
6137
6183
|
RETIRED_AGY_MODEL_MESSAGE = "This Antigravity model is no longer offered. Use Gemini 3.8 Flash, or Claude Sonnet 5.5 or Opus 5.5.";
|
|
6138
6184
|
ALL_MODEL_DEFINITIONS = {
|
|
6185
|
+
"antigravity-gemini-4-hydrogen": defineModel("antigravity-gemini-4-hydrogen", {
|
|
6186
|
+
name: "Gemini 4 Hydrogen (Antigravity)",
|
|
6187
|
+
reasoning: true,
|
|
6188
|
+
limit: { context: 1048576, output: 262144 },
|
|
6189
|
+
modalities: DEFAULT_MODALITIES,
|
|
6190
|
+
variants: {
|
|
6191
|
+
low: { thinkingLevel: "low" },
|
|
6192
|
+
medium: { thinkingLevel: "medium" },
|
|
6193
|
+
high: { thinkingLevel: "high" },
|
|
6194
|
+
xhigh: { thinkingLevel: "xhigh" }
|
|
6195
|
+
}
|
|
6196
|
+
}),
|
|
6139
6197
|
"antigravity-gemini-4-argon": defineModel("antigravity-gemini-4-argon", {
|
|
6140
6198
|
name: "Gemini 4 Argon (Antigravity)",
|
|
6141
6199
|
reasoning: true,
|
|
@@ -6304,6 +6362,7 @@ var init_model_registry = __esm({
|
|
|
6304
6362
|
ANTIGRAVITY_OPENCODE_MODEL_IDS = [
|
|
6305
6363
|
"antigravity-gemini-4-argon",
|
|
6306
6364
|
"antigravity-gemini-4-carbon",
|
|
6365
|
+
"antigravity-gemini-4-hydrogen",
|
|
6307
6366
|
"antigravity-gemini-3.8-flash",
|
|
6308
6367
|
"antigravity-gemini-3.1-flash-image",
|
|
6309
6368
|
"antigravity-claude-sonnet-5-5",
|
|
@@ -7942,7 +8001,7 @@ async function rmEvictingDir(evictingPath) {
|
|
|
7942
8001
|
});
|
|
7943
8002
|
}
|
|
7944
8003
|
async function sleep(ms) {
|
|
7945
|
-
await new Promise((
|
|
8004
|
+
await new Promise((resolve32) => setTimeout(resolve32, ms));
|
|
7946
8005
|
}
|
|
7947
8006
|
async function acquireFencedFileLock(options) {
|
|
7948
8007
|
const lockPath = `${options.path}.${options.name}.lock`;
|
|
@@ -8058,8 +8117,8 @@ function buildLock(lockPath, evictingPath, ownerId, options, now) {
|
|
|
8058
8117
|
let released = false;
|
|
8059
8118
|
let lost = false;
|
|
8060
8119
|
let lostResolve = null;
|
|
8061
|
-
let lostPromise = new Promise((
|
|
8062
|
-
lostResolve =
|
|
8120
|
+
let lostPromise = new Promise((resolve32) => {
|
|
8121
|
+
lostResolve = resolve32;
|
|
8063
8122
|
});
|
|
8064
8123
|
const markLost = () => {
|
|
8065
8124
|
if (lost)
|
|
@@ -8069,9 +8128,9 @@ function buildLock(lockPath, evictingPath, ownerId, options, now) {
|
|
|
8069
8128
|
clearInterval(renewTimer);
|
|
8070
8129
|
renewTimer = null;
|
|
8071
8130
|
}
|
|
8072
|
-
const
|
|
8131
|
+
const resolve32 = lostResolve;
|
|
8073
8132
|
lostResolve = null;
|
|
8074
|
-
|
|
8133
|
+
resolve32?.();
|
|
8075
8134
|
};
|
|
8076
8135
|
const setupRenew = () => {
|
|
8077
8136
|
if (options.renew === false)
|
|
@@ -8694,7 +8753,7 @@ async function saveAccountStorageReplace(path5, incoming) {
|
|
|
8694
8753
|
return mutateAccountStorage(path5, () => incoming);
|
|
8695
8754
|
}
|
|
8696
8755
|
async function clearAccountStorage(path5) {
|
|
8697
|
-
const sleep5 = (ms) => new Promise((
|
|
8756
|
+
const sleep5 = (ms) => new Promise((resolve32) => setTimeout(resolve32, ms));
|
|
8698
8757
|
const lock = await acquireWithRetry(path5, sleep5);
|
|
8699
8758
|
try {
|
|
8700
8759
|
await assertLegacyAccountStorageWritable(path5);
|
|
@@ -8742,7 +8801,7 @@ var init_account_storage = __esm({
|
|
|
8742
8801
|
}
|
|
8743
8802
|
};
|
|
8744
8803
|
RETRY_DELAYS_MS = [100, 200, 400, 800, 1e3];
|
|
8745
|
-
DEFAULT_SLEEP = (ms) => new Promise((
|
|
8804
|
+
DEFAULT_SLEEP = (ms) => new Promise((resolve32) => setTimeout(resolve32, ms));
|
|
8746
8805
|
DEFAULT_BUILD_BACKUP_PATH = (path5, now) => `${path5}.corrupt-${now.toISOString().replace(/[:.]/g, "-")}`;
|
|
8747
8806
|
}
|
|
8748
8807
|
});
|
|
@@ -9960,8 +10019,8 @@ var init_account_manager = __esm({
|
|
|
9960
10019
|
await this.saveInFlight;
|
|
9961
10020
|
return;
|
|
9962
10021
|
}
|
|
9963
|
-
return new Promise((
|
|
9964
|
-
this.savePromiseResolvers.push({ resolve:
|
|
10022
|
+
return new Promise((resolve32, reject) => {
|
|
10023
|
+
this.savePromiseResolvers.push({ resolve: resolve32, reject });
|
|
9965
10024
|
});
|
|
9966
10025
|
}
|
|
9967
10026
|
async dispose() {
|
|
@@ -10004,8 +10063,8 @@ var init_account_manager = __esm({
|
|
|
10004
10063
|
reject(error);
|
|
10005
10064
|
throw error;
|
|
10006
10065
|
}
|
|
10007
|
-
for (const { resolve:
|
|
10008
|
-
|
|
10066
|
+
for (const { resolve: resolve32 } of resolvers)
|
|
10067
|
+
resolve32();
|
|
10009
10068
|
}
|
|
10010
10069
|
async executeSave() {
|
|
10011
10070
|
this.savePending = false;
|
|
@@ -10019,16 +10078,16 @@ var init_account_manager = __esm({
|
|
|
10019
10078
|
}
|
|
10020
10079
|
try {
|
|
10021
10080
|
await this.saveToDisk();
|
|
10022
|
-
for (const { resolve:
|
|
10023
|
-
|
|
10081
|
+
for (const { resolve: resolve32 } of resolvers) {
|
|
10082
|
+
resolve32();
|
|
10024
10083
|
}
|
|
10025
10084
|
} catch (error) {
|
|
10026
10085
|
if (isStorageLockContention(error)) {
|
|
10027
10086
|
this.onDiagnostic?.("Skipped account-state persist due to storage lock contention", {
|
|
10028
10087
|
error: String(error)
|
|
10029
10088
|
});
|
|
10030
|
-
for (const { resolve:
|
|
10031
|
-
|
|
10089
|
+
for (const { resolve: resolve32 } of resolvers) {
|
|
10090
|
+
resolve32();
|
|
10032
10091
|
}
|
|
10033
10092
|
return;
|
|
10034
10093
|
}
|
|
@@ -10250,11 +10309,12 @@ function fnv1a64Signed(input2) {
|
|
|
10250
10309
|
}
|
|
10251
10310
|
return BigInt.asIntN(64, hash2).toString();
|
|
10252
10311
|
}
|
|
10253
|
-
function createAgyRequestSessionContext(
|
|
10312
|
+
function createAgyRequestSessionContext(ids = {}) {
|
|
10254
10313
|
return {
|
|
10255
10314
|
conversationId: ids.conversationId ?? randomUUID7(),
|
|
10256
10315
|
trajectoryId: ids.trajectoryId ?? randomUUID7(),
|
|
10257
|
-
|
|
10316
|
+
// Print-mode agy uses the empty-string offset basis in every workspace.
|
|
10317
|
+
numericSessionId: fnv1a64Signed("")
|
|
10258
10318
|
};
|
|
10259
10319
|
}
|
|
10260
10320
|
function getAgyModelEnum(model) {
|
|
@@ -10278,52 +10338,58 @@ function orderAgyRequestPayloadInPlace(payload) {
|
|
|
10278
10338
|
}
|
|
10279
10339
|
Object.assign(payload, ordered);
|
|
10280
10340
|
}
|
|
10281
|
-
function countAgyRequestSteps(payload
|
|
10282
|
-
|
|
10283
|
-
|
|
10284
|
-
|
|
10285
|
-
if (
|
|
10286
|
-
return
|
|
10287
|
-
let
|
|
10288
|
-
let
|
|
10289
|
-
for (const content of contents) {
|
|
10290
|
-
if (
|
|
10341
|
+
function countAgyRequestSteps(payload) {
|
|
10342
|
+
return Array.isArray(payload.contents) ? payload.contents.length : 0;
|
|
10343
|
+
}
|
|
10344
|
+
function hasSecondUserTurn(payload) {
|
|
10345
|
+
if (!Array.isArray(payload.contents))
|
|
10346
|
+
return false;
|
|
10347
|
+
let sawUser = false;
|
|
10348
|
+
let sawModelAfterUser = false;
|
|
10349
|
+
for (const content of payload.contents) {
|
|
10350
|
+
if (content?.role === "model" && sawUser)
|
|
10351
|
+
sawModelAfterUser = true;
|
|
10352
|
+
if (content?.role !== "user" || !Array.isArray(content.parts))
|
|
10291
10353
|
continue;
|
|
10292
|
-
const
|
|
10293
|
-
if (!
|
|
10354
|
+
const isPrompt = content.parts.some((part) => part !== null && typeof part === "object" && !("functionResponse" in part) && (!("text" in part) || part.text !== "[Continue]"));
|
|
10355
|
+
if (!isPrompt)
|
|
10294
10356
|
continue;
|
|
10295
|
-
|
|
10296
|
-
|
|
10297
|
-
|
|
10298
|
-
if (!part || typeof part !== "object" || Array.isArray(part))
|
|
10299
|
-
return false;
|
|
10300
|
-
return "functionResponse" in part;
|
|
10301
|
-
}).length;
|
|
10302
|
-
}
|
|
10303
|
-
}
|
|
10304
|
-
if (mode === "cli") {
|
|
10305
|
-
return Math.max(1, contents.length + functionResponseCount);
|
|
10357
|
+
if (sawModelAfterUser)
|
|
10358
|
+
return true;
|
|
10359
|
+
sawUser = true;
|
|
10306
10360
|
}
|
|
10307
|
-
return
|
|
10361
|
+
return false;
|
|
10308
10362
|
}
|
|
10309
|
-
function buildAgyAgentRequestMetadata(session, payload, model, timestamp
|
|
10310
|
-
const
|
|
10363
|
+
function buildAgyAgentRequestMetadata(session, payload, model, timestamp) {
|
|
10364
|
+
const requestTimestamp = timestamp ?? Math.max(Date.now(), (session.lastMetadataTimestamp ?? 0) + 1);
|
|
10365
|
+
const stepCount = countAgyRequestSteps(payload);
|
|
10366
|
+
const lastStepIndex = stepCount - 1;
|
|
10367
|
+
if (session.lastMetadataTimestamp !== requestTimestamp) {
|
|
10368
|
+
session.requestCount = (session.requestCount ?? 0) + 1;
|
|
10369
|
+
session.lastMetadataTimestamp = requestTimestamp;
|
|
10370
|
+
if (session.lastExecutionId || hasSecondUserTurn(payload)) {
|
|
10371
|
+
session.lastExecutionId = randomUUID7();
|
|
10372
|
+
}
|
|
10373
|
+
}
|
|
10311
10374
|
const isClaude = model.toLowerCase().startsWith("claude-");
|
|
10312
10375
|
const isNonGemini = isClaude || model.toLowerCase().startsWith("gpt-");
|
|
10313
10376
|
session.usedClaude = session.usedClaude === true || isClaude;
|
|
10314
10377
|
session.usedNonGeminiModel = session.usedNonGeminiModel === true || isNonGemini;
|
|
10315
10378
|
const modelEnum = getAgyModelEnum(model);
|
|
10316
10379
|
const labels = {
|
|
10380
|
+
cascade_id: session.conversationId,
|
|
10317
10381
|
...session.lastExecutionId ? { last_execution_id: session.lastExecutionId } : {},
|
|
10318
10382
|
last_step_index: String(lastStepIndex),
|
|
10319
10383
|
...modelEnum ? { model_enum: modelEnum } : {},
|
|
10384
|
+
request_id: `${session.trajectoryId}-${(session.requestCount ?? 1) - 1}`,
|
|
10385
|
+
root_cascade_id: session.conversationId,
|
|
10320
10386
|
trajectory_id: session.trajectoryId,
|
|
10321
10387
|
used_claude: session.usedClaude ? "true" : "false",
|
|
10322
10388
|
used_claude_conservative: session.usedClaude ? "true" : "false",
|
|
10323
10389
|
used_non_gemini_model: session.usedNonGeminiModel ? "true" : "false"
|
|
10324
10390
|
};
|
|
10325
10391
|
return {
|
|
10326
|
-
requestId: `agent/${session.conversationId}/${
|
|
10392
|
+
requestId: `agent/${session.conversationId}/${requestTimestamp}/${session.trajectoryId}/${stepCount}`,
|
|
10327
10393
|
sessionId: session.numericSessionId,
|
|
10328
10394
|
labels,
|
|
10329
10395
|
lastStepIndex
|
|
@@ -10342,19 +10408,16 @@ var init_agy_request_metadata = __esm({
|
|
|
10342
10408
|
"contents",
|
|
10343
10409
|
"systemInstruction",
|
|
10344
10410
|
"tools",
|
|
10345
|
-
"toolConfig",
|
|
10346
10411
|
"labels",
|
|
10347
10412
|
"generationConfig",
|
|
10348
10413
|
"sessionId"
|
|
10349
10414
|
];
|
|
10350
10415
|
AgyRequestSessionStore = class {
|
|
10351
10416
|
entries = /* @__PURE__ */ new Map();
|
|
10352
|
-
workspaceUri;
|
|
10353
10417
|
ttlMs;
|
|
10354
10418
|
maxEntries;
|
|
10355
10419
|
now;
|
|
10356
|
-
constructor(
|
|
10357
|
-
this.workspaceUri = workspaceUri;
|
|
10420
|
+
constructor(options = {}) {
|
|
10358
10421
|
this.ttlMs = options.ttlMs ?? DEFAULT_SESSION_STATE_TTL_MS;
|
|
10359
10422
|
this.maxEntries = options.maxEntries ?? DEFAULT_MAX_SESSION_STATES;
|
|
10360
10423
|
this.now = options.now ?? Date.now;
|
|
@@ -10367,7 +10430,7 @@ var init_agy_request_metadata = __esm({
|
|
|
10367
10430
|
existing.lastAccessedAt = timestamp;
|
|
10368
10431
|
return existing.context;
|
|
10369
10432
|
}
|
|
10370
|
-
const context = createAgyRequestSessionContext(
|
|
10433
|
+
const context = createAgyRequestSessionContext();
|
|
10371
10434
|
this.entries.set(key, {
|
|
10372
10435
|
context,
|
|
10373
10436
|
lastAccessedAt: timestamp,
|
|
@@ -10382,12 +10445,6 @@ var init_agy_request_metadata = __esm({
|
|
|
10382
10445
|
stored.lastRequestTimestamp = timestamp;
|
|
10383
10446
|
return { session, timestamp };
|
|
10384
10447
|
}
|
|
10385
|
-
completeExecution(key) {
|
|
10386
|
-
const stored = this.entries.get(key);
|
|
10387
|
-
if (stored) {
|
|
10388
|
-
stored.context.lastExecutionId = randomUUID7();
|
|
10389
|
-
}
|
|
10390
|
-
}
|
|
10391
10448
|
has(key) {
|
|
10392
10449
|
return this.entries.has(key);
|
|
10393
10450
|
}
|
|
@@ -10529,7 +10586,7 @@ function getHttpsProxy(url) {
|
|
|
10529
10586
|
}
|
|
10530
10587
|
}
|
|
10531
10588
|
function waitForHead(socket, timeoutMs, onTimeout) {
|
|
10532
|
-
return new Promise((
|
|
10589
|
+
return new Promise((resolve32, reject) => {
|
|
10533
10590
|
let buffer = Buffer3.alloc(0);
|
|
10534
10591
|
const timeout = setTimeout(() => {
|
|
10535
10592
|
onTimeout();
|
|
@@ -10552,7 +10609,7 @@ function waitForHead(socket, timeoutMs, onTimeout) {
|
|
|
10552
10609
|
return;
|
|
10553
10610
|
const head = buffer.subarray(0, marker).toString("latin1");
|
|
10554
10611
|
const leftover = buffer.subarray(marker + 4);
|
|
10555
|
-
cleanup2(() =>
|
|
10612
|
+
cleanup2(() => resolve32({ head, leftover }));
|
|
10556
10613
|
};
|
|
10557
10614
|
socket.on("data", onData);
|
|
10558
10615
|
socket.once("error", onError);
|
|
@@ -10566,7 +10623,7 @@ async function connectViaProxy(proxyUrl, targetUrl, timeoutMs, signal, onDebug)
|
|
|
10566
10623
|
port: Number(proxyUrl.port || DEFAULT_PROXY_PORT),
|
|
10567
10624
|
signal: signal ?? void 0
|
|
10568
10625
|
});
|
|
10569
|
-
await new Promise((
|
|
10626
|
+
await new Promise((resolve32, reject) => {
|
|
10570
10627
|
const timeout = setTimeout(() => {
|
|
10571
10628
|
onDebug?.(`agy transport proxy connect timeout after ${timeoutMs}ms`);
|
|
10572
10629
|
proxySocket.destroy();
|
|
@@ -10575,7 +10632,7 @@ async function connectViaProxy(proxyUrl, targetUrl, timeoutMs, signal, onDebug)
|
|
|
10575
10632
|
const cleanup2 = () => clearTimeout(timeout);
|
|
10576
10633
|
proxySocket.once("connect", () => {
|
|
10577
10634
|
cleanup2();
|
|
10578
|
-
|
|
10635
|
+
resolve32();
|
|
10579
10636
|
});
|
|
10580
10637
|
proxySocket.once("error", (error) => {
|
|
10581
10638
|
cleanup2();
|
|
@@ -10600,10 +10657,11 @@ Host: ${targetHost}:${targetPort}\r
|
|
|
10600
10657
|
if (leftover.length > 0) {
|
|
10601
10658
|
proxySocket.unshift(leftover);
|
|
10602
10659
|
}
|
|
10603
|
-
return await new Promise((
|
|
10660
|
+
return await new Promise((resolve32, reject) => {
|
|
10604
10661
|
const tlsOptions = {
|
|
10605
10662
|
socket: proxySocket,
|
|
10606
10663
|
servername: targetHost,
|
|
10664
|
+
ALPNProtocols: ["http/1.1"],
|
|
10607
10665
|
signal: signal ?? void 0
|
|
10608
10666
|
};
|
|
10609
10667
|
const tlsSocket = tls.connect(tlsOptions);
|
|
@@ -10615,7 +10673,7 @@ Host: ${targetHost}:${targetPort}\r
|
|
|
10615
10673
|
const cleanup2 = () => clearTimeout(timeout);
|
|
10616
10674
|
tlsSocket.once("secureConnect", () => {
|
|
10617
10675
|
cleanup2();
|
|
10618
|
-
|
|
10676
|
+
resolve32(tlsSocket);
|
|
10619
10677
|
});
|
|
10620
10678
|
tlsSocket.once("error", (error) => {
|
|
10621
10679
|
cleanup2();
|
|
@@ -10624,11 +10682,12 @@ Host: ${targetHost}:${targetPort}\r
|
|
|
10624
10682
|
});
|
|
10625
10683
|
}
|
|
10626
10684
|
async function connectDirect(targetUrl, timeoutMs, signal, onDebug) {
|
|
10627
|
-
return await new Promise((
|
|
10685
|
+
return await new Promise((resolve32, reject) => {
|
|
10628
10686
|
const tlsOptions = {
|
|
10629
10687
|
host: targetUrl.hostname,
|
|
10630
10688
|
port: Number(targetUrl.port || DEFAULT_HTTPS_PORT),
|
|
10631
10689
|
servername: targetUrl.hostname,
|
|
10690
|
+
ALPNProtocols: ["http/1.1"],
|
|
10632
10691
|
signal: signal ?? void 0
|
|
10633
10692
|
};
|
|
10634
10693
|
const socket = tls.connect(tlsOptions);
|
|
@@ -10640,7 +10699,7 @@ async function connectDirect(targetUrl, timeoutMs, signal, onDebug) {
|
|
|
10640
10699
|
const cleanup2 = () => clearTimeout(timeout);
|
|
10641
10700
|
socket.once("secureConnect", () => {
|
|
10642
10701
|
cleanup2();
|
|
10643
|
-
|
|
10702
|
+
resolve32(socket);
|
|
10644
10703
|
});
|
|
10645
10704
|
socket.once("error", (error) => {
|
|
10646
10705
|
cleanup2();
|
|
@@ -13422,8 +13481,8 @@ async function acquireRefreshFileLockWithClock(options) {
|
|
|
13422
13481
|
let releaseConfirmed = false;
|
|
13423
13482
|
let loss;
|
|
13424
13483
|
let resolveLoss;
|
|
13425
|
-
const lostPromise = new Promise((
|
|
13426
|
-
resolveLoss =
|
|
13484
|
+
const lostPromise = new Promise((resolve32) => {
|
|
13485
|
+
resolveLoss = resolve32;
|
|
13427
13486
|
});
|
|
13428
13487
|
function notifyTimerStep(event) {
|
|
13429
13488
|
try {
|
|
@@ -13587,7 +13646,7 @@ async function acquireRefreshFileLockWithClock(options) {
|
|
|
13587
13646
|
}
|
|
13588
13647
|
}
|
|
13589
13648
|
async function backoff() {
|
|
13590
|
-
await new Promise((
|
|
13649
|
+
await new Promise((resolve32) => setTimeout(resolve32, Math.floor(Math.random() * 4)));
|
|
13591
13650
|
}
|
|
13592
13651
|
async function readLockState(notifyReady = true) {
|
|
13593
13652
|
if (notifyReady && options.onStep)
|
|
@@ -13680,7 +13739,7 @@ async function acquireRefreshFileLockWithClock(options) {
|
|
|
13680
13739
|
const remainingMs = deadline - performance.now();
|
|
13681
13740
|
if (remainingMs <= 0)
|
|
13682
13741
|
throw original;
|
|
13683
|
-
await new Promise((
|
|
13742
|
+
await new Promise((resolve32) => setTimeout(resolve32, Math.min(delayMs, remainingMs)));
|
|
13684
13743
|
if (performance.now() >= deadline)
|
|
13685
13744
|
throw original;
|
|
13686
13745
|
delayMs = Math.min(delayMs * 2, 50);
|
|
@@ -14183,7 +14242,7 @@ async function acquireRefreshFileLockWithClock(options) {
|
|
|
14183
14242
|
const remainingMs = deadline - performance.now();
|
|
14184
14243
|
if (remainingMs <= 0)
|
|
14185
14244
|
break;
|
|
14186
|
-
await new Promise((
|
|
14245
|
+
await new Promise((resolve32) => setTimeout(resolve32, Math.min(delayMs, remainingMs)));
|
|
14187
14246
|
if (windowsPrivateFiles && performance.now() >= deadline)
|
|
14188
14247
|
break;
|
|
14189
14248
|
delayMs = Math.min(delayMs * 2, 50);
|
|
@@ -14268,7 +14327,7 @@ async function withLock(target, options, fn) {
|
|
|
14268
14327
|
timeoutMs: options.timeoutMs
|
|
14269
14328
|
});
|
|
14270
14329
|
}
|
|
14271
|
-
await new Promise((
|
|
14330
|
+
await new Promise((resolve32) => setTimeout(resolve32, Math.min(25, Math.ceil(remaining))));
|
|
14272
14331
|
}
|
|
14273
14332
|
}
|
|
14274
14333
|
var LockContentionError, LockOwnershipError;
|
|
@@ -14358,7 +14417,7 @@ async function acquirePoolLock(spec, defaults2, env3) {
|
|
|
14358
14417
|
});
|
|
14359
14418
|
}
|
|
14360
14419
|
const jitter = Math.floor(Math.random() * (options.retryMs + 1));
|
|
14361
|
-
await new Promise((
|
|
14420
|
+
await new Promise((resolve32) => setTimeout(resolve32, Math.min(options.retryMs + jitter, remaining)));
|
|
14362
14421
|
}
|
|
14363
14422
|
}
|
|
14364
14423
|
function definedOnly(spec) {
|
|
@@ -17256,11 +17315,11 @@ var init_quota_writer = __esm({
|
|
|
17256
17315
|
const left = deadline - performance.now();
|
|
17257
17316
|
if (left <= 0)
|
|
17258
17317
|
throw refusal2("pull", id, "lock-contention", `pool quota queue for ${id} is full (${POOL_QUOTA_QUEUE_LIMIT} readings) and the store locks stayed held`, true);
|
|
17259
|
-
await new Promise((
|
|
17318
|
+
await new Promise((resolve32) => {
|
|
17260
17319
|
const done = () => {
|
|
17261
17320
|
clearTimeout(timer);
|
|
17262
17321
|
this.wake.delete(done);
|
|
17263
|
-
|
|
17322
|
+
resolve32();
|
|
17264
17323
|
};
|
|
17265
17324
|
const timer = setTimeout(done, left);
|
|
17266
17325
|
this.wake.add(done);
|
|
@@ -20324,7 +20383,7 @@ async function select(terminal, items, options) {
|
|
|
20324
20383
|
writeLine("");
|
|
20325
20384
|
renderedLines = lines;
|
|
20326
20385
|
};
|
|
20327
|
-
return new Promise((
|
|
20386
|
+
return new Promise((resolve32) => {
|
|
20328
20387
|
const wasRaw = stdin.isRaw ?? false;
|
|
20329
20388
|
const cleanup2 = () => {
|
|
20330
20389
|
if (cleaned)
|
|
@@ -20344,7 +20403,7 @@ async function select(terminal, items, options) {
|
|
|
20344
20403
|
};
|
|
20345
20404
|
const finish = (value) => {
|
|
20346
20405
|
cleanup2();
|
|
20347
|
-
|
|
20406
|
+
resolve32(value);
|
|
20348
20407
|
};
|
|
20349
20408
|
const onSignal = () => finish(null);
|
|
20350
20409
|
const onKey = (data) => {
|
|
@@ -20384,7 +20443,7 @@ async function select(terminal, items, options) {
|
|
|
20384
20443
|
stdin.setRawMode(true);
|
|
20385
20444
|
} catch {
|
|
20386
20445
|
cleanup2();
|
|
20387
|
-
|
|
20446
|
+
resolve32(null);
|
|
20388
20447
|
return;
|
|
20389
20448
|
}
|
|
20390
20449
|
stdin.resume();
|
|
@@ -22410,10 +22469,10 @@ async function drainShutdown(pending, onTimeout) {
|
|
|
22410
22469
|
try {
|
|
22411
22470
|
await Promise.race([
|
|
22412
22471
|
drained,
|
|
22413
|
-
new Promise((
|
|
22472
|
+
new Promise((resolve32) => {
|
|
22414
22473
|
timer = setTimeout(() => {
|
|
22415
22474
|
expired = true;
|
|
22416
|
-
|
|
22475
|
+
resolve32();
|
|
22417
22476
|
}, 2e3);
|
|
22418
22477
|
})
|
|
22419
22478
|
]);
|
|
@@ -22686,7 +22745,7 @@ function grantReachOf(listed) {
|
|
|
22686
22745
|
tuples: Object.freeze(grantTuples.map(({ selectorKind, selector, operation }) => Object.freeze({ selectorKind, selector, operation })))
|
|
22687
22746
|
});
|
|
22688
22747
|
}
|
|
22689
|
-
var defaultLogger, phaseDiagnostics, SERVING_MARGIN_MS, KEPT_RECEIPT_MARGIN_MS, ClaustrumScopedCustody;
|
|
22748
|
+
var defaultLogger, phaseDiagnostics, SERVING_MARGIN_MS, KEPT_RECEIPT_MARGIN_MS, VAULT_RECEIPT_WAIT_MS, VAULT_YOUNG_OUTAGE_MS, ClaustrumScopedCustody;
|
|
22690
22749
|
var init_custody = __esm({
|
|
22691
22750
|
"../core/dist/common-auth-embedded/claustrum/custody.js"() {
|
|
22692
22751
|
"use strict";
|
|
@@ -22703,6 +22762,8 @@ var init_custody = __esm({
|
|
|
22703
22762
|
phaseDiagnostics = channel("common-auth.claustrum.phases");
|
|
22704
22763
|
SERVING_MARGIN_MS = 3e5;
|
|
22705
22764
|
KEPT_RECEIPT_MARGIN_MS = 6e4;
|
|
22765
|
+
VAULT_RECEIPT_WAIT_MS = 1e4;
|
|
22766
|
+
VAULT_YOUNG_OUTAGE_MS = 6e4;
|
|
22706
22767
|
ClaustrumScopedCustody = class {
|
|
22707
22768
|
#client;
|
|
22708
22769
|
#readToken;
|
|
@@ -22720,7 +22781,10 @@ var init_custody = __esm({
|
|
|
22720
22781
|
#setTimeout;
|
|
22721
22782
|
#clearTimeout;
|
|
22722
22783
|
#outage = false;
|
|
22784
|
+
#outageSince = 0;
|
|
22785
|
+
#outageWaitSpent = false;
|
|
22723
22786
|
#outageError = new ClaustrumUnreachableError();
|
|
22787
|
+
#receiptWaits = /* @__PURE__ */ new Map();
|
|
22724
22788
|
#probeTimer;
|
|
22725
22789
|
#probing = false;
|
|
22726
22790
|
#lastProbeAt = -Infinity;
|
|
@@ -22796,6 +22860,8 @@ var init_custody = __esm({
|
|
|
22796
22860
|
if (this.#closed || this.#outage)
|
|
22797
22861
|
return;
|
|
22798
22862
|
this.#outage = true;
|
|
22863
|
+
this.#outageSince = this.#now();
|
|
22864
|
+
this.#outageWaitSpent = false;
|
|
22799
22865
|
this.#outageError = error instanceof ClaustrumCredentialError5 ? error : new ClaustrumUnreachableError(error instanceof ClaustrumUnreachableError ? error.reason : void 0);
|
|
22800
22866
|
this.#logger.warn("serving kept vault receipt", { reason: "unreachable" });
|
|
22801
22867
|
this.#scheduleProbe();
|
|
@@ -23070,9 +23136,10 @@ var init_custody = __esm({
|
|
|
23070
23136
|
/** Ask the vault while reachable; retain one validated receipt in memory only. */
|
|
23071
23137
|
async authorize(identity4, signal, routeId = "vault") {
|
|
23072
23138
|
this.#check(signal);
|
|
23139
|
+
const startedAt = this.#now();
|
|
23073
23140
|
const { credentialId, credentialType, accountIdentity } = identity4;
|
|
23074
23141
|
let kept = this.#kept.get(credentialId);
|
|
23075
|
-
if (kept && (kept.attempt.credentialType !== credentialType || kept.attempt.expectedAccountIdentity !== accountIdentity)) {
|
|
23142
|
+
if (kept && (kept.attempt.credentialType !== credentialType || kept.attempt.expectedAccountIdentity !== accountIdentity || !this.#usable(kept.attempt))) {
|
|
23076
23143
|
this.forget(credentialId);
|
|
23077
23144
|
kept = void 0;
|
|
23078
23145
|
}
|
|
@@ -23089,7 +23156,18 @@ var init_custody = __esm({
|
|
|
23089
23156
|
return this.#serveKept(credentialId, kept, token, routeId);
|
|
23090
23157
|
}
|
|
23091
23158
|
try {
|
|
23092
|
-
|
|
23159
|
+
let attempt;
|
|
23160
|
+
try {
|
|
23161
|
+
const recovering = this.#outage && this.#receiptWaits.has(this.#receiptWaitKey({ credentialId, credentialType, accountIdentity }, token));
|
|
23162
|
+
if (recovering)
|
|
23163
|
+
throw this.#outageError;
|
|
23164
|
+
attempt = await this.#authorizeFresh({ credentialId, credentialType, accountIdentity }, token, signal);
|
|
23165
|
+
} catch (error) {
|
|
23166
|
+
this.#check(signal);
|
|
23167
|
+
if (classifyVaultFailure(error) !== "unreachable" || kept)
|
|
23168
|
+
throw error;
|
|
23169
|
+
attempt = await this.#waitForReceipt({ credentialId, credentialType, accountIdentity }, token, startedAt, error, signal);
|
|
23170
|
+
}
|
|
23093
23171
|
this.#kept.set(credentialId, { attempt, routeId, since: null });
|
|
23094
23172
|
this.#usageServed.set(credentialId, { ...identity4 });
|
|
23095
23173
|
return attempt;
|
|
@@ -23102,6 +23180,109 @@ var init_custody = __esm({
|
|
|
23102
23180
|
return this.#serveKept(credentialId, kept, token, routeId, error);
|
|
23103
23181
|
}
|
|
23104
23182
|
}
|
|
23183
|
+
#receiptWaitKey(identity4, token) {
|
|
23184
|
+
return JSON.stringify([
|
|
23185
|
+
identity4.credentialId,
|
|
23186
|
+
identity4.credentialType,
|
|
23187
|
+
identity4.accountIdentity,
|
|
23188
|
+
token
|
|
23189
|
+
]);
|
|
23190
|
+
}
|
|
23191
|
+
async #waitForReceipt(identity4, token, startedAt, error, signal) {
|
|
23192
|
+
const remaining = VAULT_RECEIPT_WAIT_MS - (this.#now() - startedAt);
|
|
23193
|
+
if (remaining <= 0 || this.#outageWaitSpent || this.#now() - this.#outageSince >= VAULT_YOUNG_OUTAGE_MS)
|
|
23194
|
+
throw error;
|
|
23195
|
+
const key = this.#receiptWaitKey(identity4, token);
|
|
23196
|
+
let wait2 = this.#receiptWaits.get(key);
|
|
23197
|
+
if (!wait2) {
|
|
23198
|
+
const controller = new AbortController();
|
|
23199
|
+
const created = {
|
|
23200
|
+
controller,
|
|
23201
|
+
users: 0,
|
|
23202
|
+
error,
|
|
23203
|
+
pending: Promise.resolve().then(async () => {
|
|
23204
|
+
let delay3 = 250;
|
|
23205
|
+
for (; ; ) {
|
|
23206
|
+
await this.#receiptBackoff(delay3, controller.signal);
|
|
23207
|
+
try {
|
|
23208
|
+
return await this.#authorizeFresh(identity4, token, controller.signal);
|
|
23209
|
+
} catch (failure2) {
|
|
23210
|
+
this.#check(controller.signal);
|
|
23211
|
+
if (classifyVaultFailure(failure2) !== "unreachable")
|
|
23212
|
+
throw failure2;
|
|
23213
|
+
created.error = failure2;
|
|
23214
|
+
delay3 = Math.min(delay3 * 2, 1e3);
|
|
23215
|
+
}
|
|
23216
|
+
}
|
|
23217
|
+
})
|
|
23218
|
+
};
|
|
23219
|
+
wait2 = created;
|
|
23220
|
+
this.#receiptWaits.set(key, wait2);
|
|
23221
|
+
const remove2 = () => {
|
|
23222
|
+
if (this.#receiptWaits.get(key) === created)
|
|
23223
|
+
this.#receiptWaits.delete(key);
|
|
23224
|
+
};
|
|
23225
|
+
void wait2.pending.then(remove2, remove2);
|
|
23226
|
+
}
|
|
23227
|
+
const shared4 = wait2;
|
|
23228
|
+
shared4.users++;
|
|
23229
|
+
let timer;
|
|
23230
|
+
let abort;
|
|
23231
|
+
try {
|
|
23232
|
+
const attempt = await Promise.race([
|
|
23233
|
+
shared4.pending,
|
|
23234
|
+
new Promise((_resolve, reject) => {
|
|
23235
|
+
timer = this.#setTimeout(() => {
|
|
23236
|
+
if (this.#outage)
|
|
23237
|
+
this.#outageWaitSpent = true;
|
|
23238
|
+
reject(shared4.error);
|
|
23239
|
+
}, remaining);
|
|
23240
|
+
timer.unref?.();
|
|
23241
|
+
if (signal) {
|
|
23242
|
+
abort = () => reject(signal.reason);
|
|
23243
|
+
signal.addEventListener("abort", abort, { once: true });
|
|
23244
|
+
if (signal.aborted)
|
|
23245
|
+
abort();
|
|
23246
|
+
}
|
|
23247
|
+
})
|
|
23248
|
+
]);
|
|
23249
|
+
this.#check(signal);
|
|
23250
|
+
const receipt2 = Object.freeze(Object.defineProperty({ ...attempt }, "accessToken", {
|
|
23251
|
+
value: attempt.accessToken,
|
|
23252
|
+
enumerable: false
|
|
23253
|
+
}));
|
|
23254
|
+
this.#provenance.set(receipt2, { token });
|
|
23255
|
+
return receipt2;
|
|
23256
|
+
} finally {
|
|
23257
|
+
if (timer)
|
|
23258
|
+
this.#clearTimeout(timer);
|
|
23259
|
+
if (abort)
|
|
23260
|
+
signal?.removeEventListener("abort", abort);
|
|
23261
|
+
if (--shared4.users === 0) {
|
|
23262
|
+
shared4.controller.abort();
|
|
23263
|
+
if (this.#receiptWaits.get(key) === shared4)
|
|
23264
|
+
this.#receiptWaits.delete(key);
|
|
23265
|
+
}
|
|
23266
|
+
}
|
|
23267
|
+
}
|
|
23268
|
+
#receiptBackoff(delay3, signal) {
|
|
23269
|
+
this.#check(signal);
|
|
23270
|
+
return new Promise((resolve32, reject) => {
|
|
23271
|
+
const abort = () => {
|
|
23272
|
+
this.#clearTimeout(timer);
|
|
23273
|
+
signal.removeEventListener("abort", abort);
|
|
23274
|
+
reject(signal.reason);
|
|
23275
|
+
};
|
|
23276
|
+
const timer = this.#setTimeout(() => {
|
|
23277
|
+
signal.removeEventListener("abort", abort);
|
|
23278
|
+
resolve32();
|
|
23279
|
+
}, delay3);
|
|
23280
|
+
timer.unref?.();
|
|
23281
|
+
signal.addEventListener("abort", abort, { once: true });
|
|
23282
|
+
if (signal.aborted)
|
|
23283
|
+
abort();
|
|
23284
|
+
});
|
|
23285
|
+
}
|
|
23105
23286
|
#serveKept(credentialId, kept, token, routeId, error = this.#outageError) {
|
|
23106
23287
|
if (!kept || this.#kept.get(credentialId) !== kept || !this.#usable(kept.attempt)) {
|
|
23107
23288
|
this.forget(credentialId);
|
|
@@ -23327,6 +23508,9 @@ var init_custody = __esm({
|
|
|
23327
23508
|
if (this.#closed)
|
|
23328
23509
|
return;
|
|
23329
23510
|
this.#closed = true;
|
|
23511
|
+
for (const wait2 of this.#receiptWaits.values())
|
|
23512
|
+
wait2.controller.abort();
|
|
23513
|
+
this.#receiptWaits.clear();
|
|
23330
23514
|
if (this.#probeTimer)
|
|
23331
23515
|
this.#clearTimeout(this.#probeTimer);
|
|
23332
23516
|
this.#probeTimer = void 0;
|
|
@@ -24327,7 +24511,7 @@ var init_consumer = __esm({
|
|
|
24327
24511
|
this.#shutdown.signal,
|
|
24328
24512
|
...signal ? [signal] : []
|
|
24329
24513
|
]);
|
|
24330
|
-
return new Promise((
|
|
24514
|
+
return new Promise((resolve32, reject) => {
|
|
24331
24515
|
const cleanup2 = () => {
|
|
24332
24516
|
combined.signal.removeEventListener("abort", abort);
|
|
24333
24517
|
combined.dispose();
|
|
@@ -24342,7 +24526,7 @@ var init_consumer = __esm({
|
|
|
24342
24526
|
if (combined.signal.aborted)
|
|
24343
24527
|
reject(combined.signal.reason);
|
|
24344
24528
|
else
|
|
24345
|
-
|
|
24529
|
+
resolve32(value);
|
|
24346
24530
|
}, (error) => {
|
|
24347
24531
|
cleanup2();
|
|
24348
24532
|
reject(error);
|
|
@@ -25148,12 +25332,12 @@ function unreachableConnect2() {
|
|
|
25148
25332
|
return new ClaustrumUnreachableError();
|
|
25149
25333
|
}
|
|
25150
25334
|
function untilAborted(pending, signal) {
|
|
25151
|
-
return new Promise((
|
|
25335
|
+
return new Promise((resolve32, reject) => {
|
|
25152
25336
|
const abort = () => reject(signal.reason);
|
|
25153
25337
|
signal.addEventListener("abort", abort, { once: true });
|
|
25154
25338
|
pending.then((value) => {
|
|
25155
25339
|
signal.removeEventListener("abort", abort);
|
|
25156
|
-
|
|
25340
|
+
resolve32(value);
|
|
25157
25341
|
}, (error) => {
|
|
25158
25342
|
signal.removeEventListener("abort", abort);
|
|
25159
25343
|
reject(error);
|
|
@@ -25200,6 +25384,13 @@ var init_hub = __esm({
|
|
|
25200
25384
|
#own;
|
|
25201
25385
|
#watch;
|
|
25202
25386
|
#run;
|
|
25387
|
+
/**
|
|
25388
|
+
* Member commit fan-outs still running, each until every one of its
|
|
25389
|
+
* commits has settled. Only a run whose generation ended can leave one
|
|
25390
|
+
* behind while another run starts; `#discover` waits for them before it
|
|
25391
|
+
* reads the files it lists over.
|
|
25392
|
+
*/
|
|
25393
|
+
#fanOuts = /* @__PURE__ */ new Set();
|
|
25203
25394
|
/** The hub's last authority read; undefined before the first one. */
|
|
25204
25395
|
#active;
|
|
25205
25396
|
/** Counts inactive transitions, so local work started before one stops. */
|
|
@@ -25673,6 +25864,9 @@ var init_hub = __esm({
|
|
|
25673
25864
|
if (!this.#live(generation))
|
|
25674
25865
|
return void 0;
|
|
25675
25866
|
const folders = await this.#ensureRosterDirectories().then(() => void 0, (error) => error instanceof Error ? error : new Error(String(error)));
|
|
25867
|
+
await this.#settleFanOuts();
|
|
25868
|
+
if (!this.#live(generation))
|
|
25869
|
+
return void 0;
|
|
25676
25870
|
const bases = new Map(await Promise.all([...this.#members.values()].map(async (entry) => [
|
|
25677
25871
|
entry,
|
|
25678
25872
|
await readVaultRoster(entry.path).then((file) => file ? { file } : {}, (error) => error instanceof Error ? error : new Error(String(error)))
|
|
@@ -25693,7 +25887,14 @@ var init_hub = __esm({
|
|
|
25693
25887
|
if (!this.#live(generation))
|
|
25694
25888
|
return void 0;
|
|
25695
25889
|
const members = this.#open();
|
|
25696
|
-
const
|
|
25890
|
+
const fanOut = Promise.all(members.map((entry) => entry.hooks && !entry.closed ? this.#commit(entry, entry.hooks, inventory, folders ?? bases.get(entry), generation) : void 0));
|
|
25891
|
+
this.#fanOuts.add(fanOut);
|
|
25892
|
+
let commits;
|
|
25893
|
+
try {
|
|
25894
|
+
commits = await fanOut;
|
|
25895
|
+
} finally {
|
|
25896
|
+
this.#fanOuts.delete(fanOut);
|
|
25897
|
+
}
|
|
25697
25898
|
if (!this.#live(generation))
|
|
25698
25899
|
return void 0;
|
|
25699
25900
|
const errors = /* @__PURE__ */ new Map();
|
|
@@ -25794,6 +25995,27 @@ var init_hub = __esm({
|
|
|
25794
25995
|
return { error };
|
|
25795
25996
|
}
|
|
25796
25997
|
}
|
|
25998
|
+
/**
|
|
25999
|
+
* Wait until no member commit fan-out of an earlier run is still running.
|
|
26000
|
+
* Each of them belongs to a generation that ended, so its commits fail or
|
|
26001
|
+
* finish at their next generation check and this wait stays short.
|
|
26002
|
+
*/
|
|
26003
|
+
async #settleFanOuts() {
|
|
26004
|
+
if (!this.#fanOuts.size)
|
|
26005
|
+
return;
|
|
26006
|
+
const phaseDiagnostics2 = channel2("common-auth.claustrum.phases");
|
|
26007
|
+
const phase = (name) => {
|
|
26008
|
+
if (phaseDiagnostics2.hasSubscribers)
|
|
26009
|
+
phaseDiagnostics2.publish({ logger: this.#logger, phase: name });
|
|
26010
|
+
};
|
|
26011
|
+
phase("earlier fan-out drain begin");
|
|
26012
|
+
try {
|
|
26013
|
+
while (this.#fanOuts.size)
|
|
26014
|
+
await Promise.allSettled([...this.#fanOuts]);
|
|
26015
|
+
} finally {
|
|
26016
|
+
phase("earlier fan-out drain end");
|
|
26017
|
+
}
|
|
26018
|
+
}
|
|
25797
26019
|
/**
|
|
25798
26020
|
* Create the roster folders under the state folder (`rosters`, this host
|
|
25799
26021
|
* generation and this key) owner-only, as every other Claustrum private
|
|
@@ -26106,6 +26328,8 @@ __export(claustrum_exports, {
|
|
|
26106
26328
|
VAULT_FAILURE_CLASSES: () => VAULT_FAILURE_CLASSES,
|
|
26107
26329
|
VAULT_HOST_CONNECT_REFUSAL: () => VAULT_HOST_CONNECT_REFUSAL,
|
|
26108
26330
|
VAULT_HOST_STATUS: () => VAULT_HOST_STATUS,
|
|
26331
|
+
VAULT_RECEIPT_WAIT_MS: () => VAULT_RECEIPT_WAIT_MS,
|
|
26332
|
+
VAULT_YOUNG_OUTAGE_MS: () => VAULT_YOUNG_OUTAGE_MS,
|
|
26109
26333
|
WATCH_RETRY_MS: () => WATCH_RETRY_MS,
|
|
26110
26334
|
acceptAccount: () => acceptAccount,
|
|
26111
26335
|
acceptVaultRoute: () => acceptVaultRoute,
|
|
@@ -27228,8 +27452,8 @@ function getDefaultTierId(allowedTiers) {
|
|
|
27228
27452
|
return allowedTiers[0]?.id;
|
|
27229
27453
|
}
|
|
27230
27454
|
function wait(ms) {
|
|
27231
|
-
return new Promise((
|
|
27232
|
-
setTimeout(
|
|
27455
|
+
return new Promise((resolve32) => {
|
|
27456
|
+
setTimeout(resolve32, ms);
|
|
27233
27457
|
});
|
|
27234
27458
|
}
|
|
27235
27459
|
function extractManagedProjectId(payload) {
|
|
@@ -28039,7 +28263,7 @@ var init_quota_manager = __esm({
|
|
|
28039
28263
|
});
|
|
28040
28264
|
|
|
28041
28265
|
// ../core/dist/transform/agy-generation.js
|
|
28042
|
-
function applyAgyNativeGenerationConfig(wireModel, generationConfig) {
|
|
28266
|
+
function applyAgyNativeGenerationConfig(wireModel, generationConfig, options = {}) {
|
|
28043
28267
|
const native = getAgyNativeModel(wireModel);
|
|
28044
28268
|
if (!native)
|
|
28045
28269
|
return;
|
|
@@ -28048,7 +28272,21 @@ function applyAgyNativeGenerationConfig(wireModel, generationConfig) {
|
|
|
28048
28272
|
generationConfig.maxOutputTokens = output2;
|
|
28049
28273
|
}
|
|
28050
28274
|
delete generationConfig.max_output_tokens;
|
|
28051
|
-
|
|
28275
|
+
const capturedTier = /^(?:gemini-3\.8-flash|claude-(?:sonnet|opus)-5-5)-(low|medium|high)$/i.exec(wireModel)?.[1];
|
|
28276
|
+
if (capturedTier) {
|
|
28277
|
+
const thinking = generationConfig.thinkingConfig;
|
|
28278
|
+
const budget = options.thinkingBudget ?? (options.preserveThinkingBudget === false ? void 0 : thinking?.thinkingBudget);
|
|
28279
|
+
generationConfig.thinkingConfig = {
|
|
28280
|
+
includeThoughts: true,
|
|
28281
|
+
...typeof budget === "number" ? { thinkingBudget: budget } : { thinkingLevel: capturedTier.toUpperCase() }
|
|
28282
|
+
};
|
|
28283
|
+
} else if (isGeminiHydrogenModel(wireModel)) {
|
|
28284
|
+
const tier = wireModel.toLowerCase().split("-").at(-1);
|
|
28285
|
+
generationConfig.thinkingConfig = {
|
|
28286
|
+
includeThoughts: true,
|
|
28287
|
+
thinkingLevel: tier === "xhigh" ? 100 : tier === "low" ? "LOW" : tier === "medium" ? "MEDIUM" : "HIGH"
|
|
28288
|
+
};
|
|
28289
|
+
} else if ((isGeminiArgonModel(wireModel) || isGeminiCarbonModel(wireModel)) && native.thinkingLevel !== void 0) {
|
|
28052
28290
|
generationConfig.thinkingConfig = {
|
|
28053
28291
|
includeThoughts: true,
|
|
28054
28292
|
thinkingLevel: ADAPTIVE_LEVELS[native.thinkingLevel]
|
|
@@ -28597,7 +28835,9 @@ function wrapToolsAsFunctionDeclarations(payload) {
|
|
|
28597
28835
|
}
|
|
28598
28836
|
const finalTools = [];
|
|
28599
28837
|
if (functionDeclarations.length > 0) {
|
|
28600
|
-
finalTools.push(
|
|
28838
|
+
finalTools.push(...functionDeclarations.map((declaration) => ({
|
|
28839
|
+
functionDeclarations: [declaration]
|
|
28840
|
+
})));
|
|
28601
28841
|
}
|
|
28602
28842
|
finalTools.push(...passthroughTools);
|
|
28603
28843
|
if (hasWebSearchTool && functionDeclarations.length === 0) {
|
|
@@ -28863,6 +29103,15 @@ function getAgyGemini31ProThinkingBudget(tier) {
|
|
|
28863
29103
|
function resolveModelWithTier(requestedModel) {
|
|
28864
29104
|
const isAntigravity = QUOTA_PREFIX_REGEX.test(requestedModel);
|
|
28865
29105
|
const modelWithoutQuota = requestedModel.replace(QUOTA_PREFIX_REGEX, "");
|
|
29106
|
+
if (isGeminiHydrogenModel(modelWithoutQuota)) {
|
|
29107
|
+
const tier2 = modelWithoutQuota.toLowerCase().match(HYDROGEN_TIER_REGEX)?.[1];
|
|
29108
|
+
return {
|
|
29109
|
+
actualModel: getGeminiHydrogenAntigravityModel(tier2),
|
|
29110
|
+
thinkingLevel: tier2 ?? "high",
|
|
29111
|
+
tier: tier2 ?? "high",
|
|
29112
|
+
isThinkingModel: true
|
|
29113
|
+
};
|
|
29114
|
+
}
|
|
28866
29115
|
const tier = extractThinkingTierFromModel(modelWithoutQuota);
|
|
28867
29116
|
const baseName = tier ? modelWithoutQuota.replace(TIER_REGEX, "") : modelWithoutQuota;
|
|
28868
29117
|
const isImageModel = IMAGE_GENERATION_MODELS.test(modelWithoutQuota);
|
|
@@ -29035,7 +29284,7 @@ function resolveAntigravityModel(requestedModel) {
|
|
|
29035
29284
|
const prefixedModel = `antigravity-${transformedModel}`;
|
|
29036
29285
|
return resolveModelWithTier(prefixedModel);
|
|
29037
29286
|
}
|
|
29038
|
-
var THINKING_TIER_BUDGETS, MODEL_ALIASES, TIER_REGEX, QUOTA_PREFIX_REGEX, GEMINI_3_PRO_REGEX, GEMINI_3_FLASH_REGEX, IMAGE_GENERATION_MODELS;
|
|
29287
|
+
var THINKING_TIER_BUDGETS, MODEL_ALIASES, TIER_REGEX, HYDROGEN_TIER_REGEX, QUOTA_PREFIX_REGEX, GEMINI_3_PRO_REGEX, GEMINI_3_FLASH_REGEX, IMAGE_GENERATION_MODELS;
|
|
29039
29288
|
var init_model_resolver = __esm({
|
|
29040
29289
|
"../core/dist/transform/model-resolver.js"() {
|
|
29041
29290
|
"use strict";
|
|
@@ -29048,6 +29297,7 @@ var init_model_resolver = __esm({
|
|
|
29048
29297
|
};
|
|
29049
29298
|
MODEL_ALIASES = getResolverAliasMap();
|
|
29050
29299
|
TIER_REGEX = /-(minimal|low|medium|high)$/;
|
|
29300
|
+
HYDROGEN_TIER_REGEX = /-(low|medium|high|xhigh)$/i;
|
|
29051
29301
|
QUOTA_PREFIX_REGEX = /^antigravity-/i;
|
|
29052
29302
|
GEMINI_3_PRO_REGEX = /^gemini-3(?:\.\d+)?-pro/i;
|
|
29053
29303
|
GEMINI_3_FLASH_REGEX = /^gemini-3(?:\.\d+)?-flash/i;
|
|
@@ -29552,12 +29802,12 @@ var init_vault_provider_state = __esm({
|
|
|
29552
29802
|
function untilAborted2(pending, signal) {
|
|
29553
29803
|
if (!signal)
|
|
29554
29804
|
return pending;
|
|
29555
|
-
return new Promise((
|
|
29805
|
+
return new Promise((resolve32, reject) => {
|
|
29556
29806
|
const abort = () => reject(signal.reason);
|
|
29557
29807
|
signal.addEventListener("abort", abort, { once: true });
|
|
29558
29808
|
if (signal.aborted)
|
|
29559
29809
|
abort();
|
|
29560
|
-
pending.then(
|
|
29810
|
+
pending.then(resolve32, reject).finally(() => signal.removeEventListener("abort", abort));
|
|
29561
29811
|
});
|
|
29562
29812
|
}
|
|
29563
29813
|
async function resolveClaustrumConnectionPath(explicit) {
|
|
@@ -31059,12 +31309,12 @@ function createVaultAccountPool(options) {
|
|
|
31059
31309
|
try {
|
|
31060
31310
|
return await Promise.race([
|
|
31061
31311
|
read.then(() => true),
|
|
31062
|
-
new Promise((
|
|
31312
|
+
new Promise((resolve32, reject) => {
|
|
31063
31313
|
const abort = () => reject(signal?.reason);
|
|
31064
31314
|
signal?.addEventListener("abort", abort, { once: true });
|
|
31065
31315
|
detachAbort = () => signal?.removeEventListener("abort", abort);
|
|
31066
31316
|
if (remaining !== void 0)
|
|
31067
|
-
cancelTimer2 = schedule2(() =>
|
|
31317
|
+
cancelTimer2 = schedule2(() => resolve32(false), remaining);
|
|
31068
31318
|
if (signal?.aborted) abort();
|
|
31069
31319
|
})
|
|
31070
31320
|
]);
|
|
@@ -31569,11 +31819,11 @@ function createOpenCodeVaultCustody(options) {
|
|
|
31569
31819
|
].join("\n");
|
|
31570
31820
|
const waitForApproval = async () => {
|
|
31571
31821
|
while (!closed2) {
|
|
31572
|
-
await new Promise((
|
|
31822
|
+
await new Promise((resolve32) => {
|
|
31573
31823
|
const done = () => {
|
|
31574
31824
|
clearTimeout(timer);
|
|
31575
31825
|
cancelWait = void 0;
|
|
31576
|
-
|
|
31826
|
+
resolve32();
|
|
31577
31827
|
};
|
|
31578
31828
|
const timer = setTimeout(done, 2e3);
|
|
31579
31829
|
timer.unref?.();
|
|
@@ -34559,13 +34809,13 @@ function closeDebugStream(state) {
|
|
|
34559
34809
|
state.logWriter = () => {
|
|
34560
34810
|
};
|
|
34561
34811
|
if (state.logFilePath) liveLogFilePaths.delete(state.logFilePath);
|
|
34562
|
-
return new Promise((
|
|
34563
|
-
current.once("close", () =>
|
|
34564
|
-
current.once("error", () =>
|
|
34812
|
+
return new Promise((resolve32) => {
|
|
34813
|
+
current.once("close", () => resolve32());
|
|
34814
|
+
current.once("error", () => resolve32());
|
|
34565
34815
|
try {
|
|
34566
34816
|
current.end();
|
|
34567
34817
|
} catch {
|
|
34568
|
-
|
|
34818
|
+
resolve32();
|
|
34569
34819
|
}
|
|
34570
34820
|
});
|
|
34571
34821
|
}
|
|
@@ -34830,13 +35080,13 @@ function closeDebugLog() {
|
|
|
34830
35080
|
if (!state || !current) return Promise.resolve();
|
|
34831
35081
|
state.logStream = null;
|
|
34832
35082
|
if (state.logFilePath) liveLogFilePaths.delete(state.logFilePath);
|
|
34833
|
-
return new Promise((
|
|
34834
|
-
current.once("close", () =>
|
|
34835
|
-
current.once("error", () =>
|
|
35083
|
+
return new Promise((resolve32) => {
|
|
35084
|
+
current.once("close", () => resolve32());
|
|
35085
|
+
current.once("error", () => resolve32());
|
|
34836
35086
|
try {
|
|
34837
35087
|
current.end();
|
|
34838
35088
|
} catch {
|
|
34839
|
-
|
|
35089
|
+
resolve32();
|
|
34840
35090
|
}
|
|
34841
35091
|
});
|
|
34842
35092
|
}
|
|
@@ -35154,7 +35404,7 @@ var init_vault_folder = __esm({
|
|
|
35154
35404
|
|
|
35155
35405
|
// src/ga/server/index.ts
|
|
35156
35406
|
init_dist();
|
|
35157
|
-
import { randomUUID as
|
|
35407
|
+
import { randomUUID as randomUUID21 } from "node:crypto";
|
|
35158
35408
|
import {
|
|
35159
35409
|
createServer as createServer2
|
|
35160
35410
|
} from "node:http";
|
|
@@ -35360,12 +35610,12 @@ async function startOAuthListener({
|
|
|
35360
35610
|
let resolveCallback;
|
|
35361
35611
|
let rejectCallback;
|
|
35362
35612
|
let timeoutHandle;
|
|
35363
|
-
const callbackPromise = new Promise((
|
|
35613
|
+
const callbackPromise = new Promise((resolve32, reject) => {
|
|
35364
35614
|
resolveCallback = (url) => {
|
|
35365
35615
|
if (settled) return;
|
|
35366
35616
|
settled = true;
|
|
35367
35617
|
if (timeoutHandle) clearTimeout(timeoutHandle);
|
|
35368
|
-
|
|
35618
|
+
resolve32(url);
|
|
35369
35619
|
};
|
|
35370
35620
|
rejectCallback = (error) => {
|
|
35371
35621
|
if (settled) return;
|
|
@@ -35524,7 +35774,7 @@ async function startOAuthListener({
|
|
|
35524
35774
|
});
|
|
35525
35775
|
});
|
|
35526
35776
|
const bindAddress = getBindAddress();
|
|
35527
|
-
await new Promise((
|
|
35777
|
+
await new Promise((resolve32, reject) => {
|
|
35528
35778
|
const handleError = (error) => {
|
|
35529
35779
|
server.off("error", handleError);
|
|
35530
35780
|
if (error.code === "EADDRINUSE") {
|
|
@@ -35540,7 +35790,7 @@ async function startOAuthListener({
|
|
|
35540
35790
|
server.once("error", handleError);
|
|
35541
35791
|
server.listen(port, bindAddress, () => {
|
|
35542
35792
|
server.off("error", handleError);
|
|
35543
|
-
|
|
35793
|
+
resolve32();
|
|
35544
35794
|
});
|
|
35545
35795
|
});
|
|
35546
35796
|
server.on("error", (error) => {
|
|
@@ -35548,7 +35798,7 @@ async function startOAuthListener({
|
|
|
35548
35798
|
});
|
|
35549
35799
|
return {
|
|
35550
35800
|
waitForCallback: () => callbackPromise,
|
|
35551
|
-
close: () => new Promise((
|
|
35801
|
+
close: () => new Promise((resolve32, reject) => {
|
|
35552
35802
|
server.close((error) => {
|
|
35553
35803
|
if (error && error.code !== "ERR_SERVER_NOT_RUNNING") {
|
|
35554
35804
|
reject(error);
|
|
@@ -35557,7 +35807,7 @@ async function startOAuthListener({
|
|
|
35557
35807
|
if (!settled) {
|
|
35558
35808
|
rejectCallback(new Error("OAuth listener closed before callback"));
|
|
35559
35809
|
}
|
|
35560
|
-
|
|
35810
|
+
resolve32();
|
|
35561
35811
|
});
|
|
35562
35812
|
})
|
|
35563
35813
|
};
|
|
@@ -35573,11 +35823,11 @@ var GA_POOL_PASTE_METHOD_ID = "antigravity-auth-pool-paste";
|
|
|
35573
35823
|
var GA_POOL_RECONNECT_METHOD_ID = "antigravity-auth-pool-reconnect";
|
|
35574
35824
|
var LOGIN_FAILED = "The Antigravity pool login could not be completed.";
|
|
35575
35825
|
function abortable(pending, signal) {
|
|
35576
|
-
return new Promise((
|
|
35826
|
+
return new Promise((resolve32, reject) => {
|
|
35577
35827
|
const abort = () => reject(signal.reason);
|
|
35578
35828
|
if (signal.aborted) abort();
|
|
35579
35829
|
else signal.addEventListener("abort", abort, { once: true });
|
|
35580
|
-
void pending.then(
|
|
35830
|
+
void pending.then(resolve32, reject).finally(() => {
|
|
35581
35831
|
signal.removeEventListener("abort", abort);
|
|
35582
35832
|
});
|
|
35583
35833
|
});
|
|
@@ -37124,7 +37374,10 @@ function descriptorAtPath(descriptor, path5) {
|
|
|
37124
37374
|
}
|
|
37125
37375
|
return current;
|
|
37126
37376
|
}
|
|
37127
|
-
function destination(declaration, setting, value, { host, model }) {
|
|
37377
|
+
function destination(declaration, setting, value, { host, model }, level) {
|
|
37378
|
+
if (level !== void 0) {
|
|
37379
|
+
return level === "default" && !isJsonObject(value) ? [setting] : [setting, level];
|
|
37380
|
+
}
|
|
37128
37381
|
if (declaration.overrides !== void 0 && isJsonObject(value)) {
|
|
37129
37382
|
if (declaration.overrides.model && model !== void 0 && model !== "default" && model !== "opencode" && model !== "pi" && Object.hasOwn(value, model)) {
|
|
37130
37383
|
return [setting, model];
|
|
@@ -37154,6 +37407,19 @@ function checkPath(parsed, path5) {
|
|
|
37154
37407
|
invalid();
|
|
37155
37408
|
}
|
|
37156
37409
|
}
|
|
37410
|
+
function preservePlainDefault(parsed, setting) {
|
|
37411
|
+
const node = parsed.tree && findNodeAtLocation(parsed.tree, [setting]);
|
|
37412
|
+
if (!node)
|
|
37413
|
+
invalid();
|
|
37414
|
+
const value = parsed.text.slice(node.offset, node.offset + node.length);
|
|
37415
|
+
return parseForEdit(applyEdits(parsed.text, [
|
|
37416
|
+
{
|
|
37417
|
+
offset: node.offset,
|
|
37418
|
+
length: node.length,
|
|
37419
|
+
content: `{ "default": ${value} }`
|
|
37420
|
+
}
|
|
37421
|
+
]));
|
|
37422
|
+
}
|
|
37157
37423
|
function removeMember(text2, tree, path5) {
|
|
37158
37424
|
const property = tree && findNodeAtLocation(tree, path5)?.parent;
|
|
37159
37425
|
const parent = property?.parent;
|
|
@@ -37227,6 +37493,16 @@ function applySettingsEdits(definition, source, edits, context) {
|
|
|
37227
37493
|
if (!Object.hasOwn(definition.settings, edit.setting))
|
|
37228
37494
|
invalid();
|
|
37229
37495
|
const declaration = definition.settings[edit.setting];
|
|
37496
|
+
if (edit.level !== void 0) {
|
|
37497
|
+
if (edit.path !== void 0)
|
|
37498
|
+
invalid();
|
|
37499
|
+
if (edit.level === "default") {
|
|
37500
|
+
if (declaration.overrides === void 0)
|
|
37501
|
+
invalid();
|
|
37502
|
+
} else if (edit.level !== "opencode" && edit.level !== "pi" || !declaration.overrides?.host) {
|
|
37503
|
+
invalid();
|
|
37504
|
+
}
|
|
37505
|
+
}
|
|
37230
37506
|
if (edit.path !== void 0 && declaration.value.kind !== "object" && declaration.value.kind !== "record")
|
|
37231
37507
|
invalid();
|
|
37232
37508
|
const descriptor = descriptorAtPath(declaration.value, edit.path ?? []);
|
|
@@ -37238,7 +37514,19 @@ function applySettingsEdits(definition, source, edits, context) {
|
|
|
37238
37514
|
const units = [];
|
|
37239
37515
|
for (const edit of edits) {
|
|
37240
37516
|
const declaration = definition.settings[edit.setting];
|
|
37241
|
-
|
|
37517
|
+
if (edit.level !== void 0 && edit.level !== "default" && !isJsonObject(working.value[edit.setting])) {
|
|
37518
|
+
if (edit.remove === true)
|
|
37519
|
+
continue;
|
|
37520
|
+
if (Object.hasOwn(working.value, edit.setting)) {
|
|
37521
|
+
working = preservePlainDefault(working, edit.setting);
|
|
37522
|
+
}
|
|
37523
|
+
for (const unit of units) {
|
|
37524
|
+
if (unit.path.length === 1 && unit.path[0] === edit.setting) {
|
|
37525
|
+
unit.path.push("default");
|
|
37526
|
+
}
|
|
37527
|
+
}
|
|
37528
|
+
}
|
|
37529
|
+
const base = edit.path !== void 0 ? [edit.setting] : destination(declaration, edit.setting, working.value[edit.setting], context, edit.level);
|
|
37242
37530
|
const path5 = [...base, ...edit.path ?? []];
|
|
37243
37531
|
checkPath(working, path5);
|
|
37244
37532
|
units.push(resolutionUnit(declaration.value, base, edit.path ?? []));
|
|
@@ -37391,18 +37679,20 @@ async function writeTarget(file) {
|
|
|
37391
37679
|
} catch (error) {
|
|
37392
37680
|
if (error.code !== "ENOENT")
|
|
37393
37681
|
unavailable(file, error);
|
|
37682
|
+
let isSymlink = false;
|
|
37394
37683
|
try {
|
|
37395
|
-
await SettingsFs.lstat(file);
|
|
37684
|
+
isSymlink = (await SettingsFs.lstat(file)).isSymbolicLink();
|
|
37396
37685
|
} catch (lstatError) {
|
|
37397
37686
|
if (lstatError.code !== "ENOENT")
|
|
37398
37687
|
unavailable(file, lstatError);
|
|
37399
|
-
try {
|
|
37400
|
-
return join11(await SettingsFs.realpath(dirname14(file)), basename6(file));
|
|
37401
|
-
} catch (parentError) {
|
|
37402
|
-
unavailable(file, parentError);
|
|
37403
|
-
}
|
|
37404
37688
|
}
|
|
37405
|
-
|
|
37689
|
+
if (isSymlink)
|
|
37690
|
+
unavailable(file, error);
|
|
37691
|
+
try {
|
|
37692
|
+
return join11(await SettingsFs.realpath(dirname14(file)), basename6(file));
|
|
37693
|
+
} catch (parentError) {
|
|
37694
|
+
unavailable(file, parentError);
|
|
37695
|
+
}
|
|
37406
37696
|
}
|
|
37407
37697
|
}
|
|
37408
37698
|
async function updateSettings(definition, options, edits, context) {
|
|
@@ -37457,6 +37747,16 @@ async function updateSettings(definition, options, edits, context) {
|
|
|
37457
37747
|
if (Number.isInteger(version) && version > 1) {
|
|
37458
37748
|
throw new SettingsRefusal("settings-newer-version", "Settings were written by a newer version");
|
|
37459
37749
|
}
|
|
37750
|
+
if (typeof edits === "function") {
|
|
37751
|
+
const planned = edits(deepFreeze(missing ? { status: "missing" } : {
|
|
37752
|
+
status: "ready",
|
|
37753
|
+
document: structuredClone(parsed.value)
|
|
37754
|
+
}));
|
|
37755
|
+
if (planned !== null && (typeof planned === "object" || typeof planned === "function") && "then" in planned && typeof planned.then === "function") {
|
|
37756
|
+
throw new SettingsRefusal("settings-invalid-value", "Settings update plans must be synchronous");
|
|
37757
|
+
}
|
|
37758
|
+
edits = planned;
|
|
37759
|
+
}
|
|
37460
37760
|
if (!parsed.tree) {
|
|
37461
37761
|
source = `${parsed.hasBom ? "\uFEFF" : ""}// ${definition.plugin} settings
|
|
37462
37762
|
{
|
|
@@ -38847,7 +39147,7 @@ function buildAccountAccessProbeRequest(projectId) {
|
|
|
38847
39147
|
generationConfig: { maxOutputTokens: 1, temperature: 0 }
|
|
38848
39148
|
};
|
|
38849
39149
|
const requestMetadata = buildAgyAgentRequestMetadata(
|
|
38850
|
-
createAgyRequestSessionContext(
|
|
39150
|
+
createAgyRequestSessionContext(),
|
|
38851
39151
|
request2,
|
|
38852
39152
|
wireModel
|
|
38853
39153
|
);
|
|
@@ -40426,7 +40726,7 @@ function drainSidebarWrites() {
|
|
|
40426
40726
|
return sidebarWriteChain;
|
|
40427
40727
|
}
|
|
40428
40728
|
async function sleep3(ms) {
|
|
40429
|
-
await new Promise((
|
|
40729
|
+
await new Promise((resolve32) => setTimeout(resolve32, ms));
|
|
40430
40730
|
}
|
|
40431
40731
|
async function acquireSidebarLockWithRetry(stateFile) {
|
|
40432
40732
|
const start = Date.now();
|
|
@@ -40985,14 +41285,14 @@ var LocalQuotaGrantStaleError = class extends Error {
|
|
|
40985
41285
|
name = "LocalQuotaGrantStaleError";
|
|
40986
41286
|
};
|
|
40987
41287
|
function untilQuotaAborted(pending, signal) {
|
|
40988
|
-
return new Promise((
|
|
41288
|
+
return new Promise((resolve32, reject) => {
|
|
40989
41289
|
const abort = () => reject(signal.reason);
|
|
40990
41290
|
if (signal.aborted) abort();
|
|
40991
41291
|
else signal.addEventListener("abort", abort, { once: true });
|
|
40992
41292
|
void pending.then(
|
|
40993
41293
|
(value) => {
|
|
40994
41294
|
signal.removeEventListener("abort", abort);
|
|
40995
|
-
|
|
41295
|
+
resolve32(value);
|
|
40996
41296
|
},
|
|
40997
41297
|
(error) => {
|
|
40998
41298
|
signal.removeEventListener("abort", abort);
|
|
@@ -42904,6 +43204,30 @@ To view: \`open "${filePath}"\``;
|
|
|
42904
43204
|
return ``;
|
|
42905
43205
|
}
|
|
42906
43206
|
|
|
43207
|
+
// src/plugin/core/streaming/terminal-event.ts
|
|
43208
|
+
function responseHasFinishReason(response) {
|
|
43209
|
+
if (!response || typeof response !== "object") return false;
|
|
43210
|
+
const resp = response;
|
|
43211
|
+
if (Array.isArray(resp.candidates)) {
|
|
43212
|
+
return resp.candidates.some((candidate) => {
|
|
43213
|
+
const cand = candidate;
|
|
43214
|
+
return typeof cand?.finishReason === "string" && cand.finishReason.length > 0;
|
|
43215
|
+
});
|
|
43216
|
+
}
|
|
43217
|
+
const stopReason = resp.stopReason ?? resp.stop_reason;
|
|
43218
|
+
return typeof stopReason === "string" && stopReason.length > 0;
|
|
43219
|
+
}
|
|
43220
|
+
function isTerminalSseLine(line) {
|
|
43221
|
+
if (!line.startsWith("data:")) return false;
|
|
43222
|
+
if (!/"(?:finishReason|stopReason|stop_reason)"/.test(line)) return false;
|
|
43223
|
+
try {
|
|
43224
|
+
const parsed = JSON.parse(line.slice(5).trim());
|
|
43225
|
+
return parsed?.response !== void 0 && responseHasFinishReason(parsed.response);
|
|
43226
|
+
} catch {
|
|
43227
|
+
return false;
|
|
43228
|
+
}
|
|
43229
|
+
}
|
|
43230
|
+
|
|
42907
43231
|
// src/plugin/core/streaming/transformer.ts
|
|
42908
43232
|
function hashString(str) {
|
|
42909
43233
|
let hash2 = 5381;
|
|
@@ -43073,18 +43397,6 @@ function responseHasToolCall(response) {
|
|
|
43073
43397
|
}
|
|
43074
43398
|
return false;
|
|
43075
43399
|
}
|
|
43076
|
-
function responseHasFinishReason(response) {
|
|
43077
|
-
if (!response || typeof response !== "object") return false;
|
|
43078
|
-
const resp = response;
|
|
43079
|
-
if (Array.isArray(resp.candidates)) {
|
|
43080
|
-
return resp.candidates.some((candidate) => {
|
|
43081
|
-
const cand = candidate;
|
|
43082
|
-
return typeof cand?.finishReason === "string" && cand.finishReason.length > 0;
|
|
43083
|
-
});
|
|
43084
|
-
}
|
|
43085
|
-
const stopReason = resp.stopReason ?? resp.stop_reason;
|
|
43086
|
-
return typeof stopReason === "string" && stopReason.length > 0;
|
|
43087
|
-
}
|
|
43088
43400
|
function transformSseLineWithMetadata(line, signatureStore, thoughtBuffer, sentThinkingBuffer, callbacks, options, debugState2, usageState) {
|
|
43089
43401
|
if (!line.startsWith("data:")) {
|
|
43090
43402
|
return { line, hasToolCall: false, hasFinishReason: false };
|
|
@@ -46037,7 +46349,7 @@ init_dist();
|
|
|
46037
46349
|
// src/plugin/request.ts
|
|
46038
46350
|
var log11 = createLogger4("request");
|
|
46039
46351
|
var PLUGIN_SESSION_ID = `-${crypto2.randomUUID()}`;
|
|
46040
|
-
var DEFAULT_AGY_REQUEST_SESSION = createAgyRequestSessionContext(
|
|
46352
|
+
var DEFAULT_AGY_REQUEST_SESSION = createAgyRequestSessionContext();
|
|
46041
46353
|
var sessionDisplayedThinkingHashes = /* @__PURE__ */ new Set();
|
|
46042
46354
|
var MIN_SIGNATURE_LENGTH = 50;
|
|
46043
46355
|
var AGY_CLAUDE_THINKING_BUDGET = 1024;
|
|
@@ -46118,7 +46430,9 @@ function getAgyMaxOutputTokens(model) {
|
|
|
46118
46430
|
}
|
|
46119
46431
|
function applyAgyGenerationDefaults(model, generationConfig) {
|
|
46120
46432
|
if (getAgyNativeModel(model)) {
|
|
46121
|
-
applyAgyNativeGenerationConfig(model, generationConfig
|
|
46433
|
+
applyAgyNativeGenerationConfig(model, generationConfig, {
|
|
46434
|
+
preserveThinkingBudget: false
|
|
46435
|
+
});
|
|
46122
46436
|
return;
|
|
46123
46437
|
}
|
|
46124
46438
|
const maxOutputTokens = getAgyMaxOutputTokens(model);
|
|
@@ -46434,20 +46748,38 @@ function stripUnsupportedAntigravityFields(payload) {
|
|
|
46434
46748
|
}
|
|
46435
46749
|
}
|
|
46436
46750
|
}
|
|
46437
|
-
function
|
|
46438
|
-
|
|
46439
|
-
|
|
46440
|
-
|
|
46751
|
+
function isGeminiFunctionResponseTurn(content, wireModel) {
|
|
46752
|
+
return wireModel.startsWith("gemini-") && content?.role === "model" && Array.isArray(content.parts) && content.parts.length > 0 && content.parts.every((part) => part?.functionResponse);
|
|
46753
|
+
}
|
|
46754
|
+
function configureAntigravityToolCalling(payload) {
|
|
46755
|
+
delete payload.toolConfig;
|
|
46756
|
+
if (Array.isArray(payload.tools)) {
|
|
46757
|
+
payload.tools = payload.tools.flatMap(
|
|
46758
|
+
(tool2) => Array.isArray(tool2?.functionDeclarations) ? tool2.functionDeclarations.map((declaration) => ({
|
|
46759
|
+
functionDeclarations: [declaration]
|
|
46760
|
+
})) : [tool2]
|
|
46761
|
+
);
|
|
46441
46762
|
}
|
|
46442
|
-
const toolConfig = payload.toolConfig && typeof payload.toolConfig === "object" && !Array.isArray(payload.toolConfig) ? payload.toolConfig : {};
|
|
46443
|
-
const functionCallingConfig = toolConfig.functionCallingConfig && typeof toolConfig.functionCallingConfig === "object" && !Array.isArray(toolConfig.functionCallingConfig) ? toolConfig.functionCallingConfig : {};
|
|
46444
|
-
functionCallingConfig.mode = "VALIDATED";
|
|
46445
|
-
toolConfig.functionCallingConfig = functionCallingConfig;
|
|
46446
|
-
payload.toolConfig = toolConfig;
|
|
46447
46763
|
}
|
|
46448
|
-
function normalizeNativeFunctionResponseRoles(payload) {
|
|
46764
|
+
function normalizeNativeFunctionResponseRoles(payload, wireModel) {
|
|
46449
46765
|
const contents = payload.contents;
|
|
46450
46766
|
if (!Array.isArray(contents)) return;
|
|
46767
|
+
if (wireModel.startsWith("claude-")) {
|
|
46768
|
+
for (const content of contents) {
|
|
46769
|
+
if (Array.isArray(content?.parts)) {
|
|
46770
|
+
for (const part of content.parts) {
|
|
46771
|
+
if (part?.functionCall) {
|
|
46772
|
+
delete part.thoughtSignature;
|
|
46773
|
+
delete part.thought_signature;
|
|
46774
|
+
}
|
|
46775
|
+
}
|
|
46776
|
+
}
|
|
46777
|
+
if (content?.role === "model" && Array.isArray(content.parts) && content.parts.length > 0 && content.parts.every((part) => part?.functionResponse)) {
|
|
46778
|
+
content.role = "user";
|
|
46779
|
+
}
|
|
46780
|
+
}
|
|
46781
|
+
return;
|
|
46782
|
+
}
|
|
46451
46783
|
const signedCalls = /* @__PURE__ */ new Set();
|
|
46452
46784
|
for (const content of contents) {
|
|
46453
46785
|
const parts = content?.parts;
|
|
@@ -46893,7 +47225,10 @@ function prepareAntigravityRequestIn(wire, input2, init, accessToken, projectId,
|
|
|
46893
47225
|
}
|
|
46894
47226
|
const [, rawModel = "", rawAction = ""] = match;
|
|
46895
47227
|
const requestedModel = rawModel;
|
|
46896
|
-
const
|
|
47228
|
+
const hydrogenTier = isGeminiHydrogenModel(rawModel) ? options?.variant?.thinkingLevel : void 0;
|
|
47229
|
+
const resolved = resolveAntigravityModel(
|
|
47230
|
+
hydrogenTier ? `${rawModel.replace(/-(low|medium|high|xhigh)$/i, "")}-${hydrogenTier}` : rawModel
|
|
47231
|
+
);
|
|
46897
47232
|
let effectiveModel = resolved.actualModel;
|
|
46898
47233
|
const streaming = rawAction === STREAM_ACTION;
|
|
46899
47234
|
const defaultEndpoint = ANTIGRAVITY_ENDPOINT;
|
|
@@ -46982,14 +47317,14 @@ function prepareAntigravityRequestIn(wire, input2, init, accessToken, projectId,
|
|
|
46982
47317
|
}
|
|
46983
47318
|
sanitizeRequestPayloadForAntigravity(req);
|
|
46984
47319
|
stripUnsupportedAntigravityFields(req);
|
|
46985
|
-
configureAntigravityToolCalling(req
|
|
46986
|
-
normalizeNativeFunctionResponseRoles(req);
|
|
47320
|
+
configureAntigravityToolCalling(req);
|
|
47321
|
+
normalizeNativeFunctionResponseRoles(req, effectiveModel);
|
|
46987
47322
|
}
|
|
46988
47323
|
for (const req of requestObjects) {
|
|
46989
47324
|
if (Array.isArray(req.contents)) {
|
|
46990
47325
|
const contents = req.contents;
|
|
46991
47326
|
const lastContent = contents[contents.length - 1];
|
|
46992
|
-
if (lastContent?.role === "model" || lastContent?.role === "assistant") {
|
|
47327
|
+
if (lastContent?.role === "model" && !isGeminiFunctionResponseTurn(lastContent, effectiveModel) || lastContent?.role === "assistant") {
|
|
46993
47328
|
contents.push({ role: "user", parts: [{ text: "[Continue]" }] });
|
|
46994
47329
|
}
|
|
46995
47330
|
}
|
|
@@ -47024,7 +47359,9 @@ function prepareAntigravityRequestIn(wire, input2, init, accessToken, projectId,
|
|
|
47024
47359
|
{
|
|
47025
47360
|
const generationConfig = wireRequest.generationConfig;
|
|
47026
47361
|
const config = generationConfig && typeof generationConfig === "object" && !Array.isArray(generationConfig) ? generationConfig : {};
|
|
47027
|
-
applyAgyNativeGenerationConfig(effectiveModel, config
|
|
47362
|
+
applyAgyNativeGenerationConfig(effectiveModel, config, {
|
|
47363
|
+
thinkingBudget: options?.variant?.thinkingBudget
|
|
47364
|
+
});
|
|
47028
47365
|
if (Object.keys(config).length > 0)
|
|
47029
47366
|
wireRequest.generationConfig = config;
|
|
47030
47367
|
const metadata = buildAgyAgentRequestMetadata(
|
|
@@ -47053,13 +47390,19 @@ function prepareAntigravityRequestIn(wire, input2, init, accessToken, projectId,
|
|
|
47053
47390
|
requestPayload.providerOptions,
|
|
47054
47391
|
rawGenerationConfig
|
|
47055
47392
|
);
|
|
47393
|
+
const callerThinking = rawGenerationConfig?.thinkingConfig ?? extraBody?.thinkingConfig ?? requestPayload.thinkingConfig;
|
|
47394
|
+
const callerAnthropicThinking = extraBody?.thinking ?? requestPayload.thinking;
|
|
47395
|
+
const explicitThinkingBudget = variantConfig?.thinkingBudget ?? (typeof callerThinking?.thinkingBudget === "number" ? callerThinking.thinkingBudget : void 0) ?? (typeof callerAnthropicThinking?.budgetTokens === "number" ? callerAnthropicThinking.budgetTokens : void 0);
|
|
47056
47396
|
const isGemini3 = effectiveModel.toLowerCase().includes("gemini-3");
|
|
47057
47397
|
wire.logger.debug(
|
|
47058
47398
|
`[ThinkingResolution] rawModel=${rawModel} resolvedModel=${effectiveModel} resolvedTier=${tierThinkingLevel ?? "none"} variantLevel=${variantConfig?.thinkingLevel ?? "none"} variantBudget=${variantConfig?.thinkingBudget ?? "none"} providerOptions.google=${JSON.stringify(requestPayload.providerOptions?.google ?? null)} generationConfig.thinkingConfig=${JSON.stringify(rawGenerationConfig?.thinkingConfig ?? null)}`
|
|
47059
47399
|
);
|
|
47060
47400
|
delete requestPayload.providerOptions;
|
|
47061
|
-
if (variantConfig?.thinkingLevel && (isGemini3 || isGeminiArgonModel(effectiveModel) || isGeminiCarbonModel(effectiveModel) || getAgyNativeModel(effectiveModel)?.supportsAdaptiveThinking)) {
|
|
47062
|
-
const variantModelBase = rawModel.replace(/-preview-customtools$/i, "").replace(/-preview$/i, "").replace(
|
|
47401
|
+
if (variantConfig?.thinkingLevel && (isGemini3 || isGeminiArgonModel(effectiveModel) || isGeminiCarbonModel(effectiveModel) || isGeminiHydrogenModel(effectiveModel) || getAgyNativeModel(effectiveModel)?.supportsAdaptiveThinking)) {
|
|
47402
|
+
const variantModelBase = rawModel.replace(/-preview-customtools$/i, "").replace(/-preview$/i, "").replace(
|
|
47403
|
+
isGeminiHydrogenModel(effectiveModel) ? /-(low|medium|high|xhigh)$/i : /-(minimal|low|medium|high)$/i,
|
|
47404
|
+
""
|
|
47405
|
+
);
|
|
47063
47406
|
const variantResolved = resolveAntigravityModel(
|
|
47064
47407
|
`${variantModelBase}-${variantConfig.thinkingLevel}`
|
|
47065
47408
|
);
|
|
@@ -47155,7 +47498,7 @@ function prepareAntigravityRequestIn(wire, input2, init, accessToken, projectId,
|
|
|
47155
47498
|
if (rawGenerationConfig) {
|
|
47156
47499
|
rawGenerationConfig.thinkingConfig = thinkingConfig;
|
|
47157
47500
|
applyAgyGenerationDefaults(effectiveModel, rawGenerationConfig);
|
|
47158
|
-
if (isClaudeThinking && typeof thinkingBudget === "number" && thinkingBudget > 0) {
|
|
47501
|
+
if (isClaudeThinking && !getAgyNativeModel(effectiveModel)?.supportsAdaptiveThinking && typeof thinkingBudget === "number" && thinkingBudget > 0) {
|
|
47159
47502
|
const currentMax = rawGenerationConfig.maxOutputTokens ?? rawGenerationConfig.max_output_tokens;
|
|
47160
47503
|
if (!currentMax) {
|
|
47161
47504
|
rawGenerationConfig.maxOutputTokens = 64e3;
|
|
@@ -47171,7 +47514,7 @@ function prepareAntigravityRequestIn(wire, input2, init, accessToken, projectId,
|
|
|
47171
47514
|
const generationConfig = {
|
|
47172
47515
|
thinkingConfig
|
|
47173
47516
|
};
|
|
47174
|
-
if (isClaudeThinking && typeof thinkingBudget === "number" && thinkingBudget > 0) {
|
|
47517
|
+
if (isClaudeThinking && !getAgyNativeModel(effectiveModel)?.supportsAdaptiveThinking && typeof thinkingBudget === "number" && thinkingBudget > 0) {
|
|
47175
47518
|
generationConfig.maxOutputTokens = 64e3;
|
|
47176
47519
|
}
|
|
47177
47520
|
applyAgyGenerationDefaults(effectiveModel, generationConfig);
|
|
@@ -47272,7 +47615,11 @@ function prepareAntigravityRequestIn(wire, input2, init, accessToken, projectId,
|
|
|
47272
47615
|
});
|
|
47273
47616
|
const finalTools = [];
|
|
47274
47617
|
if (functionDeclarations.length > 0) {
|
|
47275
|
-
finalTools.push(
|
|
47618
|
+
finalTools.push(
|
|
47619
|
+
...functionDeclarations.map((declaration) => ({
|
|
47620
|
+
functionDeclarations: [declaration]
|
|
47621
|
+
}))
|
|
47622
|
+
);
|
|
47276
47623
|
}
|
|
47277
47624
|
requestPayload.tools = finalTools.concat(passthroughTools);
|
|
47278
47625
|
} else {
|
|
@@ -47404,7 +47751,7 @@ function prepareAntigravityRequestIn(wire, input2, init, accessToken, projectId,
|
|
|
47404
47751
|
requestPayload.messages
|
|
47405
47752
|
);
|
|
47406
47753
|
}
|
|
47407
|
-
if (isClaudeThinking && Array.isArray(requestPayload.contents)) {
|
|
47754
|
+
if (isClaudeThinking && !getAgyNativeModel(effectiveModel)?.supportsAdaptiveThinking && Array.isArray(requestPayload.contents)) {
|
|
47408
47755
|
const conversationState = analyzeConversationState(
|
|
47409
47756
|
requestPayload.contents
|
|
47410
47757
|
);
|
|
@@ -47418,7 +47765,7 @@ function prepareAntigravityRequestIn(wire, input2, init, accessToken, projectId,
|
|
|
47418
47765
|
}
|
|
47419
47766
|
if (Array.isArray(requestPayload.contents)) {
|
|
47420
47767
|
const lastContent = requestPayload.contents[requestPayload.contents.length - 1];
|
|
47421
|
-
if (lastContent?.role === "model" || lastContent?.role === "assistant") {
|
|
47768
|
+
if (lastContent?.role === "model" && !isGeminiFunctionResponseTurn(lastContent, effectiveModel) || lastContent?.role === "assistant") {
|
|
47422
47769
|
requestPayload.contents.push({
|
|
47423
47770
|
role: "user",
|
|
47424
47771
|
parts: [{ text: "[Continue]" }]
|
|
@@ -47443,15 +47790,18 @@ function prepareAntigravityRequestIn(wire, input2, init, accessToken, projectId,
|
|
|
47443
47790
|
{
|
|
47444
47791
|
const generationConfig = requestPayload.generationConfig;
|
|
47445
47792
|
const config = generationConfig && typeof generationConfig === "object" && !Array.isArray(generationConfig) ? generationConfig : {};
|
|
47446
|
-
applyAgyNativeGenerationConfig(effectiveModel, config
|
|
47793
|
+
applyAgyNativeGenerationConfig(effectiveModel, config, {
|
|
47794
|
+
thinkingBudget: explicitThinkingBudget,
|
|
47795
|
+
preserveThinkingBudget: false
|
|
47796
|
+
});
|
|
47447
47797
|
if (Object.keys(config).length > 0)
|
|
47448
47798
|
requestPayload.generationConfig = config;
|
|
47449
47799
|
stripUnsupportedAntigravityFields(requestPayload);
|
|
47450
|
-
configureAntigravityToolCalling(requestPayload
|
|
47451
|
-
normalizeNativeFunctionResponseRoles(requestPayload);
|
|
47800
|
+
configureAntigravityToolCalling(requestPayload);
|
|
47801
|
+
normalizeNativeFunctionResponseRoles(requestPayload, effectiveModel);
|
|
47452
47802
|
if (Array.isArray(requestPayload.contents)) {
|
|
47453
|
-
const lastContent = requestPayload.contents
|
|
47454
|
-
if (lastContent?.role === "model") {
|
|
47803
|
+
const lastContent = requestPayload.contents.at(-1);
|
|
47804
|
+
if (lastContent?.role === "model" && !isGeminiFunctionResponseTurn(lastContent, effectiveModel)) {
|
|
47455
47805
|
requestPayload.contents.push({
|
|
47456
47806
|
role: "user",
|
|
47457
47807
|
parts: [{ text: "[Continue]" }]
|
|
@@ -47557,7 +47907,9 @@ function buildThinkingWarmupBody(bodyText, isClaudeThinking) {
|
|
|
47557
47907
|
thinkingBudget: AGY_CLAUDE_THINKING_BUDGET
|
|
47558
47908
|
};
|
|
47559
47909
|
generationConfig.maxOutputTokens ??= generationConfig.max_output_tokens ?? getAgyMaxOutputTokens(wireModel) ?? computeClaudeMaxOutputTokens(AGY_CLAUDE_THINKING_BUDGET);
|
|
47560
|
-
applyAgyNativeGenerationConfig(wireModel, generationConfig
|
|
47910
|
+
applyAgyNativeGenerationConfig(wireModel, generationConfig, {
|
|
47911
|
+
preserveThinkingBudget: false
|
|
47912
|
+
});
|
|
47561
47913
|
req.generationConfig = generationConfig;
|
|
47562
47914
|
requestObjects.push(req);
|
|
47563
47915
|
};
|
|
@@ -47967,8 +48319,6 @@ function transformAntigravityResponse(...args) {
|
|
|
47967
48319
|
}
|
|
47968
48320
|
|
|
47969
48321
|
// src/plugin/session-context.ts
|
|
47970
|
-
import { resolve as resolve24 } from "node:path";
|
|
47971
|
-
import { pathToFileURL } from "node:url";
|
|
47972
48322
|
var FALLBACK_SESSION_KEY = "__default__";
|
|
47973
48323
|
function extractOpenCodeSessionIdentity(headers) {
|
|
47974
48324
|
const normalized = new Headers(headers);
|
|
@@ -47980,9 +48330,8 @@ function extractOpenCodeSessionIdentity(headers) {
|
|
|
47980
48330
|
var AgySessionRegistry = class {
|
|
47981
48331
|
requestSessions;
|
|
47982
48332
|
parentSessionIds = /* @__PURE__ */ new Map();
|
|
47983
|
-
constructor(
|
|
47984
|
-
|
|
47985
|
-
this.requestSessions = new AgyRequestSessionStore(workspaceUri, options);
|
|
48333
|
+
constructor(options = {}) {
|
|
48334
|
+
this.requestSessions = new AgyRequestSessionStore(options);
|
|
47986
48335
|
}
|
|
47987
48336
|
getOrCreate(identity4) {
|
|
47988
48337
|
const key = identity4.sessionId ?? FALLBACK_SESSION_KEY;
|
|
@@ -48143,10 +48492,10 @@ async function retainResponseLifetime(response, cancellation) {
|
|
|
48143
48492
|
cancellation.release();
|
|
48144
48493
|
throw error;
|
|
48145
48494
|
}
|
|
48146
|
-
let
|
|
48495
|
+
let resolve32 = () => {
|
|
48147
48496
|
};
|
|
48148
48497
|
const settled = new Promise((done) => {
|
|
48149
|
-
|
|
48498
|
+
resolve32 = done;
|
|
48150
48499
|
});
|
|
48151
48500
|
let stopping = false;
|
|
48152
48501
|
let finished = false;
|
|
@@ -48156,7 +48505,7 @@ async function retainResponseLifetime(response, cancellation) {
|
|
|
48156
48505
|
finished = true;
|
|
48157
48506
|
cancellation.signal.removeEventListener("abort", abort);
|
|
48158
48507
|
cancellation.release();
|
|
48159
|
-
|
|
48508
|
+
resolve32();
|
|
48160
48509
|
};
|
|
48161
48510
|
const abort = () => {
|
|
48162
48511
|
if (finished || stopping) return;
|
|
@@ -48214,7 +48563,7 @@ async function retainResponseLifetime(response, cancellation) {
|
|
|
48214
48563
|
|
|
48215
48564
|
// src/plugin/shared/request-services.ts
|
|
48216
48565
|
init_dist();
|
|
48217
|
-
import { createHash as createHash17 } from "node:crypto";
|
|
48566
|
+
import { createHash as createHash17, randomUUID as randomUUID20 } from "node:crypto";
|
|
48218
48567
|
|
|
48219
48568
|
// src/common-auth-embedded/claustrum/host.js
|
|
48220
48569
|
import { ClaustrumCredentialError as ClaustrumCredentialError8 } from "@cortexkit/claustrum-client";
|
|
@@ -48336,6 +48685,14 @@ function isCacheWarmStopReason(value) {
|
|
|
48336
48685
|
}
|
|
48337
48686
|
|
|
48338
48687
|
// src/common-auth-embedded/routing-accessor/index.js
|
|
48688
|
+
var PLUGIN_WAIT_REASONS = [
|
|
48689
|
+
"account_limit",
|
|
48690
|
+
"account_free",
|
|
48691
|
+
"rate_limited",
|
|
48692
|
+
"server_busy",
|
|
48693
|
+
"quota_reading",
|
|
48694
|
+
"routing_hold"
|
|
48695
|
+
];
|
|
48339
48696
|
function isObject2(value) {
|
|
48340
48697
|
return typeof value === "object" && value !== null;
|
|
48341
48698
|
}
|
|
@@ -48442,8 +48799,8 @@ async function askRouting(input2) {
|
|
|
48442
48799
|
return void 0;
|
|
48443
48800
|
const requested = input2.deadlineMs ?? 1500;
|
|
48444
48801
|
const deadlineMs = Number.isNaN(requested) ? 1500 : Math.min(2e3, Math.max(1, requested));
|
|
48445
|
-
const expired = new Promise((
|
|
48446
|
-
timer = setTimeout(() =>
|
|
48802
|
+
const expired = new Promise((resolve32) => {
|
|
48803
|
+
timer = setTimeout(() => resolve32(void 0), deadlineMs);
|
|
48447
48804
|
timer.unref();
|
|
48448
48805
|
});
|
|
48449
48806
|
const request2 = {
|
|
@@ -48456,6 +48813,10 @@ async function askRouting(input2) {
|
|
|
48456
48813
|
}
|
|
48457
48814
|
if (input2.refusals === true)
|
|
48458
48815
|
request2.refusals = true;
|
|
48816
|
+
const warmCredentialId = input2.warmCredentialId;
|
|
48817
|
+
if (isNonEmptyString(warmCredentialId) && warmCredentialId.length <= 256 && !/\p{Cc}/u.test(warmCredentialId) && input2.candidates.some((candidate) => candidate.credentialId === warmCredentialId)) {
|
|
48818
|
+
request2.warm_credential = warmCredentialId;
|
|
48819
|
+
}
|
|
48459
48820
|
const pending = accountFor.call(handle, request2, { deadlineMs });
|
|
48460
48821
|
if (!isObject2(pending) || typeof pending.then !== "function")
|
|
48461
48822
|
return void 0;
|
|
@@ -48472,7 +48833,8 @@ async function askRouting(input2) {
|
|
|
48472
48833
|
}
|
|
48473
48834
|
function reportRouting(input2) {
|
|
48474
48835
|
try {
|
|
48475
|
-
const
|
|
48836
|
+
const sessionId = input2.sessionId;
|
|
48837
|
+
const handle = routingHandle(sessionId);
|
|
48476
48838
|
if (!handle)
|
|
48477
48839
|
return;
|
|
48478
48840
|
const report = handle.report;
|
|
@@ -48481,6 +48843,22 @@ function reportRouting(input2) {
|
|
|
48481
48843
|
let payload;
|
|
48482
48844
|
if ("kind" in input2) {
|
|
48483
48845
|
switch (input2.kind) {
|
|
48846
|
+
case "wait": {
|
|
48847
|
+
const { phase, waitId, reason, nextMs, attempt, message, outcome } = input2;
|
|
48848
|
+
if (!isNonEmptyString(sessionId) || phase !== "start" && phase !== "end" || !isNonEmptyString(waitId) || waitId.length > 64 || /[^A-Za-z0-9._:-]/.test(waitId) || !PLUGIN_WAIT_REASONS.includes(reason))
|
|
48849
|
+
return;
|
|
48850
|
+
payload = {
|
|
48851
|
+
kind: "wait",
|
|
48852
|
+
phase,
|
|
48853
|
+
wait_id: waitId,
|
|
48854
|
+
reason,
|
|
48855
|
+
...typeof nextMs === "number" && Number.isSafeInteger(nextMs) && nextMs > 0 ? { next_ms: nextMs } : {},
|
|
48856
|
+
...typeof attempt === "number" && Number.isInteger(attempt) && attempt >= 1 ? { attempt } : {},
|
|
48857
|
+
...typeof message === "string" && message.length >= 1 && message.length <= 160 && !/\p{Cc}/u.test(message) ? { message } : {},
|
|
48858
|
+
...phase === "end" && (outcome === "resumed" || outcome === "cancelled" || outcome === "abandoned") ? { outcome } : {}
|
|
48859
|
+
};
|
|
48860
|
+
break;
|
|
48861
|
+
}
|
|
48484
48862
|
case "billing": {
|
|
48485
48863
|
const { attemptId, requestKind, credentialId, provider: provider2, model, outcome, accountId, providerRequestId, providerResponseId, userMessageId, status, attempt, chargeBasis, usage: inputUsage, usageByModel: inputUsageByModel, cache: inputCache } = input2;
|
|
48486
48864
|
if (!isNonEmptyString(attemptId) || !isNonEmptyString(credentialId) || !isNonEmptyString(provider2) || !isNonEmptyString(model) || requestKind !== "primary" && requestKind !== "title" && requestKind !== "compaction" && requestKind !== "generate" && requestKind !== "keep_warm" && requestKind !== "prime" || outcome !== "completed" && outcome !== "cut" && outcome !== "failed")
|
|
@@ -48919,8 +49297,8 @@ function createAfterHandoff(work, signals, onFailure) {
|
|
|
48919
49297
|
let running = false;
|
|
48920
49298
|
let resolveCompletion = () => {
|
|
48921
49299
|
};
|
|
48922
|
-
const completion = new Promise((
|
|
48923
|
-
resolveCompletion =
|
|
49300
|
+
const completion = new Promise((resolve32) => {
|
|
49301
|
+
resolveCompletion = resolve32;
|
|
48924
49302
|
});
|
|
48925
49303
|
const finish = () => {
|
|
48926
49304
|
if (finished) return;
|
|
@@ -48967,14 +49345,14 @@ function createAfterHandoff(work, signals, onFailure) {
|
|
|
48967
49345
|
};
|
|
48968
49346
|
}
|
|
48969
49347
|
function publishResponse(dispatch) {
|
|
48970
|
-
return new Promise((
|
|
49348
|
+
return new Promise((resolve32, reject) => {
|
|
48971
49349
|
let acknowledge;
|
|
48972
49350
|
void Promise.resolve().then(
|
|
48973
49351
|
() => dispatch((callback) => {
|
|
48974
49352
|
acknowledge = callback;
|
|
48975
49353
|
})
|
|
48976
49354
|
).then((response) => {
|
|
48977
|
-
|
|
49355
|
+
resolve32(response);
|
|
48978
49356
|
acknowledge?.();
|
|
48979
49357
|
}, reject);
|
|
48980
49358
|
});
|
|
@@ -49211,9 +49589,13 @@ function observeVaultUpstream(response, signal) {
|
|
|
49211
49589
|
return void 0;
|
|
49212
49590
|
let completed = false;
|
|
49213
49591
|
return {
|
|
49214
|
-
response: observeBody(
|
|
49215
|
-
|
|
49216
|
-
|
|
49592
|
+
response: observeBody(
|
|
49593
|
+
response,
|
|
49594
|
+
() => {
|
|
49595
|
+
completed = !signal?.aborted;
|
|
49596
|
+
},
|
|
49597
|
+
isTerminalSseLine
|
|
49598
|
+
),
|
|
49217
49599
|
completedSuccessfully: () => completed
|
|
49218
49600
|
};
|
|
49219
49601
|
}
|
|
@@ -49232,29 +49614,36 @@ function observeVaultServed(identity4, response, signal, upstream) {
|
|
|
49232
49614
|
};
|
|
49233
49615
|
return observeBody(response, report);
|
|
49234
49616
|
}
|
|
49235
|
-
function observeBody(response, complete) {
|
|
49617
|
+
function observeBody(response, complete, terminal) {
|
|
49236
49618
|
if (!response.body) {
|
|
49237
49619
|
complete();
|
|
49238
49620
|
return response;
|
|
49239
49621
|
}
|
|
49240
49622
|
const sse = response.headers.get("content-type")?.includes("text/event-stream");
|
|
49623
|
+
const awaitsTerminal = sse && terminal !== void 0;
|
|
49241
49624
|
const reader = response.body.getReader();
|
|
49242
49625
|
const decoder = new TextDecoder();
|
|
49243
49626
|
let pending = "";
|
|
49244
49627
|
let failed = false;
|
|
49628
|
+
let terminated = false;
|
|
49245
49629
|
const inspect = (line) => {
|
|
49630
|
+
if (terminated) return;
|
|
49246
49631
|
if (line.length > 1024 * 1024) {
|
|
49247
49632
|
failed = true;
|
|
49248
49633
|
return;
|
|
49249
49634
|
}
|
|
49250
49635
|
if (line.startsWith("event:") && line.slice(6).trim() === "error")
|
|
49251
49636
|
failed = true;
|
|
49252
|
-
if (
|
|
49253
|
-
|
|
49254
|
-
|
|
49255
|
-
|
|
49256
|
-
|
|
49257
|
-
|
|
49637
|
+
if (line.startsWith("data:") && /"(?:error|response.failed|failed)"/.test(line)) {
|
|
49638
|
+
try {
|
|
49639
|
+
failed ||= streamFailure(JSON.parse(line.slice(5)));
|
|
49640
|
+
} catch {
|
|
49641
|
+
failed = true;
|
|
49642
|
+
}
|
|
49643
|
+
}
|
|
49644
|
+
if (awaitsTerminal && !failed && terminal?.(line)) {
|
|
49645
|
+
terminated = true;
|
|
49646
|
+
complete();
|
|
49258
49647
|
}
|
|
49259
49648
|
};
|
|
49260
49649
|
const body = new ReadableStream(
|
|
@@ -49271,12 +49660,12 @@ function observeBody(response, complete) {
|
|
|
49271
49660
|
failed = true;
|
|
49272
49661
|
}
|
|
49273
49662
|
}
|
|
49274
|
-
if (!failed) complete();
|
|
49663
|
+
if (!failed && !awaitsTerminal) complete();
|
|
49275
49664
|
controller.close();
|
|
49276
49665
|
reader.releaseLock();
|
|
49277
49666
|
return;
|
|
49278
49667
|
}
|
|
49279
|
-
if (!failed) {
|
|
49668
|
+
if (!failed && !terminated) {
|
|
49280
49669
|
pending += decoder.decode(chunk.value, { stream: true });
|
|
49281
49670
|
if (sse) {
|
|
49282
49671
|
let newline = pending.indexOf("\n");
|
|
@@ -49424,7 +49813,7 @@ function formatWaitTime(ms) {
|
|
|
49424
49813
|
return remainingMinutes > 0 ? `${hours}h ${remainingMinutes}m` : `${hours}h`;
|
|
49425
49814
|
}
|
|
49426
49815
|
function sleep4(ms, signal) {
|
|
49427
|
-
return new Promise((
|
|
49816
|
+
return new Promise((resolve32, reject) => {
|
|
49428
49817
|
if (signal?.aborted) {
|
|
49429
49818
|
reject(
|
|
49430
49819
|
signal.reason instanceof Error ? signal.reason : new Error("Aborted")
|
|
@@ -49434,7 +49823,7 @@ function sleep4(ms, signal) {
|
|
|
49434
49823
|
const timerMs = Math.min(Math.max(0, Math.floor(ms)), 2147483647);
|
|
49435
49824
|
const timeout = setTimeout(() => {
|
|
49436
49825
|
cleanup2();
|
|
49437
|
-
|
|
49826
|
+
resolve32();
|
|
49438
49827
|
}, timerMs);
|
|
49439
49828
|
const onAbort = () => {
|
|
49440
49829
|
cleanup2();
|
|
@@ -49449,6 +49838,44 @@ function sleep4(ms, signal) {
|
|
|
49449
49838
|
signal?.addEventListener("abort", onAbort, { once: true });
|
|
49450
49839
|
});
|
|
49451
49840
|
}
|
|
49841
|
+
var WAIT_MESSAGES = {
|
|
49842
|
+
account_free: "Waiting for an available account...",
|
|
49843
|
+
account_limit: "Waiting for the same account (prompt cache preserved)...",
|
|
49844
|
+
rate_limited: "Rate limited. Retrying...",
|
|
49845
|
+
server_busy: "Server busy. Retrying..."
|
|
49846
|
+
};
|
|
49847
|
+
async function withRoutingWaitReports(cancellation, run) {
|
|
49848
|
+
const pending = [];
|
|
49849
|
+
let closed2 = false;
|
|
49850
|
+
const finish = (outcome) => {
|
|
49851
|
+
for (const wait2 of pending.splice(0)) {
|
|
49852
|
+
reportRouting({ kind: "wait", phase: "end", ...wait2, outcome });
|
|
49853
|
+
}
|
|
49854
|
+
};
|
|
49855
|
+
try {
|
|
49856
|
+
return await run({
|
|
49857
|
+
sleep(ms, signal, sessionId, reason, attempt) {
|
|
49858
|
+
if (!closed2 && ms >= 2e3 && sessionId && hasVaultRoutingAccessor()) {
|
|
49859
|
+
const wait2 = {
|
|
49860
|
+
sessionId,
|
|
49861
|
+
waitId: randomUUID20(),
|
|
49862
|
+
reason,
|
|
49863
|
+
nextMs: Date.now() + ms,
|
|
49864
|
+
...attempt === void 0 ? {} : { attempt },
|
|
49865
|
+
message: WAIT_MESSAGES[reason]
|
|
49866
|
+
};
|
|
49867
|
+
pending.push(wait2);
|
|
49868
|
+
reportRouting({ kind: "wait", phase: "start", ...wait2 });
|
|
49869
|
+
}
|
|
49870
|
+
return sleep4(ms, signal);
|
|
49871
|
+
},
|
|
49872
|
+
resumed: () => finish("resumed")
|
|
49873
|
+
});
|
|
49874
|
+
} finally {
|
|
49875
|
+
closed2 = true;
|
|
49876
|
+
finish(cancellation.aborted ? "cancelled" : "abandoned");
|
|
49877
|
+
}
|
|
49878
|
+
}
|
|
49452
49879
|
function createLocalQuotaRefresh(accountManager, quotaManager, log18) {
|
|
49453
49880
|
return async function refreshQuotaAfterSuccess(account, intervalMinutes, signal) {
|
|
49454
49881
|
if (intervalMinutes <= 0) return;
|
|
@@ -49617,7 +50044,7 @@ function createRequestExecutor(deps) {
|
|
|
49617
50044
|
log18.debug("routing-report-failed", { sessionId, error: String(error) });
|
|
49618
50045
|
}
|
|
49619
50046
|
};
|
|
49620
|
-
async function execute(input2, init, options, selectedCredentials, selectedProjectIds, deadline, waitPolicy) {
|
|
50047
|
+
async function execute(input2, init, options, selectedCredentials, selectedProjectIds, deadline, waitPolicy, waits) {
|
|
49621
50048
|
const assertAdmission = async () => {
|
|
49622
50049
|
await deadline.wait(() => deps.assertAdmission?.(deadline.signal));
|
|
49623
50050
|
};
|
|
@@ -49685,9 +50112,13 @@ function createRequestExecutor(deps) {
|
|
|
49685
50112
|
};
|
|
49686
50113
|
}
|
|
49687
50114
|
const sender = options.transport ?? defaultTransport2;
|
|
49688
|
-
const transport = (url, sendInit, sendOptions) => deadline.open(
|
|
49689
|
-
()
|
|
49690
|
-
|
|
50115
|
+
const transport = (url, sendInit, sendOptions) => deadline.open(() => {
|
|
50116
|
+
waits.resumed();
|
|
50117
|
+
return sender(url, sendInit, {
|
|
50118
|
+
...sendOptions,
|
|
50119
|
+
signal: deadline.signal
|
|
50120
|
+
});
|
|
50121
|
+
});
|
|
49691
50122
|
const requestSessionIdentity = options.session ?? extractOpenCodeSessionIdentity(init?.headers);
|
|
49692
50123
|
const agyRequestScope = agySessionRegistry.beginRequest(
|
|
49693
50124
|
agyMetadataIdentity(requestSessionIdentity, kind)
|
|
@@ -49737,6 +50168,13 @@ function createRequestExecutor(deps) {
|
|
|
49737
50168
|
let lastFailure = null;
|
|
49738
50169
|
let lastError = null;
|
|
49739
50170
|
const abortSignal = init?.signal ?? void 0;
|
|
50171
|
+
const routingSleep = (ms, reason, attempt) => waits.sleep(
|
|
50172
|
+
ms,
|
|
50173
|
+
abortSignal,
|
|
50174
|
+
credentials.domain === "vault" ? requestSessionIdentity.sessionId ?? void 0 : void 0,
|
|
50175
|
+
reason,
|
|
50176
|
+
attempt
|
|
50177
|
+
);
|
|
49740
50178
|
const checkAborted = () => {
|
|
49741
50179
|
deadline.check();
|
|
49742
50180
|
if (abortSignal?.aborted) {
|
|
@@ -50078,7 +50516,10 @@ function createRequestExecutor(deps) {
|
|
|
50078
50516
|
);
|
|
50079
50517
|
retryState.markSoftQuotaToastShown();
|
|
50080
50518
|
}
|
|
50081
|
-
await
|
|
50519
|
+
await routingSleep(
|
|
50520
|
+
Math.min(waitMs, remainingWaitMs()),
|
|
50521
|
+
"account_free"
|
|
50522
|
+
);
|
|
50082
50523
|
continue;
|
|
50083
50524
|
}
|
|
50084
50525
|
waitPolicy.refusal = quotaWins ? () => createNativeGoogleErrorResponse({
|
|
@@ -50121,7 +50562,7 @@ function createRequestExecutor(deps) {
|
|
|
50121
50562
|
);
|
|
50122
50563
|
retryState.markRateLimitToastShown();
|
|
50123
50564
|
}
|
|
50124
|
-
await
|
|
50565
|
+
await routingSleep(Math.min(waitMs, remainingWaitMs()), "account_free");
|
|
50125
50566
|
continue;
|
|
50126
50567
|
}
|
|
50127
50568
|
allAccountsBlockedAt = void 0;
|
|
@@ -50795,7 +51236,11 @@ function createRequestExecutor(deps) {
|
|
|
50795
51236
|
`\u23F3 Server busy (${response.status}). Retrying in ${waitSec}s...`,
|
|
50796
51237
|
"warning"
|
|
50797
51238
|
);
|
|
50798
|
-
await
|
|
51239
|
+
await routingSleep(
|
|
51240
|
+
waitMs,
|
|
51241
|
+
"server_busy",
|
|
51242
|
+
capacityRetryCount + 1
|
|
51243
|
+
);
|
|
50799
51244
|
if (capacityRetryCount < 1) {
|
|
50800
51245
|
capacityRetryCount++;
|
|
50801
51246
|
i -= 1;
|
|
@@ -50865,7 +51310,7 @@ function createRequestExecutor(deps) {
|
|
|
50865
51310
|
rateLimitReason,
|
|
50866
51311
|
serverRetryMs
|
|
50867
51312
|
);
|
|
50868
|
-
await
|
|
51313
|
+
await routingSleep(effectiveDelayMs, "account_limit");
|
|
50869
51314
|
i -= 1;
|
|
50870
51315
|
continue;
|
|
50871
51316
|
}
|
|
@@ -50915,7 +51360,11 @@ function createRequestExecutor(deps) {
|
|
|
50915
51360
|
`Rate limited. Retrying in ${expBackoffFormatted} (attempt ${backoff.attempt})...`,
|
|
50916
51361
|
"warning"
|
|
50917
51362
|
);
|
|
50918
|
-
await
|
|
51363
|
+
await routingSleep(
|
|
51364
|
+
expBackoffMs,
|
|
51365
|
+
"rate_limited",
|
|
51366
|
+
backoff.attempt
|
|
51367
|
+
);
|
|
50919
51368
|
}
|
|
50920
51369
|
lastFailure = createFailureContext(response);
|
|
50921
51370
|
shouldSwitchAccount = true;
|
|
@@ -51408,15 +51857,19 @@ function createRequestExecutor(deps) {
|
|
|
51408
51857
|
const waitPolicy = {};
|
|
51409
51858
|
const selectedCredentials = /* @__PURE__ */ new Set();
|
|
51410
51859
|
const selectedProjectIds = /* @__PURE__ */ new Set();
|
|
51411
|
-
const pending =
|
|
51412
|
-
|
|
51413
|
-
|
|
51414
|
-
|
|
51415
|
-
|
|
51416
|
-
|
|
51417
|
-
|
|
51418
|
-
|
|
51419
|
-
|
|
51860
|
+
const pending = withRoutingWaitReports(
|
|
51861
|
+
cancellation.signal,
|
|
51862
|
+
(waits) => deadline.wait(
|
|
51863
|
+
() => execute(
|
|
51864
|
+
input2,
|
|
51865
|
+
{ ...init, signal: deadline.signal },
|
|
51866
|
+
requestOptions ?? {},
|
|
51867
|
+
selectedCredentials,
|
|
51868
|
+
selectedProjectIds,
|
|
51869
|
+
deadline,
|
|
51870
|
+
waitPolicy,
|
|
51871
|
+
waits
|
|
51872
|
+
)
|
|
51420
51873
|
)
|
|
51421
51874
|
).catch((error) => {
|
|
51422
51875
|
cancellation.signal.throwIfAborted();
|
|
@@ -53576,7 +54029,7 @@ function createGaReauthorize(input2) {
|
|
|
53576
54029
|
const continuations = /* @__PURE__ */ new Set();
|
|
53577
54030
|
const shutdown = new AbortController();
|
|
53578
54031
|
let disposed = false;
|
|
53579
|
-
const waitForRedirect = (code2) => new Promise((
|
|
54032
|
+
const waitForRedirect = (code2) => new Promise((resolve32, reject) => {
|
|
53580
54033
|
const detach = () => shutdown.signal.removeEventListener("abort", abort);
|
|
53581
54034
|
const abort = () => {
|
|
53582
54035
|
detach();
|
|
@@ -53587,7 +54040,7 @@ function createGaReauthorize(input2) {
|
|
|
53587
54040
|
void code2.then(
|
|
53588
54041
|
(value) => {
|
|
53589
54042
|
detach();
|
|
53590
|
-
|
|
54043
|
+
resolve32(value);
|
|
53591
54044
|
},
|
|
53592
54045
|
(error) => {
|
|
53593
54046
|
detach();
|
|
@@ -53965,7 +54418,7 @@ function gaEngineCollaborators(input2) {
|
|
|
53965
54418
|
const observe = input2.overrides.observeRawSenderSignal;
|
|
53966
54419
|
return {
|
|
53967
54420
|
config: runtime.config.config,
|
|
53968
|
-
sessions: new AgySessionRegistry(
|
|
54421
|
+
sessions: new AgySessionRegistry(),
|
|
53969
54422
|
operatorSettings: runtime.operatorSettings,
|
|
53970
54423
|
modelAccess: () => runtime.settings.modelAccess(),
|
|
53971
54424
|
transport: (url, init, options) => {
|
|
@@ -56776,11 +57229,11 @@ async function startGaLoopbackBridge(options) {
|
|
|
56776
57229
|
}
|
|
56777
57230
|
}
|
|
56778
57231
|
};
|
|
56779
|
-
await new Promise((
|
|
57232
|
+
await new Promise((resolve32, reject) => {
|
|
56780
57233
|
server.once("error", reject);
|
|
56781
57234
|
server.listen(0, BRIDGE_HOST, () => {
|
|
56782
57235
|
server.off("error", reject);
|
|
56783
|
-
|
|
57236
|
+
resolve32();
|
|
56784
57237
|
});
|
|
56785
57238
|
});
|
|
56786
57239
|
server.unref();
|
|
@@ -56791,7 +57244,7 @@ async function startGaLoopbackBridge(options) {
|
|
|
56791
57244
|
origin,
|
|
56792
57245
|
rewrite(original, job, env3) {
|
|
56793
57246
|
if (closing) throw new Error("The Antigravity bridge is disposed");
|
|
56794
|
-
const id =
|
|
57247
|
+
const id = randomUUID21();
|
|
56795
57248
|
const target = `${origin}/agy/${id}`;
|
|
56796
57249
|
assertLoopbackProxyGuard({ env: env3, target });
|
|
56797
57250
|
const timer = setTimeout(() => {
|
|
@@ -56884,8 +57337,8 @@ async function startGaLoopbackBridge(options) {
|
|
|
56884
57337
|
disposal = (async () => {
|
|
56885
57338
|
for (const { timer } of queued.values()) clearTimeout(timer);
|
|
56886
57339
|
queued.clear();
|
|
56887
|
-
const closed2 = new Promise((
|
|
56888
|
-
server.close(() =>
|
|
57340
|
+
const closed2 = new Promise((resolve32) => {
|
|
57341
|
+
server.close(() => resolve32());
|
|
56889
57342
|
});
|
|
56890
57343
|
for (const controller of running) {
|
|
56891
57344
|
controller.abort(
|
|
@@ -56951,9 +57404,9 @@ async function pipeResponse(upstream, response, onFailure, onHandoff) {
|
|
|
56951
57404
|
return;
|
|
56952
57405
|
}
|
|
56953
57406
|
if (!response.write(value) && !response.destroyed) {
|
|
56954
|
-
await new Promise((
|
|
56955
|
-
response.once("drain",
|
|
56956
|
-
response.once("close",
|
|
57407
|
+
await new Promise((resolve32) => {
|
|
57408
|
+
response.once("drain", resolve32);
|
|
57409
|
+
response.once("close", resolve32);
|
|
56957
57410
|
});
|
|
56958
57411
|
}
|
|
56959
57412
|
if (response.destroyed) {
|
|
@@ -57021,7 +57474,7 @@ function isObject3(value) {
|
|
|
57021
57474
|
return typeof value === "object" && value !== null;
|
|
57022
57475
|
}
|
|
57023
57476
|
function createGaGeneration() {
|
|
57024
|
-
return `g-${
|
|
57477
|
+
return `g-${randomUUID21()}`;
|
|
57025
57478
|
}
|
|
57026
57479
|
var GaRpcInputError = class extends Error {
|
|
57027
57480
|
constructor(issues) {
|
|
@@ -57630,14 +58083,14 @@ function createGaAntigravityPlugin(overrides = {}) {
|
|
|
57630
58083
|
|
|
57631
58084
|
// src/plugin/index.ts
|
|
57632
58085
|
init_dist();
|
|
57633
|
-
import { createHash as createHash24, randomUUID as
|
|
57634
|
-
import { join as join47, resolve as
|
|
58086
|
+
import { createHash as createHash24, randomUUID as randomUUID26 } from "node:crypto";
|
|
58087
|
+
import { join as join47, resolve as resolve31 } from "node:path";
|
|
57635
58088
|
|
|
57636
58089
|
// src/cli.ts
|
|
57637
58090
|
init_dist();
|
|
57638
58091
|
import { execFile } from "node:child_process";
|
|
57639
58092
|
import { realpathSync as realpathSync6 } from "node:fs";
|
|
57640
|
-
import { resolve as
|
|
58093
|
+
import { resolve as resolve28 } from "node:path";
|
|
57641
58094
|
import { createInterface } from "node:readline/promises";
|
|
57642
58095
|
import { fileURLToPath as fileURLToPath2 } from "node:url";
|
|
57643
58096
|
import { promisify } from "node:util";
|
|
@@ -57694,7 +58147,7 @@ init_runtime_paths();
|
|
|
57694
58147
|
// src/setup.ts
|
|
57695
58148
|
init_dist();
|
|
57696
58149
|
import { lstat as lstat10, readFile as readFile22 } from "node:fs/promises";
|
|
57697
|
-
import { join as join38, resolve as
|
|
58150
|
+
import { join as join38, resolve as resolve27 } from "node:path";
|
|
57698
58151
|
|
|
57699
58152
|
// src/common-auth-embedded/auth-menu/ansi.js
|
|
57700
58153
|
var ANSI2 = {
|
|
@@ -57862,7 +58315,7 @@ async function select2(terminal, items, options) {
|
|
|
57862
58315
|
writeLine("");
|
|
57863
58316
|
renderedLines = lines;
|
|
57864
58317
|
};
|
|
57865
|
-
return new Promise((
|
|
58318
|
+
return new Promise((resolve32) => {
|
|
57866
58319
|
const wasRaw = stdin.isRaw ?? false;
|
|
57867
58320
|
const cleanup2 = () => {
|
|
57868
58321
|
if (cleaned)
|
|
@@ -57882,7 +58335,7 @@ async function select2(terminal, items, options) {
|
|
|
57882
58335
|
};
|
|
57883
58336
|
const finish = (value) => {
|
|
57884
58337
|
cleanup2();
|
|
57885
|
-
|
|
58338
|
+
resolve32(value);
|
|
57886
58339
|
};
|
|
57887
58340
|
const onSignal = () => finish(null);
|
|
57888
58341
|
const onKey = (data) => {
|
|
@@ -57922,7 +58375,7 @@ async function select2(terminal, items, options) {
|
|
|
57922
58375
|
stdin.setRawMode(true);
|
|
57923
58376
|
} catch {
|
|
57924
58377
|
cleanup2();
|
|
57925
|
-
|
|
58378
|
+
resolve32(null);
|
|
57926
58379
|
return;
|
|
57927
58380
|
}
|
|
57928
58381
|
stdin.resume();
|
|
@@ -57933,15 +58386,15 @@ async function select2(terminal, items, options) {
|
|
|
57933
58386
|
}
|
|
57934
58387
|
|
|
57935
58388
|
// src/common-auth-embedded/claustrum/enrollment.js
|
|
57936
|
-
import { createHash as createHash19, randomBytes as randomBytes6, randomUUID as
|
|
58389
|
+
import { createHash as createHash19, randomBytes as randomBytes6, randomUUID as randomUUID23 } from "node:crypto";
|
|
57937
58390
|
import { constants as fsConstants2 } from "node:fs";
|
|
57938
58391
|
import { chmod as chmod6, mkdir as mkdir18, open as open11, readFile as readFile20, realpath as realpath6, rename as rename13, stat as stat17, unlink as unlink14 } from "node:fs/promises";
|
|
57939
|
-
import { basename as basename13, dirname as dirname28, extname as extname2, isAbsolute as isAbsolute4, join as join34, resolve as
|
|
58392
|
+
import { basename as basename13, dirname as dirname28, extname as extname2, isAbsolute as isAbsolute4, join as join34, resolve as resolve26 } from "node:path";
|
|
57940
58393
|
import { ClaustrumCredentialError as ClaustrumCredentialError9, ClaustrumClient as ClaustrumWireClient2, writeEnrollmentTokenFile as writeEnrollmentTokenFile2 } from "@cortexkit/claustrum-client";
|
|
57941
58394
|
|
|
57942
58395
|
// src/common-auth-embedded/fs/file-read-cache.js
|
|
57943
58396
|
import { lstat as lstat8, stat as stat15 } from "node:fs/promises";
|
|
57944
|
-
import { resolve as
|
|
58397
|
+
import { resolve as resolve24 } from "node:path";
|
|
57945
58398
|
async function identity3(path5, probe) {
|
|
57946
58399
|
try {
|
|
57947
58400
|
const metadata = await probe(path5);
|
|
@@ -57962,7 +58415,7 @@ var FileReadCache2 = class {
|
|
|
57962
58415
|
this.#probe = options.followSymlinks ? (path5) => (options.stat ?? stat15)(path5) : (path5) => (options.lstat ?? lstat8)(path5);
|
|
57963
58416
|
}
|
|
57964
58417
|
async read(paths, read, validateHit) {
|
|
57965
|
-
const resolvedPaths = paths.map((path5) =>
|
|
58418
|
+
const resolvedPaths = paths.map((path5) => resolve24(path5));
|
|
57966
58419
|
const key = JSON.stringify(resolvedPaths);
|
|
57967
58420
|
const probed = await Promise.all(resolvedPaths.map((path5) => identity3(path5, this.#probe)));
|
|
57968
58421
|
const identities = probed.every((entry) => entry !== void 0) ? probed : void 0;
|
|
@@ -58012,13 +58465,13 @@ init_private_files2();
|
|
|
58012
58465
|
|
|
58013
58466
|
// src/common-auth-embedded/fs/refresh-file-lock.js
|
|
58014
58467
|
init_logger3();
|
|
58015
|
-
import { randomUUID as
|
|
58468
|
+
import { randomUUID as randomUUID22 } from "node:crypto";
|
|
58016
58469
|
import { link as link4, lstat as lstat9, mkdir as mkdir17, open as open10, readdir as readdir6, readFile as readFile19, rename as rename12, rm as rm7, stat as stat16, unlink as unlink13 } from "node:fs/promises";
|
|
58017
58470
|
import { basename as basename12, dirname as dirname27, join as join33 } from "node:path";
|
|
58018
58471
|
|
|
58019
58472
|
// src/common-auth-embedded/fs/lock-record.js
|
|
58020
58473
|
init_private_files2();
|
|
58021
|
-
import { resolve as
|
|
58474
|
+
import { resolve as resolve25 } from "node:path";
|
|
58022
58475
|
var DisappearedLockRecordError2 = class extends Error {
|
|
58023
58476
|
path;
|
|
58024
58477
|
code = "ENOENT";
|
|
@@ -58028,10 +58481,10 @@ var DisappearedLockRecordError2 = class extends Error {
|
|
|
58028
58481
|
}
|
|
58029
58482
|
};
|
|
58030
58483
|
function isWindowsAccessDeniedRead2(error, paths) {
|
|
58031
|
-
return error instanceof PrivateFileError2 && error.reason === "io-error" && error.win32Code === 5 && (error.stage === "read" || error.stage === "verify") && paths.some((path5) =>
|
|
58484
|
+
return error instanceof PrivateFileError2 && error.reason === "io-error" && error.win32Code === 5 && (error.stage === "read" || error.stage === "verify") && paths.some((path5) => resolve25(path5) === error.path);
|
|
58032
58485
|
}
|
|
58033
58486
|
function isWindowsAccessDeniedCreate2(error, paths, stage) {
|
|
58034
|
-
return error instanceof PrivateFileError2 && error.reason === "io-error" && error.win32Code === 5 && error.stage === stage && paths.some((path5) =>
|
|
58487
|
+
return error instanceof PrivateFileError2 && error.reason === "io-error" && error.win32Code === 5 && error.stage === stage && paths.some((path5) => resolve25(path5) === error.path);
|
|
58035
58488
|
}
|
|
58036
58489
|
async function readLockRecord2(path5, read) {
|
|
58037
58490
|
try {
|
|
@@ -58069,7 +58522,7 @@ var LockOwnershipError2 = class extends Error {
|
|
|
58069
58522
|
// src/common-auth-embedded/fs/refresh-file-lock.js
|
|
58070
58523
|
var leaseCreationTestHooks2;
|
|
58071
58524
|
async function createExclusiveText2(path5, text2) {
|
|
58072
|
-
const tempPath = `${path5}.${
|
|
58525
|
+
const tempPath = `${path5}.${randomUUID22()}.tmp`;
|
|
58073
58526
|
let handle;
|
|
58074
58527
|
try {
|
|
58075
58528
|
handle = await open10(tempPath, "wx", 384);
|
|
@@ -58227,15 +58680,15 @@ function acquireRefreshFileLock2(options) {
|
|
|
58227
58680
|
async function acquireRefreshFileLockWithClock2(options) {
|
|
58228
58681
|
const lockPath = lockPathFor2(options.path, options.name);
|
|
58229
58682
|
const legacyOwnerPath = join33(lockPath, "owner.json");
|
|
58230
|
-
const ownerId =
|
|
58683
|
+
const ownerId = randomUUID22();
|
|
58231
58684
|
const now = options.now ?? Date.now;
|
|
58232
58685
|
let renewTimer = null;
|
|
58233
58686
|
let released = false;
|
|
58234
58687
|
let releaseConfirmed = false;
|
|
58235
58688
|
let loss;
|
|
58236
58689
|
let resolveLoss;
|
|
58237
|
-
const lostPromise = new Promise((
|
|
58238
|
-
resolveLoss =
|
|
58690
|
+
const lostPromise = new Promise((resolve32) => {
|
|
58691
|
+
resolveLoss = resolve32;
|
|
58239
58692
|
});
|
|
58240
58693
|
function notifyTimerStep(event) {
|
|
58241
58694
|
try {
|
|
@@ -58270,7 +58723,7 @@ async function acquireRefreshFileLockWithClock2(options) {
|
|
|
58270
58723
|
let renewalInFlight = null;
|
|
58271
58724
|
const evictPath = `${lockPath}.evicting`;
|
|
58272
58725
|
const evictOwnerPath = join33(evictPath, "owner.json");
|
|
58273
|
-
const evictOwnerId =
|
|
58726
|
+
const evictOwnerId = randomUUID22();
|
|
58274
58727
|
const EVICT_TTL = 5e3;
|
|
58275
58728
|
const MAX_STEAL_ATTEMPTS = 8;
|
|
58276
58729
|
function isChangingLockCreate(error) {
|
|
@@ -58315,7 +58768,7 @@ async function acquireRefreshFileLockWithClock2(options) {
|
|
|
58315
58768
|
});
|
|
58316
58769
|
return;
|
|
58317
58770
|
}
|
|
58318
|
-
const tempPath = `${lockPath}.${
|
|
58771
|
+
const tempPath = `${lockPath}.${randomUUID22()}.tmp`;
|
|
58319
58772
|
let handle;
|
|
58320
58773
|
let created = false;
|
|
58321
58774
|
try {
|
|
@@ -58399,7 +58852,7 @@ async function acquireRefreshFileLockWithClock2(options) {
|
|
|
58399
58852
|
}
|
|
58400
58853
|
}
|
|
58401
58854
|
async function backoff() {
|
|
58402
|
-
await new Promise((
|
|
58855
|
+
await new Promise((resolve32) => setTimeout(resolve32, Math.floor(Math.random() * 4)));
|
|
58403
58856
|
}
|
|
58404
58857
|
async function readLockState(notifyReady = true) {
|
|
58405
58858
|
if (notifyReady && options.onStep)
|
|
@@ -58492,7 +58945,7 @@ async function acquireRefreshFileLockWithClock2(options) {
|
|
|
58492
58945
|
const remainingMs = deadline - performance.now();
|
|
58493
58946
|
if (remainingMs <= 0)
|
|
58494
58947
|
throw original;
|
|
58495
|
-
await new Promise((
|
|
58948
|
+
await new Promise((resolve32) => setTimeout(resolve32, Math.min(delayMs, remainingMs)));
|
|
58496
58949
|
if (performance.now() >= deadline)
|
|
58497
58950
|
throw original;
|
|
58498
58951
|
delayMs = Math.min(delayMs * 2, 50);
|
|
@@ -58620,7 +59073,7 @@ async function acquireRefreshFileLockWithClock2(options) {
|
|
|
58620
59073
|
}
|
|
58621
59074
|
if (options.onStep)
|
|
58622
59075
|
await options.onStep("stale-marker-stat");
|
|
58623
|
-
const claimedPath = `${evictPath}.${
|
|
59076
|
+
const claimedPath = `${evictPath}.${randomUUID22()}`;
|
|
58624
59077
|
try {
|
|
58625
59078
|
await rename12(evictPath, claimedPath);
|
|
58626
59079
|
} catch (error) {
|
|
@@ -58995,7 +59448,7 @@ async function acquireRefreshFileLockWithClock2(options) {
|
|
|
58995
59448
|
const remainingMs = deadline - performance.now();
|
|
58996
59449
|
if (remainingMs <= 0)
|
|
58997
59450
|
break;
|
|
58998
|
-
await new Promise((
|
|
59451
|
+
await new Promise((resolve32) => setTimeout(resolve32, Math.min(delayMs, remainingMs)));
|
|
58999
59452
|
if (windowsPrivateFiles2 && performance.now() >= deadline)
|
|
59000
59453
|
break;
|
|
59001
59454
|
delayMs = Math.min(delayMs * 2, 50);
|
|
@@ -59084,7 +59537,7 @@ function hostEnrollmentPaths2(input2) {
|
|
|
59084
59537
|
const override = input2.override?.trim();
|
|
59085
59538
|
if (override && !isAbsolute4(override) && !input2.cwd)
|
|
59086
59539
|
throw new ClaustrumConsumerError2("invalid-state", "A relative Claustrum enrollment override needs a base directory");
|
|
59087
|
-
const tokenPath = override ? isAbsolute4(override) ? override :
|
|
59540
|
+
const tokenPath = override ? isAbsolute4(override) ? override : resolve26(input2.cwd, override) : join34(input2.stateDir, `${input2.host}-enrollment.json`);
|
|
59088
59541
|
return getClaustrumEnrollmentPaths2(tokenPath);
|
|
59089
59542
|
}
|
|
59090
59543
|
function isRecord11(value) {
|
|
@@ -59326,7 +59779,7 @@ async function writeStateAtomic2(path5, state, ancestorOptions = {}) {
|
|
|
59326
59779
|
}
|
|
59327
59780
|
if (windowsPrivateFiles2)
|
|
59328
59781
|
return writePrivateAtomic2(path5, bytes);
|
|
59329
|
-
const temporary = join34(parent, `.${basename13(path5)}.${process.pid}.${
|
|
59782
|
+
const temporary = join34(parent, `.${basename13(path5)}.${process.pid}.${randomUUID23()}.tmp`);
|
|
59330
59783
|
let descriptor;
|
|
59331
59784
|
let created = false;
|
|
59332
59785
|
try {
|
|
@@ -59778,7 +60231,7 @@ var ByteTail = class {
|
|
|
59778
60231
|
};
|
|
59779
60232
|
var defaultCommandRunner = {
|
|
59780
60233
|
run(file, args, options = {}) {
|
|
59781
|
-
return new Promise((
|
|
60234
|
+
return new Promise((resolve32) => {
|
|
59782
60235
|
const started = performance.now();
|
|
59783
60236
|
const timeoutMs = options.timeoutMs ?? 15e3;
|
|
59784
60237
|
const stderr = new ByteTail();
|
|
@@ -59796,7 +60249,7 @@ var defaultCommandRunner = {
|
|
|
59796
60249
|
stdio: ["ignore", "pipe", "pipe"]
|
|
59797
60250
|
});
|
|
59798
60251
|
} catch {
|
|
59799
|
-
|
|
60252
|
+
resolve32({
|
|
59800
60253
|
exitCode: 1,
|
|
59801
60254
|
stdout: "",
|
|
59802
60255
|
stderr: "",
|
|
@@ -59831,7 +60284,7 @@ var defaultCommandRunner = {
|
|
|
59831
60284
|
settled = true;
|
|
59832
60285
|
if (timer)
|
|
59833
60286
|
clearTimeout(timer);
|
|
59834
|
-
|
|
60287
|
+
resolve32({
|
|
59835
60288
|
exitCode: spawnError ? 1 : outputExceeded ? 1 : code2 ?? 1,
|
|
59836
60289
|
stdout: Buffer.concat(stdout, stdoutLength).toString("utf8"),
|
|
59837
60290
|
stderr: stderr.toString(),
|
|
@@ -60762,7 +61215,7 @@ import { domainToUnicode } from "node:url";
|
|
|
60762
61215
|
import { applyEdits as applyEdits2, createScanner as createScanner2, findNodeAtLocation as findNodeAtLocation2, modify as modify2, parse as parse2, parseTree as parseTree2 } from "jsonc-parser";
|
|
60763
61216
|
|
|
60764
61217
|
// src/common-auth-embedded/setup/config-write.js
|
|
60765
|
-
import { randomUUID as
|
|
61218
|
+
import { randomUUID as randomUUID24 } from "node:crypto";
|
|
60766
61219
|
import { mkdir as mkdir19, open as open12, rename as rename14, stat as stat19, unlink as unlink15 } from "node:fs/promises";
|
|
60767
61220
|
import { basename as basename14, dirname as dirname29, join as join36 } from "node:path";
|
|
60768
61221
|
import { setTimeout as delay2 } from "node:timers/promises";
|
|
@@ -60779,7 +61232,7 @@ async function writeHostConfigAtomic(file, content, options = {}) {
|
|
|
60779
61232
|
throw error;
|
|
60780
61233
|
}
|
|
60781
61234
|
}
|
|
60782
|
-
const stage = join36(parent, `.${basename14(file)}.${(options.stageName ??
|
|
61235
|
+
const stage = join36(parent, `.${basename14(file)}.${(options.stageName ?? randomUUID24)()}.tmp`);
|
|
60783
61236
|
let created = false;
|
|
60784
61237
|
try {
|
|
60785
61238
|
const handle = await open12(stage, "wx", mode ?? 438);
|
|
@@ -61345,7 +61798,7 @@ async function writeNativeSlot(host, slot, context, expectedAuthority = "local")
|
|
|
61345
61798
|
beforeRename: async () => {
|
|
61346
61799
|
await assertSetupHostsStopped();
|
|
61347
61800
|
const claustrum = await loadCommonAuthClaustrum();
|
|
61348
|
-
const stateDir = host === "opencode" ? openCodeVaultDir(
|
|
61801
|
+
const stateDir = host === "opencode" ? openCodeVaultDir(resolve27(accountFileForVault())) : getPiAntigravityVaultDir();
|
|
61349
61802
|
if (await claustrum.vaultAuthority(
|
|
61350
61803
|
claustrum.hostEnrollmentPaths({ stateDir, host }),
|
|
61351
61804
|
`antigravity-auth-${host}`
|
|
@@ -61390,7 +61843,7 @@ async function createSetupPlugin(deps, migrateOpenCode, forceLogin = false) {
|
|
|
61390
61843
|
// `beforeSignIn`, which may move it after this plugin is built.
|
|
61391
61844
|
paths: {
|
|
61392
61845
|
get stateDir() {
|
|
61393
|
-
return openCodeVaultDir(
|
|
61846
|
+
return openCodeVaultDir(resolve27(accountFileForVault()));
|
|
61394
61847
|
},
|
|
61395
61848
|
host: "opencode"
|
|
61396
61849
|
}
|
|
@@ -61414,7 +61867,7 @@ async function createSetupPlugin(deps, migrateOpenCode, forceLogin = false) {
|
|
|
61414
61867
|
const assertLocal = async (host, context) => {
|
|
61415
61868
|
if (host === "opencode")
|
|
61416
61869
|
return assertLocalOpenCodeLogin(
|
|
61417
|
-
|
|
61870
|
+
resolve27(accountFileForVault()),
|
|
61418
61871
|
context.opencodeGeneration
|
|
61419
61872
|
);
|
|
61420
61873
|
if (await authority(host) !== "local")
|
|
@@ -62074,7 +62527,7 @@ async function runCliProcess(argv, deps) {
|
|
|
62074
62527
|
...deps,
|
|
62075
62528
|
prepareVaultFolder: deps.prepareVaultFolder ?? (async (options) => {
|
|
62076
62529
|
const folder = await prepareVaultFolder({
|
|
62077
|
-
accountFile:
|
|
62530
|
+
accountFile: resolve28(accountFileForVault()),
|
|
62078
62531
|
...options
|
|
62079
62532
|
});
|
|
62080
62533
|
if (folder.refusal) throw folder.refusal;
|
|
@@ -62120,11 +62573,11 @@ function createDefaultCliDependencies() {
|
|
|
62120
62573
|
);
|
|
62121
62574
|
if (host !== "pi")
|
|
62122
62575
|
await assertLocalOpenCodeLogin(
|
|
62123
|
-
|
|
62576
|
+
resolve28(accountFileForVault()),
|
|
62124
62577
|
context?.opencodeGeneration
|
|
62125
62578
|
);
|
|
62126
62579
|
const repository = host === "pi" ? void 0 : await prepareCliLoginStore(
|
|
62127
|
-
|
|
62580
|
+
resolve28(getStoragePath()),
|
|
62128
62581
|
context?.opencodeGeneration
|
|
62129
62582
|
);
|
|
62130
62583
|
try {
|
|
@@ -62140,7 +62593,7 @@ function createDefaultCliDependencies() {
|
|
|
62140
62593
|
}
|
|
62141
62594
|
if (host === "opencode") await assertSetupHostsStopped();
|
|
62142
62595
|
await assertLocalOpenCodeLogin(
|
|
62143
|
-
|
|
62596
|
+
resolve28(accountFileForVault()),
|
|
62144
62597
|
context?.opencodeGeneration
|
|
62145
62598
|
);
|
|
62146
62599
|
await persistCliStoreLogin(
|
|
@@ -62160,7 +62613,7 @@ function createDefaultCliDependencies() {
|
|
|
62160
62613
|
};
|
|
62161
62614
|
}
|
|
62162
62615
|
async function prepareCliLoginStore(legacyPath, generation) {
|
|
62163
|
-
await assertLocalOpenCodeLogin(
|
|
62616
|
+
await assertLocalOpenCodeLogin(resolve28(accountFileForVault()), generation);
|
|
62164
62617
|
const modules = await loadCommonAuthStoreModules();
|
|
62165
62618
|
const options = {
|
|
62166
62619
|
legacyPath,
|
|
@@ -62305,7 +62758,7 @@ async function readAccountStore(legacyPath) {
|
|
|
62305
62758
|
function createDefaultAccountStoreOperations() {
|
|
62306
62759
|
const offline = { processesStopped: true };
|
|
62307
62760
|
return {
|
|
62308
|
-
legacyPath: () =>
|
|
62761
|
+
legacyPath: () => resolve28(
|
|
62309
62762
|
decidedAccountStoreAnchor(runtimeLayoutLocation()) ? getStoragePath() : discoveredAccountFile()
|
|
62310
62763
|
),
|
|
62311
62764
|
migrate: async (legacyPath) => createAccountMigrationFactory(await loadCommonAuthStoreModules())({
|
|
@@ -62336,7 +62789,7 @@ function createDefaultAccountStoreOperations() {
|
|
|
62336
62789
|
};
|
|
62337
62790
|
}
|
|
62338
62791
|
function samePath(left, right) {
|
|
62339
|
-
return process.platform === "win32" ?
|
|
62792
|
+
return process.platform === "win32" ? resolve28(left).toLowerCase() === resolve28(right).toLowerCase() : resolve28(left) === resolve28(right);
|
|
62340
62793
|
}
|
|
62341
62794
|
function isCliEntry() {
|
|
62342
62795
|
if (import.meta.main !== void 0) return import.meta.main;
|
|
@@ -62826,14 +63279,14 @@ function isTuiConnected(sessionId) {
|
|
|
62826
63279
|
// src/rpc/rpc-dir.ts
|
|
62827
63280
|
import { createHash as createHash20 } from "node:crypto";
|
|
62828
63281
|
import { homedir as homedir14, tmpdir as tmpdir6 } from "node:os";
|
|
62829
|
-
import { isAbsolute as isAbsolute5, join as join42, resolve as
|
|
63282
|
+
import { isAbsolute as isAbsolute5, join as join42, resolve as resolve29 } from "node:path";
|
|
62830
63283
|
var RPC_DIR_ENV = "ANTIGRAVITY_AUTH_RPC_DIR";
|
|
62831
63284
|
function getRpcDir(projectDirectory) {
|
|
62832
63285
|
const override = process.env[RPC_DIR_ENV]?.trim();
|
|
62833
63286
|
if (override) {
|
|
62834
|
-
return isAbsolute5(override) ? override :
|
|
63287
|
+
return isAbsolute5(override) ? override : resolve29(projectDirectory, override);
|
|
62835
63288
|
}
|
|
62836
|
-
const projectHash = createHash20("sha256").update(
|
|
63289
|
+
const projectHash = createHash20("sha256").update(resolve29(projectDirectory)).digest("hex").slice(0, 16);
|
|
62837
63290
|
const stateHome = process.env.XDG_STATE_HOME ?? join42(homedir14(), ".local", "state");
|
|
62838
63291
|
return join42(stateHome, "cortexkit", "antigravity-auth", "rpc", projectHash);
|
|
62839
63292
|
}
|
|
@@ -62845,10 +63298,10 @@ function isSessionId(value) {
|
|
|
62845
63298
|
|
|
62846
63299
|
// src/common-auth-embedded/rpc/port-file.js
|
|
62847
63300
|
init_private_files2();
|
|
62848
|
-
import { createHash as createHash21, randomUUID as
|
|
63301
|
+
import { createHash as createHash21, randomUUID as randomUUID25 } from "node:crypto";
|
|
62849
63302
|
import { chmod as chmod7, mkdir as mkdir20, open as open13, readdir as readdir7, rename as rename15, rmdir as rmdir3, stat as stat20, unlink as unlink16 } from "node:fs/promises";
|
|
62850
63303
|
import { uptime as uptime2 } from "node:os";
|
|
62851
|
-
import { join as join43, resolve as
|
|
63304
|
+
import { join as join43, resolve as resolve30 } from "node:path";
|
|
62852
63305
|
function staleBefore(clock2) {
|
|
62853
63306
|
return (clock2.now ?? Date.now)() - (clock2.uptime ?? uptime2)() * 1e3 - 3e5;
|
|
62854
63307
|
}
|
|
@@ -62906,7 +63359,7 @@ async function writePortFile(dir, entry, options = {}) {
|
|
|
62906
63359
|
await ensurePrivateDirectory2(dir, options.secureDir ?? false);
|
|
62907
63360
|
await options.beforeWrite?.();
|
|
62908
63361
|
await writePrivateAtomic2(target, JSON.stringify({ ...entry, startedAt: Date.now() }), {
|
|
62909
|
-
stagePath: `${target}.${(options.stageName ??
|
|
63362
|
+
stagePath: `${target}.${(options.stageName ?? randomUUID25)()}.tmp`
|
|
62910
63363
|
});
|
|
62911
63364
|
return target;
|
|
62912
63365
|
}
|
|
@@ -62918,7 +63371,7 @@ async function writePortFile(dir, entry, options = {}) {
|
|
|
62918
63371
|
await chmod7(dir, 448);
|
|
62919
63372
|
await options.beforeWrite?.();
|
|
62920
63373
|
const full = { ...entry, startedAt: Date.now() };
|
|
62921
|
-
const tmp = `${target}.${(options.stageName ??
|
|
63374
|
+
const tmp = `${target}.${(options.stageName ?? randomUUID25)()}.tmp`;
|
|
62922
63375
|
let handle;
|
|
62923
63376
|
let created = false;
|
|
62924
63377
|
try {
|
|
@@ -62958,7 +63411,7 @@ async function sweepRpcState(root, activeDir, isManagedDir, log18, options = {})
|
|
|
62958
63411
|
return;
|
|
62959
63412
|
throw error;
|
|
62960
63413
|
}
|
|
62961
|
-
const active2 =
|
|
63414
|
+
const active2 = resolve30(activeDir);
|
|
62962
63415
|
for (const projectDir of projectDirs) {
|
|
62963
63416
|
if (!projectDir.isDirectory() || !isManagedDir(projectDir.name)) {
|
|
62964
63417
|
continue;
|
|
@@ -63005,7 +63458,7 @@ async function sweepRpcState(root, activeDir, isManagedDir, log18, options = {})
|
|
|
63005
63458
|
else if (isStalePortFile(entry, info, cutoff))
|
|
63006
63459
|
await removeStalePortFile(portFile, raw, info, options.beforeRemove);
|
|
63007
63460
|
}
|
|
63008
|
-
if (
|
|
63461
|
+
if (resolve30(dir) !== active2)
|
|
63009
63462
|
await rmdir3(dir).catch(() => {
|
|
63010
63463
|
});
|
|
63011
63464
|
}
|
|
@@ -63039,7 +63492,7 @@ var BodyTooLargeError = class extends Error {
|
|
|
63039
63492
|
}
|
|
63040
63493
|
};
|
|
63041
63494
|
function readBody(req) {
|
|
63042
|
-
return new Promise((
|
|
63495
|
+
return new Promise((resolve32, reject) => {
|
|
63043
63496
|
const tooLarge = (declaredOversize = false) => {
|
|
63044
63497
|
req.removeAllListeners("data");
|
|
63045
63498
|
req.on("data", () => {
|
|
@@ -63062,7 +63515,7 @@ function readBody(req) {
|
|
|
63062
63515
|
}
|
|
63063
63516
|
chunks.push(chunk);
|
|
63064
63517
|
});
|
|
63065
|
-
req.on("end", () =>
|
|
63518
|
+
req.on("end", () => resolve32(Buffer.concat(chunks).toString("utf8")));
|
|
63066
63519
|
req.on("error", reject);
|
|
63067
63520
|
});
|
|
63068
63521
|
}
|
|
@@ -63241,12 +63694,12 @@ async function startRpcServer(options) {
|
|
|
63241
63694
|
json(500, { error: "internal error" });
|
|
63242
63695
|
}
|
|
63243
63696
|
}
|
|
63244
|
-
const port = await new Promise((
|
|
63697
|
+
const port = await new Promise((resolve32, reject) => {
|
|
63245
63698
|
server.on("error", reject);
|
|
63246
63699
|
server.listen(0, "127.0.0.1", () => {
|
|
63247
63700
|
const addr = server.address();
|
|
63248
63701
|
if (addr && typeof addr === "object")
|
|
63249
|
-
|
|
63702
|
+
resolve32(addr.port);
|
|
63250
63703
|
else
|
|
63251
63704
|
reject(new Error("no port"));
|
|
63252
63705
|
});
|
|
@@ -63269,16 +63722,16 @@ async function startRpcServer(options) {
|
|
|
63269
63722
|
rpcPort: port
|
|
63270
63723
|
});
|
|
63271
63724
|
} catch (error) {
|
|
63272
|
-
await new Promise((
|
|
63725
|
+
await new Promise((resolve32) => server.close(() => resolve32()));
|
|
63273
63726
|
throw error;
|
|
63274
63727
|
}
|
|
63275
63728
|
return {
|
|
63276
63729
|
port,
|
|
63277
63730
|
token,
|
|
63278
63731
|
async stop() {
|
|
63279
|
-
await new Promise((
|
|
63732
|
+
await new Promise((resolve32) => {
|
|
63280
63733
|
server.closeAllConnections?.();
|
|
63281
|
-
server.close(() =>
|
|
63734
|
+
server.close(() => resolve32());
|
|
63282
63735
|
for (const socket of connections)
|
|
63283
63736
|
socket.destroy();
|
|
63284
63737
|
});
|
|
@@ -63610,6 +64063,18 @@ import { dirname as dirname31, join as join45 } from "node:path";
|
|
|
63610
64063
|
// src/plugin/model-registry.ts
|
|
63611
64064
|
init_dist();
|
|
63612
64065
|
|
|
64066
|
+
// src/plugin/config/models.ts
|
|
64067
|
+
function getOpencode1ModelDefinitions() {
|
|
64068
|
+
const models = { ...OPENCODE_MODEL_DEFINITIONS };
|
|
64069
|
+
const hydrogen = models["antigravity-gemini-4-hydrogen"];
|
|
64070
|
+
if (hydrogen) {
|
|
64071
|
+
const variants = { ...hydrogen.variants };
|
|
64072
|
+
delete variants.xhigh;
|
|
64073
|
+
models[hydrogen.id] = { ...hydrogen, variants };
|
|
64074
|
+
}
|
|
64075
|
+
return models;
|
|
64076
|
+
}
|
|
64077
|
+
|
|
63613
64078
|
// src/plugin/config/updater.ts
|
|
63614
64079
|
var PLUGIN_NAME = "@cortexkit/opencode-antigravity-auth@latest";
|
|
63615
64080
|
var SCHEMA_URL = "https://opencode.ai/config.json";
|
|
@@ -63671,7 +64136,7 @@ async function updateOpencodeConfig(options = {}) {
|
|
|
63671
64136
|
if (!config.provider.google) {
|
|
63672
64137
|
config.provider.google = {};
|
|
63673
64138
|
}
|
|
63674
|
-
config.provider.google.models =
|
|
64139
|
+
config.provider.google.models = getOpencode1ModelDefinitions();
|
|
63675
64140
|
config.provider.google.whitelist = getAntigravityOpencodeModelIds();
|
|
63676
64141
|
const configDir = dirname31(configPath);
|
|
63677
64142
|
if (!existsSync15(configDir)) {
|
|
@@ -63887,7 +64352,7 @@ async function select3(items, options) {
|
|
|
63887
64352
|
}
|
|
63888
64353
|
renderedLines = linesWritten;
|
|
63889
64354
|
};
|
|
63890
|
-
return new Promise((
|
|
64355
|
+
return new Promise((resolve32) => {
|
|
63891
64356
|
const wasRaw = stdin.isRaw ?? false;
|
|
63892
64357
|
const cleanup2 = () => {
|
|
63893
64358
|
if (isCleanedUp) return;
|
|
@@ -63908,11 +64373,11 @@ async function select3(items, options) {
|
|
|
63908
64373
|
};
|
|
63909
64374
|
const onSignal = () => {
|
|
63910
64375
|
cleanup2();
|
|
63911
|
-
|
|
64376
|
+
resolve32(null);
|
|
63912
64377
|
};
|
|
63913
64378
|
const finishWithValue = (value) => {
|
|
63914
64379
|
cleanup2();
|
|
63915
|
-
|
|
64380
|
+
resolve32(value);
|
|
63916
64381
|
};
|
|
63917
64382
|
const findNextSelectable = (from, direction) => {
|
|
63918
64383
|
if (items.length === 0) return from;
|
|
@@ -63958,7 +64423,7 @@ async function select3(items, options) {
|
|
|
63958
64423
|
stdin.setRawMode(true);
|
|
63959
64424
|
} catch {
|
|
63960
64425
|
cleanup2();
|
|
63961
|
-
|
|
64426
|
+
resolve32(null);
|
|
63962
64427
|
return;
|
|
63963
64428
|
}
|
|
63964
64429
|
stdin.resume();
|
|
@@ -66832,9 +67297,10 @@ function applyAntigravityProviderCatalog(config, providerId) {
|
|
|
66832
67297
|
const mutableConfig = config;
|
|
66833
67298
|
mutableConfig.provider ??= {};
|
|
66834
67299
|
const providerConfig = mutableConfig.provider[providerId] ?? {};
|
|
67300
|
+
const models = getOpencode1ModelDefinitions();
|
|
66835
67301
|
providerConfig.models = {
|
|
66836
67302
|
...providerConfig.models ?? {},
|
|
66837
|
-
...
|
|
67303
|
+
...models
|
|
66838
67304
|
};
|
|
66839
67305
|
providerConfig.whitelist = getAntigravityOpencodeModelIds();
|
|
66840
67306
|
mutableConfig.provider[providerId] = providerConfig;
|
|
@@ -66971,10 +67437,10 @@ function resolvePluginDependencies(overrides = {}) {
|
|
|
66971
67437
|
}
|
|
66972
67438
|
async function defaultSleep(ms, signal) {
|
|
66973
67439
|
if (ms <= 0) return;
|
|
66974
|
-
await new Promise((
|
|
67440
|
+
await new Promise((resolve32, reject) => {
|
|
66975
67441
|
const timer = setTimeout(() => {
|
|
66976
67442
|
signal?.removeEventListener("abort", onAbort);
|
|
66977
|
-
|
|
67443
|
+
resolve32();
|
|
66978
67444
|
}, ms);
|
|
66979
67445
|
timer.unref?.();
|
|
66980
67446
|
const onAbort = () => {
|
|
@@ -67325,18 +67791,8 @@ tool.schema = z5;
|
|
|
67325
67791
|
init_logger4();
|
|
67326
67792
|
|
|
67327
67793
|
// src/plugin/search.ts
|
|
67328
|
-
import crypto3 from "node:crypto";
|
|
67329
67794
|
init_logger4();
|
|
67330
67795
|
var log16 = createLogger4("search");
|
|
67331
|
-
var sessionCounter = 0;
|
|
67332
|
-
var sessionPrefix = `search-${Date.now().toString(36)}`;
|
|
67333
|
-
function generateRequestId() {
|
|
67334
|
-
return `agent/${crypto3.randomUUID()}/${Date.now()}/${crypto3.randomUUID()}/2`;
|
|
67335
|
-
}
|
|
67336
|
-
function getSessionId() {
|
|
67337
|
-
sessionCounter++;
|
|
67338
|
-
return `${sessionPrefix}-${sessionCounter}`;
|
|
67339
|
-
}
|
|
67340
67796
|
function formatSearchResult(result) {
|
|
67341
67797
|
const lines = [];
|
|
67342
67798
|
lines.push("## Search Results\n");
|
|
@@ -67447,13 +67903,18 @@ ${urlList}`;
|
|
|
67447
67903
|
topP: 1
|
|
67448
67904
|
}
|
|
67449
67905
|
};
|
|
67906
|
+
const metadata = buildAgyAgentRequestMetadata(
|
|
67907
|
+
createAgyRequestSessionContext(),
|
|
67908
|
+
requestPayload,
|
|
67909
|
+
SEARCH_MODEL
|
|
67910
|
+
);
|
|
67911
|
+
requestPayload.labels = metadata.labels;
|
|
67912
|
+
requestPayload.sessionId = metadata.sessionId;
|
|
67913
|
+
orderAgyRequestPayloadInPlace(requestPayload);
|
|
67450
67914
|
const wrappedBody = {
|
|
67451
67915
|
project: projectId,
|
|
67452
|
-
requestId:
|
|
67453
|
-
request:
|
|
67454
|
-
...requestPayload,
|
|
67455
|
-
sessionId: getSessionId()
|
|
67456
|
-
},
|
|
67916
|
+
requestId: metadata.requestId,
|
|
67917
|
+
request: requestPayload,
|
|
67457
67918
|
model: SEARCH_MODEL,
|
|
67458
67919
|
userAgent: "antigravity",
|
|
67459
67920
|
requestType: "agent"
|
|
@@ -67697,8 +68158,8 @@ function createPluginLifecycle(options) {
|
|
|
67697
68158
|
};
|
|
67698
68159
|
let failDisposal = () => {
|
|
67699
68160
|
};
|
|
67700
|
-
disposal = new Promise((
|
|
67701
|
-
finishDisposal =
|
|
68161
|
+
disposal = new Promise((resolve32, reject) => {
|
|
68162
|
+
finishDisposal = resolve32;
|
|
67702
68163
|
failDisposal = reject;
|
|
67703
68164
|
});
|
|
67704
68165
|
void (async () => {
|
|
@@ -67849,7 +68310,7 @@ var createAntigravityPlugin = (providerId, options = {}) => async (input2) => {
|
|
|
67849
68310
|
if (config.keep_thinking) {
|
|
67850
68311
|
initDiskSignatureCache(config.signature_cache);
|
|
67851
68312
|
}
|
|
67852
|
-
const sessionRegistry = new AgySessionRegistry(
|
|
68313
|
+
const sessionRegistry = new AgySessionRegistry();
|
|
67853
68314
|
let cachedGetAuth = null;
|
|
67854
68315
|
let stopSidebarPublisher;
|
|
67855
68316
|
const lifecycle = createPluginLifecycle({
|
|
@@ -67866,7 +68327,7 @@ var createAntigravityPlugin = (providerId, options = {}) => async (input2) => {
|
|
|
67866
68327
|
await drainSidebarWrites();
|
|
67867
68328
|
}
|
|
67868
68329
|
});
|
|
67869
|
-
const accountFile =
|
|
68330
|
+
const accountFile = resolve31(accountFileForVault());
|
|
67870
68331
|
const vaultFolder = await prepareVaultFolder({ accountFile });
|
|
67871
68332
|
const unavailableMessage = vaultFolder.refusal?.message ?? VAULT_ACCOUNT_REMEDY;
|
|
67872
68333
|
let vaultQuotaPoller;
|
|
@@ -68211,7 +68672,7 @@ var createAntigravityPlugin = (providerId, options = {}) => async (input2) => {
|
|
|
68211
68672
|
const key = vaultAccountRowKey(row);
|
|
68212
68673
|
const existing = vaultSelectors2.get(key);
|
|
68213
68674
|
if (existing) return existing;
|
|
68214
|
-
const selector =
|
|
68675
|
+
const selector = randomUUID26();
|
|
68215
68676
|
vaultSelectors2.set(key, selector);
|
|
68216
68677
|
return selector;
|
|
68217
68678
|
},
|