Skip to main content

muse_code_sdk/msp/method/
workflow.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
7/// `workflow/cancel` params: cancel a live workflow run.
8#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
9#[serde(rename_all = "camelCase")]
10pub struct WorkflowCancelParams {
11    /// The target session.
12    pub session_id: String,
13    /// The idempotency handle (UUIDv7).
14    pub command_id: String,
15    /// The run to cancel, exactly as the `workflow` item names it; required,
16    /// non-empty.
17    pub workflow_run_id: String,
18}
19
20/// Which control to apply to the child's current attempt. Closed on the wire:
21/// an unknown value is `-32602 invalidParams`.
22#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
23#[serde(rename_all = "camelCase")]
24pub enum WorkflowChildAction {
25    /// Cancel the child's current live attempt and move on.
26    Skip,
27    /// Cancel it and durably admit a replacement attempt under the same
28    /// child owner.
29    Retry,
30}
31
32/// `workflow/childControl` params: skip or retry one workflow child, keyed by
33/// the `(childId, attempt)` pair the `workflow` item's `children[]` carries.
34#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
35#[serde(rename_all = "camelCase")]
36pub struct WorkflowChildControlParams {
37    /// The target session.
38    pub session_id: String,
39    /// The idempotency handle (UUIDv7).
40    pub command_id: String,
41    /// The run owning the child; required, non-empty.
42    pub workflow_run_id: String,
43    /// The child, from the item's `children[]`; required, non-empty.
44    pub child_id: String,
45    /// The child's CURRENT attempt (integer >= 1). A stale value rejects
46    /// `"stale_attempt"`; re-read the item and re-key — never guess.
47    pub attempt: u64,
48    /// The control to apply.
49    pub action: WorkflowChildAction,
50}
51
52/// `workflow/pause` params: pause a live workflow run, shaped exactly like
53/// `workflow/cancel`.
54#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
55#[serde(rename_all = "camelCase")]
56pub struct WorkflowPauseParams {
57    /// The target session.
58    pub session_id: String,
59    /// The idempotency handle (UUIDv7).
60    pub command_id: String,
61    /// The run to pause, exactly as the `workflow` item names it; required,
62    /// non-empty.
63    pub workflow_run_id: String,
64}
65
66/// The shared admission-only ack: deliberately bare `{commandId, status}` —
67/// settlement arrives as the workflow item's view events, never through the
68/// ack.
69#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
70#[serde(rename_all = "camelCase")]
71#[non_exhaustive]
72pub struct WorkflowControlResult {
73    /// Echoes the client's id.
74    pub command_id: String,
75    /// Admission status.
76    pub status: CommandStatus,
77}
78
79/// `workflow/resume` params: resume a paused workflow run, host-driven.
80#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
81#[serde(rename_all = "camelCase")]
82pub struct WorkflowResumeParams {
83    /// The target session.
84    pub session_id: String,
85    /// The idempotency handle (UUIDv7).
86    pub command_id: String,
87    /// The paused run to resume, exactly as the `workflow` item names it;
88    /// required, non-empty.
89    pub workflow_run_id: String,
90}
91
92/// `workflow/resume` result: admission-only plus the driven turn — always
93/// present, since resume always drives (idle fresh turn or busy steer).
94#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
95#[serde(rename_all = "camelCase")]
96#[non_exhaustive]
97pub struct WorkflowResumeResult {
98    /// Echoes the client's id.
99    pub command_id: String,
100    /// Admission status.
101    pub status: CommandStatus,
102    /// The turn the host drove: the fresh resume turn on an idle session, the
103    /// admission-time active turn on a busy session.
104    pub turn_id: String,
105}