Expand description
Generated wire types for the OpenAI Codex app-server.
This crate needs only serde and serde_json. Use it to parse or construct
protocol messages without spawning a process or depending on Tokio.
§codexwire-protocol
Generated serde types for Codex 0.167.0’s app-server JSON-RPC protocol.
This crate depends on serde and serde_json, with no Tokio, I/O, or child process
support. For a client, use codexwire.
Initial crates.io publication is pending. Install from Git for now:
cargo add codexwire-protocol --git https://github.com/talaagent/codexwire
cargo add serde_json§Construct a typed request
use codexwire_protocol::{ClientInfo, InitializeParams, Request};
let params = InitializeParams {
capabilities: None,
client_info: ClientInfo {
name: "example".into(), title: None, version: "0.1.0".into(),
},
};
assert_eq!(InitializeParams::METHOD, "initialize");
let json = serde_json::to_value(¶ms)?;
assert_eq!(json["clientInfo"]["name"], "example");Request ties params to a method and response type. Notification and
ServerRequest identify the server messages supported by the client. These
are message bodies; a JSON-RPC transport adds IDs, method names, and envelopes.
§Read unfamiliar variants
use codexwire_protocol::ThreadItem;
use serde_json::json;
let raw = json!({"type": "futureItem", "id": "example", "newField": true});
let item: ThreadItem = serde_json::from_value(raw.clone())?;
assert!(matches!(&item, ThreadItem::Unknown(_)));
assert_eq!(serde_json::to_value(item)?, raw);A known tag whose body fails to decode also lands in the raw fallback. Not every
schema method is generated, and some complex bodies deliberately remain
serde_json::Value. The input schema is committed with a version pin; regenerate
with scripts/gen-codex-protocol from the repository root. Packaged consumers
need neither the schema, Python, nor a Codex binary to build this crate.
CODEX_VERSION records the upstream CLI pin. Package versions follow the public
Rust API’s compatibility, independently of the Codex CLI version.
See CONTRIBUTING.md for schema updates and release instructions. Licensed under Apache-2.0, with upstream attribution in NOTICE.
Structs§
- Account
Rate Limits Updated Notification - Sparse rolling rate-limit update.
- AddPatch
Change Kind - Agent
Message Delta Notification - Agent
Message Thread Item - AskFor
Approval Granular - Audio
User Input - Client
Info - Codex
Error Info Active Turn NotSteerable - Codex
Error Info Http Connection Failed - Codex
Error Info Response Stream Connection Failed - Codex
Error Info Response Stream Disconnected - Codex
Error Info Response TooMany Failed Attempts - Collab
Agent Tool Call Thread Item - Collaboration
Mode - Collaboration mode for a Codex session.
- Command
Execution Approval Decision Accept With Execpolicy Amendment - Command
Execution Approval Decision Apply Network Policy Amendment - Command
Execution Request Approval Params - Command
Execution Request Approval Response - Command
Execution Thread Item - Context
Compaction Thread Item - Credits
Snapshot - Delete
Patch Change Kind - Dynamic
Tool Call Thread Item - Entered
Review Mode Thread Item - Error
Notification - Exited
Review Mode Thread Item - File
Change Request Approval Params - File
Change Request Approval Response - File
Change Thread Item - File
Update Change - Function
Call Output Thread Item - Hook
Prompt Thread Item - Image
Generation Input Image - A local image file successfully read for this exact image-generation request.
- Image
Generation Thread Item - Image
User Input - Image
View Thread Item - Initialize
Capabilities - Client-declared capabilities negotiated during initialize.
- Initialize
Params - Initialize
Response - Item
Completed Notification - Item
Started Notification - Local
Audio User Input - Local
Image User Input - McpApp
Ui - UI resource and display preference for model invocations, captured from the tool descriptor.
- McpServer
Elicitation Request Response - McpTool
Call AppContext - McpTool
Call Error - McpTool
Call Thread Item - Mention
User Input - Misalignment
Error Details - Misalignment
Steer - Network
Approval Context - Plan
Thread Item - Rate
Limit Snapshot - Rate
Limit Window - Reasoning
Thread Item - Settings
- Settings for a collaboration mode.
- Skill
User Input - Sleep
Thread Item - Spend
Control Limit Snapshot - SubAgent
Activity Thread Item - SubAgent
Source Thread Spawn - Text
User Input - Thread
- Thread
Resume Params - There are three ways to resume a thread: 1. By thread_id: load the thread from disk by thread_id and resume it. 2. By history: instantiate the thread from memory and resume it. 3. By path: load the thread from disk by path and resume it.
- Thread
Resume Response - Thread
Section - An independently persisted, user-visible thread section.
- Thread
Section Appearance - Extensible visual presentation for a custom thread section.
- Thread
Start Params - Thread
Start Response - Thread
Started Notification - Thread
Token Usage - Thread
Token Usage Updated Notification - Token
Usage Breakdown - Turn
- Turn
Completed Notification - Turn
Error - Turn
Interrupt Params - Turn
Start Params - Turn
Start Response - Turn
Started Notification - Turn
Tool Output - Update
Patch Change Kind - Usage
Limit Exceeded Image Generation Failure - User
Message Thread Item - WebSearch
Thread Item
Enums§
- Agent
Message Delivery - Approvals
Reviewer - Configures who approval requests are routed to for review. Examples include sandbox escapes, blocked network access, MCP approval prompts, and ARC escalations. Defaults to
user.auto_reviewuses a carefully prompted subagent to gather relevant context and apply a risk-based decision framework before approving or denying the request. The legacy valueguardian_subagentis accepted for compatibility. - AskFor
Approval - Codex
Error Info - This translation layer make sure that we expose codex error code in camel case.
- Collab
Agent Tool - Collab
Agent Tool Call Status - Command
Execution Approval Decision - Command
Execution Approval Kind - Distinguishes a command approval from input sent to an existing terminal.
- Command
Execution Source - Command
Execution Status - Dynamic
Tool Call Status - File
Change Approval Decision - Image
Detail - Image
Generation Failure - McpApp
Display Mode - McpServer
Elicitation Action - McpTool
Call Status - Message
Phase - Classifies assistant text as commentary, a partial answer, or a terminal answer.
- Mode
Kind - Initial collaboration mode to use when the TUI starts.
- Network
Approval Protocol - NonSteerable
Turn Kind - Patch
Apply Status - Patch
Change Kind - Personality
- Deprecated:
friendlyandpragmaticno longer select a style. - Plan
Type - Rate
Limit Reached Type - Reasoning
Summary - A summary of the reasoning performed by the model. This can be useful for debugging and understanding the model’s reasoning process. See https://platform.openai.com/docs/guides/reasoning?api-mode=responses#reasoning-summaries
- Sandbox
Mode - Session
Source - SubAgent
Activity Kind - SubAgent
Source - Thread
History Mode - Thread
Item - A thread item and its recorded lifecycle times. The payload stays flat on the wire.
- Thread
Start Source - Turn
Items View - Turn
Status - User
Input
Constants§
- CODEX_
VERSION - The Codex version this schema came from (
codex --version).
Traits§
- Notification
- A server notification: its method name.
- Request
- A client request: its method name and response type.
- Server
Request - A server-to-client request: its method name and response type.
Type Aliases§
- Absolute
Path Buf - A path that is guaranteed to be absolute and normalized (though it is not guaranteed to be canonicalized or exist on the filesystem).
- Agent
Path - Async
User Input Question - Collab
Agent State - Command
Action - Dynamic
Tool Call Output Content Item - Function
Call Output Body - GitInfo
- Hook
Prompt Fragment - Legacy
AppPath String - McpServer
Elicitation Request Params - McpTool
Call Result - Memory
Citation - Network
Policy Amendment - Reasoning
Effort - A non-empty reasoning effort value advertised by the model.
- Sandbox
Policy - Text
Element - Thread
Id - Thread
Source - Thread
Status - Turn
Interrupt Response - WebSearch
Action