muse_code_sdk/msp/view/item/object/body_completion.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/// Whether the origin call join held at delivery.
9#[derive(Debug, Clone, PartialEq, Eq)]
10#[non_exhaustive]
11pub enum BodyCompletionCorrelation {
12 /// The origin call joined: the row names the call and its result.
13 Resolved,
14 /// The join did not hold (compaction): the row renders the
15 /// bounded missing-correlation diagnostic, never a guess.
16 Unresolved,
17 /// A value from a newer host, kept verbatim so an older client decodes the
18 /// rest of the message. 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 BodyCompletionCorrelation {
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::Resolved => "resolved",
29 Self::Unresolved => "unresolved",
30 Self::Unknown(value) => value,
31 }
32 }
33}
34
35impl Serialize for BodyCompletionCorrelation {
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 BodyCompletionCorrelation {
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 "resolved" => Self::Resolved,
52 "unresolved" => Self::Unresolved,
53 _ => Self::Unknown(value),
54 })
55 }
56}
57
58/// `bodyCompletion`: the facts one receipt row renders. The fold reads them
59/// from the inbox terminal record and the backgrounded call it names. `status`,
60/// `result_summary`, and `correlation` are required; `origin_call_id` is absent
61/// exactly when the join is unresolved.
62#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
63#[serde(rename_all = "camelCase")]
64#[non_exhaustive]
65pub struct BodyCompletionMembers {
66 /// The originating call's provider call id, opaque — the join
67 /// key back to the original row. Absent when the join is
68 /// unresolved (compaction).
69 #[serde(skip_serializing_if = "Option::is_none")]
70 pub origin_call_id: Option<String>,
71 /// One fixed wire word per Task terminal (`completed`,
72 /// `failed`, `cancelled`, `timedOut`, `rejected`) — never
73 /// display text; gate-off display words derive client-side.
74 pub status: String,
75 /// Bounded transcript-visible result text; empty when the
76 /// terminal carries none. Full bytes stay behind outputRef.
77 pub result_summary: String,
78 /// Whether the origin call join held at delivery.
79 pub correlation: BodyCompletionCorrelation,
80 /// True for the Manual semantic receipt (`◆`); false for the
81 /// ordinary completion row.
82 pub receipt: bool,
83}