@cortexkit/opencode-antigravity-auth 3.0.25 → 3.0.26
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 +61 -8
- package/dist/cli.js.map +2 -2
- package/dist/cli.meta.json +6 -6
- package/dist/index.js +61 -8
- package/dist/index.js.map +3 -3
- package/dist/index.meta.json +6 -6
- package/dist/server.js +78 -10
- package/dist/server.js.map +3 -3
- package/dist/server.meta.json +1 -1
- package/dist/src/ga/server/pool-login.d.ts.map +1 -1
- package/dist/src/ga/server/pool-login.js +19 -3
- package/dist/src/ga/server/pool-login.js.map +1 -1
- package/dist/src/plugin/ga-location-services.d.ts.map +1 -1
- package/dist/src/plugin/ga-location-services.js +3 -1
- package/dist/src/plugin/ga-location-services.js.map +1 -1
- package/dist/src/plugin/storage.d.ts.map +1 -1
- package/dist/src/plugin/storage.js +3 -1
- package/dist/src/plugin/storage.js.map +1 -1
- package/dist/types/src/ga/server/pool-login.d.ts.map +1 -1
- package/dist/types/src/plugin/ga-location-services.d.ts.map +1 -1
- package/dist/types/src/plugin/storage.d.ts.map +1 -1
- package/package.json +2 -2
package/dist/cli.meta.json
CHANGED
|
@@ -58,7 +58,7 @@
|
|
|
58
58
|
"format": "esm"
|
|
59
59
|
},
|
|
60
60
|
"../core/dist/account-migration.js": {
|
|
61
|
-
"bytes":
|
|
61
|
+
"bytes": 183913,
|
|
62
62
|
"imports": [
|
|
63
63
|
{
|
|
64
64
|
"path": "node:crypto",
|
|
@@ -3173,7 +3173,7 @@
|
|
|
3173
3173
|
"format": "esm"
|
|
3174
3174
|
},
|
|
3175
3175
|
"src/plugin/storage.ts": {
|
|
3176
|
-
"bytes":
|
|
3176
|
+
"bytes": 28395,
|
|
3177
3177
|
"imports": [
|
|
3178
3178
|
{
|
|
3179
3179
|
"path": "node:fs",
|
|
@@ -4355,7 +4355,7 @@
|
|
|
4355
4355
|
"imports": [],
|
|
4356
4356
|
"exports": [],
|
|
4357
4357
|
"inputs": {},
|
|
4358
|
-
"bytes":
|
|
4358
|
+
"bytes": 3180370
|
|
4359
4359
|
},
|
|
4360
4360
|
"dist/cli.js": {
|
|
4361
4361
|
"imports": [
|
|
@@ -5146,7 +5146,7 @@
|
|
|
5146
5146
|
"bytesInOutput": 10845
|
|
5147
5147
|
},
|
|
5148
5148
|
"../core/dist/account-migration.js": {
|
|
5149
|
-
"bytesInOutput":
|
|
5149
|
+
"bytesInOutput": 150328
|
|
5150
5150
|
},
|
|
5151
5151
|
"../core/dist/account-repository.js": {
|
|
5152
5152
|
"bytesInOutput": 78687
|
|
@@ -5542,7 +5542,7 @@
|
|
|
5542
5542
|
"bytesInOutput": 46416
|
|
5543
5543
|
},
|
|
5544
5544
|
"src/plugin/storage.ts": {
|
|
5545
|
-
"bytesInOutput":
|
|
5545
|
+
"bytesInOutput": 11142
|
|
5546
5546
|
},
|
|
5547
5547
|
"src/runtime-paths.ts": {
|
|
5548
5548
|
"bytesInOutput": 6278
|
|
@@ -5677,7 +5677,7 @@
|
|
|
5677
5677
|
"bytesInOutput": 292
|
|
5678
5678
|
}
|
|
5679
5679
|
},
|
|
5680
|
-
"bytes":
|
|
5680
|
+
"bytes": 1191953
|
|
5681
5681
|
}
|
|
5682
5682
|
}
|
|
5683
5683
|
}
|
package/dist/index.js
CHANGED
|
@@ -1801,6 +1801,8 @@ function openMigrationStore(modules, paths, now, onStep) {
|
|
|
1801
1801
|
}
|
|
1802
1802
|
async function rowsOf(store) {
|
|
1803
1803
|
const read = await store.read();
|
|
1804
|
+
if (read.status === "error" && read.kind === "snapshot-contended")
|
|
1805
|
+
throw new AccountStoreBusyError();
|
|
1804
1806
|
if (read.status !== "ready")
|
|
1805
1807
|
throw new AccountMigrationError("successor is not a ready public store");
|
|
1806
1808
|
return read.rows;
|
|
@@ -2009,8 +2011,46 @@ function receipt(journal) {
|
|
|
2009
2011
|
restartRequired: journal.sourceKind !== "absent" || journal.operation === "rollback"
|
|
2010
2012
|
};
|
|
2011
2013
|
}
|
|
2014
|
+
async function readAdmissionState(path5) {
|
|
2015
|
+
try {
|
|
2016
|
+
const bytes = await secureRead(path5);
|
|
2017
|
+
return { bytes, stamp: digest(bytes) };
|
|
2018
|
+
} catch (error) {
|
|
2019
|
+
if (errno(error) === "ENOENT")
|
|
2020
|
+
return { bytes: void 0, stamp: void 0 };
|
|
2021
|
+
throw error;
|
|
2022
|
+
}
|
|
2023
|
+
}
|
|
2012
2024
|
async function currentSuccessor(store, paths, journal) {
|
|
2013
|
-
|
|
2025
|
+
for (let attempt = 0; attempt < ADMISSION_SNAPSHOT_ATTEMPTS; attempt++) {
|
|
2026
|
+
const configBytes = await secureRead(paths.configPath);
|
|
2027
|
+
let state;
|
|
2028
|
+
let snapshot2;
|
|
2029
|
+
let failure2;
|
|
2030
|
+
try {
|
|
2031
|
+
state = await readAdmissionState(paths.statePath);
|
|
2032
|
+
snapshot2 = {
|
|
2033
|
+
stateBytes: state.bytes,
|
|
2034
|
+
rows: await rowsOf(store),
|
|
2035
|
+
settings: await settingsOf(store)
|
|
2036
|
+
};
|
|
2037
|
+
} catch (error) {
|
|
2038
|
+
failure2 = { error };
|
|
2039
|
+
}
|
|
2040
|
+
const checkedConfigBytes = await secureRead(paths.configPath);
|
|
2041
|
+
const checkedState = await readAdmissionState(paths.statePath);
|
|
2042
|
+
if (digest(configBytes) !== digest(checkedConfigBytes) || state !== void 0 && state.stamp !== checkedState.stamp)
|
|
2043
|
+
continue;
|
|
2044
|
+
if (failure2)
|
|
2045
|
+
throw failure2.error;
|
|
2046
|
+
if (!snapshot2)
|
|
2047
|
+
throw new AccountMigrationError("active snapshot missing");
|
|
2048
|
+
return validateCurrentSuccessor(journal, configBytes, snapshot2.stateBytes, snapshot2.rows, snapshot2.settings);
|
|
2049
|
+
}
|
|
2050
|
+
throw new AccountStoreBusyError();
|
|
2051
|
+
}
|
|
2052
|
+
function validateCurrentSuccessor(journal, configBytes, stateBytes, rows, settings) {
|
|
2053
|
+
const config = object(jsonBytes(configBytes), "active config");
|
|
2014
2054
|
if (config.version !== 1 || !Array.isArray(config.accounts))
|
|
2015
2055
|
throw new AccountMigrationError("active config lacks its native roster");
|
|
2016
2056
|
const pool = object(config.commonAuthPool, "active native pool");
|
|
@@ -2027,15 +2067,14 @@ async function currentSuccessor(store, paths, journal) {
|
|
|
2027
2067
|
if (new Set(nativeIds).size !== nativeIds.length || Object.keys(entries).length !== nativeIds.length || Object.keys(entries).some((id) => !nativeIds.includes(id)))
|
|
2028
2068
|
throw new AccountMigrationError("active native entry/roster presence differs");
|
|
2029
2069
|
let stateAccounts = {};
|
|
2030
|
-
if (
|
|
2031
|
-
const state = object(jsonBytes(
|
|
2070
|
+
if (stateBytes !== void 0) {
|
|
2071
|
+
const state = object(jsonBytes(stateBytes), "active state");
|
|
2032
2072
|
if (state.version !== 1)
|
|
2033
2073
|
throw new AccountMigrationError("active native state schema differs");
|
|
2034
2074
|
stateAccounts = object(state.accounts, "active state accounts");
|
|
2035
2075
|
}
|
|
2036
2076
|
if (Object.keys(stateAccounts).length !== nativeIds.length || Object.keys(stateAccounts).some((id) => !nativeIds.includes(id)))
|
|
2037
2077
|
throw new AccountMigrationError("active state contains orphan or missing credentials");
|
|
2038
|
-
const rows = await rowsOf(store);
|
|
2039
2078
|
if (!isDeepStrictEqual(rows.map((row) => row.id), nativeIds))
|
|
2040
2079
|
throw new AccountMigrationError("public and native active roster order differs");
|
|
2041
2080
|
rows.forEach((row) => {
|
|
@@ -2044,10 +2083,10 @@ async function currentSuccessor(store, paths, journal) {
|
|
|
2044
2083
|
if (entry.credentialEpoch !== rowRef(row).credentialEpoch || Object.hasOwn(entry, "quota") !== (row.quota !== void 0) || row.quota !== void 0 && !isDeepStrictEqual(entry.quota, row.quota))
|
|
2045
2084
|
throw new AccountMigrationError("active native epoch or quota presence differs from public row");
|
|
2046
2085
|
});
|
|
2047
|
-
const settings = await settingsOf(store);
|
|
2048
2086
|
if (!isDeepStrictEqual(decodeAccountStoreGeneration(settings[ACCOUNT_STORE_GENERATION_SETTINGS_KEY]), generationJson(journal)))
|
|
2049
2087
|
throw new AccountMigrationError("active generation setting differs from journal");
|
|
2050
2088
|
decodeRoutingSettings(settings[ROUTING_SETTINGS_KEY]);
|
|
2089
|
+
return settings;
|
|
2051
2090
|
}
|
|
2052
2091
|
function openAdmissionStore(modules, paths, now) {
|
|
2053
2092
|
return modules.store.openPoolStore({
|
|
@@ -2175,11 +2214,13 @@ async function readAccountStoreAdmission(legacyPath, modules, now, expectedGener
|
|
|
2175
2214
|
if (!journal)
|
|
2176
2215
|
throw new AccountMigrationError("active serving journal missing");
|
|
2177
2216
|
const store = openAdmissionStore(modules, binding.paths, now);
|
|
2178
|
-
await currentSuccessor(store, binding.paths, journal);
|
|
2179
|
-
if (
|
|
2217
|
+
const settings = await currentSuccessor(store, binding.paths, journal);
|
|
2218
|
+
if (settings[MANAGEMENT_SETTINGS_KEY] !== void 0)
|
|
2180
2219
|
return { status: "pending" };
|
|
2181
2220
|
return { status: "active", receipt: binding.receipt, paths: binding.paths };
|
|
2182
2221
|
} catch (error) {
|
|
2222
|
+
if (error instanceof AccountStoreBusyError)
|
|
2223
|
+
return { status: "busy", retryable: true };
|
|
2183
2224
|
return {
|
|
2184
2225
|
status: "error",
|
|
2185
2226
|
reason: error instanceof AccountMigrationError ? error.reason : "current credential serving validation failed"
|
|
@@ -3730,6 +3771,8 @@ async function initializePrivateEmptyGeneration(modules, paths, parentLease, man
|
|
|
3730
3771
|
await expectedFreshArtifacts(paths, journal);
|
|
3731
3772
|
await currentSuccessor(store, paths, journal);
|
|
3732
3773
|
const admission = await readAccountStoreAdmission(paths.legacyPath, modules, options.now, journal.id);
|
|
3774
|
+
if (admission.status === "busy")
|
|
3775
|
+
throw new AccountStoreBusyError();
|
|
3733
3776
|
if (admission.status !== "active" || !isDeepStrictEqual(admission.receipt, receipt(journal)))
|
|
3734
3777
|
throw new AccountMigrationError("published empty generation is not admitted");
|
|
3735
3778
|
await boundary?.("pointer:after-sync-before-stage-cleanup");
|
|
@@ -3865,7 +3908,7 @@ async function cleanupPointerStage(legacyPath, pointer, lease) {
|
|
|
3865
3908
|
await unlink2(stage);
|
|
3866
3909
|
return true;
|
|
3867
3910
|
}
|
|
3868
|
-
var AccountMigrationError, QUOTA_FIELDS, ACCOUNT_MIGRATION_PHASES, ACCOUNT_MIGRATION_MANAGEMENT_STEPS, ACCOUNT_STORE_GENERATION_SETTINGS_KEY, UUID, SHA256;
|
|
3911
|
+
var AccountMigrationError, QUOTA_FIELDS, ACCOUNT_MIGRATION_PHASES, ACCOUNT_MIGRATION_MANAGEMENT_STEPS, ACCOUNT_STORE_GENERATION_SETTINGS_KEY, UUID, SHA256, ADMISSION_SNAPSHOT_ATTEMPTS, AccountStoreBusyError;
|
|
3869
3912
|
var init_account_migration = __esm({
|
|
3870
3913
|
"../core/dist/account-migration.js"() {
|
|
3871
3914
|
"use strict";
|
|
@@ -3897,6 +3940,14 @@ var init_account_migration = __esm({
|
|
|
3897
3940
|
ACCOUNT_STORE_GENERATION_SETTINGS_KEY = "antigravityGeneration";
|
|
3898
3941
|
UUID = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/;
|
|
3899
3942
|
SHA256 = /^[0-9a-f]{64}$/;
|
|
3943
|
+
ADMISSION_SNAPSHOT_ATTEMPTS = 3;
|
|
3944
|
+
AccountStoreBusyError = class extends Error {
|
|
3945
|
+
retryable = true;
|
|
3946
|
+
constructor() {
|
|
3947
|
+
super("The Antigravity account store is busy. Try again in a moment.");
|
|
3948
|
+
this.name = "AccountStoreBusyError";
|
|
3949
|
+
}
|
|
3950
|
+
};
|
|
3900
3951
|
}
|
|
3901
3952
|
});
|
|
3902
3953
|
|
|
@@ -32841,6 +32892,8 @@ async function assertLegacyPoolInUse(legacyPath) {
|
|
|
32841
32892
|
}
|
|
32842
32893
|
function refusalMessage2(admission) {
|
|
32843
32894
|
switch (admission.status) {
|
|
32895
|
+
case "busy":
|
|
32896
|
+
return new AccountStoreBusyError().message;
|
|
32844
32897
|
case "pending":
|
|
32845
32898
|
return admission.operation === "rollback" ? `An account-store rollback is pending; rerun \`${ROLLBACK_COMMAND}\`.` : `An account-store migration is pending; stop every Antigravity process and rerun \`${MIGRATE_COMMAND}\`.`;
|
|
32846
32899
|
case "inactive":
|