Skip to main content

muse_code_sdk/msp/method/
session_satellites.rs

1// @generated from the MSP stable schema and protocol sources; do not edit by hand.
2
3use super::session::Session;
4use crate::msp::view::state::ApprovalMode;
5use crate::msp::view::state::ApprovalModeSource;
6use crate::msp::view::state::PermissionAxes;
7use crate::msp::view::state::ReviewerAuthority;
8use serde::Deserialize;
9use serde::Serialize;
10
11mod catch_all;
12
13/// `session/listChanged` params: one changed row of the `session/list` shape —
14/// the full Session object as the answering host's list face serves it at
15/// emission, a replace, never a delta. Emitted only on connections that
16/// negotiated the `sessionListStream` capability at `initialize`; row birth
17/// stays on `session/started`, unload pairs with `session/closed`.
18#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
19#[serde(rename_all = "camelCase")]
20#[non_exhaustive]
21pub struct SessionListChangedParams {
22    /// The served list row for the changed session.
23    pub session: Session,
24}
25
26/// One attention flag: a pending server-initiated request class parked on the
27/// session. Open on the wire — clients MUST ignore unknown values; future
28/// attention kinds are additive.
29#[derive(Debug, Clone, PartialEq, Eq)]
30#[allow(clippy::enum_variant_names)]
31#[non_exhaustive]
32pub enum AttentionFlag {
33    /// At least one approval request is open and unresolved.
34    ApprovalPending,
35    /// At least one user-input request is open.
36    InputPending,
37    /// At least one peer-admission request is open. Experimental: stripped
38    /// per-connection for unopted callers.
39    AdmissionPending,
40    /// A value from a newer host, kept verbatim so an older client decodes the
41    /// rest of the message. Never construct it with a known word.
42    Unknown(String),
43}
44
45/// One `needsInputReasons` reason: why a loaded session's input is needed. Open
46/// on the wire — clients MUST ignore unknown values; future reasons are
47/// additive. The reasons are a pure projection of the pending-request fold's
48/// answer in PR 1 (the same read that derives `attention`); `admissionPending`
49/// is deliberately not a reason.
50#[derive(Debug, Clone, PartialEq, Eq)]
51#[non_exhaustive]
52pub enum NeedsInputReason {
53    /// At least one approval request is open and unresolved.
54    ApprovalPending,
55    /// At least one user-input request is open.
56    InputPending,
57    /// A value from a newer host, kept verbatim so an older client decodes the
58    /// rest of the message. Excluded from the generated schema while the enum
59    /// stays declared open; never construct it with a known word.
60    Unknown(String),
61}
62
63/// The effective approval-mode projection: the same object
64/// `session/setApprovalMode` returns as `effectiveMode` and the `Session`
65/// object carries as `approvalMode`.
66#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
67#[serde(rename_all = "camelCase")]
68#[non_exhaustive]
69pub struct EffectiveApprovalModeState {
70    /// The mode in effect.
71    pub mode: ApprovalMode,
72    /// How the mode took effect.
73    pub source: ApprovalModeSource,
74    /// The command that last set it; `null` when no command did.
75    pub last_command_id: Option<String>,
76}
77
78/// The effective permission-state projection: the committed native permission
79/// snapshot (profile identity, reviewer authority) plus the live per-session
80/// runtime's attachment evidence. The same object
81/// `session/setPermissionProfile` returns and the `Session` object carries as
82/// `permissionState`. Served values must be coherent: a read never combines an
83/// old profile with a newer runtime's attachment claim.
84#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
85#[serde(rename_all = "camelCase")]
86#[non_exhaustive]
87pub struct EffectivePermissionState {
88    /// The committed profile id; `null` when the committed source is a launch
89    /// override (`LaunchOverrides` pins `id: None`); every catalog row and
90    /// configured/default commit carries a non-null id.
91    pub profile_id: Option<String>,
92    /// The committed profile's reviewer authority.
93    pub reviewer_authority: ReviewerAuthority,
94    /// Whether an executable reviewer is currently installed for this loaded
95    /// session (live runtime evidence).
96    pub reviewer_attached: bool,
97    /// The committed profile's effective four axis values: the resolved
98    /// filesystem, network, approval, and reviewer the YOLO predicate reads.
99    /// Omitted when unknown — an older host, the no-profile state, or the
100    /// commit-receipt fallback arm that reports without a re-inspect — and a
101    /// client MUST fall back to the served id there, never infer equivalence it
102    /// cannot see.
103    #[serde(skip_serializing_if = "Option::is_none")]
104    pub axes: Option<PermissionAxes>,
105    /// The session's client-supplied shell prefix allow-rules with origin.
106    /// Absent means the host folded none — never fabricated. **Experimental**.
107    #[serde(skip_serializing_if = "Option::is_none")]
108    pub client_approval_rules: Option<Vec<super::approval::ClientApprovalRuleState>>,
109}
110
111/// Who opened a session.
112#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
113#[serde(rename_all = "camelCase")]
114pub struct SessionSpawnedBy {
115    /// The exact session that opened this one, except that any `muse` started
116    /// in a later pane of the worker's tmux session or Herdr workspace names
117    /// the worker's manager and carries the worker's `project`/`thread` labels.
118    pub parent_session_id: String,
119    /// An opaque project label the spawner named, when it named one.
120    #[serde(default, skip_serializing_if = "Option::is_none")]
121    pub project: Option<String>,
122    /// An opaque thread label the spawner named, when it named one.
123    #[serde(default, skip_serializing_if = "Option::is_none")]
124    pub thread: Option<String>,
125}
126
127/// Fork provenance folded from the durable `session.fork.created` record.
128#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
129#[serde(rename_all = "camelCase")]
130#[non_exhaustive]
131pub struct ForkProvenance {
132    /// The source session this fork was cut from.
133    pub session_id: String,
134    /// An **opaque provenance string** preserved verbatim from the durable
135    /// record. Display-only — not one of the cursor families: clients MUST NOT
136    /// parse it and no method accepts it.
137    pub cut_cursor: String,
138    /// Whether the fork named an explicit cut point.
139    pub cut_explicit: bool,
140    /// The `commandId` of the `session/fork` that created it.
141    pub command_id: String,
142    /// `true` when validated full provenance records a conversation rewind,
143    /// `false` for a proved ordinary fork. **Additive-optional**: omitted when
144    /// the serving face holds no full provenance, which means unknown, never a
145    /// guessed ordinary fork; never `null`.
146    #[serde(default, skip_serializing_if = "Option::is_none")]
147    pub is_rewind: Option<bool>,
148}
149
150/// Side provenance folded from the durable side provenance.
151#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
152#[serde(rename_all = "camelCase")]
153#[non_exhaustive]
154pub struct SideProvenance {
155    /// The source main session this side was opened from.
156    pub session_id: String,
157    /// An **opaque provenance string** preserved verbatim from the durable side
158    /// provenance (`source_cut_cursor`). Display-only — not one of the cursor
159    /// families: clients MUST NOT parse it and no method accepts it.
160    pub cut_cursor: String,
161    /// The `commandId` of the `session/sideChat` that created it.
162    pub command_id: String,
163}