muse_code_sdk/msp/method/limits.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/// The `session/start` `limits` choice: every member is optional — a start
7/// names only the axes it chooses. Reports use `SessionLimits`, whose members
8/// are always present.
9#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)]
10#[serde(rename_all = "camelCase")]
11pub struct SessionLimitsChoice {
12 /// Shell filesystem/network sandboxing (`--disable-sandbox` absent).
13 #[serde(skip_serializing_if = "Option::is_none")]
14 pub sandbox_enabled: Option<bool>,
15 /// Sandbox network policy (`--sandbox-network` grammar).
16 #[serde(skip_serializing_if = "Option::is_none")]
17 pub sandbox_network: Option<LimitsNetworkMode>,
18 /// Non-shell workspace filesystem writes (`--disable-write` absent).
19 #[serde(skip_serializing_if = "Option::is_none")]
20 pub writes_enabled: Option<bool>,
21 /// Workspace shell execution (`--disable-shell` absent).
22 #[serde(skip_serializing_if = "Option::is_none")]
23 pub shell_enabled: Option<bool>,
24 /// Loading the workspace's skills and rules (`--trust-workspace`).
25 #[serde(skip_serializing_if = "Option::is_none")]
26 pub workspace_trusted: Option<bool>,
27}
28
29/// A five-axis limits report: every `maxLimits` / `currentLimits` member is
30/// this one definition, and every member is required — reporting always fills
31/// all five, so readers never see an absence.
32#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
33#[serde(rename_all = "camelCase")]
34#[non_exhaustive]
35pub struct SessionLimits {
36 /// Shell filesystem/network sandboxing (`--disable-sandbox` absent).
37 pub sandbox_enabled: bool,
38 /// Sandbox network policy (`--sandbox-network` grammar).
39 pub sandbox_network: LimitsNetworkMode,
40 /// Non-shell workspace filesystem writes (`--disable-write` absent).
41 pub writes_enabled: bool,
42 /// Workspace shell execution (`--disable-shell` absent).
43 pub shell_enabled: bool,
44 /// Loading the workspace's skills and rules (`--trust-workspace`).
45 pub workspace_trusted: bool,
46}
47
48impl SessionLimits {
49 /// The wire name of the sandbox-enabled axis (single source: this
50 /// struct's camelCase).
51 pub const SANDBOX_ENABLED_AXIS: &str = "sandboxEnabled";
52 /// The wire name of the sandbox-network axis (single source: this
53 /// struct's camelCase).
54 pub const SANDBOX_NETWORK_AXIS: &str = "sandboxNetwork";
55 /// The wire name of the writes axis (single source: this struct's
56 /// camelCase).
57 pub const WRITES_ENABLED_AXIS: &str = "writesEnabled";
58 /// The wire name of the shell axis (single source: this struct's
59 /// camelCase).
60 pub const SHELL_ENABLED_AXIS: &str = "shellEnabled";
61 /// The wire name of the trust axis, shared by the `-32028` axes and
62 /// the resume `tightenedAxes` (single source: this struct's camelCase).
63 pub const WORKSPACE_TRUSTED_AXIS: &str = "workspaceTrusted";
64}
65
66/// The sandbox-network axis values. **Closed**: a client selects one of the
67/// three serve spellings and can never construct another; the socket promise is
68/// same-version, so the result use needs no unknown arm.
69#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
70pub enum LimitsNetworkMode {
71 /// `restricted`: no network for sandboxed shells.
72 #[serde(rename = "restricted")]
73 Restricted,
74 /// `enabled`: full network for sandboxed shells — also what a sandbox-OFF
75 /// ceiling reports, so the plain per-axis compare needs no special case.
76 #[serde(rename = "enabled")]
77 Enabled,
78 /// `proxy-only`: the built-in default.
79 #[serde(rename = "proxy-only")]
80 ProxyOnly,
81}
82
83/// One too-wide axis in a `-32028 limitsAboveMax` refusal: every too-wide axis
84/// is listed, never the first only. `requested`/`max` carry the axis's own JSON
85/// values.
86#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
87#[serde(rename_all = "camelCase")]
88#[non_exhaustive]
89pub struct LimitsAboveMaxAxis {
90 /// The axis name (`workspaceTrusted`,...).
91 pub axis: String,
92 /// The requested value.
93 pub requested: LimitsAxisValue,
94 /// The ceiling value.
95 pub max: LimitsAxisValue,
96}
97
98/// One axis value in a limits refusal: a boolean on the four boolean axes, the
99/// mode string on `sandboxNetwork`. **Closed**: exactly the two shapes, never
100/// another — named in the governing rules closed untagged-union list
101/// (`CLOSED_WITHOUT_MARKER`), since the untagged shape carries no schema
102/// marker. Untagged so the wire carries the bare JSON value; untagged also
103/// keeps the shape the schema builder requires (a bare `serde_json::Value`
104/// renders no type and is rejected).
105#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
106#[serde(untagged)]
107pub enum LimitsAxisValue {
108 /// A boolean-axis value.
109 Bool(bool),
110 /// A `sandboxNetwork`-axis value.
111 Mode(LimitsNetworkMode),
112}