Skip to main content

Module protocol

Module protocol 

Source
Expand description

Defines the protocol for a Codex session between a client and an agent.

Uses a SQ (Submission Queue) / EQ (Event Queue) pattern to asynchronously communicate between user and agent.

Re-exports§

pub use crate::approvals::ApplyPatchApprovalRequestEvent;
pub use crate::approvals::ElicitationAction;
pub use crate::approvals::ExecApprovalRequestEvent;
pub use crate::approvals::ExecPolicyAmendment;
pub use crate::approvals::NetworkApprovalContext;
pub use crate::approvals::NetworkApprovalProtocol;
pub use crate::mcp_protocol::InputItem;
pub use crate::request_user_input::RequestUserInputEvent;

Structs§

AgentMessageContentDeltaEvent
AgentMessageDeltaEvent
AgentMessageEvent
AgentReasoningDeltaEvent
AgentReasoningEvent
AgentReasoningRawContentDeltaEvent
AgentReasoningRawContentEvent
AgentReasoningSectionBreakEvent
AutoContextCheckEvent
BackgroundEventEvent
Chunk
CollabAgentInteractionBeginEvent
CollabAgentInteractionEndEvent
CollabAgentSpawnBeginEvent
CollabAgentSpawnEndEvent
CollabCloseBeginEvent
CollabCloseEndEvent
CollabResumeBeginEvent
CollabResumeEndEvent
CollabWaitingBeginEvent
CollabWaitingEndEvent
CompactedItem
CompactionCheckpointWarningEvent
ContextCompactedEvent
ConversationPathResponseEvent
Response payload for Op::GetHistory containing the current session’s in-memory transcript.
CreditsSnapshot
DeprecationNoticeEvent
ErrorEvent
Event
Event Queue Entry - events from agent
ExecCommandBeginEvent
ExecCommandEndEvent
ExecCommandOutputDeltaEvent
ExitedReviewModeEvent
FinalOutput
GetHistoryEntryResponseEvent
GitInfo
ItemCompletedEvent
ItemStartedEvent
ListCustomPromptsResponseEvent
Response payload for Op::ListCustomPrompts.
ListRemoteSkillsResponseEvent
Response payload for Op::ListRemoteSkills.
ListSkillsResponseEvent
Response payload for Op::ListSkills.
McpInvocation
McpListToolsResponseEvent
McpServerFailure
McpServerRefreshConfig
Config payload for refreshing MCP servers.
McpStartupCompleteEvent
McpStartupFailure
McpStartupUpdateEvent
McpToolCallBeginEvent
McpToolCallEndEvent
OrderMeta
PatchApplyBeginEvent
PatchApplyEndEvent
PlanDeltaEvent
RateLimitSnapshot
RateLimitWindow
RawResponseItemEvent
ReasoningContentDeltaEvent
ReasoningRawContentDeltaEvent
RecordedEvent
RejectConfig
RemoteSkillDownloadedEvent
Response payload for Op::DownloadRemoteSkill.
RemoteSkillSummary
ResumedHistory
ReviewCodeLocation
Location of the code related to a review finding.
ReviewContextMetadata
ReviewFinding
A single review finding describing an observed issue or recommendation.
ReviewLineRange
Inclusive line range in a file associated with the finding.
ReviewOutputEvent
Structured review result produced by a child review session.
ReviewRequest
Review request sent to the review session.
ReviewSnapshotInfo
RolloutLine
SessionConfiguredEvent
SessionMeta
SessionMeta contains session-level data that doesn’t correspond to a specific turn.
SessionMetaLine
SkillDependencies
SkillErrorInfo
SkillInterface
SkillMetadata
SkillToolDependency
SkillsListEntry
StreamErrorEvent
StreamInfoEvent
Submission
Submission Queue Entry - requests from user
TerminalInteractionEvent
ThreadNameUpdatedEvent
ThreadRolledBackEvent
TokenCountEvent
TokenUsage
TokenUsageInfo
TurnAbortedEvent
TurnCompleteEvent
TurnContextItem
TurnDiffEvent
TurnStartedEvent
UndoCompletedEvent
UndoStartedEvent
UserMessageEvent
ViewImageToolCallEvent
WarningEvent
WebSearchBeginEvent
WebSearchEndEvent
WritableRoot
A writable root path accompanied by a list of subpaths that should remain read‑only even when the root is writable. This is primarily used to ensure that folders containing files that could be modified to escalate the privileges of the agent (e.g. .codex, .git, notably .git/hooks) under a writable root are not modified by the agent.

Enums§

AgentStatus
Agent lifecycle status, derived from emitted events.
AskForApproval
Determines the conditions under which the user is consulted to approve running the command proposed by Codex.
AutoContextPhase
CodexErrorInfo
Codex errors that we expose to clients.
EventMsg
Response event from the agent NOTE: Make sure none of these values have optional types, as it will mess up the extension code-gen.
ExecCommandSource
ExecOutputStream
FileChange
InitialHistory
InputMessageKind
McpAuthStatus
McpServerFailurePhase
McpStartupStatus
NetworkAccess
Represents whether outbound network access is available to the agent.
Op
Submission operation
ReviewDecision
User’s decision in response to an ExecApprovalRequest.
ReviewDelivery
ReviewTarget
RolloutItem
SandboxPolicy
Determines execution restrictions for model shell commands.
SessionSource
SkillScope
SubAgentSource
TruncationPolicy
TurnAbortReason

Constants§

BROWSER_SNAPSHOT_CLOSE_TAG
BROWSER_SNAPSHOT_OPEN_TAG
COLLABORATION_MODE_CLOSE_TAG
COLLABORATION_MODE_OPEN_TAG
ENVIRONMENT_CONTEXT_CLOSE_TAG
ENVIRONMENT_CONTEXT_DELTA_CLOSE_TAG
ENVIRONMENT_CONTEXT_DELTA_OPEN_TAG
ENVIRONMENT_CONTEXT_OPEN_TAG
USER_INSTRUCTIONS_CLOSE_TAG
USER_INSTRUCTIONS_OPEN_TAG
Open/close tags for special user-input blocks. Used across crates to avoid duplicated hardcoded strings.
USER_MESSAGE_BEGIN

Traits§

HasLegacyEvent