Skip to main content

muse_code_sdk/msp/method/
computer_use.rs

1// @generated from the MSP stable schema and protocol sources; do not edit by hand.
2
3pub use apps::ComputerUseApp;
4pub use apps::ComputerUseAppPatch;
5pub use apps::ComputerUseInstalledApp;
6use serde::Deserialize;
7use serde::Serialize;
8
9pub(crate) mod apps;
10mod catch_all;
11
12/// A capability dropdown's value. **Open**: the read result carries it, so an
13/// older client tolerates a value it does not know.
14#[derive(Debug, Clone, PartialEq, Eq)]
15#[non_exhaustive]
16pub enum ComputerUseChoice {
17    /// Each use shows the approval card.
18    Ask,
19    /// The whole Mac is allowed for this capability.
20    AlwaysAllow,
21    /// A value from a newer host, kept verbatim so an older client decodes the
22    /// rest of the message. Never construct it with a known word.
23    Unknown(String),
24}
25
26/// One row of the Settings blocked-apps list.
27#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
28#[serde(rename_all = "camelCase")]
29#[non_exhaustive]
30pub struct ComputerUseBlockedApp {
31    /// The app's bundle ID, or the family prefix when `prefix` is true.
32    pub bundle_id: String,
33    /// A built-in block, which Settings cannot remove.
34    pub locked: bool,
35    /// A built-in family row: it blocks every bundle ID that starts with
36    /// `bundleId`. Omitted means false; only locked rows are prefixes.
37    #[serde(default, skip_serializing_if = "std::ops::Not::not")]
38    pub prefix: bool,
39}
40
41/// `computerUseSettings/read` params.
42#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)]
43#[serde(rename_all = "camelCase")]
44pub struct ComputerUseSettingsReadParams {
45    /// Also list the built-in blocks as locked rows (the D18.8 toggle).
46    /// Omitted means false.
47    #[serde(default, skip_serializing_if = "Option::is_none")]
48    pub show_built_ins: Option<bool>,
49    /// Also answer `installedApps`, for an app picker. Omitted means false.
50    #[serde(default, skip_serializing_if = "Option::is_none")]
51    pub installed: Option<bool>,
52}
53
54/// `computerUseSettings/read` result, also answered by
55/// `computerUseSettings/update`.
56#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
57#[serde(rename_all = "camelCase")]
58#[non_exhaustive]
59pub struct ComputerUseSettings {
60    /// The computer-control dropdown, as it applies: `ask` while the stored
61    /// blocked-apps list can't be read.
62    pub computer_control: ComputerUseChoice,
63    /// The screenshots dropdown, under the same rule.
64    pub screenshots: ComputerUseChoice,
65    /// The user's blocks in the order they were added, then the built-in
66    /// blocks when `showBuiltIns` asked for them.
67    pub blocked_apps: Vec<ComputerUseBlockedApp>,
68    /// The apps list: apps Computer Use has asked about, most recent first;
69    /// then the other saved grants, then the user's other blocks; then the
70    /// locked rows. Each app once. A host that serves the list always
71    /// answers it, so its absence means an older host.
72    #[serde(default, skip_serializing_if = "Option::is_none")]
73    pub apps: Option<Vec<ComputerUseApp>>,
74    /// The installed and running apps, sorted by name, when the read asked
75    /// for `installed`.
76    #[serde(default, skip_serializing_if = "Option::is_none")]
77    pub installed_apps: Option<Vec<ComputerUseInstalledApp>>,
78}
79
80/// `computerUseSettings/update` params: a patch. Omitted members are left
81/// alone; the whole patch applies or none of it does.
82#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)]
83#[serde(rename_all = "camelCase")]
84pub struct ComputerUseSettingsUpdateParams {
85    /// The new computer-control dropdown value.
86    #[serde(default, skip_serializing_if = "Option::is_none")]
87    pub computer_control: Option<ComputerUseChoice>,
88    /// The new screenshots dropdown value.
89    #[serde(default, skip_serializing_if = "Option::is_none")]
90    pub screenshots: Option<ComputerUseChoice>,
91    /// Bundle IDs to add to the user's blocked apps. A built-in block is
92    /// refused: it is already blocked.
93    #[serde(default, skip_serializing_if = "Vec::is_empty")]
94    pub block_apps: Vec<String>,
95    /// Bundle IDs to remove from the user's blocked apps. Only the user's own
96    /// entries can be removed; a built-in block stays.
97    #[serde(default, skip_serializing_if = "Vec::is_empty")]
98    pub unblock_apps: Vec<String>,
99    /// Per-app choices to set. A locked app is refused; so is a bundle ID
100    /// named twice, or also in `blockApps` or `unblockApps`.
101    #[serde(default, skip_serializing_if = "Vec::is_empty")]
102    pub apps: Vec<ComputerUseAppPatch>,
103}