@openai/codex 0.11.0 → 0.13.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
@@ -18,6 +18,7 @@ This is the home of the **Codex CLI**, which is a coding agent from OpenAI that
18
18
  - [Quickstart](#quickstart)
19
19
  - [OpenAI API Users](#openai-api-users)
20
20
  - [OpenAI Plus/Pro Users](#openai-pluspro-users)
21
+ - [Using Open Source Models](#using-open-source-models)
21
22
  - [Why Codex?](#why-codex)
22
23
  - [Security model & permissions](#security-model--permissions)
23
24
  - [Platform sandboxing details](#platform-sandboxing-details)
@@ -186,6 +187,41 @@ they'll be committed to your working directory.
186
187
 
187
188
  ---
188
189
 
190
+ ## Using Open Source Models
191
+
192
+ Codex can run fully locally against an OpenAI-compatible OSS host (like Ollama) using the `--oss` flag:
193
+
194
+ - Interactive UI:
195
+ - codex --oss
196
+ - Non-interactive (programmatic) mode:
197
+ - echo "Refactor utils" | codex exec --oss
198
+
199
+ Model selection when using `--oss`:
200
+
201
+ - If you omit `-m/--model`, Codex defaults to -m gpt-oss:20b and will verify it exists locally (downloading if needed).
202
+ - To pick a different size, pass one of:
203
+ - -m "gpt-oss:20b"
204
+ - -m "gpt-oss:120b"
205
+
206
+ Point Codex at your own OSS host:
207
+
208
+ - By default, `--oss` talks to http://localhost:11434/v1.
209
+ - To use a different host, set one of these environment variables before running Codex:
210
+ - CODEX_OSS_BASE_URL, for example:
211
+ - CODEX_OSS_BASE_URL="http://my-ollama.example.com:11434/v1" codex --oss -m gpt-oss:20b
212
+ - or CODEX_OSS_PORT (when the host is localhost):
213
+ - CODEX_OSS_PORT=11434 codex --oss
214
+
215
+ Advanced: you can persist this in your config instead of environment variables by overriding the built-in `oss` provider in `~/.codex/config.toml`:
216
+
217
+ ```toml
218
+ [model_providers.oss]
219
+ name = "Open Source"
220
+ base_url = "http://my-ollama.example.com:11434/v1"
221
+ ```
222
+
223
+ ---
224
+
189
225
  ## Why Codex?
190
226
 
191
227
  Codex CLI is built for developers who already **live in the terminal** and want
Binary file
Binary file
Binary file
Binary file
Binary file
package/dist/cli.js CHANGED
@@ -568,7 +568,11 @@ ${g.join(" ")}
568
568
  (sysctl-name "kern.version")
569
569
  (sysctl-name "sysctl.proc_cputype")
570
570
  (sysctl-name-prefix "hw.perflevel")
571
- )`.trim();ul();var pce=Re(VD(),1);import g6 from"fs";import DHe from"os";import wHe from"path";var xHe=1e4;function RHe(e){return e.length===1&&e[0]!==void 0?(0,pce.parse)(e[0]).some(r=>typeof r=="object"&&"op"in r):!1}function dce({cmd:e,workdir:t,timeoutInMillis:r,additionalWritableRoots:n},a,i,o){let s={timeout:r||xHe,...RHe(e)?{shell:!0}:{},...t?{cwd:t}:{}};switch(a){case"none":return vE(e,s,i,o);case"macos.seatbelt":{let u=[process.cwd(),DHe.tmpdir(),...n];return uce(e,s,u,i,o)}case"linux.landlock":return cce(e,s,n,i,o)}}function fce(e,t=void 0){let r=e.replace(/('|")?<<('|")EOF('|")/,"").replace(/\*\*\* End Patch\nEOF('|")?/,"*** End Patch").trim();r.endsWith(Iu)||(r+=`
571
+ )
572
+
573
+ ; Added on top of Chrome profile
574
+ ; Needed for python multiprocessing on MacOS for the SemLock
575
+ (allow ipc-posix-sem)`.trim();ul();var pce=Re(VD(),1);import g6 from"fs";import DHe from"os";import wHe from"path";var xHe=1e4;function RHe(e){return e.length===1&&e[0]!==void 0?(0,pce.parse)(e[0]).some(r=>typeof r=="object"&&"op"in r):!1}function dce({cmd:e,workdir:t,timeoutInMillis:r,additionalWritableRoots:n},a,i,o){let s={timeout:r||xHe,...RHe(e)?{shell:!0}:{},...t?{cwd:t}:{}};switch(a){case"none":return vE(e,s,i,o);case"macos.seatbelt":{let u=[process.cwd(),DHe.tmpdir(),...n];return uce(e,s,u,i,o)}case"linux.landlock":return cce(e,s,n,i,o)}}function fce(e,t=void 0){let r=e.replace(/('|")?<<('|")EOF('|")/,"").replace(/\*\*\* End Patch\nEOF('|")?/,"*** End Patch").trim();r.endsWith(Iu)||(r+=`
572
576
  `+Iu),zt(`Applying patch: \`\`\`${r}\`\`\`
573
577
 
574
578
  `);try{return{stdout:uB(r,a=>g6.readFileSync(TS(a,t),"utf8"),(a,i)=>{let o=TS(a,t),s=wHe.dirname(o);s!=="."&&g6.mkdirSync(s,{recursive:!0}),g6.writeFileSync(o,i,"utf8")},a=>g6.unlinkSync(TS(a,t))),stderr:"",exitCode:0}}catch(n){return{stdout:"",stderr:String(n.message??n),exitCode:1}}}ul();import hB from"fs/promises";var gce=new Set;function hce(e){let[t,r,n]=e;return n?.startsWith("apply_patch")?"apply_patch":t==="bash"&&r==="-lc"?(n??"").split(/\s+/)[0]||"bash":n?n.split(/\s+/)[0]:JSON.stringify(e)}async function _B(e,t,r,n,a,i){let{cmd:o,workdir:s}=e,u=hce(o);if(gce.has(u))return gB(e,void 0,!1,n,t,i).then(mB);let p=ace(o,s,r,[process.cwd()]),g;switch(p.type){case"ask-user":{let b=await mce(e,p.applyPatch,a);if(b!=null)return b;g=!1;break}case"auto-approve":{g=p.runInSandbox;break}case"reject":return{outputText:"aborted",metadata:{error:"command rejected",reason:"Command rejected by auto-approval system."}}}let{applyPatch:_}=p,E=await gB(e,_,g,n,t,i);if(i?.aborted)return{outputText:"",metadata:{}};if(E.exitCode!==0&&g&&t.fullAutoErrorMode&&t.fullAutoErrorMode==="ask-user"){let b=await mce(e,p.applyPatch,a);if(b!=null)return b;{let S=await gB(e,_,!1,n,t,i);return mB(S)}}else return mB(E)}function mB(e){let{stdout:t,stderr:r,exitCode:n,durationMs:a}=e;return{outputText:t||r,metadata:{exit_code:n,duration_seconds:Math.round(a/100)/10}}}async function gB(e,t,r,n,a,i){let{workdir:o}=e;if(o)try{await hB.access(o)}catch{zt(`EXEC workdir=${o} not found, use process.cwd() instead`),o=process.cwd()}if(t!=null)zt("EXEC running apply_patch command");else if(XN()){let{cmd:b,timeoutInMillis:S}=e,C=S!=null?Math.round(S/1e3).toString():"undefined";zt(`EXEC running \`${Lp(b)}\` in workdir=${o} with timeout=${C}s`)}let s=Date.now(),u=t!=null?fce(t.patch,o):await dce({...e,additionalWritableRoots:n},await OHe(r),a,i),p=Date.now()-s,{stdout:g,stderr:_,exitCode:E}=u;return XN()&&zt(`EXEC exit=${E} time=${p}ms: