@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.
Files changed (2) hide show
  1. package/bin/codex.js +41 -20
  2. 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
- function findCodexExecutable() {
82
- let vendorRoot;
83
- try {
84
- const packageJsonPath = require.resolve(`${platformPackage}/package.json`);
85
- vendorRoot = path.join(path.dirname(packageJsonPath), "vendor");
86
- } catch {
87
- vendorRoot = path.join(__dirname, "..", "vendor");
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 exeName = process.platform === "win32" ? "codex.exe" : "codex";
91
- // Upstream 0.138 launcher expects vendor/<triple>/bin/<exe>; the fork CI
92
- // payloads ship vendor/<triple>/codex/<exe> (pre-0.138 layout). Accept
93
- // both so a launcher/payload layout drift can never brick the install.
94
- const candidates = [
95
- path.join(vendorRoot, targetTriple, "bin", exeName),
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 = findCodexExecutable();
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
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mmmbuto/codex-vl",
3
- "version": "0.138.0-alpha.6",
3
+ "version": "0.138.0-alpha.7",
4
4
  "license": "Apache-2.0",
5
5
  "bin": {
6
6
  "codex-vl": "bin/codex.js",