Skip to main content

muse_code_sdk/msp/view/
subagent_input_phase.rs

1// @generated from the MSP stable schema and protocol sources; do not edit by hand.
2
3use serde::Deserialize;
4use serde::Deserializer;
5use serde::Serialize;
6use serde::Serializer;
7
8/// `subagentInput.inputPhase`: the record the item stands for. Open: a client
9/// ignores an item whose phase it does not know.
10#[derive(Debug, Clone, PartialEq, Eq)]
11#[non_exhaustive]
12pub enum SubagentInputPhase {
13    /// The input entered the subagent's inbox (its queue record).
14    Queued,
15    /// A delivery-visible drain handed the input to the subagent.
16    Delivered,
17    /// A value from a newer host, kept verbatim so an older client decodes the
18    /// rest of the item. Excluded from the generated schema while the enum
19    /// stays declared open; never construct it with a known word.
20    Unknown(String),
21}
22
23impl SubagentInputPhase {
24    /// The exact wire spelling, including a value from a newer host.
25    #[must_use]
26    pub fn as_str(&self) -> &str {
27        match self {
28            Self::Queued => "queued",
29            Self::Delivered => "delivered",
30            Self::Unknown(value) => value,
31        }
32    }
33}
34
35impl Serialize for SubagentInputPhase {
36    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
37    where
38        S: Serializer,
39    {
40        serializer.serialize_str(self.as_str())
41    }
42}
43
44impl<'de> Deserialize<'de> for SubagentInputPhase {
45    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
46    where
47        D: Deserializer<'de>,
48    {
49        let value = String::deserialize(deserializer)?;
50        Ok(match value.as_str() {
51            "queued" => Self::Queued,
52            "delivered" => Self::Delivered,
53            _ => Self::Unknown(value),
54        })
55    }
56}