Skip to main content

muse_code_sdk/msp/view/
approval_card_facts.rs

1// @generated from the MSP stable schema and protocol sources; do not edit by hand.
2
3use serde::Deserialize;
4use serde::Serialize;
5
6/// One Computer Use card's facts. Empty collections and absent rows are
7/// omitted, never `null`.
8#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)]
9#[serde(rename_all = "camelCase")]
10#[non_exhaustive]
11pub struct ApprovalCuaCardFacts {
12    /// The target window's title: the app's own text, which a page can set;
13    /// a client shows it quoted and as plain text, never as markup or a
14    /// choice, and may cap it.
15    #[serde(default, skip_serializing_if = "Option::is_none")]
16    pub window_title: Option<String>,
17    /// For a browser, the host of the window's current page.
18    #[serde(default, skip_serializing_if = "Option::is_none")]
19    pub page: Option<ApprovalCuaPage>,
20    /// Only the consequential steps, in call order.
21    #[serde(default, skip_serializing_if = "Vec::is_empty")]
22    pub steps: Vec<ApprovalCuaStep>,
23    /// The data the call would send that the card must name; a card with any
24    /// offers only one-shot choices.
25    #[serde(default, skip_serializing_if = "Vec::is_empty")]
26    pub data: Vec<ApprovalCuaDataFact>,
27}
28
29/// The page's full host, no path or query.
30#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
31#[serde(rename_all = "camelCase")]
32#[non_exhaustive]
33pub struct ApprovalCuaPage {
34    /// The host in Unicode.
35    pub host: String,
36    /// The host's `xn--` form; equal to `host` when they don't differ.
37    pub host_ascii: String,
38}
39
40/// One consequential step. A client renders "Step N: <action> <roleWord>
41/// "<label>" — <effect>"; a key step names its `chord`, and only a step with
42/// a `point` (and no label or chord) reads "at x,y".
43#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
44#[serde(rename_all = "camelCase")]
45#[non_exhaustive]
46pub struct ApprovalCuaStep {
47    /// 1-based, as the batch numbers its steps.
48    pub step: u32,
49    /// An open tag for styling and tests only (`verb:<class>`, `unresolved`,
50    /// `unlabeled`); a client that doesn't know a value renders the step from
51    /// `effect` and its label as usual.
52    pub kind: String,
53    /// The host's verb phrase, such as `click` or `type into`.
54    pub action: String,
55    /// The host's trusted sentence for what the step may do.
56    pub effect: String,
57    /// `button`, `link`, `menu item` or `key`; absent for a point step.
58    #[serde(default, skip_serializing_if = "Option::is_none")]
59    pub role_word: Option<String>,
60    /// The control's label: the app's own text, shown quoted and as plain
61    /// text; a client may cap it.
62    #[serde(default, skip_serializing_if = "Option::is_none")]
63    pub label: Option<String>,
64    /// The chord, for a key step.
65    #[serde(default, skip_serializing_if = "Option::is_none")]
66    pub chord: Option<String>,
67    /// The step's own 0–1000 model coordinates, only for a point step.
68    #[serde(default, skip_serializing_if = "Option::is_none")]
69    pub point: Option<ApprovalCuaPoint>,
70}
71
72/// A point in the model's 0–1000 coordinates.
73#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
74#[non_exhaustive]
75pub struct ApprovalCuaPoint {
76    pub x: u16,
77    pub y: u16,
78}
79
80/// One piece of data the call would send. An open union on `kind`
81/// (`secret`, or `other` for a row the host can't word); a client shows
82/// `other` and any kind it doesn't know as a generic data row.
83#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
84#[serde(rename_all = "camelCase")]
85#[non_exhaustive]
86pub struct ApprovalCuaDataFact {
87    /// Open discriminator: `secret` or `other`.
88    pub kind: String,
89    /// For `secret`, the scanner's open tag (`github_token`,
90    /// `secret_named_value` and so on); a client words the tags it knows and
91    /// shows any other as "a secret".
92    #[serde(default, skip_serializing_if = "Option::is_none")]
93    pub secret_kind: Option<String>,
94    /// For `secret`, the parts of it the card may show, never the value.
95    #[serde(default, skip_serializing_if = "Option::is_none")]
96    pub mask: Option<ApprovalCuaMask>,
97}
98
99/// A secret's mask: a vendor token's prefix and last 4 characters
100/// (`ghp_…3f9a`), a named value's name and length (`password=… (12 chars)`),
101/// or the length alone; all absent names the kind only.
102#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)]
103#[serde(rename_all = "camelCase")]
104#[non_exhaustive]
105pub struct ApprovalCuaMask {
106    /// A vendor token's fixed prefix (`ghp_`), or a named value's name and
107    /// its `=` (`password=`).
108    #[serde(default, skip_serializing_if = "Option::is_none")]
109    pub prefix: Option<String>,
110    /// A vendor token's last 4 characters.
111    #[serde(default, skip_serializing_if = "Option::is_none")]
112    pub last4: Option<String>,
113    /// The secret's length in characters.
114    #[serde(default, skip_serializing_if = "Option::is_none")]
115    pub chars: Option<u32>,
116}