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::state::TokenUsage;
use serde::Deserialize;
use serde::Serialize;
mod catch_all;
/// Subagent control status. Open; the generic item `status` is the terminal
/// authority.
#[derive(Debug, Clone, PartialEq, Eq)]
#[non_exhaustive]
pub enum SubagentControlStatus {
/// Spawn accepted.
Accepted,
/// Child starting.
Starting,
/// Child running.
Running,
/// Result envelope ready.
ResultReady,
/// Child closing.
Closing,
/// Child closed.
Closed,
/// Recovery pending after a restart.
RecoveryPending,
/// Parked for manual reconciliation.
ManualReconciliation,
/// A value from a newer host, kept verbatim so an older client decodes the
/// rest of the message. Never construct it with a known word.
Unknown(String),
}
/// A subagent child's workspace placement: `shared` when the spawn requested no
/// worktree isolation, `isolated` when it did. Open; unknown values read as
/// unknown. Experimental.
#[derive(Debug, Clone, PartialEq, Eq)]
#[non_exhaustive]
pub enum WorkspacePlacement {
/// The child shares its parent's workspace.
Shared,
/// The child runs in its own worktree.
Isolated,
/// A value from a newer host, kept verbatim so an older client decodes the
/// rest of the message. Excluded from the generated schema while the enum
/// stays declared open; never construct it with a known word.
Unknown(String),
}
/// A subagent's result envelope.
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
#[non_exhaustive]
pub struct SubagentResult {
/// Result summary, bounded on the wire at the 64 KiB retained-text budget;
/// a cut sets the item's `truncated`. The durable record stays verbatim.
pub summary: String,
/// Result text, when present, bounded on the wire at the same 64 KiB
/// budget; a cut sets the item's `truncated`.
#[serde(skip_serializing_if = "Option::is_none")]
pub text: Option<String>,
/// Error kind, verbatim durable vocabulary, when the child failed.
#[serde(skip_serializing_if = "Option::is_none")]
pub error_kind: Option<String>,
/// Evidence references, verbatim.
pub evidence_refs: Vec<String>,
/// Artifact references, verbatim.
pub artifact_refs: Vec<String>,
/// Structured result data, verbatim, when present.
#[serde(skip_serializing_if = "Option::is_none")]
pub structured_data: Option<serde_json::Map<String, serde_json::Value>>,
/// `true` once the parent consumed the result. Absent otherwise; never
/// cleared once set. Clients mint the `Finished` marker off this flag
/// instead of re-deriving the join; a client that knows `subagentResult`
/// draws one `Finished` member per consumed result instead, and keeps
/// drawing from this flag for a child with no such item, as on a host
/// before the kind.
#[serde(skip_serializing_if = "Option::is_none")]
pub drained: Option<bool>,
/// `true` once a newer attempt of the child started after this result: the
/// result stays, and a client takes the child's status from
/// `controlStatus`. Absent, it asserts nothing (a host before this member,
/// or a fold state saved before it, never sets it); a newer result replaces
/// the whole result, so it carries no mark.
#[serde(skip_serializing_if = "Option::is_none")]
pub superseded: Option<bool>,
}
/// One workflow child's folded state, keyed by `(childId, attempt)`.
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
#[non_exhaustive]
pub struct WorkflowChild {
/// The child's id within the run.
pub child_id: String,
/// The attempt number.
pub attempt: u32,
/// camelCased `WorkflowChildLifecycleStatus`, verbatim (durable runtime
/// vocabulary).
pub status: String,
/// The child's phase, when recorded.
#[serde(skip_serializing_if = "Option::is_none")]
pub phase: Option<String>,
/// The child's display label, when recorded.
#[serde(skip_serializing_if = "Option::is_none")]
pub label: Option<String>,
/// The child's observed usage, when recorded.
#[serde(skip_serializing_if = "Option::is_none")]
pub usage: Option<TokenUsage>,
/// The child's observed duration, when recorded.
#[serde(skip_serializing_if = "Option::is_none")]
pub duration_ms: Option<u64>,
/// The child's terminal, turn vocabulary.
#[serde(skip_serializing_if = "Option::is_none")]
pub terminal: Option<crate::msp::view::event::TurnTerminal>,
/// The child's recorded result reference, verbatim, when present — an
/// opaque string, matching the durable owner.
#[serde(skip_serializing_if = "Option::is_none")]
pub result_ref: Option<String>,
/// The attempt's machine failure class, verbatim when recorded. The
/// attempt's outcome (`terminal`, else `status`) stays authoritative,
/// except that `"completed"` with `failureKind` present means it failed.
#[serde(skip_serializing_if = "Option::is_none")]
pub failure_kind: Option<String>,
/// The attempt's failure reason text, verbatim when recorded except cut
/// to at most 2,048 UTF-8 bytes ending in U+2026 when longer.
#[serde(skip_serializing_if = "Option::is_none")]
pub failure_reason: Option<String>,
}
/// `workflow`: the run's launch token budget.
#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
#[non_exhaustive]
pub struct WorkflowTokenBudget {
/// The effective launch budget in tokens, verbatim from the launch fact.
pub total: u64,
}