Skip to main content

muse_code_sdk/msp/method/
computer_use_setup.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/// Where the session's setup stands: `cua_setup`'s state codes, camelCase.
9/// **Open**: a result vocabulary, so an older client tolerates a new state.
10#[derive(Debug, Clone, PartialEq, Eq)]
11#[non_exhaustive]
12pub enum ComputerUseSetupPhase {
13    /// No attempt has run.
14    Dormant,
15    /// An attempt is running.
16    InProgress,
17    /// Grants changed; only a relaunched host can recheck them.
18    RestartRequired,
19    /// The worker is up with its grants; each app still needs approval.
20    ReadyForTarget,
21    /// The chat stopped setup.
22    Stopped,
23    /// A value from a newer host, kept verbatim so an older client decodes the
24    /// rest of the message. Never construct it with a known word.
25    Unknown(String),
26}
27
28/// One macOS permission as setup last saw it. **Open**, like the phase.
29#[derive(Debug, Clone, PartialEq, Eq)]
30#[non_exhaustive]
31pub enum ComputerUsePermission {
32    /// Setup is ready and didn't name it missing.
33    Granted,
34    /// Setup named it missing.
35    Missing,
36    /// Setup can't say.
37    Unknown,
38    /// A value from a newer host, kept verbatim so an older client decodes the
39    /// rest of the message. Never construct it with a known word.
40    Unrecognized(String),
41}
42
43/// The session's setup state: the result of both methods and the
44/// `computerUseSetup/changed` payload's `state`.
45#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
46#[serde(rename_all = "camelCase")]
47#[non_exhaustive]
48pub struct ComputerUseSetupState {
49    /// Where setup stands.
50    pub setup: ComputerUseSetupPhase,
51    /// Accessibility.
52    pub accessibility: ComputerUsePermission,
53    /// Screen Recording.
54    pub screen_recording: ComputerUsePermission,
55    /// Input Monitoring: computer use is ready without it; some actions need it.
56    pub input_monitoring: ComputerUsePermission,
57    /// The `cua_setup` refusal code when the call was refused, verbatim.
58    #[serde(default, skip_serializing_if = "Option::is_none")]
59    pub refused: Option<String>,
60    /// The sentence `cua_setup` gives the user for this answer.
61    #[serde(default, skip_serializing_if = "Option::is_none")]
62    pub message: Option<String>,
63}
64
65/// `computerUseSetup/read` params.
66#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)]
67#[serde(rename_all = "camelCase")]
68pub struct ComputerUseSetupReadParams {
69    /// The session whose setup to read. Omitted reads the host's own setup,
70    /// which needs the `computerUseHostSetup` grant.
71    #[serde(default, skip_serializing_if = "Option::is_none")]
72    pub session_id: Option<String>,
73}
74
75/// `computerUseSetup/start` params: a human command.
76#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
77#[serde(rename_all = "camelCase")]
78pub struct ComputerUseSetupStartParams {
79    /// The session whose setup to start. Omitted starts the host's own
80    /// setup, which needs the `computerUseHostSetup` grant.
81    #[serde(default, skip_serializing_if = "Option::is_none")]
82    pub session_id: Option<String>,
83    /// The client's id for this command.
84    pub command_id: String,
85}
86
87/// `computerUseSetup/changed` params.
88#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
89#[serde(rename_all = "camelCase")]
90#[non_exhaustive]
91pub struct ComputerUseSetupChanged {
92    /// The session whose setup state changed; absent for the host's own
93    /// setup, which only `computerUseHostSetup` holders receive.
94    #[serde(default, skip_serializing_if = "Option::is_none")]
95    pub session_id: Option<String>,
96    /// Its new state.
97    pub state: ComputerUseSetupState,
98}