chatroom-cli 1.91.5 → 1.91.6

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/index.js CHANGED
@@ -29834,7 +29834,7 @@ var init_model_variant = __esm(() => {
29834
29834
  });
29835
29835
 
29836
29836
  // src/daemon/infrastructure/local/harness/services/codex-sdk/codex-sdk-package.ts
29837
- import { existsSync as existsSync2, readFileSync as readFileSync4, statSync } from "node:fs";
29837
+ import { existsSync as existsSync2, readFileSync as readFileSync4, realpathSync, statSync } from "node:fs";
29838
29838
  import { createRequire as createRequire4 } from "node:module";
29839
29839
  import { dirname as dirname3, join as join8 } from "node:path";
29840
29840
  import { fileURLToPath as fileURLToPath3, pathToFileURL as pathToFileURL2 } from "node:url";
@@ -29909,6 +29909,25 @@ function isRegularFile(filePath) {
29909
29909
  return false;
29910
29910
  }
29911
29911
  }
29912
+ function addPlatformPackageJsonCandidate(candidates, candidate) {
29913
+ if (candidate && existsSync2(candidate) && !candidates.includes(candidate)) {
29914
+ candidates.push(candidate);
29915
+ }
29916
+ }
29917
+ function resolvePlatformPackageJsonCandidates(platformPkg, chatroomCliRoot, codexPackageJson, chatroomRequire, codexRequire) {
29918
+ const candidates = [];
29919
+ const codexPackageDir = realpathSync(dirname3(codexPackageJson));
29920
+ const platformPkgBaseName = platformPkg.includes("/") ? platformPkg.slice(platformPkg.indexOf("/") + 1) : platformPkg;
29921
+ try {
29922
+ addPlatformPackageJsonCandidate(candidates, codexRequire.resolve(`${platformPkg}/package.json`));
29923
+ } catch {}
29924
+ try {
29925
+ addPlatformPackageJsonCandidate(candidates, chatroomRequire.resolve(`${platformPkg}/package.json`, { paths: [chatroomCliRoot] }));
29926
+ } catch {}
29927
+ addPlatformPackageJsonCandidate(candidates, join8(codexPackageDir, "..", platformPkgBaseName, "package.json"));
29928
+ addPlatformPackageJsonCandidate(candidates, join8(codexPackageDir, "node_modules", platformPkg, "package.json"));
29929
+ return candidates;
29930
+ }
29912
29931
  function resolveNativeCodexBinary(vendorRoot, targetTriple, codexBinaryName) {
29913
29932
  const packageRoot = join8(vendorRoot, targetTriple);
29914
29933
  const packageBinaryPath = join8(packageRoot, "bin", codexBinaryName);
@@ -29922,8 +29941,6 @@ function resolveNativeCodexBinary(vendorRoot, targetTriple, codexBinaryName) {
29922
29941
  return;
29923
29942
  }
29924
29943
  function resolveCodexExecutablePath(moduleRef = import.meta.url) {
29925
- if (cachedExecutablePath2)
29926
- return cachedExecutablePath2;
29927
29944
  const chatroomCliRoot = resolveChatroomCliRoot2(moduleRef);
29928
29945
  const require3 = createRequire4(join8(chatroomCliRoot, "package.json"));
29929
29946
  let codexPackageJson;
@@ -29938,18 +29955,7 @@ function resolveCodexExecutablePath(moduleRef = import.meta.url) {
29938
29955
  const platformPkg = resolvePlatformPackageName2(targetTriple);
29939
29956
  const codexBinaryName = process.platform === "win32" ? "codex.exe" : "codex";
29940
29957
  const codexRequire = createRequire4(codexPackageJson);
29941
- const platformPackageJsonCandidates = [];
29942
- try {
29943
- platformPackageJsonCandidates.push(codexRequire.resolve(`${platformPkg}/package.json`));
29944
- } catch {}
29945
- try {
29946
- const fromCliRoot = require3.resolve(`${platformPkg}/package.json`, {
29947
- paths: [chatroomCliRoot]
29948
- });
29949
- if (!platformPackageJsonCandidates.includes(fromCliRoot)) {
29950
- platformPackageJsonCandidates.push(fromCliRoot);
29951
- }
29952
- } catch {}
29958
+ const platformPackageJsonCandidates = resolvePlatformPackageJsonCandidates(platformPkg, chatroomCliRoot, codexPackageJson, require3, codexRequire);
29953
29959
  if (platformPackageJsonCandidates.length === 0) {
29954
29960
  throw new CodexSdkPackageError(`Native Codex CLI package ${platformPkg} is not installed. Ensure ${CODEX_NPM_NAME} is installed with optional dependencies. ${REINSTALL_HINT2}`);
29955
29961
  }
@@ -29957,8 +29963,7 @@ function resolveCodexExecutablePath(moduleRef = import.meta.url) {
29957
29963
  const vendorRoot = join8(dirname3(platformPackageJson), "vendor");
29958
29964
  const binaryPath = resolveNativeCodexBinary(vendorRoot, targetTriple, codexBinaryName);
29959
29965
  if (binaryPath) {
29960
- cachedExecutablePath2 = binaryPath;
29961
- return cachedExecutablePath2;
29966
+ return binaryPath;
29962
29967
  }
29963
29968
  }
29964
29969
  throw new CodexSdkPackageError(`Unable to locate Codex CLI binaries for ${targetTriple}. Ensure ${CODEX_NPM_NAME} is installed with optional dependencies. ${REINSTALL_HINT2}`);
@@ -30004,7 +30009,7 @@ function formatCodexSdkLoadError(err) {
30004
30009
  }
30005
30010
  return formatCodexSdkError(err);
30006
30011
  }
30007
- var REINSTALL_HINT2 = "Reinstall chatroom-cli: npm install -g chatroom-cli@latest", CODEX_NPM_NAME = "@openai/codex", PLATFORM_PACKAGE_BY_TARGET, CodexSdkPackageError, cachedExecutablePath2;
30012
+ var REINSTALL_HINT2 = "Reinstall chatroom-cli: npm install -g chatroom-cli@latest", CODEX_NPM_NAME = "@openai/codex", PLATFORM_PACKAGE_BY_TARGET, CodexSdkPackageError;
30008
30013
  var init_codex_sdk_package = __esm(() => {
30009
30014
  PLATFORM_PACKAGE_BY_TARGET = {
30010
30015
  "x86_64-unknown-linux-musl": "@openai/codex-linux-x64",
@@ -117823,4 +117828,4 @@ program2.hook("preAction", async (_thisCommand, actionCommand) => {
117823
117828
  });
117824
117829
  program2.parse();
117825
117830
 
117826
- //# debugId=FF821111964F2C9464756E2164756E21
117831
+ //# debugId=BFC81C63628747E364756E2164756E21