@cortexkit/opencode-antigravity-auth 3.0.25 → 3.0.27
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 +7 -7
- package/dist/index.js +731 -209
- package/dist/index.js.map +3 -3
- package/dist/index.meta.json +22 -22
- package/dist/server.js +952 -335
- package/dist/server.js.map +4 -4
- package/dist/server.meta.json +1 -1
- package/dist/src/ga/server/index.d.ts +3 -1
- package/dist/src/ga/server/index.d.ts.map +1 -1
- package/dist/src/ga/server/index.js +89 -6
- package/dist/src/ga/server/index.js.map +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/background-vault-quota-refresh.js +1 -1
- package/dist/src/plugin/background-vault-quota-refresh.js.map +1 -1
- package/dist/src/plugin/fetch-interceptor.d.ts.map +1 -1
- package/dist/src/plugin/fetch-interceptor.js +4 -2
- package/dist/src/plugin/fetch-interceptor.js.map +1 -1
- package/dist/src/plugin/ga-location-services.d.ts +1 -1
- package/dist/src/plugin/ga-location-services.d.ts.map +1 -1
- package/dist/src/plugin/ga-location-services.js +30 -21
- package/dist/src/plugin/ga-location-services.js.map +1 -1
- package/dist/src/plugin/index.js +2 -2
- package/dist/src/plugin/index.js.map +1 -1
- package/dist/src/plugin/request-helpers.d.ts +139 -0
- package/dist/src/plugin/request-helpers.d.ts.map +1 -1
- package/dist/src/plugin/request-helpers.js +512 -0
- package/dist/src/plugin/request-helpers.js.map +1 -1
- package/dist/src/plugin/request.d.ts.map +1 -1
- package/dist/src/plugin/request.js +219 -63
- package/dist/src/plugin/request.js.map +1 -1
- package/dist/src/plugin/shared/request-services.d.ts +1 -1
- package/dist/src/plugin/shared/request-services.d.ts.map +1 -1
- package/dist/src/plugin/shared/request-services.js +36 -127
- 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 +4 -2
- package/dist/src/plugin/shared/vault-menu.js.map +1 -1
- package/dist/src/plugin/shared/vault-request-credentials.d.ts +11 -4
- package/dist/src/plugin/shared/vault-request-credentials.d.ts.map +1 -1
- package/dist/src/plugin/shared/vault-request-credentials.js +67 -16
- package/dist/src/plugin/shared/vault-request-credentials.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/index.d.ts +3 -1
- package/dist/types/src/ga/server/index.d.ts.map +1 -1
- package/dist/types/src/ga/server/pool-login.d.ts.map +1 -1
- package/dist/types/src/plugin/fetch-interceptor.d.ts.map +1 -1
- package/dist/types/src/plugin/ga-location-services.d.ts +1 -1
- package/dist/types/src/plugin/ga-location-services.d.ts.map +1 -1
- package/dist/types/src/plugin/request-helpers.d.ts +139 -0
- package/dist/types/src/plugin/request-helpers.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 -1
- 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 +11 -4
- package/dist/types/src/plugin/shared/vault-request-credentials.d.ts.map +1 -1
- package/dist/types/src/plugin/storage.d.ts.map +1 -1
- package/package.json +2 -2
package/dist/cli.js
CHANGED
|
@@ -1799,6 +1799,8 @@ function openMigrationStore(modules, paths, now, onStep) {
|
|
|
1799
1799
|
}
|
|
1800
1800
|
async function rowsOf(store) {
|
|
1801
1801
|
const read = await store.read();
|
|
1802
|
+
if (read.status === "error" && read.kind === "snapshot-contended")
|
|
1803
|
+
throw new AccountStoreBusyError();
|
|
1802
1804
|
if (read.status !== "ready")
|
|
1803
1805
|
throw new AccountMigrationError("successor is not a ready public store");
|
|
1804
1806
|
return read.rows;
|
|
@@ -2007,8 +2009,46 @@ function receipt(journal) {
|
|
|
2007
2009
|
restartRequired: journal.sourceKind !== "absent" || journal.operation === "rollback"
|
|
2008
2010
|
};
|
|
2009
2011
|
}
|
|
2012
|
+
async function readAdmissionState(path2) {
|
|
2013
|
+
try {
|
|
2014
|
+
const bytes = await secureRead(path2);
|
|
2015
|
+
return { bytes, stamp: digest(bytes) };
|
|
2016
|
+
} catch (error) {
|
|
2017
|
+
if (errno(error) === "ENOENT")
|
|
2018
|
+
return { bytes: void 0, stamp: void 0 };
|
|
2019
|
+
throw error;
|
|
2020
|
+
}
|
|
2021
|
+
}
|
|
2010
2022
|
async function currentSuccessor(store, paths, journal) {
|
|
2011
|
-
|
|
2023
|
+
for (let attempt = 0; attempt < ADMISSION_SNAPSHOT_ATTEMPTS; attempt++) {
|
|
2024
|
+
const configBytes = await secureRead(paths.configPath);
|
|
2025
|
+
let state;
|
|
2026
|
+
let snapshot2;
|
|
2027
|
+
let failure;
|
|
2028
|
+
try {
|
|
2029
|
+
state = await readAdmissionState(paths.statePath);
|
|
2030
|
+
snapshot2 = {
|
|
2031
|
+
stateBytes: state.bytes,
|
|
2032
|
+
rows: await rowsOf(store),
|
|
2033
|
+
settings: await settingsOf(store)
|
|
2034
|
+
};
|
|
2035
|
+
} catch (error) {
|
|
2036
|
+
failure = { error };
|
|
2037
|
+
}
|
|
2038
|
+
const checkedConfigBytes = await secureRead(paths.configPath);
|
|
2039
|
+
const checkedState = await readAdmissionState(paths.statePath);
|
|
2040
|
+
if (digest(configBytes) !== digest(checkedConfigBytes) || state !== void 0 && state.stamp !== checkedState.stamp)
|
|
2041
|
+
continue;
|
|
2042
|
+
if (failure)
|
|
2043
|
+
throw failure.error;
|
|
2044
|
+
if (!snapshot2)
|
|
2045
|
+
throw new AccountMigrationError("active snapshot missing");
|
|
2046
|
+
return validateCurrentSuccessor(journal, configBytes, snapshot2.stateBytes, snapshot2.rows, snapshot2.settings);
|
|
2047
|
+
}
|
|
2048
|
+
throw new AccountStoreBusyError();
|
|
2049
|
+
}
|
|
2050
|
+
function validateCurrentSuccessor(journal, configBytes, stateBytes, rows, settings) {
|
|
2051
|
+
const config = object(jsonBytes(configBytes), "active config");
|
|
2012
2052
|
if (config.version !== 1 || !Array.isArray(config.accounts))
|
|
2013
2053
|
throw new AccountMigrationError("active config lacks its native roster");
|
|
2014
2054
|
const pool = object(config.commonAuthPool, "active native pool");
|
|
@@ -2025,15 +2065,14 @@ async function currentSuccessor(store, paths, journal) {
|
|
|
2025
2065
|
if (new Set(nativeIds).size !== nativeIds.length || Object.keys(entries).length !== nativeIds.length || Object.keys(entries).some((id) => !nativeIds.includes(id)))
|
|
2026
2066
|
throw new AccountMigrationError("active native entry/roster presence differs");
|
|
2027
2067
|
let stateAccounts = {};
|
|
2028
|
-
if (
|
|
2029
|
-
const state = object(jsonBytes(
|
|
2068
|
+
if (stateBytes !== void 0) {
|
|
2069
|
+
const state = object(jsonBytes(stateBytes), "active state");
|
|
2030
2070
|
if (state.version !== 1)
|
|
2031
2071
|
throw new AccountMigrationError("active native state schema differs");
|
|
2032
2072
|
stateAccounts = object(state.accounts, "active state accounts");
|
|
2033
2073
|
}
|
|
2034
2074
|
if (Object.keys(stateAccounts).length !== nativeIds.length || Object.keys(stateAccounts).some((id) => !nativeIds.includes(id)))
|
|
2035
2075
|
throw new AccountMigrationError("active state contains orphan or missing credentials");
|
|
2036
|
-
const rows = await rowsOf(store);
|
|
2037
2076
|
if (!isDeepStrictEqual(rows.map((row) => row.id), nativeIds))
|
|
2038
2077
|
throw new AccountMigrationError("public and native active roster order differs");
|
|
2039
2078
|
rows.forEach((row) => {
|
|
@@ -2042,10 +2081,10 @@ async function currentSuccessor(store, paths, journal) {
|
|
|
2042
2081
|
if (entry.credentialEpoch !== rowRef(row).credentialEpoch || Object.hasOwn(entry, "quota") !== (row.quota !== void 0) || row.quota !== void 0 && !isDeepStrictEqual(entry.quota, row.quota))
|
|
2043
2082
|
throw new AccountMigrationError("active native epoch or quota presence differs from public row");
|
|
2044
2083
|
});
|
|
2045
|
-
const settings = await settingsOf(store);
|
|
2046
2084
|
if (!isDeepStrictEqual(decodeAccountStoreGeneration(settings[ACCOUNT_STORE_GENERATION_SETTINGS_KEY]), generationJson(journal)))
|
|
2047
2085
|
throw new AccountMigrationError("active generation setting differs from journal");
|
|
2048
2086
|
decodeRoutingSettings(settings[ROUTING_SETTINGS_KEY]);
|
|
2087
|
+
return settings;
|
|
2049
2088
|
}
|
|
2050
2089
|
function openAdmissionStore(modules, paths, now) {
|
|
2051
2090
|
return modules.store.openPoolStore({
|
|
@@ -2173,11 +2212,13 @@ async function readAccountStoreAdmission(legacyPath, modules, now, expectedGener
|
|
|
2173
2212
|
if (!journal)
|
|
2174
2213
|
throw new AccountMigrationError("active serving journal missing");
|
|
2175
2214
|
const store = openAdmissionStore(modules, binding.paths, now);
|
|
2176
|
-
await currentSuccessor(store, binding.paths, journal);
|
|
2177
|
-
if (
|
|
2215
|
+
const settings = await currentSuccessor(store, binding.paths, journal);
|
|
2216
|
+
if (settings[MANAGEMENT_SETTINGS_KEY] !== void 0)
|
|
2178
2217
|
return { status: "pending" };
|
|
2179
2218
|
return { status: "active", receipt: binding.receipt, paths: binding.paths };
|
|
2180
2219
|
} catch (error) {
|
|
2220
|
+
if (error instanceof AccountStoreBusyError)
|
|
2221
|
+
return { status: "busy", retryable: true };
|
|
2181
2222
|
return {
|
|
2182
2223
|
status: "error",
|
|
2183
2224
|
reason: error instanceof AccountMigrationError ? error.reason : "current credential serving validation failed"
|
|
@@ -3728,6 +3769,8 @@ async function initializePrivateEmptyGeneration(modules, paths, parentLease, man
|
|
|
3728
3769
|
await expectedFreshArtifacts(paths, journal);
|
|
3729
3770
|
await currentSuccessor(store, paths, journal);
|
|
3730
3771
|
const admission = await readAccountStoreAdmission(paths.legacyPath, modules, options.now, journal.id);
|
|
3772
|
+
if (admission.status === "busy")
|
|
3773
|
+
throw new AccountStoreBusyError();
|
|
3731
3774
|
if (admission.status !== "active" || !isDeepStrictEqual(admission.receipt, receipt(journal)))
|
|
3732
3775
|
throw new AccountMigrationError("published empty generation is not admitted");
|
|
3733
3776
|
await boundary?.("pointer:after-sync-before-stage-cleanup");
|
|
@@ -3863,7 +3906,7 @@ async function cleanupPointerStage(legacyPath, pointer, lease) {
|
|
|
3863
3906
|
await unlink2(stage);
|
|
3864
3907
|
return true;
|
|
3865
3908
|
}
|
|
3866
|
-
var AccountMigrationError, QUOTA_FIELDS, ACCOUNT_MIGRATION_PHASES, ACCOUNT_MIGRATION_MANAGEMENT_STEPS, ACCOUNT_STORE_GENERATION_SETTINGS_KEY, UUID, SHA256;
|
|
3909
|
+
var AccountMigrationError, QUOTA_FIELDS, ACCOUNT_MIGRATION_PHASES, ACCOUNT_MIGRATION_MANAGEMENT_STEPS, ACCOUNT_STORE_GENERATION_SETTINGS_KEY, UUID, SHA256, ADMISSION_SNAPSHOT_ATTEMPTS, AccountStoreBusyError;
|
|
3867
3910
|
var init_account_migration = __esm({
|
|
3868
3911
|
"../core/dist/account-migration.js"() {
|
|
3869
3912
|
"use strict";
|
|
@@ -3895,6 +3938,14 @@ var init_account_migration = __esm({
|
|
|
3895
3938
|
ACCOUNT_STORE_GENERATION_SETTINGS_KEY = "antigravityGeneration";
|
|
3896
3939
|
UUID = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/;
|
|
3897
3940
|
SHA256 = /^[0-9a-f]{64}$/;
|
|
3941
|
+
ADMISSION_SNAPSHOT_ATTEMPTS = 3;
|
|
3942
|
+
AccountStoreBusyError = class extends Error {
|
|
3943
|
+
retryable = true;
|
|
3944
|
+
constructor() {
|
|
3945
|
+
super("The Antigravity account store is busy. Try again in a moment.");
|
|
3946
|
+
this.name = "AccountStoreBusyError";
|
|
3947
|
+
}
|
|
3948
|
+
};
|
|
3898
3949
|
}
|
|
3899
3950
|
});
|
|
3900
3951
|
|
|
@@ -25616,6 +25667,8 @@ async function assertLegacyPoolInUse(legacyPath) {
|
|
|
25616
25667
|
}
|
|
25617
25668
|
function refusalMessage2(admission) {
|
|
25618
25669
|
switch (admission.status) {
|
|
25670
|
+
case "busy":
|
|
25671
|
+
return new AccountStoreBusyError().message;
|
|
25619
25672
|
case "pending":
|
|
25620
25673
|
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}\`.`;
|
|
25621
25674
|
case "inactive":
|