muse_code_sdk/msp/method/skill.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/// `skill/list` params. Per-session because skill scope follows the session's
10/// workspace and plugin state.
11#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
12#[serde(rename_all = "camelCase")]
13pub struct SkillListParams {
14 /// The target session.
15 pub session_id: String,
16}
17
18/// `skill/list` result: one row per typed-invocable shortcut spelling — exactly
19/// the invocations the first-party typed dispatch accepts.
20#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
21#[serde(rename_all = "camelCase")]
22#[non_exhaustive]
23pub struct SkillListResult {
24 /// The session's user-invocable skill rows.
25 pub skills: Vec<SkillCatalogEntry>,
26}
27
28/// One typed-invocable shortcut spelling. A plugin skill may contribute two
29/// rows: its bare-name winner and its qualified `<pluginId>:<skillId>` form.
30#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
31#[serde(rename_all = "camelCase")]
32#[non_exhaustive]
33pub struct SkillCatalogEntry {
34 /// The shortcut token without the leading slash — bare (`fix-bug`) or
35 /// plugin-qualified (`acme:deploy`) — the exact value a `skill` input
36 /// part submits. Unique within one response.
37 pub selector: String,
38 /// The skill display name the first-party palette shows.
39 pub display_name: String,
40 /// The skill's declared human-readable name, for clients to show where
41 /// people read the skill's name; absent when the skill declares none. The
42 /// palette keeps showing `displayName`.
43 #[serde(skip_serializing_if = "Option::is_none")]
44 pub title: Option<String>,
45 /// The skill's palette summary.
46 pub description: String,
47 /// Present when the skill declares an argument hint.
48 #[serde(skip_serializing_if = "Option::is_none")]
49 pub argument_hint: Option<String>,
50 /// Where the skill comes from.
51 pub source: SkillSource,
52 /// The owning plugin's identifier; present when `source` is `plugin`.
53 #[serde(skip_serializing_if = "Option::is_none")]
54 pub plugin_id: Option<String>,
55}
56
57/// A skill row's source scope: the projection of the skills crate's
58/// `SkillsSourceScope`. Open: a future scope value is additive.
59#[derive(Debug, Clone, PartialEq, Eq)]
60#[non_exhaustive]
61pub enum SkillSource {
62 /// Shipped with the binary.
63 Bundled,
64 /// The user's personal skill directories.
65 User,
66 /// The session workspace's project skills.
67 Project,
68 /// Contributed by an installed plugin (`pluginId` names it).
69 Plugin,
70 /// Offered by the session's Skill Provider client; the `selector` is
71 /// `msp:<name>`. Experimental: the per-variant stability strips it from the
72 /// stable JSON bundle; the Rust render keeps it, so a Rust client's match
73 /// reaches its catch-all arm.
74 SkillProvider,
75 /// A value from a newer host, kept verbatim so an older client decodes the
76 /// rest of the message. Never construct it with a known word.
77 Unknown(String),
78}
79
80/// A `skill` input part's picked-copy source: the catalog-row `source` enum
81/// values, sent by the TUI on every skill submit so the host resolves the exact
82/// `(selector, source)` row. **Closed**: a client-selected write vocabulary —
83/// an unknown value is `invalidParams`, never a fall-through to the bare row.
84/// Contrast the open read-side [`SkillSource`].
85#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
86#[serde(rename_all = "camelCase")]
87pub enum SkillInvocationSource {
88 /// Shipped with the binary.
89 Bundled,
90 /// The user's personal skill directories.
91 User,
92 /// The session workspace's project skills.
93 Project,
94 /// Contributed by an installed plugin.
95 Plugin,
96}
97
98/// `skill/changed` params: the session's user-invocable set changed; clients
99/// re-issue `skill/list`. Advisory — the host may coalesce bursts and
100/// guarantees no ordering relative to view events.
101#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
102#[serde(rename_all = "camelCase")]
103#[non_exhaustive]
104pub struct SkillChangedParams {
105 /// The session whose set changed.
106 pub session_id: String,
107}
108
109/// `skill/setActivation` activation target. **Closed**: a client-selected write
110/// vocabulary — a write must fail a scope the host does not implement rather
111/// than record activation against an unknown target. Contrast the open
112/// read-side [`SkillSource`].
113#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
114#[serde(rename_all = "camelCase")]
115pub enum SkillActivationScope {
116 /// The user's personal skill directories.
117 User,
118 /// The session workspace's project skills.
119 Project,
120 /// Shipped with the binary.
121 Bundled,
122 /// Contributed by an installed plugin.
123 Plugin,
124}
125
126/// The three-state skill activation. **Closed**: a client-selected write
127/// vocabulary.
128#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
129#[serde(rename_all = "camelCase")]
130pub enum SkillActivationState {
131 /// Fully active: user-invoked and model-invoked.
132 On,
133 /// User-invoked only; the model cannot invoke it.
134 UserInvocableOnly,
135 /// Inactive everywhere.
136 Off,
137}
138
139/// `skill/setActivation` params: turn one skill on or off in any scope through
140/// the single `SkillsService::set_activation` seam.
141#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
142#[serde(rename_all = "camelCase")]
143pub struct SkillSetActivationParams {
144 /// The target session.
145 pub session_id: String,
146 /// The idempotency handle (UUIDv7).
147 pub command_id: String,
148 /// Names one skill: a bare or plugin-qualified token from the session's
149 /// full catalog, the row vocabulary.
150 pub selector: String,
151 /// The activation target.
152 pub scope: SkillActivationScope,
153 /// The activation to apply.
154 pub activation: SkillActivationState,
155}
156
157/// `skill/setActivation` result: the ack envelope plus the applied state.
158#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
159#[serde(rename_all = "camelCase")]
160#[non_exhaustive]
161pub struct SkillSetActivationResult {
162 /// Echoes the client's id.
163 pub command_id: String,
164 /// Admission status.
165 pub status: CommandStatus,
166 /// Echoes the applied write's selector.
167 pub selector: String,
168 /// Echoes the applied write's scope.
169 pub scope: SkillActivationScope,
170 /// The applied activation.
171 pub activation: SkillActivationState,
172 /// The activation value in force for that `(selector, scope)`
173 /// immediately before the write: the same value a full-catalog
174 /// `skill/list` row would have carried in `activation` for it.
175 pub previous: SkillActivationState,
176}
177
178/// `skill/import` foreign ecosystem. **Closed**: a client-selected write
179/// vocabulary — a write must fail an ecosystem the host does not implement
180/// rather than import from an unknown dir. The host resolves its own foreign
181/// dir (the `foreign_skills_sources` derivation); no client paths cross the
182/// wire.
183#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
184#[serde(rename_all = "camelCase")]
185pub enum SkillImportSource {
186 /// `~/.claude/skills`.
187 Claude,
188 /// `$CODEX_HOME/skills` (else `~/.codex/skills`).
189 Codex,
190}
191
192/// `skill/import` params: import foreign skills through the single
193/// `SkillsService::import_skills` seam.
194#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
195#[serde(rename_all = "camelCase")]
196pub struct SkillImportParams {
197 /// The target session.
198 pub session_id: String,
199 /// The idempotency handle (UUIDv7) — required even for `dryRun` previews.
200 pub command_id: String,
201 /// The foreign ecosystem to import from.
202 pub source: SkillImportSource,
203 /// Preview for the consent UI; writes nothing. Additive-optional,
204 /// default false.
205 #[serde(default, skip_serializing_if = "std::ops::Not::not")]
206 pub dry_run: bool,
207 /// Re-import over already-imported ids (the CLI `--force` twin).
208 /// Additive-optional, default false.
209 #[serde(default, skip_serializing_if = "std::ops::Not::not")]
210 pub force: bool,
211}
212
213/// One quarantined import candidate: kept, not loaded.
214#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
215#[serde(rename_all = "camelCase")]
216#[non_exhaustive]
217pub struct SkillImportQuarantine {
218 /// The candidate's id.
219 pub id: String,
220 /// The quarantine reasons.
221 pub reasons: Vec<String>,
222}
223
224/// One import candidate that could neither install nor quarantine: recorded so
225/// the run continues past it. `id` is null when the candidate never yielded one
226/// — present-but-null, never omitted.
227#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
228#[serde(rename_all = "camelCase")]
229#[non_exhaustive]
230pub struct SkillImportFailure {
231 /// The candidate's id, or null when it never yielded one.
232 pub id: Option<String>,
233 /// Why the candidate failed.
234 pub reason: String,
235}
236
237/// The four receipt-list lengths: a client renders counts without walking
238/// lists.
239#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
240#[serde(rename_all = "camelCase")]
241#[non_exhaustive]
242pub struct SkillImportCounts {
243 /// `installed.len()`.
244 pub installed: u64,
245 /// `quarantined.len()`.
246 pub quarantined: u64,
247 /// `skipped.len()`.
248 pub skipped: u64,
249 /// `failed.len()`.
250 pub failed: u64,
251}
252
253/// `skill/import` result: the ack envelope plus the service receipt projection.
254#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
255#[serde(rename_all = "camelCase")]
256#[non_exhaustive]
257pub struct SkillImportResult {
258 /// Echoes the client's id.
259 pub command_id: String,
260 /// Admission status.
261 pub status: CommandStatus,
262 /// Echoes the call's ecosystem.
263 pub source: SkillImportSource,
264 /// Echoes the call's preview flag.
265 pub dry_run: bool,
266 /// The ids the run installed, in pipeline order.
267 pub installed: Vec<String>,
268 /// Kept, not loaded, with reasons.
269 pub quarantined: Vec<SkillImportQuarantine>,
270 /// Ids the run did not install: already-imported ids and in-run
271 /// duplicates, verbatim from the seam's `skipped` vec.
272 pub skipped: Vec<String>,
273 /// Candidates that could neither install nor quarantine. Import never
274 /// aborts the whole run on one bad candidate.
275 pub failed: Vec<SkillImportFailure>,
276 /// The four list lengths.
277 pub counts: SkillImportCounts,
278}