13 Commits

  • Add openai_base_url config override for built-in provider (#12031)
    We regularly get bug reports from users who mistakenly have the
    `OPENAI_BASE_URL` environment variable set. This PR deprecates this
    environment variable in favor of a top-level config key
    `openai_base_url` that is used for the same purpose. By making it a
    config key, it will be more visible to users. It will also participate
    in all of the infrastructure we've added for layered and managed
    configs.
    
    Summary
    - introduce the `openai_base_url` top-level config key, update
    schema/tests, and route the built-in openai provider through it while
    - fall back to deprecated `OPENAI_BASE_URL` env var but warn user of
    deprecation when no `openai_base_url` config key is present
    - update CLI, SDK, and TUI code to prefer the new config path (with a
    deprecated env-var fallback) and document the SDK behavior change
  • Make codex-sdk depend on openai/codex (#11503)
    Do not bundle all binaries inside the SDK as it makes the package huge.
    Instead depend on openai/codex
  • feat: make it possible to specify --config flags in the SDK (#10003)
    Updates the `CodexOptions` passed to the `Codex()` constructor in the
    SDK to support a `config` property that is a map of configuration data
    that will be transformed into `--config` flags passed to the invocation
    of `codex`.
    
    Therefore, something like this:
    
    ```typescript
    const codex = new Codex({
      config: {
        show_raw_agent_reasoning: true,
        sandbox_workspace_write: { network_access: true },
      },
    });
    ```
    
    would result in the following args being added to the invocation of
    `codex`:
    
    ```shell
    --config show_raw_agent_reasoning=true --config sandbox_workspace_write.network_access=true
    ```
  • feat(ts-sdk): allow overriding CLI environment (#6648)
    ## Summary
    - add an `env` option for the TypeScript Codex client and plumb it into
    `CodexExec` so the CLI can run without inheriting `process.env`
    - extend the test spy to capture spawn environments, add coverage for
    the new option, and document how to use it
    
    ## Testing
    - `pnpm test` *(fails: corepack cannot download pnpm because outbound
    network access is blocked in the sandbox)*
    
    ------
    [Codex
    Task](https://chatgpt.com/codex/tasks/task_i_6916b2d7c7548322a72d61d91a2dac85)
  • Fix SDK documentation: replace 'file diffs' with 'file change notifications' (#6425)
    The TypeScript SDK's README incorrectly claimed that runStreamed() emits
    "file diffs". However, the FileChangeItem type only contains metadata
    (path, kind, status) without actual diff content.
    
    Updated line 36 to accurately describe the SDK as providing "file change
    notifications" instead of "file diffs" to match the actual
    implementation in items.ts.
    
    Fixes #5850
  • feat: add images support to the Codex Typescript SDK (#5281)
    Extend `run` and `runStreamed` input to be either a `string` or
    structured input. A structured input is an array of text parts and/or
    image paths, which will then be fed to the CLI through the `--image`
    argument. Text parts are combined with double newlines. For instance:
    
    ```ts
    const turn = await thread.run([
      { type: "text", text: "Describe these screenshots" },
      { type: "local_image", path: "./ui.png" },
      { type: "local_image", path: "./diagram.jpg" },
      { type: "text", text: "Thanks!" },
    ]);
    ```
    
    Ends up launching the CLI with:
    
    ```
    codex exec --image foo.png --image bar.png "Describe these screenshots\n\nThanks!" 
    ```
    
    The complete `Input` type for both function now is:
    
    ```ts
    export type UserInput =
      | {
          type: "text";
          text: string;
        }
      | {
          type: "local_image";
          path: string;
        };
    
    export type Input = string | UserInput[];
    ```
    
    This brings the Codex SDK closer to feature parity with the CLI.
    Adresses #5280 .
  • Update README.md (#4794)
    # External (non-OpenAI) Pull Request Requirements
    
    Before opening this Pull Request, please read the dedicated
    "Contributing" markdown file or your PR may be closed:
    https://github.com/openai/codex/blob/main/docs/contributing.md
    
    If your PR conforms to our contribution guidelines, replace this text
    with a detailed and high quality description of your changes.
  • Expand TypeScript SDK README (#4779)
    ## Summary
    - expand the TypeScript SDK README with streaming, architecture, and API
    docs
    - refresh quick start examples and clarify thread management options
    
    ## Testing
    - Not Run (docs only)
    
    ---------
    
    Co-authored-by: pakrym-oai <pakrym@openai.com>
  • Misc SDK fixes (#4752)
    Remove codex-level workingDirectory
    Throw on turn.failed in `run()`
    Cleanup readme
  • Store settings on the thread instead of turn (#4579)
    It's much more common to keep the same settings for the entire
    conversation, we can add per-turn overrides later.
  • Add initial set of doc comments to the SDK (#4513)
    Also perform minor code cleanup.
  • chore: introduce publishing logic for @openai/codex-sdk (#4543)
    There was a bit of copypasta I put up with when were publishing two
    packages to npm, but now that it's three, I created some more scripts to
    consolidate things.
    
    With this change, I ran:
    
    ```shell
    ./scripts/stage_npm_packages.py --release-version 0.43.0-alpha.8 --package codex --package codex-responses-api-proxy --package codex-sdk
    ```
    
    Indeed when it finished, I ended up with:
    
    ```shell
    $ tree dist
    dist
    └── npm
        ├── codex-npm-0.43.0-alpha.8.tgz
        ├── codex-responses-api-proxy-npm-0.43.0-alpha.8.tgz
        └── codex-sdk-npm-0.43.0-alpha.8.tgz
    $ tar tzvf dist/npm/codex-sdk-npm-0.43.0-alpha.8.tgz
    -rwxr-xr-x  0 0      0    25476720 Oct 26  1985 package/vendor/aarch64-apple-darwin/codex/codex
    -rwxr-xr-x  0 0      0    29871400 Oct 26  1985 package/vendor/aarch64-unknown-linux-musl/codex/codex
    -rwxr-xr-x  0 0      0    28368096 Oct 26  1985 package/vendor/x86_64-apple-darwin/codex/codex
    -rwxr-xr-x  0 0      0    36029472 Oct 26  1985 package/vendor/x86_64-unknown-linux-musl/codex/codex
    -rw-r--r--  0 0      0       10926 Oct 26  1985 package/LICENSE
    -rw-r--r--  0 0      0    30187520 Oct 26  1985 package/vendor/aarch64-pc-windows-msvc/codex/codex.exe
    -rw-r--r--  0 0      0    35277824 Oct 26  1985 package/vendor/x86_64-pc-windows-msvc/codex/codex.exe
    -rw-r--r--  0 0      0        4842 Oct 26  1985 package/dist/index.js
    -rw-r--r--  0 0      0        1347 Oct 26  1985 package/package.json
    -rw-r--r--  0 0      0        9867 Oct 26  1985 package/dist/index.js.map
    -rw-r--r--  0 0      0          12 Oct 26  1985 package/README.md
    -rw-r--r--  0 0      0        4287 Oct 26  1985 package/dist/index.d.ts
    ```