Commit Graph

27 Commits

  • [SDK] Add network_access and web_search options to TypeScript SDK (#6367)
    ## Summary
    
    This PR adds two new optional boolean fields to `ThreadOptions` in the
    TypeScript SDK:
    
    - **`networkAccess`**: Enables network access in the sandbox by setting
    `sandbox_workspace_write.network_access` config
    - **`webSearch`**: Enables the web search tool by setting
    `tools.web_search` config
    
    These options map to existing Codex configuration options and are
    properly threaded through the SDK layers:
    1. `ThreadOptions` (threadOptions.ts) - User-facing API
    2. `CodexExecArgs` (exec.ts) - Internal execution args  
    3. CLI flags via `--config` in the `codex exec` command
    
    ## Changes
    
    - `sdk/typescript/src/threadOptions.ts`: Added `networkAccess` and
    `webSearch` fields to `ThreadOptions` type
    - `sdk/typescript/src/exec.ts`: Added fields to `CodexExecArgs` and CLI
    flag generation
    - `sdk/typescript/src/thread.ts`: Pass options through to exec layer
    
    ## Test Plan
    
    - [x] Build succeeds (`pnpm build`)
    - [x] Linter passes (`pnpm lint`)
    - [x] Type definitions are properly exported
    - [ ] Manual testing with sample code (to be done by reviewer)
    
    ---------
    
    Co-authored-by: Claude <noreply@anthropic.com>
  • Add modelReasoningEffort option to TypeScript SDK (#6237)
    ## Summary
    - Adds `ModelReasoningEffort` type to TypeScript SDK with values:
    `minimal`, `low`, `medium`, `high`
    - Adds `modelReasoningEffort` option to `ThreadOptions`
    - Forwards the option to the codex CLI via `--config
    model_reasoning_effort="<value>"`
    - Includes test coverage for the new option
    
    ## Changes
    - `sdk/typescript/src/threadOptions.ts`: Define `ModelReasoningEffort`
    type and add to `ThreadOptions`
    - `sdk/typescript/src/index.ts`: Export `ModelReasoningEffort` type
    - `sdk/typescript/src/exec.ts`: Forward `modelReasoningEffort` to CLI as
    config flag
    - `sdk/typescript/src/thread.ts`: Pass option through to exec (+ debug
    logging)
    - `sdk/typescript/tests/run.test.ts`: Add test for
    `modelReasoningEffort` flag forwarding
    
    ---------
    
    Co-authored-by: Eric Traut <etraut@openai.com>
  • Re-enable SDK image forwarding test (#5934)
    ## Summary
    - re-enable the TypeScript SDK test that verifies local images are
    forwarded to `codex exec`
    
    ## Testing
    - `pnpm test` *(fails: unable to download pnpm 10.8.1 because external
    network access is blocked in the sandbox)*
    
    ------
    https://chatgpt.com/codex/tasks/task_i_690289cb861083209fd006867e2adfb1
  • [exec] Add MCP tool arguments and results (#5899)
    Extends mcp_tool_call item to include arguments and results.
  • Skip flaky test (#5680)
    Did an investigation but couldn't find anything obvious. Let's skip for
    now.
  • 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 .
  • Remove unused type (#5003)
    It was never exported
  • Set codex SDK TypeScript originator (#4894)
    ## Summary
    - ensure the TypeScript SDK sets CODEX_INTERNAL_ORIGINATOR_OVERRIDE to
    codex_sdk_ts when spawning the Codex CLI
    - extend the responses proxy test helper to capture request headers for
    assertions
    - add coverage that verifies Codex threads launched from the TypeScript
    SDK send the codex_sdk_ts originator header
    
    ## Testing
    - Not Run (not requested)
    
    
    ------
    https://chatgpt.com/codex/tasks/task_i_68e561b125248320a487f129093d16e7
  • 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
  • Expose turn token usage in the SDK (#4700)
    It's present on the event, add it to the final result as well.
  • Support CODEX_API_KEY for codex exec (#4615)
    Allows to set API key per invocation of `codex exec`
  • 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.
  • Explicit node imports (#4567)
    To help with compatibility
  • SDK: support working directory and skipGitRepoCheck options (#4563)
    Make options not required, add support for working directory and
    skipGitRepoCheck options on the turn
  • 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
    ```
  • Add executable detection and export Codex from the SDK (#4532)
    Executable detection uses the same rules as the codex wrapper.
  • SDK CI (#4483)
    Build debug codex in SDK configuration