chatroom-cli 1.91.3 → 1.91.5
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 +45 -15
- 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, 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,34 +29902,64 @@ 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 resolveNativeCodexBinary(vendorRoot, targetTriple, codexBinaryName) {
|
|
29913
|
+
const packageRoot = join8(vendorRoot, targetTriple);
|
|
29914
|
+
const packageBinaryPath = join8(packageRoot, "bin", codexBinaryName);
|
|
29915
|
+
if (isRegularFile(packageBinaryPath) && isRegularFile(join8(packageRoot, "codex-package.json"))) {
|
|
29916
|
+
return packageBinaryPath;
|
|
29917
|
+
}
|
|
29918
|
+
const legacyBinaryPath = join8(packageRoot, "codex", codexBinaryName);
|
|
29919
|
+
if (isRegularFile(legacyBinaryPath)) {
|
|
29920
|
+
return legacyBinaryPath;
|
|
29921
|
+
}
|
|
29922
|
+
return;
|
|
29923
|
+
}
|
|
29905
29924
|
function resolveCodexExecutablePath(moduleRef = import.meta.url) {
|
|
29906
29925
|
if (cachedExecutablePath2)
|
|
29907
29926
|
return cachedExecutablePath2;
|
|
29908
29927
|
const chatroomCliRoot = resolveChatroomCliRoot2(moduleRef);
|
|
29909
29928
|
const require3 = createRequire4(join8(chatroomCliRoot, "package.json"));
|
|
29929
|
+
let codexPackageJson;
|
|
29910
29930
|
try {
|
|
29911
|
-
require3.resolve(`${CODEX_NPM_NAME}/package.json`, {
|
|
29931
|
+
codexPackageJson = require3.resolve(`${CODEX_NPM_NAME}/package.json`, {
|
|
29932
|
+
paths: [chatroomCliRoot]
|
|
29933
|
+
});
|
|
29912
29934
|
} catch {
|
|
29913
29935
|
throw new CodexSdkPackageError(`${CODEX_NPM_NAME} is not installed. Ensure chatroom-cli was installed with optional dependencies. ${REINSTALL_HINT2}`);
|
|
29914
29936
|
}
|
|
29915
29937
|
const targetTriple = resolveTargetTriple();
|
|
29916
29938
|
const platformPkg = resolvePlatformPackageName2(targetTriple);
|
|
29917
29939
|
const codexBinaryName = process.platform === "win32" ? "codex.exe" : "codex";
|
|
29918
|
-
|
|
29940
|
+
const codexRequire = createRequire4(codexPackageJson);
|
|
29941
|
+
const platformPackageJsonCandidates = [];
|
|
29919
29942
|
try {
|
|
29920
|
-
|
|
29921
|
-
} catch {
|
|
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 {}
|
|
29953
|
+
if (platformPackageJsonCandidates.length === 0) {
|
|
29922
29954
|
throw new CodexSdkPackageError(`Native Codex CLI package ${platformPkg} is not installed. Ensure ${CODEX_NPM_NAME} is installed with optional dependencies. ${REINSTALL_HINT2}`);
|
|
29923
29955
|
}
|
|
29924
|
-
|
|
29925
|
-
|
|
29926
|
-
|
|
29927
|
-
|
|
29928
|
-
|
|
29929
|
-
|
|
29930
|
-
|
|
29931
|
-
cachedExecutablePath2 = legacyBinaryPath;
|
|
29932
|
-
return cachedExecutablePath2;
|
|
29956
|
+
for (const platformPackageJson of platformPackageJsonCandidates) {
|
|
29957
|
+
const vendorRoot = join8(dirname3(platformPackageJson), "vendor");
|
|
29958
|
+
const binaryPath = resolveNativeCodexBinary(vendorRoot, targetTriple, codexBinaryName);
|
|
29959
|
+
if (binaryPath) {
|
|
29960
|
+
cachedExecutablePath2 = binaryPath;
|
|
29961
|
+
return cachedExecutablePath2;
|
|
29962
|
+
}
|
|
29933
29963
|
}
|
|
29934
29964
|
throw new CodexSdkPackageError(`Unable to locate Codex CLI binaries for ${targetTriple}. Ensure ${CODEX_NPM_NAME} is installed with optional dependencies. ${REINSTALL_HINT2}`);
|
|
29935
29965
|
}
|
|
@@ -117793,4 +117823,4 @@ program2.hook("preAction", async (_thisCommand, actionCommand) => {
|
|
|
117793
117823
|
});
|
|
117794
117824
|
program2.parse();
|
|
117795
117825
|
|
|
117796
|
-
//# debugId=
|
|
117826
|
+
//# debugId=FF821111964F2C9464756E2164756E21
|