@cortexkit/opencode-antigravity-auth 3.0.30 → 3.0.32

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 (76) hide show
  1. package/dist/cli.js +104 -81
  2. package/dist/cli.js.map +3 -3
  3. package/dist/cli.meta.json +24 -19
  4. package/dist/index.js +171 -140
  5. package/dist/index.js.map +3 -3
  6. package/dist/index.meta.json +28 -23
  7. package/dist/server.js +171 -140
  8. package/dist/server.js.map +3 -3
  9. package/dist/server.meta.json +1 -1
  10. package/dist/src/common-auth-embedded/claustrum/roster.d.ts +2 -0
  11. package/dist/src/common-auth-embedded/claustrum/roster.js +32 -8
  12. package/dist/src/common-auth-embedded/fs/file-read-cache.js +10 -5
  13. package/dist/src/common-auth-embedded/limits/axes.d.ts +7 -1
  14. package/dist/src/common-auth-embedded/limits/decide.d.ts +5 -0
  15. package/dist/src/common-auth-embedded/limits/families.d.ts +4 -2
  16. package/dist/src/common-auth-embedded/limits/marker.d.ts +5 -0
  17. package/dist/src/common-auth-embedded/limits/request-history.d.ts +3 -1
  18. package/dist/src/common-auth-embedded/opencode2/install.d.ts +2 -1
  19. package/dist/src/common-auth-embedded/opencode2/install.js +58 -9
  20. package/dist/src/common-auth-embedded/opencode2/types.d.ts +19 -3
  21. package/dist/src/common-auth-embedded/routing-accessor/index.d.ts +30 -5
  22. package/dist/src/common-auth-embedded/routing-accessor/index.js +121 -33
  23. package/dist/src/common-auth-embedded/setup/enroll.js +7 -1
  24. package/dist/src/common-auth-embedded/source-output.json +63 -63
  25. package/dist/src/common-auth-embedded/store/index.d.ts +1 -1
  26. package/dist/src/common-auth-embedded/store/limits-namespace.d.ts +7 -1
  27. package/dist/src/common-auth-embedded/store/limits-namespace.js +19 -7
  28. package/dist/src/common-auth-embedded/store/pool.d.ts +1 -1
  29. package/dist/src/common-auth-embedded/store/pool.js +1 -1
  30. package/dist/src/plugin/__fixtures__/release-model-ids.d.ts.map +1 -1
  31. package/dist/src/plugin/__fixtures__/release-model-ids.js +0 -1
  32. package/dist/src/plugin/__fixtures__/release-model-ids.js.map +1 -1
  33. package/dist/src/plugin/__fixtures__/verified-store.js +2 -2
  34. package/dist/src/plugin/account-access.js +1 -1
  35. package/dist/src/plugin/request.d.ts.map +1 -1
  36. package/dist/src/plugin/request.js +3 -2
  37. package/dist/src/plugin/request.js.map +1 -1
  38. package/dist/src/plugin/shared/request-services.d.ts +1 -1
  39. package/dist/src/plugin/shared/request-services.js +1 -1
  40. package/dist/tui-build-map.json +1 -1
  41. package/dist/tui-ga-build-map.json +1 -1
  42. package/dist/types/src/common-auth-embedded/claustrum/roster.d.ts +2 -0
  43. package/dist/types/src/common-auth-embedded/limits/axes.d.ts +7 -1
  44. package/dist/types/src/common-auth-embedded/limits/decide.d.ts +5 -0
  45. package/dist/types/src/common-auth-embedded/limits/families.d.ts +4 -2
  46. package/dist/types/src/common-auth-embedded/limits/marker.d.ts +5 -0
  47. package/dist/types/src/common-auth-embedded/limits/request-history.d.ts +3 -1
  48. package/dist/types/src/common-auth-embedded/opencode2/install.d.ts +2 -1
  49. package/dist/types/src/common-auth-embedded/opencode2/types.d.ts +19 -3
  50. package/dist/types/src/common-auth-embedded/routing-accessor/index.d.ts +30 -5
  51. package/dist/types/src/common-auth-embedded/store/index.d.ts +1 -1
  52. package/dist/types/src/common-auth-embedded/store/limits-namespace.d.ts +7 -1
  53. package/dist/types/src/common-auth-embedded/store/pool.d.ts +1 -1
  54. package/dist/types/src/plugin/request.d.ts.map +1 -1
  55. package/dist/types/src/plugin/shared/request-services.d.ts +1 -1
  56. package/package.json +3 -3
  57. package/src/common-auth-embedded/claustrum/roster.d.ts +2 -0
  58. package/src/common-auth-embedded/claustrum/roster.js +32 -8
  59. package/src/common-auth-embedded/fs/file-read-cache.js +10 -5
  60. package/src/common-auth-embedded/limits/axes.d.ts +7 -1
  61. package/src/common-auth-embedded/limits/decide.d.ts +5 -0
  62. package/src/common-auth-embedded/limits/families.d.ts +4 -2
  63. package/src/common-auth-embedded/limits/marker.d.ts +5 -0
  64. package/src/common-auth-embedded/limits/request-history.d.ts +3 -1
  65. package/src/common-auth-embedded/opencode2/install.d.ts +2 -1
  66. package/src/common-auth-embedded/opencode2/install.js +58 -9
  67. package/src/common-auth-embedded/opencode2/types.d.ts +19 -3
  68. package/src/common-auth-embedded/routing-accessor/index.d.ts +30 -5
  69. package/src/common-auth-embedded/routing-accessor/index.js +121 -33
  70. package/src/common-auth-embedded/setup/enroll.js +7 -1
  71. package/src/common-auth-embedded/source-output.json +63 -63
  72. package/src/common-auth-embedded/store/index.d.ts +1 -1
  73. package/src/common-auth-embedded/store/limits-namespace.d.ts +7 -1
  74. package/src/common-auth-embedded/store/limits-namespace.js +19 -7
  75. package/src/common-auth-embedded/store/pool.d.ts +1 -1
  76. package/src/common-auth-embedded/store/pool.js +1 -1
package/dist/server.js CHANGED
@@ -1631,10 +1631,10 @@ async function privateDirectory(path5) {
1631
1631
  if (errno(error) !== "EEXIST")
1632
1632
  throw error;
1633
1633
  }
1634
- const stat16 = await lstat2(path5);
1635
- if (!stat16.isDirectory() || stat16.isSymbolicLink())
1634
+ const stat18 = await lstat2(path5);
1635
+ if (!stat18.isDirectory() || stat18.isSymbolicLink())
1636
1636
  throw new AccountMigrationError("successor directory is not a regular directory");
1637
- privateMode(stat16.mode, 448);
1637
+ privateMode(stat18.mode, 448);
1638
1638
  if (windowsPrivateFiles)
1639
1639
  await verifySafeDirectory(path5);
1640
1640
  if (!sameFilesystemPath(await realpath(path5), path5))
@@ -5879,7 +5879,7 @@ function getAgyNativeModel(model) {
5879
5879
  }
5880
5880
  function isRetiredAgyModel(model) {
5881
5881
  const route = model.toLowerCase().replace(/^antigravity-/, "").replace(/^gemini-(?=claude-)/, "").replace(/-preview(?:-customtools)?$/, "");
5882
- return (/^claude-(opus|sonnet)-4-6(?:-thinking)?(?:-(?:minimal|low|medium|high))?$/.test(route) || /^gemini-3\.1-pro(?:-(?:low|high))?$/.test(route) || /^gemini-3\.[67]-flash(?:-(?:low|medium|high|tiered))?$/.test(route) || route === "gemini-pro-agent") && getAgyNativeModel(route) === void 0;
5882
+ return (/^claude-(opus|sonnet)-4-6(?:-thinking)?(?:-(?:minimal|low|medium|high))?$/.test(route) || /^gemini-3\.1-pro(?:-(?:low|high))?$/.test(route) || /^gemini-3\.5-flash(?:-(?:low|medium|high|extra-low))?$/.test(route) || /^gemini-3\.[67]-flash(?:-(?:low|medium|high|tiered))?$/.test(route) || route === "gemini-3-flash-agent" || route === "gemini-pro-agent") && getAgyNativeModel(route) === void 0;
5883
5883
  }
5884
5884
  function pickModelDefinitions(ids) {
5885
5885
  return Object.fromEntries(ids.map((id) => [id, ALL_MODEL_DEFINITIONS[id]]));
@@ -6067,36 +6067,12 @@ var init_model_registry = __esm({
6067
6067
  supportsThinking: true,
6068
6068
  vertexModelId: "openai/gpt-oss-120b-maas"
6069
6069
  },
6070
- "gemini-3.5-flash-extra-low": {
6071
- displayName: "Gemini 3.5 Flash (Low)",
6072
- maxTokens: 1048576,
6073
- maxOutputTokens: 65536,
6074
- model: "MODEL_PLACEHOLDER_M187",
6075
- thinkingBudget: 1e3,
6076
- supportsThinking: true
6077
- },
6078
- "gemini-3.5-flash-low": {
6079
- displayName: "Gemini 3.5 Flash (Medium)",
6080
- maxTokens: 1048576,
6081
- maxOutputTokens: 65536,
6082
- model: "MODEL_PLACEHOLDER_M20",
6083
- thinkingBudget: 4e3,
6084
- supportsThinking: true
6085
- },
6086
- "gemini-3-flash-agent": {
6087
- displayName: "Gemini 3.5 Flash (High)",
6088
- maxTokens: 1048576,
6089
- maxOutputTokens: 65536,
6090
- model: "MODEL_PLACEHOLDER_M84",
6091
- thinkingBudget: -1,
6092
- supportsThinking: true
6093
- },
6094
6070
  "gemini-3.1-flash-image": {
6095
6071
  displayName: "Gemini 3.1 Flash Image",
6096
6072
  model: "MODEL_PLACEHOLDER_M21"
6097
6073
  }
6098
6074
  };
6099
- RETIRED_AGY_MODEL_MESSAGE = "This Antigravity model is no longer offered. Choose another model.";
6075
+ RETIRED_AGY_MODEL_MESSAGE = "This Antigravity model is no longer offered. Use Gemini 3.8 Flash, or Claude Sonnet 5.5 or Opus 5.5.";
6100
6076
  ALL_MODEL_DEFINITIONS = {
6101
6077
  "antigravity-gemini-4-argon": defineModel("antigravity-gemini-4-argon", {
6102
6078
  name: "Gemini 4 Argon (Antigravity)",
@@ -6109,17 +6085,6 @@ var init_model_registry = __esm({
6109
6085
  high: { thinkingLevel: "high" }
6110
6086
  }
6111
6087
  }),
6112
- "antigravity-gemini-3.5-flash": defineModel("antigravity-gemini-3.5-flash", {
6113
- name: "Gemini 3.5 Flash (Antigravity)",
6114
- reasoning: true,
6115
- limit: { context: 1048576, output: 65536 },
6116
- modalities: DEFAULT_MODALITIES,
6117
- variants: {
6118
- low: { thinkingLevel: "low" },
6119
- medium: { thinkingLevel: "medium" },
6120
- high: { thinkingLevel: "high" }
6121
- }
6122
- }),
6123
6088
  "antigravity-gemini-3.1-flash-image": defineModel("antigravity-gemini-3.1-flash-image", {
6124
6089
  name: "Gemini 3.1 Flash Image (Antigravity)",
6125
6090
  reasoning: false,
@@ -6175,7 +6140,6 @@ var init_model_registry = __esm({
6175
6140
  "gemini-3-flash-low": "gemini-3-flash",
6176
6141
  "gemini-3-flash-medium": "gemini-3-flash",
6177
6142
  "gemini-3-flash-high": "gemini-3-flash",
6178
- "gemini-3.5-flash-low": "gemini-3.5-flash",
6179
6143
  "gemini-3.5-flash-medium": "gemini-3.5-flash",
6180
6144
  "gemini-3.5-flash-high": "gemini-3.5-flash",
6181
6145
  "gemini-3.6-flash-low": "gemini-3.6-flash",
@@ -6245,9 +6209,6 @@ var init_model_registry = __esm({
6245
6209
  "gemini-3.1-pro-low": "gemini",
6246
6210
  "gemini-3.1-pro-high": "gemini",
6247
6211
  "gemini-3-flash": "gemini",
6248
- "gemini-3-flash-agent": "gemini",
6249
- "gemini-3.5-flash-low": "gemini",
6250
- "gemini-3.5-flash-extra-low": "gemini",
6251
6212
  "gemini-3.6-flash-low": "gemini",
6252
6213
  "gemini-3.6-flash-medium": "gemini",
6253
6214
  "gemini-3.6-flash-high": "gemini",
@@ -6267,7 +6228,6 @@ var init_model_registry = __esm({
6267
6228
  ANTIGRAVITY_OPENCODE_MODEL_IDS = [
6268
6229
  "antigravity-gemini-4-argon",
6269
6230
  "antigravity-gemini-3.8-flash",
6270
- "antigravity-gemini-3.5-flash",
6271
6231
  "antigravity-gemini-3.1-flash-image",
6272
6232
  "antigravity-claude-sonnet-5-5",
6273
6233
  "antigravity-claude-opus-5-5",
@@ -10385,6 +10345,9 @@ var init_agy_request_metadata = __esm({
10385
10345
  }
10386
10346
  };
10387
10347
  HISTORICAL_AGY_MODEL_ENUMS = {
10348
+ "gemini-3.5-flash-extra-low": "MODEL_PLACEHOLDER_M187",
10349
+ "gemini-3.5-flash-low": "MODEL_PLACEHOLDER_M20",
10350
+ "gemini-3-flash-agent": "MODEL_PLACEHOLDER_M84",
10388
10351
  "gemini-3.1-pro-low": "MODEL_PLACEHOLDER_M36",
10389
10352
  "gemini-3.1-pro-high": "MODEL_PLACEHOLDER_M37",
10390
10353
  "gemini-pro-agent": "MODEL_PLACEHOLDER_M16",
@@ -14951,7 +14914,7 @@ var init_attribution = __esm({
14951
14914
  });
14952
14915
 
14953
14916
  // ../core/dist/common-auth-embedded/store/limits-namespace.js
14954
- async function updatePoolLimitsNamespace(rt, mutator) {
14917
+ async function updatePoolLimitsNamespace(rt, mutator, options = {}) {
14955
14918
  assertLimitsWriteAllowed();
14956
14919
  const { ctx } = rt;
14957
14920
  await runOperation(ctx, "updateLimitsNamespace", void 0, void 0, async (locks, progress) => {
@@ -14971,13 +14934,21 @@ async function updatePoolLimitsNamespace(rt, mutator) {
14971
14934
  operation: "updateLimitsNamespace",
14972
14935
  rowId: void 0
14973
14936
  };
14974
- await writeJsonAtomic2(ctx.configPath, config, {
14975
- beforeRename: async () => {
14976
- await ctx.onStep?.("before-config-write", info);
14977
- await locks.assertAll();
14978
- }
14979
- });
14937
+ try {
14938
+ await writeJsonAtomic2(ctx.configPath, config, {
14939
+ beforeRename: async () => {
14940
+ await ctx.onStep?.("before-config-write", info);
14941
+ await locks.assertAll();
14942
+ options.beforePublish?.();
14943
+ }
14944
+ });
14945
+ } catch (error) {
14946
+ if (error && typeof error === "object" && "published" in error && error.published === true)
14947
+ options.onPublished?.();
14948
+ throw error;
14949
+ }
14980
14950
  progress.writes++;
14951
+ options.onPublished?.();
14981
14952
  await ctx.onStep?.("after-config-write", info);
14982
14953
  });
14983
14954
  }
@@ -17322,11 +17293,11 @@ var init_refresh = __esm({
17322
17293
  });
17323
17294
 
17324
17295
  // ../core/dist/common-auth-embedded/fs/file-read-cache.js
17325
- import { lstat as lstat4 } from "node:fs/promises";
17296
+ import { lstat as lstat4, stat as stat4 } from "node:fs/promises";
17326
17297
  import { resolve as resolve5 } from "node:path";
17327
- async function identity(path5) {
17298
+ async function identity(path5, followSymlinks) {
17328
17299
  try {
17329
- const metadata = await lstat4(path5);
17300
+ const metadata = await (followSymlinks ? stat4(path5) : lstat4(path5));
17330
17301
  return metadata.isFile() ? metadata : void 0;
17331
17302
  } catch (error) {
17332
17303
  return error.code === "ENOENT" ? "absent" : void 0;
@@ -17342,11 +17313,15 @@ var init_file_read_cache = __esm({
17342
17313
  "../core/dist/common-auth-embedded/fs/file-read-cache.js"() {
17343
17314
  "use strict";
17344
17315
  FileReadCache = class {
17316
+ #followSymlinks;
17345
17317
  #entries = /* @__PURE__ */ new Map();
17318
+ constructor(options = {}) {
17319
+ this.#followSymlinks = options.followSymlinks ?? false;
17320
+ }
17346
17321
  async read(paths, read, validateHit) {
17347
17322
  const resolvedPaths = paths.map((path5) => resolve5(path5));
17348
17323
  const key = JSON.stringify(resolvedPaths);
17349
- const probed = await Promise.all(resolvedPaths.map(identity));
17324
+ const probed = await Promise.all(resolvedPaths.map((path5) => identity(path5, this.#followSymlinks)));
17350
17325
  const identities = probed.every((entry) => entry !== void 0) ? probed : void 0;
17351
17326
  const cached = this.#entries.get(key);
17352
17327
  if (identities && cached && identities.every((entry, index) => {
@@ -17583,7 +17558,7 @@ function openPoolStore(options) {
17583
17558
  reorder: (ids, callOptions) => reorderRows(rt, ids, callOptions),
17584
17559
  readSettings: () => readPoolSettings(rt),
17585
17560
  updateSettings: (mutator, callOptions) => updatePoolSettings(rt, mutator, callOptions),
17586
- updateLimitsNamespace: (mutator) => updatePoolLimitsNamespace(rt, mutator),
17561
+ updateLimitsNamespace: (mutator, options2) => updatePoolLimitsNamespace(rt, mutator, options2),
17587
17562
  recordIdentity: (id, identity3, attribution, callOptions) => recordRowIdentity(rt, id, identity3, attribution, callOptions),
17588
17563
  refresh: (id, provider2, callOptions) => refreshRow(rt, id, provider2, callOptions),
17589
17564
  recordQuota: record3,
@@ -21094,7 +21069,7 @@ var init_any_signal = __esm({
21094
21069
  // ../core/dist/common-auth-embedded/claustrum/enrollment.js
21095
21070
  import { createHash as createHash6, randomBytes as randomBytes4, randomUUID as randomUUID12 } from "node:crypto";
21096
21071
  import { constants as fsConstants } from "node:fs";
21097
- import { chmod as chmod2, mkdir as mkdir8, open as open6, readFile as readFile6, realpath as realpath3, rename as rename7, stat as stat4, unlink as unlink6 } from "node:fs/promises";
21072
+ import { chmod as chmod2, mkdir as mkdir8, open as open6, readFile as readFile6, realpath as realpath3, rename as rename7, stat as stat5, unlink as unlink6 } from "node:fs/promises";
21098
21073
  import { basename as basename3, dirname as dirname9, extname, isAbsolute as isAbsolute2, join as join7, resolve as resolve7 } from "node:path";
21099
21074
  import { ClaustrumCredentialError as ClaustrumCredentialError2, ClaustrumClient as ClaustrumWireClient, writeEnrollmentTokenFile } from "@cortexkit/claustrum-client";
21100
21075
  function classifyEnrollmentError(error) {
@@ -21314,7 +21289,7 @@ async function refuseWritableAncestor(parent, options = {}) {
21314
21289
  }
21315
21290
  let privateGroup;
21316
21291
  for (; ; ) {
21317
- const metadata = await stat4(component).catch(() => void 0);
21292
+ const metadata = await stat5(component).catch(() => void 0);
21318
21293
  if (metadata && (metadata.mode & 18) !== 0 && (metadata.mode & 512) === 0) {
21319
21294
  if (privateGroup === void 0) {
21320
21295
  privateGroup = gid !== void 0 && await isPrivateGroup(uid, gid, options);
@@ -21343,7 +21318,7 @@ async function ensureClaustrumPrivateDirectory(directory, options = {}, what = "
21343
21318
  return;
21344
21319
  }
21345
21320
  await mkdir8(directory, { recursive: true, mode: 448 });
21346
- const metadata = await stat4(directory);
21321
+ const metadata = await stat5(directory);
21347
21322
  const uid = process.geteuid?.();
21348
21323
  if (uid !== void 0 && metadata.uid !== uid) {
21349
21324
  throw new ClaustrumConsumerError("unsafe-file", `Claustrum ${what} must be owned by the current user`);
@@ -22824,7 +22799,7 @@ var init_interlock = __esm({
22824
22799
 
22825
22800
  // ../core/dist/common-auth-embedded/claustrum/roster.js
22826
22801
  import { createHash as createHash7 } from "node:crypto";
22827
- import { stat as stat5 } from "node:fs/promises";
22802
+ import { stat as stat6 } from "node:fs/promises";
22828
22803
  import { resolve as resolve8 } from "node:path";
22829
22804
  function vaultRosterSeed(roster) {
22830
22805
  return {
@@ -23055,6 +23030,12 @@ function decodedVaultRoster(roster) {
23055
23030
  return decodeRoster(JSON.parse(JSON.stringify(roster)));
23056
23031
  }
23057
23032
  async function readVaultRoster(path5) {
23033
+ if (windowsPrivateFiles)
23034
+ return readFreshVaultRoster(path5);
23035
+ const roster = await rosterReadCache.read([path5], ([resolvedPath = path5]) => readFreshVaultRoster(resolvedPath));
23036
+ return structuredClone(roster);
23037
+ }
23038
+ async function readFreshVaultRoster(path5) {
23058
23039
  let text2;
23059
23040
  try {
23060
23041
  text2 = await readPrivateText(path5, windowsPrivateFiles);
@@ -23073,19 +23054,26 @@ async function readVaultRoster(path5) {
23073
23054
  }
23074
23055
  async function mutateVaultRoster(path5, change, options = {}) {
23075
23056
  return withLock(path5, { ...WRITE_LOCK, signal: options.signal }, async (lock) => {
23076
- const current = await readVaultRoster(path5);
23057
+ const current = await readFreshVaultRoster(path5);
23077
23058
  const { next, result } = await change(current, {
23078
23059
  assertOwned: () => lock.assertOwned()
23079
23060
  });
23080
23061
  if (next) {
23081
23062
  await lock.assertOwned();
23082
- await writeJsonAtomic2(path5, next, {
23083
- beforeRename: async () => {
23084
- await options.beforePublish?.();
23085
- options.signal?.throwIfAborted();
23086
- await lock.assertOwned();
23087
- }
23088
- });
23063
+ try {
23064
+ await writeJsonAtomic2(path5, next, {
23065
+ beforeRename: async () => {
23066
+ await options.beforePublish?.();
23067
+ options.signal?.throwIfAborted();
23068
+ await lock.assertOwned();
23069
+ }
23070
+ });
23071
+ } catch (error) {
23072
+ if (error && typeof error === "object" && "published" in error && error.published === true)
23073
+ options.onPublished?.();
23074
+ throw error;
23075
+ }
23076
+ options.onPublished?.();
23089
23077
  }
23090
23078
  return result;
23091
23079
  });
@@ -23233,7 +23221,7 @@ function isVaultRosterLockRefusal(path5, error) {
23233
23221
  }
23234
23222
  async function fileStamp(path5) {
23235
23223
  try {
23236
- const { dev, ino, size, mtimeMs } = await stat5(path5);
23224
+ const { dev, ino, size, mtimeMs } = await stat6(path5);
23237
23225
  return { dev, ino, size, mtimeMs };
23238
23226
  } catch {
23239
23227
  return void 0;
@@ -23373,10 +23361,11 @@ function resolveVaultPrimary(input2) {
23373
23361
  ...previous && previous.accountIdentity !== identity3 && { replaced: previous }
23374
23362
  };
23375
23363
  }
23376
- var DEFAULT_ROUTE_PREFIX, SKIPPED_REASONS, WRITE_LOCK, DISCOVERY_LEASE, pendingDiscoveries, UNLOCKED_READ_ATTEMPTS;
23364
+ var DEFAULT_ROUTE_PREFIX, SKIPPED_REASONS, rosterReadCache, WRITE_LOCK, DISCOVERY_LEASE, pendingDiscoveries, UNLOCKED_READ_ATTEMPTS;
23377
23365
  var init_roster = __esm({
23378
23366
  "../core/dist/common-auth-embedded/claustrum/roster.js"() {
23379
23367
  "use strict";
23368
+ init_file_read_cache();
23380
23369
  init_fs();
23381
23370
  init_private_files();
23382
23371
  init_quota();
@@ -23391,6 +23380,9 @@ var init_roster = __esm({
23391
23380
  "blank account identity",
23392
23381
  "empty state"
23393
23382
  ]);
23383
+ rosterReadCache = new FileReadCache({
23384
+ followSymlinks: true
23385
+ });
23394
23386
  WRITE_LOCK = {
23395
23387
  name: "claustrum-roster-write",
23396
23388
  ttlMs: 1e4,
@@ -24446,7 +24438,7 @@ var init_consumer = __esm({
24446
24438
  // ../core/dist/common-auth-embedded/claustrum/hub.js
24447
24439
  import { createHash as createHash8 } from "node:crypto";
24448
24440
  import { channel as channel2 } from "node:diagnostics_channel";
24449
- import { readdir, stat as stat6 } from "node:fs/promises";
24441
+ import { readdir, stat as stat7 } from "node:fs/promises";
24450
24442
  import { dirname as dirname10, join as join8, resolve as resolve10 } from "node:path";
24451
24443
  function canonicalJson3(value, path5 = /* @__PURE__ */ new Set()) {
24452
24444
  if (value === null)
@@ -25187,7 +25179,7 @@ var init_hub = __esm({
25187
25179
  let newest;
25188
25180
  for (const path5 of candidates) {
25189
25181
  try {
25190
- const modified = (await stat6(path5)).mtimeMs;
25182
+ const modified = (await stat7(path5)).mtimeMs;
25191
25183
  const roster = await readVaultRoster(path5);
25192
25184
  if (roster && (!newest || modified > newest.modified))
25193
25185
  newest = { modified, roster };
@@ -25554,7 +25546,7 @@ var init_claustrum = __esm({
25554
25546
 
25555
25547
  // ../core/dist/common-auth-embedded/pi-slot/lock.js
25556
25548
  import { rmdirSync, statSync as statSync2, utimesSync } from "node:fs";
25557
- import { mkdir as mkdir9, rmdir, stat as stat7, utimes } from "node:fs/promises";
25549
+ import { mkdir as mkdir9, rmdir, stat as stat8, utimes } from "node:fs/promises";
25558
25550
  function sameDirectory(observed, identity3) {
25559
25551
  return observed.dev === identity3.dev && observed.ino === identity3.ino;
25560
25552
  }
@@ -25582,7 +25574,7 @@ async function acquire(path5, stale) {
25582
25574
  throw held();
25583
25575
  let mtime;
25584
25576
  try {
25585
- mtime = (await stat7(path5)).mtime.getTime();
25577
+ mtime = (await stat8(path5)).mtime.getTime();
25586
25578
  } catch (error2) {
25587
25579
  if (errorCode(error2) === "ENOENT")
25588
25580
  return acquire(path5, 0);
@@ -25595,7 +25587,7 @@ async function acquire(path5, stale) {
25595
25587
  }
25596
25588
  let created;
25597
25589
  try {
25598
- const st = await stat7(path5);
25590
+ const st = await stat8(path5);
25599
25591
  created = { dev: st.dev, ino: st.ino };
25600
25592
  } catch {
25601
25593
  created = void 0;
@@ -25605,14 +25597,14 @@ async function acquire(path5, stale) {
25605
25597
  const probe = new Date(Math.ceil(Date.now() / 1e3) * 1e3 + 5);
25606
25598
  await utimes(path5, probe, probe);
25607
25599
  }
25608
- const observed = await stat7(path5);
25600
+ const observed = await stat8(path5);
25609
25601
  const mtime = observed.mtime.getTime();
25610
25602
  precision ??= mtime % 1e3 === 0 ? "s" : "ms";
25611
25603
  return { dev: observed.dev, ino: observed.ino, mtime };
25612
25604
  } catch (error) {
25613
25605
  try {
25614
25606
  if (created) {
25615
- const current = await stat7(path5).catch(() => void 0);
25607
+ const current = await stat8(path5).catch(() => void 0);
25616
25608
  if (current && current.dev === created.dev && current.ino === created.ino)
25617
25609
  await remove(path5).catch(() => {
25618
25610
  });
@@ -25712,7 +25704,7 @@ async function acquirePiLock(authPath, onCompromised, onRenew) {
25712
25704
  }
25713
25705
  let observed;
25714
25706
  try {
25715
- observed = await stat7(path5);
25707
+ observed = await stat8(path5);
25716
25708
  } catch (error) {
25717
25709
  if (errorCode(error) !== "ENOENT")
25718
25710
  throw error;
@@ -25851,13 +25843,13 @@ async function safeRead(path5, privateFile = false, afterReadCheck) {
25851
25843
  let file;
25852
25844
  try {
25853
25845
  file = await open7(path5, constants2.O_RDONLY | constants2.O_NOFOLLOW);
25854
- const stat16 = await file.stat();
25855
- if (!stat16.isFile() || privateFile && (stat16.mode & 511) !== 384) {
25846
+ const stat18 = await file.stat();
25847
+ if (!stat18.isFile() || privateFile && (stat18.mode & 511) !== 384) {
25856
25848
  throw new PiSlotError("unsafe-path");
25857
25849
  }
25858
25850
  await afterReadCheck?.(path5);
25859
25851
  const current = await lstat5(path5);
25860
- if (!current.isFile() || current.dev !== stat16.dev || current.ino !== stat16.ino) {
25852
+ if (!current.isFile() || current.dev !== stat18.dev || current.ino !== stat18.ino) {
25861
25853
  throw new PiSlotError("unsafe-path");
25862
25854
  }
25863
25855
  const bytes = await file.readFile();
@@ -30635,7 +30627,7 @@ var init_vault_insula_quota = __esm({
30635
30627
  });
30636
30628
 
30637
30629
  // src/plugin/vault-custody.ts
30638
- import { chmod as chmod3, mkdir as mkdir11, readFile as readFile9, stat as stat8 } from "node:fs/promises";
30630
+ import { chmod as chmod3, mkdir as mkdir11, readFile as readFile9, stat as stat9 } from "node:fs/promises";
30639
30631
  import { join as join11 } from "node:path";
30640
30632
  async function enrollmentFilesIdentity(paths) {
30641
30633
  const takenAt = performance.now();
@@ -30643,7 +30635,7 @@ async function enrollmentFilesIdentity(paths) {
30643
30635
  const parts = [];
30644
30636
  for (const path5 of [paths.tokenPath, paths.statePath]) {
30645
30637
  try {
30646
- const info = await stat8(path5, { bigint: true });
30638
+ const info = await stat9(path5, { bigint: true });
30647
30639
  if (info.ino === 0n) coarse = true;
30648
30640
  parts.push(
30649
30641
  `${info.dev}:${info.ino}:${info.size}:${info.mtimeNs}:${info.ctimeNs}`
@@ -31539,7 +31531,7 @@ var init_process_heartbeat = __esm({
31539
31531
  });
31540
31532
 
31541
31533
  // src/version-fence.ts
31542
- import { readdir as readdir2, readFile as readFile11, stat as stat9, unlink as unlink9 } from "node:fs/promises";
31534
+ import { readdir as readdir2, readFile as readFile11, stat as stat10, unlink as unlink9 } from "node:fs/promises";
31543
31535
  import { homedir as homedir3, uptime } from "node:os";
31544
31536
  import { join as join13 } from "node:path";
31545
31537
  function defaultStateHome() {
@@ -31659,7 +31651,7 @@ async function staleRecord(path5, record3, boot, heartbeat) {
31659
31651
  let start = heartbeat ? record3.startedAt : void 0;
31660
31652
  if (start === void 0) {
31661
31653
  try {
31662
- start = (await stat9(path5)).mtimeMs;
31654
+ start = (await stat10(path5)).mtimeMs;
31663
31655
  } catch {
31664
31656
  return false;
31665
31657
  }
@@ -31788,7 +31780,7 @@ import {
31788
31780
  readFile as readFile12,
31789
31781
  rename as rename10,
31790
31782
  rmdir as rmdir2,
31791
- stat as stat10,
31783
+ stat as stat11,
31792
31784
  unlink as unlink10
31793
31785
  } from "node:fs/promises";
31794
31786
  import { basename as basename4, dirname as dirname15, join as join14, resolve as resolve15 } from "node:path";
@@ -32707,7 +32699,7 @@ async function physicalAliases(location, files) {
32707
32699
  async function samePhysical(a, b) {
32708
32700
  const id = async (path5) => {
32709
32701
  try {
32710
- const info = await stat10(path5, { bigint: true });
32702
+ const info = await stat11(path5, { bigint: true });
32711
32703
  return info.ino === 0n ? void 0 : `${info.dev}:${info.ino}`;
32712
32704
  } catch (error) {
32713
32705
  const code2 = error.code;
@@ -32973,7 +32965,7 @@ function lockHolderText(name) {
32973
32965
  }
32974
32966
  async function exists2(path5) {
32975
32967
  try {
32976
- await stat10(path5);
32968
+ await stat11(path5);
32977
32969
  return true;
32978
32970
  } catch (error) {
32979
32971
  const code2 = error.code;
@@ -35017,7 +35009,7 @@ function extractAccountAccessErrorDetails(bodyText) {
35017
35009
  };
35018
35010
  }
35019
35011
  function buildAccountAccessProbeRequest(projectId) {
35020
- const wireModel = "gemini-3.5-flash-low";
35012
+ const wireModel = "gemini-3.8-flash-low";
35021
35013
  const request = {
35022
35014
  contents: [{ role: "user", parts: [{ text: "ping" }] }],
35023
35015
  generationConfig: { maxOutputTokens: 1, temperature: 0 }
@@ -43637,8 +43629,8 @@ function prepareAntigravityRequestIn(wire, input2, init, accessToken, projectId,
43637
43629
  } else {
43638
43630
  const requestPayload = { ...parsedBody };
43639
43631
  if (isImageGenerationModel(effectiveModel) && isOpenCodeTitleGenerationRequest(requestPayload)) {
43640
- effectiveModel = "gemini-3.5-flash-low";
43641
- tierThinkingBudget = 4e3;
43632
+ effectiveModel = "gemini-3.8-flash-low";
43633
+ tierThinkingBudget = 1e3;
43642
43634
  tierThinkingLevel = void 0;
43643
43635
  }
43644
43636
  const rawGenerationConfig = requestPayload.generationConfig;
@@ -45167,32 +45159,61 @@ function reportRouting(input2) {
45167
45159
  const report = handle.report;
45168
45160
  if (typeof report !== "function")
45169
45161
  return;
45170
- const identity3 = {
45171
- account_id: input2.accountId,
45172
- ...input2.credentialId !== void 0 ? { credential_id: input2.credentialId } : {}
45173
- };
45174
45162
  let payload;
45175
- switch (input2.outcome) {
45176
- case "served":
45177
- payload = { ...identity3, outcome: "served", headers: input2.headers };
45178
- break;
45179
- case "exhausted": {
45180
- const { window, pool } = input2;
45181
- if (window !== "5h" && window !== "7d")
45163
+ if ("kind" in input2) {
45164
+ switch (input2.kind) {
45165
+ case "turn_notes_supported": {
45166
+ const { model, supported } = input2;
45167
+ if (typeof model !== "string" || model.length === 0 || typeof supported !== "boolean")
45168
+ return;
45169
+ payload = {
45170
+ kind: "turn_notes_supported",
45171
+ model,
45172
+ supported
45173
+ };
45174
+ break;
45175
+ }
45176
+ case "turn_note_skipped": {
45177
+ const { after_tool_use_id, reason } = input2;
45178
+ if (typeof after_tool_use_id !== "string" || after_tool_use_id.length === 0 || reason !== "anchor_missing" && reason !== "before_user_message" && reason !== "unsupported_model" && reason !== "not_oauth")
45179
+ return;
45180
+ payload = {
45181
+ kind: "turn_note_skipped",
45182
+ after_tool_use_id,
45183
+ reason
45184
+ };
45185
+ break;
45186
+ }
45187
+ default:
45182
45188
  return;
45183
- if (pool !== void 0 && (typeof pool !== "string" || !/^[a-z0-9._-]{1,64}$/.test(pool)))
45189
+ }
45190
+ } else {
45191
+ const identity3 = {
45192
+ account_id: input2.accountId,
45193
+ ...input2.credentialId !== void 0 ? { credential_id: input2.credentialId } : {}
45194
+ };
45195
+ switch (input2.outcome) {
45196
+ case "served":
45197
+ payload = { ...identity3, outcome: "served", headers: input2.headers };
45198
+ break;
45199
+ case "exhausted": {
45200
+ const { window, pool } = input2;
45201
+ if (window !== "5h" && window !== "7d")
45202
+ return;
45203
+ if (pool !== void 0 && (typeof pool !== "string" || !/^[a-z0-9._-]{1,64}$/.test(pool)))
45204
+ return;
45205
+ payload = {
45206
+ ...identity3,
45207
+ outcome: "exhausted",
45208
+ window,
45209
+ ...pool ? { pool } : {},
45210
+ ...input2.resetsAt !== void 0 ? { resets_at: input2.resetsAt } : {}
45211
+ };
45212
+ break;
45213
+ }
45214
+ default:
45184
45215
  return;
45185
- payload = {
45186
- ...identity3,
45187
- outcome: "exhausted",
45188
- window,
45189
- ...pool ? { pool } : {},
45190
- ...input2.resetsAt !== void 0 ? { resets_at: input2.resetsAt } : {}
45191
- };
45192
- break;
45193
45216
  }
45194
- default:
45195
- return;
45196
45217
  }
45197
45218
  const pending = report.call(handle, payload);
45198
45219
  if (isObject2(pending) && typeof pending.then === "function") {
@@ -45939,7 +45960,7 @@ function prepareAgyWireRequest(wire, request) {
45939
45960
  request.options
45940
45961
  );
45941
45962
  }
45942
- var TITLE_FALLBACK_MODEL = "gemini-3.5-flash-low";
45963
+ var TITLE_FALLBACK_MODEL = "gemini-3.8-flash-low";
45943
45964
  function routeTitleModel(url) {
45944
45965
  const model = extractModelFromUrl(url);
45945
45966
  if (model === null) return url;
@@ -53638,16 +53659,16 @@ async function select2(terminal, items, options) {
53638
53659
  // src/common-auth-embedded/claustrum/enrollment.js
53639
53660
  import { createHash as createHash19, randomBytes as randomBytes6, randomUUID as randomUUID19 } from "node:crypto";
53640
53661
  import { constants as fsConstants2 } from "node:fs";
53641
- import { chmod as chmod6, mkdir as mkdir15, open as open10, readFile as readFile14, realpath as realpath4, rename as rename12, stat as stat12, unlink as unlink11 } from "node:fs/promises";
53662
+ import { chmod as chmod6, mkdir as mkdir15, open as open10, readFile as readFile14, realpath as realpath4, rename as rename12, stat as stat14, unlink as unlink11 } from "node:fs/promises";
53642
53663
  import { basename as basename6, dirname as dirname22, extname as extname2, isAbsolute as isAbsolute4, join as join26, resolve as resolve22 } from "node:path";
53643
53664
  import { ClaustrumCredentialError as ClaustrumCredentialError6, ClaustrumClient as ClaustrumWireClient2, writeEnrollmentTokenFile as writeEnrollmentTokenFile2 } from "@cortexkit/claustrum-client";
53644
53665
 
53645
53666
  // src/common-auth-embedded/fs/file-read-cache.js
53646
- import { lstat as lstat7 } from "node:fs/promises";
53667
+ import { lstat as lstat7, stat as stat12 } from "node:fs/promises";
53647
53668
  import { resolve as resolve21 } from "node:path";
53648
- async function identity2(path5) {
53669
+ async function identity2(path5, followSymlinks) {
53649
53670
  try {
53650
- const metadata = await lstat7(path5);
53671
+ const metadata = await (followSymlinks ? stat12(path5) : lstat7(path5));
53651
53672
  return metadata.isFile() ? metadata : void 0;
53652
53673
  } catch (error) {
53653
53674
  return error.code === "ENOENT" ? "absent" : void 0;
@@ -53659,11 +53680,15 @@ function sameIdentity2(left, right) {
53659
53680
  return left.dev === right.dev && left.ino === right.ino && left.size === right.size && left.mtimeMs === right.mtimeMs && left.ctimeMs === right.ctimeMs;
53660
53681
  }
53661
53682
  var FileReadCache2 = class {
53683
+ #followSymlinks;
53662
53684
  #entries = /* @__PURE__ */ new Map();
53685
+ constructor(options = {}) {
53686
+ this.#followSymlinks = options.followSymlinks ?? false;
53687
+ }
53663
53688
  async read(paths, read, validateHit) {
53664
53689
  const resolvedPaths = paths.map((path5) => resolve21(path5));
53665
53690
  const key = JSON.stringify(resolvedPaths);
53666
- const probed = await Promise.all(resolvedPaths.map(identity2));
53691
+ const probed = await Promise.all(resolvedPaths.map((path5) => identity2(path5, this.#followSymlinks)));
53667
53692
  const identities = probed.every((entry) => entry !== void 0) ? probed : void 0;
53668
53693
  const cached = this.#entries.get(key);
53669
53694
  if (identities && cached && identities.every((entry, index) => {
@@ -53712,7 +53737,7 @@ init_private_files2();
53712
53737
  // src/common-auth-embedded/fs/refresh-file-lock.js
53713
53738
  init_private_files2();
53714
53739
  import { randomUUID as randomUUID18 } from "node:crypto";
53715
- import { lstat as lstat8, mkdir as mkdir14, open as open9, readFile as readFile13, rename as rename11, rm as rm6, stat as stat11 } from "node:fs/promises";
53740
+ import { lstat as lstat8, mkdir as mkdir14, open as open9, readFile as readFile13, rename as rename11, rm as rm6, stat as stat13 } from "node:fs/promises";
53716
53741
  import { dirname as dirname21, join as join25 } from "node:path";
53717
53742
 
53718
53743
  // src/common-auth-embedded/fs/with-lock.js
@@ -53966,7 +53991,7 @@ async function acquireRefreshFileLockWithClock2(options) {
53966
53991
  };
53967
53992
  }
53968
53993
  try {
53969
- const current = await stat11(lockPath);
53994
+ const current = await stat13(lockPath);
53970
53995
  const legacyExpiry = Number.isFinite(expiresAt) ? expiresAt : current.mtimeMs + options.ttlMs;
53971
53996
  if (legacyExpiry > now())
53972
53997
  return { status: "live" };
@@ -54060,7 +54085,7 @@ async function acquireRefreshFileLockWithClock2(options) {
54060
54085
  if (!ownedDirectory)
54061
54086
  return false;
54062
54087
  try {
54063
- await stat11(evictOwnerPath);
54088
+ await stat13(evictOwnerPath);
54064
54089
  return false;
54065
54090
  } catch (error) {
54066
54091
  if (error.code !== "ENOENT")
@@ -54081,7 +54106,7 @@ async function acquireRefreshFileLockWithClock2(options) {
54081
54106
  return false;
54082
54107
  stillOurs = true;
54083
54108
  try {
54084
- await stat11(evictOwnerPath);
54109
+ await stat13(evictOwnerPath);
54085
54110
  return false;
54086
54111
  } catch (error) {
54087
54112
  return error.code === "ENOENT";
@@ -54131,7 +54156,7 @@ async function acquireRefreshFileLockWithClock2(options) {
54131
54156
  async function recoverStaleEvictionMarker(deadline) {
54132
54157
  let evictStat;
54133
54158
  try {
54134
- evictStat = await stat11(evictPath);
54159
+ evictStat = await stat13(evictPath);
54135
54160
  } catch (error) {
54136
54161
  if (error.code === "ENOENT")
54137
54162
  return "missing";
@@ -54149,7 +54174,7 @@ async function acquireRefreshFileLockWithClock2(options) {
54149
54174
  if (evictStat.mtimeMs + EVICT_TTL > now()) {
54150
54175
  let hasOwner = true;
54151
54176
  try {
54152
- await stat11(evictOwnerPath);
54177
+ await stat13(evictOwnerPath);
54153
54178
  } catch (error) {
54154
54179
  if (error.code === "ENOENT")
54155
54180
  hasOwner = false;
@@ -54766,7 +54791,7 @@ async function refuseWritableAncestor2(parent, options = {}) {
54766
54791
  }
54767
54792
  let privateGroup;
54768
54793
  for (; ; ) {
54769
- const metadata = await stat12(component).catch(() => void 0);
54794
+ const metadata = await stat14(component).catch(() => void 0);
54770
54795
  if (metadata && (metadata.mode & 18) !== 0 && (metadata.mode & 512) === 0) {
54771
54796
  if (privateGroup === void 0) {
54772
54797
  privateGroup = gid !== void 0 && await isPrivateGroup2(uid, gid, options);
@@ -54795,7 +54820,7 @@ async function ensureClaustrumPrivateDirectory2(directory, options = {}, what =
54795
54820
  return;
54796
54821
  }
54797
54822
  await mkdir15(directory, { recursive: true, mode: 448 });
54798
- const metadata = await stat12(directory);
54823
+ const metadata = await stat14(directory);
54799
54824
  const uid = process.geteuid?.();
54800
54825
  if (uid !== void 0 && metadata.uid !== uid) {
54801
54826
  throw new ClaustrumConsumerError2("unsafe-file", `Claustrum ${what} must be owned by the current user`);
@@ -55384,7 +55409,7 @@ function setupPaths(io = {}) {
55384
55409
  }
55385
55410
 
55386
55411
  // src/common-auth-embedded/setup/detect.js
55387
- function stat13(path5, kind) {
55412
+ function stat15(path5, kind) {
55388
55413
  try {
55389
55414
  return statSync5(path5)[kind]();
55390
55415
  } catch {
@@ -55393,12 +55418,12 @@ function stat13(path5, kind) {
55393
55418
  }
55394
55419
  var defaultSetupFileSystem = {
55395
55420
  exists: existsSync12,
55396
- isFile: (path5) => stat13(path5, "isFile"),
55397
- isDirectory: (path5) => stat13(path5, "isDirectory"),
55421
+ isFile: (path5) => stat15(path5, "isFile"),
55422
+ isDirectory: (path5) => stat15(path5, "isDirectory"),
55398
55423
  isExecutable(path5) {
55399
55424
  try {
55400
55425
  accessSync(path5, constants3.X_OK);
55401
- return stat13(path5, "isFile");
55426
+ return stat15(path5, "isFile");
55402
55427
  } catch {
55403
55428
  return false;
55404
55429
  }
@@ -55897,6 +55922,12 @@ async function connectSetupHost(plugin2, host, io, terminal, fence) {
55897
55922
  await writeEnrollmentTokenFile3(path5, file);
55898
55923
  }
55899
55924
  });
55925
+ await fence();
55926
+ const initial = await manager.status();
55927
+ if (initial.state === "approved") {
55928
+ printLine2(terminal, `Already connected as ${initial.approvedName ?? initial.proposedName}.`);
55929
+ return;
55930
+ }
55900
55931
  printLine2(terminal, `Asking the vault to connect ${name}\u2026`);
55901
55932
  const deadline = now() + ENROLLMENT_WAIT_MS;
55902
55933
  let printedRequest;
@@ -55904,7 +55935,6 @@ async function connectSetupHost(plugin2, host, io, terminal, fence) {
55904
55935
  let reportedCode;
55905
55936
  let failedProposals = 0;
55906
55937
  for (; ; ) {
55907
- await fence();
55908
55938
  const status = await manager.reconcile();
55909
55939
  if (status.state === "approved") {
55910
55940
  printLine2(terminal, `Connected ${host} to Claustrum.`);
@@ -55950,6 +55980,7 @@ async function connectSetupHost(plugin2, host, io, terminal, fence) {
55950
55980
  if (remaining <= 0)
55951
55981
  break;
55952
55982
  await wait2(Math.min(pause, remaining));
55983
+ await fence();
55953
55984
  }
55954
55985
  if (printedRequest)
55955
55986
  throw new HostNotEnrolledError(`Claustrum approval is still pending. In another terminal, run: ${approveCommand(printedRequest, name)} and then rerun setup.`, {
@@ -56104,7 +56135,7 @@ import { applyEdits, createScanner, findNodeAtLocation, modify, parse as parse2,
56104
56135
 
56105
56136
  // src/common-auth-embedded/setup/config-write.js
56106
56137
  import { randomUUID as randomUUID20 } from "node:crypto";
56107
- import { mkdir as mkdir16, open as open11, rename as rename13, stat as stat14, unlink as unlink12 } from "node:fs/promises";
56138
+ import { mkdir as mkdir16, open as open11, rename as rename13, stat as stat16, unlink as unlink12 } from "node:fs/promises";
56108
56139
  import { basename as basename7, dirname as dirname23, join as join28 } from "node:path";
56109
56140
  import { setTimeout as delay2 } from "node:timers/promises";
56110
56141
  async function writeHostConfigAtomic(file, content, options = {}) {
@@ -56114,7 +56145,7 @@ async function writeHostConfigAtomic(file, content, options = {}) {
56114
56145
  let mode;
56115
56146
  if (!windows2) {
56116
56147
  try {
56117
- mode = (await stat14(file)).mode & 4095;
56148
+ mode = (await stat16(file)).mode & 4095;
56118
56149
  } catch (error) {
56119
56150
  if (error.code !== "ENOENT")
56120
56151
  throw error;
@@ -57818,8 +57849,8 @@ function getLocalDevPath(directory) {
57818
57849
  }
57819
57850
  function findPackageJsonUp(startPath) {
57820
57851
  try {
57821
- const stat16 = fs4.statSync(startPath);
57822
- let dir = stat16.isDirectory() ? startPath : path4.dirname(startPath);
57852
+ const stat18 = fs4.statSync(startPath);
57853
+ let dir = stat18.isDirectory() ? startPath : path4.dirname(startPath);
57823
57854
  for (let i = 0; i < 10; i++) {
57824
57855
  const pkgPath = path4.join(dir, "package.json");
57825
57856
  if (fs4.existsSync(pkgPath)) {
@@ -58149,7 +58180,7 @@ function isSessionId(value) {
58149
58180
  // src/common-auth-embedded/rpc/port-file.js
58150
58181
  init_private_files2();
58151
58182
  import { createHash as createHash21, randomUUID as randomUUID21 } from "node:crypto";
58152
- import { chmod as chmod7, mkdir as mkdir17, open as open12, readdir as readdir4, rename as rename14, rmdir as rmdir3, stat as stat15, unlink as unlink13 } from "node:fs/promises";
58183
+ import { chmod as chmod7, mkdir as mkdir17, open as open12, readdir as readdir4, rename as rename14, rmdir as rmdir3, stat as stat17, unlink as unlink13 } from "node:fs/promises";
58153
58184
  import { uptime as uptime2 } from "node:os";
58154
58185
  import { join as join35, resolve as resolve26 } from "node:path";
58155
58186
  function staleBefore(clock2) {
@@ -58165,7 +58196,7 @@ async function removeStalePortFile(path5, raw, info, beforeRemove2) {
58165
58196
  await beforeRemove2?.(path5);
58166
58197
  try {
58167
58198
  const current = await readPrivateText2(path5);
58168
- const identity3 = await stat15(path5);
58199
+ const identity3 = await stat17(path5);
58169
58200
  if (current === raw && identity3.dev === info.dev && identity3.ino === info.ino && identity3.mtimeMs === info.mtimeMs && identity3.size === info.size)
58170
58201
  await unlink13(path5).catch(() => {
58171
58202
  });
@@ -58279,7 +58310,7 @@ async function sweepRpcState(root, activeDir, isManagedDir, log17, options = {})
58279
58310
  if (!name.startsWith("port-") || !name.endsWith(".json"))
58280
58311
  continue;
58281
58312
  const portFile = join35(dir, name);
58282
- const info = await stat15(portFile).catch(() => void 0);
58313
+ const info = await stat17(portFile).catch(() => void 0);
58283
58314
  let raw;
58284
58315
  try {
58285
58316
  raw = await readPrivateText2(portFile);