salambo-codex-agent-sdk
v1.1.0
Published
TypeScript SDK around `codex app-server`.
Readme
salambo-codex-agent-sdk
TypeScript SDK around codex app-server.
This SDK is a thin runtime boundary for:
- creating and resuming sessions
- starting, steering, and interrupting turns
- streaming raw inbound App Server events
- opting into experimental raw response items when Codex supports them
It is not:
- a custom hook framework
- a Responses-compatible SSE adapter
- a bundled Codex binary distribution
Stability
Stable SDK surface today:
createSession()session.send(prompt)session.steer(prompt)session.stream()session.interrupt()session.abort()configProfilecwdsystemPromptresumeephemeraloutputSchema
Experimental SDK surface:
experimentalRawEventsrawResponseItem/completedas a product-facing dependency
Guidance:
- build production integrations on the stable session API plus
app_server_raw - treat experimental raw response items as optional diagnostics / research inputs
- do not assume experimental features are always available across Codex runtimes
- build any Responses-compatible SSE layer outside this SDK, on top of the raw App Server stream
Install
pnpm add salambo-codex-agent-sdkRequirements:
- Node
>=20 - Codex installed locally and available via
PATHorSALAMBO_CODEX_PATH
Codex Runtime Resolution
Session startup resolves Codex in this order:
SALAMBO_CODEX_PATHcodexinPATHcodex-app-serverinPATH
Example override:
export SALAMBO_CODEX_PATH=/absolute/path/to/codexCodex Version Compatibility
This SDK currently:
- requires Codex
>= 0.114.0 - is tested against Codex
0.114.0
If the installed Codex version is older than the supported minimum, session startup fails with a clear error.
Quickstart
session.stream() yields raw inbound app-server messages exactly as they are
parsed from stdout, plus local parse-error events when a line cannot be parsed.
Examples:
- notifications:
{ method, params } - server requests:
{ id, method, params } - responses:
{ id, result }or{ id, error } - parse failures:
{ type: "parse_error", line, error }
The raw Responses-style model item is still available at:
rawResponseItem/completed.params.item
This raw response item path is experimental. The stable runtime contract of the
SDK is still the raw App Server stream from session.stream().
import { createSession } from "salambo-codex-agent-sdk";
await using session = createSession({
configProfile: "default",
cwd: process.cwd(),
});
await session.send("Say hello and nothing else.");
for await (const msg of session.stream()) {
console.log(msg);
}API
const session = createSession({
configProfile?: string,
cwd?: string,
systemPrompt?: string,
resume?: string,
ephemeral?: boolean,
experimentalRawEvents?: boolean,
outputSchema?: JsonValue,
});Session methods:
await session.send(prompt)await session.steer(prompt)for await (const event of session.stream()) { ... }await session.interrupt()session.abort()
Dev Commands
pnpm buildbuilds the SDKpnpm typecheckruns TypeScript checkspnpm lintruns ESLintpnpm testruns all Vitest suitespnpm test:confidenceruns the primary local/CI confidence gatepnpm test:unitruns unit tests onlypnpm test:protocolruns the deterministic fake app-server contract suitepnpm test:e2eruns the E2E suitepnpm test:integrationruns integration tests (live tests are opt-in)pnpm test:ciruns the deterministic CI profilepnpm test:live:isolatedruns live integration tests in an isolated Codex homepnpm release:patchprepares a patch releasepnpm release:minorprepares a minor releasepnpm release:majorprepares a major release
Release Flow
Run one command:
pnpm release:patchIt does:
pnpm test:confidencenpm pack --dry-runnpm version patch(creates commit + tag)git push origin HEAD --follow-tags
Optional strict mode:
RUN_LIVE_RELEASE_CHECKS=1 pnpm release:patchFinal publish step stays manual:
npm publishIsolated Live Test Flow
scripts/test-live-isolated.sh does:
- Load
.envif present. - Require
OPENAI_API_KEY. - Use isolated
CODEX_HOME(default/tmp/salambo-codex-home). - Run
codex login --with-api-key. - Set
SALAMBO_RUN_LIVE_TESTS=1. - Run
tests/integration/phase1.test.tsandtests/e2e/upstream.test.ts.
Environment:
- Required:
OPENAI_API_KEY - Optional:
SALAMBO_TEST_MODEL(defaultgpt-5.2-codex) - Optional:
CODEX_HOME(default/tmp/salambo-codex-home) - Optional:
SALAMBO_CODEX_PATH(path tocodexorcodex-app-server)
Examples:
pnpm test:live:isolatedSALAMBO_TEST_MODEL=gpt-5.2-codex pnpm test:live:isolatedTroubleshooting
If session startup fails:
- Check that
codex --versionworks, or setSALAMBO_CODEX_PATH - Make sure Codex is at least
0.114.0 - Ensure
codex app-server --helpworks from the same environment
