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
Login Completed Notification account/login/completednotification.- Account
Rate Limits Updated Notification account/rateLimits/updatednotification.- Account
Updated Notification account/updatednotification (stub — accepts the wire shape unchanged).- Agent
Message Delta Notification item/agentMessage/deltanotification.- AppList
Updated Notification app/list/updatednotification (stub).- Client
Info - Client info sent during the
initializehandshake. - CmdOutput
Delta Notification item/commandExecution/outputDeltanotification.- Command
Exec Output Delta Notification command/exec/outputDeltanotification (stub).- Command
Execution Approval Params - Parameters for
item/commandExecution/requestApproval(server → client). - Command
Execution Approval Response - Response for
item/commandExecution/requestApproval. - Config
Warning Notification configWarningnotification.- Context
Compacted Notification thread/compactednotification (stub).- Deprecation
Notice Notification deprecationNoticenotification.- Error
Notification errornotification.- External
Agent Config Import Completed Notification externalAgentConfig/import/completednotification (stub).- 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.- Fuzzy
File Search Session Completed Notification fuzzyFileSearch/sessionCompletednotification (stub).- Fuzzy
File Search Session Updated Notification fuzzyFileSearch/sessionUpdatednotification (stub).- Guardian
Warning Notification guardianWarningnotification.- Hook
Completed Notification hook/completednotification (stub).- Hook
Started Notification hook/startednotification (stub).- 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
Guardian Approval Review Completed Notification item/autoApprovalReview/completednotification (stub).- Item
Guardian Approval Review Started Notification item/autoApprovalReview/startednotification (stub).- Item
Started Notification item/startednotification.- McpServer
Oauth Login Completed Notification mcpServer/oauthLogin/completednotification.- McpServer
Startup Status Updated Notification mcpServer/startupStatus/updatednotification.- McpTool
Call Progress Notification item/mcpToolCall/progressnotification (stub).- Model
Rerouted Notification model/reroutednotification (stub).- Model
Verification Notification model/verificationnotification (stub).- Plan
Delta Notification item/plan/deltanotification (EXPERIMENTAL).- Process
Exited Notification process/exitednotification (stub).- Process
Output Delta Notification process/outputDeltanotification (stub).- 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.- Server
Request Resolved Notification serverRequest/resolvednotification (stub).- Skills
Changed Notification skills/changednotification (no payload).- Terminal
Interaction Notification item/commandExecution/terminalInteractionnotification (stub).- 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
Goal Updated Notification thread/goal/updatednotification (stub).- Thread
Info - Thread metadata returned inside a
ThreadStartResponse. - Thread
Name Updated Notification thread/name/updatednotification.- Thread
Realtime Closed Notification thread/realtime/closednotification (stub).- Thread
Realtime Error Notification thread/realtime/errornotification (stub).- Thread
Realtime Item Added Notification thread/realtime/itemAddednotification (stub).- Thread
Realtime Output Audio Delta Notification thread/realtime/outputAudio/deltanotification (stub).- Thread
Realtime SdpNotification thread/realtime/sdpnotification (stub).- Thread
Realtime Started Notification thread/realtime/startednotification (stub).- Thread
Realtime Transcript Delta Notification thread/realtime/transcript/deltanotification (stub).- Thread
Realtime Transcript Done Notification thread/realtime/transcript/donenotification (stub).- 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).- Windows
Sandbox Setup Completed Notification windowsSandbox/setupCompletednotification (stub).- Windows
World Writable Warning Notification windows/worldWritableWarningnotification (stub).
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.