muse_code_sdk/msp/method/user_input.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::user_input::UserInputAnswer;
5use crate::msp::view::user_input::UserInputClarification;
6use serde::Deserialize;
7use serde::Serialize;
8
9/// `userInput/answer` params: answer every question.
10///
11/// Each answer carries `questionId` then exactly one of `selectedLabel`
12/// (single mode), `selectedLabels` (multiple mode, within min/max bounds), or
13/// `freeText` (<=500 chars); plus an optional `note` (<=500). Answers that do
14/// not match the prompt fail -32057 `userInputAnswerInvalid`. Image
15/// `attachments` are a **reserved** field in v1, rejected if sent, because
16/// the blob-upload path they reference is also reserved.
17#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
18#[serde(rename_all = "camelCase")]
19pub struct UserInputAnswerParams {
20 /// The target session.
21 pub session_id: String,
22 /// The idempotency handle (UUIDv7).
23 pub command_id: String,
24 /// The prompt being answered.
25 pub user_input_id: String,
26 /// One entry per question.
27 pub answers: Vec<UserInputAnswer>,
28}
29
30/// `userInput/answer` result.
31#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
32#[serde(rename_all = "camelCase")]
33#[non_exhaustive]
34pub struct UserInputAnswerResult {
35 /// Echoes the client's id.
36 pub command_id: String,
37 /// Admission status.
38 pub status: CommandStatus,
39 /// The prompt this answer settled.
40 pub user_input_id: String,
41}
42
43/// `userInput/cancel` params: decline to answer; the tool call resolves with a
44/// cancelled result the model sees.
45#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
46#[serde(rename_all = "camelCase")]
47pub struct UserInputCancelParams {
48 /// The target session.
49 pub session_id: String,
50 /// The idempotency handle (UUIDv7).
51 pub command_id: String,
52 /// The prompt being declined.
53 pub user_input_id: String,
54 /// Why the prompt was declined.
55 #[serde(skip_serializing_if = "Option::is_none")]
56 pub reason: Option<String>,
57}
58
59/// `userInput/cancel` result.
60#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
61#[serde(rename_all = "camelCase")]
62#[non_exhaustive]
63pub struct UserInputCancelResult {
64 /// Echoes the client's id.
65 pub command_id: String,
66 /// Admission status.
67 pub status: CommandStatus,
68 /// The prompt this cancellation settled.
69 pub user_input_id: String,
70}
71
72/// `userInput/clarify` params: answer with a free-form clarification instead of
73/// the structured options — the "let me explain" path; the model receives the
74/// clarification text and re-decides.
75#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
76#[serde(rename_all = "camelCase")]
77pub struct UserInputClarifyParams {
78 /// The target session.
79 pub session_id: String,
80 /// The idempotency handle (UUIDv7).
81 pub command_id: String,
82 /// The prompt being clarified.
83 pub user_input_id: String,
84 /// `format` is `"text"` in v1 (open); `content` is <=500 chars.
85 pub clarification: UserInputClarification,
86}
87
88/// `userInput/clarify` result.
89#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
90#[serde(rename_all = "camelCase")]
91#[non_exhaustive]
92pub struct UserInputClarifyResult {
93 /// Echoes the client's id.
94 pub command_id: String,
95 /// Admission status.
96 pub status: CommandStatus,
97 /// The prompt this clarification settled.
98 pub user_input_id: String,
99}
100
101/// `userInput/interrupt` params: interrupt the named prompt carrying confirmed
102/// partial answers, then stop the turn.
103///
104/// `answers` is optional and, when present, follows exactly the
105/// `userInput/answer` shape and limits (same `questionId` + one-of + `note`
106/// rules, same -32057 `userInputAnswerInvalid` on mismatch); absent or
107/// empty means interrupt with no confirmed answers.
108#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
109#[serde(rename_all = "camelCase")]
110pub struct UserInputInterruptParams {
111 /// The target session.
112 pub session_id: String,
113 /// The idempotency handle (UUIDv7).
114 pub command_id: String,
115 /// The prompt being interrupted.
116 pub user_input_id: String,
117 /// Confirmed partial answers the named settlement carries.
118 #[serde(default, skip_serializing_if = "Option::is_none")]
119 pub answers: Option<Vec<UserInputAnswer>>,
120}
121
122/// `userInput/interrupt` result.
123#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
124#[serde(rename_all = "camelCase")]
125#[non_exhaustive]
126pub struct UserInputInterruptResult {
127 /// Echoes the client's id.
128 pub command_id: String,
129 /// Admission status.
130 pub status: CommandStatus,
131 /// The prompt this interruption settled.
132 pub user_input_id: String,
133}
134
135/// `userInput/engaged` params: a fire-and-forget engagement note — the user
136/// started interacting with a timed prompt, so the host disarms that prompt's
137/// auto-resolution countdown. No result, no errors, no `commandId`, no ledger
138/// row.
139#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
140#[serde(rename_all = "camelCase")]
141pub struct UserInputEngagedParams {
142 /// The target session.
143 pub session_id: String,
144 /// The prompt being engaged.
145 pub user_input_id: String,
146}