muse_code_sdk/msp/method/model_complete.rs
1// @generated from the MSP stable schema and protocol sources; do not edit by hand.
2
3use super::turn::CommandStatus;
4use serde::Deserialize;
5use serde::Serialize;
6
7/// Who said one `model/complete` message. **Closed**: a client-produced
8/// input the host validates, so an unknown role is `invalidParams`.
9#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
10#[serde(rename_all = "camelCase")]
11pub enum ModelCompleteRole {
12 /// The caller's own text.
13 User,
14 /// An earlier model answer the caller sends back as context.
15 Assistant,
16}
17
18/// One `model/complete` message.
19#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
20#[serde(rename_all = "camelCase")]
21pub struct ModelCompleteMessage {
22 /// Who said it.
23 pub role: ModelCompleteRole,
24 /// What was said.
25 pub text: String,
26}
27
28/// `model/complete` params: the retry id, 1 to 32 messages (the first and the
29/// last `user`), an optional system text and the output bound. No session and
30/// no model: the host picks the model. The host answers an unknown field with
31/// `invalidParams`; the type itself accepts it.
32#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
33#[serde(rename_all = "camelCase")]
34pub struct ModelCompleteParams {
35 /// The client-minted UUIDv7 retry id.
36 pub command_id: String,
37 /// What the model answers, oldest first.
38 pub messages: Vec<ModelCompleteMessage>,
39 /// The system text, when the caller sends one.
40 #[serde(default, skip_serializing_if = "Option::is_none")]
41 pub system: Option<String>,
42 /// The most tokens the model may write.
43 pub max_tokens: u32,
44}
45
46/// `model/complete` result: admission only — the ack is never the completion.
47#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
48#[serde(rename_all = "camelCase")]
49#[non_exhaustive]
50pub struct ModelCompleteResult {
51 /// The request's id, echoed.
52 pub command_id: String,
53 /// Always `accepted` on this path.
54 pub status: CommandStatus,
55}
56
57/// `model/cancel` params: the `commandId` of the call to cancel, not a retry id
58/// of its own.
59#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
60#[serde(rename_all = "camelCase")]
61pub struct ModelCancelParams {
62 /// The call to cancel.
63 pub command_id: String,
64}
65
66/// `model/cancel` result: always empty, for a call in flight and for an id no
67/// call holds alike; `model/completed` reports the outcome.
68#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)]
69#[non_exhaustive]
70pub struct ModelCancelResult {}