@cortexkit/opencode-antigravity-auth 3.0.30 → 3.0.31

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 (71) 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 +120 -118
  5. package/dist/index.js.map +3 -3
  6. package/dist/index.meta.json +26 -21
  7. package/dist/server.js +120 -118
  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/setup/enroll.js +7 -1
  22. package/dist/src/common-auth-embedded/source-output.json +57 -57
  23. package/dist/src/common-auth-embedded/store/index.d.ts +1 -1
  24. package/dist/src/common-auth-embedded/store/limits-namespace.d.ts +7 -1
  25. package/dist/src/common-auth-embedded/store/limits-namespace.js +19 -7
  26. package/dist/src/common-auth-embedded/store/pool.d.ts +1 -1
  27. package/dist/src/common-auth-embedded/store/pool.js +1 -1
  28. package/dist/src/plugin/__fixtures__/release-model-ids.d.ts.map +1 -1
  29. package/dist/src/plugin/__fixtures__/release-model-ids.js +0 -1
  30. package/dist/src/plugin/__fixtures__/release-model-ids.js.map +1 -1
  31. package/dist/src/plugin/__fixtures__/verified-store.js +2 -2
  32. package/dist/src/plugin/account-access.js +1 -1
  33. package/dist/src/plugin/request.d.ts.map +1 -1
  34. package/dist/src/plugin/request.js +3 -2
  35. package/dist/src/plugin/request.js.map +1 -1
  36. package/dist/src/plugin/shared/request-services.d.ts +1 -1
  37. package/dist/src/plugin/shared/request-services.js +1 -1
  38. package/dist/tui-build-map.json +1 -1
  39. package/dist/tui-ga-build-map.json +1 -1
  40. package/dist/types/src/common-auth-embedded/claustrum/roster.d.ts +2 -0
  41. package/dist/types/src/common-auth-embedded/limits/axes.d.ts +7 -1
  42. package/dist/types/src/common-auth-embedded/limits/decide.d.ts +5 -0
  43. package/dist/types/src/common-auth-embedded/limits/families.d.ts +4 -2
  44. package/dist/types/src/common-auth-embedded/limits/marker.d.ts +5 -0
  45. package/dist/types/src/common-auth-embedded/limits/request-history.d.ts +3 -1
  46. package/dist/types/src/common-auth-embedded/opencode2/install.d.ts +2 -1
  47. package/dist/types/src/common-auth-embedded/opencode2/types.d.ts +19 -3
  48. package/dist/types/src/common-auth-embedded/store/index.d.ts +1 -1
  49. package/dist/types/src/common-auth-embedded/store/limits-namespace.d.ts +7 -1
  50. package/dist/types/src/common-auth-embedded/store/pool.d.ts +1 -1
  51. package/dist/types/src/plugin/request.d.ts.map +1 -1
  52. package/dist/types/src/plugin/shared/request-services.d.ts +1 -1
  53. package/package.json +3 -3
  54. package/src/common-auth-embedded/claustrum/roster.d.ts +2 -0
  55. package/src/common-auth-embedded/claustrum/roster.js +32 -8
  56. package/src/common-auth-embedded/fs/file-read-cache.js +10 -5
  57. package/src/common-auth-embedded/limits/axes.d.ts +7 -1
  58. package/src/common-auth-embedded/limits/decide.d.ts +5 -0
  59. package/src/common-auth-embedded/limits/families.d.ts +4 -2
  60. package/src/common-auth-embedded/limits/marker.d.ts +5 -0
  61. package/src/common-auth-embedded/limits/request-history.d.ts +3 -1
  62. package/src/common-auth-embedded/opencode2/install.d.ts +2 -1
  63. package/src/common-auth-embedded/opencode2/install.js +58 -9
  64. package/src/common-auth-embedded/opencode2/types.d.ts +19 -3
  65. package/src/common-auth-embedded/setup/enroll.js +7 -1
  66. package/src/common-auth-embedded/source-output.json +57 -57
  67. package/src/common-auth-embedded/store/index.d.ts +1 -1
  68. package/src/common-auth-embedded/store/limits-namespace.d.ts +7 -1
  69. package/src/common-auth-embedded/store/limits-namespace.js +19 -7
  70. package/src/common-auth-embedded/store/pool.d.ts +1 -1
  71. package/src/common-auth-embedded/store/pool.js +1 -1
package/dist/index.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
  }
@@ -31884,7 +31876,7 @@ import {
31884
31876
  readFile as readFile12,
31885
31877
  rename as rename10,
31886
31878
  rmdir as rmdir2,
31887
- stat as stat10,
31879
+ stat as stat11,
31888
31880
  unlink as unlink10
31889
31881
  } from "node:fs/promises";
31890
31882
  import { basename as basename4, dirname as dirname15, join as join14, resolve as resolve15 } from "node:path";
@@ -32803,7 +32795,7 @@ async function physicalAliases(location, files) {
32803
32795
  async function samePhysical(a, b) {
32804
32796
  const id = async (path5) => {
32805
32797
  try {
32806
- const info = await stat10(path5, { bigint: true });
32798
+ const info = await stat11(path5, { bigint: true });
32807
32799
  return info.ino === 0n ? void 0 : `${info.dev}:${info.ino}`;
32808
32800
  } catch (error) {
32809
32801
  const code2 = error.code;
@@ -33069,7 +33061,7 @@ function lockHolderText(name) {
33069
33061
  }
33070
33062
  async function exists2(path5) {
33071
33063
  try {
33072
- await stat10(path5);
33064
+ await stat11(path5);
33073
33065
  return true;
33074
33066
  } catch (error) {
33075
33067
  const code2 = error.code;
@@ -37059,16 +37051,16 @@ async function select2(terminal, items, options) {
37059
37051
  // src/common-auth-embedded/claustrum/enrollment.js
37060
37052
  import { createHash as createHash13, randomBytes as randomBytes5, randomUUID as randomUUID17 } from "node:crypto";
37061
37053
  import { constants as fsConstants2 } from "node:fs";
37062
- 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";
37054
+ 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";
37063
37055
  import { basename as basename5, dirname as dirname20, extname as extname2, isAbsolute as isAbsolute4, join as join20, resolve as resolve19 } from "node:path";
37064
37056
  import { ClaustrumCredentialError as ClaustrumCredentialError6, ClaustrumClient as ClaustrumWireClient2, writeEnrollmentTokenFile as writeEnrollmentTokenFile2 } from "@cortexkit/claustrum-client";
37065
37057
 
37066
37058
  // src/common-auth-embedded/fs/file-read-cache.js
37067
- import { lstat as lstat7 } from "node:fs/promises";
37059
+ import { lstat as lstat7, stat as stat12 } from "node:fs/promises";
37068
37060
  import { resolve as resolve18 } from "node:path";
37069
- async function identity2(path5) {
37061
+ async function identity2(path5, followSymlinks) {
37070
37062
  try {
37071
- const metadata = await lstat7(path5);
37063
+ const metadata = await (followSymlinks ? stat12(path5) : lstat7(path5));
37072
37064
  return metadata.isFile() ? metadata : void 0;
37073
37065
  } catch (error) {
37074
37066
  return error.code === "ENOENT" ? "absent" : void 0;
@@ -37080,11 +37072,15 @@ function sameIdentity2(left, right) {
37080
37072
  return left.dev === right.dev && left.ino === right.ino && left.size === right.size && left.mtimeMs === right.mtimeMs && left.ctimeMs === right.ctimeMs;
37081
37073
  }
37082
37074
  var FileReadCache2 = class {
37075
+ #followSymlinks;
37083
37076
  #entries = /* @__PURE__ */ new Map();
37077
+ constructor(options = {}) {
37078
+ this.#followSymlinks = options.followSymlinks ?? false;
37079
+ }
37084
37080
  async read(paths, read, validateHit) {
37085
37081
  const resolvedPaths = paths.map((path5) => resolve18(path5));
37086
37082
  const key = JSON.stringify(resolvedPaths);
37087
- const probed = await Promise.all(resolvedPaths.map(identity2));
37083
+ const probed = await Promise.all(resolvedPaths.map((path5) => identity2(path5, this.#followSymlinks)));
37088
37084
  const identities = probed.every((entry) => entry !== void 0) ? probed : void 0;
37089
37085
  const cached = this.#entries.get(key);
37090
37086
  if (identities && cached && identities.every((entry, index) => {
@@ -37133,7 +37129,7 @@ init_private_files2();
37133
37129
  // src/common-auth-embedded/fs/refresh-file-lock.js
37134
37130
  init_private_files2();
37135
37131
  import { randomUUID as randomUUID16 } from "node:crypto";
37136
- 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";
37132
+ 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";
37137
37133
  import { dirname as dirname19, join as join19 } from "node:path";
37138
37134
 
37139
37135
  // src/common-auth-embedded/fs/with-lock.js
@@ -37387,7 +37383,7 @@ async function acquireRefreshFileLockWithClock2(options) {
37387
37383
  };
37388
37384
  }
37389
37385
  try {
37390
- const current = await stat11(lockPath);
37386
+ const current = await stat13(lockPath);
37391
37387
  const legacyExpiry = Number.isFinite(expiresAt) ? expiresAt : current.mtimeMs + options.ttlMs;
37392
37388
  if (legacyExpiry > now())
37393
37389
  return { status: "live" };
@@ -37481,7 +37477,7 @@ async function acquireRefreshFileLockWithClock2(options) {
37481
37477
  if (!ownedDirectory)
37482
37478
  return false;
37483
37479
  try {
37484
- await stat11(evictOwnerPath);
37480
+ await stat13(evictOwnerPath);
37485
37481
  return false;
37486
37482
  } catch (error) {
37487
37483
  if (error.code !== "ENOENT")
@@ -37502,7 +37498,7 @@ async function acquireRefreshFileLockWithClock2(options) {
37502
37498
  return false;
37503
37499
  stillOurs = true;
37504
37500
  try {
37505
- await stat11(evictOwnerPath);
37501
+ await stat13(evictOwnerPath);
37506
37502
  return false;
37507
37503
  } catch (error) {
37508
37504
  return error.code === "ENOENT";
@@ -37552,7 +37548,7 @@ async function acquireRefreshFileLockWithClock2(options) {
37552
37548
  async function recoverStaleEvictionMarker(deadline) {
37553
37549
  let evictStat;
37554
37550
  try {
37555
- evictStat = await stat11(evictPath);
37551
+ evictStat = await stat13(evictPath);
37556
37552
  } catch (error) {
37557
37553
  if (error.code === "ENOENT")
37558
37554
  return "missing";
@@ -37570,7 +37566,7 @@ async function acquireRefreshFileLockWithClock2(options) {
37570
37566
  if (evictStat.mtimeMs + EVICT_TTL > now()) {
37571
37567
  let hasOwner = true;
37572
37568
  try {
37573
- await stat11(evictOwnerPath);
37569
+ await stat13(evictOwnerPath);
37574
37570
  } catch (error) {
37575
37571
  if (error.code === "ENOENT")
37576
37572
  hasOwner = false;
@@ -38187,7 +38183,7 @@ async function refuseWritableAncestor2(parent, options = {}) {
38187
38183
  }
38188
38184
  let privateGroup;
38189
38185
  for (; ; ) {
38190
- const metadata = await stat12(component).catch(() => void 0);
38186
+ const metadata = await stat14(component).catch(() => void 0);
38191
38187
  if (metadata && (metadata.mode & 18) !== 0 && (metadata.mode & 512) === 0) {
38192
38188
  if (privateGroup === void 0) {
38193
38189
  privateGroup = gid !== void 0 && await isPrivateGroup2(uid, gid, options);
@@ -38216,7 +38212,7 @@ async function ensureClaustrumPrivateDirectory2(directory, options = {}, what =
38216
38212
  return;
38217
38213
  }
38218
38214
  await mkdir15(directory, { recursive: true, mode: 448 });
38219
- const metadata = await stat12(directory);
38215
+ const metadata = await stat14(directory);
38220
38216
  const uid = process.geteuid?.();
38221
38217
  if (uid !== void 0 && metadata.uid !== uid) {
38222
38218
  throw new ClaustrumConsumerError2("unsafe-file", `Claustrum ${what} must be owned by the current user`);
@@ -38805,7 +38801,7 @@ function setupPaths(io = {}) {
38805
38801
  }
38806
38802
 
38807
38803
  // src/common-auth-embedded/setup/detect.js
38808
- function stat13(path5, kind) {
38804
+ function stat15(path5, kind) {
38809
38805
  try {
38810
38806
  return statSync5(path5)[kind]();
38811
38807
  } catch {
@@ -38814,12 +38810,12 @@ function stat13(path5, kind) {
38814
38810
  }
38815
38811
  var defaultSetupFileSystem = {
38816
38812
  exists: existsSync6,
38817
- isFile: (path5) => stat13(path5, "isFile"),
38818
- isDirectory: (path5) => stat13(path5, "isDirectory"),
38813
+ isFile: (path5) => stat15(path5, "isFile"),
38814
+ isDirectory: (path5) => stat15(path5, "isDirectory"),
38819
38815
  isExecutable(path5) {
38820
38816
  try {
38821
38817
  accessSync(path5, constants3.X_OK);
38822
- return stat13(path5, "isFile");
38818
+ return stat15(path5, "isFile");
38823
38819
  } catch {
38824
38820
  return false;
38825
38821
  }
@@ -39318,6 +39314,12 @@ async function connectSetupHost(plugin, host, io, terminal, fence) {
39318
39314
  await writeEnrollmentTokenFile3(path5, file);
39319
39315
  }
39320
39316
  });
39317
+ await fence();
39318
+ const initial = await manager.status();
39319
+ if (initial.state === "approved") {
39320
+ printLine2(terminal, `Already connected as ${initial.approvedName ?? initial.proposedName}.`);
39321
+ return;
39322
+ }
39321
39323
  printLine2(terminal, `Asking the vault to connect ${name}\u2026`);
39322
39324
  const deadline = now() + ENROLLMENT_WAIT_MS;
39323
39325
  let printedRequest;
@@ -39325,7 +39327,6 @@ async function connectSetupHost(plugin, host, io, terminal, fence) {
39325
39327
  let reportedCode;
39326
39328
  let failedProposals = 0;
39327
39329
  for (; ; ) {
39328
- await fence();
39329
39330
  const status = await manager.reconcile();
39330
39331
  if (status.state === "approved") {
39331
39332
  printLine2(terminal, `Connected ${host} to Claustrum.`);
@@ -39371,6 +39372,7 @@ async function connectSetupHost(plugin, host, io, terminal, fence) {
39371
39372
  if (remaining <= 0)
39372
39373
  break;
39373
39374
  await wait2(Math.min(pause, remaining));
39375
+ await fence();
39374
39376
  }
39375
39377
  if (printedRequest)
39376
39378
  throw new HostNotEnrolledError(`Claustrum approval is still pending. In another terminal, run: ${approveCommand(printedRequest, name)} and then rerun setup.`, {
@@ -39525,7 +39527,7 @@ import { applyEdits, createScanner, findNodeAtLocation, modify, parse as parse2,
39525
39527
 
39526
39528
  // src/common-auth-embedded/setup/config-write.js
39527
39529
  import { randomUUID as randomUUID18 } from "node:crypto";
39528
- import { mkdir as mkdir16, open as open11, rename as rename13, stat as stat14, unlink as unlink12 } from "node:fs/promises";
39530
+ import { mkdir as mkdir16, open as open11, rename as rename13, stat as stat16, unlink as unlink12 } from "node:fs/promises";
39529
39531
  import { basename as basename6, dirname as dirname21, join as join22 } from "node:path";
39530
39532
  import { setTimeout as delay2 } from "node:timers/promises";
39531
39533
  async function writeHostConfigAtomic(file, content, options = {}) {
@@ -39535,7 +39537,7 @@ async function writeHostConfigAtomic(file, content, options = {}) {
39535
39537
  let mode;
39536
39538
  if (!windows2) {
39537
39539
  try {
39538
- mode = (await stat14(file)).mode & 4095;
39540
+ mode = (await stat16(file)).mode & 4095;
39539
39541
  } catch (error) {
39540
39542
  if (error.code !== "ENOENT")
39541
39543
  throw error;
@@ -41239,8 +41241,8 @@ function getLocalDevPath(directory) {
41239
41241
  }
41240
41242
  function findPackageJsonUp(startPath) {
41241
41243
  try {
41242
- const stat16 = fs4.statSync(startPath);
41243
- let dir = stat16.isDirectory() ? startPath : path4.dirname(startPath);
41244
+ const stat18 = fs4.statSync(startPath);
41245
+ let dir = stat18.isDirectory() ? startPath : path4.dirname(startPath);
41244
41246
  for (let i = 0; i < 10; i++) {
41245
41247
  const pkgPath = path4.join(dir, "package.json");
41246
41248
  if (fs4.existsSync(pkgPath)) {
@@ -41570,7 +41572,7 @@ function isSessionId(value) {
41570
41572
  // src/common-auth-embedded/rpc/port-file.js
41571
41573
  init_private_files2();
41572
41574
  import { createHash as createHash15, randomUUID as randomUUID19 } from "node:crypto";
41573
- 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";
41575
+ 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";
41574
41576
  import { uptime as uptime2 } from "node:os";
41575
41577
  import { join as join29, resolve as resolve23 } from "node:path";
41576
41578
  function staleBefore(clock2) {
@@ -41586,7 +41588,7 @@ async function removeStalePortFile(path5, raw, info, beforeRemove2) {
41586
41588
  await beforeRemove2?.(path5);
41587
41589
  try {
41588
41590
  const current = await readPrivateText2(path5);
41589
- const identity3 = await stat15(path5);
41591
+ const identity3 = await stat17(path5);
41590
41592
  if (current === raw && identity3.dev === info.dev && identity3.ino === info.ino && identity3.mtimeMs === info.mtimeMs && identity3.size === info.size)
41591
41593
  await unlink13(path5).catch(() => {
41592
41594
  });
@@ -41700,7 +41702,7 @@ async function sweepRpcState(root, activeDir, isManagedDir, log17, options = {})
41700
41702
  if (!name.startsWith("port-") || !name.endsWith(".json"))
41701
41703
  continue;
41702
41704
  const portFile = join29(dir, name);
41703
- const info = await stat15(portFile).catch(() => void 0);
41705
+ const info = await stat17(portFile).catch(() => void 0);
41704
41706
  let raw;
41705
41707
  try {
41706
41708
  raw = await readPrivateText2(portFile);
@@ -42365,7 +42367,7 @@ function extractAccountAccessErrorDetails(bodyText) {
42365
42367
  };
42366
42368
  }
42367
42369
  function buildAccountAccessProbeRequest(projectId) {
42368
- const wireModel = "gemini-3.5-flash-low";
42370
+ const wireModel = "gemini-3.8-flash-low";
42369
42371
  const request = {
42370
42372
  contents: [{ role: "user", parts: [{ text: "ping" }] }],
42371
42373
  generationConfig: { maxOutputTokens: 1, temperature: 0 }
@@ -51267,8 +51269,8 @@ function prepareAntigravityRequestIn(wire, input2, init, accessToken, projectId,
51267
51269
  } else {
51268
51270
  const requestPayload = { ...parsedBody };
51269
51271
  if (isImageGenerationModel(effectiveModel) && isOpenCodeTitleGenerationRequest(requestPayload)) {
51270
- effectiveModel = "gemini-3.5-flash-low";
51271
- tierThinkingBudget = 4e3;
51272
+ effectiveModel = "gemini-3.8-flash-low";
51273
+ tierThinkingBudget = 1e3;
51272
51274
  tierThinkingLevel = void 0;
51273
51275
  }
51274
51276
  const rawGenerationConfig = requestPayload.generationConfig;
@@ -55162,7 +55164,7 @@ function prepareAgyWireRequest(wire, request) {
55162
55164
  request.options
55163
55165
  );
55164
55166
  }
55165
- var TITLE_FALLBACK_MODEL = "gemini-3.5-flash-low";
55167
+ var TITLE_FALLBACK_MODEL = "gemini-3.8-flash-low";
55166
55168
  function routeTitleModel(url) {
55167
55169
  const model = extractModelFromUrl(url);
55168
55170
  if (model === null) return url;