Skip to main content

muse_code_sdk/msp/method/
subagent.rs

1// @generated from the MSP stable schema and protocol sources; do not edit by hand.
2
3use crate::msp::view::item::SubagentControlStatus;
4use serde::Deserialize;
5use serde::Serialize;
6
7/// `subagent/list` params: the session whose subagent roster to read. A
8/// read-only query in the `skill/list` mold: no `commandId`, no durable
9/// record, no view event. Served by the loaded parent's runtime control
10/// records, so its refusals (`-32020`/`-32021`/`-32022`/`-32024`, plus a retryable
11/// `-32603` when the runtime source declines) are the `task/list` split.
12#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
13#[serde(rename_all = "camelCase")]
14pub struct SubagentListParams {
15    /// The target session (the parent whose children to list).
16    pub session_id: String,
17}
18
19/// `subagent/list` result: the session's roster rows. Empty only when the
20/// parent's control records name no durable child; a declined source
21/// refuses typed instead of answering empty.
22#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
23#[serde(rename_all = "camelCase")]
24#[non_exhaustive]
25pub struct SubagentListResult {
26    /// The session's roster rows, ordered by `(agentPath, subagentId)`.
27    pub subagents: Vec<SubagentRosterEntry>,
28}
29
30/// One roster row: a durable child's identity, place, and state, projected
31/// from its control records. Rows carry no result content — the transcript
32/// stays on the child session / `subagent/readResult`.
33#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
34#[serde(rename_all = "camelCase")]
35#[non_exhaustive]
36pub struct SubagentRosterEntry {
37    /// The durable child identity (`subagent_id`). Rows without one are not
38    /// roster rows: a rejected spawn names no child.
39    pub subagent_id: String,
40    /// The child's own session id, readable via `session/read`/`view/page`.
41    /// **Additive-optional**: absent until the child's start is attested.
42    #[serde(skip_serializing_if = "Option::is_none")]
43    pub child_session_id: Option<String>,
44    /// The agent definition path (`agent_path`), verbatim from the spawn.
45    pub agent_path: String,
46    /// The child's display name: the spawn `description`, falling back to
47    /// the spawn `role`. **Additive-optional**: absent when neither carries
48    /// one; never parsed from `agentPath`.
49    #[serde(skip_serializing_if = "Option::is_none")]
50    pub name: Option<String>,
51    /// The granted definition's name (`definition_grant_audit`
52    /// `definition_name`). **Additive-optional**: absent on spawns without
53    /// a grant audit (historical records). The resolved definition id is
54    /// not persisted on the spawn record, so the name is what the roster
55    /// can truthfully carry.
56    #[serde(skip_serializing_if = "Option::is_none")]
57    pub definition_name: Option<String>,
58    /// The parent row's `agentPath`. **Additive-optional**: absent whenever
59    /// `parentSubagentId` is.
60    #[serde(skip_serializing_if = "Option::is_none")]
61    pub parent_path: Option<String>,
62    /// The parent's `subagentId`: the roster row whose child session issued
63    /// this child's spawn. **Additive-optional**: absent when the parent is
64    /// the root session, or when the parent row is not in the roster or not
65    /// yet attested — never guessed, never derived from `agentPath`.
66    #[serde(skip_serializing_if = "Option::is_none")]
67    pub parent_subagent_id: Option<String>,
68    /// The spawn depth (1 = a root-session child).
69    pub depth: u32,
70    /// The spawn role. **Additive-optional**: absent when the spawn
71    /// carried none.
72    #[serde(skip_serializing_if = "Option::is_none")]
73    pub role: Option<String>,
74    /// The spawn objective. **Additive-optional**: absent when the spawn
75    /// carried none.
76    #[serde(skip_serializing_if = "Option::is_none")]
77    pub objective: Option<String>,
78    /// The owning dynamic workflow run id, when the child was
79    /// workflow-admitted. **Additive-optional**: absent for native spawns.
80    #[serde(skip_serializing_if = "Option::is_none")]
81    pub workflow_run_id: Option<String>,
82    /// The child's control status: `Accepted` at spawn, then the latest
83    /// `StatusUpdated` / `Closed` / `ResultReady` / `RecoveryAvailable` /
84    /// `RecoveryDecision` (`Accepted | Starting | Running | ResultReady |
85    /// Closing | Closed | RecoveryPending | ManualReconciliation`).
86    pub control_status: SubagentControlStatus,
87    /// Whether the child's latest attempt's result is ready (a
88    /// `ResultReady` for the latest admitted attempt seen).
89    pub result_ready: bool,
90    /// The terminal reason: the result envelope's `errorKind` when present,
91    /// else the cancel outcome's `reason`. **Additive-optional**: absent on
92    /// live rows and on terminals that carry no reason — never fabricated
93    /// from the close outcome's status word.
94    #[serde(skip_serializing_if = "Option::is_none")]
95    pub terminal_reason: Option<String>,
96    /// The child's observed wall-clock duration in ms, when the runtime
97    /// observed one. **Additive-optional**: absent until first observation.
98    #[serde(skip_serializing_if = "Option::is_none")]
99    pub duration_ms: Option<u64>,
100}