@mmmbuto/codex-vl 0.138.0-alpha.6 → 0.138.0-alpha.7
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/codex.js +41 -20
- package/package.json +1 -1
package/bin/codex.js
CHANGED
|
@@ -78,29 +78,50 @@ if (!platformPackage) {
|
|
|
78
78
|
throw new Error(`Unsupported target triple: ${targetTriple}`);
|
|
79
79
|
}
|
|
80
80
|
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
81
|
+
// Fork-owned native package resolution (restored verbatim from 0.137.0):
|
|
82
|
+
// resolves both the upstream vendor/<triple>/bin and the fork CI
|
|
83
|
+
// vendor/<triple>/codex payload layouts AND returns the PATH shim dir
|
|
84
|
+
// (`pathDir`) consumed below — the 0.138 merge had replaced this block
|
|
85
|
+
// with upstream's simpler resolver, orphaning `pathDir`.
|
|
86
|
+
const codexBinaryName = process.platform === "win32" ? "codex.exe" : "codex";
|
|
87
|
+
const localVendorRoot = path.join(__dirname, "..", "vendor");
|
|
88
|
+
const packageBinaryPath = (vendorRoot) =>
|
|
89
|
+
path.join(vendorRoot, targetTriple, "bin", codexBinaryName);
|
|
90
|
+
const legacyBinaryPath = (vendorRoot) =>
|
|
91
|
+
path.join(vendorRoot, targetTriple, "codex", codexBinaryName);
|
|
92
|
+
|
|
93
|
+
function resolveNativePackage(vendorRoot) {
|
|
94
|
+
const packageRoot = path.join(vendorRoot, targetTriple);
|
|
95
|
+
const binaryPath = packageBinaryPath(vendorRoot);
|
|
96
|
+
if (existsSync(binaryPath)) {
|
|
97
|
+
return {
|
|
98
|
+
binaryPath,
|
|
99
|
+
pathDir: path.join(packageRoot, "codex-path"),
|
|
100
|
+
};
|
|
88
101
|
}
|
|
89
102
|
|
|
90
|
-
const
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
path.join(vendorRoot, targetTriple, "codex", exeName),
|
|
97
|
-
];
|
|
98
|
-
for (const codexExecutable of candidates) {
|
|
99
|
-
if (existsSync(codexExecutable)) {
|
|
100
|
-
return codexExecutable;
|
|
101
|
-
}
|
|
103
|
+
const legacyPath = legacyBinaryPath(vendorRoot);
|
|
104
|
+
if (existsSync(legacyPath)) {
|
|
105
|
+
return {
|
|
106
|
+
binaryPath: legacyPath,
|
|
107
|
+
pathDir: path.join(packageRoot, "path"),
|
|
108
|
+
};
|
|
102
109
|
}
|
|
103
110
|
|
|
111
|
+
return null;
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
let nativePackage;
|
|
115
|
+
try {
|
|
116
|
+
const packageJsonPath = require.resolve(`${platformPackage}/package.json`);
|
|
117
|
+
nativePackage = resolveNativePackage(
|
|
118
|
+
path.join(path.dirname(packageJsonPath), "vendor"),
|
|
119
|
+
);
|
|
120
|
+
} catch {
|
|
121
|
+
nativePackage = resolveNativePackage(localVendorRoot);
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
if (!nativePackage) {
|
|
104
125
|
const packageManager = detectPackageManager();
|
|
105
126
|
const updateCommand =
|
|
106
127
|
packageManager === "bun"
|
|
@@ -111,7 +132,7 @@ function findCodexExecutable() {
|
|
|
111
132
|
);
|
|
112
133
|
}
|
|
113
134
|
|
|
114
|
-
const binaryPath =
|
|
135
|
+
const { binaryPath, pathDir } = nativePackage;
|
|
115
136
|
|
|
116
137
|
// Use an asynchronous spawn instead of spawnSync so that Node is able to
|
|
117
138
|
// respond to signals (e.g. Ctrl-C / SIGINT) while the native binary is
|