oh-my-opencode-unguarded 3.9.4 → 3.10.1

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.
package/dist/cli/index.js CHANGED
@@ -7109,11 +7109,14 @@ var init_constants = __esm(() => {
7109
7109
  });
7110
7110
 
7111
7111
  // src/features/hook-message-injector/injector.ts
7112
+ import { randomBytes } from "crypto";
7113
+ var processPrefix;
7112
7114
  var init_injector = __esm(() => {
7113
7115
  init_constants();
7114
7116
  init_logger();
7115
7117
  init_opencode_storage_detection();
7116
7118
  init_shared();
7119
+ processPrefix = randomBytes(4).toString("hex");
7117
7120
  });
7118
7121
 
7119
7122
  // src/features/hook-message-injector/index.ts
@@ -8530,6 +8533,7 @@ var require_src = __commonJS((exports, module) => {
8530
8533
  });
8531
8534
 
8532
8535
  // src/hooks/auto-update-checker/constants.ts
8536
+ import * as fs4 from "fs";
8533
8537
  import * as path4 from "path";
8534
8538
  import * as os3 from "os";
8535
8539
  function getCacheDir2() {
@@ -8538,21 +8542,37 @@ function getCacheDir2() {
8538
8542
  }
8539
8543
  return path4.join(os3.homedir(), ".cache", "opencode");
8540
8544
  }
8545
+ function resolveHostCacheDir() {
8546
+ if (process.platform === "win32") {
8547
+ const dotCacheDir = path4.join(os3.homedir(), ".cache", "opencode");
8548
+ if (fs4.existsSync(path4.join(dotCacheDir, "node_modules"))) {
8549
+ return dotCacheDir;
8550
+ }
8551
+ const localAppDataDir = path4.join(process.env.LOCALAPPDATA ?? os3.homedir(), "opencode");
8552
+ if (fs4.existsSync(path4.join(localAppDataDir, "node_modules"))) {
8553
+ return localAppDataDir;
8554
+ }
8555
+ return dotCacheDir;
8556
+ }
8557
+ return path4.join(os3.homedir(), ".cache", "opencode");
8558
+ }
8541
8559
  function getWindowsAppdataDir() {
8542
8560
  if (process.platform !== "win32")
8543
8561
  return null;
8544
8562
  return process.env.APPDATA ?? path4.join(os3.homedir(), "AppData", "Roaming");
8545
8563
  }
8546
- var PACKAGE_NAME3 = "oh-my-opencode-unguarded", NPM_REGISTRY_URL, NPM_FETCH_TIMEOUT = 5000, CACHE_DIR, VERSION_FILE, USER_CONFIG_DIR, USER_OPENCODE_CONFIG, USER_OPENCODE_CONFIG_JSONC, INSTALLED_PACKAGE_JSON;
8564
+ var PACKAGE_NAME3 = "oh-my-opencode-unguarded", NPM_REGISTRY_URL, NPM_FETCH_TIMEOUT = 5000, CACHE_DIR, VERSION_FILE, HOST_CACHE_DIR, USER_CONFIG_DIR, USER_OPENCODE_CONFIG, USER_OPENCODE_CONFIG_JSONC, INSTALLED_PACKAGE_JSON, HOST_INSTALLED_PACKAGE_JSON;
8547
8565
  var init_constants3 = __esm(() => {
8548
8566
  init_shared();
8549
8567
  NPM_REGISTRY_URL = `https://registry.npmjs.org/-/package/${PACKAGE_NAME3}/dist-tags`;
8550
8568
  CACHE_DIR = getCacheDir2();
8551
8569
  VERSION_FILE = path4.join(CACHE_DIR, "version");
8570
+ HOST_CACHE_DIR = resolveHostCacheDir();
8552
8571
  USER_CONFIG_DIR = getOpenCodeConfigDir({ binary: "opencode" });
8553
8572
  USER_OPENCODE_CONFIG = path4.join(USER_CONFIG_DIR, "opencode.json");
8554
8573
  USER_OPENCODE_CONFIG_JSONC = path4.join(USER_CONFIG_DIR, "opencode.jsonc");
8555
8574
  INSTALLED_PACKAGE_JSON = path4.join(USER_CONFIG_DIR, "node_modules", PACKAGE_NAME3, "package.json");
8575
+ HOST_INSTALLED_PACKAGE_JSON = path4.join(HOST_CACHE_DIR, "node_modules", PACKAGE_NAME3, "package.json");
8556
8576
  });
8557
8577
 
8558
8578
  // src/hooks/auto-update-checker/checker/config-paths.ts
@@ -8592,7 +8612,7 @@ function stripJsonComments(json3) {
8592
8612
  }
8593
8613
 
8594
8614
  // src/hooks/auto-update-checker/checker/local-dev-path.ts
8595
- import * as fs4 from "fs";
8615
+ import * as fs5 from "fs";
8596
8616
  import { fileURLToPath } from "url";
8597
8617
  function isLocalDevMode(directory) {
8598
8618
  return getLocalDevPath(directory) !== null;
@@ -8600,9 +8620,9 @@ function isLocalDevMode(directory) {
8600
8620
  function getLocalDevPath(directory) {
8601
8621
  for (const configPath of getConfigPaths(directory)) {
8602
8622
  try {
8603
- if (!fs4.existsSync(configPath))
8623
+ if (!fs5.existsSync(configPath))
8604
8624
  continue;
8605
- const content = fs4.readFileSync(configPath, "utf-8");
8625
+ const content = fs5.readFileSync(configPath, "utf-8");
8606
8626
  const config2 = JSON.parse(stripJsonComments(content));
8607
8627
  const plugins = config2.plugin ?? [];
8608
8628
  for (const entry of plugins) {
@@ -8626,17 +8646,17 @@ var init_local_dev_path = __esm(() => {
8626
8646
  });
8627
8647
 
8628
8648
  // src/hooks/auto-update-checker/checker/package-json-locator.ts
8629
- import * as fs5 from "fs";
8649
+ import * as fs6 from "fs";
8630
8650
  import * as path6 from "path";
8631
8651
  function findPackageJsonUp(startPath) {
8632
8652
  try {
8633
- const stat = fs5.statSync(startPath);
8653
+ const stat = fs6.statSync(startPath);
8634
8654
  let dir = stat.isDirectory() ? startPath : path6.dirname(startPath);
8635
8655
  for (let i2 = 0;i2 < 10; i2++) {
8636
8656
  const pkgPath = path6.join(dir, "package.json");
8637
- if (fs5.existsSync(pkgPath)) {
8657
+ if (fs6.existsSync(pkgPath)) {
8638
8658
  try {
8639
- const content = fs5.readFileSync(pkgPath, "utf-8");
8659
+ const content = fs6.readFileSync(pkgPath, "utf-8");
8640
8660
  const pkg = JSON.parse(content);
8641
8661
  if (pkg.name === PACKAGE_NAME3)
8642
8662
  return pkgPath;
@@ -8655,7 +8675,7 @@ var init_package_json_locator = __esm(() => {
8655
8675
  });
8656
8676
 
8657
8677
  // src/hooks/auto-update-checker/checker/local-dev-version.ts
8658
- import * as fs6 from "fs";
8678
+ import * as fs7 from "fs";
8659
8679
  function getLocalDevVersion(directory) {
8660
8680
  const localPath = getLocalDevPath(directory);
8661
8681
  if (!localPath)
@@ -8664,7 +8684,7 @@ function getLocalDevVersion(directory) {
8664
8684
  const pkgPath = findPackageJsonUp(localPath);
8665
8685
  if (!pkgPath)
8666
8686
  return null;
8667
- const content = fs6.readFileSync(pkgPath, "utf-8");
8687
+ const content = fs7.readFileSync(pkgPath, "utf-8");
8668
8688
  const pkg = JSON.parse(content);
8669
8689
  return pkg.version ?? null;
8670
8690
  } catch {
@@ -8677,16 +8697,16 @@ var init_local_dev_version = __esm(() => {
8677
8697
  });
8678
8698
 
8679
8699
  // src/hooks/auto-update-checker/checker/plugin-entry.ts
8680
- import * as fs7 from "fs";
8700
+ import * as fs8 from "fs";
8681
8701
  function isExplicitVersionPin(pinnedVersion) {
8682
8702
  return /^\d+\.\d+\.\d+/.test(pinnedVersion);
8683
8703
  }
8684
8704
  function findPluginEntry(directory) {
8685
8705
  for (const configPath of getConfigPaths(directory)) {
8686
8706
  try {
8687
- if (!fs7.existsSync(configPath))
8707
+ if (!fs8.existsSync(configPath))
8688
8708
  continue;
8689
- const content = fs7.readFileSync(configPath, "utf-8");
8709
+ const content = fs8.readFileSync(configPath, "utf-8");
8690
8710
  const config2 = JSON.parse(stripJsonComments(content));
8691
8711
  const plugins = config2.plugin ?? [];
8692
8712
  for (const entry of plugins) {
@@ -8711,23 +8731,32 @@ var init_plugin_entry = __esm(() => {
8711
8731
  });
8712
8732
 
8713
8733
  // src/hooks/auto-update-checker/checker/cached-version.ts
8714
- import * as fs8 from "fs";
8734
+ import * as fs9 from "fs";
8715
8735
  import * as path7 from "path";
8716
8736
  import { fileURLToPath as fileURLToPath2 } from "url";
8717
- function getCachedVersion() {
8737
+ function readVersionFromPackageJson(pkgJsonPath) {
8718
8738
  try {
8719
- if (fs8.existsSync(INSTALLED_PACKAGE_JSON)) {
8720
- const content = fs8.readFileSync(INSTALLED_PACKAGE_JSON, "utf-8");
8739
+ if (fs9.existsSync(pkgJsonPath)) {
8740
+ const content = fs9.readFileSync(pkgJsonPath, "utf-8");
8721
8741
  const pkg = JSON.parse(content);
8722
8742
  if (pkg.version)
8723
8743
  return pkg.version;
8724
8744
  }
8725
8745
  } catch {}
8746
+ return null;
8747
+ }
8748
+ function getCachedVersion() {
8749
+ const hostVersion = readVersionFromPackageJson(HOST_INSTALLED_PACKAGE_JSON);
8750
+ if (hostVersion)
8751
+ return hostVersion;
8752
+ const configVersion = readVersionFromPackageJson(INSTALLED_PACKAGE_JSON);
8753
+ if (configVersion)
8754
+ return configVersion;
8726
8755
  try {
8727
8756
  const currentDir = path7.dirname(fileURLToPath2(import.meta.url));
8728
8757
  const pkgPath = findPackageJsonUp(currentDir);
8729
8758
  if (pkgPath) {
8730
- const content = fs8.readFileSync(pkgPath, "utf-8");
8759
+ const content = fs9.readFileSync(pkgPath, "utf-8");
8731
8760
  const pkg = JSON.parse(content);
8732
8761
  if (pkg.version)
8733
8762
  return pkg.version;
@@ -8736,10 +8765,10 @@ function getCachedVersion() {
8736
8765
  log("[auto-update-checker] Failed to resolve version from current directory:", err);
8737
8766
  }
8738
8767
  try {
8739
- const execDir = path7.dirname(fs8.realpathSync(process.execPath));
8768
+ const execDir = path7.dirname(fs9.realpathSync(process.execPath));
8740
8769
  const pkgPath = findPackageJsonUp(execDir);
8741
8770
  if (pkgPath) {
8742
- const content = fs8.readFileSync(pkgPath, "utf-8");
8771
+ const content = fs9.readFileSync(pkgPath, "utf-8");
8743
8772
  const pkg = JSON.parse(content);
8744
8773
  if (pkg.version)
8745
8774
  return pkg.version;
@@ -8756,10 +8785,10 @@ var init_cached_version = __esm(() => {
8756
8785
  });
8757
8786
 
8758
8787
  // src/hooks/auto-update-checker/checker/pinned-version-updater.ts
8759
- import * as fs9 from "fs";
8788
+ import * as fs10 from "fs";
8760
8789
  function replacePluginEntry(configPath, oldEntry, newEntry) {
8761
8790
  try {
8762
- const content = fs9.readFileSync(configPath, "utf-8");
8791
+ const content = fs10.readFileSync(configPath, "utf-8");
8763
8792
  const pluginMatch = content.match(/"plugin"\s*:\s*\[/);
8764
8793
  if (!pluginMatch || pluginMatch.index === undefined) {
8765
8794
  log(`[auto-update-checker] No "plugin" array found in ${configPath}`);
@@ -8790,7 +8819,7 @@ function replacePluginEntry(configPath, oldEntry, newEntry) {
8790
8819
  log(`[auto-update-checker] No changes made to ${configPath}`);
8791
8820
  return false;
8792
8821
  }
8793
- fs9.writeFileSync(configPath, updatedContent, "utf-8");
8822
+ fs10.writeFileSync(configPath, updatedContent, "utf-8");
8794
8823
  log(`[auto-update-checker] Updated ${configPath}: ${oldEntry} \u2192 ${newEntry}`);
8795
8824
  return true;
8796
8825
  } catch (err) {
@@ -8937,17 +8966,17 @@ var init_checker = __esm(() => {
8937
8966
  });
8938
8967
 
8939
8968
  // src/hooks/auto-update-checker/cache.ts
8940
- import * as fs10 from "fs";
8969
+ import * as fs11 from "fs";
8941
8970
  import * as path8 from "path";
8942
8971
  function stripTrailingCommas(json3) {
8943
8972
  return json3.replace(/,(\s*[}\]])/g, "$1");
8944
8973
  }
8945
- function removeFromBunLock(packageName) {
8946
- const lockPath = path8.join(USER_CONFIG_DIR, "bun.lock");
8947
- if (!fs10.existsSync(lockPath))
8974
+ function removeFromBunLock(dir, packageName) {
8975
+ const lockPath = path8.join(dir, "bun.lock");
8976
+ if (!fs11.existsSync(lockPath))
8948
8977
  return false;
8949
8978
  try {
8950
- const content = fs10.readFileSync(lockPath, "utf-8");
8979
+ const content = fs11.readFileSync(lockPath, "utf-8");
8951
8980
  const lock = JSON.parse(stripTrailingCommas(content));
8952
8981
  let modified = false;
8953
8982
  if (lock.workspaces?.[""]?.dependencies?.[packageName]) {
@@ -8959,38 +8988,55 @@ function removeFromBunLock(packageName) {
8959
8988
  modified = true;
8960
8989
  }
8961
8990
  if (modified) {
8962
- fs10.writeFileSync(lockPath, JSON.stringify(lock, null, 2));
8963
- log(`[auto-update-checker] Removed from bun.lock: ${packageName}`);
8991
+ fs11.writeFileSync(lockPath, JSON.stringify(lock, null, 2));
8992
+ log(`[auto-update-checker] Removed from bun.lock in ${dir}: ${packageName}`);
8964
8993
  }
8965
8994
  return modified;
8966
8995
  } catch {
8967
8996
  return false;
8968
8997
  }
8969
8998
  }
8999
+ function removeNodeModulesDir(baseDir, packageName) {
9000
+ const pkgDir = path8.join(baseDir, "node_modules", packageName);
9001
+ if (!fs11.existsSync(pkgDir))
9002
+ return false;
9003
+ fs11.rmSync(pkgDir, { recursive: true, force: true });
9004
+ log(`[auto-update-checker] Package removed: ${pkgDir}`);
9005
+ return true;
9006
+ }
9007
+ function removeFromPackageJson(baseDir, packageName) {
9008
+ const pkgJsonPath = path8.join(baseDir, "package.json");
9009
+ if (!fs11.existsSync(pkgJsonPath))
9010
+ return false;
9011
+ try {
9012
+ const content = fs11.readFileSync(pkgJsonPath, "utf-8");
9013
+ const pkgJson = JSON.parse(content);
9014
+ if (pkgJson.dependencies?.[packageName]) {
9015
+ delete pkgJson.dependencies[packageName];
9016
+ fs11.writeFileSync(pkgJsonPath, JSON.stringify(pkgJson, null, 2));
9017
+ log(`[auto-update-checker] Dependency removed from package.json in ${baseDir}: ${packageName}`);
9018
+ return true;
9019
+ }
9020
+ } catch {}
9021
+ return false;
9022
+ }
8970
9023
  function invalidatePackage(packageName = PACKAGE_NAME3) {
8971
9024
  try {
8972
- const pkgDir = path8.join(USER_CONFIG_DIR, "node_modules", packageName);
8973
- const pkgJsonPath = path8.join(USER_CONFIG_DIR, "package.json");
8974
- let packageRemoved = false;
8975
- let dependencyRemoved = false;
8976
- let lockRemoved = false;
8977
- if (fs10.existsSync(pkgDir)) {
8978
- fs10.rmSync(pkgDir, { recursive: true, force: true });
8979
- log(`[auto-update-checker] Package removed: ${pkgDir}`);
8980
- packageRemoved = true;
8981
- }
8982
- if (fs10.existsSync(pkgJsonPath)) {
8983
- const content = fs10.readFileSync(pkgJsonPath, "utf-8");
8984
- const pkgJson = JSON.parse(content);
8985
- if (pkgJson.dependencies?.[packageName]) {
8986
- delete pkgJson.dependencies[packageName];
8987
- fs10.writeFileSync(pkgJsonPath, JSON.stringify(pkgJson, null, 2));
8988
- log(`[auto-update-checker] Dependency removed from package.json: ${packageName}`);
8989
- dependencyRemoved = true;
8990
- }
8991
- }
8992
- lockRemoved = removeFromBunLock(packageName);
8993
- if (!packageRemoved && !dependencyRemoved && !lockRemoved) {
9025
+ let invalidated = false;
9026
+ const hostRemoved = removeNodeModulesDir(HOST_CACHE_DIR, packageName);
9027
+ const hostPkgJsonRemoved = removeFromPackageJson(HOST_CACHE_DIR, packageName);
9028
+ const hostLockRemoved = removeFromBunLock(HOST_CACHE_DIR, packageName);
9029
+ if (hostRemoved || hostPkgJsonRemoved || hostLockRemoved) {
9030
+ invalidated = true;
9031
+ }
9032
+ if (HOST_CACHE_DIR !== USER_CONFIG_DIR) {
9033
+ const configRemoved = removeNodeModulesDir(USER_CONFIG_DIR, packageName);
9034
+ const configLockRemoved = removeFromBunLock(USER_CONFIG_DIR, packageName);
9035
+ if (configRemoved || configLockRemoved) {
9036
+ invalidated = true;
9037
+ }
9038
+ }
9039
+ if (!invalidated) {
8994
9040
  log(`[auto-update-checker] Package not found, nothing to invalidate: ${packageName}`);
8995
9041
  return false;
8996
9042
  }
@@ -9329,7 +9375,7 @@ var {
9329
9375
  // package.json
9330
9376
  var package_default = {
9331
9377
  name: "oh-my-opencode-unguarded",
9332
- version: "3.9.4",
9378
+ version: "3.10.1",
9333
9379
  description: "The Best AI Agent Harness - Batteries-Included OpenCode Plugin with Multi-Model Orchestration, Parallel Background Agents, and Crafted LSP/AST Tools",
9334
9380
  main: "dist/index.js",
9335
9381
  types: "dist/index.d.ts",
@@ -9379,10 +9425,6 @@ var package_default = {
9379
9425
  url: "https://github.com/D4ch1au/evil-oh-my-opencode/issues"
9380
9426
  },
9381
9427
  homepage: "https://github.com/D4ch1au/evil-oh-my-opencode#readme",
9382
- publishConfig: {
9383
- registry: "https://registry.npmjs.org",
9384
- access: "public"
9385
- },
9386
9428
  dependencies: {
9387
9429
  "@ast-grep/cli": "^0.40.0",
9388
9430
  "@ast-grep/napi": "^0.40.0",
@@ -9408,23 +9450,27 @@ var package_default = {
9408
9450
  typescript: "^5.7.3"
9409
9451
  },
9410
9452
  optionalDependencies: {
9411
- "oh-my-opencode-darwin-arm64": "3.9.0",
9412
- "oh-my-opencode-darwin-x64": "3.9.0",
9413
- "oh-my-opencode-darwin-x64-baseline": "3.9.0",
9414
- "oh-my-opencode-linux-arm64": "3.9.0",
9415
- "oh-my-opencode-linux-arm64-musl": "3.9.0",
9416
- "oh-my-opencode-linux-x64": "3.9.0",
9417
- "oh-my-opencode-linux-x64-baseline": "3.9.0",
9418
- "oh-my-opencode-linux-x64-musl": "3.9.0",
9419
- "oh-my-opencode-linux-x64-musl-baseline": "3.9.0",
9420
- "oh-my-opencode-windows-x64": "3.9.0",
9421
- "oh-my-opencode-windows-x64-baseline": "3.9.0"
9453
+ "oh-my-opencode-darwin-arm64": "3.10.0",
9454
+ "oh-my-opencode-darwin-x64": "3.10.0",
9455
+ "oh-my-opencode-darwin-x64-baseline": "3.10.0",
9456
+ "oh-my-opencode-linux-arm64": "3.10.0",
9457
+ "oh-my-opencode-linux-arm64-musl": "3.10.0",
9458
+ "oh-my-opencode-linux-x64": "3.10.0",
9459
+ "oh-my-opencode-linux-x64-baseline": "3.10.0",
9460
+ "oh-my-opencode-linux-x64-musl": "3.10.0",
9461
+ "oh-my-opencode-linux-x64-musl-baseline": "3.10.0",
9462
+ "oh-my-opencode-windows-x64": "3.10.0",
9463
+ "oh-my-opencode-windows-x64-baseline": "3.10.0"
9422
9464
  },
9423
9465
  trustedDependencies: [
9424
9466
  "@ast-grep/cli",
9425
9467
  "@ast-grep/napi",
9426
9468
  "@code-yeongyu/comment-checker"
9427
- ]
9469
+ ],
9470
+ publishConfig: {
9471
+ registry: "https://registry.npmjs.org",
9472
+ access: "public"
9473
+ }
9428
9474
  };
9429
9475
 
9430
9476
  // src/cli/cli-installer.ts
@@ -26598,11 +26644,11 @@ var PACKAGE_NAME4 = "oh-my-opencode-unguarded";
26598
26644
  var OPENCODE_BINARIES2 = ["opencode", "opencode-desktop"];
26599
26645
 
26600
26646
  // src/cli/doctor/checks/system.ts
26601
- import { existsSync as existsSync22, readFileSync as readFileSync23 } from "fs";
26647
+ import { existsSync as existsSync23, readFileSync as readFileSync23 } from "fs";
26602
26648
 
26603
26649
  // src/cli/doctor/checks/system-binary.ts
26604
26650
  init_spawn_with_windows_hide();
26605
- import { existsSync as existsSync19 } from "fs";
26651
+ import { existsSync as existsSync20 } from "fs";
26606
26652
  import { homedir as homedir5 } from "os";
26607
26653
  import { join as join16 } from "path";
26608
26654
  function getDesktopAppPaths(platform) {
@@ -26642,7 +26688,7 @@ function buildVersionCommand(binaryPath, platform) {
26642
26688
  }
26643
26689
  return [binaryPath, "--version"];
26644
26690
  }
26645
- function findDesktopBinary(platform = process.platform, checkExists = existsSync19) {
26691
+ function findDesktopBinary(platform = process.platform, checkExists = existsSync20) {
26646
26692
  for (const desktopPath of getDesktopAppPaths(platform)) {
26647
26693
  if (checkExists(desktopPath)) {
26648
26694
  return { binary: "opencode", path: desktopPath };
@@ -26689,13 +26735,13 @@ function compareVersions(current, minimum) {
26689
26735
  }
26690
26736
 
26691
26737
  // src/cli/doctor/checks/system-plugin.ts
26692
- import { existsSync as existsSync20, readFileSync as readFileSync21 } from "fs";
26738
+ import { existsSync as existsSync21, readFileSync as readFileSync21 } from "fs";
26693
26739
  init_shared();
26694
26740
  function detectConfigPath() {
26695
26741
  const paths = getOpenCodeConfigPaths({ binary: "opencode", version: null });
26696
- if (existsSync20(paths.configJsonc))
26742
+ if (existsSync21(paths.configJsonc))
26697
26743
  return paths.configJsonc;
26698
- if (existsSync20(paths.configJson))
26744
+ if (existsSync21(paths.configJson))
26699
26745
  return paths.configJson;
26700
26746
  return null;
26701
26747
  }
@@ -26768,7 +26814,7 @@ function getPluginInfo() {
26768
26814
  // src/cli/doctor/checks/system-loaded-version.ts
26769
26815
  init_checker();
26770
26816
  init_auto_update_checker();
26771
- import { existsSync as existsSync21, readFileSync as readFileSync22 } from "fs";
26817
+ import { existsSync as existsSync22, readFileSync as readFileSync22 } from "fs";
26772
26818
  import { homedir as homedir6 } from "os";
26773
26819
  import { join as join17 } from "path";
26774
26820
  init_shared();
@@ -26785,12 +26831,12 @@ function resolveOpenCodeCacheDir() {
26785
26831
  return join17(xdgCacheHome, "opencode");
26786
26832
  const fromShared = getOpenCodeCacheDir();
26787
26833
  const platformDefault = join17(getPlatformDefaultCacheDir(), "opencode");
26788
- if (existsSync21(fromShared) || !existsSync21(platformDefault))
26834
+ if (existsSync22(fromShared) || !existsSync22(platformDefault))
26789
26835
  return fromShared;
26790
26836
  return platformDefault;
26791
26837
  }
26792
26838
  function readPackageJson(filePath) {
26793
- if (!existsSync21(filePath))
26839
+ if (!existsSync22(filePath))
26794
26840
  return null;
26795
26841
  try {
26796
26842
  const content = readFileSync22(filePath, "utf-8");
@@ -26831,7 +26877,7 @@ init_shared();
26831
26877
  function isConfigValid(configPath) {
26832
26878
  if (!configPath)
26833
26879
  return true;
26834
- if (!existsSync22(configPath))
26880
+ if (!existsSync23(configPath))
26835
26881
  return false;
26836
26882
  try {
26837
26883
  parseJsonc(readFileSync23(configPath, "utf-8"));
@@ -26942,7 +26988,7 @@ init_shared();
26942
26988
 
26943
26989
  // src/cli/doctor/checks/model-resolution-cache.ts
26944
26990
  init_shared();
26945
- import { existsSync as existsSync23, readFileSync as readFileSync24 } from "fs";
26991
+ import { existsSync as existsSync24, readFileSync as readFileSync24 } from "fs";
26946
26992
  import { homedir as homedir7 } from "os";
26947
26993
  import { join as join18 } from "path";
26948
26994
  function getOpenCodeCacheDir2() {
@@ -26953,7 +26999,7 @@ function getOpenCodeCacheDir2() {
26953
26999
  }
26954
27000
  function loadAvailableModelsFromCache() {
26955
27001
  const cacheFile = join18(getOpenCodeCacheDir2(), "models.json");
26956
- if (!existsSync23(cacheFile)) {
27002
+ if (!existsSync24(cacheFile)) {
26957
27003
  return { providers: [], modelCount: 0, cacheExists: false };
26958
27004
  }
26959
27005
  try {
@@ -27279,7 +27325,7 @@ async function checkConfig() {
27279
27325
 
27280
27326
  // src/cli/doctor/checks/dependencies.ts
27281
27327
  init_spawn_with_windows_hide();
27282
- import { existsSync as existsSync24 } from "fs";
27328
+ import { existsSync as existsSync25 } from "fs";
27283
27329
  import { createRequire } from "module";
27284
27330
  import { dirname as dirname6, join as join22 } from "path";
27285
27331
  async function checkBinaryExists(binary2) {
@@ -27337,7 +27383,7 @@ async function checkAstGrepNapi() {
27337
27383
  path: null
27338
27384
  };
27339
27385
  } catch {
27340
- const { existsSync: existsSync25 } = await import("fs");
27386
+ const { existsSync: existsSync26 } = await import("fs");
27341
27387
  const { join: join23 } = await import("path");
27342
27388
  const { homedir: homedir8 } = await import("os");
27343
27389
  const pathsToCheck = [
@@ -27345,7 +27391,7 @@ async function checkAstGrepNapi() {
27345
27391
  join23(process.cwd(), "node_modules", "@ast-grep", "napi")
27346
27392
  ];
27347
27393
  for (const napiPath of pathsToCheck) {
27348
- if (existsSync25(napiPath)) {
27394
+ if (existsSync26(napiPath)) {
27349
27395
  return {
27350
27396
  name: "AST-Grep NAPI",
27351
27397
  required: false,
@@ -27371,7 +27417,7 @@ function findCommentCheckerPackageBinary() {
27371
27417
  const require2 = createRequire(import.meta.url);
27372
27418
  const pkgPath = require2.resolve("@code-yeongyu/comment-checker/package.json");
27373
27419
  const binaryPath = join22(dirname6(pkgPath), "bin", binaryName);
27374
- if (existsSync24(binaryPath))
27420
+ if (existsSync25(binaryPath))
27375
27421
  return binaryPath;
27376
27422
  } catch {}
27377
27423
  return null;
@@ -27490,14 +27536,14 @@ init_jsonc_parser();
27490
27536
 
27491
27537
  // src/tools/lsp/server-installation.ts
27492
27538
  init_shared();
27493
- import { existsSync as existsSync25 } from "fs";
27539
+ import { existsSync as existsSync26 } from "fs";
27494
27540
  import { join as join23 } from "path";
27495
27541
  function isServerInstalled(command) {
27496
27542
  if (command.length === 0)
27497
27543
  return false;
27498
27544
  const cmd = command[0];
27499
27545
  if (cmd.includes("/") || cmd.includes("\\")) {
27500
- if (existsSync25(cmd))
27546
+ if (existsSync26(cmd))
27501
27547
  return true;
27502
27548
  }
27503
27549
  const isWindows = process.platform === "win32";
@@ -27519,7 +27565,7 @@ function isServerInstalled(command) {
27519
27565
  const paths = pathEnv.split(pathSeparator);
27520
27566
  for (const p2 of paths) {
27521
27567
  for (const suffix of exts) {
27522
- if (existsSync25(join23(p2, cmd + suffix))) {
27568
+ if (existsSync26(join23(p2, cmd + suffix))) {
27523
27569
  return true;
27524
27570
  }
27525
27571
  }
@@ -27535,7 +27581,7 @@ function isServerInstalled(command) {
27535
27581
  ];
27536
27582
  for (const base of additionalBases) {
27537
27583
  for (const suffix of exts) {
27538
- if (existsSync25(join23(base, cmd + suffix))) {
27584
+ if (existsSync26(join23(base, cmd + suffix))) {
27539
27585
  return true;
27540
27586
  }
27541
27587
  }
@@ -27569,7 +27615,7 @@ function getLspServerStats(servers) {
27569
27615
 
27570
27616
  // src/cli/doctor/checks/tools-mcp.ts
27571
27617
  init_shared();
27572
- import { existsSync as existsSync26, readFileSync as readFileSync27 } from "fs";
27618
+ import { existsSync as existsSync27, readFileSync as readFileSync27 } from "fs";
27573
27619
  import { homedir as homedir8 } from "os";
27574
27620
  import { join as join24 } from "path";
27575
27621
  var BUILTIN_MCP_SERVERS = ["context7", "grep_app"];
@@ -27583,7 +27629,7 @@ function getMcpConfigPaths() {
27583
27629
  function loadUserMcpConfig() {
27584
27630
  const servers = {};
27585
27631
  for (const configPath of getMcpConfigPaths()) {
27586
- if (!existsSync26(configPath))
27632
+ if (!existsSync27(configPath))
27587
27633
  continue;
27588
27634
  try {
27589
27635
  const content = readFileSync27(configPath, "utf-8");
@@ -27988,7 +28034,7 @@ async function doctor(options = { mode: "default" }) {
27988
28034
 
27989
28035
  // src/features/mcp-oauth/storage.ts
27990
28036
  init_shared();
27991
- import { chmodSync, existsSync as existsSync27, mkdirSync as mkdirSync6, readFileSync as readFileSync28, unlinkSync as unlinkSync2, writeFileSync as writeFileSync12 } from "fs";
28037
+ import { chmodSync, existsSync as existsSync28, mkdirSync as mkdirSync6, readFileSync as readFileSync28, unlinkSync as unlinkSync2, writeFileSync as writeFileSync12 } from "fs";
27992
28038
  import { dirname as dirname7, join as join25 } from "path";
27993
28039
  var STORAGE_FILE_NAME = "mcp-oauth.json";
27994
28040
  function getMcpOauthStoragePath() {
@@ -28029,7 +28075,7 @@ function buildKey(serverHost, resource) {
28029
28075
  }
28030
28076
  function readStore() {
28031
28077
  const filePath = getMcpOauthStoragePath();
28032
- if (!existsSync27(filePath)) {
28078
+ if (!existsSync28(filePath)) {
28033
28079
  return null;
28034
28080
  }
28035
28081
  try {
@@ -28043,7 +28089,7 @@ function writeStore(store2) {
28043
28089
  const filePath = getMcpOauthStoragePath();
28044
28090
  try {
28045
28091
  const dir = dirname7(filePath);
28046
- if (!existsSync27(dir)) {
28092
+ if (!existsSync28(dir)) {
28047
28093
  mkdirSync6(dir, { recursive: true });
28048
28094
  }
28049
28095
  writeFileSync12(filePath, JSON.stringify(store2, null, 2), { encoding: "utf-8", mode: 384 });
@@ -28078,7 +28124,7 @@ function deleteToken(serverHost, resource) {
28078
28124
  if (Object.keys(store2).length === 0) {
28079
28125
  try {
28080
28126
  const filePath = getMcpOauthStoragePath();
28081
- if (existsSync27(filePath)) {
28127
+ if (existsSync28(filePath)) {
28082
28128
  unlinkSync2(filePath);
28083
28129
  }
28084
28130
  return true;
@@ -28259,10 +28305,10 @@ async function findAvailablePort2(startPort = DEFAULT_PORT) {
28259
28305
 
28260
28306
  // src/features/mcp-oauth/oauth-authorization-flow.ts
28261
28307
  import { spawn as spawn2 } from "child_process";
28262
- import { createHash, randomBytes } from "crypto";
28308
+ import { createHash, randomBytes as randomBytes2 } from "crypto";
28263
28309
  import { createServer } from "http";
28264
28310
  function generateCodeVerifier() {
28265
- return randomBytes(32).toString("base64url");
28311
+ return randomBytes2(32).toString("base64url");
28266
28312
  }
28267
28313
  function generateCodeChallenge(verifier) {
28268
28314
  return createHash("sha256").update(verifier).digest("base64url");
@@ -28347,7 +28393,7 @@ function openBrowser(url2) {
28347
28393
  async function runAuthorizationCodeRedirect(options) {
28348
28394
  const verifier = generateCodeVerifier();
28349
28395
  const challenge = generateCodeChallenge(verifier);
28350
- const state = randomBytes(16).toString("hex");
28396
+ const state = randomBytes2(16).toString("hex");
28351
28397
  const authorizationUrl = buildAuthorizationUrl(options.authorizationEndpoint, {
28352
28398
  clientId: options.clientId,
28353
28399
  redirectUri: options.redirectUri,
@@ -3,8 +3,10 @@ export declare const NPM_REGISTRY_URL = "https://registry.npmjs.org/-/package/oh
3
3
  export declare const NPM_FETCH_TIMEOUT = 5000;
4
4
  export declare const CACHE_DIR: string;
5
5
  export declare const VERSION_FILE: string;
6
+ export declare const HOST_CACHE_DIR: string;
6
7
  export declare function getWindowsAppdataDir(): string | null;
7
8
  export declare const USER_CONFIG_DIR: string;
8
9
  export declare const USER_OPENCODE_CONFIG: string;
9
10
  export declare const USER_OPENCODE_CONFIG_JSONC: string;
10
11
  export declare const INSTALLED_PACKAGE_JSON: string;
12
+ export declare const HOST_INSTALLED_PACKAGE_JSON: string;