@cortexkit/opencode-antigravity-auth 3.1.9 → 3.1.10
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 +4 -0
- package/dist/cli.js +145 -102
- package/dist/cli.js.map +3 -3
- package/dist/cli.meta.json +19 -14
- package/dist/index.js +320 -230
- package/dist/index.js.map +3 -3
- package/dist/index.meta.json +22 -17
- package/dist/server.js +306 -216
- package/dist/server.js.map +3 -3
- package/dist/server.meta.json +1 -1
- package/dist/src/common-auth-embedded/claustrum/custody.d.ts +16 -5
- package/dist/src/common-auth-embedded/claustrum/custody.js +31 -14
- package/dist/src/common-auth-embedded/routing-accessor/index.d.ts +6 -1
- package/dist/src/common-auth-embedded/setup/process-fence.js +20 -3
- package/dist/src/common-auth-embedded/source-output.json +20 -20
- 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.js +2 -2
- package/dist/src/plugin/config/models.d.ts +1 -1
- package/dist/src/plugin/config/models.d.ts.map +1 -1
- package/dist/src/plugin/config/models.js +10 -5
- package/dist/src/plugin/config/models.js.map +1 -1
- package/dist/src/plugin/request.js +7 -7
- package/dist/src/plugin/request.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 +16 -5
- package/dist/types/src/common-auth-embedded/routing-accessor/index.d.ts +6 -1
- package/dist/types/src/plugin/config/models.d.ts +1 -1
- package/dist/types/src/plugin/config/models.d.ts.map +1 -1
- package/package.json +2 -2
- package/src/common-auth-embedded/claustrum/custody.d.ts +16 -5
- package/src/common-auth-embedded/claustrum/custody.js +31 -14
- package/src/common-auth-embedded/routing-accessor/index.d.ts +6 -1
- package/src/common-auth-embedded/setup/process-fence.js +20 -3
- package/src/common-auth-embedded/source-output.json +20 -20
package/dist/index.js
CHANGED
|
@@ -4129,6 +4129,8 @@ function getGemini38FlashAntigravityModel(tier) {
|
|
|
4129
4129
|
}
|
|
4130
4130
|
function getQuotaGroupForModel(modelId, hasArgonPool = false) {
|
|
4131
4131
|
const normalized = modelId.toLowerCase();
|
|
4132
|
+
if (isGeminiNeonModel(normalized))
|
|
4133
|
+
return "gemini";
|
|
4132
4134
|
if (isGeminiHydrogenModel(normalized))
|
|
4133
4135
|
return "gemini";
|
|
4134
4136
|
if (isGeminiCarbonModel(normalized))
|
|
@@ -4162,6 +4164,23 @@ function getGeminiHydrogenAntigravityModel(tier) {
|
|
|
4162
4164
|
}
|
|
4163
4165
|
}, tier);
|
|
4164
4166
|
}
|
|
4167
|
+
function isGeminiNeonModel(model) {
|
|
4168
|
+
return /^(?:antigravity-)?gemini-4-neon(?:-(?:low|medium|high|xhigh))?$/i.test(model);
|
|
4169
|
+
}
|
|
4170
|
+
function supportsGeminiXHigh(model) {
|
|
4171
|
+
return isGeminiHydrogenModel(model) || isGeminiNeonModel(model);
|
|
4172
|
+
}
|
|
4173
|
+
function getGeminiNeonAntigravityModel(tier) {
|
|
4174
|
+
return getTieredAntigravityModel({
|
|
4175
|
+
defaultModel: "gemini-4-neon-high",
|
|
4176
|
+
byTier: {
|
|
4177
|
+
low: "gemini-4-neon-low",
|
|
4178
|
+
medium: "gemini-4-neon-medium",
|
|
4179
|
+
high: "gemini-4-neon-high",
|
|
4180
|
+
xhigh: "gemini-4-neon-xhigh"
|
|
4181
|
+
}
|
|
4182
|
+
}, tier);
|
|
4183
|
+
}
|
|
4165
4184
|
function getGeminiCarbonAntigravityModel(tier) {
|
|
4166
4185
|
return getTieredAntigravityModel({
|
|
4167
4186
|
defaultModel: "gemini-4-carbon-medium",
|
|
@@ -4194,6 +4213,35 @@ var init_model_registry = __esm({
|
|
|
4194
4213
|
DEFAULT_COST = { input: 0, output: 0 };
|
|
4195
4214
|
DEFAULT_OPTIONS = {};
|
|
4196
4215
|
AGY_NATIVE_MODEL_DEFINITIONS = {
|
|
4216
|
+
// Native CLI 1.5.9 catalog: all four Neon routes share the same limits.
|
|
4217
|
+
"gemini-4-neon-low": {
|
|
4218
|
+
displayName: "Gemini 4 Neon (Low)",
|
|
4219
|
+
maxTokens: 1048576,
|
|
4220
|
+
maxOutputTokens: 262144,
|
|
4221
|
+
model: "MODEL_PLACEHOLDER_M534",
|
|
4222
|
+
supportsThinking: true
|
|
4223
|
+
},
|
|
4224
|
+
"gemini-4-neon-medium": {
|
|
4225
|
+
displayName: "Gemini 4 Neon (Medium)",
|
|
4226
|
+
maxTokens: 1048576,
|
|
4227
|
+
maxOutputTokens: 262144,
|
|
4228
|
+
model: "MODEL_PLACEHOLDER_M533",
|
|
4229
|
+
supportsThinking: true
|
|
4230
|
+
},
|
|
4231
|
+
"gemini-4-neon-high": {
|
|
4232
|
+
displayName: "Gemini 4 Neon (High)",
|
|
4233
|
+
maxTokens: 1048576,
|
|
4234
|
+
maxOutputTokens: 262144,
|
|
4235
|
+
model: "MODEL_PLACEHOLDER_M532",
|
|
4236
|
+
supportsThinking: true
|
|
4237
|
+
},
|
|
4238
|
+
"gemini-4-neon-xhigh": {
|
|
4239
|
+
displayName: "Gemini 4 Neon (XHigh)",
|
|
4240
|
+
maxTokens: 1048576,
|
|
4241
|
+
maxOutputTokens: 262144,
|
|
4242
|
+
model: "MODEL_PLACEHOLDER_M535",
|
|
4243
|
+
supportsThinking: true
|
|
4244
|
+
},
|
|
4197
4245
|
// Context: Google's "Introducing Gemini 4 Hydrogen" announcement (12 Nov 2026).
|
|
4198
4246
|
// Output caps and route enums: native CLI 1.5.5 capture (13 Nov 2026).
|
|
4199
4247
|
"gemini-4-hydrogen-low": {
|
|
@@ -4378,6 +4426,18 @@ var init_model_registry = __esm({
|
|
|
4378
4426
|
};
|
|
4379
4427
|
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.";
|
|
4380
4428
|
ALL_MODEL_DEFINITIONS = {
|
|
4429
|
+
"antigravity-gemini-4-neon": defineModel("antigravity-gemini-4-neon", {
|
|
4430
|
+
name: "Gemini 4 Neon (Antigravity)",
|
|
4431
|
+
reasoning: true,
|
|
4432
|
+
limit: { context: 1048576, output: 262144 },
|
|
4433
|
+
modalities: DEFAULT_MODALITIES,
|
|
4434
|
+
variants: {
|
|
4435
|
+
low: { thinkingLevel: "low" },
|
|
4436
|
+
medium: { thinkingLevel: "medium" },
|
|
4437
|
+
high: { thinkingLevel: "high" },
|
|
4438
|
+
xhigh: { thinkingLevel: "xhigh" }
|
|
4439
|
+
}
|
|
4440
|
+
}),
|
|
4381
4441
|
"antigravity-gemini-4-hydrogen": defineModel("antigravity-gemini-4-hydrogen", {
|
|
4382
4442
|
name: "Gemini 4 Hydrogen (Antigravity)",
|
|
4383
4443
|
reasoning: true,
|
|
@@ -4559,6 +4619,7 @@ var init_model_registry = __esm({
|
|
|
4559
4619
|
"antigravity-gemini-4-argon",
|
|
4560
4620
|
"antigravity-gemini-4-carbon",
|
|
4561
4621
|
"antigravity-gemini-4-hydrogen",
|
|
4622
|
+
"antigravity-gemini-4-neon",
|
|
4562
4623
|
"antigravity-gemini-3.8-flash",
|
|
4563
4624
|
"antigravity-gemini-3.1-flash-image",
|
|
4564
4625
|
"antigravity-claude-sonnet-5-5",
|
|
@@ -8575,7 +8636,7 @@ function writeConsoleLog(level, ...args) {
|
|
|
8575
8636
|
}
|
|
8576
8637
|
function createLogger(module) {
|
|
8577
8638
|
const service = `antigravity.${module}`;
|
|
8578
|
-
const
|
|
8639
|
+
const log19 = (level, message, extra) => {
|
|
8579
8640
|
if (_sink) {
|
|
8580
8641
|
try {
|
|
8581
8642
|
_sink({ service, level, message, extra });
|
|
@@ -8589,10 +8650,10 @@ function createLogger(module) {
|
|
|
8589
8650
|
}
|
|
8590
8651
|
};
|
|
8591
8652
|
return {
|
|
8592
|
-
debug: (message, extra) =>
|
|
8593
|
-
info: (message, extra) =>
|
|
8594
|
-
warn: (message, extra) =>
|
|
8595
|
-
error: (message, extra) =>
|
|
8653
|
+
debug: (message, extra) => log19("debug", message, extra),
|
|
8654
|
+
info: (message, extra) => log19("info", message, extra),
|
|
8655
|
+
warn: (message, extra) => log19("warn", message, extra),
|
|
8656
|
+
error: (message, extra) => log19("error", message, extra)
|
|
8596
8657
|
};
|
|
8597
8658
|
}
|
|
8598
8659
|
var ENV_CONSOLE_LOG, _sink;
|
|
@@ -23077,22 +23138,22 @@ function credentialTypeOf(row, family) {
|
|
|
23077
23138
|
return notMine;
|
|
23078
23139
|
if ("classify" in family) {
|
|
23079
23140
|
const metadata = rowFactsOf(row);
|
|
23080
|
-
let
|
|
23141
|
+
let type2;
|
|
23081
23142
|
switch (metadata.authMethod) {
|
|
23082
23143
|
case "apikey":
|
|
23083
|
-
|
|
23144
|
+
type2 = "api_key";
|
|
23084
23145
|
break;
|
|
23085
23146
|
case "chatgpt":
|
|
23086
23147
|
case "antigravity":
|
|
23087
23148
|
case "oauth":
|
|
23088
|
-
|
|
23149
|
+
type2 = "oauth";
|
|
23089
23150
|
break;
|
|
23090
23151
|
default:
|
|
23091
23152
|
return { kind: "refused", code: "unknown-auth-method" };
|
|
23092
23153
|
}
|
|
23093
23154
|
const facts = {
|
|
23094
23155
|
credentialId: row.id,
|
|
23095
|
-
credentialType:
|
|
23156
|
+
credentialType: type2,
|
|
23096
23157
|
categories: row.categories,
|
|
23097
23158
|
refreshAdapter: row.refreshAdapter,
|
|
23098
23159
|
...metadata
|
|
@@ -23104,24 +23165,37 @@ function credentialTypeOf(row, family) {
|
|
|
23104
23165
|
if (result.kind === "not-mine")
|
|
23105
23166
|
return notMine;
|
|
23106
23167
|
if (result.kind === "mine" && typeof result.member === "string")
|
|
23107
|
-
return { kind: "mine", type, member: result.member };
|
|
23168
|
+
return { kind: "mine", type: type2, member: result.member };
|
|
23108
23169
|
if (result.kind === "refused" && typeof result.code === "string" && /^[a-z][a-z0-9-]{0,31}$/.test(result.code) && !result.code.includes("\n") && family.refusalCodes.includes(result.code))
|
|
23109
23170
|
return { kind: "refused", code: result.code };
|
|
23110
23171
|
} catch {
|
|
23111
23172
|
}
|
|
23112
23173
|
return { kind: "refused", code: "unclassified" };
|
|
23113
23174
|
}
|
|
23114
|
-
|
|
23175
|
+
const type = row.credentialType;
|
|
23176
|
+
if (type === "oauth") {
|
|
23177
|
+
if (row.refreshAdapter !== family.refreshAdapter)
|
|
23178
|
+
return notMine;
|
|
23179
|
+
} else if (type === "api_key") {
|
|
23180
|
+
if (!family.apiKeys || row.refreshAdapter !== void 0)
|
|
23181
|
+
return notMine;
|
|
23182
|
+
} else {
|
|
23115
23183
|
return notMine;
|
|
23116
|
-
|
|
23117
|
-
|
|
23118
|
-
if (
|
|
23119
|
-
|
|
23120
|
-
|
|
23184
|
+
}
|
|
23185
|
+
const { authMethod } = rowFactsOf(row, { includeProviderIds: false });
|
|
23186
|
+
if (authMethod !== void 0) {
|
|
23187
|
+
const matchesType = type === "oauth" ? authMethod === "chatgpt" || authMethod === "antigravity" || authMethod === "oauth" : authMethod === "apikey";
|
|
23188
|
+
if (!matchesType)
|
|
23189
|
+
return { kind: "refused", code: "unknown-auth-method" };
|
|
23190
|
+
}
|
|
23191
|
+
return { kind: "mine", type };
|
|
23121
23192
|
}
|
|
23122
|
-
function rowFactsOf(row) {
|
|
23193
|
+
function rowFactsOf(row, { includeProviderIds = true } = {}) {
|
|
23123
23194
|
const metadata = row;
|
|
23124
|
-
return {
|
|
23195
|
+
return {
|
|
23196
|
+
providerIds: includeProviderIds ? metadata.providerIds : void 0,
|
|
23197
|
+
authMethod: metadata.authMethod
|
|
23198
|
+
};
|
|
23125
23199
|
}
|
|
23126
23200
|
function grantReachOf(listed) {
|
|
23127
23201
|
const { grants, grantTuples } = listed;
|
|
@@ -23453,14 +23527,15 @@ var init_custody = __esm({
|
|
|
23453
23527
|
for (const record5 of skipped)
|
|
23454
23528
|
this.#logger.warn("skipped malformed vault record", record5);
|
|
23455
23529
|
const grantReach = grantReachOf(inventory);
|
|
23530
|
+
const classifying = "classify" in this.#family;
|
|
23456
23531
|
return {
|
|
23457
23532
|
view: inventory.view,
|
|
23458
23533
|
credentials: Object.freeze(credentials),
|
|
23459
23534
|
skipped: Object.freeze(skipped),
|
|
23460
|
-
...
|
|
23461
|
-
refused: Object.freeze(refused2)
|
|
23462
|
-
notMine
|
|
23535
|
+
...(classifying || refused2.length > 0) && {
|
|
23536
|
+
refused: Object.freeze(refused2)
|
|
23463
23537
|
},
|
|
23538
|
+
...classifying && { notMine },
|
|
23464
23539
|
...grantReach && { grantReach }
|
|
23465
23540
|
};
|
|
23466
23541
|
}
|
|
@@ -27930,11 +28005,11 @@ function diagnostics(chain, error) {
|
|
|
27930
28005
|
}) : [String(error)];
|
|
27931
28006
|
return redactCredentialText([...new Set(messages)].join("; caused by "));
|
|
27932
28007
|
}
|
|
27933
|
-
function hostFailure(error,
|
|
28008
|
+
function hostFailure(error, log19) {
|
|
27934
28009
|
if (error instanceof HostRefusalError || error instanceof AccountStoreBusyError || error instanceof PreResponseTimeoutError || isUpstreamFailure(error) || error instanceof Error && error.name === "ClaustrumUnreachableError" && error.message === "Claustrum vault could not be reached")
|
|
27935
28010
|
return error;
|
|
27936
28011
|
const chain = errorChain(error);
|
|
27937
|
-
|
|
28012
|
+
log19(diagnostics(chain, error));
|
|
27938
28013
|
if (error instanceof Error && error.name === "ClaustrumCredentialError" && "code" in error && error.code === "grant_denied") {
|
|
27939
28014
|
return Object.assign(new HostRefusalError("The vault refused access to the selected account. Check the plugin log for details."), { code: "grant_denied" });
|
|
27940
28015
|
}
|
|
@@ -28832,7 +28907,7 @@ function applyAgyNativeGenerationConfig(wireModel, generationConfig, options = {
|
|
|
28832
28907
|
includeThoughts: true,
|
|
28833
28908
|
...typeof budget === "number" ? { thinkingBudget: budget } : { thinkingLevel: capturedTier.toUpperCase() }
|
|
28834
28909
|
};
|
|
28835
|
-
} else if (
|
|
28910
|
+
} else if (supportsGeminiXHigh(wireModel)) {
|
|
28836
28911
|
const tier = wireModel.toLowerCase().split("-").at(-1);
|
|
28837
28912
|
generationConfig.thinkingConfig = {
|
|
28838
28913
|
includeThoughts: true,
|
|
@@ -29709,10 +29784,10 @@ function getAgyGemini31ProThinkingBudget(tier) {
|
|
|
29709
29784
|
function resolveModelWithTier(requestedModel) {
|
|
29710
29785
|
const isAntigravity = QUOTA_PREFIX_REGEX.test(requestedModel);
|
|
29711
29786
|
const modelWithoutQuota = requestedModel.replace(QUOTA_PREFIX_REGEX, "");
|
|
29712
|
-
if (
|
|
29713
|
-
const tier2 = modelWithoutQuota.toLowerCase().match(
|
|
29787
|
+
if (supportsGeminiXHigh(modelWithoutQuota)) {
|
|
29788
|
+
const tier2 = modelWithoutQuota.toLowerCase().match(XHIGH_TIER_REGEX)?.[1];
|
|
29714
29789
|
return {
|
|
29715
|
-
actualModel: getGeminiHydrogenAntigravityModel(tier2),
|
|
29790
|
+
actualModel: isGeminiNeonModel(modelWithoutQuota) ? getGeminiNeonAntigravityModel(tier2) : getGeminiHydrogenAntigravityModel(tier2),
|
|
29716
29791
|
thinkingLevel: tier2 ?? "high",
|
|
29717
29792
|
tier: tier2 ?? "high",
|
|
29718
29793
|
isThinkingModel: true
|
|
@@ -29890,7 +29965,7 @@ function resolveAntigravityModel(requestedModel) {
|
|
|
29890
29965
|
const prefixedModel = `antigravity-${transformedModel}`;
|
|
29891
29966
|
return resolveModelWithTier(prefixedModel);
|
|
29892
29967
|
}
|
|
29893
|
-
var THINKING_TIER_BUDGETS, MODEL_ALIASES, TIER_REGEX,
|
|
29968
|
+
var THINKING_TIER_BUDGETS, MODEL_ALIASES, TIER_REGEX, XHIGH_TIER_REGEX, QUOTA_PREFIX_REGEX, GEMINI_3_PRO_REGEX, GEMINI_3_FLASH_REGEX, IMAGE_GENERATION_MODELS;
|
|
29894
29969
|
var init_model_resolver = __esm({
|
|
29895
29970
|
"../core/dist/transform/model-resolver.js"() {
|
|
29896
29971
|
"use strict";
|
|
@@ -29903,7 +29978,7 @@ var init_model_resolver = __esm({
|
|
|
29903
29978
|
};
|
|
29904
29979
|
MODEL_ALIASES = getResolverAliasMap();
|
|
29905
29980
|
TIER_REGEX = /-(minimal|low|medium|high)$/;
|
|
29906
|
-
|
|
29981
|
+
XHIGH_TIER_REGEX = /-(low|medium|high|xhigh)$/i;
|
|
29907
29982
|
QUOTA_PREFIX_REGEX = /^antigravity-/i;
|
|
29908
29983
|
GEMINI_3_PRO_REGEX = /^gemini-3(?:\.\d+)?-pro/i;
|
|
29909
29984
|
GEMINI_3_FLASH_REGEX = /^gemini-3(?:\.\d+)?-flash/i;
|
|
@@ -30760,7 +30835,7 @@ function getAntigravityVersionResolution() {
|
|
|
30760
30835
|
return lastResolution ?? { version: getAntigravityVersion(), source: "fallback" };
|
|
30761
30836
|
}
|
|
30762
30837
|
async function initAntigravityVersion() {
|
|
30763
|
-
const
|
|
30838
|
+
const log19 = createLogger("version");
|
|
30764
30839
|
const fallback = getAntigravityVersion();
|
|
30765
30840
|
let version;
|
|
30766
30841
|
let source;
|
|
@@ -30774,15 +30849,15 @@ async function initAntigravityVersion() {
|
|
|
30774
30849
|
} else {
|
|
30775
30850
|
source = "fallback";
|
|
30776
30851
|
setAntigravityVersion(fallback);
|
|
30777
|
-
|
|
30852
|
+
log19.info("version-fetch-failed", { fallback });
|
|
30778
30853
|
lastResolution = { version: fallback, source };
|
|
30779
30854
|
return lastResolution;
|
|
30780
30855
|
}
|
|
30781
30856
|
}
|
|
30782
30857
|
if (version !== fallback) {
|
|
30783
|
-
|
|
30858
|
+
log19.info("version-updated", { version, source, previous: fallback });
|
|
30784
30859
|
} else {
|
|
30785
|
-
|
|
30860
|
+
log19.debug("version-unchanged", { version, source });
|
|
30786
30861
|
}
|
|
30787
30862
|
setAntigravityVersion(version);
|
|
30788
30863
|
lastResolution = { version, source };
|
|
@@ -33319,19 +33394,19 @@ function initLogger3(client) {
|
|
|
33319
33394
|
}
|
|
33320
33395
|
function createLogger4(module) {
|
|
33321
33396
|
let channel3;
|
|
33322
|
-
const
|
|
33397
|
+
const log19 = (level, message, extra) => {
|
|
33323
33398
|
channel3 ??= getLegacyLogger().createLogger(module);
|
|
33324
33399
|
channel3[level](message, extra);
|
|
33325
33400
|
};
|
|
33326
33401
|
return {
|
|
33327
|
-
debug: (message, extra) =>
|
|
33328
|
-
info: (message, extra) =>
|
|
33402
|
+
debug: (message, extra) => log19("debug", message, extra),
|
|
33403
|
+
info: (message, extra) => log19("info", message, extra),
|
|
33329
33404
|
hostInfo: (message, extra) => {
|
|
33330
33405
|
channel3 ??= getLegacyLogger().createLogger(module);
|
|
33331
33406
|
channel3.hostInfo?.(message, extra);
|
|
33332
33407
|
},
|
|
33333
|
-
warn: (message, extra) =>
|
|
33334
|
-
error: (message, extra) =>
|
|
33408
|
+
warn: (message, extra) => log19("warn", message, extra),
|
|
33409
|
+
error: (message, extra) => log19("error", message, extra)
|
|
33335
33410
|
};
|
|
33336
33411
|
}
|
|
33337
33412
|
var ENV_CONSOLE_LOG2, LOG_LEVEL_FROM_OPERATOR, legacyClient, legacyLogger;
|
|
@@ -34787,7 +34862,7 @@ async function prepareVaultFolder(options) {
|
|
|
34787
34862
|
const kept = refusals.get(key2);
|
|
34788
34863
|
if (kept)
|
|
34789
34864
|
return override ? { ...override, refusal: kept } : refused(accountFile, kept);
|
|
34790
|
-
const
|
|
34865
|
+
const log19 = options.log ?? createLogger4("runtime-layout");
|
|
34791
34866
|
const version = options.version ?? await pluginPackageVersion().catch(() => "unknown");
|
|
34792
34867
|
try {
|
|
34793
34868
|
if (override) {
|
|
@@ -34796,11 +34871,11 @@ async function prepareVaultFolder(options) {
|
|
|
34796
34871
|
await prepareRuntimeLayout({
|
|
34797
34872
|
version,
|
|
34798
34873
|
accountFile,
|
|
34799
|
-
log:
|
|
34874
|
+
log: log19,
|
|
34800
34875
|
...options.layoutLockWaitMs === void 0 ? {} : { layoutLockWaitMs: options.layoutLockWaitMs }
|
|
34801
34876
|
});
|
|
34802
34877
|
if (options.accountStore !== false)
|
|
34803
|
-
await prepareAccountStore({ version, log:
|
|
34878
|
+
await prepareAccountStore({ version, log: log19 });
|
|
34804
34879
|
} catch (error) {
|
|
34805
34880
|
const refusal3 = error instanceof RuntimeLayoutRefusal ? error : new RuntimeLayoutRefusal(
|
|
34806
34881
|
override?.vaultDir ?? runtimeLayoutLocation().stateHomeDir,
|
|
@@ -34808,7 +34883,7 @@ async function prepareVaultFolder(options) {
|
|
|
34808
34883
|
);
|
|
34809
34884
|
if (!refusals.has(key2)) {
|
|
34810
34885
|
refusals.set(key2, refusal3);
|
|
34811
|
-
|
|
34886
|
+
log19.warn(refusal3.message, {
|
|
34812
34887
|
stateDir: refusal3.stateDir,
|
|
34813
34888
|
errorClass: refusal3.errorClass
|
|
34814
34889
|
});
|
|
@@ -34929,10 +35004,10 @@ function errorFile(error) {
|
|
|
34929
35004
|
...typeof stage === "string" && stage ? { stage } : {}
|
|
34930
35005
|
};
|
|
34931
35006
|
}
|
|
34932
|
-
function logCleanupFailure(location,
|
|
35007
|
+
function logCleanupFailure(location, log19, step, error) {
|
|
34933
35008
|
logOnce(
|
|
34934
35009
|
`${location.key}\0cleanup`,
|
|
34935
|
-
() =>
|
|
35010
|
+
() => log19.warn(
|
|
34936
35011
|
"antigravity-auth could not finish removing its old vault files from OpenCode's config folder; it tries again at the next start",
|
|
34937
35012
|
{
|
|
34938
35013
|
configDir: location.configDir,
|
|
@@ -34961,13 +35036,13 @@ function prepareRuntimeLayout(options) {
|
|
|
34961
35036
|
return run;
|
|
34962
35037
|
}
|
|
34963
35038
|
async function decide(location, options) {
|
|
34964
|
-
const
|
|
35039
|
+
const log19 = options.log ?? createLogger4("runtime-layout");
|
|
34965
35040
|
const stateDir = location.stateHomeDir;
|
|
34966
35041
|
const markerPath = join18(stateDir, RUNTIME_LAYOUT_MARKER_FILE);
|
|
34967
35042
|
const files = layoutFiles(location, options.accountFile);
|
|
34968
35043
|
const fence = options.fence ?? defaultFence(options.version);
|
|
34969
35044
|
const stateHome = async () => {
|
|
34970
|
-
await settleVault(location, options, "state-home",
|
|
35045
|
+
await settleVault(location, options, "state-home", log19);
|
|
34971
35046
|
return "state-home";
|
|
34972
35047
|
};
|
|
34973
35048
|
let marker = await readMarker(markerPath, stateDir, files.vault.old);
|
|
@@ -34978,7 +35053,7 @@ async function decide(location, options) {
|
|
|
34978
35053
|
join18(stateDir, RUNTIME_LAYOUT_MANIFEST_FILE)
|
|
34979
35054
|
).catch(() => true);
|
|
34980
35055
|
if (!manifestLeft) {
|
|
34981
|
-
await settleVault(location, options, "state-home",
|
|
35056
|
+
await settleVault(location, options, "state-home", log19);
|
|
34982
35057
|
return stateHome();
|
|
34983
35058
|
}
|
|
34984
35059
|
}
|
|
@@ -34990,7 +35065,7 @@ async function decide(location, options) {
|
|
|
34990
35065
|
RUNTIME_LAYOUT_LOCK_NAME,
|
|
34991
35066
|
markerPath,
|
|
34992
35067
|
options.layoutLockWaitMs ?? LAYOUT_LOCK_WAIT_MS,
|
|
34993
|
-
|
|
35068
|
+
log19
|
|
34994
35069
|
);
|
|
34995
35070
|
} catch (error) {
|
|
34996
35071
|
marker = await readMarker(markerPath, stateDir, files.vault.old);
|
|
@@ -35010,7 +35085,7 @@ async function decide(location, options) {
|
|
|
35010
35085
|
const legacy = async () => {
|
|
35011
35086
|
try {
|
|
35012
35087
|
await lock.assertOwned();
|
|
35013
|
-
await settleVault(location, options, "legacy",
|
|
35088
|
+
await settleVault(location, options, "legacy", log19);
|
|
35014
35089
|
} catch (error) {
|
|
35015
35090
|
throw new RuntimeLayoutRefusal(stateDir, errorClass(error));
|
|
35016
35091
|
}
|
|
@@ -35024,20 +35099,20 @@ async function decide(location, options) {
|
|
|
35024
35099
|
if (!marker.oldFilesRemoved && !aliased)
|
|
35025
35100
|
await finishOldFiles(location, files, markerPath, marker, lock, {
|
|
35026
35101
|
fence,
|
|
35027
|
-
log:
|
|
35102
|
+
log: log19,
|
|
35028
35103
|
steps: options.steps,
|
|
35029
35104
|
oldSignatureCache: options.oldSignatureCacheFile ?? legacySignatureCacheFile()
|
|
35030
35105
|
});
|
|
35031
35106
|
else if (marker.oldFilesRemoved) {
|
|
35032
35107
|
await refuseReappearedFiles(location, files);
|
|
35033
|
-
await removeLeftoverManifest(location, lock, options.steps,
|
|
35108
|
+
await removeLeftoverManifest(location, lock, options.steps, log19);
|
|
35034
35109
|
}
|
|
35035
35110
|
return await stateHome();
|
|
35036
35111
|
}
|
|
35037
35112
|
if (aliased) {
|
|
35038
35113
|
logOnce(
|
|
35039
35114
|
`${location.key}\0aliased`,
|
|
35040
|
-
() =>
|
|
35115
|
+
() => log19.warn(
|
|
35041
35116
|
"antigravity-auth keeps its vault files in OpenCode's config folder: its state folder is that same folder",
|
|
35042
35117
|
{ configDir: location.configDir, stateDir }
|
|
35043
35118
|
)
|
|
@@ -35046,14 +35121,14 @@ async function decide(location, options) {
|
|
|
35046
35121
|
}
|
|
35047
35122
|
const gate = await fence();
|
|
35048
35123
|
if (!gate.open) {
|
|
35049
|
-
logDeferral(location, gate.blockers,
|
|
35124
|
+
logDeferral(location, gate.blockers, log19);
|
|
35050
35125
|
return await legacy();
|
|
35051
35126
|
}
|
|
35052
35127
|
let markerStarted = false;
|
|
35053
35128
|
try {
|
|
35054
35129
|
const outcome = await moveFiles(location, files, markerPath, lock, {
|
|
35055
35130
|
fence,
|
|
35056
|
-
log:
|
|
35131
|
+
log: log19,
|
|
35057
35132
|
steps: options.steps,
|
|
35058
35133
|
destinationPrivate: options.destinationPrivate ?? defaultDestinationPrivate,
|
|
35059
35134
|
oldSignatureCache: options.oldSignatureCacheFile ?? legacySignatureCacheFile(),
|
|
@@ -35062,13 +35137,13 @@ async function decide(location, options) {
|
|
|
35062
35137
|
}
|
|
35063
35138
|
});
|
|
35064
35139
|
if (outcome.kind === "deferred") {
|
|
35065
|
-
logDeferral(location, outcome.blockers,
|
|
35140
|
+
logDeferral(location, outcome.blockers, log19);
|
|
35066
35141
|
return await legacy();
|
|
35067
35142
|
}
|
|
35068
35143
|
if (outcome.kind === "refused") {
|
|
35069
35144
|
logOnce(
|
|
35070
35145
|
`${location.key}\0refused`,
|
|
35071
|
-
() =>
|
|
35146
|
+
() => log19.warn(
|
|
35072
35147
|
outcome.reason === "destination-not-private" ? "antigravity-auth keeps its vault files in OpenCode's config folder: the vault folder in its state folder already exists and is not private to your user. It was left unchanged; remove it if it holds nothing you need, then restart OpenCode." : "antigravity-auth keeps its vault files in OpenCode's config folder: it will not move them",
|
|
35073
35148
|
{ reason: outcome.reason, paths: outcome.paths, stateDir }
|
|
35074
35149
|
)
|
|
@@ -35076,7 +35151,7 @@ async function decide(location, options) {
|
|
|
35076
35151
|
return await legacy();
|
|
35077
35152
|
}
|
|
35078
35153
|
if (outcome.moved)
|
|
35079
|
-
|
|
35154
|
+
log19.info(
|
|
35080
35155
|
"antigravity-auth moved its vault files out of OpenCode's config folder",
|
|
35081
35156
|
{ from: files.vault.old, to: files.vault.next }
|
|
35082
35157
|
);
|
|
@@ -35087,7 +35162,7 @@ async function decide(location, options) {
|
|
|
35087
35162
|
return await stateHome();
|
|
35088
35163
|
logOnce(
|
|
35089
35164
|
`${location.key}\0failed`,
|
|
35090
|
-
() =>
|
|
35165
|
+
() => log19.warn(
|
|
35091
35166
|
"antigravity-auth's vault files stay in OpenCode's config folder: moving them failed; the move is tried again at the next start",
|
|
35092
35167
|
{
|
|
35093
35168
|
configDir: location.configDir,
|
|
@@ -35136,7 +35211,7 @@ async function prepareAccountStore(options) {
|
|
|
35136
35211
|
if (!await localAccountStoreAuthorized()) return void 0;
|
|
35137
35212
|
const decided = decidedAccountStoreAnchor(location);
|
|
35138
35213
|
if (decided) return decided;
|
|
35139
|
-
const
|
|
35214
|
+
const log19 = options.log ?? createLogger4("runtime-layout");
|
|
35140
35215
|
const runKey = `${location.stateHomeDir}\0${location.key}`;
|
|
35141
35216
|
let run = processState.storeRuns.get(runKey);
|
|
35142
35217
|
if (!run) {
|
|
@@ -35147,12 +35222,12 @@ async function prepareAccountStore(options) {
|
|
|
35147
35222
|
RUNTIME_LAYOUT_LOCK_NAME,
|
|
35148
35223
|
join18(location.stateHomeDir, RUNTIME_LAYOUT_MARKER_FILE),
|
|
35149
35224
|
options.layoutLockWaitMs ?? LAYOUT_LOCK_WAIT_MS,
|
|
35150
|
-
|
|
35225
|
+
log19
|
|
35151
35226
|
);
|
|
35152
35227
|
try {
|
|
35153
35228
|
await lock.assertOwned();
|
|
35154
35229
|
if (!await localAccountStoreAuthorized()) return void 0;
|
|
35155
|
-
return await settleAccountStore(location, options,
|
|
35230
|
+
return await settleAccountStore(location, options, log19);
|
|
35156
35231
|
} finally {
|
|
35157
35232
|
await lock.release();
|
|
35158
35233
|
}
|
|
@@ -35163,20 +35238,20 @@ async function prepareAccountStore(options) {
|
|
|
35163
35238
|
}
|
|
35164
35239
|
return run;
|
|
35165
35240
|
}
|
|
35166
|
-
async function settleAccountStore(location, options,
|
|
35241
|
+
async function settleAccountStore(location, options, log19) {
|
|
35167
35242
|
const decided = decidedAccountStoreAnchor(location);
|
|
35168
35243
|
if (decided) return decided;
|
|
35169
|
-
const anchor = await decideAccountStore(location, options,
|
|
35244
|
+
const anchor = await decideAccountStore(location, options, log19);
|
|
35170
35245
|
setAccountStoreAnchor(location, anchor);
|
|
35171
35246
|
return anchor;
|
|
35172
35247
|
}
|
|
35173
|
-
async function decideAccountStore(location, options,
|
|
35174
|
-
const keepConfig = () => recordAnchor(location, options, "config",
|
|
35248
|
+
async function decideAccountStore(location, options, log19) {
|
|
35249
|
+
const keepConfig = () => recordAnchor(location, options, "config", log19);
|
|
35175
35250
|
if (processHasOlderGeneration()) {
|
|
35176
35251
|
logOnce(
|
|
35177
35252
|
"older-generation-account-store",
|
|
35178
35253
|
() => showLog(
|
|
35179
|
-
|
|
35254
|
+
log19,
|
|
35180
35255
|
"antigravity-auth keeps the account store in OpenCode's config folder until OpenCode restarts, because an older version of the plugin ran in this process.",
|
|
35181
35256
|
{ accountStore: "config" }
|
|
35182
35257
|
)
|
|
@@ -35190,7 +35265,7 @@ async function decideAccountStore(location, options, log18) {
|
|
|
35190
35265
|
if (!sameSpelling(forward.legacyPath, stateAnchor)) {
|
|
35191
35266
|
logOnce(
|
|
35192
35267
|
`${location.key}\0store-forward-elsewhere`,
|
|
35193
|
-
() =>
|
|
35268
|
+
() => log19.warn(
|
|
35194
35269
|
"the account store moved to another folder than this process resolved; check XDG_STATE_HOME",
|
|
35195
35270
|
{ movedTo: forward.legacyPath, expected: stateAnchor }
|
|
35196
35271
|
)
|
|
@@ -35201,9 +35276,9 @@ async function decideAccountStore(location, options, log18) {
|
|
|
35201
35276
|
options,
|
|
35202
35277
|
configAnchor,
|
|
35203
35278
|
stateAnchor,
|
|
35204
|
-
|
|
35279
|
+
log19
|
|
35205
35280
|
);
|
|
35206
|
-
return recordAnchor(location, options, "state-home",
|
|
35281
|
+
return recordAnchor(location, options, "state-home", log19);
|
|
35207
35282
|
}
|
|
35208
35283
|
if (decidedRuntimeLayout(location) === "legacy") return keepConfig();
|
|
35209
35284
|
const configStore = await presentAccountStore(configAnchor);
|
|
@@ -35215,9 +35290,9 @@ async function decideAccountStore(location, options, log18) {
|
|
|
35215
35290
|
`antigravity-auth cannot start: two account stores exist, one at ${configAnchor} and one at ${stateAnchor}, and neither is marked as moved. Keep the one you want and move the other one aside, then restart OpenCode.`
|
|
35216
35291
|
);
|
|
35217
35292
|
}
|
|
35218
|
-
if (stateStore) return recordAnchor(location, options, "state-home",
|
|
35293
|
+
if (stateStore) return recordAnchor(location, options, "state-home", log19);
|
|
35219
35294
|
if (configStore) {
|
|
35220
|
-
if (!await storeMovePathResolves(stateAnchor, location,
|
|
35295
|
+
if (!await storeMovePathResolves(stateAnchor, location, log19))
|
|
35221
35296
|
return keepConfig();
|
|
35222
35297
|
return moveStore(
|
|
35223
35298
|
location,
|
|
@@ -35225,21 +35300,21 @@ async function decideAccountStore(location, options, log18) {
|
|
|
35225
35300
|
configAnchor,
|
|
35226
35301
|
stateAnchor,
|
|
35227
35302
|
false,
|
|
35228
|
-
|
|
35303
|
+
log19,
|
|
35229
35304
|
false
|
|
35230
35305
|
);
|
|
35231
35306
|
}
|
|
35232
|
-
if (await storeArtefacts(stateAnchor) > 0 && !await abandonUnpublishedStore(location, stateAnchor,
|
|
35307
|
+
if (await storeArtefacts(stateAnchor) > 0 && !await abandonUnpublishedStore(location, stateAnchor, log19))
|
|
35233
35308
|
return keepConfig();
|
|
35234
|
-
if (!await storeMovePathResolves(stateAnchor, location,
|
|
35309
|
+
if (!await storeMovePathResolves(stateAnchor, location, log19))
|
|
35235
35310
|
return keepConfig();
|
|
35236
|
-
return initializeStore(location, options, stateAnchor,
|
|
35311
|
+
return initializeStore(location, options, stateAnchor, log19);
|
|
35237
35312
|
}
|
|
35238
|
-
function showLog(
|
|
35239
|
-
if (
|
|
35240
|
-
else
|
|
35313
|
+
function showLog(log19, message, meta) {
|
|
35314
|
+
if (log19.log) log19.log(message, meta);
|
|
35315
|
+
else log19.info(message, meta);
|
|
35241
35316
|
}
|
|
35242
|
-
async function recordAnchor(location, options, anchor,
|
|
35317
|
+
async function recordAnchor(location, options, anchor, log19) {
|
|
35243
35318
|
try {
|
|
35244
35319
|
await recordProcessAnchor({
|
|
35245
35320
|
key: location.key,
|
|
@@ -35251,32 +35326,32 @@ async function recordAnchor(location, options, anchor, log18) {
|
|
|
35251
35326
|
}
|
|
35252
35327
|
if (anchor === "state-home")
|
|
35253
35328
|
showLog(
|
|
35254
|
-
|
|
35329
|
+
log19,
|
|
35255
35330
|
"antigravity-auth keeps its account store in its state folder",
|
|
35256
35331
|
{ accountStore: anchor }
|
|
35257
35332
|
);
|
|
35258
35333
|
return anchor;
|
|
35259
35334
|
}
|
|
35260
|
-
async function storeMovePathResolves(stateAnchor, location,
|
|
35335
|
+
async function storeMovePathResolves(stateAnchor, location, log19) {
|
|
35261
35336
|
if (folderResolvesToItself(
|
|
35262
35337
|
join18(location.stateHomeDir, "antigravity-accounts.json")
|
|
35263
35338
|
))
|
|
35264
35339
|
return true;
|
|
35265
35340
|
logOnce(
|
|
35266
35341
|
`${location.key}\0store-linked-path`,
|
|
35267
|
-
() =>
|
|
35342
|
+
() => log19.warn(ACCOUNT_STORE_LINKED_PATH_MESSAGE, {
|
|
35268
35343
|
accountStore: stateAnchor,
|
|
35269
35344
|
stateFolder: location.stateHomeDir
|
|
35270
35345
|
})
|
|
35271
35346
|
);
|
|
35272
35347
|
return false;
|
|
35273
35348
|
}
|
|
35274
|
-
async function storeFenceOpen(location, options,
|
|
35349
|
+
async function storeFenceOpen(location, options, log19) {
|
|
35275
35350
|
const gate = await (options.storeFence ?? defaultStoreFence(options.version))();
|
|
35276
35351
|
if (gate.open) return true;
|
|
35277
35352
|
logOnce(
|
|
35278
35353
|
`${location.key}\0store-version-fence`,
|
|
35279
|
-
() =>
|
|
35354
|
+
() => log19.info(ACCOUNT_STORE_DEFERRED_MESSAGE, {
|
|
35280
35355
|
configDir: location.configDir,
|
|
35281
35356
|
blockers: gate.blockers
|
|
35282
35357
|
})
|
|
@@ -35303,7 +35378,7 @@ async function storeArtefacts(anchor) {
|
|
|
35303
35378
|
(name) => name === store || name.startsWith(`${pool}.store.`) || name.startsWith(pool) && name.endsWith(".tmp")
|
|
35304
35379
|
).length;
|
|
35305
35380
|
}
|
|
35306
|
-
async function abandonUnpublishedStore(location, stateAnchor,
|
|
35381
|
+
async function abandonUnpublishedStore(location, stateAnchor, log19) {
|
|
35307
35382
|
const store = await loadCommonAuthStoreModules();
|
|
35308
35383
|
const binding = await readAccountStoreBinding(stateAnchor, store, Date.now);
|
|
35309
35384
|
if (binding.status === "bound") return false;
|
|
@@ -35314,7 +35389,7 @@ async function abandonUnpublishedStore(location, stateAnchor, log18) {
|
|
|
35314
35389
|
});
|
|
35315
35390
|
await unlink11(accountStorePointerPath(stateAnchor)).catch(() => {
|
|
35316
35391
|
});
|
|
35317
|
-
|
|
35392
|
+
log19.info(
|
|
35318
35393
|
"antigravity-auth set an unfinished account store aside before starting its move again",
|
|
35319
35394
|
{ configDir: location.configDir, archived }
|
|
35320
35395
|
);
|
|
@@ -35336,9 +35411,9 @@ async function runStoreMove(input2) {
|
|
|
35336
35411
|
return { status: "pending", reason: outcome.reason };
|
|
35337
35412
|
return { status: "cancelled" };
|
|
35338
35413
|
}
|
|
35339
|
-
async function moveStore(location, options, source, target, back,
|
|
35340
|
-
const keepConfig = () => recordAnchor(location, options, "config",
|
|
35341
|
-
if (!await storeFenceOpen(location, options,
|
|
35414
|
+
async function moveStore(location, options, source, target, back, log19, forwarded) {
|
|
35415
|
+
const keepConfig = () => recordAnchor(location, options, "config", log19);
|
|
35416
|
+
if (!await storeFenceOpen(location, options, log19)) return keepConfig();
|
|
35342
35417
|
try {
|
|
35343
35418
|
const result = await (options.relocate ?? runStoreMove)({
|
|
35344
35419
|
source,
|
|
@@ -35348,7 +35423,7 @@ async function moveStore(location, options, source, target, back, log18, forward
|
|
|
35348
35423
|
if (result.status !== "completed") {
|
|
35349
35424
|
logOnce(
|
|
35350
35425
|
`${location.key}\0store-move-unfinished`,
|
|
35351
|
-
() =>
|
|
35426
|
+
() => log19.info(ACCOUNT_STORE_DEFERRED_MESSAGE, {
|
|
35352
35427
|
configDir: location.configDir,
|
|
35353
35428
|
reason: result.status === "pending" ? result.reason : result.status
|
|
35354
35429
|
})
|
|
@@ -35356,14 +35431,14 @@ async function moveStore(location, options, source, target, back, log18, forward
|
|
|
35356
35431
|
return forwarded ? "state-home" : keepConfig();
|
|
35357
35432
|
}
|
|
35358
35433
|
showLog(
|
|
35359
|
-
|
|
35434
|
+
log19,
|
|
35360
35435
|
"antigravity-auth moved the account store out of OpenCode's config folder",
|
|
35361
35436
|
{ from: source, to: target, generation: result.id }
|
|
35362
35437
|
);
|
|
35363
35438
|
} catch (error) {
|
|
35364
35439
|
logOnce(
|
|
35365
35440
|
`${location.key}\0store-move-failed`,
|
|
35366
|
-
() =>
|
|
35441
|
+
() => log19.warn(
|
|
35367
35442
|
"antigravity-auth's account store stays in OpenCode's config folder: moving it failed; the move is tried again at the next start",
|
|
35368
35443
|
{
|
|
35369
35444
|
configDir: location.configDir,
|
|
@@ -35374,9 +35449,9 @@ async function moveStore(location, options, source, target, back, log18, forward
|
|
|
35374
35449
|
);
|
|
35375
35450
|
return forwarded ? "state-home" : keepConfig();
|
|
35376
35451
|
}
|
|
35377
|
-
return recordAnchor(location, options, "state-home",
|
|
35452
|
+
return recordAnchor(location, options, "state-home", log19);
|
|
35378
35453
|
}
|
|
35379
|
-
async function resumeForwardedStore(location, options, configAnchor, stateAnchor,
|
|
35454
|
+
async function resumeForwardedStore(location, options, configAnchor, stateAnchor, log19) {
|
|
35380
35455
|
const store = await loadCommonAuthStoreModules();
|
|
35381
35456
|
const binding = await readAccountStoreBinding(stateAnchor, store, Date.now);
|
|
35382
35457
|
if (binding.status === "bound") return;
|
|
@@ -35387,13 +35462,13 @@ async function resumeForwardedStore(location, options, configAnchor, stateAnchor
|
|
|
35387
35462
|
configAnchor,
|
|
35388
35463
|
stateAnchor,
|
|
35389
35464
|
false,
|
|
35390
|
-
|
|
35465
|
+
log19,
|
|
35391
35466
|
true
|
|
35392
35467
|
);
|
|
35393
35468
|
} catch (error) {
|
|
35394
35469
|
logOnce(
|
|
35395
35470
|
`${location.key}\0store-resume-failed`,
|
|
35396
|
-
() =>
|
|
35471
|
+
() => log19.warn(
|
|
35397
35472
|
"antigravity-auth's account store is still moving; it could not be finished at this start",
|
|
35398
35473
|
{
|
|
35399
35474
|
configDir: location.configDir,
|
|
@@ -35404,9 +35479,9 @@ async function resumeForwardedStore(location, options, configAnchor, stateAnchor
|
|
|
35404
35479
|
);
|
|
35405
35480
|
}
|
|
35406
35481
|
}
|
|
35407
|
-
async function initializeStore(location, options, stateAnchor,
|
|
35408
|
-
const keepConfig = () => recordAnchor(location, options, "config",
|
|
35409
|
-
if (!await storeFenceOpen(location, options,
|
|
35482
|
+
async function initializeStore(location, options, stateAnchor, log19) {
|
|
35483
|
+
const keepConfig = () => recordAnchor(location, options, "config", log19);
|
|
35484
|
+
if (!await storeFenceOpen(location, options, log19)) return keepConfig();
|
|
35410
35485
|
try {
|
|
35411
35486
|
const store = await loadCommonAuthStoreModules();
|
|
35412
35487
|
const created = await initializeFreshAccountStore(store, {
|
|
@@ -35419,7 +35494,7 @@ async function initializeStore(location, options, stateAnchor, log18) {
|
|
|
35419
35494
|
} catch (error) {
|
|
35420
35495
|
logOnce(
|
|
35421
35496
|
`${location.key}\0store-init-failed`,
|
|
35422
|
-
() =>
|
|
35497
|
+
() => log19.warn(
|
|
35423
35498
|
"antigravity-auth's account store stays in OpenCode's config folder: creating it in its state folder failed; it is tried again at the next start",
|
|
35424
35499
|
{
|
|
35425
35500
|
configDir: location.configDir,
|
|
@@ -35431,13 +35506,13 @@ async function initializeStore(location, options, stateAnchor, log18) {
|
|
|
35431
35506
|
return keepConfig();
|
|
35432
35507
|
}
|
|
35433
35508
|
showLog(
|
|
35434
|
-
|
|
35509
|
+
log19,
|
|
35435
35510
|
"antigravity-auth created its account store in its state folder",
|
|
35436
35511
|
{
|
|
35437
35512
|
accountStore: stateAnchor
|
|
35438
35513
|
}
|
|
35439
35514
|
);
|
|
35440
|
-
return recordAnchor(location, options, "state-home",
|
|
35515
|
+
return recordAnchor(location, options, "state-home", log19);
|
|
35441
35516
|
}
|
|
35442
35517
|
async function writeStateHomeStoreForward(id, stateAnchor, configAnchor = legacyAccountFile(runtimeLayoutLocation().configDir)) {
|
|
35443
35518
|
const forward = {
|
|
@@ -35452,10 +35527,10 @@ async function writeStateHomeStoreForward(id, stateAnchor, configAnchor = legacy
|
|
|
35452
35527
|
durability: "file-only-on-windows"
|
|
35453
35528
|
});
|
|
35454
35529
|
}
|
|
35455
|
-
function logDeferral(location, blockers,
|
|
35530
|
+
function logDeferral(location, blockers, log19) {
|
|
35456
35531
|
logOnce(
|
|
35457
35532
|
`${location.key}\0deferred`,
|
|
35458
|
-
() =>
|
|
35533
|
+
() => log19.info(RUNTIME_LAYOUT_DEFERRED_MESSAGE, {
|
|
35459
35534
|
configDir: location.configDir,
|
|
35460
35535
|
blockers
|
|
35461
35536
|
})
|
|
@@ -35613,13 +35688,13 @@ async function finishOldFiles(location, files, markerPath, marker, layoutLock, i
|
|
|
35613
35688
|
if (done) await removeOldVaultFolder(files, layoutLock, input2.steps);
|
|
35614
35689
|
}
|
|
35615
35690
|
}
|
|
35616
|
-
async function removeLeftoverManifest(location, layoutLock, steps,
|
|
35691
|
+
async function removeLeftoverManifest(location, layoutLock, steps, log19) {
|
|
35617
35692
|
try {
|
|
35618
35693
|
await removeManifestOwned(location.stateHomeDir, layoutLock, steps);
|
|
35619
35694
|
} catch (error) {
|
|
35620
35695
|
logOnce(
|
|
35621
35696
|
`${location.key}\0manifest`,
|
|
35622
|
-
() =>
|
|
35697
|
+
() => log19.warn(
|
|
35623
35698
|
`antigravity-auth could not remove ${RUNTIME_LAYOUT_MANIFEST_FILE} from its state folder; it tries again at the next start`,
|
|
35624
35699
|
{ stateDir: location.stateHomeDir, errorClass: errorClass(error) }
|
|
35625
35700
|
)
|
|
@@ -35639,7 +35714,7 @@ async function removeOldVaultFolder(files, layoutLock, steps) {
|
|
|
35639
35714
|
} catch {
|
|
35640
35715
|
}
|
|
35641
35716
|
}
|
|
35642
|
-
async function removeOldSignatureCache(location, path5, layoutLock, steps,
|
|
35717
|
+
async function removeOldSignatureCache(location, path5, layoutLock, steps, log19) {
|
|
35643
35718
|
try {
|
|
35644
35719
|
if (!await exists2(path5)) return;
|
|
35645
35720
|
await beforeRemove(path5, layoutLock, steps);
|
|
@@ -35648,7 +35723,7 @@ async function removeOldSignatureCache(location, path5, layoutLock, steps, log18
|
|
|
35648
35723
|
if (error?.code === "ENOENT") return;
|
|
35649
35724
|
logOnce(
|
|
35650
35725
|
`${location.key}\0signature-cache`,
|
|
35651
|
-
() =>
|
|
35726
|
+
() => log19.warn(
|
|
35652
35727
|
"antigravity-auth could not remove its old signature cache from OpenCode's config folder; it is no longer used and can be deleted",
|
|
35653
35728
|
{ path: path5, errorClass: errorClass(error) }
|
|
35654
35729
|
)
|
|
@@ -35659,7 +35734,7 @@ async function beforeRemove(path5, layoutLock, steps) {
|
|
|
35659
35734
|
await steps?.beforeRemove?.(path5);
|
|
35660
35735
|
await layoutLock.assertOwned();
|
|
35661
35736
|
}
|
|
35662
|
-
async function takeDataLocks(files,
|
|
35737
|
+
async function takeDataLocks(files, log19) {
|
|
35663
35738
|
const locks = [];
|
|
35664
35739
|
try {
|
|
35665
35740
|
if (await exists2(files.vault.old))
|
|
@@ -35669,7 +35744,7 @@ async function takeDataLocks(files, log18) {
|
|
|
35669
35744
|
lock.name,
|
|
35670
35745
|
join18(files.vault.old, lock.file),
|
|
35671
35746
|
lock.waitMs,
|
|
35672
|
-
|
|
35747
|
+
log19
|
|
35673
35748
|
)
|
|
35674
35749
|
);
|
|
35675
35750
|
return locks;
|
|
@@ -36020,7 +36095,7 @@ async function ensureOwnerOnlyDir(path5) {
|
|
|
36020
36095
|
await mkdir13(path5, { recursive: true, mode: 448 });
|
|
36021
36096
|
await chmod5(path5, 448);
|
|
36022
36097
|
}
|
|
36023
|
-
async function takeLock(name, path5, waitMs,
|
|
36098
|
+
async function takeLock(name, path5, waitMs, log19) {
|
|
36024
36099
|
const fs7 = await loadCommonAuthFs();
|
|
36025
36100
|
const started = performance.now();
|
|
36026
36101
|
let announced = false;
|
|
@@ -36045,7 +36120,7 @@ async function takeLock(name, path5, waitMs, log18) {
|
|
|
36045
36120
|
);
|
|
36046
36121
|
if (!announced && waited >= LOCK_WAIT_NOTICE_MS) {
|
|
36047
36122
|
announced = true;
|
|
36048
|
-
|
|
36123
|
+
log19.info(
|
|
36049
36124
|
`antigravity-auth is waiting up to ${Math.round(waitMs / 1e3)} s for the ${name} lock at ${path5}.${lockHolderText(name)}`,
|
|
36050
36125
|
{ lock: name, path: path5 }
|
|
36051
36126
|
);
|
|
@@ -41145,9 +41220,11 @@ import { setTimeout as delay2 } from "node:timers/promises";
|
|
|
41145
41220
|
import { writeEnrollmentTokenFile as writeEnrollmentTokenFile3 } from "@cortexkit/claustrum-client";
|
|
41146
41221
|
|
|
41147
41222
|
// src/common-auth-embedded/setup/process-fence.js
|
|
41223
|
+
init_logger3();
|
|
41148
41224
|
import { statSync as statSync6 } from "node:fs";
|
|
41149
41225
|
import { win32 as win323 } from "node:path";
|
|
41150
41226
|
var WINDOWS_CIM_TIMEOUT_MS = 45e3;
|
|
41227
|
+
var log9 = createLogger3("setup-process-fence");
|
|
41151
41228
|
var WINDOWS_ARM_POWERSHELL_TIMEOUT_MS = 9e4;
|
|
41152
41229
|
function isFile(file) {
|
|
41153
41230
|
try {
|
|
@@ -41307,14 +41384,23 @@ async function listSetupProcesses(runner = defaultCommandRunner, options = {}) {
|
|
|
41307
41384
|
options.onStep?.({ ...inspection });
|
|
41308
41385
|
}
|
|
41309
41386
|
};
|
|
41310
|
-
const inspectCim = (args) => {
|
|
41387
|
+
const inspectCim = async (args) => {
|
|
41311
41388
|
const pwsh = win323.resolve(windowsEnv(env3, "ProgramFiles") ?? "C:\\Program Files", "PowerShell", "7", "pwsh.exe");
|
|
41312
41389
|
const program = (options.isFile ?? isFile)(pwsh) ? "pwsh" : "powershell";
|
|
41313
41390
|
const arm64 = (windowsEnv(env3, "PROCESSOR_ARCHITEW6432") ?? windowsEnv(env3, "PROCESSOR_ARCHITECTURE"))?.toUpperCase() === "ARM64";
|
|
41314
41391
|
const slow = program === "powershell" && arm64;
|
|
41315
41392
|
if (slow)
|
|
41316
41393
|
options.onProgress?.("Checking that OpenCode and Pi are not running. Without PowerShell 7 this can take up to a minute on Windows ARM; installing PowerShell 7 makes it fast.");
|
|
41317
|
-
|
|
41394
|
+
const file = program === "pwsh" ? pwsh : win323.resolve(system32, "WindowsPowerShell", "v1.0", "powershell.exe");
|
|
41395
|
+
const timeoutMs = slow ? WINDOWS_ARM_POWERSHELL_TIMEOUT_MS : WINDOWS_CIM_TIMEOUT_MS;
|
|
41396
|
+
const started = performance.now();
|
|
41397
|
+
const result = await inspect("CIM", file, args, timeoutMs, program);
|
|
41398
|
+
const remaining = Math.floor(timeoutMs - (performance.now() - started));
|
|
41399
|
+
if ((result.exitCode === 3221225477 || result.exitCode === -1073741819) && !result.timedOut && !result.signal && !result.spawnError && remaining > 0) {
|
|
41400
|
+
log9.warn("Windows process query crashed with an access violation; retrying once");
|
|
41401
|
+
return inspect("CIM", file, args, remaining, program);
|
|
41402
|
+
}
|
|
41403
|
+
return result;
|
|
41318
41404
|
};
|
|
41319
41405
|
try {
|
|
41320
41406
|
if (windows2 && options.hostImagesOnly) {
|
|
@@ -43887,8 +43973,8 @@ function isUsablePortFileEntry(value, name) {
|
|
|
43887
43973
|
const { pid, port, token } = value;
|
|
43888
43974
|
return isProbeablePid(pid) && filenamePid(name) === pid && typeof port === "number" && Number.isInteger(port) && port >= 1 && port <= 65535 && typeof token === "string" && token.length > 0;
|
|
43889
43975
|
}
|
|
43890
|
-
async function removeCorruptPortFile(portFile,
|
|
43891
|
-
|
|
43976
|
+
async function removeCorruptPortFile(portFile, log19) {
|
|
43977
|
+
log19?.debug("rpc corrupt port file", { pid: process.pid, portFile });
|
|
43892
43978
|
await unlink15(portFile).catch(() => {
|
|
43893
43979
|
});
|
|
43894
43980
|
}
|
|
@@ -43942,7 +44028,7 @@ async function writePortFile(dir, entry, options = {}) {
|
|
|
43942
44028
|
}
|
|
43943
44029
|
}
|
|
43944
44030
|
}
|
|
43945
|
-
async function sweepRpcState(root, activeDir, isManagedDir,
|
|
44031
|
+
async function sweepRpcState(root, activeDir, isManagedDir, log19, options = {}) {
|
|
43946
44032
|
const cutoff = staleBefore(options);
|
|
43947
44033
|
let projectDirs;
|
|
43948
44034
|
try {
|
|
@@ -43958,14 +44044,14 @@ async function sweepRpcState(root, activeDir, isManagedDir, log18, options = {})
|
|
|
43958
44044
|
continue;
|
|
43959
44045
|
}
|
|
43960
44046
|
const dir = join30(root, projectDir.name);
|
|
43961
|
-
if (!await sweepRpcDirectory(dir,
|
|
44047
|
+
if (!await sweepRpcDirectory(dir, log19, options, cutoff))
|
|
43962
44048
|
continue;
|
|
43963
44049
|
if (resolve26(dir) !== active2)
|
|
43964
44050
|
await rmdir3(dir).catch(() => {
|
|
43965
44051
|
});
|
|
43966
44052
|
}
|
|
43967
44053
|
}
|
|
43968
|
-
async function sweepRpcDirectory(dir,
|
|
44054
|
+
async function sweepRpcDirectory(dir, log19, options = {}, cutoff = staleBefore(options)) {
|
|
43969
44055
|
let names;
|
|
43970
44056
|
try {
|
|
43971
44057
|
names = await readdir6(dir);
|
|
@@ -43993,11 +44079,11 @@ async function sweepRpcDirectory(dir, log18, options = {}, cutoff = staleBefore(
|
|
|
43993
44079
|
try {
|
|
43994
44080
|
parsed = JSON.parse(raw);
|
|
43995
44081
|
} catch {
|
|
43996
|
-
await removeCorruptPortFile(portFile,
|
|
44082
|
+
await removeCorruptPortFile(portFile, log19);
|
|
43997
44083
|
continue;
|
|
43998
44084
|
}
|
|
43999
44085
|
if (!isUsablePortFileEntry(parsed, name)) {
|
|
44000
|
-
await removeCorruptPortFile(portFile,
|
|
44086
|
+
await removeCorruptPortFile(portFile, log19);
|
|
44001
44087
|
continue;
|
|
44002
44088
|
}
|
|
44003
44089
|
const entry = parsed;
|
|
@@ -44028,7 +44114,7 @@ var key = /* @__PURE__ */ Symbol.for("common-auth.rpc.startup-sweep");
|
|
|
44028
44114
|
globals[key] ??= {};
|
|
44029
44115
|
var state = globals[key];
|
|
44030
44116
|
var now = Date.now;
|
|
44031
|
-
async function sweepRpcStateOnStart(root, activeDir, isManagedDir,
|
|
44117
|
+
async function sweepRpcStateOnStart(root, activeDir, isManagedDir, log19) {
|
|
44032
44118
|
const time = now();
|
|
44033
44119
|
if (state.lastSweepAt !== void 0 && time - state.lastSweepAt < 6e4) {
|
|
44034
44120
|
const active2 = resolve27(activeDir);
|
|
@@ -44037,11 +44123,11 @@ async function sweepRpcStateOnStart(root, activeDir, isManagedDir, log18) {
|
|
|
44037
44123
|
throw error;
|
|
44038
44124
|
return void 0;
|
|
44039
44125
|
}))?.isDirectory())
|
|
44040
|
-
await sweepRpcDirectory(active2,
|
|
44126
|
+
await sweepRpcDirectory(active2, log19);
|
|
44041
44127
|
return;
|
|
44042
44128
|
}
|
|
44043
44129
|
state.lastSweepAt = time;
|
|
44044
|
-
await sweepRpcState(root, activeDir, isManagedDir,
|
|
44130
|
+
await sweepRpcState(root, activeDir, isManagedDir, log19);
|
|
44045
44131
|
}
|
|
44046
44132
|
|
|
44047
44133
|
// src/common-auth-embedded/rpc/rpc-server.js
|
|
@@ -44117,7 +44203,7 @@ function tokenOk(header, token) {
|
|
|
44117
44203
|
async function startRpcServer(options) {
|
|
44118
44204
|
if (typeof options.drain === "function" === (typeof options.drainAsync === "function"))
|
|
44119
44205
|
throw new TypeError("exactly one of drain or drainAsync must be provided");
|
|
44120
|
-
const
|
|
44206
|
+
const log19 = options.log ?? { warn() {
|
|
44121
44207
|
}, debug() {
|
|
44122
44208
|
} };
|
|
44123
44209
|
const token = randomBytes6(32).toString("hex");
|
|
@@ -44218,7 +44304,7 @@ async function startRpcServer(options) {
|
|
|
44218
44304
|
return json(400, { error: "session required" });
|
|
44219
44305
|
if (sessionId === void 0 && !warnedMissingNotificationSession) {
|
|
44220
44306
|
warnedMissingNotificationSession = true;
|
|
44221
|
-
|
|
44307
|
+
log19.warn("rpc notification drain missing session id", {
|
|
44222
44308
|
pid: process.pid
|
|
44223
44309
|
});
|
|
44224
44310
|
}
|
|
@@ -44227,7 +44313,7 @@ async function startRpcServer(options) {
|
|
|
44227
44313
|
try {
|
|
44228
44314
|
messages = await options.drainAsync(lastReceivedId, sessionId);
|
|
44229
44315
|
} catch (error) {
|
|
44230
|
-
|
|
44316
|
+
log19.warn("rpc notification drain failed", {
|
|
44231
44317
|
pid: process.pid,
|
|
44232
44318
|
error: error instanceof Error ? error.message : String(error)
|
|
44233
44319
|
});
|
|
@@ -44246,20 +44332,20 @@ async function startRpcServer(options) {
|
|
|
44246
44332
|
return json(404, { error: "unknown method" });
|
|
44247
44333
|
} catch (error) {
|
|
44248
44334
|
if (error instanceof RpcRequestError) {
|
|
44249
|
-
|
|
44335
|
+
log19.debug("rpc request refused", {
|
|
44250
44336
|
pid: process.pid,
|
|
44251
44337
|
status: error.status
|
|
44252
44338
|
});
|
|
44253
44339
|
return json(error.status, { error: error.message });
|
|
44254
44340
|
}
|
|
44255
44341
|
if (error instanceof ApplyDeadlineError) {
|
|
44256
|
-
|
|
44342
|
+
log19.warn("rpc apply deadline exceeded", {
|
|
44257
44343
|
pid: process.pid,
|
|
44258
44344
|
deadlineMs: options.applyDeadlineMs
|
|
44259
44345
|
});
|
|
44260
44346
|
return json(504, { error: "handler deadline exceeded" });
|
|
44261
44347
|
}
|
|
44262
|
-
|
|
44348
|
+
log19.warn("rpc request failed", {
|
|
44263
44349
|
pid: process.pid,
|
|
44264
44350
|
error: error instanceof Error ? error.message : String(error)
|
|
44265
44351
|
});
|
|
@@ -44279,9 +44365,9 @@ async function startRpcServer(options) {
|
|
|
44279
44365
|
server.unref();
|
|
44280
44366
|
if (options.sweepRoot) {
|
|
44281
44367
|
try {
|
|
44282
|
-
await sweepRpcStateOnStart(options.sweepRoot, options.dir, options.isManagedDir,
|
|
44368
|
+
await sweepRpcStateOnStart(options.sweepRoot, options.dir, options.isManagedDir, log19);
|
|
44283
44369
|
} catch (error) {
|
|
44284
|
-
|
|
44370
|
+
log19.warn("rpc state sweep failed", {
|
|
44285
44371
|
pid: process.pid,
|
|
44286
44372
|
error: error instanceof Error ? error.message : String(error)
|
|
44287
44373
|
});
|
|
@@ -44289,7 +44375,7 @@ async function startRpcServer(options) {
|
|
|
44289
44375
|
}
|
|
44290
44376
|
try {
|
|
44291
44377
|
await writePortFile(options.dir, { port, token, pid: process.pid }, { secureDir: options.secureDir });
|
|
44292
|
-
|
|
44378
|
+
log19.debug("rpc server pid", {
|
|
44293
44379
|
pid: process.pid,
|
|
44294
44380
|
rpcPort: port
|
|
44295
44381
|
});
|
|
@@ -46334,7 +46420,7 @@ async function exists3(path5) {
|
|
|
46334
46420
|
throw error;
|
|
46335
46421
|
}
|
|
46336
46422
|
}
|
|
46337
|
-
function
|
|
46423
|
+
function log10(options, level, message, data) {
|
|
46338
46424
|
try {
|
|
46339
46425
|
options.log[level](message, data);
|
|
46340
46426
|
} catch {
|
|
@@ -46405,7 +46491,7 @@ function merge(options, legacy, mapped, result) {
|
|
|
46405
46491
|
}));
|
|
46406
46492
|
if (values.some(({ host, value }) => !isDeepStrictEqual5(hosts.has(host) ? hosts.get(host) : primary.value, value))) {
|
|
46407
46493
|
result.differing.push({ setting, values });
|
|
46408
|
-
|
|
46494
|
+
log10(options, "info", `Differing legacy settings: ${setting}`, { values });
|
|
46409
46495
|
}
|
|
46410
46496
|
}
|
|
46411
46497
|
return document;
|
|
@@ -46442,7 +46528,7 @@ A rollback loses changes made after the move.
|
|
|
46442
46528
|
}
|
|
46443
46529
|
} catch (error) {
|
|
46444
46530
|
result.noteFailures.push({ path: path5, error });
|
|
46445
|
-
|
|
46531
|
+
log10(options, "warn", "Could not write settings move note", {
|
|
46446
46532
|
path: path5,
|
|
46447
46533
|
error
|
|
46448
46534
|
});
|
|
@@ -46486,7 +46572,7 @@ ${JSON.stringify(document, null, 2)}
|
|
|
46486
46572
|
staged = false;
|
|
46487
46573
|
} catch (error) {
|
|
46488
46574
|
result.postPublishFailures.push({ step: "temp-unlink", error });
|
|
46489
|
-
|
|
46575
|
+
log10(options, "warn", "Settings move temp cleanup failed", { temp, error });
|
|
46490
46576
|
}
|
|
46491
46577
|
if (process.platform !== "win32") {
|
|
46492
46578
|
try {
|
|
@@ -46498,7 +46584,7 @@ ${JSON.stringify(document, null, 2)}
|
|
|
46498
46584
|
}
|
|
46499
46585
|
} catch (error) {
|
|
46500
46586
|
result.postPublishFailures.push({ step: "directory-sync", error });
|
|
46501
|
-
|
|
46587
|
+
log10(options, "warn", "Settings move directory sync failed", {
|
|
46502
46588
|
target,
|
|
46503
46589
|
error
|
|
46504
46590
|
});
|
|
@@ -46607,7 +46693,7 @@ async function moveSettingsOnce(options) {
|
|
|
46607
46693
|
if (settled.outcome === "moved") {
|
|
46608
46694
|
settled.postPublishFailures.push({ step: "lock-release", error });
|
|
46609
46695
|
}
|
|
46610
|
-
|
|
46696
|
+
log10(options, "warn", "Settings move lock release failed", { error });
|
|
46611
46697
|
return settled;
|
|
46612
46698
|
}
|
|
46613
46699
|
} catch (cause) {
|
|
@@ -47044,7 +47130,7 @@ function getUserConfigPath() {
|
|
|
47044
47130
|
function getProjectConfigPath(directory) {
|
|
47045
47131
|
return join35(directory, ".opencode", "antigravity.json");
|
|
47046
47132
|
}
|
|
47047
|
-
function loadConfigFile(path5,
|
|
47133
|
+
function loadConfigFile(path5, log19) {
|
|
47048
47134
|
try {
|
|
47049
47135
|
if (!fs6.existsSync(path5)) {
|
|
47050
47136
|
return null;
|
|
@@ -47053,7 +47139,7 @@ function loadConfigFile(path5, log18) {
|
|
|
47053
47139
|
const rawConfig = JSON.parse(content);
|
|
47054
47140
|
const result = AntigravityConfigSchema.partial().safeParse(rawConfig);
|
|
47055
47141
|
if (!result.success) {
|
|
47056
|
-
|
|
47142
|
+
log19.warn("Config validation error", {
|
|
47057
47143
|
path: path5,
|
|
47058
47144
|
issues: result.error.issues.map((i) => `${i.path.join(".")}: ${i.message}`).join(", ")
|
|
47059
47145
|
});
|
|
@@ -47062,9 +47148,9 @@ function loadConfigFile(path5, log18) {
|
|
|
47062
47148
|
return result.data;
|
|
47063
47149
|
} catch (error) {
|
|
47064
47150
|
if (error instanceof SyntaxError) {
|
|
47065
|
-
|
|
47151
|
+
log19.warn("Invalid JSON in config file", { path: path5, error: error.message });
|
|
47066
47152
|
} else {
|
|
47067
|
-
|
|
47153
|
+
log19.warn("Failed to load config file", { path: path5, error: String(error) });
|
|
47068
47154
|
}
|
|
47069
47155
|
return null;
|
|
47070
47156
|
}
|
|
@@ -47083,15 +47169,15 @@ function mergeConfigs(base, override) {
|
|
|
47083
47169
|
function loadConfig(directory) {
|
|
47084
47170
|
return loadConfigWithLogger(directory, legacyLog);
|
|
47085
47171
|
}
|
|
47086
|
-
function loadConfigWithLogger(directory,
|
|
47172
|
+
function loadConfigWithLogger(directory, log19) {
|
|
47087
47173
|
let config = structuredClone(DEFAULT_CONFIG);
|
|
47088
47174
|
const userConfigPath = getUserConfigPath();
|
|
47089
|
-
const userConfig = loadConfigFile(userConfigPath,
|
|
47175
|
+
const userConfig = loadConfigFile(userConfigPath, log19);
|
|
47090
47176
|
if (userConfig) {
|
|
47091
47177
|
config = mergeConfigs(config, userConfig);
|
|
47092
47178
|
}
|
|
47093
47179
|
const projectConfigPath = getProjectConfigPath(directory);
|
|
47094
|
-
const projectConfig = loadConfigFile(projectConfigPath,
|
|
47180
|
+
const projectConfig = loadConfigFile(projectConfigPath, log19);
|
|
47095
47181
|
if (projectConfig) {
|
|
47096
47182
|
config = mergeConfigs(config, projectConfig);
|
|
47097
47183
|
}
|
|
@@ -47605,7 +47691,7 @@ async function defaultFence2() {
|
|
|
47605
47691
|
return (await versionFenceOpen({ currentVersion })).open;
|
|
47606
47692
|
}
|
|
47607
47693
|
function createSettingsRuntime(options) {
|
|
47608
|
-
const { file, legacyUserFile, log:
|
|
47694
|
+
const { file, legacyUserFile, log: log19 } = options;
|
|
47609
47695
|
const open14 = options.open ?? openSettings;
|
|
47610
47696
|
const store = options.protection ?? createProtectionStore2();
|
|
47611
47697
|
const reportPath = options.moveReportPath ?? defaultMoveReportPath();
|
|
@@ -47620,7 +47706,7 @@ function createSettingsRuntime(options) {
|
|
|
47620
47706
|
const enqueue = (step) => {
|
|
47621
47707
|
const run = queue2.then(step);
|
|
47622
47708
|
queue2 = run.catch(
|
|
47623
|
-
(error) =>
|
|
47709
|
+
(error) => log19.warn("Settings refresh failed", {
|
|
47624
47710
|
error: error instanceof Error ? error.name : "unknown"
|
|
47625
47711
|
})
|
|
47626
47712
|
);
|
|
@@ -47653,7 +47739,7 @@ function createSettingsRuntime(options) {
|
|
|
47653
47739
|
await store.save(file, next);
|
|
47654
47740
|
persisted = next;
|
|
47655
47741
|
} catch (error) {
|
|
47656
|
-
|
|
47742
|
+
log19.warn("Could not save the last applied protection settings", {
|
|
47657
47743
|
error: error instanceof Error ? error.name : "unknown"
|
|
47658
47744
|
});
|
|
47659
47745
|
}
|
|
@@ -47723,7 +47809,7 @@ function createSettingsRuntime(options) {
|
|
|
47723
47809
|
if (mode === "shared" || disposed) return;
|
|
47724
47810
|
handle = open14(ANTIGRAVITY_SETTINGS, {
|
|
47725
47811
|
file,
|
|
47726
|
-
log:
|
|
47812
|
+
log: log19,
|
|
47727
47813
|
separateInstall: false,
|
|
47728
47814
|
createMissing: true,
|
|
47729
47815
|
legacyProject: (project2) => ({
|
|
@@ -47761,7 +47847,7 @@ function createSettingsRuntime(options) {
|
|
|
47761
47847
|
legacyUserFile,
|
|
47762
47848
|
floorKeys: options.floorKeys ?? (async () => null),
|
|
47763
47849
|
fence: options.fence ?? defaultFence2,
|
|
47764
|
-
log:
|
|
47850
|
+
log: log19,
|
|
47765
47851
|
...options.move ? { move: options.move } : {}
|
|
47766
47852
|
});
|
|
47767
47853
|
} catch (cause) {
|
|
@@ -47780,7 +47866,7 @@ function createSettingsRuntime(options) {
|
|
|
47780
47866
|
unmapped: result.unmapped
|
|
47781
47867
|
});
|
|
47782
47868
|
} catch (error) {
|
|
47783
|
-
|
|
47869
|
+
log19.warn("Could not save the settings move report", {
|
|
47784
47870
|
error: error instanceof Error ? error.name : "unknown"
|
|
47785
47871
|
});
|
|
47786
47872
|
}
|
|
@@ -47793,14 +47879,14 @@ function createSettingsRuntime(options) {
|
|
|
47793
47879
|
return;
|
|
47794
47880
|
case "fence-closed":
|
|
47795
47881
|
if (!reportedFence)
|
|
47796
|
-
|
|
47882
|
+
log19.info(
|
|
47797
47883
|
"Settings stay in antigravity.json while an older antigravity-auth runs"
|
|
47798
47884
|
);
|
|
47799
47885
|
reportedFence = true;
|
|
47800
47886
|
break;
|
|
47801
47887
|
case "failed":
|
|
47802
47888
|
if (!reportedFailure)
|
|
47803
|
-
|
|
47889
|
+
log19.warn("The settings move failed; it is retried", {
|
|
47804
47890
|
error: result.cause instanceof Error ? result.cause.name : "unknown"
|
|
47805
47891
|
});
|
|
47806
47892
|
reportedFailure = true;
|
|
@@ -49117,11 +49203,15 @@ init_dist();
|
|
|
49117
49203
|
// src/plugin/config/models.ts
|
|
49118
49204
|
function getOpencode1ModelDefinitions() {
|
|
49119
49205
|
const models = { ...OPENCODE_MODEL_DEFINITIONS };
|
|
49120
|
-
const
|
|
49121
|
-
|
|
49122
|
-
|
|
49206
|
+
for (const id of [
|
|
49207
|
+
"antigravity-gemini-4-hydrogen",
|
|
49208
|
+
"antigravity-gemini-4-neon"
|
|
49209
|
+
]) {
|
|
49210
|
+
const model = models[id];
|
|
49211
|
+
if (!model) continue;
|
|
49212
|
+
const variants = { ...model.variants };
|
|
49123
49213
|
delete variants.xhigh;
|
|
49124
|
-
models[
|
|
49214
|
+
models[id] = { ...model, variants };
|
|
49125
49215
|
}
|
|
49126
49216
|
return models;
|
|
49127
49217
|
}
|
|
@@ -50164,10 +50254,10 @@ function toV1AuthCallbackResult(result) {
|
|
|
50164
50254
|
};
|
|
50165
50255
|
}
|
|
50166
50256
|
var MAX_OAUTH_ACCOUNTS = 10;
|
|
50167
|
-
var
|
|
50168
|
-
async function reportPersistenceFailure(error, client,
|
|
50257
|
+
var log11 = createLogger4("oauth-methods");
|
|
50258
|
+
async function reportPersistenceFailure(error, client, log19) {
|
|
50169
50259
|
const message = error instanceof AccountStorageUnreadableError ? `Account storage at ${error.details.path} is unreadable (${error.details.reason}: ${error.details.detail}).${error.details.backupPath ? ` A backup was written to ${error.details.backupPath}. Repair or remove the existing file before retrying.` : " A backup could not be written; repair or remove the existing file before retrying."}` : error instanceof Error ? error.message : String(error);
|
|
50170
|
-
|
|
50260
|
+
log19.error("OAuth login persistence failed; aborting login", {
|
|
50171
50261
|
error: message
|
|
50172
50262
|
});
|
|
50173
50263
|
try {
|
|
@@ -51004,7 +51094,7 @@ ${verifyUrl}
|
|
|
51004
51094
|
}
|
|
51005
51095
|
});
|
|
51006
51096
|
} catch (storeError) {
|
|
51007
|
-
|
|
51097
|
+
log11.error(
|
|
51008
51098
|
"Failed to update stored Antigravity OAuth credentials",
|
|
51009
51099
|
{ error: String(storeError) }
|
|
51010
51100
|
);
|
|
@@ -51029,7 +51119,7 @@ ${verifyUrl}
|
|
|
51029
51119
|
}
|
|
51030
51120
|
});
|
|
51031
51121
|
} catch (storeError) {
|
|
51032
|
-
|
|
51122
|
+
log11.error(
|
|
51033
51123
|
"Failed to clear stored Antigravity OAuth credentials",
|
|
51034
51124
|
{ error: String(storeError) }
|
|
51035
51125
|
);
|
|
@@ -51070,7 +51160,7 @@ Re-authenticating ${refreshEmail || "account"}...
|
|
|
51070
51160
|
}
|
|
51071
51161
|
});
|
|
51072
51162
|
} catch (storeError) {
|
|
51073
|
-
|
|
51163
|
+
log11.error(
|
|
51074
51164
|
"Failed to clear stored Antigravity OAuth credentials",
|
|
51075
51165
|
{ error: String(storeError) }
|
|
51076
51166
|
);
|
|
@@ -51409,7 +51499,7 @@ ${authorization2.url}
|
|
|
51409
51499
|
return await reportPersistenceFailure(
|
|
51410
51500
|
persistError,
|
|
51411
51501
|
client,
|
|
51412
|
-
|
|
51502
|
+
log11
|
|
51413
51503
|
);
|
|
51414
51504
|
}
|
|
51415
51505
|
const newTotal = existingCount + 1;
|
|
@@ -51453,7 +51543,7 @@ ${authorization2.url}
|
|
|
51453
51543
|
try {
|
|
51454
51544
|
await persistAccountPool2([result], false);
|
|
51455
51545
|
} catch (persistError) {
|
|
51456
|
-
return await reportPersistenceFailure(persistError, client,
|
|
51546
|
+
return await reportPersistenceFailure(persistError, client, log11);
|
|
51457
51547
|
}
|
|
51458
51548
|
const newTotal = existingCount + 1;
|
|
51459
51549
|
const toastMessage = existingCount > 0 ? `Added account${result.email ? ` (${result.email})` : ""} - ${newTotal} total` : `Authenticated${result.email ? ` (${result.email})` : ""}`;
|
|
@@ -51617,7 +51707,7 @@ init_logger4();
|
|
|
51617
51707
|
|
|
51618
51708
|
// src/plugin/refresh-queue.ts
|
|
51619
51709
|
init_logger4();
|
|
51620
|
-
var
|
|
51710
|
+
var log12 = createLogger4("refresh-queue");
|
|
51621
51711
|
var DEFAULT_PROACTIVE_REFRESH_CONFIG = {
|
|
51622
51712
|
enabled: true,
|
|
51623
51713
|
bufferSeconds: 1800,
|
|
@@ -51657,7 +51747,7 @@ var ProactiveRefreshQueue = class {
|
|
|
51657
51747
|
"ProactiveRefreshQueue needs a host client or explicit dependencies"
|
|
51658
51748
|
);
|
|
51659
51749
|
}
|
|
51660
|
-
this.log =
|
|
51750
|
+
this.log = log12;
|
|
51661
51751
|
this.refresh = (auth) => refreshAccessToken(auth, client, providerId);
|
|
51662
51752
|
}
|
|
51663
51753
|
this.config = {
|
|
@@ -53628,8 +53718,8 @@ function createSessionRecoveryHook(ctx, config) {
|
|
|
53628
53718
|
if (!sessionID) return false;
|
|
53629
53719
|
let assistantMsgID = info.id;
|
|
53630
53720
|
let msgs;
|
|
53631
|
-
const
|
|
53632
|
-
|
|
53721
|
+
const log19 = createLogger4("session-recovery");
|
|
53722
|
+
log19.debug("Recovery attempt started", {
|
|
53633
53723
|
errorType,
|
|
53634
53724
|
sessionID,
|
|
53635
53725
|
providedMsgID: assistantMsgID ?? "none"
|
|
@@ -53649,7 +53739,7 @@ function createSessionRecoveryHook(ctx, config) {
|
|
|
53649
53739
|
const m = msgs[i];
|
|
53650
53740
|
if (m && m.info?.role === "assistant" && m.info?.id) {
|
|
53651
53741
|
assistantMsgID = m.info.id;
|
|
53652
|
-
|
|
53742
|
+
log19.debug("Found assistant message ID from session messages", {
|
|
53653
53743
|
msgID: assistantMsgID,
|
|
53654
53744
|
msgIndex: i
|
|
53655
53745
|
});
|
|
@@ -53658,7 +53748,7 @@ function createSessionRecoveryHook(ctx, config) {
|
|
|
53658
53748
|
}
|
|
53659
53749
|
}
|
|
53660
53750
|
if (!assistantMsgID) {
|
|
53661
|
-
|
|
53751
|
+
log19.debug("No assistant message ID found, cannot recover");
|
|
53662
53752
|
return false;
|
|
53663
53753
|
}
|
|
53664
53754
|
if (processingErrors.has(assistantMsgID)) return false;
|
|
@@ -53702,7 +53792,7 @@ function createSessionRecoveryHook(ctx, config) {
|
|
|
53702
53792
|
}
|
|
53703
53793
|
return success;
|
|
53704
53794
|
} catch (err) {
|
|
53705
|
-
|
|
53795
|
+
log19.error("Recovery failed", { error: String(err) });
|
|
53706
53796
|
return false;
|
|
53707
53797
|
} finally {
|
|
53708
53798
|
processingErrors.delete(assistantMsgID);
|
|
@@ -53722,7 +53812,7 @@ function createSessionRecoveryHook(ctx, config) {
|
|
|
53722
53812
|
// src/plugin/request-helpers.ts
|
|
53723
53813
|
init_dist();
|
|
53724
53814
|
init_logger4();
|
|
53725
|
-
var
|
|
53815
|
+
var log13 = createLogger4("request-helpers");
|
|
53726
53816
|
var ANTIGRAVITY_PREVIEW_LINK = "https://goo.gle/enable-preview-features";
|
|
53727
53817
|
function appendDescriptionHint(schema, hint) {
|
|
53728
53818
|
if (!schema || typeof schema !== "object") {
|
|
@@ -54147,7 +54237,7 @@ function filterContentArray(contentArray, sessionId, getCachedSignatureFn, isCla
|
|
|
54147
54237
|
}
|
|
54148
54238
|
const existingSignature = item.signature || item.thoughtSignature;
|
|
54149
54239
|
const signatureInfo = existingSignature ? `foreign signature (${String(existingSignature).length} chars)` : "no signature";
|
|
54150
|
-
|
|
54240
|
+
log13.debug(
|
|
54151
54241
|
`Injecting plain text sentinel for last-message thinking block with ${signatureInfo}`
|
|
54152
54242
|
);
|
|
54153
54243
|
const sentinel2 = { text: "." };
|
|
@@ -54659,7 +54749,7 @@ function recursivelyParseJsonStrings(obj, skipParseKeys = SKIP_PARSE_KEYS, curre
|
|
|
54659
54749
|
if (lastBracket > 0) {
|
|
54660
54750
|
const cleaned = stripped.slice(0, lastBracket + 1);
|
|
54661
54751
|
const parsed = JSON.parse(cleaned);
|
|
54662
|
-
|
|
54752
|
+
log13.debug("Auto-corrected malformed JSON array", {
|
|
54663
54753
|
truncatedChars: stripped.length - cleaned.length
|
|
54664
54754
|
});
|
|
54665
54755
|
return recursivelyParseJsonStrings(parsed);
|
|
@@ -54673,7 +54763,7 @@ function recursivelyParseJsonStrings(obj, skipParseKeys = SKIP_PARSE_KEYS, curre
|
|
|
54673
54763
|
if (lastBrace > 0) {
|
|
54674
54764
|
const cleaned = stripped.slice(0, lastBrace + 1);
|
|
54675
54765
|
const parsed = JSON.parse(cleaned);
|
|
54676
|
-
|
|
54766
|
+
log13.debug("Auto-corrected malformed JSON object", {
|
|
54677
54767
|
truncatedChars: stripped.length - cleaned.length
|
|
54678
54768
|
});
|
|
54679
54769
|
return recursivelyParseJsonStrings(parsed);
|
|
@@ -54773,7 +54863,7 @@ function fixToolResponseGrouping(contents) {
|
|
|
54773
54863
|
if (orphanResp.functionResponse.name === "unknown_function" && expectedName) {
|
|
54774
54864
|
orphanResp.functionResponse.name = expectedName;
|
|
54775
54865
|
}
|
|
54776
|
-
|
|
54866
|
+
log13.debug("Auto-repaired tool ID mismatch", {
|
|
54777
54867
|
mappedFrom: matchedId,
|
|
54778
54868
|
mappedTo: expectedId,
|
|
54779
54869
|
functionName: expectedName
|
|
@@ -54793,7 +54883,7 @@ function fixToolResponseGrouping(contents) {
|
|
|
54793
54883
|
id: expectedId
|
|
54794
54884
|
}
|
|
54795
54885
|
};
|
|
54796
|
-
|
|
54886
|
+
log13.debug("Created placeholder response for missing tool", {
|
|
54797
54887
|
id: expectedId,
|
|
54798
54888
|
name: expectedName
|
|
54799
54889
|
});
|
|
@@ -55111,7 +55201,7 @@ function applyToolPairingFixes(payload, isClaude) {
|
|
|
55111
55201
|
);
|
|
55112
55202
|
payload.contents = fixToolResponseGrouping(contentsWithMatchedIds);
|
|
55113
55203
|
contentsFixed = true;
|
|
55114
|
-
|
|
55204
|
+
log13.debug("Applied tool pairing fixes to contents[]", {
|
|
55115
55205
|
originalLength: payload.contents.length
|
|
55116
55206
|
});
|
|
55117
55207
|
}
|
|
@@ -55120,7 +55210,7 @@ function applyToolPairingFixes(payload, isClaude) {
|
|
|
55120
55210
|
payload.messages
|
|
55121
55211
|
);
|
|
55122
55212
|
messagesFixed = true;
|
|
55123
|
-
|
|
55213
|
+
log13.debug("Applied tool pairing fixes to messages[]", {
|
|
55124
55214
|
originalLength: payload.messages.length
|
|
55125
55215
|
});
|
|
55126
55216
|
}
|
|
@@ -55719,7 +55809,7 @@ init_dist();
|
|
|
55719
55809
|
init_dist();
|
|
55720
55810
|
|
|
55721
55811
|
// src/plugin/request.ts
|
|
55722
|
-
var
|
|
55812
|
+
var log14 = createLogger4("request");
|
|
55723
55813
|
var PLUGIN_SESSION_ID = `-${crypto2.randomUUID()}`;
|
|
55724
55814
|
var DEFAULT_AGY_REQUEST_SESSION = createAgyRequestSessionContext();
|
|
55725
55815
|
var sessionDisplayedThinkingHashes = /* @__PURE__ */ new Set();
|
|
@@ -56542,7 +56632,7 @@ var openCode1WireLocation = {
|
|
|
56542
56632
|
logAntigravityDebugResponse: (context, response, meta) => logAntigravityDebugResponse(context, response, meta),
|
|
56543
56633
|
logCacheStats: (model, cacheRead, cacheWrite, totalInput) => logCacheStats(model, cacheRead, cacheWrite, totalInput)
|
|
56544
56634
|
},
|
|
56545
|
-
logger:
|
|
56635
|
+
logger: log14,
|
|
56546
56636
|
sessionFingerprint: () => getSessionFingerprint(),
|
|
56547
56637
|
displayedThinkingHashes: sessionDisplayedThinkingHashes,
|
|
56548
56638
|
cacheStats: { last: null }
|
|
@@ -56601,9 +56691,9 @@ function prepareAntigravityRequestIn(wire, input2, init, accessToken, projectId,
|
|
|
56601
56691
|
}
|
|
56602
56692
|
const [, rawModel = "", rawAction = ""] = match;
|
|
56603
56693
|
const requestedModel = rawModel;
|
|
56604
|
-
const
|
|
56694
|
+
const geminiTier = supportsGeminiXHigh(rawModel) ? options?.variant?.thinkingLevel : void 0;
|
|
56605
56695
|
const resolved = resolveAntigravityModel(
|
|
56606
|
-
|
|
56696
|
+
geminiTier ? `${rawModel.replace(/-(low|medium|high|xhigh)$/i, "")}-${geminiTier}` : rawModel
|
|
56607
56697
|
);
|
|
56608
56698
|
let effectiveModel = resolved.actualModel;
|
|
56609
56699
|
const streaming = rawAction === STREAM_ACTION;
|
|
@@ -56774,9 +56864,9 @@ function prepareAntigravityRequestIn(wire, input2, init, accessToken, projectId,
|
|
|
56774
56864
|
`[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)}`
|
|
56775
56865
|
);
|
|
56776
56866
|
delete requestPayload.providerOptions;
|
|
56777
|
-
if (variantConfig?.thinkingLevel && (isGemini3 || isGeminiArgonModel(effectiveModel) || isGeminiCarbonModel(effectiveModel) ||
|
|
56867
|
+
if (variantConfig?.thinkingLevel && (isGemini3 || isGeminiArgonModel(effectiveModel) || isGeminiCarbonModel(effectiveModel) || supportsGeminiXHigh(effectiveModel) || getAgyNativeModel(effectiveModel)?.supportsAdaptiveThinking)) {
|
|
56778
56868
|
const variantModelBase = rawModel.replace(/-preview-customtools$/i, "").replace(/-preview$/i, "").replace(
|
|
56779
|
-
|
|
56869
|
+
supportsGeminiXHigh(effectiveModel) ? /-(low|medium|high|xhigh)$/i : /-(minimal|low|medium|high)$/i,
|
|
56780
56870
|
""
|
|
56781
56871
|
);
|
|
56782
56872
|
const variantResolved = resolveAntigravityModel(
|
|
@@ -57875,7 +57965,7 @@ function publishResponse(dispatch) {
|
|
|
57875
57965
|
|
|
57876
57966
|
// src/plugin/auth-loader.ts
|
|
57877
57967
|
init_storage();
|
|
57878
|
-
var
|
|
57968
|
+
var log15 = createLogger4("auth-loader");
|
|
57879
57969
|
var failureLog = createLogger("auth-loader");
|
|
57880
57970
|
function loaderFailure(error) {
|
|
57881
57971
|
if (error instanceof RuntimeLayoutRefusal) return error;
|
|
@@ -58047,7 +58137,7 @@ function createAuthLoader({
|
|
|
58047
58137
|
});
|
|
58048
58138
|
refreshQueue = deps.createStoreRefreshQueue(
|
|
58049
58139
|
{
|
|
58050
|
-
logger:
|
|
58140
|
+
logger: log15,
|
|
58051
58141
|
refreshToken: (_auth, account) => credentials.refresh(account)
|
|
58052
58142
|
},
|
|
58053
58143
|
queueConfig
|
|
@@ -58155,7 +58245,7 @@ function createAuthLoader({
|
|
|
58155
58245
|
}
|
|
58156
58246
|
if (opening.status === "ready") {
|
|
58157
58247
|
if (!isOAuthAuth(auth) && !readAuthority) {
|
|
58158
|
-
|
|
58248
|
+
log15.warn(
|
|
58159
58249
|
"The host holds no Antigravity sign-in; the account store is left untouched"
|
|
58160
58250
|
);
|
|
58161
58251
|
return {};
|
|
@@ -58214,12 +58304,12 @@ function createAuthLoader({
|
|
|
58214
58304
|
expires: auth.expires ?? 0
|
|
58215
58305
|
}
|
|
58216
58306
|
});
|
|
58217
|
-
|
|
58307
|
+
log15.info("Restored Antigravity OAuth auth from account storage", {
|
|
58218
58308
|
reason: drift.reason,
|
|
58219
58309
|
email: drift.account.email
|
|
58220
58310
|
});
|
|
58221
58311
|
} catch (error) {
|
|
58222
|
-
|
|
58312
|
+
log15.warn(
|
|
58223
58313
|
"Failed to restore Antigravity OAuth auth from account storage",
|
|
58224
58314
|
{ error: String(error) }
|
|
58225
58315
|
);
|
|
@@ -61055,7 +61145,7 @@ async function withRoutingWaitReports(cancellation, run) {
|
|
|
61055
61145
|
finish(cancellation.aborted ? "cancelled" : "abandoned");
|
|
61056
61146
|
}
|
|
61057
61147
|
}
|
|
61058
|
-
function createLocalQuotaRefresh(accountManager, quotaManager,
|
|
61148
|
+
function createLocalQuotaRefresh(accountManager, quotaManager, log19) {
|
|
61059
61149
|
return async function refreshQuotaAfterSuccess(account, intervalMinutes, signal) {
|
|
61060
61150
|
if (intervalMinutes <= 0) return;
|
|
61061
61151
|
const accountIndex = accountManager.getAccounts().indexOf(account);
|
|
@@ -61086,7 +61176,7 @@ function createLocalQuotaRefresh(accountManager, quotaManager, log18) {
|
|
|
61086
61176
|
accountManager.requestSaveToDisk();
|
|
61087
61177
|
}
|
|
61088
61178
|
} catch (err) {
|
|
61089
|
-
|
|
61179
|
+
log19.debug(
|
|
61090
61180
|
`quota-refresh-failed ${singleAccount ? quotaManager.hashedLogLabel("account", singleAccount) : `idx-${accountIndex}`}`,
|
|
61091
61181
|
{ error: String(err) }
|
|
61092
61182
|
);
|
|
@@ -61105,7 +61195,7 @@ function createRequestExecutor(deps) {
|
|
|
61105
61195
|
wire,
|
|
61106
61196
|
debug,
|
|
61107
61197
|
dump,
|
|
61108
|
-
logger:
|
|
61198
|
+
logger: log19,
|
|
61109
61199
|
trackers,
|
|
61110
61200
|
classifyAccessError,
|
|
61111
61201
|
notify,
|
|
@@ -61156,7 +61246,7 @@ function createRequestExecutor(deps) {
|
|
|
61156
61246
|
const entries = unavailableModels.get(key2);
|
|
61157
61247
|
const entry = entries?.get(model);
|
|
61158
61248
|
if (!entries || !entry) return;
|
|
61159
|
-
|
|
61249
|
+
log19.debug("model-unavailable-memory-drop", {
|
|
61160
61250
|
account: entry.label,
|
|
61161
61251
|
model,
|
|
61162
61252
|
cause
|
|
@@ -61196,7 +61286,7 @@ function createRequestExecutor(deps) {
|
|
|
61196
61286
|
...entry,
|
|
61197
61287
|
recordedAt: modelAvailabilityNow()
|
|
61198
61288
|
});
|
|
61199
|
-
|
|
61289
|
+
log19.debug("model-unavailable-memory-record", {
|
|
61200
61290
|
account: entry.label,
|
|
61201
61291
|
model
|
|
61202
61292
|
});
|
|
@@ -61212,7 +61302,7 @@ function createRequestExecutor(deps) {
|
|
|
61212
61302
|
const reportVault401 = (admission, status) => {
|
|
61213
61303
|
if (!admission || status !== 401) return;
|
|
61214
61304
|
void Promise.resolve().then(() => admission.report401(status)).catch((error) => {
|
|
61215
|
-
|
|
61305
|
+
log19.debug("send-admission-401-report-failed", { error: String(error) });
|
|
61216
61306
|
});
|
|
61217
61307
|
};
|
|
61218
61308
|
const reportRouting2 = (sessionId, entry) => {
|
|
@@ -61220,7 +61310,7 @@ function createRequestExecutor(deps) {
|
|
|
61220
61310
|
try {
|
|
61221
61311
|
onRouting(sessionId, entry);
|
|
61222
61312
|
} catch (error) {
|
|
61223
|
-
|
|
61313
|
+
log19.debug("routing-report-failed", { sessionId, error: String(error) });
|
|
61224
61314
|
}
|
|
61225
61315
|
};
|
|
61226
61316
|
async function execute(input2, init, options, selectedCredentials, selectedProjectIds, deadline, waitPolicy, waits) {
|
|
@@ -61404,7 +61494,7 @@ function createRequestExecutor(deps) {
|
|
|
61404
61494
|
const quietMode = config.quiet_mode;
|
|
61405
61495
|
const toastScope = config.toast_scope;
|
|
61406
61496
|
const showToast = async (message, variant2) => {
|
|
61407
|
-
|
|
61497
|
+
log19.debug("toast", {
|
|
61408
61498
|
message,
|
|
61409
61499
|
variant: variant2,
|
|
61410
61500
|
isChildSession: isChildRequest,
|
|
@@ -61413,7 +61503,7 @@ function createRequestExecutor(deps) {
|
|
|
61413
61503
|
if (quietMode) return;
|
|
61414
61504
|
if (abortSignal?.aborted) return;
|
|
61415
61505
|
if (toastScope === "root_only" && isChildRequest) {
|
|
61416
|
-
|
|
61506
|
+
log19.debug("toast-suppressed-child-session", {
|
|
61417
61507
|
message,
|
|
61418
61508
|
variant: variant2,
|
|
61419
61509
|
parentID: requestSessionIdentity.parentSessionId
|
|
@@ -61456,7 +61546,7 @@ function createRequestExecutor(deps) {
|
|
|
61456
61546
|
);
|
|
61457
61547
|
const routingRefusalResponse = (refused2) => {
|
|
61458
61548
|
const { code: code2, routingCode, reason } = refused2;
|
|
61459
|
-
|
|
61549
|
+
log19.warn("routing-refused", {
|
|
61460
61550
|
code: code2,
|
|
61461
61551
|
...routingCode === void 0 ? {} : { routingCode },
|
|
61462
61552
|
...reason === void 0 ? {} : { reason }
|
|
@@ -61533,7 +61623,7 @@ function createRequestExecutor(deps) {
|
|
|
61533
61623
|
pushDebug(
|
|
61534
61624
|
`model-access: all ${serviceable.length} serviceable account(s) excluded`
|
|
61535
61625
|
);
|
|
61536
|
-
|
|
61626
|
+
log19.warn("model-access-all-excluded", {
|
|
61537
61627
|
family,
|
|
61538
61628
|
model,
|
|
61539
61629
|
accounts: serviceable.length
|
|
@@ -61613,7 +61703,7 @@ function createRequestExecutor(deps) {
|
|
|
61613
61703
|
});
|
|
61614
61704
|
} catch (error) {
|
|
61615
61705
|
if (error instanceof AntigravityKillswitchError) {
|
|
61616
|
-
|
|
61706
|
+
log19.warn("killswitch-all-excluded", {
|
|
61617
61707
|
family,
|
|
61618
61708
|
model,
|
|
61619
61709
|
threshold: error.thresholdPercent,
|
|
@@ -61639,7 +61729,7 @@ function createRequestExecutor(deps) {
|
|
|
61639
61729
|
pushDebug(
|
|
61640
61730
|
`model-unavailable: all ${candidates.length} eligible account(s) skipped`
|
|
61641
61731
|
);
|
|
61642
|
-
|
|
61732
|
+
log19.warn("model-unavailable-all-accounts", {
|
|
61643
61733
|
family,
|
|
61644
61734
|
model,
|
|
61645
61735
|
accounts: candidates.length
|
|
@@ -61962,7 +62052,7 @@ function createRequestExecutor(deps) {
|
|
|
61962
62052
|
await deadline.wait(() => credentials.saveToDisk());
|
|
61963
62053
|
} catch (error) {
|
|
61964
62054
|
checkAborted();
|
|
61965
|
-
|
|
62055
|
+
log19.error("Failed to persist project context", {
|
|
61966
62056
|
error: String(error)
|
|
61967
62057
|
});
|
|
61968
62058
|
}
|
|
@@ -62019,7 +62109,7 @@ function createRequestExecutor(deps) {
|
|
|
62019
62109
|
await deadline.wait(() => credentials.saveToDisk());
|
|
62020
62110
|
} catch (error) {
|
|
62021
62111
|
checkAborted();
|
|
62022
|
-
|
|
62112
|
+
log19.error("Failed to persist refreshed auth", {
|
|
62023
62113
|
error: String(error)
|
|
62024
62114
|
});
|
|
62025
62115
|
}
|
|
@@ -62028,14 +62118,14 @@ function createRequestExecutor(deps) {
|
|
|
62028
62118
|
if (credentials.isInvalidGrant(error)) {
|
|
62029
62119
|
const removed = credentials.removeAccount(account);
|
|
62030
62120
|
if (removed) {
|
|
62031
|
-
|
|
62121
|
+
log19.warn(
|
|
62032
62122
|
"Removed revoked account from pool - reauthenticate via `opencode auth login`"
|
|
62033
62123
|
);
|
|
62034
62124
|
try {
|
|
62035
62125
|
await deadline.wait(() => credentials.saveToDiskReplace());
|
|
62036
62126
|
} catch (persistError) {
|
|
62037
62127
|
checkAborted();
|
|
62038
|
-
|
|
62128
|
+
log19.error("Failed to persist revoked account removal", {
|
|
62039
62129
|
error: String(persistError)
|
|
62040
62130
|
});
|
|
62041
62131
|
}
|
|
@@ -62045,7 +62135,7 @@ function createRequestExecutor(deps) {
|
|
|
62045
62135
|
await deadline.wait(() => credentials.clearStoredAuth());
|
|
62046
62136
|
} catch (storeError) {
|
|
62047
62137
|
checkAborted();
|
|
62048
|
-
|
|
62138
|
+
log19.error(
|
|
62049
62139
|
"Failed to clear stored Antigravity OAuth credentials",
|
|
62050
62140
|
{
|
|
62051
62141
|
error: String(storeError)
|
|
@@ -62115,8 +62205,8 @@ function createRequestExecutor(deps) {
|
|
|
62115
62205
|
const sendPhysical = async (url, sendInit, admission, sendModel, requestKind, onMainTransportFailure) => {
|
|
62116
62206
|
const source = credentials.domain === "local" ? "local" : hasVaultHost2() ? "hosted" : "vault";
|
|
62117
62207
|
const message = `request-send source=${source} model=${sendModel} account=Account ${account.index + 1}`;
|
|
62118
|
-
if (source === "local")
|
|
62119
|
-
else (
|
|
62208
|
+
if (source === "local") log19.info(message);
|
|
62209
|
+
else (log19.hostInfo ?? log19.info)(message);
|
|
62120
62210
|
const attempt = ++physicalSendCount;
|
|
62121
62211
|
const sessionId = requestSessionIdentity.sessionId;
|
|
62122
62212
|
const billing = admission && sessionId && hasVaultRoutingAccessor() ? new VaultBillingAttempt(
|
|
@@ -62495,7 +62585,7 @@ function createRequestExecutor(deps) {
|
|
|
62495
62585
|
);
|
|
62496
62586
|
} catch (error) {
|
|
62497
62587
|
checkAborted();
|
|
62498
|
-
|
|
62588
|
+
log19.debug("send-admission-401-report-failed", {
|
|
62499
62589
|
error: String(error)
|
|
62500
62590
|
});
|
|
62501
62591
|
}
|
|
@@ -62884,7 +62974,7 @@ function createRequestExecutor(deps) {
|
|
|
62884
62974
|
debug.logAntigravityDebugResponse(debugContext, response, {
|
|
62885
62975
|
note
|
|
62886
62976
|
});
|
|
62887
|
-
|
|
62977
|
+
log19.info("model-unavailable", {
|
|
62888
62978
|
accountIndex: account.index,
|
|
62889
62979
|
family,
|
|
62890
62980
|
model,
|
|
@@ -63208,7 +63298,7 @@ function createRequestExecutor(deps) {
|
|
|
63208
63298
|
const originalError = recoveryError.originalError || {
|
|
63209
63299
|
error: { message: "Thinking recovery triggered" }
|
|
63210
63300
|
};
|
|
63211
|
-
|
|
63301
|
+
log19.debug("thinking-recovery-failed", { error: originalError });
|
|
63212
63302
|
const recoveryMessage = "Antigravity could not repair the conversation's thinking blocks. Start a new session.";
|
|
63213
63303
|
return new Response(
|
|
63214
63304
|
JSON.stringify({
|
|
@@ -63313,11 +63403,11 @@ function createRequestExecutor(deps) {
|
|
|
63313
63403
|
cancellation.signal,
|
|
63314
63404
|
deps.preResponseClock
|
|
63315
63405
|
);
|
|
63316
|
-
|
|
63406
|
+
log19.debug("pre-response-start", { limitMs: PRE_RESPONSE_DEADLINE_MS });
|
|
63317
63407
|
const handoff = createAfterHandoff(
|
|
63318
63408
|
advisoryWork,
|
|
63319
63409
|
requestedSignal ? [requestedSignal, shutdown.signal] : [shutdown.signal],
|
|
63320
|
-
() =>
|
|
63410
|
+
() => log19.debug("post-response-advisory-work-failed")
|
|
63321
63411
|
);
|
|
63322
63412
|
const waitPolicy = {};
|
|
63323
63413
|
const selectedCredentials = /* @__PURE__ */ new Set();
|
|
@@ -63347,7 +63437,7 @@ function createRequestExecutor(deps) {
|
|
|
63347
63437
|
).catch((error) => {
|
|
63348
63438
|
cancellation.signal.throwIfAborted();
|
|
63349
63439
|
if (error instanceof PreResponseTimeoutError) {
|
|
63350
|
-
|
|
63440
|
+
log19.debug("pre-response-timeout", { reason: error.reason });
|
|
63351
63441
|
return waitPolicy.refusal?.() ?? preResponseTimeoutResponse();
|
|
63352
63442
|
}
|
|
63353
63443
|
throw error;
|
|
@@ -63479,7 +63569,7 @@ function extractRateLimitBodyInfo(body, status, headers) {
|
|
|
63479
63569
|
|
|
63480
63570
|
// src/plugin/fetch-interceptor.ts
|
|
63481
63571
|
init_vault_request_credentials();
|
|
63482
|
-
var
|
|
63572
|
+
var log16 = createLogger4("fetch-interceptor");
|
|
63483
63573
|
var failureLog2 = createLogger("fetch-interceptor");
|
|
63484
63574
|
function fetchFailure(error, input2, init) {
|
|
63485
63575
|
const signal = init?.signal ?? (input2 instanceof Request ? input2.signal : void 0);
|
|
@@ -63539,14 +63629,14 @@ function openCode1EngineCollaborators(common) {
|
|
|
63539
63629
|
// the engine calls.
|
|
63540
63630
|
debug: debug_exports,
|
|
63541
63631
|
dump: { dumpRequest: dumpGeminiRequest },
|
|
63542
|
-
logger:
|
|
63632
|
+
logger: log16,
|
|
63543
63633
|
classifyAccessError: extractAccountAccessErrorDetails,
|
|
63544
63634
|
notify: (message, variant) => client.tui.showToast({ body: { message, variant } }),
|
|
63545
63635
|
onRouting: common.onRouting ?? ((sessionId, entry) => {
|
|
63546
63636
|
void upsertSidebarActiveRouting(sessionId, entry, {
|
|
63547
63637
|
authoritative: true
|
|
63548
63638
|
}).catch((error) => {
|
|
63549
|
-
|
|
63639
|
+
log16.debug("sidebar-routing-upsert-failed", {
|
|
63550
63640
|
sessionId,
|
|
63551
63641
|
error: String(error)
|
|
63552
63642
|
});
|
|
@@ -63572,7 +63662,7 @@ function createFetchInterceptor(context) {
|
|
|
63572
63662
|
const refreshQuotaAfterSuccess = createLocalQuotaRefresh(
|
|
63573
63663
|
accountManager,
|
|
63574
63664
|
quotaManager,
|
|
63575
|
-
|
|
63665
|
+
log16
|
|
63576
63666
|
);
|
|
63577
63667
|
const executor = createRequestExecutor({
|
|
63578
63668
|
assertAdmission: context.assertAdmission,
|
|
@@ -63727,7 +63817,7 @@ init_logger4();
|
|
|
63727
63817
|
|
|
63728
63818
|
// src/plugin/search.ts
|
|
63729
63819
|
init_logger4();
|
|
63730
|
-
var
|
|
63820
|
+
var log17 = createLogger4("search");
|
|
63731
63821
|
function formatSearchResult(result) {
|
|
63732
63822
|
const lines = [];
|
|
63733
63823
|
lines.push("## Search Results\n");
|
|
@@ -63855,7 +63945,7 @@ ${urlList}`;
|
|
|
63855
63945
|
requestType: "agent"
|
|
63856
63946
|
};
|
|
63857
63947
|
const url = `${ANTIGRAVITY_ENDPOINT}/v1internal:generateContent`;
|
|
63858
|
-
|
|
63948
|
+
log17.debug("Executing search", {
|
|
63859
63949
|
query,
|
|
63860
63950
|
urlCount: urls?.length ?? 0,
|
|
63861
63951
|
thinking
|
|
@@ -63878,7 +63968,7 @@ ${urlList}`;
|
|
|
63878
63968
|
);
|
|
63879
63969
|
if (!response.ok) {
|
|
63880
63970
|
const errorText3 = await response.text();
|
|
63881
|
-
|
|
63971
|
+
log17.debug("Search API error", {
|
|
63882
63972
|
status: response.status,
|
|
63883
63973
|
error: errorText3
|
|
63884
63974
|
});
|
|
@@ -63891,14 +63981,14 @@ ${errorText3}
|
|
|
63891
63981
|
Please try again with a different query.`;
|
|
63892
63982
|
}
|
|
63893
63983
|
const data = await response.json();
|
|
63894
|
-
|
|
63984
|
+
log17.debug("Search response received", { hasResponse: !!data.response });
|
|
63895
63985
|
const result = parseSearchResponse(data);
|
|
63896
63986
|
const formatted = formatSearchResult(result);
|
|
63897
|
-
|
|
63987
|
+
log17.debug("Search response formatted", { resultLength: formatted.length });
|
|
63898
63988
|
return formatted;
|
|
63899
63989
|
} catch (error) {
|
|
63900
63990
|
const message = error instanceof Error ? error.message : String(error);
|
|
63901
|
-
|
|
63991
|
+
log17.debug("Search execution error", { error: message });
|
|
63902
63992
|
return `## Search Error
|
|
63903
63993
|
|
|
63904
63994
|
Failed to execute search: ${message}. Please try again with a different query.`;
|
|
@@ -63906,7 +63996,7 @@ Failed to execute search: ${message}. Please try again with a different query.`;
|
|
|
63906
63996
|
}
|
|
63907
63997
|
|
|
63908
63998
|
// src/plugin/google-search-tool.ts
|
|
63909
|
-
var
|
|
63999
|
+
var log18 = createLogger4("plugin");
|
|
63910
64000
|
function createGoogleSearchTool({
|
|
63911
64001
|
getAuth,
|
|
63912
64002
|
client,
|
|
@@ -63928,7 +64018,7 @@ function createGoogleSearchTool({
|
|
|
63928
64018
|
if (mayStartLocalWork && !await mayStartLocalWork()) {
|
|
63929
64019
|
return "Google Search is not available through local credentials while vault custody is active or unreadable.";
|
|
63930
64020
|
}
|
|
63931
|
-
|
|
64021
|
+
log18.debug("Google Search tool called", {
|
|
63932
64022
|
query: args.query,
|
|
63933
64023
|
urlCount: args.urls?.length ?? 0
|
|
63934
64024
|
});
|