mirror of
https://github.com/openai/codex.git
synced 2026-09-06 15:29:32 +00:00
## Summary - add validated protocol-version, capability, and session identifier types - define explicit `ClientToHost` and `HostToClient` JSON envelopes for connection negotiation and session open/close acknowledgements - reject invalid states and unknown fields during decoding, with explicit wire-format and round-trip coverage ## Why This establishes the transport-neutral encoding shape needed to build and test the new code-mode host incrementally. Cell, tool callback, and failure-domain messages are intentionally deferred until their actors and behavior tests establish the required semantics. This is additive protocol scaffolding and does not change the current production code-mode implementation. ## Validation
20 lines
682 B
Rust
20 lines
682 B
Rust
use serde::Deserialize;
|
|
use serde::Serialize;
|
|
|
|
use super::Capability;
|
|
use super::SupportedProtocolVersions;
|
|
|
|
/// Explains why connection negotiation was rejected before any session opened.
|
|
#[derive(Clone, Debug, Deserialize, Eq, PartialEq, Serialize)]
|
|
#[serde(deny_unknown_fields, tag = "type", rename_all_fields = "camelCase")]
|
|
pub enum HandshakeRejectReason {
|
|
#[serde(rename = "noCompatibleVersion")]
|
|
NoCompatibleVersion {
|
|
supported_versions: SupportedProtocolVersions,
|
|
},
|
|
#[serde(rename = "missingRequiredCapability")]
|
|
MissingRequiredCapability { capability: Capability },
|
|
#[serde(rename = "invalidHello")]
|
|
InvalidHello { message: String },
|
|
}
|