@cortexkit/opencode-antigravity-auth 3.1.0 → 3.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli.js +828 -620
- package/dist/cli.js.map +4 -4
- package/dist/cli.meta.json +118 -60
- package/dist/index.js +4695 -4086
- package/dist/index.js.map +4 -4
- package/dist/index.meta.json +154 -81
- package/dist/server.js +4636 -4027
- package/dist/server.js.map +4 -4
- package/dist/server.meta.json +1 -1
- package/dist/src/common-auth-embedded/fs/canonical-file-path.d.ts +17 -0
- package/dist/src/common-auth-embedded/fs/canonical-file-path.js +53 -0
- package/dist/src/common-auth-embedded/fs/index.d.ts +1 -0
- package/dist/src/common-auth-embedded/fs/index.js +3 -0
- package/dist/src/common-auth-embedded/settings/fs.js +1 -0
- package/dist/src/common-auth-embedded/settings/update.js +4 -22
- package/dist/src/common-auth-embedded/source-output.json +39 -23
- package/dist/src/common-auth-embedded/tui-prefs/watcher.js +9 -2
- package/dist/src/ga/tui/host-ga.d.ts.map +1 -1
- package/dist/src/ga/tui/host-ga.js +1 -0
- package/dist/src/ga/tui/host-ga.js.map +1 -1
- package/dist/src/plugin/__fixtures__/verified-store.js +2 -2
- package/dist/src/plugin/config/loader.d.ts +2 -2
- package/dist/src/plugin/config/loader.d.ts.map +1 -1
- package/dist/src/plugin/config/loader.js +18 -9
- package/dist/src/plugin/config/loader.js.map +1 -1
- package/dist/src/plugin/request.d.ts.map +1 -1
- package/dist/src/plugin/request.js +3 -1
- package/dist/src/plugin/request.js.map +1 -1
- package/dist/src/plugin/shared/request-services.d.ts +1 -0
- package/dist/src/plugin/shared/request-services.d.ts.map +1 -1
- package/dist/src/plugin/shared/request-services.js +55 -1
- package/dist/src/plugin/shared/request-services.js.map +1 -1
- package/dist/src/plugin/shared/vault-menu.d.ts +1 -1
- package/dist/src/plugin/shared/vault-menu.d.ts.map +1 -1
- package/dist/src/plugin/shared/vault-menu.js +21 -14
- package/dist/src/plugin/shared/vault-menu.js.map +1 -1
- package/dist/src/plugin/shared/vault-request-credentials.d.ts +2 -0
- package/dist/src/plugin/shared/vault-request-credentials.d.ts.map +1 -1
- package/dist/src/plugin/shared/vault-request-credentials.js +136 -15
- package/dist/src/plugin/shared/vault-request-credentials.js.map +1 -1
- package/dist/tui-build-map.json +1 -1
- package/dist/tui-ga-build-map.json +5 -5
- package/dist/types/src/plugin/config/loader.d.ts +2 -2
- package/dist/types/src/plugin/config/loader.d.ts.map +1 -1
- package/dist/types/src/plugin/request.d.ts.map +1 -1
- package/dist/types/src/plugin/shared/request-services.d.ts +1 -0
- package/dist/types/src/plugin/shared/request-services.d.ts.map +1 -1
- package/dist/types/src/plugin/shared/vault-menu.d.ts +1 -1
- package/dist/types/src/plugin/shared/vault-menu.d.ts.map +1 -1
- package/dist/types/src/plugin/shared/vault-request-credentials.d.ts +2 -0
- package/dist/types/src/plugin/shared/vault-request-credentials.d.ts.map +1 -1
- package/package.json +2 -2
- package/src/common-auth-embedded/fs/canonical-file-path.d.ts +17 -0
- package/src/common-auth-embedded/fs/canonical-file-path.js +53 -0
- package/src/common-auth-embedded/fs/index.d.ts +1 -0
- package/src/common-auth-embedded/fs/index.js +3 -0
- package/src/common-auth-embedded/settings/fs.js +1 -0
- package/src/common-auth-embedded/settings/update.js +4 -22
- package/src/common-auth-embedded/source-output.json +39 -23
- package/src/common-auth-embedded/tui-prefs/watcher.js +9 -2
- package/src/tui-ga-compiled/host-ga.js +1 -1
- package/src/tui-ga-raw/host-ga.tsx +5 -0
package/dist/cli.js
CHANGED
|
@@ -500,6 +500,8 @@ var init_account_repository_codecs = __esm({
|
|
|
500
500
|
enabled: optional(nullable(boolean)),
|
|
501
501
|
lastSwitchReason: optional(nullable(enumOf(["rate-limit", "initial", "rotation"]))),
|
|
502
502
|
rateLimitResetTimes: optional(nullable(mapOf(nullable(finiteNumber)))),
|
|
503
|
+
rateLimitWrittenAt: optional(nullable(mapOf(nullable(finiteNumber)))),
|
|
504
|
+
rateLimitClearedAt: optional(nullable(finiteNumber)),
|
|
503
505
|
coolingDownUntil: optional(nullable(finiteNumber)),
|
|
504
506
|
cooldownReason: optional(nullable(enumOf([
|
|
505
507
|
"auth-failure",
|
|
@@ -3972,6 +3974,356 @@ var init_account_migration = __esm({
|
|
|
3972
3974
|
}
|
|
3973
3975
|
});
|
|
3974
3976
|
|
|
3977
|
+
// ../core/dist/fingerprint.js
|
|
3978
|
+
function normalizeHarnessPlatform(platform = process.platform) {
|
|
3979
|
+
return platform === "win32" ? "windows" : platform || "unknown";
|
|
3980
|
+
}
|
|
3981
|
+
function normalizeHarnessArch(arch = process.arch) {
|
|
3982
|
+
switch (arch) {
|
|
3983
|
+
case "x64":
|
|
3984
|
+
return "amd64";
|
|
3985
|
+
case "ia32":
|
|
3986
|
+
return "386";
|
|
3987
|
+
default:
|
|
3988
|
+
return arch || "unknown";
|
|
3989
|
+
}
|
|
3990
|
+
}
|
|
3991
|
+
function buildAntigravityHarnessUserAgent(version = AGY_CLI_VERSION, platform = process.platform, arch = process.arch, authMethod = "consumer") {
|
|
3992
|
+
const osType = normalizeHarnessPlatform(platform);
|
|
3993
|
+
const normalizedArch = normalizeHarnessArch(arch);
|
|
3994
|
+
const changeList = version === AGY_CLI_VERSION ? `; cl=${AGY_CLI_CHANGE_LIST}` : "";
|
|
3995
|
+
return `antigravity/cli/${version} (aidev_client; os_type=${osType}; arch=${normalizedArch}${changeList}; auth_method=${authMethod})`;
|
|
3996
|
+
}
|
|
3997
|
+
function buildAntigravityHarnessLoadCodeAssistUserAgent(version = AGY_CLI_VERSION) {
|
|
3998
|
+
return buildAntigravityHarnessUserAgent(version);
|
|
3999
|
+
}
|
|
4000
|
+
function buildAntigravityLoadCodeAssistMetadata() {
|
|
4001
|
+
return { ideType: "ANTIGRAVITY" };
|
|
4002
|
+
}
|
|
4003
|
+
function buildAntigravityHarnessBootstrapHeaders(accessToken) {
|
|
4004
|
+
return {
|
|
4005
|
+
"User-Agent": buildAntigravityHarnessLoadCodeAssistUserAgent(),
|
|
4006
|
+
Authorization: `Bearer ${accessToken}`,
|
|
4007
|
+
"Content-Type": "application/json",
|
|
4008
|
+
"Accept-Encoding": "gzip"
|
|
4009
|
+
};
|
|
4010
|
+
}
|
|
4011
|
+
var AGY_CLI_VERSION, AGY_CLI_CHANGE_LIST;
|
|
4012
|
+
var init_fingerprint = __esm({
|
|
4013
|
+
"../core/dist/fingerprint.js"() {
|
|
4014
|
+
"use strict";
|
|
4015
|
+
AGY_CLI_VERSION = "1.5.8";
|
|
4016
|
+
AGY_CLI_CHANGE_LIST = "1020628950";
|
|
4017
|
+
}
|
|
4018
|
+
});
|
|
4019
|
+
|
|
4020
|
+
// ../core/dist/model-registry.js
|
|
4021
|
+
function defineModel(id, model) {
|
|
4022
|
+
return {
|
|
4023
|
+
id,
|
|
4024
|
+
release_date: MODEL_RELEASE_DATE,
|
|
4025
|
+
attachment: model.modalities.input.some((modality) => modality !== "text"),
|
|
4026
|
+
temperature: true,
|
|
4027
|
+
tool_call: true,
|
|
4028
|
+
cost: { ...DEFAULT_COST },
|
|
4029
|
+
options: { ...DEFAULT_OPTIONS },
|
|
4030
|
+
...model
|
|
4031
|
+
};
|
|
4032
|
+
}
|
|
4033
|
+
function pickModelDefinitions(ids) {
|
|
4034
|
+
return Object.fromEntries(ids.map((id) => [id, ALL_MODEL_DEFINITIONS[id]]));
|
|
4035
|
+
}
|
|
4036
|
+
function getResolverAliasMap() {
|
|
4037
|
+
return RESOLVER_ALIASES;
|
|
4038
|
+
}
|
|
4039
|
+
function getQuotaGroupForModel(modelId, hasArgonPool = false) {
|
|
4040
|
+
const normalized = modelId.toLowerCase();
|
|
4041
|
+
if (isGeminiHydrogenModel(normalized))
|
|
4042
|
+
return "gemini";
|
|
4043
|
+
if (isGeminiCarbonModel(normalized))
|
|
4044
|
+
return "gemini";
|
|
4045
|
+
if (isGeminiArgonModel(normalized))
|
|
4046
|
+
return hasArgonPool ? "gemini-argon" : void 0;
|
|
4047
|
+
return QUOTA_GROUP_BY_MODEL_ID[normalized] ?? // Check Claude / GPT-OSS substrings BEFORE the `gemini` substring so
|
|
4048
|
+
// a `gemini-claude-*` alias (which is a Claude route exposed under
|
|
4049
|
+
// a `gemini-` namespace) attributes to the non-gemini pool rather
|
|
4050
|
+
// than the gemini pool. Substring matching is required because the
|
|
4051
|
+
// alias IDs start with `gemini-` but contain `claude`.
|
|
4052
|
+
(normalized.includes("claude") || normalized.includes("gpt-oss") ? "non-gemini" : normalized.startsWith("gemini") || normalized.startsWith("tab_") ? "gemini" : void 0);
|
|
4053
|
+
}
|
|
4054
|
+
function isGeminiArgonModel(model) {
|
|
4055
|
+
return /^(?:antigravity-)?gemini-4-argon(?:-(?:low|medium|high))?$/.test(model.toLowerCase());
|
|
4056
|
+
}
|
|
4057
|
+
function isGeminiCarbonModel(model) {
|
|
4058
|
+
return /^(?:antigravity-)?gemini-4-carbon(?:-(?:low|medium|high))?$/.test(model.toLowerCase());
|
|
4059
|
+
}
|
|
4060
|
+
function isGeminiHydrogenModel(model) {
|
|
4061
|
+
return /^(?:antigravity-)?gemini-4-hydrogen(?:-(?:low|medium|high|xhigh))?$/.test(model.toLowerCase());
|
|
4062
|
+
}
|
|
4063
|
+
var DEFAULT_MODALITIES, MODEL_RELEASE_DATE, DEFAULT_COST, DEFAULT_OPTIONS, ALL_MODEL_DEFINITIONS, RESOLVER_ALIASES, QUOTA_GROUP_BY_MODEL_ID, ANTIGRAVITY_OPENCODE_MODEL_IDS, OPENCODE_MODEL_DEFINITIONS;
|
|
4064
|
+
var init_model_registry = __esm({
|
|
4065
|
+
"../core/dist/model-registry.js"() {
|
|
4066
|
+
"use strict";
|
|
4067
|
+
DEFAULT_MODALITIES = {
|
|
4068
|
+
input: ["text", "image", "pdf"],
|
|
4069
|
+
output: ["text"]
|
|
4070
|
+
};
|
|
4071
|
+
MODEL_RELEASE_DATE = "";
|
|
4072
|
+
DEFAULT_COST = { input: 0, output: 0 };
|
|
4073
|
+
DEFAULT_OPTIONS = {};
|
|
4074
|
+
ALL_MODEL_DEFINITIONS = {
|
|
4075
|
+
"antigravity-gemini-4-hydrogen": defineModel("antigravity-gemini-4-hydrogen", {
|
|
4076
|
+
name: "Gemini 4 Hydrogen (Antigravity)",
|
|
4077
|
+
reasoning: true,
|
|
4078
|
+
limit: { context: 1048576, output: 262144 },
|
|
4079
|
+
modalities: DEFAULT_MODALITIES,
|
|
4080
|
+
variants: {
|
|
4081
|
+
low: { thinkingLevel: "low" },
|
|
4082
|
+
medium: { thinkingLevel: "medium" },
|
|
4083
|
+
high: { thinkingLevel: "high" },
|
|
4084
|
+
xhigh: { thinkingLevel: "xhigh" }
|
|
4085
|
+
}
|
|
4086
|
+
}),
|
|
4087
|
+
"antigravity-gemini-4-argon": defineModel("antigravity-gemini-4-argon", {
|
|
4088
|
+
name: "Gemini 4 Argon (Antigravity)",
|
|
4089
|
+
reasoning: true,
|
|
4090
|
+
limit: { context: 1048576, output: 65536 },
|
|
4091
|
+
modalities: DEFAULT_MODALITIES,
|
|
4092
|
+
variants: {
|
|
4093
|
+
low: { thinkingLevel: "low" },
|
|
4094
|
+
medium: { thinkingLevel: "medium" },
|
|
4095
|
+
high: { thinkingLevel: "high" }
|
|
4096
|
+
}
|
|
4097
|
+
}),
|
|
4098
|
+
"antigravity-gemini-4-carbon": defineModel("antigravity-gemini-4-carbon", {
|
|
4099
|
+
name: "Gemini 4 Carbon (Antigravity)",
|
|
4100
|
+
reasoning: true,
|
|
4101
|
+
limit: { context: 1048576, output: 262144 },
|
|
4102
|
+
modalities: DEFAULT_MODALITIES,
|
|
4103
|
+
variants: {
|
|
4104
|
+
low: { thinkingLevel: "low" },
|
|
4105
|
+
medium: { thinkingLevel: "medium" },
|
|
4106
|
+
high: { thinkingLevel: "high" }
|
|
4107
|
+
}
|
|
4108
|
+
}),
|
|
4109
|
+
"antigravity-gemini-3.1-flash-image": defineModel("antigravity-gemini-3.1-flash-image", {
|
|
4110
|
+
name: "Gemini 3.1 Flash Image (Antigravity)",
|
|
4111
|
+
reasoning: false,
|
|
4112
|
+
limit: { context: 66e3, output: 33e3 },
|
|
4113
|
+
modalities: { input: ["text", "image"], output: ["text", "image"] }
|
|
4114
|
+
}),
|
|
4115
|
+
"antigravity-gemini-3.8-flash": defineModel("antigravity-gemini-3.8-flash", {
|
|
4116
|
+
name: "Gemini 3.8 Flash (Antigravity)",
|
|
4117
|
+
reasoning: true,
|
|
4118
|
+
limit: { context: 1048576, output: 65536 },
|
|
4119
|
+
modalities: DEFAULT_MODALITIES,
|
|
4120
|
+
variants: {
|
|
4121
|
+
low: { thinkingLevel: "low" },
|
|
4122
|
+
medium: { thinkingLevel: "medium" },
|
|
4123
|
+
high: { thinkingLevel: "high" }
|
|
4124
|
+
}
|
|
4125
|
+
}),
|
|
4126
|
+
"antigravity-claude-sonnet-5-5": defineModel("antigravity-claude-sonnet-5-5", {
|
|
4127
|
+
name: "Claude Sonnet 5.5 (Antigravity)",
|
|
4128
|
+
reasoning: true,
|
|
4129
|
+
limit: { context: 1e6, output: 128e3 },
|
|
4130
|
+
modalities: DEFAULT_MODALITIES,
|
|
4131
|
+
variants: {
|
|
4132
|
+
low: { thinkingLevel: "low" },
|
|
4133
|
+
medium: { thinkingLevel: "medium" },
|
|
4134
|
+
high: { thinkingLevel: "high" }
|
|
4135
|
+
}
|
|
4136
|
+
}),
|
|
4137
|
+
"antigravity-claude-opus-5-5": defineModel("antigravity-claude-opus-5-5", {
|
|
4138
|
+
name: "Claude Opus 5.5 (Antigravity)",
|
|
4139
|
+
reasoning: true,
|
|
4140
|
+
limit: { context: 1e6, output: 128e3 },
|
|
4141
|
+
modalities: DEFAULT_MODALITIES,
|
|
4142
|
+
variants: {
|
|
4143
|
+
low: { thinkingLevel: "low" },
|
|
4144
|
+
medium: { thinkingLevel: "medium" },
|
|
4145
|
+
high: { thinkingLevel: "high" }
|
|
4146
|
+
}
|
|
4147
|
+
}),
|
|
4148
|
+
"antigravity-gpt-oss-120b-medium": defineModel("antigravity-gpt-oss-120b-medium", {
|
|
4149
|
+
name: "GPT-OSS 120B Medium (Antigravity)",
|
|
4150
|
+
reasoning: true,
|
|
4151
|
+
limit: { context: 131072, output: 32768 },
|
|
4152
|
+
modalities: DEFAULT_MODALITIES
|
|
4153
|
+
})
|
|
4154
|
+
};
|
|
4155
|
+
RESOLVER_ALIASES = {
|
|
4156
|
+
"gemini-4-carbon-low": "gemini-4-carbon",
|
|
4157
|
+
"gemini-4-carbon-medium": "gemini-4-carbon",
|
|
4158
|
+
"gemini-4-carbon-high": "gemini-4-carbon",
|
|
4159
|
+
"gemini-4-argon-low": "gemini-4-argon",
|
|
4160
|
+
"gemini-4-argon-medium": "gemini-4-argon",
|
|
4161
|
+
"gemini-4-argon-high": "gemini-4-argon",
|
|
4162
|
+
"gemini-3.1-pro-low": "gemini-3.1-pro",
|
|
4163
|
+
"gemini-3.1-pro-high": "gemini-3.1-pro",
|
|
4164
|
+
"gemini-3-flash-low": "gemini-3-flash",
|
|
4165
|
+
"gemini-3-flash-medium": "gemini-3-flash",
|
|
4166
|
+
"gemini-3-flash-high": "gemini-3-flash",
|
|
4167
|
+
"gemini-3.5-flash-medium": "gemini-3.5-flash",
|
|
4168
|
+
"gemini-3.5-flash-high": "gemini-3.5-flash",
|
|
4169
|
+
"gemini-3.6-flash-low": "gemini-3.6-flash",
|
|
4170
|
+
"gemini-3.6-flash-medium": "gemini-3.6-flash",
|
|
4171
|
+
"gemini-3.6-flash-high": "gemini-3.6-flash",
|
|
4172
|
+
"gemini-3.7-flash-low": "gemini-3.7-flash",
|
|
4173
|
+
"gemini-3.7-flash-medium": "gemini-3.7-flash",
|
|
4174
|
+
"gemini-3.7-flash-high": "gemini-3.7-flash",
|
|
4175
|
+
"gemini-3.8-flash-low": "gemini-3.8-flash",
|
|
4176
|
+
"gemini-3.8-flash-medium": "gemini-3.8-flash",
|
|
4177
|
+
"gemini-3.8-flash-high": "gemini-3.8-flash",
|
|
4178
|
+
// Historical parsing does not authorize serving: admission rejects retired routes.
|
|
4179
|
+
"gemini-claude-opus-4-6-thinking-low": "claude-opus-4-6-thinking",
|
|
4180
|
+
"gemini-claude-opus-4-6-thinking-medium": "claude-opus-4-6-thinking",
|
|
4181
|
+
"gemini-claude-opus-4-6-thinking-high": "claude-opus-4-6-thinking",
|
|
4182
|
+
"gemini-claude-sonnet-4-6-thinking-low": "claude-sonnet-4-6",
|
|
4183
|
+
"gemini-claude-sonnet-4-6-thinking-medium": "claude-sonnet-4-6",
|
|
4184
|
+
"gemini-claude-sonnet-4-6-thinking-high": "claude-sonnet-4-6",
|
|
4185
|
+
"gemini-claude-sonnet-4-6": "claude-sonnet-4-6",
|
|
4186
|
+
"claude-sonnet-4-6-thinking": "claude-sonnet-4-6",
|
|
4187
|
+
"claude-sonnet-4-6-thinking-low": "claude-sonnet-4-6",
|
|
4188
|
+
"claude-sonnet-4-6-thinking-medium": "claude-sonnet-4-6",
|
|
4189
|
+
"claude-sonnet-4-6-thinking-high": "claude-sonnet-4-6",
|
|
4190
|
+
"gpt-oss-120b": "gpt-oss-120b-medium"
|
|
4191
|
+
};
|
|
4192
|
+
QUOTA_GROUP_BY_MODEL_ID = {
|
|
4193
|
+
"claude-opus-4-6-thinking": "non-gemini",
|
|
4194
|
+
"claude-opus-4-6": "non-gemini",
|
|
4195
|
+
"claude-sonnet-4-6-thinking": "non-gemini",
|
|
4196
|
+
"claude-sonnet-4-6": "non-gemini",
|
|
4197
|
+
"gemini-pro-agent": "gemini",
|
|
4198
|
+
"gemini-3.1-pro": "gemini",
|
|
4199
|
+
"gemini-3.1-pro-low": "gemini",
|
|
4200
|
+
"gemini-3.1-pro-high": "gemini",
|
|
4201
|
+
"gemini-3-flash": "gemini",
|
|
4202
|
+
"gemini-3.6-flash-low": "gemini",
|
|
4203
|
+
"gemini-3.6-flash-medium": "gemini",
|
|
4204
|
+
"gemini-3.6-flash-high": "gemini",
|
|
4205
|
+
"gemini-3.6-flash-tiered": "gemini",
|
|
4206
|
+
"gemini-3.7-flash-low": "gemini",
|
|
4207
|
+
"gemini-3.7-flash-medium": "gemini",
|
|
4208
|
+
"gemini-3.7-flash-high": "gemini",
|
|
4209
|
+
"gemini-3.7-flash-tiered": "gemini",
|
|
4210
|
+
"gemini-3.8-flash-low": "gemini",
|
|
4211
|
+
"gemini-3.8-flash-medium": "gemini",
|
|
4212
|
+
"gemini-3.8-flash-high": "gemini",
|
|
4213
|
+
"gemini-3.8-flash-tiered": "gemini",
|
|
4214
|
+
"gemini-3.1-flash-image": "gemini",
|
|
4215
|
+
"gpt-oss-120b": "non-gemini",
|
|
4216
|
+
"gpt-oss-120b-medium": "non-gemini"
|
|
4217
|
+
};
|
|
4218
|
+
ANTIGRAVITY_OPENCODE_MODEL_IDS = [
|
|
4219
|
+
"antigravity-gemini-4-argon",
|
|
4220
|
+
"antigravity-gemini-4-carbon",
|
|
4221
|
+
"antigravity-gemini-4-hydrogen",
|
|
4222
|
+
"antigravity-gemini-3.8-flash",
|
|
4223
|
+
"antigravity-gemini-3.1-flash-image",
|
|
4224
|
+
"antigravity-claude-sonnet-5-5",
|
|
4225
|
+
"antigravity-claude-opus-5-5",
|
|
4226
|
+
"antigravity-gpt-oss-120b-medium"
|
|
4227
|
+
];
|
|
4228
|
+
OPENCODE_MODEL_DEFINITIONS = pickModelDefinitions(ANTIGRAVITY_OPENCODE_MODEL_IDS);
|
|
4229
|
+
}
|
|
4230
|
+
});
|
|
4231
|
+
|
|
4232
|
+
// ../core/dist/rotation.js
|
|
4233
|
+
var QUOTA_EXHAUSTED_BACKOFFS, MAX_QUOTA_EXHAUSTED_BACKOFF_MS;
|
|
4234
|
+
var init_rotation = __esm({
|
|
4235
|
+
"../core/dist/rotation.js"() {
|
|
4236
|
+
"use strict";
|
|
4237
|
+
QUOTA_EXHAUSTED_BACKOFFS = [
|
|
4238
|
+
6e4,
|
|
4239
|
+
3e5,
|
|
4240
|
+
18e5,
|
|
4241
|
+
72e5
|
|
4242
|
+
];
|
|
4243
|
+
MAX_QUOTA_EXHAUSTED_BACKOFF_MS = Math.max(...QUOTA_EXHAUSTED_BACKOFFS);
|
|
4244
|
+
}
|
|
4245
|
+
});
|
|
4246
|
+
|
|
4247
|
+
// ../core/dist/account-selector.js
|
|
4248
|
+
function resolveQuotaGroup(family, model, cachedQuota) {
|
|
4249
|
+
if (model) {
|
|
4250
|
+
const registryGroup = getQuotaGroupForModel(model, cachedQuota?.["gemini-argon"] !== void 0);
|
|
4251
|
+
if (registryGroup)
|
|
4252
|
+
return registryGroup;
|
|
4253
|
+
const lower = model.toLowerCase();
|
|
4254
|
+
if (lower.includes("claude") || lower.includes("gpt-oss")) {
|
|
4255
|
+
return "non-gemini";
|
|
4256
|
+
}
|
|
4257
|
+
if (lower.includes("gemini"))
|
|
4258
|
+
return "gemini";
|
|
4259
|
+
}
|
|
4260
|
+
return family === "claude" ? "non-gemini" : "gemini";
|
|
4261
|
+
}
|
|
4262
|
+
function reconcileManualLimitClear(account) {
|
|
4263
|
+
if (account.rateLimitClearedAt === void 0)
|
|
4264
|
+
return;
|
|
4265
|
+
for (const key of Object.keys(account.rateLimitResetTimes)) {
|
|
4266
|
+
if ((account.rateLimitWrittenAt?.[key] ?? 0) > account.rateLimitClearedAt)
|
|
4267
|
+
continue;
|
|
4268
|
+
delete account.rateLimitResetTimes[key];
|
|
4269
|
+
if (account.rateLimitWrittenAt)
|
|
4270
|
+
delete account.rateLimitWrittenAt[key];
|
|
4271
|
+
}
|
|
4272
|
+
}
|
|
4273
|
+
function reconcileRateLimitsFromReading(account, reading, now) {
|
|
4274
|
+
const at = reading.checkedAt;
|
|
4275
|
+
if (at === void 0 || !Number.isFinite(at) || at <= 0 || at > now)
|
|
4276
|
+
return [];
|
|
4277
|
+
const cleared = [];
|
|
4278
|
+
for (const key of Object.keys(account.rateLimitResetTimes)) {
|
|
4279
|
+
const match = /^(claude|gemini)(?::(.+))?$/.exec(key);
|
|
4280
|
+
const writtenAt = account.rateLimitWrittenAt?.[key];
|
|
4281
|
+
if (!match || writtenAt === void 0 || writtenAt >= at)
|
|
4282
|
+
continue;
|
|
4283
|
+
const group = resolveQuotaGroup(match[1], match[2], reading.quota);
|
|
4284
|
+
const quota = reading.quota?.[group];
|
|
4285
|
+
if (quota?.remainingFraction === 0) {
|
|
4286
|
+
const reset = quotaExhaustedUntil({ cachedQuota: reading.quota, cachedQuotaUpdatedAt: at }, match[1], match[2], now);
|
|
4287
|
+
if (reset > (account.rateLimitResetTimes[key] ?? 0) && reset > now) {
|
|
4288
|
+
account.rateLimitResetTimes[key] = reset;
|
|
4289
|
+
account.rateLimitWrittenAt[key] = at;
|
|
4290
|
+
cleared.push(key);
|
|
4291
|
+
}
|
|
4292
|
+
continue;
|
|
4293
|
+
}
|
|
4294
|
+
if (quota?.remainingFraction === void 0 || !Number.isFinite(quota.remainingFraction) || quota.remainingFraction <= 0)
|
|
4295
|
+
continue;
|
|
4296
|
+
delete account.rateLimitResetTimes[key];
|
|
4297
|
+
if (account.rateLimitWrittenAt)
|
|
4298
|
+
delete account.rateLimitWrittenAt[key];
|
|
4299
|
+
cleared.push(key);
|
|
4300
|
+
}
|
|
4301
|
+
return cleared;
|
|
4302
|
+
}
|
|
4303
|
+
function quotaExhaustedUntil(account, family, model, now) {
|
|
4304
|
+
const at = account.cachedQuotaUpdatedAt;
|
|
4305
|
+
if (at === void 0 || !Number.isFinite(at) || at <= 0 || at > now)
|
|
4306
|
+
return 0;
|
|
4307
|
+
const group = resolveQuotaGroup(family, model, account.cachedQuota);
|
|
4308
|
+
const quota = account.cachedQuota?.[group];
|
|
4309
|
+
if (quota?.remainingFraction !== 0)
|
|
4310
|
+
return 0;
|
|
4311
|
+
const resets = quota.windows?.filter((w) => w.remainingFraction === 0).map((w) => Date.parse(w.resetTime)) ?? [];
|
|
4312
|
+
if (quota.resetTime)
|
|
4313
|
+
resets.push(Date.parse(quota.resetTime));
|
|
4314
|
+
return Math.max(0, ...resets.filter(Number.isFinite));
|
|
4315
|
+
}
|
|
4316
|
+
var ACCOUNT_SESSION_STATE_TTL_MS;
|
|
4317
|
+
var init_account_selector = __esm({
|
|
4318
|
+
"../core/dist/account-selector.js"() {
|
|
4319
|
+
"use strict";
|
|
4320
|
+
init_fingerprint();
|
|
4321
|
+
init_model_registry();
|
|
4322
|
+
init_rotation();
|
|
4323
|
+
ACCOUNT_SESSION_STATE_TTL_MS = 24 * 60 * 60 * 1e3;
|
|
4324
|
+
}
|
|
4325
|
+
});
|
|
4326
|
+
|
|
3975
4327
|
// ../core/dist/account-repository.js
|
|
3976
4328
|
import { createHash as createHash2, randomUUID as randomUUID3 } from "node:crypto";
|
|
3977
4329
|
import { mkdir as mkdir2, open as open2, readFile as readFile2, realpath as realpath2, stat, unlink as unlink3 } from "node:fs/promises";
|
|
@@ -4035,6 +4387,12 @@ function mergeSameCredential(stored, incoming) {
|
|
|
4035
4387
|
if (incoming.rateLimitResetTimes !== void 0) {
|
|
4036
4388
|
out.rateLimitResetTimes = mergeRateLimitResets(stored.rateLimitResetTimes, incoming.rateLimitResetTimes);
|
|
4037
4389
|
}
|
|
4390
|
+
if (incoming.rateLimitWrittenAt !== void 0) {
|
|
4391
|
+
out.rateLimitWrittenAt = mergeRateLimitResets(stored.rateLimitWrittenAt, incoming.rateLimitWrittenAt);
|
|
4392
|
+
}
|
|
4393
|
+
const clearedAt = latest(stored.rateLimitClearedAt, incoming.rateLimitClearedAt);
|
|
4394
|
+
if (clearedAt !== void 0)
|
|
4395
|
+
out.rateLimitClearedAt = clearedAt;
|
|
4038
4396
|
const extensions = mergeExtensions(stored.extensions, incoming.extensions);
|
|
4039
4397
|
if (extensions !== void 0)
|
|
4040
4398
|
out.extensions = extensions;
|
|
@@ -4103,12 +4461,72 @@ function applyCooldownObservation(metadata, observation) {
|
|
|
4103
4461
|
}
|
|
4104
4462
|
return next;
|
|
4105
4463
|
}
|
|
4106
|
-
function applyRateLimitObservation(metadata, resets) {
|
|
4464
|
+
function applyRateLimitObservation(metadata, resets, writtenAt = {}) {
|
|
4465
|
+
const next = {
|
|
4466
|
+
...metadata,
|
|
4467
|
+
rateLimitResetTimes: mergeRateLimitResets(metadata.rateLimitResetTimes, resets),
|
|
4468
|
+
rateLimitWrittenAt: mergeRateLimitResets(metadata.rateLimitWrittenAt, writtenAt)
|
|
4469
|
+
};
|
|
4470
|
+
if (metadata.rateLimitClearedAt != null) {
|
|
4471
|
+
const state = {
|
|
4472
|
+
rateLimitResetTimes: numericLimits(next.rateLimitResetTimes),
|
|
4473
|
+
rateLimitWrittenAt: numericLimits(next.rateLimitWrittenAt),
|
|
4474
|
+
rateLimitClearedAt: metadata.rateLimitClearedAt
|
|
4475
|
+
};
|
|
4476
|
+
reconcileManualLimitClear(state);
|
|
4477
|
+
return { ...next, ...state };
|
|
4478
|
+
}
|
|
4479
|
+
return next;
|
|
4480
|
+
}
|
|
4481
|
+
function applyRateLimitReadingUpdate(metadata, reading, now) {
|
|
4482
|
+
const state = {
|
|
4483
|
+
rateLimitResetTimes: numericLimits(metadata.rateLimitResetTimes),
|
|
4484
|
+
rateLimitWrittenAt: numericLimits(metadata.rateLimitWrittenAt),
|
|
4485
|
+
rateLimitClearedAt: metadata.rateLimitClearedAt ?? void 0
|
|
4486
|
+
};
|
|
4487
|
+
reconcileManualLimitClear(state);
|
|
4488
|
+
const changed = reconcileRateLimitsFromReading(state, reading, now);
|
|
4489
|
+
if (changed.length === 0)
|
|
4490
|
+
return metadata;
|
|
4491
|
+
const resets = { ...metadata.rateLimitResetTimes };
|
|
4492
|
+
const written = { ...metadata.rateLimitWrittenAt };
|
|
4493
|
+
for (const key of changed) {
|
|
4494
|
+
const reset = state.rateLimitResetTimes[key];
|
|
4495
|
+
if (reset === void 0) {
|
|
4496
|
+
delete resets[key];
|
|
4497
|
+
delete written[key];
|
|
4498
|
+
} else {
|
|
4499
|
+
resets[key] = reset;
|
|
4500
|
+
written[key] = state.rateLimitWrittenAt[key] ?? null;
|
|
4501
|
+
}
|
|
4502
|
+
}
|
|
4107
4503
|
return {
|
|
4108
4504
|
...metadata,
|
|
4109
|
-
rateLimitResetTimes:
|
|
4505
|
+
rateLimitResetTimes: resets,
|
|
4506
|
+
rateLimitWrittenAt: written
|
|
4507
|
+
};
|
|
4508
|
+
}
|
|
4509
|
+
function rateLimitReadingUpdateOf(quota) {
|
|
4510
|
+
const groups = {};
|
|
4511
|
+
for (const name of ["gemini", "non-gemini", "gemini-argon"]) {
|
|
4512
|
+
const group = quota.cachedQuota?.[name];
|
|
4513
|
+
if (group)
|
|
4514
|
+
groups[name] = {
|
|
4515
|
+
modelCount: group.modelCount,
|
|
4516
|
+
...group.remainingFraction != null ? { remainingFraction: group.remainingFraction } : {},
|
|
4517
|
+
...group.resetTime != null ? { resetTime: group.resetTime } : {},
|
|
4518
|
+
...group.windows != null ? { windows: group.windows } : {}
|
|
4519
|
+
};
|
|
4520
|
+
}
|
|
4521
|
+
return {
|
|
4522
|
+
kind: "quota-reading",
|
|
4523
|
+
checkedAt: quota.cachedQuotaUpdatedAt ?? void 0,
|
|
4524
|
+
quota: groups
|
|
4110
4525
|
};
|
|
4111
4526
|
}
|
|
4527
|
+
function numericLimits(values) {
|
|
4528
|
+
return Object.fromEntries(Object.entries(values ?? {}).filter((entry) => typeof entry[1] === "number"));
|
|
4529
|
+
}
|
|
4112
4530
|
function applySwitch(metadata, reason) {
|
|
4113
4531
|
return { ...metadata, lastSwitchReason: reason };
|
|
4114
4532
|
}
|
|
@@ -4472,6 +4890,7 @@ var init_account_repository = __esm({
|
|
|
4472
4890
|
init_account_migration();
|
|
4473
4891
|
init_account_repository_codecs();
|
|
4474
4892
|
init_account_repository_types();
|
|
4893
|
+
init_account_selector();
|
|
4475
4894
|
STORE_SAVE_LOCK = {
|
|
4476
4895
|
name: "save",
|
|
4477
4896
|
ttlMs: 1e4,
|
|
@@ -5207,7 +5626,7 @@ var init_account_repository = __esm({
|
|
|
5207
5626
|
return this.applyToMetadata("recordCooldown", ref, (m) => applyCooldownObservation(m, observation));
|
|
5208
5627
|
}
|
|
5209
5628
|
recordRateLimits(ref, resets) {
|
|
5210
|
-
return this.applyToMetadata("recordRateLimits", ref, (m) => applyRateLimitObservation(m, resets));
|
|
5629
|
+
return this.applyToMetadata("recordRateLimits", ref, (m) => applyRateLimitObservation(m, resets, Object.fromEntries(Object.keys(resets).map((key) => [key, this.now()]))));
|
|
5211
5630
|
}
|
|
5212
5631
|
recordSwitch(ref, reason) {
|
|
5213
5632
|
return this.applyToMetadata("recordSwitch", ref, (m) => applySwitch(m, reason));
|
|
@@ -5254,6 +5673,10 @@ var init_account_repository = __esm({
|
|
|
5254
5673
|
});
|
|
5255
5674
|
}
|
|
5256
5675
|
await this.store.recordQuota(ref.id, credentialFenceOf(ref), encoded);
|
|
5676
|
+
await this.updateMetadata(ref, (metadata) => metadata ? {
|
|
5677
|
+
kind: "set",
|
|
5678
|
+
metadata: applyRateLimitReadingUpdate(metadata, rateLimitReadingUpdateOf(observation), this.now())
|
|
5679
|
+
} : { kind: "keep" });
|
|
5257
5680
|
});
|
|
5258
5681
|
}
|
|
5259
5682
|
// ---- selection and roster ---------------------------------------------
|
|
@@ -5705,359 +6128,85 @@ var init_account_repository = __esm({
|
|
|
5705
6128
|
const allRows = await this.readRows("replacePool");
|
|
5706
6129
|
const rows = preparation ? allRows.filter((row) => row.staged?.reservation === preparation.reservation) : published ? allRows.filter((row) => row.invalid !== "roster") : allRows;
|
|
5707
6130
|
const mismatch = (input, problem) => refusal("replacePool", "unexpected", `input ${input.id} ${problem} ${preparation ? "during preparation" : "after the replacement"}`, { rowId: input.id });
|
|
5708
|
-
for (const input of inputs) {
|
|
5709
|
-
const row = rows.find((candidate) => candidate.id === input.id);
|
|
5710
|
-
if (row === void 0 || row.invalid !== void 0 || row.torn === true || row.credential?.type !== "oauth" || row.credential.refresh !== input.refreshToken || row.stamp !== "bound") {
|
|
5711
|
-
throw mismatch(input, "is not in the pool");
|
|
5712
|
-
}
|
|
5713
|
-
if (preparation && (row.enabled || row.credentialEpoch !== preparation.finalize.find((ref) => ref.id === input.id)?.attribution.credentialEpoch))
|
|
5714
|
-
throw mismatch(input, "does not hold its disabled prepared credential");
|
|
5715
|
-
if (published && (row.staged || row.enabled !== (input.metadata.enabled !== false)))
|
|
5716
|
-
throw mismatch(input, "has not been finalized with its requested enabled state");
|
|
5717
|
-
if (row.identity !== input.identity) {
|
|
5718
|
-
throw mismatch(input, "is recorded for another identity");
|
|
5719
|
-
}
|
|
5720
|
-
if (row.providerStateDropped !== void 0 || row.providerState === void 0 || canonicalJson(encodeProviderMetadata(decodeProviderState(row.providerState).metadata)) !== canonicalJson(encodeProviderMetadata(input.metadata))) {
|
|
5721
|
-
throw mismatch(input, "does not hold its requested metadata");
|
|
5722
|
-
}
|
|
5723
|
-
if (row.quota !== void 0) {
|
|
5724
|
-
throw mismatch(input, "holds a quota reading");
|
|
5725
|
-
}
|
|
5726
|
-
}
|
|
5727
|
-
if (rows.length !== inputs.length || rows.some((row, index) => row.id !== inputs[index]?.id)) {
|
|
5728
|
-
throw refusal("replacePool", "unexpected", "the pool does not hold exactly the replacement inputs, in their order");
|
|
5729
|
-
}
|
|
5730
|
-
}
|
|
5731
|
-
transferPath(id) {
|
|
5732
|
-
return join3(this.paths.transfersDir, `${id}.json`);
|
|
5733
|
-
}
|
|
5734
|
-
async writeTransfer(id, inputs) {
|
|
5735
|
-
await mkdir2(this.paths.transfersDir, { recursive: true, mode: 448 });
|
|
5736
|
-
const body = {
|
|
5737
|
-
schemaVersion: 1,
|
|
5738
|
-
managementId: id,
|
|
5739
|
-
inputs: inputs.map(encodeLoginInput)
|
|
5740
|
-
};
|
|
5741
|
-
const handle = await open2(this.transferPath(id), "wx", 384);
|
|
5742
|
-
try {
|
|
5743
|
-
await handle.writeFile(JSON.stringify(body));
|
|
5744
|
-
await handle.sync();
|
|
5745
|
-
} finally {
|
|
5746
|
-
await handle.close();
|
|
5747
|
-
}
|
|
5748
|
-
for (const path2 of [this.paths.transfersDir, this.paths.storeDir]) {
|
|
5749
|
-
const directory = await open2(path2, "r");
|
|
5750
|
-
try {
|
|
5751
|
-
await directory.sync();
|
|
5752
|
-
} finally {
|
|
5753
|
-
await directory.close();
|
|
5754
|
-
}
|
|
5755
|
-
}
|
|
5756
|
-
}
|
|
5757
|
-
async readTransfer(id) {
|
|
5758
|
-
const raw = JSON.parse(await readFile2(this.transferPath(id), "utf8"));
|
|
5759
|
-
return decodeTransferFile(raw, id);
|
|
5760
|
-
}
|
|
5761
|
-
async discardTransfer(id) {
|
|
5762
|
-
try {
|
|
5763
|
-
await unlink3(this.transferPath(id));
|
|
5764
|
-
} catch (error) {
|
|
5765
|
-
if (!(isRecord(error) && error.code === "ENOENT"))
|
|
5766
|
-
throw error;
|
|
5767
|
-
}
|
|
5768
|
-
}
|
|
5769
|
-
// ---- draining ----------------------------------------------------------
|
|
5770
|
-
flush() {
|
|
5771
|
-
return this.drain();
|
|
5772
|
-
}
|
|
5773
|
-
async drain() {
|
|
5774
|
-
while (this.inFlight.size > 0) {
|
|
5775
|
-
await Promise.allSettled([...this.inFlight]);
|
|
5776
|
-
}
|
|
5777
|
-
const report = { completed: this.completed, failures: this.failures };
|
|
5778
|
-
this.completed = 0;
|
|
5779
|
-
this.failures = [];
|
|
5780
|
-
return report;
|
|
5781
|
-
}
|
|
5782
|
-
async dispose() {
|
|
5783
|
-
this.closing = true;
|
|
5784
|
-
return this.drain();
|
|
5785
|
-
}
|
|
5786
|
-
};
|
|
5787
|
-
}
|
|
5788
|
-
});
|
|
5789
|
-
|
|
5790
|
-
// ../core/dist/fingerprint.js
|
|
5791
|
-
function normalizeHarnessPlatform(platform = process.platform) {
|
|
5792
|
-
return platform === "win32" ? "windows" : platform || "unknown";
|
|
5793
|
-
}
|
|
5794
|
-
function normalizeHarnessArch(arch = process.arch) {
|
|
5795
|
-
switch (arch) {
|
|
5796
|
-
case "x64":
|
|
5797
|
-
return "amd64";
|
|
5798
|
-
case "ia32":
|
|
5799
|
-
return "386";
|
|
5800
|
-
default:
|
|
5801
|
-
return arch || "unknown";
|
|
5802
|
-
}
|
|
5803
|
-
}
|
|
5804
|
-
function buildAntigravityHarnessUserAgent(version = AGY_CLI_VERSION, platform = process.platform, arch = process.arch, authMethod = "consumer") {
|
|
5805
|
-
const osType = normalizeHarnessPlatform(platform);
|
|
5806
|
-
const normalizedArch = normalizeHarnessArch(arch);
|
|
5807
|
-
const changeList = version === AGY_CLI_VERSION ? `; cl=${AGY_CLI_CHANGE_LIST}` : "";
|
|
5808
|
-
return `antigravity/cli/${version} (aidev_client; os_type=${osType}; arch=${normalizedArch}${changeList}; auth_method=${authMethod})`;
|
|
5809
|
-
}
|
|
5810
|
-
function buildAntigravityHarnessLoadCodeAssistUserAgent(version = AGY_CLI_VERSION) {
|
|
5811
|
-
return buildAntigravityHarnessUserAgent(version);
|
|
5812
|
-
}
|
|
5813
|
-
function buildAntigravityLoadCodeAssistMetadata() {
|
|
5814
|
-
return { ideType: "ANTIGRAVITY" };
|
|
5815
|
-
}
|
|
5816
|
-
function buildAntigravityHarnessBootstrapHeaders(accessToken) {
|
|
5817
|
-
return {
|
|
5818
|
-
"User-Agent": buildAntigravityHarnessLoadCodeAssistUserAgent(),
|
|
5819
|
-
Authorization: `Bearer ${accessToken}`,
|
|
5820
|
-
"Content-Type": "application/json",
|
|
5821
|
-
"Accept-Encoding": "gzip"
|
|
5822
|
-
};
|
|
5823
|
-
}
|
|
5824
|
-
var AGY_CLI_VERSION, AGY_CLI_CHANGE_LIST;
|
|
5825
|
-
var init_fingerprint = __esm({
|
|
5826
|
-
"../core/dist/fingerprint.js"() {
|
|
5827
|
-
"use strict";
|
|
5828
|
-
AGY_CLI_VERSION = "1.5.8";
|
|
5829
|
-
AGY_CLI_CHANGE_LIST = "1020628950";
|
|
5830
|
-
}
|
|
5831
|
-
});
|
|
5832
|
-
|
|
5833
|
-
// ../core/dist/model-registry.js
|
|
5834
|
-
function defineModel(id, model) {
|
|
5835
|
-
return {
|
|
5836
|
-
id,
|
|
5837
|
-
release_date: MODEL_RELEASE_DATE,
|
|
5838
|
-
attachment: model.modalities.input.some((modality) => modality !== "text"),
|
|
5839
|
-
temperature: true,
|
|
5840
|
-
tool_call: true,
|
|
5841
|
-
cost: { ...DEFAULT_COST },
|
|
5842
|
-
options: { ...DEFAULT_OPTIONS },
|
|
5843
|
-
...model
|
|
5844
|
-
};
|
|
5845
|
-
}
|
|
5846
|
-
function pickModelDefinitions(ids) {
|
|
5847
|
-
return Object.fromEntries(ids.map((id) => [id, ALL_MODEL_DEFINITIONS[id]]));
|
|
5848
|
-
}
|
|
5849
|
-
function getResolverAliasMap() {
|
|
5850
|
-
return RESOLVER_ALIASES;
|
|
5851
|
-
}
|
|
5852
|
-
function getQuotaGroupForModel(modelId, hasArgonPool = false) {
|
|
5853
|
-
const normalized = modelId.toLowerCase();
|
|
5854
|
-
if (isGeminiHydrogenModel(normalized))
|
|
5855
|
-
return "gemini";
|
|
5856
|
-
if (isGeminiCarbonModel(normalized))
|
|
5857
|
-
return "gemini";
|
|
5858
|
-
if (isGeminiArgonModel(normalized))
|
|
5859
|
-
return hasArgonPool ? "gemini-argon" : void 0;
|
|
5860
|
-
return QUOTA_GROUP_BY_MODEL_ID[normalized] ?? // Check Claude / GPT-OSS substrings BEFORE the `gemini` substring so
|
|
5861
|
-
// a `gemini-claude-*` alias (which is a Claude route exposed under
|
|
5862
|
-
// a `gemini-` namespace) attributes to the non-gemini pool rather
|
|
5863
|
-
// than the gemini pool. Substring matching is required because the
|
|
5864
|
-
// alias IDs start with `gemini-` but contain `claude`.
|
|
5865
|
-
(normalized.includes("claude") || normalized.includes("gpt-oss") ? "non-gemini" : normalized.startsWith("gemini") || normalized.startsWith("tab_") ? "gemini" : void 0);
|
|
5866
|
-
}
|
|
5867
|
-
function isGeminiArgonModel(model) {
|
|
5868
|
-
return /^(?:antigravity-)?gemini-4-argon(?:-(?:low|medium|high))?$/.test(model.toLowerCase());
|
|
5869
|
-
}
|
|
5870
|
-
function isGeminiCarbonModel(model) {
|
|
5871
|
-
return /^(?:antigravity-)?gemini-4-carbon(?:-(?:low|medium|high))?$/.test(model.toLowerCase());
|
|
5872
|
-
}
|
|
5873
|
-
function isGeminiHydrogenModel(model) {
|
|
5874
|
-
return /^(?:antigravity-)?gemini-4-hydrogen(?:-(?:low|medium|high|xhigh))?$/.test(model.toLowerCase());
|
|
5875
|
-
}
|
|
5876
|
-
var DEFAULT_MODALITIES, MODEL_RELEASE_DATE, DEFAULT_COST, DEFAULT_OPTIONS, ALL_MODEL_DEFINITIONS, RESOLVER_ALIASES, QUOTA_GROUP_BY_MODEL_ID, ANTIGRAVITY_OPENCODE_MODEL_IDS, OPENCODE_MODEL_DEFINITIONS;
|
|
5877
|
-
var init_model_registry = __esm({
|
|
5878
|
-
"../core/dist/model-registry.js"() {
|
|
5879
|
-
"use strict";
|
|
5880
|
-
DEFAULT_MODALITIES = {
|
|
5881
|
-
input: ["text", "image", "pdf"],
|
|
5882
|
-
output: ["text"]
|
|
5883
|
-
};
|
|
5884
|
-
MODEL_RELEASE_DATE = "";
|
|
5885
|
-
DEFAULT_COST = { input: 0, output: 0 };
|
|
5886
|
-
DEFAULT_OPTIONS = {};
|
|
5887
|
-
ALL_MODEL_DEFINITIONS = {
|
|
5888
|
-
"antigravity-gemini-4-hydrogen": defineModel("antigravity-gemini-4-hydrogen", {
|
|
5889
|
-
name: "Gemini 4 Hydrogen (Antigravity)",
|
|
5890
|
-
reasoning: true,
|
|
5891
|
-
limit: { context: 1048576, output: 262144 },
|
|
5892
|
-
modalities: DEFAULT_MODALITIES,
|
|
5893
|
-
variants: {
|
|
5894
|
-
low: { thinkingLevel: "low" },
|
|
5895
|
-
medium: { thinkingLevel: "medium" },
|
|
5896
|
-
high: { thinkingLevel: "high" },
|
|
5897
|
-
xhigh: { thinkingLevel: "xhigh" }
|
|
6131
|
+
for (const input of inputs) {
|
|
6132
|
+
const row = rows.find((candidate) => candidate.id === input.id);
|
|
6133
|
+
if (row === void 0 || row.invalid !== void 0 || row.torn === true || row.credential?.type !== "oauth" || row.credential.refresh !== input.refreshToken || row.stamp !== "bound") {
|
|
6134
|
+
throw mismatch(input, "is not in the pool");
|
|
6135
|
+
}
|
|
6136
|
+
if (preparation && (row.enabled || row.credentialEpoch !== preparation.finalize.find((ref) => ref.id === input.id)?.attribution.credentialEpoch))
|
|
6137
|
+
throw mismatch(input, "does not hold its disabled prepared credential");
|
|
6138
|
+
if (published && (row.staged || row.enabled !== (input.metadata.enabled !== false)))
|
|
6139
|
+
throw mismatch(input, "has not been finalized with its requested enabled state");
|
|
6140
|
+
if (row.identity !== input.identity) {
|
|
6141
|
+
throw mismatch(input, "is recorded for another identity");
|
|
6142
|
+
}
|
|
6143
|
+
if (row.providerStateDropped !== void 0 || row.providerState === void 0 || canonicalJson(encodeProviderMetadata(decodeProviderState(row.providerState).metadata)) !== canonicalJson(encodeProviderMetadata(input.metadata))) {
|
|
6144
|
+
throw mismatch(input, "does not hold its requested metadata");
|
|
6145
|
+
}
|
|
6146
|
+
if (row.quota !== void 0) {
|
|
6147
|
+
throw mismatch(input, "holds a quota reading");
|
|
6148
|
+
}
|
|
5898
6149
|
}
|
|
5899
|
-
|
|
5900
|
-
|
|
5901
|
-
name: "Gemini 4 Argon (Antigravity)",
|
|
5902
|
-
reasoning: true,
|
|
5903
|
-
limit: { context: 1048576, output: 65536 },
|
|
5904
|
-
modalities: DEFAULT_MODALITIES,
|
|
5905
|
-
variants: {
|
|
5906
|
-
low: { thinkingLevel: "low" },
|
|
5907
|
-
medium: { thinkingLevel: "medium" },
|
|
5908
|
-
high: { thinkingLevel: "high" }
|
|
6150
|
+
if (rows.length !== inputs.length || rows.some((row, index) => row.id !== inputs[index]?.id)) {
|
|
6151
|
+
throw refusal("replacePool", "unexpected", "the pool does not hold exactly the replacement inputs, in their order");
|
|
5909
6152
|
}
|
|
5910
|
-
}
|
|
5911
|
-
|
|
5912
|
-
|
|
5913
|
-
|
|
5914
|
-
|
|
5915
|
-
|
|
5916
|
-
|
|
5917
|
-
|
|
5918
|
-
|
|
5919
|
-
|
|
6153
|
+
}
|
|
6154
|
+
transferPath(id) {
|
|
6155
|
+
return join3(this.paths.transfersDir, `${id}.json`);
|
|
6156
|
+
}
|
|
6157
|
+
async writeTransfer(id, inputs) {
|
|
6158
|
+
await mkdir2(this.paths.transfersDir, { recursive: true, mode: 448 });
|
|
6159
|
+
const body = {
|
|
6160
|
+
schemaVersion: 1,
|
|
6161
|
+
managementId: id,
|
|
6162
|
+
inputs: inputs.map(encodeLoginInput)
|
|
6163
|
+
};
|
|
6164
|
+
const handle = await open2(this.transferPath(id), "wx", 384);
|
|
6165
|
+
try {
|
|
6166
|
+
await handle.writeFile(JSON.stringify(body));
|
|
6167
|
+
await handle.sync();
|
|
6168
|
+
} finally {
|
|
6169
|
+
await handle.close();
|
|
5920
6170
|
}
|
|
5921
|
-
|
|
5922
|
-
|
|
5923
|
-
|
|
5924
|
-
|
|
5925
|
-
|
|
5926
|
-
|
|
5927
|
-
|
|
5928
|
-
"antigravity-gemini-3.8-flash": defineModel("antigravity-gemini-3.8-flash", {
|
|
5929
|
-
name: "Gemini 3.8 Flash (Antigravity)",
|
|
5930
|
-
reasoning: true,
|
|
5931
|
-
limit: { context: 1048576, output: 65536 },
|
|
5932
|
-
modalities: DEFAULT_MODALITIES,
|
|
5933
|
-
variants: {
|
|
5934
|
-
low: { thinkingLevel: "low" },
|
|
5935
|
-
medium: { thinkingLevel: "medium" },
|
|
5936
|
-
high: { thinkingLevel: "high" }
|
|
6171
|
+
for (const path2 of [this.paths.transfersDir, this.paths.storeDir]) {
|
|
6172
|
+
const directory = await open2(path2, "r");
|
|
6173
|
+
try {
|
|
6174
|
+
await directory.sync();
|
|
6175
|
+
} finally {
|
|
6176
|
+
await directory.close();
|
|
6177
|
+
}
|
|
5937
6178
|
}
|
|
5938
|
-
}
|
|
5939
|
-
|
|
5940
|
-
|
|
5941
|
-
|
|
5942
|
-
|
|
5943
|
-
|
|
5944
|
-
|
|
5945
|
-
|
|
5946
|
-
|
|
5947
|
-
|
|
6179
|
+
}
|
|
6180
|
+
async readTransfer(id) {
|
|
6181
|
+
const raw = JSON.parse(await readFile2(this.transferPath(id), "utf8"));
|
|
6182
|
+
return decodeTransferFile(raw, id);
|
|
6183
|
+
}
|
|
6184
|
+
async discardTransfer(id) {
|
|
6185
|
+
try {
|
|
6186
|
+
await unlink3(this.transferPath(id));
|
|
6187
|
+
} catch (error) {
|
|
6188
|
+
if (!(isRecord(error) && error.code === "ENOENT"))
|
|
6189
|
+
throw error;
|
|
5948
6190
|
}
|
|
5949
|
-
}
|
|
5950
|
-
|
|
5951
|
-
|
|
5952
|
-
|
|
5953
|
-
|
|
5954
|
-
|
|
5955
|
-
|
|
5956
|
-
|
|
5957
|
-
medium: { thinkingLevel: "medium" },
|
|
5958
|
-
high: { thinkingLevel: "high" }
|
|
6191
|
+
}
|
|
6192
|
+
// ---- draining ----------------------------------------------------------
|
|
6193
|
+
flush() {
|
|
6194
|
+
return this.drain();
|
|
6195
|
+
}
|
|
6196
|
+
async drain() {
|
|
6197
|
+
while (this.inFlight.size > 0) {
|
|
6198
|
+
await Promise.allSettled([...this.inFlight]);
|
|
5959
6199
|
}
|
|
5960
|
-
|
|
5961
|
-
|
|
5962
|
-
|
|
5963
|
-
|
|
5964
|
-
|
|
5965
|
-
|
|
5966
|
-
|
|
5967
|
-
|
|
5968
|
-
|
|
5969
|
-
"gemini-4-carbon-low": "gemini-4-carbon",
|
|
5970
|
-
"gemini-4-carbon-medium": "gemini-4-carbon",
|
|
5971
|
-
"gemini-4-carbon-high": "gemini-4-carbon",
|
|
5972
|
-
"gemini-4-argon-low": "gemini-4-argon",
|
|
5973
|
-
"gemini-4-argon-medium": "gemini-4-argon",
|
|
5974
|
-
"gemini-4-argon-high": "gemini-4-argon",
|
|
5975
|
-
"gemini-3.1-pro-low": "gemini-3.1-pro",
|
|
5976
|
-
"gemini-3.1-pro-high": "gemini-3.1-pro",
|
|
5977
|
-
"gemini-3-flash-low": "gemini-3-flash",
|
|
5978
|
-
"gemini-3-flash-medium": "gemini-3-flash",
|
|
5979
|
-
"gemini-3-flash-high": "gemini-3-flash",
|
|
5980
|
-
"gemini-3.5-flash-medium": "gemini-3.5-flash",
|
|
5981
|
-
"gemini-3.5-flash-high": "gemini-3.5-flash",
|
|
5982
|
-
"gemini-3.6-flash-low": "gemini-3.6-flash",
|
|
5983
|
-
"gemini-3.6-flash-medium": "gemini-3.6-flash",
|
|
5984
|
-
"gemini-3.6-flash-high": "gemini-3.6-flash",
|
|
5985
|
-
"gemini-3.7-flash-low": "gemini-3.7-flash",
|
|
5986
|
-
"gemini-3.7-flash-medium": "gemini-3.7-flash",
|
|
5987
|
-
"gemini-3.7-flash-high": "gemini-3.7-flash",
|
|
5988
|
-
"gemini-3.8-flash-low": "gemini-3.8-flash",
|
|
5989
|
-
"gemini-3.8-flash-medium": "gemini-3.8-flash",
|
|
5990
|
-
"gemini-3.8-flash-high": "gemini-3.8-flash",
|
|
5991
|
-
// Historical parsing does not authorize serving: admission rejects retired routes.
|
|
5992
|
-
"gemini-claude-opus-4-6-thinking-low": "claude-opus-4-6-thinking",
|
|
5993
|
-
"gemini-claude-opus-4-6-thinking-medium": "claude-opus-4-6-thinking",
|
|
5994
|
-
"gemini-claude-opus-4-6-thinking-high": "claude-opus-4-6-thinking",
|
|
5995
|
-
"gemini-claude-sonnet-4-6-thinking-low": "claude-sonnet-4-6",
|
|
5996
|
-
"gemini-claude-sonnet-4-6-thinking-medium": "claude-sonnet-4-6",
|
|
5997
|
-
"gemini-claude-sonnet-4-6-thinking-high": "claude-sonnet-4-6",
|
|
5998
|
-
"gemini-claude-sonnet-4-6": "claude-sonnet-4-6",
|
|
5999
|
-
"claude-sonnet-4-6-thinking": "claude-sonnet-4-6",
|
|
6000
|
-
"claude-sonnet-4-6-thinking-low": "claude-sonnet-4-6",
|
|
6001
|
-
"claude-sonnet-4-6-thinking-medium": "claude-sonnet-4-6",
|
|
6002
|
-
"claude-sonnet-4-6-thinking-high": "claude-sonnet-4-6",
|
|
6003
|
-
"gpt-oss-120b": "gpt-oss-120b-medium"
|
|
6004
|
-
};
|
|
6005
|
-
QUOTA_GROUP_BY_MODEL_ID = {
|
|
6006
|
-
"claude-opus-4-6-thinking": "non-gemini",
|
|
6007
|
-
"claude-opus-4-6": "non-gemini",
|
|
6008
|
-
"claude-sonnet-4-6-thinking": "non-gemini",
|
|
6009
|
-
"claude-sonnet-4-6": "non-gemini",
|
|
6010
|
-
"gemini-pro-agent": "gemini",
|
|
6011
|
-
"gemini-3.1-pro": "gemini",
|
|
6012
|
-
"gemini-3.1-pro-low": "gemini",
|
|
6013
|
-
"gemini-3.1-pro-high": "gemini",
|
|
6014
|
-
"gemini-3-flash": "gemini",
|
|
6015
|
-
"gemini-3.6-flash-low": "gemini",
|
|
6016
|
-
"gemini-3.6-flash-medium": "gemini",
|
|
6017
|
-
"gemini-3.6-flash-high": "gemini",
|
|
6018
|
-
"gemini-3.6-flash-tiered": "gemini",
|
|
6019
|
-
"gemini-3.7-flash-low": "gemini",
|
|
6020
|
-
"gemini-3.7-flash-medium": "gemini",
|
|
6021
|
-
"gemini-3.7-flash-high": "gemini",
|
|
6022
|
-
"gemini-3.7-flash-tiered": "gemini",
|
|
6023
|
-
"gemini-3.8-flash-low": "gemini",
|
|
6024
|
-
"gemini-3.8-flash-medium": "gemini",
|
|
6025
|
-
"gemini-3.8-flash-high": "gemini",
|
|
6026
|
-
"gemini-3.8-flash-tiered": "gemini",
|
|
6027
|
-
"gemini-3.1-flash-image": "gemini",
|
|
6028
|
-
"gpt-oss-120b": "non-gemini",
|
|
6029
|
-
"gpt-oss-120b-medium": "non-gemini"
|
|
6200
|
+
const report = { completed: this.completed, failures: this.failures };
|
|
6201
|
+
this.completed = 0;
|
|
6202
|
+
this.failures = [];
|
|
6203
|
+
return report;
|
|
6204
|
+
}
|
|
6205
|
+
async dispose() {
|
|
6206
|
+
this.closing = true;
|
|
6207
|
+
return this.drain();
|
|
6208
|
+
}
|
|
6030
6209
|
};
|
|
6031
|
-
ANTIGRAVITY_OPENCODE_MODEL_IDS = [
|
|
6032
|
-
"antigravity-gemini-4-argon",
|
|
6033
|
-
"antigravity-gemini-4-carbon",
|
|
6034
|
-
"antigravity-gemini-4-hydrogen",
|
|
6035
|
-
"antigravity-gemini-3.8-flash",
|
|
6036
|
-
"antigravity-gemini-3.1-flash-image",
|
|
6037
|
-
"antigravity-claude-sonnet-5-5",
|
|
6038
|
-
"antigravity-claude-opus-5-5",
|
|
6039
|
-
"antigravity-gpt-oss-120b-medium"
|
|
6040
|
-
];
|
|
6041
|
-
OPENCODE_MODEL_DEFINITIONS = pickModelDefinitions(ANTIGRAVITY_OPENCODE_MODEL_IDS);
|
|
6042
|
-
}
|
|
6043
|
-
});
|
|
6044
|
-
|
|
6045
|
-
// ../core/dist/rotation.js
|
|
6046
|
-
var init_rotation = __esm({
|
|
6047
|
-
"../core/dist/rotation.js"() {
|
|
6048
|
-
"use strict";
|
|
6049
|
-
}
|
|
6050
|
-
});
|
|
6051
|
-
|
|
6052
|
-
// ../core/dist/account-selector.js
|
|
6053
|
-
var ACCOUNT_SESSION_STATE_TTL_MS;
|
|
6054
|
-
var init_account_selector = __esm({
|
|
6055
|
-
"../core/dist/account-selector.js"() {
|
|
6056
|
-
"use strict";
|
|
6057
|
-
init_fingerprint();
|
|
6058
|
-
init_model_registry();
|
|
6059
|
-
init_rotation();
|
|
6060
|
-
ACCOUNT_SESSION_STATE_TTL_MS = 24 * 60 * 60 * 1e3;
|
|
6061
6210
|
}
|
|
6062
6211
|
});
|
|
6063
6212
|
|
|
@@ -6142,7 +6291,7 @@ async function rmEvictingDir(evictingPath) {
|
|
|
6142
6291
|
});
|
|
6143
6292
|
}
|
|
6144
6293
|
async function sleep(ms) {
|
|
6145
|
-
await new Promise((
|
|
6294
|
+
await new Promise((resolve25) => setTimeout(resolve25, ms));
|
|
6146
6295
|
}
|
|
6147
6296
|
async function acquireFencedFileLock(options) {
|
|
6148
6297
|
const lockPath = `${options.path}.${options.name}.lock`;
|
|
@@ -6258,8 +6407,8 @@ function buildLock(lockPath, evictingPath, ownerId, options, now) {
|
|
|
6258
6407
|
let released = false;
|
|
6259
6408
|
let lost = false;
|
|
6260
6409
|
let lostResolve = null;
|
|
6261
|
-
let lostPromise = new Promise((
|
|
6262
|
-
lostResolve =
|
|
6410
|
+
let lostPromise = new Promise((resolve25) => {
|
|
6411
|
+
lostResolve = resolve25;
|
|
6263
6412
|
});
|
|
6264
6413
|
const markLost = () => {
|
|
6265
6414
|
if (lost)
|
|
@@ -6269,9 +6418,9 @@ function buildLock(lockPath, evictingPath, ownerId, options, now) {
|
|
|
6269
6418
|
clearInterval(renewTimer);
|
|
6270
6419
|
renewTimer = null;
|
|
6271
6420
|
}
|
|
6272
|
-
const
|
|
6421
|
+
const resolve25 = lostResolve;
|
|
6273
6422
|
lostResolve = null;
|
|
6274
|
-
|
|
6423
|
+
resolve25?.();
|
|
6275
6424
|
};
|
|
6276
6425
|
const setupRenew = () => {
|
|
6277
6426
|
if (options.renew === false)
|
|
@@ -6913,7 +7062,7 @@ var init_account_storage = __esm({
|
|
|
6913
7062
|
}
|
|
6914
7063
|
};
|
|
6915
7064
|
RETRY_DELAYS_MS = [100, 200, 400, 800, 1e3];
|
|
6916
|
-
DEFAULT_SLEEP = (ms) => new Promise((
|
|
7065
|
+
DEFAULT_SLEEP = (ms) => new Promise((resolve25) => setTimeout(resolve25, ms));
|
|
6917
7066
|
DEFAULT_BUILD_BACKUP_PATH = (path2, now) => `${path2}.corrupt-${now.toISOString().replace(/[:.]/g, "-")}`;
|
|
6918
7067
|
}
|
|
6919
7068
|
});
|
|
@@ -7081,7 +7230,7 @@ function getHttpsProxy(url) {
|
|
|
7081
7230
|
}
|
|
7082
7231
|
}
|
|
7083
7232
|
function waitForHead(socket, timeoutMs, onTimeout) {
|
|
7084
|
-
return new Promise((
|
|
7233
|
+
return new Promise((resolve25, reject) => {
|
|
7085
7234
|
let buffer = Buffer2.alloc(0);
|
|
7086
7235
|
const timeout = setTimeout(() => {
|
|
7087
7236
|
onTimeout();
|
|
@@ -7104,7 +7253,7 @@ function waitForHead(socket, timeoutMs, onTimeout) {
|
|
|
7104
7253
|
return;
|
|
7105
7254
|
const head = buffer.subarray(0, marker).toString("latin1");
|
|
7106
7255
|
const leftover = buffer.subarray(marker + 4);
|
|
7107
|
-
cleanup2(() =>
|
|
7256
|
+
cleanup2(() => resolve25({ head, leftover }));
|
|
7108
7257
|
};
|
|
7109
7258
|
socket.on("data", onData);
|
|
7110
7259
|
socket.once("error", onError);
|
|
@@ -7118,7 +7267,7 @@ async function connectViaProxy(proxyUrl, targetUrl, timeoutMs, signal, onDebug)
|
|
|
7118
7267
|
port: Number(proxyUrl.port || DEFAULT_PROXY_PORT),
|
|
7119
7268
|
signal: signal ?? void 0
|
|
7120
7269
|
});
|
|
7121
|
-
await new Promise((
|
|
7270
|
+
await new Promise((resolve25, reject) => {
|
|
7122
7271
|
const timeout = setTimeout(() => {
|
|
7123
7272
|
onDebug?.(`agy transport proxy connect timeout after ${timeoutMs}ms`);
|
|
7124
7273
|
proxySocket.destroy();
|
|
@@ -7127,7 +7276,7 @@ async function connectViaProxy(proxyUrl, targetUrl, timeoutMs, signal, onDebug)
|
|
|
7127
7276
|
const cleanup2 = () => clearTimeout(timeout);
|
|
7128
7277
|
proxySocket.once("connect", () => {
|
|
7129
7278
|
cleanup2();
|
|
7130
|
-
|
|
7279
|
+
resolve25();
|
|
7131
7280
|
});
|
|
7132
7281
|
proxySocket.once("error", (error) => {
|
|
7133
7282
|
cleanup2();
|
|
@@ -7152,7 +7301,7 @@ Host: ${targetHost}:${targetPort}\r
|
|
|
7152
7301
|
if (leftover.length > 0) {
|
|
7153
7302
|
proxySocket.unshift(leftover);
|
|
7154
7303
|
}
|
|
7155
|
-
return await new Promise((
|
|
7304
|
+
return await new Promise((resolve25, reject) => {
|
|
7156
7305
|
const tlsOptions = {
|
|
7157
7306
|
socket: proxySocket,
|
|
7158
7307
|
servername: targetHost,
|
|
@@ -7168,7 +7317,7 @@ Host: ${targetHost}:${targetPort}\r
|
|
|
7168
7317
|
const cleanup2 = () => clearTimeout(timeout);
|
|
7169
7318
|
tlsSocket.once("secureConnect", () => {
|
|
7170
7319
|
cleanup2();
|
|
7171
|
-
|
|
7320
|
+
resolve25(tlsSocket);
|
|
7172
7321
|
});
|
|
7173
7322
|
tlsSocket.once("error", (error) => {
|
|
7174
7323
|
cleanup2();
|
|
@@ -7177,7 +7326,7 @@ Host: ${targetHost}:${targetPort}\r
|
|
|
7177
7326
|
});
|
|
7178
7327
|
}
|
|
7179
7328
|
async function connectDirect(targetUrl, timeoutMs, signal, onDebug) {
|
|
7180
|
-
return await new Promise((
|
|
7329
|
+
return await new Promise((resolve25, reject) => {
|
|
7181
7330
|
const tlsOptions = {
|
|
7182
7331
|
host: targetUrl.hostname,
|
|
7183
7332
|
port: Number(targetUrl.port || DEFAULT_HTTPS_PORT),
|
|
@@ -7194,7 +7343,7 @@ async function connectDirect(targetUrl, timeoutMs, signal, onDebug) {
|
|
|
7194
7343
|
const cleanup2 = () => clearTimeout(timeout);
|
|
7195
7344
|
socket.once("secureConnect", () => {
|
|
7196
7345
|
cleanup2();
|
|
7197
|
-
|
|
7346
|
+
resolve25(socket);
|
|
7198
7347
|
});
|
|
7199
7348
|
socket.once("error", (error) => {
|
|
7200
7349
|
cleanup2();
|
|
@@ -9372,8 +9521,8 @@ async function acquireRefreshFileLockWithClock(options) {
|
|
|
9372
9521
|
let releaseConfirmed = false;
|
|
9373
9522
|
let loss;
|
|
9374
9523
|
let resolveLoss;
|
|
9375
|
-
const lostPromise = new Promise((
|
|
9376
|
-
resolveLoss =
|
|
9524
|
+
const lostPromise = new Promise((resolve25) => {
|
|
9525
|
+
resolveLoss = resolve25;
|
|
9377
9526
|
});
|
|
9378
9527
|
function notifyTimerStep(event) {
|
|
9379
9528
|
try {
|
|
@@ -9537,7 +9686,7 @@ async function acquireRefreshFileLockWithClock(options) {
|
|
|
9537
9686
|
}
|
|
9538
9687
|
}
|
|
9539
9688
|
async function backoff() {
|
|
9540
|
-
await new Promise((
|
|
9689
|
+
await new Promise((resolve25) => setTimeout(resolve25, Math.floor(Math.random() * 4)));
|
|
9541
9690
|
}
|
|
9542
9691
|
async function readLockState(notifyReady = true) {
|
|
9543
9692
|
if (notifyReady && options.onStep)
|
|
@@ -9630,7 +9779,7 @@ async function acquireRefreshFileLockWithClock(options) {
|
|
|
9630
9779
|
const remainingMs = deadline - performance.now();
|
|
9631
9780
|
if (remainingMs <= 0)
|
|
9632
9781
|
throw original;
|
|
9633
|
-
await new Promise((
|
|
9782
|
+
await new Promise((resolve25) => setTimeout(resolve25, Math.min(delayMs, remainingMs)));
|
|
9634
9783
|
if (performance.now() >= deadline)
|
|
9635
9784
|
throw original;
|
|
9636
9785
|
delayMs = Math.min(delayMs * 2, 50);
|
|
@@ -10133,7 +10282,7 @@ async function acquireRefreshFileLockWithClock(options) {
|
|
|
10133
10282
|
const remainingMs = deadline - performance.now();
|
|
10134
10283
|
if (remainingMs <= 0)
|
|
10135
10284
|
break;
|
|
10136
|
-
await new Promise((
|
|
10285
|
+
await new Promise((resolve25) => setTimeout(resolve25, Math.min(delayMs, remainingMs)));
|
|
10137
10286
|
if (windowsPrivateFiles && performance.now() >= deadline)
|
|
10138
10287
|
break;
|
|
10139
10288
|
delayMs = Math.min(delayMs * 2, 50);
|
|
@@ -10218,7 +10367,7 @@ async function withLock(target, options, fn) {
|
|
|
10218
10367
|
timeoutMs: options.timeoutMs
|
|
10219
10368
|
});
|
|
10220
10369
|
}
|
|
10221
|
-
await new Promise((
|
|
10370
|
+
await new Promise((resolve25) => setTimeout(resolve25, Math.min(25, Math.ceil(remaining))));
|
|
10222
10371
|
}
|
|
10223
10372
|
}
|
|
10224
10373
|
var LockContentionError, LockOwnershipError;
|
|
@@ -10308,7 +10457,7 @@ async function acquirePoolLock(spec, defaults, env3) {
|
|
|
10308
10457
|
});
|
|
10309
10458
|
}
|
|
10310
10459
|
const jitter = Math.floor(Math.random() * (options.retryMs + 1));
|
|
10311
|
-
await new Promise((
|
|
10460
|
+
await new Promise((resolve25) => setTimeout(resolve25, Math.min(options.retryMs + jitter, remaining)));
|
|
10312
10461
|
}
|
|
10313
10462
|
}
|
|
10314
10463
|
function definedOnly(spec) {
|
|
@@ -13206,11 +13355,11 @@ var init_quota_writer = __esm({
|
|
|
13206
13355
|
const left = deadline - performance.now();
|
|
13207
13356
|
if (left <= 0)
|
|
13208
13357
|
throw refusal2("pull", id, "lock-contention", `pool quota queue for ${id} is full (${POOL_QUOTA_QUEUE_LIMIT} readings) and the store locks stayed held`, true);
|
|
13209
|
-
await new Promise((
|
|
13358
|
+
await new Promise((resolve25) => {
|
|
13210
13359
|
const done = () => {
|
|
13211
13360
|
clearTimeout(timer);
|
|
13212
13361
|
this.wake.delete(done);
|
|
13213
|
-
|
|
13362
|
+
resolve25();
|
|
13214
13363
|
};
|
|
13215
13364
|
const timer = setTimeout(done, left);
|
|
13216
13365
|
this.wake.add(done);
|
|
@@ -13930,6 +14079,54 @@ var init_store = __esm({
|
|
|
13930
14079
|
}
|
|
13931
14080
|
});
|
|
13932
14081
|
|
|
14082
|
+
// ../core/dist/common-auth-embedded/fs/canonical-file-path.js
|
|
14083
|
+
import { basename as basename4, dirname as dirname9, join as join7, resolve as resolve7 } from "node:path";
|
|
14084
|
+
async function canonicalFilePath(file, fs3) {
|
|
14085
|
+
let target = file;
|
|
14086
|
+
for (let hops = 0; ; hops++) {
|
|
14087
|
+
target = join7(await fs3.realpath(dirname9(target)), basename4(target));
|
|
14088
|
+
let isSymlink;
|
|
14089
|
+
try {
|
|
14090
|
+
isSymlink = (await fs3.lstat(target)).isSymbolicLink();
|
|
14091
|
+
} catch (error) {
|
|
14092
|
+
if (error.code === "ENOENT" && hops === 0)
|
|
14093
|
+
return target;
|
|
14094
|
+
throw error;
|
|
14095
|
+
}
|
|
14096
|
+
if (!isSymlink)
|
|
14097
|
+
return target;
|
|
14098
|
+
if (hops >= maxSymlinkHops)
|
|
14099
|
+
throw new Error("Too many file symlink hops");
|
|
14100
|
+
target = resolve7(dirname9(target), await fs3.readlink(target));
|
|
14101
|
+
}
|
|
14102
|
+
}
|
|
14103
|
+
function canonicalFilePathSync(file, fs3) {
|
|
14104
|
+
let target = file;
|
|
14105
|
+
for (let hops = 0; ; hops++) {
|
|
14106
|
+
target = join7(fs3.realpathSync(dirname9(target)), basename4(target));
|
|
14107
|
+
let isSymlink;
|
|
14108
|
+
try {
|
|
14109
|
+
isSymlink = fs3.lstatSync(target).isSymbolicLink();
|
|
14110
|
+
} catch (error) {
|
|
14111
|
+
if (error.code === "ENOENT" && hops === 0)
|
|
14112
|
+
return target;
|
|
14113
|
+
throw error;
|
|
14114
|
+
}
|
|
14115
|
+
if (!isSymlink)
|
|
14116
|
+
return target;
|
|
14117
|
+
if (hops >= maxSymlinkHops)
|
|
14118
|
+
throw new Error("Too many file symlink hops");
|
|
14119
|
+
target = resolve7(dirname9(target), fs3.readlinkSync(target));
|
|
14120
|
+
}
|
|
14121
|
+
}
|
|
14122
|
+
var maxSymlinkHops;
|
|
14123
|
+
var init_canonical_file_path = __esm({
|
|
14124
|
+
"../core/dist/common-auth-embedded/fs/canonical-file-path.js"() {
|
|
14125
|
+
"use strict";
|
|
14126
|
+
maxSymlinkHops = 40;
|
|
14127
|
+
}
|
|
14128
|
+
});
|
|
14129
|
+
|
|
13933
14130
|
// ../core/dist/common-auth-embedded/fs/lock-constants.js
|
|
13934
14131
|
var WRITER_LOCK_CONSTANTS;
|
|
13935
14132
|
var init_lock_constants = __esm({
|
|
@@ -13960,6 +14157,8 @@ __export(fs_exports, {
|
|
|
13960
14157
|
PrivateFileError: () => PrivateFileError,
|
|
13961
14158
|
WRITER_LOCK_CONSTANTS: () => WRITER_LOCK_CONSTANTS,
|
|
13962
14159
|
acquireRefreshFileLock: () => acquireRefreshFileLock,
|
|
14160
|
+
canonicalFilePath: () => canonicalFilePath,
|
|
14161
|
+
canonicalFilePathSync: () => canonicalFilePathSync,
|
|
13963
14162
|
isLostMarkerRaceError: () => isLostMarkerRaceError,
|
|
13964
14163
|
lockPathFor: () => lockPathFor,
|
|
13965
14164
|
withLock: () => withLock,
|
|
@@ -13969,6 +14168,7 @@ var init_fs = __esm({
|
|
|
13969
14168
|
"../core/dist/common-auth-embedded/fs/index.js"() {
|
|
13970
14169
|
"use strict";
|
|
13971
14170
|
init_atomic_write2();
|
|
14171
|
+
init_canonical_file_path();
|
|
13972
14172
|
init_lock_constants();
|
|
13973
14173
|
init_private_files();
|
|
13974
14174
|
init_refresh_file_lock();
|
|
@@ -16274,7 +16474,7 @@ async function select(terminal, items, options) {
|
|
|
16274
16474
|
writeLine("");
|
|
16275
16475
|
renderedLines = lines;
|
|
16276
16476
|
};
|
|
16277
|
-
return new Promise((
|
|
16477
|
+
return new Promise((resolve25) => {
|
|
16278
16478
|
const wasRaw = stdin.isRaw ?? false;
|
|
16279
16479
|
const cleanup2 = () => {
|
|
16280
16480
|
if (cleaned)
|
|
@@ -16294,7 +16494,7 @@ async function select(terminal, items, options) {
|
|
|
16294
16494
|
};
|
|
16295
16495
|
const finish = (value) => {
|
|
16296
16496
|
cleanup2();
|
|
16297
|
-
|
|
16497
|
+
resolve25(value);
|
|
16298
16498
|
};
|
|
16299
16499
|
const onSignal = () => finish(null);
|
|
16300
16500
|
const onKey = (data) => {
|
|
@@ -16334,7 +16534,7 @@ async function select(terminal, items, options) {
|
|
|
16334
16534
|
stdin.setRawMode(true);
|
|
16335
16535
|
} catch {
|
|
16336
16536
|
cleanup2();
|
|
16337
|
-
|
|
16537
|
+
resolve25(null);
|
|
16338
16538
|
return;
|
|
16339
16539
|
}
|
|
16340
16540
|
stdin.resume();
|
|
@@ -17070,7 +17270,7 @@ var init_watch = __esm({
|
|
|
17070
17270
|
});
|
|
17071
17271
|
|
|
17072
17272
|
// ../core/dist/common-auth-embedded/claustrum/insula.js
|
|
17073
|
-
import { resolve as
|
|
17273
|
+
import { resolve as resolve8 } from "node:path";
|
|
17074
17274
|
import { storeIdentity } from "@cortexkit/claustrum-client";
|
|
17075
17275
|
import { SubcClient } from "@cortexkit/subc-client";
|
|
17076
17276
|
function insulaUsageTransport(options) {
|
|
@@ -17198,8 +17398,8 @@ function refusalCode(error) {
|
|
|
17198
17398
|
}
|
|
17199
17399
|
function acquireInsulaQuotaSource(transport, tokenPath) {
|
|
17200
17400
|
const key = JSON.stringify([
|
|
17201
|
-
|
|
17202
|
-
|
|
17401
|
+
resolve8(transport.connectionFile),
|
|
17402
|
+
resolve8(tokenPath)
|
|
17203
17403
|
]);
|
|
17204
17404
|
let shared3 = sources.get(key);
|
|
17205
17405
|
if (!shared3) {
|
|
@@ -17513,7 +17713,7 @@ var init_any_signal = __esm({
|
|
|
17513
17713
|
import { createHash as createHash5, randomBytes as randomBytes2, randomUUID as randomUUID10 } from "node:crypto";
|
|
17514
17714
|
import { constants as fsConstants } from "node:fs";
|
|
17515
17715
|
import { chmod as chmod2, mkdir as mkdir8, open as open6, readFile as readFile6, realpath as realpath3, rename as rename7, stat as stat5, unlink as unlink7 } from "node:fs/promises";
|
|
17516
|
-
import { basename as
|
|
17716
|
+
import { basename as basename5, dirname as dirname10, extname, isAbsolute as isAbsolute2, join as join8, resolve as resolve9 } from "node:path";
|
|
17517
17717
|
import { ClaustrumCredentialError as ClaustrumCredentialError3, ClaustrumClient as ClaustrumWireClient, writeEnrollmentTokenFile } from "@cortexkit/claustrum-client";
|
|
17518
17718
|
function classifyEnrollmentError(error) {
|
|
17519
17719
|
if (!(error instanceof ClaustrumCredentialError3))
|
|
@@ -17560,9 +17760,9 @@ function connectClaustrumEnrollmentClient(options) {
|
|
|
17560
17760
|
}
|
|
17561
17761
|
function getClaustrumEnrollmentPaths(tokenPath) {
|
|
17562
17762
|
const extension = extname(tokenPath) || ".json";
|
|
17563
|
-
const stem =
|
|
17763
|
+
const stem = basename5(tokenPath, extname(tokenPath));
|
|
17564
17764
|
return {
|
|
17565
|
-
statePath:
|
|
17765
|
+
statePath: join8(dirname10(tokenPath), `${stem}-state${extension}`),
|
|
17566
17766
|
tokenPath
|
|
17567
17767
|
};
|
|
17568
17768
|
}
|
|
@@ -17570,7 +17770,7 @@ function hostEnrollmentPaths(input) {
|
|
|
17570
17770
|
const override = input.override?.trim();
|
|
17571
17771
|
if (override && !isAbsolute2(override) && !input.cwd)
|
|
17572
17772
|
throw new ClaustrumConsumerError("invalid-state", "A relative Claustrum enrollment override needs a base directory");
|
|
17573
|
-
const tokenPath = override ? isAbsolute2(override) ? override :
|
|
17773
|
+
const tokenPath = override ? isAbsolute2(override) ? override : resolve9(input.cwd, override) : join8(input.stateDir, `${input.host}-enrollment.json`);
|
|
17574
17774
|
return getClaustrumEnrollmentPaths(tokenPath);
|
|
17575
17775
|
}
|
|
17576
17776
|
function isRecord6(value) {
|
|
@@ -17676,7 +17876,7 @@ function parseSecretJson(text2) {
|
|
|
17676
17876
|
async function readBoundedJson(path2) {
|
|
17677
17877
|
if (windowsPrivateFiles) {
|
|
17678
17878
|
try {
|
|
17679
|
-
await ensurePrivateDirectory(
|
|
17879
|
+
await ensurePrivateDirectory(dirname10(path2));
|
|
17680
17880
|
const text2 = await readPrivateText(path2, true);
|
|
17681
17881
|
if (Buffer.byteLength(text2) > ENROLLMENT_FILE_MAX_BYTES) {
|
|
17682
17882
|
throw new ClaustrumConsumerError("unsafe-file", "Claustrum enrollment file is too large");
|
|
@@ -17773,7 +17973,7 @@ async function refuseWritableAncestor(parent, options = {}) {
|
|
|
17773
17973
|
throw new ClaustrumConsumerError("unsafe-file", `Claustrum enrollment path has a writable ancestor: ${component}. Another user could replace it. Run: chmod g-w,o-w ${component}`);
|
|
17774
17974
|
}
|
|
17775
17975
|
}
|
|
17776
|
-
const next =
|
|
17976
|
+
const next = dirname10(component);
|
|
17777
17977
|
if (next === component)
|
|
17778
17978
|
return;
|
|
17779
17979
|
component = next;
|
|
@@ -17802,7 +18002,7 @@ async function ensureClaustrumPrivateDirectory(directory, options = {}, what = "
|
|
|
17802
18002
|
await chmod2(directory, 448);
|
|
17803
18003
|
}
|
|
17804
18004
|
async function writeStateAtomic(path2, state, ancestorOptions = {}) {
|
|
17805
|
-
const parent =
|
|
18005
|
+
const parent = dirname10(path2);
|
|
17806
18006
|
await ensureClaustrumPrivateDirectory(parent, ancestorOptions);
|
|
17807
18007
|
await refuseWritableAncestor(parent, ancestorOptions);
|
|
17808
18008
|
const bytes = `${JSON.stringify(state)}
|
|
@@ -17812,7 +18012,7 @@ async function writeStateAtomic(path2, state, ancestorOptions = {}) {
|
|
|
17812
18012
|
}
|
|
17813
18013
|
if (windowsPrivateFiles)
|
|
17814
18014
|
return writePrivateAtomic(path2, bytes);
|
|
17815
|
-
const temporary =
|
|
18015
|
+
const temporary = join8(parent, `.${basename5(path2)}.${process.pid}.${randomUUID10()}.tmp`);
|
|
17816
18016
|
let descriptor;
|
|
17817
18017
|
let created = false;
|
|
17818
18018
|
try {
|
|
@@ -17945,7 +18145,7 @@ function wrongConsumer() {
|
|
|
17945
18145
|
return new ClaustrumConsumerError("wrong-consumer", "Claustrum enrollment state belongs to a different consumer");
|
|
17946
18146
|
}
|
|
17947
18147
|
async function resetClaustrumEnrollmentState(paths, proposedName) {
|
|
17948
|
-
await ensureClaustrumPrivateDirectory(
|
|
18148
|
+
await ensureClaustrumPrivateDirectory(dirname10(paths.statePath));
|
|
17949
18149
|
const lock = await acquireRefreshFileLock({
|
|
17950
18150
|
name: "ceremony",
|
|
17951
18151
|
path: paths.statePath,
|
|
@@ -17983,7 +18183,7 @@ async function removeIfPresent(path2) {
|
|
|
17983
18183
|
}
|
|
17984
18184
|
}
|
|
17985
18185
|
async function disconnectClaustrumEnrollment(paths, proposedName) {
|
|
17986
|
-
await ensureClaustrumPrivateDirectory(
|
|
18186
|
+
await ensureClaustrumPrivateDirectory(dirname10(paths.statePath));
|
|
17987
18187
|
const lock = await acquireRefreshFileLock({
|
|
17988
18188
|
// The same lock as the ceremony, so a token written by a concurrent
|
|
17989
18189
|
// reconcile() can never land after this removes the files.
|
|
@@ -18091,7 +18291,7 @@ var init_enrollment = __esm({
|
|
|
18091
18291
|
return statusFromState(blocked);
|
|
18092
18292
|
}
|
|
18093
18293
|
async reconcile() {
|
|
18094
|
-
await ensureClaustrumPrivateDirectory(
|
|
18294
|
+
await ensureClaustrumPrivateDirectory(dirname10(this.#paths.statePath), this.#ancestorOptions);
|
|
18095
18295
|
const lock = await acquireRefreshFileLock({
|
|
18096
18296
|
name: "ceremony",
|
|
18097
18297
|
path: this.#paths.statePath,
|
|
@@ -18244,8 +18444,8 @@ var init_enrollment = __esm({
|
|
|
18244
18444
|
await writeStateAtomic(this.#paths.statePath, denied, this.#ancestorOptions);
|
|
18245
18445
|
return statusFromState(denied);
|
|
18246
18446
|
}
|
|
18247
|
-
await ensureClaustrumPrivateDirectory(
|
|
18248
|
-
await refuseWritableAncestor(
|
|
18447
|
+
await ensureClaustrumPrivateDirectory(dirname10(this.#paths.tokenPath), this.#ancestorOptions);
|
|
18448
|
+
await refuseWritableAncestor(dirname10(this.#paths.tokenPath), this.#ancestorOptions);
|
|
18249
18449
|
await this.#writeTokenFile(this.#paths.tokenPath, {
|
|
18250
18450
|
token: outcome.token,
|
|
18251
18451
|
token_generation: outcome.tokenGeneration
|
|
@@ -18360,10 +18560,10 @@ async function drainShutdown(pending, onTimeout) {
|
|
|
18360
18560
|
try {
|
|
18361
18561
|
await Promise.race([
|
|
18362
18562
|
drained,
|
|
18363
|
-
new Promise((
|
|
18563
|
+
new Promise((resolve25) => {
|
|
18364
18564
|
timer = setTimeout(() => {
|
|
18365
18565
|
expired = true;
|
|
18366
|
-
|
|
18566
|
+
resolve25();
|
|
18367
18567
|
}, 2e3);
|
|
18368
18568
|
})
|
|
18369
18569
|
]);
|
|
@@ -19158,7 +19358,7 @@ var init_custody = __esm({
|
|
|
19158
19358
|
}
|
|
19159
19359
|
#receiptBackoff(delay3, signal) {
|
|
19160
19360
|
this.#check(signal);
|
|
19161
|
-
return new Promise((
|
|
19361
|
+
return new Promise((resolve25, reject) => {
|
|
19162
19362
|
const abort = () => {
|
|
19163
19363
|
this.#clearTimeout(timer);
|
|
19164
19364
|
signal.removeEventListener("abort", abort);
|
|
@@ -19166,7 +19366,7 @@ var init_custody = __esm({
|
|
|
19166
19366
|
};
|
|
19167
19367
|
const timer = this.#setTimeout(() => {
|
|
19168
19368
|
signal.removeEventListener("abort", abort);
|
|
19169
|
-
|
|
19369
|
+
resolve25();
|
|
19170
19370
|
}, delay3);
|
|
19171
19371
|
timer.unref?.();
|
|
19172
19372
|
signal.addEventListener("abort", abort, { once: true });
|
|
@@ -19516,7 +19716,7 @@ var init_interlock = __esm({
|
|
|
19516
19716
|
// ../core/dist/common-auth-embedded/claustrum/roster.js
|
|
19517
19717
|
import { createHash as createHash6 } from "node:crypto";
|
|
19518
19718
|
import { stat as stat6 } from "node:fs/promises";
|
|
19519
|
-
import { resolve as
|
|
19719
|
+
import { resolve as resolve10 } from "node:path";
|
|
19520
19720
|
function vaultRosterSeed(roster) {
|
|
19521
19721
|
return {
|
|
19522
19722
|
declined: roster.declined.map((entry) => ({ ...entry })),
|
|
@@ -19918,16 +20118,16 @@ function applyVaultQuota(current, input) {
|
|
|
19918
20118
|
};
|
|
19919
20119
|
}
|
|
19920
20120
|
function forgetPendingVaultDiscovery(path2) {
|
|
19921
|
-
pendingDiscoveries.delete(
|
|
20121
|
+
pendingDiscoveries.delete(resolve10(path2));
|
|
19922
20122
|
}
|
|
19923
20123
|
function isVaultRosterLockRefusal(path2, error) {
|
|
19924
|
-
const target =
|
|
20124
|
+
const target = resolve10(path2);
|
|
19925
20125
|
if (error instanceof ClaustrumConsumerError)
|
|
19926
20126
|
return error.kind === "roster-busy";
|
|
19927
20127
|
if (error instanceof LockContentionError || error instanceof LockOwnershipError)
|
|
19928
|
-
return
|
|
20128
|
+
return resolve10(error.details.target) === target;
|
|
19929
20129
|
if (error instanceof PrivateFileError) {
|
|
19930
|
-
const failed =
|
|
20130
|
+
const failed = resolve10(error.path);
|
|
19931
20131
|
return [WRITE_LOCK.name, DISCOVERY_LEASE.name].some((name) => {
|
|
19932
20132
|
const lock = lockPathFor(target, name);
|
|
19933
20133
|
return failed === lock || failed.startsWith(`${lock}.`);
|
|
@@ -19988,7 +20188,7 @@ async function refreshVaultRoster(options) {
|
|
|
19988
20188
|
throw new ClaustrumConsumerError("roster-busy", "Claustrum account discovery is already in progress");
|
|
19989
20189
|
return persisted;
|
|
19990
20190
|
}
|
|
19991
|
-
const key =
|
|
20191
|
+
const key = resolve10(options.path);
|
|
19992
20192
|
const listedOver = options.listedOver;
|
|
19993
20193
|
let discovered;
|
|
19994
20194
|
try {
|
|
@@ -20112,9 +20312,9 @@ var init_roster = __esm({
|
|
|
20112
20312
|
});
|
|
20113
20313
|
|
|
20114
20314
|
// ../core/dist/common-auth-embedded/claustrum/quota-writer.js
|
|
20115
|
-
import { resolve as
|
|
20315
|
+
import { resolve as resolve11 } from "node:path";
|
|
20116
20316
|
function writerFor(path2, clock = quotaCommitTimer) {
|
|
20117
|
-
const key =
|
|
20317
|
+
const key = resolve11(path2);
|
|
20118
20318
|
let writer = writers.get(key);
|
|
20119
20319
|
if (!writer) {
|
|
20120
20320
|
writer = {
|
|
@@ -20178,7 +20378,7 @@ function orderedFields(pending) {
|
|
|
20178
20378
|
return [...pending.values()].flatMap((account) => [...account.values()]).sort((a, b) => a.order - b.order);
|
|
20179
20379
|
}
|
|
20180
20380
|
function pendingVaultQuota(path2, roster) {
|
|
20181
|
-
const writer = writers.get(
|
|
20381
|
+
const writer = writers.get(resolve11(path2));
|
|
20182
20382
|
if (writer) {
|
|
20183
20383
|
for (const field of orderedFields(writer.pending)) {
|
|
20184
20384
|
if (field.priorReading)
|
|
@@ -20189,7 +20389,7 @@ function pendingVaultQuota(path2, roster) {
|
|
|
20189
20389
|
return roster;
|
|
20190
20390
|
}
|
|
20191
20391
|
function hasPendingVaultQuota(path2) {
|
|
20192
|
-
return !!writers.get(
|
|
20392
|
+
return !!writers.get(resolve11(path2))?.pending.size;
|
|
20193
20393
|
}
|
|
20194
20394
|
function schedule(writer, delay3) {
|
|
20195
20395
|
if (writer.running || writer.timer || !writer.pending.size || writer.abort.signal.aborted)
|
|
@@ -20254,7 +20454,7 @@ function flush(writer) {
|
|
|
20254
20454
|
return writer.running;
|
|
20255
20455
|
}
|
|
20256
20456
|
async function drainVaultQuota(path2, timeoutMs = 1e3) {
|
|
20257
|
-
const key =
|
|
20457
|
+
const key = resolve11(path2);
|
|
20258
20458
|
const writer = writers.get(key);
|
|
20259
20459
|
if (!writer)
|
|
20260
20460
|
return;
|
|
@@ -20402,7 +20602,7 @@ var init_consumer = __esm({
|
|
|
20402
20602
|
this.#shutdown.signal,
|
|
20403
20603
|
...signal ? [signal] : []
|
|
20404
20604
|
]);
|
|
20405
|
-
return new Promise((
|
|
20605
|
+
return new Promise((resolve25, reject) => {
|
|
20406
20606
|
const cleanup2 = () => {
|
|
20407
20607
|
combined.signal.removeEventListener("abort", abort);
|
|
20408
20608
|
combined.dispose();
|
|
@@ -20417,7 +20617,7 @@ var init_consumer = __esm({
|
|
|
20417
20617
|
if (combined.signal.aborted)
|
|
20418
20618
|
reject(combined.signal.reason);
|
|
20419
20619
|
else
|
|
20420
|
-
|
|
20620
|
+
resolve25(value);
|
|
20421
20621
|
}, (error) => {
|
|
20422
20622
|
cleanup2();
|
|
20423
20623
|
reject(error);
|
|
@@ -21162,7 +21362,7 @@ var init_consumer = __esm({
|
|
|
21162
21362
|
import { createHash as createHash7 } from "node:crypto";
|
|
21163
21363
|
import { channel as channel2 } from "node:diagnostics_channel";
|
|
21164
21364
|
import { readdir as readdir2, stat as stat7 } from "node:fs/promises";
|
|
21165
|
-
import { dirname as
|
|
21365
|
+
import { dirname as dirname11, join as join9, resolve as resolve12 } from "node:path";
|
|
21166
21366
|
function canonicalJson3(value, path2 = /* @__PURE__ */ new Set()) {
|
|
21167
21367
|
if (value === null)
|
|
21168
21368
|
return "null";
|
|
@@ -21223,12 +21423,12 @@ function unreachableConnect2() {
|
|
|
21223
21423
|
return new ClaustrumUnreachableError();
|
|
21224
21424
|
}
|
|
21225
21425
|
function untilAborted(pending, signal) {
|
|
21226
|
-
return new Promise((
|
|
21426
|
+
return new Promise((resolve25, reject) => {
|
|
21227
21427
|
const abort = () => reject(signal.reason);
|
|
21228
21428
|
signal.addEventListener("abort", abort, { once: true });
|
|
21229
21429
|
pending.then((value) => {
|
|
21230
21430
|
signal.removeEventListener("abort", abort);
|
|
21231
|
-
|
|
21431
|
+
resolve25(value);
|
|
21232
21432
|
}, (error) => {
|
|
21233
21433
|
signal.removeEventListener("abort", abort);
|
|
21234
21434
|
reject(error);
|
|
@@ -21306,13 +21506,13 @@ var init_hub = __esm({
|
|
|
21306
21506
|
this.#options = options;
|
|
21307
21507
|
this.#logger = options.logger ?? createLogger2("claustrum");
|
|
21308
21508
|
this.#warnShutdown = shutdownWarning(this.#logger, this.#shutdown.signal);
|
|
21309
|
-
this.#generationDirectory =
|
|
21509
|
+
this.#generationDirectory = join9(options.stateDir, "rosters", hostGeneration);
|
|
21310
21510
|
this.#key = rosterFingerprint(options, providers);
|
|
21311
|
-
const directory =
|
|
21511
|
+
const directory = join9(this.#generationDirectory, this.#key);
|
|
21312
21512
|
for (const provider2 of providers)
|
|
21313
21513
|
this.#members.set(provider2, {
|
|
21314
21514
|
provider: provider2,
|
|
21315
|
-
path:
|
|
21515
|
+
path: join9(directory, `${provider2}.json`),
|
|
21316
21516
|
closed: false
|
|
21317
21517
|
});
|
|
21318
21518
|
}
|
|
@@ -21393,7 +21593,7 @@ var init_hub = __esm({
|
|
|
21393
21593
|
};
|
|
21394
21594
|
const { consumer, hooks } = createHubMember(port, consumerOptions);
|
|
21395
21595
|
entry.hooks = hooks;
|
|
21396
|
-
const path2 =
|
|
21596
|
+
const path2 = resolve12(entry.path);
|
|
21397
21597
|
const subscribers = sharedRosters.get(path2) ?? /* @__PURE__ */ new Set();
|
|
21398
21598
|
const install = (roster) => {
|
|
21399
21599
|
if (entry.closed || this.#active !== true || !this.#current || !this.#live(this.#current) || !hooks.roster() || this.#collides(hooks, roster))
|
|
@@ -21424,7 +21624,7 @@ var init_hub = __esm({
|
|
|
21424
21624
|
return;
|
|
21425
21625
|
entry.seen = JSON.stringify(decodedVaultRoster(roster));
|
|
21426
21626
|
entry.hooks?.install(roster);
|
|
21427
|
-
for (const install of sharedRosters.get(
|
|
21627
|
+
for (const install of sharedRosters.get(resolve12(entry.path)) ?? []) {
|
|
21428
21628
|
if (!this.#live(generation))
|
|
21429
21629
|
return;
|
|
21430
21630
|
if (install !== entry.receiveRoster)
|
|
@@ -21917,9 +22117,9 @@ var init_hub = __esm({
|
|
|
21917
22117
|
*/
|
|
21918
22118
|
async #ensureRosterDirectories() {
|
|
21919
22119
|
for (const directory of [
|
|
21920
|
-
|
|
22120
|
+
dirname11(this.#generationDirectory),
|
|
21921
22121
|
this.#generationDirectory,
|
|
21922
|
-
|
|
22122
|
+
join9(this.#generationDirectory, this.#key)
|
|
21923
22123
|
])
|
|
21924
22124
|
await ensureClaustrumPrivateDirectory(directory, {}, "roster directory");
|
|
21925
22125
|
}
|
|
@@ -21931,11 +22131,11 @@ var init_hub = __esm({
|
|
|
21931
22131
|
*/
|
|
21932
22132
|
async #seed(entry) {
|
|
21933
22133
|
const name = `${entry.provider}.json`;
|
|
21934
|
-
const candidates = [
|
|
22134
|
+
const candidates = [join9(this.#generationDirectory, name)];
|
|
21935
22135
|
try {
|
|
21936
22136
|
for (const key of await readdir2(this.#generationDirectory))
|
|
21937
22137
|
if (key !== this.#key && FINGERPRINT.test(key))
|
|
21938
|
-
candidates.push(
|
|
22138
|
+
candidates.push(join9(this.#generationDirectory, key, name));
|
|
21939
22139
|
} catch {
|
|
21940
22140
|
}
|
|
21941
22141
|
let newest;
|
|
@@ -22518,7 +22718,7 @@ var init_lock = __esm({
|
|
|
22518
22718
|
import { createHash as createHash8 } from "node:crypto";
|
|
22519
22719
|
import { constants as constants2 } from "node:fs";
|
|
22520
22720
|
import { lstat as lstat5, mkdir as mkdir10, open as open7, unlink as unlink8 } from "node:fs/promises";
|
|
22521
|
-
import { dirname as
|
|
22721
|
+
import { dirname as dirname12, resolve as resolve13 } from "node:path";
|
|
22522
22722
|
import { setTimeout as sleep2 } from "node:timers/promises";
|
|
22523
22723
|
function rootSpans(text2) {
|
|
22524
22724
|
let i = text2.indexOf("{") + 1;
|
|
@@ -22719,8 +22919,8 @@ function createPiSlot(options, onStep, hooks) {
|
|
|
22719
22919
|
if (!provider2 || !options.authPath || !options.stashPath || !placeholderKey || placeholderKey.startsWith("!") || placeholderKey.includes("$") || !Number.isFinite(timeout) || timeout < 0) {
|
|
22720
22920
|
throw new PiSlotError("invalid-options");
|
|
22721
22921
|
}
|
|
22722
|
-
const authPath =
|
|
22723
|
-
const stashPath =
|
|
22922
|
+
const authPath = resolve13(options.authPath);
|
|
22923
|
+
const stashPath = resolve13(options.stashPath);
|
|
22724
22924
|
if (authPath === stashPath || stashPath === `${authPath}.lock`) {
|
|
22725
22925
|
throw new PiSlotError("invalid-options");
|
|
22726
22926
|
}
|
|
@@ -22753,9 +22953,9 @@ function createPiSlot(options, onStep, hooks) {
|
|
|
22753
22953
|
};
|
|
22754
22954
|
try {
|
|
22755
22955
|
if (windowsPrivateFiles)
|
|
22756
|
-
await ensurePrivateDirectory(
|
|
22956
|
+
await ensurePrivateDirectory(dirname12(authPath));
|
|
22757
22957
|
else
|
|
22758
|
-
await mkdir10(
|
|
22958
|
+
await mkdir10(dirname12(authPath), { recursive: true, mode: 448 });
|
|
22759
22959
|
const deadline = Date.now() + timeout;
|
|
22760
22960
|
let retry = 0;
|
|
22761
22961
|
while (!release) {
|
|
@@ -22796,7 +22996,7 @@ function createPiSlot(options, onStep, hooks) {
|
|
|
22796
22996
|
async function deleteStash(assertLock) {
|
|
22797
22997
|
assertLock();
|
|
22798
22998
|
await unlink8(stashPath);
|
|
22799
|
-
await syncDir(
|
|
22999
|
+
await syncDir(dirname12(stashPath));
|
|
22800
23000
|
onStep?.("stash-deleted");
|
|
22801
23001
|
}
|
|
22802
23002
|
return {
|
|
@@ -22816,10 +23016,10 @@ function createPiSlot(options, onStep, hooks) {
|
|
|
22816
23016
|
throw new PiSlotError("conflict");
|
|
22817
23017
|
if (!stash) {
|
|
22818
23018
|
if (windowsPrivateFiles)
|
|
22819
|
-
await ensurePrivateDirectory(
|
|
23019
|
+
await ensurePrivateDirectory(dirname12(stashPath));
|
|
22820
23020
|
else {
|
|
22821
|
-
await mkdir10(
|
|
22822
|
-
const dir = await lstat5(
|
|
23021
|
+
await mkdir10(dirname12(stashPath), { recursive: true, mode: 448 });
|
|
23022
|
+
const dir = await lstat5(dirname12(stashPath));
|
|
22823
23023
|
if (!dir.isDirectory() || (dir.mode & 511) !== 448)
|
|
22824
23024
|
throw new PiSlotError("unsafe-path");
|
|
22825
23025
|
}
|
|
@@ -22937,6 +23137,13 @@ var init_credential_redaction = __esm({
|
|
|
22937
23137
|
}
|
|
22938
23138
|
});
|
|
22939
23139
|
|
|
23140
|
+
// ../core/dist/harness-identity.js
|
|
23141
|
+
var init_harness_identity = __esm({
|
|
23142
|
+
"../core/dist/harness-identity.js"() {
|
|
23143
|
+
"use strict";
|
|
23144
|
+
}
|
|
23145
|
+
});
|
|
23146
|
+
|
|
22940
23147
|
// ../core/dist/model-types.js
|
|
22941
23148
|
var init_model_types = __esm({
|
|
22942
23149
|
"../core/dist/model-types.js"() {
|
|
@@ -22946,15 +23153,15 @@ var init_model_types = __esm({
|
|
|
22946
23153
|
|
|
22947
23154
|
// ../core/dist/pi-paths.js
|
|
22948
23155
|
import { homedir } from "node:os";
|
|
22949
|
-
import { dirname as
|
|
23156
|
+
import { dirname as dirname13, join as join10 } from "node:path";
|
|
22950
23157
|
function getPiConfigDir() {
|
|
22951
|
-
return process.env.PI_AGENT_DIR?.trim() ||
|
|
23158
|
+
return process.env.PI_AGENT_DIR?.trim() || join10(homedir(), ".pi", "agent");
|
|
22952
23159
|
}
|
|
22953
23160
|
function getPiAntigravityAuthFile() {
|
|
22954
|
-
return process.env.PI_ANTIGRAVITY_AUTH_FILE?.trim() ||
|
|
23161
|
+
return process.env.PI_ANTIGRAVITY_AUTH_FILE?.trim() || join10(getPiConfigDir(), "antigravity-accounts.json");
|
|
22955
23162
|
}
|
|
22956
23163
|
function getPiAntigravityVaultDir() {
|
|
22957
|
-
return
|
|
23164
|
+
return join10(dirname13(getPiAntigravityAuthFile()), "antigravity-auth-vault");
|
|
22958
23165
|
}
|
|
22959
23166
|
var init_pi_paths = __esm({
|
|
22960
23167
|
"../core/dist/pi-paths.js"() {
|
|
@@ -22988,8 +23195,8 @@ function getDefaultTierId(allowedTiers) {
|
|
|
22988
23195
|
return allowedTiers[0]?.id;
|
|
22989
23196
|
}
|
|
22990
23197
|
function wait(ms) {
|
|
22991
|
-
return new Promise((
|
|
22992
|
-
setTimeout(
|
|
23198
|
+
return new Promise((resolve25) => {
|
|
23199
|
+
setTimeout(resolve25, ms);
|
|
22993
23200
|
});
|
|
22994
23201
|
}
|
|
22995
23202
|
function extractManagedProjectId(payload) {
|
|
@@ -23979,6 +24186,7 @@ var init_dist = __esm({
|
|
|
23979
24186
|
init_fetch_timeout();
|
|
23980
24187
|
init_file_lock();
|
|
23981
24188
|
init_fingerprint();
|
|
24189
|
+
init_harness_identity();
|
|
23982
24190
|
init_logger();
|
|
23983
24191
|
init_model_registry();
|
|
23984
24192
|
init_model_types();
|
|
@@ -24011,7 +24219,7 @@ var init_capture_sink2 = __esm({
|
|
|
24011
24219
|
import { randomUUID as randomUUID11 } from "node:crypto";
|
|
24012
24220
|
import { lstat as lstat6, readFile as readFile7, rename as rename8, unlink as unlink9 } from "node:fs/promises";
|
|
24013
24221
|
import { tmpdir as tmpdir2 } from "node:os";
|
|
24014
|
-
import { dirname as
|
|
24222
|
+
import { dirname as dirname14, join as join11, resolve as resolve14 } from "node:path";
|
|
24015
24223
|
function ioCode2(detail) {
|
|
24016
24224
|
if (detail?.reason === "io-error") {
|
|
24017
24225
|
if (detail.win32Code === 2 || detail.win32Code === 3)
|
|
@@ -24032,7 +24240,7 @@ function isUnavailable2(api, error) {
|
|
|
24032
24240
|
}
|
|
24033
24241
|
async function assertNativeAddonLoads2(api) {
|
|
24034
24242
|
try {
|
|
24035
|
-
await api.verifyPrivatePath(
|
|
24243
|
+
await api.verifyPrivatePath(join11(tmpdir2(), `.common-auth-private-files-probe-${randomUUID11()}`), "file");
|
|
24036
24244
|
} catch (error) {
|
|
24037
24245
|
if (isUnavailable2(api, error))
|
|
24038
24246
|
throw privateFilesUnavailable2(error);
|
|
@@ -24061,7 +24269,7 @@ async function privateOperation2(path2, stage, operation) {
|
|
|
24061
24269
|
}
|
|
24062
24270
|
}
|
|
24063
24271
|
async function verifySafeDirectory2(path2, options) {
|
|
24064
|
-
path2 =
|
|
24272
|
+
path2 = resolve14(path2);
|
|
24065
24273
|
options ??= safeParentOptionsForTest2;
|
|
24066
24274
|
await privateOperation2(path2, "safe-parent", async () => {
|
|
24067
24275
|
const result = await (await loadBackend2()).verifySafeParent(path2, options);
|
|
@@ -24076,7 +24284,7 @@ async function verifySafeDirectory2(path2, options) {
|
|
|
24076
24284
|
});
|
|
24077
24285
|
}
|
|
24078
24286
|
async function verifyPrivate2(path2, kind, migrate = false) {
|
|
24079
|
-
path2 =
|
|
24287
|
+
path2 = resolve14(path2);
|
|
24080
24288
|
if (kind === "directory")
|
|
24081
24289
|
return verifySafeDirectory2(path2);
|
|
24082
24290
|
await privateOperation2(path2, "verify", async () => {
|
|
@@ -24093,7 +24301,7 @@ async function verifyPrivate2(path2, kind, migrate = false) {
|
|
|
24093
24301
|
api.NULL_DACL,
|
|
24094
24302
|
api.EMPTY_DACL
|
|
24095
24303
|
].includes(reason)) {
|
|
24096
|
-
await verifySafeDirectory2(
|
|
24304
|
+
await verifySafeDirectory2(dirname14(path2));
|
|
24097
24305
|
await api.securePrivatePath(path2, kind);
|
|
24098
24306
|
repaired = true;
|
|
24099
24307
|
} else {
|
|
@@ -24111,7 +24319,7 @@ async function verifyPrivate2(path2, kind, migrate = false) {
|
|
|
24111
24319
|
});
|
|
24112
24320
|
}
|
|
24113
24321
|
async function ensurePrivateDirectory2(path2, _migrate = false, options) {
|
|
24114
|
-
path2 =
|
|
24322
|
+
path2 = resolve14(path2);
|
|
24115
24323
|
await privateOperation2(path2, "directory", async () => {
|
|
24116
24324
|
const api = await loadBackend2();
|
|
24117
24325
|
try {
|
|
@@ -24121,7 +24329,7 @@ async function ensurePrivateDirectory2(path2, _migrate = false, options) {
|
|
|
24121
24329
|
if (ioCode2(error) !== "ENOENT")
|
|
24122
24330
|
throw error;
|
|
24123
24331
|
}
|
|
24124
|
-
const parent =
|
|
24332
|
+
const parent = dirname14(path2);
|
|
24125
24333
|
if (parent === path2)
|
|
24126
24334
|
throw Object.assign(new Error("Missing root"), { code: "ENOENT" });
|
|
24127
24335
|
await ensurePrivateDirectory2(parent, false, options);
|
|
@@ -24142,28 +24350,28 @@ async function readPrivateText2(path2, migrate = false) {
|
|
|
24142
24350
|
async function readPrivateBuffer2(path2, migrate = false) {
|
|
24143
24351
|
if (!windowsPrivateFiles2)
|
|
24144
24352
|
return readFile7(path2);
|
|
24145
|
-
path2 =
|
|
24353
|
+
path2 = resolve14(path2);
|
|
24146
24354
|
if (migrate) {
|
|
24147
|
-
await verifySafeDirectory2(
|
|
24355
|
+
await verifySafeDirectory2(dirname14(path2));
|
|
24148
24356
|
await verifyPrivate2(path2, "file", true);
|
|
24149
24357
|
}
|
|
24150
24358
|
return privateOperation2(path2, "read", async () => (await loadBackend2()).readOwnerOnly(path2));
|
|
24151
24359
|
}
|
|
24152
24360
|
async function createPrivateBytes2(path2, bytes) {
|
|
24153
|
-
await verifySafeDirectory2(
|
|
24361
|
+
await verifySafeDirectory2(dirname14(resolve14(path2)));
|
|
24154
24362
|
await privateOperation2(path2, "create", async () => {
|
|
24155
|
-
await (await loadBackend2()).createPrivateFile(
|
|
24363
|
+
await (await loadBackend2()).createPrivateFile(resolve14(path2), bytes);
|
|
24156
24364
|
});
|
|
24157
24365
|
}
|
|
24158
24366
|
async function createPrivateDirectoryExclusive2(path2) {
|
|
24159
|
-
await verifySafeDirectory2(
|
|
24367
|
+
await verifySafeDirectory2(dirname14(resolve14(path2)));
|
|
24160
24368
|
await privateOperation2(path2, "directory-create", async () => {
|
|
24161
|
-
await (await loadBackend2()).createOwnerOnly(
|
|
24369
|
+
await (await loadBackend2()).createOwnerOnly(resolve14(path2), { kind: "dir" });
|
|
24162
24370
|
});
|
|
24163
24371
|
}
|
|
24164
24372
|
async function replaceWindowsFile2(from, to, options = {}) {
|
|
24165
|
-
from =
|
|
24166
|
-
to =
|
|
24373
|
+
from = resolve14(from);
|
|
24374
|
+
to = resolve14(to);
|
|
24167
24375
|
const now = options.now ?? (() => performance.now());
|
|
24168
24376
|
const start = now();
|
|
24169
24377
|
const leaseDeadline = options.deadline ?? Infinity;
|
|
@@ -24206,16 +24414,16 @@ async function replaceWindowsFile2(from, to, options = {}) {
|
|
|
24206
24414
|
throw error;
|
|
24207
24415
|
}
|
|
24208
24416
|
async function writePrivateAtomic2(path2, bytes, options = {}) {
|
|
24209
|
-
path2 =
|
|
24210
|
-
await ensurePrivateDirectory2(
|
|
24417
|
+
path2 = resolve14(path2);
|
|
24418
|
+
await ensurePrivateDirectory2(dirname14(path2));
|
|
24211
24419
|
try {
|
|
24212
24420
|
await verifyPrivate2(path2, "file", true);
|
|
24213
24421
|
} catch (error) {
|
|
24214
24422
|
if (error.code !== "ENOENT")
|
|
24215
24423
|
throw error;
|
|
24216
24424
|
}
|
|
24217
|
-
const stage =
|
|
24218
|
-
if (
|
|
24425
|
+
const stage = resolve14(options.stagePath ?? `${path2}.${randomUUID11()}.tmp`);
|
|
24426
|
+
if (dirname14(stage) !== dirname14(path2))
|
|
24219
24427
|
throw new PrivateFileError2(path2, "stage-directory", { code: "EXDEV" });
|
|
24220
24428
|
let created = false;
|
|
24221
24429
|
let published = false;
|
|
@@ -24380,7 +24588,7 @@ var init_redact2 = __esm({
|
|
|
24380
24588
|
// src/common-auth-embedded/logger/engine.js
|
|
24381
24589
|
import { appendFileSync as appendFileSync2, chmodSync as chmodSync2, existsSync as existsSync2, renameSync as renameSync2, statSync as statSync3 } from "node:fs";
|
|
24382
24590
|
import { open as open8 } from "node:fs/promises";
|
|
24383
|
-
import { dirname as
|
|
24591
|
+
import { dirname as dirname15, resolve as resolve15 } from "node:path";
|
|
24384
24592
|
function chmodPrivate2(path2) {
|
|
24385
24593
|
try {
|
|
24386
24594
|
chmodSync2(path2, 384);
|
|
@@ -24412,7 +24620,7 @@ async function closeWindowsFile2(sink) {
|
|
|
24412
24620
|
await privateOperation2(file, "log-close", () => handle.close());
|
|
24413
24621
|
}
|
|
24414
24622
|
async function openWindowsFile2(sink, file) {
|
|
24415
|
-
await ensurePrivateDirectory2(
|
|
24623
|
+
await ensurePrivateDirectory2(dirname15(file));
|
|
24416
24624
|
try {
|
|
24417
24625
|
await verifyPrivate2(file, "file", true);
|
|
24418
24626
|
} catch (error) {
|
|
@@ -24431,7 +24639,7 @@ async function openWindowsFile2(sink, file) {
|
|
|
24431
24639
|
return sink.handle;
|
|
24432
24640
|
}
|
|
24433
24641
|
async function flushWindowsFile2(sink, file, text2) {
|
|
24434
|
-
file =
|
|
24642
|
+
file = resolve15(file);
|
|
24435
24643
|
try {
|
|
24436
24644
|
if (sink.file !== file)
|
|
24437
24645
|
await closeWindowsFile2(sink);
|
|
@@ -24755,20 +24963,20 @@ import { randomUUID as randomUUID12 } from "node:crypto";
|
|
|
24755
24963
|
import { realpathSync, rmSync } from "node:fs";
|
|
24756
24964
|
import { chmod as chmod3, mkdir as mkdir11, readFile as readFile8, rename as rename9, rm as rm5, writeFile as writeFile3 } from "node:fs/promises";
|
|
24757
24965
|
import { homedir as homedir2 } from "node:os";
|
|
24758
|
-
import { join as
|
|
24966
|
+
import { join as join12, resolve as resolve16 } from "node:path";
|
|
24759
24967
|
function processHeartbeatDir() {
|
|
24760
|
-
const base = process.env.XDG_STATE_HOME ||
|
|
24761
|
-
return
|
|
24968
|
+
const base = process.env.XDG_STATE_HOME || join12(homedir2(), ".local", "state");
|
|
24969
|
+
return join12(base, "cortexkit", "antigravity-auth", "processes");
|
|
24762
24970
|
}
|
|
24763
24971
|
function processHeartbeatPath(pid = process.pid, dir = processHeartbeatDir()) {
|
|
24764
|
-
return
|
|
24972
|
+
return join12(dir, `${pid}.json`);
|
|
24765
24973
|
}
|
|
24766
24974
|
function processConfigFolderKey() {
|
|
24767
24975
|
const folder = getConfigDir();
|
|
24768
24976
|
try {
|
|
24769
24977
|
return realpathSync.native(folder);
|
|
24770
24978
|
} catch {
|
|
24771
|
-
return
|
|
24979
|
+
return resolve16(folder);
|
|
24772
24980
|
}
|
|
24773
24981
|
}
|
|
24774
24982
|
function processHasOlderGeneration() {
|
|
@@ -25006,15 +25214,15 @@ var init_process_heartbeat = __esm({
|
|
|
25006
25214
|
// src/version-fence.ts
|
|
25007
25215
|
import { readdir as readdir3, readFile as readFile9, stat as stat9, unlink as unlink10 } from "node:fs/promises";
|
|
25008
25216
|
import { homedir as homedir3, uptime } from "node:os";
|
|
25009
|
-
import { join as
|
|
25217
|
+
import { join as join13 } from "node:path";
|
|
25010
25218
|
function defaultStateHome() {
|
|
25011
|
-
return process.env.XDG_STATE_HOME ||
|
|
25219
|
+
return process.env.XDG_STATE_HOME || join13(homedir3(), ".local", "state");
|
|
25012
25220
|
}
|
|
25013
25221
|
function processHeartbeatDir2(stateHome = defaultStateHome()) {
|
|
25014
|
-
return
|
|
25222
|
+
return join13(stateHome, "cortexkit", "antigravity-auth", "processes");
|
|
25015
25223
|
}
|
|
25016
25224
|
function rpcStateRoot(stateHome = defaultStateHome()) {
|
|
25017
|
-
return
|
|
25225
|
+
return join13(stateHome, "cortexkit", "antigravity-auth", "rpc");
|
|
25018
25226
|
}
|
|
25019
25227
|
function isRpcProjectDir(name) {
|
|
25020
25228
|
return /^[0-9a-f]{16}$/.test(name);
|
|
@@ -25165,7 +25373,7 @@ async function versionFenceOpen(options) {
|
|
|
25165
25373
|
for (const name of heartbeats.ok ? heartbeats.names : []) {
|
|
25166
25374
|
const pid = pidFrom(name, /^(\d+)\.json$/);
|
|
25167
25375
|
if (pid === void 0 || pid === self) continue;
|
|
25168
|
-
const path2 =
|
|
25376
|
+
const path2 = join13(heartbeatDir, name);
|
|
25169
25377
|
const heartbeat = await readProcessRecord(path2, pid);
|
|
25170
25378
|
if (heartbeat.kind === "gone") continue;
|
|
25171
25379
|
const live = alive(pid);
|
|
@@ -25190,7 +25398,7 @@ async function versionFenceOpen(options) {
|
|
|
25190
25398
|
block({ pid: "unknown", version: "unknown", detail: projects.error });
|
|
25191
25399
|
for (const project2 of projects.ok ? projects.names : []) {
|
|
25192
25400
|
if (!isRpcProjectDir(project2)) continue;
|
|
25193
|
-
const dir =
|
|
25401
|
+
const dir = join13(rpcRoot, project2);
|
|
25194
25402
|
const ports = await list2(dir);
|
|
25195
25403
|
if (!ports.ok) {
|
|
25196
25404
|
if (ports.code === "ENOTDIR") continue;
|
|
@@ -25200,7 +25408,7 @@ async function versionFenceOpen(options) {
|
|
|
25200
25408
|
for (const name of ports.names) {
|
|
25201
25409
|
const pid = pidFrom(name, /^port-(\d+)\.json$/);
|
|
25202
25410
|
if (pid === void 0 || pid === self || !alive(pid)) continue;
|
|
25203
|
-
const path2 =
|
|
25411
|
+
const path2 = join13(dir, name);
|
|
25204
25412
|
const port = await readProcessRecord(path2, pid);
|
|
25205
25413
|
if (port.kind === "gone") continue;
|
|
25206
25414
|
if (await staleRecord(path2, port, boot, false)) continue;
|
|
@@ -25352,7 +25560,7 @@ import {
|
|
|
25352
25560
|
stat as stat10,
|
|
25353
25561
|
unlink as unlink11
|
|
25354
25562
|
} from "node:fs/promises";
|
|
25355
|
-
import { basename as
|
|
25563
|
+
import { basename as basename6, dirname as dirname16, join as join14, resolve as resolve17 } from "node:path";
|
|
25356
25564
|
function refusalMessage(stateDir, errorClass2) {
|
|
25357
25565
|
if (errorClass2 === "ERR_PRIVATE_FILES_SECURITY")
|
|
25358
25566
|
return `antigravity-auth cannot start: ${stateDir} is not a folder only your user can access, or it is a link, so the plugin will not use it (${errorClass2}). Replace it with a plain folder of your own, then restart OpenCode.`;
|
|
@@ -25366,11 +25574,11 @@ function foreignFolder(stateDir, identity3) {
|
|
|
25366
25574
|
);
|
|
25367
25575
|
}
|
|
25368
25576
|
function markerRemedy(markerPath, oldVaultDir) {
|
|
25369
|
-
return `Check that the old vault files are still in ${oldVaultDir}. If they are, delete ${markerPath}, then restart OpenCode; if they are not, keep ${
|
|
25577
|
+
return `Check that the old vault files are still in ${oldVaultDir}. If they are, delete ${markerPath}, then restart OpenCode; if they are not, keep ${dirname16(markerPath)} as it is.`;
|
|
25370
25578
|
}
|
|
25371
25579
|
function foreignMarker(markerPath, identity3, oldVaultDir) {
|
|
25372
25580
|
return new RuntimeLayoutRefusal(
|
|
25373
|
-
|
|
25581
|
+
dirname16(markerPath),
|
|
25374
25582
|
"foreign-marker",
|
|
25375
25583
|
`antigravity-auth cannot start: ${markerPath} belongs to another OpenCode config folder, not ${identity3}, so it cannot tell whether this folder's vault files were moved. ${markerRemedy(markerPath, oldVaultDir)}`
|
|
25376
25584
|
);
|
|
@@ -25401,7 +25609,7 @@ function errorClass(error) {
|
|
|
25401
25609
|
function errorFile(error) {
|
|
25402
25610
|
const { path: path2, stage } = error ?? {};
|
|
25403
25611
|
return {
|
|
25404
|
-
...typeof path2 === "string" && path2 ? { file:
|
|
25612
|
+
...typeof path2 === "string" && path2 ? { file: basename6(path2) } : {},
|
|
25405
25613
|
...typeof stage === "string" && stage ? { stage } : {}
|
|
25406
25614
|
};
|
|
25407
25615
|
}
|
|
@@ -25439,7 +25647,7 @@ function prepareRuntimeLayout(options) {
|
|
|
25439
25647
|
async function decide(location, options) {
|
|
25440
25648
|
const log9 = options.log ?? createLogger4("runtime-layout");
|
|
25441
25649
|
const stateDir = location.stateHomeDir;
|
|
25442
|
-
const markerPath =
|
|
25650
|
+
const markerPath = join14(stateDir, RUNTIME_LAYOUT_MARKER_FILE);
|
|
25443
25651
|
const files = layoutFiles(location, options.accountFile);
|
|
25444
25652
|
const fence = options.fence ?? defaultFence(options.version);
|
|
25445
25653
|
const stateHome = async () => {
|
|
@@ -25451,7 +25659,7 @@ async function decide(location, options) {
|
|
|
25451
25659
|
if (marker?.oldFilesRemoved) {
|
|
25452
25660
|
await refuseReappearedFiles(location, files);
|
|
25453
25661
|
const manifestLeft = await exists2(
|
|
25454
|
-
|
|
25662
|
+
join14(stateDir, RUNTIME_LAYOUT_MANIFEST_FILE)
|
|
25455
25663
|
).catch(() => true);
|
|
25456
25664
|
if (!manifestLeft) {
|
|
25457
25665
|
await settleVault(location, options, "state-home", log9);
|
|
@@ -25621,7 +25829,7 @@ async function prepareAccountStore(options) {
|
|
|
25621
25829
|
await ensureOwnerOnlyDir(location.stateHomeDir);
|
|
25622
25830
|
const lock = await takeLock(
|
|
25623
25831
|
RUNTIME_LAYOUT_LOCK_NAME,
|
|
25624
|
-
|
|
25832
|
+
join14(location.stateHomeDir, RUNTIME_LAYOUT_MARKER_FILE),
|
|
25625
25833
|
options.layoutLockWaitMs ?? LAYOUT_LOCK_WAIT_MS,
|
|
25626
25834
|
log9
|
|
25627
25835
|
);
|
|
@@ -25735,7 +25943,7 @@ async function recordAnchor(location, options, anchor, log9) {
|
|
|
25735
25943
|
}
|
|
25736
25944
|
async function storeMovePathResolves(stateAnchor, location, log9) {
|
|
25737
25945
|
if (folderResolvesToItself(
|
|
25738
|
-
|
|
25946
|
+
join14(location.stateHomeDir, "antigravity-accounts.json")
|
|
25739
25947
|
))
|
|
25740
25948
|
return true;
|
|
25741
25949
|
logOnce(
|
|
@@ -25772,9 +25980,9 @@ function storeFolder(anchor) {
|
|
|
25772
25980
|
return `${anchor}.store`;
|
|
25773
25981
|
}
|
|
25774
25982
|
async function storeArtefacts(anchor) {
|
|
25775
|
-
const names = await readdir4(
|
|
25776
|
-
const store =
|
|
25777
|
-
const pool =
|
|
25983
|
+
const names = await readdir4(dirname16(anchor)).catch(() => []);
|
|
25984
|
+
const store = basename6(storeFolder(anchor));
|
|
25985
|
+
const pool = basename6(anchor);
|
|
25778
25986
|
return names.filter(
|
|
25779
25987
|
(name) => name === store || name.startsWith(`${pool}.store.`) || name.startsWith(pool) && name.endsWith(".tmp")
|
|
25780
25988
|
).length;
|
|
@@ -25919,7 +26127,7 @@ async function writeStateHomeStoreForward(id, stateAnchor, configAnchor = legacy
|
|
|
25919
26127
|
const forward = {
|
|
25920
26128
|
schemaVersion: 2,
|
|
25921
26129
|
id,
|
|
25922
|
-
directoryBasename:
|
|
26130
|
+
directoryBasename: basename6(storeFolder(stateAnchor)),
|
|
25923
26131
|
relocatedTo: { legacyPath: stateAnchor, id }
|
|
25924
26132
|
};
|
|
25925
26133
|
const fs3 = await loadCommonAuthFs();
|
|
@@ -26103,7 +26311,7 @@ async function removeLeftoverManifest(location, layoutLock, steps, log9) {
|
|
|
26103
26311
|
}
|
|
26104
26312
|
}
|
|
26105
26313
|
async function removeManifestOwned(stateDir, layoutLock, steps) {
|
|
26106
|
-
const path2 =
|
|
26314
|
+
const path2 = join14(stateDir, RUNTIME_LAYOUT_MANIFEST_FILE);
|
|
26107
26315
|
if (!await exists2(path2)) return;
|
|
26108
26316
|
await beforeRemove(path2, layoutLock, steps);
|
|
26109
26317
|
await removeManifest(stateDir);
|
|
@@ -26143,7 +26351,7 @@ async function takeDataLocks(files, log9) {
|
|
|
26143
26351
|
locks.push(
|
|
26144
26352
|
await takeLock(
|
|
26145
26353
|
lock.name,
|
|
26146
|
-
|
|
26354
|
+
join14(files.vault.old, lock.file),
|
|
26147
26355
|
lock.waitMs,
|
|
26148
26356
|
log9
|
|
26149
26357
|
)
|
|
@@ -26170,8 +26378,8 @@ function sha256(bytes) {
|
|
|
26170
26378
|
}
|
|
26171
26379
|
function vaultStateFile(files) {
|
|
26172
26380
|
return {
|
|
26173
|
-
old:
|
|
26174
|
-
next:
|
|
26381
|
+
old: join14(files.vault.old, VAULT_ENROLLMENT_STATE_FILE),
|
|
26382
|
+
next: join14(files.vault.next, VAULT_ENROLLMENT_STATE_FILE)
|
|
26175
26383
|
};
|
|
26176
26384
|
}
|
|
26177
26385
|
async function keepableVaultState(files, present2) {
|
|
@@ -26212,10 +26420,10 @@ async function removeMovedVaultStateLeftover(vaultDir, accountFile) {
|
|
|
26212
26420
|
if (process.env.OPENCODE_ANTIGRAVITY_AUTH_VAULT_DIR) return;
|
|
26213
26421
|
const location = runtimeLayoutLocation();
|
|
26214
26422
|
const files = layoutFiles(location, accountFile);
|
|
26215
|
-
if (
|
|
26423
|
+
if (resolve17(vaultDir) !== resolve17(files.vault.next)) return;
|
|
26216
26424
|
const stateDir = location.stateHomeDir;
|
|
26217
26425
|
const marker = await readMarker(
|
|
26218
|
-
|
|
26426
|
+
join14(stateDir, RUNTIME_LAYOUT_MARKER_FILE),
|
|
26219
26427
|
stateDir,
|
|
26220
26428
|
files.vault.old
|
|
26221
26429
|
);
|
|
@@ -26244,13 +26452,13 @@ async function vaultFiles(dir) {
|
|
|
26244
26452
|
}
|
|
26245
26453
|
async function presentOldFiles(files) {
|
|
26246
26454
|
return (await vaultFiles(files.vault.old)).map((name) => ({
|
|
26247
|
-
old:
|
|
26248
|
-
next:
|
|
26455
|
+
old: join14(files.vault.old, name),
|
|
26456
|
+
next: join14(files.vault.next, name)
|
|
26249
26457
|
}));
|
|
26250
26458
|
}
|
|
26251
26459
|
async function destinationFiles(files) {
|
|
26252
26460
|
return (await vaultFiles(files.vault.next)).map(
|
|
26253
|
-
(name) =>
|
|
26461
|
+
(name) => join14(files.vault.next, name)
|
|
26254
26462
|
);
|
|
26255
26463
|
}
|
|
26256
26464
|
async function physicalAliases(location, files) {
|
|
@@ -26259,7 +26467,7 @@ async function physicalAliases(location, files) {
|
|
|
26259
26467
|
[files.vault.old, files.vault.next]
|
|
26260
26468
|
];
|
|
26261
26469
|
for (const name of VAULT_FILE_NAMES)
|
|
26262
|
-
pairs.push([
|
|
26470
|
+
pairs.push([join14(files.vault.old, name), join14(files.vault.next, name)]);
|
|
26263
26471
|
const aliased = [];
|
|
26264
26472
|
for (const [old, next] of pairs)
|
|
26265
26473
|
if (await samePhysical(old, next)) aliased.push(old);
|
|
@@ -26372,11 +26580,11 @@ async function unlinkIfIdentical(file, stateDir, guard, io = { platform: process
|
|
|
26372
26580
|
async function refuseReappearedFiles(location, files) {
|
|
26373
26581
|
const keptState = vaultStateFile(files).old;
|
|
26374
26582
|
for (const name of await vaultFiles(files.vault.old)) {
|
|
26375
|
-
const old =
|
|
26583
|
+
const old = join14(files.vault.old, name);
|
|
26376
26584
|
if (old === keptState && await isVaultShapedKeptState(files)) continue;
|
|
26377
26585
|
throw credentialConflict(location.stateHomeDir, {
|
|
26378
26586
|
old,
|
|
26379
|
-
next:
|
|
26587
|
+
next: join14(files.vault.next, name)
|
|
26380
26588
|
});
|
|
26381
26589
|
}
|
|
26382
26590
|
}
|
|
@@ -26418,13 +26626,13 @@ async function assertOwnFolder(location, marker, files) {
|
|
|
26418
26626
|
const stateDir = location.stateHomeDir;
|
|
26419
26627
|
if (marker?.oldDir !== void 0 && marker.oldDir !== location.key)
|
|
26420
26628
|
throw foreignMarker(
|
|
26421
|
-
|
|
26629
|
+
join14(stateDir, RUNTIME_LAYOUT_MARKER_FILE),
|
|
26422
26630
|
location.key,
|
|
26423
26631
|
files.vault.old
|
|
26424
26632
|
);
|
|
26425
26633
|
let text2;
|
|
26426
26634
|
try {
|
|
26427
|
-
text2 = await readFile10(
|
|
26635
|
+
text2 = await readFile10(join14(stateDir, RUNTIME_CONFIG_DIR_NOTE_FILE), "utf8");
|
|
26428
26636
|
} catch (error) {
|
|
26429
26637
|
const code2 = error.code;
|
|
26430
26638
|
if (code2 === "ENOENT" || code2 === "ENOTDIR") return;
|
|
@@ -26438,7 +26646,7 @@ async function assertOwnFolder(location, marker, files) {
|
|
|
26438
26646
|
if (owner !== location.key) throw foreignFolder(stateDir, location.key);
|
|
26439
26647
|
}
|
|
26440
26648
|
async function writeOwnerNote(location) {
|
|
26441
|
-
const path2 =
|
|
26649
|
+
const path2 = join14(location.stateHomeDir, RUNTIME_CONFIG_DIR_NOTE_FILE);
|
|
26442
26650
|
if (await exists2(path2)) return;
|
|
26443
26651
|
await writePrivateText(
|
|
26444
26652
|
path2,
|
|
@@ -26449,7 +26657,7 @@ async function writeOwnerNote(location) {
|
|
|
26449
26657
|
async function readManifest(stateDir) {
|
|
26450
26658
|
let text2;
|
|
26451
26659
|
try {
|
|
26452
|
-
text2 = await readFile10(
|
|
26660
|
+
text2 = await readFile10(join14(stateDir, RUNTIME_LAYOUT_MANIFEST_FILE), "utf8");
|
|
26453
26661
|
} catch (error) {
|
|
26454
26662
|
if (error.code === "ENOENT") return /* @__PURE__ */ new Set();
|
|
26455
26663
|
throw error;
|
|
@@ -26466,13 +26674,13 @@ async function readManifest(stateDir) {
|
|
|
26466
26674
|
}
|
|
26467
26675
|
async function writeManifest(stateDir, paths) {
|
|
26468
26676
|
await writePrivateText(
|
|
26469
|
-
|
|
26677
|
+
join14(stateDir, RUNTIME_LAYOUT_MANIFEST_FILE),
|
|
26470
26678
|
`${JSON.stringify({ version: 1, files: paths }, null, 2)}
|
|
26471
26679
|
`
|
|
26472
26680
|
);
|
|
26473
26681
|
}
|
|
26474
26682
|
async function removeManifest(stateDir) {
|
|
26475
|
-
await unlink11(
|
|
26683
|
+
await unlink11(join14(stateDir, RUNTIME_LAYOUT_MANIFEST_FILE)).catch(
|
|
26476
26684
|
(error) => {
|
|
26477
26685
|
if (error.code !== "ENOENT") throw error;
|
|
26478
26686
|
}
|
|
@@ -26483,7 +26691,7 @@ async function writeMarker(path2, marker) {
|
|
|
26483
26691
|
`);
|
|
26484
26692
|
}
|
|
26485
26693
|
async function writePrivateText(path2, text2) {
|
|
26486
|
-
await ensureOwnerOnlyDir(
|
|
26694
|
+
await ensureOwnerOnlyDir(dirname16(path2));
|
|
26487
26695
|
const fs3 = await loadCommonAuthFs();
|
|
26488
26696
|
await fs3.writeJsonAtomic(path2, null, {
|
|
26489
26697
|
serialize: () => text2,
|
|
@@ -26641,9 +26849,9 @@ import {
|
|
|
26641
26849
|
writeFileSync
|
|
26642
26850
|
} from "node:fs";
|
|
26643
26851
|
import { homedir as homedir4 } from "node:os";
|
|
26644
|
-
import { dirname as
|
|
26852
|
+
import { dirname as dirname17, join as join15, resolve as resolve18 } from "node:path";
|
|
26645
26853
|
async function ensureGitignore(configDir) {
|
|
26646
|
-
const gitignorePath =
|
|
26854
|
+
const gitignorePath = join15(configDir, ".gitignore");
|
|
26647
26855
|
try {
|
|
26648
26856
|
let content;
|
|
26649
26857
|
let existingLines = [];
|
|
@@ -26689,8 +26897,8 @@ async function ensureGitignore(configDir) {
|
|
|
26689
26897
|
}
|
|
26690
26898
|
}
|
|
26691
26899
|
function getLegacyWindowsConfigDir() {
|
|
26692
|
-
return
|
|
26693
|
-
process.env.APPDATA ||
|
|
26900
|
+
return join15(
|
|
26901
|
+
process.env.APPDATA || join15(homedir4(), "AppData", "Roaming"),
|
|
26694
26902
|
"opencode"
|
|
26695
26903
|
);
|
|
26696
26904
|
}
|
|
@@ -26698,15 +26906,15 @@ function getConfigDir() {
|
|
|
26698
26906
|
if (process.env.OPENCODE_CONFIG_DIR) {
|
|
26699
26907
|
return process.env.OPENCODE_CONFIG_DIR;
|
|
26700
26908
|
}
|
|
26701
|
-
const xdgConfig2 = process.env.XDG_CONFIG_HOME ||
|
|
26702
|
-
return
|
|
26909
|
+
const xdgConfig2 = process.env.XDG_CONFIG_HOME || join15(homedir4(), ".config");
|
|
26910
|
+
return join15(xdgConfig2, "opencode");
|
|
26703
26911
|
}
|
|
26704
26912
|
function migrateLegacyWindowsConfig() {
|
|
26705
26913
|
if (process.platform !== "win32") {
|
|
26706
26914
|
return false;
|
|
26707
26915
|
}
|
|
26708
|
-
const newPath =
|
|
26709
|
-
const legacyPath =
|
|
26916
|
+
const newPath = join15(getConfigDir(), "antigravity-accounts.json");
|
|
26917
|
+
const legacyPath = join15(
|
|
26710
26918
|
getLegacyWindowsConfigDir(),
|
|
26711
26919
|
"antigravity-accounts.json"
|
|
26712
26920
|
);
|
|
@@ -26741,8 +26949,8 @@ function migrateLegacyWindowsConfig() {
|
|
|
26741
26949
|
}
|
|
26742
26950
|
}
|
|
26743
26951
|
function resolveWindowsAccountAnchor(newPath, legacyPath) {
|
|
26744
|
-
const standard =
|
|
26745
|
-
const legacy =
|
|
26952
|
+
const standard = resolve18(newPath);
|
|
26953
|
+
const legacy = resolve18(legacyPath);
|
|
26746
26954
|
if (standard.toLowerCase() === legacy.toLowerCase()) return newPath;
|
|
26747
26955
|
const standardPointer = existsSync3(accountStorePointerPath(standard));
|
|
26748
26956
|
const legacyPointer = existsSync3(accountStorePointerPath(legacy));
|
|
@@ -26756,15 +26964,15 @@ function resolveWindowsAccountAnchor(newPath, legacyPath) {
|
|
|
26756
26964
|
return newPath;
|
|
26757
26965
|
}
|
|
26758
26966
|
function getStoragePathWithMigration() {
|
|
26759
|
-
const newPath =
|
|
26967
|
+
const newPath = join15(getConfigDir(), "antigravity-accounts.json");
|
|
26760
26968
|
if (process.platform === "win32") {
|
|
26761
26969
|
migrateLegacyWindowsConfig();
|
|
26762
|
-
const legacyPath =
|
|
26970
|
+
const legacyPath = join15(
|
|
26763
26971
|
getLegacyWindowsConfigDir(),
|
|
26764
26972
|
"antigravity-accounts.json"
|
|
26765
26973
|
);
|
|
26766
26974
|
const anchored = resolveWindowsAccountAnchor(newPath, legacyPath);
|
|
26767
|
-
if (
|
|
26975
|
+
if (resolve18(anchored).toLowerCase() !== resolve18(newPath).toLowerCase() && !existsSync3(accountStorePointerPath(resolve18(anchored)))) {
|
|
26768
26976
|
log6.info("Using legacy Windows config path (migration failed)", {
|
|
26769
26977
|
legacyPath,
|
|
26770
26978
|
newPath
|
|
@@ -26778,20 +26986,20 @@ function stateHomeStoragePath() {
|
|
|
26778
26986
|
return stateHomeAccountFile(runtimeLayoutLocation());
|
|
26779
26987
|
}
|
|
26780
26988
|
function accountFileForVault(configDir = getConfigDir()) {
|
|
26781
|
-
const configured =
|
|
26989
|
+
const configured = join15(configDir, "antigravity-accounts.json");
|
|
26782
26990
|
if (process.platform !== "win32") return configured;
|
|
26783
26991
|
const legacyDir = getLegacyWindowsConfigDir();
|
|
26784
|
-
if (
|
|
26992
|
+
if (resolve18(configDir).toLowerCase() === resolve18(legacyDir).toLowerCase())
|
|
26785
26993
|
return configured;
|
|
26786
|
-
const configuredVault =
|
|
26787
|
-
const legacyVault =
|
|
26994
|
+
const configuredVault = join15(configDir, "antigravity-auth-vault");
|
|
26995
|
+
const legacyVault = join15(legacyDir, "antigravity-auth-vault");
|
|
26788
26996
|
const configuredPresent = existsSync3(configuredVault);
|
|
26789
26997
|
const legacyPresent = existsSync3(legacyVault);
|
|
26790
26998
|
if (configuredPresent && legacyPresent)
|
|
26791
26999
|
throw new Error(
|
|
26792
27000
|
`Two vault folders exist: ${configuredVault} and ${legacyVault}. Keep one vault enrollment before restarting OpenCode.`
|
|
26793
27001
|
);
|
|
26794
|
-
return legacyPresent ?
|
|
27002
|
+
return legacyPresent ? join15(legacyDir, "antigravity-accounts.json") : configured;
|
|
26795
27003
|
}
|
|
26796
27004
|
async function prepareLocalAccountStore() {
|
|
26797
27005
|
if (!decidedRuntimeLayout(runtimeLayoutLocation())) return;
|
|
@@ -26806,13 +27014,13 @@ function getStoragePath() {
|
|
|
26806
27014
|
if (anchor === "config") return getStoragePathWithMigration();
|
|
26807
27015
|
const location = runtimeLayoutLocation();
|
|
26808
27016
|
if (decidedRuntimeLayout(location))
|
|
26809
|
-
return
|
|
27017
|
+
return join15(location.configDir, "antigravity-accounts.json");
|
|
26810
27018
|
const configPath = getStoragePathWithMigration();
|
|
26811
27019
|
return readForwardedAccountStore(configPath)?.legacyPath ?? configPath;
|
|
26812
27020
|
}
|
|
26813
27021
|
async function assertLegacyPoolInUse(legacyPath) {
|
|
26814
27022
|
try {
|
|
26815
|
-
await assertLegacyAccountStorageWritable(
|
|
27023
|
+
await assertLegacyAccountStorageWritable(resolve18(legacyPath));
|
|
26816
27024
|
} catch (error) {
|
|
26817
27025
|
throw new LegacyAccountPoolRetiredError(legacyPath, { cause: error });
|
|
26818
27026
|
}
|
|
@@ -26832,7 +27040,7 @@ function refusalMessage2(admission) {
|
|
|
26832
27040
|
async function bindingOf(options) {
|
|
26833
27041
|
if (options.legacyPath === void 0) await prepareLocalAccountStore();
|
|
26834
27042
|
const now = options.now ?? (() => Date.now());
|
|
26835
|
-
const legacyPath =
|
|
27043
|
+
const legacyPath = resolve18(options.legacyPath ?? getStoragePath());
|
|
26836
27044
|
return {
|
|
26837
27045
|
legacyPath,
|
|
26838
27046
|
now,
|
|
@@ -26901,14 +27109,14 @@ async function openAccountStore(options) {
|
|
|
26901
27109
|
async function initializeFreshAccountStoreFor(modules, options = {}) {
|
|
26902
27110
|
if (options.legacyPath === void 0) await prepareLocalAccountStore();
|
|
26903
27111
|
return initializeFreshAccountStore(modules, {
|
|
26904
|
-
legacyPath:
|
|
27112
|
+
legacyPath: resolve18(options.legacyPath ?? getStoragePath()),
|
|
26905
27113
|
now: options.now ?? (() => Date.now())
|
|
26906
27114
|
});
|
|
26907
27115
|
}
|
|
26908
27116
|
async function loadAccounts() {
|
|
26909
27117
|
const path2 = getStoragePath();
|
|
26910
27118
|
await assertLegacyPoolInUse(path2);
|
|
26911
|
-
await ensureGitignore(
|
|
27119
|
+
await ensureGitignore(dirname17(path2));
|
|
26912
27120
|
return loadAccountStorage(path2);
|
|
26913
27121
|
}
|
|
26914
27122
|
var log6, GITIGNORE_ENTRIES, LegacyAccountPoolRetiredError, MIGRATE_COMMAND, UNMIGRATED_ACCOUNT_MESSAGE, ROLLBACK_COMMAND;
|
|
@@ -26947,12 +27155,12 @@ var init_storage = __esm({
|
|
|
26947
27155
|
import { createHash as createHash11 } from "node:crypto";
|
|
26948
27156
|
import { existsSync as existsSync4, promises as fs2, readFileSync as readFileSync2, realpathSync as realpathSync2 } from "node:fs";
|
|
26949
27157
|
import { homedir as homedir5 } from "node:os";
|
|
26950
|
-
import { dirname as
|
|
27158
|
+
import { dirname as dirname18, join as join16, resolve as resolve19 } from "node:path";
|
|
26951
27159
|
function configDirIdentity(path2) {
|
|
26952
27160
|
try {
|
|
26953
27161
|
return realpathSync2.native(path2);
|
|
26954
27162
|
} catch {
|
|
26955
|
-
return
|
|
27163
|
+
return resolve19(path2);
|
|
26956
27164
|
}
|
|
26957
27165
|
}
|
|
26958
27166
|
function decisionKey(location) {
|
|
@@ -26960,18 +27168,18 @@ function decisionKey(location) {
|
|
|
26960
27168
|
}
|
|
26961
27169
|
function runtimeLayoutLocation(configDir = getConfigDir()) {
|
|
26962
27170
|
const stateHome = defaultStateHome();
|
|
26963
|
-
const homeConfig =
|
|
27171
|
+
const homeConfig = join16(homedir5(), ".config", "opencode");
|
|
26964
27172
|
const cacheKey = `${configDir}\0${homeConfig}\0${stateHome}`;
|
|
26965
27173
|
const cached = shared2.locations.get(cacheKey);
|
|
26966
27174
|
if (cached && shared2.decisions.has(decisionKey(cached))) return cached;
|
|
26967
27175
|
const key = configDirIdentity(configDir);
|
|
26968
27176
|
if (cached && cached.key === key) return cached;
|
|
26969
27177
|
const isDefaultConfigDir = key === configDirIdentity(homeConfig);
|
|
26970
|
-
const root =
|
|
27178
|
+
const root = join16(stateHome, "cortexkit", "antigravity-auth");
|
|
26971
27179
|
const location = {
|
|
26972
27180
|
key,
|
|
26973
27181
|
configDir,
|
|
26974
|
-
stateHomeDir: isDefaultConfigDir ?
|
|
27182
|
+
stateHomeDir: isDefaultConfigDir ? join16(root, "opencode") : join16(
|
|
26975
27183
|
root,
|
|
26976
27184
|
`opencode-${createHash11("sha256").update(key).digest("hex").slice(0, 16)}`
|
|
26977
27185
|
),
|
|
@@ -26993,46 +27201,46 @@ function decidedAccountStoreAnchor(location) {
|
|
|
26993
27201
|
return shared2.storeAnchors.get(`${location.stateHomeDir}\0${location.key}`);
|
|
26994
27202
|
}
|
|
26995
27203
|
function currentRuntimeLayout(location = runtimeLayoutLocation()) {
|
|
26996
|
-
return decidedRuntimeLayout(location) ?? (existsSync4(
|
|
27204
|
+
return decidedRuntimeLayout(location) ?? (existsSync4(join16(location.stateHomeDir, RUNTIME_LAYOUT_MARKER_FILE)) ? "state-home" : "legacy");
|
|
26997
27205
|
}
|
|
26998
27206
|
function legacyWindowsConfigDir() {
|
|
26999
|
-
return
|
|
27000
|
-
process.env.APPDATA ||
|
|
27207
|
+
return join16(
|
|
27208
|
+
process.env.APPDATA || join16(homedir5(), "AppData", "Roaming"),
|
|
27001
27209
|
"opencode"
|
|
27002
27210
|
);
|
|
27003
27211
|
}
|
|
27004
27212
|
function pluginStateDir() {
|
|
27005
|
-
return
|
|
27213
|
+
return join16(defaultStateHome(), "cortexkit", "antigravity-auth");
|
|
27006
27214
|
}
|
|
27007
27215
|
function legacySignatureCacheFile() {
|
|
27008
|
-
const configHome = process.platform === "win32" ? legacyWindowsConfigDir() :
|
|
27009
|
-
process.env.XDG_CONFIG_HOME ||
|
|
27216
|
+
const configHome = process.platform === "win32" ? legacyWindowsConfigDir() : join16(
|
|
27217
|
+
process.env.XDG_CONFIG_HOME || join16(homedir5(), ".config"),
|
|
27010
27218
|
"opencode"
|
|
27011
27219
|
);
|
|
27012
|
-
return
|
|
27220
|
+
return join16(configHome, SIGNATURE_CACHE_FILE_NAME);
|
|
27013
27221
|
}
|
|
27014
27222
|
function stateHomeLogsDir() {
|
|
27015
|
-
return
|
|
27223
|
+
return join16(pluginStateDir(), "logs");
|
|
27016
27224
|
}
|
|
27017
27225
|
function legacyAccountFile(configDir = getConfigDir()) {
|
|
27018
|
-
const standard =
|
|
27226
|
+
const standard = join16(configDir, ACCOUNT_FILE_NAME);
|
|
27019
27227
|
if (process.platform !== "win32") return standard;
|
|
27020
27228
|
return resolveWindowsAccountAnchor(
|
|
27021
27229
|
standard,
|
|
27022
|
-
|
|
27230
|
+
join16(legacyWindowsConfigDir(), ACCOUNT_FILE_NAME)
|
|
27023
27231
|
);
|
|
27024
27232
|
}
|
|
27025
27233
|
function legacyVaultDir(accountFile) {
|
|
27026
|
-
return
|
|
27234
|
+
return join16(dirname18(accountFile), VAULT_DIR_NAME);
|
|
27027
27235
|
}
|
|
27028
27236
|
function stateHomeVaultDir(location) {
|
|
27029
|
-
return
|
|
27237
|
+
return join16(location.stateHomeDir, VAULT_DIR_NAME);
|
|
27030
27238
|
}
|
|
27031
27239
|
function accountStorePointerPath2(accountFile) {
|
|
27032
27240
|
return `${accountFile}${ACCOUNT_STORE_POINTER_SUFFIX}`;
|
|
27033
27241
|
}
|
|
27034
27242
|
function stateHomeAccountFile(location) {
|
|
27035
|
-
return
|
|
27243
|
+
return join16(realPathOrSelf(location.stateHomeDir), ACCOUNT_FILE_NAME);
|
|
27036
27244
|
}
|
|
27037
27245
|
function realPathOrSelf(path2) {
|
|
27038
27246
|
try {
|
|
@@ -27042,10 +27250,10 @@ function realPathOrSelf(path2) {
|
|
|
27042
27250
|
}
|
|
27043
27251
|
}
|
|
27044
27252
|
function folderResolvesToItself(path2) {
|
|
27045
|
-
let current =
|
|
27253
|
+
let current = dirname18(path2);
|
|
27046
27254
|
for (; ; ) {
|
|
27047
27255
|
if (!existsSync4(current)) {
|
|
27048
|
-
const parent =
|
|
27256
|
+
const parent = dirname18(current);
|
|
27049
27257
|
if (parent === current) return true;
|
|
27050
27258
|
current = parent;
|
|
27051
27259
|
continue;
|
|
@@ -27252,7 +27460,7 @@ import {
|
|
|
27252
27460
|
statSync as statSync4,
|
|
27253
27461
|
unlinkSync as unlinkSync2
|
|
27254
27462
|
} from "node:fs";
|
|
27255
|
-
import { join as
|
|
27463
|
+
import { join as join17 } from "node:path";
|
|
27256
27464
|
import { env } from "node:process";
|
|
27257
27465
|
function getLogsDir(customLogDir) {
|
|
27258
27466
|
const logsDir = customLogDir || stateHomeLogsDir();
|
|
@@ -27271,9 +27479,9 @@ function createLogFilePath(customLogDir) {
|
|
|
27271
27479
|
const logsDir = getLogsDir(requestedLogDir(customLogDir));
|
|
27272
27480
|
cleanupOldLogs(logsDir, 25);
|
|
27273
27481
|
const timestamp = (/* @__PURE__ */ new Date()).toISOString().replace(/[:.]/g, "-");
|
|
27274
|
-
let candidate =
|
|
27482
|
+
let candidate = join17(logsDir, `antigravity-debug-${timestamp}.log`);
|
|
27275
27483
|
for (let suffix = 2; liveLogFilePaths.has(candidate); suffix++) {
|
|
27276
|
-
candidate =
|
|
27484
|
+
candidate = join17(logsDir, `antigravity-debug-${timestamp}-${suffix}.log`);
|
|
27277
27485
|
}
|
|
27278
27486
|
return candidate;
|
|
27279
27487
|
}
|
|
@@ -27281,7 +27489,7 @@ function cleanupOldLogs(logsDir, maxFiles) {
|
|
|
27281
27489
|
try {
|
|
27282
27490
|
const files = readdirSync(logsDir).filter(
|
|
27283
27491
|
(file) => file.startsWith("antigravity-debug-") && file.endsWith(".log")
|
|
27284
|
-
).map((file) =>
|
|
27492
|
+
).map((file) => join17(logsDir, file));
|
|
27285
27493
|
if (files.length <= maxFiles) {
|
|
27286
27494
|
return;
|
|
27287
27495
|
}
|
|
@@ -27614,13 +27822,13 @@ function closeDebugLog() {
|
|
|
27614
27822
|
if (!state || !current) return Promise.resolve();
|
|
27615
27823
|
state.logStream = null;
|
|
27616
27824
|
if (state.logFilePath) liveLogFilePaths.delete(state.logFilePath);
|
|
27617
|
-
return new Promise((
|
|
27618
|
-
current.once("close", () =>
|
|
27619
|
-
current.once("error", () =>
|
|
27825
|
+
return new Promise((resolve25) => {
|
|
27826
|
+
current.once("close", () => resolve25());
|
|
27827
|
+
current.once("error", () => resolve25());
|
|
27620
27828
|
try {
|
|
27621
27829
|
current.end();
|
|
27622
27830
|
} catch {
|
|
27623
|
-
|
|
27831
|
+
resolve25();
|
|
27624
27832
|
}
|
|
27625
27833
|
});
|
|
27626
27834
|
}
|
|
@@ -27778,7 +27986,7 @@ var init_logger4 = __esm({
|
|
|
27778
27986
|
init_dist();
|
|
27779
27987
|
import { execFile } from "node:child_process";
|
|
27780
27988
|
import { realpathSync as realpathSync4 } from "node:fs";
|
|
27781
|
-
import { resolve as
|
|
27989
|
+
import { resolve as resolve24 } from "node:path";
|
|
27782
27990
|
import { createInterface } from "node:readline/promises";
|
|
27783
27991
|
import { fileURLToPath as fileURLToPath2 } from "node:url";
|
|
27784
27992
|
import { promisify } from "node:util";
|
|
@@ -28186,14 +28394,14 @@ async function fetchQuotaPayloads(options) {
|
|
|
28186
28394
|
};
|
|
28187
28395
|
}
|
|
28188
28396
|
function untilQuotaAborted(pending, signal) {
|
|
28189
|
-
return new Promise((
|
|
28397
|
+
return new Promise((resolve25, reject) => {
|
|
28190
28398
|
const abort = () => reject(signal.reason);
|
|
28191
28399
|
if (signal.aborted) abort();
|
|
28192
28400
|
else signal.addEventListener("abort", abort, { once: true });
|
|
28193
28401
|
void pending.then(
|
|
28194
28402
|
(value) => {
|
|
28195
28403
|
signal.removeEventListener("abort", abort);
|
|
28196
|
-
|
|
28404
|
+
resolve25(value);
|
|
28197
28405
|
},
|
|
28198
28406
|
(error) => {
|
|
28199
28407
|
signal.removeEventListener("abort", abort);
|
|
@@ -28475,12 +28683,12 @@ async function startOAuthListener({
|
|
|
28475
28683
|
let resolveCallback;
|
|
28476
28684
|
let rejectCallback;
|
|
28477
28685
|
let timeoutHandle;
|
|
28478
|
-
const callbackPromise = new Promise((
|
|
28686
|
+
const callbackPromise = new Promise((resolve25, reject) => {
|
|
28479
28687
|
resolveCallback = (url) => {
|
|
28480
28688
|
if (settled) return;
|
|
28481
28689
|
settled = true;
|
|
28482
28690
|
if (timeoutHandle) clearTimeout(timeoutHandle);
|
|
28483
|
-
|
|
28691
|
+
resolve25(url);
|
|
28484
28692
|
};
|
|
28485
28693
|
rejectCallback = (error) => {
|
|
28486
28694
|
if (settled) return;
|
|
@@ -28639,7 +28847,7 @@ async function startOAuthListener({
|
|
|
28639
28847
|
});
|
|
28640
28848
|
});
|
|
28641
28849
|
const bindAddress = getBindAddress();
|
|
28642
|
-
await new Promise((
|
|
28850
|
+
await new Promise((resolve25, reject) => {
|
|
28643
28851
|
const handleError = (error) => {
|
|
28644
28852
|
server.off("error", handleError);
|
|
28645
28853
|
if (error.code === "EADDRINUSE") {
|
|
@@ -28655,7 +28863,7 @@ async function startOAuthListener({
|
|
|
28655
28863
|
server.once("error", handleError);
|
|
28656
28864
|
server.listen(port, bindAddress, () => {
|
|
28657
28865
|
server.off("error", handleError);
|
|
28658
|
-
|
|
28866
|
+
resolve25();
|
|
28659
28867
|
});
|
|
28660
28868
|
});
|
|
28661
28869
|
server.on("error", (error) => {
|
|
@@ -28663,7 +28871,7 @@ async function startOAuthListener({
|
|
|
28663
28871
|
});
|
|
28664
28872
|
return {
|
|
28665
28873
|
waitForCallback: () => callbackPromise,
|
|
28666
|
-
close: () => new Promise((
|
|
28874
|
+
close: () => new Promise((resolve25, reject) => {
|
|
28667
28875
|
server.close((error) => {
|
|
28668
28876
|
if (error && error.code !== "ERR_SERVER_NOT_RUNNING") {
|
|
28669
28877
|
reject(error);
|
|
@@ -28672,7 +28880,7 @@ async function startOAuthListener({
|
|
|
28672
28880
|
if (!settled) {
|
|
28673
28881
|
rejectCallback(new Error("OAuth listener closed before callback"));
|
|
28674
28882
|
}
|
|
28675
|
-
|
|
28883
|
+
resolve25();
|
|
28676
28884
|
});
|
|
28677
28885
|
})
|
|
28678
28886
|
};
|
|
@@ -28691,7 +28899,7 @@ init_runtime_paths();
|
|
|
28691
28899
|
// src/setup.ts
|
|
28692
28900
|
init_dist();
|
|
28693
28901
|
import { lstat as lstat9, readFile as readFile13 } from "node:fs/promises";
|
|
28694
|
-
import { join as
|
|
28902
|
+
import { join as join23, resolve as resolve23 } from "node:path";
|
|
28695
28903
|
|
|
28696
28904
|
// src/auth-method-labels.ts
|
|
28697
28905
|
var OPENCODE2_POOL_AUTH_LABEL = "Google (antigravity-auth pool, browser)";
|
|
@@ -28864,7 +29072,7 @@ async function select2(terminal, items, options) {
|
|
|
28864
29072
|
writeLine("");
|
|
28865
29073
|
renderedLines = lines;
|
|
28866
29074
|
};
|
|
28867
|
-
return new Promise((
|
|
29075
|
+
return new Promise((resolve25) => {
|
|
28868
29076
|
const wasRaw = stdin.isRaw ?? false;
|
|
28869
29077
|
const cleanup2 = () => {
|
|
28870
29078
|
if (cleaned)
|
|
@@ -28884,7 +29092,7 @@ async function select2(terminal, items, options) {
|
|
|
28884
29092
|
};
|
|
28885
29093
|
const finish = (value) => {
|
|
28886
29094
|
cleanup2();
|
|
28887
|
-
|
|
29095
|
+
resolve25(value);
|
|
28888
29096
|
};
|
|
28889
29097
|
const onSignal = () => finish(null);
|
|
28890
29098
|
const onKey = (data) => {
|
|
@@ -28924,7 +29132,7 @@ async function select2(terminal, items, options) {
|
|
|
28924
29132
|
stdin.setRawMode(true);
|
|
28925
29133
|
} catch {
|
|
28926
29134
|
cleanup2();
|
|
28927
|
-
|
|
29135
|
+
resolve25(null);
|
|
28928
29136
|
return;
|
|
28929
29137
|
}
|
|
28930
29138
|
stdin.resume();
|
|
@@ -28938,12 +29146,12 @@ async function select2(terminal, items, options) {
|
|
|
28938
29146
|
import { createHash as createHash12, randomBytes as randomBytes3, randomUUID as randomUUID15 } from "node:crypto";
|
|
28939
29147
|
import { constants as fsConstants2 } from "node:fs";
|
|
28940
29148
|
import { chmod as chmod5, mkdir as mkdir14, open as open10, readFile as readFile12, realpath as realpath4, rename as rename12, stat as stat13, unlink as unlink13 } from "node:fs/promises";
|
|
28941
|
-
import { basename as
|
|
29149
|
+
import { basename as basename8, dirname as dirname20, extname as extname2, isAbsolute as isAbsolute4, join as join19, resolve as resolve22 } from "node:path";
|
|
28942
29150
|
import { ClaustrumCredentialError as ClaustrumCredentialError9, ClaustrumClient as ClaustrumWireClient2, writeEnrollmentTokenFile as writeEnrollmentTokenFile2 } from "@cortexkit/claustrum-client";
|
|
28943
29151
|
|
|
28944
29152
|
// src/common-auth-embedded/fs/file-read-cache.js
|
|
28945
29153
|
import { lstat as lstat7, stat as stat11 } from "node:fs/promises";
|
|
28946
|
-
import { resolve as
|
|
29154
|
+
import { resolve as resolve20 } from "node:path";
|
|
28947
29155
|
async function identity2(path2, probe) {
|
|
28948
29156
|
try {
|
|
28949
29157
|
const metadata = await probe(path2);
|
|
@@ -28964,7 +29172,7 @@ var FileReadCache2 = class {
|
|
|
28964
29172
|
this.#probe = options.followSymlinks ? (path2) => (options.stat ?? stat11)(path2) : (path2) => (options.lstat ?? lstat7)(path2);
|
|
28965
29173
|
}
|
|
28966
29174
|
async read(paths, read, validateHit) {
|
|
28967
|
-
const resolvedPaths = paths.map((path2) =>
|
|
29175
|
+
const resolvedPaths = paths.map((path2) => resolve20(path2));
|
|
28968
29176
|
const key = JSON.stringify(resolvedPaths);
|
|
28969
29177
|
const probed = await Promise.all(resolvedPaths.map((path2) => identity2(path2, this.#probe)));
|
|
28970
29178
|
const identities = probed.every((entry) => entry !== void 0) ? probed : void 0;
|
|
@@ -29016,11 +29224,11 @@ init_private_files2();
|
|
|
29016
29224
|
init_logger3();
|
|
29017
29225
|
import { randomUUID as randomUUID14 } from "node:crypto";
|
|
29018
29226
|
import { link as link3, lstat as lstat8, mkdir as mkdir13, open as open9, readdir as readdir5, readFile as readFile11, rename as rename11, rm as rm6, stat as stat12, unlink as unlink12 } from "node:fs/promises";
|
|
29019
|
-
import { basename as
|
|
29227
|
+
import { basename as basename7, dirname as dirname19, join as join18 } from "node:path";
|
|
29020
29228
|
|
|
29021
29229
|
// src/common-auth-embedded/fs/lock-record.js
|
|
29022
29230
|
init_private_files2();
|
|
29023
|
-
import { resolve as
|
|
29231
|
+
import { resolve as resolve21 } from "node:path";
|
|
29024
29232
|
var DisappearedLockRecordError2 = class extends Error {
|
|
29025
29233
|
path;
|
|
29026
29234
|
code = "ENOENT";
|
|
@@ -29030,10 +29238,10 @@ var DisappearedLockRecordError2 = class extends Error {
|
|
|
29030
29238
|
}
|
|
29031
29239
|
};
|
|
29032
29240
|
function isWindowsAccessDeniedRead2(error, paths) {
|
|
29033
|
-
return error instanceof PrivateFileError2 && error.reason === "io-error" && error.win32Code === 5 && (error.stage === "read" || error.stage === "verify") && paths.some((path2) =>
|
|
29241
|
+
return error instanceof PrivateFileError2 && error.reason === "io-error" && error.win32Code === 5 && (error.stage === "read" || error.stage === "verify") && paths.some((path2) => resolve21(path2) === error.path);
|
|
29034
29242
|
}
|
|
29035
29243
|
function isWindowsAccessDeniedCreate2(error, paths, stage) {
|
|
29036
|
-
return error instanceof PrivateFileError2 && error.reason === "io-error" && error.win32Code === 5 && error.stage === stage && paths.some((path2) =>
|
|
29244
|
+
return error instanceof PrivateFileError2 && error.reason === "io-error" && error.win32Code === 5 && error.stage === stage && paths.some((path2) => resolve21(path2) === error.path);
|
|
29037
29245
|
}
|
|
29038
29246
|
async function readLockRecord2(path2, read) {
|
|
29039
29247
|
try {
|
|
@@ -29175,14 +29383,14 @@ async function readStagedOwner2(path2) {
|
|
|
29175
29383
|
return { identity: before, expiresAt };
|
|
29176
29384
|
}
|
|
29177
29385
|
async function sweepAbandonedStaging2(lockPath, ttlMs, now) {
|
|
29178
|
-
const directory =
|
|
29179
|
-
const lockName =
|
|
29386
|
+
const directory = dirname19(lockPath);
|
|
29387
|
+
const lockName = basename7(lockPath);
|
|
29180
29388
|
const hooks = stagingSweepTestHooks2;
|
|
29181
29389
|
const names = await (hooks?.readdir ?? readdir5)(directory);
|
|
29182
29390
|
const candidates = names.filter((name) => isStagingName2(name, lockName)).slice(0, STAGING_SWEEP_MAX_CANDIDATES2);
|
|
29183
29391
|
const marginMs = Math.max(Number.isFinite(ttlMs) ? ttlMs : 0, STAGING_SWEEP_MIN_AGE_MS2);
|
|
29184
29392
|
for (const name of candidates) {
|
|
29185
|
-
const path2 =
|
|
29393
|
+
const path2 = join18(directory, name);
|
|
29186
29394
|
try {
|
|
29187
29395
|
if (now() - (await lstat8(path2)).mtimeMs < marginMs)
|
|
29188
29396
|
continue;
|
|
@@ -29228,7 +29436,7 @@ function acquireRefreshFileLock2(options) {
|
|
|
29228
29436
|
}
|
|
29229
29437
|
async function acquireRefreshFileLockWithClock2(options) {
|
|
29230
29438
|
const lockPath = lockPathFor2(options.path, options.name);
|
|
29231
|
-
const legacyOwnerPath =
|
|
29439
|
+
const legacyOwnerPath = join18(lockPath, "owner.json");
|
|
29232
29440
|
const ownerId = randomUUID14();
|
|
29233
29441
|
const now = options.now ?? Date.now;
|
|
29234
29442
|
let renewTimer = null;
|
|
@@ -29236,8 +29444,8 @@ async function acquireRefreshFileLockWithClock2(options) {
|
|
|
29236
29444
|
let releaseConfirmed = false;
|
|
29237
29445
|
let loss;
|
|
29238
29446
|
let resolveLoss;
|
|
29239
|
-
const lostPromise = new Promise((
|
|
29240
|
-
resolveLoss =
|
|
29447
|
+
const lostPromise = new Promise((resolve25) => {
|
|
29448
|
+
resolveLoss = resolve25;
|
|
29241
29449
|
});
|
|
29242
29450
|
function notifyTimerStep(event) {
|
|
29243
29451
|
try {
|
|
@@ -29271,7 +29479,7 @@ async function acquireRefreshFileLockWithClock2(options) {
|
|
|
29271
29479
|
let terminalIOError;
|
|
29272
29480
|
let renewalInFlight = null;
|
|
29273
29481
|
const evictPath = `${lockPath}.evicting`;
|
|
29274
|
-
const evictOwnerPath =
|
|
29482
|
+
const evictOwnerPath = join18(evictPath, "owner.json");
|
|
29275
29483
|
const evictOwnerId = randomUUID14();
|
|
29276
29484
|
const EVICT_TTL = 5e3;
|
|
29277
29485
|
const MAX_STEAL_ATTEMPTS = 8;
|
|
@@ -29375,7 +29583,7 @@ async function acquireRefreshFileLockWithClock2(options) {
|
|
|
29375
29583
|
}
|
|
29376
29584
|
async function tryAcquire() {
|
|
29377
29585
|
if (windowsPrivateFiles2)
|
|
29378
|
-
await ensurePrivateDirectory2(
|
|
29586
|
+
await ensurePrivateDirectory2(dirname19(lockPath));
|
|
29379
29587
|
try {
|
|
29380
29588
|
await createLease();
|
|
29381
29589
|
return true;
|
|
@@ -29385,9 +29593,9 @@ async function acquireRefreshFileLockWithClock2(options) {
|
|
|
29385
29593
|
return false;
|
|
29386
29594
|
if (code2 === "ENOENT") {
|
|
29387
29595
|
if (windowsPrivateFiles2)
|
|
29388
|
-
await ensurePrivateDirectory2(
|
|
29596
|
+
await ensurePrivateDirectory2(dirname19(lockPath));
|
|
29389
29597
|
else
|
|
29390
|
-
await mkdir13(
|
|
29598
|
+
await mkdir13(dirname19(lockPath), { recursive: true });
|
|
29391
29599
|
try {
|
|
29392
29600
|
await createLease();
|
|
29393
29601
|
return true;
|
|
@@ -29401,7 +29609,7 @@ async function acquireRefreshFileLockWithClock2(options) {
|
|
|
29401
29609
|
}
|
|
29402
29610
|
}
|
|
29403
29611
|
async function backoff() {
|
|
29404
|
-
await new Promise((
|
|
29612
|
+
await new Promise((resolve25) => setTimeout(resolve25, Math.floor(Math.random() * 4)));
|
|
29405
29613
|
}
|
|
29406
29614
|
async function readLockState(notifyReady = true) {
|
|
29407
29615
|
if (notifyReady && options.onStep)
|
|
@@ -29494,7 +29702,7 @@ async function acquireRefreshFileLockWithClock2(options) {
|
|
|
29494
29702
|
const remainingMs = deadline - performance.now();
|
|
29495
29703
|
if (remainingMs <= 0)
|
|
29496
29704
|
throw original;
|
|
29497
|
-
await new Promise((
|
|
29705
|
+
await new Promise((resolve25) => setTimeout(resolve25, Math.min(delayMs, remainingMs)));
|
|
29498
29706
|
if (performance.now() >= deadline)
|
|
29499
29707
|
throw original;
|
|
29500
29708
|
delayMs = Math.min(delayMs * 2, 50);
|
|
@@ -29997,7 +30205,7 @@ async function acquireRefreshFileLockWithClock2(options) {
|
|
|
29997
30205
|
const remainingMs = deadline - performance.now();
|
|
29998
30206
|
if (remainingMs <= 0)
|
|
29999
30207
|
break;
|
|
30000
|
-
await new Promise((
|
|
30208
|
+
await new Promise((resolve25) => setTimeout(resolve25, Math.min(delayMs, remainingMs)));
|
|
30001
30209
|
if (windowsPrivateFiles2 && performance.now() >= deadline)
|
|
30002
30210
|
break;
|
|
30003
30211
|
delayMs = Math.min(delayMs * 2, 50);
|
|
@@ -30174,9 +30382,9 @@ function connectClaustrumEnrollmentClient2(options) {
|
|
|
30174
30382
|
}
|
|
30175
30383
|
function getClaustrumEnrollmentPaths2(tokenPath) {
|
|
30176
30384
|
const extension = extname2(tokenPath) || ".json";
|
|
30177
|
-
const stem =
|
|
30385
|
+
const stem = basename8(tokenPath, extname2(tokenPath));
|
|
30178
30386
|
return {
|
|
30179
|
-
statePath:
|
|
30387
|
+
statePath: join19(dirname20(tokenPath), `${stem}-state${extension}`),
|
|
30180
30388
|
tokenPath
|
|
30181
30389
|
};
|
|
30182
30390
|
}
|
|
@@ -30184,7 +30392,7 @@ function hostEnrollmentPaths2(input) {
|
|
|
30184
30392
|
const override = input.override?.trim();
|
|
30185
30393
|
if (override && !isAbsolute4(override) && !input.cwd)
|
|
30186
30394
|
throw new ClaustrumConsumerError2("invalid-state", "A relative Claustrum enrollment override needs a base directory");
|
|
30187
|
-
const tokenPath = override ? isAbsolute4(override) ? override :
|
|
30395
|
+
const tokenPath = override ? isAbsolute4(override) ? override : resolve22(input.cwd, override) : join19(input.stateDir, `${input.host}-enrollment.json`);
|
|
30188
30396
|
return getClaustrumEnrollmentPaths2(tokenPath);
|
|
30189
30397
|
}
|
|
30190
30398
|
function isRecord10(value) {
|
|
@@ -30290,7 +30498,7 @@ function parseSecretJson2(text2) {
|
|
|
30290
30498
|
async function readBoundedJson2(path2) {
|
|
30291
30499
|
if (windowsPrivateFiles2) {
|
|
30292
30500
|
try {
|
|
30293
|
-
await ensurePrivateDirectory2(
|
|
30501
|
+
await ensurePrivateDirectory2(dirname20(path2));
|
|
30294
30502
|
const text2 = await readPrivateText2(path2, true);
|
|
30295
30503
|
if (Buffer.byteLength(text2) > ENROLLMENT_FILE_MAX_BYTES2) {
|
|
30296
30504
|
throw new ClaustrumConsumerError2("unsafe-file", "Claustrum enrollment file is too large");
|
|
@@ -30387,7 +30595,7 @@ async function refuseWritableAncestor2(parent, options = {}) {
|
|
|
30387
30595
|
throw new ClaustrumConsumerError2("unsafe-file", `Claustrum enrollment path has a writable ancestor: ${component}. Another user could replace it. Run: chmod g-w,o-w ${component}`);
|
|
30388
30596
|
}
|
|
30389
30597
|
}
|
|
30390
|
-
const next =
|
|
30598
|
+
const next = dirname20(component);
|
|
30391
30599
|
if (next === component)
|
|
30392
30600
|
return;
|
|
30393
30601
|
component = next;
|
|
@@ -30416,7 +30624,7 @@ async function ensureClaustrumPrivateDirectory2(directory, options = {}, what =
|
|
|
30416
30624
|
await chmod5(directory, 448);
|
|
30417
30625
|
}
|
|
30418
30626
|
async function writeStateAtomic2(path2, state, ancestorOptions = {}) {
|
|
30419
|
-
const parent =
|
|
30627
|
+
const parent = dirname20(path2);
|
|
30420
30628
|
await ensureClaustrumPrivateDirectory2(parent, ancestorOptions);
|
|
30421
30629
|
await refuseWritableAncestor2(parent, ancestorOptions);
|
|
30422
30630
|
const bytes = `${JSON.stringify(state)}
|
|
@@ -30426,7 +30634,7 @@ async function writeStateAtomic2(path2, state, ancestorOptions = {}) {
|
|
|
30426
30634
|
}
|
|
30427
30635
|
if (windowsPrivateFiles2)
|
|
30428
30636
|
return writePrivateAtomic2(path2, bytes);
|
|
30429
|
-
const temporary =
|
|
30637
|
+
const temporary = join19(parent, `.${basename8(path2)}.${process.pid}.${randomUUID15()}.tmp`);
|
|
30430
30638
|
let descriptor;
|
|
30431
30639
|
let created = false;
|
|
30432
30640
|
try {
|
|
@@ -30605,7 +30813,7 @@ var ClaustrumEnrollmentManager2 = class {
|
|
|
30605
30813
|
return statusFromState2(blocked);
|
|
30606
30814
|
}
|
|
30607
30815
|
async reconcile() {
|
|
30608
|
-
await ensureClaustrumPrivateDirectory2(
|
|
30816
|
+
await ensureClaustrumPrivateDirectory2(dirname20(this.#paths.statePath), this.#ancestorOptions);
|
|
30609
30817
|
const lock = await acquireRefreshFileLock2({
|
|
30610
30818
|
name: "ceremony",
|
|
30611
30819
|
path: this.#paths.statePath,
|
|
@@ -30758,8 +30966,8 @@ var ClaustrumEnrollmentManager2 = class {
|
|
|
30758
30966
|
await writeStateAtomic2(this.#paths.statePath, denied, this.#ancestorOptions);
|
|
30759
30967
|
return statusFromState2(denied);
|
|
30760
30968
|
}
|
|
30761
|
-
await ensureClaustrumPrivateDirectory2(
|
|
30762
|
-
await refuseWritableAncestor2(
|
|
30969
|
+
await ensureClaustrumPrivateDirectory2(dirname20(this.#paths.tokenPath), this.#ancestorOptions);
|
|
30970
|
+
await refuseWritableAncestor2(dirname20(this.#paths.tokenPath), this.#ancestorOptions);
|
|
30763
30971
|
await this.#writeTokenFile(this.#paths.tokenPath, {
|
|
30764
30972
|
token: outcome.token,
|
|
30765
30973
|
token_generation: outcome.tokenGeneration
|
|
@@ -30796,7 +31004,7 @@ var ClaustrumEnrollmentManager2 = class {
|
|
|
30796
31004
|
}
|
|
30797
31005
|
};
|
|
30798
31006
|
async function resetClaustrumEnrollmentState2(paths, proposedName) {
|
|
30799
|
-
await ensureClaustrumPrivateDirectory2(
|
|
31007
|
+
await ensureClaustrumPrivateDirectory2(dirname20(paths.statePath));
|
|
30800
31008
|
const lock = await acquireRefreshFileLock2({
|
|
30801
31009
|
name: "ceremony",
|
|
30802
31010
|
path: paths.statePath,
|
|
@@ -30878,7 +31086,7 @@ var ByteTail = class {
|
|
|
30878
31086
|
};
|
|
30879
31087
|
var defaultCommandRunner = {
|
|
30880
31088
|
run(file, args, options = {}) {
|
|
30881
|
-
return new Promise((
|
|
31089
|
+
return new Promise((resolve25) => {
|
|
30882
31090
|
const started = performance.now();
|
|
30883
31091
|
const timeoutMs = options.timeoutMs ?? 15e3;
|
|
30884
31092
|
const stderr = new ByteTail();
|
|
@@ -30896,7 +31104,7 @@ var defaultCommandRunner = {
|
|
|
30896
31104
|
stdio: ["ignore", "pipe", "pipe"]
|
|
30897
31105
|
});
|
|
30898
31106
|
} catch {
|
|
30899
|
-
|
|
31107
|
+
resolve25({
|
|
30900
31108
|
exitCode: 1,
|
|
30901
31109
|
stdout: "",
|
|
30902
31110
|
stderr: "",
|
|
@@ -30931,7 +31139,7 @@ var defaultCommandRunner = {
|
|
|
30931
31139
|
settled = true;
|
|
30932
31140
|
if (timer)
|
|
30933
31141
|
clearTimeout(timer);
|
|
30934
|
-
|
|
31142
|
+
resolve25({
|
|
30935
31143
|
exitCode: spawnError ? 1 : outputExceeded ? 1 : code2 ?? 1,
|
|
30936
31144
|
stdout: Buffer.concat(stdout, stdoutLength).toString("utf8"),
|
|
30937
31145
|
stderr: stderr.toString(),
|
|
@@ -31090,7 +31298,7 @@ function recordSetupEnrollment(failure, enrollment) {
|
|
|
31090
31298
|
import { accessSync, constants as constants3, existsSync as existsSync6, readFileSync as readFileSync4, realpathSync as realpathSync3, statSync as statSync5 } from "node:fs";
|
|
31091
31299
|
import { mkdtemp, rm as rm7 } from "node:fs/promises";
|
|
31092
31300
|
import { tmpdir as tmpdir3 } from "node:os";
|
|
31093
|
-
import { join as
|
|
31301
|
+
import { join as join20 } from "node:path";
|
|
31094
31302
|
import { parse } from "jsonc-parser";
|
|
31095
31303
|
|
|
31096
31304
|
// src/common-auth-embedded/setup/paths.js
|
|
@@ -31261,7 +31469,7 @@ async function detectHosts(plugin, io = {}) {
|
|
|
31261
31469
|
return null;
|
|
31262
31470
|
let root;
|
|
31263
31471
|
try {
|
|
31264
|
-
root = await mkdtemp(
|
|
31472
|
+
root = await mkdtemp(join20(tmpdir3(), "common-auth-setup-version-"));
|
|
31265
31473
|
const probeEnv = {
|
|
31266
31474
|
...env3,
|
|
31267
31475
|
HOME: root,
|
|
@@ -31864,11 +32072,11 @@ import { applyEdits, createScanner, findNodeAtLocation, modify, parse as parse2,
|
|
|
31864
32072
|
// src/common-auth-embedded/setup/config-write.js
|
|
31865
32073
|
import { randomUUID as randomUUID16 } from "node:crypto";
|
|
31866
32074
|
import { mkdir as mkdir15, open as open11, rename as rename13, stat as stat15, unlink as unlink14 } from "node:fs/promises";
|
|
31867
|
-
import { basename as
|
|
32075
|
+
import { basename as basename9, dirname as dirname21, join as join21 } from "node:path";
|
|
31868
32076
|
import { setTimeout as delay2 } from "node:timers/promises";
|
|
31869
32077
|
async function writeHostConfigAtomic(file, content, options = {}) {
|
|
31870
32078
|
const windows = (options.platform ?? process.platform) === "win32";
|
|
31871
|
-
const parent =
|
|
32079
|
+
const parent = dirname21(file);
|
|
31872
32080
|
await mkdir15(parent, { recursive: true });
|
|
31873
32081
|
let mode;
|
|
31874
32082
|
if (!windows) {
|
|
@@ -31879,7 +32087,7 @@ async function writeHostConfigAtomic(file, content, options = {}) {
|
|
|
31879
32087
|
throw error;
|
|
31880
32088
|
}
|
|
31881
32089
|
}
|
|
31882
|
-
const stage =
|
|
32090
|
+
const stage = join21(parent, `.${basename9(file)}.${(options.stageName ?? randomUUID16)()}.tmp`);
|
|
31883
32091
|
let created = false;
|
|
31884
32092
|
try {
|
|
31885
32093
|
const handle = await open11(stage, "wx", mode ?? 438);
|
|
@@ -32313,10 +32521,10 @@ init_storage();
|
|
|
32313
32521
|
// src/plugin/vault-activation.ts
|
|
32314
32522
|
init_dist();
|
|
32315
32523
|
import { homedir as homedir7 } from "node:os";
|
|
32316
|
-
import { join as
|
|
32524
|
+
import { join as join22 } from "node:path";
|
|
32317
32525
|
function nativeOpenCodeAuthPath(env3 = process.env, home = homedir7()) {
|
|
32318
|
-
return
|
|
32319
|
-
env3.XDG_DATA_HOME ||
|
|
32526
|
+
return join22(
|
|
32527
|
+
env3.XDG_DATA_HOME || join22(home, ".local", "share"),
|
|
32320
32528
|
"opencode",
|
|
32321
32529
|
"auth.json"
|
|
32322
32530
|
);
|
|
@@ -32342,7 +32550,7 @@ function openCodeVaultDir(accountFile) {
|
|
|
32342
32550
|
return folder.vaultDir;
|
|
32343
32551
|
}
|
|
32344
32552
|
function nativeAuthPath(host, context) {
|
|
32345
|
-
return host === "opencode" ? nativeOpenCodeAuthPath() :
|
|
32553
|
+
return host === "opencode" ? nativeOpenCodeAuthPath() : join23(context.piAgentDir, "auth.json");
|
|
32346
32554
|
}
|
|
32347
32555
|
function provider(host) {
|
|
32348
32556
|
return host === "opencode" ? OPENCODE_VAULT_PROVIDER : ANTIGRAVITY_PROVIDER_ID;
|
|
@@ -32398,7 +32606,7 @@ async function writeNativeSlot(host, slot, context, expectedAuthority = "local")
|
|
|
32398
32606
|
beforeRename: async () => {
|
|
32399
32607
|
await assertSetupHostsStopped();
|
|
32400
32608
|
const claustrum = await loadCommonAuthClaustrum();
|
|
32401
|
-
const stateDir = host === "opencode" ? openCodeVaultDir(
|
|
32609
|
+
const stateDir = host === "opencode" ? openCodeVaultDir(resolve23(accountFileForVault())) : getPiAntigravityVaultDir();
|
|
32402
32610
|
if (await claustrum.vaultAuthority(
|
|
32403
32611
|
claustrum.hostEnrollmentPaths({ stateDir, host }),
|
|
32404
32612
|
`antigravity-auth-${host}`
|
|
@@ -32443,7 +32651,7 @@ async function createSetupPlugin(deps, migrateOpenCode, forceLogin = false) {
|
|
|
32443
32651
|
// `beforeSignIn`, which may move it after this plugin is built.
|
|
32444
32652
|
paths: {
|
|
32445
32653
|
get stateDir() {
|
|
32446
|
-
return openCodeVaultDir(
|
|
32654
|
+
return openCodeVaultDir(resolve23(accountFileForVault()));
|
|
32447
32655
|
},
|
|
32448
32656
|
host: "opencode"
|
|
32449
32657
|
}
|
|
@@ -32467,7 +32675,7 @@ async function createSetupPlugin(deps, migrateOpenCode, forceLogin = false) {
|
|
|
32467
32675
|
const assertLocal = async (host, context) => {
|
|
32468
32676
|
if (host === "opencode")
|
|
32469
32677
|
return assertLocalOpenCodeLogin(
|
|
32470
|
-
|
|
32678
|
+
resolve23(accountFileForVault()),
|
|
32471
32679
|
context.opencodeGeneration
|
|
32472
32680
|
);
|
|
32473
32681
|
if (await authority(host) !== "local")
|
|
@@ -32483,7 +32691,7 @@ async function createSetupPlugin(deps, migrateOpenCode, forceLogin = false) {
|
|
|
32483
32691
|
const { openPiSlot: openPiSlot2 } = await loadCommonAuthPiSlot();
|
|
32484
32692
|
if ((await openPiSlot2({
|
|
32485
32693
|
authPath: nativeAuthPath(host, context),
|
|
32486
|
-
stashPath:
|
|
32694
|
+
stashPath: join23(piDir, "google-login-stash.json"),
|
|
32487
32695
|
provider: ANTIGRAVITY_PROVIDER_ID,
|
|
32488
32696
|
placeholderKey: PI_PLACEHOLDER_KEY
|
|
32489
32697
|
}).inspect()).slot === "placeholder")
|
|
@@ -32530,7 +32738,7 @@ Setup has not completed the OpenCode 2 native Google connection.
|
|
|
32530
32738
|
const { openPiSlot: openPiSlot2 } = await loadCommonAuthPiSlot();
|
|
32531
32739
|
const inspection = await openPiSlot2({
|
|
32532
32740
|
authPath: nativeAuthPath("pi", context),
|
|
32533
|
-
stashPath:
|
|
32741
|
+
stashPath: join23(piDir, "google-login-stash.json"),
|
|
32534
32742
|
provider: ANTIGRAVITY_PROVIDER_ID,
|
|
32535
32743
|
placeholderKey: PI_PLACEHOLDER_KEY
|
|
32536
32744
|
}).inspect();
|
|
@@ -32651,7 +32859,7 @@ Setup has not completed the OpenCode 2 native Google connection.
|
|
|
32651
32859
|
await assertSetupHostsStopped();
|
|
32652
32860
|
await openPiSlot2({
|
|
32653
32861
|
authPath: nativeAuthPath(host, context),
|
|
32654
|
-
stashPath:
|
|
32862
|
+
stashPath: join23(piDir, "google-login-stash.json"),
|
|
32655
32863
|
provider: ANTIGRAVITY_PROVIDER_ID,
|
|
32656
32864
|
placeholderKey: PI_PLACEHOLDER_KEY
|
|
32657
32865
|
}).enterVault();
|
|
@@ -33127,7 +33335,7 @@ async function runCliProcess(argv, deps) {
|
|
|
33127
33335
|
...deps,
|
|
33128
33336
|
prepareVaultFolder: deps.prepareVaultFolder ?? (async (options) => {
|
|
33129
33337
|
const folder = await prepareVaultFolder({
|
|
33130
|
-
accountFile:
|
|
33338
|
+
accountFile: resolve24(accountFileForVault()),
|
|
33131
33339
|
...options
|
|
33132
33340
|
});
|
|
33133
33341
|
if (folder.refusal) throw folder.refusal;
|
|
@@ -33173,11 +33381,11 @@ function createDefaultCliDependencies() {
|
|
|
33173
33381
|
);
|
|
33174
33382
|
if (host !== "pi")
|
|
33175
33383
|
await assertLocalOpenCodeLogin(
|
|
33176
|
-
|
|
33384
|
+
resolve24(accountFileForVault()),
|
|
33177
33385
|
context?.opencodeGeneration
|
|
33178
33386
|
);
|
|
33179
33387
|
const repository = host === "pi" ? void 0 : await prepareCliLoginStore(
|
|
33180
|
-
|
|
33388
|
+
resolve24(getStoragePath()),
|
|
33181
33389
|
context?.opencodeGeneration
|
|
33182
33390
|
);
|
|
33183
33391
|
try {
|
|
@@ -33193,7 +33401,7 @@ function createDefaultCliDependencies() {
|
|
|
33193
33401
|
}
|
|
33194
33402
|
if (host === "opencode") await assertSetupHostsStopped();
|
|
33195
33403
|
await assertLocalOpenCodeLogin(
|
|
33196
|
-
|
|
33404
|
+
resolve24(accountFileForVault()),
|
|
33197
33405
|
context?.opencodeGeneration
|
|
33198
33406
|
);
|
|
33199
33407
|
await persistCliStoreLogin(
|
|
@@ -33213,7 +33421,7 @@ function createDefaultCliDependencies() {
|
|
|
33213
33421
|
};
|
|
33214
33422
|
}
|
|
33215
33423
|
async function prepareCliLoginStore(legacyPath, generation) {
|
|
33216
|
-
await assertLocalOpenCodeLogin(
|
|
33424
|
+
await assertLocalOpenCodeLogin(resolve24(accountFileForVault()), generation);
|
|
33217
33425
|
const modules = await loadCommonAuthStoreModules();
|
|
33218
33426
|
const options = {
|
|
33219
33427
|
legacyPath,
|
|
@@ -33358,7 +33566,7 @@ async function readAccountStore(legacyPath) {
|
|
|
33358
33566
|
function createDefaultAccountStoreOperations() {
|
|
33359
33567
|
const offline = { processesStopped: true };
|
|
33360
33568
|
return {
|
|
33361
|
-
legacyPath: () =>
|
|
33569
|
+
legacyPath: () => resolve24(
|
|
33362
33570
|
decidedAccountStoreAnchor(runtimeLayoutLocation()) ? getStoragePath() : discoveredAccountFile()
|
|
33363
33571
|
),
|
|
33364
33572
|
migrate: async (legacyPath) => createAccountMigrationFactory(await loadCommonAuthStoreModules())({
|
|
@@ -33389,7 +33597,7 @@ function createDefaultAccountStoreOperations() {
|
|
|
33389
33597
|
};
|
|
33390
33598
|
}
|
|
33391
33599
|
function samePath(left, right) {
|
|
33392
|
-
return process.platform === "win32" ?
|
|
33600
|
+
return process.platform === "win32" ? resolve24(left).toLowerCase() === resolve24(right).toLowerCase() : resolve24(left) === resolve24(right);
|
|
33393
33601
|
}
|
|
33394
33602
|
function isCliEntry() {
|
|
33395
33603
|
if (import.meta.main !== void 0) return import.meta.main;
|