@jaminzhou/codex-app-server-client
v0.6.1
Published
Unofficial TypeScript client for streaming Codex conversations, explicit approvals, and persistent threads over the public app-server protocol.
Maintainers
Readme
Codex App Server Client
Add a streaming Codex conversation to a Node.js app: show output as it arrives, route approval requests to your UI, and interrupt or resume persisted conversations. The client manages the app-server process, typed requests, and event routing so you can focus on your application's flow.
Unofficial, independently implemented open-source project. Not affiliated with, sponsored by, or endorsed by OpenAI. Codex and OpenAI are trademarks of OpenAI.
Package: @jaminzhou/codex-app-server-client.
Source version: 0.6.1 (unpublished candidate); a non-preview 0.x API, not a 1.0
stability commitment.
Check exact registry availability; a source checkout or local rebuild is not proof of publication.
Version 0.3.0 removed the upstream-retired thread/rollback method from public types; callers
using it must migrate. Version 0.4.0 removes upstream-retired plugin-extension types and
PluginSummary.extensions from the generated public TypeScript surface. Version 0.5.0 adds the
Codex 0.159.0 protocol surface without removing any existing public method or type. Published
client 0.6.0 targets Codex 0.162.0, adding three typed methods and 13 protocol types while
retaining the removed namespaceTools capability as a deprecated optional field for older supported
runtimes. This 0.6.1 source candidate updates the runtime to 0.162.1 with no generated public API
changes. Published client 0.5.3 uses runtime 0.160.1; 0.5.2 uses 0.160.0, and the immutable
0.5.1 archive remains on 0.159.3. See the 0.6.1 candidate record,
the 0.6.0 release record,
the 0.5.3 release guide, the 0.5.2 release guide,
the 0.5.1 release guide, the 0.5.0 release guide, the
0.4.0 release guide, the 0.3.1 release guide, the
0.3.0 migration guide, the
historical 0.2.2 release record, and
migration notes from 0.1.0.
The unscoped npm name belongs to a different project.
Is this for your app?
Use this package for a long-lived Node.js host, terminal tool, or Electron main process that needs conversation history, streamed events, and explicit approval callbacks over the public Codex app-server protocol. A browser or Electron renderer needs a separate trusted Node.js host; this is not a browser SDK or a complete UI.
For simpler job automation, consider the official Codex SDK. This package is independently maintained and has its own pre-1.0 API.
Requirements and support
- Run an installed package: Node.js 18+ with ESM (
.mjsor"type": "module"). Use a currently maintained Node.js release for a new app. - Build from source / Git: Node.js 22+ and pnpm 11.7.0. A Git install runs a build; a tarball already contains JavaScript, declarations, schemas, and examples.
- Runtime: this unpublished
0.6.1source candidate uses@openai/[email protected]; published client0.6.0uses0.162.0, client0.5.3uses0.160.1, client0.5.2uses0.160.0, and client0.5.1uses0.159.3, client0.5.0uses0.159.0, and client0.4.0uses0.158.0,0.3.1uses0.157.1,0.3.0uses0.156.1,0.2.2uses0.155.1,0.2.1on0.154.0, and the historical0.1.0archive on0.153.4. Check the registry for exact-version availability. No global CLI installation is needed. Keep optional dependencies enabled because they carry the platform binary. - Platforms: installed-package CI covers Linux, macOS, and Windows. Binary resolution supports x64 and arm64 where the pinned upstream CLI ships them; CI does not cover every architecture.
- Transports: managed local stdio by default; Unix socket attachment is also available. TCP WebSocket remains experimental for this pinned baseline.
- Source version boundary: basic runtime smoke covers
0.150.1,0.152.1,0.153.4,0.154.0,0.155.0,0.155.1,0.156.1,0.157.1,0.158.0,0.159.0,0.159.2,0.159.3,0.160.0,0.160.1,0.162.0, and0.162.1. Current rich turn/approval examples use the source candidate's0.162.1; published client0.6.0uses0.162.0, client0.5.3uses0.160.1, client0.5.2uses0.160.0, client0.5.1uses0.159.3, client0.5.0uses0.159.0, client0.4.0uses0.158.0; clients0.3.1,0.3.0and0.2.2use0.157.1,0.156.1and0.155.1, respectively. Other releases are not implied compatible.
See compatibility and upgrade guidance before changing the runtime.
First run: no account or model usage required
Check availability, then install the exact version in a new consumer directory:
npm init -y
npm view @jaminzhou/[email protected] version --registry https://registry.npmjs.org/
npm install --save-exact --ignore-scripts --include=optional @jaminzhou/[email protected]
node node_modules/@jaminzhou/codex-app-server-client/examples/stream.mjsIf the exact-version query reports that 0.6.0 is unavailable, it has not been made available in
that registry: use a verified local candidate below, or explicitly choose an available historical
release with its older feature set. Do not infer publication from a source checkout's version number.
Expected output:
[mock] Real app-server, local provider, no model usage.
Hello from the local mock.
[turn] completedThe example starts the real pinned app-server with a temporary home/workspace and a scripted loopback model provider. It requires no login, makes no model-service calls, and cleans up afterwards. It tests integration plumbing; the mock text is not a model-quality or live-account test.
Two more complete examples exercise the interaction lifecycle:
node node_modules/@jaminzhou/codex-app-server-client/examples/approvals.mjs
node node_modules/@jaminzhou/codex-app-server-client/examples/interrupt-resume.mjsThey verify that a declined command never executes and that an interrupted conversation resumes after restarting the app-server. See example commands, output, and recovery.
The package includes 16 numbered equivalents of the official Python app-server
examples,
covering lifecycle, images, structured output, model selection, a small terminal loop, login cancellation
and untrusted ExternalMessage input with independent joined-turn handles.
Their public example references are unchanged, and this source candidate runs them on the pinned
0.162.1 baseline. Published client 0.6.0 runs them on 0.162.0, client 0.5.3 on 0.160.1, client 0.5.2 on 0.160.0, client 0.5.1 on 0.159.3,
client 0.5.0 on 0.159.0,
0.4.0 on 0.158.0, 0.3.1 on 0.157.1, 0.3.0 on 0.156.1,
0.2.2 on 0.155.1, and 0.2.1 on 0.154.0.
These additions are not files in the immutable npm 0.1.0 archive.
Install into your own project
Use the exact registry version above (or pnpm add --save-exact --ignore-scripts
@jaminzhou/[email protected]). To validate unpublished changes in this source checkout,
run the development checks below. npm versions are immutable; never create a different archive for
an already-published version.
pnpm check
pnpm compatibility:smoke
pnpm package:smokepackage:smoke builds and checks a temporary package in clean npm and pnpm consumers; it does not
select or publish a release candidate. For a future release archive, first select a new unpublished
version and update package.json, then follow release preparation.
The initial preview publication used --tag next, but the registry also assigned latest to it.
At the 0.1.0 release verification, latest pointed to 0.1.0 and next retained the preview.
Neither tag is a stability guarantee. Pin the exact version and retain your lockfile.
See release preparation, the 0.6.1 candidate record,
the 0.6.0 release record, the 0.5.3 release guide,
the 0.5.2 release guide,
the 0.5.1 release guide,
the 0.5.0 release guide,
the 0.4.0 release guide,
the 0.3.1 release guide,
the 0.3.0 release guide,
and the historical 0.2.2 release record.
If you need Git installation, pin a reviewed full SHA:
npm install 'github:JaminZhou/codex-app-server-client#<full-commit-sha>'.
Git installs need the prepare build. For pnpm 11, first add that exact source to your
consumer's pnpm-workspace.yaml:
allowBuilds:
'@jaminzhou/codex-app-server-client@https://codeload.github.com/JaminZhou/codex-app-server-client/tar.gz/<full-commit-sha>': trueThen run pnpm add 'github:JaminZhou/codex-app-server-client#<full-commit-sha>'.
See troubleshooting if the binary or built files are missing.
Run with your Codex account
The default examples above use no credentials. To opt into real model output, first authenticate
the same CLI runtime bundled by the client, under the same user and CODEX_HOME you will use for
your app. For this source checkout:
npm exec --package=@openai/[email protected] -- codex login
npm exec --package=@openai/[email protected] -- codex login status
node examples/stream.mjs --liveThe unpublished 0.6.1 source candidate uses @openai/[email protected]; published client 0.6.0
uses 0.162.0, client 0.5.3 uses 0.160.1, client 0.5.2 uses 0.160.0,
client 0.5.1 uses 0.159.3,
client 0.5.0 uses 0.159.0, client 0.4.0 uses 0.158.0, client 0.3.1 uses 0.157.1, and 0.3.0 uses
0.156.1.
For 0.2.2, use 0.155.1, and for 0.2.1, use 0.154.0.
For the historical client 0.1.0 archive, use its matching @openai/[email protected] instead.
From an installed consumer, use
node node_modules/@jaminzhou/codex-app-server-client/examples/stream.mjs --live.
A headless machine can use codex login --device-auth through the same pinned command.
Applications can also use the client's browser, device-code, and API-key login APIs.
ChatGPT sign-in uses the account's Codex entitlement and limits; API-key sign-in uses API billing. Installing this MIT-licensed client does not include model usage, bypass limits, or add account features. Availability also depends on the account, workspace policy, and configured provider. See official authentication guidance.
--live uses the current working directory and the selected runtime's configuration/credentials,
may consume usage, and can persist conversation history. Review that directory and configuration
before running it. Keep auth files and tokens out of source control and logs. The examples use a
read-only sandbox and explicit decline handlers; your app must choose its own approval UI and policy.
Build on the example
The stream example shows createThread(), startTurn(), and
for await ... turn.events(). The approval example shows a typed
server-request callback. The resume example waits for interruption
to finish before reconnecting and resuming the saved thread ID.
The API guide covers collected results, raw typed call(), notifications,
login, goals, cancellation, transports, and exported protocol types. It documents limitations such
as one consumer per turn handle and no automatic reconnect/replay.
Development and sources
pnpm check
pnpm package:smokeCONTRIBUTING.md describes CI and protocol regeneration. SOURCES.md records exact public provenance. Implementation sources are public CLI bindings/schemas, open-source Codex, and official open-source SDKs; no private Codex Desktop code or extracted application bundle is used.
The independently written client is MIT-licensed. Generated Codex bindings and schemas carry OpenAI attribution under Apache-2.0; see THIRD_PARTY_NOTICES.md.
