// @generated — Generated by `cargo xtask machine-codegen --all`.
#![allow(
    clippy::unwrap_used,
    clippy::expect_used,
    clippy::panic,
    clippy::implicit_clone,
    clippy::unnecessary_cast,
    clippy::redundant_clone
)]

pub fn schema() -> meerkat_machine_schema::MachineSchema {
    meerkat_machine_schema::catalog::dsl::dsl_meerkat_machine()
}

#[derive(
    Debug,
    Clone,
    Default,
    PartialEq,
    Eq,
    PartialOrd,
    Ord,
    Hash,
    serde::Serialize,
    serde::Deserialize,
)]
pub struct AgentRuntimeId(pub String);
impl From<String> for AgentRuntimeId {
    fn from(value: String) -> Self {
        Self(value)
    }
}
impl From<&str> for AgentRuntimeId {
    fn from(value: &str) -> Self {
        Self(value.to_owned())
    }
}
impl std::fmt::Display for AgentRuntimeId {
    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
        f.write_str(&self.0)
    }
}
#[derive(
    Debug,
    Clone,
    Default,
    PartialEq,
    Eq,
    PartialOrd,
    Ord,
    Hash,
    serde::Serialize,
    serde::Deserialize,
)]
pub struct CommsRuntimeId(pub String);
impl From<String> for CommsRuntimeId {
    fn from(value: String) -> Self {
        Self(value)
    }
}
impl From<&str> for CommsRuntimeId {
    fn from(value: &str) -> Self {
        Self(value.to_owned())
    }
}
impl std::fmt::Display for CommsRuntimeId {
    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
        f.write_str(&self.0)
    }
}
#[allow(non_camel_case_types)]
#[derive(
    Debug,
    Clone,
    Copy,
    Default,
    PartialEq,
    Eq,
    PartialOrd,
    Ord,
    Hash,
    serde::Serialize,
    serde::Deserialize,
)]
pub enum ContentShape {
    #[default]
    #[serde(rename = "conversation")]
    Conversation,
    #[serde(rename = "conversation+context")]
    ConversationAndContext,
    #[serde(rename = "context")]
    Context,
    #[serde(rename = "empty")]
    Empty,
    #[serde(rename = "immediate_append")]
    ImmediateAppend,
    #[serde(rename = "immediate_context")]
    ImmediateContext,
}
impl ContentShape {
    pub fn as_str(&self) -> &'static str {
        match self {
            Self::Conversation => {
                meerkat_core::turn_execution_authority::ContentShape::Conversation.as_str()
            }
            Self::ConversationAndContext => {
                meerkat_core::turn_execution_authority::ContentShape::ConversationAndContext
                    .as_str()
            }
            Self::Context => meerkat_core::turn_execution_authority::ContentShape::Context.as_str(),
            Self::Empty => meerkat_core::turn_execution_authority::ContentShape::Empty.as_str(),
            Self::ImmediateAppend => {
                meerkat_core::turn_execution_authority::ContentShape::ImmediateAppend.as_str()
            }
            Self::ImmediateContext => {
                meerkat_core::turn_execution_authority::ContentShape::ImmediateContext.as_str()
            }
        }
    }
}
impl std::convert::TryFrom<&str> for ContentShape {
    type Error = String;
    fn try_from(value: &str) -> Result<Self, Self::Error> {
        match value {
            "conversation" => Ok(Self::Conversation),
            "conversation+context" => Ok(Self::ConversationAndContext),
            "context" => Ok(Self::Context),
            "empty" => Ok(Self::Empty),
            "immediate_append" => Ok(Self::ImmediateAppend),
            "immediate_context" => Ok(Self::ImmediateContext),
            other => Err(format!("invalid ContentShape value `{other}`")),
        }
    }
}
impl std::convert::TryFrom<String> for ContentShape {
    type Error = String;
    fn try_from(value: String) -> Result<Self, Self::Error> {
        Self::try_from(value.as_str())
    }
}
impl std::fmt::Display for ContentShape {
    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
        f.write_str(self.as_str())
    }
}
#[allow(non_camel_case_types)]
#[derive(
    Debug,
    Clone,
    Copy,
    Default,
    PartialEq,
    Eq,
    PartialOrd,
    Ord,
    Hash,
    serde::Serialize,
    serde::Deserialize,
)]
pub enum DrainExitReason {
    #[default]
    #[serde(rename = "IdleTimeout")]
    IdleTimeout,
    #[serde(rename = "Dismissed")]
    Dismissed,
    #[serde(rename = "Failed")]
    Failed,
    #[serde(rename = "Aborted")]
    Aborted,
    #[serde(rename = "SessionShutdown")]
    SessionShutdown,
}
impl DrainExitReason {
    pub fn as_str(&self) -> &'static str {
        match self {
            Self::IdleTimeout => "IdleTimeout",
            Self::Dismissed => "Dismissed",
            Self::Failed => "Failed",
            Self::Aborted => "Aborted",
            Self::SessionShutdown => "SessionShutdown",
        }
    }
}
impl std::convert::TryFrom<&str> for DrainExitReason {
    type Error = String;
    fn try_from(value: &str) -> Result<Self, Self::Error> {
        match value {
            "IdleTimeout" => Ok(Self::IdleTimeout),
            "Dismissed" => Ok(Self::Dismissed),
            "Failed" => Ok(Self::Failed),
            "Aborted" => Ok(Self::Aborted),
            "SessionShutdown" => Ok(Self::SessionShutdown),
            other => Err(format!("invalid DrainExitReason value `{other}`")),
        }
    }
}
impl std::convert::TryFrom<String> for DrainExitReason {
    type Error = String;
    fn try_from(value: String) -> Result<Self, Self::Error> {
        Self::try_from(value.as_str())
    }
}
impl std::fmt::Display for DrainExitReason {
    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
        f.write_str(self.as_str())
    }
}
#[allow(non_camel_case_types)]
#[derive(
    Debug,
    Clone,
    Copy,
    Default,
    PartialEq,
    Eq,
    PartialOrd,
    Ord,
    Hash,
    serde::Serialize,
    serde::Deserialize,
)]
pub enum DrainMode {
    #[default]
    #[serde(rename = "Timed")]
    Timed,
    #[serde(rename = "AttachedSession")]
    AttachedSession,
    #[serde(rename = "PersistentHost")]
    PersistentHost,
}
impl DrainMode {
    pub fn as_str(&self) -> &'static str {
        match self {
            Self::Timed => "Timed",
            Self::AttachedSession => "AttachedSession",
            Self::PersistentHost => "PersistentHost",
        }
    }
}
impl std::convert::TryFrom<&str> for DrainMode {
    type Error = String;
    fn try_from(value: &str) -> Result<Self, Self::Error> {
        match value {
            "Timed" => Ok(Self::Timed),
            "AttachedSession" => Ok(Self::AttachedSession),
            "PersistentHost" => Ok(Self::PersistentHost),
            other => Err(format!("invalid DrainMode value `{other}`")),
        }
    }
}
impl std::convert::TryFrom<String> for DrainMode {
    type Error = String;
    fn try_from(value: String) -> Result<Self, Self::Error> {
        Self::try_from(value.as_str())
    }
}
impl std::fmt::Display for DrainMode {
    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
        f.write_str(self.as_str())
    }
}
#[allow(non_camel_case_types)]
#[derive(
    Debug,
    Clone,
    Copy,
    Default,
    PartialEq,
    Eq,
    PartialOrd,
    Ord,
    Hash,
    serde::Serialize,
    serde::Deserialize,
)]
pub enum DrainPhase {
    #[default]
    #[serde(rename = "Inactive")]
    Inactive,
    #[serde(rename = "Running")]
    Running,
    #[serde(rename = "Stopped")]
    Stopped,
    #[serde(rename = "ExitedRespawnable")]
    ExitedRespawnable,
}
impl DrainPhase {
    pub fn as_str(&self) -> &'static str {
        match self {
            Self::Inactive => "Inactive",
            Self::Running => "Running",
            Self::Stopped => "Stopped",
            Self::ExitedRespawnable => "ExitedRespawnable",
        }
    }
}
impl std::convert::TryFrom<&str> for DrainPhase {
    type Error = String;
    fn try_from(value: &str) -> Result<Self, Self::Error> {
        match value {
            "Inactive" => Ok(Self::Inactive),
            "Running" => Ok(Self::Running),
            "Stopped" => Ok(Self::Stopped),
            "ExitedRespawnable" => Ok(Self::ExitedRespawnable),
            other => Err(format!("invalid DrainPhase value `{other}`")),
        }
    }
}
impl std::convert::TryFrom<String> for DrainPhase {
    type Error = String;
    fn try_from(value: String) -> Result<Self, Self::Error> {
        Self::try_from(value.as_str())
    }
}
impl std::fmt::Display for DrainPhase {
    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
        f.write_str(self.as_str())
    }
}
#[allow(non_camel_case_types)]
#[derive(
    Debug,
    Clone,
    Copy,
    Default,
    PartialEq,
    Eq,
    PartialOrd,
    Ord,
    Hash,
    serde::Serialize,
    serde::Deserialize,
)]
pub enum ExternalToolSurfaceBaseState {
    #[default]
    #[serde(rename = "Absent")]
    Absent,
    #[serde(rename = "Active")]
    Active,
    #[serde(rename = "Removing")]
    Removing,
    #[serde(rename = "Removed")]
    Removed,
}
impl ExternalToolSurfaceBaseState {
    pub fn as_str(&self) -> &'static str {
        match self {
            Self::Absent => "Absent",
            Self::Active => "Active",
            Self::Removing => "Removing",
            Self::Removed => "Removed",
        }
    }
}
impl std::convert::TryFrom<&str> for ExternalToolSurfaceBaseState {
    type Error = String;
    fn try_from(value: &str) -> Result<Self, Self::Error> {
        match value {
            "Absent" => Ok(Self::Absent),
            "Active" => Ok(Self::Active),
            "Removing" => Ok(Self::Removing),
            "Removed" => Ok(Self::Removed),
            other => Err(format!(
                "invalid ExternalToolSurfaceBaseState value `{other}`"
            )),
        }
    }
}
impl std::convert::TryFrom<String> for ExternalToolSurfaceBaseState {
    type Error = String;
    fn try_from(value: String) -> Result<Self, Self::Error> {
        Self::try_from(value.as_str())
    }
}
impl std::fmt::Display for ExternalToolSurfaceBaseState {
    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
        f.write_str(self.as_str())
    }
}
#[allow(non_camel_case_types)]
#[derive(
    Debug,
    Clone,
    Copy,
    Default,
    PartialEq,
    Eq,
    PartialOrd,
    Ord,
    Hash,
    serde::Serialize,
    serde::Deserialize,
)]
pub enum ExternalToolSurfaceDeltaOperation {
    #[default]
    #[serde(rename = "None")]
    None,
    #[serde(rename = "Add")]
    Add,
    #[serde(rename = "Remove")]
    Remove,
    #[serde(rename = "Reload")]
    Reload,
}
impl ExternalToolSurfaceDeltaOperation {
    pub fn as_str(&self) -> &'static str {
        match self {
            Self::None => "None",
            Self::Add => "Add",
            Self::Remove => "Remove",
            Self::Reload => "Reload",
        }
    }
}
impl std::convert::TryFrom<&str> for ExternalToolSurfaceDeltaOperation {
    type Error = String;
    fn try_from(value: &str) -> Result<Self, Self::Error> {
        match value {
            "None" => Ok(Self::None),
            "Add" => Ok(Self::Add),
            "Remove" => Ok(Self::Remove),
            "Reload" => Ok(Self::Reload),
            other => Err(format!(
                "invalid ExternalToolSurfaceDeltaOperation value `{other}`"
            )),
        }
    }
}
impl std::convert::TryFrom<String> for ExternalToolSurfaceDeltaOperation {
    type Error = String;
    fn try_from(value: String) -> Result<Self, Self::Error> {
        Self::try_from(value.as_str())
    }
}
impl std::fmt::Display for ExternalToolSurfaceDeltaOperation {
    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
        f.write_str(self.as_str())
    }
}
#[allow(non_camel_case_types)]
#[derive(
    Debug,
    Clone,
    Copy,
    Default,
    PartialEq,
    Eq,
    PartialOrd,
    Ord,
    Hash,
    serde::Serialize,
    serde::Deserialize,
)]
pub enum ExternalToolSurfaceDeltaPhase {
    #[default]
    #[serde(rename = "None")]
    None,
    #[serde(rename = "Pending")]
    Pending,
    #[serde(rename = "Applied")]
    Applied,
    #[serde(rename = "Draining")]
    Draining,
    #[serde(rename = "Failed")]
    Failed,
    #[serde(rename = "Forced")]
    Forced,
}
impl ExternalToolSurfaceDeltaPhase {
    pub fn as_str(&self) -> &'static str {
        match self {
            Self::None => "None",
            Self::Pending => "Pending",
            Self::Applied => "Applied",
            Self::Draining => "Draining",
            Self::Failed => "Failed",
            Self::Forced => "Forced",
        }
    }
}
impl std::convert::TryFrom<&str> for ExternalToolSurfaceDeltaPhase {
    type Error = String;
    fn try_from(value: &str) -> Result<Self, Self::Error> {
        match value {
            "None" => Ok(Self::None),
            "Pending" => Ok(Self::Pending),
            "Applied" => Ok(Self::Applied),
            "Draining" => Ok(Self::Draining),
            "Failed" => Ok(Self::Failed),
            "Forced" => Ok(Self::Forced),
            other => Err(format!(
                "invalid ExternalToolSurfaceDeltaPhase value `{other}`"
            )),
        }
    }
}
impl std::convert::TryFrom<String> for ExternalToolSurfaceDeltaPhase {
    type Error = String;
    fn try_from(value: String) -> Result<Self, Self::Error> {
        Self::try_from(value.as_str())
    }
}
impl std::fmt::Display for ExternalToolSurfaceDeltaPhase {
    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
        f.write_str(self.as_str())
    }
}
#[allow(non_camel_case_types)]
#[derive(
    Debug,
    Clone,
    Copy,
    Default,
    PartialEq,
    Eq,
    PartialOrd,
    Ord,
    Hash,
    serde::Serialize,
    serde::Deserialize,
)]
pub enum ExternalToolSurfaceFailureCause {
    #[default]
    #[serde(rename = "PendingFailed")]
    PendingFailed,
    #[serde(rename = "SurfaceDraining")]
    SurfaceDraining,
    #[serde(rename = "SurfaceUnavailable")]
    SurfaceUnavailable,
}
impl ExternalToolSurfaceFailureCause {
    pub fn as_str(&self) -> &'static str {
        match self {
            Self::PendingFailed => "PendingFailed",
            Self::SurfaceDraining => "SurfaceDraining",
            Self::SurfaceUnavailable => "SurfaceUnavailable",
        }
    }
}
impl std::convert::TryFrom<&str> for ExternalToolSurfaceFailureCause {
    type Error = String;
    fn try_from(value: &str) -> Result<Self, Self::Error> {
        match value {
            "PendingFailed" => Ok(Self::PendingFailed),
            "SurfaceDraining" => Ok(Self::SurfaceDraining),
            "SurfaceUnavailable" => Ok(Self::SurfaceUnavailable),
            other => Err(format!(
                "invalid ExternalToolSurfaceFailureCause value `{other}`"
            )),
        }
    }
}
impl std::convert::TryFrom<String> for ExternalToolSurfaceFailureCause {
    type Error = String;
    fn try_from(value: String) -> Result<Self, Self::Error> {
        Self::try_from(value.as_str())
    }
}
impl std::fmt::Display for ExternalToolSurfaceFailureCause {
    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
        f.write_str(self.as_str())
    }
}
#[derive(
    Debug,
    Clone,
    Copy,
    Default,
    PartialEq,
    Eq,
    PartialOrd,
    Ord,
    Hash,
    serde::Serialize,
    serde::Deserialize,
)]
pub struct FenceToken(pub u64);
impl From<u64> for FenceToken {
    fn from(value: u64) -> Self {
        Self(value)
    }
}
impl std::fmt::Display for FenceToken {
    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
        write!(f, "{}", self.0)
    }
}
#[derive(
    Debug,
    Clone,
    Copy,
    Default,
    PartialEq,
    Eq,
    PartialOrd,
    Ord,
    Hash,
    serde::Serialize,
    serde::Deserialize,
)]
pub struct Generation(pub u64);
impl From<u64> for Generation {
    fn from(value: u64) -> Self {
        Self(value)
    }
}
impl std::fmt::Display for Generation {
    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
        write!(f, "{}", self.0)
    }
}
#[allow(non_camel_case_types)]
#[derive(
    Debug,
    Clone,
    Copy,
    Default,
    PartialEq,
    Eq,
    PartialOrd,
    Ord,
    Hash,
    serde::Serialize,
    serde::Deserialize,
)]
pub enum InboundPeerRequestState {
    #[default]
    #[serde(rename = "Received")]
    Received,
    #[serde(rename = "Replied")]
    Replied,
}
impl InboundPeerRequestState {
    pub fn as_str(&self) -> &'static str {
        match self {
            Self::Received => "Received",
            Self::Replied => "Replied",
        }
    }
}
impl std::convert::TryFrom<&str> for InboundPeerRequestState {
    type Error = String;
    fn try_from(value: &str) -> Result<Self, Self::Error> {
        match value {
            "Received" => Ok(Self::Received),
            "Replied" => Ok(Self::Replied),
            other => Err(format!("invalid InboundPeerRequestState value `{other}`")),
        }
    }
}
impl std::convert::TryFrom<String> for InboundPeerRequestState {
    type Error = String;
    fn try_from(value: String) -> Result<Self, Self::Error> {
        Self::try_from(value.as_str())
    }
}
impl std::fmt::Display for InboundPeerRequestState {
    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
        f.write_str(self.as_str())
    }
}
#[allow(non_camel_case_types)]
#[derive(
    Debug,
    Clone,
    Copy,
    Default,
    PartialEq,
    Eq,
    PartialOrd,
    Ord,
    Hash,
    serde::Serialize,
    serde::Deserialize,
)]
pub enum InputAbandonReason {
    #[default]
    #[serde(rename = "Retired")]
    Retired,
    #[serde(rename = "Reset")]
    Reset,
    #[serde(rename = "Stopped")]
    Stopped,
    #[serde(rename = "Destroyed")]
    Destroyed,
    #[serde(rename = "Cancelled")]
    Cancelled,
    #[serde(rename = "MaxAttemptsExhausted")]
    MaxAttemptsExhausted,
}
impl InputAbandonReason {
    pub fn as_str(&self) -> &'static str {
        match self {
            Self::Retired => "Retired",
            Self::Reset => "Reset",
            Self::Stopped => "Stopped",
            Self::Destroyed => "Destroyed",
            Self::Cancelled => "Cancelled",
            Self::MaxAttemptsExhausted => "MaxAttemptsExhausted",
        }
    }
}
impl std::convert::TryFrom<&str> for InputAbandonReason {
    type Error = String;
    fn try_from(value: &str) -> Result<Self, Self::Error> {
        match value {
            "Retired" => Ok(Self::Retired),
            "Reset" => Ok(Self::Reset),
            "Stopped" => Ok(Self::Stopped),
            "Destroyed" => Ok(Self::Destroyed),
            "Cancelled" => Ok(Self::Cancelled),
            "MaxAttemptsExhausted" => Ok(Self::MaxAttemptsExhausted),
            other => Err(format!("invalid InputAbandonReason value `{other}`")),
        }
    }
}
impl std::convert::TryFrom<String> for InputAbandonReason {
    type Error = String;
    fn try_from(value: String) -> Result<Self, Self::Error> {
        Self::try_from(value.as_str())
    }
}
impl std::fmt::Display for InputAbandonReason {
    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
        f.write_str(self.as_str())
    }
}
#[derive(
    Debug,
    Clone,
    Default,
    PartialEq,
    Eq,
    PartialOrd,
    Ord,
    Hash,
    serde::Serialize,
    serde::Deserialize,
)]
pub struct InputId(pub String);
impl From<String> for InputId {
    fn from(value: String) -> Self {
        Self(value)
    }
}
impl From<&str> for InputId {
    fn from(value: &str) -> Self {
        Self(value.to_owned())
    }
}
impl std::fmt::Display for InputId {
    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
        f.write_str(&self.0)
    }
}
#[allow(non_camel_case_types)]
#[derive(
    Debug,
    Clone,
    Copy,
    Default,
    PartialEq,
    Eq,
    PartialOrd,
    Ord,
    Hash,
    serde::Serialize,
    serde::Deserialize,
)]
pub enum InputLane {
    #[default]
    #[serde(rename = "Queue")]
    Queue,
    #[serde(rename = "Steer")]
    Steer,
}
impl InputLane {
    pub fn as_str(&self) -> &'static str {
        match self {
            Self::Queue => "Queue",
            Self::Steer => "Steer",
        }
    }
}
impl std::convert::TryFrom<&str> for InputLane {
    type Error = String;
    fn try_from(value: &str) -> Result<Self, Self::Error> {
        match value {
            "Queue" => Ok(Self::Queue),
            "Steer" => Ok(Self::Steer),
            other => Err(format!("invalid InputLane value `{other}`")),
        }
    }
}
impl std::convert::TryFrom<String> for InputLane {
    type Error = String;
    fn try_from(value: String) -> Result<Self, Self::Error> {
        Self::try_from(value.as_str())
    }
}
impl std::fmt::Display for InputLane {
    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
        f.write_str(self.as_str())
    }
}
#[allow(non_camel_case_types)]
#[derive(
    Debug,
    Clone,
    Copy,
    Default,
    PartialEq,
    Eq,
    PartialOrd,
    Ord,
    Hash,
    serde::Serialize,
    serde::Deserialize,
)]
pub enum InputPhase {
    #[default]
    #[serde(rename = "Queued")]
    Queued,
    #[serde(rename = "Staged")]
    Staged,
    #[serde(rename = "Applied")]
    Applied,
    #[serde(rename = "AppliedPendingConsumption")]
    AppliedPendingConsumption,
    #[serde(rename = "Consumed")]
    Consumed,
    #[serde(rename = "Superseded")]
    Superseded,
    #[serde(rename = "Coalesced")]
    Coalesced,
    #[serde(rename = "Abandoned")]
    Abandoned,
}
impl InputPhase {
    pub fn as_str(&self) -> &'static str {
        match self {
            Self::Queued => "Queued",
            Self::Staged => "Staged",
            Self::Applied => "Applied",
            Self::AppliedPendingConsumption => "AppliedPendingConsumption",
            Self::Consumed => "Consumed",
            Self::Superseded => "Superseded",
            Self::Coalesced => "Coalesced",
            Self::Abandoned => "Abandoned",
        }
    }
}
impl std::convert::TryFrom<&str> for InputPhase {
    type Error = String;
    fn try_from(value: &str) -> Result<Self, Self::Error> {
        match value {
            "Queued" => Ok(Self::Queued),
            "Staged" => Ok(Self::Staged),
            "Applied" => Ok(Self::Applied),
            "AppliedPendingConsumption" => Ok(Self::AppliedPendingConsumption),
            "Consumed" => Ok(Self::Consumed),
            "Superseded" => Ok(Self::Superseded),
            "Coalesced" => Ok(Self::Coalesced),
            "Abandoned" => Ok(Self::Abandoned),
            other => Err(format!("invalid InputPhase value `{other}`")),
        }
    }
}
impl std::convert::TryFrom<String> for InputPhase {
    type Error = String;
    fn try_from(value: String) -> Result<Self, Self::Error> {
        Self::try_from(value.as_str())
    }
}
impl std::fmt::Display for InputPhase {
    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
        f.write_str(self.as_str())
    }
}
#[allow(non_camel_case_types)]
#[derive(
    Debug,
    Clone,
    Copy,
    Default,
    PartialEq,
    Eq,
    PartialOrd,
    Ord,
    Hash,
    serde::Serialize,
    serde::Deserialize,
)]
pub enum InputTerminalKind {
    #[default]
    #[serde(rename = "Consumed")]
    Consumed,
    #[serde(rename = "Superseded")]
    Superseded,
    #[serde(rename = "Coalesced")]
    Coalesced,
    #[serde(rename = "Abandoned")]
    Abandoned,
}
impl InputTerminalKind {
    pub fn as_str(&self) -> &'static str {
        match self {
            Self::Consumed => "Consumed",
            Self::Superseded => "Superseded",
            Self::Coalesced => "Coalesced",
            Self::Abandoned => "Abandoned",
        }
    }
}
impl std::convert::TryFrom<&str> for InputTerminalKind {
    type Error = String;
    fn try_from(value: &str) -> Result<Self, Self::Error> {
        match value {
            "Consumed" => Ok(Self::Consumed),
            "Superseded" => Ok(Self::Superseded),
            "Coalesced" => Ok(Self::Coalesced),
            "Abandoned" => Ok(Self::Abandoned),
            other => Err(format!("invalid InputTerminalKind value `{other}`")),
        }
    }
}
impl std::convert::TryFrom<String> for InputTerminalKind {
    type Error = String;
    fn try_from(value: String) -> Result<Self, Self::Error> {
        Self::try_from(value.as_str())
    }
}
impl std::fmt::Display for InputTerminalKind {
    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
        f.write_str(self.as_str())
    }
}
#[allow(non_camel_case_types)]
#[derive(
    Debug,
    Clone,
    Copy,
    Default,
    PartialEq,
    Eq,
    PartialOrd,
    Ord,
    Hash,
    serde::Serialize,
    serde::Deserialize,
)]
pub enum InteractionStreamState {
    #[default]
    #[serde(rename = "Reserved")]
    Reserved,
    #[serde(rename = "Attached")]
    Attached,
    #[serde(rename = "Completed")]
    Completed,
    #[serde(rename = "Expired")]
    Expired,
    #[serde(rename = "ClosedEarly")]
    ClosedEarly,
}
impl InteractionStreamState {
    pub fn as_str(&self) -> &'static str {
        match self {
            Self::Reserved => "Reserved",
            Self::Attached => "Attached",
            Self::Completed => "Completed",
            Self::Expired => "Expired",
            Self::ClosedEarly => "ClosedEarly",
        }
    }
}
impl std::convert::TryFrom<&str> for InteractionStreamState {
    type Error = String;
    fn try_from(value: &str) -> Result<Self, Self::Error> {
        match value {
            "Reserved" => Ok(Self::Reserved),
            "Attached" => Ok(Self::Attached),
            "Completed" => Ok(Self::Completed),
            "Expired" => Ok(Self::Expired),
            "ClosedEarly" => Ok(Self::ClosedEarly),
            other => Err(format!("invalid InteractionStreamState value `{other}`")),
        }
    }
}
impl std::convert::TryFrom<String> for InteractionStreamState {
    type Error = String;
    fn try_from(value: String) -> Result<Self, Self::Error> {
        Self::try_from(value.as_str())
    }
}
impl std::fmt::Display for InteractionStreamState {
    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
        f.write_str(self.as_str())
    }
}
#[allow(non_camel_case_types)]
#[derive(
    Debug,
    Clone,
    Copy,
    Default,
    PartialEq,
    Eq,
    PartialOrd,
    Ord,
    Hash,
    serde::Serialize,
    serde::Deserialize,
)]
pub enum LlmRetryFailureKind {
    #[default]
    #[serde(rename = "RateLimited")]
    RateLimited,
    #[serde(rename = "NetworkTimeout")]
    NetworkTimeout,
    #[serde(rename = "CallTimeout")]
    CallTimeout,
    #[serde(rename = "RetryableProviderError")]
    RetryableProviderError,
}
impl LlmRetryFailureKind {
    pub fn as_str(&self) -> &'static str {
        match self {
            Self::RateLimited => "RateLimited",
            Self::NetworkTimeout => "NetworkTimeout",
            Self::CallTimeout => "CallTimeout",
            Self::RetryableProviderError => "RetryableProviderError",
        }
    }
}
impl std::convert::TryFrom<&str> for LlmRetryFailureKind {
    type Error = String;
    fn try_from(value: &str) -> Result<Self, Self::Error> {
        match value {
            "RateLimited" => Ok(Self::RateLimited),
            "NetworkTimeout" => Ok(Self::NetworkTimeout),
            "CallTimeout" => Ok(Self::CallTimeout),
            "RetryableProviderError" => Ok(Self::RetryableProviderError),
            other => Err(format!("invalid LlmRetryFailureKind value `{other}`")),
        }
    }
}
impl std::convert::TryFrom<String> for LlmRetryFailureKind {
    type Error = String;
    fn try_from(value: String) -> Result<Self, Self::Error> {
        Self::try_from(value.as_str())
    }
}
impl std::fmt::Display for LlmRetryFailureKind {
    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
        f.write_str(self.as_str())
    }
}
#[derive(
    Debug,
    Clone,
    Default,
    PartialEq,
    Eq,
    PartialOrd,
    Ord,
    Hash,
    serde::Serialize,
    serde::Deserialize,
)]
pub struct McpServerId(pub String);
impl From<String> for McpServerId {
    fn from(value: String) -> Self {
        Self(value)
    }
}
impl From<&str> for McpServerId {
    fn from(value: &str) -> Self {
        Self(value.to_owned())
    }
}
impl std::fmt::Display for McpServerId {
    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
        f.write_str(&self.0)
    }
}
#[allow(non_camel_case_types)]
#[derive(
    Debug,
    Clone,
    Copy,
    Default,
    PartialEq,
    Eq,
    PartialOrd,
    Ord,
    Hash,
    serde::Serialize,
    serde::Deserialize,
)]
pub enum McpServerState {
    #[default]
    #[serde(rename = "PendingConnect")]
    PendingConnect,
    #[serde(rename = "Connected")]
    Connected,
    #[serde(rename = "Failed")]
    Failed,
    #[serde(rename = "Disconnected")]
    Disconnected,
}
impl McpServerState {
    pub fn as_str(&self) -> &'static str {
        match self {
            Self::PendingConnect => "PendingConnect",
            Self::Connected => "Connected",
            Self::Failed => "Failed",
            Self::Disconnected => "Disconnected",
        }
    }
}
impl std::convert::TryFrom<&str> for McpServerState {
    type Error = String;
    fn try_from(value: &str) -> Result<Self, Self::Error> {
        match value {
            "PendingConnect" => Ok(Self::PendingConnect),
            "Connected" => Ok(Self::Connected),
            "Failed" => Ok(Self::Failed),
            "Disconnected" => Ok(Self::Disconnected),
            other => Err(format!("invalid McpServerState value `{other}`")),
        }
    }
}
impl std::convert::TryFrom<String> for McpServerState {
    type Error = String;
    fn try_from(value: String) -> Result<Self, Self::Error> {
        Self::try_from(value.as_str())
    }
}
impl std::fmt::Display for McpServerState {
    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
        f.write_str(self.as_str())
    }
}
#[derive(
    Debug,
    Clone,
    Default,
    PartialEq,
    Eq,
    PartialOrd,
    Ord,
    Hash,
    serde::Serialize,
    serde::Deserialize,
)]
pub struct MobId(pub String);
impl From<String> for MobId {
    fn from(value: String) -> Self {
        Self(value)
    }
}
impl From<&str> for MobId {
    fn from(value: &str) -> Self {
        Self(value.to_owned())
    }
}
impl std::fmt::Display for MobId {
    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
        f.write_str(&self.0)
    }
}
#[derive(
    Debug,
    Clone,
    Default,
    PartialEq,
    Eq,
    PartialOrd,
    Ord,
    Hash,
    serde::Serialize,
    serde::Deserialize,
)]
pub struct OperationId(pub String);
impl From<String> for OperationId {
    fn from(value: String) -> Self {
        Self(value)
    }
}
impl From<&str> for OperationId {
    fn from(value: &str) -> Self {
        Self(value.to_owned())
    }
}
impl std::fmt::Display for OperationId {
    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
        f.write_str(&self.0)
    }
}
#[allow(non_camel_case_types)]
#[derive(
    Debug,
    Clone,
    Copy,
    Default,
    PartialEq,
    Eq,
    PartialOrd,
    Ord,
    Hash,
    serde::Serialize,
    serde::Deserialize,
)]
pub enum OperationKind {
    #[default]
    #[serde(rename = "MobMemberChild")]
    MobMemberChild,
    #[serde(rename = "BackgroundToolOp")]
    BackgroundToolOp,
}
impl OperationKind {
    pub fn as_str(&self) -> &'static str {
        match self {
            Self::MobMemberChild => "MobMemberChild",
            Self::BackgroundToolOp => "BackgroundToolOp",
        }
    }
}
impl std::convert::TryFrom<&str> for OperationKind {
    type Error = String;
    fn try_from(value: &str) -> Result<Self, Self::Error> {
        match value {
            "MobMemberChild" => Ok(Self::MobMemberChild),
            "BackgroundToolOp" => Ok(Self::BackgroundToolOp),
            other => Err(format!("invalid OperationKind value `{other}`")),
        }
    }
}
impl std::convert::TryFrom<String> for OperationKind {
    type Error = String;
    fn try_from(value: String) -> Result<Self, Self::Error> {
        Self::try_from(value.as_str())
    }
}
impl std::fmt::Display for OperationKind {
    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
        f.write_str(self.as_str())
    }
}
#[allow(non_camel_case_types)]
#[derive(
    Debug,
    Clone,
    Copy,
    Default,
    PartialEq,
    Eq,
    PartialOrd,
    Ord,
    Hash,
    serde::Serialize,
    serde::Deserialize,
)]
pub enum OperationStatus {
    #[default]
    #[serde(rename = "Absent")]
    Absent,
    #[serde(rename = "Provisioning")]
    Provisioning,
    #[serde(rename = "Running")]
    Running,
    #[serde(rename = "Retiring")]
    Retiring,
    #[serde(rename = "Completed")]
    Completed,
    #[serde(rename = "Failed")]
    Failed,
    #[serde(rename = "Aborted")]
    Aborted,
    #[serde(rename = "Cancelled")]
    Cancelled,
    #[serde(rename = "Retired")]
    Retired,
    #[serde(rename = "Terminated")]
    Terminated,
}
impl OperationStatus {
    pub fn as_str(&self) -> &'static str {
        match self {
            Self::Absent => "Absent",
            Self::Provisioning => "Provisioning",
            Self::Running => "Running",
            Self::Retiring => "Retiring",
            Self::Completed => "Completed",
            Self::Failed => "Failed",
            Self::Aborted => "Aborted",
            Self::Cancelled => "Cancelled",
            Self::Retired => "Retired",
            Self::Terminated => "Terminated",
        }
    }
}
impl std::convert::TryFrom<&str> for OperationStatus {
    type Error = String;
    fn try_from(value: &str) -> Result<Self, Self::Error> {
        match value {
            "Absent" => Ok(Self::Absent),
            "Provisioning" => Ok(Self::Provisioning),
            "Running" => Ok(Self::Running),
            "Retiring" => Ok(Self::Retiring),
            "Completed" => Ok(Self::Completed),
            "Failed" => Ok(Self::Failed),
            "Aborted" => Ok(Self::Aborted),
            "Cancelled" => Ok(Self::Cancelled),
            "Retired" => Ok(Self::Retired),
            "Terminated" => Ok(Self::Terminated),
            other => Err(format!("invalid OperationStatus value `{other}`")),
        }
    }
}
impl std::convert::TryFrom<String> for OperationStatus {
    type Error = String;
    fn try_from(value: String) -> Result<Self, Self::Error> {
        Self::try_from(value.as_str())
    }
}
impl std::fmt::Display for OperationStatus {
    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
        f.write_str(self.as_str())
    }
}
#[allow(non_camel_case_types)]
#[derive(
    Debug,
    Clone,
    Copy,
    Default,
    PartialEq,
    Eq,
    PartialOrd,
    Ord,
    Hash,
    serde::Serialize,
    serde::Deserialize,
)]
pub enum OperationTerminalOutcomeKind {
    #[default]
    #[serde(rename = "Completed")]
    Completed,
    #[serde(rename = "Failed")]
    Failed,
    #[serde(rename = "Aborted")]
    Aborted,
    #[serde(rename = "Cancelled")]
    Cancelled,
    #[serde(rename = "Retired")]
    Retired,
    #[serde(rename = "Terminated")]
    Terminated,
}
impl OperationTerminalOutcomeKind {
    pub fn as_str(&self) -> &'static str {
        match self {
            Self::Completed => "Completed",
            Self::Failed => "Failed",
            Self::Aborted => "Aborted",
            Self::Cancelled => "Cancelled",
            Self::Retired => "Retired",
            Self::Terminated => "Terminated",
        }
    }
}
impl std::convert::TryFrom<&str> for OperationTerminalOutcomeKind {
    type Error = String;
    fn try_from(value: &str) -> Result<Self, Self::Error> {
        match value {
            "Completed" => Ok(Self::Completed),
            "Failed" => Ok(Self::Failed),
            "Aborted" => Ok(Self::Aborted),
            "Cancelled" => Ok(Self::Cancelled),
            "Retired" => Ok(Self::Retired),
            "Terminated" => Ok(Self::Terminated),
            other => Err(format!(
                "invalid OperationTerminalOutcomeKind value `{other}`"
            )),
        }
    }
}
impl std::convert::TryFrom<String> for OperationTerminalOutcomeKind {
    type Error = String;
    fn try_from(value: String) -> Result<Self, Self::Error> {
        Self::try_from(value.as_str())
    }
}
impl std::fmt::Display for OperationTerminalOutcomeKind {
    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
        f.write_str(self.as_str())
    }
}
#[allow(non_camel_case_types)]
#[derive(
    Debug,
    Clone,
    Copy,
    Default,
    PartialEq,
    Eq,
    PartialOrd,
    Ord,
    Hash,
    serde::Serialize,
    serde::Deserialize,
)]
pub enum OutboundPeerRequestState {
    #[default]
    #[serde(rename = "Sent")]
    Sent,
    #[serde(rename = "AcceptedProgress")]
    AcceptedProgress,
    #[serde(rename = "Completed")]
    Completed,
    #[serde(rename = "Failed")]
    Failed,
    #[serde(rename = "TimedOut")]
    TimedOut,
}
impl OutboundPeerRequestState {
    pub fn as_str(&self) -> &'static str {
        match self {
            Self::Sent => "Sent",
            Self::AcceptedProgress => "AcceptedProgress",
            Self::Completed => "Completed",
            Self::Failed => "Failed",
            Self::TimedOut => "TimedOut",
        }
    }
}
impl std::convert::TryFrom<&str> for OutboundPeerRequestState {
    type Error = String;
    fn try_from(value: &str) -> Result<Self, Self::Error> {
        match value {
            "Sent" => Ok(Self::Sent),
            "AcceptedProgress" => Ok(Self::AcceptedProgress),
            "Completed" => Ok(Self::Completed),
            "Failed" => Ok(Self::Failed),
            "TimedOut" => Ok(Self::TimedOut),
            other => Err(format!("invalid OutboundPeerRequestState value `{other}`")),
        }
    }
}
impl std::convert::TryFrom<String> for OutboundPeerRequestState {
    type Error = String;
    fn try_from(value: String) -> Result<Self, Self::Error> {
        Self::try_from(value.as_str())
    }
}
impl std::fmt::Display for OutboundPeerRequestState {
    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
        f.write_str(self.as_str())
    }
}
#[derive(
    Debug,
    Clone,
    Default,
    PartialEq,
    Eq,
    PartialOrd,
    Ord,
    Hash,
    serde::Serialize,
    serde::Deserialize,
)]
pub struct PeerCorrelationId(pub String);
impl From<String> for PeerCorrelationId {
    fn from(value: String) -> Self {
        Self(value)
    }
}
impl From<&str> for PeerCorrelationId {
    fn from(value: &str) -> Self {
        Self(value.to_owned())
    }
}
impl std::fmt::Display for PeerCorrelationId {
    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
        f.write_str(&self.0)
    }
}
pub type PeerEndpoint = meerkat_machine_schema::catalog::dsl::meerkat_machine::PeerEndpoint;
#[allow(non_camel_case_types)]
#[derive(
    Debug,
    Clone,
    Copy,
    Default,
    PartialEq,
    Eq,
    PartialOrd,
    Ord,
    Hash,
    serde::Serialize,
    serde::Deserialize,
)]
pub enum PeerIngressAdmittedKind {
    #[default]
    #[serde(rename = "Message")]
    Message,
    #[serde(rename = "Request")]
    Request,
    #[serde(rename = "Response")]
    Response,
    #[serde(rename = "Ack")]
    Ack,
    #[serde(rename = "PlainEvent")]
    PlainEvent,
}
impl PeerIngressAdmittedKind {
    pub fn as_str(&self) -> &'static str {
        match self {
            Self::Message => "Message",
            Self::Request => "Request",
            Self::Response => "Response",
            Self::Ack => "Ack",
            Self::PlainEvent => "PlainEvent",
        }
    }
}
impl std::convert::TryFrom<&str> for PeerIngressAdmittedKind {
    type Error = String;
    fn try_from(value: &str) -> Result<Self, Self::Error> {
        match value {
            "Message" => Ok(Self::Message),
            "Request" => Ok(Self::Request),
            "Response" => Ok(Self::Response),
            "Ack" => Ok(Self::Ack),
            "PlainEvent" => Ok(Self::PlainEvent),
            other => Err(format!("invalid PeerIngressAdmittedKind value `{other}`")),
        }
    }
}
impl std::convert::TryFrom<String> for PeerIngressAdmittedKind {
    type Error = String;
    fn try_from(value: String) -> Result<Self, Self::Error> {
        Self::try_from(value.as_str())
    }
}
impl std::fmt::Display for PeerIngressAdmittedKind {
    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
        f.write_str(self.as_str())
    }
}
#[allow(non_camel_case_types)]
#[derive(
    Debug,
    Clone,
    Copy,
    Default,
    PartialEq,
    Eq,
    PartialOrd,
    Ord,
    Hash,
    serde::Serialize,
    serde::Deserialize,
)]
pub enum PeerIngressAuthClass {
    #[default]
    #[serde(rename = "Required")]
    Required,
    #[serde(rename = "SupervisorBridgeExempt")]
    SupervisorBridgeExempt,
}
impl PeerIngressAuthClass {
    pub fn as_str(&self) -> &'static str {
        match self {
            Self::Required => "Required",
            Self::SupervisorBridgeExempt => "SupervisorBridgeExempt",
        }
    }
}
impl std::convert::TryFrom<&str> for PeerIngressAuthClass {
    type Error = String;
    fn try_from(value: &str) -> Result<Self, Self::Error> {
        match value {
            "Required" => Ok(Self::Required),
            "SupervisorBridgeExempt" => Ok(Self::SupervisorBridgeExempt),
            other => Err(format!("invalid PeerIngressAuthClass value `{other}`")),
        }
    }
}
impl std::convert::TryFrom<String> for PeerIngressAuthClass {
    type Error = String;
    fn try_from(value: String) -> Result<Self, Self::Error> {
        Self::try_from(value.as_str())
    }
}
impl std::fmt::Display for PeerIngressAuthClass {
    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
        f.write_str(self.as_str())
    }
}
#[allow(non_camel_case_types)]
#[derive(
    Debug,
    Clone,
    Copy,
    Default,
    PartialEq,
    Eq,
    PartialOrd,
    Ord,
    Hash,
    serde::Serialize,
    serde::Deserialize,
)]
pub enum PeerIngressEnvelopeClass {
    #[default]
    #[serde(rename = "Message")]
    Message,
    #[serde(rename = "Request")]
    Request,
    #[serde(rename = "Lifecycle")]
    Lifecycle,
    #[serde(rename = "Response")]
    Response,
    #[serde(rename = "Ack")]
    Ack,
}
impl PeerIngressEnvelopeClass {
    pub fn as_str(&self) -> &'static str {
        match self {
            Self::Message => "Message",
            Self::Request => "Request",
            Self::Lifecycle => "Lifecycle",
            Self::Response => "Response",
            Self::Ack => "Ack",
        }
    }
}
impl std::convert::TryFrom<&str> for PeerIngressEnvelopeClass {
    type Error = String;
    fn try_from(value: &str) -> Result<Self, Self::Error> {
        match value {
            "Message" => Ok(Self::Message),
            "Request" => Ok(Self::Request),
            "Lifecycle" => Ok(Self::Lifecycle),
            "Response" => Ok(Self::Response),
            "Ack" => Ok(Self::Ack),
            other => Err(format!("invalid PeerIngressEnvelopeClass value `{other}`")),
        }
    }
}
impl std::convert::TryFrom<String> for PeerIngressEnvelopeClass {
    type Error = String;
    fn try_from(value: String) -> Result<Self, Self::Error> {
        Self::try_from(value.as_str())
    }
}
impl std::fmt::Display for PeerIngressEnvelopeClass {
    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
        f.write_str(self.as_str())
    }
}
#[allow(non_camel_case_types)]
#[derive(
    Debug,
    Clone,
    Copy,
    Default,
    PartialEq,
    Eq,
    PartialOrd,
    Ord,
    Hash,
    serde::Serialize,
    serde::Deserialize,
)]
pub enum PeerIngressInputClass {
    #[default]
    #[serde(rename = "ActionableMessage")]
    ActionableMessage,
    #[serde(rename = "ActionableRequest")]
    ActionableRequest,
    #[serde(rename = "ResponseProgress")]
    ResponseProgress,
    #[serde(rename = "ResponseTerminal")]
    ResponseTerminal,
    #[serde(rename = "PeerLifecycleAdded")]
    PeerLifecycleAdded,
    #[serde(rename = "PeerLifecycleRetired")]
    PeerLifecycleRetired,
    #[serde(rename = "PeerLifecycleUnwired")]
    PeerLifecycleUnwired,
    #[serde(rename = "SilentRequest")]
    SilentRequest,
    #[serde(rename = "Ack")]
    Ack,
    #[serde(rename = "PlainEvent")]
    PlainEvent,
}
impl PeerIngressInputClass {
    pub fn as_str(&self) -> &'static str {
        match self {
            Self::ActionableMessage => "ActionableMessage",
            Self::ActionableRequest => "ActionableRequest",
            Self::ResponseProgress => "ResponseProgress",
            Self::ResponseTerminal => "ResponseTerminal",
            Self::PeerLifecycleAdded => "PeerLifecycleAdded",
            Self::PeerLifecycleRetired => "PeerLifecycleRetired",
            Self::PeerLifecycleUnwired => "PeerLifecycleUnwired",
            Self::SilentRequest => "SilentRequest",
            Self::Ack => "Ack",
            Self::PlainEvent => "PlainEvent",
        }
    }
}
impl std::convert::TryFrom<&str> for PeerIngressInputClass {
    type Error = String;
    fn try_from(value: &str) -> Result<Self, Self::Error> {
        match value {
            "ActionableMessage" => Ok(Self::ActionableMessage),
            "ActionableRequest" => Ok(Self::ActionableRequest),
            "ResponseProgress" => Ok(Self::ResponseProgress),
            "ResponseTerminal" => Ok(Self::ResponseTerminal),
            "PeerLifecycleAdded" => Ok(Self::PeerLifecycleAdded),
            "PeerLifecycleRetired" => Ok(Self::PeerLifecycleRetired),
            "PeerLifecycleUnwired" => Ok(Self::PeerLifecycleUnwired),
            "SilentRequest" => Ok(Self::SilentRequest),
            "Ack" => Ok(Self::Ack),
            "PlainEvent" => Ok(Self::PlainEvent),
            other => Err(format!("invalid PeerIngressInputClass value `{other}`")),
        }
    }
}
impl std::convert::TryFrom<String> for PeerIngressInputClass {
    type Error = String;
    fn try_from(value: String) -> Result<Self, Self::Error> {
        Self::try_from(value.as_str())
    }
}
impl std::fmt::Display for PeerIngressInputClass {
    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
        f.write_str(self.as_str())
    }
}
#[allow(non_camel_case_types)]
#[derive(
    Debug,
    Clone,
    Copy,
    Default,
    PartialEq,
    Eq,
    PartialOrd,
    Ord,
    Hash,
    serde::Serialize,
    serde::Deserialize,
)]
pub enum PeerIngressLifecycleClass {
    #[default]
    #[serde(rename = "PeerAdded")]
    PeerAdded,
    #[serde(rename = "PeerRetired")]
    PeerRetired,
    #[serde(rename = "PeerUnwired")]
    PeerUnwired,
}
impl PeerIngressLifecycleClass {
    pub fn as_str(&self) -> &'static str {
        match self {
            Self::PeerAdded => "PeerAdded",
            Self::PeerRetired => "PeerRetired",
            Self::PeerUnwired => "PeerUnwired",
        }
    }
}
impl std::convert::TryFrom<&str> for PeerIngressLifecycleClass {
    type Error = String;
    fn try_from(value: &str) -> Result<Self, Self::Error> {
        match value {
            "PeerAdded" => Ok(Self::PeerAdded),
            "PeerRetired" => Ok(Self::PeerRetired),
            "PeerUnwired" => Ok(Self::PeerUnwired),
            other => Err(format!("invalid PeerIngressLifecycleClass value `{other}`")),
        }
    }
}
impl std::convert::TryFrom<String> for PeerIngressLifecycleClass {
    type Error = String;
    fn try_from(value: String) -> Result<Self, Self::Error> {
        Self::try_from(value.as_str())
    }
}
impl std::fmt::Display for PeerIngressLifecycleClass {
    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
        f.write_str(self.as_str())
    }
}
#[allow(non_camel_case_types)]
#[derive(
    Debug,
    Clone,
    Copy,
    Default,
    PartialEq,
    Eq,
    PartialOrd,
    Ord,
    Hash,
    serde::Serialize,
    serde::Deserialize,
)]
pub enum PeerIngressOwnerKind {
    #[default]
    #[serde(rename = "Unattached")]
    Unattached,
    #[serde(rename = "SessionOwned")]
    SessionOwned,
    #[serde(rename = "MobOwned")]
    MobOwned,
}
impl PeerIngressOwnerKind {
    pub fn as_str(&self) -> &'static str {
        match self {
            Self::Unattached => "Unattached",
            Self::SessionOwned => "SessionOwned",
            Self::MobOwned => "MobOwned",
        }
    }
}
impl std::convert::TryFrom<&str> for PeerIngressOwnerKind {
    type Error = String;
    fn try_from(value: &str) -> Result<Self, Self::Error> {
        match value {
            "Unattached" => Ok(Self::Unattached),
            "SessionOwned" => Ok(Self::SessionOwned),
            "MobOwned" => Ok(Self::MobOwned),
            other => Err(format!("invalid PeerIngressOwnerKind value `{other}`")),
        }
    }
}
impl std::convert::TryFrom<String> for PeerIngressOwnerKind {
    type Error = String;
    fn try_from(value: String) -> Result<Self, Self::Error> {
        Self::try_from(value.as_str())
    }
}
impl std::fmt::Display for PeerIngressOwnerKind {
    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
        f.write_str(self.as_str())
    }
}
#[allow(non_camel_case_types)]
#[derive(
    Debug,
    Clone,
    Copy,
    Default,
    PartialEq,
    Eq,
    PartialOrd,
    Ord,
    Hash,
    serde::Serialize,
    serde::Deserialize,
)]
pub enum PeerIngressResponseStatus {
    #[default]
    #[serde(rename = "Accepted")]
    Accepted,
    #[serde(rename = "Completed")]
    Completed,
    #[serde(rename = "Failed")]
    Failed,
}
impl PeerIngressResponseStatus {
    pub fn as_str(&self) -> &'static str {
        match self {
            Self::Accepted => "Accepted",
            Self::Completed => "Completed",
            Self::Failed => "Failed",
        }
    }
}
impl std::convert::TryFrom<&str> for PeerIngressResponseStatus {
    type Error = String;
    fn try_from(value: &str) -> Result<Self, Self::Error> {
        match value {
            "Accepted" => Ok(Self::Accepted),
            "Completed" => Ok(Self::Completed),
            "Failed" => Ok(Self::Failed),
            other => Err(format!("invalid PeerIngressResponseStatus value `{other}`")),
        }
    }
}
impl std::convert::TryFrom<String> for PeerIngressResponseStatus {
    type Error = String;
    fn try_from(value: String) -> Result<Self, Self::Error> {
        Self::try_from(value.as_str())
    }
}
impl std::fmt::Display for PeerIngressResponseStatus {
    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
        f.write_str(self.as_str())
    }
}
#[allow(non_camel_case_types)]
#[derive(
    Debug,
    Clone,
    Copy,
    Default,
    PartialEq,
    Eq,
    PartialOrd,
    Ord,
    Hash,
    serde::Serialize,
    serde::Deserialize,
)]
pub enum PeerIngressResponseTerminality {
    #[default]
    #[serde(rename = "Progress")]
    Progress,
    #[serde(rename = "TerminalCompleted")]
    TerminalCompleted,
    #[serde(rename = "TerminalFailed")]
    TerminalFailed,
}
impl PeerIngressResponseTerminality {
    pub fn as_str(&self) -> &'static str {
        match self {
            Self::Progress => "Progress",
            Self::TerminalCompleted => "TerminalCompleted",
            Self::TerminalFailed => "TerminalFailed",
        }
    }
}
impl std::convert::TryFrom<&str> for PeerIngressResponseTerminality {
    type Error = String;
    fn try_from(value: &str) -> Result<Self, Self::Error> {
        match value {
            "Progress" => Ok(Self::Progress),
            "TerminalCompleted" => Ok(Self::TerminalCompleted),
            "TerminalFailed" => Ok(Self::TerminalFailed),
            other => Err(format!(
                "invalid PeerIngressResponseTerminality value `{other}`"
            )),
        }
    }
}
impl std::convert::TryFrom<String> for PeerIngressResponseTerminality {
    type Error = String;
    fn try_from(value: String) -> Result<Self, Self::Error> {
        Self::try_from(value.as_str())
    }
}
impl std::fmt::Display for PeerIngressResponseTerminality {
    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
        f.write_str(self.as_str())
    }
}
#[allow(non_camel_case_types)]
#[derive(
    Debug,
    Clone,
    Copy,
    Default,
    PartialEq,
    Eq,
    PartialOrd,
    Ord,
    Hash,
    serde::Serialize,
    serde::Deserialize,
)]
pub enum PeerTerminalDisposition {
    #[default]
    #[serde(rename = "Completed")]
    Completed,
    #[serde(rename = "Failed")]
    Failed,
}
impl PeerTerminalDisposition {
    pub fn as_str(&self) -> &'static str {
        match self {
            Self::Completed => "Completed",
            Self::Failed => "Failed",
        }
    }
}
impl std::convert::TryFrom<&str> for PeerTerminalDisposition {
    type Error = String;
    fn try_from(value: &str) -> Result<Self, Self::Error> {
        match value {
            "Completed" => Ok(Self::Completed),
            "Failed" => Ok(Self::Failed),
            other => Err(format!("invalid PeerTerminalDisposition value `{other}`")),
        }
    }
}
impl std::convert::TryFrom<String> for PeerTerminalDisposition {
    type Error = String;
    fn try_from(value: String) -> Result<Self, Self::Error> {
        Self::try_from(value.as_str())
    }
}
impl std::fmt::Display for PeerTerminalDisposition {
    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
        f.write_str(self.as_str())
    }
}
#[allow(non_camel_case_types)]
#[derive(
    Debug,
    Clone,
    Copy,
    Default,
    PartialEq,
    Eq,
    PartialOrd,
    Ord,
    Hash,
    serde::Serialize,
    serde::Deserialize,
)]
pub enum PostAdmissionSignalKind {
    #[default]
    #[serde(rename = "WakeLoop")]
    WakeLoop,
    #[serde(rename = "InterruptYielding")]
    InterruptYielding,
    #[serde(rename = "RequestImmediateProcessing")]
    RequestImmediateProcessing,
}
impl PostAdmissionSignalKind {
    pub fn as_str(&self) -> &'static str {
        match self {
            Self::WakeLoop => "WakeLoop",
            Self::InterruptYielding => "InterruptYielding",
            Self::RequestImmediateProcessing => "RequestImmediateProcessing",
        }
    }
}
impl std::convert::TryFrom<&str> for PostAdmissionSignalKind {
    type Error = String;
    fn try_from(value: &str) -> Result<Self, Self::Error> {
        match value {
            "WakeLoop" => Ok(Self::WakeLoop),
            "InterruptYielding" => Ok(Self::InterruptYielding),
            "RequestImmediateProcessing" => Ok(Self::RequestImmediateProcessing),
            other => Err(format!("invalid PostAdmissionSignalKind value `{other}`")),
        }
    }
}
impl std::convert::TryFrom<String> for PostAdmissionSignalKind {
    type Error = String;
    fn try_from(value: String) -> Result<Self, Self::Error> {
        Self::try_from(value.as_str())
    }
}
impl std::fmt::Display for PostAdmissionSignalKind {
    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
        f.write_str(self.as_str())
    }
}
#[allow(non_camel_case_types)]
#[derive(
    Debug,
    Clone,
    Copy,
    Default,
    PartialEq,
    Eq,
    PartialOrd,
    Ord,
    Hash,
    serde::Serialize,
    serde::Deserialize,
)]
pub enum PreRunPhase {
    #[default]
    #[serde(rename = "Idle")]
    Idle,
    #[serde(rename = "Attached")]
    Attached,
    #[serde(rename = "Retired")]
    Retired,
}
impl PreRunPhase {
    pub fn as_str(&self) -> &'static str {
        match self {
            Self::Idle => "Idle",
            Self::Attached => "Attached",
            Self::Retired => "Retired",
        }
    }
}
impl std::convert::TryFrom<&str> for PreRunPhase {
    type Error = String;
    fn try_from(value: &str) -> Result<Self, Self::Error> {
        match value {
            "Idle" => Ok(Self::Idle),
            "Attached" => Ok(Self::Attached),
            "Retired" => Ok(Self::Retired),
            other => Err(format!("invalid PreRunPhase value `{other}`")),
        }
    }
}
impl std::convert::TryFrom<String> for PreRunPhase {
    type Error = String;
    fn try_from(value: String) -> Result<Self, Self::Error> {
        Self::try_from(value.as_str())
    }
}
impl std::fmt::Display for PreRunPhase {
    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
        f.write_str(self.as_str())
    }
}
#[allow(non_camel_case_types)]
#[derive(
    Debug,
    Clone,
    Copy,
    Default,
    PartialEq,
    Eq,
    PartialOrd,
    Ord,
    Hash,
    serde::Serialize,
    serde::Deserialize,
)]
pub enum RegistrationPhase {
    #[default]
    #[serde(rename = "Queuing")]
    Queuing,
    #[serde(rename = "Active")]
    Active,
}
impl RegistrationPhase {
    pub fn as_str(&self) -> &'static str {
        match self {
            Self::Queuing => "Queuing",
            Self::Active => "Active",
        }
    }
}
impl std::convert::TryFrom<&str> for RegistrationPhase {
    type Error = String;
    fn try_from(value: &str) -> Result<Self, Self::Error> {
        match value {
            "Queuing" => Ok(Self::Queuing),
            "Active" => Ok(Self::Active),
            other => Err(format!("invalid RegistrationPhase value `{other}`")),
        }
    }
}
impl std::convert::TryFrom<String> for RegistrationPhase {
    type Error = String;
    fn try_from(value: String) -> Result<Self, Self::Error> {
        Self::try_from(value.as_str())
    }
}
impl std::fmt::Display for RegistrationPhase {
    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
        f.write_str(self.as_str())
    }
}
#[allow(non_camel_case_types)]
#[derive(
    Debug,
    Clone,
    Copy,
    Default,
    PartialEq,
    Eq,
    PartialOrd,
    Ord,
    Hash,
    serde::Serialize,
    serde::Deserialize,
)]
pub enum RoutingApprovalParentKind {
    #[default]
    #[serde(rename = "SwitchTurn")]
    SwitchTurn,
    #[serde(rename = "ImageOperation")]
    ImageOperation,
}
impl RoutingApprovalParentKind {
    pub fn as_str(&self) -> &'static str {
        match self {
            Self::SwitchTurn => "SwitchTurn",
            Self::ImageOperation => "ImageOperation",
        }
    }
}
impl std::convert::TryFrom<&str> for RoutingApprovalParentKind {
    type Error = String;
    fn try_from(value: &str) -> Result<Self, Self::Error> {
        match value {
            "SwitchTurn" => Ok(Self::SwitchTurn),
            "ImageOperation" => Ok(Self::ImageOperation),
            other => Err(format!("invalid RoutingApprovalParentKind value `{other}`")),
        }
    }
}
impl std::convert::TryFrom<String> for RoutingApprovalParentKind {
    type Error = String;
    fn try_from(value: String) -> Result<Self, Self::Error> {
        Self::try_from(value.as_str())
    }
}
impl std::fmt::Display for RoutingApprovalParentKind {
    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
        f.write_str(self.as_str())
    }
}
#[allow(non_camel_case_types)]
#[derive(
    Debug,
    Clone,
    Copy,
    Default,
    PartialEq,
    Eq,
    PartialOrd,
    Ord,
    Hash,
    serde::Serialize,
    serde::Deserialize,
)]
pub enum RoutingApprovalPhase {
    #[default]
    #[serde(rename = "Pending")]
    Pending,
    #[serde(rename = "PresentedToUser")]
    PresentedToUser,
    #[serde(rename = "Approved")]
    Approved,
    #[serde(rename = "Denied")]
    Denied,
    #[serde(rename = "SurfaceDetached")]
    SurfaceDetached,
}
impl RoutingApprovalPhase {
    pub fn as_str(&self) -> &'static str {
        match self {
            Self::Pending => "Pending",
            Self::PresentedToUser => "PresentedToUser",
            Self::Approved => "Approved",
            Self::Denied => "Denied",
            Self::SurfaceDetached => "SurfaceDetached",
        }
    }
}
impl std::convert::TryFrom<&str> for RoutingApprovalPhase {
    type Error = String;
    fn try_from(value: &str) -> Result<Self, Self::Error> {
        match value {
            "Pending" => Ok(Self::Pending),
            "PresentedToUser" => Ok(Self::PresentedToUser),
            "Approved" => Ok(Self::Approved),
            "Denied" => Ok(Self::Denied),
            "SurfaceDetached" => Ok(Self::SurfaceDetached),
            other => Err(format!("invalid RoutingApprovalPhase value `{other}`")),
        }
    }
}
impl std::convert::TryFrom<String> for RoutingApprovalPhase {
    type Error = String;
    fn try_from(value: String) -> Result<Self, Self::Error> {
        Self::try_from(value.as_str())
    }
}
impl std::fmt::Display for RoutingApprovalPhase {
    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
        f.write_str(self.as_str())
    }
}
#[allow(non_camel_case_types)]
#[derive(
    Debug,
    Clone,
    Copy,
    Default,
    PartialEq,
    Eq,
    PartialOrd,
    Ord,
    Hash,
    serde::Serialize,
    serde::Deserialize,
)]
pub enum RoutingDenialReason {
    #[default]
    #[serde(rename = "CapabilityPolicy")]
    CapabilityPolicy,
    #[serde(rename = "ApprovalRequiredButUnavailable")]
    ApprovalRequiredButUnavailable,
    #[serde(rename = "DeniedDuringApproval")]
    DeniedDuringApproval,
    #[serde(rename = "ScopedOverrideConflict")]
    ScopedOverrideConflict,
    #[serde(rename = "RealtimeTransportConflict")]
    RealtimeTransportConflict,
}
impl RoutingDenialReason {
    pub fn as_str(&self) -> &'static str {
        match self {
            Self::CapabilityPolicy => "CapabilityPolicy",
            Self::ApprovalRequiredButUnavailable => "ApprovalRequiredButUnavailable",
            Self::DeniedDuringApproval => "DeniedDuringApproval",
            Self::ScopedOverrideConflict => "ScopedOverrideConflict",
            Self::RealtimeTransportConflict => "RealtimeTransportConflict",
        }
    }
}
impl std::convert::TryFrom<&str> for RoutingDenialReason {
    type Error = String;
    fn try_from(value: &str) -> Result<Self, Self::Error> {
        match value {
            "CapabilityPolicy" => Ok(Self::CapabilityPolicy),
            "ApprovalRequiredButUnavailable" => Ok(Self::ApprovalRequiredButUnavailable),
            "DeniedDuringApproval" => Ok(Self::DeniedDuringApproval),
            "ScopedOverrideConflict" => Ok(Self::ScopedOverrideConflict),
            "RealtimeTransportConflict" => Ok(Self::RealtimeTransportConflict),
            other => Err(format!("invalid RoutingDenialReason value `{other}`")),
        }
    }
}
impl std::convert::TryFrom<String> for RoutingDenialReason {
    type Error = String;
    fn try_from(value: String) -> Result<Self, Self::Error> {
        Self::try_from(value.as_str())
    }
}
impl std::fmt::Display for RoutingDenialReason {
    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
        f.write_str(self.as_str())
    }
}
#[allow(non_camel_case_types)]
#[derive(
    Debug,
    Clone,
    Copy,
    Default,
    PartialEq,
    Eq,
    PartialOrd,
    Ord,
    Hash,
    serde::Serialize,
    serde::Deserialize,
)]
pub enum RoutingImageOperationPhase {
    #[default]
    #[serde(rename = "Requested")]
    Requested,
    #[serde(rename = "PlanResolved")]
    PlanResolved,
    #[serde(rename = "ScopedOverrideActive")]
    ScopedOverrideActive,
    #[serde(rename = "ProviderCallInFlight")]
    ProviderCallInFlight,
    #[serde(rename = "ResultCommitted")]
    ResultCommitted,
    #[serde(rename = "RestoringScopedOverride")]
    RestoringScopedOverride,
    #[serde(rename = "Terminal")]
    Terminal,
}
impl RoutingImageOperationPhase {
    pub fn as_str(&self) -> &'static str {
        match self {
            Self::Requested => "Requested",
            Self::PlanResolved => "PlanResolved",
            Self::ScopedOverrideActive => "ScopedOverrideActive",
            Self::ProviderCallInFlight => "ProviderCallInFlight",
            Self::ResultCommitted => "ResultCommitted",
            Self::RestoringScopedOverride => "RestoringScopedOverride",
            Self::Terminal => "Terminal",
        }
    }
}
impl std::convert::TryFrom<&str> for RoutingImageOperationPhase {
    type Error = String;
    fn try_from(value: &str) -> Result<Self, Self::Error> {
        match value {
            "Requested" => Ok(Self::Requested),
            "PlanResolved" => Ok(Self::PlanResolved),
            "ScopedOverrideActive" => Ok(Self::ScopedOverrideActive),
            "ProviderCallInFlight" => Ok(Self::ProviderCallInFlight),
            "ResultCommitted" => Ok(Self::ResultCommitted),
            "RestoringScopedOverride" => Ok(Self::RestoringScopedOverride),
            "Terminal" => Ok(Self::Terminal),
            other => Err(format!(
                "invalid RoutingImageOperationPhase value `{other}`"
            )),
        }
    }
}
impl std::convert::TryFrom<String> for RoutingImageOperationPhase {
    type Error = String;
    fn try_from(value: String) -> Result<Self, Self::Error> {
        Self::try_from(value.as_str())
    }
}
impl std::fmt::Display for RoutingImageOperationPhase {
    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
        f.write_str(self.as_str())
    }
}
#[allow(non_camel_case_types)]
#[derive(
    Debug,
    Clone,
    Copy,
    Default,
    PartialEq,
    Eq,
    PartialOrd,
    Ord,
    Hash,
    serde::Serialize,
    serde::Deserialize,
)]
pub enum RoutingImageTerminal {
    #[default]
    #[serde(rename = "Generated")]
    Generated,
    #[serde(rename = "Denied")]
    Denied,
    #[serde(rename = "EmptyResult")]
    EmptyResult,
    #[serde(rename = "RefusedByProvider")]
    RefusedByProvider,
    #[serde(rename = "SafetyFiltered")]
    SafetyFiltered,
    #[serde(rename = "Failed")]
    Failed,
    #[serde(rename = "Cancelled")]
    Cancelled,
    #[serde(rename = "Timeout")]
    Timeout,
    #[serde(rename = "ScopedRestoreFailed")]
    ScopedRestoreFailed,
}
impl RoutingImageTerminal {
    pub fn as_str(&self) -> &'static str {
        match self {
            Self::Generated => "Generated",
            Self::Denied => "Denied",
            Self::EmptyResult => "EmptyResult",
            Self::RefusedByProvider => "RefusedByProvider",
            Self::SafetyFiltered => "SafetyFiltered",
            Self::Failed => "Failed",
            Self::Cancelled => "Cancelled",
            Self::Timeout => "Timeout",
            Self::ScopedRestoreFailed => "ScopedRestoreFailed",
        }
    }
}
impl std::convert::TryFrom<&str> for RoutingImageTerminal {
    type Error = String;
    fn try_from(value: &str) -> Result<Self, Self::Error> {
        match value {
            "Generated" => Ok(Self::Generated),
            "Denied" => Ok(Self::Denied),
            "EmptyResult" => Ok(Self::EmptyResult),
            "RefusedByProvider" => Ok(Self::RefusedByProvider),
            "SafetyFiltered" => Ok(Self::SafetyFiltered),
            "Failed" => Ok(Self::Failed),
            "Cancelled" => Ok(Self::Cancelled),
            "Timeout" => Ok(Self::Timeout),
            "ScopedRestoreFailed" => Ok(Self::ScopedRestoreFailed),
            other => Err(format!("invalid RoutingImageTerminal value `{other}`")),
        }
    }
}
impl std::convert::TryFrom<String> for RoutingImageTerminal {
    type Error = String;
    fn try_from(value: String) -> Result<Self, Self::Error> {
        Self::try_from(value.as_str())
    }
}
impl std::fmt::Display for RoutingImageTerminal {
    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
        f.write_str(self.as_str())
    }
}
#[allow(non_camel_case_types)]
#[derive(
    Debug,
    Clone,
    Copy,
    Default,
    PartialEq,
    Eq,
    PartialOrd,
    Ord,
    Hash,
    serde::Serialize,
    serde::Deserialize,
)]
pub enum RoutingSwitchTurnPhase {
    #[default]
    #[serde(rename = "Requested")]
    Requested,
    #[serde(rename = "PendingForBoundary")]
    PendingForBoundary,
    #[serde(rename = "ActiveFiniteOverride")]
    ActiveFiniteOverride,
    #[serde(rename = "ApplyingPersistentReconfigure")]
    ApplyingPersistentReconfigure,
    #[serde(rename = "Terminal")]
    Terminal,
}
impl RoutingSwitchTurnPhase {
    pub fn as_str(&self) -> &'static str {
        match self {
            Self::Requested => "Requested",
            Self::PendingForBoundary => "PendingForBoundary",
            Self::ActiveFiniteOverride => "ActiveFiniteOverride",
            Self::ApplyingPersistentReconfigure => "ApplyingPersistentReconfigure",
            Self::Terminal => "Terminal",
        }
    }
}
impl std::convert::TryFrom<&str> for RoutingSwitchTurnPhase {
    type Error = String;
    fn try_from(value: &str) -> Result<Self, Self::Error> {
        match value {
            "Requested" => Ok(Self::Requested),
            "PendingForBoundary" => Ok(Self::PendingForBoundary),
            "ActiveFiniteOverride" => Ok(Self::ActiveFiniteOverride),
            "ApplyingPersistentReconfigure" => Ok(Self::ApplyingPersistentReconfigure),
            "Terminal" => Ok(Self::Terminal),
            other => Err(format!("invalid RoutingSwitchTurnPhase value `{other}`")),
        }
    }
}
impl std::convert::TryFrom<String> for RoutingSwitchTurnPhase {
    type Error = String;
    fn try_from(value: String) -> Result<Self, Self::Error> {
        Self::try_from(value.as_str())
    }
}
impl std::fmt::Display for RoutingSwitchTurnPhase {
    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
        f.write_str(self.as_str())
    }
}
#[allow(non_camel_case_types)]
#[derive(
    Debug,
    Clone,
    Copy,
    Default,
    PartialEq,
    Eq,
    PartialOrd,
    Ord,
    Hash,
    serde::Serialize,
    serde::Deserialize,
)]
pub enum RoutingSwitchTurnTerminal {
    #[default]
    #[serde(rename = "Denied")]
    Denied,
    #[serde(rename = "ConsumedAndRestored")]
    ConsumedAndRestored,
    #[serde(rename = "PersistentReconfigureApplied")]
    PersistentReconfigureApplied,
}
impl RoutingSwitchTurnTerminal {
    pub fn as_str(&self) -> &'static str {
        match self {
            Self::Denied => "Denied",
            Self::ConsumedAndRestored => "ConsumedAndRestored",
            Self::PersistentReconfigureApplied => "PersistentReconfigureApplied",
        }
    }
}
impl std::convert::TryFrom<&str> for RoutingSwitchTurnTerminal {
    type Error = String;
    fn try_from(value: &str) -> Result<Self, Self::Error> {
        match value {
            "Denied" => Ok(Self::Denied),
            "ConsumedAndRestored" => Ok(Self::ConsumedAndRestored),
            "PersistentReconfigureApplied" => Ok(Self::PersistentReconfigureApplied),
            other => Err(format!("invalid RoutingSwitchTurnTerminal value `{other}`")),
        }
    }
}
impl std::convert::TryFrom<String> for RoutingSwitchTurnTerminal {
    type Error = String;
    fn try_from(value: String) -> Result<Self, Self::Error> {
        Self::try_from(value.as_str())
    }
}
impl std::fmt::Display for RoutingSwitchTurnTerminal {
    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
        f.write_str(self.as_str())
    }
}
#[derive(
    Debug,
    Clone,
    Default,
    PartialEq,
    Eq,
    PartialOrd,
    Ord,
    Hash,
    serde::Serialize,
    serde::Deserialize,
)]
pub struct RunId(pub String);
impl From<String> for RunId {
    fn from(value: String) -> Self {
        Self(value)
    }
}
impl From<&str> for RunId {
    fn from(value: &str) -> Self {
        Self(value.to_owned())
    }
}
impl std::fmt::Display for RunId {
    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
        f.write_str(&self.0)
    }
}
#[allow(non_camel_case_types)]
#[derive(
    Debug,
    Clone,
    Copy,
    Default,
    PartialEq,
    Eq,
    PartialOrd,
    Ord,
    Hash,
    serde::Serialize,
    serde::Deserialize,
)]
pub enum RuntimeApplyFailureCause {
    #[default]
    #[serde(rename = "Unknown")]
    Unknown,
    #[serde(rename = "PrimitiveRejected")]
    PrimitiveRejected,
    #[serde(rename = "RuntimeContextApply")]
    RuntimeContextApply,
    #[serde(rename = "RuntimeTurn")]
    RuntimeTurn,
    #[serde(rename = "HookDenied")]
    HookDenied,
    #[serde(rename = "HookRuntimeFailure")]
    HookRuntimeFailure,
    #[serde(rename = "ExecutorStopped")]
    ExecutorStopped,
    #[serde(rename = "ExecutorControlFailed")]
    ExecutorControlFailed,
    #[serde(rename = "ExecutorInternal")]
    ExecutorInternal,
}
impl RuntimeApplyFailureCause {
    pub fn as_str(&self) -> &'static str {
        match self {
            Self::Unknown => "Unknown",
            Self::PrimitiveRejected => "PrimitiveRejected",
            Self::RuntimeContextApply => "RuntimeContextApply",
            Self::RuntimeTurn => "RuntimeTurn",
            Self::HookDenied => "HookDenied",
            Self::HookRuntimeFailure => "HookRuntimeFailure",
            Self::ExecutorStopped => "ExecutorStopped",
            Self::ExecutorControlFailed => "ExecutorControlFailed",
            Self::ExecutorInternal => "ExecutorInternal",
        }
    }
}
impl std::convert::TryFrom<&str> for RuntimeApplyFailureCause {
    type Error = String;
    fn try_from(value: &str) -> Result<Self, Self::Error> {
        match value {
            "Unknown" => Ok(Self::Unknown),
            "PrimitiveRejected" => Ok(Self::PrimitiveRejected),
            "RuntimeContextApply" => Ok(Self::RuntimeContextApply),
            "RuntimeTurn" => Ok(Self::RuntimeTurn),
            "HookDenied" => Ok(Self::HookDenied),
            "HookRuntimeFailure" => Ok(Self::HookRuntimeFailure),
            "ExecutorStopped" => Ok(Self::ExecutorStopped),
            "ExecutorControlFailed" => Ok(Self::ExecutorControlFailed),
            "ExecutorInternal" => Ok(Self::ExecutorInternal),
            other => Err(format!("invalid RuntimeApplyFailureCause value `{other}`")),
        }
    }
}
impl std::convert::TryFrom<String> for RuntimeApplyFailureCause {
    type Error = String;
    fn try_from(value: String) -> Result<Self, Self::Error> {
        Self::try_from(value.as_str())
    }
}
impl std::fmt::Display for RuntimeApplyFailureCause {
    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
        f.write_str(self.as_str())
    }
}
#[allow(non_camel_case_types)]
#[derive(
    Debug,
    Clone,
    Copy,
    Default,
    PartialEq,
    Eq,
    PartialOrd,
    Ord,
    Hash,
    serde::Serialize,
    serde::Deserialize,
)]
pub enum RuntimeEffectKind {
    #[default]
    #[serde(rename = "CancelAfterBoundary")]
    CancelAfterBoundary,
    #[serde(rename = "StopRuntimeExecutor")]
    StopRuntimeExecutor,
}
impl RuntimeEffectKind {
    pub fn as_str(&self) -> &'static str {
        match self {
            Self::CancelAfterBoundary => "CancelAfterBoundary",
            Self::StopRuntimeExecutor => "StopRuntimeExecutor",
        }
    }
}
impl std::convert::TryFrom<&str> for RuntimeEffectKind {
    type Error = String;
    fn try_from(value: &str) -> Result<Self, Self::Error> {
        match value {
            "CancelAfterBoundary" => Ok(Self::CancelAfterBoundary),
            "StopRuntimeExecutor" => Ok(Self::StopRuntimeExecutor),
            other => Err(format!("invalid RuntimeEffectKind value `{other}`")),
        }
    }
}
impl std::convert::TryFrom<String> for RuntimeEffectKind {
    type Error = String;
    fn try_from(value: String) -> Result<Self, Self::Error> {
        Self::try_from(value.as_str())
    }
}
impl std::fmt::Display for RuntimeEffectKind {
    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
        f.write_str(self.as_str())
    }
}
#[allow(non_camel_case_types)]
#[derive(
    Debug,
    Clone,
    Copy,
    Default,
    PartialEq,
    Eq,
    PartialOrd,
    Ord,
    Hash,
    serde::Serialize,
    serde::Deserialize,
)]
pub enum RuntimeNoticeKind {
    #[default]
    #[serde(rename = "Drain")]
    Drain,
    #[serde(rename = "Reset")]
    Reset,
    #[serde(rename = "Stop")]
    Stop,
    #[serde(rename = "Exit")]
    Exit,
    #[serde(rename = "Recover")]
    Recover,
}
impl RuntimeNoticeKind {
    pub fn as_str(&self) -> &'static str {
        match self {
            Self::Drain => "Drain",
            Self::Reset => "Reset",
            Self::Stop => "Stop",
            Self::Exit => "Exit",
            Self::Recover => "Recover",
        }
    }
}
impl std::convert::TryFrom<&str> for RuntimeNoticeKind {
    type Error = String;
    fn try_from(value: &str) -> Result<Self, Self::Error> {
        match value {
            "Drain" => Ok(Self::Drain),
            "Reset" => Ok(Self::Reset),
            "Stop" => Ok(Self::Stop),
            "Exit" => Ok(Self::Exit),
            "Recover" => Ok(Self::Recover),
            other => Err(format!("invalid RuntimeNoticeKind value `{other}`")),
        }
    }
}
impl std::convert::TryFrom<String> for RuntimeNoticeKind {
    type Error = String;
    fn try_from(value: String) -> Result<Self, Self::Error> {
        Self::try_from(value.as_str())
    }
}
impl std::fmt::Display for RuntimeNoticeKind {
    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
        f.write_str(self.as_str())
    }
}
#[derive(
    Debug,
    Clone,
    Default,
    PartialEq,
    Eq,
    PartialOrd,
    Ord,
    Hash,
    serde::Serialize,
    serde::Deserialize,
)]
pub struct SessionId(pub String);
impl From<String> for SessionId {
    fn from(value: String) -> Self {
        Self(value)
    }
}
impl From<&str> for SessionId {
    fn from(value: &str) -> Self {
        Self(value.to_owned())
    }
}
impl std::fmt::Display for SessionId {
    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
        f.write_str(&self.0)
    }
}
#[derive(
    Debug,
    Clone,
    Default,
    PartialEq,
    Eq,
    PartialOrd,
    Ord,
    Hash,
    serde::Serialize,
    serde::Deserialize,
)]
pub struct SessionLlmCapabilitySurface(pub String);
impl From<String> for SessionLlmCapabilitySurface {
    fn from(value: String) -> Self {
        Self(value)
    }
}
impl From<&str> for SessionLlmCapabilitySurface {
    fn from(value: &str) -> Self {
        Self(value.to_owned())
    }
}
impl std::fmt::Display for SessionLlmCapabilitySurface {
    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
        f.write_str(&self.0)
    }
}
#[allow(non_camel_case_types)]
#[derive(
    Debug,
    Clone,
    Copy,
    Default,
    PartialEq,
    Eq,
    PartialOrd,
    Ord,
    Hash,
    serde::Serialize,
    serde::Deserialize,
)]
pub enum SessionLlmCapabilitySurfaceStatus {
    #[default]
    #[serde(rename = "Unresolved")]
    Unresolved,
    #[serde(rename = "Resolved")]
    Resolved,
}
impl SessionLlmCapabilitySurfaceStatus {
    pub fn as_str(&self) -> &'static str {
        match self {
            Self::Unresolved => "Unresolved",
            Self::Resolved => "Resolved",
        }
    }
}
impl std::convert::TryFrom<&str> for SessionLlmCapabilitySurfaceStatus {
    type Error = String;
    fn try_from(value: &str) -> Result<Self, Self::Error> {
        match value {
            "Unresolved" => Ok(Self::Unresolved),
            "Resolved" => Ok(Self::Resolved),
            other => Err(format!(
                "invalid SessionLlmCapabilitySurfaceStatus value `{other}`"
            )),
        }
    }
}
impl std::convert::TryFrom<String> for SessionLlmCapabilitySurfaceStatus {
    type Error = String;
    fn try_from(value: String) -> Result<Self, Self::Error> {
        Self::try_from(value.as_str())
    }
}
impl std::fmt::Display for SessionLlmCapabilitySurfaceStatus {
    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
        f.write_str(self.as_str())
    }
}
#[derive(
    Debug,
    Clone,
    Default,
    PartialEq,
    Eq,
    PartialOrd,
    Ord,
    Hash,
    serde::Serialize,
    serde::Deserialize,
)]
pub struct SessionLlmIdentity(pub String);
impl From<String> for SessionLlmIdentity {
    fn from(value: String) -> Self {
        Self(value)
    }
}
impl From<&str> for SessionLlmIdentity {
    fn from(value: &str) -> Self {
        Self(value.to_owned())
    }
}
impl std::fmt::Display for SessionLlmIdentity {
    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
        f.write_str(&self.0)
    }
}
#[derive(
    Debug,
    Clone,
    Default,
    PartialEq,
    Eq,
    PartialOrd,
    Ord,
    Hash,
    serde::Serialize,
    serde::Deserialize,
)]
pub struct SessionToolVisibilityDelta(pub String);
impl From<String> for SessionToolVisibilityDelta {
    fn from(value: String) -> Self {
        Self(value)
    }
}
impl From<&str> for SessionToolVisibilityDelta {
    fn from(value: &str) -> Self {
        Self(value.to_owned())
    }
}
impl std::fmt::Display for SessionToolVisibilityDelta {
    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
        f.write_str(&self.0)
    }
}
#[derive(
    Debug,
    Clone,
    Default,
    PartialEq,
    Eq,
    PartialOrd,
    Ord,
    Hash,
    serde::Serialize,
    serde::Deserialize,
)]
pub struct SessionToolVisibilityState(pub String);
impl From<String> for SessionToolVisibilityState {
    fn from(value: String) -> Self {
        Self(value)
    }
}
impl From<&str> for SessionToolVisibilityState {
    fn from(value: &str) -> Self {
        Self(value.to_owned())
    }
}
impl std::fmt::Display for SessionToolVisibilityState {
    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
        f.write_str(&self.0)
    }
}
#[allow(non_camel_case_types)]
#[derive(
    Debug,
    Clone,
    Copy,
    Default,
    PartialEq,
    Eq,
    PartialOrd,
    Ord,
    Hash,
    serde::Serialize,
    serde::Deserialize,
)]
pub enum SupervisorBindingKind {
    #[default]
    #[serde(rename = "Unbound")]
    Unbound,
    #[serde(rename = "Bound")]
    Bound,
}
impl SupervisorBindingKind {
    pub fn as_str(&self) -> &'static str {
        match self {
            Self::Unbound => "Unbound",
            Self::Bound => "Bound",
        }
    }
}
impl std::convert::TryFrom<&str> for SupervisorBindingKind {
    type Error = String;
    fn try_from(value: &str) -> Result<Self, Self::Error> {
        match value {
            "Unbound" => Ok(Self::Unbound),
            "Bound" => Ok(Self::Bound),
            other => Err(format!("invalid SupervisorBindingKind value `{other}`")),
        }
    }
}
impl std::convert::TryFrom<String> for SupervisorBindingKind {
    type Error = String;
    fn try_from(value: String) -> Result<Self, Self::Error> {
        Self::try_from(value.as_str())
    }
}
impl std::fmt::Display for SupervisorBindingKind {
    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
        f.write_str(self.as_str())
    }
}
#[allow(non_camel_case_types)]
#[derive(
    Debug,
    Clone,
    Copy,
    Default,
    PartialEq,
    Eq,
    PartialOrd,
    Ord,
    Hash,
    serde::Serialize,
    serde::Deserialize,
)]
pub enum SurfacePendingOp {
    #[default]
    #[serde(rename = "None")]
    None,
    #[serde(rename = "Add")]
    Add,
    #[serde(rename = "Reload")]
    Reload,
}
impl SurfacePendingOp {
    pub fn as_str(&self) -> &'static str {
        match self {
            Self::None => "None",
            Self::Add => "Add",
            Self::Reload => "Reload",
        }
    }
}
impl std::convert::TryFrom<&str> for SurfacePendingOp {
    type Error = String;
    fn try_from(value: &str) -> Result<Self, Self::Error> {
        match value {
            "None" => Ok(Self::None),
            "Add" => Ok(Self::Add),
            "Reload" => Ok(Self::Reload),
            other => Err(format!("invalid SurfacePendingOp value `{other}`")),
        }
    }
}
impl std::convert::TryFrom<String> for SurfacePendingOp {
    type Error = String;
    fn try_from(value: String) -> Result<Self, Self::Error> {
        Self::try_from(value.as_str())
    }
}
impl std::fmt::Display for SurfacePendingOp {
    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
        f.write_str(self.as_str())
    }
}
#[allow(non_camel_case_types)]
#[derive(
    Debug,
    Clone,
    Copy,
    Default,
    PartialEq,
    Eq,
    PartialOrd,
    Ord,
    Hash,
    serde::Serialize,
    serde::Deserialize,
)]
pub enum SurfacePhase {
    #[default]
    #[serde(rename = "Operating")]
    Operating,
    #[serde(rename = "Shutdown")]
    Shutdown,
}
impl SurfacePhase {
    pub fn as_str(&self) -> &'static str {
        match self {
            Self::Operating => "Operating",
            Self::Shutdown => "Shutdown",
        }
    }
}
impl std::convert::TryFrom<&str> for SurfacePhase {
    type Error = String;
    fn try_from(value: &str) -> Result<Self, Self::Error> {
        match value {
            "Operating" => Ok(Self::Operating),
            "Shutdown" => Ok(Self::Shutdown),
            other => Err(format!("invalid SurfacePhase value `{other}`")),
        }
    }
}
impl std::convert::TryFrom<String> for SurfacePhase {
    type Error = String;
    fn try_from(value: String) -> Result<Self, Self::Error> {
        Self::try_from(value.as_str())
    }
}
impl std::fmt::Display for SurfacePhase {
    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
        f.write_str(self.as_str())
    }
}
#[allow(non_camel_case_types)]
#[derive(
    Debug,
    Clone,
    Copy,
    Default,
    PartialEq,
    Eq,
    PartialOrd,
    Ord,
    Hash,
    serde::Serialize,
    serde::Deserialize,
)]
pub enum SurfaceStagedOp {
    #[default]
    #[serde(rename = "None")]
    None,
    #[serde(rename = "Add")]
    Add,
    #[serde(rename = "Remove")]
    Remove,
    #[serde(rename = "Reload")]
    Reload,
}
impl SurfaceStagedOp {
    pub fn as_str(&self) -> &'static str {
        match self {
            Self::None => "None",
            Self::Add => "Add",
            Self::Remove => "Remove",
            Self::Reload => "Reload",
        }
    }
}
impl std::convert::TryFrom<&str> for SurfaceStagedOp {
    type Error = String;
    fn try_from(value: &str) -> Result<Self, Self::Error> {
        match value {
            "None" => Ok(Self::None),
            "Add" => Ok(Self::Add),
            "Remove" => Ok(Self::Remove),
            "Reload" => Ok(Self::Reload),
            other => Err(format!("invalid SurfaceStagedOp value `{other}`")),
        }
    }
}
impl std::convert::TryFrom<String> for SurfaceStagedOp {
    type Error = String;
    fn try_from(value: String) -> Result<Self, Self::Error> {
        Self::try_from(value.as_str())
    }
}
impl std::fmt::Display for SurfaceStagedOp {
    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
        f.write_str(self.as_str())
    }
}
pub type ToolFilter = meerkat_machine_schema::catalog::dsl::meerkat_machine::ToolFilter;
pub type ToolVisibilityWitness =
    meerkat_machine_schema::catalog::dsl::meerkat_machine::ToolVisibilityWitness;
#[allow(non_camel_case_types)]
#[derive(
    Debug,
    Clone,
    Copy,
    Default,
    PartialEq,
    Eq,
    PartialOrd,
    Ord,
    Hash,
    serde::Serialize,
    serde::Deserialize,
)]
pub enum TurnCancellationReason {
    #[default]
    #[serde(rename = "Observed")]
    Observed,
}
impl TurnCancellationReason {
    pub fn as_str(&self) -> &'static str {
        match self {
            Self::Observed => "Observed",
        }
    }
}
impl std::convert::TryFrom<&str> for TurnCancellationReason {
    type Error = String;
    fn try_from(value: &str) -> Result<Self, Self::Error> {
        match value {
            "Observed" => Ok(Self::Observed),
            other => Err(format!("invalid TurnCancellationReason value `{other}`")),
        }
    }
}
impl std::convert::TryFrom<String> for TurnCancellationReason {
    type Error = String;
    fn try_from(value: String) -> Result<Self, Self::Error> {
        Self::try_from(value.as_str())
    }
}
impl std::fmt::Display for TurnCancellationReason {
    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
        f.write_str(self.as_str())
    }
}
#[allow(non_camel_case_types)]
#[derive(
    Debug,
    Clone,
    Copy,
    Default,
    PartialEq,
    Eq,
    PartialOrd,
    Ord,
    Hash,
    serde::Serialize,
    serde::Deserialize,
)]
pub enum TurnPhase {
    #[default]
    #[serde(rename = "Ready")]
    Ready,
    #[serde(rename = "ApplyingPrimitive")]
    ApplyingPrimitive,
    #[serde(rename = "CallingLlm")]
    CallingLlm,
    #[serde(rename = "WaitingForOps")]
    WaitingForOps,
    #[serde(rename = "DrainingBoundary")]
    DrainingBoundary,
    #[serde(rename = "Extracting")]
    Extracting,
    #[serde(rename = "ErrorRecovery")]
    ErrorRecovery,
    #[serde(rename = "Cancelling")]
    Cancelling,
    #[serde(rename = "Completed")]
    Completed,
    #[serde(rename = "Failed")]
    Failed,
    #[serde(rename = "Cancelled")]
    Cancelled,
}
impl TurnPhase {
    pub fn as_str(&self) -> &'static str {
        match self {
            Self::Ready => "Ready",
            Self::ApplyingPrimitive => "ApplyingPrimitive",
            Self::CallingLlm => "CallingLlm",
            Self::WaitingForOps => "WaitingForOps",
            Self::DrainingBoundary => "DrainingBoundary",
            Self::Extracting => "Extracting",
            Self::ErrorRecovery => "ErrorRecovery",
            Self::Cancelling => "Cancelling",
            Self::Completed => "Completed",
            Self::Failed => "Failed",
            Self::Cancelled => "Cancelled",
        }
    }
}
impl std::convert::TryFrom<&str> for TurnPhase {
    type Error = String;
    fn try_from(value: &str) -> Result<Self, Self::Error> {
        match value {
            "Ready" => Ok(Self::Ready),
            "ApplyingPrimitive" => Ok(Self::ApplyingPrimitive),
            "CallingLlm" => Ok(Self::CallingLlm),
            "WaitingForOps" => Ok(Self::WaitingForOps),
            "DrainingBoundary" => Ok(Self::DrainingBoundary),
            "Extracting" => Ok(Self::Extracting),
            "ErrorRecovery" => Ok(Self::ErrorRecovery),
            "Cancelling" => Ok(Self::Cancelling),
            "Completed" => Ok(Self::Completed),
            "Failed" => Ok(Self::Failed),
            "Cancelled" => Ok(Self::Cancelled),
            other => Err(format!("invalid TurnPhase value `{other}`")),
        }
    }
}
impl std::convert::TryFrom<String> for TurnPhase {
    type Error = String;
    fn try_from(value: String) -> Result<Self, Self::Error> {
        Self::try_from(value.as_str())
    }
}
impl std::fmt::Display for TurnPhase {
    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
        f.write_str(self.as_str())
    }
}
#[allow(non_camel_case_types)]
#[derive(
    Debug,
    Clone,
    Copy,
    Default,
    PartialEq,
    Eq,
    PartialOrd,
    Ord,
    Hash,
    serde::Serialize,
    serde::Deserialize,
)]
pub enum TurnPrimitiveKind {
    #[default]
    #[serde(rename = "None")]
    None,
    #[serde(rename = "ConversationTurn")]
    ConversationTurn,
    #[serde(rename = "ImmediateAppend")]
    ImmediateAppend,
    #[serde(rename = "ImmediateContextAppend")]
    ImmediateContextAppend,
}
impl TurnPrimitiveKind {
    pub fn as_str(&self) -> &'static str {
        match self {
            Self::None => "None",
            Self::ConversationTurn => "ConversationTurn",
            Self::ImmediateAppend => "ImmediateAppend",
            Self::ImmediateContextAppend => "ImmediateContextAppend",
        }
    }
}
impl std::convert::TryFrom<&str> for TurnPrimitiveKind {
    type Error = String;
    fn try_from(value: &str) -> Result<Self, Self::Error> {
        match value {
            "None" => Ok(Self::None),
            "ConversationTurn" => Ok(Self::ConversationTurn),
            "ImmediateAppend" => Ok(Self::ImmediateAppend),
            "ImmediateContextAppend" => Ok(Self::ImmediateContextAppend),
            other => Err(format!("invalid TurnPrimitiveKind value `{other}`")),
        }
    }
}
impl std::convert::TryFrom<String> for TurnPrimitiveKind {
    type Error = String;
    fn try_from(value: String) -> Result<Self, Self::Error> {
        Self::try_from(value.as_str())
    }
}
impl std::fmt::Display for TurnPrimitiveKind {
    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
        f.write_str(self.as_str())
    }
}
#[allow(non_camel_case_types)]
#[derive(
    Debug,
    Clone,
    Copy,
    Default,
    PartialEq,
    Eq,
    PartialOrd,
    Ord,
    Hash,
    serde::Serialize,
    serde::Deserialize,
)]
pub enum TurnTerminalCauseKind {
    #[default]
    #[serde(rename = "Unknown")]
    Unknown,
    #[serde(rename = "HookDenied")]
    HookDenied,
    #[serde(rename = "HookFailure")]
    HookFailure,
    #[serde(rename = "LlmFailure")]
    LlmFailure,
    #[serde(rename = "ToolFailure")]
    ToolFailure,
    #[serde(rename = "StructuredOutputValidationFailed")]
    StructuredOutputValidationFailed,
    #[serde(rename = "BudgetExhausted")]
    BudgetExhausted,
    #[serde(rename = "TimeBudgetExceeded")]
    TimeBudgetExceeded,
    #[serde(rename = "RetryExhausted")]
    RetryExhausted,
    #[serde(rename = "TurnLimitReached")]
    TurnLimitReached,
    #[serde(rename = "RuntimeApplyFailure")]
    RuntimeApplyFailure,
    #[serde(rename = "FatalFailure")]
    FatalFailure,
}
impl TurnTerminalCauseKind {
    pub fn as_str(&self) -> &'static str {
        match self {
            Self::Unknown => "Unknown",
            Self::HookDenied => "HookDenied",
            Self::HookFailure => "HookFailure",
            Self::LlmFailure => "LlmFailure",
            Self::ToolFailure => "ToolFailure",
            Self::StructuredOutputValidationFailed => "StructuredOutputValidationFailed",
            Self::BudgetExhausted => "BudgetExhausted",
            Self::TimeBudgetExceeded => "TimeBudgetExceeded",
            Self::RetryExhausted => "RetryExhausted",
            Self::TurnLimitReached => "TurnLimitReached",
            Self::RuntimeApplyFailure => "RuntimeApplyFailure",
            Self::FatalFailure => "FatalFailure",
        }
    }
}
impl std::convert::TryFrom<&str> for TurnTerminalCauseKind {
    type Error = String;
    fn try_from(value: &str) -> Result<Self, Self::Error> {
        match value {
            "Unknown" => Ok(Self::Unknown),
            "HookDenied" => Ok(Self::HookDenied),
            "HookFailure" => Ok(Self::HookFailure),
            "LlmFailure" => Ok(Self::LlmFailure),
            "ToolFailure" => Ok(Self::ToolFailure),
            "StructuredOutputValidationFailed" => Ok(Self::StructuredOutputValidationFailed),
            "BudgetExhausted" => Ok(Self::BudgetExhausted),
            "TimeBudgetExceeded" => Ok(Self::TimeBudgetExceeded),
            "RetryExhausted" => Ok(Self::RetryExhausted),
            "TurnLimitReached" => Ok(Self::TurnLimitReached),
            "RuntimeApplyFailure" => Ok(Self::RuntimeApplyFailure),
            "FatalFailure" => Ok(Self::FatalFailure),
            other => Err(format!("invalid TurnTerminalCauseKind value `{other}`")),
        }
    }
}
impl std::convert::TryFrom<String> for TurnTerminalCauseKind {
    type Error = String;
    fn try_from(value: String) -> Result<Self, Self::Error> {
        Self::try_from(value.as_str())
    }
}
impl std::fmt::Display for TurnTerminalCauseKind {
    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
        f.write_str(self.as_str())
    }
}
#[allow(non_camel_case_types)]
#[derive(
    Debug,
    Clone,
    Copy,
    Default,
    PartialEq,
    Eq,
    PartialOrd,
    Ord,
    Hash,
    serde::Serialize,
    serde::Deserialize,
)]
pub enum TurnTerminalOutcome {
    #[default]
    #[serde(rename = "None")]
    None,
    #[serde(rename = "Completed")]
    Completed,
    #[serde(rename = "Failed")]
    Failed,
    #[serde(rename = "Cancelled")]
    Cancelled,
    #[serde(rename = "BudgetExhausted")]
    BudgetExhausted,
    #[serde(rename = "TimeBudgetExceeded")]
    TimeBudgetExceeded,
    #[serde(rename = "StructuredOutputValidationFailed")]
    StructuredOutputValidationFailed,
}
impl TurnTerminalOutcome {
    pub fn as_str(&self) -> &'static str {
        match self {
            Self::None => "None",
            Self::Completed => "Completed",
            Self::Failed => "Failed",
            Self::Cancelled => "Cancelled",
            Self::BudgetExhausted => "BudgetExhausted",
            Self::TimeBudgetExceeded => "TimeBudgetExceeded",
            Self::StructuredOutputValidationFailed => "StructuredOutputValidationFailed",
        }
    }
}
impl std::convert::TryFrom<&str> for TurnTerminalOutcome {
    type Error = String;
    fn try_from(value: &str) -> Result<Self, Self::Error> {
        match value {
            "None" => Ok(Self::None),
            "Completed" => Ok(Self::Completed),
            "Failed" => Ok(Self::Failed),
            "Cancelled" => Ok(Self::Cancelled),
            "BudgetExhausted" => Ok(Self::BudgetExhausted),
            "TimeBudgetExceeded" => Ok(Self::TimeBudgetExceeded),
            "StructuredOutputValidationFailed" => Ok(Self::StructuredOutputValidationFailed),
            other => Err(format!("invalid TurnTerminalOutcome value `{other}`")),
        }
    }
}
impl std::convert::TryFrom<String> for TurnTerminalOutcome {
    type Error = String;
    fn try_from(value: String) -> Result<Self, Self::Error> {
        Self::try_from(value.as_str())
    }
}
impl std::fmt::Display for TurnTerminalOutcome {
    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
        f.write_str(self.as_str())
    }
}
#[derive(
    Debug,
    Clone,
    Default,
    PartialEq,
    Eq,
    PartialOrd,
    Ord,
    Hash,
    serde::Serialize,
    serde::Deserialize,
)]
pub struct WaitRequestId(pub String);
impl From<String> for WaitRequestId {
    fn from(value: String) -> Self {
        Self(value)
    }
}
impl From<&str> for WaitRequestId {
    fn from(value: &str) -> Self {
        Self(value.to_owned())
    }
}
impl std::fmt::Display for WaitRequestId {
    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
        f.write_str(&self.0)
    }
}
#[derive(
    Debug,
    Clone,
    Default,
    PartialEq,
    Eq,
    PartialOrd,
    Ord,
    Hash,
    serde::Serialize,
    serde::Deserialize,
)]
pub struct WorkId(pub String);
impl From<String> for WorkId {
    fn from(value: String) -> Self {
        Self(value)
    }
}
impl From<&str> for WorkId {
    fn from(value: &str) -> Self {
        Self(value.to_owned())
    }
}
impl std::fmt::Display for WorkId {
    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
        f.write_str(&self.0)
    }
}
#[allow(non_camel_case_types)]
#[derive(
    Debug,
    Clone,
    Copy,
    Default,
    PartialEq,
    Eq,
    PartialOrd,
    Ord,
    Hash,
    serde::Serialize,
    serde::Deserialize,
)]
pub enum WorkOrigin {
    #[default]
    #[serde(rename = "External")]
    External,
    #[serde(rename = "Internal")]
    Internal,
    #[serde(rename = "Ingest")]
    Ingest,
}
impl WorkOrigin {
    pub fn as_str(&self) -> &'static str {
        match self {
            Self::External => "External",
            Self::Internal => "Internal",
            Self::Ingest => "Ingest",
        }
    }
}
impl std::convert::TryFrom<&str> for WorkOrigin {
    type Error = String;
    fn try_from(value: &str) -> Result<Self, Self::Error> {
        match value {
            "External" => Ok(Self::External),
            "Internal" => Ok(Self::Internal),
            "Ingest" => Ok(Self::Ingest),
            other => Err(format!("invalid WorkOrigin value `{other}`")),
        }
    }
}
impl std::convert::TryFrom<String> for WorkOrigin {
    type Error = String;
    fn try_from(value: String) -> Result<Self, Self::Error> {
        Self::try_from(value.as_str())
    }
}
impl std::fmt::Display for WorkOrigin {
    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
        f.write_str(self.as_str())
    }
}

pub trait Context {}
pub struct EmptyContext;
impl Context for EmptyContext {}

#[allow(non_camel_case_types)]
#[derive(Debug, Clone, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
pub enum Phase {
    Initializing,
    Idle,
    Attached,
    Running,
    Retired,
    Stopped,
    Destroyed,
}

#[derive(Debug, Clone, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
pub struct State {
    pub phase: Phase,
    pub session_id: Option<SessionId>,
    pub active_runtime_id: Option<AgentRuntimeId>,
    pub active_fence_token: Option<FenceToken>,
    pub current_run_id: Option<RunId>,
    pub pre_run_phase: Option<PreRunPhase>,
    pub turn_phase: TurnPhase,
    pub primitive_kind: Option<TurnPrimitiveKind>,
    pub admitted_content_shape: Option<ContentShape>,
    pub vision_enabled: bool,
    pub image_tool_results_enabled: bool,
    pub tool_calls_pending: u64,
    pub pending_op_refs: std::collections::BTreeSet<String>,
    pub barrier_operation_ids: std::collections::BTreeSet<String>,
    pub has_barrier_ops: bool,
    pub barrier_satisfied: bool,
    pub boundary_count: u64,
    pub cancel_after_boundary: bool,
    pub terminal_outcome: Option<TurnTerminalOutcome>,
    pub terminal_cause_kind: Option<TurnTerminalCauseKind>,
    pub last_runtime_apply_failure_cause: Option<RuntimeApplyFailureCause>,
    pub last_runtime_apply_failure_message: Option<String>,
    pub extraction_attempts: u64,
    pub max_extraction_retries: u64,
    pub llm_retry_attempt: u64,
    pub llm_retry_max_retries: u64,
    pub llm_retry_selected_delay_ms: u64,
    pub llm_retry_last_failure_kind: Option<LlmRetryFailureKind>,
    pub silent_intent_overrides: std::collections::BTreeSet<String>,
    pub model_routing_baseline_model: Option<String>,
    pub model_routing_baseline_realtime: Option<bool>,
    pub model_routing_topology_epoch: u64,
    pub model_routing_turn_override_id: Option<String>,
    pub model_routing_turn_request_id: Option<String>,
    pub model_routing_turn_target_model: Option<String>,
    pub model_routing_turn_realtime: Option<bool>,
    pub model_routing_turn_remaining_turns: Option<u64>,
    pub model_routing_operation_override_id: Option<String>,
    pub model_routing_operation_target_model: Option<String>,
    pub model_routing_operation_realtime: Option<bool>,
    pub model_routing_pending_switch_request_id: Option<String>,
    pub model_routing_pending_switch_target_model: Option<String>,
    pub model_routing_pending_switch_realtime: Option<bool>,
    pub model_routing_pending_switch_turns: Option<u64>,
    pub model_routing_pending_switch_phase: Option<RoutingSwitchTurnPhase>,
    pub model_routing_switch_terminal:
        std::collections::BTreeMap<String, RoutingSwitchTurnTerminal>,
    pub model_routing_switch_denials: std::collections::BTreeMap<String, RoutingDenialReason>,
    pub model_routing_image_operation_phases:
        std::collections::BTreeMap<String, RoutingImageOperationPhase>,
    pub model_routing_image_operation_target_models: std::collections::BTreeMap<String, String>,
    pub model_routing_image_operation_realtime: std::collections::BTreeMap<String, bool>,
    pub model_routing_image_operation_requires_scoped_override:
        std::collections::BTreeMap<String, bool>,
    pub model_routing_image_terminals: std::collections::BTreeMap<String, RoutingImageTerminal>,
    pub model_routing_image_terminal_payloads: std::collections::BTreeMap<String, String>,
    pub model_routing_image_denials: std::collections::BTreeMap<String, RoutingDenialReason>,
    pub model_routing_approval_phases: std::collections::BTreeMap<String, RoutingApprovalPhase>,
    pub model_routing_approval_parent_kind:
        std::collections::BTreeMap<String, RoutingApprovalParentKind>,
    pub registration_phase: RegistrationPhase,
    pub drain_phase: DrainPhase,
    pub drain_mode: Option<DrainMode>,
    pub next_staged_visibility_revision: u64,
    pub active_filter: ToolFilter,
    pub staged_filter: ToolFilter,
    pub active_visibility_revision: u64,
    pub staged_visibility_revision: u64,
    pub active_deferred_names: std::collections::BTreeSet<String>,
    pub staged_deferred_names: std::collections::BTreeSet<String>,
    pub active_deferred_authorities: std::collections::BTreeMap<String, ToolVisibilityWitness>,
    pub staged_deferred_authorities: std::collections::BTreeMap<String, ToolVisibilityWitness>,
    pub input_phases: std::collections::BTreeMap<String, InputPhase>,
    pub input_terminal_kind: std::collections::BTreeMap<String, InputTerminalKind>,
    pub input_superseded_by: std::collections::BTreeMap<String, String>,
    pub input_aggregate_id: std::collections::BTreeMap<String, String>,
    pub input_abandon_reason: std::collections::BTreeMap<String, InputAbandonReason>,
    pub input_abandon_attempt_count: std::collections::BTreeMap<String, u64>,
    pub input_attempt_counts: std::collections::BTreeMap<String, u64>,
    pub input_run_associations: std::collections::BTreeMap<String, String>,
    pub input_boundary_sequences: std::collections::BTreeMap<String, u64>,
    pub next_admission_seq: u64,
    pub input_admission_seq: std::collections::BTreeMap<String, u64>,
    pub input_lane: std::collections::BTreeMap<String, InputLane>,
    pub op_statuses: std::collections::BTreeMap<String, OperationStatus>,
    pub op_completion_seq: std::collections::BTreeMap<String, u64>,
    pub op_terminal_outcomes: std::collections::BTreeMap<String, OperationTerminalOutcomeKind>,
    pub op_terminal_payload: std::collections::BTreeMap<String, String>,
    pub op_kinds: std::collections::BTreeMap<String, OperationKind>,
    pub op_peer_ready: std::collections::BTreeMap<String, bool>,
    pub op_progress_counts: std::collections::BTreeMap<String, u64>,
    pub active_op_count: u64,
    pub wait_active: bool,
    pub wait_request_id: Option<WaitRequestId>,
    pub wait_operation_ids: std::collections::BTreeSet<String>,
    pub wait_operation_id_tokens: std::collections::BTreeSet<OperationId>,
    pub next_completion_seq: u64,
    pub known_surfaces: std::collections::BTreeSet<String>,
    pub active_surfaces: std::collections::BTreeSet<String>,
    pub visible_surfaces: std::collections::BTreeSet<String>,
    pub surface_base_state: std::collections::BTreeMap<String, ExternalToolSurfaceBaseState>,
    pub surface_pending_op: std::collections::BTreeMap<String, SurfacePendingOp>,
    pub surface_staged_op: std::collections::BTreeMap<String, SurfaceStagedOp>,
    pub reload_staged_surfaces: std::collections::BTreeSet<String>,
    pub surface_staged_intent_sequence: std::collections::BTreeMap<String, u64>,
    pub next_staged_intent_sequence: u64,
    pub surface_pending_task_sequence: std::collections::BTreeMap<String, u64>,
    pub next_pending_task_sequence: u64,
    pub surface_pending_lineage_sequence: std::collections::BTreeMap<String, u64>,
    pub surface_inflight_calls: std::collections::BTreeMap<String, u64>,
    pub surface_last_delta_operation:
        std::collections::BTreeMap<String, ExternalToolSurfaceDeltaOperation>,
    pub surface_last_delta_phase: std::collections::BTreeMap<String, ExternalToolSurfaceDeltaPhase>,
    pub snapshot_epoch: u64,
    pub snapshot_aligned_epoch: u64,
    pub surface_draining_since_ms: std::collections::BTreeMap<String, u64>,
    pub surface_removal_timeout_at_ms: std::collections::BTreeMap<String, u64>,
    pub surface_removal_applied_at_turn: std::collections::BTreeMap<String, u64>,
    pub surface_phase: SurfacePhase,
    pub removal_timeout_ms: u64,
    pub mcp_server_states: std::collections::BTreeMap<McpServerId, McpServerState>,
    pub pending_peer_requests:
        std::collections::BTreeMap<PeerCorrelationId, OutboundPeerRequestState>,
    pub inbound_peer_requests:
        std::collections::BTreeMap<PeerCorrelationId, InboundPeerRequestState>,
    pub last_session_context_updated_at_ms: u64,
    pub reserved_interaction_streams: std::collections::BTreeSet<PeerCorrelationId>,
    pub attached_interaction_streams: std::collections::BTreeSet<PeerCorrelationId>,
    pub peer_ingress_owner_kind: PeerIngressOwnerKind,
    pub peer_ingress_comms_runtime_id: Option<CommsRuntimeId>,
    pub peer_ingress_mob_id: Option<MobId>,
    pub supervisor_binding_kind: SupervisorBindingKind,
    pub supervisor_bound_name: Option<String>,
    pub supervisor_bound_peer_id: Option<String>,
    pub supervisor_bound_address: Option<String>,
    pub supervisor_bound_epoch: Option<u64>,
    pub local_endpoint: Option<PeerEndpoint>,
    pub direct_peer_endpoints: std::collections::BTreeSet<PeerEndpoint>,
    pub mob_overlay_peer_endpoints: std::collections::BTreeSet<PeerEndpoint>,
    pub peer_projection_epoch: u64,
    pub mob_overlay_epoch: u64,
}
impl Default for State {
    fn default() -> Self {
        initial_state()
    }
}

pub mod inputs {
    #[allow(unused_imports)]
    use super::*;
    #[derive(Debug, Clone, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
    pub struct RegisterSession {
        pub session_id: SessionId,
    }
    #[derive(Debug, Clone, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
    pub struct UnregisterSession {
        pub session_id: SessionId,
    }
    #[derive(Debug, Clone, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
    pub struct ReconfigureSessionLlmIdentity {
        pub previous_identity: SessionLlmIdentity,
        pub previous_visibility_state: SessionToolVisibilityState,
        pub previous_capability_surface: Option<SessionLlmCapabilitySurface>,
        pub previous_capability_surface_status: SessionLlmCapabilitySurfaceStatus,
        pub target_identity: SessionLlmIdentity,
        pub target_capability_surface: SessionLlmCapabilitySurface,
        pub next_visibility_state: SessionToolVisibilityState,
        pub next_capability_base_filter: ToolFilter,
        pub next_active_visibility_revision: u64,
        pub tool_visibility_delta: SessionToolVisibilityDelta,
    }
    #[derive(Debug, Clone, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
    pub struct PrepareBindings {
        pub agent_runtime_id: AgentRuntimeId,
        pub fence_token: FenceToken,
        pub generation: Generation,
        pub session_id: SessionId,
    }
    #[derive(Debug, Clone, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
    pub struct SetPeerIngressContext {
        pub keep_alive: bool,
    }
    #[derive(Debug, Clone, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
    pub struct NotifyDrainExited {
        pub reason: DrainExitReason,
    }
    #[derive(Debug, Clone, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
    pub struct InterruptCurrentRun {}
    #[derive(Debug, Clone, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
    pub struct CancelAfterBoundary {
        pub reason: String,
    }
    #[derive(Debug, Clone, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
    pub struct StagePersistentFilter {
        pub filter: ToolFilter,
        pub witnesses: std::collections::BTreeMap<String, ToolVisibilityWitness>,
    }
    #[derive(Debug, Clone, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
    pub struct RequestDeferredTools {
        pub authorities: std::collections::BTreeMap<String, ToolVisibilityWitness>,
    }
    #[derive(Debug, Clone, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
    pub struct PublishCommittedVisibleSet {
        pub active_filter: ToolFilter,
        pub staged_filter: ToolFilter,
        pub active_requested_deferred_names: std::collections::BTreeSet<String>,
        pub staged_requested_deferred_names: std::collections::BTreeSet<String>,
        pub active_deferred_authorities: std::collections::BTreeMap<String, ToolVisibilityWitness>,
        pub staged_deferred_authorities: std::collections::BTreeMap<String, ToolVisibilityWitness>,
        pub active_visibility_revision: u64,
        pub staged_visibility_revision: u64,
    }
    #[derive(Debug, Clone, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
    pub struct Recover {}
    #[derive(Debug, Clone, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
    pub struct Retire {
        pub session_id: SessionId,
    }
    #[derive(Debug, Clone, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
    pub struct Reset {}
    #[derive(Debug, Clone, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
    pub struct StopRuntimeExecutor {
        pub reason: String,
    }
    #[derive(Debug, Clone, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
    pub struct RuntimeExecutorExited {}
    #[derive(Debug, Clone, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
    pub struct Destroy {
        pub session_id: SessionId,
    }
    #[derive(Debug, Clone, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
    pub struct EnsureSessionWithExecutor {
        pub session_id: SessionId,
    }
    #[derive(Debug, Clone, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
    pub struct SetSilentIntents {
        pub session_id: SessionId,
        pub intents: std::collections::BTreeSet<String>,
    }
    #[derive(Debug, Clone, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
    pub struct ContainsSession {
        pub session_id: SessionId,
    }
    #[derive(Debug, Clone, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
    pub struct SessionHasExecutor {
        pub session_id: SessionId,
    }
    #[derive(Debug, Clone, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
    pub struct SessionHasComms {
        pub session_id: SessionId,
    }
    #[derive(Debug, Clone, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
    pub struct OpsLifecycleRegistry {
        pub session_id: SessionId,
    }
    #[derive(Debug, Clone, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
    pub struct InputState {
        pub session_id: SessionId,
        pub input_id: InputId,
    }
    #[derive(Debug, Clone, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
    pub struct ListActiveInputs {
        pub session_id: SessionId,
    }
    #[derive(Debug, Clone, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
    pub struct Abort {
        pub session_id: SessionId,
    }
    #[derive(Debug, Clone, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
    pub struct AbortAll {}
    #[derive(Debug, Clone, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
    pub struct Wait {
        pub session_id: SessionId,
    }
    #[derive(Debug, Clone, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
    pub struct Ingest {
        pub runtime_id: AgentRuntimeId,
        pub work_id: WorkId,
        pub origin: WorkOrigin,
    }
    #[derive(Debug, Clone, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
    pub struct PublishEvent {
        pub kind: String,
    }
    #[derive(Debug, Clone, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
    pub struct RuntimeState {
        pub runtime_id: String,
    }
    #[derive(Debug, Clone, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
    pub struct ModelRoutingStatus {
        pub session_id: SessionId,
    }
    #[derive(Debug, Clone, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
    pub struct SetModelRoutingBaseline {
        pub baseline_model: String,
        pub realtime_capable: bool,
    }
    #[derive(Debug, Clone, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
    pub struct RequestFiniteSwitchTurn {
        pub request_id: String,
        pub target_model: String,
        pub turns: u64,
        pub target_realtime_capable: bool,
        pub requires_approval: bool,
        pub approval_available: bool,
        pub approval_denied: bool,
        pub realtime_detach_allowed: bool,
    }
    #[derive(Debug, Clone, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
    pub struct RequestUntilChangedSwitchTurn {
        pub request_id: String,
        pub target_model: String,
        pub target_realtime_capable: bool,
        pub requires_approval: bool,
        pub approval_available: bool,
        pub approval_denied: bool,
        pub realtime_detach_allowed: bool,
    }
    #[derive(Debug, Clone, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
    pub struct CompleteUntilChangedSwitchTurnReconfigure {
        pub request_id: String,
    }
    #[derive(Debug, Clone, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
    pub struct AdmitModelRoutingAssistantTurn {}
    #[derive(Debug, Clone, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
    pub struct BeginImageOperation {
        pub operation_id: String,
        pub target_model: String,
        pub target_realtime_capable: bool,
        pub requires_approval: bool,
        pub approval_available: bool,
        pub approval_denied: bool,
        pub realtime_detach_allowed: bool,
        pub requires_scoped_override: bool,
    }
    #[derive(Debug, Clone, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
    pub struct ActivateImageOperationOverride {
        pub operation_id: String,
        pub target_model: String,
        pub target_realtime_capable: bool,
    }
    #[derive(Debug, Clone, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
    pub struct CompleteImageOperation {
        pub operation_id: String,
        pub terminal: RoutingImageTerminal,
        pub terminal_payload: String,
    }
    #[derive(Debug, Clone, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
    pub struct RestoreImageOperationOverride {
        pub operation_id: String,
    }
    #[derive(Debug, Clone, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
    pub struct LoadBoundaryReceipt {
        pub runtime_id: String,
        pub sequence: u64,
    }
    #[derive(Debug, Clone, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
    pub struct AcceptWithCompletion {
        pub input_id: InputId,
        pub request_immediate_processing: bool,
        pub interrupt_yielding: bool,
        pub wake_if_idle: bool,
    }
    #[derive(Debug, Clone, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
    pub struct AcceptWithoutWake {
        pub input_id: InputId,
    }
    #[derive(Debug, Clone, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
    pub struct Prepare {
        pub session_id: SessionId,
        pub run_id: RunId,
    }
    #[derive(Debug, Clone, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
    pub struct Commit {
        pub input_id: InputId,
        pub run_id: RunId,
    }
    #[derive(Debug, Clone, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
    pub struct Fail {
        pub run_id: RunId,
    }
    #[derive(Debug, Clone, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
    pub struct CancelRun {
        pub run_id: RunId,
    }
    #[derive(Debug, Clone, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
    pub struct RollbackRun {
        pub run_id: RunId,
    }
    #[derive(Debug, Clone, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
    pub struct Recycle {}
    #[derive(Debug, Clone, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
    pub struct StartConversationRun {
        pub run_id: RunId,
        pub primitive_kind: TurnPrimitiveKind,
        pub admitted_content_shape: ContentShape,
        pub vision_enabled: bool,
        pub image_tool_results_enabled: bool,
        pub max_extraction_retries: u64,
    }
    #[derive(Debug, Clone, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
    pub struct StartImmediateAppend {
        pub run_id: RunId,
    }
    #[derive(Debug, Clone, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
    pub struct StartImmediateContext {
        pub run_id: RunId,
    }
    #[derive(Debug, Clone, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
    pub struct PrimitiveApplied {}
    #[derive(Debug, Clone, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
    pub struct LlmReturnedToolCalls {
        pub tool_count: u64,
    }
    #[derive(Debug, Clone, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
    pub struct LlmReturnedTerminal {}
    #[derive(Debug, Clone, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
    pub struct RegisterPendingOps {
        pub op_refs: std::collections::BTreeSet<String>,
        pub barrier_operation_ids: std::collections::BTreeSet<String>,
    }
    #[derive(Debug, Clone, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
    pub struct ToolCallsResolved {}
    #[derive(Debug, Clone, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
    pub struct OpsBarrierSatisfied {
        pub operation_ids: std::collections::BTreeSet<String>,
    }
    #[derive(Debug, Clone, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
    pub struct BoundaryContinue {}
    #[derive(Debug, Clone, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
    pub struct BoundaryComplete {}
    #[derive(Debug, Clone, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
    pub struct EnterExtraction {
        pub max_extraction_retries: u64,
    }
    #[derive(Debug, Clone, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
    pub struct ExtractionStart {}
    #[derive(Debug, Clone, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
    pub struct ExtractionValidationPassed {}
    #[derive(Debug, Clone, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
    pub struct ExtractionValidationFailed {
        pub error: String,
    }
    #[derive(Debug, Clone, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
    pub struct ExtractionFailed {
        pub error: String,
    }
    #[derive(Debug, Clone, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
    pub struct RecoverableFailure {
        pub failure_kind: LlmRetryFailureKind,
        pub retry_attempt: u64,
        pub max_retries: u64,
        pub selected_delay_ms: u64,
        pub error: String,
    }
    #[derive(Debug, Clone, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
    pub struct FatalFailure {
        pub terminal_cause_kind: TurnTerminalCauseKind,
        pub error: String,
    }
    #[derive(Debug, Clone, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
    pub struct RetryRequested {
        pub retry_attempt: u64,
    }
    #[derive(Debug, Clone, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
    pub struct CancelNow {}
    #[derive(Debug, Clone, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
    pub struct RequestCancelAfterBoundary {}
    #[derive(Debug, Clone, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
    pub struct CancellationObserved {}
    #[derive(Debug, Clone, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
    pub struct AcknowledgeTerminal {
        pub outcome: TurnTerminalOutcome,
    }
    #[derive(Debug, Clone, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
    pub struct TurnLimitReached {}
    #[derive(Debug, Clone, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
    pub struct BudgetExhausted {}
    #[derive(Debug, Clone, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
    pub struct TimeBudgetExceeded {}
    #[derive(Debug, Clone, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
    pub struct ForceCancelNoRun {}
    #[derive(Debug, Clone, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
    pub struct RunCompleted {
        pub run_id: RunId,
    }
    #[derive(Debug, Clone, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
    pub struct ServiceTurnCommitted {
        pub run_id: RunId,
    }
    #[derive(Debug, Clone, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
    pub struct RunFailed {
        pub run_id: RunId,
        pub runtime_apply_failure_cause: Option<RuntimeApplyFailureCause>,
        pub runtime_apply_failure_message: Option<String>,
        pub terminal_outcome: TurnTerminalOutcome,
        pub terminal_cause_kind: TurnTerminalCauseKind,
        pub error: String,
    }
    #[derive(Debug, Clone, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
    pub struct RunCancelled {
        pub run_id: RunId,
    }
    #[derive(Debug, Clone, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
    pub struct RecoverInputLifecycle {
        pub input_id: String,
        pub phase: InputPhase,
        pub terminal_kind: Option<InputTerminalKind>,
        pub superseded_by: Option<String>,
        pub aggregate_id: Option<String>,
        pub abandon_reason: Option<InputAbandonReason>,
        pub abandon_attempt_count: u64,
        pub attempt_count: u64,
        pub run_id: Option<String>,
        pub boundary_sequence: Option<u64>,
        pub lane: Option<InputLane>,
    }
    #[derive(Debug, Clone, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
    pub struct QueueAccepted {
        pub input_id: String,
    }
    #[derive(Debug, Clone, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
    pub struct SteerAccepted {
        pub input_id: String,
    }
    #[derive(Debug, Clone, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
    pub struct ChangeLane {
        pub input_id: String,
        pub new_lane: InputLane,
    }
    #[derive(Debug, Clone, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
    pub struct StageForRun {
        pub input_id: String,
        pub run_id: String,
    }
    #[derive(Debug, Clone, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
    pub struct IncrementAttemptCount {
        pub input_id: String,
    }
    #[derive(Debug, Clone, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
    pub struct RollbackStaged {
        pub input_id: String,
        pub lane: InputLane,
    }
    #[derive(Debug, Clone, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
    pub struct MarkApplied {
        pub input_id: String,
    }
    #[derive(Debug, Clone, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
    pub struct MarkAppliedPendingConsumption {
        pub input_id: String,
    }
    #[derive(Debug, Clone, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
    pub struct ConsumeInput {
        pub input_id: String,
    }
    #[derive(Debug, Clone, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
    pub struct ConsumeOnAccept {
        pub input_id: String,
    }
    #[derive(Debug, Clone, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
    pub struct SupersedeInput {
        pub input_id: String,
        pub superseded_by: String,
    }
    #[derive(Debug, Clone, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
    pub struct CoalesceInput {
        pub input_id: String,
        pub aggregate_id: String,
    }
    #[derive(Debug, Clone, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
    pub struct AbandonInput {
        pub input_id: String,
        pub reason: InputAbandonReason,
        pub attempt_count: u64,
    }
    #[derive(Debug, Clone, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
    pub struct RecordBoundarySeq {
        pub input_id: String,
        pub seq: u64,
    }
    #[derive(Debug, Clone, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
    pub struct RegisterOp {
        pub operation_id: String,
        pub kind: OperationKind,
    }
    #[derive(Debug, Clone, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
    pub struct StartOp {
        pub operation_id: String,
    }
    #[derive(Debug, Clone, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
    pub struct CompleteOp {
        pub operation_id: String,
        pub outcome: OperationTerminalOutcomeKind,
        pub payload: String,
    }
    #[derive(Debug, Clone, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
    pub struct FailOp {
        pub operation_id: String,
        pub outcome: OperationTerminalOutcomeKind,
        pub payload: String,
    }
    #[derive(Debug, Clone, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
    pub struct CancelOp {
        pub operation_id: String,
        pub outcome: OperationTerminalOutcomeKind,
        pub payload: String,
    }
    #[derive(Debug, Clone, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
    pub struct AbortOp {
        pub operation_id: String,
        pub outcome: OperationTerminalOutcomeKind,
        pub payload: String,
    }
    #[derive(Debug, Clone, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
    pub struct PeerReadyOp {
        pub operation_id: String,
    }
    #[derive(Debug, Clone, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
    pub struct ProgressReportedOp {
        pub operation_id: String,
    }
    #[derive(Debug, Clone, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
    pub struct RetireRequestedOp {
        pub operation_id: String,
    }
    #[derive(Debug, Clone, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
    pub struct RetireCompletedOp {
        pub operation_id: String,
        pub outcome: OperationTerminalOutcomeKind,
        pub payload: String,
    }
    #[derive(Debug, Clone, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
    pub struct TerminateOp {
        pub operation_id: String,
        pub outcome: OperationTerminalOutcomeKind,
        pub payload: String,
    }
    #[derive(Debug, Clone, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
    pub struct RequestWaitAll {
        pub wait_request_id: WaitRequestId,
        pub operation_ids: std::collections::BTreeSet<String>,
        pub operation_id_tokens: std::collections::BTreeSet<OperationId>,
    }
    #[derive(Debug, Clone, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
    pub struct SatisfyWaitAll {
        pub wait_request_id: WaitRequestId,
        pub operation_id_tokens: std::collections::BTreeSet<OperationId>,
    }
    #[derive(Debug, Clone, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
    pub struct CancelWaitAll {}
    #[derive(Debug, Clone, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
    pub struct SpawnDrain {
        pub mode: DrainMode,
    }
    #[derive(Debug, Clone, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
    pub struct StopDrain {}
    #[derive(Debug, Clone, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
    pub struct DrainExitedClean {}
    #[derive(Debug, Clone, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
    pub struct DrainExitedRespawnable {}
    #[derive(Debug, Clone, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
    pub struct StageVisibilityFilter {
        pub filter: ToolFilter,
    }
    #[derive(Debug, Clone, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
    pub struct CommitVisibilityFilter {
        pub filter: ToolFilter,
        pub revision: u64,
    }
    #[derive(Debug, Clone, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
    pub struct StageDeferredNames {
        pub names: std::collections::BTreeSet<String>,
    }
    #[derive(Debug, Clone, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
    pub struct CommitDeferredNames {
        pub authorities: std::collections::BTreeMap<String, ToolVisibilityWitness>,
    }
    #[derive(Debug, Clone, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
    pub struct SyncVisibilityRevisions {
        pub active_revision: u64,
        pub staged_revision: u64,
        pub active_deferred_names: std::collections::BTreeSet<String>,
        pub staged_deferred_names: std::collections::BTreeSet<String>,
        pub active_deferred_authorities: std::collections::BTreeMap<String, ToolVisibilityWitness>,
        pub staged_deferred_authorities: std::collections::BTreeMap<String, ToolVisibilityWitness>,
    }
    #[derive(Debug, Clone, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
    pub struct SurfaceRegister {
        pub surface_id: String,
    }
    #[derive(Debug, Clone, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
    pub struct SurfaceStageAdd {
        pub surface_id: String,
        pub now_ms: u64,
    }
    #[derive(Debug, Clone, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
    pub struct SurfaceStageRemove {
        pub surface_id: String,
        pub now_ms: u64,
    }
    #[derive(Debug, Clone, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
    pub struct SurfaceStageReload {
        pub surface_id: String,
        pub now_ms: u64,
    }
    #[derive(Debug, Clone, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
    pub struct SurfaceApplyBoundary {
        pub surface_id: String,
        pub now_ms: u64,
        pub staged_intent_sequence: u64,
        pub applied_at_turn: u64,
    }
    #[derive(Debug, Clone, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
    pub struct SurfaceMarkPendingSucceeded {
        pub surface_id: String,
        pub pending_task_sequence: u64,
        pub staged_intent_sequence: u64,
    }
    #[derive(Debug, Clone, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
    pub struct SurfaceMarkPendingFailed {
        pub surface_id: String,
        pub pending_task_sequence: u64,
        pub staged_intent_sequence: u64,
        pub cause: ExternalToolSurfaceFailureCause,
    }
    #[derive(Debug, Clone, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
    pub struct SurfaceCallStarted {
        pub surface_id: String,
    }
    #[derive(Debug, Clone, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
    pub struct SurfaceCallFinished {
        pub surface_id: String,
    }
    #[derive(Debug, Clone, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
    pub struct SurfaceFinalizeRemovalClean {
        pub surface_id: String,
    }
    #[derive(Debug, Clone, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
    pub struct SurfaceFinalizeRemovalForced {
        pub surface_id: String,
    }
    #[derive(Debug, Clone, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
    pub struct SurfaceSnapshotAligned {
        pub epoch: u64,
    }
    #[derive(Debug, Clone, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
    pub struct SurfaceShutdown {}
    #[derive(Debug, Clone, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
    pub struct McpServerConnectPending {
        pub server_id: McpServerId,
    }
    #[derive(Debug, Clone, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
    pub struct McpServerConnected {
        pub server_id: McpServerId,
    }
    #[derive(Debug, Clone, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
    pub struct McpServerFailed {
        pub server_id: McpServerId,
        pub error: String,
    }
    #[derive(Debug, Clone, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
    pub struct McpServerDisconnected {
        pub server_id: McpServerId,
    }
    #[derive(Debug, Clone, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
    pub struct McpServerReload {
        pub server_id: McpServerId,
    }
    #[derive(Debug, Clone, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
    pub struct PeerRequestSent {
        pub corr_id: PeerCorrelationId,
        pub to: String,
    }
    #[derive(Debug, Clone, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
    pub struct PeerResponseProgressArrived {
        pub corr_id: PeerCorrelationId,
    }
    #[derive(Debug, Clone, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
    pub struct PeerResponseTerminalArrived {
        pub corr_id: PeerCorrelationId,
        pub disposition: PeerTerminalDisposition,
    }
    #[derive(Debug, Clone, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
    pub struct PeerRequestTimedOut {
        pub corr_id: PeerCorrelationId,
    }
    #[derive(Debug, Clone, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
    pub struct PeerRequestReceived {
        pub corr_id: PeerCorrelationId,
    }
    #[derive(Debug, Clone, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
    pub struct PeerResponseReplied {
        pub corr_id: PeerCorrelationId,
    }
    #[derive(Debug, Clone, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
    pub struct AdvanceSessionContext {
        pub updated_at_ms: u64,
    }
    #[derive(Debug, Clone, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
    pub struct InteractionStreamReserved {
        pub corr_id: PeerCorrelationId,
    }
    #[derive(Debug, Clone, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
    pub struct InteractionStreamAttached {
        pub corr_id: PeerCorrelationId,
    }
    #[derive(Debug, Clone, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
    pub struct InteractionStreamCompleted {
        pub corr_id: PeerCorrelationId,
    }
    #[derive(Debug, Clone, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
    pub struct InteractionStreamExpired {
        pub corr_id: PeerCorrelationId,
    }
    #[derive(Debug, Clone, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
    pub struct InteractionStreamClosedEarly {
        pub corr_id: PeerCorrelationId,
    }
    #[derive(Debug, Clone, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
    pub struct AttachSessionIngress {
        pub comms_runtime_id: CommsRuntimeId,
    }
    #[derive(Debug, Clone, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
    pub struct AttachMobIngress {
        pub comms_runtime_id: CommsRuntimeId,
        pub mob_id: MobId,
    }
    #[derive(Debug, Clone, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
    pub struct DetachIngress {}
    #[derive(Debug, Clone, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
    pub struct BindSupervisor {
        pub name: String,
        pub peer_id: String,
        pub address: String,
        pub epoch: u64,
    }
    #[derive(Debug, Clone, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
    pub struct AuthorizeSupervisor {
        pub name: String,
        pub peer_id: String,
        pub address: String,
        pub epoch: u64,
    }
    #[derive(Debug, Clone, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
    pub struct RevokeSupervisor {
        pub peer_id: String,
        pub epoch: u64,
    }
    #[derive(Debug, Clone, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
    pub struct SupervisorTrustEdgePublished {
        pub peer_id: String,
        pub epoch: u64,
    }
    #[derive(Debug, Clone, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
    pub struct SupervisorTrustEdgePublishFailed {
        pub peer_id: String,
        pub epoch: u64,
        pub reason: String,
    }
    #[derive(Debug, Clone, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
    pub struct SupervisorTrustEdgeRevoked {
        pub peer_id: String,
        pub epoch: u64,
    }
    #[derive(Debug, Clone, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
    pub struct SupervisorTrustEdgeRevokeFailed {
        pub peer_id: String,
        pub epoch: u64,
        pub reason: String,
    }
    #[derive(Debug, Clone, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
    pub struct PublishLocalEndpoint {
        pub endpoint: PeerEndpoint,
    }
    #[derive(Debug, Clone, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
    pub struct ClearLocalEndpoint {}
    #[derive(Debug, Clone, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
    pub struct AddDirectPeerEndpoint {
        pub endpoint: PeerEndpoint,
    }
    #[derive(Debug, Clone, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
    pub struct RemoveDirectPeerEndpoint {
        pub endpoint: PeerEndpoint,
    }
    #[derive(Debug, Clone, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
    pub struct ApplyMobPeerOverlay {
        pub epoch: u64,
        pub endpoints: std::collections::BTreeSet<PeerEndpoint>,
    }
}

#[derive(Debug, Clone, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
pub enum Input {
    RegisterSession(inputs::RegisterSession),
    UnregisterSession(inputs::UnregisterSession),
    ReconfigureSessionLlmIdentity(inputs::ReconfigureSessionLlmIdentity),
    PrepareBindings(inputs::PrepareBindings),
    SetPeerIngressContext(inputs::SetPeerIngressContext),
    NotifyDrainExited(inputs::NotifyDrainExited),
    InterruptCurrentRun(inputs::InterruptCurrentRun),
    CancelAfterBoundary(inputs::CancelAfterBoundary),
    StagePersistentFilter(inputs::StagePersistentFilter),
    RequestDeferredTools(inputs::RequestDeferredTools),
    PublishCommittedVisibleSet(inputs::PublishCommittedVisibleSet),
    Recover(inputs::Recover),
    Retire(inputs::Retire),
    Reset(inputs::Reset),
    StopRuntimeExecutor(inputs::StopRuntimeExecutor),
    RuntimeExecutorExited(inputs::RuntimeExecutorExited),
    Destroy(inputs::Destroy),
    EnsureSessionWithExecutor(inputs::EnsureSessionWithExecutor),
    SetSilentIntents(inputs::SetSilentIntents),
    ContainsSession(inputs::ContainsSession),
    SessionHasExecutor(inputs::SessionHasExecutor),
    SessionHasComms(inputs::SessionHasComms),
    OpsLifecycleRegistry(inputs::OpsLifecycleRegistry),
    InputState(inputs::InputState),
    ListActiveInputs(inputs::ListActiveInputs),
    Abort(inputs::Abort),
    AbortAll(inputs::AbortAll),
    Wait(inputs::Wait),
    Ingest(inputs::Ingest),
    PublishEvent(inputs::PublishEvent),
    RuntimeState(inputs::RuntimeState),
    ModelRoutingStatus(inputs::ModelRoutingStatus),
    SetModelRoutingBaseline(inputs::SetModelRoutingBaseline),
    RequestFiniteSwitchTurn(inputs::RequestFiniteSwitchTurn),
    RequestUntilChangedSwitchTurn(inputs::RequestUntilChangedSwitchTurn),
    CompleteUntilChangedSwitchTurnReconfigure(inputs::CompleteUntilChangedSwitchTurnReconfigure),
    AdmitModelRoutingAssistantTurn(inputs::AdmitModelRoutingAssistantTurn),
    BeginImageOperation(inputs::BeginImageOperation),
    ActivateImageOperationOverride(inputs::ActivateImageOperationOverride),
    CompleteImageOperation(inputs::CompleteImageOperation),
    RestoreImageOperationOverride(inputs::RestoreImageOperationOverride),
    LoadBoundaryReceipt(inputs::LoadBoundaryReceipt),
    AcceptWithCompletion(inputs::AcceptWithCompletion),
    AcceptWithoutWake(inputs::AcceptWithoutWake),
    Prepare(inputs::Prepare),
    Commit(inputs::Commit),
    Fail(inputs::Fail),
    CancelRun(inputs::CancelRun),
    RollbackRun(inputs::RollbackRun),
    Recycle(inputs::Recycle),
    StartConversationRun(inputs::StartConversationRun),
    StartImmediateAppend(inputs::StartImmediateAppend),
    StartImmediateContext(inputs::StartImmediateContext),
    PrimitiveApplied(inputs::PrimitiveApplied),
    LlmReturnedToolCalls(inputs::LlmReturnedToolCalls),
    LlmReturnedTerminal(inputs::LlmReturnedTerminal),
    RegisterPendingOps(inputs::RegisterPendingOps),
    ToolCallsResolved(inputs::ToolCallsResolved),
    OpsBarrierSatisfied(inputs::OpsBarrierSatisfied),
    BoundaryContinue(inputs::BoundaryContinue),
    BoundaryComplete(inputs::BoundaryComplete),
    EnterExtraction(inputs::EnterExtraction),
    ExtractionStart(inputs::ExtractionStart),
    ExtractionValidationPassed(inputs::ExtractionValidationPassed),
    ExtractionValidationFailed(inputs::ExtractionValidationFailed),
    ExtractionFailed(inputs::ExtractionFailed),
    RecoverableFailure(inputs::RecoverableFailure),
    FatalFailure(inputs::FatalFailure),
    RetryRequested(inputs::RetryRequested),
    CancelNow(inputs::CancelNow),
    RequestCancelAfterBoundary(inputs::RequestCancelAfterBoundary),
    CancellationObserved(inputs::CancellationObserved),
    AcknowledgeTerminal(inputs::AcknowledgeTerminal),
    TurnLimitReached(inputs::TurnLimitReached),
    BudgetExhausted(inputs::BudgetExhausted),
    TimeBudgetExceeded(inputs::TimeBudgetExceeded),
    ForceCancelNoRun(inputs::ForceCancelNoRun),
    RunCompleted(inputs::RunCompleted),
    ServiceTurnCommitted(inputs::ServiceTurnCommitted),
    RunFailed(inputs::RunFailed),
    RunCancelled(inputs::RunCancelled),
    RecoverInputLifecycle(inputs::RecoverInputLifecycle),
    QueueAccepted(inputs::QueueAccepted),
    SteerAccepted(inputs::SteerAccepted),
    ChangeLane(inputs::ChangeLane),
    StageForRun(inputs::StageForRun),
    IncrementAttemptCount(inputs::IncrementAttemptCount),
    RollbackStaged(inputs::RollbackStaged),
    MarkApplied(inputs::MarkApplied),
    MarkAppliedPendingConsumption(inputs::MarkAppliedPendingConsumption),
    ConsumeInput(inputs::ConsumeInput),
    ConsumeOnAccept(inputs::ConsumeOnAccept),
    SupersedeInput(inputs::SupersedeInput),
    CoalesceInput(inputs::CoalesceInput),
    AbandonInput(inputs::AbandonInput),
    RecordBoundarySeq(inputs::RecordBoundarySeq),
    RegisterOp(inputs::RegisterOp),
    StartOp(inputs::StartOp),
    CompleteOp(inputs::CompleteOp),
    FailOp(inputs::FailOp),
    CancelOp(inputs::CancelOp),
    AbortOp(inputs::AbortOp),
    PeerReadyOp(inputs::PeerReadyOp),
    ProgressReportedOp(inputs::ProgressReportedOp),
    RetireRequestedOp(inputs::RetireRequestedOp),
    RetireCompletedOp(inputs::RetireCompletedOp),
    TerminateOp(inputs::TerminateOp),
    RequestWaitAll(inputs::RequestWaitAll),
    SatisfyWaitAll(inputs::SatisfyWaitAll),
    CancelWaitAll(inputs::CancelWaitAll),
    SpawnDrain(inputs::SpawnDrain),
    StopDrain(inputs::StopDrain),
    DrainExitedClean(inputs::DrainExitedClean),
    DrainExitedRespawnable(inputs::DrainExitedRespawnable),
    StageVisibilityFilter(inputs::StageVisibilityFilter),
    CommitVisibilityFilter(inputs::CommitVisibilityFilter),
    StageDeferredNames(inputs::StageDeferredNames),
    CommitDeferredNames(inputs::CommitDeferredNames),
    SyncVisibilityRevisions(inputs::SyncVisibilityRevisions),
    SurfaceRegister(inputs::SurfaceRegister),
    SurfaceStageAdd(inputs::SurfaceStageAdd),
    SurfaceStageRemove(inputs::SurfaceStageRemove),
    SurfaceStageReload(inputs::SurfaceStageReload),
    SurfaceApplyBoundary(inputs::SurfaceApplyBoundary),
    SurfaceMarkPendingSucceeded(inputs::SurfaceMarkPendingSucceeded),
    SurfaceMarkPendingFailed(inputs::SurfaceMarkPendingFailed),
    SurfaceCallStarted(inputs::SurfaceCallStarted),
    SurfaceCallFinished(inputs::SurfaceCallFinished),
    SurfaceFinalizeRemovalClean(inputs::SurfaceFinalizeRemovalClean),
    SurfaceFinalizeRemovalForced(inputs::SurfaceFinalizeRemovalForced),
    SurfaceSnapshotAligned(inputs::SurfaceSnapshotAligned),
    SurfaceShutdown(inputs::SurfaceShutdown),
    McpServerConnectPending(inputs::McpServerConnectPending),
    McpServerConnected(inputs::McpServerConnected),
    McpServerFailed(inputs::McpServerFailed),
    McpServerDisconnected(inputs::McpServerDisconnected),
    McpServerReload(inputs::McpServerReload),
    PeerRequestSent(inputs::PeerRequestSent),
    PeerResponseProgressArrived(inputs::PeerResponseProgressArrived),
    PeerResponseTerminalArrived(inputs::PeerResponseTerminalArrived),
    PeerRequestTimedOut(inputs::PeerRequestTimedOut),
    PeerRequestReceived(inputs::PeerRequestReceived),
    PeerResponseReplied(inputs::PeerResponseReplied),
    AdvanceSessionContext(inputs::AdvanceSessionContext),
    InteractionStreamReserved(inputs::InteractionStreamReserved),
    InteractionStreamAttached(inputs::InteractionStreamAttached),
    InteractionStreamCompleted(inputs::InteractionStreamCompleted),
    InteractionStreamExpired(inputs::InteractionStreamExpired),
    InteractionStreamClosedEarly(inputs::InteractionStreamClosedEarly),
    AttachSessionIngress(inputs::AttachSessionIngress),
    AttachMobIngress(inputs::AttachMobIngress),
    DetachIngress(inputs::DetachIngress),
    BindSupervisor(inputs::BindSupervisor),
    AuthorizeSupervisor(inputs::AuthorizeSupervisor),
    RevokeSupervisor(inputs::RevokeSupervisor),
    SupervisorTrustEdgePublished(inputs::SupervisorTrustEdgePublished),
    SupervisorTrustEdgePublishFailed(inputs::SupervisorTrustEdgePublishFailed),
    SupervisorTrustEdgeRevoked(inputs::SupervisorTrustEdgeRevoked),
    SupervisorTrustEdgeRevokeFailed(inputs::SupervisorTrustEdgeRevokeFailed),
    PublishLocalEndpoint(inputs::PublishLocalEndpoint),
    ClearLocalEndpoint(inputs::ClearLocalEndpoint),
    AddDirectPeerEndpoint(inputs::AddDirectPeerEndpoint),
    RemoveDirectPeerEndpoint(inputs::RemoveDirectPeerEndpoint),
    ApplyMobPeerOverlay(inputs::ApplyMobPeerOverlay),
}
impl Input {
    pub fn kind(&self) -> InputKind {
        match self {
            Self::RegisterSession(_) => InputKind::RegisterSession,
            Self::UnregisterSession(_) => InputKind::UnregisterSession,
            Self::ReconfigureSessionLlmIdentity(_) => InputKind::ReconfigureSessionLlmIdentity,
            Self::PrepareBindings(_) => InputKind::PrepareBindings,
            Self::SetPeerIngressContext(_) => InputKind::SetPeerIngressContext,
            Self::NotifyDrainExited(_) => InputKind::NotifyDrainExited,
            Self::InterruptCurrentRun(_) => InputKind::InterruptCurrentRun,
            Self::CancelAfterBoundary(_) => InputKind::CancelAfterBoundary,
            Self::StagePersistentFilter(_) => InputKind::StagePersistentFilter,
            Self::RequestDeferredTools(_) => InputKind::RequestDeferredTools,
            Self::PublishCommittedVisibleSet(_) => InputKind::PublishCommittedVisibleSet,
            Self::Recover(_) => InputKind::Recover,
            Self::Retire(_) => InputKind::Retire,
            Self::Reset(_) => InputKind::Reset,
            Self::StopRuntimeExecutor(_) => InputKind::StopRuntimeExecutor,
            Self::RuntimeExecutorExited(_) => InputKind::RuntimeExecutorExited,
            Self::Destroy(_) => InputKind::Destroy,
            Self::EnsureSessionWithExecutor(_) => InputKind::EnsureSessionWithExecutor,
            Self::SetSilentIntents(_) => InputKind::SetSilentIntents,
            Self::ContainsSession(_) => InputKind::ContainsSession,
            Self::SessionHasExecutor(_) => InputKind::SessionHasExecutor,
            Self::SessionHasComms(_) => InputKind::SessionHasComms,
            Self::OpsLifecycleRegistry(_) => InputKind::OpsLifecycleRegistry,
            Self::InputState(_) => InputKind::InputState,
            Self::ListActiveInputs(_) => InputKind::ListActiveInputs,
            Self::Abort(_) => InputKind::Abort,
            Self::AbortAll(_) => InputKind::AbortAll,
            Self::Wait(_) => InputKind::Wait,
            Self::Ingest(_) => InputKind::Ingest,
            Self::PublishEvent(_) => InputKind::PublishEvent,
            Self::RuntimeState(_) => InputKind::RuntimeState,
            Self::ModelRoutingStatus(_) => InputKind::ModelRoutingStatus,
            Self::SetModelRoutingBaseline(_) => InputKind::SetModelRoutingBaseline,
            Self::RequestFiniteSwitchTurn(_) => InputKind::RequestFiniteSwitchTurn,
            Self::RequestUntilChangedSwitchTurn(_) => InputKind::RequestUntilChangedSwitchTurn,
            Self::CompleteUntilChangedSwitchTurnReconfigure(_) => {
                InputKind::CompleteUntilChangedSwitchTurnReconfigure
            }
            Self::AdmitModelRoutingAssistantTurn(_) => InputKind::AdmitModelRoutingAssistantTurn,
            Self::BeginImageOperation(_) => InputKind::BeginImageOperation,
            Self::ActivateImageOperationOverride(_) => InputKind::ActivateImageOperationOverride,
            Self::CompleteImageOperation(_) => InputKind::CompleteImageOperation,
            Self::RestoreImageOperationOverride(_) => InputKind::RestoreImageOperationOverride,
            Self::LoadBoundaryReceipt(_) => InputKind::LoadBoundaryReceipt,
            Self::AcceptWithCompletion(_) => InputKind::AcceptWithCompletion,
            Self::AcceptWithoutWake(_) => InputKind::AcceptWithoutWake,
            Self::Prepare(_) => InputKind::Prepare,
            Self::Commit(_) => InputKind::Commit,
            Self::Fail(_) => InputKind::Fail,
            Self::CancelRun(_) => InputKind::CancelRun,
            Self::RollbackRun(_) => InputKind::RollbackRun,
            Self::Recycle(_) => InputKind::Recycle,
            Self::StartConversationRun(_) => InputKind::StartConversationRun,
            Self::StartImmediateAppend(_) => InputKind::StartImmediateAppend,
            Self::StartImmediateContext(_) => InputKind::StartImmediateContext,
            Self::PrimitiveApplied(_) => InputKind::PrimitiveApplied,
            Self::LlmReturnedToolCalls(_) => InputKind::LlmReturnedToolCalls,
            Self::LlmReturnedTerminal(_) => InputKind::LlmReturnedTerminal,
            Self::RegisterPendingOps(_) => InputKind::RegisterPendingOps,
            Self::ToolCallsResolved(_) => InputKind::ToolCallsResolved,
            Self::OpsBarrierSatisfied(_) => InputKind::OpsBarrierSatisfied,
            Self::BoundaryContinue(_) => InputKind::BoundaryContinue,
            Self::BoundaryComplete(_) => InputKind::BoundaryComplete,
            Self::EnterExtraction(_) => InputKind::EnterExtraction,
            Self::ExtractionStart(_) => InputKind::ExtractionStart,
            Self::ExtractionValidationPassed(_) => InputKind::ExtractionValidationPassed,
            Self::ExtractionValidationFailed(_) => InputKind::ExtractionValidationFailed,
            Self::ExtractionFailed(_) => InputKind::ExtractionFailed,
            Self::RecoverableFailure(_) => InputKind::RecoverableFailure,
            Self::FatalFailure(_) => InputKind::FatalFailure,
            Self::RetryRequested(_) => InputKind::RetryRequested,
            Self::CancelNow(_) => InputKind::CancelNow,
            Self::RequestCancelAfterBoundary(_) => InputKind::RequestCancelAfterBoundary,
            Self::CancellationObserved(_) => InputKind::CancellationObserved,
            Self::AcknowledgeTerminal(_) => InputKind::AcknowledgeTerminal,
            Self::TurnLimitReached(_) => InputKind::TurnLimitReached,
            Self::BudgetExhausted(_) => InputKind::BudgetExhausted,
            Self::TimeBudgetExceeded(_) => InputKind::TimeBudgetExceeded,
            Self::ForceCancelNoRun(_) => InputKind::ForceCancelNoRun,
            Self::RunCompleted(_) => InputKind::RunCompleted,
            Self::ServiceTurnCommitted(_) => InputKind::ServiceTurnCommitted,
            Self::RunFailed(_) => InputKind::RunFailed,
            Self::RunCancelled(_) => InputKind::RunCancelled,
            Self::RecoverInputLifecycle(_) => InputKind::RecoverInputLifecycle,
            Self::QueueAccepted(_) => InputKind::QueueAccepted,
            Self::SteerAccepted(_) => InputKind::SteerAccepted,
            Self::ChangeLane(_) => InputKind::ChangeLane,
            Self::StageForRun(_) => InputKind::StageForRun,
            Self::IncrementAttemptCount(_) => InputKind::IncrementAttemptCount,
            Self::RollbackStaged(_) => InputKind::RollbackStaged,
            Self::MarkApplied(_) => InputKind::MarkApplied,
            Self::MarkAppliedPendingConsumption(_) => InputKind::MarkAppliedPendingConsumption,
            Self::ConsumeInput(_) => InputKind::ConsumeInput,
            Self::ConsumeOnAccept(_) => InputKind::ConsumeOnAccept,
            Self::SupersedeInput(_) => InputKind::SupersedeInput,
            Self::CoalesceInput(_) => InputKind::CoalesceInput,
            Self::AbandonInput(_) => InputKind::AbandonInput,
            Self::RecordBoundarySeq(_) => InputKind::RecordBoundarySeq,
            Self::RegisterOp(_) => InputKind::RegisterOp,
            Self::StartOp(_) => InputKind::StartOp,
            Self::CompleteOp(_) => InputKind::CompleteOp,
            Self::FailOp(_) => InputKind::FailOp,
            Self::CancelOp(_) => InputKind::CancelOp,
            Self::AbortOp(_) => InputKind::AbortOp,
            Self::PeerReadyOp(_) => InputKind::PeerReadyOp,
            Self::ProgressReportedOp(_) => InputKind::ProgressReportedOp,
            Self::RetireRequestedOp(_) => InputKind::RetireRequestedOp,
            Self::RetireCompletedOp(_) => InputKind::RetireCompletedOp,
            Self::TerminateOp(_) => InputKind::TerminateOp,
            Self::RequestWaitAll(_) => InputKind::RequestWaitAll,
            Self::SatisfyWaitAll(_) => InputKind::SatisfyWaitAll,
            Self::CancelWaitAll(_) => InputKind::CancelWaitAll,
            Self::SpawnDrain(_) => InputKind::SpawnDrain,
            Self::StopDrain(_) => InputKind::StopDrain,
            Self::DrainExitedClean(_) => InputKind::DrainExitedClean,
            Self::DrainExitedRespawnable(_) => InputKind::DrainExitedRespawnable,
            Self::StageVisibilityFilter(_) => InputKind::StageVisibilityFilter,
            Self::CommitVisibilityFilter(_) => InputKind::CommitVisibilityFilter,
            Self::StageDeferredNames(_) => InputKind::StageDeferredNames,
            Self::CommitDeferredNames(_) => InputKind::CommitDeferredNames,
            Self::SyncVisibilityRevisions(_) => InputKind::SyncVisibilityRevisions,
            Self::SurfaceRegister(_) => InputKind::SurfaceRegister,
            Self::SurfaceStageAdd(_) => InputKind::SurfaceStageAdd,
            Self::SurfaceStageRemove(_) => InputKind::SurfaceStageRemove,
            Self::SurfaceStageReload(_) => InputKind::SurfaceStageReload,
            Self::SurfaceApplyBoundary(_) => InputKind::SurfaceApplyBoundary,
            Self::SurfaceMarkPendingSucceeded(_) => InputKind::SurfaceMarkPendingSucceeded,
            Self::SurfaceMarkPendingFailed(_) => InputKind::SurfaceMarkPendingFailed,
            Self::SurfaceCallStarted(_) => InputKind::SurfaceCallStarted,
            Self::SurfaceCallFinished(_) => InputKind::SurfaceCallFinished,
            Self::SurfaceFinalizeRemovalClean(_) => InputKind::SurfaceFinalizeRemovalClean,
            Self::SurfaceFinalizeRemovalForced(_) => InputKind::SurfaceFinalizeRemovalForced,
            Self::SurfaceSnapshotAligned(_) => InputKind::SurfaceSnapshotAligned,
            Self::SurfaceShutdown(_) => InputKind::SurfaceShutdown,
            Self::McpServerConnectPending(_) => InputKind::McpServerConnectPending,
            Self::McpServerConnected(_) => InputKind::McpServerConnected,
            Self::McpServerFailed(_) => InputKind::McpServerFailed,
            Self::McpServerDisconnected(_) => InputKind::McpServerDisconnected,
            Self::McpServerReload(_) => InputKind::McpServerReload,
            Self::PeerRequestSent(_) => InputKind::PeerRequestSent,
            Self::PeerResponseProgressArrived(_) => InputKind::PeerResponseProgressArrived,
            Self::PeerResponseTerminalArrived(_) => InputKind::PeerResponseTerminalArrived,
            Self::PeerRequestTimedOut(_) => InputKind::PeerRequestTimedOut,
            Self::PeerRequestReceived(_) => InputKind::PeerRequestReceived,
            Self::PeerResponseReplied(_) => InputKind::PeerResponseReplied,
            Self::AdvanceSessionContext(_) => InputKind::AdvanceSessionContext,
            Self::InteractionStreamReserved(_) => InputKind::InteractionStreamReserved,
            Self::InteractionStreamAttached(_) => InputKind::InteractionStreamAttached,
            Self::InteractionStreamCompleted(_) => InputKind::InteractionStreamCompleted,
            Self::InteractionStreamExpired(_) => InputKind::InteractionStreamExpired,
            Self::InteractionStreamClosedEarly(_) => InputKind::InteractionStreamClosedEarly,
            Self::AttachSessionIngress(_) => InputKind::AttachSessionIngress,
            Self::AttachMobIngress(_) => InputKind::AttachMobIngress,
            Self::DetachIngress(_) => InputKind::DetachIngress,
            Self::BindSupervisor(_) => InputKind::BindSupervisor,
            Self::AuthorizeSupervisor(_) => InputKind::AuthorizeSupervisor,
            Self::RevokeSupervisor(_) => InputKind::RevokeSupervisor,
            Self::SupervisorTrustEdgePublished(_) => InputKind::SupervisorTrustEdgePublished,
            Self::SupervisorTrustEdgePublishFailed(_) => {
                InputKind::SupervisorTrustEdgePublishFailed
            }
            Self::SupervisorTrustEdgeRevoked(_) => InputKind::SupervisorTrustEdgeRevoked,
            Self::SupervisorTrustEdgeRevokeFailed(_) => InputKind::SupervisorTrustEdgeRevokeFailed,
            Self::PublishLocalEndpoint(_) => InputKind::PublishLocalEndpoint,
            Self::ClearLocalEndpoint(_) => InputKind::ClearLocalEndpoint,
            Self::AddDirectPeerEndpoint(_) => InputKind::AddDirectPeerEndpoint,
            Self::RemoveDirectPeerEndpoint(_) => InputKind::RemoveDirectPeerEndpoint,
            Self::ApplyMobPeerOverlay(_) => InputKind::ApplyMobPeerOverlay,
        }
    }
}
#[derive(Debug, Clone, Copy, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
pub enum InputKind {
    RegisterSession,
    UnregisterSession,
    ReconfigureSessionLlmIdentity,
    PrepareBindings,
    SetPeerIngressContext,
    NotifyDrainExited,
    InterruptCurrentRun,
    CancelAfterBoundary,
    StagePersistentFilter,
    RequestDeferredTools,
    PublishCommittedVisibleSet,
    Recover,
    Retire,
    Reset,
    StopRuntimeExecutor,
    RuntimeExecutorExited,
    Destroy,
    EnsureSessionWithExecutor,
    SetSilentIntents,
    ContainsSession,
    SessionHasExecutor,
    SessionHasComms,
    OpsLifecycleRegistry,
    InputState,
    ListActiveInputs,
    Abort,
    AbortAll,
    Wait,
    Ingest,
    PublishEvent,
    RuntimeState,
    ModelRoutingStatus,
    SetModelRoutingBaseline,
    RequestFiniteSwitchTurn,
    RequestUntilChangedSwitchTurn,
    CompleteUntilChangedSwitchTurnReconfigure,
    AdmitModelRoutingAssistantTurn,
    BeginImageOperation,
    ActivateImageOperationOverride,
    CompleteImageOperation,
    RestoreImageOperationOverride,
    LoadBoundaryReceipt,
    AcceptWithCompletion,
    AcceptWithoutWake,
    Prepare,
    Commit,
    Fail,
    CancelRun,
    RollbackRun,
    Recycle,
    StartConversationRun,
    StartImmediateAppend,
    StartImmediateContext,
    PrimitiveApplied,
    LlmReturnedToolCalls,
    LlmReturnedTerminal,
    RegisterPendingOps,
    ToolCallsResolved,
    OpsBarrierSatisfied,
    BoundaryContinue,
    BoundaryComplete,
    EnterExtraction,
    ExtractionStart,
    ExtractionValidationPassed,
    ExtractionValidationFailed,
    ExtractionFailed,
    RecoverableFailure,
    FatalFailure,
    RetryRequested,
    CancelNow,
    RequestCancelAfterBoundary,
    CancellationObserved,
    AcknowledgeTerminal,
    TurnLimitReached,
    BudgetExhausted,
    TimeBudgetExceeded,
    ForceCancelNoRun,
    RunCompleted,
    ServiceTurnCommitted,
    RunFailed,
    RunCancelled,
    RecoverInputLifecycle,
    QueueAccepted,
    SteerAccepted,
    ChangeLane,
    StageForRun,
    IncrementAttemptCount,
    RollbackStaged,
    MarkApplied,
    MarkAppliedPendingConsumption,
    ConsumeInput,
    ConsumeOnAccept,
    SupersedeInput,
    CoalesceInput,
    AbandonInput,
    RecordBoundarySeq,
    RegisterOp,
    StartOp,
    CompleteOp,
    FailOp,
    CancelOp,
    AbortOp,
    PeerReadyOp,
    ProgressReportedOp,
    RetireRequestedOp,
    RetireCompletedOp,
    TerminateOp,
    RequestWaitAll,
    SatisfyWaitAll,
    CancelWaitAll,
    SpawnDrain,
    StopDrain,
    DrainExitedClean,
    DrainExitedRespawnable,
    StageVisibilityFilter,
    CommitVisibilityFilter,
    StageDeferredNames,
    CommitDeferredNames,
    SyncVisibilityRevisions,
    SurfaceRegister,
    SurfaceStageAdd,
    SurfaceStageRemove,
    SurfaceStageReload,
    SurfaceApplyBoundary,
    SurfaceMarkPendingSucceeded,
    SurfaceMarkPendingFailed,
    SurfaceCallStarted,
    SurfaceCallFinished,
    SurfaceFinalizeRemovalClean,
    SurfaceFinalizeRemovalForced,
    SurfaceSnapshotAligned,
    SurfaceShutdown,
    McpServerConnectPending,
    McpServerConnected,
    McpServerFailed,
    McpServerDisconnected,
    McpServerReload,
    PeerRequestSent,
    PeerResponseProgressArrived,
    PeerResponseTerminalArrived,
    PeerRequestTimedOut,
    PeerRequestReceived,
    PeerResponseReplied,
    AdvanceSessionContext,
    InteractionStreamReserved,
    InteractionStreamAttached,
    InteractionStreamCompleted,
    InteractionStreamExpired,
    InteractionStreamClosedEarly,
    AttachSessionIngress,
    AttachMobIngress,
    DetachIngress,
    BindSupervisor,
    AuthorizeSupervisor,
    RevokeSupervisor,
    SupervisorTrustEdgePublished,
    SupervisorTrustEdgePublishFailed,
    SupervisorTrustEdgeRevoked,
    SupervisorTrustEdgeRevokeFailed,
    PublishLocalEndpoint,
    ClearLocalEndpoint,
    AddDirectPeerEndpoint,
    RemoveDirectPeerEndpoint,
    ApplyMobPeerOverlay,
}

pub mod signals {
    #[allow(unused_imports)]
    use super::*;
    #[derive(Debug, Clone, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
    pub struct Initialize {}
    #[derive(Debug, Clone, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
    pub struct BoundaryApplied {
        pub revision: u64,
    }
    #[derive(Debug, Clone, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
    pub struct DrainQueuedRun {
        pub run_id: RunId,
    }
    #[derive(Debug, Clone, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
    pub struct ClassifyExternalEnvelope {
        pub item_id: String,
        pub from_peer: String,
        pub envelope_kind: PeerIngressEnvelopeClass,
        pub request_intent: String,
        pub lifecycle_kind: PeerIngressLifecycleClass,
        pub lifecycle_peer_param: Option<String>,
        pub response_status: PeerIngressResponseStatus,
        pub in_reply_to: String,
    }
    #[derive(Debug, Clone, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
    pub struct ClassifyPlainEvent {
        pub source_name: String,
    }
    #[derive(Debug, Clone, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
    pub struct EnsureDrainRunning {}
}

#[derive(Debug, Clone, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
pub enum Signal {
    Initialize(signals::Initialize),
    BoundaryApplied(signals::BoundaryApplied),
    DrainQueuedRun(signals::DrainQueuedRun),
    ClassifyExternalEnvelope(signals::ClassifyExternalEnvelope),
    ClassifyPlainEvent(signals::ClassifyPlainEvent),
    EnsureDrainRunning(signals::EnsureDrainRunning),
}
impl Signal {
    pub fn kind(&self) -> SignalKind {
        match self {
            Self::Initialize(_) => SignalKind::Initialize,
            Self::BoundaryApplied(_) => SignalKind::BoundaryApplied,
            Self::DrainQueuedRun(_) => SignalKind::DrainQueuedRun,
            Self::ClassifyExternalEnvelope(_) => SignalKind::ClassifyExternalEnvelope,
            Self::ClassifyPlainEvent(_) => SignalKind::ClassifyPlainEvent,
            Self::EnsureDrainRunning(_) => SignalKind::EnsureDrainRunning,
        }
    }
}
#[derive(Debug, Clone, Copy, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
pub enum SignalKind {
    Initialize,
    BoundaryApplied,
    DrainQueuedRun,
    ClassifyExternalEnvelope,
    ClassifyPlainEvent,
    EnsureDrainRunning,
}

pub mod effects {
    #[allow(unused_imports)]
    use super::*;
    #[derive(Debug, Clone, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
    pub struct RuntimeBound {
        pub agent_runtime_id: AgentRuntimeId,
        pub fence_token: FenceToken,
    }
    #[derive(Debug, Clone, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
    pub struct RuntimeRetired {
        pub agent_runtime_id: AgentRuntimeId,
        pub fence_token: FenceToken,
    }
    #[derive(Debug, Clone, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
    pub struct RuntimeDestroyed {
        pub agent_runtime_id: AgentRuntimeId,
        pub fence_token: FenceToken,
    }
    #[derive(Debug, Clone, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
    pub struct TurnRunStarted {
        pub run_id: RunId,
    }
    #[derive(Debug, Clone, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
    pub struct TurnBoundaryApplied {
        pub run_id: RunId,
        pub boundary_sequence: u64,
    }
    #[derive(Debug, Clone, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
    pub struct TurnRunCompleted {
        pub run_id: RunId,
        pub outcome: TurnTerminalOutcome,
    }
    #[derive(Debug, Clone, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
    pub struct TurnRunFailed {
        pub run_id: RunId,
        pub terminal_cause_kind: TurnTerminalCauseKind,
        pub error: String,
    }
    #[derive(Debug, Clone, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
    pub struct TurnRunCancelled {
        pub run_id: RunId,
        pub reason: TurnCancellationReason,
    }
    #[derive(Debug, Clone, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
    pub struct TurnCheckCompaction {}
    #[derive(Debug, Clone, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
    pub struct RequestCancellationAtBoundary {}
    #[derive(Debug, Clone, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
    pub struct WakeInterrupt {}
    #[derive(Debug, Clone, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
    pub struct CommittedVisibleSetPublished {
        pub revision: u64,
    }
    #[derive(Debug, Clone, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
    pub struct RuntimeNotice {
        pub kind: RuntimeNoticeKind,
        pub detail: String,
    }
    #[derive(Debug, Clone, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
    pub struct RuntimeEffectFact {
        pub kind: RuntimeEffectKind,
        pub reason: String,
    }
    #[derive(Debug, Clone, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
    pub struct ModelRoutingStatusChanged {
        pub topology_epoch: u64,
    }
    #[derive(Debug, Clone, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
    pub struct SwitchTurnDenied {
        pub request_id: String,
        pub reason: RoutingDenialReason,
    }
    #[derive(Debug, Clone, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
    pub struct SwitchTurnPersistentReconfigureRequested {
        pub request_id: String,
        pub target_model: String,
    }
    #[derive(Debug, Clone, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
    pub struct SwitchTurnFiniteOverrideActivated {
        pub request_id: String,
        pub target_model: String,
        pub turns_remaining: u64,
    }
    #[derive(Debug, Clone, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
    pub struct SwitchTurnFiniteOverrideRestored {
        pub request_id: String,
    }
    #[derive(Debug, Clone, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
    pub struct ImageOperationPhaseChanged {
        pub operation_id: String,
        pub phase: RoutingImageOperationPhase,
    }
    #[derive(Debug, Clone, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
    pub struct ImageOperationDenied {
        pub operation_id: String,
        pub reason: RoutingDenialReason,
    }
    #[derive(Debug, Clone, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
    pub struct ModelRoutingApprovalTerminalized {
        pub approval_id: String,
        pub phase: RoutingApprovalPhase,
    }
    #[derive(Debug, Clone, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
    pub struct ResolveAdmission {}
    #[derive(Debug, Clone, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
    pub struct SubmitAdmittedIngressEffect {}
    #[derive(Debug, Clone, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
    pub struct SubmitRunPrimitive {}
    #[derive(Debug, Clone, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
    pub struct ResolveCompletionAsTerminated {}
    #[derive(Debug, Clone, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
    pub struct ApplyControlPlaneCommand {}
    #[derive(Debug, Clone, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
    pub struct InitiateRecycle {}
    #[derive(Debug, Clone, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
    pub struct IngressAccepted {}
    #[derive(Debug, Clone, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
    pub struct PostAdmissionSignal {
        pub signal: PostAdmissionSignalKind,
    }
    #[derive(Debug, Clone, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
    pub struct ReadyForRun {}
    #[derive(Debug, Clone, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
    pub struct InputLifecycleNotice {}
    #[derive(Debug, Clone, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
    pub struct CompletionResolved {}
    #[derive(Debug, Clone, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
    pub struct IngressNotice {}
    #[derive(Debug, Clone, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
    pub struct SilentIntentApplied {}
    #[derive(Debug, Clone, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
    pub struct CheckCompaction {}
    #[derive(Debug, Clone, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
    pub struct RecordTerminalOutcome {}
    #[derive(Debug, Clone, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
    pub struct RecordRunAssociation {}
    #[derive(Debug, Clone, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
    pub struct RecordBoundarySequence {}
    #[derive(Debug, Clone, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
    pub struct SubmitOpEvent {
        pub operation_id: String,
    }
    #[derive(Debug, Clone, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
    pub struct NotifyOpWatcher {
        pub operation_id: String,
    }
    #[derive(Debug, Clone, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
    pub struct ExposeOperationPeer {
        pub operation_id: String,
    }
    #[derive(Debug, Clone, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
    pub struct RetainTerminalRecord {
        pub operation_id: String,
    }
    #[derive(Debug, Clone, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
    pub struct EvictCompletedRecord {
        pub operation_id: String,
    }
    #[derive(Debug, Clone, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
    pub struct CompletionProduced {
        pub seq: u64,
        pub operation_id: OperationId,
        pub kind: OperationKind,
    }
    #[derive(Debug, Clone, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
    pub struct WaitAllSatisfied {
        pub wait_request_id: WaitRequestId,
        pub operation_ids: std::collections::BTreeSet<OperationId>,
    }
    #[derive(Debug, Clone, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
    pub struct CollectCompletedResult {}
    #[derive(Debug, Clone, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
    pub struct EnqueueClassifiedEntry {}
    #[derive(Debug, Clone, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
    pub struct PeerIngressClassified {
        pub class: PeerIngressInputClass,
        pub kind: PeerIngressAdmittedKind,
        pub auth: PeerIngressAuthClass,
        pub lifecycle_kind: Option<PeerIngressLifecycleClass>,
        pub lifecycle_peer: Option<String>,
        pub request_id: Option<String>,
        pub response_terminality: Option<PeerIngressResponseTerminality>,
    }
    #[derive(Debug, Clone, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
    pub struct SpawnDrainTask {}
    #[derive(Debug, Clone, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
    pub struct ScheduleSurfaceCompletion {
        pub surface_id: String,
        pub operation: ExternalToolSurfaceDeltaOperation,
        pub pending_task_sequence: u64,
        pub staged_intent_sequence: u64,
        pub applied_at_turn: u64,
    }
    #[derive(Debug, Clone, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
    pub struct RefreshVisibleSurfaceSet {
        pub snapshot_epoch: u64,
    }
    #[derive(Debug, Clone, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
    pub struct EmitExternalToolDelta {
        pub surface_id: String,
        pub operation: ExternalToolSurfaceDeltaOperation,
        pub phase: ExternalToolSurfaceDeltaPhase,
        pub cause: Option<ExternalToolSurfaceFailureCause>,
    }
    #[derive(Debug, Clone, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
    pub struct CloseSurfaceConnection {
        pub surface_id: String,
    }
    #[derive(Debug, Clone, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
    pub struct RejectSurfaceCall {
        pub surface_id: String,
        pub cause: ExternalToolSurfaceFailureCause,
    }
    #[derive(Debug, Clone, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
    pub struct PublishSupervisorTrustEdge {
        pub peer_id: String,
        pub name: String,
        pub address: String,
        pub signing_public_key: Option<String>,
        pub epoch: u64,
    }
    #[derive(Debug, Clone, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
    pub struct RevokeSupervisorTrustEdge {
        pub peer_id: String,
        pub epoch: u64,
    }
    #[derive(Debug, Clone, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
    pub struct McpServerStateChanged {
        pub server_id: McpServerId,
        pub new_state: McpServerState,
    }
    #[derive(Debug, Clone, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
    pub struct McpServerReloadRequested {
        pub server_id: McpServerId,
    }
    #[derive(Debug, Clone, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
    pub struct PeerInteractionStateChanged {
        pub corr_id: PeerCorrelationId,
        pub new_state: OutboundPeerRequestState,
    }
    #[derive(Debug, Clone, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
    pub struct PeerInteractionCleanup {
        pub corr_id: PeerCorrelationId,
    }
    #[derive(Debug, Clone, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
    pub struct InboundPeerInteractionStateChanged {
        pub corr_id: PeerCorrelationId,
        pub new_state: InboundPeerRequestState,
    }
    #[derive(Debug, Clone, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
    pub struct SessionContextAdvanced {
        pub updated_at_ms: u64,
    }
    #[derive(Debug, Clone, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
    pub struct InteractionStreamStateChanged {
        pub corr_id: PeerCorrelationId,
        pub new_state: InteractionStreamState,
    }
    #[derive(Debug, Clone, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
    pub struct InteractionStreamCleanup {
        pub corr_id: PeerCorrelationId,
    }
    #[derive(Debug, Clone, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
    pub struct LocalEndpointChanged {
        pub endpoint: Option<PeerEndpoint>,
    }
    #[derive(Debug, Clone, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
    pub struct PeerProjectionChanged {
        pub peer_projection_epoch: u64,
    }
    #[derive(Debug, Clone, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
    pub struct CommsTrustReconcileRequested {
        pub peer_projection_epoch: u64,
    }
}

#[derive(Debug, Clone, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
pub enum Effect {
    RuntimeBound(effects::RuntimeBound),
    RuntimeRetired(effects::RuntimeRetired),
    RuntimeDestroyed(effects::RuntimeDestroyed),
    TurnRunStarted(effects::TurnRunStarted),
    TurnBoundaryApplied(effects::TurnBoundaryApplied),
    TurnRunCompleted(effects::TurnRunCompleted),
    TurnRunFailed(effects::TurnRunFailed),
    TurnRunCancelled(effects::TurnRunCancelled),
    TurnCheckCompaction(effects::TurnCheckCompaction),
    RequestCancellationAtBoundary(effects::RequestCancellationAtBoundary),
    WakeInterrupt(effects::WakeInterrupt),
    CommittedVisibleSetPublished(effects::CommittedVisibleSetPublished),
    RuntimeNotice(effects::RuntimeNotice),
    RuntimeEffectFact(effects::RuntimeEffectFact),
    ModelRoutingStatusChanged(effects::ModelRoutingStatusChanged),
    SwitchTurnDenied(effects::SwitchTurnDenied),
    SwitchTurnPersistentReconfigureRequested(effects::SwitchTurnPersistentReconfigureRequested),
    SwitchTurnFiniteOverrideActivated(effects::SwitchTurnFiniteOverrideActivated),
    SwitchTurnFiniteOverrideRestored(effects::SwitchTurnFiniteOverrideRestored),
    ImageOperationPhaseChanged(effects::ImageOperationPhaseChanged),
    ImageOperationDenied(effects::ImageOperationDenied),
    ModelRoutingApprovalTerminalized(effects::ModelRoutingApprovalTerminalized),
    ResolveAdmission(effects::ResolveAdmission),
    SubmitAdmittedIngressEffect(effects::SubmitAdmittedIngressEffect),
    SubmitRunPrimitive(effects::SubmitRunPrimitive),
    ResolveCompletionAsTerminated(effects::ResolveCompletionAsTerminated),
    ApplyControlPlaneCommand(effects::ApplyControlPlaneCommand),
    InitiateRecycle(effects::InitiateRecycle),
    IngressAccepted(effects::IngressAccepted),
    PostAdmissionSignal(effects::PostAdmissionSignal),
    ReadyForRun(effects::ReadyForRun),
    InputLifecycleNotice(effects::InputLifecycleNotice),
    CompletionResolved(effects::CompletionResolved),
    IngressNotice(effects::IngressNotice),
    SilentIntentApplied(effects::SilentIntentApplied),
    CheckCompaction(effects::CheckCompaction),
    RecordTerminalOutcome(effects::RecordTerminalOutcome),
    RecordRunAssociation(effects::RecordRunAssociation),
    RecordBoundarySequence(effects::RecordBoundarySequence),
    SubmitOpEvent(effects::SubmitOpEvent),
    NotifyOpWatcher(effects::NotifyOpWatcher),
    ExposeOperationPeer(effects::ExposeOperationPeer),
    RetainTerminalRecord(effects::RetainTerminalRecord),
    EvictCompletedRecord(effects::EvictCompletedRecord),
    CompletionProduced(effects::CompletionProduced),
    WaitAllSatisfied(effects::WaitAllSatisfied),
    CollectCompletedResult(effects::CollectCompletedResult),
    EnqueueClassifiedEntry(effects::EnqueueClassifiedEntry),
    PeerIngressClassified(effects::PeerIngressClassified),
    SpawnDrainTask(effects::SpawnDrainTask),
    ScheduleSurfaceCompletion(effects::ScheduleSurfaceCompletion),
    RefreshVisibleSurfaceSet(effects::RefreshVisibleSurfaceSet),
    EmitExternalToolDelta(effects::EmitExternalToolDelta),
    CloseSurfaceConnection(effects::CloseSurfaceConnection),
    RejectSurfaceCall(effects::RejectSurfaceCall),
    PublishSupervisorTrustEdge(effects::PublishSupervisorTrustEdge),
    RevokeSupervisorTrustEdge(effects::RevokeSupervisorTrustEdge),
    McpServerStateChanged(effects::McpServerStateChanged),
    McpServerReloadRequested(effects::McpServerReloadRequested),
    PeerInteractionStateChanged(effects::PeerInteractionStateChanged),
    PeerInteractionCleanup(effects::PeerInteractionCleanup),
    InboundPeerInteractionStateChanged(effects::InboundPeerInteractionStateChanged),
    SessionContextAdvanced(effects::SessionContextAdvanced),
    InteractionStreamStateChanged(effects::InteractionStreamStateChanged),
    InteractionStreamCleanup(effects::InteractionStreamCleanup),
    LocalEndpointChanged(effects::LocalEndpointChanged),
    PeerProjectionChanged(effects::PeerProjectionChanged),
    CommsTrustReconcileRequested(effects::CommsTrustReconcileRequested),
}
#[derive(Debug, Clone, Copy, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
pub enum EffectKind {
    RuntimeBound,
    RuntimeRetired,
    RuntimeDestroyed,
    TurnRunStarted,
    TurnBoundaryApplied,
    TurnRunCompleted,
    TurnRunFailed,
    TurnRunCancelled,
    TurnCheckCompaction,
    RequestCancellationAtBoundary,
    WakeInterrupt,
    CommittedVisibleSetPublished,
    RuntimeNotice,
    RuntimeEffectFact,
    ModelRoutingStatusChanged,
    SwitchTurnDenied,
    SwitchTurnPersistentReconfigureRequested,
    SwitchTurnFiniteOverrideActivated,
    SwitchTurnFiniteOverrideRestored,
    ImageOperationPhaseChanged,
    ImageOperationDenied,
    ModelRoutingApprovalTerminalized,
    ResolveAdmission,
    SubmitAdmittedIngressEffect,
    SubmitRunPrimitive,
    ResolveCompletionAsTerminated,
    ApplyControlPlaneCommand,
    InitiateRecycle,
    IngressAccepted,
    PostAdmissionSignal,
    ReadyForRun,
    InputLifecycleNotice,
    CompletionResolved,
    IngressNotice,
    SilentIntentApplied,
    CheckCompaction,
    RecordTerminalOutcome,
    RecordRunAssociation,
    RecordBoundarySequence,
    SubmitOpEvent,
    NotifyOpWatcher,
    ExposeOperationPeer,
    RetainTerminalRecord,
    EvictCompletedRecord,
    CompletionProduced,
    WaitAllSatisfied,
    CollectCompletedResult,
    EnqueueClassifiedEntry,
    PeerIngressClassified,
    SpawnDrainTask,
    ScheduleSurfaceCompletion,
    RefreshVisibleSurfaceSet,
    EmitExternalToolDelta,
    CloseSurfaceConnection,
    RejectSurfaceCall,
    PublishSupervisorTrustEdge,
    RevokeSupervisorTrustEdge,
    McpServerStateChanged,
    McpServerReloadRequested,
    PeerInteractionStateChanged,
    PeerInteractionCleanup,
    InboundPeerInteractionStateChanged,
    SessionContextAdvanced,
    InteractionStreamStateChanged,
    InteractionStreamCleanup,
    LocalEndpointChanged,
    PeerProjectionChanged,
    CommsTrustReconcileRequested,
}

#[allow(non_camel_case_types)]
#[derive(Debug, Clone, Copy, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
pub enum TransitionId {
    Initialize,
    RegisterSessionIdle,
    RegisterSessionAttached,
    RegisterSessionRunning,
    RegisterSessionRetired,
    RegisterSessionStopped,
    UnregisterSessionIdle,
    UnregisterSessionAttached,
    UnregisterSessionRunning,
    UnregisterSessionRetired,
    UnregisterSessionStopped,
    ReconfigureSessionLlmIdentityAttached,
    ReconfigureSessionLlmIdentityRunning,
    SetModelRoutingBaselineIdle,
    SetModelRoutingBaselineAttached,
    SetModelRoutingBaselineRunning,
    SetModelRoutingBaselineRetired,
    SetModelRoutingBaselineStopped,
    RequestFiniteSwitchTurnApprovalUnavailableIdle,
    RequestFiniteSwitchTurnApprovalUnavailableAttached,
    RequestFiniteSwitchTurnApprovalUnavailableRunning,
    RequestFiniteSwitchTurnApprovalDeniedIdle,
    RequestFiniteSwitchTurnApprovalDeniedAttached,
    RequestFiniteSwitchTurnApprovalDeniedRunning,
    RequestFiniteSwitchTurnScopedConflictIdle,
    RequestFiniteSwitchTurnScopedConflictAttached,
    RequestFiniteSwitchTurnScopedConflictRunning,
    RequestFiniteSwitchTurnAcceptedIdle,
    RequestFiniteSwitchTurnAcceptedAttached,
    RequestFiniteSwitchTurnAcceptedRunning,
    RequestUntilChangedSwitchTurnAcceptedIdle,
    RequestUntilChangedSwitchTurnAcceptedAttached,
    RequestUntilChangedSwitchTurnAcceptedRunning,
    RequestUntilChangedSwitchTurnApprovalUnavailableIdle,
    RequestUntilChangedSwitchTurnApprovalUnavailableAttached,
    RequestUntilChangedSwitchTurnApprovalUnavailableRunning,
    RequestUntilChangedSwitchTurnApprovalDeniedIdle,
    RequestUntilChangedSwitchTurnApprovalDeniedAttached,
    RequestUntilChangedSwitchTurnApprovalDeniedRunning,
    CompleteUntilChangedSwitchTurnReconfigureIdle,
    CompleteUntilChangedSwitchTurnReconfigureAttached,
    CompleteUntilChangedSwitchTurnReconfigureRunning,
    AdmitPendingFiniteSwitchTurnIdle,
    AdmitPendingFiniteSwitchTurnAttached,
    AdmitPendingFiniteSwitchTurnRunning,
    DecrementFiniteSwitchTurnIdle,
    DecrementFiniteSwitchTurnAttached,
    DecrementFiniteSwitchTurnRunning,
    RestoreConsumedFiniteSwitchTurnIdle,
    RestoreConsumedFiniteSwitchTurnAttached,
    RestoreConsumedFiniteSwitchTurnRunning,
    BeginImageOperationScopedConflictIdle,
    BeginImageOperationScopedConflictAttached,
    BeginImageOperationScopedConflictRunning,
    BeginImageOperationApprovalUnavailableIdle,
    BeginImageOperationApprovalUnavailableAttached,
    BeginImageOperationApprovalUnavailableRunning,
    BeginImageOperationApprovalDeniedIdle,
    BeginImageOperationApprovalDeniedAttached,
    BeginImageOperationApprovalDeniedRunning,
    BeginImageOperationAcceptedIdle,
    BeginImageOperationAcceptedAttached,
    BeginImageOperationAcceptedRunning,
    ActivateImageOperationOverrideIdle,
    ActivateImageOperationOverrideAttached,
    ActivateImageOperationOverrideRunning,
    CompleteImageOperationIdle,
    CompleteImageOperationAttached,
    CompleteImageOperationRunning,
    CompleteImageOperationWithoutScopedOverrideIdle,
    CompleteImageOperationWithoutScopedOverrideAttached,
    CompleteImageOperationWithoutScopedOverrideRunning,
    RestoreImageOperationOverrideIdle,
    RestoreImageOperationOverrideAttached,
    RestoreImageOperationOverrideRunning,
    StagePersistentFilterIdle,
    StagePersistentFilterAttached,
    StagePersistentFilterRunning,
    StagePersistentFilterRetired,
    StagePersistentFilterStopped,
    RequestDeferredToolsIdle,
    RequestDeferredToolsAttached,
    RequestDeferredToolsRunning,
    RequestDeferredToolsRetired,
    RequestDeferredToolsStopped,
    PrepareBindingsInitializing,
    PrepareBindingsIdle,
    PrepareBindingsAttached,
    PrepareBindingsRunning,
    PrepareBindingsRetired,
    PrepareBindingsStopped,
    SetPeerIngressContextIdle,
    SetPeerIngressContextAttached,
    SetPeerIngressContextRunning,
    SetPeerIngressContextRetired,
    SetPeerIngressContextStopped,
    NotifyDrainExitedIdle,
    NotifyDrainExitedAttached,
    NotifyDrainExitedRunning,
    NotifyDrainExitedRetired,
    NotifyDrainExitedStopped,
    InterruptCurrentRunAttached,
    InterruptCurrentRun,
    CancelAfterBoundaryAttached,
    CancelAfterBoundary,
    BoundaryAppliedPublish,
    PublishCommittedVisibleSetIdle,
    PublishCommittedVisibleSetAttached,
    PublishCommittedVisibleSetRunning,
    PublishCommittedVisibleSetRetired,
    PublishCommittedVisibleSetStopped,
    RetireRequestedFromIdle,
    RetireAlreadyRetired,
    Reset,
    StopRuntimeExecutorInitializing,
    StopRuntimeExecutorIdle,
    StopRuntimeExecutorRetired,
    StopRuntimeExecutorAttached,
    StopRuntimeExecutorRunning,
    RuntimeExecutorExitedFromAttached,
    RuntimeExecutorExitedFromRunning,
    RuntimeExecutorExitedFromIdle,
    RuntimeExecutorExitedFromRetired,
    RuntimeExecutorExitedFromStopped,
    DestroyInitializing,
    Destroy,
    RecoverInitializing,
    RecoverIdle,
    RecoverAttached,
    RecoverRetired,
    RecoverStopped,
    EnsureSessionWithExecutorIdle,
    EnsureSessionWithExecutorAttached,
    EnsureSessionWithExecutorRunning,
    EnsureSessionWithExecutorRetired,
    EnsureSessionWithExecutorStopped,
    SetSilentIntentsIdle,
    SetSilentIntentsAttached,
    SetSilentIntentsRunning,
    SetSilentIntentsRetired,
    SetSilentIntentsStopped,
    AbortIdle,
    AbortAttached,
    AbortRunning,
    AbortRetired,
    AbortStopped,
    WaitIdle,
    WaitAttached,
    WaitRunning,
    WaitRetired,
    WaitStopped,
    AbortAllIdle,
    AbortAllAttached,
    AbortAllRunning,
    AbortAllRetired,
    AbortAllStopped,
    EnsureDrainRunningAttached,
    EnsureDrainRunningRunning,
    IngestIdle,
    IngestAttached,
    IngestRunning,
    PublishEventIdle,
    PublishEventAttached,
    PublishEventRunning,
    PublishEventRetired,
    PublishEventStopped,
    AcceptWithCompletionIdleQueued,
    AcceptWithCompletionIdleImmediate,
    AcceptWithCompletionAttachedImmediate,
    AcceptWithCompletionAttachedQueued,
    AcceptWithCompletionRunningQueuedPassive,
    AcceptWithCompletionRunningQueuedWakeIfIdle,
    AcceptWithCompletionRunningInterruptYielding,
    AcceptWithCompletionRunningImmediate,
    AcceptWithoutWakeIdle,
    AcceptWithoutWakeAttached,
    AcceptWithoutWakeRunning,
    ClassifyExternalEnvelopeMessageAttached,
    ClassifyExternalEnvelopeMessageRunning,
    ClassifyExternalEnvelopeRequestPeerAddedAttached,
    ClassifyExternalEnvelopeRequestPeerAddedIdle,
    ClassifyExternalEnvelopeRequestPeerAddedRunning,
    ClassifyExternalEnvelopeRequestPeerRetiredAttached,
    ClassifyExternalEnvelopeRequestPeerRetiredIdle,
    ClassifyExternalEnvelopeRequestPeerRetiredRetired,
    ClassifyExternalEnvelopeRequestPeerRetiredStopped,
    ClassifyExternalEnvelopeRequestPeerRetiredRunning,
    ClassifyExternalEnvelopeRequestPeerUnwiredAttached,
    ClassifyExternalEnvelopeRequestPeerUnwiredIdle,
    ClassifyExternalEnvelopeRequestPeerUnwiredRetired,
    ClassifyExternalEnvelopeRequestPeerUnwiredStopped,
    ClassifyExternalEnvelopeRequestPeerUnwiredRunning,
    ClassifyExternalEnvelopeRequestSupervisorSilentAttached,
    ClassifyExternalEnvelopeRequestSupervisorSilentRunning,
    ClassifyExternalEnvelopeRequestSilentAttached,
    ClassifyExternalEnvelopeRequestSilentRunning,
    ClassifyExternalEnvelopeRequestSupervisorAttached,
    ClassifyExternalEnvelopeRequestSupervisorRunning,
    ClassifyExternalEnvelopeRequestActionableAttached,
    ClassifyExternalEnvelopeRequestActionableRunning,
    ClassifyExternalEnvelopeLifecycleAddedIdle,
    ClassifyExternalEnvelopeLifecycleAddedAttached,
    ClassifyExternalEnvelopeLifecycleAddedRunning,
    ClassifyExternalEnvelopeLifecycleRetiredIdle,
    ClassifyExternalEnvelopeLifecycleRetiredRetired,
    ClassifyExternalEnvelopeLifecycleRetiredStopped,
    ClassifyExternalEnvelopeLifecycleRetiredAttached,
    ClassifyExternalEnvelopeLifecycleRetiredRunning,
    ClassifyExternalEnvelopeLifecycleUnwiredIdle,
    ClassifyExternalEnvelopeLifecycleUnwiredRetired,
    ClassifyExternalEnvelopeLifecycleUnwiredStopped,
    ClassifyExternalEnvelopeLifecycleUnwiredAttached,
    ClassifyExternalEnvelopeLifecycleUnwiredRunning,
    ClassifyExternalEnvelopeResponseAcceptedAttached,
    ClassifyExternalEnvelopeResponseAcceptedRunning,
    ClassifyExternalEnvelopeResponseCompletedAttached,
    ClassifyExternalEnvelopeResponseCompletedRunning,
    ClassifyExternalEnvelopeResponseFailedAttached,
    ClassifyExternalEnvelopeResponseFailedRunning,
    ClassifyExternalEnvelopeAckAttached,
    ClassifyExternalEnvelopeAckRunning,
    ClassifyPlainEventAttached,
    ClassifyPlainEventRunning,
    PrepareIdle,
    PrepareAttached,
    DrainQueuedRunRetired,
    StartConversationRunInitializing,
    StartConversationRunAttached,
    StartConversationRunRunning,
    StartImmediateAppendInitializing,
    StartImmediateAppendAttached,
    StartImmediateAppendRunning,
    StartImmediateContextInitializing,
    StartImmediateContextAttached,
    StartImmediateContextRunning,
    PrimitiveAppliedConversation,
    PrimitiveAppliedImmediateCompleted,
    PrimitiveAppliedImmediateCancelled,
    LlmReturnedToolCallsPositive,
    LlmReturnedToolCallsZero,
    LlmReturnedTerminal,
    RegisterPendingOps,
    ToolCallsResolvedToCalling,
    ToolCallsResolvedToBoundary,
    OpsBarrierSatisfied,
    BoundaryContinueToCalling,
    BoundaryContinueToCancelled,
    BoundaryCompleteCompleted,
    BoundaryCompleteCancelled,
    EnterExtraction,
    ExtractionStart,
    ExtractionValidationPassed,
    ExtractionValidationFailedRetry,
    ExtractionValidationFailedExhausted,
    ExtractionFailedTerminal,
    RecoverableFailure,
    FatalFailure,
    RetryRequested,
    CancelNow,
    RequestCancelAfterBoundary,
    CancellationObserved,
    AcknowledgeTerminal,
    TurnLimitReached,
    BudgetExhausted,
    TimeBudgetExceeded,
    ForceCancelNoRun,
    RunCompleted,
    ServiceTurnCommittedRunningToIdle,
    ServiceTurnCommittedRunningToAttached,
    ServiceTurnCommittedRunningToRetired,
    RunFailed,
    RunCancelled,
    SurfaceRegisterAttached,
    SurfaceRegisterRunning,
    SurfaceStageAddAttached,
    SurfaceStageAddRunning,
    SurfaceStageRemoveAttached,
    SurfaceStageRemoveRunning,
    SurfaceStageReloadAttached,
    SurfaceStageReloadRunning,
    SurfaceApplyBoundaryAddAttached,
    SurfaceApplyBoundaryAddRunning,
    SurfaceApplyBoundaryReloadAttached,
    SurfaceApplyBoundaryReloadRunning,
    SurfaceApplyBoundaryRemoveDrainingAttached,
    SurfaceApplyBoundaryRemoveDrainingRunning,
    SurfaceApplyBoundaryRemoveNoopAttached,
    SurfaceApplyBoundaryRemoveNoopRunning,
    SurfaceMarkPendingSucceededAddAttached,
    SurfaceMarkPendingSucceededAddRunning,
    SurfaceMarkPendingSucceededReloadAttached,
    SurfaceMarkPendingSucceededReloadRunning,
    SurfaceMarkPendingFailedAttached,
    SurfaceMarkPendingFailedRunning,
    SurfaceCallStartedActiveAttached,
    SurfaceCallStartedActiveRunning,
    SurfaceCallStartedRejectRemovingAttached,
    SurfaceCallStartedRejectRemovingRunning,
    SurfaceCallStartedRejectUnavailableAttached,
    SurfaceCallStartedRejectUnavailableRunning,
    SurfaceCallFinishedAttached,
    SurfaceCallFinishedRunning,
    SurfaceFinalizeRemovalCleanAttached,
    SurfaceFinalizeRemovalCleanRunning,
    SurfaceFinalizeRemovalForcedAttached,
    SurfaceFinalizeRemovalForcedRunning,
    SurfaceSnapshotAlignedAttached,
    SurfaceSnapshotAlignedRunning,
    SurfaceShutdownAttached,
    SurfaceShutdownRunning,
    CommitRunningToIdle,
    CommitRunningToAttached,
    CommitRunningToRetired,
    FailRunningToIdle,
    FailRunningToAttached,
    FailRunningToRetired,
    CancelRunningToIdle,
    CancelRunningToAttached,
    CancelRunningToRetired,
    RollbackRunRunningToIdle,
    RollbackRunRunningToAttached,
    RollbackRunRunningToRetired,
    RecycleFromIdleOrRetired,
    RecycleFromAttached,
    RecoverInputLifecycleIdle,
    RecoverInputLifecycleAttached,
    RecoverInputLifecycleRunning,
    RecoverInputLifecycleRetired,
    RecoverInputLifecycleStopped,
    QueueAcceptedIdle,
    QueueAcceptedAttached,
    QueueAcceptedRunning,
    QueueAcceptedRetired,
    QueueAcceptedStopped,
    SteerAcceptedIdle,
    SteerAcceptedAttached,
    SteerAcceptedRunning,
    SteerAcceptedRetired,
    SteerAcceptedStopped,
    ChangeLaneIdle,
    ChangeLaneAttached,
    ChangeLaneRunning,
    ChangeLaneRetired,
    ChangeLaneStopped,
    StageForRunIdle,
    StageForRunAttached,
    StageForRunRunning,
    StageForRunRetired,
    StageForRunStopped,
    IncrementAttemptCountIdle,
    IncrementAttemptCountAttached,
    IncrementAttemptCountRunning,
    IncrementAttemptCountRetired,
    IncrementAttemptCountStopped,
    RollbackStagedIdle,
    RollbackStagedAttached,
    RollbackStagedRunning,
    RollbackStagedRetired,
    RollbackStagedStopped,
    MarkAppliedIdle,
    MarkAppliedAttached,
    MarkAppliedRunning,
    MarkAppliedRetired,
    MarkAppliedStopped,
    MarkAppliedPendingConsumptionIdle,
    MarkAppliedPendingConsumptionAttached,
    MarkAppliedPendingConsumptionRunning,
    MarkAppliedPendingConsumptionRetired,
    MarkAppliedPendingConsumptionStopped,
    ConsumeOnAcceptIdle,
    ConsumeOnAcceptAttached,
    ConsumeOnAcceptRunning,
    ConsumeOnAcceptRetired,
    ConsumeOnAcceptStopped,
    RecordBoundarySeqIdle,
    RecordBoundarySeqAttached,
    RecordBoundarySeqRunning,
    RecordBoundarySeqRetired,
    RecordBoundarySeqStopped,
    ConsumeInputIdle,
    ConsumeInputAttached,
    ConsumeInputRunning,
    ConsumeInputRetired,
    ConsumeInputStopped,
    SupersedeInputIdle,
    SupersedeInputAttached,
    SupersedeInputRunning,
    SupersedeInputRetired,
    SupersedeInputStopped,
    CoalesceInputIdle,
    CoalesceInputAttached,
    CoalesceInputRunning,
    CoalesceInputRetired,
    CoalesceInputStopped,
    AbandonInputIdle,
    AbandonInputAttached,
    AbandonInputRunning,
    AbandonInputRetired,
    AbandonInputStopped,
    RegisterOpIdle,
    RegisterOpAttached,
    RegisterOpRunning,
    RegisterOpRetired,
    RegisterOpStopped,
    StartOpIdle,
    StartOpAttached,
    StartOpRunning,
    StartOpRetired,
    StartOpStopped,
    CompleteOpIdle,
    CompleteOpAttached,
    CompleteOpRunning,
    CompleteOpRetired,
    CompleteOpStopped,
    FailOpIdle,
    FailOpAttached,
    FailOpRunning,
    FailOpRetired,
    FailOpStopped,
    CancelOpIdle,
    CancelOpAttached,
    CancelOpRunning,
    CancelOpRetired,
    CancelOpStopped,
    AbortOpIdle,
    AbortOpAttached,
    AbortOpRunning,
    AbortOpRetired,
    AbortOpStopped,
    PeerReadyOpIdle,
    PeerReadyOpAttached,
    PeerReadyOpRunning,
    PeerReadyOpRetired,
    PeerReadyOpStopped,
    ProgressReportedOpIdle,
    ProgressReportedOpAttached,
    ProgressReportedOpRunning,
    ProgressReportedOpRetired,
    ProgressReportedOpStopped,
    RetireRequestedOpIdle,
    RetireRequestedOpAttached,
    RetireRequestedOpRunning,
    RetireRequestedOpRetired,
    RetireRequestedOpStopped,
    RetireCompletedOpIdle,
    RetireCompletedOpAttached,
    RetireCompletedOpRunning,
    RetireCompletedOpRetired,
    RetireCompletedOpStopped,
    TerminateOpIdle,
    TerminateOpAttached,
    TerminateOpRunning,
    TerminateOpRetired,
    TerminateOpStopped,
    RequestWaitAllIdle,
    RequestWaitAllAttached,
    RequestWaitAllRunning,
    RequestWaitAllRetired,
    RequestWaitAllStopped,
    SatisfyWaitAllIdle,
    SatisfyWaitAllAttached,
    SatisfyWaitAllRunning,
    SatisfyWaitAllRetired,
    SatisfyWaitAllStopped,
    CancelWaitAllIdle,
    CancelWaitAllAttached,
    CancelWaitAllRunning,
    CancelWaitAllRetired,
    CancelWaitAllStopped,
    SpawnDrainIdle,
    SpawnDrainAttached,
    SpawnDrainRunning,
    SpawnDrainRetired,
    SpawnDrainStopped,
    StopDrainIdle,
    StopDrainAttached,
    StopDrainRunning,
    StopDrainRetired,
    StopDrainStopped,
    DrainExitedCleanIdle,
    DrainExitedCleanAttached,
    DrainExitedCleanRunning,
    DrainExitedCleanRetired,
    DrainExitedCleanStopped,
    DrainExitedRespawnableIdle,
    DrainExitedRespawnableAttached,
    DrainExitedRespawnableRunning,
    DrainExitedRespawnableRetired,
    DrainExitedRespawnableStopped,
    StageVisibilityFilterIdle,
    StageVisibilityFilterAttached,
    StageVisibilityFilterRunning,
    StageVisibilityFilterRetired,
    StageVisibilityFilterStopped,
    CommitVisibilityFilterIdle,
    CommitVisibilityFilterAttached,
    CommitVisibilityFilterRunning,
    CommitVisibilityFilterRetired,
    CommitVisibilityFilterStopped,
    StageDeferredNamesIdle,
    StageDeferredNamesAttached,
    StageDeferredNamesRunning,
    StageDeferredNamesRetired,
    StageDeferredNamesStopped,
    CommitDeferredNamesIdle,
    CommitDeferredNamesAttached,
    CommitDeferredNamesRunning,
    CommitDeferredNamesRetired,
    CommitDeferredNamesStopped,
    SyncVisibilityRevisionsIdle,
    SyncVisibilityRevisionsAttached,
    SyncVisibilityRevisionsRunning,
    SyncVisibilityRevisionsRetired,
    SyncVisibilityRevisionsStopped,
    McpServerConnectPendingIdle,
    McpServerConnectPendingAttached,
    McpServerConnectPendingRunning,
    McpServerConnectPendingRetired,
    McpServerConnectPendingStopped,
    McpServerConnectedIdle,
    McpServerConnectedAttached,
    McpServerConnectedRunning,
    McpServerConnectedRetired,
    McpServerConnectedStopped,
    McpServerFailedIdle,
    McpServerFailedAttached,
    McpServerFailedRunning,
    McpServerFailedRetired,
    McpServerFailedStopped,
    McpServerDisconnectedIdle,
    McpServerDisconnectedAttached,
    McpServerDisconnectedRunning,
    McpServerDisconnectedRetired,
    McpServerDisconnectedStopped,
    McpServerReloadIdle,
    McpServerReloadAttached,
    McpServerReloadRunning,
    McpServerReloadRetired,
    McpServerReloadStopped,
    PeerRequestSentIdle,
    PeerRequestSentAttached,
    PeerRequestSentRunning,
    PeerRequestSentRetired,
    PeerRequestSentStopped,
    PeerResponseProgressArrivedIdle,
    PeerResponseProgressArrivedAttached,
    PeerResponseProgressArrivedRunning,
    PeerResponseProgressArrivedRetired,
    PeerResponseProgressArrivedStopped,
    PeerResponseTerminalArrivedCompletedIdle,
    PeerResponseTerminalArrivedCompletedAttached,
    PeerResponseTerminalArrivedCompletedRunning,
    PeerResponseTerminalArrivedCompletedRetired,
    PeerResponseTerminalArrivedCompletedStopped,
    PeerResponseTerminalArrivedFailedIdle,
    PeerResponseTerminalArrivedFailedAttached,
    PeerResponseTerminalArrivedFailedRunning,
    PeerResponseTerminalArrivedFailedRetired,
    PeerResponseTerminalArrivedFailedStopped,
    PeerRequestTimedOutIdle,
    PeerRequestTimedOutAttached,
    PeerRequestTimedOutRunning,
    PeerRequestTimedOutRetired,
    PeerRequestTimedOutStopped,
    PeerRequestReceivedIdle,
    PeerRequestReceivedAttached,
    PeerRequestReceivedRunning,
    PeerRequestReceivedRetired,
    PeerRequestReceivedStopped,
    PeerResponseRepliedIdle,
    PeerResponseRepliedAttached,
    PeerResponseRepliedRunning,
    PeerResponseRepliedRetired,
    PeerResponseRepliedStopped,
    AdvanceSessionContextIdle,
    AdvanceSessionContextAttached,
    AdvanceSessionContextRunning,
    AdvanceSessionContextRetired,
    AdvanceSessionContextStopped,
    InteractionStreamReservedIdle,
    InteractionStreamReservedAttached,
    InteractionStreamReservedRunning,
    InteractionStreamReservedRetired,
    InteractionStreamReservedStopped,
    InteractionStreamAttachedIdle,
    InteractionStreamAttachedAttached,
    InteractionStreamAttachedRunning,
    InteractionStreamAttachedRetired,
    InteractionStreamAttachedStopped,
    InteractionStreamCompletedIdle,
    InteractionStreamCompletedAttached,
    InteractionStreamCompletedRunning,
    InteractionStreamCompletedRetired,
    InteractionStreamCompletedStopped,
    InteractionStreamExpiredIdle,
    InteractionStreamExpiredAttached,
    InteractionStreamExpiredRunning,
    InteractionStreamExpiredRetired,
    InteractionStreamExpiredStopped,
    InteractionStreamClosedEarlyIdle,
    InteractionStreamClosedEarlyAttached,
    InteractionStreamClosedEarlyRunning,
    InteractionStreamClosedEarlyRetired,
    InteractionStreamClosedEarlyStopped,
    AttachSessionIngressIdle,
    AttachSessionIngressAttached,
    AttachSessionIngressRunning,
    AttachSessionIngressRetired,
    AttachSessionIngressStopped,
    AttachMobIngressIdle,
    AttachMobIngressAttached,
    AttachMobIngressRunning,
    AttachMobIngressRetired,
    AttachMobIngressStopped,
    DetachIngressIdle,
    DetachIngressAttached,
    DetachIngressRunning,
    DetachIngressRetired,
    DetachIngressStopped,
    BindSupervisorIdle,
    BindSupervisorAttached,
    BindSupervisorRunning,
    BindSupervisorRetired,
    BindSupervisorStopped,
    AuthorizeSupervisorIdle,
    AuthorizeSupervisorAttached,
    AuthorizeSupervisorRunning,
    AuthorizeSupervisorRetired,
    AuthorizeSupervisorStopped,
    RevokeSupervisorIdle,
    RevokeSupervisorAttached,
    RevokeSupervisorRunning,
    RevokeSupervisorRetired,
    RevokeSupervisorStopped,
    SupervisorTrustEdgePublishedIdle,
    SupervisorTrustEdgePublishedAttached,
    SupervisorTrustEdgePublishedRunning,
    SupervisorTrustEdgePublishedRetired,
    SupervisorTrustEdgePublishedStopped,
    SupervisorTrustEdgePublishFailedIdle,
    SupervisorTrustEdgePublishFailedAttached,
    SupervisorTrustEdgePublishFailedRunning,
    SupervisorTrustEdgePublishFailedRetired,
    SupervisorTrustEdgePublishFailedStopped,
    SupervisorTrustEdgeRevokedIdle,
    SupervisorTrustEdgeRevokedAttached,
    SupervisorTrustEdgeRevokedRunning,
    SupervisorTrustEdgeRevokedRetired,
    SupervisorTrustEdgeRevokedStopped,
    SupervisorTrustEdgeRevokeFailedIdle,
    SupervisorTrustEdgeRevokeFailedAttached,
    SupervisorTrustEdgeRevokeFailedRunning,
    SupervisorTrustEdgeRevokeFailedRetired,
    SupervisorTrustEdgeRevokeFailedStopped,
    PublishLocalEndpointIdle,
    PublishLocalEndpointAttached,
    PublishLocalEndpointRunning,
    ClearLocalEndpointIdle,
    ClearLocalEndpointAttached,
    ClearLocalEndpointRunning,
    AddDirectPeerEndpointIdle,
    AddDirectPeerEndpointAttached,
    AddDirectPeerEndpointRunning,
    RemoveDirectPeerEndpointIdle,
    RemoveDirectPeerEndpointAttached,
    RemoveDirectPeerEndpointRunning,
    ApplyMobPeerOverlayIdle,
    ApplyMobPeerOverlayAttached,
    ApplyMobPeerOverlayRunning,
}
#[allow(non_camel_case_types)]
#[derive(Debug, Clone, Copy, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
pub enum GuardId {
    None,
}
#[allow(non_camel_case_types)]
#[derive(Debug, Clone, Copy, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
pub enum HelperId {
    None,
}

#[derive(Debug, Clone, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
pub struct GuardRejection {
    pub transition_id: TransitionId,
    pub guard_id: GuardId,
}
#[derive(Debug, Clone, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
pub enum TriggerDiscriminant {
    Input(InputKind),
    Signal(SignalKind),
}
#[derive(Debug, Clone, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
pub enum TransitionRefusal {
    NoMatchingTransition {
        phase: Phase,
        trigger: TriggerDiscriminant,
    },
    GuardRejected {
        rejections: Vec<GuardRejection>,
    },
    AmbiguousTransition {
        transitions: Vec<TransitionId>,
    },
}
#[derive(Debug, Clone, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
pub enum KernelError {
    ContextViolation {
        transition_id: TransitionId,
        detail: String,
    },
    HelperEvaluation {
        helper_id: HelperId,
        detail: String,
    },
    CodegenInvariant {
        detail: String,
    },
}
#[derive(Debug, Clone, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
pub enum TransitionError {
    Refusal(TransitionRefusal),
    Kernel(KernelError),
}
#[derive(Debug, Clone, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
pub struct Outcome {
    pub transition_id: TransitionId,
    pub next_state: State,
    pub effects: Vec<Effect>,
}

pub mod helpers {
    #[allow(unused_imports)]
    use super::*;
    pub fn none<C: Context>(_: &State, context: &C) -> Result<(), KernelError> {
        let _ = context;
        Ok(())
    }
}

pub fn initial_state() -> State {
    State {
        phase: Phase::Initializing,
        session_id: None,
        active_runtime_id: None,
        active_fence_token: None,
        current_run_id: None,
        pre_run_phase: None,
        turn_phase: TurnPhase::default(),
        primitive_kind: None,
        admitted_content_shape: None,
        vision_enabled: false,
        image_tool_results_enabled: false,
        tool_calls_pending: 0,
        pending_op_refs: Default::default(),
        barrier_operation_ids: Default::default(),
        has_barrier_ops: false,
        barrier_satisfied: false,
        boundary_count: 0,
        cancel_after_boundary: false,
        terminal_outcome: None,
        terminal_cause_kind: None,
        last_runtime_apply_failure_cause: None,
        last_runtime_apply_failure_message: None,
        extraction_attempts: 0,
        max_extraction_retries: 0,
        llm_retry_attempt: 0,
        llm_retry_max_retries: 0,
        llm_retry_selected_delay_ms: 0,
        llm_retry_last_failure_kind: None,
        silent_intent_overrides: Default::default(),
        model_routing_baseline_model: None,
        model_routing_baseline_realtime: None,
        model_routing_topology_epoch: 0,
        model_routing_turn_override_id: None,
        model_routing_turn_request_id: None,
        model_routing_turn_target_model: None,
        model_routing_turn_realtime: None,
        model_routing_turn_remaining_turns: None,
        model_routing_operation_override_id: None,
        model_routing_operation_target_model: None,
        model_routing_operation_realtime: None,
        model_routing_pending_switch_request_id: None,
        model_routing_pending_switch_target_model: None,
        model_routing_pending_switch_realtime: None,
        model_routing_pending_switch_turns: None,
        model_routing_pending_switch_phase: None,
        model_routing_switch_terminal: Default::default(),
        model_routing_switch_denials: Default::default(),
        model_routing_image_operation_phases: Default::default(),
        model_routing_image_operation_target_models: Default::default(),
        model_routing_image_operation_realtime: Default::default(),
        model_routing_image_operation_requires_scoped_override: Default::default(),
        model_routing_image_terminals: Default::default(),
        model_routing_image_terminal_payloads: Default::default(),
        model_routing_image_denials: Default::default(),
        model_routing_approval_phases: Default::default(),
        model_routing_approval_parent_kind: Default::default(),
        registration_phase: RegistrationPhase::default(),
        drain_phase: DrainPhase::default(),
        drain_mode: None,
        next_staged_visibility_revision: 0,
        active_filter: ToolFilter::default(),
        staged_filter: ToolFilter::default(),
        active_visibility_revision: 0,
        staged_visibility_revision: 0,
        active_deferred_names: Default::default(),
        staged_deferred_names: Default::default(),
        active_deferred_authorities: Default::default(),
        staged_deferred_authorities: Default::default(),
        input_phases: Default::default(),
        input_terminal_kind: Default::default(),
        input_superseded_by: Default::default(),
        input_aggregate_id: Default::default(),
        input_abandon_reason: Default::default(),
        input_abandon_attempt_count: Default::default(),
        input_attempt_counts: Default::default(),
        input_run_associations: Default::default(),
        input_boundary_sequences: Default::default(),
        next_admission_seq: 0,
        input_admission_seq: Default::default(),
        input_lane: Default::default(),
        op_statuses: Default::default(),
        op_completion_seq: Default::default(),
        op_terminal_outcomes: Default::default(),
        op_terminal_payload: Default::default(),
        op_kinds: Default::default(),
        op_peer_ready: Default::default(),
        op_progress_counts: Default::default(),
        active_op_count: 0,
        wait_active: false,
        wait_request_id: None,
        wait_operation_ids: Default::default(),
        wait_operation_id_tokens: Default::default(),
        next_completion_seq: 0,
        known_surfaces: Default::default(),
        active_surfaces: Default::default(),
        visible_surfaces: Default::default(),
        surface_base_state: Default::default(),
        surface_pending_op: Default::default(),
        surface_staged_op: Default::default(),
        reload_staged_surfaces: Default::default(),
        surface_staged_intent_sequence: Default::default(),
        next_staged_intent_sequence: 0,
        surface_pending_task_sequence: Default::default(),
        next_pending_task_sequence: 0,
        surface_pending_lineage_sequence: Default::default(),
        surface_inflight_calls: Default::default(),
        surface_last_delta_operation: Default::default(),
        surface_last_delta_phase: Default::default(),
        snapshot_epoch: 0,
        snapshot_aligned_epoch: 0,
        surface_draining_since_ms: Default::default(),
        surface_removal_timeout_at_ms: Default::default(),
        surface_removal_applied_at_turn: Default::default(),
        surface_phase: SurfacePhase::default(),
        removal_timeout_ms: 0,
        mcp_server_states: Default::default(),
        pending_peer_requests: Default::default(),
        inbound_peer_requests: Default::default(),
        last_session_context_updated_at_ms: 0,
        reserved_interaction_streams: Default::default(),
        attached_interaction_streams: Default::default(),
        peer_ingress_owner_kind: PeerIngressOwnerKind::default(),
        peer_ingress_comms_runtime_id: None,
        peer_ingress_mob_id: None,
        supervisor_binding_kind: SupervisorBindingKind::default(),
        supervisor_bound_name: None,
        supervisor_bound_peer_id: None,
        supervisor_bound_address: None,
        supervisor_bound_epoch: None,
        local_endpoint: None,
        direct_peer_endpoints: Default::default(),
        mob_overlay_peer_endpoints: Default::default(),
        peer_projection_epoch: 0,
        mob_overlay_epoch: 0,
    }
}
