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