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 /// For a browser card, the notices it carries; absent unless at least
28 /// one shows.
29 #[serde(default, skip_serializing_if = "Option::is_none")]
30 pub browser: Option<ApprovalCuaBrowser>,
31}
32
33/// A browser card's notices: the first time Computer Use uses a browser on
34/// this Mac, and the session's consent before it opens its own window in a
35/// browser that comes to the front when it does. A client words each flag
36/// itself.
37#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)]
38#[serde(rename_all = "camelCase")]
39#[non_exhaustive]
40pub struct ApprovalCuaBrowser {
41 /// The browser's display name.
42 pub name: String,
43 /// Show the first-use notice: Computer Use hasn't used this browser on
44 /// this Mac before and will act signed in as the person.
45 #[serde(default, skip_serializing_if = "std::ops::Not::not")]
46 pub first_use: bool,
47 /// Show the window consent line: Computer Use will open its own window
48 /// in this browser and bring the browser to the front, once per session.
49 #[serde(default, skip_serializing_if = "std::ops::Not::not")]
50 pub window_consent: bool,
51}
52
53/// The page's full host, no path or query.
54#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
55#[serde(rename_all = "camelCase")]
56#[non_exhaustive]
57pub struct ApprovalCuaPage {
58 /// The host in Unicode.
59 pub host: String,
60 /// The host's `xn--` form; equal to `host` when they don't differ.
61 pub host_ascii: String,
62}
63
64/// One consequential step. A client renders "Step N: <action> <roleWord>
65/// "<label>" — <effect>"; a key step names its `chord`, and only a step with
66/// a `point` (and no label or chord) reads "at x,y".
67#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
68#[serde(rename_all = "camelCase")]
69#[non_exhaustive]
70pub struct ApprovalCuaStep {
71 /// 1-based, as the batch numbers its steps.
72 pub step: u32,
73 /// An open tag for styling and tests only (`verb:<class>`, `unresolved`,
74 /// `unlabeled`); a client that doesn't know a value renders the step from
75 /// `effect` and its label as usual.
76 pub kind: String,
77 /// The host's verb phrase, such as `click` or `type into`.
78 pub action: String,
79 /// The host's trusted sentence for what the step may do.
80 pub effect: String,
81 /// `button`, `link`, `menu item` or `key`; absent for a point step.
82 #[serde(default, skip_serializing_if = "Option::is_none")]
83 pub role_word: Option<String>,
84 /// The control's label: the app's own text, shown quoted and as plain
85 /// text; a client may cap it.
86 #[serde(default, skip_serializing_if = "Option::is_none")]
87 pub label: Option<String>,
88 /// The chord, for a key step.
89 #[serde(default, skip_serializing_if = "Option::is_none")]
90 pub chord: Option<String>,
91 /// The step's own 0–1000 model coordinates, only for a point step.
92 #[serde(default, skip_serializing_if = "Option::is_none")]
93 pub point: Option<ApprovalCuaPoint>,
94}
95
96/// A point in the model's 0–1000 coordinates.
97#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
98#[non_exhaustive]
99pub struct ApprovalCuaPoint {
100 pub x: u16,
101 pub y: u16,
102}
103
104/// One piece of data the call would send. An open union on `kind`
105/// (`secret`, or `other` for a row the host can't word); a client shows
106/// `other` and any kind it doesn't know as a generic data row.
107#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
108#[serde(rename_all = "camelCase")]
109#[non_exhaustive]
110pub struct ApprovalCuaDataFact {
111 /// Open discriminator: `secret` or `other`.
112 pub kind: String,
113 /// For `secret`, the scanner's open tag (`github_token`,
114 /// `secret_named_value` and so on); a client words the tags it knows and
115 /// shows any other as "a secret".
116 #[serde(default, skip_serializing_if = "Option::is_none")]
117 pub secret_kind: Option<String>,
118 /// For `secret`, the parts of it the card may show, never the value.
119 #[serde(default, skip_serializing_if = "Option::is_none")]
120 pub mask: Option<ApprovalCuaMask>,
121}
122
123/// A secret's mask: a vendor token's prefix and last 4 characters
124/// (`ghp_…3f9a`), a named value's name and length (`password=… (12 chars)`),
125/// or the length alone; all absent names the kind only.
126#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)]
127#[serde(rename_all = "camelCase")]
128#[non_exhaustive]
129pub struct ApprovalCuaMask {
130 /// A vendor token's fixed prefix (`ghp_`), or a named value's name and
131 /// its `=` (`password=`).
132 #[serde(default, skip_serializing_if = "Option::is_none")]
133 pub prefix: Option<String>,
134 /// A vendor token's last 4 characters.
135 #[serde(default, skip_serializing_if = "Option::is_none")]
136 pub last4: Option<String>,
137 /// The secret's length in characters.
138 #[serde(default, skip_serializing_if = "Option::is_none")]
139 pub chars: Option<u32>,
140}