1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
// @generated from the MSP stable schema and protocol sources; do not edit by hand.
use crate::msp::view::item_background::BackgroundInitiator;
use crate::msp::view::item_background::BackgroundStatus;
use crate::msp::view::item_content::ModelVisibleContent;
use crate::msp::view::item_content::OutputRef;
use crate::msp::view::item_content::PatchSummary;
use crate::msp::view::item_hold::HeldFor;
use crate::msp::view::item_status::StatusAttempt;
use crate::msp::view::item_status::StatusChildren;
use crate::msp::view::item_status::StatusHealth;
use crate::msp::view::item_status::StatusProgress;
use crate::msp::view::item_status::StatusStep;
use crate::msp::view::tool_receipt::ToolReceipt;
use serde::Deserialize;
use serde::Serialize;
/// `toolCall` members, flattened into the item row.
#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
#[non_exhaustive]
pub struct ToolCallMembers {
/// `toolCall`: tool name.
#[serde(skip_serializing_if = "Option::is_none")]
pub tool: Option<String>,
/// `toolCall`: the provider call id (`call_...`), opaque.
#[serde(skip_serializing_if = "Option::is_none")]
pub call_id: Option<String>,
/// `toolCall`: the model-authored argument JSON, **verbatim**; clients
/// parse. Verbatim keeps the fold byte-deterministic and survives
/// model-emitted almost-JSON.
#[serde(skip_serializing_if = "Option::is_none")]
pub args: Option<String>,
/// `toolCall`/`subagent`: `Failed`/`Rejected`/`Cancelled` reason text,
/// verbatim.
#[serde(skip_serializing_if = "Option::is_none")]
pub failure_reason: Option<String>,
/// `toolCall`: machine-readable failure class.
#[serde(skip_serializing_if = "Option::is_none")]
pub failure_kind: Option<String>,
/// `toolCall`/`userShell`: bounded transcript-visible result text; streams
/// via `item/delta` field `"output"`.
#[serde(skip_serializing_if = "Option::is_none")]
pub visible_output: Option<String>,
/// `toolCall`/`userShell`: stored-output reference; fetch the full bytes
/// via `item/readOutput`.
#[serde(skip_serializing_if = "Option::is_none")]
pub output_ref: Option<OutputRef>,
/// `toolCall`: the shared semantic receipt — what the operation did, as
/// machine-readable fact. Optional and additive: absence is always valid
/// and is never an error. When present, a server serves the **same**
/// receipt on every item path — `item/completed`, `view/page`, seeded
/// snapshots and resume. Observation only; carries no control authority,
/// and no field in it enters model-visible content.
#[serde(skip_serializing_if = "Option::is_none")]
pub tool_receipt: Option<Box<ToolReceipt>>,
/// `toolCall`: server-authored edit-family diff summary — always beside
/// `patchRef`; absent = no diff available.
#[serde(skip_serializing_if = "Option::is_none")]
pub patch_summary: Option<PatchSummary>,
/// `toolCall`: stored structured-patch reference (`kind: "tool_patch"`,
/// `mediaType: "application/json"`); the body is fetched via
/// `item/readOutput` with `patchRef.id`, and the ref survives the
/// elided-snapshot rung exactly like `outputRef` without ever being an
/// elision trigger.
#[serde(skip_serializing_if = "Option::is_none")]
pub patch_ref: Option<OutputRef>,
/// `toolCall`: rich content the model saw beyond text; base64 is not
/// inlined on the view.
#[serde(skip_serializing_if = "Option::is_none")]
pub model_visible_content: Option<Vec<ModelVisibleContent>>,
/// `toolCall`: the approval that gated this call; join key for the approval
/// view events.
#[serde(skip_serializing_if = "Option::is_none")]
pub approval_id: Option<String>,
/// `toolCall`: `true` while the call is held before it is admitted to
/// execute. Present on an item started at hold time, cleared by the release
/// `item/updated`, absent on calls never held.
#[serde(skip_serializing_if = "Option::is_none")]
pub held: Option<bool>,
/// `toolCall`: what holds the call; present exactly when `held` is.
#[serde(skip_serializing_if = "Option::is_none")]
pub held_for: Option<HeldFor>,
/// `toolCall`: `true` once the task was durably backgrounded; delivered
/// via `item/updated`.
#[serde(skip_serializing_if = "Option::is_none")]
pub background: Option<bool>,
/// `toolCall`: who backgrounded the task; absent on pre-split records —
/// never inferred.
#[serde(skip_serializing_if = "Option::is_none")]
pub background_initiator: Option<BackgroundInitiator>,
/// `toolCall`: the backgrounded-row payload for a running backgrounded item
/// — auto-yield or an explicit user/timeout background; may appear with or
/// without `background`/`backgroundInitiator`. Experimental, delivered via
/// `item/updated`. Presentation only — never a durability claim.
#[serde(skip_serializing_if = "Option::is_none")]
pub background_status: Option<BackgroundStatus>,
/// `toolCall`: the task's visible latest-status line — the latest `Status`
/// message through the shared detail normalization; absent when no status
/// folded or nothing displayable remains.
#[serde(skip_serializing_if = "Option::is_none")]
pub status_line: Option<String>,
/// `toolCall`: the latest detail's phase row, verbatim; absent when the
/// latest detail carries none.
#[serde(skip_serializing_if = "Option::is_none")]
pub status_phase: Option<String>,
/// `toolCall`: the latest progress facet, field-for-field; absent when the
/// latest detail carries none.
#[serde(skip_serializing_if = "Option::is_none")]
pub status_progress: Option<StatusProgress>,
/// `toolCall`: the latest active-step facet, field-for-field; absent when
/// the latest detail carries none.
#[serde(skip_serializing_if = "Option::is_none")]
pub status_step: Option<StatusStep>,
/// `toolCall`: the latest external-attempt facet, field-for-field —
/// countdown inputs the client renders the tick from; absent when the
/// latest detail carries none.
#[serde(skip_serializing_if = "Option::is_none")]
pub status_attempt: Option<StatusAttempt>,
/// `toolCall`: the latest health facet, field-for-field; absent when the
/// latest detail carries none.
#[serde(skip_serializing_if = "Option::is_none")]
pub status_health: Option<StatusHealth>,
/// `toolCall`: the latest child-summary facet, field-for-field; absent when
/// the latest detail carries none.
#[serde(skip_serializing_if = "Option::is_none")]
pub status_children: Option<StatusChildren>,
/// `toolCall`: the tool's own words for this call; absent = none.
#[serde(skip_serializing_if = "Option::is_none")]
pub display_label: Option<Box<crate::msp::view::tool_label::ToolDisplayLabel>>,
/// `toolCall`: the task's registered Work ID, verbatim
/// (`work.v2.managed_bash.sha256.…`); present only when the task registered
/// a ManagedBash id, absent otherwise. Stable from day one: no
/// `x-msp-stability` marker. The host serves it at the later of the task
/// terminal and the inbox admission; absence keeps the client's v1
/// derivation.
#[serde(skip_serializing_if = "Option::is_none")]
pub work_id: Option<String>,
}