chatroom-cli 1.91.4 → 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 +54 -30
- package/dist/index.js.map +3 -3
- package/package.json +1 -1
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 } 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";
|
|
@@ -29902,45 +29902,69 @@ function resolvePlatformPackageName2(targetTriple) {
|
|
|
29902
29902
|
}
|
|
29903
29903
|
return pkg;
|
|
29904
29904
|
}
|
|
29905
|
+
function isRegularFile(filePath) {
|
|
29906
|
+
try {
|
|
29907
|
+
return statSync(filePath).isFile();
|
|
29908
|
+
} catch {
|
|
29909
|
+
return false;
|
|
29910
|
+
}
|
|
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
|
+
}
|
|
29931
|
+
function resolveNativeCodexBinary(vendorRoot, targetTriple, codexBinaryName) {
|
|
29932
|
+
const packageRoot = join8(vendorRoot, targetTriple);
|
|
29933
|
+
const packageBinaryPath = join8(packageRoot, "bin", codexBinaryName);
|
|
29934
|
+
if (isRegularFile(packageBinaryPath) && isRegularFile(join8(packageRoot, "codex-package.json"))) {
|
|
29935
|
+
return packageBinaryPath;
|
|
29936
|
+
}
|
|
29937
|
+
const legacyBinaryPath = join8(packageRoot, "codex", codexBinaryName);
|
|
29938
|
+
if (isRegularFile(legacyBinaryPath)) {
|
|
29939
|
+
return legacyBinaryPath;
|
|
29940
|
+
}
|
|
29941
|
+
return;
|
|
29942
|
+
}
|
|
29905
29943
|
function resolveCodexExecutablePath(moduleRef = import.meta.url) {
|
|
29906
|
-
if (cachedExecutablePath2)
|
|
29907
|
-
return cachedExecutablePath2;
|
|
29908
29944
|
const chatroomCliRoot = resolveChatroomCliRoot2(moduleRef);
|
|
29909
29945
|
const require3 = createRequire4(join8(chatroomCliRoot, "package.json"));
|
|
29910
|
-
let
|
|
29946
|
+
let codexPackageJson;
|
|
29911
29947
|
try {
|
|
29912
|
-
|
|
29948
|
+
codexPackageJson = require3.resolve(`${CODEX_NPM_NAME}/package.json`, {
|
|
29949
|
+
paths: [chatroomCliRoot]
|
|
29950
|
+
});
|
|
29913
29951
|
} catch {
|
|
29914
29952
|
throw new CodexSdkPackageError(`${CODEX_NPM_NAME} is not installed. Ensure chatroom-cli was installed with optional dependencies. ${REINSTALL_HINT2}`);
|
|
29915
29953
|
}
|
|
29916
29954
|
const targetTriple = resolveTargetTriple();
|
|
29917
29955
|
const platformPkg = resolvePlatformPackageName2(targetTriple);
|
|
29918
29956
|
const codexBinaryName = process.platform === "win32" ? "codex.exe" : "codex";
|
|
29919
|
-
|
|
29920
|
-
|
|
29921
|
-
|
|
29922
|
-
try {
|
|
29923
|
-
return require3.resolve(`${platformPkg}/package.json`, { paths: [resolveFrom] });
|
|
29924
|
-
} catch {
|
|
29925
|
-
return;
|
|
29926
|
-
}
|
|
29927
|
-
}).find((resolved) => resolved !== undefined);
|
|
29928
|
-
if (!platformPackageJson) {
|
|
29929
|
-
throw new Error(`Unable to resolve ${platformPkg}`);
|
|
29930
|
-
}
|
|
29931
|
-
platformPkgDir = dirname3(platformPackageJson);
|
|
29932
|
-
} catch {
|
|
29957
|
+
const codexRequire = createRequire4(codexPackageJson);
|
|
29958
|
+
const platformPackageJsonCandidates = resolvePlatformPackageJsonCandidates(platformPkg, chatroomCliRoot, codexPackageJson, require3, codexRequire);
|
|
29959
|
+
if (platformPackageJsonCandidates.length === 0) {
|
|
29933
29960
|
throw new CodexSdkPackageError(`Native Codex CLI package ${platformPkg} is not installed. Ensure ${CODEX_NPM_NAME} is installed with optional dependencies. ${REINSTALL_HINT2}`);
|
|
29934
29961
|
}
|
|
29935
|
-
|
|
29936
|
-
|
|
29937
|
-
|
|
29938
|
-
|
|
29939
|
-
|
|
29940
|
-
|
|
29941
|
-
if (existsSync2(legacyBinaryPath)) {
|
|
29942
|
-
cachedExecutablePath2 = legacyBinaryPath;
|
|
29943
|
-
return cachedExecutablePath2;
|
|
29962
|
+
for (const platformPackageJson of platformPackageJsonCandidates) {
|
|
29963
|
+
const vendorRoot = join8(dirname3(platformPackageJson), "vendor");
|
|
29964
|
+
const binaryPath = resolveNativeCodexBinary(vendorRoot, targetTriple, codexBinaryName);
|
|
29965
|
+
if (binaryPath) {
|
|
29966
|
+
return binaryPath;
|
|
29967
|
+
}
|
|
29944
29968
|
}
|
|
29945
29969
|
throw new CodexSdkPackageError(`Unable to locate Codex CLI binaries for ${targetTriple}. Ensure ${CODEX_NPM_NAME} is installed with optional dependencies. ${REINSTALL_HINT2}`);
|
|
29946
29970
|
}
|
|
@@ -29985,7 +30009,7 @@ function formatCodexSdkLoadError(err) {
|
|
|
29985
30009
|
}
|
|
29986
30010
|
return formatCodexSdkError(err);
|
|
29987
30011
|
}
|
|
29988
|
-
var REINSTALL_HINT2 = "Reinstall chatroom-cli: npm install -g chatroom-cli@latest", CODEX_NPM_NAME = "@openai/codex", PLATFORM_PACKAGE_BY_TARGET, CodexSdkPackageError
|
|
30012
|
+
var REINSTALL_HINT2 = "Reinstall chatroom-cli: npm install -g chatroom-cli@latest", CODEX_NPM_NAME = "@openai/codex", PLATFORM_PACKAGE_BY_TARGET, CodexSdkPackageError;
|
|
29989
30013
|
var init_codex_sdk_package = __esm(() => {
|
|
29990
30014
|
PLATFORM_PACKAGE_BY_TARGET = {
|
|
29991
30015
|
"x86_64-unknown-linux-musl": "@openai/codex-linux-x64",
|
|
@@ -117804,4 +117828,4 @@ program2.hook("preAction", async (_thisCommand, actionCommand) => {
|
|
|
117804
117828
|
});
|
|
117805
117829
|
program2.parse();
|
|
117806
117830
|
|
|
117807
|
-
//# debugId=
|
|
117831
|
+
//# debugId=BFC81C63628747E364756E2164756E21
|