Skip to main content

muse_code_sdk/msp/
error.rs

1// @generated from the MSP stable schema and protocol sources; do not edit by hand.
2
3pub use data::ErrorData;
4pub use kind::ErrorKind;
5pub use registry::ErrorCode;
6use serde::Deserialize;
7use serde::Serialize;
8
9pub(crate) mod data;
10pub(crate) mod definition;
11pub(crate) mod kind;
12pub(crate) mod registry;
13
14/// Identifies one requirement of an approval: for a `shell` approval, one
15/// stage. A client sends it back as `requirementId` in `approval/decide`, and a
16/// stale-requirement error names the current one.
17#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
18#[serde(rename_all = "camelCase")]
19pub struct ApprovalRequirementRef {
20    /// The approval this requirement belongs to.
21    pub approval_id: String,
22    /// The requirement's index within the approval, counting from 0; an
23    /// approval with a single requirement uses 0.
24    pub source_index: usize,
25}
26
27/// Winning terminal returned to a losing `approval/decide` command.
28#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
29#[serde(rename_all = "camelCase")]
30#[non_exhaustive]
31pub struct ApprovalResolutionSummary {
32    /// The winning decision, as an `approval/resolved` decision value such as
33    /// `approved` or `abort`.
34    pub decision: String,
35    /// Who made the winning decision, such as `user`, `policy` or `llmJudge`.
36    pub resolved_by: String,
37    /// The view cursor of the winning `approval/resolved` event.
38    pub view_cursor: String,
39}
40
41/// Winning terminal returned to a late user-input command.
42#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
43#[serde(rename_all = "camelCase")]
44#[non_exhaustive]
45pub struct UserInputSettlementSummary {
46    /// How the prompt settled, as a `userInput/settled` outcome value such as
47    /// `answered` or `timedOut`.
48    pub outcome: String,
49    /// The view cursor of the `userInput/settled` event that recorded the
50    /// settlement.
51    pub view_cursor: String,
52}
53
54/// Winning terminal returned to a losing `admission/decide` command:
55/// `resolvedBy` is omitted on timeout.
56#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
57#[serde(rename_all = "camelCase")]
58#[non_exhaustive]
59pub struct AdmissionResolutionSummary {
60    /// The winning decision, such as `allow_once` or `timedOut`.
61    pub decision: String,
62    /// Who made the winning decision; absent when no person decided, for
63    /// example a timeout, an automatic allow, or a cancelled or retired
64    /// request.
65    #[serde(default, skip_serializing_if = "Option::is_none")]
66    pub resolved_by: Option<String>,
67    /// The view cursor of the winning `admission/resolved` event.
68    pub view_cursor: String,
69}
70
71/// The `error` member of an error response.
72#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
73#[serde(rename_all = "camelCase")]
74#[non_exhaustive]
75pub struct ErrorObject {
76    /// Registry code. Typed as a plain integer on the wire; the value domain is
77    /// the registry below.
78    pub code: i64,
79    /// Human-readable message. Never a branch point.
80    pub message: String,
81    /// Structured detail; carries `kind` when present.
82    #[serde(skip_serializing_if = "Option::is_none")]
83    pub data: Option<Box<ErrorData>>,
84}