| Phase | 8 — Headless server & exec |
| Status | Not started |
| Depends on | 02 |
| Size | L |
| Drop-in critical | ★★ (JSON-RPC method surface) |
Port codex-app-server-protocol: the JSON-RPC 2.0 method/request/response/
notification definitions that clients (IDEs, the TUI, exec) use to drive Codex.
Must match method names and payload schemas exactly.
reference-codex/codex-rs/app-server-protocol/src/protocol/(theclient_request_definitions!macro,ClientRequest/ClientResponse,ServerNotification, serialization scopes).reference-codex/codex-rs/docs/protocol_v1.md.
- Define every JSON-RPC method with its exact wire name, e.g.:
- Thread:
thread/start,thread/resume,thread/fork,thread/archive,thread/list,thread/read,thread/setName,thread/turnsList,thread/injectItems,thread/rollback,thread/settingsUpdate,thread/goalSet|Get|Clear,thread/metadataUpdate,thread/memoryModeSet,thread/unsubscribe. - Turn:
turn/start,turn/steer,turn/interrupt. - Filesystem:
fs/readFile,fs/writeFile,fs/createDirectory,fs/getMetadata,fs/readDirectory,fs/remove,fs/copy,fs/watch,fs/unwatch. - Plugins/apps/skills/hooks/marketplace, account/auth, review, MCP, config
(
model/list,permissionProfile/list,collaborationMode/list,experimentalFeature/list), feedback — full set from the macro.
- Thread:
Initializehandshake (v1 compatibility) as the required first request.ServerNotificationevent stream types (async, not request/response), incl.codex/event/*.- Request serialization scopes (global / thread / command-process) for ordering.
- Generate/emit JSON Schema + TypeScript-equivalent types (parity with
schemars/ts-rs) for client compatibility;app-server generate-ts/generate-json-schema.
- Golden: request/response/notification JSON for every method round-trips byte-identically against captured Codex traffic.
- Generated JSON Schema matches Codex's
generate-json-schemaoutput (semantic equality). Initializehandshake matches v1 exactly.
- The macro generates a large enum; in Go this is a hand-written or code-generated dispatch table. Drive field names directly from captured JSON, not guesses.
- Scopes affect concurrency (spec 33) — define them precisely here.
- The server that implements these methods (spec 33).