Skip to main content

muse_code_sdk/msp/method/
plugin.rs

1// @generated from the MSP stable schema and protocol sources; do not edit by hand.
2
3use crate::msp::method::turn::CommandStatus;
4use serde::Deserialize;
5use serde::Serialize;
6
7mod catch_all;
8
9/// `plugin/list` params. Per-session params; rows are the installed plugin
10/// records.
11#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
12#[serde(rename_all = "camelCase")]
13pub struct PluginListParams {
14    /// The target session.
15    pub session_id: String,
16}
17
18/// `plugin/list` result: one row per installed plugin record; the spec promises
19/// the set, not an order.
20#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
21#[serde(rename_all = "camelCase")]
22#[non_exhaustive]
23pub struct PluginListResult {
24    /// The installed plugin rows.
25    pub plugins: Vec<PluginCatalogEntry>,
26}
27
28/// One installed plugin record.
29#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
30#[serde(rename_all = "camelCase")]
31#[non_exhaustive]
32pub struct PluginCatalogEntry {
33    /// The installed plugin's identifier.
34    pub id: String,
35    /// The installed version.
36    pub version: String,
37    /// The record's own install switch; non-enabled rows are included
38    /// as `false`, never dropped.
39    pub enabled: bool,
40    /// The installed record's source provenance.
41    pub source: PluginSource,
42    /// Where the plugin came from. Absent when the host cannot name it, for
43    /// example a marketplace install whose marketplace was removed later.
44    /// **Experimental** (`plugin/list.origin`).
45    #[serde(default, skip_serializing_if = "Option::is_none")]
46    pub origin: Option<PluginOrigin>,
47}
48
49/// Where a `plugin/list` row came from, in the `plugin/install` target
50/// vocabulary: the host sets exactly one member (the `PluginInstallTarget`
51/// shape; the one-member rule is the host's, not the schema's).
52#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)]
53#[serde(rename_all = "camelCase")]
54#[non_exhaustive]
55pub struct PluginOrigin {
56    /// The configured marketplace that a marketplace install came from.
57    #[serde(default, skip_serializing_if = "Option::is_none")]
58    pub marketplace: Option<String>,
59    /// The host folder that a folder install was copied from.
60    #[serde(default, skip_serializing_if = "Option::is_none")]
61    pub local_path: Option<String>,
62}
63
64/// A plugin row's source provenance: camelCase of `PluginSourceProvenance`.
65/// Open: a future provenance is additive.
66#[derive(Debug, Clone, PartialEq, Eq)]
67#[non_exhaustive]
68pub enum PluginSource {
69    /// A curated (built-in official) marketplace install.
70    Curated,
71    /// A user-added marketplace install.
72    MarketplaceUserAdded,
73    /// An imported foreign-manifest plugin.
74    ForeignImport,
75    /// A native local (ad-hoc manifest) plugin.
76    NativeLocal,
77    /// A value from a newer host, kept verbatim so an older client decodes the
78    /// rest of the message. Never construct it with a known word.
79    Unknown(String),
80}
81
82/// `plugin/install` params. Per-session params plus a client-generated
83/// `commandId` (UUIDv7) with the uniform idempotency contract.
84#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
85#[serde(rename_all = "camelCase")]
86pub struct PluginInstallParams {
87    /// The target session; its workspace resolves project scope.
88    pub session_id: String,
89    /// The client-generated idempotency key (UUIDv7).
90    pub command_id: String,
91    /// Exactly one install target arm.
92    pub target: PluginInstallTarget,
93}
94
95/// The one structured install target: a flat object with two optional arms,
96/// exactly one present — the `TurnInputPart` convention, since the v1 schema
97/// model names no object-variant union. Both arms or neither is `-32602
98/// invalidParams`.
99#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
100#[serde(rename_all = "camelCase")]
101pub struct PluginInstallTarget {
102    /// The marketplace arm: install a named plugin from a store.
103    #[serde(skip_serializing_if = "Option::is_none")]
104    pub marketplace: Option<PluginInstallMarketplaceTarget>,
105    /// The local-path arm: install from a host folder.
106    #[serde(skip_serializing_if = "Option::is_none")]
107    pub local_path: Option<PluginInstallLocalPathTarget>,
108}
109
110/// The `plugin/install` marketplace arm.
111#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
112#[serde(rename_all = "camelCase")]
113pub struct PluginInstallMarketplaceTarget {
114    /// The configured marketplace name.
115    pub marketplace: String,
116    /// The plugin name within the store.
117    pub name: String,
118}
119
120/// The `plugin/install` local-path arm.
121#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
122#[serde(rename_all = "camelCase")]
123pub struct PluginInstallLocalPathTarget {
124    /// The host folder to install from; absolute recommended, relative
125    /// resolves against the host working directory.
126    pub path: String,
127    /// The install lane; omitted means `default`.
128    #[serde(skip_serializing_if = "Option::is_none")]
129    pub scope: Option<PluginInstallScope>,
130}
131
132/// The `plugin/install` local-path scope. Closed: an unknown scope is `-32602
133/// invalidParams`.
134#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
135#[serde(rename_all = "camelCase")]
136pub enum PluginInstallScope {
137    /// The default lane (omitted `scope`).
138    Default,
139    /// The explicit-user lane.
140    User,
141    /// The explicit-project lane, resolved against the session's
142    /// workspace (degrades to the default lane with no workspace root).
143    Project,
144}
145
146/// `plugin/install` result: the ack envelope plus the installed receipt.
147#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
148#[serde(rename_all = "camelCase")]
149#[non_exhaustive]
150pub struct PluginInstallResult {
151    /// The echoed idempotency key.
152    pub command_id: String,
153    /// The ack status.
154    pub status: CommandStatus,
155    /// The installed record's identifier.
156    pub id: String,
157    /// The installed record's version.
158    pub version: String,
159    /// The installed record's own switch.
160    pub enabled: bool,
161    /// The installed-list provenance vocabulary.
162    pub source: PluginSource,
163    /// The installer's advisory text when the install succeeded with a
164    /// caveat; absent otherwise.
165    #[serde(skip_serializing_if = "Option::is_none")]
166    pub warning: Option<String>,
167}
168
169/// `plugin/marketplaceAdd` params. Per-session params plus a client-generated
170/// `commandId` (UUIDv7).
171#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
172#[serde(rename_all = "camelCase")]
173pub struct PluginMarketplaceAddParams {
174    /// The target session.
175    pub session_id: String,
176    /// The client-generated idempotency key (UUIDv7).
177    pub command_id: String,
178    /// The marketplace name to configure.
179    pub name: String,
180    /// The app's source vocabulary: `owner/repo`, a git URL, a `file://`
181    /// URL, or a local path.
182    pub source: String,
183}
184
185/// The stored marketplace record both add and update answer: the ack envelope
186/// plus the record.
187#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
188#[serde(rename_all = "camelCase")]
189#[non_exhaustive]
190pub struct PluginMarketplaceRecordResult {
191    /// The echoed idempotency key.
192    pub command_id: String,
193    /// The ack status.
194    pub status: CommandStatus,
195    /// The configured marketplace name.
196    pub name: String,
197    /// The normalized stored source.
198    pub source: PluginMarketplaceSourceShape,
199    /// The plugins the store now offers.
200    pub plugin_count: u64,
201    /// Entries the store could not offer, with the reason each was
202    /// skipped; empty when nothing was skipped.
203    pub skipped: Vec<PluginMarketplaceSkippedEntry>,
204}
205
206/// The normalized stored marketplace source.
207#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
208#[serde(rename_all = "camelCase")]
209#[non_exhaustive]
210pub struct PluginMarketplaceSourceShape {
211    /// The stored source kind.
212    pub kind: String,
213    /// The stored source path.
214    pub path: String,
215}
216
217/// One skipped marketplace entry.
218#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
219#[serde(rename_all = "camelCase")]
220#[non_exhaustive]
221pub struct PluginMarketplaceSkippedEntry {
222    /// The skipped plugin.
223    pub plugin: String,
224    /// Why it was skipped.
225    pub reason: String,
226}
227
228/// `plugin/marketplaceUpdate` params. Per-session params plus a
229/// client-generated `commandId` (UUIDv7).
230#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
231#[serde(rename_all = "camelCase")]
232pub struct PluginMarketplaceUpdateParams {
233    /// The target session.
234    pub session_id: String,
235    /// The client-generated idempotency key (UUIDv7).
236    pub command_id: String,
237    /// The marketplace name to refresh.
238    pub name: String,
239}
240
241/// `plugin/marketplaceRemove` params. Per-session params plus a
242/// client-generated `commandId` (UUIDv7).
243#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
244#[serde(rename_all = "camelCase")]
245pub struct PluginMarketplaceRemoveParams {
246    /// The target session.
247    pub session_id: String,
248    /// The client-generated idempotency key (UUIDv7).
249    pub command_id: String,
250    /// The marketplace name to remove.
251    pub name: String,
252}
253
254/// `plugin/marketplaceRemove` result: the ack envelope plus the removed name.
255#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
256#[serde(rename_all = "camelCase")]
257#[non_exhaustive]
258pub struct PluginMarketplaceRemoveResult {
259    /// The echoed idempotency key.
260    pub command_id: String,
261    /// The ack status.
262    pub status: CommandStatus,
263    /// The removed marketplace name.
264    pub name: String,
265}
266
267/// What happened to a marketplace. Closed: an unknown change is a contract
268/// violation, never tolerated.
269#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
270#[serde(rename_all = "camelCase")]
271pub enum PluginMarketplaceChange {
272    /// The marketplace was added.
273    Added,
274    /// The marketplace was updated.
275    Updated,
276    /// The marketplace was removed.
277    Removed,
278}
279
280/// `plugin/changed` params: an install landed; clients re-issue `plugin/list`
281/// (plus `hook/list` and `skill/list`).
282#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
283#[serde(rename_all = "camelCase")]
284#[non_exhaustive]
285pub struct PluginChangedParams {
286    /// The acting session.
287    pub session_id: String,
288    /// The installed record's identifier.
289    pub id: String,
290    /// The installed record's version.
291    pub version: String,
292    /// The installed record's own switch.
293    pub enabled: bool,
294    /// The installed-list provenance vocabulary.
295    pub source: PluginSource,
296}
297
298/// `plugin/marketplaceChanged` params: a marketplace was added, updated, or
299/// removed.
300#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
301#[serde(rename_all = "camelCase")]
302#[non_exhaustive]
303pub struct PluginMarketplaceChangedParams {
304    /// The acting session.
305    pub session_id: String,
306    /// What happened.
307    pub change: PluginMarketplaceChange,
308    /// The marketplace name.
309    pub name: String,
310    /// The stored record's plugin count; omitted on `removed`, never
311    /// fabricated.
312    #[serde(skip_serializing_if = "Option::is_none")]
313    pub plugin_count: Option<u64>,
314    /// The stored record's skipped count; omitted on `removed`, never
315    /// fabricated.
316    #[serde(skip_serializing_if = "Option::is_none")]
317    pub skipped_count: Option<u64>,
318}