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