@cortexkit/opencode-antigravity-auth 3.1.11 → 3.1.12
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.map +2 -2
- package/dist/cli.meta.json +7 -2
- package/dist/index.js +129 -67
- package/dist/index.js.map +3 -3
- package/dist/index.meta.json +16 -6
- package/dist/server.js +138 -68
- package/dist/server.js.map +3 -3
- package/dist/server.meta.json +1 -1
- package/dist/src/plugin/ga-location-services.d.ts +1 -0
- package/dist/src/plugin/ga-location-services.d.ts.map +1 -1
- package/dist/src/plugin/ga-location-services.js +2 -0
- package/dist/src/plugin/ga-location-services.js.map +1 -1
- package/dist/src/plugin/ga-shared-vault-custody.d.ts.map +1 -1
- package/dist/src/plugin/ga-shared-vault-custody.js +7 -1
- package/dist/src/plugin/ga-shared-vault-custody.js.map +1 -1
- package/dist/src/plugin/index.d.ts.map +1 -1
- package/dist/src/plugin/index.js +6 -1
- package/dist/src/plugin/index.js.map +1 -1
- package/dist/src/plugin/shared/vault-request-credentials.d.ts +12 -8
- package/dist/src/plugin/shared/vault-request-credentials.d.ts.map +1 -1
- package/dist/src/plugin/shared/vault-request-credentials.js +117 -50
- package/dist/src/plugin/shared/vault-request-credentials.js.map +1 -1
- package/dist/types/src/plugin/ga-location-services.d.ts +1 -0
- package/dist/types/src/plugin/ga-location-services.d.ts.map +1 -1
- package/dist/types/src/plugin/ga-shared-vault-custody.d.ts.map +1 -1
- package/dist/types/src/plugin/index.d.ts.map +1 -1
- package/dist/types/src/plugin/shared/vault-request-credentials.d.ts +12 -8
- package/dist/types/src/plugin/shared/vault-request-credentials.d.ts.map +1 -1
- package/package.json +2 -2
package/dist/index.meta.json
CHANGED
|
@@ -3354,8 +3354,13 @@
|
|
|
3354
3354
|
"format": "esm"
|
|
3355
3355
|
},
|
|
3356
3356
|
"src/plugin/shared/vault-request-credentials.ts": {
|
|
3357
|
-
"bytes":
|
|
3357
|
+
"bytes": 44834,
|
|
3358
3358
|
"imports": [
|
|
3359
|
+
{
|
|
3360
|
+
"path": "node:fs/promises",
|
|
3361
|
+
"kind": "import-statement",
|
|
3362
|
+
"external": true
|
|
3363
|
+
},
|
|
3359
3364
|
{
|
|
3360
3365
|
"path": "../core/dist/index.js",
|
|
3361
3366
|
"kind": "import-statement",
|
|
@@ -7496,7 +7501,7 @@
|
|
|
7496
7501
|
"format": "esm"
|
|
7497
7502
|
},
|
|
7498
7503
|
"src/plugin/index.ts": {
|
|
7499
|
-
"bytes":
|
|
7504
|
+
"bytes": 44686,
|
|
7500
7505
|
"imports": [
|
|
7501
7506
|
{
|
|
7502
7507
|
"path": "node:crypto",
|
|
@@ -7778,7 +7783,7 @@
|
|
|
7778
7783
|
"imports": [],
|
|
7779
7784
|
"exports": [],
|
|
7780
7785
|
"inputs": {},
|
|
7781
|
-
"bytes":
|
|
7786
|
+
"bytes": 5429856
|
|
7782
7787
|
},
|
|
7783
7788
|
"dist/index.js": {
|
|
7784
7789
|
"imports": [
|
|
@@ -8362,6 +8367,11 @@
|
|
|
8362
8367
|
"kind": "import-statement",
|
|
8363
8368
|
"external": true
|
|
8364
8369
|
},
|
|
8370
|
+
{
|
|
8371
|
+
"path": "node:fs/promises",
|
|
8372
|
+
"kind": "import-statement",
|
|
8373
|
+
"external": true
|
|
8374
|
+
},
|
|
8365
8375
|
{
|
|
8366
8376
|
"path": "node:path",
|
|
8367
8377
|
"kind": "import-statement",
|
|
@@ -9597,7 +9607,7 @@
|
|
|
9597
9607
|
"bytesInOutput": 4134
|
|
9598
9608
|
},
|
|
9599
9609
|
"src/plugin/shared/vault-request-credentials.ts": {
|
|
9600
|
-
"bytesInOutput":
|
|
9610
|
+
"bytesInOutput": 26306
|
|
9601
9611
|
},
|
|
9602
9612
|
"src/plugin/vault-insula-quota.ts": {
|
|
9603
9613
|
"bytesInOutput": 2028
|
|
@@ -9612,7 +9622,7 @@
|
|
|
9612
9622
|
"bytesInOutput": 46703
|
|
9613
9623
|
},
|
|
9614
9624
|
"src/plugin/index.ts": {
|
|
9615
|
-
"bytesInOutput":
|
|
9625
|
+
"bytesInOutput": 30870
|
|
9616
9626
|
},
|
|
9617
9627
|
"src/cli.ts": {
|
|
9618
9628
|
"bytesInOutput": 24821
|
|
@@ -10119,7 +10129,7 @@
|
|
|
10119
10129
|
"bytesInOutput": 0
|
|
10120
10130
|
}
|
|
10121
10131
|
},
|
|
10122
|
-
"bytes":
|
|
10132
|
+
"bytes": 2465993
|
|
10123
10133
|
}
|
|
10124
10134
|
}
|
|
10125
10135
|
}
|
package/dist/server.js
CHANGED
|
@@ -1652,10 +1652,10 @@ async function privateDirectory(path5) {
|
|
|
1652
1652
|
if (errno(error) !== "EEXIST")
|
|
1653
1653
|
throw error;
|
|
1654
1654
|
}
|
|
1655
|
-
const
|
|
1656
|
-
if (!
|
|
1655
|
+
const stat22 = await lstat2(path5);
|
|
1656
|
+
if (!stat22.isDirectory() || stat22.isSymbolicLink())
|
|
1657
1657
|
throw new AccountMigrationError("successor directory is not a regular directory");
|
|
1658
|
-
privateMode(
|
|
1658
|
+
privateMode(stat22.mode, 448);
|
|
1659
1659
|
if (windowsPrivateFiles)
|
|
1660
1660
|
await verifySafeDirectory(path5);
|
|
1661
1661
|
if (!sameFilesystemPath(await realpath(path5), path5))
|
|
@@ -27452,13 +27452,13 @@ async function safeRead(path5, afterReadCheck) {
|
|
|
27452
27452
|
let file;
|
|
27453
27453
|
try {
|
|
27454
27454
|
file = await open7(path5, constants2.O_RDONLY | constants2.O_NOFOLLOW);
|
|
27455
|
-
const
|
|
27456
|
-
if (!
|
|
27455
|
+
const stat22 = await file.stat();
|
|
27456
|
+
if (!stat22.isFile()) {
|
|
27457
27457
|
throw new PiSlotError("unsafe-path");
|
|
27458
27458
|
}
|
|
27459
27459
|
await afterReadCheck?.(path5);
|
|
27460
27460
|
const current = await lstat5(path5);
|
|
27461
|
-
if (!current.isFile() || current.dev !==
|
|
27461
|
+
if (!current.isFile() || current.dev !== stat22.dev || current.ino !== stat22.ino) {
|
|
27462
27462
|
throw new PiSlotError("unsafe-path");
|
|
27463
27463
|
}
|
|
27464
27464
|
const bytes = await file.readFile();
|
|
@@ -31920,6 +31920,7 @@ var init_provider_key_policy = __esm({
|
|
|
31920
31920
|
});
|
|
31921
31921
|
|
|
31922
31922
|
// src/plugin/shared/vault-request-credentials.ts
|
|
31923
|
+
import { stat as stat11 } from "node:fs/promises";
|
|
31923
31924
|
function vaultAccountRows(routes) {
|
|
31924
31925
|
return routes.map((route, index) => ({
|
|
31925
31926
|
index,
|
|
@@ -32022,14 +32023,6 @@ function durableSelectionOf(row) {
|
|
|
32022
32023
|
...row.cooldownReason !== void 0 ? { cooldownReason: row.cooldownReason } : {},
|
|
32023
32024
|
...row.fingerprint !== void 0 ? { fingerprint: structuredClone(row.fingerprint) } : {},
|
|
32024
32025
|
...row.fingerprintHistory !== void 0 ? { fingerprintHistory: structuredClone(row.fingerprintHistory) } : {},
|
|
32025
|
-
...row.verificationRequired !== void 0 ? { verificationRequired: row.verificationRequired } : {},
|
|
32026
|
-
...row.verificationRequiredAt !== void 0 ? { verificationRequiredAt: row.verificationRequiredAt } : {},
|
|
32027
|
-
...row.verificationRequiredReason !== void 0 ? { verificationRequiredReason: row.verificationRequiredReason } : {},
|
|
32028
|
-
...row.verificationUrl !== void 0 ? { verificationUrl: row.verificationUrl } : {},
|
|
32029
|
-
...row.accountIneligible !== void 0 ? { accountIneligible: row.accountIneligible } : {},
|
|
32030
|
-
...row.accountIneligibleAt !== void 0 ? { accountIneligibleAt: row.accountIneligibleAt } : {},
|
|
32031
|
-
...row.accountIneligibleReason !== void 0 ? { accountIneligibleReason: row.accountIneligibleReason } : {},
|
|
32032
|
-
...row.eligibilityStateUpdatedAt !== void 0 ? { eligibilityStateUpdatedAt: row.eligibilityStateUpdatedAt } : {},
|
|
32033
32026
|
...row.dailyRequestCounts !== void 0 ? { dailyRequestCounts: { ...row.dailyRequestCounts } } : {}
|
|
32034
32027
|
};
|
|
32035
32028
|
}
|
|
@@ -32116,6 +32109,7 @@ function createVaultSelectionState(options) {
|
|
|
32116
32109
|
const attributions = /* @__PURE__ */ new WeakMap();
|
|
32117
32110
|
const changed = /* @__PURE__ */ new Set();
|
|
32118
32111
|
const clears = /* @__PURE__ */ new WeakMap();
|
|
32112
|
+
const accessVerdicts = /* @__PURE__ */ new WeakMap();
|
|
32119
32113
|
const legacyLoads = /* @__PURE__ */ new Map();
|
|
32120
32114
|
let writing = Promise.resolve();
|
|
32121
32115
|
const mark = (row) => {
|
|
@@ -32131,9 +32125,11 @@ function createVaultSelectionState(options) {
|
|
|
32131
32125
|
const attribution = attributions.get(row);
|
|
32132
32126
|
if (attribution === void 0) return;
|
|
32133
32127
|
changed.delete(row);
|
|
32134
|
-
const selection = durableSelectionOf(row);
|
|
32128
|
+
const { coolingDownUntil, cooldownReason, ...selection } = durableSelectionOf(row);
|
|
32135
32129
|
const cleared = clears.get(row);
|
|
32136
32130
|
clears.delete(row);
|
|
32131
|
+
const verdicts = accessVerdicts.get(row);
|
|
32132
|
+
accessVerdicts.delete(row);
|
|
32137
32133
|
try {
|
|
32138
32134
|
await options.source.commitState(attribution, (current) => {
|
|
32139
32135
|
let metadata = applyRateLimitObservation(
|
|
@@ -32155,6 +32151,20 @@ function createVaultSelectionState(options) {
|
|
|
32155
32151
|
selection.rateLimitResetTimes ?? {},
|
|
32156
32152
|
selection.rateLimitWrittenAt ?? {}
|
|
32157
32153
|
);
|
|
32154
|
+
if (coolingDownUntil != null && cooldownReason != null && (metadata.coolingDownUntil == null || coolingDownUntil > metadata.coolingDownUntil)) {
|
|
32155
|
+
metadata = applyCooldownObservation(metadata, {
|
|
32156
|
+
until: coolingDownUntil,
|
|
32157
|
+
reason: cooldownReason
|
|
32158
|
+
});
|
|
32159
|
+
}
|
|
32160
|
+
for (const verdict of verdicts ?? []) {
|
|
32161
|
+
const applied = applyAccessVerdict(metadata, verdict);
|
|
32162
|
+
if (applied) {
|
|
32163
|
+
metadata = applied.metadata;
|
|
32164
|
+
if (verdict.kind === "cleared")
|
|
32165
|
+
metadata.eligibilityStateUpdatedAt = verdict.observedAt;
|
|
32166
|
+
}
|
|
32167
|
+
}
|
|
32158
32168
|
if (cleared) {
|
|
32159
32169
|
const resets = { ...metadata.rateLimitResetTimes };
|
|
32160
32170
|
const written = { ...metadata.rateLimitWrittenAt };
|
|
@@ -32207,7 +32217,12 @@ function createVaultSelectionState(options) {
|
|
|
32207
32217
|
switched: mark,
|
|
32208
32218
|
lastUsed: mark,
|
|
32209
32219
|
usage: mark,
|
|
32210
|
-
accessVerdict
|
|
32220
|
+
accessVerdict(row, verdict) {
|
|
32221
|
+
const pending = accessVerdicts.get(row);
|
|
32222
|
+
if (pending) pending.push(verdict);
|
|
32223
|
+
else accessVerdicts.set(row, [verdict]);
|
|
32224
|
+
mark(row);
|
|
32225
|
+
},
|
|
32211
32226
|
fingerprint: mark,
|
|
32212
32227
|
requestSave: () => {
|
|
32213
32228
|
void flush2();
|
|
@@ -32216,16 +32231,20 @@ function createVaultSelectionState(options) {
|
|
|
32216
32231
|
admitted(row, attribution) {
|
|
32217
32232
|
attributions.set(row, attribution);
|
|
32218
32233
|
},
|
|
32219
|
-
async hydrate(rows) {
|
|
32234
|
+
async hydrate(rows, keptKeys) {
|
|
32220
32235
|
const file = await options.readState();
|
|
32221
32236
|
for (const row of rows) {
|
|
32222
32237
|
const identity4 = row.route.accountIdentity;
|
|
32223
32238
|
if (!Object.hasOwn(file.accounts, identity4)) continue;
|
|
32224
32239
|
const state2 = file.accounts[identity4];
|
|
32225
32240
|
if (state2 === void 0 || !stateBelongsTo(state2, row)) continue;
|
|
32226
|
-
|
|
32227
|
-
|
|
32228
|
-
|
|
32241
|
+
const kept = keptKeys?.has(vaultAccountRowKey(row));
|
|
32242
|
+
if (state2.metadata !== void 0) {
|
|
32243
|
+
if (kept)
|
|
32244
|
+
row.rateLimitClearedAt = state2.metadata.rateLimitClearedAt ?? void 0;
|
|
32245
|
+
else applyDurableSelection(row, state2.metadata);
|
|
32246
|
+
}
|
|
32247
|
+
const stamped = kept ? [] : stampRateLimitWrites(row, now2());
|
|
32229
32248
|
if (stamped.length) {
|
|
32230
32249
|
const legacyKey = legacyLimitKey({
|
|
32231
32250
|
...state2.observed,
|
|
@@ -32303,6 +32322,17 @@ function createVaultSelectionState(options) {
|
|
|
32303
32322
|
}
|
|
32304
32323
|
};
|
|
32305
32324
|
}
|
|
32325
|
+
async function providerStateSignature(path5) {
|
|
32326
|
+
if (path5 === void 0) return null;
|
|
32327
|
+
try {
|
|
32328
|
+
const info = await stat11(path5, { bigint: true });
|
|
32329
|
+
return info.isFile() ? `${info.dev}:${info.ino}:${info.size}:${info.mtimeNs}:${info.ctimeNs}` : null;
|
|
32330
|
+
} catch (error) {
|
|
32331
|
+
if (typeof error === "object" && error !== null && "code" in error && error.code === "ENOENT")
|
|
32332
|
+
return "missing";
|
|
32333
|
+
return null;
|
|
32334
|
+
}
|
|
32335
|
+
}
|
|
32306
32336
|
function createVaultAccountPool(options) {
|
|
32307
32337
|
const { source, durable } = options;
|
|
32308
32338
|
const state2 = durable ? createVaultSelectionState({
|
|
@@ -32325,23 +32355,54 @@ function createVaultAccountPool(options) {
|
|
|
32325
32355
|
const refusal3 = options.emptyRosterRefusal;
|
|
32326
32356
|
if (refusal3)
|
|
32327
32357
|
credentials.emptyRosterRefusal = () => refusal3(source.emptyRosterCause?.() ?? "unknown");
|
|
32358
|
+
const clock2 = options.now ?? Date.now;
|
|
32359
|
+
const refreshKeptRow = (prior, fresh) => {
|
|
32360
|
+
refreshVaultAccountRow(prior, fresh);
|
|
32361
|
+
const clearedAt = fresh.rateLimitClearedAt;
|
|
32362
|
+
if (clearedAt !== void 0 && clearedAt > (prior.rateLimitClearedAt ?? 0)) {
|
|
32363
|
+
prior.rateLimitClearedAt = clearedAt;
|
|
32364
|
+
reconcileManualLimitClear(prior);
|
|
32365
|
+
}
|
|
32366
|
+
const checkedAt = fresh.cachedQuotaUpdatedAt;
|
|
32367
|
+
if (fresh.cachedQuota !== void 0 && checkedAt !== void 0 && checkedAt > (prior.cachedQuotaUpdatedAt ?? 0) && checkedAt <= clock2()) {
|
|
32368
|
+
prior.cachedQuota = fresh.cachedQuota;
|
|
32369
|
+
prior.cachedQuotaUpdatedAt = checkedAt;
|
|
32370
|
+
selector.reconcileQuotaReading(prior, false);
|
|
32371
|
+
}
|
|
32372
|
+
};
|
|
32373
|
+
let hydratedSignature = null;
|
|
32328
32374
|
const rowsFromSource = async () => {
|
|
32329
32375
|
const rows = vaultAccountRows(source.routes());
|
|
32330
|
-
if (state2) {
|
|
32331
|
-
|
|
32332
|
-
|
|
32333
|
-
|
|
32376
|
+
if (!state2 || !durable || rows.length === 0) return { rows };
|
|
32377
|
+
const signature = await providerStateSignature(durable.stateFile);
|
|
32378
|
+
const kept = new Set(selector.rows.map(vaultAccountRowKey));
|
|
32379
|
+
const added = rows.some((row) => !kept.has(vaultAccountRowKey(row)));
|
|
32380
|
+
if (!added && signature !== null && signature === hydratedSignature)
|
|
32381
|
+
return { rows };
|
|
32382
|
+
try {
|
|
32383
|
+
await state2.hydrate(rows, kept);
|
|
32384
|
+
} catch (error) {
|
|
32385
|
+
if (added) throw error;
|
|
32386
|
+
try {
|
|
32387
|
+
durable.onReadFailure?.();
|
|
32388
|
+
} catch {
|
|
32389
|
+
}
|
|
32390
|
+
return { rows, signature: null };
|
|
32334
32391
|
}
|
|
32335
|
-
return rows;
|
|
32392
|
+
return { rows, signature };
|
|
32336
32393
|
};
|
|
32337
|
-
const
|
|
32338
|
-
|
|
32394
|
+
const install = ({
|
|
32395
|
+
rows,
|
|
32396
|
+
signature
|
|
32397
|
+
}) => {
|
|
32398
|
+
selector.replaceAccounts(rows, {
|
|
32339
32399
|
keyOf: vaultAccountRowKey,
|
|
32340
|
-
refresh:
|
|
32400
|
+
refresh: refreshKeptRow
|
|
32341
32401
|
});
|
|
32402
|
+
if (signature !== void 0) hydratedSignature = signature;
|
|
32342
32403
|
};
|
|
32404
|
+
const replace = async () => install(await rowsFromSource());
|
|
32343
32405
|
let firstRead = null;
|
|
32344
|
-
const clock2 = options.now ?? Date.now;
|
|
32345
32406
|
const schedule2 = options.schedule ?? ((callback, delayMs) => {
|
|
32346
32407
|
const timer = setTimeout(callback, delayMs);
|
|
32347
32408
|
timer.unref?.();
|
|
@@ -32360,12 +32421,8 @@ function createVaultAccountPool(options) {
|
|
|
32360
32421
|
firstReadStartedAt = clock2();
|
|
32361
32422
|
firstRead = (async () => {
|
|
32362
32423
|
await source.refresh();
|
|
32363
|
-
const
|
|
32364
|
-
if (current())
|
|
32365
|
-
selector.replaceAccounts(rows, {
|
|
32366
|
-
keyOf: vaultAccountRowKey,
|
|
32367
|
-
refresh: refreshVaultAccountRow
|
|
32368
|
-
});
|
|
32424
|
+
const loaded = await rowsFromSource();
|
|
32425
|
+
if (current()) install(loaded);
|
|
32369
32426
|
})().then(
|
|
32370
32427
|
() => {
|
|
32371
32428
|
if (current()) firstReadStartedAt = null;
|
|
@@ -32646,7 +32703,7 @@ var init_vault_insula_quota = __esm({
|
|
|
32646
32703
|
});
|
|
32647
32704
|
|
|
32648
32705
|
// src/plugin/vault-custody.ts
|
|
32649
|
-
import { chmod as chmod3, mkdir as mkdir13, readFile as readFile12, stat as
|
|
32706
|
+
import { chmod as chmod3, mkdir as mkdir13, readFile as readFile12, stat as stat12 } from "node:fs/promises";
|
|
32650
32707
|
import { join as join15 } from "node:path";
|
|
32651
32708
|
async function enrollmentFilesIdentity(paths) {
|
|
32652
32709
|
const takenAt = performance.now();
|
|
@@ -32654,7 +32711,7 @@ async function enrollmentFilesIdentity(paths) {
|
|
|
32654
32711
|
const parts = [];
|
|
32655
32712
|
for (const path5 of [paths.tokenPath, paths.statePath]) {
|
|
32656
32713
|
try {
|
|
32657
|
-
const info = await
|
|
32714
|
+
const info = await stat12(path5, { bigint: true });
|
|
32658
32715
|
if (info.ino === 0n) coarse = true;
|
|
32659
32716
|
parts.push(
|
|
32660
32717
|
`${info.dev}:${info.ino}:${info.size}:${info.mtimeNs}:${info.ctimeNs}`
|
|
@@ -33585,7 +33642,7 @@ var init_process_heartbeat = __esm({
|
|
|
33585
33642
|
});
|
|
33586
33643
|
|
|
33587
33644
|
// src/version-fence.ts
|
|
33588
|
-
import { readdir as readdir4, readFile as readFile14, stat as
|
|
33645
|
+
import { readdir as readdir4, readFile as readFile14, stat as stat13, unlink as unlink11 } from "node:fs/promises";
|
|
33589
33646
|
import { homedir as homedir3, uptime } from "node:os";
|
|
33590
33647
|
import { join as join17 } from "node:path";
|
|
33591
33648
|
function defaultStateHome() {
|
|
@@ -33705,7 +33762,7 @@ async function staleRecord(path5, record5, boot, heartbeat) {
|
|
|
33705
33762
|
let start = heartbeat ? record5.startedAt : void 0;
|
|
33706
33763
|
if (start === void 0) {
|
|
33707
33764
|
try {
|
|
33708
|
-
start = (await
|
|
33765
|
+
start = (await stat13(path5)).mtimeMs;
|
|
33709
33766
|
} catch {
|
|
33710
33767
|
return false;
|
|
33711
33768
|
}
|
|
@@ -33834,7 +33891,7 @@ import {
|
|
|
33834
33891
|
readFile as readFile15,
|
|
33835
33892
|
rename as rename11,
|
|
33836
33893
|
rmdir as rmdir2,
|
|
33837
|
-
stat as
|
|
33894
|
+
stat as stat14,
|
|
33838
33895
|
unlink as unlink12
|
|
33839
33896
|
} from "node:fs/promises";
|
|
33840
33897
|
import { basename as basename8, dirname as dirname21, join as join18, resolve as resolve20 } from "node:path";
|
|
@@ -34753,7 +34810,7 @@ async function physicalAliases(location, files) {
|
|
|
34753
34810
|
async function samePhysical(a, b) {
|
|
34754
34811
|
const id = async (path5) => {
|
|
34755
34812
|
try {
|
|
34756
|
-
const info = await
|
|
34813
|
+
const info = await stat14(path5, { bigint: true });
|
|
34757
34814
|
return info.ino === 0n ? void 0 : `${info.dev}:${info.ino}`;
|
|
34758
34815
|
} catch (error) {
|
|
34759
34816
|
const code2 = error.code;
|
|
@@ -35019,7 +35076,7 @@ function lockHolderText(name) {
|
|
|
35019
35076
|
}
|
|
35020
35077
|
async function exists3(path5) {
|
|
35021
35078
|
try {
|
|
35022
|
-
await
|
|
35079
|
+
await stat14(path5);
|
|
35023
35080
|
return true;
|
|
35024
35081
|
} catch (error) {
|
|
35025
35082
|
const code2 = error.code;
|
|
@@ -43381,6 +43438,7 @@ function acquireGaVaultCustody(options) {
|
|
|
43381
43438
|
const { custody } = held2;
|
|
43382
43439
|
let released;
|
|
43383
43440
|
return {
|
|
43441
|
+
paths: custody.paths,
|
|
43384
43442
|
readMode: () => custody.readMode(),
|
|
43385
43443
|
menuSection: () => custody.menuSection(),
|
|
43386
43444
|
readState: () => custody.readState(),
|
|
@@ -43429,7 +43487,12 @@ function sharedVaultQuota(custody, leases, options) {
|
|
|
43429
43487
|
source,
|
|
43430
43488
|
pool: createOpenCodeVaultAccountPool({
|
|
43431
43489
|
source,
|
|
43432
|
-
durable: {
|
|
43490
|
+
durable: {
|
|
43491
|
+
source,
|
|
43492
|
+
readState: () => custody.readState(),
|
|
43493
|
+
...custody.paths ? { stateFile: custody.paths.stateFile } : {},
|
|
43494
|
+
onReadFailure: () => logger3()?.debug("vault-state-read-skipped")
|
|
43495
|
+
}
|
|
43433
43496
|
})
|
|
43434
43497
|
};
|
|
43435
43498
|
return current;
|
|
@@ -53776,7 +53839,7 @@ import { join as join31 } from "node:path";
|
|
|
53776
53839
|
|
|
53777
53840
|
// src/settings/runtime.ts
|
|
53778
53841
|
init_dist();
|
|
53779
|
-
import { readFile as readFile19, stat as
|
|
53842
|
+
import { readFile as readFile19, stat as stat15 } from "node:fs/promises";
|
|
53780
53843
|
import { homedir as homedir10 } from "node:os";
|
|
53781
53844
|
import { basename as basename11, join as join30 } from "node:path";
|
|
53782
53845
|
init_process_heartbeat();
|
|
@@ -54024,7 +54087,7 @@ function applyHotValues(target, next) {
|
|
|
54024
54087
|
var DEFAULT_RETRY_DELAYS_MS = [5e3, 15e3, 6e4, 3e5];
|
|
54025
54088
|
async function exists4(path5) {
|
|
54026
54089
|
try {
|
|
54027
|
-
await
|
|
54090
|
+
await stat15(path5);
|
|
54028
54091
|
return true;
|
|
54029
54092
|
} catch {
|
|
54030
54093
|
return false;
|
|
@@ -56494,6 +56557,8 @@ async function createGaVaultLocationServices(input2) {
|
|
|
56494
56557
|
durable: {
|
|
56495
56558
|
source,
|
|
56496
56559
|
readState: () => custody.readState(),
|
|
56560
|
+
...custody.paths ? { stateFile: custody.paths.stateFile } : {},
|
|
56561
|
+
onReadFailure: () => vaultLogger.debug("vault-state-read-skipped"),
|
|
56497
56562
|
onError: (error) => vaultLogger.debug("vault-state-write-dropped", {
|
|
56498
56563
|
error: error instanceof Error ? error.name : "unknown"
|
|
56499
56564
|
})
|
|
@@ -60275,12 +60340,12 @@ async function select2(terminal, items, options) {
|
|
|
60275
60340
|
// src/common-auth-embedded/claustrum/enrollment.js
|
|
60276
60341
|
import { createHash as createHash19, randomBytes as randomBytes6, randomUUID as randomUUID23 } from "node:crypto";
|
|
60277
60342
|
import { constants as fsConstants2 } from "node:fs";
|
|
60278
|
-
import { chmod as chmod6, mkdir as mkdir18, open as open11, readFile as readFile21, realpath as realpath6, rename as rename13, stat as
|
|
60343
|
+
import { chmod as chmod6, mkdir as mkdir18, open as open11, readFile as readFile21, realpath as realpath6, rename as rename13, stat as stat18, unlink as unlink14 } from "node:fs/promises";
|
|
60279
60344
|
import { basename as basename13, dirname as dirname28, extname as extname2, isAbsolute as isAbsolute4, join as join33, resolve as resolve28 } from "node:path";
|
|
60280
60345
|
import { ClaustrumCredentialError as ClaustrumCredentialError9, ClaustrumClient as ClaustrumWireClient2, writeEnrollmentTokenFile as writeEnrollmentTokenFile2 } from "@cortexkit/claustrum-client";
|
|
60281
60346
|
|
|
60282
60347
|
// src/common-auth-embedded/fs/file-read-cache.js
|
|
60283
|
-
import { lstat as lstat8, stat as
|
|
60348
|
+
import { lstat as lstat8, stat as stat16 } from "node:fs/promises";
|
|
60284
60349
|
import { resolve as resolve26 } from "node:path";
|
|
60285
60350
|
async function identity3(path5, probe) {
|
|
60286
60351
|
try {
|
|
@@ -60299,7 +60364,7 @@ var FileReadCache2 = class {
|
|
|
60299
60364
|
#probe;
|
|
60300
60365
|
#entries = /* @__PURE__ */ new Map();
|
|
60301
60366
|
constructor(options = {}) {
|
|
60302
|
-
this.#probe = options.followSymlinks ? (path5) => (options.stat ??
|
|
60367
|
+
this.#probe = options.followSymlinks ? (path5) => (options.stat ?? stat16)(path5) : (path5) => (options.lstat ?? lstat8)(path5);
|
|
60303
60368
|
}
|
|
60304
60369
|
async read(paths, read, validateHit) {
|
|
60305
60370
|
const resolvedPaths = paths.map((path5) => resolve26(path5));
|
|
@@ -60353,7 +60418,7 @@ init_private_files2();
|
|
|
60353
60418
|
// src/common-auth-embedded/fs/refresh-file-lock.js
|
|
60354
60419
|
init_logger3();
|
|
60355
60420
|
import { randomUUID as randomUUID22 } from "node:crypto";
|
|
60356
|
-
import { link as link4, lstat as lstat9, mkdir as mkdir17, open as open10, readdir as readdir6, readFile as readFile20, rename as rename12, rm as rm7, stat as
|
|
60421
|
+
import { link as link4, lstat as lstat9, mkdir as mkdir17, open as open10, readdir as readdir6, readFile as readFile20, rename as rename12, rm as rm7, stat as stat17, unlink as unlink13 } from "node:fs/promises";
|
|
60357
60422
|
import { basename as basename12, dirname as dirname27, join as join32 } from "node:path";
|
|
60358
60423
|
|
|
60359
60424
|
// src/common-auth-embedded/fs/lock-record.js
|
|
@@ -60763,7 +60828,7 @@ async function acquireRefreshFileLockWithClock2(options) {
|
|
|
60763
60828
|
};
|
|
60764
60829
|
}
|
|
60765
60830
|
try {
|
|
60766
|
-
const current = await
|
|
60831
|
+
const current = await stat17(lockPath);
|
|
60767
60832
|
const legacyExpiry = Number.isFinite(expiresAt) ? expiresAt : current.mtimeMs + options.ttlMs;
|
|
60768
60833
|
if (legacyExpiry > now2())
|
|
60769
60834
|
return { status: "live" };
|
|
@@ -60857,7 +60922,7 @@ async function acquireRefreshFileLockWithClock2(options) {
|
|
|
60857
60922
|
if (!ownedDirectory)
|
|
60858
60923
|
return false;
|
|
60859
60924
|
try {
|
|
60860
|
-
await
|
|
60925
|
+
await stat17(evictOwnerPath);
|
|
60861
60926
|
return false;
|
|
60862
60927
|
} catch (error) {
|
|
60863
60928
|
if (error.code !== "ENOENT")
|
|
@@ -60878,7 +60943,7 @@ async function acquireRefreshFileLockWithClock2(options) {
|
|
|
60878
60943
|
return false;
|
|
60879
60944
|
stillOurs = true;
|
|
60880
60945
|
try {
|
|
60881
|
-
await
|
|
60946
|
+
await stat17(evictOwnerPath);
|
|
60882
60947
|
return false;
|
|
60883
60948
|
} catch (error) {
|
|
60884
60949
|
return error.code === "ENOENT";
|
|
@@ -60928,7 +60993,7 @@ async function acquireRefreshFileLockWithClock2(options) {
|
|
|
60928
60993
|
async function recoverStaleEvictionMarker(deadline) {
|
|
60929
60994
|
let evictStat;
|
|
60930
60995
|
try {
|
|
60931
|
-
evictStat = await
|
|
60996
|
+
evictStat = await stat17(evictPath);
|
|
60932
60997
|
} catch (error) {
|
|
60933
60998
|
if (error.code === "ENOENT")
|
|
60934
60999
|
return "missing";
|
|
@@ -60946,7 +61011,7 @@ async function acquireRefreshFileLockWithClock2(options) {
|
|
|
60946
61011
|
if (evictStat.mtimeMs + EVICT_TTL > now2()) {
|
|
60947
61012
|
let hasOwner = true;
|
|
60948
61013
|
try {
|
|
60949
|
-
await
|
|
61014
|
+
await stat17(evictOwnerPath);
|
|
60950
61015
|
} catch (error) {
|
|
60951
61016
|
if (error.code === "ENOENT")
|
|
60952
61017
|
hasOwner = false;
|
|
@@ -61618,7 +61683,7 @@ async function refuseWritableAncestor2(parent, options = {}) {
|
|
|
61618
61683
|
}
|
|
61619
61684
|
let privateGroup;
|
|
61620
61685
|
for (; ; ) {
|
|
61621
|
-
const metadata = await
|
|
61686
|
+
const metadata = await stat18(component).catch(() => void 0);
|
|
61622
61687
|
if (metadata && (metadata.mode & 18) !== 0 && (metadata.mode & 512) === 0) {
|
|
61623
61688
|
if (privateGroup === void 0) {
|
|
61624
61689
|
privateGroup = gid !== void 0 && await isPrivateGroup2(uid, gid, options);
|
|
@@ -61647,7 +61712,7 @@ async function ensureClaustrumPrivateDirectory2(directory, options = {}, what =
|
|
|
61647
61712
|
return;
|
|
61648
61713
|
}
|
|
61649
61714
|
await mkdir18(directory, { recursive: true, mode: 448 });
|
|
61650
|
-
const metadata = await
|
|
61715
|
+
const metadata = await stat18(directory);
|
|
61651
61716
|
const uid = process.geteuid?.();
|
|
61652
61717
|
if (uid !== void 0 && metadata.uid !== uid) {
|
|
61653
61718
|
throw new ClaustrumConsumerError2("unsafe-file", `Claustrum ${what} must be owned by the current user`);
|
|
@@ -62365,7 +62430,7 @@ function setupPaths(io = {}) {
|
|
|
62365
62430
|
}
|
|
62366
62431
|
|
|
62367
62432
|
// src/common-auth-embedded/setup/detect.js
|
|
62368
|
-
function
|
|
62433
|
+
function stat19(path5, kind) {
|
|
62369
62434
|
try {
|
|
62370
62435
|
return statSync7(path5)[kind]();
|
|
62371
62436
|
} catch {
|
|
@@ -62374,12 +62439,12 @@ function stat18(path5, kind) {
|
|
|
62374
62439
|
}
|
|
62375
62440
|
var defaultSetupFileSystem = {
|
|
62376
62441
|
exists: existsSync12,
|
|
62377
|
-
isFile: (path5) =>
|
|
62378
|
-
isDirectory: (path5) =>
|
|
62442
|
+
isFile: (path5) => stat19(path5, "isFile"),
|
|
62443
|
+
isDirectory: (path5) => stat19(path5, "isDirectory"),
|
|
62379
62444
|
isExecutable(path5) {
|
|
62380
62445
|
try {
|
|
62381
62446
|
accessSync(path5, constants3.X_OK);
|
|
62382
|
-
return
|
|
62447
|
+
return stat19(path5, "isFile");
|
|
62383
62448
|
} catch {
|
|
62384
62449
|
return false;
|
|
62385
62450
|
}
|
|
@@ -63180,7 +63245,7 @@ import { applyEdits as applyEdits2, createScanner as createScanner2, findNodeAtL
|
|
|
63180
63245
|
|
|
63181
63246
|
// src/common-auth-embedded/setup/config-write.js
|
|
63182
63247
|
import { randomUUID as randomUUID24 } from "node:crypto";
|
|
63183
|
-
import { mkdir as mkdir19, open as open12, rename as rename14, stat as
|
|
63248
|
+
import { mkdir as mkdir19, open as open12, rename as rename14, stat as stat20, unlink as unlink15 } from "node:fs/promises";
|
|
63184
63249
|
import { basename as basename14, dirname as dirname29, join as join35 } from "node:path";
|
|
63185
63250
|
import { setTimeout as delay3 } from "node:timers/promises";
|
|
63186
63251
|
async function writeHostConfigAtomic(file, content, options = {}) {
|
|
@@ -63190,7 +63255,7 @@ async function writeHostConfigAtomic(file, content, options = {}) {
|
|
|
63190
63255
|
let mode;
|
|
63191
63256
|
if (!windows2) {
|
|
63192
63257
|
try {
|
|
63193
|
-
mode = (await
|
|
63258
|
+
mode = (await stat20(file)).mode & 4095;
|
|
63194
63259
|
} catch (error) {
|
|
63195
63260
|
if (error.code !== "ENOENT")
|
|
63196
63261
|
throw error;
|
|
@@ -64964,8 +65029,8 @@ function getLocalDevPath(directory) {
|
|
|
64964
65029
|
}
|
|
64965
65030
|
function findPackageJsonUp(startPath) {
|
|
64966
65031
|
try {
|
|
64967
|
-
const
|
|
64968
|
-
let dir =
|
|
65032
|
+
const stat22 = fs6.statSync(startPath);
|
|
65033
|
+
let dir = stat22.isDirectory() ? startPath : path4.dirname(startPath);
|
|
64969
65034
|
for (let i = 0; i < 10; i++) {
|
|
64970
65035
|
const pkgPath = path4.join(dir, "package.json");
|
|
64971
65036
|
if (fs6.existsSync(pkgPath)) {
|
|
@@ -65295,7 +65360,7 @@ function isSessionId(value) {
|
|
|
65295
65360
|
// src/common-auth-embedded/rpc/port-file.js
|
|
65296
65361
|
init_private_files2();
|
|
65297
65362
|
import { createHash as createHash21, randomUUID as randomUUID25 } from "node:crypto";
|
|
65298
|
-
import { chmod as chmod7, mkdir as mkdir20, open as open13, readdir as readdir7, rename as rename16, rmdir as rmdir3, stat as
|
|
65363
|
+
import { chmod as chmod7, mkdir as mkdir20, open as open13, readdir as readdir7, rename as rename16, rmdir as rmdir3, stat as stat21, unlink as unlink16 } from "node:fs/promises";
|
|
65299
65364
|
import { uptime as uptime2 } from "node:os";
|
|
65300
65365
|
import { join as join42, resolve as resolve32 } from "node:path";
|
|
65301
65366
|
function staleBefore(clock2) {
|
|
@@ -65311,7 +65376,7 @@ async function removeStalePortFile(path5, raw, info, beforeRemove2) {
|
|
|
65311
65376
|
await beforeRemove2?.(path5);
|
|
65312
65377
|
try {
|
|
65313
65378
|
const current = await readPrivateText2(path5);
|
|
65314
|
-
const identity4 = await
|
|
65379
|
+
const identity4 = await stat21(path5);
|
|
65315
65380
|
if (current === raw && identity4.dev === info.dev && identity4.ino === info.ino && identity4.mtimeMs === info.mtimeMs && identity4.size === info.size)
|
|
65316
65381
|
await unlink16(path5).catch(() => {
|
|
65317
65382
|
});
|
|
@@ -65434,7 +65499,7 @@ async function sweepRpcDirectory(dir, log19, options = {}, cutoff = staleBefore(
|
|
|
65434
65499
|
if (!name.startsWith("port-") || !name.endsWith(".json"))
|
|
65435
65500
|
continue;
|
|
65436
65501
|
const portFile = join42(dir, name);
|
|
65437
|
-
const info = await
|
|
65502
|
+
const info = await stat21(portFile).catch(() => void 0);
|
|
65438
65503
|
let raw;
|
|
65439
65504
|
try {
|
|
65440
65505
|
raw = await readPrivateText2(portFile);
|
|
@@ -70446,7 +70511,12 @@ var createAntigravityPluginRuntime = (providerId, options = {}) => async (input2
|
|
|
70446
70511
|
source,
|
|
70447
70512
|
pool: createOpenCodeVaultAccountPool({
|
|
70448
70513
|
source,
|
|
70449
|
-
durable: {
|
|
70514
|
+
durable: {
|
|
70515
|
+
source,
|
|
70516
|
+
readState: () => vaultCustody.readState(),
|
|
70517
|
+
stateFile: vaultCustody.paths.stateFile,
|
|
70518
|
+
onReadFailure: () => logger2.debug("vault-state-read-skipped")
|
|
70519
|
+
}
|
|
70450
70520
|
})
|
|
70451
70521
|
};
|
|
70452
70522
|
return vaultPool;
|