npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@korus-dev/codex-sdk

v0.167.1

Published

Typed Codex app-server JSON-RPC client and Node.js transports.

Readme

Codex SDK

Build Node.js applications on the Codex app-server.

A typed TypeScript client for streaming conversations, responding to approvals, and connecting your tools to Codex. Bring your own application state and interface—the SDK handles the protocol and connection.

npm version CI Documentation License Node.js

Documentation → · Getting started · API reference · Contributing

What you get

  • Typed requests and events. Parameters, results, notifications, and tool responses follow the Codex app-server schema.
  • Streaming conversations. Start and resume threads, submit turns, and receive incremental output.
  • Approvals and tools. Respond to server requests with your application's authorization policy.
  • Two ways to connect. Launch an app-server over stdio or attach to an existing Unix control socket.
  • Request diagnostics. Observe outcomes and timings without collecting protocol payloads.
  • Zero runtime dependencies. ESM built on Node.js, with TypeScript declarations for bundler-based projects.

This is an independently maintained SDK, separate from OpenAI's official SDKs.

Use multi-agent-sdk for a provider-neutral agent API and agent-ui-sdk for Vue conversation components and Electron integration.

Install

npm install @korus-dev/codex-sdk

Requires Node.js 22.19.0 or newer and a separately installed Codex CLI. TypeScript projects also need @types/node. Use ESM ("type": "module" in your app's package.json).

The generated protocol targets Codex CLI 0.167.0, including experimental APIs. Feature availability depends on the running server and its configuration.

Your first conversation

With Codex installed and authenticated, stream your first reply:

import { CodexAppServerClient, CodexAppServerStdioTransport } from '@korus-dev/codex-sdk';

const client = new CodexAppServerClient(new CodexAppServerStdioTransport());
client.onNotification('item/agentMessage/delta', ({ params }) => {
  process.stdout.write(params.delta);
});

await client.start();
try {
  await client.initialize({
    clientInfo: { name: 'hello_codex', title: null, version: '1.0.0' },
    capabilities: null,
  });
  const { thread } = await client.request('thread/start', {});
  const finished = new Promise<void>(resolve => {
    client.onNotification('turn/completed', () => resolve());
  });
  await client.request('turn/start', {
    threadId: thread.id,
    input: [{ type: 'text', text: 'Say hello!', text_elements: [] }],
  });
  await finished;
} finally {
  await client.close();
}

The SDK finds Codex automatically and uses your current directory. See the full conversation guide for approvals, deadlines, and connection recovery.

Connect your way

| Transport | Use it when | Lifecycle | | --- | --- | --- | | CodexAppServerStdioTransport | Your app should launch its own Codex process | Closing the transport stops its child | | CodexAppServerUnixSocketTransport | An app-server is already running | Closing disconnects this client and leaves the server running |

Configure command, cwd, codexHome, environment variables, and Codex overrides in your trusted Node.js host. There are no implicit feature flags. Set executableDiscovery: false when you want only your supplied command and environment.

See transports and executable discovery for configuration and custom transports.

Go further

| Build | Guide | | --- | --- | | History and conversation recovery | Threads and turns | | Account and sign-in flows | Authentication | | App-owned tools and approval handling | Approvals and tools | | External tool services | MCP servers | | Pairing and remote connections | Remote control | | Every typed protocol method | Protocol inventory |

Import runtime APIs and types from @korus-dev/codex-sdk. See the export reference for the complete API and generated types.

Development

npm ci
npm run check

Development uses Node.js 26.12.1, pinned in .node-version. check runs typechecks, tests with coverage, the package build, a packed-consumer check, and the VitePress build. Preview the VitePress documentation with npm run dev:docs.

See the development guide for schema generation, CLI verification, and release workflows.

Contributing

Issues and pull requests are welcome. Read CONTRIBUTING.md, or open an issue for bugs and questions.

License and security

Released under Apache-2.0. See CHANGELOG.md for release notes and SECURITY.md to report vulnerabilities privately.