muse_code_sdk/msp/method/lifecycle/runtime_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
6/// The runtime-owned git worktree a child session runs in, mirrored from the
7/// `subagent.worktree.*` records on its parent's log. The three enums are open:
8/// clients treat an unknown value as unknown.
9#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
10#[serde(rename_all = "camelCase")]
11#[non_exhaustive]
12pub struct RuntimeWorktree {
13 /// The recorded worktree root, verbatim (recorded history; serving it
14 /// never probes the path).
15 pub worktree_root: String,
16 /// The commit the worktree was created from.
17 pub base_commit: String,
18 /// The head commit the active lease recorded.
19 pub head_commit: String,
20 /// Who owns the worktree.
21 pub ownership: RuntimeWorktreeOwnership,
22 /// How the worktree is cleaned up.
23 pub cleanup_policy: RuntimeWorktreeCleanupPolicy,
24 /// Where the worktree's cleanup stands.
25 pub cleanup_state: RuntimeWorktreeCleanupState,
26 /// True exactly when the parent's uncommitted changes were recorded as
27 /// excluded from the checkout.
28 pub parent_dirty_excluded: bool,
29}
30
31/// Who owns a session's worktree. The set is open, so newer hosts may send
32/// other values.
33#[derive(Debug, Clone, PartialEq, Eq)]
34#[non_exhaustive]
35pub enum RuntimeWorktreeOwnership {
36 /// `runtimeOwned`: the runtime created the worktree and owns its cleanup.
37 RuntimeOwned,
38 /// A value from a newer host, kept verbatim so an older client decodes the
39 /// rest of the message. Excluded from the generated schema while the enum
40 /// stays declared open; never construct it with a known word.
41 Unknown(String),
42}
43
44/// How a session's worktree is cleaned up. The set is open, so newer hosts
45/// may send other values.
46#[derive(Debug, Clone, PartialEq, Eq)]
47#[non_exhaustive]
48pub enum RuntimeWorktreeCleanupPolicy {
49 /// `removeIfClean`: the runtime removes the worktree when it has no
50 /// uncommitted changes, and keeps it otherwise.
51 RemoveIfClean,
52 /// A value from a newer host, kept verbatim so an older client decodes the
53 /// rest of the message. Excluded from the generated schema while the enum
54 /// stays declared open; never construct it with a known word.
55 Unknown(String),
56}
57
58/// Where a session's worktree cleanup stands. The set is open, so newer
59/// hosts may send other values.
60#[derive(Debug, Clone, PartialEq, Eq)]
61#[non_exhaustive]
62pub enum RuntimeWorktreeCleanupState {
63 /// `active`: no cleanup outcome is recorded yet.
64 Active,
65 /// `cleaned`: the runtime removed the worktree.
66 Cleaned,
67 /// `retained`: the runtime kept the worktree.
68 Retained,
69 /// `cleanupFailed`: the runtime tried to remove the worktree and failed.
70 CleanupFailed,
71 /// A value from a newer host, kept verbatim so an older client decodes the
72 /// rest of the message. Excluded from the generated schema while the enum
73 /// stays declared open; never construct it with a known word.
74 Unknown(String),
75}