@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.
Files changed (29) hide show
  1. package/dist/cli.js.map +2 -2
  2. package/dist/cli.meta.json +7 -2
  3. package/dist/index.js +129 -67
  4. package/dist/index.js.map +3 -3
  5. package/dist/index.meta.json +16 -6
  6. package/dist/server.js +138 -68
  7. package/dist/server.js.map +3 -3
  8. package/dist/server.meta.json +1 -1
  9. package/dist/src/plugin/ga-location-services.d.ts +1 -0
  10. package/dist/src/plugin/ga-location-services.d.ts.map +1 -1
  11. package/dist/src/plugin/ga-location-services.js +2 -0
  12. package/dist/src/plugin/ga-location-services.js.map +1 -1
  13. package/dist/src/plugin/ga-shared-vault-custody.d.ts.map +1 -1
  14. package/dist/src/plugin/ga-shared-vault-custody.js +7 -1
  15. package/dist/src/plugin/ga-shared-vault-custody.js.map +1 -1
  16. package/dist/src/plugin/index.d.ts.map +1 -1
  17. package/dist/src/plugin/index.js +6 -1
  18. package/dist/src/plugin/index.js.map +1 -1
  19. package/dist/src/plugin/shared/vault-request-credentials.d.ts +12 -8
  20. package/dist/src/plugin/shared/vault-request-credentials.d.ts.map +1 -1
  21. package/dist/src/plugin/shared/vault-request-credentials.js +117 -50
  22. package/dist/src/plugin/shared/vault-request-credentials.js.map +1 -1
  23. package/dist/types/src/plugin/ga-location-services.d.ts +1 -0
  24. package/dist/types/src/plugin/ga-location-services.d.ts.map +1 -1
  25. package/dist/types/src/plugin/ga-shared-vault-custody.d.ts.map +1 -1
  26. package/dist/types/src/plugin/index.d.ts.map +1 -1
  27. package/dist/types/src/plugin/shared/vault-request-credentials.d.ts +12 -8
  28. package/dist/types/src/plugin/shared/vault-request-credentials.d.ts.map +1 -1
  29. package/package.json +2 -2
@@ -3143,8 +3143,13 @@
3143
3143
  "format": "esm"
3144
3144
  },
3145
3145
  "src/plugin/shared/vault-request-credentials.ts": {
3146
- "bytes": 42104,
3146
+ "bytes": 44834,
3147
3147
  "imports": [
3148
+ {
3149
+ "path": "node:fs/promises",
3150
+ "kind": "import-statement",
3151
+ "external": true
3152
+ },
3148
3153
  {
3149
3154
  "path": "../core/dist/index.js",
3150
3155
  "kind": "import-statement",
@@ -4731,7 +4736,7 @@
4731
4736
  "imports": [],
4732
4737
  "exports": [],
4733
4738
  "inputs": {},
4734
- "bytes": 3440592
4739
+ "bytes": 3443399
4735
4740
  },
4736
4741
  "dist/cli.js": {
4737
4742
  "imports": [
package/dist/index.js CHANGED
@@ -1652,10 +1652,10 @@ async function privateDirectory(path5) {
1652
1652
  if (errno(error) !== "EEXIST")
1653
1653
  throw error;
1654
1654
  }
1655
- const stat21 = await lstat2(path5);
1656
- if (!stat21.isDirectory() || stat21.isSymbolicLink())
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(stat21.mode, 448);
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 stat21 = await file.stat();
27456
- if (!stat21.isFile()) {
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 !== stat21.dev || current.ino !== stat21.ino) {
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();
@@ -33717,6 +33717,7 @@ var init_logger4 = __esm({
33717
33717
  });
33718
33718
 
33719
33719
  // src/plugin/shared/vault-request-credentials.ts
33720
+ import { stat as stat10 } from "node:fs/promises";
33720
33721
  function vaultAccountRows(routes) {
33721
33722
  return routes.map((route, index) => ({
33722
33723
  index,
@@ -33819,14 +33820,6 @@ function durableSelectionOf(row) {
33819
33820
  ...row.cooldownReason !== void 0 ? { cooldownReason: row.cooldownReason } : {},
33820
33821
  ...row.fingerprint !== void 0 ? { fingerprint: structuredClone(row.fingerprint) } : {},
33821
33822
  ...row.fingerprintHistory !== void 0 ? { fingerprintHistory: structuredClone(row.fingerprintHistory) } : {},
33822
- ...row.verificationRequired !== void 0 ? { verificationRequired: row.verificationRequired } : {},
33823
- ...row.verificationRequiredAt !== void 0 ? { verificationRequiredAt: row.verificationRequiredAt } : {},
33824
- ...row.verificationRequiredReason !== void 0 ? { verificationRequiredReason: row.verificationRequiredReason } : {},
33825
- ...row.verificationUrl !== void 0 ? { verificationUrl: row.verificationUrl } : {},
33826
- ...row.accountIneligible !== void 0 ? { accountIneligible: row.accountIneligible } : {},
33827
- ...row.accountIneligibleAt !== void 0 ? { accountIneligibleAt: row.accountIneligibleAt } : {},
33828
- ...row.accountIneligibleReason !== void 0 ? { accountIneligibleReason: row.accountIneligibleReason } : {},
33829
- ...row.eligibilityStateUpdatedAt !== void 0 ? { eligibilityStateUpdatedAt: row.eligibilityStateUpdatedAt } : {},
33830
33823
  ...row.dailyRequestCounts !== void 0 ? { dailyRequestCounts: { ...row.dailyRequestCounts } } : {}
33831
33824
  };
33832
33825
  }
@@ -33913,6 +33906,7 @@ function createVaultSelectionState(options) {
33913
33906
  const attributions = /* @__PURE__ */ new WeakMap();
33914
33907
  const changed = /* @__PURE__ */ new Set();
33915
33908
  const clears = /* @__PURE__ */ new WeakMap();
33909
+ const accessVerdicts = /* @__PURE__ */ new WeakMap();
33916
33910
  const legacyLoads = /* @__PURE__ */ new Map();
33917
33911
  let writing = Promise.resolve();
33918
33912
  const mark = (row) => {
@@ -33928,9 +33922,11 @@ function createVaultSelectionState(options) {
33928
33922
  const attribution = attributions.get(row);
33929
33923
  if (attribution === void 0) return;
33930
33924
  changed.delete(row);
33931
- const selection = durableSelectionOf(row);
33925
+ const { coolingDownUntil, cooldownReason, ...selection } = durableSelectionOf(row);
33932
33926
  const cleared = clears.get(row);
33933
33927
  clears.delete(row);
33928
+ const verdicts = accessVerdicts.get(row);
33929
+ accessVerdicts.delete(row);
33934
33930
  try {
33935
33931
  await options.source.commitState(attribution, (current) => {
33936
33932
  let metadata = applyRateLimitObservation(
@@ -33952,6 +33948,20 @@ function createVaultSelectionState(options) {
33952
33948
  selection.rateLimitResetTimes ?? {},
33953
33949
  selection.rateLimitWrittenAt ?? {}
33954
33950
  );
33951
+ if (coolingDownUntil != null && cooldownReason != null && (metadata.coolingDownUntil == null || coolingDownUntil > metadata.coolingDownUntil)) {
33952
+ metadata = applyCooldownObservation(metadata, {
33953
+ until: coolingDownUntil,
33954
+ reason: cooldownReason
33955
+ });
33956
+ }
33957
+ for (const verdict of verdicts ?? []) {
33958
+ const applied = applyAccessVerdict(metadata, verdict);
33959
+ if (applied) {
33960
+ metadata = applied.metadata;
33961
+ if (verdict.kind === "cleared")
33962
+ metadata.eligibilityStateUpdatedAt = verdict.observedAt;
33963
+ }
33964
+ }
33955
33965
  if (cleared) {
33956
33966
  const resets = { ...metadata.rateLimitResetTimes };
33957
33967
  const written = { ...metadata.rateLimitWrittenAt };
@@ -34004,7 +34014,12 @@ function createVaultSelectionState(options) {
34004
34014
  switched: mark,
34005
34015
  lastUsed: mark,
34006
34016
  usage: mark,
34007
- accessVerdict: mark,
34017
+ accessVerdict(row, verdict) {
34018
+ const pending = accessVerdicts.get(row);
34019
+ if (pending) pending.push(verdict);
34020
+ else accessVerdicts.set(row, [verdict]);
34021
+ mark(row);
34022
+ },
34008
34023
  fingerprint: mark,
34009
34024
  requestSave: () => {
34010
34025
  void flush2();
@@ -34013,16 +34028,20 @@ function createVaultSelectionState(options) {
34013
34028
  admitted(row, attribution) {
34014
34029
  attributions.set(row, attribution);
34015
34030
  },
34016
- async hydrate(rows) {
34031
+ async hydrate(rows, keptKeys) {
34017
34032
  const file = await options.readState();
34018
34033
  for (const row of rows) {
34019
34034
  const identity4 = row.route.accountIdentity;
34020
34035
  if (!Object.hasOwn(file.accounts, identity4)) continue;
34021
34036
  const state2 = file.accounts[identity4];
34022
34037
  if (state2 === void 0 || !stateBelongsTo(state2, row)) continue;
34023
- if (state2.metadata !== void 0)
34024
- applyDurableSelection(row, state2.metadata);
34025
- const stamped = stampRateLimitWrites(row, now2());
34038
+ const kept = keptKeys?.has(vaultAccountRowKey(row));
34039
+ if (state2.metadata !== void 0) {
34040
+ if (kept)
34041
+ row.rateLimitClearedAt = state2.metadata.rateLimitClearedAt ?? void 0;
34042
+ else applyDurableSelection(row, state2.metadata);
34043
+ }
34044
+ const stamped = kept ? [] : stampRateLimitWrites(row, now2());
34026
34045
  if (stamped.length) {
34027
34046
  const legacyKey = legacyLimitKey({
34028
34047
  ...state2.observed,
@@ -34100,6 +34119,17 @@ function createVaultSelectionState(options) {
34100
34119
  }
34101
34120
  };
34102
34121
  }
34122
+ async function providerStateSignature(path5) {
34123
+ if (path5 === void 0) return null;
34124
+ try {
34125
+ const info = await stat10(path5, { bigint: true });
34126
+ return info.isFile() ? `${info.dev}:${info.ino}:${info.size}:${info.mtimeNs}:${info.ctimeNs}` : null;
34127
+ } catch (error) {
34128
+ if (typeof error === "object" && error !== null && "code" in error && error.code === "ENOENT")
34129
+ return "missing";
34130
+ return null;
34131
+ }
34132
+ }
34103
34133
  function createVaultAccountPool(options) {
34104
34134
  const { source, durable } = options;
34105
34135
  const state2 = durable ? createVaultSelectionState({
@@ -34122,23 +34152,54 @@ function createVaultAccountPool(options) {
34122
34152
  const refusal3 = options.emptyRosterRefusal;
34123
34153
  if (refusal3)
34124
34154
  credentials.emptyRosterRefusal = () => refusal3(source.emptyRosterCause?.() ?? "unknown");
34155
+ const clock2 = options.now ?? Date.now;
34156
+ const refreshKeptRow = (prior, fresh) => {
34157
+ refreshVaultAccountRow(prior, fresh);
34158
+ const clearedAt = fresh.rateLimitClearedAt;
34159
+ if (clearedAt !== void 0 && clearedAt > (prior.rateLimitClearedAt ?? 0)) {
34160
+ prior.rateLimitClearedAt = clearedAt;
34161
+ reconcileManualLimitClear(prior);
34162
+ }
34163
+ const checkedAt = fresh.cachedQuotaUpdatedAt;
34164
+ if (fresh.cachedQuota !== void 0 && checkedAt !== void 0 && checkedAt > (prior.cachedQuotaUpdatedAt ?? 0) && checkedAt <= clock2()) {
34165
+ prior.cachedQuota = fresh.cachedQuota;
34166
+ prior.cachedQuotaUpdatedAt = checkedAt;
34167
+ selector.reconcileQuotaReading(prior, false);
34168
+ }
34169
+ };
34170
+ let hydratedSignature = null;
34125
34171
  const rowsFromSource = async () => {
34126
34172
  const rows = vaultAccountRows(source.routes());
34127
- if (state2) {
34128
- const kept = new Set(selector.rows.map(vaultAccountRowKey));
34129
- const added = rows.filter((row) => !kept.has(vaultAccountRowKey(row)));
34130
- if (added.length > 0) await state2.hydrate(added);
34173
+ if (!state2 || !durable || rows.length === 0) return { rows };
34174
+ const signature = await providerStateSignature(durable.stateFile);
34175
+ const kept = new Set(selector.rows.map(vaultAccountRowKey));
34176
+ const added = rows.some((row) => !kept.has(vaultAccountRowKey(row)));
34177
+ if (!added && signature !== null && signature === hydratedSignature)
34178
+ return { rows };
34179
+ try {
34180
+ await state2.hydrate(rows, kept);
34181
+ } catch (error) {
34182
+ if (added) throw error;
34183
+ try {
34184
+ durable.onReadFailure?.();
34185
+ } catch {
34186
+ }
34187
+ return { rows, signature: null };
34131
34188
  }
34132
- return rows;
34189
+ return { rows, signature };
34133
34190
  };
34134
- const replace = async () => {
34135
- selector.replaceAccounts(await rowsFromSource(), {
34191
+ const install = ({
34192
+ rows,
34193
+ signature
34194
+ }) => {
34195
+ selector.replaceAccounts(rows, {
34136
34196
  keyOf: vaultAccountRowKey,
34137
- refresh: refreshVaultAccountRow
34197
+ refresh: refreshKeptRow
34138
34198
  });
34199
+ if (signature !== void 0) hydratedSignature = signature;
34139
34200
  };
34201
+ const replace = async () => install(await rowsFromSource());
34140
34202
  let firstRead = null;
34141
- const clock2 = options.now ?? Date.now;
34142
34203
  const schedule2 = options.schedule ?? ((callback, delayMs) => {
34143
34204
  const timer = setTimeout(callback, delayMs);
34144
34205
  timer.unref?.();
@@ -34157,12 +34218,8 @@ function createVaultAccountPool(options) {
34157
34218
  firstReadStartedAt = clock2();
34158
34219
  firstRead = (async () => {
34159
34220
  await source.refresh();
34160
- const rows = await rowsFromSource();
34161
- if (current())
34162
- selector.replaceAccounts(rows, {
34163
- keyOf: vaultAccountRowKey,
34164
- refresh: refreshVaultAccountRow
34165
- });
34221
+ const loaded = await rowsFromSource();
34222
+ if (current()) install(loaded);
34166
34223
  })().then(
34167
34224
  () => {
34168
34225
  if (current()) firstReadStartedAt = null;
@@ -34443,7 +34500,7 @@ var init_vault_insula_quota = __esm({
34443
34500
  });
34444
34501
 
34445
34502
  // src/plugin/vault-custody.ts
34446
- import { chmod as chmod4, mkdir as mkdir12, readFile as readFile11, stat as stat10 } from "node:fs/promises";
34503
+ import { chmod as chmod4, mkdir as mkdir12, readFile as readFile11, stat as stat11 } from "node:fs/promises";
34447
34504
  import { join as join17 } from "node:path";
34448
34505
  async function enrollmentFilesIdentity(paths) {
34449
34506
  const takenAt = performance.now();
@@ -34451,7 +34508,7 @@ async function enrollmentFilesIdentity(paths) {
34451
34508
  const parts = [];
34452
34509
  for (const path5 of [paths.tokenPath, paths.statePath]) {
34453
34510
  try {
34454
- const info = await stat10(path5, { bigint: true });
34511
+ const info = await stat11(path5, { bigint: true });
34455
34512
  if (info.ino === 0n) coarse = true;
34456
34513
  parts.push(
34457
34514
  `${info.dev}:${info.ino}:${info.size}:${info.mtimeNs}:${info.ctimeNs}`
@@ -35236,7 +35293,7 @@ import {
35236
35293
  readFile as readFile12,
35237
35294
  rename as rename10,
35238
35295
  rmdir as rmdir2,
35239
- stat as stat11,
35296
+ stat as stat12,
35240
35297
  unlink as unlink11
35241
35298
  } from "node:fs/promises";
35242
35299
  import { basename as basename6, dirname as dirname18, join as join18, resolve as resolve19 } from "node:path";
@@ -36155,7 +36212,7 @@ async function physicalAliases(location, files) {
36155
36212
  async function samePhysical(a, b) {
36156
36213
  const id = async (path5) => {
36157
36214
  try {
36158
- const info = await stat11(path5, { bigint: true });
36215
+ const info = await stat12(path5, { bigint: true });
36159
36216
  return info.ino === 0n ? void 0 : `${info.dev}:${info.ino}`;
36160
36217
  } catch (error) {
36161
36218
  const code2 = error.code;
@@ -36421,7 +36478,7 @@ function lockHolderText(name) {
36421
36478
  }
36422
36479
  async function exists2(path5) {
36423
36480
  try {
36424
- await stat11(path5);
36481
+ await stat12(path5);
36425
36482
  return true;
36426
36483
  } catch (error) {
36427
36484
  const code2 = error.code;
@@ -39153,12 +39210,12 @@ async function select2(terminal, items, options) {
39153
39210
  // src/common-auth-embedded/claustrum/enrollment.js
39154
39211
  import { createHash as createHash12, randomBytes as randomBytes5, randomUUID as randomUUID17 } from "node:crypto";
39155
39212
  import { constants as fsConstants2 } from "node:fs";
39156
- import { chmod as chmod6, mkdir as mkdir15, open as open10, readFile as readFile14, realpath as realpath4, rename as rename12, stat as stat14, unlink as unlink13 } from "node:fs/promises";
39213
+ import { chmod as chmod6, mkdir as mkdir15, open as open10, readFile as readFile14, realpath as realpath4, rename as rename12, stat as stat15, unlink as unlink13 } from "node:fs/promises";
39157
39214
  import { basename as basename8, dirname as dirname21, extname as extname2, isAbsolute as isAbsolute4, join as join21, resolve as resolve22 } from "node:path";
39158
39215
  import { ClaustrumCredentialError as ClaustrumCredentialError9, ClaustrumClient as ClaustrumWireClient2, writeEnrollmentTokenFile as writeEnrollmentTokenFile2 } from "@cortexkit/claustrum-client";
39159
39216
 
39160
39217
  // src/common-auth-embedded/fs/file-read-cache.js
39161
- import { lstat as lstat7, stat as stat12 } from "node:fs/promises";
39218
+ import { lstat as lstat7, stat as stat13 } from "node:fs/promises";
39162
39219
  import { resolve as resolve20 } from "node:path";
39163
39220
  async function identity2(path5, probe) {
39164
39221
  try {
@@ -39177,7 +39234,7 @@ var FileReadCache2 = class {
39177
39234
  #probe;
39178
39235
  #entries = /* @__PURE__ */ new Map();
39179
39236
  constructor(options = {}) {
39180
- this.#probe = options.followSymlinks ? (path5) => (options.stat ?? stat12)(path5) : (path5) => (options.lstat ?? lstat7)(path5);
39237
+ this.#probe = options.followSymlinks ? (path5) => (options.stat ?? stat13)(path5) : (path5) => (options.lstat ?? lstat7)(path5);
39181
39238
  }
39182
39239
  async read(paths, read, validateHit) {
39183
39240
  const resolvedPaths = paths.map((path5) => resolve20(path5));
@@ -39231,7 +39288,7 @@ init_private_files2();
39231
39288
  // src/common-auth-embedded/fs/refresh-file-lock.js
39232
39289
  init_logger3();
39233
39290
  import { randomUUID as randomUUID16 } from "node:crypto";
39234
- import { link as link3, lstat as lstat8, mkdir as mkdir14, open as open9, readdir as readdir5, readFile as readFile13, rename as rename11, rm as rm6, stat as stat13, unlink as unlink12 } from "node:fs/promises";
39291
+ import { link as link3, lstat as lstat8, mkdir as mkdir14, open as open9, readdir as readdir5, readFile as readFile13, rename as rename11, rm as rm6, stat as stat14, unlink as unlink12 } from "node:fs/promises";
39235
39292
  import { basename as basename7, dirname as dirname20, join as join20 } from "node:path";
39236
39293
 
39237
39294
  // src/common-auth-embedded/fs/lock-record.js
@@ -39641,7 +39698,7 @@ async function acquireRefreshFileLockWithClock2(options) {
39641
39698
  };
39642
39699
  }
39643
39700
  try {
39644
- const current = await stat13(lockPath);
39701
+ const current = await stat14(lockPath);
39645
39702
  const legacyExpiry = Number.isFinite(expiresAt) ? expiresAt : current.mtimeMs + options.ttlMs;
39646
39703
  if (legacyExpiry > now2())
39647
39704
  return { status: "live" };
@@ -39735,7 +39792,7 @@ async function acquireRefreshFileLockWithClock2(options) {
39735
39792
  if (!ownedDirectory)
39736
39793
  return false;
39737
39794
  try {
39738
- await stat13(evictOwnerPath);
39795
+ await stat14(evictOwnerPath);
39739
39796
  return false;
39740
39797
  } catch (error) {
39741
39798
  if (error.code !== "ENOENT")
@@ -39756,7 +39813,7 @@ async function acquireRefreshFileLockWithClock2(options) {
39756
39813
  return false;
39757
39814
  stillOurs = true;
39758
39815
  try {
39759
- await stat13(evictOwnerPath);
39816
+ await stat14(evictOwnerPath);
39760
39817
  return false;
39761
39818
  } catch (error) {
39762
39819
  return error.code === "ENOENT";
@@ -39806,7 +39863,7 @@ async function acquireRefreshFileLockWithClock2(options) {
39806
39863
  async function recoverStaleEvictionMarker(deadline) {
39807
39864
  let evictStat;
39808
39865
  try {
39809
- evictStat = await stat13(evictPath);
39866
+ evictStat = await stat14(evictPath);
39810
39867
  } catch (error) {
39811
39868
  if (error.code === "ENOENT")
39812
39869
  return "missing";
@@ -39824,7 +39881,7 @@ async function acquireRefreshFileLockWithClock2(options) {
39824
39881
  if (evictStat.mtimeMs + EVICT_TTL > now2()) {
39825
39882
  let hasOwner = true;
39826
39883
  try {
39827
- await stat13(evictOwnerPath);
39884
+ await stat14(evictOwnerPath);
39828
39885
  } catch (error) {
39829
39886
  if (error.code === "ENOENT")
39830
39887
  hasOwner = false;
@@ -40594,7 +40651,7 @@ async function refuseWritableAncestor2(parent, options = {}) {
40594
40651
  }
40595
40652
  let privateGroup;
40596
40653
  for (; ; ) {
40597
- const metadata = await stat14(component).catch(() => void 0);
40654
+ const metadata = await stat15(component).catch(() => void 0);
40598
40655
  if (metadata && (metadata.mode & 18) !== 0 && (metadata.mode & 512) === 0) {
40599
40656
  if (privateGroup === void 0) {
40600
40657
  privateGroup = gid !== void 0 && await isPrivateGroup2(uid, gid, options);
@@ -40623,7 +40680,7 @@ async function ensureClaustrumPrivateDirectory2(directory, options = {}, what =
40623
40680
  return;
40624
40681
  }
40625
40682
  await mkdir15(directory, { recursive: true, mode: 448 });
40626
- const metadata = await stat14(directory);
40683
+ const metadata = await stat15(directory);
40627
40684
  const uid = process.geteuid?.();
40628
40685
  if (uid !== void 0 && metadata.uid !== uid) {
40629
40686
  throw new ClaustrumConsumerError2("unsafe-file", `Claustrum ${what} must be owned by the current user`);
@@ -41341,7 +41398,7 @@ function setupPaths(io = {}) {
41341
41398
  }
41342
41399
 
41343
41400
  // src/common-auth-embedded/setup/detect.js
41344
- function stat15(path5, kind) {
41401
+ function stat16(path5, kind) {
41345
41402
  try {
41346
41403
  return statSync6(path5)[kind]();
41347
41404
  } catch {
@@ -41350,12 +41407,12 @@ function stat15(path5, kind) {
41350
41407
  }
41351
41408
  var defaultSetupFileSystem = {
41352
41409
  exists: existsSync6,
41353
- isFile: (path5) => stat15(path5, "isFile"),
41354
- isDirectory: (path5) => stat15(path5, "isDirectory"),
41410
+ isFile: (path5) => stat16(path5, "isFile"),
41411
+ isDirectory: (path5) => stat16(path5, "isDirectory"),
41355
41412
  isExecutable(path5) {
41356
41413
  try {
41357
41414
  accessSync(path5, constants3.X_OK);
41358
- return stat15(path5, "isFile");
41415
+ return stat16(path5, "isFile");
41359
41416
  } catch {
41360
41417
  return false;
41361
41418
  }
@@ -42156,7 +42213,7 @@ import { applyEdits, createScanner, findNodeAtLocation, modify, parse as parse2,
42156
42213
 
42157
42214
  // src/common-auth-embedded/setup/config-write.js
42158
42215
  import { randomUUID as randomUUID18 } from "node:crypto";
42159
- import { mkdir as mkdir16, open as open11, rename as rename13, stat as stat16, unlink as unlink14 } from "node:fs/promises";
42216
+ import { mkdir as mkdir16, open as open11, rename as rename13, stat as stat17, unlink as unlink14 } from "node:fs/promises";
42160
42217
  import { basename as basename9, dirname as dirname22, join as join23 } from "node:path";
42161
42218
  import { setTimeout as delay3 } from "node:timers/promises";
42162
42219
  async function writeHostConfigAtomic(file, content, options = {}) {
@@ -42166,7 +42223,7 @@ async function writeHostConfigAtomic(file, content, options = {}) {
42166
42223
  let mode;
42167
42224
  if (!windows2) {
42168
42225
  try {
42169
- mode = (await stat16(file)).mode & 4095;
42226
+ mode = (await stat17(file)).mode & 4095;
42170
42227
  } catch (error) {
42171
42228
  if (error.code !== "ENOENT")
42172
42229
  throw error;
@@ -43940,8 +43997,8 @@ function getLocalDevPath(directory) {
43940
43997
  }
43941
43998
  function findPackageJsonUp(startPath) {
43942
43999
  try {
43943
- const stat21 = fs4.statSync(startPath);
43944
- let dir = stat21.isDirectory() ? startPath : path4.dirname(startPath);
44000
+ const stat22 = fs4.statSync(startPath);
44001
+ let dir = stat22.isDirectory() ? startPath : path4.dirname(startPath);
43945
44002
  for (let i = 0; i < 10; i++) {
43946
44003
  const pkgPath = path4.join(dir, "package.json");
43947
44004
  if (fs4.existsSync(pkgPath)) {
@@ -44271,7 +44328,7 @@ function isSessionId(value) {
44271
44328
  // src/common-auth-embedded/rpc/port-file.js
44272
44329
  init_private_files2();
44273
44330
  import { createHash as createHash14, randomUUID as randomUUID19 } from "node:crypto";
44274
- import { chmod as chmod7, mkdir as mkdir17, open as open12, readdir as readdir6, rename as rename15, rmdir as rmdir3, stat as stat17, unlink as unlink15 } from "node:fs/promises";
44331
+ import { chmod as chmod7, mkdir as mkdir17, open as open12, readdir as readdir6, rename as rename15, rmdir as rmdir3, stat as stat18, unlink as unlink15 } from "node:fs/promises";
44275
44332
  import { uptime as uptime2 } from "node:os";
44276
44333
  import { join as join30, resolve as resolve26 } from "node:path";
44277
44334
  function staleBefore(clock2) {
@@ -44287,7 +44344,7 @@ async function removeStalePortFile(path5, raw, info, beforeRemove2) {
44287
44344
  await beforeRemove2?.(path5);
44288
44345
  try {
44289
44346
  const current = await readPrivateText2(path5);
44290
- const identity4 = await stat17(path5);
44347
+ const identity4 = await stat18(path5);
44291
44348
  if (current === raw && identity4.dev === info.dev && identity4.ino === info.ino && identity4.mtimeMs === info.mtimeMs && identity4.size === info.size)
44292
44349
  await unlink15(path5).catch(() => {
44293
44350
  });
@@ -44410,7 +44467,7 @@ async function sweepRpcDirectory(dir, log19, options = {}, cutoff = staleBefore(
44410
44467
  if (!name.startsWith("port-") || !name.endsWith(".json"))
44411
44468
  continue;
44412
44469
  const portFile = join30(dir, name);
44413
- const info = await stat17(portFile).catch(() => void 0);
44470
+ const info = await stat18(portFile).catch(() => void 0);
44414
44471
  let raw;
44415
44472
  try {
44416
44473
  raw = await readPrivateText2(portFile);
@@ -45661,7 +45718,7 @@ import { join as join33, resolve as resolve29 } from "node:path";
45661
45718
  init_canonical_file_path();
45662
45719
  init_private_files();
45663
45720
  import { lstatSync, readFileSync as readFileSync8, readlinkSync, realpathSync as realpathSync5, statSync as statSync9, watch } from "node:fs";
45664
- import { readFile as readFile17, stat as stat18 } from "node:fs/promises";
45721
+ import { readFile as readFile17, stat as stat19 } from "node:fs/promises";
45665
45722
  import { basename as basename11, dirname as dirname25, join as join32, resolve as resolve28 } from "node:path";
45666
45723
  import { clearTimeout as clearTimeout2, setTimeout as setTimeout2 } from "node:timers";
45667
45724
  var pathFsDefaults = { lstatSync, readlinkSync, realpathSync: realpathSync5 };
@@ -45697,7 +45754,7 @@ function watchFile(file, onChange, options, settings) {
45697
45754
  return shared3.subscribe(onChange);
45698
45755
  const name = basename11(path5);
45699
45756
  const read = windowsPrivateFiles && !settings ? (file2) => readPrivateText(file2) : options.fs?.readFile ?? ((file2) => readFile17(file2, "utf8"));
45700
- const probe = options.fs?.stat ?? stat18;
45757
+ const probe = options.fs?.stat ?? stat19;
45701
45758
  let timer = null;
45702
45759
  let pollTimer = null;
45703
45760
  let lastMetadata = null;
@@ -47451,7 +47508,7 @@ function readLegacyProjectSettings(text2) {
47451
47508
 
47452
47509
  // src/settings/runtime.ts
47453
47510
  init_dist();
47454
- import { readFile as readFile22, stat as stat20 } from "node:fs/promises";
47511
+ import { readFile as readFile22, stat as stat21 } from "node:fs/promises";
47455
47512
  import { homedir as homedir12 } from "node:os";
47456
47513
  import { basename as basename15, join as join38 } from "node:path";
47457
47514
 
@@ -48026,7 +48083,7 @@ function applyHotValues(target, next) {
48026
48083
  var DEFAULT_RETRY_DELAYS_MS = [5e3, 15e3, 6e4, 3e5];
48027
48084
  async function exists4(path5) {
48028
48085
  try {
48029
- await stat20(path5);
48086
+ await stat21(path5);
48030
48087
  return true;
48031
48088
  } catch {
48032
48089
  return false;
@@ -65027,7 +65084,12 @@ var createAntigravityPluginRuntime = (providerId, options = {}) => async (input2
65027
65084
  source,
65028
65085
  pool: createOpenCodeVaultAccountPool({
65029
65086
  source,
65030
- durable: { source, readState: () => vaultCustody.readState() }
65087
+ durable: {
65088
+ source,
65089
+ readState: () => vaultCustody.readState(),
65090
+ stateFile: vaultCustody.paths.stateFile,
65091
+ onReadFailure: () => logger2.debug("vault-state-read-skipped")
65092
+ }
65031
65093
  })
65032
65094
  };
65033
65095
  return vaultPool;