muse_code_sdk/msp/method/worktree.rs
1// @generated from the MSP stable schema and protocol sources; do not edit by hand.
2
3use serde::Deserialize;
4use serde::Serialize;
5
6mod catch_all;
7
8/// `session/start` `worktree` param: absent means no worktree — the start
9/// proceeds exactly as today. Adjacently tagged on `mode`: a create carries an
10/// optional `baseRef`, an existing carries a required `path` (omitted `path`
11/// fails decode — the pre-existing invalid-params class, never a new message).
12#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
13#[serde(tag = "mode", rename_all = "lowercase")]
14pub enum WorktreeStartRequest {
15 /// The host allocates the worktree.
16 #[serde(rename_all = "camelCase")]
17 Create {
18 /// The base to create from; omitted means `HEAD`.
19 #[serde(skip_serializing_if = "Option::is_none")]
20 base_ref: Option<String>,
21 },
22 /// The host validates and binds the given path.
23 Existing {
24 /// The caller-provided worktree path to validate.
25 path: String,
26 },
27}
28
29/// Where a session's worktree came from: `created` means the host
30/// allocated it for the session, `attached` means the host bound a
31/// caller-provided worktree.
32#[derive(Debug, Clone, PartialEq, Eq)]
33#[non_exhaustive]
34pub enum WorktreeOrigin {
35 /// The host allocated this worktree for the session.
36 Created,
37 /// The host validated and bound a caller-provided worktree.
38 Attached,
39 /// A value from a newer host, kept verbatim so an older client decodes the
40 /// rest of the message. Never construct it with a known word.
41 Unknown(String),
42}
43
44/// The Session `worktree` member: path and origin only — the branch stays in
45/// the existing `branch` member.
46#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
47#[serde(rename_all = "camelCase")]
48#[non_exhaustive]
49pub struct SessionWorktree {
50 /// Canonical worktree path the session runs in.
51 pub path: String,
52 /// Whether the host created or attached it.
53 pub origin: WorktreeOrigin,
54}