muse_code_sdk/msp/view/item_background.rs
1// @generated from the MSP stable schema and protocol sources; do not edit by hand.
2
3use serde::Deserialize;
4use serde::Serialize;
5
6mod catch_all;
7
8/// Who durably backgrounded a task. Open — runtime vocabulary.
9#[derive(Debug, Clone, PartialEq, Eq)]
10#[non_exhaustive]
11pub enum BackgroundInitiator {
12 /// The user backgrounded the task.
13 User,
14 /// The foreground-wait timeout backgrounded it.
15 Timeout,
16 /// A value from a newer host, kept verbatim so an older client decodes the
17 /// rest of the message. Never construct it with a known word.
18 Unknown(String),
19}
20
21/// Presentation state of a backgrounded running tool item. Open — new states
22/// are additive. Asserts presentation only, never durable backgrounding (that
23/// claim stays `Item::background`, set only behind a durable
24/// `TaskBackgrounded`).
25#[derive(Debug, Clone, PartialEq, Eq)]
26#[non_exhaustive]
27pub enum BackgroundState {
28 /// The running item backgrounded; render the Backgrounded row.
29 /// May appear on any running backgrounded `toolCall` — auto-yield
30 /// or an explicit user/timeout background, with or without
31 /// `background`/`backgroundInitiator`.
32 Backgrounded,
33 /// A value from a newer host, kept verbatim so an older client decodes the
34 /// rest of the message. Never construct it with a known word.
35 Unknown(String),
36}
37
38/// The backgrounded-row payload for a running `toolCall` item: the presentation
39/// state plus the live status text the row body renders. Experimental — stable
40/// clients ignore the member.
41#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
42#[serde(rename_all = "camelCase")]
43#[non_exhaustive]
44pub struct BackgroundStatus {
45 /// The item's background presentation state.
46 pub state: BackgroundState,
47 /// The live status text the backgrounded row body renders. The flip
48 /// gate requires non-empty detail (the fold always sets it); a
49 /// state-only member leaves the row alone.
50 #[serde(skip_serializing_if = "Option::is_none")]
51 pub detail: Option<String>,
52}