@openai/codex 0.1.2505191453 → 0.2.0

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.
Binary file
Binary file
Binary file
Binary file
Binary file
package/bin/codex.js CHANGED
@@ -16,14 +16,23 @@
16
16
  */
17
17
 
18
18
  import { spawnSync } from "child_process";
19
+ import fs from "fs";
19
20
  import path from "path";
20
21
  import { fileURLToPath, pathToFileURL } from "url";
21
22
 
22
23
  // Determine whether the user explicitly wants the Rust CLI.
23
- const wantsNative =
24
- process.env.CODEX_RUST != null
24
+
25
+ // __dirname equivalent in ESM
26
+ const __filename = fileURLToPath(import.meta.url);
27
+ const __dirname = path.dirname(__filename);
28
+
29
+ // For the @native release of the Node module, the `use-native` file is added,
30
+ // indicating we should default to the native binary. For other releases,
31
+ // setting CODEX_RUST=1 will opt-in to the native binary, if included.
32
+ const wantsNative = fs.existsSync(path.join(__dirname, "use-native")) ||
33
+ (process.env.CODEX_RUST != null
25
34
  ? ["1", "true", "yes"].includes(process.env.CODEX_RUST.toLowerCase())
26
- : false;
35
+ : false);
27
36
 
28
37
  // Try native binary if requested.
29
38
  if (wantsNative) {
@@ -37,7 +46,7 @@ if (wantsNative) {
37
46
  targetTriple = "x86_64-unknown-linux-musl";
38
47
  break;
39
48
  case "arm64":
40
- targetTriple = "aarch64-unknown-linux-gnu";
49
+ targetTriple = "aarch64-unknown-linux-musl";
41
50
  break;
42
51
  default:
43
52
  break;
@@ -63,10 +72,6 @@ if (wantsNative) {
63
72
  throw new Error(`Unsupported platform: ${platform} (${arch})`);
64
73
  }
65
74
 
66
- // __dirname equivalent in ESM
67
- const __filename = fileURLToPath(import.meta.url);
68
- const __dirname = path.dirname(__filename);
69
-
70
75
  const binaryPath = path.join(__dirname, "..", "bin", `codex-${targetTriple}`);
71
76
  const result = spawnSync(binaryPath, process.argv.slice(2), {
72
77
  stdio: "inherit",
@@ -78,10 +83,6 @@ if (wantsNative) {
78
83
 
79
84
  // Fallback: execute the original JavaScript CLI.
80
85
 
81
- // Determine this script's directory
82
- const __filename = fileURLToPath(import.meta.url);
83
- const __dirname = path.dirname(__filename);
84
-
85
86
  // Resolve the path to the compiled CLI bundle
86
87
  const cliPath = path.resolve(__dirname, "../dist/cli.js");
87
88
  const cliUrl = pathToFileURL(cliPath).href;
package/bin/use-native ADDED
File without changes