salambo-codex-agent-sdk
v0.1.4
Published
TypeScript SDK wrapper around `codex app-server`, with: - V2 session API (`createSession`) - V1 compat API (`query`) - Hooks, approvals, multi-turn, model switching - Upstream fallback support + fork hook protocol support
Readme
salambo-codex-agent-sdk
TypeScript SDK wrapper around codex app-server, with:
- V2 session API (
createSession) - V1 compat API (
query) - Hooks, approvals, multi-turn, model switching
- Upstream fallback support + fork hook protocol support
Install
pnpm add salambo-codex-agent-sdkNode requirement: >=20.
Binary Resolution
Session startup resolves the app-server binary in this order:
options.codexPathSALAMBO_CODEX_PATH- Platform binary package:
salambo-codex-bin-darwin-arm64salambo-codex-bin-darwin-x64salambo-codex-bin-linux-arm64salambo-codex-bin-linux-x64salambo-codex-bin-win32-x64
codex/codex-app-serverinPATH
Supported platform matrix (v1):
darwin-arm64darwin-x64linux-arm64linux-x64win32-x64
Override example:
export SALAMBO_CODEX_PATH=/absolute/path/to/codex-app-serverQuickstart (V2)
import { createSession } from "salambo-codex-agent-sdk";
await using session = createSession({
model: "gpt-5.2-codex",
provider: "openai",
permissionMode: "bypassPermissions",
});
await session.send("Say hello and nothing else.");
for await (const msg of session.stream()) {
console.log(msg);
}Quickstart (V1 compat)
import { query } from "salambo-codex-agent-sdk";
for await (const msg of query({
prompt: "Say hello",
options: { model: "gpt-5.2-codex", provider: "openai" },
})) {
console.log(msg);
}Dev Commands
pnpm buildbuilds the SDKpnpm typecheckruns TypeScript checkspnpm lintruns ESLintpnpm testruns unit + integration (live integration is opt-in only)pnpm test:unitruns unit tests onlypnpm test:integrationruns integration suite (live tests still opt-in)pnpm test:hooksruns hook-focused unit testspnpm test:ciruns deterministic CI profilepnpm test:live:isolatedruns live integration tests in an isolated Codex homepnpm test:live:fork-isolatedruns live fork hook E2E tests in an isolated Codex homepnpm release:patchrelease prep (checks + bump + tag + push)pnpm release:minorsame flow for minor releasespnpm release:majorsame flow for major releases
Release Flow (release-please style, manual)
Run one command:
pnpm release:patchIt does:
pnpm typecheckpnpm lintpnpm test:unitnpm pack --dry-runnpm version patch(creates commit + tag)git push origin HEAD --follow-tags
Optional strict mode (includes live tests):
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.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 to forkedcodexorcodex-app-serverbinary; defaultcodex)
Examples:
pnpm test:live:isolatedSALAMBO_TEST_MODEL=gpt-5.2-codex pnpm test:live:isolatedFork hook E2E:
SALAMBO_CODEX_PATH=/absolute/path/to/codex-app-server pnpm test:live:fork-isolatedThis script writes an isolated CODEX_HOME/config.toml with:
[hook_protocol]
enabled = true
pre_tool_use = true
post_tool_use = trueBinary Troubleshooting
If session startup fails with a binary resolution error:
- Check platform package install:
pnpm ls salambo-codex-bin-<platform> - Or set explicit binary path with
SALAMBO_CODEX_PATH - Or ensure
codexis available inPATH
