muse_code_sdk/msp/method/task.rs
1// @generated from the MSP stable schema and protocol sources; do not edit by hand.
2
3use crate::msp::method::turn::CommandStatus;
4use crate::msp::view::item_content::BackgroundInitiator;
5use serde::Deserialize;
6use serde::Serialize;
7
8mod catch_all;
9
10/// `task/background` params: durably send a running foreground tool task to the
11/// background.
12#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
13#[serde(rename_all = "camelCase")]
14pub struct TaskBackgroundParams {
15 /// The target session.
16 pub session_id: String,
17 /// The idempotency handle (UUIDv7).
18 pub command_id: String,
19 /// The task to background, exactly as the view names it: the `toolCall`
20 /// item's `itemId` IS the task id.
21 pub task_id: String,
22}
23
24/// `task/stop` params: stop one named background task. Required target, never
25/// "whichever is loudest" — is the blanket verb.
26#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
27#[serde(rename_all = "camelCase")]
28pub struct TaskStopParams {
29 /// The target session.
30 pub session_id: String,
31 /// The idempotency handle (UUIDv7).
32 pub command_id: String,
33 /// The task to stop, the `toolCall` item's `itemId`.
34 pub task_id: String,
35}
36
37/// `task/stopAll` params: stop every stoppable background workload live at
38/// admission.
39#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
40#[serde(rename_all = "camelCase")]
41pub struct TaskStopAllParams {
42 /// The target session.
43 pub session_id: String,
44 /// The idempotency handle (UUIDv7).
45 pub command_id: String,
46}
47
48/// The `task/background` / `task/stop` ack: admission-only, echoing the
49/// targeted task.
50#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
51#[serde(rename_all = "camelCase")]
52#[non_exhaustive]
53pub struct TaskCommandResult {
54 /// Echoes the client's id.
55 pub command_id: String,
56 /// Admission status.
57 pub status: CommandStatus,
58 /// Echoes the targeted task id.
59 pub task_id: String,
60}
61
62/// The `task/stopAll` ack: always `accepted`, including over an empty set — a
63/// blanket stop over nothing is a satisfied gesture. The ack deliberately
64/// carries no stopped-task list; count the kills from the view.
65#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
66#[serde(rename_all = "camelCase")]
67#[non_exhaustive]
68pub struct TaskStopAllResult {
69 /// Echoes the client's id.
70 pub command_id: String,
71 /// Admission status.
72 pub status: CommandStatus,
73}
74
75/// `task/list` params: the session whose background-task inventory to read. A
76/// read-only query in the `skill/list` mold: no `commandId`, no durable record,
77/// no view event.
78#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
79#[serde(rename_all = "camelCase")]
80pub struct TaskListParams {
81 /// The target session.
82 pub session_id: String,
83}
84
85/// `task/list` result: one row per running background workload in
86/// `task/stopAll` reach, oldest first; empty when nothing is running.
87#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
88#[serde(rename_all = "camelCase")]
89#[non_exhaustive]
90pub struct TaskListResult {
91 /// The session's live background-task rows.
92 pub tasks: Vec<TaskListEntry>,
93}
94
95/// One background-task inventory row. The row is the stable contract: `kind`
96/// and `status` stay open so a future state extends them without breaking
97/// clients.
98#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
99#[serde(rename_all = "camelCase")]
100#[non_exhaustive]
101pub struct TaskListEntry {
102 /// The `toolCall` item's `itemId` for item rows; the runtime registry
103 /// id for registry-only rows.
104 pub task_id: String,
105 /// What the workload is: `"tool"` or `"tool.*"` for item rows (the
106 /// recorded kind when the registry records one, else `"tool"`); the
107 /// recorded registry kind string verbatim for registry-only rows.
108 /// Open vocabulary — clients MUST ignore unknown kinds. A `String`,
109 /// not an enum: registry kind strings are unbounded.
110 pub kind: String,
111 /// `"inProgress"` — the only value at this increment, since every
112 /// listed row is non-terminal by construction.
113 pub status: TaskListStatus,
114 /// The short tool name on item-visible tool rows only; never a label,
115 /// never arguments. **Additive-optional**: absent elsewhere.
116 #[serde(skip_serializing_if = "Option::is_none")]
117 pub tool: Option<String>,
118 /// The host-known task start, RFC3339. **Additive-optional**: omitted,
119 /// never guessed, when the host does not know it.
120 #[serde(skip_serializing_if = "Option::is_none")]
121 pub started_at: Option<String>,
122 /// Who backgrounded the task, mirroring the item field.
123 /// **Additive-optional**: absent on pre-split records and
124 /// registry-only rows, never inferred.
125 #[serde(skip_serializing_if = "Option::is_none")]
126 pub background_initiator: Option<BackgroundInitiator>,
127}
128
129/// A task row's status. Open: a future state is additive, and clients MUST
130/// ignore unknown statuses.
131#[derive(Debug, Clone, PartialEq, Eq)]
132#[non_exhaustive]
133pub enum TaskListStatus {
134 /// The workload is live; every listed row carries this today.
135 InProgress,
136 /// A value from a newer host, kept verbatim so an older client decodes the
137 /// rest of the message. Never construct it with a known word.
138 Unknown(String),
139}