Skip to main content

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    /// A value from a newer host, kept verbatim so an older client decodes the
71    /// rest of the message. Never construct it with a known word.
72    Unknown(String),
73}
74
75/// A `skill` input part's picked-copy source: the catalog-row `source` enum
76/// values, sent by the TUI on every skill submit so the host resolves the exact
77/// `(selector, source)` row. **Closed**: a client-selected write vocabulary —
78/// an unknown value is `invalidParams`, never a fall-through to the bare row.
79/// Contrast the open read-side [`SkillSource`].
80#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
81#[serde(rename_all = "camelCase")]
82pub enum SkillInvocationSource {
83    /// Shipped with the binary.
84    Bundled,
85    /// The user's personal skill directories.
86    User,
87    /// The session workspace's project skills.
88    Project,
89    /// Contributed by an installed plugin.
90    Plugin,
91}
92
93/// `skill/changed` params: the session's user-invocable set changed; clients
94/// re-issue `skill/list`. Advisory — the host may coalesce bursts and
95/// guarantees no ordering relative to view events.
96#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
97#[serde(rename_all = "camelCase")]
98#[non_exhaustive]
99pub struct SkillChangedParams {
100    /// The session whose set changed.
101    pub session_id: String,
102}
103
104/// `skill/setActivation` activation target. **Closed**: a client-selected write
105/// vocabulary — a write must fail a scope the host does not implement rather
106/// than record activation against an unknown target. Contrast the open
107/// read-side [`SkillSource`].
108#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
109#[serde(rename_all = "camelCase")]
110pub enum SkillActivationScope {
111    /// The user's personal skill directories.
112    User,
113    /// The session workspace's project skills.
114    Project,
115    /// Shipped with the binary.
116    Bundled,
117    /// Contributed by an installed plugin.
118    Plugin,
119}
120
121/// The three-state skill activation. **Closed**: a client-selected write
122/// vocabulary.
123#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
124#[serde(rename_all = "camelCase")]
125pub enum SkillActivationState {
126    /// Fully active: user-invoked and model-invoked.
127    On,
128    /// User-invoked only; the model cannot invoke it.
129    UserInvocableOnly,
130    /// Inactive everywhere.
131    Off,
132}
133
134/// `skill/setActivation` params: turn one skill on or off in any scope through
135/// the single `SkillsService::set_activation` seam.
136#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
137#[serde(rename_all = "camelCase")]
138pub struct SkillSetActivationParams {
139    /// The target session.
140    pub session_id: String,
141    /// The idempotency handle (UUIDv7).
142    pub command_id: String,
143    /// Names one skill: a bare or plugin-qualified token from the session's
144    /// full catalog, the row vocabulary.
145    pub selector: String,
146    /// The activation target.
147    pub scope: SkillActivationScope,
148    /// The activation to apply.
149    pub activation: SkillActivationState,
150}
151
152/// `skill/setActivation` result: the ack envelope plus the applied state.
153#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
154#[serde(rename_all = "camelCase")]
155#[non_exhaustive]
156pub struct SkillSetActivationResult {
157    /// Echoes the client's id.
158    pub command_id: String,
159    /// Admission status.
160    pub status: CommandStatus,
161    /// Echoes the applied write's selector.
162    pub selector: String,
163    /// Echoes the applied write's scope.
164    pub scope: SkillActivationScope,
165    /// The applied activation.
166    pub activation: SkillActivationState,
167    /// The activation value in force for that `(selector, scope)`
168    /// immediately before the write: the same value a full-catalog
169    /// `skill/list` row would have carried in `activation` for it.
170    pub previous: SkillActivationState,
171}
172
173/// `skill/import` foreign ecosystem. **Closed**: a client-selected write
174/// vocabulary — a write must fail an ecosystem the host does not implement
175/// rather than import from an unknown dir. The host resolves its own foreign
176/// dir (the `foreign_skills_sources` derivation); no client paths cross the
177/// wire.
178#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
179#[serde(rename_all = "camelCase")]
180pub enum SkillImportSource {
181    /// `~/.claude/skills`.
182    Claude,
183    /// `$CODEX_HOME/skills` (else `~/.codex/skills`).
184    Codex,
185}
186
187/// `skill/import` params: import foreign skills through the single
188/// `SkillsService::import_skills` seam.
189#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
190#[serde(rename_all = "camelCase")]
191pub struct SkillImportParams {
192    /// The target session.
193    pub session_id: String,
194    /// The idempotency handle (UUIDv7) — required even for `dryRun` previews.
195    pub command_id: String,
196    /// The foreign ecosystem to import from.
197    pub source: SkillImportSource,
198    /// Preview for the consent UI; writes nothing. Additive-optional,
199    /// default false.
200    #[serde(default, skip_serializing_if = "std::ops::Not::not")]
201    pub dry_run: bool,
202    /// Re-import over already-imported ids (the CLI `--force` twin).
203    /// Additive-optional, default false.
204    #[serde(default, skip_serializing_if = "std::ops::Not::not")]
205    pub force: bool,
206}
207
208/// One quarantined import candidate: kept, not loaded.
209#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
210#[serde(rename_all = "camelCase")]
211#[non_exhaustive]
212pub struct SkillImportQuarantine {
213    /// The candidate's id.
214    pub id: String,
215    /// The quarantine reasons.
216    pub reasons: Vec<String>,
217}
218
219/// One import candidate that could neither install nor quarantine: recorded so
220/// the run continues past it. `id` is null when the candidate never yielded one
221/// — present-but-null, never omitted.
222#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
223#[serde(rename_all = "camelCase")]
224#[non_exhaustive]
225pub struct SkillImportFailure {
226    /// The candidate's id, or null when it never yielded one.
227    pub id: Option<String>,
228    /// Why the candidate failed.
229    pub reason: String,
230}
231
232/// The four receipt-list lengths: a client renders counts without walking
233/// lists.
234#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
235#[serde(rename_all = "camelCase")]
236#[non_exhaustive]
237pub struct SkillImportCounts {
238    /// `installed.len()`.
239    pub installed: u64,
240    /// `quarantined.len()`.
241    pub quarantined: u64,
242    /// `skipped.len()`.
243    pub skipped: u64,
244    /// `failed.len()`.
245    pub failed: u64,
246}
247
248/// `skill/import` result: the ack envelope plus the service receipt projection.
249#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
250#[serde(rename_all = "camelCase")]
251#[non_exhaustive]
252pub struct SkillImportResult {
253    /// Echoes the client's id.
254    pub command_id: String,
255    /// Admission status.
256    pub status: CommandStatus,
257    /// Echoes the call's ecosystem.
258    pub source: SkillImportSource,
259    /// Echoes the call's preview flag.
260    pub dry_run: bool,
261    /// The ids the run installed, in pipeline order.
262    pub installed: Vec<String>,
263    /// Kept, not loaded, with reasons.
264    pub quarantined: Vec<SkillImportQuarantine>,
265    /// Ids the run did not install: already-imported ids and in-run
266    /// duplicates, verbatim from the seam's `skipped` vec.
267    pub skipped: Vec<String>,
268    /// Candidates that could neither install nor quarantine. Import never
269    /// aborts the whole run on one bad candidate.
270    pub failed: Vec<SkillImportFailure>,
271    /// The four list lengths.
272    pub counts: SkillImportCounts,
273}