Expand description
App-server v2 protocol types for the Codex CLI.
These types represent the JSON-RPC request parameters, response payloads,
and notification bodies used by codex app-server. All wire types use
camelCase field names via #[serde(rename_all = "camelCase")].
§Organization
- Request/Response pairs —
ThreadStartParams/ThreadStartResponse,TurnStartParams/TurnStartResponse, etc. - Server notifications — Structs like
TurnCompletedNotification,AgentMessageDeltaNotificationthat can be deserialized from theparamsfield of a [ServerMessage::Notification] - Approval flow types —
CommandExecutionApprovalParamsandFileChangeApprovalParamsfor server-to-client requests that need a response - Method constants — The
methodsmodule contains all JSON-RPC method name strings
§Parsing notifications
Prefer the typed dispatch in crate::messages over manual method checks:
use codex_codes::{Notification, ServerMessage};
fn handle(msg: ServerMessage) {
if let ServerMessage::Notification(Notification::TurnCompleted(c)) = msg {
println!("Turn {} on thread {} completed", c.turn.id, c.thread_id);
}
}Modules§
- methods
- JSON-RPC method names used by the app-server protocol.
Structs§
- Account
Rate Limits Updated Notification account/rateLimits/updatednotification.- Agent
Message Delta Notification item/agentMessage/deltanotification.- Client
Info - Client info sent during the
initializehandshake. - CmdOutput
Delta Notification item/commandExecution/outputDeltanotification.- Command
Execution Approval Params - Parameters for
item/commandExecution/requestApproval(server → client). - Command
Execution Approval Response - Response for
item/commandExecution/requestApproval. - Error
Notification errornotification.- File
Change Approval Params - Parameters for
item/fileChange/requestApproval(server → client). - File
Change Approval Response - Response for
item/fileChange/requestApproval. - File
Change Output Delta Notification item/fileChange/outputDeltanotification.- Initialize
Capabilities - Client capabilities negotiated during
initialize. - Initialize
Params - Parameters for the
initializerequest. - Initialize
Response - Response from the
initializerequest. - Item
Completed Notification item/completednotification.- Item
Started Notification item/startednotification.- McpServer
Startup Status Updated Notification mcpServer/startupStatus/updatednotification.- Rate
Limit Window - A rate-limit window descriptor used inside
RateLimits. - Rate
Limits - Rate-limit envelope sent in
AccountRateLimitsUpdatedNotification. - Reasoning
Delta Notification item/reasoning/summaryTextDeltanotification.- Remote
Control Status Changed Notification remoteControl/status/changednotification.- Thread
Archive Params - Parameters for
thread/archive. - Thread
Archive Response - Response from
thread/archive. - Thread
Info - Thread metadata returned inside a
ThreadStartResponse. - Thread
Start Params - Parameters for
thread/start. - Thread
Start Response - Response from
thread/start. - Thread
Started Notification thread/startednotification.- Thread
Status Changed Notification thread/status/changednotification.- Thread
Token Usage Updated Notification thread/tokenUsage/updatednotification.- Token
Counts - A snapshot of token counts within a single turn or aggregated across a
thread. Sub-field of
TokenUsage. - Token
Usage - Cumulative token usage for a thread.
- Turn
- A completed turn with its items and final status.
- Turn
Completed Notification turn/completednotification.- Turn
Error - Error information from a failed turn.
- Turn
Interrupt Params - Parameters for
turn/interrupt. - Turn
Interrupt Response - Response from
turn/interrupt. - Turn
Start Params - Parameters for
turn/start. - Turn
Start Response - Response from
turn/start. - Turn
Started Notification turn/startednotification.
Enums§
- Command
Approval Decision - Decision for command execution approval.
- File
Change Approval Decision - Decision for file change approval.
- Thread
Status - Status of a thread, sent via
ThreadStatusChangedNotification. - Turn
Status - Status of a turn within a
Turn. - User
Input - User input sent as part of a
TurnStartParams.