@nuwax-ai/nuwax-harness 0.18.60 → 0.18.63
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/bin/runtime.js +31 -2
- package/package.json +1 -1
package/bin/runtime.js
CHANGED
|
@@ -12,14 +12,43 @@ const require = createRequire(import.meta.url);
|
|
|
12
12
|
const VERSION = require("../package.json").version;
|
|
13
13
|
const OSS_CDN_BASE = "https://nuwa-packages.oss-rg-china-mainland.aliyuncs.com/nuwax-codex";
|
|
14
14
|
|
|
15
|
-
|
|
15
|
+
// Fork (nuwax-codex): Linux now defaults to the musl build on every libc.
|
|
16
|
+
//
|
|
17
|
+
// The musl build is statically linked, so it starts on any distribution no
|
|
18
|
+
// matter which glibc the kernel host ships. The gnu build links the *build
|
|
19
|
+
// host's* glibc — 2.39 on the current CI runners (Ubuntu 24.04) — and refuses
|
|
20
|
+
// to start on Ubuntu 22.04 (2.35) or Debian 12 (2.36) with
|
|
21
|
+
// `GLIBC_2.39 not found`. Upstream codex ships only the musl variant for Linux
|
|
22
|
+
// for the same reason, and our ACP adapter / Electron client already resolve
|
|
23
|
+
// musl first (`resolveCodexBinary.ts`, `binaryLocator.ts`); the npm CLI was the
|
|
24
|
+
// last path still preferring gnu.
|
|
25
|
+
//
|
|
26
|
+
// `NUWAX_LIBC=gnu` opts back into the gnu build for hosts that need glibc's NSS
|
|
27
|
+
// (Active Directory / LDAP / sssd name and user resolution), which musl does
|
|
28
|
+
// not implement. Forcing gnu on a musl host is refused: that binary cannot run
|
|
29
|
+
// there.
|
|
30
|
+
function forcedLibcPreference(value) {
|
|
31
|
+
if (value === undefined || value === null || String(value).trim() === "") return undefined;
|
|
32
|
+
const normalized = String(value).trim().toLowerCase();
|
|
33
|
+
if (normalized === "gnu" || normalized === "glibc") return "gnu";
|
|
34
|
+
if (normalized === "musl") return "musl";
|
|
35
|
+
throw new Error(`Invalid NUWAX_LIBC="${value}"; expected "musl" or "gnu".`);
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
export function getTargetTriple(platform = process.platform, arch = process.arch, libc = familySync(), forcedLibc = process.env.NUWAX_LIBC) {
|
|
16
39
|
if (platform === "darwin") {
|
|
17
40
|
if (arch === "arm64") return "aarch64-apple-darwin";
|
|
18
41
|
if (arch === "x64") return "x86_64-apple-darwin";
|
|
19
42
|
} else if (platform === "linux") {
|
|
20
43
|
if (arch === "arm64") return "aarch64-unknown-linux-musl";
|
|
21
44
|
if (arch === "x64") {
|
|
22
|
-
|
|
45
|
+
if (forcedLibcPreference(forcedLibc) === "gnu") {
|
|
46
|
+
if (libc === "musl") {
|
|
47
|
+
throw new Error("NUWAX_LIBC=gnu cannot be used on a musl host: the gnu build needs glibc");
|
|
48
|
+
}
|
|
49
|
+
return "x86_64-unknown-linux-gnu";
|
|
50
|
+
}
|
|
51
|
+
return "x86_64-unknown-linux-musl";
|
|
23
52
|
}
|
|
24
53
|
} else if (platform === "win32") {
|
|
25
54
|
if (arch === "arm64") return "aarch64-pc-windows-msvc";
|