Skip to main content

muse_code_sdk/msp/view/
health.rs

1// @generated from the MSP stable schema and protocol sources; do not edit by hand.
2
3use crate::msp::method::lifecycle::HistoryNoneReason;
4use serde::Deserialize;
5use serde::Serialize;
6
7/// `session/viewHealthChanged` params: the named session's live view stream
8/// became unavailable, and why.
9///
10/// Best-effort: ordered after already-queued view frames and may be dropped
11/// (for example when the connection is closing), so a client MUST NOT assume a
12/// guaranteed push and still reads `history.noneReason` on its next
13/// resume/read.
14#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
15#[serde(rename_all = "camelCase")]
16#[non_exhaustive]
17pub struct SessionViewHealthChangedParams {
18    /// The session whose live view health changed.
19    pub session_id: String,
20    /// The new view-health state. In v1 the host emits only `Unavailable`.
21    pub health: SessionViewHealth,
22    /// Why the view is unavailable — the SAME typed `HistoryNoneReason`
23    /// vocabulary the pull path stamps on `history.noneReason`, so a client
24    /// reuses one handler for push and pull. `projectionUnavailable` in v1;
25    /// present only when `health` is `Unavailable`. Open on the client side: an
26    /// unknown reason decodes conservatively and renders generically.
27    #[serde(default, skip_serializing_if = "Option::is_none")]
28    pub none_reason: Option<HistoryNoneReason>,
29}
30
31/// The view-health state. Open enum (`x-msp-openness: open`): a client MUST
32/// ignore an unrecognized value. v1 emits only `Unavailable`; openness itself
33/// reserves additive room for a future re-arm and for the durable-degraded
34/// axis, so no never-emitted token is baked onto the stable surface now.
35#[derive(Debug, Clone, PartialEq, Eq)]
36#[non_exhaustive]
37pub enum SessionViewHealth {
38    /// The live view stream is unavailable — see `noneReason`.
39    Unavailable,
40    /// A value from a newer host, kept verbatim so an older client decodes the
41    /// rest of the message. Excluded from the generated schema while the enum
42    /// stays declared open; never construct it with a known word.
43    Unknown(String),
44}