Skip to main content

muse_code_sdk/msp/view/
item_content.rs

1// @generated from the MSP stable schema and protocol sources; do not edit by hand.
2
3pub use super::item_background::BackgroundInitiator;
4pub use super::item_background_terminal_completion::BackgroundTerminalCompletion;
5pub use super::item_damaged_range::DamagedRange;
6pub use super::item_earlier_history::EarlierHistory;
7pub use super::item_kind::HookRunStatus;
8pub use super::item_kind::ItemKind;
9pub use super::item_kind::ItemStatus;
10pub use super::item_peer_message::PeerMessage;
11pub use super::item_subagent_workflow::SubagentControlStatus;
12pub use super::item_subagent_workflow::SubagentResult;
13pub use super::item_subagent_workflow::WorkflowChild;
14pub use super::item_subagent_workflow::WorkflowTokenBudget;
15pub use super::item_subagent_workflow::WorkspacePlacement;
16pub use crate::msp::view::subagent_input_phase::SubagentInputPhase;
17pub use crate::msp::view::subagent_result_status::SubagentResultStatus;
18use serde::Deserialize;
19use serde::Serialize;
20
21mod catch_all;
22
23/// `userMessage` image attachment metadata: metadata only — the durable bytes
24/// live in the log and are reachable on the raw altitude.
25#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
26#[serde(rename_all = "camelCase")]
27#[non_exhaustive]
28pub struct MessageAttachment {
29    /// Attachment type, `"image"` in v1 (free string: attachment vocabulary
30    /// grows additively with the runtime's intake surface).
31    #[serde(rename = "type")]
32    pub attachment_type: String,
33    /// The image media type (e.g. `"image/png"`).
34    pub media_type: String,
35    /// Pixel width, when known.
36    #[serde(skip_serializing_if = "Option::is_none")]
37    pub width: Option<u32>,
38    /// Pixel height, when known.
39    #[serde(skip_serializing_if = "Option::is_none")]
40    pub height: Option<u32>,
41    /// This attachment's name, `<itemId>/<n>` — the item's id plus this entry's
42    /// 1-based position in its `attachments` array. Name only: no link form and
43    /// no byte read by id.
44    ///
45    /// Set by the server on every attachment entry it emits, and identical on
46    /// live, paging, snapshot and rebuild paths. Optional in the schema so
47    /// older servers stay valid; clients compare and store the whole string and
48    /// MUST NOT parse it.
49    #[serde(skip_serializing_if = "Option::is_none")]
50    pub attachment_id: Option<String>,
51}
52
53/// Stored-output reference: the camelCased fold of the durable `ToolOutputRef`.
54/// The fetch path is `item/readOutput`.
55#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
56#[serde(rename_all = "camelCase")]
57#[non_exhaustive]
58pub struct OutputRef {
59    /// The stored output's durable id.
60    pub id: String,
61    /// The stored output's kind, verbatim durable vocabulary.
62    pub kind: String,
63    /// The stored output's URI.
64    pub uri: String,
65    /// Media type, when recorded.
66    #[serde(skip_serializing_if = "Option::is_none")]
67    pub media_type: Option<String>,
68    /// Stored byte length.
69    pub byte_len: u64,
70    /// Content digest (e.g. `"sha256:..."`), when recorded.
71    #[serde(skip_serializing_if = "Option::is_none")]
72    pub digest: Option<String>,
73    /// Stored path, when recorded.
74    #[serde(skip_serializing_if = "Option::is_none")]
75    pub path: Option<String>,
76    /// Whether the bytes are servable.
77    pub availability: OutputRefAvailability,
78}
79
80/// Server-authored edit-family diff summary: `files` counts the stored patch
81/// document's file entries; `added` and `removed` are the total `+`/`-`
82/// prefixed LINE counts summed over the stored patch's hunks across all files —
83/// line counts, never hunk or byte counts. Rides the `toolCall` item beside
84/// `patchRef`; the body is fetched via `item/readOutput` with `patchRef.id`.
85#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
86#[serde(rename_all = "camelCase")]
87#[non_exhaustive]
88pub struct PatchSummary {
89    /// File entries in the stored patch document.
90    pub files: u64,
91    /// Total `+`-prefixed line count across all files' hunks.
92    pub added: u64,
93    /// Total `-`-prefixed line count across all files' hunks.
94    pub removed: u64,
95}
96
97/// Whether a stored output's bytes are servable. Open — durable runtime
98/// vocabulary may grow additively.
99#[derive(Debug, Clone, PartialEq, Eq)]
100#[non_exhaustive]
101pub enum OutputRefAvailability {
102    /// The bytes are stored and servable.
103    Available,
104    /// The stored bytes are gone.
105    Missing,
106    /// The store does not serve this kind.
107    Unsupported,
108    /// The last access attempt failed.
109    AccessFailed,
110    /// A value from a newer host, kept verbatim so an older client decodes the
111    /// rest of the message. Never construct it with a known word.
112    Unknown(String),
113}
114
115/// Rich content the model saw beyond text: metadata only — fetch bytes via
116/// `item/readOutput` when an `outputRef` exists.
117#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
118#[serde(rename_all = "camelCase")]
119#[non_exhaustive]
120pub struct ModelVisibleContent {
121    /// Content type, `"image"` in v1 (free string, grows with the durable
122    /// vocabulary).
123    #[serde(rename = "type")]
124    pub content_type: String,
125    /// The tool that produced the content.
126    pub source_tool_name: String,
127    /// The recorded content path.
128    pub path: String,
129    /// The content media type.
130    pub media_type: String,
131    /// Pixel width, when known.
132    #[serde(skip_serializing_if = "Option::is_none")]
133    pub width: Option<u32>,
134    /// Pixel height, when known.
135    #[serde(skip_serializing_if = "Option::is_none")]
136    pub height: Option<u32>,
137}
138
139/// Compaction outcome. Open.
140#[derive(Debug, Clone, PartialEq, Eq)]
141#[non_exhaustive]
142pub enum CompactionOutcome {
143    /// A summary was installed.
144    Compacted,
145    /// Nothing compactable; a noop is a success.
146    Noop,
147    /// The summarizer failed; fallback recorded.
148    Failed,
149    /// The compaction was cancelled.
150    Cancelled,
151    /// A value from a newer host, kept verbatim so an older client decodes the
152    /// rest of the message. Never construct it with a known word.
153    Unknown(String),
154}
155
156/// What initiated a compaction. Open.
157#[derive(Debug, Clone, PartialEq, Eq)]
158#[non_exhaustive]
159pub enum CompactionTrigger {
160    /// The `session/compact` command.
161    Manual,
162    /// Automatic pressure-triggered compaction.
163    Auto,
164    /// A value from a newer host, kept verbatim so an older client decodes the
165    /// rest of the message. Never construct it with a known word.
166    Unknown(String),
167}
168
169/// `webSearch`: one typed result hit — result schema v1.
170#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
171#[serde(rename_all = "camelCase")]
172#[non_exhaustive]
173pub struct WebSearchHit {
174    /// The hit title, verbatim (empty when the provider omits it).
175    pub title: String,
176    /// The hit URL, verbatim (empty when the provider omits it).
177    pub url: String,
178}