@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/server.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 };
|
|
@@ -33527,10 +33602,10 @@ function errorFile(error) {
|
|
|
33527
33602
|
...typeof stage === "string" && stage ? { stage } : {}
|
|
33528
33603
|
};
|
|
33529
33604
|
}
|
|
33530
|
-
function logCleanupFailure(location,
|
|
33605
|
+
function logCleanupFailure(location, log19, step, error) {
|
|
33531
33606
|
logOnce(
|
|
33532
33607
|
`${location.key}\0cleanup`,
|
|
33533
|
-
() =>
|
|
33608
|
+
() => log19.warn(
|
|
33534
33609
|
"antigravity-auth could not finish removing its old vault files from OpenCode's config folder; it tries again at the next start",
|
|
33535
33610
|
{
|
|
33536
33611
|
configDir: location.configDir,
|
|
@@ -33559,13 +33634,13 @@ function prepareRuntimeLayout(options) {
|
|
|
33559
33634
|
return run;
|
|
33560
33635
|
}
|
|
33561
33636
|
async function decide(location, options) {
|
|
33562
|
-
const
|
|
33637
|
+
const log19 = options.log ?? createLogger4("runtime-layout");
|
|
33563
33638
|
const stateDir = location.stateHomeDir;
|
|
33564
33639
|
const markerPath = join18(stateDir, RUNTIME_LAYOUT_MARKER_FILE);
|
|
33565
33640
|
const files = layoutFiles(location, options.accountFile);
|
|
33566
33641
|
const fence = options.fence ?? defaultFence(options.version);
|
|
33567
33642
|
const stateHome = async () => {
|
|
33568
|
-
await settleVault(location, options, "state-home",
|
|
33643
|
+
await settleVault(location, options, "state-home", log19);
|
|
33569
33644
|
return "state-home";
|
|
33570
33645
|
};
|
|
33571
33646
|
let marker = await readMarker(markerPath, stateDir, files.vault.old);
|
|
@@ -33576,7 +33651,7 @@ async function decide(location, options) {
|
|
|
33576
33651
|
join18(stateDir, RUNTIME_LAYOUT_MANIFEST_FILE)
|
|
33577
33652
|
).catch(() => true);
|
|
33578
33653
|
if (!manifestLeft) {
|
|
33579
|
-
await settleVault(location, options, "state-home",
|
|
33654
|
+
await settleVault(location, options, "state-home", log19);
|
|
33580
33655
|
return stateHome();
|
|
33581
33656
|
}
|
|
33582
33657
|
}
|
|
@@ -33588,7 +33663,7 @@ async function decide(location, options) {
|
|
|
33588
33663
|
RUNTIME_LAYOUT_LOCK_NAME,
|
|
33589
33664
|
markerPath,
|
|
33590
33665
|
options.layoutLockWaitMs ?? LAYOUT_LOCK_WAIT_MS,
|
|
33591
|
-
|
|
33666
|
+
log19
|
|
33592
33667
|
);
|
|
33593
33668
|
} catch (error) {
|
|
33594
33669
|
marker = await readMarker(markerPath, stateDir, files.vault.old);
|
|
@@ -33608,7 +33683,7 @@ async function decide(location, options) {
|
|
|
33608
33683
|
const legacy = async () => {
|
|
33609
33684
|
try {
|
|
33610
33685
|
await lock.assertOwned();
|
|
33611
|
-
await settleVault(location, options, "legacy",
|
|
33686
|
+
await settleVault(location, options, "legacy", log19);
|
|
33612
33687
|
} catch (error) {
|
|
33613
33688
|
throw new RuntimeLayoutRefusal(stateDir, errorClass(error));
|
|
33614
33689
|
}
|
|
@@ -33622,20 +33697,20 @@ async function decide(location, options) {
|
|
|
33622
33697
|
if (!marker.oldFilesRemoved && !aliased)
|
|
33623
33698
|
await finishOldFiles(location, files, markerPath, marker, lock, {
|
|
33624
33699
|
fence,
|
|
33625
|
-
log:
|
|
33700
|
+
log: log19,
|
|
33626
33701
|
steps: options.steps,
|
|
33627
33702
|
oldSignatureCache: options.oldSignatureCacheFile ?? legacySignatureCacheFile()
|
|
33628
33703
|
});
|
|
33629
33704
|
else if (marker.oldFilesRemoved) {
|
|
33630
33705
|
await refuseReappearedFiles(location, files);
|
|
33631
|
-
await removeLeftoverManifest(location, lock, options.steps,
|
|
33706
|
+
await removeLeftoverManifest(location, lock, options.steps, log19);
|
|
33632
33707
|
}
|
|
33633
33708
|
return await stateHome();
|
|
33634
33709
|
}
|
|
33635
33710
|
if (aliased) {
|
|
33636
33711
|
logOnce(
|
|
33637
33712
|
`${location.key}\0aliased`,
|
|
33638
|
-
() =>
|
|
33713
|
+
() => log19.warn(
|
|
33639
33714
|
"antigravity-auth keeps its vault files in OpenCode's config folder: its state folder is that same folder",
|
|
33640
33715
|
{ configDir: location.configDir, stateDir }
|
|
33641
33716
|
)
|
|
@@ -33644,14 +33719,14 @@ async function decide(location, options) {
|
|
|
33644
33719
|
}
|
|
33645
33720
|
const gate = await fence();
|
|
33646
33721
|
if (!gate.open) {
|
|
33647
|
-
logDeferral(location, gate.blockers,
|
|
33722
|
+
logDeferral(location, gate.blockers, log19);
|
|
33648
33723
|
return await legacy();
|
|
33649
33724
|
}
|
|
33650
33725
|
let markerStarted = false;
|
|
33651
33726
|
try {
|
|
33652
33727
|
const outcome = await moveFiles(location, files, markerPath, lock, {
|
|
33653
33728
|
fence,
|
|
33654
|
-
log:
|
|
33729
|
+
log: log19,
|
|
33655
33730
|
steps: options.steps,
|
|
33656
33731
|
destinationPrivate: options.destinationPrivate ?? defaultDestinationPrivate,
|
|
33657
33732
|
oldSignatureCache: options.oldSignatureCacheFile ?? legacySignatureCacheFile(),
|
|
@@ -33660,13 +33735,13 @@ async function decide(location, options) {
|
|
|
33660
33735
|
}
|
|
33661
33736
|
});
|
|
33662
33737
|
if (outcome.kind === "deferred") {
|
|
33663
|
-
logDeferral(location, outcome.blockers,
|
|
33738
|
+
logDeferral(location, outcome.blockers, log19);
|
|
33664
33739
|
return await legacy();
|
|
33665
33740
|
}
|
|
33666
33741
|
if (outcome.kind === "refused") {
|
|
33667
33742
|
logOnce(
|
|
33668
33743
|
`${location.key}\0refused`,
|
|
33669
|
-
() =>
|
|
33744
|
+
() => log19.warn(
|
|
33670
33745
|
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",
|
|
33671
33746
|
{ reason: outcome.reason, paths: outcome.paths, stateDir }
|
|
33672
33747
|
)
|
|
@@ -33674,7 +33749,7 @@ async function decide(location, options) {
|
|
|
33674
33749
|
return await legacy();
|
|
33675
33750
|
}
|
|
33676
33751
|
if (outcome.moved)
|
|
33677
|
-
|
|
33752
|
+
log19.info(
|
|
33678
33753
|
"antigravity-auth moved its vault files out of OpenCode's config folder",
|
|
33679
33754
|
{ from: files.vault.old, to: files.vault.next }
|
|
33680
33755
|
);
|
|
@@ -33685,7 +33760,7 @@ async function decide(location, options) {
|
|
|
33685
33760
|
return await stateHome();
|
|
33686
33761
|
logOnce(
|
|
33687
33762
|
`${location.key}\0failed`,
|
|
33688
|
-
() =>
|
|
33763
|
+
() => log19.warn(
|
|
33689
33764
|
"antigravity-auth's vault files stay in OpenCode's config folder: moving them failed; the move is tried again at the next start",
|
|
33690
33765
|
{
|
|
33691
33766
|
configDir: location.configDir,
|
|
@@ -33734,7 +33809,7 @@ async function prepareAccountStore(options) {
|
|
|
33734
33809
|
if (!await localAccountStoreAuthorized()) return void 0;
|
|
33735
33810
|
const decided = decidedAccountStoreAnchor(location);
|
|
33736
33811
|
if (decided) return decided;
|
|
33737
|
-
const
|
|
33812
|
+
const log19 = options.log ?? createLogger4("runtime-layout");
|
|
33738
33813
|
const runKey = `${location.stateHomeDir}\0${location.key}`;
|
|
33739
33814
|
let run = processState.storeRuns.get(runKey);
|
|
33740
33815
|
if (!run) {
|
|
@@ -33745,12 +33820,12 @@ async function prepareAccountStore(options) {
|
|
|
33745
33820
|
RUNTIME_LAYOUT_LOCK_NAME,
|
|
33746
33821
|
join18(location.stateHomeDir, RUNTIME_LAYOUT_MARKER_FILE),
|
|
33747
33822
|
options.layoutLockWaitMs ?? LAYOUT_LOCK_WAIT_MS,
|
|
33748
|
-
|
|
33823
|
+
log19
|
|
33749
33824
|
);
|
|
33750
33825
|
try {
|
|
33751
33826
|
await lock.assertOwned();
|
|
33752
33827
|
if (!await localAccountStoreAuthorized()) return void 0;
|
|
33753
|
-
return await settleAccountStore(location, options,
|
|
33828
|
+
return await settleAccountStore(location, options, log19);
|
|
33754
33829
|
} finally {
|
|
33755
33830
|
await lock.release();
|
|
33756
33831
|
}
|
|
@@ -33761,20 +33836,20 @@ async function prepareAccountStore(options) {
|
|
|
33761
33836
|
}
|
|
33762
33837
|
return run;
|
|
33763
33838
|
}
|
|
33764
|
-
async function settleAccountStore(location, options,
|
|
33839
|
+
async function settleAccountStore(location, options, log19) {
|
|
33765
33840
|
const decided = decidedAccountStoreAnchor(location);
|
|
33766
33841
|
if (decided) return decided;
|
|
33767
|
-
const anchor = await decideAccountStore(location, options,
|
|
33842
|
+
const anchor = await decideAccountStore(location, options, log19);
|
|
33768
33843
|
setAccountStoreAnchor(location, anchor);
|
|
33769
33844
|
return anchor;
|
|
33770
33845
|
}
|
|
33771
|
-
async function decideAccountStore(location, options,
|
|
33772
|
-
const keepConfig = () => recordAnchor(location, options, "config",
|
|
33846
|
+
async function decideAccountStore(location, options, log19) {
|
|
33847
|
+
const keepConfig = () => recordAnchor(location, options, "config", log19);
|
|
33773
33848
|
if (processHasOlderGeneration()) {
|
|
33774
33849
|
logOnce(
|
|
33775
33850
|
"older-generation-account-store",
|
|
33776
33851
|
() => showLog(
|
|
33777
|
-
|
|
33852
|
+
log19,
|
|
33778
33853
|
"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.",
|
|
33779
33854
|
{ accountStore: "config" }
|
|
33780
33855
|
)
|
|
@@ -33788,7 +33863,7 @@ async function decideAccountStore(location, options, log18) {
|
|
|
33788
33863
|
if (!sameSpelling(forward.legacyPath, stateAnchor)) {
|
|
33789
33864
|
logOnce(
|
|
33790
33865
|
`${location.key}\0store-forward-elsewhere`,
|
|
33791
|
-
() =>
|
|
33866
|
+
() => log19.warn(
|
|
33792
33867
|
"the account store moved to another folder than this process resolved; check XDG_STATE_HOME",
|
|
33793
33868
|
{ movedTo: forward.legacyPath, expected: stateAnchor }
|
|
33794
33869
|
)
|
|
@@ -33799,9 +33874,9 @@ async function decideAccountStore(location, options, log18) {
|
|
|
33799
33874
|
options,
|
|
33800
33875
|
configAnchor,
|
|
33801
33876
|
stateAnchor,
|
|
33802
|
-
|
|
33877
|
+
log19
|
|
33803
33878
|
);
|
|
33804
|
-
return recordAnchor(location, options, "state-home",
|
|
33879
|
+
return recordAnchor(location, options, "state-home", log19);
|
|
33805
33880
|
}
|
|
33806
33881
|
if (decidedRuntimeLayout(location) === "legacy") return keepConfig();
|
|
33807
33882
|
const configStore = await presentAccountStore(configAnchor);
|
|
@@ -33813,9 +33888,9 @@ async function decideAccountStore(location, options, log18) {
|
|
|
33813
33888
|
`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.`
|
|
33814
33889
|
);
|
|
33815
33890
|
}
|
|
33816
|
-
if (stateStore) return recordAnchor(location, options, "state-home",
|
|
33891
|
+
if (stateStore) return recordAnchor(location, options, "state-home", log19);
|
|
33817
33892
|
if (configStore) {
|
|
33818
|
-
if (!await storeMovePathResolves(stateAnchor, location,
|
|
33893
|
+
if (!await storeMovePathResolves(stateAnchor, location, log19))
|
|
33819
33894
|
return keepConfig();
|
|
33820
33895
|
return moveStore(
|
|
33821
33896
|
location,
|
|
@@ -33823,21 +33898,21 @@ async function decideAccountStore(location, options, log18) {
|
|
|
33823
33898
|
configAnchor,
|
|
33824
33899
|
stateAnchor,
|
|
33825
33900
|
false,
|
|
33826
|
-
|
|
33901
|
+
log19,
|
|
33827
33902
|
false
|
|
33828
33903
|
);
|
|
33829
33904
|
}
|
|
33830
|
-
if (await storeArtefacts(stateAnchor) > 0 && !await abandonUnpublishedStore(location, stateAnchor,
|
|
33905
|
+
if (await storeArtefacts(stateAnchor) > 0 && !await abandonUnpublishedStore(location, stateAnchor, log19))
|
|
33831
33906
|
return keepConfig();
|
|
33832
|
-
if (!await storeMovePathResolves(stateAnchor, location,
|
|
33907
|
+
if (!await storeMovePathResolves(stateAnchor, location, log19))
|
|
33833
33908
|
return keepConfig();
|
|
33834
|
-
return initializeStore(location, options, stateAnchor,
|
|
33909
|
+
return initializeStore(location, options, stateAnchor, log19);
|
|
33835
33910
|
}
|
|
33836
|
-
function showLog(
|
|
33837
|
-
if (
|
|
33838
|
-
else
|
|
33911
|
+
function showLog(log19, message, meta) {
|
|
33912
|
+
if (log19.log) log19.log(message, meta);
|
|
33913
|
+
else log19.info(message, meta);
|
|
33839
33914
|
}
|
|
33840
|
-
async function recordAnchor(location, options, anchor,
|
|
33915
|
+
async function recordAnchor(location, options, anchor, log19) {
|
|
33841
33916
|
try {
|
|
33842
33917
|
await recordProcessAnchor({
|
|
33843
33918
|
key: location.key,
|
|
@@ -33849,32 +33924,32 @@ async function recordAnchor(location, options, anchor, log18) {
|
|
|
33849
33924
|
}
|
|
33850
33925
|
if (anchor === "state-home")
|
|
33851
33926
|
showLog(
|
|
33852
|
-
|
|
33927
|
+
log19,
|
|
33853
33928
|
"antigravity-auth keeps its account store in its state folder",
|
|
33854
33929
|
{ accountStore: anchor }
|
|
33855
33930
|
);
|
|
33856
33931
|
return anchor;
|
|
33857
33932
|
}
|
|
33858
|
-
async function storeMovePathResolves(stateAnchor, location,
|
|
33933
|
+
async function storeMovePathResolves(stateAnchor, location, log19) {
|
|
33859
33934
|
if (folderResolvesToItself(
|
|
33860
33935
|
join18(location.stateHomeDir, "antigravity-accounts.json")
|
|
33861
33936
|
))
|
|
33862
33937
|
return true;
|
|
33863
33938
|
logOnce(
|
|
33864
33939
|
`${location.key}\0store-linked-path`,
|
|
33865
|
-
() =>
|
|
33940
|
+
() => log19.warn(ACCOUNT_STORE_LINKED_PATH_MESSAGE, {
|
|
33866
33941
|
accountStore: stateAnchor,
|
|
33867
33942
|
stateFolder: location.stateHomeDir
|
|
33868
33943
|
})
|
|
33869
33944
|
);
|
|
33870
33945
|
return false;
|
|
33871
33946
|
}
|
|
33872
|
-
async function storeFenceOpen(location, options,
|
|
33947
|
+
async function storeFenceOpen(location, options, log19) {
|
|
33873
33948
|
const gate = await (options.storeFence ?? defaultStoreFence(options.version))();
|
|
33874
33949
|
if (gate.open) return true;
|
|
33875
33950
|
logOnce(
|
|
33876
33951
|
`${location.key}\0store-version-fence`,
|
|
33877
|
-
() =>
|
|
33952
|
+
() => log19.info(ACCOUNT_STORE_DEFERRED_MESSAGE, {
|
|
33878
33953
|
configDir: location.configDir,
|
|
33879
33954
|
blockers: gate.blockers
|
|
33880
33955
|
})
|
|
@@ -33901,7 +33976,7 @@ async function storeArtefacts(anchor) {
|
|
|
33901
33976
|
(name) => name === store || name.startsWith(`${pool}.store.`) || name.startsWith(pool) && name.endsWith(".tmp")
|
|
33902
33977
|
).length;
|
|
33903
33978
|
}
|
|
33904
|
-
async function abandonUnpublishedStore(location, stateAnchor,
|
|
33979
|
+
async function abandonUnpublishedStore(location, stateAnchor, log19) {
|
|
33905
33980
|
const store = await loadCommonAuthStoreModules();
|
|
33906
33981
|
const binding = await readAccountStoreBinding(stateAnchor, store, Date.now);
|
|
33907
33982
|
if (binding.status === "bound") return false;
|
|
@@ -33912,7 +33987,7 @@ async function abandonUnpublishedStore(location, stateAnchor, log18) {
|
|
|
33912
33987
|
});
|
|
33913
33988
|
await unlink12(accountStorePointerPath(stateAnchor)).catch(() => {
|
|
33914
33989
|
});
|
|
33915
|
-
|
|
33990
|
+
log19.info(
|
|
33916
33991
|
"antigravity-auth set an unfinished account store aside before starting its move again",
|
|
33917
33992
|
{ configDir: location.configDir, archived }
|
|
33918
33993
|
);
|
|
@@ -33934,9 +34009,9 @@ async function runStoreMove(input2) {
|
|
|
33934
34009
|
return { status: "pending", reason: outcome.reason };
|
|
33935
34010
|
return { status: "cancelled" };
|
|
33936
34011
|
}
|
|
33937
|
-
async function moveStore(location, options, source, target, back,
|
|
33938
|
-
const keepConfig = () => recordAnchor(location, options, "config",
|
|
33939
|
-
if (!await storeFenceOpen(location, options,
|
|
34012
|
+
async function moveStore(location, options, source, target, back, log19, forwarded) {
|
|
34013
|
+
const keepConfig = () => recordAnchor(location, options, "config", log19);
|
|
34014
|
+
if (!await storeFenceOpen(location, options, log19)) return keepConfig();
|
|
33940
34015
|
try {
|
|
33941
34016
|
const result = await (options.relocate ?? runStoreMove)({
|
|
33942
34017
|
source,
|
|
@@ -33946,7 +34021,7 @@ async function moveStore(location, options, source, target, back, log18, forward
|
|
|
33946
34021
|
if (result.status !== "completed") {
|
|
33947
34022
|
logOnce(
|
|
33948
34023
|
`${location.key}\0store-move-unfinished`,
|
|
33949
|
-
() =>
|
|
34024
|
+
() => log19.info(ACCOUNT_STORE_DEFERRED_MESSAGE, {
|
|
33950
34025
|
configDir: location.configDir,
|
|
33951
34026
|
reason: result.status === "pending" ? result.reason : result.status
|
|
33952
34027
|
})
|
|
@@ -33954,14 +34029,14 @@ async function moveStore(location, options, source, target, back, log18, forward
|
|
|
33954
34029
|
return forwarded ? "state-home" : keepConfig();
|
|
33955
34030
|
}
|
|
33956
34031
|
showLog(
|
|
33957
|
-
|
|
34032
|
+
log19,
|
|
33958
34033
|
"antigravity-auth moved the account store out of OpenCode's config folder",
|
|
33959
34034
|
{ from: source, to: target, generation: result.id }
|
|
33960
34035
|
);
|
|
33961
34036
|
} catch (error) {
|
|
33962
34037
|
logOnce(
|
|
33963
34038
|
`${location.key}\0store-move-failed`,
|
|
33964
|
-
() =>
|
|
34039
|
+
() => log19.warn(
|
|
33965
34040
|
"antigravity-auth's account store stays in OpenCode's config folder: moving it failed; the move is tried again at the next start",
|
|
33966
34041
|
{
|
|
33967
34042
|
configDir: location.configDir,
|
|
@@ -33972,9 +34047,9 @@ async function moveStore(location, options, source, target, back, log18, forward
|
|
|
33972
34047
|
);
|
|
33973
34048
|
return forwarded ? "state-home" : keepConfig();
|
|
33974
34049
|
}
|
|
33975
|
-
return recordAnchor(location, options, "state-home",
|
|
34050
|
+
return recordAnchor(location, options, "state-home", log19);
|
|
33976
34051
|
}
|
|
33977
|
-
async function resumeForwardedStore(location, options, configAnchor, stateAnchor,
|
|
34052
|
+
async function resumeForwardedStore(location, options, configAnchor, stateAnchor, log19) {
|
|
33978
34053
|
const store = await loadCommonAuthStoreModules();
|
|
33979
34054
|
const binding = await readAccountStoreBinding(stateAnchor, store, Date.now);
|
|
33980
34055
|
if (binding.status === "bound") return;
|
|
@@ -33985,13 +34060,13 @@ async function resumeForwardedStore(location, options, configAnchor, stateAnchor
|
|
|
33985
34060
|
configAnchor,
|
|
33986
34061
|
stateAnchor,
|
|
33987
34062
|
false,
|
|
33988
|
-
|
|
34063
|
+
log19,
|
|
33989
34064
|
true
|
|
33990
34065
|
);
|
|
33991
34066
|
} catch (error) {
|
|
33992
34067
|
logOnce(
|
|
33993
34068
|
`${location.key}\0store-resume-failed`,
|
|
33994
|
-
() =>
|
|
34069
|
+
() => log19.warn(
|
|
33995
34070
|
"antigravity-auth's account store is still moving; it could not be finished at this start",
|
|
33996
34071
|
{
|
|
33997
34072
|
configDir: location.configDir,
|
|
@@ -34002,9 +34077,9 @@ async function resumeForwardedStore(location, options, configAnchor, stateAnchor
|
|
|
34002
34077
|
);
|
|
34003
34078
|
}
|
|
34004
34079
|
}
|
|
34005
|
-
async function initializeStore(location, options, stateAnchor,
|
|
34006
|
-
const keepConfig = () => recordAnchor(location, options, "config",
|
|
34007
|
-
if (!await storeFenceOpen(location, options,
|
|
34080
|
+
async function initializeStore(location, options, stateAnchor, log19) {
|
|
34081
|
+
const keepConfig = () => recordAnchor(location, options, "config", log19);
|
|
34082
|
+
if (!await storeFenceOpen(location, options, log19)) return keepConfig();
|
|
34008
34083
|
try {
|
|
34009
34084
|
const store = await loadCommonAuthStoreModules();
|
|
34010
34085
|
const created = await initializeFreshAccountStore(store, {
|
|
@@ -34017,7 +34092,7 @@ async function initializeStore(location, options, stateAnchor, log18) {
|
|
|
34017
34092
|
} catch (error) {
|
|
34018
34093
|
logOnce(
|
|
34019
34094
|
`${location.key}\0store-init-failed`,
|
|
34020
|
-
() =>
|
|
34095
|
+
() => log19.warn(
|
|
34021
34096
|
"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",
|
|
34022
34097
|
{
|
|
34023
34098
|
configDir: location.configDir,
|
|
@@ -34029,13 +34104,13 @@ async function initializeStore(location, options, stateAnchor, log18) {
|
|
|
34029
34104
|
return keepConfig();
|
|
34030
34105
|
}
|
|
34031
34106
|
showLog(
|
|
34032
|
-
|
|
34107
|
+
log19,
|
|
34033
34108
|
"antigravity-auth created its account store in its state folder",
|
|
34034
34109
|
{
|
|
34035
34110
|
accountStore: stateAnchor
|
|
34036
34111
|
}
|
|
34037
34112
|
);
|
|
34038
|
-
return recordAnchor(location, options, "state-home",
|
|
34113
|
+
return recordAnchor(location, options, "state-home", log19);
|
|
34039
34114
|
}
|
|
34040
34115
|
async function writeStateHomeStoreForward(id, stateAnchor, configAnchor = legacyAccountFile(runtimeLayoutLocation().configDir)) {
|
|
34041
34116
|
const forward = {
|
|
@@ -34050,10 +34125,10 @@ async function writeStateHomeStoreForward(id, stateAnchor, configAnchor = legacy
|
|
|
34050
34125
|
durability: "file-only-on-windows"
|
|
34051
34126
|
});
|
|
34052
34127
|
}
|
|
34053
|
-
function logDeferral(location, blockers,
|
|
34128
|
+
function logDeferral(location, blockers, log19) {
|
|
34054
34129
|
logOnce(
|
|
34055
34130
|
`${location.key}\0deferred`,
|
|
34056
|
-
() =>
|
|
34131
|
+
() => log19.info(RUNTIME_LAYOUT_DEFERRED_MESSAGE, {
|
|
34057
34132
|
configDir: location.configDir,
|
|
34058
34133
|
blockers
|
|
34059
34134
|
})
|
|
@@ -34211,13 +34286,13 @@ async function finishOldFiles(location, files, markerPath, marker, layoutLock, i
|
|
|
34211
34286
|
if (done) await removeOldVaultFolder(files, layoutLock, input2.steps);
|
|
34212
34287
|
}
|
|
34213
34288
|
}
|
|
34214
|
-
async function removeLeftoverManifest(location, layoutLock, steps,
|
|
34289
|
+
async function removeLeftoverManifest(location, layoutLock, steps, log19) {
|
|
34215
34290
|
try {
|
|
34216
34291
|
await removeManifestOwned(location.stateHomeDir, layoutLock, steps);
|
|
34217
34292
|
} catch (error) {
|
|
34218
34293
|
logOnce(
|
|
34219
34294
|
`${location.key}\0manifest`,
|
|
34220
|
-
() =>
|
|
34295
|
+
() => log19.warn(
|
|
34221
34296
|
`antigravity-auth could not remove ${RUNTIME_LAYOUT_MANIFEST_FILE} from its state folder; it tries again at the next start`,
|
|
34222
34297
|
{ stateDir: location.stateHomeDir, errorClass: errorClass(error) }
|
|
34223
34298
|
)
|
|
@@ -34237,7 +34312,7 @@ async function removeOldVaultFolder(files, layoutLock, steps) {
|
|
|
34237
34312
|
} catch {
|
|
34238
34313
|
}
|
|
34239
34314
|
}
|
|
34240
|
-
async function removeOldSignatureCache(location, path5, layoutLock, steps,
|
|
34315
|
+
async function removeOldSignatureCache(location, path5, layoutLock, steps, log19) {
|
|
34241
34316
|
try {
|
|
34242
34317
|
if (!await exists3(path5)) return;
|
|
34243
34318
|
await beforeRemove(path5, layoutLock, steps);
|
|
@@ -34246,7 +34321,7 @@ async function removeOldSignatureCache(location, path5, layoutLock, steps, log18
|
|
|
34246
34321
|
if (error?.code === "ENOENT") return;
|
|
34247
34322
|
logOnce(
|
|
34248
34323
|
`${location.key}\0signature-cache`,
|
|
34249
|
-
() =>
|
|
34324
|
+
() => log19.warn(
|
|
34250
34325
|
"antigravity-auth could not remove its old signature cache from OpenCode's config folder; it is no longer used and can be deleted",
|
|
34251
34326
|
{ path: path5, errorClass: errorClass(error) }
|
|
34252
34327
|
)
|
|
@@ -34257,7 +34332,7 @@ async function beforeRemove(path5, layoutLock, steps) {
|
|
|
34257
34332
|
await steps?.beforeRemove?.(path5);
|
|
34258
34333
|
await layoutLock.assertOwned();
|
|
34259
34334
|
}
|
|
34260
|
-
async function takeDataLocks(files,
|
|
34335
|
+
async function takeDataLocks(files, log19) {
|
|
34261
34336
|
const locks = [];
|
|
34262
34337
|
try {
|
|
34263
34338
|
if (await exists3(files.vault.old))
|
|
@@ -34267,7 +34342,7 @@ async function takeDataLocks(files, log18) {
|
|
|
34267
34342
|
lock.name,
|
|
34268
34343
|
join18(files.vault.old, lock.file),
|
|
34269
34344
|
lock.waitMs,
|
|
34270
|
-
|
|
34345
|
+
log19
|
|
34271
34346
|
)
|
|
34272
34347
|
);
|
|
34273
34348
|
return locks;
|
|
@@ -34618,7 +34693,7 @@ async function ensureOwnerOnlyDir(path5) {
|
|
|
34618
34693
|
await mkdir15(path5, { recursive: true, mode: 448 });
|
|
34619
34694
|
await chmod5(path5, 448);
|
|
34620
34695
|
}
|
|
34621
|
-
async function takeLock(name, path5, waitMs,
|
|
34696
|
+
async function takeLock(name, path5, waitMs, log19) {
|
|
34622
34697
|
const fs7 = await loadCommonAuthFs();
|
|
34623
34698
|
const started = performance.now();
|
|
34624
34699
|
let announced = false;
|
|
@@ -34643,7 +34718,7 @@ async function takeLock(name, path5, waitMs, log18) {
|
|
|
34643
34718
|
);
|
|
34644
34719
|
if (!announced && waited >= LOCK_WAIT_NOTICE_MS) {
|
|
34645
34720
|
announced = true;
|
|
34646
|
-
|
|
34721
|
+
log19.info(
|
|
34647
34722
|
`antigravity-auth is waiting up to ${Math.round(waitMs / 1e3)} s for the ${name} lock at ${path5}.${lockHolderText(name)}`,
|
|
34648
34723
|
{ lock: name, path: path5 }
|
|
34649
34724
|
);
|
|
@@ -36020,19 +36095,19 @@ function initLogger3(client) {
|
|
|
36020
36095
|
}
|
|
36021
36096
|
function createLogger4(module) {
|
|
36022
36097
|
let channel3;
|
|
36023
|
-
const
|
|
36098
|
+
const log19 = (level, message, extra) => {
|
|
36024
36099
|
channel3 ??= getLegacyLogger().createLogger(module);
|
|
36025
36100
|
channel3[level](message, extra);
|
|
36026
36101
|
};
|
|
36027
36102
|
return {
|
|
36028
|
-
debug: (message, extra) =>
|
|
36029
|
-
info: (message, extra) =>
|
|
36103
|
+
debug: (message, extra) => log19("debug", message, extra),
|
|
36104
|
+
info: (message, extra) => log19("info", message, extra),
|
|
36030
36105
|
hostInfo: (message, extra) => {
|
|
36031
36106
|
channel3 ??= getLegacyLogger().createLogger(module);
|
|
36032
36107
|
channel3.hostInfo?.(message, extra);
|
|
36033
36108
|
},
|
|
36034
|
-
warn: (message, extra) =>
|
|
36035
|
-
error: (message, extra) =>
|
|
36109
|
+
warn: (message, extra) => log19("warn", message, extra),
|
|
36110
|
+
error: (message, extra) => log19("error", message, extra)
|
|
36036
36111
|
};
|
|
36037
36112
|
}
|
|
36038
36113
|
var ENV_CONSOLE_LOG2, LOG_LEVEL_FROM_OPERATOR, legacyClient, legacyLogger;
|
|
@@ -36093,7 +36168,7 @@ async function prepareVaultFolder(options) {
|
|
|
36093
36168
|
const kept = refusals.get(key2);
|
|
36094
36169
|
if (kept)
|
|
36095
36170
|
return override ? { ...override, refusal: kept } : refused(accountFile, kept);
|
|
36096
|
-
const
|
|
36171
|
+
const log19 = options.log ?? createLogger4("runtime-layout");
|
|
36097
36172
|
const version = options.version ?? await pluginPackageVersion().catch(() => "unknown");
|
|
36098
36173
|
try {
|
|
36099
36174
|
if (override) {
|
|
@@ -36102,11 +36177,11 @@ async function prepareVaultFolder(options) {
|
|
|
36102
36177
|
await prepareRuntimeLayout({
|
|
36103
36178
|
version,
|
|
36104
36179
|
accountFile,
|
|
36105
|
-
log:
|
|
36180
|
+
log: log19,
|
|
36106
36181
|
...options.layoutLockWaitMs === void 0 ? {} : { layoutLockWaitMs: options.layoutLockWaitMs }
|
|
36107
36182
|
});
|
|
36108
36183
|
if (options.accountStore !== false)
|
|
36109
|
-
await prepareAccountStore({ version, log:
|
|
36184
|
+
await prepareAccountStore({ version, log: log19 });
|
|
36110
36185
|
} catch (error) {
|
|
36111
36186
|
const refusal3 = error instanceof RuntimeLayoutRefusal ? error : new RuntimeLayoutRefusal(
|
|
36112
36187
|
override?.vaultDir ?? runtimeLayoutLocation().stateHomeDir,
|
|
@@ -36114,7 +36189,7 @@ async function prepareVaultFolder(options) {
|
|
|
36114
36189
|
);
|
|
36115
36190
|
if (!refusals.has(key2)) {
|
|
36116
36191
|
refusals.set(key2, refusal3);
|
|
36117
|
-
|
|
36192
|
+
log19.warn(refusal3.message, {
|
|
36118
36193
|
stateDir: refusal3.stateDir,
|
|
36119
36194
|
errorClass: refusal3.errorClass
|
|
36120
36195
|
});
|
|
@@ -40539,7 +40614,7 @@ function getUserConfigPath() {
|
|
|
40539
40614
|
function getProjectConfigPath(directory) {
|
|
40540
40615
|
return join22(directory, ".opencode", "antigravity.json");
|
|
40541
40616
|
}
|
|
40542
|
-
function loadConfigFile(path5,
|
|
40617
|
+
function loadConfigFile(path5, log19) {
|
|
40543
40618
|
try {
|
|
40544
40619
|
if (!fs4.existsSync(path5)) {
|
|
40545
40620
|
return null;
|
|
@@ -40548,7 +40623,7 @@ function loadConfigFile(path5, log18) {
|
|
|
40548
40623
|
const rawConfig = JSON.parse(content);
|
|
40549
40624
|
const result = AntigravityConfigSchema.partial().safeParse(rawConfig);
|
|
40550
40625
|
if (!result.success) {
|
|
40551
|
-
|
|
40626
|
+
log19.warn("Config validation error", {
|
|
40552
40627
|
path: path5,
|
|
40553
40628
|
issues: result.error.issues.map((i) => `${i.path.join(".")}: ${i.message}`).join(", ")
|
|
40554
40629
|
});
|
|
@@ -40557,9 +40632,9 @@ function loadConfigFile(path5, log18) {
|
|
|
40557
40632
|
return result.data;
|
|
40558
40633
|
} catch (error) {
|
|
40559
40634
|
if (error instanceof SyntaxError) {
|
|
40560
|
-
|
|
40635
|
+
log19.warn("Invalid JSON in config file", { path: path5, error: error.message });
|
|
40561
40636
|
} else {
|
|
40562
|
-
|
|
40637
|
+
log19.warn("Failed to load config file", { path: path5, error: String(error) });
|
|
40563
40638
|
}
|
|
40564
40639
|
return null;
|
|
40565
40640
|
}
|
|
@@ -40578,15 +40653,15 @@ function mergeConfigs(base, override) {
|
|
|
40578
40653
|
function loadConfig(directory) {
|
|
40579
40654
|
return loadConfigWithLogger(directory, legacyLog);
|
|
40580
40655
|
}
|
|
40581
|
-
function loadConfigWithLogger(directory,
|
|
40656
|
+
function loadConfigWithLogger(directory, log19) {
|
|
40582
40657
|
let config = structuredClone(DEFAULT_CONFIG);
|
|
40583
40658
|
const userConfigPath = getUserConfigPath();
|
|
40584
|
-
const userConfig = loadConfigFile(userConfigPath,
|
|
40659
|
+
const userConfig = loadConfigFile(userConfigPath, log19);
|
|
40585
40660
|
if (userConfig) {
|
|
40586
40661
|
config = mergeConfigs(config, userConfig);
|
|
40587
40662
|
}
|
|
40588
40663
|
const projectConfigPath = getProjectConfigPath(directory);
|
|
40589
|
-
const projectConfig = loadConfigFile(projectConfigPath,
|
|
40664
|
+
const projectConfig = loadConfigFile(projectConfigPath, log19);
|
|
40590
40665
|
if (projectConfig) {
|
|
40591
40666
|
config = mergeConfigs(config, projectConfig);
|
|
40592
40667
|
}
|
|
@@ -45001,8 +45076,8 @@ function createSessionRecoveryHook(ctx, config) {
|
|
|
45001
45076
|
if (!sessionID) return false;
|
|
45002
45077
|
let assistantMsgID = info.id;
|
|
45003
45078
|
let msgs;
|
|
45004
|
-
const
|
|
45005
|
-
|
|
45079
|
+
const log19 = createLogger4("session-recovery");
|
|
45080
|
+
log19.debug("Recovery attempt started", {
|
|
45006
45081
|
errorType,
|
|
45007
45082
|
sessionID,
|
|
45008
45083
|
providedMsgID: assistantMsgID ?? "none"
|
|
@@ -45022,7 +45097,7 @@ function createSessionRecoveryHook(ctx, config) {
|
|
|
45022
45097
|
const m = msgs[i];
|
|
45023
45098
|
if (m && m.info?.role === "assistant" && m.info?.id) {
|
|
45024
45099
|
assistantMsgID = m.info.id;
|
|
45025
|
-
|
|
45100
|
+
log19.debug("Found assistant message ID from session messages", {
|
|
45026
45101
|
msgID: assistantMsgID,
|
|
45027
45102
|
msgIndex: i
|
|
45028
45103
|
});
|
|
@@ -45031,7 +45106,7 @@ function createSessionRecoveryHook(ctx, config) {
|
|
|
45031
45106
|
}
|
|
45032
45107
|
}
|
|
45033
45108
|
if (!assistantMsgID) {
|
|
45034
|
-
|
|
45109
|
+
log19.debug("No assistant message ID found, cannot recover");
|
|
45035
45110
|
return false;
|
|
45036
45111
|
}
|
|
45037
45112
|
if (processingErrors.has(assistantMsgID)) return false;
|
|
@@ -45075,7 +45150,7 @@ function createSessionRecoveryHook(ctx, config) {
|
|
|
45075
45150
|
}
|
|
45076
45151
|
return success;
|
|
45077
45152
|
} catch (err) {
|
|
45078
|
-
|
|
45153
|
+
log19.error("Recovery failed", { error: String(err) });
|
|
45079
45154
|
return false;
|
|
45080
45155
|
} finally {
|
|
45081
45156
|
processingErrors.delete(assistantMsgID);
|
|
@@ -47974,9 +48049,9 @@ function prepareAntigravityRequestIn(wire, input2, init, accessToken, projectId,
|
|
|
47974
48049
|
}
|
|
47975
48050
|
const [, rawModel = "", rawAction = ""] = match;
|
|
47976
48051
|
const requestedModel = rawModel;
|
|
47977
|
-
const
|
|
48052
|
+
const geminiTier = supportsGeminiXHigh(rawModel) ? options?.variant?.thinkingLevel : void 0;
|
|
47978
48053
|
const resolved = resolveAntigravityModel(
|
|
47979
|
-
|
|
48054
|
+
geminiTier ? `${rawModel.replace(/-(low|medium|high|xhigh)$/i, "")}-${geminiTier}` : rawModel
|
|
47980
48055
|
);
|
|
47981
48056
|
let effectiveModel = resolved.actualModel;
|
|
47982
48057
|
const streaming = rawAction === STREAM_ACTION;
|
|
@@ -48147,9 +48222,9 @@ function prepareAntigravityRequestIn(wire, input2, init, accessToken, projectId,
|
|
|
48147
48222
|
`[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)}`
|
|
48148
48223
|
);
|
|
48149
48224
|
delete requestPayload.providerOptions;
|
|
48150
|
-
if (variantConfig?.thinkingLevel && (isGemini3 || isGeminiArgonModel(effectiveModel) || isGeminiCarbonModel(effectiveModel) ||
|
|
48225
|
+
if (variantConfig?.thinkingLevel && (isGemini3 || isGeminiArgonModel(effectiveModel) || isGeminiCarbonModel(effectiveModel) || supportsGeminiXHigh(effectiveModel) || getAgyNativeModel(effectiveModel)?.supportsAdaptiveThinking)) {
|
|
48151
48226
|
const variantModelBase = rawModel.replace(/-preview-customtools$/i, "").replace(/-preview$/i, "").replace(
|
|
48152
|
-
|
|
48227
|
+
supportsGeminiXHigh(effectiveModel) ? /-(low|medium|high|xhigh)$/i : /-(minimal|low|medium|high)$/i,
|
|
48153
48228
|
""
|
|
48154
48229
|
);
|
|
48155
48230
|
const variantResolved = resolveAntigravityModel(
|
|
@@ -49132,7 +49207,7 @@ var AgySessionRegistry = class {
|
|
|
49132
49207
|
};
|
|
49133
49208
|
|
|
49134
49209
|
// src/plugin/shared/advisory-repository.ts
|
|
49135
|
-
function createAdvisoryRepositoryOwner(repository,
|
|
49210
|
+
function createAdvisoryRepositoryOwner(repository, log19) {
|
|
49136
49211
|
const methods = /* @__PURE__ */ new Map();
|
|
49137
49212
|
const advisoryMethods = /* @__PURE__ */ new Set([
|
|
49138
49213
|
"updateMetadata",
|
|
@@ -49178,7 +49253,7 @@ function createAdvisoryRepositoryOwner(repository, log18) {
|
|
|
49178
49253
|
(reason) => !failures.has(reason)
|
|
49179
49254
|
);
|
|
49180
49255
|
for (const reason of absorbed) failures.delete(reason);
|
|
49181
|
-
|
|
49256
|
+
log19.debug("post-response-local-write-refused", {
|
|
49182
49257
|
count: absorbed.length
|
|
49183
49258
|
});
|
|
49184
49259
|
if (remaining.length > 0)
|
|
@@ -50770,7 +50845,7 @@ async function withRoutingWaitReports(cancellation, run) {
|
|
|
50770
50845
|
finish(cancellation.aborted ? "cancelled" : "abandoned");
|
|
50771
50846
|
}
|
|
50772
50847
|
}
|
|
50773
|
-
function createLocalQuotaRefresh(accountManager, quotaManager,
|
|
50848
|
+
function createLocalQuotaRefresh(accountManager, quotaManager, log19) {
|
|
50774
50849
|
return async function refreshQuotaAfterSuccess(account, intervalMinutes, signal) {
|
|
50775
50850
|
if (intervalMinutes <= 0) return;
|
|
50776
50851
|
const accountIndex = accountManager.getAccounts().indexOf(account);
|
|
@@ -50801,7 +50876,7 @@ function createLocalQuotaRefresh(accountManager, quotaManager, log18) {
|
|
|
50801
50876
|
accountManager.requestSaveToDisk();
|
|
50802
50877
|
}
|
|
50803
50878
|
} catch (err) {
|
|
50804
|
-
|
|
50879
|
+
log19.debug(
|
|
50805
50880
|
`quota-refresh-failed ${singleAccount ? quotaManager.hashedLogLabel("account", singleAccount) : `idx-${accountIndex}`}`,
|
|
50806
50881
|
{ error: String(err) }
|
|
50807
50882
|
);
|
|
@@ -50820,7 +50895,7 @@ function createRequestExecutor(deps) {
|
|
|
50820
50895
|
wire,
|
|
50821
50896
|
debug,
|
|
50822
50897
|
dump,
|
|
50823
|
-
logger:
|
|
50898
|
+
logger: log19,
|
|
50824
50899
|
trackers,
|
|
50825
50900
|
classifyAccessError,
|
|
50826
50901
|
notify,
|
|
@@ -50871,7 +50946,7 @@ function createRequestExecutor(deps) {
|
|
|
50871
50946
|
const entries = unavailableModels.get(key2);
|
|
50872
50947
|
const entry = entries?.get(model);
|
|
50873
50948
|
if (!entries || !entry) return;
|
|
50874
|
-
|
|
50949
|
+
log19.debug("model-unavailable-memory-drop", {
|
|
50875
50950
|
account: entry.label,
|
|
50876
50951
|
model,
|
|
50877
50952
|
cause
|
|
@@ -50911,7 +50986,7 @@ function createRequestExecutor(deps) {
|
|
|
50911
50986
|
...entry,
|
|
50912
50987
|
recordedAt: modelAvailabilityNow()
|
|
50913
50988
|
});
|
|
50914
|
-
|
|
50989
|
+
log19.debug("model-unavailable-memory-record", {
|
|
50915
50990
|
account: entry.label,
|
|
50916
50991
|
model
|
|
50917
50992
|
});
|
|
@@ -50927,7 +51002,7 @@ function createRequestExecutor(deps) {
|
|
|
50927
51002
|
const reportVault401 = (admission, status) => {
|
|
50928
51003
|
if (!admission || status !== 401) return;
|
|
50929
51004
|
void Promise.resolve().then(() => admission.report401(status)).catch((error) => {
|
|
50930
|
-
|
|
51005
|
+
log19.debug("send-admission-401-report-failed", { error: String(error) });
|
|
50931
51006
|
});
|
|
50932
51007
|
};
|
|
50933
51008
|
const reportRouting2 = (sessionId, entry) => {
|
|
@@ -50935,7 +51010,7 @@ function createRequestExecutor(deps) {
|
|
|
50935
51010
|
try {
|
|
50936
51011
|
onRouting(sessionId, entry);
|
|
50937
51012
|
} catch (error) {
|
|
50938
|
-
|
|
51013
|
+
log19.debug("routing-report-failed", { sessionId, error: String(error) });
|
|
50939
51014
|
}
|
|
50940
51015
|
};
|
|
50941
51016
|
async function execute(input2, init, options, selectedCredentials, selectedProjectIds, deadline, waitPolicy, waits) {
|
|
@@ -51119,7 +51194,7 @@ function createRequestExecutor(deps) {
|
|
|
51119
51194
|
const quietMode = config.quiet_mode;
|
|
51120
51195
|
const toastScope = config.toast_scope;
|
|
51121
51196
|
const showToast = async (message, variant2) => {
|
|
51122
|
-
|
|
51197
|
+
log19.debug("toast", {
|
|
51123
51198
|
message,
|
|
51124
51199
|
variant: variant2,
|
|
51125
51200
|
isChildSession: isChildRequest,
|
|
@@ -51128,7 +51203,7 @@ function createRequestExecutor(deps) {
|
|
|
51128
51203
|
if (quietMode) return;
|
|
51129
51204
|
if (abortSignal?.aborted) return;
|
|
51130
51205
|
if (toastScope === "root_only" && isChildRequest) {
|
|
51131
|
-
|
|
51206
|
+
log19.debug("toast-suppressed-child-session", {
|
|
51132
51207
|
message,
|
|
51133
51208
|
variant: variant2,
|
|
51134
51209
|
parentID: requestSessionIdentity.parentSessionId
|
|
@@ -51171,7 +51246,7 @@ function createRequestExecutor(deps) {
|
|
|
51171
51246
|
);
|
|
51172
51247
|
const routingRefusalResponse = (refused2) => {
|
|
51173
51248
|
const { code: code2, routingCode, reason } = refused2;
|
|
51174
|
-
|
|
51249
|
+
log19.warn("routing-refused", {
|
|
51175
51250
|
code: code2,
|
|
51176
51251
|
...routingCode === void 0 ? {} : { routingCode },
|
|
51177
51252
|
...reason === void 0 ? {} : { reason }
|
|
@@ -51248,7 +51323,7 @@ function createRequestExecutor(deps) {
|
|
|
51248
51323
|
pushDebug(
|
|
51249
51324
|
`model-access: all ${serviceable.length} serviceable account(s) excluded`
|
|
51250
51325
|
);
|
|
51251
|
-
|
|
51326
|
+
log19.warn("model-access-all-excluded", {
|
|
51252
51327
|
family,
|
|
51253
51328
|
model,
|
|
51254
51329
|
accounts: serviceable.length
|
|
@@ -51328,7 +51403,7 @@ function createRequestExecutor(deps) {
|
|
|
51328
51403
|
});
|
|
51329
51404
|
} catch (error) {
|
|
51330
51405
|
if (error instanceof AntigravityKillswitchError) {
|
|
51331
|
-
|
|
51406
|
+
log19.warn("killswitch-all-excluded", {
|
|
51332
51407
|
family,
|
|
51333
51408
|
model,
|
|
51334
51409
|
threshold: error.thresholdPercent,
|
|
@@ -51354,7 +51429,7 @@ function createRequestExecutor(deps) {
|
|
|
51354
51429
|
pushDebug(
|
|
51355
51430
|
`model-unavailable: all ${candidates.length} eligible account(s) skipped`
|
|
51356
51431
|
);
|
|
51357
|
-
|
|
51432
|
+
log19.warn("model-unavailable-all-accounts", {
|
|
51358
51433
|
family,
|
|
51359
51434
|
model,
|
|
51360
51435
|
accounts: candidates.length
|
|
@@ -51677,7 +51752,7 @@ function createRequestExecutor(deps) {
|
|
|
51677
51752
|
await deadline.wait(() => credentials.saveToDisk());
|
|
51678
51753
|
} catch (error) {
|
|
51679
51754
|
checkAborted();
|
|
51680
|
-
|
|
51755
|
+
log19.error("Failed to persist project context", {
|
|
51681
51756
|
error: String(error)
|
|
51682
51757
|
});
|
|
51683
51758
|
}
|
|
@@ -51734,7 +51809,7 @@ function createRequestExecutor(deps) {
|
|
|
51734
51809
|
await deadline.wait(() => credentials.saveToDisk());
|
|
51735
51810
|
} catch (error) {
|
|
51736
51811
|
checkAborted();
|
|
51737
|
-
|
|
51812
|
+
log19.error("Failed to persist refreshed auth", {
|
|
51738
51813
|
error: String(error)
|
|
51739
51814
|
});
|
|
51740
51815
|
}
|
|
@@ -51743,14 +51818,14 @@ function createRequestExecutor(deps) {
|
|
|
51743
51818
|
if (credentials.isInvalidGrant(error)) {
|
|
51744
51819
|
const removed = credentials.removeAccount(account);
|
|
51745
51820
|
if (removed) {
|
|
51746
|
-
|
|
51821
|
+
log19.warn(
|
|
51747
51822
|
"Removed revoked account from pool - reauthenticate via `opencode auth login`"
|
|
51748
51823
|
);
|
|
51749
51824
|
try {
|
|
51750
51825
|
await deadline.wait(() => credentials.saveToDiskReplace());
|
|
51751
51826
|
} catch (persistError) {
|
|
51752
51827
|
checkAborted();
|
|
51753
|
-
|
|
51828
|
+
log19.error("Failed to persist revoked account removal", {
|
|
51754
51829
|
error: String(persistError)
|
|
51755
51830
|
});
|
|
51756
51831
|
}
|
|
@@ -51760,7 +51835,7 @@ function createRequestExecutor(deps) {
|
|
|
51760
51835
|
await deadline.wait(() => credentials.clearStoredAuth());
|
|
51761
51836
|
} catch (storeError) {
|
|
51762
51837
|
checkAborted();
|
|
51763
|
-
|
|
51838
|
+
log19.error(
|
|
51764
51839
|
"Failed to clear stored Antigravity OAuth credentials",
|
|
51765
51840
|
{
|
|
51766
51841
|
error: String(storeError)
|
|
@@ -51830,8 +51905,8 @@ function createRequestExecutor(deps) {
|
|
|
51830
51905
|
const sendPhysical = async (url, sendInit, admission, sendModel, requestKind, onMainTransportFailure) => {
|
|
51831
51906
|
const source = credentials.domain === "local" ? "local" : hasVaultHost2() ? "hosted" : "vault";
|
|
51832
51907
|
const message = `request-send source=${source} model=${sendModel} account=Account ${account.index + 1}`;
|
|
51833
|
-
if (source === "local")
|
|
51834
|
-
else (
|
|
51908
|
+
if (source === "local") log19.info(message);
|
|
51909
|
+
else (log19.hostInfo ?? log19.info)(message);
|
|
51835
51910
|
const attempt = ++physicalSendCount;
|
|
51836
51911
|
const sessionId = requestSessionIdentity.sessionId;
|
|
51837
51912
|
const billing = admission && sessionId && hasVaultRoutingAccessor() ? new VaultBillingAttempt(
|
|
@@ -52210,7 +52285,7 @@ function createRequestExecutor(deps) {
|
|
|
52210
52285
|
);
|
|
52211
52286
|
} catch (error) {
|
|
52212
52287
|
checkAborted();
|
|
52213
|
-
|
|
52288
|
+
log19.debug("send-admission-401-report-failed", {
|
|
52214
52289
|
error: String(error)
|
|
52215
52290
|
});
|
|
52216
52291
|
}
|
|
@@ -52599,7 +52674,7 @@ function createRequestExecutor(deps) {
|
|
|
52599
52674
|
debug.logAntigravityDebugResponse(debugContext, response, {
|
|
52600
52675
|
note
|
|
52601
52676
|
});
|
|
52602
|
-
|
|
52677
|
+
log19.info("model-unavailable", {
|
|
52603
52678
|
accountIndex: account.index,
|
|
52604
52679
|
family,
|
|
52605
52680
|
model,
|
|
@@ -52923,7 +52998,7 @@ function createRequestExecutor(deps) {
|
|
|
52923
52998
|
const originalError = recoveryError.originalError || {
|
|
52924
52999
|
error: { message: "Thinking recovery triggered" }
|
|
52925
53000
|
};
|
|
52926
|
-
|
|
53001
|
+
log19.debug("thinking-recovery-failed", { error: originalError });
|
|
52927
53002
|
const recoveryMessage = "Antigravity could not repair the conversation's thinking blocks. Start a new session.";
|
|
52928
53003
|
return new Response(
|
|
52929
53004
|
JSON.stringify({
|
|
@@ -53028,11 +53103,11 @@ function createRequestExecutor(deps) {
|
|
|
53028
53103
|
cancellation.signal,
|
|
53029
53104
|
deps.preResponseClock
|
|
53030
53105
|
);
|
|
53031
|
-
|
|
53106
|
+
log19.debug("pre-response-start", { limitMs: PRE_RESPONSE_DEADLINE_MS });
|
|
53032
53107
|
const handoff = createAfterHandoff(
|
|
53033
53108
|
advisoryWork,
|
|
53034
53109
|
requestedSignal ? [requestedSignal, shutdown.signal] : [shutdown.signal],
|
|
53035
|
-
() =>
|
|
53110
|
+
() => log19.debug("post-response-advisory-work-failed")
|
|
53036
53111
|
);
|
|
53037
53112
|
const waitPolicy = {};
|
|
53038
53113
|
const selectedCredentials = /* @__PURE__ */ new Set();
|
|
@@ -53062,7 +53137,7 @@ function createRequestExecutor(deps) {
|
|
|
53062
53137
|
).catch((error) => {
|
|
53063
53138
|
cancellation.signal.throwIfAborted();
|
|
53064
53139
|
if (error instanceof PreResponseTimeoutError) {
|
|
53065
|
-
|
|
53140
|
+
log19.debug("pre-response-timeout", { reason: error.reason });
|
|
53066
53141
|
return waitPolicy.refusal?.() ?? preResponseTimeoutResponse();
|
|
53067
53142
|
}
|
|
53068
53143
|
throw error;
|
|
@@ -53457,7 +53532,7 @@ async function defaultFence2() {
|
|
|
53457
53532
|
return (await versionFenceOpen({ currentVersion })).open;
|
|
53458
53533
|
}
|
|
53459
53534
|
function createSettingsRuntime(options) {
|
|
53460
|
-
const { file, legacyUserFile, log:
|
|
53535
|
+
const { file, legacyUserFile, log: log19 } = options;
|
|
53461
53536
|
const open14 = options.open ?? openSettings;
|
|
53462
53537
|
const store = options.protection ?? createProtectionStore2();
|
|
53463
53538
|
const reportPath = options.moveReportPath ?? defaultMoveReportPath();
|
|
@@ -53472,7 +53547,7 @@ function createSettingsRuntime(options) {
|
|
|
53472
53547
|
const enqueue = (step) => {
|
|
53473
53548
|
const run = queue2.then(step);
|
|
53474
53549
|
queue2 = run.catch(
|
|
53475
|
-
(error) =>
|
|
53550
|
+
(error) => log19.warn("Settings refresh failed", {
|
|
53476
53551
|
error: error instanceof Error ? error.name : "unknown"
|
|
53477
53552
|
})
|
|
53478
53553
|
);
|
|
@@ -53505,7 +53580,7 @@ function createSettingsRuntime(options) {
|
|
|
53505
53580
|
await store.save(file, next);
|
|
53506
53581
|
persisted = next;
|
|
53507
53582
|
} catch (error) {
|
|
53508
|
-
|
|
53583
|
+
log19.warn("Could not save the last applied protection settings", {
|
|
53509
53584
|
error: error instanceof Error ? error.name : "unknown"
|
|
53510
53585
|
});
|
|
53511
53586
|
}
|
|
@@ -53575,7 +53650,7 @@ function createSettingsRuntime(options) {
|
|
|
53575
53650
|
if (mode === "shared" || disposed) return;
|
|
53576
53651
|
handle = open14(ANTIGRAVITY_SETTINGS, {
|
|
53577
53652
|
file,
|
|
53578
|
-
log:
|
|
53653
|
+
log: log19,
|
|
53579
53654
|
separateInstall: false,
|
|
53580
53655
|
createMissing: true,
|
|
53581
53656
|
legacyProject: (project3) => ({
|
|
@@ -53613,7 +53688,7 @@ function createSettingsRuntime(options) {
|
|
|
53613
53688
|
legacyUserFile,
|
|
53614
53689
|
floorKeys: options.floorKeys ?? (async () => null),
|
|
53615
53690
|
fence: options.fence ?? defaultFence2,
|
|
53616
|
-
log:
|
|
53691
|
+
log: log19,
|
|
53617
53692
|
...options.move ? { move: options.move } : {}
|
|
53618
53693
|
});
|
|
53619
53694
|
} catch (cause) {
|
|
@@ -53632,7 +53707,7 @@ function createSettingsRuntime(options) {
|
|
|
53632
53707
|
unmapped: result.unmapped
|
|
53633
53708
|
});
|
|
53634
53709
|
} catch (error) {
|
|
53635
|
-
|
|
53710
|
+
log19.warn("Could not save the settings move report", {
|
|
53636
53711
|
error: error instanceof Error ? error.name : "unknown"
|
|
53637
53712
|
});
|
|
53638
53713
|
}
|
|
@@ -53645,14 +53720,14 @@ function createSettingsRuntime(options) {
|
|
|
53645
53720
|
return;
|
|
53646
53721
|
case "fence-closed":
|
|
53647
53722
|
if (!reportedFence)
|
|
53648
|
-
|
|
53723
|
+
log19.info(
|
|
53649
53724
|
"Settings stay in antigravity.json while an older antigravity-auth runs"
|
|
53650
53725
|
);
|
|
53651
53726
|
reportedFence = true;
|
|
53652
53727
|
break;
|
|
53653
53728
|
case "failed":
|
|
53654
53729
|
if (!reportedFailure)
|
|
53655
|
-
|
|
53730
|
+
log19.warn("The settings move failed; it is retried", {
|
|
53656
53731
|
error: result.cause instanceof Error ? result.cause.name : "unknown"
|
|
53657
53732
|
});
|
|
53658
53733
|
reportedFailure = true;
|
|
@@ -54587,7 +54662,7 @@ async function buildLocationRuntime(options, scope) {
|
|
|
54587
54662
|
sink: options.logSink,
|
|
54588
54663
|
sinkEnabled: () => config?.config.debug_tui === true
|
|
54589
54664
|
});
|
|
54590
|
-
const
|
|
54665
|
+
const log19 = logger3.createLogger("runtime");
|
|
54591
54666
|
const settingsLease = (options.settingsRuntimes ?? processSettingsRuntimes).acquire({
|
|
54592
54667
|
...await openCodeSettingsPaths(options.directory),
|
|
54593
54668
|
log: logger3.createLogger("settings"),
|
|
@@ -54726,7 +54801,7 @@ async function buildLocationRuntime(options, scope) {
|
|
|
54726
54801
|
queue2.start();
|
|
54727
54802
|
});
|
|
54728
54803
|
accountChange = next.catch((error) => {
|
|
54729
|
-
|
|
54804
|
+
log19.warn("account view replacement failed", {
|
|
54730
54805
|
error: error instanceof Error ? error.message : String(error)
|
|
54731
54806
|
});
|
|
54732
54807
|
});
|
|
@@ -61940,9 +62015,11 @@ import { setTimeout as delay2 } from "node:timers/promises";
|
|
|
61940
62015
|
import { writeEnrollmentTokenFile as writeEnrollmentTokenFile3 } from "@cortexkit/claustrum-client";
|
|
61941
62016
|
|
|
61942
62017
|
// src/common-auth-embedded/setup/process-fence.js
|
|
62018
|
+
init_logger3();
|
|
61943
62019
|
import { statSync as statSync7 } from "node:fs";
|
|
61944
62020
|
import { win32 as win325 } from "node:path";
|
|
61945
62021
|
var WINDOWS_CIM_TIMEOUT_MS = 45e3;
|
|
62022
|
+
var log13 = createLogger3("setup-process-fence");
|
|
61946
62023
|
var WINDOWS_ARM_POWERSHELL_TIMEOUT_MS = 9e4;
|
|
61947
62024
|
function isFile(file) {
|
|
61948
62025
|
try {
|
|
@@ -62102,14 +62179,23 @@ async function listSetupProcesses(runner = defaultCommandRunner, options = {}) {
|
|
|
62102
62179
|
options.onStep?.({ ...inspection });
|
|
62103
62180
|
}
|
|
62104
62181
|
};
|
|
62105
|
-
const inspectCim = (args) => {
|
|
62182
|
+
const inspectCim = async (args) => {
|
|
62106
62183
|
const pwsh = win325.resolve(windowsEnv(env3, "ProgramFiles") ?? "C:\\Program Files", "PowerShell", "7", "pwsh.exe");
|
|
62107
62184
|
const program = (options.isFile ?? isFile)(pwsh) ? "pwsh" : "powershell";
|
|
62108
62185
|
const arm64 = (windowsEnv(env3, "PROCESSOR_ARCHITEW6432") ?? windowsEnv(env3, "PROCESSOR_ARCHITECTURE"))?.toUpperCase() === "ARM64";
|
|
62109
62186
|
const slow = program === "powershell" && arm64;
|
|
62110
62187
|
if (slow)
|
|
62111
62188
|
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.");
|
|
62112
|
-
|
|
62189
|
+
const file = program === "pwsh" ? pwsh : win325.resolve(system32, "WindowsPowerShell", "v1.0", "powershell.exe");
|
|
62190
|
+
const timeoutMs = slow ? WINDOWS_ARM_POWERSHELL_TIMEOUT_MS : WINDOWS_CIM_TIMEOUT_MS;
|
|
62191
|
+
const started = performance.now();
|
|
62192
|
+
const result = await inspect("CIM", file, args, timeoutMs, program);
|
|
62193
|
+
const remaining = Math.floor(timeoutMs - (performance.now() - started));
|
|
62194
|
+
if ((result.exitCode === 3221225477 || result.exitCode === -1073741819) && !result.timedOut && !result.signal && !result.spawnError && remaining > 0) {
|
|
62195
|
+
log13.warn("Windows process query crashed with an access violation; retrying once");
|
|
62196
|
+
return inspect("CIM", file, args, remaining, program);
|
|
62197
|
+
}
|
|
62198
|
+
return result;
|
|
62113
62199
|
};
|
|
62114
62200
|
try {
|
|
62115
62201
|
if (windows2 && options.hostImagesOnly) {
|
|
@@ -64682,8 +64768,8 @@ function isUsablePortFileEntry(value, name) {
|
|
|
64682
64768
|
const { pid, port, token } = value;
|
|
64683
64769
|
return isProbeablePid(pid) && filenamePid(name) === pid && typeof port === "number" && Number.isInteger(port) && port >= 1 && port <= 65535 && typeof token === "string" && token.length > 0;
|
|
64684
64770
|
}
|
|
64685
|
-
async function removeCorruptPortFile(portFile,
|
|
64686
|
-
|
|
64771
|
+
async function removeCorruptPortFile(portFile, log19) {
|
|
64772
|
+
log19?.debug("rpc corrupt port file", { pid: process.pid, portFile });
|
|
64687
64773
|
await unlink16(portFile).catch(() => {
|
|
64688
64774
|
});
|
|
64689
64775
|
}
|
|
@@ -64737,7 +64823,7 @@ async function writePortFile(dir, entry, options = {}) {
|
|
|
64737
64823
|
}
|
|
64738
64824
|
}
|
|
64739
64825
|
}
|
|
64740
|
-
async function sweepRpcState(root, activeDir, isManagedDir,
|
|
64826
|
+
async function sweepRpcState(root, activeDir, isManagedDir, log19, options = {}) {
|
|
64741
64827
|
const cutoff = staleBefore(options);
|
|
64742
64828
|
let projectDirs;
|
|
64743
64829
|
try {
|
|
@@ -64753,14 +64839,14 @@ async function sweepRpcState(root, activeDir, isManagedDir, log18, options = {})
|
|
|
64753
64839
|
continue;
|
|
64754
64840
|
}
|
|
64755
64841
|
const dir = join43(root, projectDir.name);
|
|
64756
|
-
if (!await sweepRpcDirectory(dir,
|
|
64842
|
+
if (!await sweepRpcDirectory(dir, log19, options, cutoff))
|
|
64757
64843
|
continue;
|
|
64758
64844
|
if (resolve31(dir) !== active2)
|
|
64759
64845
|
await rmdir3(dir).catch(() => {
|
|
64760
64846
|
});
|
|
64761
64847
|
}
|
|
64762
64848
|
}
|
|
64763
|
-
async function sweepRpcDirectory(dir,
|
|
64849
|
+
async function sweepRpcDirectory(dir, log19, options = {}, cutoff = staleBefore(options)) {
|
|
64764
64850
|
let names;
|
|
64765
64851
|
try {
|
|
64766
64852
|
names = await readdir7(dir);
|
|
@@ -64788,11 +64874,11 @@ async function sweepRpcDirectory(dir, log18, options = {}, cutoff = staleBefore(
|
|
|
64788
64874
|
try {
|
|
64789
64875
|
parsed = JSON.parse(raw);
|
|
64790
64876
|
} catch {
|
|
64791
|
-
await removeCorruptPortFile(portFile,
|
|
64877
|
+
await removeCorruptPortFile(portFile, log19);
|
|
64792
64878
|
continue;
|
|
64793
64879
|
}
|
|
64794
64880
|
if (!isUsablePortFileEntry(parsed, name)) {
|
|
64795
|
-
await removeCorruptPortFile(portFile,
|
|
64881
|
+
await removeCorruptPortFile(portFile, log19);
|
|
64796
64882
|
continue;
|
|
64797
64883
|
}
|
|
64798
64884
|
const entry = parsed;
|
|
@@ -64823,7 +64909,7 @@ var key = /* @__PURE__ */ Symbol.for("common-auth.rpc.startup-sweep");
|
|
|
64823
64909
|
globals[key] ??= {};
|
|
64824
64910
|
var state = globals[key];
|
|
64825
64911
|
var now = Date.now;
|
|
64826
|
-
async function sweepRpcStateOnStart(root, activeDir, isManagedDir,
|
|
64912
|
+
async function sweepRpcStateOnStart(root, activeDir, isManagedDir, log19) {
|
|
64827
64913
|
const time = now();
|
|
64828
64914
|
if (state.lastSweepAt !== void 0 && time - state.lastSweepAt < 6e4) {
|
|
64829
64915
|
const active2 = resolve32(activeDir);
|
|
@@ -64832,11 +64918,11 @@ async function sweepRpcStateOnStart(root, activeDir, isManagedDir, log18) {
|
|
|
64832
64918
|
throw error;
|
|
64833
64919
|
return void 0;
|
|
64834
64920
|
}))?.isDirectory())
|
|
64835
|
-
await sweepRpcDirectory(active2,
|
|
64921
|
+
await sweepRpcDirectory(active2, log19);
|
|
64836
64922
|
return;
|
|
64837
64923
|
}
|
|
64838
64924
|
state.lastSweepAt = time;
|
|
64839
|
-
await sweepRpcState(root, activeDir, isManagedDir,
|
|
64925
|
+
await sweepRpcState(root, activeDir, isManagedDir, log19);
|
|
64840
64926
|
}
|
|
64841
64927
|
|
|
64842
64928
|
// src/common-auth-embedded/rpc/rpc-server.js
|
|
@@ -64912,7 +64998,7 @@ function tokenOk(header, token) {
|
|
|
64912
64998
|
async function startRpcServer(options) {
|
|
64913
64999
|
if (typeof options.drain === "function" === (typeof options.drainAsync === "function"))
|
|
64914
65000
|
throw new TypeError("exactly one of drain or drainAsync must be provided");
|
|
64915
|
-
const
|
|
65001
|
+
const log19 = options.log ?? { warn() {
|
|
64916
65002
|
}, debug() {
|
|
64917
65003
|
} };
|
|
64918
65004
|
const token = randomBytes7(32).toString("hex");
|
|
@@ -65013,7 +65099,7 @@ async function startRpcServer(options) {
|
|
|
65013
65099
|
return json(400, { error: "session required" });
|
|
65014
65100
|
if (sessionId === void 0 && !warnedMissingNotificationSession) {
|
|
65015
65101
|
warnedMissingNotificationSession = true;
|
|
65016
|
-
|
|
65102
|
+
log19.warn("rpc notification drain missing session id", {
|
|
65017
65103
|
pid: process.pid
|
|
65018
65104
|
});
|
|
65019
65105
|
}
|
|
@@ -65022,7 +65108,7 @@ async function startRpcServer(options) {
|
|
|
65022
65108
|
try {
|
|
65023
65109
|
messages = await options.drainAsync(lastReceivedId, sessionId);
|
|
65024
65110
|
} catch (error) {
|
|
65025
|
-
|
|
65111
|
+
log19.warn("rpc notification drain failed", {
|
|
65026
65112
|
pid: process.pid,
|
|
65027
65113
|
error: error instanceof Error ? error.message : String(error)
|
|
65028
65114
|
});
|
|
@@ -65041,20 +65127,20 @@ async function startRpcServer(options) {
|
|
|
65041
65127
|
return json(404, { error: "unknown method" });
|
|
65042
65128
|
} catch (error) {
|
|
65043
65129
|
if (error instanceof RpcRequestError) {
|
|
65044
|
-
|
|
65130
|
+
log19.debug("rpc request refused", {
|
|
65045
65131
|
pid: process.pid,
|
|
65046
65132
|
status: error.status
|
|
65047
65133
|
});
|
|
65048
65134
|
return json(error.status, { error: error.message });
|
|
65049
65135
|
}
|
|
65050
65136
|
if (error instanceof ApplyDeadlineError) {
|
|
65051
|
-
|
|
65137
|
+
log19.warn("rpc apply deadline exceeded", {
|
|
65052
65138
|
pid: process.pid,
|
|
65053
65139
|
deadlineMs: options.applyDeadlineMs
|
|
65054
65140
|
});
|
|
65055
65141
|
return json(504, { error: "handler deadline exceeded" });
|
|
65056
65142
|
}
|
|
65057
|
-
|
|
65143
|
+
log19.warn("rpc request failed", {
|
|
65058
65144
|
pid: process.pid,
|
|
65059
65145
|
error: error instanceof Error ? error.message : String(error)
|
|
65060
65146
|
});
|
|
@@ -65074,9 +65160,9 @@ async function startRpcServer(options) {
|
|
|
65074
65160
|
server.unref();
|
|
65075
65161
|
if (options.sweepRoot) {
|
|
65076
65162
|
try {
|
|
65077
|
-
await sweepRpcStateOnStart(options.sweepRoot, options.dir, options.isManagedDir,
|
|
65163
|
+
await sweepRpcStateOnStart(options.sweepRoot, options.dir, options.isManagedDir, log19);
|
|
65078
65164
|
} catch (error) {
|
|
65079
|
-
|
|
65165
|
+
log19.warn("rpc state sweep failed", {
|
|
65080
65166
|
pid: process.pid,
|
|
65081
65167
|
error: error instanceof Error ? error.message : String(error)
|
|
65082
65168
|
});
|
|
@@ -65084,7 +65170,7 @@ async function startRpcServer(options) {
|
|
|
65084
65170
|
}
|
|
65085
65171
|
try {
|
|
65086
65172
|
await writePortFile(options.dir, { port, token, pid: process.pid }, { secureDir: options.secureDir });
|
|
65087
|
-
|
|
65173
|
+
log19.debug("rpc server pid", {
|
|
65088
65174
|
pid: process.pid,
|
|
65089
65175
|
rpcPort: port
|
|
65090
65176
|
});
|
|
@@ -65433,11 +65519,15 @@ init_dist();
|
|
|
65433
65519
|
// src/plugin/config/models.ts
|
|
65434
65520
|
function getOpencode1ModelDefinitions() {
|
|
65435
65521
|
const models = { ...OPENCODE_MODEL_DEFINITIONS };
|
|
65436
|
-
const
|
|
65437
|
-
|
|
65438
|
-
|
|
65522
|
+
for (const id of [
|
|
65523
|
+
"antigravity-gemini-4-hydrogen",
|
|
65524
|
+
"antigravity-gemini-4-neon"
|
|
65525
|
+
]) {
|
|
65526
|
+
const model = models[id];
|
|
65527
|
+
if (!model) continue;
|
|
65528
|
+
const variants = { ...model.variants };
|
|
65439
65529
|
delete variants.xhigh;
|
|
65440
|
-
models[
|
|
65530
|
+
models[id] = { ...model, variants };
|
|
65441
65531
|
}
|
|
65442
65532
|
return models;
|
|
65443
65533
|
}
|
|
@@ -66480,10 +66570,10 @@ function toV1AuthCallbackResult(result) {
|
|
|
66480
66570
|
};
|
|
66481
66571
|
}
|
|
66482
66572
|
var MAX_OAUTH_ACCOUNTS = 10;
|
|
66483
|
-
var
|
|
66484
|
-
async function reportPersistenceFailure(error, client,
|
|
66573
|
+
var log14 = createLogger4("oauth-methods");
|
|
66574
|
+
async function reportPersistenceFailure(error, client, log19) {
|
|
66485
66575
|
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);
|
|
66486
|
-
|
|
66576
|
+
log19.error("OAuth login persistence failed; aborting login", {
|
|
66487
66577
|
error: message
|
|
66488
66578
|
});
|
|
66489
66579
|
try {
|
|
@@ -67320,7 +67410,7 @@ ${verifyUrl}
|
|
|
67320
67410
|
}
|
|
67321
67411
|
});
|
|
67322
67412
|
} catch (storeError) {
|
|
67323
|
-
|
|
67413
|
+
log14.error(
|
|
67324
67414
|
"Failed to update stored Antigravity OAuth credentials",
|
|
67325
67415
|
{ error: String(storeError) }
|
|
67326
67416
|
);
|
|
@@ -67345,7 +67435,7 @@ ${verifyUrl}
|
|
|
67345
67435
|
}
|
|
67346
67436
|
});
|
|
67347
67437
|
} catch (storeError) {
|
|
67348
|
-
|
|
67438
|
+
log14.error(
|
|
67349
67439
|
"Failed to clear stored Antigravity OAuth credentials",
|
|
67350
67440
|
{ error: String(storeError) }
|
|
67351
67441
|
);
|
|
@@ -67386,7 +67476,7 @@ Re-authenticating ${refreshEmail || "account"}...
|
|
|
67386
67476
|
}
|
|
67387
67477
|
});
|
|
67388
67478
|
} catch (storeError) {
|
|
67389
|
-
|
|
67479
|
+
log14.error(
|
|
67390
67480
|
"Failed to clear stored Antigravity OAuth credentials",
|
|
67391
67481
|
{ error: String(storeError) }
|
|
67392
67482
|
);
|
|
@@ -67725,7 +67815,7 @@ ${authorization2.url}
|
|
|
67725
67815
|
return await reportPersistenceFailure(
|
|
67726
67816
|
persistError,
|
|
67727
67817
|
client,
|
|
67728
|
-
|
|
67818
|
+
log14
|
|
67729
67819
|
);
|
|
67730
67820
|
}
|
|
67731
67821
|
const newTotal = existingCount + 1;
|
|
@@ -67769,7 +67859,7 @@ ${authorization2.url}
|
|
|
67769
67859
|
try {
|
|
67770
67860
|
await persistAccountPool2([result], false);
|
|
67771
67861
|
} catch (persistError) {
|
|
67772
|
-
return await reportPersistenceFailure(persistError, client,
|
|
67862
|
+
return await reportPersistenceFailure(persistError, client, log14);
|
|
67773
67863
|
}
|
|
67774
67864
|
const newTotal = existingCount + 1;
|
|
67775
67865
|
const toastMessage = existingCount > 0 ? `Added account${result.email ? ` (${result.email})` : ""} - ${newTotal} total` : `Authenticated${result.email ? ` (${result.email})` : ""}`;
|
|
@@ -67931,7 +68021,7 @@ import { createHash as createHash22 } from "node:crypto";
|
|
|
67931
68021
|
init_debug();
|
|
67932
68022
|
init_logger4();
|
|
67933
68023
|
init_storage();
|
|
67934
|
-
var
|
|
68024
|
+
var log15 = createLogger4("auth-loader");
|
|
67935
68025
|
var failureLog = createLogger("auth-loader");
|
|
67936
68026
|
function loaderFailure(error) {
|
|
67937
68027
|
if (error instanceof RuntimeLayoutRefusal) return error;
|
|
@@ -68103,7 +68193,7 @@ function createAuthLoader({
|
|
|
68103
68193
|
});
|
|
68104
68194
|
refreshQueue = deps.createStoreRefreshQueue(
|
|
68105
68195
|
{
|
|
68106
|
-
logger:
|
|
68196
|
+
logger: log15,
|
|
68107
68197
|
refreshToken: (_auth, account) => credentials.refresh(account)
|
|
68108
68198
|
},
|
|
68109
68199
|
queueConfig
|
|
@@ -68211,7 +68301,7 @@ function createAuthLoader({
|
|
|
68211
68301
|
}
|
|
68212
68302
|
if (opening.status === "ready") {
|
|
68213
68303
|
if (!isOAuthAuth(auth) && !readAuthority2) {
|
|
68214
|
-
|
|
68304
|
+
log15.warn(
|
|
68215
68305
|
"The host holds no Antigravity sign-in; the account store is left untouched"
|
|
68216
68306
|
);
|
|
68217
68307
|
return {};
|
|
@@ -68270,12 +68360,12 @@ function createAuthLoader({
|
|
|
68270
68360
|
expires: auth.expires ?? 0
|
|
68271
68361
|
}
|
|
68272
68362
|
});
|
|
68273
|
-
|
|
68363
|
+
log15.info("Restored Antigravity OAuth auth from account storage", {
|
|
68274
68364
|
reason: drift.reason,
|
|
68275
68365
|
email: drift.account.email
|
|
68276
68366
|
});
|
|
68277
68367
|
} catch (error) {
|
|
68278
|
-
|
|
68368
|
+
log15.warn(
|
|
68279
68369
|
"Failed to restore Antigravity OAuth auth from account storage",
|
|
68280
68370
|
{ error: String(error) }
|
|
68281
68371
|
);
|
|
@@ -68960,7 +69050,7 @@ init_dist();
|
|
|
68960
69050
|
init_debug();
|
|
68961
69051
|
init_logger4();
|
|
68962
69052
|
init_vault_request_credentials();
|
|
68963
|
-
var
|
|
69053
|
+
var log16 = createLogger4("fetch-interceptor");
|
|
68964
69054
|
var failureLog2 = createLogger("fetch-interceptor");
|
|
68965
69055
|
function fetchFailure(error, input2, init) {
|
|
68966
69056
|
const signal = init?.signal ?? (input2 instanceof Request ? input2.signal : void 0);
|
|
@@ -69020,14 +69110,14 @@ function openCode1EngineCollaborators(common) {
|
|
|
69020
69110
|
// the engine calls.
|
|
69021
69111
|
debug: debug_exports,
|
|
69022
69112
|
dump: { dumpRequest: dumpGeminiRequest },
|
|
69023
|
-
logger:
|
|
69113
|
+
logger: log16,
|
|
69024
69114
|
classifyAccessError: extractAccountAccessErrorDetails,
|
|
69025
69115
|
notify: (message, variant) => client.tui.showToast({ body: { message, variant } }),
|
|
69026
69116
|
onRouting: common.onRouting ?? ((sessionId, entry) => {
|
|
69027
69117
|
void upsertSidebarActiveRouting(sessionId, entry, {
|
|
69028
69118
|
authoritative: true
|
|
69029
69119
|
}).catch((error) => {
|
|
69030
|
-
|
|
69120
|
+
log16.debug("sidebar-routing-upsert-failed", {
|
|
69031
69121
|
sessionId,
|
|
69032
69122
|
error: String(error)
|
|
69033
69123
|
});
|
|
@@ -69053,7 +69143,7 @@ function createFetchInterceptor(context) {
|
|
|
69053
69143
|
const refreshQuotaAfterSuccess = createLocalQuotaRefresh(
|
|
69054
69144
|
accountManager,
|
|
69055
69145
|
quotaManager,
|
|
69056
|
-
|
|
69146
|
+
log16
|
|
69057
69147
|
);
|
|
69058
69148
|
const executor = createRequestExecutor({
|
|
69059
69149
|
assertAdmission: context.assertAdmission,
|
|
@@ -69208,7 +69298,7 @@ init_logger4();
|
|
|
69208
69298
|
|
|
69209
69299
|
// src/plugin/search.ts
|
|
69210
69300
|
init_logger4();
|
|
69211
|
-
var
|
|
69301
|
+
var log17 = createLogger4("search");
|
|
69212
69302
|
function formatSearchResult(result) {
|
|
69213
69303
|
const lines = [];
|
|
69214
69304
|
lines.push("## Search Results\n");
|
|
@@ -69336,7 +69426,7 @@ ${urlList}`;
|
|
|
69336
69426
|
requestType: "agent"
|
|
69337
69427
|
};
|
|
69338
69428
|
const url = `${ANTIGRAVITY_ENDPOINT}/v1internal:generateContent`;
|
|
69339
|
-
|
|
69429
|
+
log17.debug("Executing search", {
|
|
69340
69430
|
query,
|
|
69341
69431
|
urlCount: urls?.length ?? 0,
|
|
69342
69432
|
thinking
|
|
@@ -69359,7 +69449,7 @@ ${urlList}`;
|
|
|
69359
69449
|
);
|
|
69360
69450
|
if (!response.ok) {
|
|
69361
69451
|
const errorText3 = await response.text();
|
|
69362
|
-
|
|
69452
|
+
log17.debug("Search API error", {
|
|
69363
69453
|
status: response.status,
|
|
69364
69454
|
error: errorText3
|
|
69365
69455
|
});
|
|
@@ -69372,14 +69462,14 @@ ${errorText3}
|
|
|
69372
69462
|
Please try again with a different query.`;
|
|
69373
69463
|
}
|
|
69374
69464
|
const data = await response.json();
|
|
69375
|
-
|
|
69465
|
+
log17.debug("Search response received", { hasResponse: !!data.response });
|
|
69376
69466
|
const result = parseSearchResponse(data);
|
|
69377
69467
|
const formatted = formatSearchResult(result);
|
|
69378
|
-
|
|
69468
|
+
log17.debug("Search response formatted", { resultLength: formatted.length });
|
|
69379
69469
|
return formatted;
|
|
69380
69470
|
} catch (error) {
|
|
69381
69471
|
const message = error instanceof Error ? error.message : String(error);
|
|
69382
|
-
|
|
69472
|
+
log17.debug("Search execution error", { error: message });
|
|
69383
69473
|
return `## Search Error
|
|
69384
69474
|
|
|
69385
69475
|
Failed to execute search: ${message}. Please try again with a different query.`;
|
|
@@ -69387,7 +69477,7 @@ Failed to execute search: ${message}. Please try again with a different query.`;
|
|
|
69387
69477
|
}
|
|
69388
69478
|
|
|
69389
69479
|
// src/plugin/google-search-tool.ts
|
|
69390
|
-
var
|
|
69480
|
+
var log18 = createLogger4("plugin");
|
|
69391
69481
|
function createGoogleSearchTool({
|
|
69392
69482
|
getAuth,
|
|
69393
69483
|
client,
|
|
@@ -69409,7 +69499,7 @@ function createGoogleSearchTool({
|
|
|
69409
69499
|
if (mayStartLocalWork && !await mayStartLocalWork()) {
|
|
69410
69500
|
return "Google Search is not available through local credentials while vault custody is active or unreadable.";
|
|
69411
69501
|
}
|
|
69412
|
-
|
|
69502
|
+
log18.debug("Google Search tool called", {
|
|
69413
69503
|
query: args.query,
|
|
69414
69504
|
urlCount: args.urls?.length ?? 0
|
|
69415
69505
|
});
|