Skip to main content

Module codex

Module codex 

Source
Expand description

Codex CLI: start a turn in a running thread through codex app-server.

The operator runs one app-server (codex app-server --listen unix:// or --listen ws://127.0.0.1:PORT) and attaches the interactive TUI to it with codex --remote <same endpoint>. This adapter is a second client on that server. Wire (verified against codex-cli 0.160.1 on the box): one JSON-RPC message per WebSocket text frame, no "jsonrpc" member; initialize → initialized → turn/start {threadId, input}. A thread the server has not loaded answers thread not found; the adapter then sends thread/resume {threadId} and retries turn/start once. turn/start on a thread with an active turn is accepted by the server. The other client (the TUI) sees turn/started and the user item.

unix:// uses a Unix domain socket and is unix-only here; Windows uses ws://127.0.0.1:PORT. Non-loopback ws:// is refused.

Modules§

desktop
Desktop follower IPC (inspected on Desktop 26.1007.2314.0). Routes to the existing thread owner. No provider spawn, auth access, thread creation or UI input. Internal protocol: fail closed on drift.

Structs§

CodexAppServerAdapter
Second client on the operator’s Codex app-server.

Enums§

CodexEndpoint
Where the shared app-server listens.

Constants§

CODEX_APP_SERVER_ENV
Env var naming the app-server endpoint (unix:///path or ws://127.0.0.1:PORT).

Functions§

initialize_request
initialize request (exact shape verified on 0.160.1).
start_turn
Runs the handshake and one turn/start (with one resume retry) on an open WebSocket. Generic over the stream so tests use a fake server.
thread_resume_request
thread/resume request.
turn_start_request
turn/start request with one text input.