Skip to main content

muse_code_sdk/msp/method/
recap.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
7mod catch_all;
8
9/// `recap/request` params: the session plus the client-minted UUIDv7 retry id.
10/// No other param; unknown fields are `invalidParams`.
11#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
12#[serde(rename_all = "camelCase")]
13pub struct RecapRequestParams {
14    /// The session to recap (required).
15    pub session_id: String,
16    /// The client-minted retry id.
17    pub command_id: String,
18}
19
20/// `recap/request` result: admission only — the ack is never the recap.
21#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
22#[serde(rename_all = "camelCase")]
23#[non_exhaustive]
24pub struct RecapRequestResult {
25    /// The request's id, echoed.
26    pub command_id: String,
27    /// Always `accepted` on this path.
28    pub status: CommandStatus,
29}
30
31/// `recap/cancel` params: the session plus the cancel's own retry id. No target
32/// — one in-flight slot per session makes the target unambiguous.
33#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
34#[serde(rename_all = "camelCase")]
35pub struct RecapCancelParams {
36    /// The session whose in-flight recap to cancel (required).
37    pub session_id: String,
38    /// The cancel's own retry id.
39    pub command_id: String,
40}
41
42/// `recap/cancel` result: admission only. In flight → the recap settles
43/// `cancelled`; idle → accepted no-op.
44#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
45#[serde(rename_all = "camelCase")]
46#[non_exhaustive]
47pub struct RecapCancelResult {
48    /// The cancel's id, echoed.
49    pub command_id: String,
50    /// Always `accepted` on this path.
51    pub status: CommandStatus,
52}
53
54/// `recap/completed` outcome: the terminal vocabulary, camelCase per the
55/// protocol spec. **Open**: a server-produced result vocabulary.
56#[derive(Debug, Clone, PartialEq, Eq)]
57#[non_exhaustive]
58pub enum RecapOutcome {
59    /// The recap text is delivered in `text`.
60    Completed,
61    /// The side-call failed; `reason` says why.
62    Failed,
63    /// `recap/cancel` won the race.
64    Cancelled,
65    /// The host-enforced 45s bound fired.
66    TimedOut,
67    /// A value from a newer host, kept verbatim so an older client decodes the
68    /// rest of the message. Never construct it with a known word.
69    Unknown(String),
70}
71
72/// `recap/completed` failure reason: post-ack failures fold to the single
73/// initial value. **Open**: later splits stay additive.
74#[derive(Debug, Clone, PartialEq, Eq)]
75#[non_exhaustive]
76pub enum RecapFailureReason {
77    /// Provider errors, tool requests, setup-fence and projection
78    /// refusals, missing models — the TUI's single failure rendering.
79    ProviderFailed,
80    /// A value from a newer host, kept verbatim so an older client decodes the
81    /// rest of the message. Never construct it with a known word.
82    Unknown(String),
83}
84
85/// `recap/completed` params: the settlement, delivered to the requesting
86/// connection outside the view stream — no `viewCursor`, no `sourceRange`.
87/// `text` is required on `completed`; `reason` is required on `failed`; neither
88/// rides `cancelled`/`timedOut`. The struct marks the conditional members
89/// optional; the SS prose pins the per-outcome rule, the `turn/completed`
90/// usage/error convention.
91#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
92#[serde(rename_all = "camelCase")]
93#[non_exhaustive]
94pub struct RecapCompletedParams {
95    /// The recapped session.
96    pub session_id: String,
97    /// The request's id — the correlation key.
98    pub command_id: String,
99    /// How the request settled.
100    pub outcome: RecapOutcome,
101    /// The recap text verbatim (on `completed`).
102    #[serde(default, skip_serializing_if = "Option::is_none")]
103    pub text: Option<String>,
104    /// The model-produced short title (on `completed`, when produced).
105    #[serde(default, skip_serializing_if = "Option::is_none")]
106    pub title: Option<String>,
107    /// Why the side-call failed (on `failed`).
108    #[serde(default, skip_serializing_if = "Option::is_none")]
109    pub reason: Option<RecapFailureReason>,
110}