@sanity/workflow-mcp 0.6.0 → 0.8.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.cts CHANGED
@@ -1,5 +1,8 @@
1
+ import type { ActionParam } from "@sanity/workflow-engine";
2
+ import type { AutonomyVerdict } from "@sanity/workflow-engine";
1
3
  import type { Diagnosis } from "@sanity/workflow-engine";
2
4
  import type { Engine } from "@sanity/workflow-engine";
5
+ import type { ExecutorClassification } from "@sanity/workflow-engine";
3
6
  import type { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
4
7
  import type { RequestHandlerExtra } from "@modelcontextprotocol/sdk/shared/protocol.js";
5
8
  import type { ServerNotification } from "@modelcontextprotocol/sdk/types.js";
@@ -27,6 +30,13 @@ export declare type GetWorkflowToolContext = (
27
30
  input: unknown,
28
31
  ) => WorkflowToolContext | Promise<WorkflowToolContext>;
29
32
 
33
+ /**
34
+ * One invocable (fireAction-fired) action. Two whole classes of action never
35
+ * appear here: an action whose `filter` scoped it out for this actor is
36
+ * ABSENT (filter is existence — it might as well not exist, never "disabled"),
37
+ * and a cascade-fired (`when`) action is projected as a
38
+ * {@link ProjectedAutomation} instead — the engine fires it, no caller can.
39
+ */
30
40
  export declare interface ProjectedActionVerdict {
31
41
  /** Action name — what to pass to `fire_action` as `action`. */
32
42
  action: string;
@@ -36,6 +46,10 @@ export declare interface ProjectedActionVerdict {
36
46
  allowed: boolean;
37
47
  /** When `allowed` is false, a short reason describing why. */
38
48
  disabledReason?: string;
49
+ /** The action's declared params — what `fire_action`'s `params` object must
50
+ * satisfy (each entry names the param and whether it is required). Absent
51
+ * when the action declares none. */
52
+ params?: ActionParam[];
39
53
  }
40
54
 
41
55
  export declare interface ProjectedActivity {
@@ -45,10 +59,71 @@ export declare interface ProjectedActivity {
45
59
  title?: string;
46
60
  /** Longer prose description, if provided. */
47
61
  description?: string;
48
- /** Current activity status. */
49
- status: "pending" | "active" | "done" | "skipped" | "failed";
50
- /** Available actions on this activity, each with its allowed/disabled verdict. */
62
+ /** Current activity status. Activities are active from stage entry; an
63
+ * activity whose `filter` scoped it out of this visit is absent from the
64
+ * projection, so `skipped` here always means an action resolved it so. */
65
+ status: "active" | "done" | "skipped" | "failed";
66
+ /**
67
+ * Who, if anyone, fires the activity's actions — `interactive` (only
68
+ * invocable actions), `autonomous` (only cascade-fired automation),
69
+ * `off-system` (work performed outside the system), or `hybrid` (both
70
+ * kinds). Shape-only; `completesWithoutCaller` is the causal answer.
71
+ */
72
+ classification: ExecutorClassification;
73
+ /**
74
+ * The causal refinement of `classification`: whether the activity resolves
75
+ * with no caller acting, following its triggers' reads to their producers
76
+ * (a mechanically autonomous trigger that only reads caller-written state
77
+ * still answers `no`). `conditional` means it depends on runtime values
78
+ * the static analysis can't see.
79
+ */
80
+ completesWithoutCaller: AutonomyVerdict;
81
+ /** What the activity waits on when it doesn't complete on its own
82
+ * ("waits on caller action …"), narrated in the workflow's vocabulary.
83
+ * Present only when `completesWithoutCaller` isn't `yes` AND something is
84
+ * narratable (a bare `conditional`, e.g. a cyclic gate, carries none). */
85
+ waitsOn?: string[];
86
+ /** Invocable actions on this activity, each with its allowed/disabled
87
+ * verdict. See {@link ProjectedActionVerdict} for what never appears. */
51
88
  actions: ProjectedActionVerdict[];
89
+ /** Cascade-fired actions, narrated as automation ("fires when …").
90
+ * Present only when the activity declares any. */
91
+ automations?: ProjectedAutomation[];
92
+ }
93
+
94
+ /**
95
+ * One cascade-fired (`when`) action, narrated as automation: the engine fires
96
+ * it on its own the moment the trigger holds — it is never invocable via
97
+ * `fire_action`, so it must not read as a button.
98
+ */
99
+ export declare interface ProjectedAutomation {
100
+ /** The cascade-fired action's name. Not accepted by `fire_action`. */
101
+ action: string;
102
+ /** Human label, if provided. */
103
+ title?: string;
104
+ /** The trigger — the GROQ condition whose truth makes the engine fire it. */
105
+ firesWhen: string;
106
+ /** What still stands between the current state and the trigger, as one
107
+ * English line ("Needs: …"). Absent when the trigger is already satisfied
108
+ * or already fired this stage visit. */
109
+ pending?: string;
110
+ }
111
+
112
+ /**
113
+ * Result of `get_workflow_definition` — one deployed version's content.
114
+ * `definition` is the stored (desugared) form with the document envelope
115
+ * stripped — valid input for the validate/deploy tools as-is (their parse
116
+ * accepts stored form; parts of it, e.g. resolved guard `idRefs`, are NOT
117
+ * valid authoring shape): modify it and redeploy via
118
+ * `deploy_workflow_definition` to mint the next version.
119
+ */
120
+ export declare interface ProjectedDefinition {
121
+ /** Definition `name`. */
122
+ name: string;
123
+ /** The deployed version this content came from. */
124
+ version: number;
125
+ /** The envelope-stripped definition content. */
126
+ definition: WorkflowDefinition;
52
127
  }
53
128
 
54
129
  /**
@@ -104,6 +179,9 @@ export declare interface ProjectedInstanceState {
104
179
  subject?: ProjectedSubject;
105
180
  /** Activities on the current stage, with available actions. */
106
181
  activities: ProjectedActivity[];
182
+ /** The workflow-level causal-autonomy narrative — "this workflow runs
183
+ * itself", or the stages where a run waits on someone. */
184
+ autonomy: string;
107
185
  /** Most recent history entries (newest first), capped to keep payload tight. */
108
186
  recentHistory: ProjectedHistoryEntry[];
109
187
  }
@@ -187,9 +265,10 @@ export declare function toolInputJsonSchema(
187
265
  ): ToolInputJsonSchema;
188
266
 
189
267
  /**
190
- * Result of `validate_workflow_definition`. On `valid: true`, `definition` is the
191
- * desugared form that would deploy (defaults filled, sugar expanded); on
192
- * `valid: false`, `error` is the aggregated, path-prefixed list of problems.
268
+ * Per-definition result inside {@link ValidateDefinitionsResult}. On
269
+ * `valid: true`, `definition` is the desugared form that would deploy
270
+ * (defaults filled, sugar expanded); on `valid: false`, `error` is the
271
+ * aggregated, path-prefixed list of problems.
193
272
  */
194
273
  export declare type ValidateDefinitionResult =
195
274
  | {
@@ -201,6 +280,15 @@ export declare type ValidateDefinitionResult =
201
280
  error: string;
202
281
  };
203
282
 
283
+ /**
284
+ * Result of `validate_workflow_definition`. `results` pairs positionally with
285
+ * the input `definitions`; `valid` is true only when every definition passed.
286
+ */
287
+ export declare interface ValidateDefinitionsResult {
288
+ valid: boolean;
289
+ results: ValidateDefinitionResult[];
290
+ }
291
+
204
292
  export declare const WORKFLOW_TOOLS: readonly WorkflowToolDef[];
205
293
 
206
294
  /**
package/dist/index.d.ts CHANGED
@@ -1,5 +1,8 @@
1
+ import type { ActionParam } from "@sanity/workflow-engine";
2
+ import type { AutonomyVerdict } from "@sanity/workflow-engine";
1
3
  import type { Diagnosis } from "@sanity/workflow-engine";
2
4
  import type { Engine } from "@sanity/workflow-engine";
5
+ import type { ExecutorClassification } from "@sanity/workflow-engine";
3
6
  import type { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
4
7
  import type { RequestHandlerExtra } from "@modelcontextprotocol/sdk/shared/protocol.js";
5
8
  import type { ServerNotification } from "@modelcontextprotocol/sdk/types.js";
@@ -27,6 +30,13 @@ export declare type GetWorkflowToolContext = (
27
30
  input: unknown,
28
31
  ) => WorkflowToolContext | Promise<WorkflowToolContext>;
29
32
 
33
+ /**
34
+ * One invocable (fireAction-fired) action. Two whole classes of action never
35
+ * appear here: an action whose `filter` scoped it out for this actor is
36
+ * ABSENT (filter is existence — it might as well not exist, never "disabled"),
37
+ * and a cascade-fired (`when`) action is projected as a
38
+ * {@link ProjectedAutomation} instead — the engine fires it, no caller can.
39
+ */
30
40
  export declare interface ProjectedActionVerdict {
31
41
  /** Action name — what to pass to `fire_action` as `action`. */
32
42
  action: string;
@@ -36,6 +46,10 @@ export declare interface ProjectedActionVerdict {
36
46
  allowed: boolean;
37
47
  /** When `allowed` is false, a short reason describing why. */
38
48
  disabledReason?: string;
49
+ /** The action's declared params — what `fire_action`'s `params` object must
50
+ * satisfy (each entry names the param and whether it is required). Absent
51
+ * when the action declares none. */
52
+ params?: ActionParam[];
39
53
  }
40
54
 
41
55
  export declare interface ProjectedActivity {
@@ -45,10 +59,71 @@ export declare interface ProjectedActivity {
45
59
  title?: string;
46
60
  /** Longer prose description, if provided. */
47
61
  description?: string;
48
- /** Current activity status. */
49
- status: "pending" | "active" | "done" | "skipped" | "failed";
50
- /** Available actions on this activity, each with its allowed/disabled verdict. */
62
+ /** Current activity status. Activities are active from stage entry; an
63
+ * activity whose `filter` scoped it out of this visit is absent from the
64
+ * projection, so `skipped` here always means an action resolved it so. */
65
+ status: "active" | "done" | "skipped" | "failed";
66
+ /**
67
+ * Who, if anyone, fires the activity's actions — `interactive` (only
68
+ * invocable actions), `autonomous` (only cascade-fired automation),
69
+ * `off-system` (work performed outside the system), or `hybrid` (both
70
+ * kinds). Shape-only; `completesWithoutCaller` is the causal answer.
71
+ */
72
+ classification: ExecutorClassification;
73
+ /**
74
+ * The causal refinement of `classification`: whether the activity resolves
75
+ * with no caller acting, following its triggers' reads to their producers
76
+ * (a mechanically autonomous trigger that only reads caller-written state
77
+ * still answers `no`). `conditional` means it depends on runtime values
78
+ * the static analysis can't see.
79
+ */
80
+ completesWithoutCaller: AutonomyVerdict;
81
+ /** What the activity waits on when it doesn't complete on its own
82
+ * ("waits on caller action …"), narrated in the workflow's vocabulary.
83
+ * Present only when `completesWithoutCaller` isn't `yes` AND something is
84
+ * narratable (a bare `conditional`, e.g. a cyclic gate, carries none). */
85
+ waitsOn?: string[];
86
+ /** Invocable actions on this activity, each with its allowed/disabled
87
+ * verdict. See {@link ProjectedActionVerdict} for what never appears. */
51
88
  actions: ProjectedActionVerdict[];
89
+ /** Cascade-fired actions, narrated as automation ("fires when …").
90
+ * Present only when the activity declares any. */
91
+ automations?: ProjectedAutomation[];
92
+ }
93
+
94
+ /**
95
+ * One cascade-fired (`when`) action, narrated as automation: the engine fires
96
+ * it on its own the moment the trigger holds — it is never invocable via
97
+ * `fire_action`, so it must not read as a button.
98
+ */
99
+ export declare interface ProjectedAutomation {
100
+ /** The cascade-fired action's name. Not accepted by `fire_action`. */
101
+ action: string;
102
+ /** Human label, if provided. */
103
+ title?: string;
104
+ /** The trigger — the GROQ condition whose truth makes the engine fire it. */
105
+ firesWhen: string;
106
+ /** What still stands between the current state and the trigger, as one
107
+ * English line ("Needs: …"). Absent when the trigger is already satisfied
108
+ * or already fired this stage visit. */
109
+ pending?: string;
110
+ }
111
+
112
+ /**
113
+ * Result of `get_workflow_definition` — one deployed version's content.
114
+ * `definition` is the stored (desugared) form with the document envelope
115
+ * stripped — valid input for the validate/deploy tools as-is (their parse
116
+ * accepts stored form; parts of it, e.g. resolved guard `idRefs`, are NOT
117
+ * valid authoring shape): modify it and redeploy via
118
+ * `deploy_workflow_definition` to mint the next version.
119
+ */
120
+ export declare interface ProjectedDefinition {
121
+ /** Definition `name`. */
122
+ name: string;
123
+ /** The deployed version this content came from. */
124
+ version: number;
125
+ /** The envelope-stripped definition content. */
126
+ definition: WorkflowDefinition;
52
127
  }
53
128
 
54
129
  /**
@@ -104,6 +179,9 @@ export declare interface ProjectedInstanceState {
104
179
  subject?: ProjectedSubject;
105
180
  /** Activities on the current stage, with available actions. */
106
181
  activities: ProjectedActivity[];
182
+ /** The workflow-level causal-autonomy narrative — "this workflow runs
183
+ * itself", or the stages where a run waits on someone. */
184
+ autonomy: string;
107
185
  /** Most recent history entries (newest first), capped to keep payload tight. */
108
186
  recentHistory: ProjectedHistoryEntry[];
109
187
  }
@@ -187,9 +265,10 @@ export declare function toolInputJsonSchema(
187
265
  ): ToolInputJsonSchema;
188
266
 
189
267
  /**
190
- * Result of `validate_workflow_definition`. On `valid: true`, `definition` is the
191
- * desugared form that would deploy (defaults filled, sugar expanded); on
192
- * `valid: false`, `error` is the aggregated, path-prefixed list of problems.
268
+ * Per-definition result inside {@link ValidateDefinitionsResult}. On
269
+ * `valid: true`, `definition` is the desugared form that would deploy
270
+ * (defaults filled, sugar expanded); on `valid: false`, `error` is the
271
+ * aggregated, path-prefixed list of problems.
193
272
  */
194
273
  export declare type ValidateDefinitionResult =
195
274
  | {
@@ -201,6 +280,15 @@ export declare type ValidateDefinitionResult =
201
280
  error: string;
202
281
  };
203
282
 
283
+ /**
284
+ * Result of `validate_workflow_definition`. `results` pairs positionally with
285
+ * the input `definitions`; `valid` is true only when every definition passed.
286
+ */
287
+ export declare interface ValidateDefinitionsResult {
288
+ valid: boolean;
289
+ results: ValidateDefinitionResult[];
290
+ }
291
+
204
292
  export declare const WORKFLOW_TOOLS: readonly WorkflowToolDef[];
205
293
 
206
294
  /**
package/dist/stdio.js CHANGED
@@ -8,7 +8,7 @@ import { registerWorkflowTools, workflowAddressFromInput, createMcpTelemetry } f
8
8
 
9
9
  import { createClient } from "@sanity/client";
10
10
 
11
- var version = "0.6.0", packageJson = {
11
+ var version = "0.8.0", packageJson = {
12
12
  version: version
13
13
  };
14
14
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sanity/workflow-mcp",
3
- "version": "0.6.0",
3
+ "version": "0.8.0",
4
4
  "description": "MCP server exposing Sanity workflow tools to agents — operate running workflow instances and author new definitions.",
5
5
  "keywords": [
6
6
  "agent",
@@ -56,14 +56,14 @@
56
56
  "@sanity/client": "^7.22.1",
57
57
  "@sanity/telemetry": "^1.1.0",
58
58
  "zod": "^4.4.3",
59
- "@sanity/workflow-engine": "0.15.0"
59
+ "@sanity/workflow-engine": "0.17.0"
60
60
  },
61
61
  "devDependencies": {
62
62
  "@sanity/pkg-utils": "^10.5.2",
63
63
  "@types/node": "^24.12.4",
64
64
  "vitest": "^4.1.8",
65
- "@sanity/workflow-engine-test": "0.10.0",
66
- "@sanity/workflow-examples": "0.5.0"
65
+ "@sanity/workflow-engine-test": "0.12.0",
66
+ "@sanity/workflow-examples": "0.7.0"
67
67
  },
68
68
  "engines": {
69
69
  "node": ">=20"