The in-flight turn id, set on turn/started and cleared on turn/completed.
The app-server's initialize response, once initialize has run.
Whether the initialize handshake has completed.
The active Codex thread id. Use resumeThread to change threads.
Aborts only the current SSE stream, preserving listeners.
Clears the active thread's goal (thread/goal/clear).
Compacts the active thread's context server-side (thread/compact/start).
Opens the SSE transport and starts its read loop. Call initialize next — the app-server rejects requests until the handshake completes.
Gracefully closes the transport and rejects pending requests. Idempotent.
Reads the account's current rate limits (account/rateLimits/read).
Wire params are Option<()>: the params field must be omitted, not {}.
Reads the account's token-usage summary (account/usage/read).
Wire params are Option<()>: the params field must be omitted, not {}.
Reads the active thread's goal (thread/goal/get).
Runs the Codex app-server initialize handshake: sends the
initialize request (client info + capabilities) and the initialized
notification. Required once after connect — the app-server
rejects all other requests with -32600 "Not initialized" until this
completes. If the server was already initialized (e.g. by a previous
session against the same process), that response is treated as success.
Uses a longer timeout (120 s) because the app-server may still be starting.
Optionalparams: Partial<InitializeParams>Overrides merged over CodexAxonConnectionOptions.initializeParams and the SDK defaults.
ConnectionStateError If the connection is not reusable after a fatal broker error (code: "terminated").
ConnectionStateError If connect has not been called yet (code: "not_connected").
Lists configured MCP servers with startup/auth status (mcpServerStatus/list).
Lists skills available to the session (skills/list).
Registers an approval handler. Without one, command/file approvals are
accepted, legacy approvals are approved, user-input answers are empty,
and requested permissions are granted for the turn. Handler timeouts are
declined. Mounting with approval_policy=never avoids approval traffic.
Registers a classified Codex timeline listener.
Reads the app-server's effective configuration (config/read).
Reads a thread's metadata — and optionally its turns — from rollout
history (thread/read). Defaults to the active thread.
Optionalparams: Partial<ThreadReadParams>Yields agent notifications until the connection closes.
Pull-based classified timeline event stream.
Yields one turn and terminates after turn/completed.
Resumes a known server-side thread and makes it current.
Sends text or structured input, creating a thread on the first call.
options carries per-turn overrides (see TurnOptions); the
app-server applies them to this turn and subsequent turns.
Optionaloptions: TurnOptionsSets or updates the active thread's goal (thread/goal/set).
Renames the active thread (thread/name/set).
Starts a Codex review on the current thread (review/start), creating a
thread if needed. Defaults to reviewing uncommitted changes.
Optionaldelivery: ReviewDelivery | nullStarts and tracks a Codex thread, returning its server-assigned id.
Native Codex app-server connection over an Axon channel.
Like Claude, Codex requires an
initializehandshake before it accepts requests: call connect, then initialize, then send a prompt and consume receiveTurn; the first send creates a server-side thread automatically.Example