Skip to main content

muse_code_sdk/msp/method/computer_use/
apps.rs

1// @generated from the MSP stable schema and protocol sources; do not edit by hand.
2
3use serde::Deserialize;
4use serde::Serialize;
5
6mod catch_all;
7
8/// A per-app choice. **Open**, like `ComputerUseChoice`.
9#[derive(Debug, Clone, PartialEq, Eq)]
10#[non_exhaustive]
11pub enum ComputerUseAppChoice {
12    /// Each use of the app shows the approval card.
13    Ask,
14    /// The app is used without asking.
15    AlwaysAllow,
16    /// The app is never used.
17    Blocked,
18    /// A value from a newer host, kept verbatim so an older client decodes the
19    /// rest of the message. Never construct it with a known word.
20    Unknown(String),
21}
22
23/// Why Settings can't change a row. **Open**.
24#[derive(Debug, Clone, PartialEq, Eq)]
25#[non_exhaustive]
26pub enum ComputerUseAppLock {
27    /// A built-in block.
28    BuiltIn,
29    /// A block in the hand-edited blocked-apps file beside the policy store.
30    File,
31    /// A value from a newer host, kept verbatim so an older client decodes the
32    /// rest of the message. Never construct it with a known word.
33    Unknown(String),
34}
35
36/// One row of the Settings apps list.
37#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
38#[serde(rename_all = "camelCase")]
39#[non_exhaustive]
40pub struct ComputerUseApp {
41    /// The app's bundle ID: the stored key.
42    pub bundle_id: String,
43    /// The name the approval card shows for it, else the name stored with
44    /// its grant or its last card; absent when there is none.
45    #[serde(default, skip_serializing_if = "Option::is_none")]
46    pub name: Option<String>,
47    /// The choice as it applies: a block wins over a grant.
48    pub choice: ComputerUseAppChoice,
49    /// Settings can't change this row; its choice is `blocked`. Omitted
50    /// means false.
51    #[serde(default, skip_serializing_if = "std::ops::Not::not")]
52    pub locked: bool,
53    /// Why the row is locked, when it is.
54    #[serde(default, skip_serializing_if = "Option::is_none")]
55    pub locked_by: Option<ComputerUseAppLock>,
56    /// When Computer Use last showed an approval card for the app, RFC3339
57    /// UTC; absent when it never has.
58    #[serde(default, skip_serializing_if = "Option::is_none")]
59    pub last_asked_at: Option<String>,
60}
61
62/// One installed or running app, for Settings' app picker.
63#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
64#[serde(rename_all = "camelCase")]
65#[non_exhaustive]
66pub struct ComputerUseInstalledApp {
67    /// The app's bundle ID.
68    pub bundle_id: String,
69    /// The name the approval card shows for it.
70    pub name: String,
71}
72
73/// One per-app choice to set in `computerUseSettings/update`.
74#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
75#[serde(rename_all = "camelCase")]
76pub struct ComputerUseAppPatch {
77    /// The app's bundle ID.
78    pub bundle_id: String,
79    /// `ask` removes the app's grant and the user's block; `alwaysAllow`
80    /// saves a grant and removes the user's block; `blocked` adds the
81    /// user's block and removes the grant.
82    pub choice: ComputerUseAppChoice,
83}