snowcode 0.9.2 → 0.9.23

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 (2) hide show
  1. package/dist/cli.mjs +358 -171
  2. package/package.json +1 -1
package/dist/cli.mjs CHANGED
@@ -125648,7 +125648,7 @@ var init_metadata = __esm(() => {
125648
125648
  isClaudeAiAuth: isClaudeAISubscriber(),
125649
125649
  version: "99.0.0",
125650
125650
  versionBase: getVersionBase(),
125651
- buildTime: "2026-04-05T03:33:03.306Z",
125651
+ buildTime: "2026-04-05T04:06:45.418Z",
125652
125652
  deploymentEnvironment: env2.detectDeploymentEnvironment(),
125653
125653
  ...isEnvTruthy(process.env.GITHUB_ACTIONS) && {
125654
125654
  githubEventName: process.env.GITHUB_EVENT_NAME,
@@ -129989,7 +129989,6 @@ var init_antigravityOAuth = __esm(() => {
129989
129989
 
129990
129990
  // src/services/api/providerConfig.ts
129991
129991
  import { existsSync as existsSync7, mkdirSync as mkdirSync5, readFileSync as readFileSync9, writeFileSync as writeFileSync4 } from "node:fs";
129992
- import { homedir as homedir11 } from "node:os";
129993
129992
  import { dirname as dirname12, join as join29 } from "node:path";
129994
129993
  function asTrimmedString(value) {
129995
129994
  return typeof value === "string" && value.trim() ? value.trim() : undefined;
@@ -130344,10 +130343,7 @@ function resolveCodexAuthPath(env4 = process.env) {
130344
130343
  const explicit = asTrimmedString(env4.CODEX_AUTH_JSON_PATH);
130345
130344
  if (explicit)
130346
130345
  return explicit;
130347
- const codexHome = asTrimmedString(env4.CODEX_HOME);
130348
- if (codexHome)
130349
- return join29(codexHome, "auth.json");
130350
- return join29(homedir11(), ".codex", "auth.json");
130346
+ return join29(getClaudeConfigHomeDir(), "codex-auth.json");
130351
130347
  }
130352
130348
  function parseChatgptAccountId(token) {
130353
130349
  if (!token)
@@ -130400,6 +130396,24 @@ function getPreferredCodexOauthAccount(accounts) {
130400
130396
  return rightAddedAt - leftAddedAt;
130401
130397
  })[0];
130402
130398
  }
130399
+ function getCodexRefreshCandidates(options) {
130400
+ const candidates = [];
130401
+ const seen = new Set;
130402
+ const pushCandidate = (refreshToken, source, account) => {
130403
+ const trimmed = asTrimmedString(refreshToken);
130404
+ if (!trimmed || seen.has(trimmed))
130405
+ return;
130406
+ seen.add(trimmed);
130407
+ candidates.push({
130408
+ refreshToken: trimmed,
130409
+ source,
130410
+ account
130411
+ });
130412
+ };
130413
+ pushCandidate(options.preferredAccount?.refreshToken, "accounts", options.preferredAccount);
130414
+ pushCandidate(options.authJsonRefreshToken, "auth.json");
130415
+ return candidates;
130416
+ }
130403
130417
  function getJwtExpiryTimeMs(token) {
130404
130418
  if (!token)
130405
130419
  return;
@@ -130553,12 +130567,15 @@ async function resolveCodexApiCredentialsForRequest(env4 = process.env) {
130553
130567
  };
130554
130568
  }
130555
130569
  const preferredAccount = getPreferredCodexOauthAccount(loadAccounts().accounts);
130556
- const refreshToken = authJsonRefreshToken ?? asTrimmedString(preferredAccount?.refreshToken);
130557
- if (refreshToken) {
130558
- const refreshed2 = await refreshCodexAccessToken(refreshToken);
130570
+ const refreshCandidates = getCodexRefreshCandidates({
130571
+ authJsonRefreshToken,
130572
+ preferredAccount
130573
+ });
130574
+ for (const candidate of refreshCandidates) {
130575
+ const refreshed2 = await refreshCodexAccessToken(candidate.refreshToken);
130559
130576
  if (refreshed2?.accessToken) {
130560
130577
  const refreshedAccountId = envAccountId ?? parseChatgptAccountId(refreshed2.accessToken) ?? authJsonAccountId;
130561
- const rotatedRefreshToken = refreshed2.refreshToken ?? refreshToken;
130578
+ const rotatedRefreshToken = refreshed2.refreshToken ?? candidate.refreshToken;
130562
130579
  persistCodexAuthJson({
130563
130580
  authPath,
130564
130581
  existing: authJson,
@@ -130566,8 +130583,8 @@ async function resolveCodexApiCredentialsForRequest(env4 = process.env) {
130566
130583
  accountId: refreshedAccountId,
130567
130584
  refreshToken: rotatedRefreshToken
130568
130585
  });
130569
- if (preferredAccount?.id && rotatedRefreshToken !== preferredAccount.refreshToken) {
130570
- updateAccount(preferredAccount.id, {
130586
+ if (candidate.account?.id && rotatedRefreshToken !== candidate.account.refreshToken) {
130587
+ updateAccount(candidate.account.id, {
130571
130588
  refreshToken: rotatedRefreshToken
130572
130589
  });
130573
130590
  }
@@ -130576,8 +130593,8 @@ async function resolveCodexApiCredentialsForRequest(env4 = process.env) {
130576
130593
  accountId: refreshedAccountId,
130577
130594
  authPath,
130578
130595
  refreshToken: rotatedRefreshToken,
130579
- accountRecordId: preferredAccount?.id,
130580
- source: authJsonRefreshToken ? "auth.json" : "accounts"
130596
+ accountRecordId: candidate.account?.id,
130597
+ source: candidate.source
130581
130598
  };
130582
130599
  }
130583
130600
  }
@@ -130594,7 +130611,7 @@ async function resolveCodexApiCredentialsForRequest(env4 = process.env) {
130594
130611
  apiKey: "",
130595
130612
  accountId: authJsonAccountId ?? envAccountId,
130596
130613
  authPath,
130597
- refreshToken,
130614
+ refreshToken: refreshCandidates[0]?.refreshToken ?? authJsonRefreshToken,
130598
130615
  accountRecordId: preferredAccount?.id,
130599
130616
  source: "none"
130600
130617
  };
@@ -130603,6 +130620,7 @@ var DEFAULT_OPENAI_BASE_URL = "https://api.openai.com/v1", DEFAULT_CODEX_BASE_UR
130603
130620
  var init_providerConfig = __esm(() => {
130604
130621
  init_accountManager();
130605
130622
  init_antigravityOAuth();
130623
+ init_envUtils();
130606
130624
  init_providerMetadata();
130607
130625
  ANTIGRAVITY_FALLBACK_BASE_URLS = [
130608
130626
  "https://daily-cloudcode-pa.googleapis.com",
@@ -130640,9 +130658,34 @@ var init_providerConfig = __esm(() => {
130640
130658
 
130641
130659
  // src/utils/updateCheck.ts
130642
130660
  import { existsSync as existsSync8, mkdirSync as mkdirSync6, readFileSync as readFileSync10, writeFileSync as writeFileSync5 } from "node:fs";
130661
+ import { createRequire as createRequire2 } from "node:module";
130643
130662
  import { join as join30 } from "node:path";
130663
+ function normalizeVersion(version2) {
130664
+ return version2.replace(/[^0-9.]/g, "").split(".").filter(Boolean).map((part) => Number(part) || 0);
130665
+ }
130666
+ function compareVersions(a2, b) {
130667
+ const av = normalizeVersion(a2);
130668
+ const bv = normalizeVersion(b);
130669
+ const len = Math.max(av.length, bv.length, 3);
130670
+ for (let i2 = 0;i2 < len; i2++) {
130671
+ const ai = av[i2] ?? 0;
130672
+ const bi = bv[i2] ?? 0;
130673
+ if (ai > bi)
130674
+ return 1;
130675
+ if (ai < bi)
130676
+ return -1;
130677
+ }
130678
+ return 0;
130679
+ }
130644
130680
  function getCurrentVersion() {
130645
- const displayVersion = (typeof MACRO !== "undefined" ? "0.9.2" : undefined) ?? "0.0.0";
130681
+ const displayVersion = (typeof MACRO !== "undefined" ? "0.9.23" : undefined) ?? (() => {
130682
+ try {
130683
+ const pkg = require2("../../package.json");
130684
+ return pkg.version;
130685
+ } catch {
130686
+ return;
130687
+ }
130688
+ })() ?? "0.0.0";
130646
130689
  return displayVersion.replace(/[^0-9.]/g, "") || "0.0.0";
130647
130690
  }
130648
130691
  function cachePath() {
@@ -130686,21 +130729,13 @@ async function fetchLatestVersion(timeoutMs) {
130686
130729
  function getAvailableUpdate(cache2) {
130687
130730
  if (!cache2)
130688
130731
  return null;
130689
- const cur = getCurrentVersion().split(".").map(Number);
130690
- const lat = cache2.latestVersion.split(".").map(Number);
130691
- for (let i2 = 0;i2 < 3; i2++) {
130692
- const c5 = cur[i2] ?? 0;
130693
- const l = lat[i2] ?? 0;
130694
- if (l > c5)
130695
- return cache2.latestVersion;
130696
- if (c5 > l)
130697
- return null;
130698
- }
130699
- return null;
130732
+ return compareVersions(cache2.latestVersion, getCurrentVersion()) > 0 ? cache2.latestVersion : null;
130700
130733
  }
130701
130734
  async function refreshUpdateCache(options) {
130702
130735
  const cache2 = readUpdateCache();
130703
- if (!options?.force && isUpdateCacheFresh(cache2)) {
130736
+ const currentVersion = getCurrentVersion();
130737
+ const canReuseFreshCache = isUpdateCacheFresh(cache2) && (!cache2 || compareVersions(cache2.latestVersion, currentVersion) >= 0);
130738
+ if (!options?.force && canReuseFreshCache) {
130704
130739
  return cache2;
130705
130740
  }
130706
130741
  const latestVersion = await fetchLatestVersion(options?.timeoutMs ?? 5000);
@@ -130718,10 +130753,11 @@ async function getAvailableUpdateWithRefresh(options) {
130718
130753
  const cache2 = await refreshUpdateCache(options);
130719
130754
  return getAvailableUpdate(cache2);
130720
130755
  }
130721
- var PKG_NAME = "snowcode", CHECK_INTERVAL_MS;
130756
+ var PKG_NAME = "snowcode", CHECK_INTERVAL_MS, require2;
130722
130757
  var init_updateCheck = __esm(() => {
130723
130758
  init_envUtils();
130724
130759
  CHECK_INTERVAL_MS = 24 * 60 * 60 * 1000;
130760
+ require2 = createRequire2(import.meta.url);
130725
130761
  });
130726
130762
 
130727
130763
  // src/components/StartupScreen.ts
@@ -130857,10 +130893,11 @@ async function printStartupScreen() {
130857
130893
  const sLen = ` ● ${sL} Ready — type /help to begin`.length;
130858
130894
  out.push(boxRow(sRow, W2, sLen));
130859
130895
  out.push(`${rgb(...BORDER)}╚${"═".repeat(W2 - 2)}╝${RESET}`);
130860
- const _ver = "0.9.2";
130896
+ const _ver = "0.9.23";
130897
+ const _currentVersion = getCurrentVersion();
130861
130898
  const _update = await getAvailableUpdateWithRefresh({ timeoutMs: 1200 });
130862
130899
  out.push(` ${DIM}${rgb(...DIMCOL)}snowcode v${_ver}${RESET}`);
130863
- if (_update) {
130900
+ if (_update && compareVersions(_update, _currentVersion) > 0) {
130864
130901
  out.push(` ${rgb(...ACCENT)}★ Update available v${_update} → /update${RESET}`);
130865
130902
  }
130866
130903
  out.push("");
@@ -171930,7 +171967,7 @@ var init_frontmatterParser = __esm(() => {
171930
171967
 
171931
171968
  // src/utils/ripgrep.ts
171932
171969
  import { execFile as execFile3, spawn as spawn2 } from "child_process";
171933
- import { homedir as homedir12 } from "os";
171970
+ import { homedir as homedir11 } from "os";
171934
171971
  import * as path11 from "path";
171935
171972
  import { fileURLToPath as fileURLToPath3 } from "url";
171936
171973
  function ripgrepCommand() {
@@ -172201,7 +172238,7 @@ var init_ripgrep = __esm(() => {
172201
172238
  }
172202
172239
  };
172203
172240
  countFilesRoundedRg = memoize_default(async (dirPath, abortSignal, ignorePatterns = []) => {
172204
- if (path11.resolve(dirPath) === path11.resolve(homedir12())) {
172241
+ if (path11.resolve(dirPath) === path11.resolve(homedir11())) {
172205
172242
  return;
172206
172243
  }
172207
172244
  try {
@@ -172295,7 +172332,7 @@ var init_pluginOnlyPolicy = __esm(() => {
172295
172332
  // src/utils/markdownConfigLoader.ts
172296
172333
  import { statSync as statSync4 } from "fs";
172297
172334
  import { lstat as lstat3, readdir as readdir7, readFile as readFile7, realpath as realpath5, stat as stat13 } from "fs/promises";
172298
- import { homedir as homedir13 } from "os";
172335
+ import { homedir as homedir12 } from "os";
172299
172336
  import { dirname as dirname17, join as join34, resolve as resolve13, sep as sep6 } from "path";
172300
172337
  function extractDescriptionFromMarkdown(content, defaultDescription = "Custom item") {
172301
172338
  const lines = content.split(`
@@ -172378,7 +172415,7 @@ function resolveStopBoundary(cwd2) {
172378
172415
  return cwdGitRoot;
172379
172416
  }
172380
172417
  function getProjectDirsUpToHome(subdir, cwd2) {
172381
- const home = resolve13(homedir13()).normalize("NFC");
172418
+ const home = resolve13(homedir12()).normalize("NFC");
172382
172419
  const gitRoot = resolveStopBoundary(cwd2);
172383
172420
  let current = resolve13(cwd2);
172384
172421
  const dirs = [];
@@ -174939,7 +174976,7 @@ var init_readOnlyCommandValidation = __esm(() => {
174939
174976
  });
174940
174977
 
174941
174978
  // src/utils/permissions/pathValidation.ts
174942
- import { homedir as homedir14 } from "os";
174979
+ import { homedir as homedir13 } from "os";
174943
174980
  import { dirname as dirname18, isAbsolute as isAbsolute6, resolve as resolve15 } from "path";
174944
174981
  function formatDirectoryList(directories) {
174945
174982
  const dirCount = directories.length;
@@ -174962,7 +174999,7 @@ function getGlobBaseDirectory(path12) {
174962
174999
  }
174963
175000
  function expandTilde(path12) {
174964
175001
  if (path12 === "~" || path12.startsWith("~/") || process.platform === "win32" && path12.startsWith("~\\")) {
174965
- return homedir14() + path12.slice(1);
175002
+ return homedir13() + path12.slice(1);
174966
175003
  }
174967
175004
  return path12;
174968
175005
  }
@@ -175079,7 +175116,7 @@ function isDangerousRemovalPath(resolvedPath) {
175079
175116
  if (WINDOWS_DRIVE_ROOT_REGEX.test(normalizedPath)) {
175080
175117
  return true;
175081
175118
  }
175082
- const normalizedHome = homedir14().replace(/[\\/]+/g, "/");
175119
+ const normalizedHome = homedir13().replace(/[\\/]+/g, "/");
175083
175120
  if (normalizedPath === normalizedHome) {
175084
175121
  return true;
175085
175122
  }
@@ -175779,7 +175816,7 @@ __export(exports_esm, {
175779
175816
  AsyncDecompress: () => AsyncDecompress,
175780
175817
  AsyncCompress: () => AsyncGzip
175781
175818
  });
175782
- import { createRequire as createRequire2 } from "module";
175819
+ import { createRequire as createRequire3 } from "module";
175783
175820
  function StrmOpt(opts, cb) {
175784
175821
  if (typeof opts == "function")
175785
175822
  cb = opts, opts = {};
@@ -176216,7 +176253,7 @@ function unzipSync(data, opts) {
176216
176253
  }
176217
176254
  return files;
176218
176255
  }
176219
- var require2, Worker, workerAdd = ";var __w=require('worker_threads');__w.parentPort.on('message',function(m){onmessage({data:m})}),postMessage=function(m,t){__w.parentPort.postMessage(m,t)},close=process.exit;self=global", wk, u8, u16, i32, fleb, fdeb, clim, freb = function(eb, start) {
176256
+ var require3, Worker, workerAdd = ";var __w=require('worker_threads');__w.parentPort.on('message',function(m){onmessage({data:m})}),postMessage=function(m,t){__w.parentPort.postMessage(m,t)},close=process.exit;self=global", wk, u8, u16, i32, fleb, fdeb, clim, freb = function(eb, start) {
176220
176257
  var b = new u16(31);
176221
176258
  for (var i2 = 0;i2 < 31; ++i2) {
176222
176259
  b[i2] = start += 1 << eb[i2 - 1];
@@ -177034,9 +177071,9 @@ var require2, Worker, workerAdd = ";var __w=require('worker_threads');__w.parent
177034
177071
  wbytes(o2, b + 16, e);
177035
177072
  }, ZipPassThrough, ZipDeflate, AsyncZipDeflate, Zip, UnzipPassThrough, UnzipInflate, AsyncUnzipInflate, Unzip, mt;
177036
177073
  var init_esm4 = __esm(() => {
177037
- require2 = createRequire2("/");
177074
+ require3 = createRequire3("/");
177038
177075
  try {
177039
- Worker = require2("worker_threads").Worker;
177076
+ Worker = require3("worker_threads").Worker;
177040
177077
  } catch (e) {}
177041
177078
  wk = Worker ? function(c6, _, msg, transfer, cb) {
177042
177079
  var done = false;
@@ -178026,11 +178063,11 @@ var init_zip = __esm(() => {
178026
178063
  });
178027
178064
 
178028
178065
  // src/utils/systemDirectories.ts
178029
- import { homedir as homedir15 } from "os";
178066
+ import { homedir as homedir14 } from "os";
178030
178067
  import { join as join38 } from "path";
178031
178068
  function getSystemDirectories(options) {
178032
178069
  const platform2 = options?.platform ?? getPlatform();
178033
- const homeDir = options?.homedir ?? homedir15();
178070
+ const homeDir = options?.homedir ?? homedir14();
178034
178071
  const env4 = options?.env ?? process.env;
178035
178072
  const defaults2 = {
178036
178073
  HOME: homeDir,
@@ -236972,7 +237009,7 @@ var init_sedValidation = __esm(() => {
236972
237009
  });
236973
237010
 
236974
237011
  // src/tools/BashTool/pathValidation.ts
236975
- import { homedir as homedir16 } from "os";
237012
+ import { homedir as homedir15 } from "os";
236976
237013
  import { isAbsolute as isAbsolute10, resolve as resolve16 } from "path";
236977
237014
  function checkDangerousRemovalPaths(command, args, cwd2) {
236978
237015
  const extractor = PATH_EXTRACTORS[command];
@@ -237421,7 +237458,7 @@ var init_pathValidation2 = __esm(() => {
237421
237458
  init_bashPermissions();
237422
237459
  init_sedValidation();
237423
237460
  PATH_EXTRACTORS = {
237424
- cd: (args) => args.length === 0 ? [homedir16()] : [args.join(" ")],
237461
+ cd: (args) => args.length === 0 ? [homedir15()] : [args.join(" ")],
237425
237462
  ls: (args) => {
237426
237463
  const paths2 = filterOutFlags(args);
237427
237464
  return paths2.length > 0 ? paths2 : ["."];
@@ -259350,11 +259387,11 @@ var init_oauthPort = __esm(() => {
259350
259387
  // src/utils/claudeInChrome/common.ts
259351
259388
  import { readdirSync as readdirSync3 } from "fs";
259352
259389
  import { stat as stat17 } from "fs/promises";
259353
- import { homedir as homedir17, platform as platform2, tmpdir as tmpdir2, userInfo as userInfo3 } from "os";
259390
+ import { homedir as homedir16, platform as platform2, tmpdir as tmpdir2, userInfo as userInfo3 } from "os";
259354
259391
  import { join as join48 } from "path";
259355
259392
  function getAllBrowserDataPaths() {
259356
259393
  const platform3 = getPlatform();
259357
- const home = homedir17();
259394
+ const home = homedir16();
259358
259395
  const paths2 = [];
259359
259396
  for (const browserId of BROWSER_DETECTION_ORDER) {
259360
259397
  const config2 = CHROMIUM_BROWSERS[browserId];
@@ -259389,7 +259426,7 @@ function getAllBrowserDataPaths() {
259389
259426
  }
259390
259427
  function getAllNativeMessagingHostsDirs() {
259391
259428
  const platform3 = getPlatform();
259392
- const home = homedir17();
259429
+ const home = homedir16();
259393
259430
  const paths2 = [];
259394
259431
  for (const browserId of BROWSER_DETECTION_ORDER) {
259395
259432
  const config2 = CHROMIUM_BROWSERS[browserId];
@@ -259460,7 +259497,7 @@ async function detectAvailableBrowser() {
259460
259497
  break;
259461
259498
  }
259462
259499
  case "windows": {
259463
- const home = homedir17();
259500
+ const home = homedir16();
259464
259501
  if (config2.windows.dataPath.length > 0) {
259465
259502
  const appDataBase = config2.windows.useRoaming ? join48(home, "AppData", "Roaming") : join48(home, "AppData", "Local");
259466
259503
  const dataPath = join48(appDataBase, ...config2.windows.dataPath);
@@ -264364,10 +264401,10 @@ var init_capitalize = __esm(() => {
264364
264401
  });
264365
264402
 
264366
264403
  // src/utils/jetbrains.ts
264367
- import { homedir as homedir18, platform as platform3 } from "os";
264404
+ import { homedir as homedir17, platform as platform3 } from "os";
264368
264405
  import { join as join55 } from "path";
264369
264406
  function buildCommonPluginDirectoryPaths(ideName) {
264370
- const homeDir = homedir18();
264407
+ const homeDir = homedir17();
264371
264408
  const directories = [];
264372
264409
  const idePatterns = ideNameToDirMap[ideName.toLowerCase()];
264373
264410
  if (!idePatterns) {
@@ -283079,7 +283116,7 @@ var init_shellConfig = __esm(() => {
283079
283116
  // src/utils/autoUpdater.ts
283080
283117
  import { constants as fsConstants2 } from "fs";
283081
283118
  import { access as access2, writeFile as writeFile10 } from "fs/promises";
283082
- import { homedir as homedir20 } from "os";
283119
+ import { homedir as homedir19 } from "os";
283083
283120
  import { join as join63 } from "path";
283084
283121
  async function assertMinVersion() {
283085
283122
  if (false) {}
@@ -283216,10 +283253,10 @@ async function getInstallationPrefix() {
283216
283253
  let prefixResult = null;
283217
283254
  if (isBun) {
283218
283255
  prefixResult = await execFileNoThrowWithCwd("bun", ["pm", "bin", "-g"], {
283219
- cwd: homedir20()
283256
+ cwd: homedir19()
283220
283257
  });
283221
283258
  } else {
283222
- prefixResult = await execFileNoThrowWithCwd("npm", ["-g", "config", "get", "prefix"], { cwd: homedir20() });
283259
+ prefixResult = await execFileNoThrowWithCwd("npm", ["-g", "config", "get", "prefix"], { cwd: homedir19() });
283223
283260
  }
283224
283261
  if (prefixResult.code !== 0) {
283225
283262
  logError2(new Error(`Failed to check ${isBun ? "bun" : "npm"} permissions`));
@@ -283247,7 +283284,7 @@ async function checkGlobalInstallPermissions() {
283247
283284
  }
283248
283285
  async function getLatestVersion(channel) {
283249
283286
  const npmTag = channel === "stable" ? "stable" : "latest";
283250
- const result = await execFileNoThrowWithCwd("npm", ["view", `${"snowcode"}@${npmTag}`, "version", "--prefer-online"], { abortSignal: AbortSignal.timeout(5000), cwd: homedir20() });
283287
+ const result = await execFileNoThrowWithCwd("npm", ["view", `${"snowcode"}@${npmTag}`, "version", "--prefer-online"], { abortSignal: AbortSignal.timeout(5000), cwd: homedir19() });
283251
283288
  if (result.code !== 0) {
283252
283289
  logForDebugging2(`npm view failed with code ${result.code}`);
283253
283290
  if (result.stderr) {
@@ -283263,7 +283300,7 @@ async function getLatestVersion(channel) {
283263
283300
  return result.stdout.trim();
283264
283301
  }
283265
283302
  async function getNpmDistTags() {
283266
- const result = await execFileNoThrowWithCwd("npm", ["view", "snowcode", "dist-tags", "--json", "--prefer-online"], { abortSignal: AbortSignal.timeout(5000), cwd: homedir20() });
283303
+ const result = await execFileNoThrowWithCwd("npm", ["view", "snowcode", "dist-tags", "--json", "--prefer-online"], { abortSignal: AbortSignal.timeout(5000), cwd: homedir19() });
283267
283304
  if (result.code !== 0) {
283268
283305
  logForDebugging2(`npm view dist-tags failed with code ${result.code}`);
283269
283306
  return { latest: null, stable: null };
@@ -283333,7 +283370,7 @@ To fix this issue:
283333
283370
  }
283334
283371
  const packageSpec = specificVersion ? `${"snowcode"}@${specificVersion}` : "snowcode";
283335
283372
  const packageManager = env2.isRunningWithBun() ? "bun" : "npm";
283336
- const installResult = await execFileNoThrowWithCwd(packageManager, ["install", "-g", packageSpec], { cwd: homedir20() });
283373
+ const installResult = await execFileNoThrowWithCwd(packageManager, ["install", "-g", packageSpec], { cwd: homedir19() });
283337
283374
  if (installResult.code !== 0) {
283338
283375
  const error42 = new AutoUpdaterError(`Failed to install new version of claude: ${installResult.stdout} ${installResult.stderr}`);
283339
283376
  logError2(error42);
@@ -283570,7 +283607,7 @@ var init_packageManagers = __esm(() => {
283570
283607
 
283571
283608
  // src/utils/doctorDiagnostic.ts
283572
283609
  import { readFile as readFile13, realpath as realpath6 } from "fs/promises";
283573
- import { homedir as homedir21 } from "os";
283610
+ import { homedir as homedir20 } from "os";
283574
283611
  import { delimiter as delimiter2, join as join64, posix as posix3, win32 } from "path";
283575
283612
  function getNormalizedPaths() {
283576
283613
  let invokedPath = process.argv[1] || "";
@@ -283634,8 +283671,8 @@ async function getInstallationPath() {
283634
283671
  }
283635
283672
  } catch {}
283636
283673
  try {
283637
- await getFsImplementation().stat(join64(homedir21(), ".local/bin/claude"));
283638
- return join64(homedir21(), ".local/bin/claude");
283674
+ await getFsImplementation().stat(join64(homedir20(), ".local/bin/claude"));
283675
+ return join64(homedir20(), ".local/bin/claude");
283639
283676
  } catch {}
283640
283677
  return "native";
283641
283678
  }
@@ -283658,7 +283695,7 @@ function getInvokedBinary() {
283658
283695
  async function detectMultipleInstallations() {
283659
283696
  const fs3 = getFsImplementation();
283660
283697
  const installations = [];
283661
- const localPath = join64(homedir21(), ".claude", "local");
283698
+ const localPath = join64(homedir20(), ".claude", "local");
283662
283699
  if (await localInstallationExists()) {
283663
283700
  installations.push({ type: "npm-local", path: localPath });
283664
283701
  }
@@ -283705,14 +283742,14 @@ async function detectMultipleInstallations() {
283705
283742
  }
283706
283743
  }
283707
283744
  }
283708
- const nativeBinPath = join64(homedir21(), ".local", "bin", "claude");
283745
+ const nativeBinPath = join64(homedir20(), ".local", "bin", "claude");
283709
283746
  try {
283710
283747
  await fs3.stat(nativeBinPath);
283711
283748
  installations.push({ type: "native", path: nativeBinPath });
283712
283749
  } catch {}
283713
283750
  const config2 = getGlobalConfig();
283714
283751
  if (config2.installMethod === "native") {
283715
- const nativeDataPath = join64(homedir21(), ".local", "share", "claude");
283752
+ const nativeDataPath = join64(homedir20(), ".local", "share", "claude");
283716
283753
  try {
283717
283754
  await fs3.stat(nativeDataPath);
283718
283755
  if (!installations.some((i3) => i3.type === "native")) {
@@ -283752,7 +283789,7 @@ async function detectConfigurationIssues(type) {
283752
283789
  if (type === "native") {
283753
283790
  const path12 = process.env.PATH || "";
283754
283791
  const pathDirectories = path12.split(delimiter2);
283755
- const homeDir = homedir21();
283792
+ const homeDir = homedir20();
283756
283793
  const localBinPath = join64(homeDir, ".local", "bin");
283757
283794
  let normalizedLocalBinPath = localBinPath;
283758
283795
  if (getPlatform() === "windows") {
@@ -283779,7 +283816,7 @@ async function detectConfigurationIssues(type) {
283779
283816
  const shellType = getShellType();
283780
283817
  const configPaths = getShellConfigPaths();
283781
283818
  const configFile = configPaths[shellType];
283782
- const displayPath = configFile ? configFile.replace(homedir21(), "~") : "your shell config file";
283819
+ const displayPath = configFile ? configFile.replace(homedir20(), "~") : "your shell config file";
283783
283820
  warnings.push({
283784
283821
  issue: "Native installation exists but ~/.local/bin is not in your PATH",
283785
283822
  fix: `Run: echo 'export PATH="$HOME/.local/bin:$PATH"' >> ${displayPath} then open a new terminal or run: source ${displayPath}`
@@ -284518,7 +284555,7 @@ import {
284518
284555
  unlink as unlink7,
284519
284556
  writeFile as writeFile12
284520
284557
  } from "fs/promises";
284521
- import { homedir as homedir22 } from "os";
284558
+ import { homedir as homedir21 } from "os";
284522
284559
  import { basename as basename14, delimiter as delimiter3, dirname as dirname26, join as join68, resolve as resolve19 } from "path";
284523
284560
  function getPlatform2() {
284524
284561
  const os4 = env2.platform;
@@ -285046,7 +285083,7 @@ async function checkInstall(force = false) {
285046
285083
  const shellType = getShellType();
285047
285084
  const configPaths = getShellConfigPaths();
285048
285085
  const configFile = configPaths[shellType];
285049
- const displayPath = configFile ? configFile.replace(homedir22(), "~") : "your shell config file";
285086
+ const displayPath = configFile ? configFile.replace(homedir21(), "~") : "your shell config file";
285050
285087
  messages.push({
285051
285088
  message: `Native installation exists but ~/.local/bin is not in your PATH. Run:
285052
285089
 
@@ -285547,7 +285584,7 @@ async function cleanupNpmInstallations() {
285547
285584
  errors4.push(macroPackageResult.error);
285548
285585
  }
285549
285586
  }
285550
- const localInstallDir = join68(homedir22(), ".claude", "local");
285587
+ const localInstallDir = join68(homedir21(), ".claude", "local");
285551
285588
  try {
285552
285589
  await rm3(localInstallDir, { recursive: true });
285553
285590
  removed++;
@@ -291856,7 +291893,7 @@ var init_InProcessBackend = __esm(() => {
291856
291893
  });
291857
291894
 
291858
291895
  // src/utils/swarm/backends/it2Setup.ts
291859
- import { homedir as homedir23 } from "os";
291896
+ import { homedir as homedir22 } from "os";
291860
291897
  async function detectPythonPackageManager() {
291861
291898
  const uvResult = await execFileNoThrow("which", ["uv"]);
291862
291899
  if (uvResult.code === 0) {
@@ -291891,18 +291928,18 @@ async function installIt2(packageManager) {
291891
291928
  switch (packageManager) {
291892
291929
  case "uvx":
291893
291930
  result = await execFileNoThrowWithCwd("uv", ["tool", "install", "it2"], {
291894
- cwd: homedir23()
291931
+ cwd: homedir22()
291895
291932
  });
291896
291933
  break;
291897
291934
  case "pipx":
291898
291935
  result = await execFileNoThrowWithCwd("pipx", ["install", "it2"], {
291899
- cwd: homedir23()
291936
+ cwd: homedir22()
291900
291937
  });
291901
291938
  break;
291902
291939
  case "pip":
291903
- result = await execFileNoThrowWithCwd("pip", ["install", "--user", "it2"], { cwd: homedir23() });
291940
+ result = await execFileNoThrowWithCwd("pip", ["install", "--user", "it2"], { cwd: homedir22() });
291904
291941
  if (result.code !== 0) {
291905
- result = await execFileNoThrowWithCwd("pip3", ["install", "--user", "it2"], { cwd: homedir23() });
291942
+ result = await execFileNoThrowWithCwd("pip3", ["install", "--user", "it2"], { cwd: homedir22() });
291906
291943
  }
291907
291944
  break;
291908
291945
  }
@@ -322940,7 +322977,7 @@ var init_modeValidation = __esm(() => {
322940
322977
  });
322941
322978
 
322942
322979
  // src/tools/PowerShellTool/pathValidation.ts
322943
- import { homedir as homedir25 } from "os";
322980
+ import { homedir as homedir24 } from "os";
322944
322981
  import { isAbsolute as isAbsolute16, resolve as resolve25 } from "path";
322945
322982
  function matchesParam(paramLower, paramList) {
322946
322983
  for (const p of paramList) {
@@ -322963,7 +323000,7 @@ function formatDirectoryList2(directories) {
322963
323000
  }
322964
323001
  function expandTilde2(filePath) {
322965
323002
  if (filePath === "~" || filePath.startsWith("~/") || filePath.startsWith("~\\")) {
322966
- return homedir25() + filePath.slice(1);
323003
+ return homedir24() + filePath.slice(1);
322967
323004
  }
322968
323005
  return filePath;
322969
323006
  }
@@ -370915,7 +370952,7 @@ function getAnthropicEnvMetadata() {
370915
370952
  function getBuildAgeMinutes() {
370916
370953
  if (false)
370917
370954
  ;
370918
- const buildTime = new Date("2026-04-05T03:33:03.306Z").getTime();
370955
+ const buildTime = new Date("2026-04-05T04:06:45.418Z").getTime();
370919
370956
  if (isNaN(buildTime))
370920
370957
  return;
370921
370958
  return Math.floor((Date.now() - buildTime) / 60000);
@@ -389971,7 +390008,7 @@ var init_projectOnboardingState = __esm(() => {
389971
390008
 
389972
390009
  // src/utils/appleTerminalBackup.ts
389973
390010
  import { stat as stat35 } from "fs/promises";
389974
- import { homedir as homedir26 } from "os";
390011
+ import { homedir as homedir25 } from "os";
389975
390012
  import { join as join103 } from "path";
389976
390013
  function markTerminalSetupInProgress(backupPath) {
389977
390014
  saveGlobalConfig((current) => ({
@@ -389994,7 +390031,7 @@ function getTerminalRecoveryInfo() {
389994
390031
  };
389995
390032
  }
389996
390033
  function getTerminalPlistPath() {
389997
- return join103(homedir26(), "Library", "Preferences", "com.apple.Terminal.plist");
390034
+ return join103(homedir25(), "Library", "Preferences", "com.apple.Terminal.plist");
389998
390035
  }
389999
390036
  async function backupTerminalPreferences() {
390000
390037
  const terminalPlistPath = getTerminalPlistPath();
@@ -390065,11 +390102,11 @@ var init_appleTerminalBackup = __esm(() => {
390065
390102
  });
390066
390103
 
390067
390104
  // src/utils/completionCache.ts
390068
- import { homedir as homedir27 } from "os";
390105
+ import { homedir as homedir26 } from "os";
390069
390106
  import { dirname as dirname44, join as join104 } from "path";
390070
390107
  function detectShell() {
390071
390108
  const shell = process.env.SHELL || "";
390072
- const home = homedir27();
390109
+ const home = homedir26();
390073
390110
  const claudeDir = join104(home, ".claude");
390074
390111
  if (shell.endsWith("/zsh") || shell.endsWith("/zsh.exe")) {
390075
390112
  const cacheFile = join104(claudeDir, "completion.zsh");
@@ -390145,7 +390182,7 @@ __export(exports_terminalSetup, {
390145
390182
  });
390146
390183
  import { randomBytes as randomBytes14 } from "crypto";
390147
390184
  import { copyFile as copyFile8, mkdir as mkdir25, readFile as readFile33, writeFile as writeFile27 } from "fs/promises";
390148
- import { homedir as homedir28, platform as platform4 } from "os";
390185
+ import { homedir as homedir27, platform as platform4 } from "os";
390149
390186
  import { dirname as dirname45, join as join105 } from "path";
390150
390187
  import { pathToFileURL as pathToFileURL7 } from "url";
390151
390188
  function isVSCodeRemoteSSH() {
@@ -390281,7 +390318,7 @@ async function installBindingsForVSCodeTerminal(editor = "VSCode", theme) {
390281
390318
  ]`)}${EOL5}`;
390282
390319
  }
390283
390320
  const editorDir = editor === "VSCode" ? "Code" : editor;
390284
- const userDirPath = join105(homedir28(), platform4() === "win32" ? join105("AppData", "Roaming", editorDir, "User") : platform4() === "darwin" ? join105("Library", "Application Support", editorDir, "User") : join105(".config", editorDir, "User"));
390321
+ const userDirPath = join105(homedir27(), platform4() === "win32" ? join105("AppData", "Roaming", editorDir, "User") : platform4() === "darwin" ? join105("Library", "Application Support", editorDir, "User") : join105(".config", editorDir, "User"));
390285
390322
  const keybindingsPath = join105(userDirPath, "keybindings.json");
390286
390323
  try {
390287
390324
  await mkdir25(userDirPath, {
@@ -390425,7 +390462,7 @@ chars = "\\u001B\\r"`;
390425
390462
  if (xdgConfigHome) {
390426
390463
  configPaths.push(join105(xdgConfigHome, "alacritty", "alacritty.toml"));
390427
390464
  } else {
390428
- configPaths.push(join105(homedir28(), ".config", "alacritty", "alacritty.toml"));
390465
+ configPaths.push(join105(homedir27(), ".config", "alacritty", "alacritty.toml"));
390429
390466
  }
390430
390467
  if (platform4() === "win32") {
390431
390468
  const appData = process.env.APPDATA;
@@ -390491,7 +390528,7 @@ chars = "\\u001B\\r"`;
390491
390528
  }
390492
390529
  }
390493
390530
  async function installBindingsForZed(theme) {
390494
- const zedDir = join105(homedir28(), ".config", "zed");
390531
+ const zedDir = join105(homedir27(), ".config", "zed");
390495
390532
  const keymapPath = join105(zedDir, "keymap.json");
390496
390533
  try {
390497
390534
  await mkdir25(zedDir, {
@@ -408543,10 +408580,10 @@ var init_MemoryFileSelector = __esm(() => {
408543
408580
  });
408544
408581
 
408545
408582
  // src/components/memory/MemoryUpdateNotification.tsx
408546
- import { homedir as homedir29 } from "os";
408583
+ import { homedir as homedir28 } from "os";
408547
408584
  import { relative as relative23 } from "path";
408548
408585
  function getRelativeMemoryPath(path18) {
408549
- const homeDir = homedir29();
408586
+ const homeDir = homedir28();
408550
408587
  const cwd2 = getCwd();
408551
408588
  const relativeToHome = path18.startsWith(homeDir) ? "~" + path18.slice(homeDir.length) : null;
408552
408589
  const relativeToCwd = path18.startsWith(cwd2) ? "./" + relative23(cwd2, path18) : null;
@@ -411179,8 +411216,8 @@ __export(exports_auth3, {
411179
411216
  });
411180
411217
  import { createServer as createServer5 } from "node:http";
411181
411218
  import { createHash as createHash21, randomBytes as randomBytes15 } from "node:crypto";
411182
- import { appendFileSync as appendFileSync5, existsSync as existsSync10, mkdirSync as mkdirSync10 } from "node:fs";
411183
- import { join as join115 } from "node:path";
411219
+ import { appendFileSync as appendFileSync5, existsSync as existsSync10, mkdirSync as mkdirSync10, writeFileSync as writeFileSync8 } from "node:fs";
411220
+ import { dirname as dirname49, join as join115 } from "node:path";
411184
411221
  function appendAuthLog(service, message) {
411185
411222
  try {
411186
411223
  const dir = getClaudeConfigHomeDir();
@@ -411294,6 +411331,28 @@ function emailFromTokens(tokens) {
411294
411331
  return p.email;
411295
411332
  return "unknown";
411296
411333
  }
411334
+ function persistCodexOauthSession(tokens) {
411335
+ try {
411336
+ const authPath = resolveCodexAuthPath();
411337
+ const accountId = parseChatgptAccountId(tokens.access_token) ?? parseChatgptAccountId(tokens.id_token);
411338
+ mkdirSync10(dirname49(authPath), { recursive: true });
411339
+ writeFileSync8(authPath, JSON.stringify({
411340
+ access_token: tokens.access_token,
411341
+ ...tokens.refresh_token ? { refresh_token: tokens.refresh_token } : {},
411342
+ ...tokens.id_token ? { id_token: tokens.id_token } : {},
411343
+ ...accountId ? { account_id: accountId } : {},
411344
+ tokens: {
411345
+ access_token: tokens.access_token,
411346
+ ...tokens.refresh_token ? { refresh_token: tokens.refresh_token } : {},
411347
+ ...tokens.id_token ? { id_token: tokens.id_token } : {},
411348
+ ...accountId ? { account_id: accountId } : {}
411349
+ }
411350
+ }, null, 2), "utf8");
411351
+ appendAuthLog("codex_oauth", `codex auth.json synced path=${authPath}${accountId ? ` accountId=${accountId}` : ""}`);
411352
+ } catch (error42) {
411353
+ appendAuthLog("codex_oauth", `codex auth.json sync failed ${String(error42)}`);
411354
+ }
411355
+ }
411297
411356
  async function fetchGoogleEmail(accessToken, idToken) {
411298
411357
  if (idToken) {
411299
411358
  const p = decodeJwtPayload2(idToken);
@@ -411565,8 +411624,13 @@ function OAuthFlow({
411565
411624
  }, undefined, false, undefined, this),
411566
411625
  /* @__PURE__ */ jsx_dev_runtime209.jsxDEV(ThemedText, {
411567
411626
  dimColor: true,
411568
- children: "R replace existing · K keep existing · Esc cancel"
411569
- }, undefined, false, undefined, this)
411627
+ children: [
411628
+ duplicateDecision?.replaceHint ?? "R replace existing",
411629
+ " · ",
411630
+ duplicateDecision?.keepHint ?? "K keep existing",
411631
+ " · Esc cancel"
411632
+ ]
411633
+ }, undefined, true, undefined, this)
411570
411634
  ]
411571
411635
  }, undefined, true, undefined, this);
411572
411636
  return /* @__PURE__ */ jsx_dev_runtime209.jsxDEV(ThemedBox_default, {
@@ -412154,8 +412218,64 @@ function AuthCommand({
412154
412218
  code_verifier: verifier
412155
412219
  }, "codex_oauth");
412156
412220
  const email3 = emailFromTokens(tokens);
412157
- addAccount({ type: "codex_oauth", label: `Codex: ${email3}`, email: email3, refreshToken: tokens.refresh_token, enabled: true });
412221
+ const accountId = parseChatgptAccountId(tokens.access_token) ?? parseChatgptAccountId(tokens.id_token);
412222
+ persistCodexOauthSession(tokens);
412158
412223
  process.env.OPENAI_API_KEY = "chatgpt-oauth";
412224
+ const matchingAccounts = loadAccounts().accounts.filter((account) => account.type === "codex_oauth" && account.email?.trim().toLowerCase() === email3.trim().toLowerCase()).sort((left, right) => Date.parse(right.addedAt || "") - Date.parse(left.addedAt || ""));
412225
+ if (matchingAccounts.length > 0) {
412226
+ return {
412227
+ email: email3,
412228
+ refreshToken: tokens.refresh_token ?? "",
412229
+ duplicateDecision: {
412230
+ message: `This Codex account already exists: ${email3}`,
412231
+ replaceHint: "R replace existing",
412232
+ keepHint: "K keep both",
412233
+ onReplace: () => {
412234
+ const [primary, ...duplicates] = matchingAccounts;
412235
+ updateAccount(primary.id, {
412236
+ label: `Codex: ${email3}`,
412237
+ email: email3,
412238
+ accountId,
412239
+ refreshToken: tokens.refresh_token ?? primary.refreshToken,
412240
+ enabled: true
412241
+ });
412242
+ for (const duplicate of duplicates) {
412243
+ removeAccount(duplicate.id);
412244
+ }
412245
+ appendAuthLog("codex_oauth", `account replaced email=${email3} removedDuplicates=${duplicates.length}`);
412246
+ return {
412247
+ email: email3,
412248
+ refreshToken: tokens.refresh_token ?? primary.refreshToken ?? "",
412249
+ completionMessage: `Codex account updated: ${email3}`
412250
+ };
412251
+ },
412252
+ onKeep: () => {
412253
+ addAccount({
412254
+ type: "codex_oauth",
412255
+ label: `Codex: ${email3}`,
412256
+ email: email3,
412257
+ accountId,
412258
+ refreshToken: tokens.refresh_token,
412259
+ enabled: true
412260
+ });
412261
+ appendAuthLog("codex_oauth", `duplicate account saved email=${email3}`);
412262
+ return {
412263
+ email: email3,
412264
+ refreshToken: tokens.refresh_token ?? "",
412265
+ completionMessage: `Codex duplicate account added: ${email3}`
412266
+ };
412267
+ }
412268
+ }
412269
+ };
412270
+ }
412271
+ addAccount({
412272
+ type: "codex_oauth",
412273
+ label: `Codex: ${email3}`,
412274
+ email: email3,
412275
+ accountId,
412276
+ refreshToken: tokens.refresh_token,
412277
+ enabled: true
412278
+ });
412159
412279
  appendAuthLog("codex_oauth", `account saved email=${email3}`);
412160
412280
  return { email: email3, refreshToken: tokens.refresh_token ?? "" };
412161
412281
  },
@@ -412204,6 +412324,7 @@ var init_auth8 = __esm(() => {
412204
412324
  init_messages3();
412205
412325
  init_accountManager();
412206
412326
  init_auth2();
412327
+ init_providerConfig();
412207
412328
  import_react120 = __toESM(require_react(), 1);
412208
412329
  jsx_dev_runtime209 = __toESM(require_jsx_dev_runtime(), 1);
412209
412330
  AG_SCOPES = [
@@ -420119,7 +420240,7 @@ var init_pluginStartupCheck = __esm(() => {
420119
420240
  });
420120
420241
 
420121
420242
  // src/utils/plugins/parseMarketplaceInput.ts
420122
- import { homedir as homedir30 } from "os";
420243
+ import { homedir as homedir29 } from "os";
420123
420244
  import { resolve as resolve36 } from "path";
420124
420245
  async function parseMarketplaceInput(input) {
420125
420246
  const trimmed = input.trim();
@@ -420155,7 +420276,7 @@ async function parseMarketplaceInput(input) {
420155
420276
  const isWindows2 = process.platform === "win32";
420156
420277
  const isWindowsPath = isWindows2 && (trimmed.startsWith(".\\") || trimmed.startsWith("..\\") || /^[a-zA-Z]:[/\\]/.test(trimmed));
420157
420278
  if (trimmed.startsWith("./") || trimmed.startsWith("../") || trimmed.startsWith("/") || trimmed.startsWith("~") || isWindowsPath) {
420158
- const resolvedPath = resolve36(trimmed.startsWith("~") ? trimmed.replace(/^~/, homedir30()) : trimmed);
420279
+ const resolvedPath = resolve36(trimmed.startsWith("~") ? trimmed.replace(/^~/, homedir29()) : trimmed);
420159
420280
  let stats;
420160
420281
  try {
420161
420282
  stats = await fs4.stat(resolvedPath);
@@ -423155,7 +423276,7 @@ var init_DiscoverPlugins = __esm(() => {
423155
423276
  });
423156
423277
 
423157
423278
  // src/services/plugins/pluginOperations.ts
423158
- import { dirname as dirname49, join as join118 } from "path";
423279
+ import { dirname as dirname50, join as join118 } from "path";
423159
423280
  function assertInstallableScope(scope) {
423160
423281
  if (!VALID_INSTALLABLE_SCOPES.includes(scope)) {
423161
423282
  throw new Error(`Invalid scope "${scope}". Must be one of: ${VALID_INSTALLABLE_SCOPES.join(", ")}`);
@@ -423632,7 +423753,7 @@ async function performPluginUpdate({
423632
423753
  }
423633
423754
  throw e;
423634
423755
  }
423635
- const marketplaceDir = marketplaceStats.isDirectory() ? marketplaceInstallLocation : dirname49(marketplaceInstallLocation);
423756
+ const marketplaceDir = marketplaceStats.isDirectory() ? marketplaceInstallLocation : dirname50(marketplaceInstallLocation);
423636
423757
  sourcePath = join118(marketplaceDir, entry.source);
423637
423758
  try {
423638
423759
  await fs4.stat(sourcePath);
@@ -434968,7 +435089,7 @@ ${args ? "Additional user input: " + args : ""}
434968
435089
 
434969
435090
  // src/utils/releaseNotes.ts
434970
435091
  import { mkdir as mkdir31, readFile as readFile40, writeFile as writeFile35 } from "fs/promises";
434971
- import { dirname as dirname51, join as join122 } from "path";
435092
+ import { dirname as dirname52, join as join122 } from "path";
434972
435093
  function getChangelogCachePath() {
434973
435094
  return join122(getClaudeConfigHomeDir(), "cache", "changelog.md");
434974
435095
  }
@@ -434979,7 +435100,7 @@ async function migrateChangelogFromConfig() {
434979
435100
  }
434980
435101
  const cachePath2 = getChangelogCachePath();
434981
435102
  try {
434982
- await mkdir31(dirname51(cachePath2), { recursive: true });
435103
+ await mkdir31(dirname52(cachePath2), { recursive: true });
434983
435104
  await writeFile35(cachePath2, config3.cachedChangelog, {
434984
435105
  encoding: "utf-8",
434985
435106
  flag: "wx"
@@ -435001,7 +435122,7 @@ async function fetchAndStoreChangelog() {
435001
435122
  return;
435002
435123
  }
435003
435124
  const cachePath2 = getChangelogCachePath();
435004
- await mkdir31(dirname51(cachePath2), { recursive: true });
435125
+ await mkdir31(dirname52(cachePath2), { recursive: true });
435005
435126
  await writeFile35(cachePath2, changelogContent, { encoding: "utf-8" });
435006
435127
  changelogMemoryCache = changelogContent;
435007
435128
  const changelogLastFetched = Date.now();
@@ -449095,7 +449216,7 @@ var init_terminalSetup2 = __esm(() => {
449095
449216
 
449096
449217
  // src/utils/antigravityLocalSessions.ts
449097
449218
  import { execFileSync as execFileSync3 } from "node:child_process";
449098
- import { existsSync as existsSync11, mkdirSync as mkdirSync11, readFileSync as readFileSync15, writeFileSync as writeFileSync8 } from "node:fs";
449219
+ import { existsSync as existsSync11, mkdirSync as mkdirSync11, readFileSync as readFileSync15, writeFileSync as writeFileSync9 } from "node:fs";
449099
449220
  import { join as join123 } from "node:path";
449100
449221
  import { platform as platform5 } from "node:os";
449101
449222
  function getSnapshotPath() {
@@ -449115,7 +449236,7 @@ function saveSnapshotFile(data) {
449115
449236
  const dir = getClaudeConfigHomeDir();
449116
449237
  if (!existsSync11(dir))
449117
449238
  mkdirSync11(dir, { recursive: true });
449118
- writeFileSync8(getSnapshotPath(), JSON.stringify(data, null, 2), "utf8");
449239
+ writeFileSync9(getSnapshotPath(), JSON.stringify(data, null, 2), "utf8");
449119
449240
  }
449120
449241
  function extractRefreshToken(oauthTokenValue) {
449121
449242
  const raw = oauthTokenValue?.trim();
@@ -449217,11 +449338,11 @@ var init_antigravityLocalSessions = __esm(() => {
449217
449338
 
449218
449339
  // src/utils/antigravityLocalUsage.ts
449219
449340
  import { execFileSync as execFileSync4 } from "node:child_process";
449220
- import { existsSync as existsSync12, mkdirSync as mkdirSync12, readdirSync as readdirSync4, readFileSync as readFileSync16, writeFileSync as writeFileSync9 } from "node:fs";
449341
+ import { existsSync as existsSync12, mkdirSync as mkdirSync12, readdirSync as readdirSync4, readFileSync as readFileSync16, writeFileSync as writeFileSync10 } from "node:fs";
449221
449342
  import { join as join124 } from "node:path";
449222
- import { homedir as homedir31, platform as platform6 } from "node:os";
449343
+ import { homedir as homedir30, platform as platform6 } from "node:os";
449223
449344
  function getConfigDir() {
449224
- return join124(homedir31(), ".snowcode");
449345
+ return join124(homedir30(), ".snowcode");
449225
449346
  }
449226
449347
  function getSnapshotPath2() {
449227
449348
  return join124(getConfigDir(), "antigravity-local-usage.json");
@@ -449240,7 +449361,7 @@ function saveSnapshots(data) {
449240
449361
  const dir = getConfigDir();
449241
449362
  if (!existsSync12(dir))
449242
449363
  mkdirSync12(dir, { recursive: true });
449243
- writeFileSync9(getSnapshotPath2(), JSON.stringify(data, null, 2), "utf8");
449364
+ writeFileSync10(getSnapshotPath2(), JSON.stringify(data, null, 2), "utf8");
449244
449365
  }
449245
449366
  function saveSnapshot(snapshot2) {
449246
449367
  const data = loadSnapshots();
@@ -449460,6 +449581,13 @@ function UsageBar({ value, width = 12 }) {
449460
449581
  function err2(e) {
449461
449582
  return e instanceof Error ? e.message : String(e);
449462
449583
  }
449584
+ function normalizeEmail(value) {
449585
+ const trimmed = value?.trim().toLowerCase();
449586
+ return trimmed || null;
449587
+ }
449588
+ function sortNewestFirst(accounts) {
449589
+ return [...accounts].sort((left, right) => Date.parse(right.addedAt || "") - Date.parse(left.addedAt || ""));
449590
+ }
449463
449591
  async function withRetry2(fn, retries = 3) {
449464
449592
  let lastError;
449465
449593
  for (let attempt = 1;attempt <= retries; attempt++) {
@@ -449747,15 +449875,73 @@ ${errorBody}`);
449747
449875
  throw new Error("Codex token refresh returned no access token");
449748
449876
  return json2;
449749
449877
  }
449878
+ async function refreshCodexTokenWithFallback(account) {
449879
+ const candidates = [];
449880
+ const seen = new Set;
449881
+ const pushCandidate = (refreshToken, candidateAccount, accountId) => {
449882
+ const trimmed = refreshToken?.trim();
449883
+ if (!trimmed || seen.has(trimmed))
449884
+ return;
449885
+ seen.add(trimmed);
449886
+ candidates.push({
449887
+ refreshToken: trimmed,
449888
+ account: candidateAccount,
449889
+ accountId: accountId ?? candidateAccount?.accountId
449890
+ });
449891
+ };
449892
+ pushCandidate(account.refreshToken, account, account.accountId);
449893
+ const accountEmail = normalizeEmail(account.email);
449894
+ if (accountEmail) {
449895
+ const siblingAccounts = sortNewestFirst(loadAccounts().accounts.filter((item) => item.enabled && item.type === "codex_oauth" && item.id !== account.id && normalizeEmail(item.email) === accountEmail));
449896
+ for (const sibling of siblingAccounts) {
449897
+ pushCandidate(sibling.refreshToken, sibling, sibling.accountId);
449898
+ }
449899
+ }
449900
+ const authJsonCredentials = resolveCodexApiCredentials();
449901
+ const enabledCodexAccounts = loadAccounts().accounts.filter((item) => item.enabled && item.type === "codex_oauth" && item.refreshToken);
449902
+ if (authJsonCredentials.refreshToken && (!account.accountId || authJsonCredentials.accountId === account.accountId || enabledCodexAccounts.length === 1)) {
449903
+ pushCandidate(authJsonCredentials.refreshToken, undefined, authJsonCredentials.accountId);
449904
+ }
449905
+ let lastError;
449906
+ for (const candidate of candidates) {
449907
+ try {
449908
+ const tokenResponse = await refreshCodexToken(candidate.refreshToken);
449909
+ const rotatedRefreshToken = tokenResponse.refresh_token ?? candidate.refreshToken;
449910
+ if (candidate.account?.id && rotatedRefreshToken !== candidate.account.refreshToken) {
449911
+ updateAccount(candidate.account.id, {
449912
+ refreshToken: rotatedRefreshToken
449913
+ });
449914
+ }
449915
+ if (account.id !== candidate.account?.id && rotatedRefreshToken !== account.refreshToken) {
449916
+ updateAccount(account.id, {
449917
+ refreshToken: rotatedRefreshToken,
449918
+ ...candidate.accountId ? { accountId: candidate.accountId } : {}
449919
+ });
449920
+ }
449921
+ return {
449922
+ tokenResponse,
449923
+ accountId: candidate.accountId
449924
+ };
449925
+ } catch (error42) {
449926
+ lastError = error42;
449927
+ }
449928
+ }
449929
+ throw lastError ?? new Error("Codex session expired. Re-run /auth for that ChatGPT account.");
449930
+ }
449750
449931
  async function fetchCodex(account) {
449751
- const tokenResponse = await refreshCodexToken(account.refreshToken);
449932
+ const { tokenResponse, accountId } = await refreshCodexTokenWithFallback(account);
449752
449933
  const token = tokenResponse.access_token;
449753
449934
  if (tokenResponse.refresh_token && tokenResponse.refresh_token !== account.refreshToken) {
449754
449935
  updateAccount(account.id, { refreshToken: tokenResponse.refresh_token });
449755
449936
  }
449756
449937
  const headers = { Authorization: `Bearer ${token}`, "User-Agent": "codex-cli" };
449757
- if (account.email)
449758
- headers["ChatGPT-Account-Id"] = account.email;
449938
+ const resolvedAccountId = account.accountId ?? accountId;
449939
+ if (resolvedAccountId) {
449940
+ headers["ChatGPT-Account-Id"] = resolvedAccountId;
449941
+ if (resolvedAccountId !== account.accountId) {
449942
+ updateAccount(account.id, { accountId: resolvedAccountId });
449943
+ }
449944
+ }
449759
449945
  const res = await fetch(CODEX_USAGE_URL, { headers });
449760
449946
  if (!res.ok) {
449761
449947
  const errorBody = await res.text().catch(() => "unknown error");
@@ -450360,6 +450546,7 @@ var React94, import_react161, jsx_dev_runtime278, AG_CLOUDCODE_BASE = "https://c
450360
450546
  var init_usage2 = __esm(() => {
450361
450547
  init_ink2();
450362
450548
  init_accountManager();
450549
+ init_providerConfig();
450363
450550
  init_antigravityOAuth();
450364
450551
  init_antigravityLocalSessions();
450365
450552
  init_antigravityLocalUsage();
@@ -450386,7 +450573,7 @@ var init_usage3 = __esm(() => {
450386
450573
  });
450387
450574
 
450388
450575
  // src/utils/fallbackConfig.ts
450389
- import { existsSync as existsSync13, readFileSync as readFileSync17, writeFileSync as writeFileSync10 } from "node:fs";
450576
+ import { existsSync as existsSync13, readFileSync as readFileSync17, writeFileSync as writeFileSync11 } from "node:fs";
450390
450577
  import { join as join125 } from "node:path";
450391
450578
  function getPath3() {
450392
450579
  return join125(getClaudeConfigHomeDir(), "fallbacks.json");
@@ -450402,7 +450589,7 @@ function loadFallbackConfig() {
450402
450589
  }
450403
450590
  }
450404
450591
  function saveFallbackConfig(config3) {
450405
- writeFileSync10(getPath3(), JSON.stringify(config3, null, 2), "utf-8");
450592
+ writeFileSync11(getPath3(), JSON.stringify(config3, null, 2), "utf-8");
450406
450593
  }
450407
450594
  function getFallbackOrder() {
450408
450595
  return loadFallbackConfig().order;
@@ -464076,7 +464263,7 @@ var init_rewind = __esm(() => {
464076
464263
  });
464077
464264
 
464078
464265
  // src/utils/heapDumpService.ts
464079
- import { createWriteStream as createWriteStream3, writeFileSync as writeFileSync11 } from "fs";
464266
+ import { createWriteStream as createWriteStream3, writeFileSync as writeFileSync12 } from "fs";
464080
464267
  import { readdir as readdir25, readFile as readFile43, writeFile as writeFile37 } from "fs/promises";
464081
464268
  import { join as join129 } from "path";
464082
464269
  import { pipeline as pipeline2 } from "stream/promises";
@@ -464215,7 +464402,7 @@ async function performHeapDump(trigger = "manual", dumpNumber = 0) {
464215
464402
  }
464216
464403
  async function writeHeapSnapshot(filepath) {
464217
464404
  if (typeof Bun !== "undefined") {
464218
- writeFileSync11(filepath, Bun.generateHeapSnapshot("v8", "arraybuffer"), {
464405
+ writeFileSync12(filepath, Bun.generateHeapSnapshot("v8", "arraybuffer"), {
464219
464406
  mode: 384
464220
464407
  });
464221
464408
  Bun.gc(true);
@@ -464754,7 +464941,7 @@ var init_bridge_kick = __esm(() => {
464754
464941
  var call59 = async () => {
464755
464942
  return {
464756
464943
  type: "text",
464757
- value: `${"99.0.0"} (built ${"2026-04-05T03:33:03.306Z"})`
464944
+ value: `${"99.0.0"} (built ${"2026-04-05T04:06:45.418Z"})`
464758
464945
  };
464759
464946
  }, version2, version_default;
464760
464947
  var init_version = __esm(() => {
@@ -466083,7 +466270,7 @@ var init_setupPortable = __esm(() => {
466083
466270
 
466084
466271
  // src/utils/claudeInChrome/setup.ts
466085
466272
  import { chmod as chmod10, mkdir as mkdir34, readFile as readFile44, writeFile as writeFile38 } from "fs/promises";
466086
- import { homedir as homedir32 } from "os";
466273
+ import { homedir as homedir31 } from "os";
466087
466274
  import { join as join131 } from "path";
466088
466275
  import { fileURLToPath as fileURLToPath6 } from "url";
466089
466276
  function shouldEnableClaudeInChrome(chromeFlag) {
@@ -466163,7 +466350,7 @@ function setupClaudeInChrome() {
466163
466350
  function getNativeMessagingHostsDirs() {
466164
466351
  const platform7 = getPlatform();
466165
466352
  if (platform7 === "windows") {
466166
- const home = homedir32();
466353
+ const home = homedir31();
466167
466354
  const appData = process.env.APPDATA || join131(home, "AppData", "Local");
466168
466355
  return [join131(appData, "Claude Code", "ChromeNativeHost")];
466169
466356
  }
@@ -466850,7 +467037,7 @@ var init_advisor2 = __esm(() => {
466850
467037
  // src/skills/bundledSkills.ts
466851
467038
  import { constants as fsConstants5 } from "fs";
466852
467039
  import { mkdir as mkdir35, open as open13 } from "fs/promises";
466853
- import { dirname as dirname52, isAbsolute as isAbsolute24, join as join132, normalize as normalize13, sep as pathSep2 } from "path";
467040
+ import { dirname as dirname53, isAbsolute as isAbsolute24, join as join132, normalize as normalize13, sep as pathSep2 } from "path";
466854
467041
  function registerBundledSkill(definition) {
466855
467042
  const { files: files2 } = definition;
466856
467043
  let skillRoot;
@@ -466914,7 +467101,7 @@ async function writeSkillFiles(dir, files2) {
466914
467101
  const byParent = new Map;
466915
467102
  for (const [relPath, content] of Object.entries(files2)) {
466916
467103
  const target = resolveSkillFilePath(dir, relPath);
466917
- const parent2 = dirname52(target);
467104
+ const parent2 = dirname53(target);
466918
467105
  const entry = [target, content];
466919
467106
  const group = byParent.get(parent2);
466920
467107
  if (group)
@@ -474885,7 +475072,7 @@ import {
474885
475072
  unlink as unlink21,
474886
475073
  writeFile as writeFile41
474887
475074
  } from "fs/promises";
474888
- import { basename as basename40, dirname as dirname54, join as join139 } from "path";
475075
+ import { basename as basename40, dirname as dirname55, join as join139 } from "path";
474889
475076
  function isTranscriptMessage(entry) {
474890
475077
  return entry.type === "user" || entry.type === "assistant" || entry.type === "attachment" || entry.type === "system";
474891
475078
  }
@@ -474930,7 +475117,7 @@ function getAgentMetadataPath(agentId) {
474930
475117
  }
474931
475118
  async function writeAgentMetadata(agentId, metadata) {
474932
475119
  const path21 = getAgentMetadataPath(agentId);
474933
- await mkdir38(dirname54(path21), { recursive: true });
475120
+ await mkdir38(dirname55(path21), { recursive: true });
474934
475121
  await writeFile41(path21, JSON.stringify(metadata));
474935
475122
  }
474936
475123
  async function readAgentMetadata(agentId) {
@@ -474953,7 +475140,7 @@ function getRemoteAgentMetadataPath(taskId) {
474953
475140
  }
474954
475141
  async function writeRemoteAgentMetadata(taskId, metadata) {
474955
475142
  const path21 = getRemoteAgentMetadataPath(taskId);
474956
- await mkdir38(dirname54(path21), { recursive: true });
475143
+ await mkdir38(dirname55(path21), { recursive: true });
474957
475144
  await writeFile41(path21, JSON.stringify(metadata));
474958
475145
  }
474959
475146
  async function readRemoteAgentMetadata(taskId) {
@@ -475142,7 +475329,7 @@ class Project {
475142
475329
  try {
475143
475330
  await fsAppendFile(filePath, data, { mode: 384 });
475144
475331
  } catch {
475145
- await mkdir38(dirname54(filePath), { recursive: true, mode: 448 });
475332
+ await mkdir38(dirname55(filePath), { recursive: true, mode: 448 });
475146
475333
  await fsAppendFile(filePath, data, { mode: 384 });
475147
475334
  }
475148
475335
  }
@@ -475741,7 +475928,7 @@ async function hydrateFromCCRv2InternalEvents(sessionId) {
475741
475928
  }
475742
475929
  for (const [agentId, entries] of byAgent) {
475743
475930
  const agentFile = getAgentTranscriptPath(asAgentId(agentId));
475744
- await mkdir38(dirname54(agentFile), { recursive: true, mode: 448 });
475931
+ await mkdir38(dirname55(agentFile), { recursive: true, mode: 448 });
475745
475932
  const agentContent = entries.map((p) => jsonStringify(p) + `
475746
475933
  `).join("");
475747
475934
  await writeFile41(agentFile, agentContent, {
@@ -476278,7 +476465,7 @@ function appendEntryToFile(fullPath, entry) {
476278
476465
  try {
476279
476466
  fs5.appendFileSync(fullPath, line, { mode: 384 });
476280
476467
  } catch {
476281
- fs5.mkdirSync(dirname54(fullPath), { mode: 448 });
476468
+ fs5.mkdirSync(dirname55(fullPath), { mode: 448 });
476282
476469
  fs5.appendFileSync(fullPath, line, { mode: 384 });
476283
476470
  }
476284
476471
  }
@@ -478042,7 +478229,7 @@ var init_agentMemory = __esm(() => {
478042
478229
 
478043
478230
  // src/utils/permissions/filesystem.ts
478044
478231
  import { randomBytes as randomBytes19 } from "crypto";
478045
- import { homedir as homedir33, tmpdir as tmpdir10 } from "os";
478232
+ import { homedir as homedir32, tmpdir as tmpdir10 } from "os";
478046
478233
  import { join as join141, normalize as normalize15, posix as posix8, sep as sep32 } from "path";
478047
478234
  function normalizeCaseForComparison(path21) {
478048
478235
  return path21.toLowerCase();
@@ -478056,7 +478243,7 @@ function getClaudeSkillScope(filePath) {
478056
478243
  prefix: "/.claude/skills/"
478057
478244
  },
478058
478245
  {
478059
- dir: expandPath(join141(homedir33(), ".claude", "skills")),
478246
+ dir: expandPath(join141(homedir32(), ".claude", "skills")),
478060
478247
  prefix: "~/.claude/skills/"
478061
478248
  }
478062
478249
  ];
@@ -478370,7 +478557,7 @@ function patternWithRoot(pattern, source) {
478370
478557
  } else if (pattern.startsWith(`~${DIR_SEP}`)) {
478371
478558
  return {
478372
478559
  relativePattern: pattern.slice(1),
478373
- root: homedir33().normalize("NFC")
478560
+ root: homedir32().normalize("NFC")
478374
478561
  };
478375
478562
  } else if (pattern.startsWith(DIR_SEP)) {
478376
478563
  return {
@@ -483206,7 +483393,7 @@ import {
483206
483393
  symlink as symlink5,
483207
483394
  utimes as utimes2
483208
483395
  } from "fs/promises";
483209
- import { basename as basename42, dirname as dirname55, join as join143 } from "path";
483396
+ import { basename as basename42, dirname as dirname56, join as join143 } from "path";
483210
483397
  function validateWorktreeSlug(slug) {
483211
483398
  if (slug.length > MAX_WORKTREE_SLUG_LENGTH) {
483212
483399
  throw new Error(`Invalid worktree name: must be ${MAX_WORKTREE_SLUG_LENGTH} characters or fewer (got ${slug.length})`);
@@ -483402,7 +483589,7 @@ async function copyWorktreeIncludeFiles(repoRoot, worktreePath) {
483402
483589
  const srcPath = join143(repoRoot, relativePath2);
483403
483590
  const destPath = join143(worktreePath, relativePath2);
483404
483591
  try {
483405
- await mkdir40(dirname55(destPath), { recursive: true });
483592
+ await mkdir40(dirname56(destPath), { recursive: true });
483406
483593
  await copyFile10(srcPath, destPath);
483407
483594
  copied.push(relativePath2);
483408
483595
  } catch (e) {
@@ -483419,7 +483606,7 @@ async function performPostCreationSetup(repoRoot, worktreePath) {
483419
483606
  const sourceSettingsLocal = join143(repoRoot, localSettingsRelativePath);
483420
483607
  try {
483421
483608
  const destSettingsLocal = join143(worktreePath, localSettingsRelativePath);
483422
- await mkdirRecursive(dirname55(destSettingsLocal));
483609
+ await mkdirRecursive(dirname56(destSettingsLocal));
483423
483610
  await copyFile10(sourceSettingsLocal, destSettingsLocal);
483424
483611
  logForDebugging2(`Copied settings.local.json to worktree: ${destSettingsLocal}`);
483425
483612
  } catch (e) {
@@ -487712,7 +487899,7 @@ import {
487712
487899
  unlink as unlink23
487713
487900
  } from "fs/promises";
487714
487901
  import { createServer as createServer6 } from "net";
487715
- import { homedir as homedir34, platform as platform7 } from "os";
487902
+ import { homedir as homedir33, platform as platform7 } from "os";
487716
487903
  import { join as join144 } from "path";
487717
487904
  function log(message, ...args) {
487718
487905
  if (LOG_FILE) {
@@ -488051,7 +488238,7 @@ var init_chromeNativeHost = __esm(() => {
488051
488238
  init_slowOperations();
488052
488239
  init_common2();
488053
488240
  MAX_MESSAGE_SIZE = 1024 * 1024;
488054
- LOG_FILE = process.env.USER_TYPE === "ant" ? join144(homedir34(), ".claude", "debug", "chrome-native-host.txt") : undefined;
488241
+ LOG_FILE = process.env.USER_TYPE === "ant" ? join144(homedir33(), ".claude", "debug", "chrome-native-host.txt") : undefined;
488055
488242
  messageSchema = lazySchema(() => exports_external2.object({
488056
488243
  type: exports_external2.string()
488057
488244
  }).passthrough());
@@ -490347,7 +490534,7 @@ __export(exports_upstreamproxy, {
490347
490534
  SESSION_TOKEN_PATH: () => SESSION_TOKEN_PATH
490348
490535
  });
490349
490536
  import { mkdir as mkdir42, readFile as readFile48, unlink as unlink24, writeFile as writeFile42 } from "fs/promises";
490350
- import { homedir as homedir35 } from "os";
490537
+ import { homedir as homedir34 } from "os";
490351
490538
  import { join as join145 } from "path";
490352
490539
  async function initUpstreamProxy(opts) {
490353
490540
  if (!isEnvTruthy(process.env.CLAUDE_CODE_REMOTE)) {
@@ -490369,7 +490556,7 @@ async function initUpstreamProxy(opts) {
490369
490556
  }
490370
490557
  setNonDumpable();
490371
490558
  const baseUrl = opts?.ccrBaseUrl ?? process.env.ANTHROPIC_BASE_URL ?? "https://api.anthropic.com";
490372
- const caBundlePath = opts?.caBundlePath ?? join145(homedir35(), ".ccr", "ca-bundle.crt");
490559
+ const caBundlePath = opts?.caBundlePath ?? join145(homedir34(), ".ccr", "ca-bundle.crt");
490373
490560
  const caOk = await downloadCaBundle(baseUrl, opts?.systemCaPath ?? SYSTEM_CA_BUNDLE, caBundlePath);
490374
490561
  if (!caOk)
490375
490562
  return state2;
@@ -498367,7 +498554,7 @@ var init_ShowInIDEPrompt = __esm(() => {
498367
498554
  });
498368
498555
 
498369
498556
  // src/components/permissions/FilePermissionDialog/permissionOptions.tsx
498370
- import { homedir as homedir36 } from "os";
498557
+ import { homedir as homedir35 } from "os";
498371
498558
  import { basename as basename46, join as join146, sep as sep33 } from "path";
498372
498559
  function isInClaudeFolder(filePath) {
498373
498560
  const absolutePath = expandPath(filePath);
@@ -498378,7 +498565,7 @@ function isInClaudeFolder(filePath) {
498378
498565
  }
498379
498566
  function isInGlobalClaudeFolder(filePath) {
498380
498567
  const absolutePath = expandPath(filePath);
498381
- const globalClaudeFolderPath = join146(homedir36(), ".claude");
498568
+ const globalClaudeFolderPath = join146(homedir35(), ".claude");
498382
498569
  const normalizedAbsolutePath = normalizeCaseForComparison(absolutePath);
498383
498570
  const normalizedGlobalClaudeFolderPath = normalizeCaseForComparison(globalClaudeFolderPath);
498384
498571
  return normalizedAbsolutePath.startsWith(normalizedGlobalClaudeFolderPath + sep33.toLowerCase()) || normalizedAbsolutePath.startsWith(normalizedGlobalClaudeFolderPath + "/");
@@ -520999,7 +521186,7 @@ var init_cacache = __esm(() => {
520999
521186
 
521000
521187
  // src/utils/cleanup.ts
521001
521188
  import * as fs5 from "fs/promises";
521002
- import { homedir as homedir37 } from "os";
521189
+ import { homedir as homedir36 } from "os";
521003
521190
  import { join as join147 } from "path";
521004
521191
  function getCutoffDate() {
521005
521192
  const settings = getSettings_DEPRECATED() || {};
@@ -521300,7 +521487,7 @@ async function cleanupNpmCacheForAnthropicPackages() {
521300
521487
  return;
521301
521488
  }
521302
521489
  logForDebugging2("npm cache cleanup: starting");
521303
- const npmCachePath = join147(homedir37(), ".npm", "_cacache");
521490
+ const npmCachePath = join147(homedir36(), ".npm", "_cacache");
521304
521491
  const NPM_CACHE_RETENTION_COUNT = 5;
521305
521492
  const startTime = Date.now();
521306
521493
  try {
@@ -524586,7 +524773,7 @@ __export(exports_asciicast, {
524586
524773
  _resetRecordingStateForTesting: () => _resetRecordingStateForTesting
524587
524774
  });
524588
524775
  import { appendFile as appendFile7, rename as rename10 } from "fs/promises";
524589
- import { basename as basename55, dirname as dirname56, join as join149 } from "path";
524776
+ import { basename as basename55, dirname as dirname57, join as join149 } from "path";
524590
524777
  function getRecordFilePath() {
524591
524778
  if (recordingState.filePath !== null) {
524592
524779
  return recordingState.filePath;
@@ -524668,7 +524855,7 @@ function installAsciicastRecorder() {
524668
524855
  }
524669
524856
  });
524670
524857
  try {
524671
- getFsImplementation().mkdirSync(dirname56(filePath));
524858
+ getFsImplementation().mkdirSync(dirname57(filePath));
524672
524859
  } catch {}
524673
524860
  getFsImplementation().appendFileSync(filePath, header + `
524674
524861
  `, { mode: 384 });
@@ -524737,7 +524924,7 @@ var init_asciicast = __esm(() => {
524737
524924
  });
524738
524925
 
524739
524926
  // src/utils/sessionRestore.ts
524740
- import { dirname as dirname57 } from "path";
524927
+ import { dirname as dirname58 } from "path";
524741
524928
  function extractTodosFromTranscript(messages) {
524742
524929
  for (let i3 = messages.length - 1;i3 >= 0; i3--) {
524743
524930
  const msg = messages[i3];
@@ -524862,7 +525049,7 @@ async function processResumedConversation(result, opts, context8) {
524862
525049
  if (!opts.forkSession) {
524863
525050
  const sid = opts.sessionIdOverride ?? result.sessionId;
524864
525051
  if (sid) {
524865
- switchSession(asSessionId(sid), opts.transcriptPath ? dirname57(opts.transcriptPath) : null);
525052
+ switchSession(asSessionId(sid), opts.transcriptPath ? dirname58(opts.transcriptPath) : null);
524866
525053
  await renameRecordingForSession();
524867
525054
  await resetSessionFilePointer();
524868
525055
  restoreCostStateForSession(sid);
@@ -533557,7 +533744,7 @@ var exports_REPL = {};
533557
533744
  __export(exports_REPL, {
533558
533745
  REPL: () => REPL
533559
533746
  });
533560
- import { dirname as dirname58, join as join152 } from "path";
533747
+ import { dirname as dirname59, join as join152 } from "path";
533561
533748
  import { tmpdir as tmpdir11 } from "os";
533562
533749
  import { writeFile as writeFile44 } from "fs/promises";
533563
533750
  import { randomUUID as randomUUID47 } from "crypto";
@@ -534493,7 +534680,7 @@ function REPL({
534493
534680
  const targetSessionCosts = getStoredSessionCosts(sessionId);
534494
534681
  saveCurrentSessionCosts();
534495
534682
  resetCostState();
534496
- switchSession(asSessionId(sessionId), log2.fullPath ? dirname58(log2.fullPath) : null);
534683
+ switchSession(asSessionId(sessionId), log2.fullPath ? dirname59(log2.fullPath) : null);
534497
534684
  const {
534498
534685
  renameRecordingForSession: renameRecordingForSession2
534499
534686
  } = await Promise.resolve().then(() => (init_asciicast(), exports_asciicast));
@@ -538216,7 +538403,7 @@ function WelcomeV2() {
538216
538403
  dimColor: true,
538217
538404
  children: [
538218
538405
  "v",
538219
- "0.9.2",
538406
+ "0.9.23",
538220
538407
  " "
538221
538408
  ]
538222
538409
  }, undefined, true, undefined, this)
@@ -538416,7 +538603,7 @@ function WelcomeV2() {
538416
538603
  dimColor: true,
538417
538604
  children: [
538418
538605
  "v",
538419
- "0.9.2",
538606
+ "0.9.23",
538420
538607
  " "
538421
538608
  ]
538422
538609
  }, undefined, true, undefined, this)
@@ -538642,7 +538829,7 @@ function AppleTerminalWelcomeV2(t0) {
538642
538829
  dimColor: true,
538643
538830
  children: [
538644
538831
  "v",
538645
- "0.9.2",
538832
+ "0.9.23",
538646
538833
  " "
538647
538834
  ]
538648
538835
  }, undefined, true, undefined, this);
@@ -538896,7 +539083,7 @@ function AppleTerminalWelcomeV2(t0) {
538896
539083
  dimColor: true,
538897
539084
  children: [
538898
539085
  "v",
538899
- "0.9.2",
539086
+ "0.9.23",
538900
539087
  " "
538901
539088
  ]
538902
539089
  }, undefined, true, undefined, this);
@@ -539748,7 +539935,7 @@ var exports_TrustDialog = {};
539748
539935
  __export(exports_TrustDialog, {
539749
539936
  TrustDialog: () => TrustDialog
539750
539937
  });
539751
- import { homedir as homedir38 } from "os";
539938
+ import { homedir as homedir37 } from "os";
539752
539939
  function TrustDialog(t0) {
539753
539940
  const $2 = import_react_compiler_runtime365.c(33);
539754
539941
  const {
@@ -539859,7 +540046,7 @@ function TrustDialog(t0) {
539859
540046
  let t13;
539860
540047
  if ($2[13] !== hasAnyBashExecution) {
539861
540048
  t12 = () => {
539862
- const isHomeDir = homedir38() === getCwd();
540049
+ const isHomeDir = homedir37() === getCwd();
539863
540050
  logEvent("tengu_trust_dialog_shown", {
539864
540051
  isHomeDir,
539865
540052
  hasMcpServers,
@@ -539888,7 +540075,7 @@ function TrustDialog(t0) {
539888
540075
  gracefulShutdownSync(1);
539889
540076
  return;
539890
540077
  }
539891
- const isHomeDir_0 = homedir38() === getCwd();
540078
+ const isHomeDir_0 = homedir37() === getCwd();
539892
540079
  logEvent("tengu_trust_dialog_accept", {
539893
540080
  isHomeDir: isHomeDir_0,
539894
540081
  hasMcpServers,
@@ -541572,7 +541759,7 @@ var exports_ResumeConversation = {};
541572
541759
  __export(exports_ResumeConversation, {
541573
541760
  ResumeConversation: () => ResumeConversation
541574
541761
  });
541575
- import { dirname as dirname59 } from "path";
541762
+ import { dirname as dirname60 } from "path";
541576
541763
  function parsePrIdentifier(value) {
541577
541764
  const directNumber = parseInt(value, 10);
541578
541765
  if (!isNaN(directNumber) && directNumber > 0) {
@@ -541706,7 +541893,7 @@ function ResumeConversation({
541706
541893
  }
541707
541894
  if (false) {}
541708
541895
  if (result_3.sessionId && !forkSession) {
541709
- switchSession(asSessionId(result_3.sessionId), log_0.fullPath ? dirname59(log_0.fullPath) : null);
541896
+ switchSession(asSessionId(result_3.sessionId), log_0.fullPath ? dirname60(log_0.fullPath) : null);
541710
541897
  await renameRecordingForSession();
541711
541898
  await resetSessionFilePointer();
541712
541899
  restoreCostStateForSession(result_3.sessionId);
@@ -544870,7 +545057,7 @@ var init_createDirectConnectSession = __esm(() => {
544870
545057
  });
544871
545058
 
544872
545059
  // src/utils/errorLogSink.ts
544873
- import { dirname as dirname60, join as join153 } from "path";
545060
+ import { dirname as dirname61, join as join153 } from "path";
544874
545061
  function getErrorsPath() {
544875
545062
  return join153(CACHE_PATHS.errors(), DATE + ".jsonl");
544876
545063
  }
@@ -544891,7 +545078,7 @@ function createJsonlWriter(options2) {
544891
545078
  function getLogWriter(path23) {
544892
545079
  let writer = logWriters.get(path23);
544893
545080
  if (!writer) {
544894
- const dir = dirname60(path23);
545081
+ const dir = dirname61(path23);
544895
545082
  writer = createJsonlWriter({
544896
545083
  writeFn: (content) => {
544897
545084
  try {
@@ -545217,7 +545404,7 @@ var init_sessionMemory = __esm(() => {
545217
545404
 
545218
545405
  // src/utils/iTermBackup.ts
545219
545406
  import { copyFile as copyFile11, stat as stat48 } from "fs/promises";
545220
- import { homedir as homedir39 } from "os";
545407
+ import { homedir as homedir38 } from "os";
545221
545408
  import { join as join154 } from "path";
545222
545409
  function markITerm2SetupComplete() {
545223
545410
  saveGlobalConfig((current) => ({
@@ -545233,7 +545420,7 @@ function getIterm2RecoveryInfo() {
545233
545420
  };
545234
545421
  }
545235
545422
  function getITerm2PlistPath() {
545236
- return join154(homedir39(), "Library", "Preferences", "com.googlecode.iterm2.plist");
545423
+ return join154(homedir38(), "Library", "Preferences", "com.googlecode.iterm2.plist");
545237
545424
  }
545238
545425
  async function checkAndRestoreITerm2Backup() {
545239
545426
  const { inProgress, backupPath } = getIterm2RecoveryInfo();
@@ -549284,14 +549471,14 @@ __export(exports_bridgePointer, {
549284
549471
  BRIDGE_POINTER_TTL_MS: () => BRIDGE_POINTER_TTL_MS
549285
549472
  });
549286
549473
  import { mkdir as mkdir44, readFile as readFile51, stat as stat49, unlink as unlink25, writeFile as writeFile47 } from "fs/promises";
549287
- import { dirname as dirname61, join as join157 } from "path";
549474
+ import { dirname as dirname62, join as join157 } from "path";
549288
549475
  function getBridgePointerPath(dir) {
549289
549476
  return join157(getProjectsDir(), sanitizePath2(dir), "bridge-pointer.json");
549290
549477
  }
549291
549478
  async function writeBridgePointer(dir, pointer) {
549292
549479
  const path23 = getBridgePointerPath(dir);
549293
549480
  try {
549294
- await mkdir44(dirname61(path23), { recursive: true });
549481
+ await mkdir44(dirname62(path23), { recursive: true });
549295
549482
  await writeFile47(path23, jsonStringify(pointer), "utf8");
549296
549483
  logForDebugging2(`[bridge:pointer] wrote ${path23}`);
549297
549484
  } catch (err3) {
@@ -551295,7 +551482,7 @@ __export(exports_print, {
551295
551482
  canBatchWith: () => canBatchWith
551296
551483
  });
551297
551484
  import { readFile as readFile52, stat as stat50 } from "fs/promises";
551298
- import { dirname as dirname62 } from "path";
551485
+ import { dirname as dirname63 } from "path";
551299
551486
  import { cwd as cwd2 } from "process";
551300
551487
  import { randomUUID as randomUUID53 } from "crypto";
551301
551488
  function trackReceivedMessageUuid(uuid3) {
@@ -553730,7 +553917,7 @@ async function loadInitialMessages(setAppState, options2) {
553730
553917
  if (false) {}
553731
553918
  if (!options2.forkSession) {
553732
553919
  if (result.sessionId) {
553733
- switchSession(asSessionId(result.sessionId), result.fullPath ? dirname62(result.fullPath) : null);
553920
+ switchSession(asSessionId(result.sessionId), result.fullPath ? dirname63(result.fullPath) : null);
553734
553921
  if (persistSession) {
553735
553922
  await resetSessionFilePointer();
553736
553923
  }
@@ -553828,7 +554015,7 @@ async function loadInitialMessages(setAppState, options2) {
553828
554015
  }
553829
554016
  if (false) {}
553830
554017
  if (!options2.forkSession && result.sessionId) {
553831
- switchSession(asSessionId(result.sessionId), result.fullPath ? dirname62(result.fullPath) : null);
554018
+ switchSession(asSessionId(result.sessionId), result.fullPath ? dirname63(result.fullPath) : null);
553832
554019
  if (persistSession) {
553833
554020
  await resetSessionFilePointer();
553834
554021
  }
@@ -555225,7 +555412,7 @@ __export(exports_claudeDesktop, {
555225
555412
  getClaudeDesktopConfigPath: () => getClaudeDesktopConfigPath
555226
555413
  });
555227
555414
  import { readdir as readdir31, readFile as readFile53, stat as stat51 } from "fs/promises";
555228
- import { homedir as homedir40 } from "os";
555415
+ import { homedir as homedir39 } from "os";
555229
555416
  import { join as join158 } from "path";
555230
555417
  async function getClaudeDesktopConfigPath() {
555231
555418
  const platform8 = getPlatform();
@@ -555233,7 +555420,7 @@ async function getClaudeDesktopConfigPath() {
555233
555420
  throw new Error(`Unsupported platform: ${platform8} - Claude Desktop integration only works on macOS and WSL.`);
555234
555421
  }
555235
555422
  if (platform8 === "macos") {
555236
- return join158(homedir40(), "Library", "Application Support", "Claude", "claude_desktop_config.json");
555423
+ return join158(homedir39(), "Library", "Application Support", "Claude", "claude_desktop_config.json");
555237
555424
  }
555238
555425
  const windowsHome = process.env.USERPROFILE ? process.env.USERPROFILE.replace(/\\/g, "/") : null;
555239
555426
  if (windowsHome) {
@@ -555648,7 +555835,7 @@ __export(exports_plugins, {
555648
555835
  VALID_UPDATE_SCOPES: () => VALID_UPDATE_SCOPES,
555649
555836
  VALID_INSTALLABLE_SCOPES: () => VALID_INSTALLABLE_SCOPES
555650
555837
  });
555651
- import { basename as basename57, dirname as dirname63 } from "path";
555838
+ import { basename as basename57, dirname as dirname64 } from "path";
555652
555839
  function handleMarketplaceError(error42, action2) {
555653
555840
  logError2(error42);
555654
555841
  cliError(`${figures_default.cross} Failed to ${action2}: ${errorMessage(error42)}`);
@@ -555681,9 +555868,9 @@ async function pluginValidateHandler(manifestPath, options2) {
555681
555868
  printValidationResult(result);
555682
555869
  let contentResults = [];
555683
555870
  if (result.fileType === "plugin") {
555684
- const manifestDir = dirname63(result.filePath);
555871
+ const manifestDir = dirname64(result.filePath);
555685
555872
  if (basename57(manifestDir) === ".claude-plugin") {
555686
- contentResults = await validatePluginContents(dirname63(manifestDir));
555873
+ contentResults = await validatePluginContents(dirname64(manifestDir));
555687
555874
  for (const r of contentResults) {
555688
555875
  console.log(`Validating ${r.fileType}: ${r.filePath}
555689
555876
  `);
@@ -556160,11 +556347,11 @@ var exports_install = {};
556160
556347
  __export(exports_install, {
556161
556348
  install: () => install
556162
556349
  });
556163
- import { homedir as homedir41 } from "node:os";
556350
+ import { homedir as homedir40 } from "node:os";
556164
556351
  import { join as join159 } from "node:path";
556165
556352
  function getInstallationPath2() {
556166
556353
  const isWindows2 = env2.platform === "win32";
556167
- const homeDir = homedir41();
556354
+ const homeDir = homedir40();
556168
556355
  if (isWindows2) {
556169
556356
  const windowsPath = join159(homeDir, ".local", "bin", "claude.exe");
556170
556357
  return windowsPath.replace(/\//g, "\\");
@@ -559017,7 +559204,7 @@ Usage: claude --remote "your task description"`, () => gracefulShutdown(1));
559017
559204
  pendingHookMessages
559018
559205
  }, renderAndRun);
559019
559206
  }
559020
- }).version("0.9.2 (Snowcode)", "-v, --version", "Output the version number");
559207
+ }).version("0.9.23 (Snowcode)", "-v, --version", "Output the version number");
559021
559208
  program.option("-w, --worktree [name]", "Create a new git worktree for this session (optionally specify a name)");
559022
559209
  program.option("--tmux", "Create a tmux session for the worktree (requires --worktree). Uses iTerm2 native panes when available; use --tmux=classic for traditional tmux.");
559023
559210
  if (canUserConfigureAdvisor()) {
@@ -559578,7 +559765,7 @@ function validateProviderEnvOrExit() {
559578
559765
  async function main2() {
559579
559766
  const args = process.argv.slice(2);
559580
559767
  if (args.length === 1 && (args[0] === "--version" || args[0] === "-v" || args[0] === "-V")) {
559581
- console.log(`${"0.9.2"} (Snowcode)`);
559768
+ console.log(`${"0.9.23"} (Snowcode)`);
559582
559769
  return;
559583
559770
  }
559584
559771
  validateProviderEnvOrExit();
@@ -559667,4 +559854,4 @@ async function main2() {
559667
559854
  }
559668
559855
  main2();
559669
559856
 
559670
- //# debugId=9BF983086649C86964756E2164756E21
559857
+ //# debugId=C9A769673304C1DF64756E2164756E21