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);
}
}Re-exports§
pub use crate::protocol_generated::types::*;
Modules§
- methods
- JSON-RPC method names used by the app-server protocol.
Structs§
- Account
Login Completed Notification account/login/completednotification.- 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. - Config
Warning Notification configWarningnotification.- Deprecation
Notice Notification deprecationNoticenotification.- 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.- File
Change Patch Updated Notification item/fileChange/patchUpdatednotification.- FsChanged
Notification fs/changednotification.- Guardian
Warning Notification guardianWarningnotification.- 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
Oauth Login Completed Notification mcpServer/oauthLogin/completednotification.- McpServer
Startup Status Updated Notification mcpServer/startupStatus/updatednotification.- Plan
Delta Notification item/plan/deltanotification (EXPERIMENTAL).- 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.- Reasoning
Summary Part Added Notification item/reasoning/summaryPartAddednotification.- Reasoning
Text Delta Notification item/reasoning/textDeltanotification.- Remote
Control Status Changed Notification remoteControl/status/changednotification.- Skills
Changed Notification skills/changednotification (no payload).- Thread
Archive Params - Parameters for
thread/archive. - Thread
Archive Response - Response from
thread/archive. - Thread
Archived Notification thread/archivednotification.- Thread
Closed Notification thread/closednotification.- Thread
Goal Cleared Notification thread/goal/clearednotification.- Thread
Info - Thread metadata returned inside a
ThreadStartResponse. - Thread
Name Updated Notification thread/name/updatednotification.- 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.- Thread
Unarchived Notification thread/unarchivednotification.- 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
Diff Updated Notification turn/diff/updatednotification.- Turn
Error - Error information from a failed turn.
- Turn
Interrupt Params - Parameters for
turn/interrupt. - Turn
Interrupt Response - Response from
turn/interrupt. - Turn
Plan Step - One step in a turn-level plan.
- Turn
Plan Updated Notification turn/plan/updatednotification.- Turn
Start Params - Parameters for
turn/start. - Turn
Start Response - Response from
turn/start. - Turn
Started Notification turn/startednotification.- Warning
Notification warningnotification (general advisory).
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
Plan Step Status - Lifecycle state of a
TurnPlanStep. - Turn
Status - Status of a turn within a
Turn. - User
Input - User input sent as part of a
TurnStartParams.