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