Skip to main content

muse_code_sdk/msp/view/item/object/
tool_call.rs

1// @generated from the MSP stable schema and protocol sources; do not edit by hand.
2
3use crate::msp::view::item_background::BackgroundInitiator;
4use crate::msp::view::item_background::BackgroundStatus;
5use crate::msp::view::item_content::ModelVisibleContent;
6use crate::msp::view::item_content::OutputRef;
7use crate::msp::view::item_content::PatchSummary;
8use crate::msp::view::item_hold::HeldFor;
9use crate::msp::view::item_status::StatusAttempt;
10use crate::msp::view::item_status::StatusChildren;
11use crate::msp::view::item_status::StatusHealth;
12use crate::msp::view::item_status::StatusProgress;
13use crate::msp::view::item_status::StatusStep;
14use crate::msp::view::tool_receipt::ToolReceipt;
15use serde::Deserialize;
16use serde::Serialize;
17
18/// `toolCall` members, flattened into the item row.
19#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
20#[serde(rename_all = "camelCase")]
21#[non_exhaustive]
22pub struct ToolCallMembers {
23    /// `toolCall`: tool name.
24    #[serde(skip_serializing_if = "Option::is_none")]
25    pub tool: Option<String>,
26    /// `toolCall`: the provider call id (`call_...`), opaque.
27    #[serde(skip_serializing_if = "Option::is_none")]
28    pub call_id: Option<String>,
29    /// `toolCall`: the model-authored argument JSON, **verbatim**; clients
30    /// parse. Verbatim keeps the fold byte-deterministic and survives
31    /// model-emitted almost-JSON.
32    #[serde(skip_serializing_if = "Option::is_none")]
33    pub args: Option<String>,
34    /// `toolCall`/`subagent`: `Failed`/`Rejected`/`Cancelled` reason text,
35    /// verbatim.
36    #[serde(skip_serializing_if = "Option::is_none")]
37    pub failure_reason: Option<String>,
38    /// `toolCall`: machine-readable failure class.
39    #[serde(skip_serializing_if = "Option::is_none")]
40    pub failure_kind: Option<String>,
41    /// `toolCall`/`userShell`: bounded transcript-visible result text; streams
42    /// via `item/delta` field `"output"`.
43    #[serde(skip_serializing_if = "Option::is_none")]
44    pub visible_output: Option<String>,
45    /// `toolCall`/`userShell`: stored-output reference; fetch the full bytes
46    /// via `item/readOutput`.
47    #[serde(skip_serializing_if = "Option::is_none")]
48    pub output_ref: Option<OutputRef>,
49    /// `toolCall`: the shared semantic receipt — what the operation did, as
50    /// machine-readable fact. Optional and additive: absence is always valid
51    /// and is never an error. When present, a server serves the **same**
52    /// receipt on every item path — `item/completed`, `view/page`, seeded
53    /// snapshots and resume. Observation only; carries no control authority,
54    /// and no field in it enters model-visible content.
55    #[serde(skip_serializing_if = "Option::is_none")]
56    pub tool_receipt: Option<Box<ToolReceipt>>,
57    /// `toolCall`: server-authored edit-family diff summary — always beside
58    /// `patchRef`; absent = no diff available.
59    #[serde(skip_serializing_if = "Option::is_none")]
60    pub patch_summary: Option<PatchSummary>,
61    /// `toolCall`: stored structured-patch reference (`kind: "tool_patch"`,
62    /// `mediaType: "application/json"`); the body is fetched via
63    /// `item/readOutput` with `patchRef.id`, and the ref survives the
64    /// elided-snapshot rung exactly like `outputRef` without ever being an
65    /// elision trigger.
66    #[serde(skip_serializing_if = "Option::is_none")]
67    pub patch_ref: Option<OutputRef>,
68    /// `toolCall`: rich content the model saw beyond text; base64 is not
69    /// inlined on the view.
70    #[serde(skip_serializing_if = "Option::is_none")]
71    pub model_visible_content: Option<Vec<ModelVisibleContent>>,
72    /// `toolCall`: the approval that gated this call; join key for the approval
73    /// view events.
74    #[serde(skip_serializing_if = "Option::is_none")]
75    pub approval_id: Option<String>,
76    /// `toolCall`: `true` while the call is held before it is admitted to
77    /// execute. Present on an item started at hold time, cleared by the release
78    /// `item/updated`, absent on calls never held.
79    #[serde(skip_serializing_if = "Option::is_none")]
80    pub held: Option<bool>,
81    /// `toolCall`: what holds the call; present exactly when `held` is.
82    #[serde(skip_serializing_if = "Option::is_none")]
83    pub held_for: Option<HeldFor>,
84    /// `toolCall`: `true` once the task was durably backgrounded; delivered
85    /// via `item/updated`.
86    #[serde(skip_serializing_if = "Option::is_none")]
87    pub background: Option<bool>,
88    /// `toolCall`: who backgrounded the task; absent on pre-split records —
89    /// never inferred.
90    #[serde(skip_serializing_if = "Option::is_none")]
91    pub background_initiator: Option<BackgroundInitiator>,
92    /// `toolCall`: the backgrounded-row payload for a running backgrounded item
93    /// — auto-yield or an explicit user/timeout background; may appear with or
94    /// without `background`/`backgroundInitiator`. Experimental, delivered via
95    /// `item/updated`. Presentation only — never a durability claim.
96    #[serde(skip_serializing_if = "Option::is_none")]
97    pub background_status: Option<BackgroundStatus>,
98    /// `toolCall`: the task's visible latest-status line — the latest `Status`
99    /// message through the shared detail normalization; absent when no status
100    /// folded or nothing displayable remains.
101    #[serde(skip_serializing_if = "Option::is_none")]
102    pub status_line: Option<String>,
103    /// `toolCall`: the latest detail's phase row, verbatim; absent when the
104    /// latest detail carries none.
105    #[serde(skip_serializing_if = "Option::is_none")]
106    pub status_phase: Option<String>,
107    /// `toolCall`: the latest progress facet, field-for-field; absent when the
108    /// latest detail carries none.
109    #[serde(skip_serializing_if = "Option::is_none")]
110    pub status_progress: Option<StatusProgress>,
111    /// `toolCall`: the latest active-step facet, field-for-field; absent when
112    /// the latest detail carries none.
113    #[serde(skip_serializing_if = "Option::is_none")]
114    pub status_step: Option<StatusStep>,
115    /// `toolCall`: the latest external-attempt facet, field-for-field —
116    /// countdown inputs the client renders the tick from; absent when the
117    /// latest detail carries none.
118    #[serde(skip_serializing_if = "Option::is_none")]
119    pub status_attempt: Option<StatusAttempt>,
120    /// `toolCall`: the latest health facet, field-for-field; absent when the
121    /// latest detail carries none.
122    #[serde(skip_serializing_if = "Option::is_none")]
123    pub status_health: Option<StatusHealth>,
124    /// `toolCall`: the latest child-summary facet, field-for-field; absent when
125    /// the latest detail carries none.
126    #[serde(skip_serializing_if = "Option::is_none")]
127    pub status_children: Option<StatusChildren>,
128    /// `toolCall`: the tool's own words for this call; absent = none.
129    #[serde(skip_serializing_if = "Option::is_none")]
130    pub display_label: Option<Box<crate::msp::view::tool_label::ToolDisplayLabel>>,
131    /// `toolCall`: the call's Bash Title — its `description` argument through
132    /// the shared Bash Title normalizer, for a managed Bash call, served only
133    /// while the host's `bash_titles` gate is on. The host adds it when it
134    /// serves the item and never stores it; absent for any other call. Old
135    /// clients ignore it.
136    #[serde(skip_serializing_if = "Option::is_none")]
137    pub bash_title: Option<String>,
138    /// `toolCall`: the task's registered Work ID, verbatim
139    /// (`work.v2.managed_bash.sha256.…`); present only when the task registered
140    /// a ManagedBash id, absent otherwise. Stable from day one: no
141    /// `x-msp-stability` marker. The host serves it at the later of the task
142    /// terminal and the inbox admission; absence keeps the client's v1
143    /// derivation.
144    #[serde(skip_serializing_if = "Option::is_none")]
145    pub work_id: Option<String>,
146    /// `toolCall`: this call's live background-target record. Set when the
147    /// foreground tool starts, refreshed by whole-item `item/updated` when the
148    /// facts change, omitted once the call settles or unregisters — present
149    /// means a live candidate. Absent (pre-feature hosts, unregistered calls)
150    /// keeps the client's derived behavior, never an error. Old clients ignore
151    /// it.
152    #[serde(skip_serializing_if = "Option::is_none")]
153    pub background_target: Option<BackgroundTarget>,
154    /// `toolCall`: the name of the remote node this call is dispatched to.
155    /// **Experimental** (`Item.node`). Present once a dispatch to that node is
156    /// recorded for the call. Absent while none is: a call on the host's own
157    /// machine (in a session that never had a remote node this keeps today's
158    /// bytes), or a remote call that is not dispatched yet, or was refused or
159    /// failed before its dispatch; its approval request, when one was made,
160    /// names the node. Never `local`, and absence never means the default node.
161    #[serde(skip_serializing_if = "Option::is_none")]
162    pub node: Option<String>,
163}
164
165/// One call's live background-target record: exactly the runtime snapshot's
166/// four facts, no new nouns.
167#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
168#[serde(rename_all = "camelCase")]
169#[non_exhaustive]
170pub struct BackgroundTarget {
171    /// The tool call this record describes (the provider call id).
172    pub tool_call_id: String,
173    /// Point-in-time Ctrl+B chooser hint; the runtime re-checks
174    /// admission on the action.
175    pub manual_release_admissible: bool,
176    /// Whether the call sits in its foreground wait right now.
177    pub foreground_wait_active: bool,
178    /// Whether the background was already requested for this call.
179    pub background_requested: bool,
180}