@cortexkit/opencode-antigravity-auth 3.0.21 → 3.0.22

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 (80) hide show
  1. package/dist/cli.js +279 -246
  2. package/dist/cli.js.map +3 -3
  3. package/dist/cli.meta.json +38 -13
  4. package/dist/index.js +766 -360
  5. package/dist/index.js.map +4 -4
  6. package/dist/index.meta.json +95 -20
  7. package/dist/server.js +785 -379
  8. package/dist/server.js.map +4 -4
  9. package/dist/server.meta.json +1 -1
  10. package/dist/src/common-auth-embedded/fs/refresh-file-lock.js +2 -2
  11. package/dist/src/common-auth-embedded/fs/with-lock.js +37 -10
  12. package/dist/src/common-auth-embedded/quota/format.d.ts +9 -4
  13. package/dist/src/common-auth-embedded/quota/format.js +45 -26
  14. package/dist/src/common-auth-embedded/quota-sidebar/index.tsx +56 -32
  15. package/dist/src/common-auth-embedded/routing-accessor/index.d.ts +62 -0
  16. package/dist/src/common-auth-embedded/routing-accessor/index.js +128 -0
  17. package/dist/src/common-auth-embedded/source-output.json +42 -22
  18. package/dist/src/plugin/__fixtures__/verified-store.js +2 -2
  19. package/dist/src/plugin/index.d.ts.map +1 -1
  20. package/dist/src/plugin/index.js +2 -0
  21. package/dist/src/plugin/index.js.map +1 -1
  22. package/dist/src/plugin/request.d.ts.map +1 -1
  23. package/dist/src/plugin/request.js +1 -0
  24. package/dist/src/plugin/request.js.map +1 -1
  25. package/dist/src/plugin/shared/request-services.d.ts +6 -0
  26. package/dist/src/plugin/shared/request-services.d.ts.map +1 -1
  27. package/dist/src/plugin/shared/request-services.js +89 -2
  28. package/dist/src/plugin/shared/request-services.js.map +1 -1
  29. package/dist/src/plugin/shared/vault-request-credentials.d.ts.map +1 -1
  30. package/dist/src/plugin/shared/vault-request-credentials.js +4 -0
  31. package/dist/src/plugin/shared/vault-request-credentials.js.map +1 -1
  32. package/dist/src/plugin/shared/vault-routing-purpose.d.ts +12 -0
  33. package/dist/src/plugin/shared/vault-routing-purpose.d.ts.map +1 -0
  34. package/dist/src/plugin/shared/vault-routing-purpose.js +18 -0
  35. package/dist/src/plugin/shared/vault-routing-purpose.js.map +1 -0
  36. package/dist/src/plugin/shared/vault-routing.d.ts +36 -0
  37. package/dist/src/plugin/shared/vault-routing.d.ts.map +1 -0
  38. package/dist/src/plugin/shared/vault-routing.js +213 -0
  39. package/dist/src/plugin/shared/vault-routing.js.map +1 -0
  40. package/dist/src/plugin/types.d.ts +1 -0
  41. package/dist/src/plugin/types.d.ts.map +1 -1
  42. package/dist/src/tui/sidebar-frame.d.ts.map +1 -1
  43. package/dist/src/tui/sidebar-frame.js +18 -16
  44. package/dist/src/tui/sidebar-frame.js.map +1 -1
  45. package/dist/tui-build-map.json +13 -13
  46. package/dist/tui-ga-build-map.json +13 -13
  47. package/dist/types/src/common-auth-embedded/quota/format.d.ts +9 -4
  48. package/dist/types/src/common-auth-embedded/routing-accessor/index.d.ts +62 -0
  49. package/dist/types/src/plugin/index.d.ts.map +1 -1
  50. package/dist/types/src/plugin/request.d.ts.map +1 -1
  51. package/dist/types/src/plugin/shared/request-services.d.ts +6 -0
  52. package/dist/types/src/plugin/shared/request-services.d.ts.map +1 -1
  53. package/dist/types/src/plugin/shared/vault-request-credentials.d.ts.map +1 -1
  54. package/dist/types/src/plugin/shared/vault-routing-purpose.d.ts +12 -0
  55. package/dist/types/src/plugin/shared/vault-routing-purpose.d.ts.map +1 -0
  56. package/dist/types/src/plugin/shared/vault-routing.d.ts +36 -0
  57. package/dist/types/src/plugin/shared/vault-routing.d.ts.map +1 -0
  58. package/dist/types/src/plugin/types.d.ts +1 -0
  59. package/dist/types/src/plugin/types.d.ts.map +1 -1
  60. package/package.json +2 -2
  61. package/src/common-auth-embedded/fs/refresh-file-lock.js +2 -2
  62. package/src/common-auth-embedded/fs/with-lock.js +37 -10
  63. package/src/common-auth-embedded/quota/format.d.ts +9 -4
  64. package/src/common-auth-embedded/quota/format.js +45 -26
  65. package/src/common-auth-embedded/quota-sidebar/index.tsx +56 -32
  66. package/src/common-auth-embedded/routing-accessor/index.d.ts +62 -0
  67. package/src/common-auth-embedded/routing-accessor/index.js +128 -0
  68. package/src/common-auth-embedded/source-output.json +42 -22
  69. package/src/tui-compiled/common-auth-embedded/quota/format.js +45 -26
  70. package/src/tui-compiled/common-auth-embedded/quota-sidebar/index.js +165 -148
  71. package/src/tui-compiled/tui/sidebar-frame.js +17 -16
  72. package/src/tui-ga-compiled/shared/aef2402f8fc342f0-format.js +45 -26
  73. package/src/tui-ga-compiled/shared/ced204104a639c9c-sidebar-frame.js +17 -16
  74. package/src/tui-ga-compiled/shared/e4ec36f367492969-index.js +165 -148
  75. package/src/tui-ga-raw/shared/aef2402f8fc342f0-format.js +45 -26
  76. package/src/tui-ga-raw/shared/ced204104a639c9c-sidebar-frame.tsx +21 -19
  77. package/src/tui-ga-raw/shared/e4ec36f367492969-index.tsx +56 -32
  78. package/src/tui-raw/common-auth-embedded/quota/format.js +45 -26
  79. package/src/tui-raw/common-auth-embedded/quota-sidebar/index.tsx +56 -32
  80. package/src/tui-raw/tui/sidebar-frame.tsx +21 -19
package/dist/cli.js CHANGED
@@ -6046,7 +6046,7 @@ async function rmEvictingDir(evictingPath) {
6046
6046
  });
6047
6047
  }
6048
6048
  async function sleep(ms) {
6049
- await new Promise((resolve21) => setTimeout(resolve21, ms));
6049
+ await new Promise((resolve22) => setTimeout(resolve22, ms));
6050
6050
  }
6051
6051
  async function acquireFencedFileLock(options) {
6052
6052
  const lockPath = `${options.path}.${options.name}.lock`;
@@ -6162,8 +6162,8 @@ function buildLock(lockPath, evictingPath, ownerId, options, now) {
6162
6162
  let released = false;
6163
6163
  let lost = false;
6164
6164
  let lostResolve = null;
6165
- let lostPromise = new Promise((resolve21) => {
6166
- lostResolve = resolve21;
6165
+ let lostPromise = new Promise((resolve22) => {
6166
+ lostResolve = resolve22;
6167
6167
  });
6168
6168
  const markLost = () => {
6169
6169
  if (lost)
@@ -6173,9 +6173,9 @@ function buildLock(lockPath, evictingPath, ownerId, options, now) {
6173
6173
  clearInterval(renewTimer);
6174
6174
  renewTimer = null;
6175
6175
  }
6176
- const resolve21 = lostResolve;
6176
+ const resolve22 = lostResolve;
6177
6177
  lostResolve = null;
6178
- resolve21?.();
6178
+ resolve22?.();
6179
6179
  };
6180
6180
  const setupRenew = () => {
6181
6181
  if (options.renew === false)
@@ -6817,7 +6817,7 @@ var init_account_storage = __esm({
6817
6817
  }
6818
6818
  };
6819
6819
  RETRY_DELAYS_MS = [100, 200, 400, 800, 1e3];
6820
- DEFAULT_SLEEP = (ms) => new Promise((resolve21) => setTimeout(resolve21, ms));
6820
+ DEFAULT_SLEEP = (ms) => new Promise((resolve22) => setTimeout(resolve22, ms));
6821
6821
  DEFAULT_BUILD_BACKUP_PATH = (path2, now) => `${path2}.corrupt-${now.toISOString().replace(/[:.]/g, "-")}`;
6822
6822
  }
6823
6823
  });
@@ -6985,7 +6985,7 @@ function getHttpsProxy(url) {
6985
6985
  }
6986
6986
  }
6987
6987
  function waitForHead(socket, timeoutMs, onTimeout) {
6988
- return new Promise((resolve21, reject) => {
6988
+ return new Promise((resolve22, reject) => {
6989
6989
  let buffer = Buffer2.alloc(0);
6990
6990
  const timeout = setTimeout(() => {
6991
6991
  onTimeout();
@@ -7008,7 +7008,7 @@ function waitForHead(socket, timeoutMs, onTimeout) {
7008
7008
  return;
7009
7009
  const head = buffer.subarray(0, marker).toString("latin1");
7010
7010
  const leftover = buffer.subarray(marker + 4);
7011
- cleanup2(() => resolve21({ head, leftover }));
7011
+ cleanup2(() => resolve22({ head, leftover }));
7012
7012
  };
7013
7013
  socket.on("data", onData);
7014
7014
  socket.once("error", onError);
@@ -7022,7 +7022,7 @@ async function connectViaProxy(proxyUrl, targetUrl, timeoutMs, signal, onDebug)
7022
7022
  port: Number(proxyUrl.port || DEFAULT_PROXY_PORT),
7023
7023
  signal: signal ?? void 0
7024
7024
  });
7025
- await new Promise((resolve21, reject) => {
7025
+ await new Promise((resolve22, reject) => {
7026
7026
  const timeout = setTimeout(() => {
7027
7027
  onDebug?.(`agy transport proxy connect timeout after ${timeoutMs}ms`);
7028
7028
  proxySocket.destroy();
@@ -7031,7 +7031,7 @@ async function connectViaProxy(proxyUrl, targetUrl, timeoutMs, signal, onDebug)
7031
7031
  const cleanup2 = () => clearTimeout(timeout);
7032
7032
  proxySocket.once("connect", () => {
7033
7033
  cleanup2();
7034
- resolve21();
7034
+ resolve22();
7035
7035
  });
7036
7036
  proxySocket.once("error", (error) => {
7037
7037
  cleanup2();
@@ -7056,7 +7056,7 @@ Host: ${targetHost}:${targetPort}\r
7056
7056
  if (leftover.length > 0) {
7057
7057
  proxySocket.unshift(leftover);
7058
7058
  }
7059
- return await new Promise((resolve21, reject) => {
7059
+ return await new Promise((resolve22, reject) => {
7060
7060
  const tlsOptions = {
7061
7061
  socket: proxySocket,
7062
7062
  servername: targetHost,
@@ -7071,7 +7071,7 @@ Host: ${targetHost}:${targetPort}\r
7071
7071
  const cleanup2 = () => clearTimeout(timeout);
7072
7072
  tlsSocket.once("secureConnect", () => {
7073
7073
  cleanup2();
7074
- resolve21(tlsSocket);
7074
+ resolve22(tlsSocket);
7075
7075
  });
7076
7076
  tlsSocket.once("error", (error) => {
7077
7077
  cleanup2();
@@ -7080,7 +7080,7 @@ Host: ${targetHost}:${targetPort}\r
7080
7080
  });
7081
7081
  }
7082
7082
  async function connectDirect(targetUrl, timeoutMs, signal, onDebug) {
7083
- return await new Promise((resolve21, reject) => {
7083
+ return await new Promise((resolve22, reject) => {
7084
7084
  const tlsOptions = {
7085
7085
  host: targetUrl.hostname,
7086
7086
  port: Number(targetUrl.port || DEFAULT_HTTPS_PORT),
@@ -7096,7 +7096,7 @@ async function connectDirect(targetUrl, timeoutMs, signal, onDebug) {
7096
7096
  const cleanup2 = () => clearTimeout(timeout);
7097
7097
  socket.once("secureConnect", () => {
7098
7098
  cleanup2();
7099
- resolve21(socket);
7099
+ resolve22(socket);
7100
7100
  });
7101
7101
  socket.once("error", (error) => {
7102
7102
  cleanup2();
@@ -8061,7 +8061,7 @@ function displayOrder(left, right) {
8061
8061
  return left.label < right.label ? -1 : left.label > right.label ? 1 : 0;
8062
8062
  }
8063
8063
  function quotaWindowParts(quota, options) {
8064
- const { windows, age } = scopedWindowParts(quota, options);
8064
+ const { windows, age } = scopedWindowParts(quota, options, true);
8065
8065
  const parts = windows.map(({ part }) => part);
8066
8066
  return age === void 0 ? { windows: parts } : { windows: parts, age };
8067
8067
  }
@@ -8072,25 +8072,36 @@ function withShortNames(windows) {
8072
8072
  }
8073
8073
  return windows;
8074
8074
  }
8075
- function scopedWindowParts(quota, options) {
8075
+ function hasWindowReading(limit) {
8076
+ return Number.isFinite(limit.remainingPercent) && Number.isFinite(limit.checkedAt);
8077
+ }
8078
+ function scopedWindowParts(quota, options, includeUnknown = false) {
8076
8079
  if (!quota)
8077
8080
  return { windows: [] };
8078
8081
  const { now } = options;
8079
- const readings = quota.limits.filter((limit) => limit.kind === "reading" && limit.remainingPercent !== void 0).sort(displayOrder);
8082
+ const readings = quota.limits.filter((limit) => limit.kind === "reading" && (includeUnknown || hasWindowReading(limit))).sort(displayOrder);
8080
8083
  const windows = readings.map((limit) => {
8081
- const remainingPercent = clampPercent(limit.remainingPercent ?? 0);
8084
+ const part = hasWindowReading(limit) ? {
8085
+ kind: "window",
8086
+ reading: "known",
8087
+ name: quotaWindowName(limit),
8088
+ short: "",
8089
+ figure: percentLeft(limit.remainingPercent),
8090
+ remainingPercent: clampPercent(limit.remainingPercent),
8091
+ checkedAt: limit.checkedAt,
8092
+ ...resetDetails(limit.resetsAt, limit.checkedAt, now)
8093
+ } : {
8094
+ kind: "window",
8095
+ reading: "unknown",
8096
+ name: quotaWindowName(limit),
8097
+ short: "",
8098
+ figure: "no reading",
8099
+ resetSinceReading: false
8100
+ };
8082
8101
  return {
8083
8102
  scope: limit.scope,
8084
8103
  ...limit.windowMinutes === void 0 ? {} : { windowMinutes: limit.windowMinutes },
8085
- part: {
8086
- kind: "window",
8087
- name: quotaWindowName(limit),
8088
- short: "",
8089
- figure: percentLeft(limit.remainingPercent ?? 0),
8090
- remainingPercent,
8091
- checkedAt: limit.checkedAt,
8092
- ...resetDetails(limit.resetsAt, limit.checkedAt, now)
8093
- }
8104
+ part
8094
8105
  };
8095
8106
  });
8096
8107
  const budget = quota.budget;
@@ -8102,6 +8113,7 @@ function scopedWindowParts(quota, options) {
8102
8113
  spent: budget.reached,
8103
8114
  part: {
8104
8115
  kind: "budget",
8116
+ reading: "known",
8105
8117
  name: "credits",
8106
8118
  short: "",
8107
8119
  figure,
@@ -8112,8 +8124,9 @@ function scopedWindowParts(quota, options) {
8112
8124
  });
8113
8125
  }
8114
8126
  withShortNames(windows);
8115
- if (windows.length > 0) {
8116
- const age = now - Math.min(...windows.map(({ part }) => part.checkedAt));
8127
+ const readingTimes = windows.flatMap(({ part }) => part.reading === "known" && part.checkedAt !== void 0 ? [part.checkedAt] : []);
8128
+ if (readingTimes.length > 0) {
8129
+ const age = now - Math.min(...readingTimes);
8117
8130
  if (age > (options.staleAfterMs ?? QUOTA_STALE_AFTER_MS)) {
8118
8131
  return { windows, age: `checked ${shortSpan(age)} ago` };
8119
8132
  }
@@ -8212,13 +8225,13 @@ function narrowTextParts(quota, options) {
8212
8225
  function quotaTextParts(quota, options) {
8213
8226
  if (options.form === "narrow")
8214
8227
  return narrowTextParts(quota, options);
8215
- const parts = quotaWindowParts(quota, options);
8228
+ const { windows, age } = scopedWindowParts(quota, options);
8216
8229
  const full = (options.form ?? "full") === "full";
8217
- const text2 = parts.windows.map((part) => {
8230
+ const text2 = windows.map(({ part }) => {
8218
8231
  const reset = full && part.resetIn ? `, resets ${part.resetIn}` : "";
8219
8232
  return `${part.kind === "budget" ? "" : `${part.name} `}${part.figure}${reset}`;
8220
8233
  });
8221
- return parts.age === void 0 ? text2 : [...text2, parts.age];
8234
+ return age === void 0 ? text2 : [...text2, age];
8222
8235
  }
8223
8236
  function formatQuota(quota, options) {
8224
8237
  const parts = quotaTextParts(quota, options);
@@ -8650,8 +8663,8 @@ async function acquireRefreshFileLockWithClock(options) {
8650
8663
  let releaseConfirmed = false;
8651
8664
  let loss;
8652
8665
  let resolveLoss;
8653
- const lostPromise = new Promise((resolve21) => {
8654
- resolveLoss = resolve21;
8666
+ const lostPromise = new Promise((resolve22) => {
8667
+ resolveLoss = resolve22;
8655
8668
  });
8656
8669
  function notifyTimerStep(event) {
8657
8670
  try {
@@ -8812,7 +8825,7 @@ async function acquireRefreshFileLockWithClock(options) {
8812
8825
  }
8813
8826
  }
8814
8827
  async function backoff() {
8815
- await new Promise((resolve21) => setTimeout(resolve21, Math.floor(Math.random() * 4)));
8828
+ await new Promise((resolve22) => setTimeout(resolve22, Math.floor(Math.random() * 4)));
8816
8829
  }
8817
8830
  async function readLockState(notifyReady = true) {
8818
8831
  if (notifyReady && options.onStep)
@@ -9302,7 +9315,7 @@ async function acquireRefreshFileLockWithClock(options) {
9302
9315
  const remainingMs = deadline - performance.now();
9303
9316
  if (remainingMs <= 0)
9304
9317
  break;
9305
- await new Promise((resolve21) => setTimeout(resolve21, Math.min(delayMs, remainingMs)));
9318
+ await new Promise((resolve22) => setTimeout(resolve22, Math.min(delayMs, remainingMs)));
9306
9319
  delayMs = Math.min(delayMs * 2, 50);
9307
9320
  }
9308
9321
  if (windowsPrivateFiles)
@@ -9325,21 +9338,37 @@ var init_refresh_file_lock = __esm({
9325
9338
  });
9326
9339
 
9327
9340
  // ../core/dist/common-auth-embedded/fs/with-lock.js
9341
+ import { join as join6, resolve as resolve3 } from "node:path";
9328
9342
  function lockPathFor(target, name) {
9329
9343
  return `${target}.${name}.lock`;
9330
9344
  }
9345
+ function isChangingLockRead(error, target, name) {
9346
+ if (!windowsPrivateFiles || !(error instanceof PrivateFileError) || error.reason !== "io-error" || error.win32Code !== 32 && error.win32Code !== 303 || error.stage !== "read" && error.stage !== "verify")
9347
+ return false;
9348
+ const path2 = resolve3(lockPathFor(target, name));
9349
+ return error.path === path2 || error.path === join6(path2, "owner.json");
9350
+ }
9331
9351
  async function withLock(target, options, fn) {
9332
9352
  const started = performance.now();
9333
9353
  for (; ; ) {
9334
9354
  options.signal?.throwIfAborted();
9335
- const lock = await acquireRefreshFileLock({
9336
- path: target,
9337
- name: options.name,
9338
- ttlMs: options.ttlMs,
9339
- renew: options.renew ?? false,
9340
- ...options.onStep ? { onStep: options.onStep } : {},
9341
- ...options.onRenewalTimer ? { onRenewalTimer: options.onRenewalTimer } : {}
9342
- });
9355
+ let lock;
9356
+ let changingReadError;
9357
+ try {
9358
+ lock = await acquireRefreshFileLock({
9359
+ path: target,
9360
+ name: options.name,
9361
+ ttlMs: options.ttlMs,
9362
+ renew: options.renew ?? false,
9363
+ ...options.onStep ? { onStep: options.onStep } : {},
9364
+ ...options.onRenewalTimer ? { onRenewalTimer: options.onRenewalTimer } : {}
9365
+ });
9366
+ } catch (error) {
9367
+ if (!isChangingLockRead(error, target, options.name))
9368
+ throw error;
9369
+ lock = null;
9370
+ changingReadError = error;
9371
+ }
9343
9372
  if (lock) {
9344
9373
  try {
9345
9374
  options.signal?.throwIfAborted();
@@ -9350,19 +9379,22 @@ async function withLock(target, options, fn) {
9350
9379
  }
9351
9380
  const remaining = options.timeoutMs - (performance.now() - started);
9352
9381
  if (remaining <= 0) {
9382
+ if (changingReadError)
9383
+ throw changingReadError;
9353
9384
  throw new LockContentionError({
9354
9385
  target,
9355
9386
  name: options.name,
9356
9387
  timeoutMs: options.timeoutMs
9357
9388
  });
9358
9389
  }
9359
- await new Promise((resolve21) => setTimeout(resolve21, Math.min(25, Math.ceil(remaining))));
9390
+ await new Promise((resolve22) => setTimeout(resolve22, Math.min(25, Math.ceil(remaining))));
9360
9391
  }
9361
9392
  }
9362
9393
  var LockContentionError, LockOwnershipError;
9363
9394
  var init_with_lock = __esm({
9364
9395
  "../core/dist/common-auth-embedded/fs/with-lock.js"() {
9365
9396
  "use strict";
9397
+ init_private_files();
9366
9398
  init_refresh_file_lock();
9367
9399
  LockContentionError = class extends Error {
9368
9400
  details;
@@ -9475,7 +9507,7 @@ async function acquirePoolLock(spec, defaults, env3) {
9475
9507
  });
9476
9508
  }
9477
9509
  const jitter = Math.floor(Math.random() * (options.retryMs + 1));
9478
- await new Promise((resolve21) => setTimeout(resolve21, Math.min(options.retryMs + jitter, remaining)));
9510
+ await new Promise((resolve22) => setTimeout(resolve22, Math.min(options.retryMs + jitter, remaining)));
9479
9511
  }
9480
9512
  }
9481
9513
  function definedOnly(spec) {
@@ -12319,7 +12351,7 @@ var init_redact = __esm({
12319
12351
  // ../core/dist/common-auth-embedded/logger/engine.js
12320
12352
  import { appendFileSync, chmodSync, existsSync, renameSync, statSync } from "node:fs";
12321
12353
  import { open as open5 } from "node:fs/promises";
12322
- import { dirname as dirname8, resolve as resolve3 } from "node:path";
12354
+ import { dirname as dirname8, resolve as resolve4 } from "node:path";
12323
12355
  function chmodPrivate(path2) {
12324
12356
  try {
12325
12357
  chmodSync(path2, 384);
@@ -12370,7 +12402,7 @@ async function openWindowsFile(sink, file) {
12370
12402
  return sink.handle;
12371
12403
  }
12372
12404
  async function flushWindowsFile(sink, file, text2) {
12373
- file = resolve3(file);
12405
+ file = resolve4(file);
12374
12406
  try {
12375
12407
  if (sink.file !== file)
12376
12408
  await closeWindowsFile(sink);
@@ -12746,11 +12778,11 @@ var init_quota_writer = __esm({
12746
12778
  const left = deadline - performance.now();
12747
12779
  if (left <= 0)
12748
12780
  throw refusal2("pull", id, "lock-contention", `pool quota queue for ${id} is full (${POOL_QUOTA_QUEUE_LIMIT} readings) and the store locks stayed held`, true);
12749
- await new Promise((resolve21) => {
12781
+ await new Promise((resolve22) => {
12750
12782
  const done = () => {
12751
12783
  clearTimeout(timer);
12752
12784
  this.wake.delete(done);
12753
- resolve21();
12785
+ resolve22();
12754
12786
  };
12755
12787
  const timer = setTimeout(done, left);
12756
12788
  this.wake.add(done);
@@ -13143,7 +13175,7 @@ var init_refresh = __esm({
13143
13175
 
13144
13176
  // ../core/dist/common-auth-embedded/fs/file-read-cache.js
13145
13177
  import { lstat as lstat4 } from "node:fs/promises";
13146
- import { resolve as resolve4 } from "node:path";
13178
+ import { resolve as resolve5 } from "node:path";
13147
13179
  async function identity(path2) {
13148
13180
  try {
13149
13181
  const metadata = await lstat4(path2);
@@ -13164,7 +13196,7 @@ var init_file_read_cache = __esm({
13164
13196
  FileReadCache = class {
13165
13197
  #entries = /* @__PURE__ */ new Map();
13166
13198
  async read(paths, read, validateHit) {
13167
- const resolvedPaths = paths.map((path2) => resolve4(path2));
13199
+ const resolvedPaths = paths.map((path2) => resolve5(path2));
13168
13200
  const key = JSON.stringify(resolvedPaths);
13169
13201
  const probed = await Promise.all(resolvedPaths.map(identity));
13170
13202
  const identities = probed.every((entry) => entry !== void 0) ? probed : void 0;
@@ -15521,7 +15553,7 @@ async function select(terminal, items, options) {
15521
15553
  writeLine("");
15522
15554
  renderedLines = lines;
15523
15555
  };
15524
- return new Promise((resolve21) => {
15556
+ return new Promise((resolve22) => {
15525
15557
  const wasRaw = stdin.isRaw ?? false;
15526
15558
  const cleanup2 = () => {
15527
15559
  if (cleaned)
@@ -15541,7 +15573,7 @@ async function select(terminal, items, options) {
15541
15573
  };
15542
15574
  const finish = (value) => {
15543
15575
  cleanup2();
15544
- resolve21(value);
15576
+ resolve22(value);
15545
15577
  };
15546
15578
  const onSignal = () => finish(null);
15547
15579
  const onKey = (data) => {
@@ -15581,7 +15613,7 @@ async function select(terminal, items, options) {
15581
15613
  stdin.setRawMode(true);
15582
15614
  } catch {
15583
15615
  cleanup2();
15584
- resolve21(null);
15616
+ resolve22(null);
15585
15617
  return;
15586
15618
  }
15587
15619
  stdin.resume();
@@ -16423,7 +16455,7 @@ var init_watch = __esm({
16423
16455
  });
16424
16456
 
16425
16457
  // ../core/dist/common-auth-embedded/claustrum/insula.js
16426
- import { resolve as resolve5 } from "node:path";
16458
+ import { resolve as resolve6 } from "node:path";
16427
16459
  import { storeIdentity } from "@cortexkit/claustrum-client";
16428
16460
  import { SubcClient } from "@cortexkit/subc-client";
16429
16461
  function insulaUsageTransport(options) {
@@ -16551,8 +16583,8 @@ function refusalCode(error) {
16551
16583
  }
16552
16584
  function acquireInsulaQuotaSource(transport, tokenPath) {
16553
16585
  const key = JSON.stringify([
16554
- resolve5(transport.connectionFile),
16555
- resolve5(tokenPath)
16586
+ resolve6(transport.connectionFile),
16587
+ resolve6(tokenPath)
16556
16588
  ]);
16557
16589
  let shared3 = sources.get(key);
16558
16590
  if (!shared3) {
@@ -16866,7 +16898,7 @@ var init_any_signal = __esm({
16866
16898
  import { createHash as createHash5, randomBytes as randomBytes2, randomUUID as randomUUID10 } from "node:crypto";
16867
16899
  import { constants as fsConstants } from "node:fs";
16868
16900
  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";
16869
- import { basename as basename3, dirname as dirname9, extname, isAbsolute as isAbsolute2, join as join6, resolve as resolve6 } from "node:path";
16901
+ import { basename as basename3, dirname as dirname9, extname, isAbsolute as isAbsolute2, join as join7, resolve as resolve7 } from "node:path";
16870
16902
  import { ClaustrumCredentialError as ClaustrumCredentialError2, ClaustrumClient as ClaustrumWireClient, writeEnrollmentTokenFile } from "@cortexkit/claustrum-client";
16871
16903
  function classifyEnrollmentError(error) {
16872
16904
  if (!(error instanceof ClaustrumCredentialError2))
@@ -16892,7 +16924,7 @@ function getClaustrumEnrollmentPaths(tokenPath) {
16892
16924
  const extension = extname(tokenPath) || ".json";
16893
16925
  const stem = basename3(tokenPath, extname(tokenPath));
16894
16926
  return {
16895
- statePath: join6(dirname9(tokenPath), `${stem}-state${extension}`),
16927
+ statePath: join7(dirname9(tokenPath), `${stem}-state${extension}`),
16896
16928
  tokenPath
16897
16929
  };
16898
16930
  }
@@ -16900,7 +16932,7 @@ function hostEnrollmentPaths(input) {
16900
16932
  const override = input.override?.trim();
16901
16933
  if (override && !isAbsolute2(override) && !input.cwd)
16902
16934
  throw new ClaustrumConsumerError("invalid-state", "A relative Claustrum enrollment override needs a base directory");
16903
- const tokenPath = override ? isAbsolute2(override) ? override : resolve6(input.cwd, override) : join6(input.stateDir, `${input.host}-enrollment.json`);
16935
+ const tokenPath = override ? isAbsolute2(override) ? override : resolve7(input.cwd, override) : join7(input.stateDir, `${input.host}-enrollment.json`);
16904
16936
  return getClaustrumEnrollmentPaths(tokenPath);
16905
16937
  }
16906
16938
  function isRecord6(value) {
@@ -17133,7 +17165,7 @@ async function writeStateAtomic(path2, state, ancestorOptions = {}) {
17133
17165
  }
17134
17166
  if (windowsPrivateFiles)
17135
17167
  return writePrivateAtomic(path2, bytes);
17136
- const temporary = join6(parent, `.${basename3(path2)}.${process.pid}.${randomUUID10()}.tmp`);
17168
+ const temporary = join7(parent, `.${basename3(path2)}.${process.pid}.${randomUUID10()}.tmp`);
17137
17169
  let descriptor;
17138
17170
  let created = false;
17139
17171
  try {
@@ -17629,10 +17661,10 @@ async function drainShutdown(pending, onTimeout) {
17629
17661
  try {
17630
17662
  await Promise.race([
17631
17663
  drained,
17632
- new Promise((resolve21) => {
17664
+ new Promise((resolve22) => {
17633
17665
  timer = setTimeout(() => {
17634
17666
  expired = true;
17635
- resolve21();
17667
+ resolve22();
17636
17668
  }, 2e3);
17637
17669
  })
17638
17670
  ]);
@@ -18402,7 +18434,7 @@ var init_interlock = __esm({
18402
18434
  // ../core/dist/common-auth-embedded/claustrum/roster.js
18403
18435
  import { createHash as createHash6 } from "node:crypto";
18404
18436
  import { stat as stat5 } from "node:fs/promises";
18405
- import { resolve as resolve7 } from "node:path";
18437
+ import { resolve as resolve8 } from "node:path";
18406
18438
  function vaultRosterSeed(roster) {
18407
18439
  return {
18408
18440
  declined: roster.declined.map((entry) => ({ ...entry })),
@@ -18789,16 +18821,16 @@ function applyVaultQuota(current, input) {
18789
18821
  };
18790
18822
  }
18791
18823
  function forgetPendingVaultDiscovery(path2) {
18792
- pendingDiscoveries.delete(resolve7(path2));
18824
+ pendingDiscoveries.delete(resolve8(path2));
18793
18825
  }
18794
18826
  function isVaultRosterLockRefusal(path2, error) {
18795
- const target = resolve7(path2);
18827
+ const target = resolve8(path2);
18796
18828
  if (error instanceof ClaustrumConsumerError)
18797
18829
  return error.kind === "roster-busy";
18798
18830
  if (error instanceof LockContentionError || error instanceof LockOwnershipError)
18799
- return resolve7(error.details.target) === target;
18831
+ return resolve8(error.details.target) === target;
18800
18832
  if (error instanceof PrivateFileError) {
18801
- const failed = resolve7(error.path);
18833
+ const failed = resolve8(error.path);
18802
18834
  return [WRITE_LOCK.name, DISCOVERY_LEASE.name].some((name) => {
18803
18835
  const lock = lockPathFor(target, name);
18804
18836
  return failed === lock || failed.startsWith(`${lock}.`);
@@ -18859,7 +18891,7 @@ async function refreshVaultRoster(options) {
18859
18891
  throw new ClaustrumConsumerError("roster-busy", "Claustrum account discovery is already in progress");
18860
18892
  return persisted;
18861
18893
  }
18862
- const key = resolve7(options.path);
18894
+ const key = resolve8(options.path);
18863
18895
  const listedOver = options.listedOver;
18864
18896
  let discovered;
18865
18897
  try {
@@ -18979,9 +19011,9 @@ var init_roster = __esm({
18979
19011
  });
18980
19012
 
18981
19013
  // ../core/dist/common-auth-embedded/claustrum/quota-writer.js
18982
- import { resolve as resolve8 } from "node:path";
19014
+ import { resolve as resolve9 } from "node:path";
18983
19015
  function writerFor(path2, clock = quotaCommitTimer) {
18984
- const key = resolve8(path2);
19016
+ const key = resolve9(path2);
18985
19017
  let writer = writers.get(key);
18986
19018
  if (!writer) {
18987
19019
  writer = {
@@ -19045,7 +19077,7 @@ function orderedFields(pending) {
19045
19077
  return [...pending.values()].flatMap((account) => [...account.values()]).sort((a, b) => a.order - b.order);
19046
19078
  }
19047
19079
  function pendingVaultQuota(path2, roster) {
19048
- const writer = writers.get(resolve8(path2));
19080
+ const writer = writers.get(resolve9(path2));
19049
19081
  if (writer) {
19050
19082
  for (const field of orderedFields(writer.pending)) {
19051
19083
  if (field.priorReading)
@@ -19056,7 +19088,7 @@ function pendingVaultQuota(path2, roster) {
19056
19088
  return roster;
19057
19089
  }
19058
19090
  function hasPendingVaultQuota(path2) {
19059
- return !!writers.get(resolve8(path2))?.pending.size;
19091
+ return !!writers.get(resolve9(path2))?.pending.size;
19060
19092
  }
19061
19093
  function schedule(writer, delay3) {
19062
19094
  if (writer.running || writer.timer || !writer.pending.size || writer.abort.signal.aborted)
@@ -19121,7 +19153,7 @@ function flush(writer) {
19121
19153
  return writer.running;
19122
19154
  }
19123
19155
  async function drainVaultQuota(path2, timeoutMs = 1e3) {
19124
- const key = resolve8(path2);
19156
+ const key = resolve9(path2);
19125
19157
  const writer = writers.get(key);
19126
19158
  if (!writer)
19127
19159
  return;
@@ -19266,7 +19298,7 @@ var init_consumer = __esm({
19266
19298
  this.#shutdown.signal,
19267
19299
  ...signal ? [signal] : []
19268
19300
  ]);
19269
- return new Promise((resolve21, reject) => {
19301
+ return new Promise((resolve22, reject) => {
19270
19302
  const cleanup2 = () => {
19271
19303
  combined.signal.removeEventListener("abort", abort);
19272
19304
  combined.dispose();
@@ -19281,7 +19313,7 @@ var init_consumer = __esm({
19281
19313
  if (combined.signal.aborted)
19282
19314
  reject(combined.signal.reason);
19283
19315
  else
19284
- resolve21(value);
19316
+ resolve22(value);
19285
19317
  }, (error) => {
19286
19318
  cleanup2();
19287
19319
  reject(error);
@@ -19995,7 +20027,7 @@ var init_consumer = __esm({
19995
20027
  import { createHash as createHash7 } from "node:crypto";
19996
20028
  import { channel as channel2 } from "node:diagnostics_channel";
19997
20029
  import { readdir, stat as stat6 } from "node:fs/promises";
19998
- import { dirname as dirname10, join as join7, resolve as resolve9 } from "node:path";
20030
+ import { dirname as dirname10, join as join8, resolve as resolve10 } from "node:path";
19999
20031
  function canonicalJson3(value, path2 = /* @__PURE__ */ new Set()) {
20000
20032
  if (value === null)
20001
20033
  return "null";
@@ -20056,12 +20088,12 @@ function unreachableConnect2() {
20056
20088
  return new ClaustrumUnreachableError();
20057
20089
  }
20058
20090
  function untilAborted(pending, signal) {
20059
- return new Promise((resolve21, reject) => {
20091
+ return new Promise((resolve22, reject) => {
20060
20092
  const abort = () => reject(signal.reason);
20061
20093
  signal.addEventListener("abort", abort, { once: true });
20062
20094
  pending.then((value) => {
20063
20095
  signal.removeEventListener("abort", abort);
20064
- resolve21(value);
20096
+ resolve22(value);
20065
20097
  }, (error) => {
20066
20098
  signal.removeEventListener("abort", abort);
20067
20099
  reject(error);
@@ -20131,13 +20163,13 @@ var init_hub = __esm({
20131
20163
  this.#options = options;
20132
20164
  this.#logger = options.logger ?? createLogger2("claustrum");
20133
20165
  this.#warnShutdown = shutdownWarning(this.#logger, this.#shutdown.signal);
20134
- this.#generationDirectory = join7(options.stateDir, "rosters", hostGeneration);
20166
+ this.#generationDirectory = join8(options.stateDir, "rosters", hostGeneration);
20135
20167
  this.#key = rosterFingerprint(options, providers);
20136
- const directory = join7(this.#generationDirectory, this.#key);
20168
+ const directory = join8(this.#generationDirectory, this.#key);
20137
20169
  for (const provider2 of providers)
20138
20170
  this.#members.set(provider2, {
20139
20171
  provider: provider2,
20140
- path: join7(directory, `${provider2}.json`),
20172
+ path: join8(directory, `${provider2}.json`),
20141
20173
  closed: false
20142
20174
  });
20143
20175
  }
@@ -20218,7 +20250,7 @@ var init_hub = __esm({
20218
20250
  };
20219
20251
  const { consumer, hooks } = createHubMember(port, consumerOptions);
20220
20252
  entry.hooks = hooks;
20221
- const path2 = resolve9(entry.path);
20253
+ const path2 = resolve10(entry.path);
20222
20254
  const subscribers = sharedRosters.get(path2) ?? /* @__PURE__ */ new Set();
20223
20255
  const install = (roster) => {
20224
20256
  if (entry.closed || this.#active !== true || !this.#current || !this.#live(this.#current) || !hooks.roster() || this.#collides(hooks, roster))
@@ -20249,7 +20281,7 @@ var init_hub = __esm({
20249
20281
  return;
20250
20282
  entry.seen = JSON.stringify(decodedVaultRoster(roster));
20251
20283
  entry.hooks?.install(roster);
20252
- for (const install of sharedRosters.get(resolve9(entry.path)) ?? []) {
20284
+ for (const install of sharedRosters.get(resolve10(entry.path)) ?? []) {
20253
20285
  if (!this.#live(generation))
20254
20286
  return;
20255
20287
  if (install !== entry.receiveRoster)
@@ -20705,7 +20737,7 @@ var init_hub = __esm({
20705
20737
  for (const directory of [
20706
20738
  dirname10(this.#generationDirectory),
20707
20739
  this.#generationDirectory,
20708
- join7(this.#generationDirectory, this.#key)
20740
+ join8(this.#generationDirectory, this.#key)
20709
20741
  ])
20710
20742
  await ensureClaustrumPrivateDirectory(directory, {}, "roster directory");
20711
20743
  }
@@ -20717,11 +20749,11 @@ var init_hub = __esm({
20717
20749
  */
20718
20750
  async #seed(entry) {
20719
20751
  const name = `${entry.provider}.json`;
20720
- const candidates = [join7(this.#generationDirectory, name)];
20752
+ const candidates = [join8(this.#generationDirectory, name)];
20721
20753
  try {
20722
20754
  for (const key of await readdir(this.#generationDirectory))
20723
20755
  if (key !== this.#key && FINGERPRINT.test(key))
20724
- candidates.push(join7(this.#generationDirectory, key, name));
20756
+ candidates.push(join8(this.#generationDirectory, key, name));
20725
20757
  } catch {
20726
20758
  }
20727
20759
  let newest;
@@ -21294,7 +21326,7 @@ var init_lock = __esm({
21294
21326
  import { createHash as createHash8 } from "node:crypto";
21295
21327
  import { constants as constants2 } from "node:fs";
21296
21328
  import { lstat as lstat5, mkdir as mkdir10, open as open7, unlink as unlink7 } from "node:fs/promises";
21297
- import { dirname as dirname11, resolve as resolve10 } from "node:path";
21329
+ import { dirname as dirname11, resolve as resolve11 } from "node:path";
21298
21330
  import { setTimeout as sleep2 } from "node:timers/promises";
21299
21331
  function rootSpans(text2) {
21300
21332
  let i = text2.indexOf("{") + 1;
@@ -21495,8 +21527,8 @@ function createPiSlot(options, onStep, hooks) {
21495
21527
  if (!provider2 || !options.authPath || !options.stashPath || !placeholderKey || placeholderKey.startsWith("!") || placeholderKey.includes("$") || !Number.isFinite(timeout) || timeout < 0) {
21496
21528
  throw new PiSlotError("invalid-options");
21497
21529
  }
21498
- const authPath = resolve10(options.authPath);
21499
- const stashPath = resolve10(options.stashPath);
21530
+ const authPath = resolve11(options.authPath);
21531
+ const stashPath = resolve11(options.stashPath);
21500
21532
  if (authPath === stashPath || stashPath === `${authPath}.lock`) {
21501
21533
  throw new PiSlotError("invalid-options");
21502
21534
  }
@@ -21722,15 +21754,15 @@ var init_model_types = __esm({
21722
21754
 
21723
21755
  // ../core/dist/pi-paths.js
21724
21756
  import { homedir } from "node:os";
21725
- import { dirname as dirname12, join as join8 } from "node:path";
21757
+ import { dirname as dirname12, join as join9 } from "node:path";
21726
21758
  function getPiConfigDir() {
21727
- return process.env.PI_AGENT_DIR?.trim() || join8(homedir(), ".pi", "agent");
21759
+ return process.env.PI_AGENT_DIR?.trim() || join9(homedir(), ".pi", "agent");
21728
21760
  }
21729
21761
  function getPiAntigravityAuthFile() {
21730
- return process.env.PI_ANTIGRAVITY_AUTH_FILE?.trim() || join8(getPiConfigDir(), "antigravity-accounts.json");
21762
+ return process.env.PI_ANTIGRAVITY_AUTH_FILE?.trim() || join9(getPiConfigDir(), "antigravity-accounts.json");
21731
21763
  }
21732
21764
  function getPiAntigravityVaultDir() {
21733
- return join8(dirname12(getPiAntigravityAuthFile()), "antigravity-auth-vault");
21765
+ return join9(dirname12(getPiAntigravityAuthFile()), "antigravity-auth-vault");
21734
21766
  }
21735
21767
  var init_pi_paths = __esm({
21736
21768
  "../core/dist/pi-paths.js"() {
@@ -21764,8 +21796,8 @@ function getDefaultTierId(allowedTiers) {
21764
21796
  return allowedTiers[0]?.id;
21765
21797
  }
21766
21798
  function wait(ms) {
21767
- return new Promise((resolve21) => {
21768
- setTimeout(resolve21, ms);
21799
+ return new Promise((resolve22) => {
21800
+ setTimeout(resolve22, ms);
21769
21801
  });
21770
21802
  }
21771
21803
  function extractManagedProjectId(payload) {
@@ -22787,7 +22819,7 @@ var init_capture_sink2 = __esm({
22787
22819
  import { randomUUID as randomUUID11 } from "node:crypto";
22788
22820
  import { lstat as lstat6, readFile as readFile7, rename as rename8, unlink as unlink8 } from "node:fs/promises";
22789
22821
  import { tmpdir as tmpdir2 } from "node:os";
22790
- import { dirname as dirname13, join as join9, resolve as resolve11 } from "node:path";
22822
+ import { dirname as dirname13, join as join10, resolve as resolve12 } from "node:path";
22791
22823
  function ioCode2(detail) {
22792
22824
  if (detail?.reason === "io-error") {
22793
22825
  if (detail.win32Code === 2 || detail.win32Code === 3)
@@ -22808,7 +22840,7 @@ function isUnavailable2(api, error) {
22808
22840
  }
22809
22841
  async function assertNativeAddonLoads2(api) {
22810
22842
  try {
22811
- await api.verifyPrivatePath(join9(tmpdir2(), `.common-auth-private-files-probe-${randomUUID11()}`), "file");
22843
+ await api.verifyPrivatePath(join10(tmpdir2(), `.common-auth-private-files-probe-${randomUUID11()}`), "file");
22812
22844
  } catch (error) {
22813
22845
  if (isUnavailable2(api, error))
22814
22846
  throw privateFilesUnavailable2(error);
@@ -22834,7 +22866,7 @@ async function privateOperation2(path2, stage, operation) {
22834
22866
  }
22835
22867
  }
22836
22868
  async function verifySafeDirectory2(path2, options) {
22837
- path2 = resolve11(path2);
22869
+ path2 = resolve12(path2);
22838
22870
  options ??= safeParentOptionsForTest2;
22839
22871
  await privateOperation2(path2, "safe-parent", async () => {
22840
22872
  const result = await (await loadBackend2()).verifySafeParent(path2, options);
@@ -22849,7 +22881,7 @@ async function verifySafeDirectory2(path2, options) {
22849
22881
  });
22850
22882
  }
22851
22883
  async function verifyPrivate2(path2, kind, migrate = false) {
22852
- path2 = resolve11(path2);
22884
+ path2 = resolve12(path2);
22853
22885
  if (kind === "directory")
22854
22886
  return verifySafeDirectory2(path2);
22855
22887
  await privateOperation2(path2, "verify", async () => {
@@ -22884,7 +22916,7 @@ async function verifyPrivate2(path2, kind, migrate = false) {
22884
22916
  });
22885
22917
  }
22886
22918
  async function ensurePrivateDirectory2(path2, _migrate = false, options) {
22887
- path2 = resolve11(path2);
22919
+ path2 = resolve12(path2);
22888
22920
  await privateOperation2(path2, "directory", async () => {
22889
22921
  const api = await loadBackend2();
22890
22922
  try {
@@ -22915,7 +22947,7 @@ async function readPrivateText2(path2, migrate = false) {
22915
22947
  async function readPrivateBuffer2(path2, migrate = false) {
22916
22948
  if (!windowsPrivateFiles2)
22917
22949
  return readFile7(path2);
22918
- path2 = resolve11(path2);
22950
+ path2 = resolve12(path2);
22919
22951
  if (migrate) {
22920
22952
  await verifySafeDirectory2(dirname13(path2));
22921
22953
  await verifyPrivate2(path2, "file", true);
@@ -22923,20 +22955,20 @@ async function readPrivateBuffer2(path2, migrate = false) {
22923
22955
  return privateOperation2(path2, "read", async () => (await loadBackend2()).readOwnerOnly(path2));
22924
22956
  }
22925
22957
  async function createPrivateBytes2(path2, bytes) {
22926
- await verifySafeDirectory2(dirname13(resolve11(path2)));
22958
+ await verifySafeDirectory2(dirname13(resolve12(path2)));
22927
22959
  await privateOperation2(path2, "create", async () => {
22928
- await (await loadBackend2()).createPrivateFile(resolve11(path2), bytes);
22960
+ await (await loadBackend2()).createPrivateFile(resolve12(path2), bytes);
22929
22961
  });
22930
22962
  }
22931
22963
  async function createPrivateDirectoryExclusive2(path2) {
22932
- await verifySafeDirectory2(dirname13(resolve11(path2)));
22964
+ await verifySafeDirectory2(dirname13(resolve12(path2)));
22933
22965
  await privateOperation2(path2, "directory-create", async () => {
22934
- await (await loadBackend2()).createOwnerOnly(resolve11(path2), { kind: "dir" });
22966
+ await (await loadBackend2()).createOwnerOnly(resolve12(path2), { kind: "dir" });
22935
22967
  });
22936
22968
  }
22937
22969
  async function replaceWindowsFile2(from, to, options = {}) {
22938
- from = resolve11(from);
22939
- to = resolve11(to);
22970
+ from = resolve12(from);
22971
+ to = resolve12(to);
22940
22972
  const now = options.now ?? (() => performance.now());
22941
22973
  const start = now();
22942
22974
  const leaseDeadline = options.deadline ?? Infinity;
@@ -22979,7 +23011,7 @@ async function replaceWindowsFile2(from, to, options = {}) {
22979
23011
  throw error;
22980
23012
  }
22981
23013
  async function writePrivateAtomic2(path2, bytes, options = {}) {
22982
- path2 = resolve11(path2);
23014
+ path2 = resolve12(path2);
22983
23015
  await ensurePrivateDirectory2(dirname13(path2));
22984
23016
  try {
22985
23017
  await verifyPrivate2(path2, "file", true);
@@ -22987,7 +23019,7 @@ async function writePrivateAtomic2(path2, bytes, options = {}) {
22987
23019
  if (error.code !== "ENOENT")
22988
23020
  throw error;
22989
23021
  }
22990
- const stage = resolve11(options.stagePath ?? `${path2}.${randomUUID11()}.tmp`);
23022
+ const stage = resolve12(options.stagePath ?? `${path2}.${randomUUID11()}.tmp`);
22991
23023
  if (dirname13(stage) !== dirname13(path2))
22992
23024
  throw new PrivateFileError2(path2, "stage-directory", { code: "EXDEV" });
22993
23025
  let created = false;
@@ -23153,7 +23185,7 @@ var init_redact2 = __esm({
23153
23185
  // src/common-auth-embedded/logger/engine.js
23154
23186
  import { appendFileSync as appendFileSync2, chmodSync as chmodSync2, existsSync as existsSync2, renameSync as renameSync2, statSync as statSync3 } from "node:fs";
23155
23187
  import { open as open8 } from "node:fs/promises";
23156
- import { dirname as dirname14, resolve as resolve12 } from "node:path";
23188
+ import { dirname as dirname14, resolve as resolve13 } from "node:path";
23157
23189
  function chmodPrivate2(path2) {
23158
23190
  try {
23159
23191
  chmodSync2(path2, 384);
@@ -23204,7 +23236,7 @@ async function openWindowsFile2(sink, file) {
23204
23236
  return sink.handle;
23205
23237
  }
23206
23238
  async function flushWindowsFile2(sink, file, text2) {
23207
- file = resolve12(file);
23239
+ file = resolve13(file);
23208
23240
  try {
23209
23241
  if (sink.file !== file)
23210
23242
  await closeWindowsFile2(sink);
@@ -23521,20 +23553,20 @@ import { randomUUID as randomUUID12 } from "node:crypto";
23521
23553
  import { realpathSync, rmSync } from "node:fs";
23522
23554
  import { chmod as chmod3, mkdir as mkdir11, readFile as readFile8, rename as rename9, rm as rm5, writeFile as writeFile3 } from "node:fs/promises";
23523
23555
  import { homedir as homedir2 } from "node:os";
23524
- import { join as join10, resolve as resolve13 } from "node:path";
23556
+ import { join as join11, resolve as resolve14 } from "node:path";
23525
23557
  function processHeartbeatDir() {
23526
- const base = process.env.XDG_STATE_HOME || join10(homedir2(), ".local", "state");
23527
- return join10(base, "cortexkit", "antigravity-auth", "processes");
23558
+ const base = process.env.XDG_STATE_HOME || join11(homedir2(), ".local", "state");
23559
+ return join11(base, "cortexkit", "antigravity-auth", "processes");
23528
23560
  }
23529
23561
  function processHeartbeatPath(pid = process.pid, dir = processHeartbeatDir()) {
23530
- return join10(dir, `${pid}.json`);
23562
+ return join11(dir, `${pid}.json`);
23531
23563
  }
23532
23564
  function processConfigFolderKey() {
23533
23565
  const folder = getConfigDir();
23534
23566
  try {
23535
23567
  return realpathSync.native(folder);
23536
23568
  } catch {
23537
- return resolve13(folder);
23569
+ return resolve14(folder);
23538
23570
  }
23539
23571
  }
23540
23572
  function processHasOlderGeneration() {
@@ -23772,15 +23804,15 @@ var init_process_heartbeat = __esm({
23772
23804
  // src/version-fence.ts
23773
23805
  import { readdir as readdir2, readFile as readFile9 } from "node:fs/promises";
23774
23806
  import { homedir as homedir3 } from "node:os";
23775
- import { join as join11 } from "node:path";
23807
+ import { join as join12 } from "node:path";
23776
23808
  function defaultStateHome() {
23777
- return process.env.XDG_STATE_HOME || join11(homedir3(), ".local", "state");
23809
+ return process.env.XDG_STATE_HOME || join12(homedir3(), ".local", "state");
23778
23810
  }
23779
23811
  function processHeartbeatDir2(stateHome = defaultStateHome()) {
23780
- return join11(stateHome, "cortexkit", "antigravity-auth", "processes");
23812
+ return join12(stateHome, "cortexkit", "antigravity-auth", "processes");
23781
23813
  }
23782
23814
  function rpcStateRoot(stateHome = defaultStateHome()) {
23783
- return join11(stateHome, "cortexkit", "antigravity-auth", "rpc");
23815
+ return join12(stateHome, "cortexkit", "antigravity-auth", "rpc");
23784
23816
  }
23785
23817
  function isRpcProjectDir(name) {
23786
23818
  return /^[0-9a-f]{16}$/.test(name);
@@ -23895,7 +23927,7 @@ async function versionFenceOpen(options) {
23895
23927
  for (const name of heartbeats.ok ? heartbeats.names : []) {
23896
23928
  const pid = pidFrom(name, /^(\d+)\.json$/);
23897
23929
  if (pid === void 0 || pid === self) continue;
23898
- const path2 = join11(heartbeatDir, name);
23930
+ const path2 = join12(heartbeatDir, name);
23899
23931
  const heartbeat = await readProcessRecord(path2, pid);
23900
23932
  if (heartbeat.kind === "gone") continue;
23901
23933
  if (!alive(pid)) continue;
@@ -23919,7 +23951,7 @@ async function versionFenceOpen(options) {
23919
23951
  block({ pid: "unknown", version: "unknown", detail: projects.error });
23920
23952
  for (const project2 of projects.ok ? projects.names : []) {
23921
23953
  if (!isRpcProjectDir(project2)) continue;
23922
- const dir = join11(rpcRoot, project2);
23954
+ const dir = join12(rpcRoot, project2);
23923
23955
  const ports = await list2(dir);
23924
23956
  if (!ports.ok) {
23925
23957
  if (ports.code === "ENOTDIR") continue;
@@ -23929,7 +23961,7 @@ async function versionFenceOpen(options) {
23929
23961
  for (const name of ports.names) {
23930
23962
  const pid = pidFrom(name, /^port-(\d+)\.json$/);
23931
23963
  if (pid === void 0 || pid === self || !alive(pid)) continue;
23932
- const path2 = join11(dir, name);
23964
+ const path2 = join12(dir, name);
23933
23965
  const port = await readProcessRecord(path2, pid);
23934
23966
  if (port.kind === "gone") continue;
23935
23967
  const version = port.kind === "ok" ? port.version : "unknown";
@@ -23980,7 +24012,7 @@ import {
23980
24012
  stat as stat8,
23981
24013
  unlink as unlink9
23982
24014
  } from "node:fs/promises";
23983
- import { basename as basename4, dirname as dirname15, join as join12, resolve as resolve14 } from "node:path";
24015
+ import { basename as basename4, dirname as dirname15, join as join13, resolve as resolve15 } from "node:path";
23984
24016
  function refusalMessage(stateDir, errorClass2) {
23985
24017
  if (errorClass2 === "ERR_PRIVATE_FILES_SECURITY")
23986
24018
  return `antigravity-auth cannot start: ${stateDir} is not a folder only your user can access, or it is a link, so the plugin will not use it (${errorClass2}). Replace it with a plain folder of your own, then restart OpenCode.`;
@@ -24067,7 +24099,7 @@ function prepareRuntimeLayout(options) {
24067
24099
  async function decide(location, options) {
24068
24100
  const log8 = options.log ?? createLogger4("runtime-layout");
24069
24101
  const stateDir = location.stateHomeDir;
24070
- const markerPath = join12(stateDir, RUNTIME_LAYOUT_MARKER_FILE);
24102
+ const markerPath = join13(stateDir, RUNTIME_LAYOUT_MARKER_FILE);
24071
24103
  const files = layoutFiles(location, options.accountFile);
24072
24104
  const fence = options.fence ?? defaultFence(options.version);
24073
24105
  const stateHome = async () => {
@@ -24079,7 +24111,7 @@ async function decide(location, options) {
24079
24111
  if (marker?.oldFilesRemoved) {
24080
24112
  await refuseReappearedFiles(location, files);
24081
24113
  const manifestLeft = await exists2(
24082
- join12(stateDir, RUNTIME_LAYOUT_MANIFEST_FILE)
24114
+ join13(stateDir, RUNTIME_LAYOUT_MANIFEST_FILE)
24083
24115
  ).catch(() => true);
24084
24116
  if (!manifestLeft) {
24085
24117
  await settleVault(location, options, "state-home", log8);
@@ -24245,7 +24277,7 @@ async function prepareAccountStore(options) {
24245
24277
  await ensureOwnerOnlyDir(location.stateHomeDir);
24246
24278
  const lock = await takeLock(
24247
24279
  RUNTIME_LAYOUT_LOCK_NAME,
24248
- join12(location.stateHomeDir, RUNTIME_LAYOUT_MARKER_FILE),
24280
+ join13(location.stateHomeDir, RUNTIME_LAYOUT_MARKER_FILE),
24249
24281
  options.layoutLockWaitMs ?? LAYOUT_LOCK_WAIT_MS,
24250
24282
  log8
24251
24283
  );
@@ -24359,7 +24391,7 @@ async function recordAnchor(location, options, anchor, log8) {
24359
24391
  }
24360
24392
  async function storeMovePathResolves(stateAnchor, location, log8) {
24361
24393
  if (folderResolvesToItself(
24362
- join12(location.stateHomeDir, "antigravity-accounts.json")
24394
+ join13(location.stateHomeDir, "antigravity-accounts.json")
24363
24395
  ))
24364
24396
  return true;
24365
24397
  logOnce(
@@ -24727,7 +24759,7 @@ async function removeLeftoverManifest(location, layoutLock, steps, log8) {
24727
24759
  }
24728
24760
  }
24729
24761
  async function removeManifestOwned(stateDir, layoutLock, steps) {
24730
- const path2 = join12(stateDir, RUNTIME_LAYOUT_MANIFEST_FILE);
24762
+ const path2 = join13(stateDir, RUNTIME_LAYOUT_MANIFEST_FILE);
24731
24763
  if (!await exists2(path2)) return;
24732
24764
  await beforeRemove(path2, layoutLock, steps);
24733
24765
  await removeManifest(stateDir);
@@ -24767,7 +24799,7 @@ async function takeDataLocks(files, log8) {
24767
24799
  locks.push(
24768
24800
  await takeLock(
24769
24801
  lock.name,
24770
- join12(files.vault.old, lock.file),
24802
+ join13(files.vault.old, lock.file),
24771
24803
  lock.waitMs,
24772
24804
  log8
24773
24805
  )
@@ -24794,8 +24826,8 @@ function sha256(bytes) {
24794
24826
  }
24795
24827
  function vaultStateFile(files) {
24796
24828
  return {
24797
- old: join12(files.vault.old, VAULT_ENROLLMENT_STATE_FILE),
24798
- next: join12(files.vault.next, VAULT_ENROLLMENT_STATE_FILE)
24829
+ old: join13(files.vault.old, VAULT_ENROLLMENT_STATE_FILE),
24830
+ next: join13(files.vault.next, VAULT_ENROLLMENT_STATE_FILE)
24799
24831
  };
24800
24832
  }
24801
24833
  async function keepableVaultState(files, present2) {
@@ -24835,10 +24867,10 @@ async function isVaultShapedKeptState(files) {
24835
24867
  async function removeMovedVaultStateLeftover(vaultDir, accountFile) {
24836
24868
  const location = runtimeLayoutLocation();
24837
24869
  const files = layoutFiles(location, accountFile);
24838
- if (resolve14(vaultDir) !== resolve14(files.vault.next)) return;
24870
+ if (resolve15(vaultDir) !== resolve15(files.vault.next)) return;
24839
24871
  const stateDir = location.stateHomeDir;
24840
24872
  const marker = await readMarker(
24841
- join12(stateDir, RUNTIME_LAYOUT_MARKER_FILE),
24873
+ join13(stateDir, RUNTIME_LAYOUT_MARKER_FILE),
24842
24874
  stateDir,
24843
24875
  files.vault.old
24844
24876
  );
@@ -24867,13 +24899,13 @@ async function vaultFiles(dir) {
24867
24899
  }
24868
24900
  async function presentOldFiles(files) {
24869
24901
  return (await vaultFiles(files.vault.old)).map((name) => ({
24870
- old: join12(files.vault.old, name),
24871
- next: join12(files.vault.next, name)
24902
+ old: join13(files.vault.old, name),
24903
+ next: join13(files.vault.next, name)
24872
24904
  }));
24873
24905
  }
24874
24906
  async function destinationFiles(files) {
24875
24907
  return (await vaultFiles(files.vault.next)).map(
24876
- (name) => join12(files.vault.next, name)
24908
+ (name) => join13(files.vault.next, name)
24877
24909
  );
24878
24910
  }
24879
24911
  async function physicalAliases(location, files) {
@@ -24882,7 +24914,7 @@ async function physicalAliases(location, files) {
24882
24914
  [files.vault.old, files.vault.next]
24883
24915
  ];
24884
24916
  for (const name of VAULT_FILE_NAMES)
24885
- pairs.push([join12(files.vault.old, name), join12(files.vault.next, name)]);
24917
+ pairs.push([join13(files.vault.old, name), join13(files.vault.next, name)]);
24886
24918
  const aliased = [];
24887
24919
  for (const [old, next] of pairs)
24888
24920
  if (await samePhysical(old, next)) aliased.push(old);
@@ -24994,11 +25026,11 @@ async function unlinkIfIdentical(file, stateDir, guard) {
24994
25026
  async function refuseReappearedFiles(location, files) {
24995
25027
  const keptState = vaultStateFile(files).old;
24996
25028
  for (const name of await vaultFiles(files.vault.old)) {
24997
- const old = join12(files.vault.old, name);
25029
+ const old = join13(files.vault.old, name);
24998
25030
  if (old === keptState && await isVaultShapedKeptState(files)) continue;
24999
25031
  throw credentialConflict(location.stateHomeDir, {
25000
25032
  old,
25001
- next: join12(files.vault.next, name)
25033
+ next: join13(files.vault.next, name)
25002
25034
  });
25003
25035
  }
25004
25036
  }
@@ -25040,13 +25072,13 @@ async function assertOwnFolder(location, marker, files) {
25040
25072
  const stateDir = location.stateHomeDir;
25041
25073
  if (marker?.oldDir !== void 0 && marker.oldDir !== location.key)
25042
25074
  throw foreignMarker(
25043
- join12(stateDir, RUNTIME_LAYOUT_MARKER_FILE),
25075
+ join13(stateDir, RUNTIME_LAYOUT_MARKER_FILE),
25044
25076
  location.key,
25045
25077
  files.vault.old
25046
25078
  );
25047
25079
  let text2;
25048
25080
  try {
25049
- text2 = await readFile10(join12(stateDir, RUNTIME_CONFIG_DIR_NOTE_FILE), "utf8");
25081
+ text2 = await readFile10(join13(stateDir, RUNTIME_CONFIG_DIR_NOTE_FILE), "utf8");
25050
25082
  } catch (error) {
25051
25083
  const code2 = error.code;
25052
25084
  if (code2 === "ENOENT" || code2 === "ENOTDIR") return;
@@ -25060,7 +25092,7 @@ async function assertOwnFolder(location, marker, files) {
25060
25092
  if (owner !== location.key) throw foreignFolder(stateDir, location.key);
25061
25093
  }
25062
25094
  async function writeOwnerNote(location) {
25063
- const path2 = join12(location.stateHomeDir, RUNTIME_CONFIG_DIR_NOTE_FILE);
25095
+ const path2 = join13(location.stateHomeDir, RUNTIME_CONFIG_DIR_NOTE_FILE);
25064
25096
  if (await exists2(path2)) return;
25065
25097
  await writePrivateText(
25066
25098
  path2,
@@ -25071,7 +25103,7 @@ async function writeOwnerNote(location) {
25071
25103
  async function readManifest(stateDir) {
25072
25104
  let text2;
25073
25105
  try {
25074
- text2 = await readFile10(join12(stateDir, RUNTIME_LAYOUT_MANIFEST_FILE), "utf8");
25106
+ text2 = await readFile10(join13(stateDir, RUNTIME_LAYOUT_MANIFEST_FILE), "utf8");
25075
25107
  } catch (error) {
25076
25108
  if (error.code === "ENOENT") return /* @__PURE__ */ new Set();
25077
25109
  throw error;
@@ -25088,13 +25120,13 @@ async function readManifest(stateDir) {
25088
25120
  }
25089
25121
  async function writeManifest(stateDir, paths) {
25090
25122
  await writePrivateText(
25091
- join12(stateDir, RUNTIME_LAYOUT_MANIFEST_FILE),
25123
+ join13(stateDir, RUNTIME_LAYOUT_MANIFEST_FILE),
25092
25124
  `${JSON.stringify({ version: 1, files: paths }, null, 2)}
25093
25125
  `
25094
25126
  );
25095
25127
  }
25096
25128
  async function removeManifest(stateDir) {
25097
- await unlink9(join12(stateDir, RUNTIME_LAYOUT_MANIFEST_FILE)).catch(
25129
+ await unlink9(join13(stateDir, RUNTIME_LAYOUT_MANIFEST_FILE)).catch(
25098
25130
  (error) => {
25099
25131
  if (error.code !== "ENOENT") throw error;
25100
25132
  }
@@ -25263,9 +25295,9 @@ import {
25263
25295
  writeFileSync
25264
25296
  } from "node:fs";
25265
25297
  import { homedir as homedir4 } from "node:os";
25266
- import { dirname as dirname16, join as join13, resolve as resolve15 } from "node:path";
25298
+ import { dirname as dirname16, join as join14, resolve as resolve16 } from "node:path";
25267
25299
  async function ensureGitignore(configDir) {
25268
- const gitignorePath = join13(configDir, ".gitignore");
25300
+ const gitignorePath = join14(configDir, ".gitignore");
25269
25301
  try {
25270
25302
  let content;
25271
25303
  let existingLines = [];
@@ -25311,8 +25343,8 @@ async function ensureGitignore(configDir) {
25311
25343
  }
25312
25344
  }
25313
25345
  function getLegacyWindowsConfigDir() {
25314
- return join13(
25315
- process.env.APPDATA || join13(homedir4(), "AppData", "Roaming"),
25346
+ return join14(
25347
+ process.env.APPDATA || join14(homedir4(), "AppData", "Roaming"),
25316
25348
  "opencode"
25317
25349
  );
25318
25350
  }
@@ -25320,15 +25352,15 @@ function getConfigDir() {
25320
25352
  if (process.env.OPENCODE_CONFIG_DIR) {
25321
25353
  return process.env.OPENCODE_CONFIG_DIR;
25322
25354
  }
25323
- const xdgConfig2 = process.env.XDG_CONFIG_HOME || join13(homedir4(), ".config");
25324
- return join13(xdgConfig2, "opencode");
25355
+ const xdgConfig2 = process.env.XDG_CONFIG_HOME || join14(homedir4(), ".config");
25356
+ return join14(xdgConfig2, "opencode");
25325
25357
  }
25326
25358
  function migrateLegacyWindowsConfig() {
25327
25359
  if (process.platform !== "win32") {
25328
25360
  return false;
25329
25361
  }
25330
- const newPath = join13(getConfigDir(), "antigravity-accounts.json");
25331
- const legacyPath = join13(
25362
+ const newPath = join14(getConfigDir(), "antigravity-accounts.json");
25363
+ const legacyPath = join14(
25332
25364
  getLegacyWindowsConfigDir(),
25333
25365
  "antigravity-accounts.json"
25334
25366
  );
@@ -25363,8 +25395,8 @@ function migrateLegacyWindowsConfig() {
25363
25395
  }
25364
25396
  }
25365
25397
  function resolveWindowsAccountAnchor(newPath, legacyPath) {
25366
- const standard = resolve15(newPath);
25367
- const legacy = resolve15(legacyPath);
25398
+ const standard = resolve16(newPath);
25399
+ const legacy = resolve16(legacyPath);
25368
25400
  if (standard.toLowerCase() === legacy.toLowerCase()) return newPath;
25369
25401
  const standardPointer = existsSync3(accountStorePointerPath(standard));
25370
25402
  const legacyPointer = existsSync3(accountStorePointerPath(legacy));
@@ -25378,15 +25410,15 @@ function resolveWindowsAccountAnchor(newPath, legacyPath) {
25378
25410
  return newPath;
25379
25411
  }
25380
25412
  function getStoragePathWithMigration() {
25381
- const newPath = join13(getConfigDir(), "antigravity-accounts.json");
25413
+ const newPath = join14(getConfigDir(), "antigravity-accounts.json");
25382
25414
  if (process.platform === "win32") {
25383
25415
  migrateLegacyWindowsConfig();
25384
- const legacyPath = join13(
25416
+ const legacyPath = join14(
25385
25417
  getLegacyWindowsConfigDir(),
25386
25418
  "antigravity-accounts.json"
25387
25419
  );
25388
25420
  const anchored = resolveWindowsAccountAnchor(newPath, legacyPath);
25389
- if (resolve15(anchored).toLowerCase() !== resolve15(newPath).toLowerCase() && !existsSync3(accountStorePointerPath(resolve15(anchored)))) {
25421
+ if (resolve16(anchored).toLowerCase() !== resolve16(newPath).toLowerCase() && !existsSync3(accountStorePointerPath(resolve16(anchored)))) {
25390
25422
  log5.info("Using legacy Windows config path (migration failed)", {
25391
25423
  legacyPath,
25392
25424
  newPath
@@ -25400,20 +25432,20 @@ function stateHomeStoragePath() {
25400
25432
  return stateHomeAccountFile(runtimeLayoutLocation());
25401
25433
  }
25402
25434
  function accountFileForVault(configDir = getConfigDir()) {
25403
- const configured = join13(configDir, "antigravity-accounts.json");
25435
+ const configured = join14(configDir, "antigravity-accounts.json");
25404
25436
  if (process.platform !== "win32") return configured;
25405
25437
  const legacyDir = getLegacyWindowsConfigDir();
25406
- if (resolve15(configDir).toLowerCase() === resolve15(legacyDir).toLowerCase())
25438
+ if (resolve16(configDir).toLowerCase() === resolve16(legacyDir).toLowerCase())
25407
25439
  return configured;
25408
- const configuredVault = join13(configDir, "antigravity-auth-vault");
25409
- const legacyVault = join13(legacyDir, "antigravity-auth-vault");
25440
+ const configuredVault = join14(configDir, "antigravity-auth-vault");
25441
+ const legacyVault = join14(legacyDir, "antigravity-auth-vault");
25410
25442
  const configuredPresent = existsSync3(configuredVault);
25411
25443
  const legacyPresent = existsSync3(legacyVault);
25412
25444
  if (configuredPresent && legacyPresent)
25413
25445
  throw new Error(
25414
25446
  `Two vault folders exist: ${configuredVault} and ${legacyVault}. Keep one vault enrollment before restarting OpenCode.`
25415
25447
  );
25416
- return legacyPresent ? join13(legacyDir, "antigravity-accounts.json") : configured;
25448
+ return legacyPresent ? join14(legacyDir, "antigravity-accounts.json") : configured;
25417
25449
  }
25418
25450
  async function prepareLocalAccountStore() {
25419
25451
  if (!decidedRuntimeLayout(runtimeLayoutLocation())) return;
@@ -25428,13 +25460,13 @@ function getStoragePath() {
25428
25460
  if (anchor === "config") return getStoragePathWithMigration();
25429
25461
  const location = runtimeLayoutLocation();
25430
25462
  if (decidedRuntimeLayout(location))
25431
- return join13(location.configDir, "antigravity-accounts.json");
25463
+ return join14(location.configDir, "antigravity-accounts.json");
25432
25464
  const configPath = getStoragePathWithMigration();
25433
25465
  return readForwardedAccountStore(configPath)?.legacyPath ?? configPath;
25434
25466
  }
25435
25467
  async function assertLegacyPoolInUse(legacyPath) {
25436
25468
  try {
25437
- await assertLegacyAccountStorageWritable(resolve15(legacyPath));
25469
+ await assertLegacyAccountStorageWritable(resolve16(legacyPath));
25438
25470
  } catch (error) {
25439
25471
  throw new LegacyAccountPoolRetiredError(legacyPath, { cause: error });
25440
25472
  }
@@ -25452,7 +25484,7 @@ function refusalMessage2(admission) {
25452
25484
  async function bindingOf(options) {
25453
25485
  if (options.legacyPath === void 0) await prepareLocalAccountStore();
25454
25486
  const now = options.now ?? (() => Date.now());
25455
- const legacyPath = resolve15(options.legacyPath ?? getStoragePath());
25487
+ const legacyPath = resolve16(options.legacyPath ?? getStoragePath());
25456
25488
  return {
25457
25489
  legacyPath,
25458
25490
  now,
@@ -25521,7 +25553,7 @@ async function openAccountStore(options) {
25521
25553
  async function initializeFreshAccountStoreFor(modules, options = {}) {
25522
25554
  if (options.legacyPath === void 0) await prepareLocalAccountStore();
25523
25555
  return initializeFreshAccountStore(modules, {
25524
- legacyPath: resolve15(options.legacyPath ?? getStoragePath()),
25556
+ legacyPath: resolve16(options.legacyPath ?? getStoragePath()),
25525
25557
  now: options.now ?? (() => Date.now())
25526
25558
  });
25527
25559
  }
@@ -25567,12 +25599,12 @@ var init_storage = __esm({
25567
25599
  import { createHash as createHash11 } from "node:crypto";
25568
25600
  import { existsSync as existsSync4, promises as fs2, readFileSync as readFileSync2, realpathSync as realpathSync2 } from "node:fs";
25569
25601
  import { homedir as homedir5 } from "node:os";
25570
- import { dirname as dirname17, join as join14, resolve as resolve16 } from "node:path";
25602
+ import { dirname as dirname17, join as join15, resolve as resolve17 } from "node:path";
25571
25603
  function configDirIdentity(path2) {
25572
25604
  try {
25573
25605
  return realpathSync2.native(path2);
25574
25606
  } catch {
25575
- return resolve16(path2);
25607
+ return resolve17(path2);
25576
25608
  }
25577
25609
  }
25578
25610
  function decisionKey(location) {
@@ -25580,18 +25612,18 @@ function decisionKey(location) {
25580
25612
  }
25581
25613
  function runtimeLayoutLocation(configDir = getConfigDir()) {
25582
25614
  const stateHome = defaultStateHome();
25583
- const homeConfig = join14(homedir5(), ".config", "opencode");
25615
+ const homeConfig = join15(homedir5(), ".config", "opencode");
25584
25616
  const cacheKey = `${configDir}\0${homeConfig}\0${stateHome}`;
25585
25617
  const cached = shared2.locations.get(cacheKey);
25586
25618
  if (cached && shared2.decisions.has(decisionKey(cached))) return cached;
25587
25619
  const key = configDirIdentity(configDir);
25588
25620
  if (cached && cached.key === key) return cached;
25589
25621
  const isDefaultConfigDir = key === configDirIdentity(homeConfig);
25590
- const root = join14(stateHome, "cortexkit", "antigravity-auth");
25622
+ const root = join15(stateHome, "cortexkit", "antigravity-auth");
25591
25623
  const location = {
25592
25624
  key,
25593
25625
  configDir,
25594
- stateHomeDir: isDefaultConfigDir ? join14(root, "opencode") : join14(
25626
+ stateHomeDir: isDefaultConfigDir ? join15(root, "opencode") : join15(
25595
25627
  root,
25596
25628
  `opencode-${createHash11("sha256").update(key).digest("hex").slice(0, 16)}`
25597
25629
  ),
@@ -25613,46 +25645,46 @@ function decidedAccountStoreAnchor(location) {
25613
25645
  return shared2.storeAnchors.get(`${location.stateHomeDir}\0${location.key}`);
25614
25646
  }
25615
25647
  function currentRuntimeLayout(location = runtimeLayoutLocation()) {
25616
- return decidedRuntimeLayout(location) ?? (existsSync4(join14(location.stateHomeDir, RUNTIME_LAYOUT_MARKER_FILE)) ? "state-home" : "legacy");
25648
+ return decidedRuntimeLayout(location) ?? (existsSync4(join15(location.stateHomeDir, RUNTIME_LAYOUT_MARKER_FILE)) ? "state-home" : "legacy");
25617
25649
  }
25618
25650
  function legacyWindowsConfigDir() {
25619
- return join14(
25620
- process.env.APPDATA || join14(homedir5(), "AppData", "Roaming"),
25651
+ return join15(
25652
+ process.env.APPDATA || join15(homedir5(), "AppData", "Roaming"),
25621
25653
  "opencode"
25622
25654
  );
25623
25655
  }
25624
25656
  function pluginStateDir() {
25625
- return join14(defaultStateHome(), "cortexkit", "antigravity-auth");
25657
+ return join15(defaultStateHome(), "cortexkit", "antigravity-auth");
25626
25658
  }
25627
25659
  function legacySignatureCacheFile() {
25628
- const configHome = process.platform === "win32" ? legacyWindowsConfigDir() : join14(
25629
- process.env.XDG_CONFIG_HOME || join14(homedir5(), ".config"),
25660
+ const configHome = process.platform === "win32" ? legacyWindowsConfigDir() : join15(
25661
+ process.env.XDG_CONFIG_HOME || join15(homedir5(), ".config"),
25630
25662
  "opencode"
25631
25663
  );
25632
- return join14(configHome, SIGNATURE_CACHE_FILE_NAME);
25664
+ return join15(configHome, SIGNATURE_CACHE_FILE_NAME);
25633
25665
  }
25634
25666
  function stateHomeLogsDir() {
25635
- return join14(pluginStateDir(), "logs");
25667
+ return join15(pluginStateDir(), "logs");
25636
25668
  }
25637
25669
  function legacyAccountFile(configDir = getConfigDir()) {
25638
- const standard = join14(configDir, ACCOUNT_FILE_NAME);
25670
+ const standard = join15(configDir, ACCOUNT_FILE_NAME);
25639
25671
  if (process.platform !== "win32") return standard;
25640
25672
  return resolveWindowsAccountAnchor(
25641
25673
  standard,
25642
- join14(legacyWindowsConfigDir(), ACCOUNT_FILE_NAME)
25674
+ join15(legacyWindowsConfigDir(), ACCOUNT_FILE_NAME)
25643
25675
  );
25644
25676
  }
25645
25677
  function legacyVaultDir(accountFile) {
25646
- return join14(dirname17(accountFile), VAULT_DIR_NAME);
25678
+ return join15(dirname17(accountFile), VAULT_DIR_NAME);
25647
25679
  }
25648
25680
  function stateHomeVaultDir(location) {
25649
- return join14(location.stateHomeDir, VAULT_DIR_NAME);
25681
+ return join15(location.stateHomeDir, VAULT_DIR_NAME);
25650
25682
  }
25651
25683
  function accountStorePointerPath2(accountFile) {
25652
25684
  return `${accountFile}${ACCOUNT_STORE_POINTER_SUFFIX}`;
25653
25685
  }
25654
25686
  function stateHomeAccountFile(location) {
25655
- return join14(realPathOrSelf(location.stateHomeDir), ACCOUNT_FILE_NAME);
25687
+ return join15(realPathOrSelf(location.stateHomeDir), ACCOUNT_FILE_NAME);
25656
25688
  }
25657
25689
  function realPathOrSelf(path2) {
25658
25690
  try {
@@ -25872,7 +25904,7 @@ import {
25872
25904
  statSync as statSync4,
25873
25905
  unlinkSync as unlinkSync2
25874
25906
  } from "node:fs";
25875
- import { join as join15 } from "node:path";
25907
+ import { join as join16 } from "node:path";
25876
25908
  import { env } from "node:process";
25877
25909
  function getLogsDir(customLogDir) {
25878
25910
  const logsDir = customLogDir || stateHomeLogsDir();
@@ -25891,9 +25923,9 @@ function createLogFilePath(customLogDir) {
25891
25923
  const logsDir = getLogsDir(requestedLogDir(customLogDir));
25892
25924
  cleanupOldLogs(logsDir, 25);
25893
25925
  const timestamp = (/* @__PURE__ */ new Date()).toISOString().replace(/[:.]/g, "-");
25894
- let candidate = join15(logsDir, `antigravity-debug-${timestamp}.log`);
25926
+ let candidate = join16(logsDir, `antigravity-debug-${timestamp}.log`);
25895
25927
  for (let suffix = 2; liveLogFilePaths.has(candidate); suffix++) {
25896
- candidate = join15(logsDir, `antigravity-debug-${timestamp}-${suffix}.log`);
25928
+ candidate = join16(logsDir, `antigravity-debug-${timestamp}-${suffix}.log`);
25897
25929
  }
25898
25930
  return candidate;
25899
25931
  }
@@ -25901,7 +25933,7 @@ function cleanupOldLogs(logsDir, maxFiles) {
25901
25933
  try {
25902
25934
  const files = readdirSync(logsDir).filter(
25903
25935
  (file) => file.startsWith("antigravity-debug-") && file.endsWith(".log")
25904
- ).map((file) => join15(logsDir, file));
25936
+ ).map((file) => join16(logsDir, file));
25905
25937
  if (files.length <= maxFiles) {
25906
25938
  return;
25907
25939
  }
@@ -26234,13 +26266,13 @@ function closeDebugLog() {
26234
26266
  if (!state || !current) return Promise.resolve();
26235
26267
  state.logStream = null;
26236
26268
  if (state.logFilePath) liveLogFilePaths.delete(state.logFilePath);
26237
- return new Promise((resolve21) => {
26238
- current.once("close", () => resolve21());
26239
- current.once("error", () => resolve21());
26269
+ return new Promise((resolve22) => {
26270
+ current.once("close", () => resolve22());
26271
+ current.once("error", () => resolve22());
26240
26272
  try {
26241
26273
  current.end();
26242
26274
  } catch {
26243
- resolve21();
26275
+ resolve22();
26244
26276
  }
26245
26277
  });
26246
26278
  }
@@ -26386,7 +26418,7 @@ var init_logger4 = __esm({
26386
26418
  init_dist();
26387
26419
  import { execFile } from "node:child_process";
26388
26420
  import { realpathSync as realpathSync4 } from "node:fs";
26389
- import { resolve as resolve20 } from "node:path";
26421
+ import { resolve as resolve21 } from "node:path";
26390
26422
  import { createInterface } from "node:readline/promises";
26391
26423
  import { fileURLToPath as fileURLToPath2 } from "node:url";
26392
26424
  import { promisify } from "node:util";
@@ -26794,14 +26826,14 @@ async function fetchQuotaPayloads(options) {
26794
26826
  };
26795
26827
  }
26796
26828
  function untilQuotaAborted(pending, signal) {
26797
- return new Promise((resolve21, reject) => {
26829
+ return new Promise((resolve22, reject) => {
26798
26830
  const abort = () => reject(signal.reason);
26799
26831
  if (signal.aborted) abort();
26800
26832
  else signal.addEventListener("abort", abort, { once: true });
26801
26833
  void pending.then(
26802
26834
  (value) => {
26803
26835
  signal.removeEventListener("abort", abort);
26804
- resolve21(value);
26836
+ resolve22(value);
26805
26837
  },
26806
26838
  (error) => {
26807
26839
  signal.removeEventListener("abort", abort);
@@ -27083,12 +27115,12 @@ async function startOAuthListener({
27083
27115
  let resolveCallback;
27084
27116
  let rejectCallback;
27085
27117
  let timeoutHandle;
27086
- const callbackPromise = new Promise((resolve21, reject) => {
27118
+ const callbackPromise = new Promise((resolve22, reject) => {
27087
27119
  resolveCallback = (url) => {
27088
27120
  if (settled) return;
27089
27121
  settled = true;
27090
27122
  if (timeoutHandle) clearTimeout(timeoutHandle);
27091
- resolve21(url);
27123
+ resolve22(url);
27092
27124
  };
27093
27125
  rejectCallback = (error) => {
27094
27126
  if (settled) return;
@@ -27247,7 +27279,7 @@ async function startOAuthListener({
27247
27279
  });
27248
27280
  });
27249
27281
  const bindAddress = getBindAddress();
27250
- await new Promise((resolve21, reject) => {
27282
+ await new Promise((resolve22, reject) => {
27251
27283
  const handleError = (error) => {
27252
27284
  server.off("error", handleError);
27253
27285
  if (error.code === "EADDRINUSE") {
@@ -27263,7 +27295,7 @@ async function startOAuthListener({
27263
27295
  server.once("error", handleError);
27264
27296
  server.listen(port, bindAddress, () => {
27265
27297
  server.off("error", handleError);
27266
- resolve21();
27298
+ resolve22();
27267
27299
  });
27268
27300
  });
27269
27301
  server.on("error", (error) => {
@@ -27271,7 +27303,7 @@ async function startOAuthListener({
27271
27303
  });
27272
27304
  return {
27273
27305
  waitForCallback: () => callbackPromise,
27274
- close: () => new Promise((resolve21, reject) => {
27306
+ close: () => new Promise((resolve22, reject) => {
27275
27307
  server.close((error) => {
27276
27308
  if (error && error.code !== "ERR_SERVER_NOT_RUNNING") {
27277
27309
  reject(error);
@@ -27280,7 +27312,7 @@ async function startOAuthListener({
27280
27312
  if (!settled) {
27281
27313
  rejectCallback(new Error("OAuth listener closed before callback"));
27282
27314
  }
27283
- resolve21();
27315
+ resolve22();
27284
27316
  });
27285
27317
  })
27286
27318
  };
@@ -27299,7 +27331,7 @@ init_runtime_paths();
27299
27331
  // src/setup.ts
27300
27332
  init_dist();
27301
27333
  import { lstat as lstat9, readFile as readFile13 } from "node:fs/promises";
27302
- import { join as join21, resolve as resolve19 } from "node:path";
27334
+ import { join as join22, resolve as resolve20 } from "node:path";
27303
27335
 
27304
27336
  // src/auth-method-labels.ts
27305
27337
  var OPENCODE2_POOL_AUTH_LABEL = "Google (antigravity-auth pool, browser)";
@@ -27471,7 +27503,7 @@ async function select2(terminal, items, options) {
27471
27503
  writeLine("");
27472
27504
  renderedLines = lines;
27473
27505
  };
27474
- return new Promise((resolve21) => {
27506
+ return new Promise((resolve22) => {
27475
27507
  const wasRaw = stdin.isRaw ?? false;
27476
27508
  const cleanup2 = () => {
27477
27509
  if (cleaned)
@@ -27491,7 +27523,7 @@ async function select2(terminal, items, options) {
27491
27523
  };
27492
27524
  const finish = (value) => {
27493
27525
  cleanup2();
27494
- resolve21(value);
27526
+ resolve22(value);
27495
27527
  };
27496
27528
  const onSignal = () => finish(null);
27497
27529
  const onKey = (data) => {
@@ -27531,7 +27563,7 @@ async function select2(terminal, items, options) {
27531
27563
  stdin.setRawMode(true);
27532
27564
  } catch {
27533
27565
  cleanup2();
27534
- resolve21(null);
27566
+ resolve22(null);
27535
27567
  return;
27536
27568
  }
27537
27569
  stdin.resume();
@@ -27545,12 +27577,12 @@ async function select2(terminal, items, options) {
27545
27577
  import { createHash as createHash12, randomBytes as randomBytes3, randomUUID as randomUUID15 } from "node:crypto";
27546
27578
  import { constants as fsConstants2 } from "node:fs";
27547
27579
  import { chmod as chmod5, mkdir as mkdir14, open as open10, readFile as readFile12, realpath as realpath4, rename as rename12, stat as stat10, unlink as unlink10 } from "node:fs/promises";
27548
- import { basename as basename5, dirname as dirname19, extname as extname2, isAbsolute as isAbsolute3, join as join17, resolve as resolve18 } from "node:path";
27580
+ import { basename as basename5, dirname as dirname19, extname as extname2, isAbsolute as isAbsolute3, join as join18, resolve as resolve19 } from "node:path";
27549
27581
  import { ClaustrumCredentialError as ClaustrumCredentialError5, ClaustrumClient as ClaustrumWireClient2, writeEnrollmentTokenFile as writeEnrollmentTokenFile2 } from "@cortexkit/claustrum-client";
27550
27582
 
27551
27583
  // src/common-auth-embedded/fs/file-read-cache.js
27552
27584
  import { lstat as lstat7 } from "node:fs/promises";
27553
- import { resolve as resolve17 } from "node:path";
27585
+ import { resolve as resolve18 } from "node:path";
27554
27586
  async function identity2(path2) {
27555
27587
  try {
27556
27588
  const metadata = await lstat7(path2);
@@ -27567,7 +27599,7 @@ function sameIdentity2(left, right) {
27567
27599
  var FileReadCache2 = class {
27568
27600
  #entries = /* @__PURE__ */ new Map();
27569
27601
  async read(paths, read, validateHit) {
27570
- const resolvedPaths = paths.map((path2) => resolve17(path2));
27602
+ const resolvedPaths = paths.map((path2) => resolve18(path2));
27571
27603
  const key = JSON.stringify(resolvedPaths);
27572
27604
  const probed = await Promise.all(resolvedPaths.map(identity2));
27573
27605
  const identities = probed.every((entry) => entry !== void 0) ? probed : void 0;
@@ -27619,9 +27651,10 @@ init_private_files2();
27619
27651
  init_private_files2();
27620
27652
  import { randomUUID as randomUUID14 } from "node:crypto";
27621
27653
  import { lstat as lstat8, mkdir as mkdir13, open as open9, readFile as readFile11, rename as rename11, rm as rm6, stat as stat9 } from "node:fs/promises";
27622
- import { dirname as dirname18, join as join16 } from "node:path";
27654
+ import { dirname as dirname18, join as join17 } from "node:path";
27623
27655
 
27624
27656
  // src/common-auth-embedded/fs/with-lock.js
27657
+ init_private_files2();
27625
27658
  function lockPathFor2(target, name) {
27626
27659
  return `${target}.${name}.lock`;
27627
27660
  }
@@ -27679,7 +27712,7 @@ function acquireRefreshFileLock2(options) {
27679
27712
  }
27680
27713
  async function acquireRefreshFileLockWithClock2(options) {
27681
27714
  const lockPath = lockPathFor2(options.path, options.name);
27682
- const legacyOwnerPath = join16(lockPath, "owner.json");
27715
+ const legacyOwnerPath = join17(lockPath, "owner.json");
27683
27716
  const ownerId = randomUUID14();
27684
27717
  const now = options.now ?? Date.now;
27685
27718
  let renewTimer = null;
@@ -27687,8 +27720,8 @@ async function acquireRefreshFileLockWithClock2(options) {
27687
27720
  let releaseConfirmed = false;
27688
27721
  let loss;
27689
27722
  let resolveLoss;
27690
- const lostPromise = new Promise((resolve21) => {
27691
- resolveLoss = resolve21;
27723
+ const lostPromise = new Promise((resolve22) => {
27724
+ resolveLoss = resolve22;
27692
27725
  });
27693
27726
  function notifyTimerStep(event) {
27694
27727
  try {
@@ -27722,7 +27755,7 @@ async function acquireRefreshFileLockWithClock2(options) {
27722
27755
  let terminalIOError;
27723
27756
  let renewalInFlight = null;
27724
27757
  const evictPath = `${lockPath}.evicting`;
27725
- const evictOwnerPath = join16(evictPath, "owner.json");
27758
+ const evictOwnerPath = join17(evictPath, "owner.json");
27726
27759
  const evictOwnerId = randomUUID14();
27727
27760
  const EVICT_TTL = 5e3;
27728
27761
  const MAX_STEAL_ATTEMPTS = 8;
@@ -27849,7 +27882,7 @@ async function acquireRefreshFileLockWithClock2(options) {
27849
27882
  }
27850
27883
  }
27851
27884
  async function backoff() {
27852
- await new Promise((resolve21) => setTimeout(resolve21, Math.floor(Math.random() * 4)));
27885
+ await new Promise((resolve22) => setTimeout(resolve22, Math.floor(Math.random() * 4)));
27853
27886
  }
27854
27887
  async function readLockState(notifyReady = true) {
27855
27888
  if (notifyReady && options.onStep)
@@ -28339,7 +28372,7 @@ async function acquireRefreshFileLockWithClock2(options) {
28339
28372
  const remainingMs = deadline - performance.now();
28340
28373
  if (remainingMs <= 0)
28341
28374
  break;
28342
- await new Promise((resolve21) => setTimeout(resolve21, Math.min(delayMs, remainingMs)));
28375
+ await new Promise((resolve22) => setTimeout(resolve22, Math.min(delayMs, remainingMs)));
28343
28376
  delayMs = Math.min(delayMs * 2, 50);
28344
28377
  }
28345
28378
  if (windowsPrivateFiles2)
@@ -28404,7 +28437,7 @@ function getClaustrumEnrollmentPaths2(tokenPath) {
28404
28437
  const extension = extname2(tokenPath) || ".json";
28405
28438
  const stem = basename5(tokenPath, extname2(tokenPath));
28406
28439
  return {
28407
- statePath: join17(dirname19(tokenPath), `${stem}-state${extension}`),
28440
+ statePath: join18(dirname19(tokenPath), `${stem}-state${extension}`),
28408
28441
  tokenPath
28409
28442
  };
28410
28443
  }
@@ -28412,7 +28445,7 @@ function hostEnrollmentPaths2(input) {
28412
28445
  const override = input.override?.trim();
28413
28446
  if (override && !isAbsolute3(override) && !input.cwd)
28414
28447
  throw new ClaustrumConsumerError2("invalid-state", "A relative Claustrum enrollment override needs a base directory");
28415
- const tokenPath = override ? isAbsolute3(override) ? override : resolve18(input.cwd, override) : join17(input.stateDir, `${input.host}-enrollment.json`);
28448
+ const tokenPath = override ? isAbsolute3(override) ? override : resolve19(input.cwd, override) : join18(input.stateDir, `${input.host}-enrollment.json`);
28416
28449
  return getClaustrumEnrollmentPaths2(tokenPath);
28417
28450
  }
28418
28451
  function isRecord10(value) {
@@ -28645,7 +28678,7 @@ async function writeStateAtomic2(path2, state, ancestorOptions = {}) {
28645
28678
  }
28646
28679
  if (windowsPrivateFiles2)
28647
28680
  return writePrivateAtomic2(path2, bytes);
28648
- const temporary = join17(parent, `.${basename5(path2)}.${process.pid}.${randomUUID15()}.tmp`);
28681
+ const temporary = join18(parent, `.${basename5(path2)}.${process.pid}.${randomUUID15()}.tmp`);
28649
28682
  let descriptor;
28650
28683
  let created = false;
28651
28684
  try {
@@ -29040,7 +29073,7 @@ var ByteTail = class {
29040
29073
  };
29041
29074
  var defaultCommandRunner = {
29042
29075
  run(file, args, options = {}) {
29043
- return new Promise((resolve21) => {
29076
+ return new Promise((resolve22) => {
29044
29077
  const started = performance.now();
29045
29078
  const timeoutMs = options.timeoutMs ?? 15e3;
29046
29079
  const stderr = new ByteTail();
@@ -29058,7 +29091,7 @@ var defaultCommandRunner = {
29058
29091
  stdio: ["ignore", "pipe", "pipe"]
29059
29092
  });
29060
29093
  } catch {
29061
- resolve21({
29094
+ resolve22({
29062
29095
  exitCode: 1,
29063
29096
  stdout: "",
29064
29097
  stderr: "",
@@ -29093,7 +29126,7 @@ var defaultCommandRunner = {
29093
29126
  settled = true;
29094
29127
  if (timer)
29095
29128
  clearTimeout(timer);
29096
- resolve21({
29129
+ resolve22({
29097
29130
  exitCode: spawnError ? 1 : outputExceeded ? 1 : code2 ?? 1,
29098
29131
  stdout: Buffer.concat(stdout, stdoutLength).toString("utf8"),
29099
29132
  stderr: stderr.toString(),
@@ -29180,7 +29213,7 @@ function recordSetupEnrollment(failure, enrollment) {
29180
29213
  import { accessSync, constants as constants3, existsSync as existsSync6, readFileSync as readFileSync4, realpathSync as realpathSync3, statSync as statSync5 } from "node:fs";
29181
29214
  import { mkdtemp, rm as rm7 } from "node:fs/promises";
29182
29215
  import { tmpdir as tmpdir3 } from "node:os";
29183
- import { join as join18 } from "node:path";
29216
+ import { join as join19 } from "node:path";
29184
29217
  import { parse } from "jsonc-parser";
29185
29218
 
29186
29219
  // src/common-auth-embedded/setup/paths.js
@@ -29351,7 +29384,7 @@ async function detectHosts(plugin, io = {}) {
29351
29384
  return null;
29352
29385
  let root;
29353
29386
  try {
29354
- root = await mkdtemp(join18(tmpdir3(), "common-auth-setup-version-"));
29387
+ root = await mkdtemp(join19(tmpdir3(), "common-auth-setup-version-"));
29355
29388
  const probeEnv = {
29356
29389
  ...env3,
29357
29390
  HOME: root,
@@ -29936,7 +29969,7 @@ import { applyEdits, createScanner, findNodeAtLocation, modify, parse as parse2,
29936
29969
  // src/common-auth-embedded/setup/config-write.js
29937
29970
  import { randomUUID as randomUUID16 } from "node:crypto";
29938
29971
  import { mkdir as mkdir15, open as open11, rename as rename13, stat as stat12, unlink as unlink11 } from "node:fs/promises";
29939
- import { basename as basename6, dirname as dirname20, join as join19 } from "node:path";
29972
+ import { basename as basename6, dirname as dirname20, join as join20 } from "node:path";
29940
29973
  import { setTimeout as delay2 } from "node:timers/promises";
29941
29974
  async function writeHostConfigAtomic(file, content, options = {}) {
29942
29975
  const windows = (options.platform ?? process.platform) === "win32";
@@ -29951,7 +29984,7 @@ async function writeHostConfigAtomic(file, content, options = {}) {
29951
29984
  throw error;
29952
29985
  }
29953
29986
  }
29954
- const stage = join19(parent, `.${basename6(file)}.${(options.stageName ?? randomUUID16)()}.tmp`);
29987
+ const stage = join20(parent, `.${basename6(file)}.${(options.stageName ?? randomUUID16)()}.tmp`);
29955
29988
  let created = false;
29956
29989
  try {
29957
29990
  const handle = await open11(stage, "wx", mode ?? 438);
@@ -30370,10 +30403,10 @@ init_storage();
30370
30403
  // src/plugin/vault-activation.ts
30371
30404
  init_dist();
30372
30405
  import { homedir as homedir7 } from "node:os";
30373
- import { join as join20 } from "node:path";
30406
+ import { join as join21 } from "node:path";
30374
30407
  function nativeOpenCodeAuthPath(env3 = process.env, home = homedir7()) {
30375
- return join20(
30376
- env3.XDG_DATA_HOME || join20(home, ".local", "share"),
30408
+ return join21(
30409
+ env3.XDG_DATA_HOME || join21(home, ".local", "share"),
30377
30410
  "opencode",
30378
30411
  "auth.json"
30379
30412
  );
@@ -30455,7 +30488,7 @@ function openCodeVaultDir(accountFile) {
30455
30488
  return folder.vaultDir;
30456
30489
  }
30457
30490
  function nativeAuthPath(host, context) {
30458
- return host === "opencode" ? nativeOpenCodeAuthPath() : join21(context.piAgentDir, "auth.json");
30491
+ return host === "opencode" ? nativeOpenCodeAuthPath() : join22(context.piAgentDir, "auth.json");
30459
30492
  }
30460
30493
  function provider(host) {
30461
30494
  return host === "opencode" ? OPENCODE_VAULT_PROVIDER : ANTIGRAVITY_PROVIDER_ID;
@@ -30511,7 +30544,7 @@ async function writeNativeSlot(host, slot, context, expectedAuthority = "local")
30511
30544
  beforeRename: async () => {
30512
30545
  await assertSetupHostsStopped();
30513
30546
  const claustrum = await loadCommonAuthClaustrum();
30514
- const stateDir = host === "opencode" ? openCodeVaultDir(resolve19(accountFileForVault())) : getPiAntigravityVaultDir();
30547
+ const stateDir = host === "opencode" ? openCodeVaultDir(resolve20(accountFileForVault())) : getPiAntigravityVaultDir();
30515
30548
  if (await claustrum.enrollmentAuthority(
30516
30549
  claustrum.hostEnrollmentPaths({ stateDir, host }),
30517
30550
  `antigravity-auth-${host}`
@@ -30549,7 +30582,7 @@ async function createSetupPlugin(deps, migrateOpenCode, forceLogin = false) {
30549
30582
  // `beforeSignIn`, which may move it after this plugin is built.
30550
30583
  paths: {
30551
30584
  get stateDir() {
30552
- return openCodeVaultDir(resolve19(accountFileForVault()));
30585
+ return openCodeVaultDir(resolve20(accountFileForVault()));
30553
30586
  },
30554
30587
  host: "opencode"
30555
30588
  }
@@ -30566,7 +30599,7 @@ async function createSetupPlugin(deps, migrateOpenCode, forceLogin = false) {
30566
30599
  const assertLocal = async (host, context) => {
30567
30600
  if (host === "opencode")
30568
30601
  return assertLocalOpenCodeLogin(
30569
- resolve19(accountFileForVault()),
30602
+ resolve20(accountFileForVault()),
30570
30603
  context.opencodeGeneration
30571
30604
  );
30572
30605
  if (await authority(host) !== "local")
@@ -30582,7 +30615,7 @@ async function createSetupPlugin(deps, migrateOpenCode, forceLogin = false) {
30582
30615
  const { openPiSlot: openPiSlot2 } = await loadCommonAuthPiSlot();
30583
30616
  if ((await openPiSlot2({
30584
30617
  authPath: nativeAuthPath(host, context),
30585
- stashPath: join21(piDir, "google-login-stash.json"),
30618
+ stashPath: join22(piDir, "google-login-stash.json"),
30586
30619
  provider: ANTIGRAVITY_PROVIDER_ID,
30587
30620
  placeholderKey: PI_PLACEHOLDER_KEY
30588
30621
  }).inspect()).slot === "placeholder")
@@ -30622,7 +30655,7 @@ async function createSetupPlugin(deps, migrateOpenCode, forceLogin = false) {
30622
30655
  const { openPiSlot: openPiSlot2 } = await loadCommonAuthPiSlot();
30623
30656
  const inspection = await openPiSlot2({
30624
30657
  authPath: nativeAuthPath("pi", context),
30625
- stashPath: join21(piDir, "google-login-stash.json"),
30658
+ stashPath: join22(piDir, "google-login-stash.json"),
30626
30659
  provider: ANTIGRAVITY_PROVIDER_ID,
30627
30660
  placeholderKey: PI_PLACEHOLDER_KEY
30628
30661
  }).inspect();
@@ -30741,7 +30774,7 @@ Setup has not completed the OpenCode 2 native Google connection.
30741
30774
  await assertSetupHostsStopped();
30742
30775
  await openPiSlot2({
30743
30776
  authPath: nativeAuthPath(host, context),
30744
- stashPath: join21(piDir, "google-login-stash.json"),
30777
+ stashPath: join22(piDir, "google-login-stash.json"),
30745
30778
  provider: ANTIGRAVITY_PROVIDER_ID,
30746
30779
  placeholderKey: PI_PLACEHOLDER_KEY
30747
30780
  }).enterVault();
@@ -31196,7 +31229,7 @@ async function runCliProcess(argv, deps) {
31196
31229
  ...deps,
31197
31230
  prepareVaultFolder: deps.prepareVaultFolder ?? (async (options) => {
31198
31231
  const folder = await prepareVaultFolder({
31199
- accountFile: resolve20(accountFileForVault()),
31232
+ accountFile: resolve21(accountFileForVault()),
31200
31233
  ...options
31201
31234
  });
31202
31235
  if (folder.refusal) throw folder.refusal;
@@ -31242,11 +31275,11 @@ function createDefaultCliDependencies() {
31242
31275
  );
31243
31276
  if (host !== "pi")
31244
31277
  await assertLocalOpenCodeLogin(
31245
- resolve20(accountFileForVault()),
31278
+ resolve21(accountFileForVault()),
31246
31279
  context?.opencodeGeneration
31247
31280
  );
31248
31281
  const repository = host === "pi" ? void 0 : await prepareCliLoginStore(
31249
- resolve20(getStoragePath()),
31282
+ resolve21(getStoragePath()),
31250
31283
  context?.opencodeGeneration
31251
31284
  );
31252
31285
  try {
@@ -31262,7 +31295,7 @@ function createDefaultCliDependencies() {
31262
31295
  }
31263
31296
  if (host === "opencode") await assertSetupHostsStopped();
31264
31297
  await assertLocalOpenCodeLogin(
31265
- resolve20(accountFileForVault()),
31298
+ resolve21(accountFileForVault()),
31266
31299
  context?.opencodeGeneration
31267
31300
  );
31268
31301
  await persistCliStoreLogin(
@@ -31282,7 +31315,7 @@ function createDefaultCliDependencies() {
31282
31315
  };
31283
31316
  }
31284
31317
  async function prepareCliLoginStore(legacyPath, generation) {
31285
- await assertLocalOpenCodeLogin(resolve20(accountFileForVault()), generation);
31318
+ await assertLocalOpenCodeLogin(resolve21(accountFileForVault()), generation);
31286
31319
  const modules = await loadCommonAuthStoreModules();
31287
31320
  const options = {
31288
31321
  legacyPath,
@@ -31407,7 +31440,7 @@ async function readAccountStore(legacyPath) {
31407
31440
  function createDefaultAccountStoreOperations() {
31408
31441
  const offline = { processesStopped: true };
31409
31442
  return {
31410
- legacyPath: () => resolve20(
31443
+ legacyPath: () => resolve21(
31411
31444
  decidedAccountStoreAnchor(runtimeLayoutLocation()) ? getStoragePath() : discoveredAccountFile()
31412
31445
  ),
31413
31446
  migrate: async (legacyPath) => createAccountMigrationFactory(await loadCommonAuthStoreModules())({
@@ -31438,7 +31471,7 @@ function createDefaultAccountStoreOperations() {
31438
31471
  };
31439
31472
  }
31440
31473
  function samePath(left, right) {
31441
- return process.platform === "win32" ? resolve20(left).toLowerCase() === resolve20(right).toLowerCase() : resolve20(left) === resolve20(right);
31474
+ return process.platform === "win32" ? resolve21(left).toLowerCase() === resolve21(right).toLowerCase() : resolve21(left) === resolve21(right);
31442
31475
  }
31443
31476
  function isCliEntry() {
31444
31477
  if (import.meta.main !== void 0) return import.meta.main;