Skip to content

feat: split SDKs by target for NPM - #11484

Closed
jif-oai wants to merge 1 commit into
mainfrom
jif/npm-split-sdks
Closed

jif-oai wants to merge 1 commit into
mainfrom
jif/npm-split-sdks

Conversation

@jif-oai

@jif-oai jif-oai commented Feb 11, 2026

Copy link
Copy Markdown
Contributor

Description

Why

@openai/codex-sdk publish was failing in release with:

npm ERR! E413 Payload Too Large

The SDK tarball currently bundles binaries for all platforms, which pushes the package over npm’s payload
limits.

What changed

  1. Implemented CLI-style packaging for SDK: one lightweight meta package plus platform-specific native tarballs.
  2. Added SDK platform package variants in the staging/build tooling:
  • codex-sdk-linux-x64
  • codex-sdk-linux-arm64
  • codex-sdk-darwin-x64
  • codex-sdk-darwin-arm64
  • codex-sdk-win32-x64
  • codex-sdk-win32-arm64
  1. Updated codex-sdk meta package generation:
  • keeps JS/TS output (dist) only
  • adds optionalDependencies pointing to platform-specific SDK variants via npm aliasing.
  1. Updated SDK runtime binary resolution to match the new layout:
  • resolve platform package via require.resolve(...)
  • fallback to local vendor/ when present (dev/back-compat path).
  1. Updated release pipeline publish logic:
  • download and publish new codex-sdk-npm--.tgz artifacts
  • publish them with platform tags (including alpha-prefixed tags for prereleases), matching existing CLI behavior.
  1. Updated docs for staging flow and SDK install behavior.

Expected impact

  1. @openai/codex-sdk main tarball is much smaller (no multi-platform vendor payload).
  2. npm publish no longer hits payload limits.
  3. Consumers install only the binary for their platform.
  4. No SDK API surface changes.

Validation

  1. pnpm --filter @openai/codex-sdk run build passed.
  2. pnpm --filter @openai/codex-sdk run lint passed.
  3. pnpm --filter @openai/codex-sdk exec jest tests/exec.test.ts passed.
  4. Python staging scripts compile (py_compile) passed.
  5. Full SDK Jest suite could not run in this sandbox due to listen EPERM 127.0.0.1 restrictions.


# `npm_name` is the local optional-dependency alias consumed by `sdk/typescript/src/exec.ts`.
# The underlying package published to npm is always `@openai/codex-sdk`.
CODEX_SDK_PLATFORM_PACKAGES: dict[str, dict[str, str]] = {

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we share more with the existing map we have for the cli?

@bolinfest

Copy link
Copy Markdown
Collaborator

@bolinfest

Copy link
Copy Markdown
Collaborator

Fixed by #11503.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants