@openai/codex 0.21.0 → 0.23.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.
package/README.md CHANGED
@@ -22,6 +22,7 @@
22
22
  - [Authenticate locally and copy your credentials to the "headless" machine](#authenticate-locally-and-copy-your-credentials-to-the-headless-machine)
23
23
  - [Connecting through VPS or remote](#connecting-through-vps-or-remote)
24
24
  - [Usage-based billing alternative: Use an OpenAI API key](#usage-based-billing-alternative-use-an-openai-api-key)
25
+ - [Forcing a specific auth method (advanced)](#forcing-a-specific-auth-method-advanced)
25
26
  - [Choosing Codex's level of autonomy](#choosing-codexs-level-of-autonomy)
26
27
  - [**1. Read/write**](#1-readwrite)
27
28
  - [**2. Read-only**](#2-read-only)
@@ -165,6 +166,35 @@ Notes:
165
166
  - This command only sets the key for your current terminal session, which we recommend. To set it for all future sessions, you can also add the `export` line to your shell's configuration file (e.g., `~/.zshrc`).
166
167
  - If you have signed in with ChatGPT, Codex will default to using your ChatGPT credits. If you wish to use your API key, use the `/logout` command to clear your ChatGPT authentication.
167
168
 
169
+ #### Forcing a specific auth method (advanced)
170
+
171
+ You can explicitly choose which authentication Codex should prefer when both are available.
172
+
173
+ - To always use your API key (even when ChatGPT auth exists), set:
174
+
175
+ ```toml
176
+ # ~/.codex/config.toml
177
+ preferred_auth_method = "apikey"
178
+ ```
179
+
180
+ Or override ad-hoc via CLI:
181
+
182
+ ```bash
183
+ codex --config preferred_auth_method="apikey"
184
+ ```
185
+
186
+ - To prefer ChatGPT auth (default), set:
187
+
188
+ ```toml
189
+ # ~/.codex/config.toml
190
+ preferred_auth_method = "chatgpt"
191
+ ```
192
+
193
+ Notes:
194
+
195
+ - When `preferred_auth_method = "apikey"` and an API key is available, the login screen is skipped.
196
+ - When `preferred_auth_method = "chatgpt"` (default), Codex prefers ChatGPT auth if present; if only an API key is present, it will use the API key. Certain account types may also require API-key mode.
197
+
168
198
  ### Choosing Codex's level of autonomy
169
199
 
170
200
  We always recommend running Codex in its default sandbox that gives you strong guardrails around what the agent can do. The default sandbox prevents it from editing files outside its workspace, or from accessing the network.
@@ -566,9 +596,13 @@ We're excited to launch a **$1 million initiative** supporting open source proje
566
596
 
567
597
  ## Contributing
568
598
 
569
- This project is under active development and the code will likely change pretty significantly. We'll update this message once that's complete!
599
+ This project is under active development and the code will likely change pretty significantly.
600
+
601
+ **At the moment, we only plan to prioritize reviewing external contributions for bugs or security fixes.**
602
+
603
+ If you want to add a new feature or change the behavior of an existing one, please open an issue proposing the feature and get approval from an OpenAI team member before spending time building it.
570
604
 
571
- More broadly we welcome contributions - whether you are opening your very first pull request or you're a seasoned maintainer. At the same time we care about reliability and long-term maintainability, so the bar for merging code is intentionally **high**. The guidelines below spell out what "high-quality" means in practice and should make the whole process transparent and friendly.
605
+ **New contributions that don't go through this process may be closed** if they aren't aligned with our current roadmap or conflict with other priorities/upcoming features.
572
606
 
573
607
  ### Development workflow
574
608
 
@@ -593,8 +627,9 @@ More broadly we welcome contributions - whether you are opening your very first
593
627
  ### Review process
594
628
 
595
629
  1. One maintainer will be assigned as a primary reviewer.
596
- 2. We may ask for changes - please do not take this personally. We value the work, we just also value consistency and long-term maintainability.
597
- 3. When there is consensus that the PR meets the bar, a maintainer will squash-and-merge.
630
+ 2. If your PR adds a new feature that was not previously discussed and approved, we may choose to close your PR (see [Contributing](#contributing)).
631
+ 3. We may ask for changes - please do not take this personally. We value the work, but we also value consistency and long-term maintainability.
632
+ 5. When there is consensus that the PR meets the bar, a maintainer will squash-and-merge.
598
633
 
599
634
  ### Community values
600
635
 
Binary file
Binary file
Binary file
package/bin/codex.js CHANGED
@@ -43,7 +43,7 @@ switch (platform) {
43
43
  targetTriple = "x86_64-pc-windows-msvc.exe";
44
44
  break;
45
45
  case "arm64":
46
- // We do not build this today, fall through...
46
+ // We do not build this today, fall through...
47
47
  default:
48
48
  break;
49
49
  }
@@ -65,9 +65,43 @@ const binaryPath = path.join(__dirname, "..", "bin", `codex-${targetTriple}`);
65
65
  // receives a fatal signal, both processes exit in a predictable manner.
66
66
  const { spawn } = await import("child_process");
67
67
 
68
+ async function tryImport(moduleName) {
69
+ try {
70
+ // eslint-disable-next-line node/no-unsupported-features/es-syntax
71
+ return await import(moduleName);
72
+ } catch (err) {
73
+ return null;
74
+ }
75
+ }
76
+
77
+ async function resolveRgDir() {
78
+ const ripgrep = await tryImport("@vscode/ripgrep");
79
+ if (!ripgrep?.rgPath) {
80
+ return null;
81
+ }
82
+ return path.dirname(ripgrep.rgPath);
83
+ }
84
+
85
+ function getUpdatedPath(newDirs) {
86
+ const pathSep = process.platform === "win32" ? ";" : ":";
87
+ const existingPath = process.env.PATH || "";
88
+ const updatedPath = [
89
+ ...newDirs,
90
+ ...existingPath.split(pathSep).filter(Boolean),
91
+ ].join(pathSep);
92
+ return updatedPath;
93
+ }
94
+
95
+ const additionalDirs = [];
96
+ const rgDir = await resolveRgDir();
97
+ if (rgDir) {
98
+ additionalDirs.push(rgDir);
99
+ }
100
+ const updatedPath = getUpdatedPath(additionalDirs);
101
+
68
102
  const child = spawn(binaryPath, process.argv.slice(2), {
69
103
  stdio: "inherit",
70
- env: { ...process.env, CODEX_MANAGED_BY_NPM: "1" },
104
+ env: { ...process.env, PATH: updatedPath, CODEX_MANAGED_BY_NPM: "1" },
71
105
  });
72
106
 
73
107
  child.on("error", (err) => {
@@ -120,4 +154,3 @@ if (childResult.type === "signal") {
120
154
  } else {
121
155
  process.exit(childResult.exitCode);
122
156
  }
123
-
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@openai/codex",
3
- "version": "0.21.0",
3
+ "version": "0.23.0",
4
4
  "license": "Apache-2.0",
5
5
  "bin": {
6
6
  "codex": "bin/codex.js"
@@ -16,5 +16,11 @@
16
16
  "repository": {
17
17
  "type": "git",
18
18
  "url": "git+https://github.com/openai/codex.git"
19
+ },
20
+ "dependencies": {
21
+ "@vscode/ripgrep": "^1.15.14"
22
+ },
23
+ "devDependencies": {
24
+ "prettier": "^3.3.3"
19
25
  }
20
26
  }