@mmmbuto/codex-vl 0.138.0-alpha.5 → 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 -16
  2. package/package.json +1 -1
package/bin/codex.js CHANGED
@@ -78,25 +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 codexExecutable = path.join(
91
- vendorRoot,
92
- targetTriple,
93
- "bin",
94
- process.platform === "win32" ? "codex.exe" : "codex",
95
- );
96
- if (existsSync(codexExecutable)) {
97
- return codexExecutable;
103
+ const legacyPath = legacyBinaryPath(vendorRoot);
104
+ if (existsSync(legacyPath)) {
105
+ return {
106
+ binaryPath: legacyPath,
107
+ pathDir: path.join(packageRoot, "path"),
108
+ };
98
109
  }
99
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) {
100
125
  const packageManager = detectPackageManager();
101
126
  const updateCommand =
102
127
  packageManager === "bun"
@@ -107,7 +132,7 @@ function findCodexExecutable() {
107
132
  );
108
133
  }
109
134
 
110
- const binaryPath = findCodexExecutable();
135
+ const { binaryPath, pathDir } = nativePackage;
111
136
 
112
137
  // Use an asynchronous spawn instead of spawnSync so that Node is able to
113
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.5",
3
+ "version": "0.138.0-alpha.7",
4
4
  "license": "Apache-2.0",
5
5
  "bin": {
6
6
  "codex-vl": "bin/codex.js",