@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/index.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",
|
|
@@ -6487,7 +6487,7 @@
|
|
|
6487
6487
|
"imports": [],
|
|
6488
6488
|
"exports": [],
|
|
6489
6489
|
"inputs": {},
|
|
6490
|
-
"bytes":
|
|
6490
|
+
"bytes": 4739474
|
|
6491
6491
|
},
|
|
6492
6492
|
"dist/index.js": {
|
|
6493
6493
|
"imports": [
|
|
@@ -7679,7 +7679,7 @@
|
|
|
7679
7679
|
"bytesInOutput": 10845
|
|
7680
7680
|
},
|
|
7681
7681
|
"../core/dist/account-migration.js": {
|
|
7682
|
-
"bytesInOutput":
|
|
7682
|
+
"bytesInOutput": 150336
|
|
7683
7683
|
},
|
|
7684
7684
|
"../core/dist/account-repository.js": {
|
|
7685
7685
|
"bytesInOutput": 78810
|
|
@@ -8075,7 +8075,7 @@
|
|
|
8075
8075
|
"bytesInOutput": 46529
|
|
8076
8076
|
},
|
|
8077
8077
|
"src/plugin/storage.ts": {
|
|
8078
|
-
"bytesInOutput":
|
|
8078
|
+
"bytesInOutput": 12217
|
|
8079
8079
|
},
|
|
8080
8080
|
"src/runtime-paths.ts": {
|
|
8081
8081
|
"bytesInOutput": 6383
|
|
@@ -8480,7 +8480,7 @@
|
|
|
8480
8480
|
"bytesInOutput": 0
|
|
8481
8481
|
}
|
|
8482
8482
|
},
|
|
8483
|
-
"bytes":
|
|
8483
|
+
"bytes": 2145629
|
|
8484
8484
|
}
|
|
8485
8485
|
}
|
|
8486
8486
|
}
|
package/dist/server.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
|
|
|
@@ -32745,6 +32796,8 @@ async function assertLegacyPoolInUse(legacyPath) {
|
|
|
32745
32796
|
}
|
|
32746
32797
|
function refusalMessage2(admission) {
|
|
32747
32798
|
switch (admission.status) {
|
|
32799
|
+
case "busy":
|
|
32800
|
+
return new AccountStoreBusyError().message;
|
|
32748
32801
|
case "pending":
|
|
32749
32802
|
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}\`.`;
|
|
32750
32803
|
case "inactive":
|
|
@@ -48331,6 +48384,7 @@ function tokenExchange(overrides) {
|
|
|
48331
48384
|
};
|
|
48332
48385
|
}
|
|
48333
48386
|
function storeRefusal(status) {
|
|
48387
|
+
if (status.status === "busy") return new AccountStoreBusyError();
|
|
48334
48388
|
return new Error(
|
|
48335
48389
|
status.status === "initialization-required" ? "The Antigravity account store is not initialized; initialize it with the antigravity-auth CLI." : status.status === "error" ? `The Antigravity account store cannot be opened: ${status.reason}` : `The Antigravity account store is ${status.status}; finish its migration or rollback with \`antigravity-auth migrate --offline\` or \`antigravity-auth rollback --offline\`.`
|
|
48336
48390
|
);
|
|
@@ -51028,20 +51082,32 @@ function createGaPoolLogin(input2) {
|
|
|
51028
51082
|
method,
|
|
51029
51083
|
connectExisting: () => track(
|
|
51030
51084
|
(async () => {
|
|
51085
|
+
let stage = "initial-admission";
|
|
51031
51086
|
try {
|
|
51032
51087
|
await admit2();
|
|
51033
51088
|
if (!input2.local?.assertExistingPool) throw new Error(LOGIN_FAILED);
|
|
51089
|
+
stage = "existing-pool-admission";
|
|
51034
51090
|
await abortable(
|
|
51035
51091
|
track(input2.local.assertExistingPool(admit2)),
|
|
51036
51092
|
shutdown.signal
|
|
51037
51093
|
);
|
|
51094
|
+
stage = "final-admission";
|
|
51038
51095
|
await admit2();
|
|
51096
|
+
stage = "placeholder";
|
|
51039
51097
|
return placeholderCredential({
|
|
51040
51098
|
integrationID: ANTIGRAVITY_PROVIDER_ID,
|
|
51041
51099
|
methodID: GA_POOL_RECONNECT_METHOD_ID,
|
|
51042
51100
|
now: Date.now()
|
|
51043
51101
|
});
|
|
51044
|
-
} catch {
|
|
51102
|
+
} catch (error) {
|
|
51103
|
+
const busy = error instanceof AccountStoreBusyError;
|
|
51104
|
+
try {
|
|
51105
|
+
console.warn(
|
|
51106
|
+
`[antigravity.pool-login] stage=${stage} reason=${busy ? "store-busy" : "store-refusal"}`
|
|
51107
|
+
);
|
|
51108
|
+
} catch {
|
|
51109
|
+
}
|
|
51110
|
+
if (busy) throw new AccountStoreBusyError();
|
|
51045
51111
|
throw new Error(LOGIN_FAILED);
|
|
51046
51112
|
}
|
|
51047
51113
|
})()
|
|
@@ -51052,7 +51118,9 @@ function createGaPoolLogin(input2) {
|
|
|
51052
51118
|
await admit2();
|
|
51053
51119
|
await input2.local.persist(result, admit2);
|
|
51054
51120
|
await admit2();
|
|
51055
|
-
} catch {
|
|
51121
|
+
} catch (error) {
|
|
51122
|
+
if (error instanceof AccountStoreBusyError)
|
|
51123
|
+
throw new AccountStoreBusyError();
|
|
51056
51124
|
throw new Error(LOGIN_FAILED);
|
|
51057
51125
|
}
|
|
51058
51126
|
})()
|