@sanity/workflows-cli 0.0.0-pr-744-20261109125055

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.
Files changed (126) hide show
  1. package/CHANGELOG.md +1848 -0
  2. package/LICENSE +21 -0
  3. package/README.md +798 -0
  4. package/bin/run.js +8 -0
  5. package/dist/command-ids.d.ts +10 -0
  6. package/dist/command-ids.js +10 -0
  7. package/dist/commands/workflows/abort.d.ts +29 -0
  8. package/dist/commands/workflows/abort.js +50 -0
  9. package/dist/commands/workflows/blueprints/generate.d.ts +12 -0
  10. package/dist/commands/workflows/blueprints/generate.js +46 -0
  11. package/dist/commands/workflows/codemod/packages.d.ts +13 -0
  12. package/dist/commands/workflows/codemod/packages.js +41 -0
  13. package/dist/commands/workflows/definitions/delete.d.ts +44 -0
  14. package/dist/commands/workflows/definitions/delete.js +74 -0
  15. package/dist/commands/workflows/definitions/diff.d.ts +23 -0
  16. package/dist/commands/workflows/definitions/diff.js +55 -0
  17. package/dist/commands/workflows/definitions/list.d.ts +51 -0
  18. package/dist/commands/workflows/definitions/list.js +139 -0
  19. package/dist/commands/workflows/definitions/show.d.ts +65 -0
  20. package/dist/commands/workflows/definitions/show.js +129 -0
  21. package/dist/commands/workflows/definitions/validate.d.ts +14 -0
  22. package/dist/commands/workflows/definitions/validate.js +50 -0
  23. package/dist/commands/workflows/deploy.d.ts +117 -0
  24. package/dist/commands/workflows/deploy.js +266 -0
  25. package/dist/commands/workflows/diagnose.d.ts +52 -0
  26. package/dist/commands/workflows/diagnose.js +195 -0
  27. package/dist/commands/workflows/fire-action.d.ts +53 -0
  28. package/dist/commands/workflows/fire-action.js +182 -0
  29. package/dist/commands/workflows/list.d.ts +78 -0
  30. package/dist/commands/workflows/list.js +248 -0
  31. package/dist/commands/workflows/nuke.d.ts +73 -0
  32. package/dist/commands/workflows/nuke.js +176 -0
  33. package/dist/commands/workflows/reset-activity.d.ts +32 -0
  34. package/dist/commands/workflows/reset-activity.js +60 -0
  35. package/dist/commands/workflows/show.d.ts +29 -0
  36. package/dist/commands/workflows/show.js +156 -0
  37. package/dist/commands/workflows/start.d.ts +57 -0
  38. package/dist/commands/workflows/start.js +196 -0
  39. package/dist/commands/workflows/tail.d.ts +23 -0
  40. package/dist/commands/workflows/tail.js +83 -0
  41. package/dist/commands/workflows/whoami.d.ts +15 -0
  42. package/dist/commands/workflows/whoami.js +53 -0
  43. package/dist/help.d.ts +13 -0
  44. package/dist/help.js +50 -0
  45. package/dist/hooks/finally/telemetry.d.ts +3 -0
  46. package/dist/hooks/finally/telemetry.js +9 -0
  47. package/dist/hooks/prerun/telemetry.d.ts +28 -0
  48. package/dist/hooks/prerun/telemetry.js +37 -0
  49. package/dist/index.d.ts +1 -0
  50. package/dist/index.js +1 -0
  51. package/dist/lib/base-command.d.ts +14 -0
  52. package/dist/lib/base-command.js +34 -0
  53. package/dist/lib/blueprint-emit.d.ts +56 -0
  54. package/dist/lib/blueprint-emit.js +233 -0
  55. package/dist/lib/blueprint-needs.d.ts +5 -0
  56. package/dist/lib/blueprint-needs.js +205 -0
  57. package/dist/lib/blueprint-stacks.d.ts +6 -0
  58. package/dist/lib/blueprint-stacks.js +88 -0
  59. package/dist/lib/cause-detail.d.ts +9 -0
  60. package/dist/lib/cause-detail.js +112 -0
  61. package/dist/lib/client.d.ts +24 -0
  62. package/dist/lib/client.js +40 -0
  63. package/dist/lib/codemod/manifest-rewrite.d.ts +14 -0
  64. package/dist/lib/codemod/manifest-rewrite.js +97 -0
  65. package/dist/lib/codemod/package-map.d.ts +22 -0
  66. package/dist/lib/codemod/package-map.js +72 -0
  67. package/dist/lib/codemod/report.d.ts +5 -0
  68. package/dist/lib/codemod/report.js +43 -0
  69. package/dist/lib/codemod/run.d.ts +23 -0
  70. package/dist/lib/codemod/run.js +103 -0
  71. package/dist/lib/codemod/source-rewrite.d.ts +18 -0
  72. package/dist/lib/codemod/source-rewrite.js +155 -0
  73. package/dist/lib/command-context.d.ts +20 -0
  74. package/dist/lib/command-context.js +24 -0
  75. package/dist/lib/command-telemetry.d.ts +54 -0
  76. package/dist/lib/command-telemetry.js +82 -0
  77. package/dist/lib/context.d.ts +155 -0
  78. package/dist/lib/context.js +268 -0
  79. package/dist/lib/default-partition.d.ts +23 -0
  80. package/dist/lib/default-partition.js +48 -0
  81. package/dist/lib/definition-files.d.ts +11 -0
  82. package/dist/lib/definition-files.js +58 -0
  83. package/dist/lib/definitions.d.ts +63 -0
  84. package/dist/lib/definitions.js +84 -0
  85. package/dist/lib/diff.d.ts +12 -0
  86. package/dist/lib/diff.js +93 -0
  87. package/dist/lib/env.d.ts +7 -0
  88. package/dist/lib/env.js +8 -0
  89. package/dist/lib/fail.d.ts +29 -0
  90. package/dist/lib/fail.js +46 -0
  91. package/dist/lib/flags.d.ts +49 -0
  92. package/dist/lib/flags.js +117 -0
  93. package/dist/lib/follow-up-command.d.ts +18 -0
  94. package/dist/lib/follow-up-command.js +12 -0
  95. package/dist/lib/history-rows.d.ts +3 -0
  96. package/dist/lib/history-rows.js +44 -0
  97. package/dist/lib/load-config.d.ts +46 -0
  98. package/dist/lib/load-config.js +110 -0
  99. package/dist/lib/nuke.d.ts +124 -0
  100. package/dist/lib/nuke.js +206 -0
  101. package/dist/lib/operation-args.d.ts +42 -0
  102. package/dist/lib/operation-args.js +21 -0
  103. package/dist/lib/ops-report.d.ts +47 -0
  104. package/dist/lib/ops-report.js +31 -0
  105. package/dist/lib/params.d.ts +3 -0
  106. package/dist/lib/params.js +21 -0
  107. package/dist/lib/pick-dataset.d.ts +10 -0
  108. package/dist/lib/pick-dataset.js +30 -0
  109. package/dist/lib/prompt.d.ts +35 -0
  110. package/dist/lib/prompt.js +11 -0
  111. package/dist/lib/read-fanout.d.ts +45 -0
  112. package/dist/lib/read-fanout.js +44 -0
  113. package/dist/lib/select-deployment.d.ts +31 -0
  114. package/dist/lib/select-deployment.js +91 -0
  115. package/dist/lib/share-definitions.d.ts +101 -0
  116. package/dist/lib/share-definitions.js +188 -0
  117. package/dist/lib/telemetry-setup.d.ts +81 -0
  118. package/dist/lib/telemetry-setup.js +111 -0
  119. package/dist/lib/telemetry.d.ts +78 -0
  120. package/dist/lib/telemetry.js +90 -0
  121. package/dist/lib/ui.d.ts +91 -0
  122. package/dist/lib/ui.js +116 -0
  123. package/dist/standalone-argv.d.ts +14 -0
  124. package/dist/standalone-argv.js +57 -0
  125. package/oclif.manifest.json +1731 -0
  126. package/package.json +121 -0
package/CHANGELOG.md ADDED
@@ -0,0 +1,1848 @@
1
+ # @sanity/workflow-cli
2
+
3
+ ## 0.0.0-pr-744-20261109125055
4
+
5
+ ### Minor Changes
6
+
7
+ - 20a68f4: The Workflows CLI's read commands (`list`, `show`, `tail`, `diagnose`, `definitions list`, and `definitions show`) can now run without a `sanity.workflow.ts` and without targeting flags. In an interactive terminal, when no config is found and none of `--project-id`/`--dataset`, `--media-library-id`, `--path`, or `--deployment` is passed, the command asks on stderr for a project and then one of its datasets from those your `sanity login` session can access, reads that dataset, and prints the `--project-id <id> --dataset <name>` flags that select it, so the next run can be scripted. The picker offers datasets only; media libraries stay reachable through `--media-library-id`. With `--json` or in a non-interactive shell, the command still fails when no config is found, and the failure now names the targeting flags. Commands that write still require a config and fail as before.
8
+
9
+ **No upgrade action required.** Runs with a config, or with the targeting flags, behave as before; scripts that run without either keep failing, now with a message that names the flags.
10
+
11
+ **Docs impact:** Update the CLI guide section on how reads choose their resources to describe the interactive project and dataset picker for the no-config case, and add it to the CLI reference entry for read targets.
12
+
13
+ - 1def098: Add `whoami`, which prints the user Workflows records for your login: the kind (`user` or `robot`), your Sanity user ID, and your project user ID. Put the Sanity user ID in user assignee fields, for example in `start --field`. `--json` prints the same values as one object. The command picks its project like the other read commands: from `sanity.workflow.ts`, `--deployment`, or `--project-id` with `--dataset`.
14
+
15
+ **No upgrade action required.**
16
+
17
+ **Docs impact:** Add `whoami` to the CLI command reference, and mention it where the docs explain which user ID to put in user assignee fields.
18
+
19
+ - cdd07a3: **BREAKING:** `grantsFromPath` is deprecated and ignored on every engine and `workflow.*` verb, `engine.session()`, and the `useWorkflowSession` hooks of `@sanity/workflows-ui/react`, `@sanity/workflows-ui/sdk` and `@sanity/workflows-ui/studio`. Without an asserted `access`, the engine now always reads the caller's grants from the ACL of its `workflowResource` (`/projects/<id>/datasets/<dataset>/acl` for a dataset, `/canvases/<id>/acl` for a Canvas). Hosts that never passed `grantsFromPath`, such as an MCP host, now see `$can` bound, so `$can` conditions that always failed closed now evaluate against the caller's grants. A host that passed a different path gets the workflow resource's grants instead. The member stays in the types until a later release removes it.
20
+
21
+ Engines created with `createEngine` contain write-routing paths for the unreleased Workflows service. They are off by default and not supported for use; with the Workflows service switch off, every instance write commits directly and nothing requests `/workflow/*`. A grants read that fails for a reason other than a `401`–`404` refusal is no longer kept for the client's lifetime: the next evaluation or write fetches the grants again, so `$can` and the subject-write forecast recover after a transient failure.
22
+
23
+ The CLI's `start`, `fire-action` and `abort` now run on a `createEngine` engine. The test bench's `createBench({service})` option exists for the engine's own tests and is not supported for use.
24
+
25
+ **Upgrade action:** stop passing `grantsFromPath`; it has no effect. Review `$can` conditions in definitions run by hosts that did not pass it, since they now evaluate instead of failing closed.
26
+
27
+ **Docs impact:** Remove `grantsFromPath` from every reference signature, guide and example and note its deprecation, and add the `$can` behaviour change to the release notes. For write routing: No docs change: the Workflows service is unreleased.
28
+
29
+ - 393526c: **BREAKING:** `sanity-workflows blueprints generate` now emits the generated runtime as two stacks. The scheduled heartbeat moves out of `workflows.blueprint.ts` into a blueprint of its own, `workflows-heartbeat/sanity.blueprint.ts`, with its own robot token (`wf-<deployment>-heartbeat-runtime`). Your `sanity.blueprint.ts` now holds only document functions (drains and start watchers), so it deploys to a project-scoped stack with a token that can deploy to the project. Only the heartbeat stack needs an organization deploy token. This affects every project whose generated runtime includes a heartbeat. If you regenerate and redeploy only your existing stack, the heartbeat is removed from it, and `$now` deadlines, parents waiting on spawned children, effects queued before their drain existed, and drains that timed out stop recovering, with no error anywhere.
30
+
31
+ The command now ends with a `Deploy:` section naming which token deploys which stack, and which of the heartbeat stack's files this run changed. That blueprint's header lists what the heartbeat depends on: the partition, the datasets, the `'function'`-hosted workflows it ticks and the `'function'`-hosted effects it re-queues. Editing an existing workflow leaves it unchanged, so only the project stack needs redeploying. Adding or removing a `'function'`-hosted workflow or effect changes it, and `blueprints generate --check` reports it as `differs`. The command also writes `workflows-heartbeat/package.json`, which copies your project's declared specifications for `@sanity/functions` and `@sanity/workflows`, the same ones each generated function's `package.json` gets. When the heartbeat stack is built from `workflows-heartbeat/`, the Functions build installs the heartbeat's dependencies from that file, so the deployed heartbeat runs the versions your project pins. Keep it next to the stack's blueprint: without it, a project installed with npm builds the heartbeat against the latest published Workflows packages, which can fail on every run while the deploy reports success. Moving a declared specification for one of those two packages changes `workflows-heartbeat/package.json`, and `blueprints generate --check` reports it as `differs`. Redeploy the heartbeat stack with the organization token whenever the `Deploy:` section lists a heartbeat-stack file as changed. The heartbeat bundles the installed Workflows runtime when it is deployed, so after upgrading the Workflows packages, redeploy both stacks even when every generated file is unchanged. Until you do, the running heartbeat does not tick the new workflow's instances or re-queue the new effect. When a heartbeat is generated, the command also lists what stays stuck, silently, if the heartbeat stack is not running.
32
+
33
+ To migrate an existing single organization-scoped stack without running two heartbeats or two sets of document functions at once:
34
+
35
+ 1. Regenerate with `sanity-workflows blueprints generate`.
36
+ 2. From the project root, run `npx sanity@latest blueprints deploy` against your existing stack. This removes the heartbeat from it and keeps its document functions.
37
+ 3. From `workflows-heartbeat/`, run `npx sanity@latest blueprints init . --organization-id <organizationId>` and `npx sanity@latest blueprints deploy` with the organization deploy token. Deadlines, children and stale effects that came due between steps 2 and 3 are picked up once the new heartbeat runs; each run works on at most 30 instances per step, so a large backlog takes several runs.
38
+ 4. Optional: to move the document functions to a project-scoped stack, run `npx sanity@latest blueprints destroy` on the old stack, then `npx sanity@latest blueprints init . --project-id <projectId>` and `npx sanity@latest blueprints deploy` from the project root with a project token. The heartbeat re-queues effects queued in between, but a document written in between starts no instance; start it with `sanity-workflows start`.
39
+
40
+ Each heartbeat stack counts toward the organization's limit of 10 organization-scoped stacks.
41
+
42
+ **Docs impact:** Update the generated-runtime guide's layout and deploy sections (two blueprints, the generated `workflows-heartbeat/package.json` the heartbeat's build installs from, which token deploys each, when the heartbeat stack needs redeploying, the stuck-instance consequences of a missing heartbeat stack, and the organization stack limit), the CLI reference output for `blueprints generate`, and add this migration to the release notes.
43
+
44
+ - 71e3f25: **BREAKING:** `createRuntime` now serves every resource alias that is not a dataset (a Media Library, Canvas, or Dashboard) by deriving its client from the workflow dataset's client with `withConfig`. Before, the runtime ignored those aliases, so a custom `clientFactory` could return any client. If you pass your own `clientFactory` and the deployment binds such an alias, the client your factory returns must now have `withConfig`; until it does, `createRuntime` throws and every generated function on that deployment fails. The default factory and `@sanity/client` already have `withConfig`, so generated runtimes that keep the default need no change for this.
45
+
46
+ **BREAKING:** `startWatcherName` from `@sanity/workflows/blueprints/generate` takes `{deploymentName, source, group}` instead of `{deploymentName, dataset, group}`, because a watcher's source can now be a Media Library id as well as a dataset name. Code that calls it directly must pass the dataset name as `source`; until it does, the call fails to type-check, and an untyped caller throws a `TypeError`. The generator and `createRuntime` already pass `source`, so generated handlers need no change.
47
+
48
+ An autonomous workflow whose subject is a Media Library asset now starts in the generated runtime. Before, `sanity-workflows blueprints generate` watched only datasets, so a workflow typed `types: ['sanity.asset']` never started when an asset was uploaded to a Media Library bound in `resourceAliases`, and nothing reported it. The generator now emits a Media Library asset function (`defineMediaLibraryAssetFunction`) for each bound Media Library, which starts an asset when it is created. A Media Library trigger cannot evaluate a filter before and after a write, so `blueprints generate` now fails when such a definition's `start.filter` reads more of the asset than `_type`, instead of emitting a watcher that would never fire. `runtime.start` references the asset as `media-library:<library id>:<asset id>`, so drains, effect handlers, and the heartbeat's `$now` deadlines read the asset through the alias. `blueprints generate` names each Media Library watcher and warns which robot tokens need access to the library.
49
+
50
+ Upgrade action: if a deployment binds a Media Library alias and has an autonomous definition whose subject is an asset, regenerate the runtime with `sanity-workflows blueprints generate` and redeploy the project stack. If the deployment has a heartbeat stack, redeploy it too from `workflows-heartbeat/` with the organization deploy token: the heartbeat bundles its own copy of the runtime. Deploy the project stack with an identity that can read the library; the deploy fails otherwise. Confirm the runtime robot token (`wf-<deployment>-runtime`) and the heartbeat robot token can read the library, or every start there fails. Other deployments generate the same files as before and need no upgrade action beyond the custom `clientFactory` and `startWatcherName` cases above.
51
+
52
+ **Docs impact:** Update the generated-runtime guide (start watchers, the project stack, and robot token access) to cover Media Library aliases and asset-typed subjects, document the `withConfig` requirement for a custom `clientFactory` in the runtime reference, replace `dataset` with `source` in any reference that shows `startWatcherName`'s arguments, and add the asset-intake pattern (upload starts review, rights expiry as a `$now` transition) to the Media Library workflow examples.
53
+
54
+ - 860bb6c: `sanity-workflows blueprints generate` now prints a short summary by default: one line per deployment with the functions it needs, only the files that need you (a new effect-handler scaffold, a change to your own `sanity.blueprint.ts`, anything it could not resolve), a count of files written by status, and a `Deploy:` section. The project stack is still named whenever there are document functions; the heartbeat stack is named only when this run created or updated one of its files. When a heartbeat-stack file changes, the instruction is now conditional ("if you have deployed the heartbeat stack, redeploy it"), because the command cannot tell whether that stack was deployed. The new `--verbose` flag prints the full output: the runtime-needs report, every file with its status, and the heartbeat stack's instructions on every run. `--check` output and every exit code are unchanged. `deploy` now marks an `unchanged` definition with an info symbol instead of a warning symbol.
55
+
56
+ **No upgrade action required.** Scripts that parse the default `blueprints generate` output for the needs report, the per-file rows, or the `Deploy:` section should pass `--verbose`.
57
+
58
+ **Docs impact:** Update the CLI command reference for `blueprints generate` with the `--verbose` flag, and any guide or example that quotes `blueprints generate` output (the Blueprints runtime setup guide and the Slack effect example) to show the shorter default output.
59
+
60
+ - caa6a86: **BREAKING:** The `setStage` admin override is removed. Every stage move now
61
+ goes through a declared transition. This affects engine callers of
62
+ `workflow.setStage` or `Engine.setStage`, test suites that call
63
+ `bench.setStage`, operators who run `sanity workflows set-stage`, and
64
+ consumers of the diagnose `RemediationVerb` vocabulary. Calls to the removed
65
+ API fail to compile, and the CLI no longer recognizes `set-stage`.
66
+
67
+ - **Engine:** `workflow.setStage`, `Engine.setStage`, `SetStageArgs`, the
68
+ `REQUEST_TAG.setStage` request tag, and the `WorkflowStageSet` telemetry
69
+ event (`Workflows Engine Stage Set`) are removed. `WorkflowStageTransitioned`
70
+ now always reports `via: 'transition'`.
71
+ - **Test bench:** `bench.setStage` and `BenchSetStageArgs` are removed. Move a
72
+ test instance by firing the actions its transitions read, or by seeding the
73
+ content and fields they read and calling `bench.tick`.
74
+ - **CLI:** `sanity workflows set-stage` is removed.
75
+ - **Diagnose:** `RemediationVerb` replaces `'set-stage'` with `'tick'`. A
76
+ `failed-activity` diagnosis suggests only `reset-activity`. A
77
+ `no-transition-fires` diagnosis suggests `tick` once the content or fields
78
+ the intended transition reads are fixed, then `abort`. The CLI has no `tick`
79
+ command: the rationale tells operators to call `workflow.tick` from code, or
80
+ to let the next commit or a deployed heartbeat re-check. Code that switches
81
+ on `RemediationVerb` must handle `'tick'` and drop `'set-stage'`.
82
+ - **Studio plugin:** a stuck instance with no firing transition now says to
83
+ fix the content or fields the workflow needs instead of telling the editor to
84
+ move the workflow on themselves.
85
+
86
+ To recover an instance that `set-stage` used to move, fix the content or
87
+ fields its intended transition reads. Then re-check its transitions: call
88
+ `workflow.tick` from code, or wait for the next commit on the instance or a
89
+ tick from a deployed heartbeat. There is no CLI `tick` command. Reset a failed
90
+ activity with `sanity workflows reset-activity`, or abort the instance with
91
+ `sanity workflows abort`.
92
+
93
+ Stored instances keep working unchanged: history rows with `via: 'setStage'`
94
+ still parse, and the CLI and Studio still render them as forced moves.
95
+
96
+ **Docs impact:** `set-stage` must be purged from the docs completely. Remove
97
+ `setStage` and `set-stage` from the engine API and CLI
98
+ references, the test-bench guide, and any recovery guidance; update the
99
+ diagnose remediation reference to the new verb set; call out the removal and
100
+ the recovery path in the release notes.
101
+
102
+ - 0317021: `@sanity/workflow-engine` exports `ServiceReaderModelError` (`kind: 'service-reader-model'`), part of a deploy check against the data model of the unreleased Workflows service. The check runs only with the Workflows service switch on, which is off by default; with it off, `deployDefinitions`, `computeDiffEntries`, `sanity-workflows deploy` and `deploy --dry-run` behave as before and request nothing from `/workflow/*`.
103
+
104
+ **No upgrade action required.**
105
+
106
+ **Docs impact:** No docs change: the Workflows service is unreleased.
107
+
108
+ - 5c549dd: `sanity-workflows start` now accepts a bare Content Release name for a field declared as `release.ref`, for example `--field release=rA1b2C3d4`. The CLI builds the release ref on the one resource the deployment binds in `resourceAliases` other than its `workflowResource`, or on `workflowResource` when it binds no other. When the deployment binds several other resources, pick one with the new `--release-resource <alias>` flag, which names a `resourceAliases` binding; without it `start` fails and asks for the flag or the full JSON object, which keeps working as before. Values for other field kinds are unchanged.
109
+
110
+ **No upgrade action required.**
111
+
112
+ **Docs impact:** Update the CLI reference for `start --field` to show the bare release-name form and how the CLI picks the release's resource, including `--release-resource`.
113
+
114
+ - 4f5a100: A generated start watcher now starts a definition only on the write that makes its `start.filter` true: a create where the filter already holds, or an update that turns it from false to true. An edit to a document whose filter was already true no longer starts another instance, even when the edit changes a field the filter reads. A filter that evaluates to null counts as false, as it does in the engine. A document whose filter turns false and then true again still gets one instance for each time it becomes true. `start.filter` keeps its meaning, and definitions without one keep starting on create only.
115
+
116
+ A `start.filter` the trigger cannot evaluate the way the engine does starts on every matching write, each write deduplicated as before: one that reads `$now` or another document through `*[...]` or `->`; one that reads `$tag` or `$definition` and also reads the written document beyond `_type` (a field of it, or the whole document as `references()` does); and one the generator does not recognize as always evaluating to a boolean or null, such as a bare field like `slug.current`, `count(tags)`, or a `select(...)`, whose value the engine counts by truthiness. Only filters reading `$now`, another document, or the whole document already fired on every write. A `$tag`/`$definition` filter that reads a field, and an unrecognized filter that reads fields only, used to fire only on a write that changed one of those fields; their watcher now fires on every write to a matching document, so an edit to an unrelated field can start another instance while the filter holds. `sanity-workflows blueprints generate` now warns for each of these definitions which of those reasons applies and that a later matching write can start another instance for the same document. To avoid repeated starts, move the part the trigger cannot evaluate (the time, cross-document, or `$tag`/`$definition` condition) into a stage, rewrite an unrecognized filter as a boolean expression (comparisons, `&&`, `||`, `!`, `defined()`, `references()`) such as `count(tags) > 0` or `defined(slug.current) && slug.current != ""`, or self-host the start. `DeploymentPlan.unnarrowedStartFilters` is renamed `everyWriteStartFilters` and lists exactly these definitions, each with its reason; a filter that reads the whole document and no variable, such as `references("campaign-1")`, is now edge-detected and no longer listed.
117
+
118
+ To upgrade, update `@sanity/workflows` and `@sanity/workflows-cli`, run `sanity-workflows blueprints generate`, commit the regenerated files, and redeploy the stack with `sanity blueprints deploy`. Until you regenerate, `sanity-workflows deploy` stops because the generated tree differs and `sanity-workflows blueprints generate --check` fails in CI: the generated function manifests copy the package versions your project declares, and many definitions with a `start.filter` get a different trigger in `workflows.blueprint.ts`. The trigger filter is compiled into the deployed functions, so until you redeploy the stack they behave as before: an edit that changes a field the start filter reads keeps starting another instance while the filter holds, and a filter that reads the whole document keeps starting one on every edit. Instances already started are not removed.
119
+
120
+ **Docs impact:** The Functions runtime guide should say a start watcher starts a definition on the write that makes its start filter true, not on every matching write, list the filters that start on every matching write with the warning and its remedies, including the ones whose watcher widened, and tell existing users to regenerate and redeploy; the CLI's generated-runtime caveats in the `@sanity/workflows-cli` README already describe the new behaviour.
121
+
122
+ - f898a15: **BREAKING:** The 12 Workflows packages are replaced by four, split by where the code runs. `@sanity/workflows` holds the engine, the Blueprints generator and Functions runtime, condition descriptions, and the code agent tools call; it is what a Function installs. `@sanity/workflows-ui` holds the Studio plugin, React hooks, the Studio and App SDK adapters, components, and the diagram. `@sanity/workflows-cli` holds the `sanity-workflows` command. `@sanity/workflows-test` holds the test bench. Every user of a `@sanity/workflow-*` package or `@sanity/groq-condition-describe` is affected: the old packages no longer publish, so a project that keeps them stays on the last old release and gets no further fixes.
123
+
124
+ Each old entry point is now a subpath of a new package with the same exported names and behaviour. Stored data, the CLI command, and its flags do not change.
125
+
126
+ | Old | New |
127
+ | ------------------------------------- | ----------------------------------------------------------------- |
128
+ | `@sanity/workflow-engine` | `@sanity/workflows` |
129
+ | `@sanity/workflow-engine/define` | `@sanity/workflows/define` |
130
+ | `@sanity/workflow-engine/generate` | `@sanity/workflows/generate` |
131
+ | `@sanity/workflow-blueprint` | `@sanity/workflows/blueprints` |
132
+ | `@sanity/workflow-blueprint/generate` | `@sanity/workflows/blueprints/generate` |
133
+ | `@sanity/workflow-blueprint/runtime` | `@sanity/workflows/blueprints/runtime` |
134
+ | `@sanity/groq-condition-describe` | `@sanity/workflows/describe` |
135
+ | `@sanity/workflow-mcp` | `@sanity/workflows/agents` |
136
+ | `@sanity/workflow-studio-plugin` | `@sanity/workflows-ui/studio-plugin` |
137
+ | `@sanity/workflow-studio` | `@sanity/workflows-ui/studio` |
138
+ | `@sanity/workflow-react` | `@sanity/workflows-ui/react` |
139
+ | `@sanity/workflow-react/observer` | `@sanity/workflows-ui/react/observer` |
140
+ | `@sanity/workflow-sdk` | `@sanity/workflows-ui/sdk` |
141
+ | `@sanity/workflow-sdk/observer` | `@sanity/workflows-ui/sdk/observer` |
142
+ | `@sanity/workflow-sdk/project-users` | `@sanity/workflows-ui/sdk/project-users` |
143
+ | `@sanity/workflow-components` | `@sanity/workflows-ui/components` |
144
+ | `@sanity/workflow-diagram` | `@sanity/workflows-ui/diagram` |
145
+ | `@sanity/workflow-cli` | `@sanity/workflows-cli` (the command is still `sanity-workflows`) |
146
+ | `@sanity/workflow-engine-test` | `@sanity/workflows-test` |
147
+
148
+ `@sanity/workflows-ui` has no root entry point; import from a subpath. `sanity`, `@sanity/sdk`, `@sanity/sdk-react`, `react-dom`, and `styled-components` are optional peer dependencies of `@sanity/workflows-ui`, so an App SDK app does not install Studio. `@sanity/blueprints-resource-workflow` now peers on `@sanity/workflows` instead of the engine and blueprint packages.
149
+
150
+ To upgrade:
151
+
152
+ 1. Run `npx @sanity/workflows-cli codemod packages --dry-run` to see the changes, then `npx @sanity/workflows-cli codemod packages` to apply them. It rewrites imports and `package.json` dependencies and lists any package name it could not rewrite safely.
153
+ 2. Install dependencies.
154
+ 3. If the project has a generated blueprint, run `sanity-workflows blueprints generate`, so every Function imports `@sanity/workflows` and its `package.json` lists it, then deploy the Functions and the heartbeat stack. Until you regenerate, `deploy` and `blueprints generate --check` report the generated tree as out of date.
155
+ 4. Typecheck.
156
+
157
+ `codemod packages` never edits lockfiles or generated blueprint files.
158
+
159
+ **Docs impact:** Replace every install command, import, and package name in the Workflows docs and examples with the new names, and add an upgrade guide with the table above and the four steps. Add `codemod packages` to the CLI command reference. Update the release notes with the new package list, and point the reference docs at the four new package names.
160
+
161
+ ### Patch Changes
162
+
163
+ - 3c92b4a: The Blueprint files and function shells that `sanity-workflows blueprints generate` writes work with `@sanity/blueprints` 0.31. Neither package's exports change.
164
+
165
+ **No upgrade action required.** `@sanity/blueprints` is not a dependency of either package, and the generated files do not record its version: your project keeps the version it declares, and moving it to 0.31 does not require regenerating.
166
+
167
+ **Docs impact: None.** Compatibility with `@sanity/blueprints` 0.31 needs no documentation change.
168
+
169
+ - 2f32af1: Workflow authoring help and package documentation now match what the engine
170
+ and commands accept.
171
+
172
+ - `START_FILTER_VARS` no longer tells authors to scan with `tag == $tag`, which
173
+ never matches: start-filter scans already cover only the engine's partition,
174
+ and their rows carry only `definition`, `subject`, and `completedAt`. The
175
+ `$tag` entry's description, which editor completion shows, now gives a scan
176
+ that works:
177
+ `count(*[definition == $definition && !defined(completedAt)]) < 3`. `$tag`
178
+ stays bound as before.
179
+ - The MCP authoring guide (`workflows_get_authoring_guide`) now teaches
180
+ subworkflows: action `spawn`, `lifecycle: 'child'`, `$row`, `$subworkflows`,
181
+ the explicit completion gate, and a parent and child validated together. It
182
+ also explains that a transition whose `when` cannot be evaluated holds the
183
+ stage: no later transition fires, and once the missing value is set the
184
+ next cascade checks the transitions again. When every activity in the stage
185
+ is resolved, `workflows_diagnose` reports the hold as the recoverable
186
+ `transition-unevaluable` stuck cause, even when a later transition is
187
+ satisfied, because that transition does not fire until the held ones
188
+ resolve.
189
+ - `sanity-workflows blueprints generate` and the `@sanity/workflows/blueprints`
190
+ guide no longer say that without the heartbeat stack `$now` deadlines never
191
+ pass, a spawning parent never advances, and a stalled effect is never
192
+ retried. A settling child re-evaluates its parent directly. Without the
193
+ heartbeat, nothing checks these on a schedule: a deadline or a parent that
194
+ missed a child settling waits until another engine call evaluates it, and a
195
+ stalled effect waits until a later drain picks it up. The needs report and
196
+ `HeartbeatSpec.reasons` likewise stop saying the heartbeat re-evaluates a
197
+ parent when a child settles. The spawning reason now reads
198
+ `re-evaluates spawning parents`, and a self-hosted spawning definition is
199
+ listed as a parent to re-evaluate after it misses a child settling.
200
+ - `sanity-workflows` help examples use the definition name `product-launch`
201
+ instead of `productLaunch`, a name the definition-name grammar rejects, so no
202
+ deployed definition can carry it.
203
+ - The `@sanity/workflows/agents` guide and the `@sanity/workflows-cli` README no longer
204
+ reference unpublished source files or repository-only commands.
205
+ - The `driverKind` documentation names `person`, `agent`, and `service` as the
206
+ values new `actionFired` entries record. The `ActivityEntry.filterEvaluation`
207
+ documentation says that it is a write-once record no engine API reads back.
208
+
209
+ **No upgrade action required.** No definition, stored document, or command
210
+ behaves differently; only help, report, and documentation wording changes.
211
+
212
+ **Docs impact:** Update start-filter guidance wherever it shows `tag == $tag`
213
+ inside a `*[...]` scan; update the MCP authoring and subworkflow guides to
214
+ cover spawning, the unevaluable-transition hold, and its recoverable
215
+ `transition-unevaluable` diagnosis; use `product-launch` in CLI
216
+ examples; describe `filterEvaluation` as a write-once stored record; and
217
+ where the generated-runtime guide lists what happens without the heartbeat
218
+ stack, say that deadlines and a parent that missed a child settling wait for
219
+ another engine call and a stalled effect waits for a later drain, rather than
220
+ that they stay stuck.
221
+
222
+ - 450fd4e: `sanity-workflows blueprints generate` and the runtime it generates are no longer labelled experimental or not ready for production, in the command's help text or in the package READMEs. The generated runtime carries the same prerelease status as the rest of Workflows; the command, its output, and its behavior are unchanged.
223
+
224
+ **No upgrade action required.**
225
+
226
+ **Docs impact:** Remove the experimental or not-ready-for-production labelling of runtime generation from the published Workflows documentation, such as the "Experimental generator" callout, and state no separate status for it; Workflows' prerelease guidance already covers it.
227
+
228
+ - 7623b3e: Engines no longer call the Workflows service unless the experimental Workflows service switch is on, and it is off by default. While it is off, every instance write commits directly, and `deployDefinitions`, `computeDiffEntries`, `sanity-workflows deploy` and `deploy --dry-run` skip the service data-model check, so nothing requests `/workflow/*`. Write routing and that check are experimental.
229
+
230
+ **No upgrade action required.**
231
+
232
+ **Docs impact:** No docs change: the Workflows service is unreleased.
233
+
234
+ - Updated dependencies [bb9c414]
235
+ - Updated dependencies [ceac057]
236
+ - Updated dependencies [ceac057]
237
+ - Updated dependencies [3c92b4a]
238
+ - Updated dependencies [0cb1f0c]
239
+ - Updated dependencies [74aa45f]
240
+ - Updated dependencies [2f32af1]
241
+ - Updated dependencies [ddb8c65]
242
+ - Updated dependencies [6c4beff]
243
+ - Updated dependencies [f20e083]
244
+ - Updated dependencies [ba999be]
245
+ - Updated dependencies [9c085c8]
246
+ - Updated dependencies [e5676c7]
247
+ - Updated dependencies [025df76]
248
+ - Updated dependencies [cdd07a3]
249
+ - Updated dependencies [4f5a100]
250
+ - Updated dependencies [393526c]
251
+ - Updated dependencies [393526c]
252
+ - Updated dependencies [0984e59]
253
+ - Updated dependencies [7e9a9e1]
254
+ - Updated dependencies [71e3f25]
255
+ - Updated dependencies [e0251b7]
256
+ - Updated dependencies [429bf8a]
257
+ - Updated dependencies [a1fc434]
258
+ - Updated dependencies [10b3f0c]
259
+ - Updated dependencies [e0251b7]
260
+ - Updated dependencies [c65f2ae]
261
+ - Updated dependencies [21b3e35]
262
+ - Updated dependencies [7239b6e]
263
+ - Updated dependencies [caa6a86]
264
+ - Updated dependencies [21b3e35]
265
+ - Updated dependencies [393526c]
266
+ - Updated dependencies [0317021]
267
+ - Updated dependencies [4f5a100]
268
+ - Updated dependencies [3019624]
269
+ - Updated dependencies [3d52a62]
270
+ - Updated dependencies [621c963]
271
+ - Updated dependencies [1a3238d]
272
+ - Updated dependencies [3060871]
273
+ - Updated dependencies [7623b3e]
274
+ - Updated dependencies [f898a15]
275
+ - @sanity/workflows@0.0.0-pr-744-20261109125055
276
+
277
+ ## 0.37.0
278
+
279
+ ### Minor Changes
280
+
281
+ - 6304d4a: `sanity-workflows start` and the instance commands (`fire-action`, `abort`, `set-stage`, `reset-activity`, `diagnose`, and the diagnosis in `show`) now accept runtime-supplied refs to any resource the deployment binds in `resourceAliases`, in another dataset or another project. A release or subject ref outside the workflow resource no longer fails with `RefResourceUndeclaredError` when its resource is bound. Clients for the bound resources reuse the CLI's existing token and API host, so that one login must be a member of every bound project. A ref to a resource the deployment does not bind still fails with `RefResourceUndeclaredError`.
282
+
283
+ `@sanity/workflow-engine` exports `deploymentResourceClients({client, deployment})`, which builds the same `resourceClients` resolver from a deployment's `resourceAliases` and any client with `withConfig`, for hosts other than the CLI.
284
+
285
+ **No upgrade action required.** To start a workflow whose content lives in another dataset or project, add that resource to the deployment's `resourceAliases` in `sanity.workflow.ts`; the definition does not need to reference the alias.
286
+
287
+ **Docs impact:** Update the CLI reference and configuration guide where they say the CLI admits runtime refs to the workflow resource only, the declared resource surface section of the engine reference, and the cross-dataset setup guidance; document `deploymentResourceClients` in the engine API reference.
288
+
289
+ - b76627b: The Workflows CLI now finds `sanity.workflow.ts` (or `.js`/`.mjs`) from any subdirectory of your project, the same way the `sanity` and `sanity blueprints` CLIs find their config. It looks in the working directory, then in each parent directory, and uses the first config it finds. Every command that reads the config also accepts `--path`, which names a config file directly, or a directory to start the upward search from. `blueprints generate` writes, and `deploy` checks, the generated Blueprint files next to the config file, not in the directory you ran the command from. Telemetry reports `--path` by name only, never its value.
290
+
291
+ **No upgrade action required.** A command run from the directory that holds the config behaves as before. A command run from a directory without one now uses the nearest parent's config instead of failing.
292
+
293
+ **Docs impact:** Update the CLI configuration section and command reference to describe the upward search, the `--path` flag, and where generated Blueprint files are written.
294
+
295
+ - b5a24c0: The Workflows CLI's topics are now plural, matching the Sanity CLI's own topics such as `datasets`, `documents`, and `blueprints`: `sanity workflows definitions list | show | diff | delete | validate` and `sanity workflows blueprints generate`. The singular `definition` and `blueprint` still run the same commands as hidden aliases with no warning, so existing scripts and CI jobs keep working. Help, examples, and suggested next commands print the plural form. Generated Blueprint files keep their existing `Generated by` header, so `blueprints generate --check` and `deploy` report no drift after upgrading. A telemetry logger you supply through `sanity.workflow.ts` now receives `commandArguments` such as `['definitions', 'list']`, whichever spelling was typed.
296
+
297
+ **No upgrade action required.** Switch scripts and docs to `definitions` and `blueprints` when convenient. If you filter your own telemetry on `commandArguments`, match the plural topics as well as the singular ones.
298
+
299
+ **Docs impact:** Update the CLI command reference, guides, and examples that show `definition …` or `blueprint generate` to the plural `definitions …` and `blueprints generate`, and mention that the singular still works.
300
+
301
+ - 8196fbe: The needs report printed by `sanity-workflows blueprints generate` is shorter and lists facts only: which functions are generated and what each runs. It no longer prints trigger filters or how the heartbeat works. The heartbeat line reads "a scheduled function ticks deadlines each minute, subject to plan cadence, and re-queues effects no drain picked up", adjusted to what the deployment needs.
302
+
303
+ **No upgrade action required**, unless a script parses the report's lines; update it to the new wording.
304
+
305
+ **Docs impact:** Replace the example report in the CLI guide's blueprint generation section, which now keeps the prerequisites and the drift check only.
306
+
307
+ - ae64320: The Workflows CLI's read commands (`list`, `show`, `tail`, `diagnose`, `definitions list`, and `definitions show`) can now inspect one resource you name, with or without a `sanity.workflow.ts`. They take the Sanity CLI's own targeting flags: `--project-id <id>` and `--dataset <name>` (`-p` and `-d`) together for a dataset, or `--media-library-id <id>` for a media library. With these flags the CLI loads no config and reads only that resource, so they can't be combined with `--deployment` or `--path`; `--partition` still filters. Commands that write keep acting through a deployment in `sanity.workflow.ts` and don't accept these flags. `list`'s help no longer says it reads "the configured dataset".
308
+
309
+ **No upgrade action required.** Without the new flags, every command reads the resources `sanity.workflow.ts` declares, as before.
310
+
311
+ **Docs impact:** Add the targeting flags to the CLI reference for the six read commands, and to the guide that explains how reads choose their resources, including that write commands still need a config.
312
+
313
+ - 9ec15d6: `sanity-workflows deploy` now warns before deploying to the
314
+ `default` partition of a workflow resource whose definitions are all in
315
+ other partitions. This is what happens when an upgrade deletes a
316
+ deployment's `tag` instead of renaming it to `partition`: the deploy would
317
+ target `default`, and the workflows in the old partition would disappear
318
+ from that deployment. The warning names the partitions that hold
319
+ definitions and the `partition` value to set. In an interactive terminal,
320
+ `deploy` then asks whether to continue: Enter continues, and answering no
321
+ exits before anything is written. A `--dry-run` or a non-interactive run, such as CI, prints the
322
+ warning and continues.
323
+
324
+ `@sanity/workflow-engine` now exports `DEFAULT_PARTITION`, the partition
325
+ name (`'default'`) a deployment uses when it omits `partition`.
326
+
327
+ **No upgrade action required.** Deployments that set `partition`, and
328
+ resources where `default` already has definitions, behave as before.
329
+
330
+ **Docs impact:** Add the warning and confirmation to the CLI `deploy`
331
+ reference, and to the `tag` → `partition` upgrade guidance as the check
332
+ that catches a deleted `tag`.
333
+
334
+ - cbf4180: `sanity-workflows deploy` now prints a one-line-per-deployment
335
+ summary of the Sanity Functions the selected deployments need when no
336
+ generated runtime sits beside the config, instead of the full needs report.
337
+ The summary counts each deployment's effect drains, heartbeats, and start
338
+ watchers, and the hint that follows still names `blueprints generate` on every
339
+ run. Both cover only the deployments the run selects: a `--deployment` whose
340
+ definitions need no functions prints nothing about the runtime, even when
341
+ another deployment in the config does.
342
+
343
+ `deploy --verbose` prints the full needs report in place of the summary, so
344
+ the report can be read without `blueprints generate` writing a tree. Nothing
345
+ is written to disk in either mode. In a terminal, the report and the hint
346
+ now wrap to the terminal's width with each line's indent kept on its
347
+ continuation lines, in both `deploy` and `blueprints generate`; piped output
348
+ is not wrapped.
349
+
350
+ **Upgrade action:** a script that parses the full needs report from `deploy`
351
+ output must add `--verbose` to keep receiving it. Interactive use needs no
352
+ change.
353
+
354
+ **Docs impact:** Update the CLI `deploy` reference where it quotes the
355
+ runtime-needs output, and add `--verbose` to the flag list.
356
+
357
+ - 3594e60: **BREAKING:** `computeDiffEntries` in `@sanity/workflow-engine` now takes a full `WorkflowClient` instead of a client with only `fetch`. Any `@sanity/client` instance already satisfies it. A caller passing a fetch-only object stops compiling, and a client without `request` throws at runtime when a definition references project roles; pass the real client.
358
+
359
+ `sanity-workflows deploy --dry-run` now runs every check a real deploy runs before its first write: structural validation, the reader-floor acknowledgement, the project role catalog check, and spawn-contract and dependency ordering. A batch that references a role the project does not have, or a spawn reference a deploy would reject, fails the dry run with the same error the deploy prints. The dry run also prints the non-blocking warnings the deploy would print beneath each definition, such as a referenced role with no current holder, and `DiffEntry` carries them as `warnings`. Diff entries come back in deploy order, children before parents.
360
+
361
+ CLI users have **no upgrade action**. A dry run that used to pass and now fails names a definition the real deploy was already rejecting.
362
+
363
+ **Docs impact:** Update the CLI deploy reference where it describes `--dry-run` as a preview, so it states that the dry run rejects the same batches a deploy rejects, and the engine API reference for `computeDiffEntries` for the client requirement.
364
+
365
+ - e3ae1ab: **BREAKING:** Code that addresses a workflow deployment uses `partition`
366
+ instead of `tag`. `createEngine`, the SDK and Studio adapter hooks,
367
+ `createBench`, raw workflow verb arguments, MCP tool inputs, and the MCP
368
+ `createWorkflowEngine` address reject `tag`.
369
+ Anyone calling these APIs directly is affected. Until you replace
370
+ `tag: 'prod'` with `partition: 'prod'`, each call throws a migration error
371
+ before any read or write. Upgrade the runtime packages together, pass
372
+ `partition`, and read `engine.partition` / `bench.partition` instead of `.tag`.
373
+ Keep the exact existing value: omitting a non-default value targets different
374
+ data.
375
+
376
+ Update these renamed code APIs at the same time:
377
+ - Engine: `validateTag` → `validatePartition`, `tagScopeFilter` →
378
+ `partitionScopeFilter`, `deployedTagsGroq` → `deployedPartitionsGroq`,
379
+ `definitionTagsGroq` → `definitionPartitionsGroq`, and `StartScope.tag` →
380
+ `StartScope.partition`.
381
+ - Test bench: `BENCH_TAG` → `BENCH_PARTITION` and `CreateBenchOptions.tag` →
382
+ `CreateBenchOptions.partition`.
383
+ - MCP: the discovery tool is `workflows_list_partitions` and returns
384
+ `{partitions: [...]}`. The exports `LIST_WORKFLOW_TAGS_TOOL_NAME`,
385
+ `LIST_WORKFLOW_TAGS_DESCRIPTION`, and `WORKFLOW_TAG_DESCRIPTION` are now
386
+ `LIST_WORKFLOW_PARTITIONS_TOOL_NAME`, `LIST_WORKFLOW_PARTITIONS_DESCRIPTION`,
387
+ and `WORKFLOW_PARTITION_DESCRIPTION`. `workflowAddressFromInput` returns
388
+ `partition`.
389
+ - Blueprint runtime (`@sanity/workflow-blueprint/runtime`): `createRuntime`
390
+ requires the deployment `name`; a hand-built deployment object must add the
391
+ configured `name` beside `partition`.
392
+ - CLI: display-row JSON uses `partition`. `list`, `show`, `tail`,
393
+ `definitions list`, and `definitions show` accept `--deployment`, exclusive
394
+ with `--partition`. When an instance ID or definition name is found in
395
+ several deployments, an interactive terminal prompts for one; with `--json`
396
+ or in a non-interactive shell the command fails naming each candidate as
397
+ `name (dataset)` and asks for `--deployment` instead of `--partition`.
398
+ Scripts that matched the old "pass --partition" message should pass
399
+ `--deployment`.
400
+
401
+ Content Lake `tag` fields, IDs, references, stored GROQ `$tag` bindings, and
402
+ HTTP request tags stay unchanged. No data migration is needed.
403
+
404
+ Configuration you edit rather than call keeps working. A deployment `tag` in
405
+ `sanity.workflow.ts` or `defineWorkflows`, a `tag` in `workflowStudioPlugin`
406
+ options, and the `--tag` / `--all-tags` CLI flags are deprecated. Each
407
+ addresses the same partition and shows a warning naming the replacement: the
408
+ CLI on stderr, the Studio plugin in the browser console, and `defineWorkflows`
409
+ in the console during Blueprint manifest evaluation. The Blueprints provider
410
+ accepts a deprecated deployment `tag` the same way and reports the
411
+ warning in the deploy log. `defineWorkflowConfig` itself prints nothing; it
412
+ returns each message in the new `WorkflowConfig.warnings` array, so code that
413
+ loads a config directly decides where to show them. **No upgrade action required** for
414
+ these yet. Rename them to `partition` (or `--partition` / `--all-partitions`),
415
+ keeping the exact existing value, before the deprecated forms are removed.
416
+ Deleting a `tag` instead of renaming it moves the deployment to the `default`
417
+ partition, where its existing workflows no longer appear. A
418
+ `tag` that is not a string, or that disagrees with an explicit `partition`,
419
+ fails rather than falling back to `default`.
420
+
421
+ A deployment you configure in `sanity.workflow.ts` or `defineWorkflows` may
422
+ now omit `partition` when it is alone on its workflow resource, and then uses
423
+ `default`. Multiple deployments on one resource require explicit, distinct
424
+ partitions. `workflowStudioPlugin`'s `partition` is optional too and defaults
425
+ to `default`, and `createRuntime` resolves a deployment that omits it the same
426
+ way. Other code APIs do not: `createEngine`, `useWorkflowEngine` and the other
427
+ adapter hooks, raw verb arguments, and MCP tool inputs still require
428
+ `partition`, and `createBench` uses `BENCH_PARTITION` (`bench`) when you omit
429
+ it. When the plugin finds no
430
+ definitions in its partition, it logs a
431
+ browser console warning naming the partitions that do hold definitions on that
432
+ resource, so a mistyped or forgotten `partition` no longer leaves Studio empty
433
+ without explanation.
434
+
435
+ `sanity-workflows blueprints generate` now names each deployment's functions
436
+ and robot token after the deployment `name` instead of its tag (for example
437
+ `wf-prod-runtime` and `wf-prod-start-production-creates` for a deployment named
438
+ `prod`), while runtime scope and filters use `partition`. Upgrade the provider first so it can
439
+ read old serialized state, then regenerate and inspect the Blueprint plan
440
+ before deploying. If a deployment name differs from its old tag, generated
441
+ resources are replaced: plan for the interruption, preserve authored handlers,
442
+ and retire old watchers and schedules.
443
+
444
+ **Docs impact:** Update deployment addressing concepts, engine and adapter API
445
+ references (including `WorkflowConfig.warnings`), CLI flags and JSON output
446
+ (including `--deployment` and the ambiguity prompt on the read commands), MCP
447
+ discovery and exported constants, Studio setup examples (the optional
448
+ `partition` and the empty-partition console warning), generated Blueprint
449
+ function names and rollout guidance, and prerelease migration notes using
450
+ `docs/partition-migration.md`.
451
+
452
+ - bc9c045: `sanity-workflows blueprints generate`, `blueprints generate --check` and `sanity-workflows deploy` now report a stale function directory: a directory under the generated `functions/` tree whose `index.ts` carries the generator's header but which the current definitions no longer produce, such as the directory a renamed start watcher leaves behind. `blueprints generate` lists it with the instruction to remove it. `deploy` prints a warning naming it and continues, because the generated blueprint lists each function by its `src` and does not deploy the directory. A directory whose `index.ts` has no generator header is treated as your own and is never reported.
453
+
454
+ `blueprints generate --check` now exits non-zero when a stale function directory is present, naming it, so a CI job that passed before can fail after the upgrade. Remove each directory it names (for example `rm -r functions/wf-prod-start-production-article-review`, left behind when the `article-review` definition, which had a start watcher of its own, is renamed) and the check passes again.
455
+
456
+ **Docs impact:** Update the CLI guide's `blueprints generate` and drift-check sections and the deploy alignment section to describe stale function directories, the `--check` failure, and the deploy warning.
457
+
458
+ - 9fba4cf: The CLI adds `sanity-workflows definitions validate <file...>`, which checks workflow definitions written as JSON files without a `sanity.workflow.ts` config, a login, or network access. Each file holds one definition or an array of them, in authoring shape or as stored content read back from a deploy. Pass several files to check a parent and its child workflows together. Once every file is read, the command prints one line per valid definition and exits non-zero with every problem listed, path-prefixed, when any definition is invalid. `--json` prints the same `{valid, results}` report the MCP `workflows_validate_definition` tool returns. A file that cannot be read, is not valid JSON, or does not hold definition objects stops the command before validation with a non-zero exit and a text error, with or without `--json`. Use it to run a generate, validate, and fix loop from an agent harness that does not use the Workflows MCP server.
459
+
460
+ `@sanity/workflow-engine` exports `validateDefinitionInputs`, the check both the CLI command and the MCP validate tool run, with its `ValidateDefinitionInputResult` and `ValidateDefinitionInputsResult` result types. It covers shape, cross-field rules, and GROQ syntax. Deploy still runs further checks: duplicate names, spawn dependencies, resource bindings, project roles, and the reader-model acknowledgement. The MCP server's `ValidateDefinitionResult` and `ValidateDefinitionsResult` types are now aliases of those engine types, with an unchanged shape.
461
+
462
+ **No upgrade action required.** Existing commands, the MCP validate and deploy tools, and `deploy --check` behave as before.
463
+
464
+ **Docs impact:** Add `definitions validate` to the CLI command reference, with its JSON-file input and `--json` output. Add `validateDefinitionInputs` to the engine API reference. Mention the command in the definition authoring guide as the validate step for agents that do not use the MCP server.
465
+
466
+ ### Patch Changes
467
+
468
+ - af41ca9: The Workflows monorepo now uses TypeScript 7 as its default compiler. The
469
+ installed CLI and published workflow declarations continue to work in projects
470
+ using TypeScript 6 or TypeScript 7, including Blueprint generation and
471
+ definition checks. Blueprint generation also works without an installed
472
+ TypeScript package, and the CLI no longer installs a separate TypeScript 6
473
+ compiler for that command.
474
+ The MCP `./stdio` entry can now be loaded from CommonJS through its `require`
475
+ condition.
476
+
477
+ **No upgrade action required.** Keep the TypeScript version your project uses.
478
+
479
+ **Docs impact:** Update the MCP stdio reference with the CommonJS entry and
480
+ release guidance with the TypeScript 6/7/no-TypeScript compatibility result and
481
+ the CLI dependency change.
482
+
483
+ - ce08657: When `definitions list`, `list`, or `definitions show` finds nothing, the message now says where the CLI looked: the partition (or `any partition`), the resource, and the deployment when `--deployment` selected it. For example, `no definitions in partition trial-2 of p1.production (deployment my-workflow)` replaces `no definitions found`, so a search scoped to the wrong partition is visible at once. `definitions show` and `show` now report a missing definition or instance as one red `✖` line, like the CLI's other errors, without oclif's `› Error:` framing; both still exit with code 1. `--json` output is unchanged.
484
+
485
+ **No upgrade action required.** Scripts that match the old human-readable text (`no definitions found`, `no instances match`) should match the new wording or use `--json`.
486
+
487
+ **Docs impact:** None. The CLI docs don't quote these messages.
488
+
489
+ - 4a561b5: `sanity workflows show --include history` now says what each history row is about. Rows name the stage, activity and action, transition, effect, or field involved, plus the acting user's id, for example `Stage entered: review (by <user-id>)` or `Transition fired: to-review, drafting → review (by <user-id>)`. Forced stage moves read `(forced: <reason>)`, and actions fired automatically read `(triggered)` with no user named. `--json` output is unchanged.
490
+
491
+ No upgrade action required.
492
+
493
+ **Docs impact: None** — the CLI reference (`docs/reference.md`) lists `show --include history` without example output, so no published text describes the old rows.
494
+
495
+ - efdddcf: Built-in telemetry from the CLI and the MCP server now includes the sending package's version as `context.packageVersion` on every event, as SDK telemetry already does. This lets analytics count CLI and MCP events by package version. Before this change, the version was sent only as a once-per-session user property (`cliVersion` for the CLI, `packageVersion` for MCP), and per-event analytics did not read it. When the CLI runs inside the Sanity CLI as `sanity workflows`, both the new per-event version and the `cliVersion` user property now report the `@sanity/workflow-cli` version. Previously they reported the Sanity CLI's version.
496
+
497
+ **No upgrade action required.** Events from earlier releases still carry no per-event version.
498
+
499
+ **Docs impact:** Update the telemetry reference for the CLI and MCP server to list `context.packageVersion` with the other per-event context fields.
500
+
501
+ - 8b07665: Every next command the Workflows CLI suggests can now be copied and run as
502
+ printed. The `fire-action` action list, the `nuke --instance` abort-first
503
+ refusal, the definition-sharing reminder after `deploy`, and the "run
504
+ `blueprints generate`" hints now start with the binary actually running
505
+ (`sanity-workflows …`, or `sanity workflows …` inside the Sanity CLI) and repeat
506
+ the `--deployment`, `--partition`, or `--all-partitions` selection from the
507
+ current run. A copied hint no longer stops at the deployment picker or fails
508
+ with "Multiple deployments configured".
509
+
510
+ **No upgrade action required.**
511
+
512
+ **Docs impact:** Update any CLI guide or reference example that shows the
513
+ `fire-action` list output, the sharing reminder, or the `blueprints generate`
514
+ hint, so the printed commands match the full form, and any page that says the
515
+ commands run only through the standalone `sanity-workflows` binary: they also
516
+ run as `sanity workflows …`, though `sanity --help` does not list them yet.
517
+
518
+ - 24ef514: The standalone CLI (`npx @sanity/workflow-cli …` or `sanity-workflows …`) no longer prints stack traces when a command is mistyped. An unexpected argument, a missing required argument, or a similar mistake now shows the error and the command's usage, then exits with code 2, the same as under `sanity workflows …`.
519
+
520
+ **No upgrade action required.**
521
+
522
+ **Docs impact:** None. The docs don't describe error output for mistyped commands.
523
+
524
+ - be42dc8: CLI telemetry now records every logged-in run, subject to the existing consent, CI, and `DO_NOT_TRACK` rules. Before, it sent nothing unless a `sanity.workflow.ts` with a dataset-backed deployment was found, so runs that named a resource with `--project-id`/`--dataset` or `--media-library-id`, runs in a directory without a config, and configs with only media library or canvas deployments went unrecorded. Events are attributed to the `--project-id` and `--dataset` a run names, else to the config's first dataset-backed deployment, else to no project; the session's `projectId` and `dataset` properties are left out when no project is known. Events now go to the global Sanity API host instead of the project hostname, as the Sanity CLI's own telemetry does.
525
+
526
+ No upgrade action required.
527
+
528
+ **Docs impact:** The CLI README's Telemetry section and its session-properties table are updated in this change; no other docs describe when CLI telemetry sends.
529
+
530
+ - a20e311: The published description of the `Workflows CLI Command Executed` trace now says that each flag used is reported in its canonical long form: an option flag as `--name=value`, and a boolean, redacted, or undeclared flag by its name only. The previous release's changelog note said that the CLI does not send flag values; that note was wrong, and the way the CLI reports flags is unchanged since that release.
531
+
532
+ **No upgrade action required.**
533
+
534
+ **Docs impact:** Update the CLI telemetry reference so its description of `extraArguments` on the `Workflows CLI Command Executed` trace matches the canonical `--name=value` form and lists the flags reported by name only.
535
+
536
+ - 38ede99: A deploy or dry run that fails now prints its error once. The spinner line names the failure (`Deploy failed` or `Diff failed`) and the message follows it a single time, with no `Error:` framing and no stack trace. Unknown project roles are reported as one line per definition and role, with a reference count and up to five referencing paths, and the message ends with what to do: create the roles in the project or change the definitions. Roles read by a condition, including the role lists on actions that the engine folds into a condition, are reported at their condition site (for example `stage "review" activity "approve" action "approve".filter`) instead of as `generated role condition`.
537
+
538
+ The engine now throws `UnknownProjectRolesError` (`kind: 'unknown-project-roles'`) for that rejection, carrying `projectId` and `unknown`, one entry per definition and role with every referencing path. Consumers that matched the previous plain `Error` message text should switch to the class or the `kind`.
539
+
540
+ **No upgrade action required.** The message text changed, so anything that parsed the old per-reference lines needs updating.
541
+
542
+ **Docs impact:** Add `UnknownProjectRolesError` to the engine error reference, and update the CLI deploy guide where it shows a failed deploy's output.
543
+
544
+ - 1d37767: `diagnoseInstance` no longer reports `progressing` when an unevaluable transition holds a stage whose activities are all resolved. This applies to every surface built on it: `workflows_diagnose` in the MCP server, the CLI `diagnose` command, and the Studio plugin's instance fault. When a transition's `when` evaluates to GROQ `null` (for example, it reads a field that hasn't been written yet) and a transition declared after it is satisfied, the engine stays in the stage until the value is written. Once every activity in the stage is resolved, the diagnosis now reports this as `stuck` with the recoverable cause `transition-unevaluable`, naming the unevaluable transitions declared before the satisfied one. When the held transition reads a referenced document that is missing, the diagnosis reports `document-missing` for that document instead, and `blockingMissingDocuments` on the evaluation lists it. Transition selection itself is unchanged. The text for this cause in `workflows_diagnose`, CLI `diagnose`, and the Studio plugin no longer promises the instance advances on its own: once the data is written, the next engine tick or commit re-checks the held transitions, and the instance advances only if a transition is then satisfied.
545
+
546
+ **No upgrade action required.**
547
+
548
+ **Docs impact:** Update the published diagnose guidance and the `StuckCause` reference to say that, once every activity in the stage is resolved, `transition-unevaluable` is reported whenever an earlier unevaluable transition holds the stage, including when a later transition is satisfied, and that a missing document read by that held transition is reported as `document-missing`; the MCP authoring guide's transition paragraph should say the same.
549
+
550
+ - f6bcbaf: `nuke --instance` now refuses to delete an instance that is still in flight and
551
+ tells you to abort it first. Before this fix the check never fired, so the
552
+ command offered to delete a running instance, and `--force` deleted it without
553
+ cancelling its pending effects or condemning its child instances.
554
+
555
+ **No upgrade action required.** Abort a running instance with `abort` before
556
+ deleting it with `nuke --instance`.
557
+
558
+ **Docs impact:** None. The CLI reference already describes `nuke --instance` as
559
+ refusing in-flight instances; this change makes the command match it.
560
+
561
+ - 816ceac: `workflows nuke --partition` now names the definitions it will delete and states the total before it asks for confirmation. Under the plan table, a `definitions:` line lists each definition name with its versions, with consecutive versions shown as a range, for example `definitions: article-review (v1–v3, v5)`. The line is omitted when the partition has no definitions. A sentence such as `This will delete 2 instances and 1 definition from partition "prod".` follows, and prints with `--force` too. That sentence and the success line after the delete now name only the document types with something to delete, joined with "and". `nuke --instance` output is unchanged.
562
+
563
+ **No upgrade action required.** Scripts that parse nuke output should expect the two new lines.
564
+
565
+ **Docs impact:** Update the CLI reference's `nuke` example output to show the `definitions:` line and the total sentence.
566
+
567
+ - f6bcbaf: `nuke` reports what it deleted in plainer words. `nuke --instance` prints
568
+ `Deleted instance <id>.`, adding `and its guard` or `and its N guards` only
569
+ when guards were deleted. A partition delete prints `Deleted from partition "<partition>": …`
570
+ without the dataset count, which the plan table above it already shows. An
571
+ empty partition reports `Nothing to delete in partition "<partition>".`
572
+
573
+ **No upgrade action required.** Scripts that match the old `Nuked partition`
574
+ or `guards across` wording need updating.
575
+
576
+ **Docs impact:** None. No guide or reference quotes these lines.
577
+
578
+ - d5ecb28: What `createRuntime` keeps from `createRuntimeEngine`, what `runtime.start` requires, and the heartbeat's documented limits:
579
+ - `runtime.engine` runs the handlers in `createRuntime`'s `effects`, as `createRuntimeEngine`'s engine ran its `effects` handlers. Its `drainEffects` fails on a pending effect the registry lacks unless `names` leaves that effect out.
580
+ - `runtime.drain` stamps history rows and telemetry with the `drainer` execution kind, as generated drains did. `runtime.heartbeat`, `runtime.start` and `runtime.engine` stamp `server`.
581
+ - `runtime.start` references the subject in the project and dataset that the function context's `clientOptions.projectId` and `clientOptions.dataset` name. It throws a `ContractViolationError` when either is missing. Sanity document functions always supply both.
582
+ - The README and the `Runtime.heartbeat` reference state the heartbeat's limits: an effect becomes eligible to re-queue five minutes after it was queued, each step works on at most 30 instances per run, and the heartbeat releases expired claims. The Workflows CLI README states the same re-queue age.
583
+
584
+ **No upgrade action required for generated functions.** A hand-written function that calls `runtime.start` with a context of its own must set `clientOptions.projectId` and `clientOptions.dataset` on it, or the start throws.
585
+
586
+ **Docs impact:** In the generated-runtime guide, state that `runtime.engine` runs the `effects` handlers, that `runtime.start` needs the context's `projectId` and `dataset`, and that under the heartbeat an effect becomes eligible to re-queue five minutes after it was queued, each step works on at most 30 instances per run, and expired claims are released.
587
+
588
+ - effbac6: `show` no longer lists an activity as active once its run has finished. On an
589
+ aborted or completed instance, an activity that was still open when the run
590
+ stopped is shown dimmed as `◌ <activity> [not finished]`, so the output still
591
+ says where the run stopped without suggesting the work can be done. Done,
592
+ failed, and skipped activities are shown as before.
593
+
594
+ The section listing an instance's stages is now headed `Stage history:`. It
595
+ lists the stages the run has entered, in order, so a stage the run has not
596
+ reached yet does not appear and a revisited stage appears once per visit.
597
+ `definitions show` keeps its `Stages:` heading for the workflow's full stage list.
598
+
599
+ **No upgrade action required.** `show --json` still returns each activity's
600
+ stored status.
601
+
602
+ **Docs impact:** Update any CLI guide example that shows `show` output for an
603
+ aborted or completed instance.
604
+
605
+ - Updated dependencies [83c7f3a]
606
+ - Updated dependencies [c32ce83]
607
+ - Updated dependencies [af41ca9]
608
+ - Updated dependencies [6304d4a]
609
+ - Updated dependencies [b5a24c0]
610
+ - Updated dependencies [9ec15d6]
611
+ - Updated dependencies [38ede99]
612
+ - Updated dependencies [a344726]
613
+ - Updated dependencies [1d37767]
614
+ - Updated dependencies [2cd9a00]
615
+ - Updated dependencies [3594e60]
616
+ - Updated dependencies [af41ca9]
617
+ - Updated dependencies [8196fbe]
618
+ - Updated dependencies [5f5e346]
619
+ - Updated dependencies [8196fbe]
620
+ - Updated dependencies [c32ce83]
621
+ - Updated dependencies [e3ae1ab]
622
+ - Updated dependencies [a344726]
623
+ - Updated dependencies [1fc7db5]
624
+ - Updated dependencies [d5ecb28]
625
+ - Updated dependencies [bc9c045]
626
+ - Updated dependencies [33d5140]
627
+ - Updated dependencies [9ce54a2]
628
+ - Updated dependencies [9fba4cf]
629
+ - Updated dependencies [c63c0d2]
630
+ - @sanity/workflow-engine@0.37.0
631
+ - @sanity/workflow-blueprint@0.37.0
632
+
633
+ ## 0.36.0
634
+
635
+ ### Minor Changes
636
+
637
+ - 12240b6: `sanity-workflows blueprint generate` reports the runtime needs of the narrowed triggers. Each drain is listed with its own document trigger rather than one shared filter, and the start-watcher line prints the trigger the deployment compiles. The heartbeat block now says which definitions the beat ticks, which definitions' queues it recovers, how long an entry must have waited, the budget it carries and that budgeted effects recover one per beat, that a beat drains the instances it selected in sequence so a backlog continues on the next beat, and that deploying definitions before the functions loses nothing. A beat that ticks nothing and exists only to recover queues says so. A spawning action is printed as a heartbeat reason beside the `$now` deadlines, naming its stage, activity and action. The warnings change too: a start filter whose truth can change without a write to its subject is now called out with the reason and the lever, a creates-only watcher is explained under its line, and the any-type-subject warning says that every document in the dataset but the engine's own can invoke the watcher.
638
+
639
+ Run `sanity-workflows blueprint generate` after upgrading and redeploy the blueprint: this release changes what the generator writes, so `blueprint generate --check` fails in CI until the tree is regenerated, and deployed functions keep their old wider triggers until the blueprint is redeployed. Read the new heartbeat lines while you are there, since the report is where the deployment's recovery scope and budget are stated.
640
+
641
+ **Docs impact:** Update any walkthrough that quotes `blueprint generate` output, and the CLI reference's description of the runtime-needs report, to include the per-drain triggers, the two heartbeat scopes, the budgeted-effect rotation, and the three warning lines: the unnarrowable start filter with its lever, the creates-only explanation, and the any-type subject.
642
+
643
+ - b76d218: **BREAKING:** CLI telemetry now sends flag **values**, not just flag names.
644
+ `extraArguments` on the `Workflows CLI Command Executed` trace carried the
645
+ names of the flags used (`["--tag"]`); it now carries each flag in its
646
+ canonical long form with its value (`["--tag=prod"]`). Anyone querying
647
+ `extraArguments` for an exact flag name must match the name with or without a
648
+ value, for example `--tag` or anything starting `--tag=`; an exact match on
649
+ `--tag` stops counting new rows.
650
+
651
+ `--tag=prod`, `--tag prod`, and `-t prod` all report `--tag=prod`, so a flag
652
+ reads the same however it was typed.
653
+
654
+ **Read this before upgrading if your deployment tags, definition names, stage
655
+ names, or instance ids are themselves sensitive.** Values reach telemetry
656
+ verbatim, so `--only=project-nimbus` and `--to=legal-hold` now report what
657
+ they were set to. Who can see the data does not change, and
658
+ `sanity telemetry disable`, `DO_NOT_TRACK`, and CI suppression behave as
659
+ before.
660
+
661
+ Some values never ship. A flag whose value is text a person typed reports its
662
+ name alone: `--reason` on `abort`, `set-stage`, and `definition delete`,
663
+ `--field` on `start`, and `--param` on `fire-action`. So does any flag the
664
+ command does not declare, including a misspelling like `--resaon`. Tokens
665
+ after the `--` terminator are not reported.
666
+
667
+ **Docs impact:** Update the package README's Telemetry section, which moves
668
+ flag values to the collected list and names the redacted flags, and any
669
+ analytics guidance that assumes Workflows CLI rows carry flag names only.
670
+
671
+ - c06a9a8: **BREAKING:** Workflows telemetry event names now all follow
672
+ `Workflows <package> <event>`, the form the Studio plugin already uses. Every
673
+ engine event gains `Engine` (`Workflows Instance Started` becomes
674
+ `Workflows Engine Instance Started`). The CLI's definition-sharing events gain
675
+ `CLI` (`Workflows CLI Definition Shared`,
676
+ `Workflows CLI Definition Sharing Decided`), and the React session event gains
677
+ `React` (`Workflows React Session Started`). Payloads and event versions are
678
+ unchanged. Dashboards and queries that match the old names stop receiving new
679
+ rows, and a telemetry logger passed to `createEngine({telemetry})` or set in
680
+ `sanity.workflow.ts` that filters on an event name stops matching.
681
+
682
+ Update Omni queries and dashboards to match both the old and new names until
683
+ the old series no longer matters; rows already recorded keep their old names.
684
+ Update any custom logger that compares `event.name` against a string. Code that
685
+ references the exported event definitions, such as `WorkflowInstanceStarted`,
686
+ needs no change.
687
+
688
+ **Docs impact:** Update every telemetry reference that lists Workflows event
689
+ names, including the engine, CLI, MCP, and React telemetry sections, and add the
690
+ rename and the dual-name query guidance to the release notes.
691
+
692
+ - 0e072b9: `sanity-workflows deploy` now checks the generated Blueprints runtime against the definitions it is about to deploy. After the definitions validate, the deploy looks for `workflows.blueprint.ts` next to `sanity.workflow.ts`. When that file is there, the deploy runs the same comparison as `blueprint generate --check`: a regenerated shell that differs from disk, or a declared effect with no handler, exits non-zero before the first definition reaches the dataset and before a token is resolved, naming each file and the command that fixes it. When no generated runtime is there, the deploy prints the runtime the definitions need and continues; definitions needing no functions print nothing, and definitions no runtime can be derived from print a warning. `deploy --check` and `deploy --dry-run` run the check too, so `deploy --check` is a complete offline pre-flight. The deploy never writes a source file, because generation stays the explicit `blueprint generate` command.
693
+
694
+ Teams with no generated runtime need **no upgrade action**: nothing is compared and the deploy behaves as before, apart from a report of what a generated runtime would contain. Teams that do generate one must keep it current, because a deploy now stops on drift instead of shipping definitions their runtime cannot serve: run `sanity-workflows blueprint generate`, review the result, and deploy again. The check covers the whole config, since the generated tree declares every deployment in it, so a targeted `deploy --deployment one` also stops when a sibling deployment has drifted or its definitions no longer validate. There is no flag or configuration key that turns the check off; a project that hand-writes its runtime has no generated tree for the check to compare.
695
+
696
+ `@sanity/workflow-blueprint` exports `generatedRuntimeAlignment` from `@sanity/workflow-blueprint/generate` for callers that need that verdict themselves. It takes the directory holding the config file, reads only that directory, writes nothing, and returns the runtime the definitions need, the tree they would generate, and every planned file that differs from disk. It also takes an optional `compiler`, the TypeScript 6 compiler API used to wire an existing `sanity.blueprint.ts`; pass it when the host project's installed `typescript` package is absent or is TypeScript 7, which does not expose that API, and omit it to use the installed package. The generated resources module's own path is exported alongside it as `WORKFLOW_RESOURCES_PATH`.
697
+
698
+ **No upgrade action required** for existing callers of `generatedRuntimeAlignment`: `compiler` is optional and omitting it preserves the prior behavior.
699
+
700
+ **Docs impact:** Update the CLI reference for `deploy`, `deploy --check`, and `deploy --dry-run` to state that the alignment check runs by default and cannot be turned off, the generated-runtime guide to describe deploy-time drift as the second gate beside the CI `blueprint generate --check` job, including the whole-config scope of a targeted deploy, and the `@sanity/workflow-blueprint` API reference for `generatedRuntimeAlignment` to document its optional `compiler` parameter.
701
+
702
+ - 3af5eb2: **BREAKING:** The `Workflows CLI Command Executed` telemetry trace is version 2
703
+ and reports the invocation the way the Sanity CLI's own `CLI Command Executed`
704
+ does. `groupOrCommand` is now always `workflows` rather than the full oclif id,
705
+ and the command path moves to a new `commandArguments` array
706
+ (`workflows:definition:list` becomes `["definition", "list"]`). The version 1
707
+ payload fields `command` and `flags` are removed: the command path is
708
+ `commandArguments`, and the declared flag names used are the new
709
+ `extraArguments` array, `--`-prefixed (`["--check", "--tag"]`). A new
710
+ `coreOptions` object reports `debug`, `help`, and `version`. All four live on
711
+ the trace's context, so they ride every event the trace emits; `success` remains
712
+ the only field on `trace.log`. Flag values are still never sent.
713
+
714
+ Two audiences must act. Anyone querying Workflows CLI rows in RudderStack or
715
+ Omni should move filters off `data.command` and `data.flags` onto the
716
+ `Group Or Command`, `Command Arguments`, and `Extra Arguments` columns, and
717
+ expect `Group Or Command` to read `workflows` for every Workflows row instead
718
+ of one value per command; queries left on the old fields return nothing.
719
+ Anyone supplying a `telemetry` logger through `sanity.workflow.ts` receives the
720
+ new field set on the same event name — a logger that reads `command` or `flags`
721
+ must read `commandArguments` and `extraArguments` instead, or it will record
722
+ `undefined`.
723
+
724
+ **Docs impact:** The package README's Telemetry section documents this event
725
+ field by field; its `Workflows CLI Command Executed` entry is updated here to
726
+ the version 2 context and payload. Any dashboard or analytics guidance that
727
+ names `data.command` or `data.flags` needs the same correction.
728
+
729
+ ### Patch Changes
730
+
731
+ - Updated dependencies [90d0053]
732
+ - Updated dependencies [12240b6]
733
+ - Updated dependencies [12240b6]
734
+ - Updated dependencies [9902088]
735
+ - Updated dependencies [56a7252]
736
+ - Updated dependencies [9902088]
737
+ - Updated dependencies [56a7252]
738
+ - Updated dependencies [9902088]
739
+ - Updated dependencies [d5da960]
740
+ - Updated dependencies [c06a9a8]
741
+ - Updated dependencies [0e072b9]
742
+ - Updated dependencies [cbad3ae]
743
+ - Updated dependencies [12240b6]
744
+ - @sanity/workflow-blueprint@0.36.0
745
+ - @sanity/workflow-engine@0.36.0
746
+
747
+ ## 0.35.0
748
+
749
+ ### Minor Changes
750
+
751
+ - a3489d2: Workflows CLI commands now load `sanity.workflow.ts` in projects using
752
+ TypeScript 7. `blueprint generate` and `blueprint generate --check` work with
753
+ TypeScript 6, TypeScript 7, or no project TypeScript installation: the CLI
754
+ supplies its own TypeScript 6 compatibility compiler for editing an existing
755
+ `sanity.blueprint.ts`. Direct generator callers can pass that API through
756
+ `emissionWritePlan({compiler})` or as the second argument to `wireBlueprint`.
757
+ When no usable compiler is available, direct wiring reports how to supply one.
758
+ The Blueprint package root now exports `CONFIG_FILE_NAMES` so custom loaders
759
+ can share the same config discovery order without importing the generator.
760
+ The workflow engine and generated function runtimes do not acquire a compiler
761
+ dependency.
762
+
763
+ **No upgrade action required.** Install the updated Workflows release normally;
764
+ keep your project's TypeScript version and existing config files.
765
+
766
+ **Docs impact:** Update the Blueprint generation reference to explain the
767
+ optional compiler argument and root `CONFIG_FILE_NAMES` export for direct
768
+ callers, and the CLI installation guidance to say Blueprint commands work in
769
+ projects using TypeScript 6, TypeScript 7, or no installed TypeScript.
770
+
771
+ ### Patch Changes
772
+
773
+ - 2f040b6: The README's Telemetry section now states the payload policy as an explicit
774
+ collected / never-collected pair, governed by
775
+ [Sanity's telemetry policy](https://www.sanity.io/telemetry), replacing the
776
+ claim that payloads never include customer-authored strings. That claim was
777
+ wrong in three ways it is worth knowing about: the dataset name is sent as a
778
+ session property, effect events carry the author-chosen effect name, and the
779
+ deployment tag reaches telemetry inside `instanceId`, whose engine-minted form
780
+ is `<tag>.wf-instance.<random>`. A caller-supplied instance id is sent
781
+ verbatim. Nothing about what the CLI sends changes; only the description of it
782
+ does.
783
+
784
+ The never-collected list now separates what the company policy excludes from
785
+ what this package additionally chooses not to send. Flag values, definition
786
+ names, and stage names sit in the second group: the policy does not prohibit
787
+ them, so do not read their absence here as a company-wide guarantee. Error
788
+ messages sit there too, with the policy permitting error information that
789
+ excludes sensitive data while this package sends none.
790
+
791
+ **No upgrade action required.** Review the new lists if you assessed this
792
+ package's telemetry against the previous wording, in particular if your
793
+ deployment tags or instance ids encode something you would not want in an
794
+ analytics pipeline. Consent and opt-out are unchanged: account-level
795
+ `sanity telemetry disable`, `DO_NOT_TRACK`, and CI suppression all behave as
796
+ before.
797
+
798
+ **Docs impact:** The Telemetry section of the package README is the change.
799
+ Any internal analytics or privacy guidance quoting the old
800
+ "never include customer-authored strings" sentence needs the same correction,
801
+ and guidance that assumes deployment tags are absent from telemetry should be
802
+ revisited.
803
+
804
+ - Updated dependencies [a3489d2]
805
+ - Updated dependencies [7e24e4a]
806
+ - Updated dependencies [ab8754a]
807
+ - @sanity/workflow-blueprint@0.35.0
808
+ - @sanity/workflow-engine@0.35.0
809
+
810
+ ## 0.34.0
811
+
812
+ ### Patch Changes
813
+
814
+ - Updated dependencies [00bb88f]
815
+ - @sanity/workflow-blueprint@0.34.0
816
+ - @sanity/workflow-engine@0.34.0
817
+
818
+ ## 0.33.0
819
+
820
+ ### Minor Changes
821
+
822
+ - 225e0fb: **BREAKING:** Workflows App SDK and Studio integrations now require `@sanity/sdk` 3.1 or later in the 3.x line, and `@sanity/workflow-sdk` requires the matching `@sanity/sdk-react` 3.1 line when its React entry is used. The previous SDK 2 peer contract is no longer supported. The exported `WorkflowClient`, `TelemetryIntakeClient`, `ProjectUserProfileClient`, and `StudioUserClient` request contracts now pass their target in `url`; the previous `uri` request target is no longer used. The engine's effective client config also accepts the broader `{type: string, id: string}` resource descriptors returned by Sanity client 8.
823
+
824
+ Before upgrading Workflows, upgrade `@sanity/sdk` and `@sanity/sdk-react` together to 3.1 or later. Applications that stay on SDK 2 must stay on an earlier Workflows release. If you implement any of the request contracts named above, update it to read the request target from `url` instead of `uri`; otherwise its request-backed reads will fail. Existing `WorkflowClient.config()` implementations need no change when their resource descriptor already has string `type` and `id` fields. No separate CLI upgrade action is required; its definition-sharing and telemetry requests adopt `url` internally.
825
+
826
+ Before installing, override SDK 3's `@sanity/mutate` dependency to `0.18.2` in your application's root package-manager configuration, reinstall, and commit the updated lockfile. SDK 3.1.0 allows Mutate 0.18.1, which can leave document reads pending with client 8. For npm, set `overrides["@sanity/sdk"]["@sanity/mutate"]` to `"0.18.2"` in `package.json`. For pnpm, set `overrides['@sanity/sdk@3>@sanity/mutate']` to `0.18.2` in `pnpm-workspace.yaml`. Keep the override until your SDK release requires Mutate 0.18.2 or later. Complete examples and verification steps are in the Installation section of the published `@sanity/workflow-sdk` README.
827
+
828
+ Malformed project-member responses now report an inaccessible directory and can recover on a later lookup, instead of being cached as a missing user. No additional upgrade action is required for this correction.
829
+
830
+ **Docs impact:** Update the App SDK and Studio integration installation guidance, package compatibility references, and examples to require Sanity App SDK 3.1 and the consumer Mutate override described in the published `@sanity/workflow-sdk` README; update the client API references for `request({url})`, effective resource descriptors, and directory-response failures.
831
+
832
+ - ba031fe: **Experimental, and not ready for production use in this release.** Both commands are available so you can try the generated runtime and give feedback; their flags and their output may still change. What you would hit today:
833
+ - The start watcher runs on every create and update of a subject type, not only on writes that can actually start a workflow, so it wakes for documents that already have an instance or match no definition. The heartbeat is scheduled every minute and evaluates every in-flight instance in the tag when it runs; how often the platform runs it is a plan limit.
834
+ - `sanity-workflows deploy` does not check the generated tree, so drift between your definitions and the tree on disk is caught only by `blueprint generate --check` in CI.
835
+ - Definitions and functions deploy in two steps, definitions first, until the Blueprints service registers the `sanity.workflow` resource.
836
+ - A generated file cannot be taken over: editing one is drift, and the next generation rewrites it.
837
+ - A retry policy is not checked against its function's timeout at generation, so an effect can be configured to retry for longer than its function may run.
838
+
839
+ All of these are tracked, and the next release is the bar for using this in production.
840
+
841
+ `sanity-workflows blueprint generate` generates the Sanity Blueprints runtime your definitions require and writes it next to `sanity.workflow.ts`. It prints the needs analysis first — which effects force a drain function, which `$now` condition forces a scheduled heartbeat, which autonomous definition forces a start watcher, and the explicit "no functions needed" answer for a purely interactive workflow — then writes `workflows.blueprint.ts`, one function module and manifest per derived need, the effect-handler registry, and one handler stub per declared effect name. Handler stubs are yours: they are scaffolded once and never overwritten. Your own `sanity.blueprint.ts` receives the `workflowResources` import and spread once. The command deletes nothing; a handler for an effect you removed, a scaffold blocked by a path differing only in case, and a blueprint it could not wire are reported as warnings for you to resolve. The generated tree is one artifact for the whole config, so the command always covers every deployment.
842
+
843
+ `sanity-workflows blueprint generate --check` is the CI drift gate. It renders the same runtime in memory, compares it with the files on disk, writes nothing, and exits zero when they match. Otherwise it exits 1 and lists every file with its reason — `missing`, `differs`, an orphaned handler, or a blueprint that is not wired — so a CI log says what to fix without anyone reading source. A declared effect with no handler file on disk reports as `missing`, which is the handler-coverage check.
844
+
845
+ **No upgrade action required.** Both commands are new and nothing else changes. To use them, your `sanity.workflow.ts` must export each deployment under its own `name`, and that export must be the deployment object itself — `export const production = {name: 'production', …} satisfies WorkflowDeploymentInput`, then `export default defineWorkflowConfig({deployments: [production]})` — because every generated module imports its deployment from `./sanity.workflow` by that name; a config that only default-exports fails the command with the export to add rather than writing a tree that cannot compile. The command checks the name only, so make sure each export is the deployment the config lists: a typecheck of the generated modules catches a wrong export only where a generated function uses it, and a deployment that needs no functions emits none. Your `sanity.workflow.ts` must also be importable inside a deployed function, because every generated module imports it and each function bundles it: reading an absent variable there yields `undefined`, but a config that throws when a variable is missing, or requires one to build the deployment, fails every deployed function on init. Keep the deployment's resource coordinates literal in that file and read secrets inside your handlers. Deploy your definitions with `sanity-workflows deploy` before `npx sanity blueprints deploy`, because the generated blueprint carries the definitions entry commented out until the Blueprints service accepts the `sanity.workflow` resource type, and a function that starts or advances an instance resolves its definition from the Content Lake. A generated heartbeat is a scheduled function, which the platform only accepts on an organization-scoped stack, and how often it may run is a plan limit. Also install `@sanity/blueprints`, `@sanity/functions`, and `@sanity/workflow-blueprint` in your project: each generated function's manifest copies the specifications your project declares for `@sanity/functions`, `@sanity/workflow-blueprint`, and `@sanity/workflow-engine`, and a package you declare nowhere fails the command instead of being stamped with a guessed range. `typescript` is now a dependency of the CLI, because parsing `sanity.blueprint.ts` to insert the wiring uses the TypeScript compiler.
846
+
847
+ **Docs impact:** Rewrite the cookbook chapter on running workflows on a server so it drives the runtime through these two commands rather than describing hand-written functions, and cover the CI drift check there. Update the CLI command reference with both commands, and the Blueprints concept page where it explains who writes the generated tree.
848
+
849
+ ### Patch Changes
850
+
851
+ - 393ac71: CLI and MCP telemetry now includes `context.surface` (`cli` or `mcp`) and
852
+ execution mode in each event's `context.environment`. Dashboards can include
853
+ shell and engine activity while distinguishing it from SDK events marked
854
+ `sdk`. Existing command trace context is preserved.
855
+
856
+ All three surfaces report `production` for `NODE_ENV=production`, and
857
+ `development` for `development` or `test`. Unset, empty, and unrecognized values
858
+ default to `production` for CLI and MCP execution mode, and `development` for
859
+ SDK build mode. SDK environment classification is unchanged. When comparing
860
+ activity across surfaces, group or filter by surface alongside environment.
861
+ Environment does not identify a production dataset or deployment; API host,
862
+ dataset name, and workflow tag do not set it.
863
+
864
+ **No upgrade action required.** Existing telemetry consent and opt-out
865
+ settings still apply. Historical events are unchanged.
866
+
867
+ **Docs impact:** Update CLI, MCP, and SDK telemetry guidance to explain surface
868
+ context, build versus execution mode, the explicit defaults, and how to
869
+ interpret environment when comparing activity across surfaces.
870
+
871
+ - 8874c50: **BREAKING:** A `subject`, `doc.ref`, or `doc.refs` field marked `required: true`
872
+ now requires its selected documents to remain readable after initialization.
873
+ Previously, the flag checked only that an initial value was supplied. Missing
874
+ required targets now produce a fault and prevent normal actions, triggered
875
+ actions, and transitions from advancing, even without an activity requirement
876
+ reading those targets. Abort and direct edits to editable fields remain
877
+ available. Optional references fault only when an unmet runtime condition needs
878
+ their content; completed workflows remain completed.
879
+
880
+ `StuckCause` adds `document-missing`. Update exhaustive handlers before upgrading,
881
+ or their typechecks fail and renderers have no matching branch. Evaluation
882
+ identifies the affected field and reference in `missingDocuments`, with its title
883
+ and completed availability evidence; `blockingMissingDocuments` selects the
884
+ references that prevent progress. The engine checks draft, published, and release
885
+ representations before distinguishing deletion from inaccessible content or
886
+ content outside the workflow perspective. Studio, CLI, and MCP use that same
887
+ result. Failed availability checks report unreadable content and log the cause;
888
+ optional references still permit unrelated actions. Incomplete reads do not
889
+ claim deletion, and an existing task fault keeps
890
+ its recovery controls. The fault clears when the required content becomes
891
+ readable; this release adds no undo-delete operation and does not automatically
892
+ abort workflows.
893
+
894
+ Upgrade every Workflows runtime sharing affected data, including Studio, CLI,
895
+ MCP servers, and deployed Functions, before relying on continued required-target
896
+ availability. Then set the deployment's reviewed `expectedMinReaderModel` to
897
+ `10` before deploying definitions with required content references. Writers stamp
898
+ model 10; this feature requires reader model 10, while documents without it keep
899
+ the floor required by their other features, normally 4, 8, or 9. Existing
900
+ instances remain readable without a backfill and adopt the rule under upgraded
901
+ engines. Their stored floor rises on the next full write, so an older runtime
902
+ can still advance an unstamped existing instance until the fleet is upgraded.
903
+ See `packages/workflow-engine/DATAMODEL.md` for the complete rollout contract.
904
+
905
+ The rendered CLI `show` command evaluates running instances. If evaluation fails,
906
+ it warns and displays stored state; terminal instances and `show --json` retain
907
+ their stored-state behavior.
908
+
909
+ **Docs impact:** Update field requiredness and initialization guidance, required
910
+ reference repair examples, the model-10 readers-first rollout, the diagnostics
911
+ reference for `StuckCause` and `MissingDocument`, CLI `show` and `diagnose`, MCP
912
+ workflow-state guidance, and the Workflows tool and document-view guides for
913
+ loading, deletion, permissions, and perspectives.
914
+
915
+ - 3b42bdc: The Workflows CLI command-trace now sets the oclif command id as trace context (`groupOrCommand`) when the built-in telemetry shell starts, so telemetry reporting can break invocations down by command the same way it can for other Sanity CLI commands. The id remains in the log payload as `command` for config-provided telemetry loggers.
916
+
917
+ **No upgrade action required.** Existing CLI installs begin emitting the queryable context after upgrading; historical rows are unchanged.
918
+
919
+ **Docs impact:** None — internal telemetry envelope shape for an existing event; no public API or user-facing CLI behavior change.
920
+
921
+ - 7eb9eca: Correct the API references for field initialization and edits, start requirements,
922
+ transitions, reference IDs, effect handling, reactive state, member controls,
923
+ Studio mappings, test helpers, and GROQ condition outcomes. The references state
924
+ caller constraints and defaults that were missing or incorrect. Package setup
925
+ guidance identifies the public npm packages and supported deployment command;
926
+ the MCP validation description distinguishes validation from deployment checks.
927
+ Runtime behavior and API signatures are unchanged.
928
+
929
+ **No upgrade action required.**
930
+
931
+ **Docs impact:** After release and reference sync, reconcile the modeling,
932
+ runtime, reactive UI, Studio, testing, deployment, MCP, and evaluation-insight
933
+ guides and references with the corrected contracts. Fix affected examples and
934
+ replace redundant API inventories with verified symbol links while preserving
935
+ useful teaching and the CLI/MCP reference material not exposed by TypeDoc.
936
+
937
+ - 2cef086: Internal maintenance consolidates engine action/edit handling and Studio document
938
+ and workflow title sorting. Action and field-edit calls retain their inputs and
939
+ results, and document and workflow titles retain their ordering. Action
940
+ availability, telemetry, and persisted document formats are unchanged.
941
+
942
+ **No upgrade action required.**
943
+
944
+ **Docs impact: None** because public APIs, configuration, and workflow behavior
945
+ are unchanged.
946
+
947
+ - Updated dependencies [8874c50]
948
+ - Updated dependencies [b3b2797]
949
+ - Updated dependencies [393ac71]
950
+ - Updated dependencies [8874c50]
951
+ - Updated dependencies [ba031fe]
952
+ - Updated dependencies [0555271]
953
+ - Updated dependencies [b3b2797]
954
+ - Updated dependencies [225e0fb]
955
+ - Updated dependencies [b7510cc]
956
+ - Updated dependencies [7eb9eca]
957
+ - Updated dependencies [2cef086]
958
+ - Updated dependencies [232f811]
959
+ - Updated dependencies [ba031fe]
960
+ - @sanity/workflow-blueprint@0.33.0
961
+ - @sanity/workflow-engine@0.33.0
962
+
963
+ ## 0.32.0
964
+
965
+ ### Minor Changes
966
+
967
+ - a8ed312: **BREAKING:** Assignment is now one ordered user-or-role member-list model: a direct user holder shadows every role in the same activity, role-only values route work to a pool, and singular `assignee` fields allow at most one user while retaining any number of roles. The `claim` field and action sugars have been removed from the authoring DSL; authors using them must replace each pair with an `assignee` field, a literal role seed where the work starts in a pool, ordinary field edits for take/release, a guarded `editable` predicate when second-taker exclusion is required, and `$assigned` on holder-only actions. Definitions that still submit `type: 'claim'` now fail validation.
968
+
969
+ Upgrade every engine, Studio, CLI, MCP, and adapter runtime sharing a workflow resource before deploying a definition containing a singular `assignee`, then acknowledge reader model 9 on deployment. Existing model-8-and-earlier instances remain readable and keep their object/null singular representation; no stored-document backfill is required. Deploy now rejects project-role references absent from the target project's live role catalog and warns when a referenced role has no current human holder, so the deploying identity must be able to read the project role and member directories.
970
+
971
+ Studio assignment matching and holder explanations now follow direct-user shadowing. The CLI adds viewer-scoped assignment list flags and counts, MCP instance listing adds corresponding assignment inputs and counts, and the public waiting `Diagnosis` adds a required `waitingFor` discriminant that distinguishes caller-actionable, manual-but-unavailable, and automation waits without implying that unassigned work is freely actionable.
972
+
973
+ `@sanity/workflow-components` now exports `roleMemberCount`, which reports the distinct people who can fulfill any supplied project role using the workflow definition's aliases. Pass the current member directory, required role names, and normalized `roleAliases`; literal members and alias-only fulfillers are deduplicated by account-global user id. No upgrade action is required unless a custom assignment surface wants alias-aware pool sizes.
974
+
975
+ **Docs impact:** Update the assignment model and authoring references, the reader-model rollout guide, guarded role-pool and take/release examples, the `@sanity/workflow-components` member-selection reference for `roleMemberCount`, Studio task-holder explanations, CLI instance-list flags, MCP list tool reference, deploy role-validation requirements, and migration guidance from removed claim sugar.
976
+
977
+ ### Patch Changes
978
+
979
+ - 8fc1f36: `@sanity/cli-core` is now a peer dependency, which reduces the install size of `@sanity/cli`
980
+
981
+ **No upgrade action required.** The peer dependency isn't marked optional, so package managers will still install it like normal.
982
+
983
+ **Docs impact:** None.
984
+
985
+ - f1c9446: The CLI now formats timestamps with `@sanity/cli-core` instead of installing `date-fns`, reducing the standalone installation size while preserving absolute detail timestamps and relative list timestamps.
986
+
987
+ **No upgrade action required.** Relative timestamps use the runtime's standard English wording.
988
+
989
+ **Docs impact:** None. Timestamp presentation and CLI usage remain unchanged.
990
+
991
+ - Updated dependencies [a8ed312]
992
+ - Updated dependencies [2ba0c09]
993
+ - Updated dependencies [2de38fd]
994
+ - Updated dependencies [a2ce4a7]
995
+ - Updated dependencies [2ddd3d7]
996
+ - Updated dependencies [6035672]
997
+ - Updated dependencies [26dd4e5]
998
+ - Updated dependencies [b04580d]
999
+ - @sanity/workflow-engine@0.32.0
1000
+
1001
+ ## 0.31.0
1002
+
1003
+ ### Patch Changes
1004
+
1005
+ - Updated dependencies [ff72ece]
1006
+ - @sanity/workflow-engine@0.31.0
1007
+
1008
+ ## 0.30.0
1009
+
1010
+ ### Minor Changes
1011
+
1012
+ - 90207dc: **BREAKING:** `assertReaderModelAcknowledgement` now requires `{requiredMinReaderModel, context?}` instead of a context string, and `ReaderModelAcknowledgementError` accepts its optional context through `{context}`. The Blueprint package's `AcknowledgedDeployment` type moves to the engine as `AcknowledgedWorkflowDeployment`; update imports and use that shared name. Assignment-valued fields can now declare a non-empty `roles` list that limits newly written assignees. Existing fields without `roles` stay unconstrained, retain reader floor 4, and continue deploying with `expectedMinReaderModel: 4`; installing this release requires no coordinated rollout or configuration change.
1013
+
1014
+ Before adding `roles`, upgrade every Studio, CLI, MCP server, Function, and other runtime that shares the affected workflow resource, then change that deployment's literal `expectedMinReaderModel` to `8`. MCP deployments pass the same reviewed literal as the optional `expectedMinReaderModel` tool argument. Definitions and instances carrying the facet require reader model 8. User assignees qualify through direct roles or the definition's role aliases, while collective role assignees must literally match one configured role. Studio assignment controls, including manual start, auto-start, and assignees nested in to-do rows, offer only eligible choices while retaining stale current values so editors can remove or replace them. Constrained pickers name the active eligible roles and distinguish an empty eligible set from a search with no matches. Top-level plural and composite edits retain no more occurrences of a stale assignment at each declared assignment location than the previous value contained; removal and reordering therefore work, while an added copy is a new assignment and must qualify. Direct singular replacements and every assignment present in an `updateWhere` fragment remain strict. Each engine verb uses one member-directory snapshot across retries, cascade hops, and spawned children, then the next verb reads current membership.
1015
+
1016
+ Malformed project-member and project-user directory responses now fail loudly instead of treating bad rows or role records as missing users, and actor resolution reports those failures as `inaccessible`, so integrations can distinguish directory failures from absent membership.
1017
+
1018
+ CLI `start` and `definition delete` no longer apply the definition-submission acknowledgement gate; deploy, check, dry-run, definition diff, Blueprint provision, and engine definition APIs still validate the selected definitions' required floor.
1019
+
1020
+ No reader-fleet rollout or deployment-literal change is required for existing definitions that do not use `roles`.
1021
+
1022
+ **Docs impact:** Update the assignment field reference and authoring examples for `roles`, distinguish eligibility from editability, action permission, and literal queue ownership, and add the model-8 conditional adoption sequence to the prerelease rollout guide.
1023
+
1024
+ - b0b1550: **BREAKING:** Product-prefixed telemetry events now use `Workflows <event>` instead of `Editorial Workflows <event>`; `EditorialWorkflowsResource` is replaced by `WorkflowsResource`; and `defineWorkflows` now generates `workflows-<deployment name>` resource names instead of `editorial-workflows-<deployment name>`. Telemetry consumers matching the previous literals stop receiving events until updated, TypeScript consumers importing the previous Blueprint interface no longer compile, and an existing Blueprint stack that relies on the generated name treats the new default as a different resource identity.
1025
+
1026
+ Update telemetry dashboards, schemas, alerts, and queries to match the `Workflows` prefix; event suffixes, payloads, and versions are unchanged. Replace Blueprint imports with `WorkflowsResource`. Before deploying an existing Blueprint stack, either pass its recorded resource name explicitly or plan the detach-and-create migration to the new default. Workflows request-tag families and billing classification are unchanged.
1027
+
1028
+ Other user-facing package copy now uses the Workflows product name. No upgrade action is required for consumers that do not match telemetry event names or use the Blueprint package.
1029
+
1030
+ **Docs impact:** Rename the product throughout the public documentation, move the docs section to `/docs/workflows/*` with permanent redirects from every `/docs/editorial-workflows/*` path, and document the telemetry-prefix, `WorkflowsResource`, and Blueprint resource-name migrations in the telemetry reference, Blueprint guide, and release notes.
1031
+
1032
+ ### Patch Changes
1033
+
1034
+ - Updated dependencies [210ca63]
1035
+ - Updated dependencies [a3a8dc0]
1036
+ - Updated dependencies [a3a8dc0]
1037
+ - Updated dependencies [a3a8dc0]
1038
+ - Updated dependencies [90207dc]
1039
+ - Updated dependencies [b0b1550]
1040
+ - @sanity/workflow-engine@0.30.0
1041
+
1042
+ ## 0.29.0
1043
+
1044
+ ### Patch Changes
1045
+
1046
+ - 8bb6a85: The workflow CLI README lists commands with operator-facing descriptions instead of implementation status.
1047
+
1048
+ **No upgrade action required.** Command behavior is unchanged.
1049
+
1050
+ **Docs impact:** `packages/workflow-cli` README — the former Command status table is now Command list.
1051
+
1052
+ - 772876b: When this package is mounted inside the official `sanity` CLI, its telemetry prerun hook no longer installs a store for host commands outside the `workflows` topic (the finally hook already no-ops when telemetry was never installed). Previously every `sanity` command in a directory with a `sanity.workflow.ts` could load workflow config, show the workflow-cli disclosure, and emit an `Editorial Workflows CLI Command Executed` event for unrelated commands such as `sanity dataset list`. Standalone `sanity-workflows` behaviour is unchanged.
1053
+
1054
+ **No upgrade action required** for standalone users. Hosts that already mount this package as an oclif plugin pick up the safer hook scope on upgrade — no config change.
1055
+
1056
+ **Docs impact:** None — host-mount telemetry scoping only; documented invoke paths are unchanged.
1057
+
1058
+ - 772876b: The `workflows` topic help description no longer uses an em dash. It now reads "Deploy, inspect, and administer Editorial Workflows definitions and instances", matching the plain phrasing of other product CLI topics.
1059
+
1060
+ **No upgrade action required.**
1061
+
1062
+ **Docs impact:** None — help copy only; documented invoke paths are unchanged.
1063
+
1064
+ - Updated dependencies [f44fc33]
1065
+ - Updated dependencies [26f25e0]
1066
+ - Updated dependencies [25bd1fb]
1067
+ - Updated dependencies [3fd04f1]
1068
+ - @sanity/workflow-engine@0.29.0
1069
+
1070
+ ## 0.28.0
1071
+
1072
+ ### Minor Changes
1073
+
1074
+ - 5050b06: **BREAKING:** Authoring a deployment now types through `WorkflowDeploymentInput` / `WorkflowConfigInput`, which require `expectedMinReaderModel` as the current reader-floor literal. Passing a parsed `WorkflowDeployment` / `WorkflowConfig` (where the floor is optional/unverified) into `defineWorkflowConfig` or `defineWorkflows` is a type error — share the authored deployment object instead of `config.deployments[n]`. The same pin shows up on the blueprint resource: `EditorialWorkflowsResource.deployment` and `parseWorkflowDeployment`'s return type are now `AcknowledgedDeployment` (floor asserted to the current literal), so a hand-constructed provider resource must carry that literal too.
1075
+
1076
+ At runtime, config parse no longer rejects a stale or missing floor on an untargeted deployment. Only deployment-scoped commands assert, and only the selected deployment: definition deploy, `--check` / `--dry-run`, blueprint provision, `start`, `definition delete`, and `definition diff` (the last is a deployment-scoped read). Instance-id commands (`fire-action`, `abort`, `set-stage`, `reset-activity`) deliberately do not assert — they resolve by instance id, not by a declared deployment's acknowledgement — so an unacknowledged floor does not stop those instance commits.
1077
+
1078
+ Upgrade TypeScript configs and blueprint manifests that fed a parsed deployment into those helpers: keep a shared authored object (`satisfies WorkflowDeploymentInput`) for both `defineWorkflowConfig` and `defineWorkflows`, and give any hand-built `EditorialWorkflowsResource` the current floor literal on `deployment`. Existing configs that already acknowledge the current floor keep working at runtime; a stale selected deployment still fails with `ReaderModelAcknowledgementError` (headline + short steps; the CLI renders it through the clean styled-error path).
1079
+
1080
+ **Docs impact:** Update the CLI / blueprint authoring examples and the prerelease reader-floor guidance so they name `WorkflowConfigInput` / `WorkflowDeploymentInput` / `AcknowledgedDeployment`, forbid passing `config.deployments[n]` into `defineWorkflows`, state that instance-id writes are outside the acknowledgement gate, and stop implying whole-config parse-time rejection for commands that never select a deployment.
1081
+
1082
+ - cc50d58: **BREAKING:** Canonical oclif command ids move from the `editorial-workflows` topic to `workflows`. A future host mount therefore surfaces `sanity workflows deploy` (and the same shape for every other command) instead of `sanity editorial-workflows …`. Standalone short forms (`sanity-workflows deploy`, `definition list`, …) are unchanged — the bin still rewrites them onto the topic before resolution.
1083
+
1084
+ Anyone invoking the previous topic-scoped ids (`sanity-workflows editorial-workflows deploy`, or a host/plugin that hard-coded those ids) must switch to `workflows …`. Continuing to call `editorial-workflows …` fails with command-not-found.
1085
+
1086
+ **Docs impact:** When the host mount ships, update Editorial Workflows CLI getting-started and invocation docs so the documented host path is `sanity workflows …`, and refresh any topic-scoped examples that still say `editorial-workflows`. Until then the standalone short forms remain the documented surface.
1087
+
1088
+ ### Patch Changes
1089
+
1090
+ - 4403e66: Short command forms (`deploy`, `definition list`, …) are no longer registered as oclif root aliases. The standalone `sanity-workflows` binary still accepts those forms by rewriting argv onto the `workflows` topic before command resolution, so day-to-day usage is unchanged. Removing the aliases makes the package safe to mount inside the official `sanity` CLI without colliding with host commands such as `sanity deploy`.
1091
+
1092
+ **No upgrade action required** for standalone `sanity-workflows` / `npx @sanity/workflow-cli` users. Anyone who embedded this package as an oclif plugin and relied on the root aliases must invoke the topic-scoped ids (`workflows deploy`, …) or perform equivalent argv rewriting in the host.
1093
+
1094
+ **Docs impact:** Update Editorial Workflows CLI getting-started and invocation docs when the host mount ships so the primary path is `sanity workflows …`; until then the standalone short forms remain the documented surface in this package README.
1095
+
1096
+ - Updated dependencies [1e4a5da]
1097
+ - Updated dependencies [5050b06]
1098
+ - Updated dependencies [a044ba5]
1099
+ - @sanity/workflow-engine@0.28.0
1100
+
1101
+ ## 0.27.0
1102
+
1103
+ ### Patch Changes
1104
+
1105
+ - Updated dependencies [780cf93]
1106
+ - @sanity/workflow-engine@0.27.0
1107
+
1108
+ ## 0.26.0
1109
+
1110
+ ### Patch Changes
1111
+
1112
+ - @sanity/workflow-engine@0.26.0
1113
+
1114
+ ## 0.25.0
1115
+
1116
+ ### Minor Changes
1117
+
1118
+ - 177d600: Deployed workflow environment tags are now discoverable.
1119
+
1120
+ The engine gains two cross-partition GROQ builders: `deployedTagsGroq()` lists
1121
+ every tag holding a deployed definition in a resource, and
1122
+ `definitionTagsGroq()` narrows that to one definition name via `$definition`.
1123
+ Both deliberately span tag partitions — every other read is tag-scoped, and
1124
+ `workflow.query` refuses GROQ that isn't — so they answer "which environments
1125
+ exist here" for a caller holding a resource but no tag. They report what is
1126
+ _observed_: a tag with nothing deployed does not appear.
1127
+
1128
+ The stdio MCP server adds a `list_workflow_tags` tool taking a
1129
+ `workflow_resource` and no tag. It is registered by the host rather than exported
1130
+ as a tool def, because a def is only ever handed an engine and an engine is
1131
+ pinned to one tag. `LIST_WORKFLOW_TAGS_TOOL_NAME` and
1132
+ `LIST_WORKFLOW_TAGS_DESCRIPTION` are exported so an embedding host registers the
1133
+ same capability under the same name without re-authoring the model-facing
1134
+ wording. The `tag` parameter's description now points an agent at that tool where
1135
+ a server offers it and at the user otherwise, and requires confirmation either
1136
+ way — having the list does not license picking from it.
1137
+
1138
+ Both registration paths share one outcome path, `withToolTelemetry`, so the
1139
+ result envelope, error rendering, and the `Editorial Workflows MCP Tool Called`
1140
+ event cannot diverge between a def-backed tool and a host-registered one. Tag
1141
+ discovery reports its adoption event like every other tool, and because it names
1142
+ a resource it can also initialize the stdio server's deferred telemetry shell —
1143
+ which matters when discovery is an agent's first call.
1144
+
1145
+ The CLI's definition-tags probe runs the engine's builder instead of its own
1146
+ copy of the query, so its `params` key is `definition` rather than `name`, and
1147
+ the tag partitions it names in an ambiguity error arrive sorted from the lake.
1148
+
1149
+ ### Patch Changes
1150
+
1151
+ - Updated dependencies [177d600]
1152
+ - Updated dependencies [fc12989]
1153
+ - @sanity/workflow-engine@0.25.0
1154
+
1155
+ ## 0.24.0
1156
+
1157
+ ### Minor Changes
1158
+
1159
+ - e359f4b: Add `nuke --instance <id>`: delete a single terminal workflow instance and its guard documents (swept across every alias-bound resource), instead of wiping a whole deployment tag. In-flight instances are refused — abort them first, and so is any document that is not an engine instance, so a bare id can never reach co-located content. Prints a dry-run plan, then a `y/N` confirmation (`--force` skips it).
1160
+
1161
+ Instance mode locates its target by lake-side projection rather than a gated engine read, so it can delete an instance whose reader floor is ahead of the running engine — the state the reset exists to clear, and which tag mode could already handle.
1162
+
1163
+ Instance mode deletes the instance document in its LAST wave, after the guards. A nuke is never a single transaction, so an interrupted run always leaves something behind — and that document is the handle a re-run locates by, so deleting it first would strand any guard the run had not yet reached with nothing left to name them. Tag mode keeps deleting instance documents first, unchanged: it re-plans from a query, so a re-run sweeps whatever survived either way.
1164
+
1165
+ ### Patch Changes
1166
+
1167
+ - fc02505: `deploy --only` now fails fast: the definition name is checked against the config before any deployment is selected, so a bogus value errors immediately instead of after the interactive deployment picker has been answered. When the value names a deployment rather than a definition, the failure points at the flag it belongs to — `"review-prod" is a deployment — did you mean --deployment review-prod?`.
1168
+ - Updated dependencies [0bc4328]
1169
+ - Updated dependencies [41a3f02]
1170
+ - @sanity/workflow-engine@0.24.0
1171
+
1172
+ ## 0.23.0
1173
+
1174
+ ### Minor Changes
1175
+
1176
+ - 795b4bb: `set-stage` now makes `--to` optional: omit it on an interactive terminal and the command presents a picker of the instance's declared stages, with the current stage marked and the cursor opened on it. Because `set-stage` is an admin override, every declared stage is offered — not just reachable transitions. The candidates come from the instance's pinned definition snapshot (the same model the engine validates the move against), so the menu can never offer a stage the move would reject. Off a non-interactive terminal `--to` stays required, so scripted use is unaffected. The engine now exports `parseDefinitionSnapshotValue` for reading a definition snapshot from a minimal instance shape.
1177
+
1178
+ ### Patch Changes
1179
+
1180
+ - Updated dependencies [94d311e]
1181
+ - Updated dependencies [795b4bb]
1182
+ - @sanity/workflow-engine@0.23.0
1183
+
1184
+ ## 0.22.0
1185
+
1186
+ ### Minor Changes
1187
+
1188
+ - 1c6d4c0: Name the target deployment and resource on `deploy` progress and result lines. The spinner and completion line now read `Deploying N definition(s) to <name> (<tag>) → <resource>…` / `Processed N definition(s) · <name> (<tag>) → <resource>` (and the dry-run equivalents), so a single-deployment run — the common case, which prints no per-batch banner — always shows where the deploy landed.
1189
+ - fb42001: The instance-keyed commands — `diagnose`, `fire-action`, `set-stage`, `abort`, `reset-activity` — now locate an instance by fanning out across every configured resource, the same way `show` and the other read commands already do. Passing an instance id is enough: on a config that spans several resources they no longer prompt for (or require) a `--deployment` / `--tag` selector — those stay as optional narrowers. As an optimization, an id carrying the engine's default `<tag>.` mint prefix probes that tag's resource first and skips the fan-out on a hit. `reset-activity` also gains the `--deployment` narrower its siblings already had.
1190
+ - 84ff807: The read commands — `list`, `show`, `definition list`, `definition show` — now take `--json`, emitting structured output on stdout for parity with the verb commands. `show` and `definition show` print the fetched document as stored; `list` and `definition list` print their table's row view (each row annotated with the `resource` it came from) under a `truncated` flag. A JSON read spanning several resources is all-or-nothing: an unreadable resource fails the whole command rather than emitting a partial listing a script would mistake for the complete result.
1191
+
1192
+ ### Patch Changes
1193
+
1194
+ - a8c460c: Colour the whole terminal-status row in the instance header — aborted rows render bold yellow, completed rows bold green — so a finished instance stands out from the neutral detail rows instead of only its timestamp carrying colour.
1195
+ - Updated dependencies [88ba4ba]
1196
+ - @sanity/workflow-engine@0.22.0
1197
+
1198
+ ## 0.21.0
1199
+
1200
+ ### Minor Changes
1201
+
1202
+ - 9273d55: List the nested `definition` commands (`list`, `show`, `diff`, `delete`) in the
1203
+ standalone binary's flat `--help` output. A custom oclif help class surfaces the
1204
+ bare `definition <verb>` aliases at the root instead of burying them under the
1205
+ `editorial-workflows` topic, so `sanity-workflows --help` shows every command
1206
+ without topic-digging. `help --all` still prints the full canonical tree.
1207
+ - e7392af: Add the `resetActivity` admin verb — reset a failed (or otherwise terminal) activity in an instance's current stage back to `active` (re-run) or `skipped` (bypass), then cascade so a `$allActivitiesDone`-gated exit transition can fire. `workflow.diagnose` now marks its `reset-activity` remediation `available`, and the CLI ships the real `reset-activity <instanceId> <activity> [--skip]` command in place of the stub. Emits the `Editorial Workflows Activity Reset` adoption event on every attempt (`changed: false` on a no-op), matching the `set-stage` and `abort` overrides.
1208
+
1209
+ Writes strictly within the existing model-3 grammar: it reuses the `activityStatusChanged` history variant and the existing activity statuses, so it adds no persisted shape — there is no data-model version bump and no reader-floor change.
1210
+
1211
+ ### Patch Changes
1212
+
1213
+ - b248789: CLI error detail lines now render in the terminal's default colour instead of red. The red headline with its `✖` still signals the failure; the detail beneath it (validation output, auth hints, wrapped errors) is the information the user has to read, and long runs of red text were hard to read.
1214
+ - f4bc057: **BREAKING:** `list_workflow_instances` now returns one page with `has_more` and an optional `next_cursor`; callers that need every match must continue with the cursor. The optional `limit` accepts 1–100 rows and defaults to 25.
1215
+
1216
+ Bound instance and definition list reads with lake-side filtering and consumer-specific projections.
1217
+
1218
+ Document filtering now excludes exited-stage references and includes live unresolved child-workflow references. Definition discovery selects and model-gates only the latest deployed version of each workflow name; historical versions remain stored and available to history-oriented APIs.
1219
+
1220
+ The MCP eval suite now verifies that agents follow list cursors to find a target beyond the first default page, including in persisted Braintrust runs.
1221
+
1222
+ MCP tool telemetry reports a `cursorUsed` boolean so continued list-page adoption is measurable without sending cursor values, arguments, or results.
1223
+
1224
+ - Updated dependencies [d9394e5]
1225
+ - Updated dependencies [92e28bd]
1226
+ - Updated dependencies [f4bc057]
1227
+ - Updated dependencies [bcc30fe]
1228
+ - Updated dependencies [e7392af]
1229
+ - Updated dependencies [fa9c796]
1230
+ - @sanity/workflow-engine@0.21.0
1231
+
1232
+ ## 0.20.0
1233
+
1234
+ ### Minor Changes
1235
+
1236
+ - 6e2a066: Ambiguous deployment/resource selection now prompts on an interactive terminal instead of only erroring. When a config has several deployments and no selector is given, `start`, `definition diff`, and `definition delete` show the same deployment picker `deploy` already offered. The instance-targeted commands (`abort`, `set-stage`, `fire-action`, `diagnose`) show that picker too when the config spans several resources — the interactive counterpart to their `--deployment` selector, reading from the chosen deployment's resource. Non-interactive runs (CI, piped output) keep the existing errors asking for `--deployment`/`--tag`, and `nuke` still requires an explicit selector — for a destructive command, naming exactly what is swept is the right friction.
1237
+ - 7c4dd86: Reduce guard lifecycle request volume and chunk orphan cleanup transactions.
1238
+ - e860898: **BREAKING:** Published Editorial Workflows packages now ship as one fixed release stack and require exact-version peers for every shared runtime package. Install the matching stack so the engine, reactive core, adapters, tools, and UI cannot silently load private or version-skewed copies.
1239
+
1240
+ ### Patch Changes
1241
+
1242
+ - efb4cd9: Error detail below the ✖ headline is no longer dimmed. Validation output, auth hints, and errors caught by command wrappers now render in legible red so the information users need to act on remains readable.
1243
+ - Updated dependencies [bce09fc]
1244
+ - Updated dependencies [efb4cd9]
1245
+ - Updated dependencies [46b0285]
1246
+ - Updated dependencies [ab5e454]
1247
+ - Updated dependencies [8a76c67]
1248
+ - Updated dependencies [e3122cc]
1249
+ - Updated dependencies [7e8f459]
1250
+ - Updated dependencies [98e488e]
1251
+ - Updated dependencies [7c4dd86]
1252
+ - @sanity/workflow-engine@0.20.0
1253
+
1254
+ ## 0.14.0
1255
+
1256
+ ### Minor Changes
1257
+
1258
+ - 59b40fd: **BREAKING:** deployment selection now keys on the deployment `name`, selected with `--deployment`. Deployment-targeted commands (`start`, `definition diff`, `definition delete`, `nuke`) take `--deployment` as the precise selector; `--tag` still selects while it names exactly one deployment and errors listing the candidates when it spans several. `deploy --tag <tag>` now deploys every deployment carrying the tag (a tag is an environment group); `--deployment` deploys one, `--all-tags` deploys everything, and the three are mutually exclusive. `nuke` requires exactly one of `--deployment` / `--tag`, and refuses when another same-tag deployment sweeps an overlapping resource — guard document ids embed only the tag, so within a shared dataset the sweep cannot tell the deployments' guards apart and would delete the other's live locks. The interactive deploy prompt selects by name with the tag as its description. Read commands keep `--tag` as an optional filter — a repeated tag fans reads out across every resource it is deployed to.
1259
+ - de7ccfa: The instance-keyed commands (`diagnose`, `abort`, `set-stage`, `fire-action`) accept `--deployment <name>` to choose which resource to read the instance from — the precise selector consistent with the deployment-targeted commands. `--deployment` names one deployment and reads from the resource it targets; `--tag` stays the optional narrower it was, and the instance's own tag partition still comes from the loaded instance itself, never from the flag. This closes the dead end where a tag repeated across several resources left these commands unable to resolve a resource, and the "spans multiple resources" failures now point at `--deployment` as the remedy.
1260
+
1261
+ ### Patch Changes
1262
+
1263
+ - Updated dependencies [24b11dd]
1264
+ - Updated dependencies [2005ab7]
1265
+ - Updated dependencies [24b11dd]
1266
+ - Updated dependencies [59b40fd]
1267
+ - @sanity/workflow-engine@0.19.0
1268
+
1269
+ ## 0.13.0
1270
+
1271
+ ### Minor Changes
1272
+
1273
+ - 58f8211: Every command's canonical oclif id now nests under the `editorial-workflows` topic, making the package mountable as a plugin of the `sanity` CLI (`sanity editorial-workflows deploy`) without colliding with host commands. The standalone surface is unchanged: the bare forms (`sanity-workflows deploy`, `sanity-workflows definition list`, …) remain as aliases of the nested ids.
1274
+ - 00c089d: **BREAKING:** Require every definition deployment and workflow deployment configuration to state an `expectedMinReaderModel` literal that exactly matches the installed engine's writer capability.
1275
+
1276
+ Deploy and definition-diff paths now reject missing or stale acknowledgements before client access or telemetry, with a structured error and readers-first rollout guidance.
1277
+
1278
+ - 53661fa: Prompt interactive deploys to select a configured deployment tag when several are available and no selector flag was supplied. Render Ctrl+C prompt cancellations without a stack trace.
1279
+
1280
+ ### Patch Changes
1281
+
1282
+ - 82e4a4e: Fix definition sharing to honor its opt-out contract: deploys now share newly created definition versions by default in every environment, including CI, `DO_NOT_TRACK`, and non-TTY runs. The first interactive run shows a mandatory disclosure rather than a consent choice, every other flagless run prints a clear status block with the explicit opt-in and opt-out flags, and only `--no-share-defs` suppresses sharing for that invocation.
1283
+ - 9126299: **BREAKING:** Delete persisted stage guard documents when their stage exits, and remove the lifted-record `GUARD_LIFTED_PREDICATE` and `isGuardLifted` exports.
1284
+
1285
+ Guard deletion now uses the observed document revision so stale exit reconciliation cannot delete a guard reactivated by a newer stage visit. Reactive guard streams contain only active persisted guards.
1286
+
1287
+ - Updated dependencies [239d9f6]
1288
+ - Updated dependencies [3af2ca0]
1289
+ - Updated dependencies [7276702]
1290
+ - Updated dependencies [58f8211]
1291
+ - Updated dependencies [00c089d]
1292
+ - Updated dependencies [71cd58e]
1293
+ - Updated dependencies [cd03973]
1294
+ - Updated dependencies [d26cc1a]
1295
+ - Updated dependencies [9126299]
1296
+ - Updated dependencies [72018af]
1297
+ - Updated dependencies [5cd8ffd]
1298
+ - Updated dependencies [b82bda4]
1299
+ - Updated dependencies [55a54b3]
1300
+ - Updated dependencies [b82bda4]
1301
+ - Updated dependencies [4490442]
1302
+ - Updated dependencies [1540dce]
1303
+ - @sanity/workflow-engine@0.18.0
1304
+
1305
+ ## 0.12.0
1306
+
1307
+ ### Minor Changes
1308
+
1309
+ - e3a7ba2: `start` gains `--instance-id` — for retries: the id is the start's idempotency key, so passing the id of a start that failed partway resumes it instead of creating a duplicate (an already-settled start replays as a no-op). A start whose first auto-advance fails after the instance was created and primed (`StartNotSettledError`) now reports as STARTED with the cause and the retry id — a warn, not the "Start rejected" failure path — and the `--json` payload carries `{instanceId, notSettled: true, detail}`. A start that fails before priming (`StartNotPrimedError`) still fails, with the `--instance-id` retry hint appended so the operator can resume instead of duplicating.
1310
+ - a8ace4d: New `nuke --tag <tag>` command — the dev-period big red button that deletes every engine-owned document for a deployment tag: instances, definitions, and guard docs (matched by instance-id prefix, so guards orphaned by earlier partial deletions are swept too) across the deployment's workflow resource and every alias-bound resource. Content documents are never touched. The command always prints a per-dataset dry-run plan, then requires typing back every involved `project.dataset` target; `--force` skips the prompt for scripts/CI (the plan still prints). Unlike `definition delete` (the governed lifecycle path), `nuke` deletes raw docs without reading them, so it works on pre-amendment shapes a newer engine can no longer read — the sanctioned reset while the versioned upgrade framework doesn't exist.
1311
+ - 5a1a9fe: Direct reads of engine-owned documents adopt the data-model gate (`assertReadableModel`): the CLI's instance and definition reads (`show`, `tail`, `list`, `definition show`, `definition list`, deploy lookups, the share read-back) and the MCP tools that interpret rows from the ungated `engine.query` escape hatch (`list_workflow_definitions`, `list_workflow_instances`, the definition lookup behind `start_workflow` / `get_workflow_definition`). A document written by a newer engine data model now fails with the governed "upgrade `@sanity/workflow-engine`" error instead of rendering unchecked; list projections carry the stamp pair so projected rows gate too.
1312
+
1313
+ ### Patch Changes
1314
+
1315
+ - 092a0d4: **BREAKING:** runtime-supplied refs written into field state are gated on the deployment's declared resource surface.
1316
+ - A `doc.ref` / `doc.refs` / `release.ref` value a caller or effect handler supplies — start `initialFields` input, an action's param-sourced op values, `editField` values, effect-completion ops — must target a declared resource: the `workflowResource` itself or a resource the `resourceClients` resolver serves. An off-surface ref throws the new `RefResourceUndeclaredError` and the commit aborts, instead of writing cleanly and failing later when something dereferences it. The check is advisory like every engine check; stored documents are unchanged.
1317
+ - Definition-authored refs are exempt: literal `initialValue` seeds, `type: 'query'` texts, spawn `with` projections, and op values that bind no action param were validated (and alias-expanded) at deploy, so they materialize into field state without re-checking.
1318
+ - Resource aliases stay a deploy-time abstraction: `deployDefinitions({definitions, resourceAliases?})` expands every `@<alias>:` reference to its physical GDR before fingerprinting, and nothing alias-shaped survives past deploy — the runtime holds no alias map, and an alias-shaped ref supplied to a runtime verb is rejected as malformed like any other non-GDR string.
1319
+ - `createBench` takes `serveResources` (dataset siblings served — and thereby declared — straight from the bench's own store) plus a raw `resourceClients` resolver for anything beyond same-store siblings. The engine also exports `sameResource` alongside the existing GDR helpers.
1320
+ - The CLI wires no `resourceClients`, so refs supplied at runtime through it (`start --field`, `fire-action` ref params) admit the workflow resource only.
1321
+
1322
+ - Updated dependencies [f9389e5]
1323
+ - Updated dependencies [d0c62ea]
1324
+ - Updated dependencies [c3eed2e]
1325
+ - Updated dependencies [df4bd80]
1326
+ - Updated dependencies [092a0d4]
1327
+ - Updated dependencies [5a1a9fe]
1328
+ - Updated dependencies [e3a7ba2]
1329
+ - Updated dependencies [30fed9e]
1330
+ - Updated dependencies [1321ba5]
1331
+ - Updated dependencies [e683875]
1332
+ - Updated dependencies [a8ace4d]
1333
+ - @sanity/workflow-engine@0.17.0
1334
+
1335
+ ## 0.11.0
1336
+
1337
+ ### Minor Changes
1338
+
1339
+ - e5f5b77: **BREAKING:** rendering and the `--json` diagnose payload follow the engine's actions-only payload model.
1340
+ - `fire-action`'s list mode renders a cascade-fired action as automation (`⚡ … [automation]` with the engine's canonical cascade-fired detail), never as a fireable command; other disabled reasons keep the shared `actionDisabledDetail` rendering.
1341
+ - `diagnose` renders transitions by their `when` trigger (`whenSatisfied` replaces `filterSatisfied` in the `--json` transitions payload), narrates a waiting activity by its caller-fireable actions only (an all-automation activity reads "waiting on automation"), and words failed-effect causes by their action origin.
1342
+ - The activity status glyphs drop `pending` — activities are active from stage entry.
1343
+
1344
+ - 7510fd5: **BREAKING:** `list` speaks the engine's filter vocabulary: the `--in-flight` flag (default: list everything) is replaced by `--include-completed` (default: in-flight only) — the same name, polarity, and default the engine and MCP list surfaces use. `list` also gains `--document <gdr-uri>` to list the instances that reference a document.
1345
+
1346
+ Fixes: expected failures (rejected write verbs, validation errors, the 401 arm) now exit by throwing through the oclif lifecycle instead of a raw `process.exit`, so the telemetry `finally` hook still completes the command trace and flushes batched events; `tail` serializes its notification handling (a burst of commits could double-print history entries and regress the high-water mark); and an untagged `definition show` whose name exists in several tag partitions of one dataset now errors listing the partitions — it previously picked the highest version across partitions, which could show a prod operator the dev definition.
1347
+
1348
+ - 6e7f42d: **BREAKING:** Definition sharing on `deploy` flips from opt-in to opt-out, and the flag is renamed. `--share-definitions-with-sanity` becomes the negatable `--share-defs` / `--no-share-defs`. A deploy that creates new definition versions now donates them by default; `--no-share-defs` opts out.
1349
+
1350
+ With neither flag, an interactive terminal is asked **once** — a blocking acknowledgement whose answer persists in the Sanity user config, so it never repeats — before anything is sent, since notice must precede the send. Every later flagless deploy prints a one-line reminder of the current state and the flag to change it, so an ongoing donation is never silent. Unattended runs (CI, `DO_NOT_TRACK`, non-TTY) can't prompt and donate nothing by default; opt in per run with `--share-defs`.
1351
+
1352
+ An explicit `--share-defs` also sends that deploy's telemetry regardless of CI / `DO_NOT_TRACK` (a command-line arg beats env vars; account-level `sanity telemetry disable` still applies). Telemetry gains a content-free `Editorial Workflows Definition Sharing Decided` event per invocation — how the decision was reached and what it was (`opt-in` / `opt-out` / `prompt-accepted` / `prompt-declined` / `remembered-share` / `remembered-decline` / `unattended`), whether anything reached the endpoint, and how many versions were eligible — so adoption dashboards can separate explicit opt-outs, prompt declines, and unattended runs and measure the true opt-out rate. The per-definition `Editorial Workflows Definition Shared` marker and the one-POST feedback transport are unchanged.
1353
+
1354
+ ### Patch Changes
1355
+
1356
+ - Updated dependencies [11e2d6f]
1357
+ - Updated dependencies [7510fd5]
1358
+ - Updated dependencies [01e8042]
1359
+ - Updated dependencies [79c54db]
1360
+ - Updated dependencies [6a46db1]
1361
+ - Updated dependencies [35b9b85]
1362
+ - Updated dependencies [e5f5b77]
1363
+ - Updated dependencies [01e8042]
1364
+ - @sanity/workflow-engine@0.16.0
1365
+
1366
+ ## 0.10.0
1367
+
1368
+ ### Minor Changes
1369
+
1370
+ - d4fd8e6: Deploy grows an explicit definition-sharing opt-in — content sharing, not telemetry, opted into by flag alone with nothing persisted and never a prompt. `deploy --share-definitions-with-sanity` shares the definition documents that deploy newly created, verbatim — the full document: structure, names, titles, GROQ filters, effect configuration, and seeded values, plus its deployment coordinates (project and dataset, or resource id); never content documents, workflow instances, or Sanity auth tokens — for that invocation only. Without the flag, an interactive deploy that created new versions logs a one-line stderr hint pointing at it (CI / non-TTY runs stay silent); telemetry consent and `DO_NOT_TRACK` play no part. Shared documents ride one POST per invocation to Sanity's first-party definition-feedback endpoint — never the telemetry pipeline — and a failed share only warns, never failing a completed deploy. Telemetry keeps a content-free `Editorial Workflows Definition Shared` marker per shared definition, projected from the same structural derivation as `Editorial Workflows Definition Deployed`; unchanged re-deploys neither hint nor share.
1371
+ - 5cb0850: `diagnose` renders insight under each unsatisfied exit transition — the transition line gains a dim `↳ Needs: …` summary from the evaluation's derived state, so "stuck" reads as "stuck until X" in the definition's own vocabulary. `--json` gains the RAW derived state instead (`transitions[].blockedBy` with each atom's GROQ and solvable requirement) — structure for scripts, language for humans.
1372
+ - 15337f1: Request-tag CLI traffic: clients carry the `sanity.workflows.cli` request-tag prefix — the workflows-owned family with the runtime as its segment, never another team's family. The family identifies the traffic, so per-request tags are bare command ops (`list`, `show`, `definition.list`, `definition.show`, `definition.load`, `instance.load`, `tail` — the tail listener passes a per-request tag because a prefix alone never tags listen requests) and engine verbs strip their `workflow.` root under the family prefix, so everything lands as `sanity.workflows.cli.<op>` in request logs.
1373
+ - ced40e4: The CLI is now its own telemetry app shell. A `prerun` hook builds a batched store over the standard Sanity-intake recipe (CI or `DO_NOT_TRACK` deny without a network call; not logged in or no dataset-backed deployment → nothing is sent; otherwise the account-level consent status), shows a one-time stderr disclosure, and threads the store's logger into every engine write verb so engine adoption events flow from CLI-driven operations. A `finally` hook completes the `Editorial Workflows CLI Command Executed` trace — command id, names of declared flags used (never values), success flag — and flushes with a deadline. A `telemetry` logger on the workflow config replaces the built-in shell wholesale: every event flows to it unconditionally and consent/suppression/transport become its business.
1374
+ - 0709ab1: De-duplicate the write-verb scaffolding and adopt the engine's canonical helpers:
1375
+ - Every write command (`abort`, `set-stage`, `fire-action`, `start`, `definition delete`) now runs through one `runWriteVerb` helper owning the spinner start / report emit / fail-and-exit catch shape, and the ", then cascaded N auto-transition(s)" suffix comes from one `cascadeTail` helper.
1376
+ - The CLI's local `errorMessage` copy is gone — all error rendering uses the engine's exported `errorMessage` (same control-character stripping as before).
1377
+ - Instance status in `list` and the aborted/completed header in `show` derive from the engine's `terminalState`.
1378
+ - History entries in `tail` and `show --include history` now print the engine's display titles (e.g. "Transition fired") instead of raw discriminators (`transitionFired`).
1379
+ - `fire-action`'s list mode renders the engine's new `instance-aborted` verdict ("instance aborted at …") for actions on aborted instances.
1380
+
1381
+ - adf32f7: **BREAKING:** the `--as` / `--as-role` impersonation flags and the pinned `workflow-cli` system actor are removed. Every write is attributed to the user behind the configured token (`/users/me`); impersonation means running with a different token. The CLI declares `executionContext {kind: 'cli', id: 'workflow-cli'}` on its engine scope, so history records the environment without forging identity.
1382
+ - 91540de: **BREAKING:** every shell-defined telemetry event name now carries the product name — `Editorial Workflows CLI Command Executed`, `Editorial Workflows Definition Shared` (workflow-cli), `Editorial Workflows MCP Tool Called` (workflow-mcp), `Editorial Workflows Session Started` (workflow-react) — replacing the bare `Workflow <X>` forms, which never shipped. Event names are matched verbatim downstream.
1383
+
1384
+ Shell context parity: every self-owned telemetry shell now attaches its execution environment, following the sanity CLI and Studio precedents. User identity stays sink-side — the intake service resolves the sender from the authenticated session on every event.
1385
+ - CLI: `updateUserProperties` with the sanity CLI's set (cliVersion, platform, architecture, runtime, runtime version, projectId, dataset) plus `surface: 'cli'` and `orgId` resolved once per invocation from the projects API (deadline-capped, degrade-soft — a failed lookup omits the property, never blocks a command).
1386
+ - SDK: Studio-style context enrichment on every posted event — `surface: 'sdk'`, package version, environment, userAgent, project coordinates.
1387
+ - MCP: `updateUserProperties` on store initialization — `surface: 'mcp'`, package version, runtime info, the addressed project coordinates; the server handshake now reports the real package version instead of `0.0.0`.
1388
+ - React hosts (Studio, SDK, custom): the session layer pushes `{surface: host}` into the HOST's own session stream via `updateUserProperties` — Studio-hosted events get an explicit surface marker without touching Studio's transport.
1389
+ - The `Editorial Workflows Definition Shared` marker carries the deploy run's `deployId`, so donated definitions group with the deploy events that minted them.
1390
+
1391
+ - d6e92ed: Now published with public npm access (previously restricted) — installable without `@sanity` org membership.
1392
+ - 23cf131: Render the engine's new `subject-permission-denied` disabled reason — the actor lacks write permission on a subject document in that subject's own resource.
1393
+ - 0a8baa4: Untagged reads now fan out across every distinct resource the config mentions instead of failing with "Config spans multiple resources — pass --tag to choose one": `list` and `definition list` query each dataset and group output under per-resource banners (an unreadable resource is noted in place, the rest still render, and the command exits non-zero), `show` and `tail` look the instance id up across resources (erroring if it exists in several), and `definition show` errors when the name is deployed to more than one dataset. `--tag` still narrows any read to that deployment's resource.
1394
+ - f580319: Match the Sanity CLI's output styling: `list` and `definition list` render borderless column tables (lowercase cyan header row, three-space gutters, uncolored cells) instead of boxed tables, and the detail lines under an error headline render in muted red. `definition list` gains a `created` column showing when each definition version was deployed and drops the `startable` column to keep rows scannable, and both list commands print a dim "showing the first N — raise --limit" note when results exceed the limit instead of truncating silently.
1395
+ - ced40e4: Request tags move to workflows-owned families with the runtime as the segment: `sanity.workflows.cli`, `sanity.workflows.studio`, `sanity.workflows.sdk` — never another team's family (`sanity.cli.*`, `sanity.studio.*`) — and platform analysis zero-rates `sanity.workflows.*`. The MCP server deliberately sits outside that family as `sanity.workflows-mcp` (no dot boundary), so agent-driven traffic bills. Under any workflows-family prefix the engine's tag wrapper strips the now-redundant `workflow.` root from every relative op tag — stamped fallback and explicit alike — so traffic lands as `sanity.workflows.cli.deploy` with exactly one workflows segment; on raw consumer clients and under foreign host prefixes the root stays, since there it is what identifies the traffic. The Studio adapter's engine and resource-router clients and the SDK telemetry shell's intake client now set their family prefix themselves instead of riding the host's.
1396
+
1397
+ ### Patch Changes
1398
+
1399
+ - e374155: Auth rejections (HTTP 401) now exit through the CLI's clean error path with a recovery hint — re-run `sanity login` when the session token has lapsed, or check `SANITY_AUTH_TOKEN` when the env token is set — instead of surfacing a raw oclif error.
1400
+ - 9f5a40f: Document that the CLI's token must span every resource the workflow references — runtime commands build one client from the deployment descriptor, and the engine reaches foreign datasets/resources through sibling clients derived from that same token. Cross-resource runtime routing (`show`, `diagnose`, `fire-action`) is now covered against a subject document living in a different dataset than the workflow resource, with no resolver wiring.
1401
+ - 109f900: `workflow deploy` now prints the advisory effect-output lint warnings returned on each deploy result, indented beneath the definition they belong to, so the producer/consumer hints are visible on the CLI deploy path (previously only carried on the result object).
1402
+ - 5cb0850: Type-only: the diagnose renderer consumes the engine's narrowed `DiagnosedTransition` slice instead of the full `TransitionEvaluation`, matching what the classifier actually reads. No behavior change.
1403
+ - 1045843: `definition diff` and `deploy --dry-run` now show only the authored fields that differ. The deploy envelope (`_id`, `_type`, `tag`, `version`, `contentHash`) is stripped from both sides before diffing — version and document id already appear on the Summary line — and long runs of unchanged context collapse to a dim `… N unchanged lines` marker with three lines of context around each change. Net-new definitions still render in full; the deploy-generated-fields footnote is gone along with the noise it explained.
1404
+ - 8077858: The build now cleans `dist/` before compiling, so removed commands can no longer ship as orphaned artifacts in a locally packed tarball (`tsc` never deletes outputs for deleted sources, and `files: ["dist"]` ships the whole directory). A packaging smoke test guards the packed output: the tarball must contain exactly the command modules that exist in `src`, and the built bin must load and register every command — catching broken specifier rewrites and stale workspace-dependency builds that stay green in unit tests and only surface for a consumer.
1405
+ - 6c21009: Correct public TSDoc and README claims that contradicted the implementation: CLI auth precedence (an explicit `SANITY_AUTH_TOKEN` wins over the `sanity login` session), the real CLI verbs (`workflow.diagnose`, `workflow.availableActions`) and document types (`sanity.workflow.instance` / `sanity.workflow.definition`), guard predicates reading the delta-mode `before()`/`after()` natives, glob patterns supporting multiple `*`s, where `$can` actually binds (requirements and the editField gate, not action filters alone), the editField target contract (any-scope match with activity-first precedence), guard observation fan-out across the engine dataset plus each watched subject's dataset, the object value expression being op-payload-only, and the MCP descriptor / SDK observer export pointers. The deploy-time `$can` rejection error now states where `$can` actually binds (the caller-bound projection: action filters, requirements, editable predicates) instead of claiming action filters are its only home.
1406
+ - 7ffdc77: New `clientConfigFromResource(resource)` export — the `@sanity/client`-config
1407
+ fragment addressing a `WorkflowResource` (dataset via the classic
1408
+ `{projectId, dataset}` config, other resource types passed through as
1409
+ `resource`). The one home for that branch: hosts spread it into their own
1410
+ `createClient` call, and the CLI's `clientFor` now derives its config through
1411
+ it instead of a private copy.
1412
+ - 72bd7ef: The packaging suite (subprocess dependency-chain build + `pnpm pack` + spawning the built bin) no longer runs in the default vitest run — it starved sibling suites into nondeterministic timeouts on loaded machines. CI runs it explicitly; opt in locally with `pnpm --filter @sanity/workflow-cli test:packaging`.
1413
+ - dc64968: Published tarballs no longer include sourcemaps (whose `sourcesContent` embedded the complete TypeScript source) or inline code comments in the compiled JS — license markers and bundler annotations (`/*@__PURE__*/`-style tree-shaking hints) are preserved. Types and TSDoc in `.d.ts` files ship unchanged, and the tarballs shrink accordingly (workflow-engine: ~3× smaller). Each tarball now ships its `CHANGELOG.md`, so release notes reach consumers who can install the package but cannot see the repository.
1414
+ - Updated dependencies [4ca17bb]
1415
+ - Updated dependencies [5143707]
1416
+ - Updated dependencies [0709ab1]
1417
+ - Updated dependencies [6bbf3ca]
1418
+ - Updated dependencies [9f5a40f]
1419
+ - Updated dependencies [d192d68]
1420
+ - Updated dependencies [6c21009]
1421
+ - Updated dependencies [109f900]
1422
+ - Updated dependencies [109f900]
1423
+ - Updated dependencies [444b0e6]
1424
+ - Updated dependencies [2511bb5]
1425
+ - Updated dependencies [d4fd8e6]
1426
+ - Updated dependencies [30ed0e8]
1427
+ - Updated dependencies [2834704]
1428
+ - Updated dependencies [2511bb5]
1429
+ - Updated dependencies [2511bb5]
1430
+ - Updated dependencies [2511bb5]
1431
+ - Updated dependencies [4607d59]
1432
+ - Updated dependencies [52f6024]
1433
+ - Updated dependencies [a8f1cb9]
1434
+ - Updated dependencies [adf32f7]
1435
+ - Updated dependencies [5cb0850]
1436
+ - Updated dependencies [70a136c]
1437
+ - Updated dependencies [91540de]
1438
+ - Updated dependencies [8455fbb]
1439
+ - Updated dependencies [325c2d1]
1440
+ - Updated dependencies [d6e92ed]
1441
+ - Updated dependencies [6c21009]
1442
+ - Updated dependencies [7ffdc77]
1443
+ - Updated dependencies [325c2d1]
1444
+ - Updated dependencies [7ffdc77]
1445
+ - Updated dependencies [ced40e4]
1446
+ - Updated dependencies [9b1b40d]
1447
+ - Updated dependencies [8c319b2]
1448
+ - Updated dependencies [dc64968]
1449
+ - Updated dependencies [23cf131]
1450
+ - Updated dependencies [d192d68]
1451
+ - Updated dependencies [15337f1]
1452
+ - Updated dependencies [2d1a8e1]
1453
+ - Updated dependencies [12cdbd6]
1454
+ - Updated dependencies [437b544]
1455
+ - Updated dependencies [ced40e4]
1456
+ - @sanity/workflow-engine@0.15.0
1457
+
1458
+ ## 0.9.0
1459
+
1460
+ ### Minor Changes
1461
+
1462
+ - a0443c4: **BREAKING:** Configure the CLI via a discovered `sanity.workflow.ts` instead of `WORKFLOW_*` environment variables. Every command now loads `defineWorkflowConfig({deployments: [...]})`, selects a deployment by `--tag` (or the sole deployment when only one is configured), and authenticates via the `sanity login` session (falling back to `SANITY_AUTH_TOKEN` for CI). Definitions and resource-handle bindings come from the selected deployment; `deploy` expands the bindings via `resourceAliases` at deploy time.
1463
+
1464
+ Removed env vars: `WORKFLOW_RESOURCE_TYPE`, `WORKFLOW_RESOURCE_ID`, `WORKFLOW_TAG`, `WORKFLOW_DEFS`, `SANITY_PROJECT_ID`, `SANITY_DATASET` (project/dataset are now derived from the deployment's resource).
1465
+
1466
+ Read commands (`list`, `definition list`, `definition show`, `show`, `tail`) inspect everything in the Content Lake resource — the config only locates which resource to read and authenticates; it never filters results to the config's tag or definitions. `--tag` is an optional query filter (omit it to span all partitions). The config selects the resource automatically when all deployments share one, and needs `--tag` only to disambiguate a config that spans multiple resources.
1467
+
1468
+ - 83d5924: **BREAKING:** One vocabulary with the engine across the command surface, plus instance start.
1469
+ - `move-stage` is renamed `set-stage`, matching the engine verb it calls (`workflow.setStage`), with help text that states the semantics honestly: an admin override that skips the definition's declared transitions and filters, while the target stage's enter lifecycle and the post-move cascade still run. Its no-op report now distinguishes a terminal instance from an already-at-target one.
1470
+ - The hidden `set-stage` guard-bypass stub is deleted — its name promised the opposite of the engine verb's semantics, and no bypass path exists in the engine. The hidden `retry-activity` stub is renamed `reset-activity` to match the engine's remediation verb.
1471
+ - One noun for definition identity: `definition diff` takes `<name>` (matching `show`/`delete`), `list --workflow-name` becomes `list --definition <name>`, and `definition list --workflow-name` becomes `definition list --name`.
1472
+ - `diagnose` renders remediation verbs under their engine names, so human output and `--json` share one vocabulary; write-command errors are prefixed with the command's own name (`set-stage error:`, `fire-action error:`, `abort error:`, `definition delete error:`) instead of engine verb spellings.
1473
+
1474
+ New: `start <name>` starts an instance from a deployed definition — `--field name=value` supplies the workflow's input-sourced fields (typed against the deployed definition's declared entries; a value for a non-input field is rejected rather than silently ignored), `--version` pins a version, `--as` / `--as-role` attribute the start to a real user, and `--json` emits structured output. Spawn-only (`lifecycle: 'child'`) definitions are refused with an explanation, so the `definition list` Startable column points at a real affordance. Write-path error output is routed through the control-character-stripping `errorMessage` helper across all commands.
1475
+
1476
+ - 845266e: `deploy` gains an `--all-tags` flag to deploy every deployment in the config in one run. The default stays a single target: `--tag <tag>` selects a deployment (omittable when only one is configured), and an ambiguous bare `deploy` against a multi-deployment config fails asking for `--tag` or `--all-tags` — deploying everything is always an explicit opt-in, never a default.
1477
+
1478
+ Definitions are validated up front, so a bad definition fails before anything is written — attributed to its deployment when the run spans several. During an `--all-tags` run, deployments are independent and idempotent, so a failure in one doesn't strand the rest: the run continues, then prints a summary of which deployments failed and exits non-zero (a single-target failure propagates directly instead). Deploys stay idempotent — an unchanged, content-addressed definition deploys as a no-op — and `--check` / `--dry-run` compose with both `--tag` and `--all-tags`. Output is labelled per deployment when a run spans more than one.
1479
+
1480
+ - 5c69928: **BREAKING:** runtime API coherence pass — one result shape, one session noun, nameable engine args.
1481
+ - `DispatchResult` → `OperationResult`, and its `fired` flag → `changed` with one meaning honored by every verb: this call changed the instance's workflow state (`false` = successful no-op — an idempotent re-fire, a tick that wrote nothing, a `setStage` already at the target, an abort of an already-terminal instance; failures still throw). `tick` derives it from the instance revision, so a persisted activity-gate flip that didn't unlock a transition still reports `changed: true`. `abortInstance` documents its always-`0` cascade (a terminal instance doesn't cascade; ancestor propagation reports on the ancestors).
1482
+ - `startInstance` now returns `OperationResult` instead of a bare `WorkflowInstance` — its cascade is finally observable. Reach the instance via `result.instance`.
1483
+ - Engine argument types are exported and nameable: the exported `*Args` shapes are now exactly what `Engine` methods take, and the raw `workflow.*` namespace takes `<Verb>Args & EngineScopeArgs` (the new exported scope type: `client` / `tag` / `workflowResource` / `resourceClients`). New named args for the read/housekeeping verbs: `InstanceRefArgs`, `ChildrenArgs`, `GuardsForDefinitionArgs`, `InstancesForDocumentArgs`, `QueryArgs`, `QueryInScopeArgs`, `FindPendingEffectsArgs`, `DrainEffectsArgs`, `SessionArgs`. `EvaluateArgs` is likewise scope-free now.
1484
+ - Verb-surface parity between `Engine` and `workflow.*` is exact and documented: `Engine.evaluateInstance` → `Engine.evaluate` (matching `workflow.evaluate`); engine-only members (`session`, `subscriptionDocumentsForInstance`, `drainEffects`, `verifyDeployedDefinitions`) and the namespace-only `workflow.permissions` are called out as deliberate.
1485
+ - One noun for the reactive session handle: `engine.instance(doc, opts?)` → `engine.session({instance, access?, grantsFromPath?})` (args object — no positional outlier), still returning `InstanceSession`; workflow-react's `WorkflowInstanceController` → `WorkflowSession`; the studio/sdk hooks `useWorkflowInstance` → `useWorkflowSession`. "Instance" now always means the document.
1486
+ - Test bench mirrors the engine: `bench.startInstance` returns `OperationResult`, and the `Bench*Args` types are the engine-bound shapes minus `access`.
1487
+ - CLI reports follow the rename: the report objects for `fire-action` / `move-stage` / `abort` (and `fire-action`'s `--json` payload) now say `changed` instead of `fired`.
1488
+
1489
+ - 6ee9068: **BREAKING:** follow the engine's vocabulary sweep. `definition list` projects the stored `lifecycle` key (was `role`) to flag spawn-only definitions — definitions deployed before the rename show as startable until redeployed. `fire-action --as` attributes the fire as a `person` actor (was `user`).
1490
+
1491
+ ### Patch Changes
1492
+
1493
+ - a0443c4: `definition diff` (and `deploy --dry-run`) now footnote the detail diff to explain that `_id`, `version`, and `contentHash` are deploy-generated — they change as a function of the content, so their `+`/`-` lines reflect the content change rather than fields the author edited. Without the note an operator could read a bumped `version` as a field they'd set themselves.
1494
+ - 2f081a3: Render a `mutation-guard-denied` verdict from its `denied` payload via the engine's shared `deniedGuardLabels` (guard name over id), following the unified guard-denial shape.
1495
+ - a0443c4: Instance-targeted commands (`diagnose`, `abort`, `move-stage`, `fire-action`) now derive their tag partition from the instance itself rather than from the config's declared deployments. An instance id is globally unique and carries its own `tag`, so naming one acts on that instance regardless of which tags `sanity.workflow.ts` happens to deploy — the config only locates the resource and authenticates, the same read-context model `show`/`tail` already use. This removes a self-lockout: a `trial`-only config previously could not `diagnose` or `abort` an instance in another partition (e.g. a `bench`- or `prod`-tagged one), failing with "not visible to this engine (tag mismatch)". On these commands `--tag` is now only used to disambiguate a config that spans multiple resources.
1496
+
1497
+ Only `deploy`, `definition diff`, and `definition delete` remain scoped to a declared deployment — they act on the authored definition set or a definition name, which (unlike an instance id) isn't unique across tags.
1498
+
1499
+ - df00bbb: The client's API version now comes from the engine's exported `ENGINE_API_VERSION` pin instead of a hand-copied literal, so every client bound to the engine stays on one version by construction.
1500
+ - a0443c4: `show` no longer crashes on a workflow instance whose stage omits its `activities` array (an activity-less stage, or an older-shape / raw-client-written document). Such a stage now renders with no activities instead of throwing `activities is not iterable`.
1501
+ - Updated dependencies [a0443c4]
1502
+ - Updated dependencies [a0443c4]
1503
+ - Updated dependencies [ad9b6f6]
1504
+ - Updated dependencies [83d5924]
1505
+ - Updated dependencies [7a655bd]
1506
+ - Updated dependencies [d9c8179]
1507
+ - Updated dependencies [0a7979a]
1508
+ - Updated dependencies [df00bbb]
1509
+ - Updated dependencies [5c69928]
1510
+ - Updated dependencies [2f081a3]
1511
+ - Updated dependencies [df00bbb]
1512
+ - Updated dependencies [113a796]
1513
+ - Updated dependencies [df00bbb]
1514
+ - Updated dependencies [2829643]
1515
+ - Updated dependencies [6ee9068]
1516
+ - Updated dependencies [2829643]
1517
+ - Updated dependencies [a0443c4]
1518
+ - @sanity/workflow-engine@0.14.0
1519
+
1520
+ ## 0.8.1
1521
+
1522
+ ### Patch Changes
1523
+
1524
+ - 5bbc3f0: Internal refactor: functions that took 3+ positional parameters now take a single named options object. No public API or behavior change — the package's exported surface (and, for the CLI, its commands and output) is unchanged.
1525
+ - Updated dependencies [416d4c9]
1526
+ - Updated dependencies [4dfe72a]
1527
+ - Updated dependencies [5bbc3f0]
1528
+ - Updated dependencies [0bf7503]
1529
+ - Updated dependencies [6e51913]
1530
+ - Updated dependencies [3229f41]
1531
+ - @sanity/workflow-engine@0.13.0
1532
+
1533
+ ## 0.8.0
1534
+
1535
+ ### Minor Changes
1536
+
1537
+ - d850aef: **BREAKING:** Workflow definitions are now immutable and content-addressed — the author no longer writes a `version`.
1538
+
1539
+ A definition's `version` (and a new `contentHash` fingerprint) are stamped onto the deployed _document_ at deploy time, derived from the content itself — the same envelope as `_id`/`_type`/`tag`. `defineWorkflow` no longer accepts a `version` (the authoring schema rejects it), and the `WorkflowDefinition` type no longer carries one.
1540
+
1541
+ `deployDefinitions` is now create-only: it hashes the authored content and compares it to the latest deployed version of that name. Identical content is a no-op (`unchanged`); any change mints the next version (`created`). It never patches a deployed version in place, so a definition can no longer change out from under the instances pinned to it. (Engine-side only — true immutability of the deployed document still requires a Content Lake guard; the engine enforces nothing.) Deploying two definitions with the same name in one batch is now rejected.
1542
+
1543
+ Instances pin `pinnedContentHash` alongside `pinnedVersion`, so a consumer can detect a deployed definition that has drifted from what an instance started on.
1544
+
1545
+ API changes:
1546
+ - `defineWorkflow({ version })` / `WorkflowDefinition.version` removed — drop `version` from authored definitions.
1547
+ - `DeployDefinitionResult.status` drops `'updated'` (now `'created' | 'unchanged'`); `DiffEntry.status` drops `'update'` (now `'create' | 'unchanged'`) — a content change is always a new version.
1548
+ - `isDefinitionUnchanged` removed; the content fingerprint is now exposed as `hashDefinitionContent`. `DeployedDefinition` is exported for consumers reading deployed documents.
1549
+ - Spawn refs (`task.subworkflows.definition.version`) are unchanged — you can still pin another definition's deployed version.
1550
+
1551
+ - 9519c76: **BREAKING:** Rename the structural `Task` node in the workflow DSL to `Activity`. The node holds multiple Actions, its own scoped Fields, and a status lifecycle — it is not atomic, so in process-modelling terms it is an _Activity_ (BPMN: Activity is the umbrella for work, Task the atomic kind). This frees the word "task" so it never appears in the model — "Tasks" is now purely a product/UI worklist view, not a model entity.
1552
+
1553
+ `Action` (the actor-fired command) is unchanged.
1554
+
1555
+ The rename cascades across the whole surface:
1556
+ - Authoring: `defineTask` → `defineActivity`; the `tasks:` array on a stage → `activities:`; `Task`/`AuthoringTask` types → `Activity`/`AuthoringActivity`.
1557
+ - Classification: `TASK_KINDS` → `ACTIVITY_KINDS`, `TaskKind` → `ActivityKind`, `deriveTaskKind`/`taskKind` → `deriveActivityKind`/`activityKind` (kind values `user`/`service`/`script`/`manual`/`receive` are unchanged). The shipped "task kinds" surface is retitled "Activity kinds".
1558
+ - Status: `TASK_STATUSES`/`TaskStatus` → `ACTIVITY_STATUSES`/`ActivityStatus` (and the terminal-status counterparts); status _values_ are unchanged.
1559
+ - Predicate sentinels: `$tasks` → `$activities`, `$allTasksDone` → `$allActivitiesDone`, `$anyTaskFailed` → `$anyActivityFailed`, `$requiredTasksDone` → `$requiredActivitiesDone`, `$task` → `$activity`. Authored GROQ filters referencing the old names must be updated.
1560
+ - Persisted/wire format: the `'task'` field scope value → `'activity'`, history entry types (`taskActivated`/`taskStatusChanged` → `activityActivated`/`activityStatusChanged`), and engine result/diagnostic codes (`failed-task` → `failed-activity`, `task-not-active` → `activity-not-active`, `reset-task` → `reset-activity`, etc.).
1561
+ - `workflow-react`: the `fireAction` argument `{task}` → `{activity}`.
1562
+
1563
+ Nothing referencing "task" remains in the model. This is a deliberate pre-customer breaking change to land the correct, permanent vocabulary.
1564
+
1565
+ - 6aa682e: **BREAKING:** Rename the `--workflow-id` filter to `--workflow-name` on `list` and `definition list`. The flag always filtered by definition name, not an id, so the new name matches both its behaviour and how definitions are referenced everywhere else (`definition show <name>`, etc.). `--workflow-id` is no longer accepted.
1566
+
1567
+ ### Patch Changes
1568
+
1569
+ - Updated dependencies [5b10863]
1570
+ - Updated dependencies [ae1434e]
1571
+ - Updated dependencies [d850aef]
1572
+ - Updated dependencies [9519c76]
1573
+ - Updated dependencies [9233cd3]
1574
+ - Updated dependencies [3ea4953]
1575
+ - Updated dependencies [e5a862a]
1576
+ - @sanity/workflow-engine@0.12.0
1577
+
1578
+ ## 0.7.1
1579
+
1580
+ ### Patch Changes
1581
+
1582
+ - Updated dependencies [3b8f3de]
1583
+ - @sanity/workflow-engine@0.11.0
1584
+
1585
+ ## 0.7.0
1586
+
1587
+ ### Minor Changes
1588
+
1589
+ - fae3553: **BREAKING:** Rename the domain concept **state → fields** across the whole API and persisted data model.
1590
+
1591
+ "State" was too easily conflated with "stage". The typed, valued data attached to workflows, stages, and tasks is now called **fields** — clearer, and aligned with Sanity schemas: the fields on a workflow, stage, and task can have typed values. This is a clean break (no migration, no back-compat); already-deployed definitions and instances must be redeployed/recreated.
1592
+
1593
+ **Authoring DSL**
1594
+ - `defineState(...)` → `defineField(...)`
1595
+ - The `state: [...]` array on a workflow / stage / task → `fields: [...]`
1596
+ - The `$state.<name>` GROQ scope token → `$fields.<name>`
1597
+ - A `claim` action's `state:` reference → `field:`
1598
+ - A `stateRead` source → `fieldRead`; its `state:` (entry name) → `field:`
1599
+ - Op targets address the entry by `field:` instead of `state:`
1600
+
1601
+ **Persisted / wire format**
1602
+ - Op type strings `state.set` / `state.unset` / `state.append` / `state.updateWhere` / `state.removeWhere` → `field.*`
1603
+ - The stored `state[]` array on instances, stage entries, and task entries → `fields[]`
1604
+ - `startInstance({ initialState })` → `startInstance({ initialFields })`
1605
+
1606
+ **Types & functions** (engine)
1607
+
1608
+ `StateEntry`→`FieldEntry`, `AuthoringStateEntry`→`AuthoringFieldEntry`, `ResolvedStateEntry`→`ResolvedFieldEntry`, `InitialStateValue`→`InitialFieldValue`, `StateKind`→`FieldKind`, `StateValueMap`→`FieldValueMap`, `StateScope`→`FieldScope`, `StoredStateRef`→`StoredFieldRef`, `STATE_SLOT_DISPLAY`→`FIELD_SLOT_DISPLAY`, `EditStateArgs`→`EditFieldArgs`, `EditStateTarget`→`EditFieldTarget`, `EditStateDeniedError`→`EditFieldDeniedError`, `ConcurrentEditStateError`→`ConcurrentEditFieldError`, `RequiredStateNotProvidedError`→`RequiredFieldNotProvidedError`, and the `editState` verb → `editField`.
1609
+
1610
+ Unchanged: runtime/lifecycle instance "state" (stage moves, `WorkflowStateDivergedError`, the projected instance snapshot), the `field`/`fields` JSON-matching primitives in `updateWhere`/`removeWhere` predicates and object Sources, and the Content Lake release `state`.
1611
+
1612
+ ### Patch Changes
1613
+
1614
+ - Updated dependencies [fae3553]
1615
+ - @sanity/workflow-engine@0.10.0
1616
+
1617
+ ## 0.6.1
1618
+
1619
+ ### Patch Changes
1620
+
1621
+ - Updated dependencies [2e4c980]
1622
+ - Updated dependencies [fd6b866]
1623
+ - @sanity/workflow-engine@0.9.0
1624
+
1625
+ ## 0.6.0
1626
+
1627
+ ### Minor Changes
1628
+
1629
+ - d798521: Align CLI output with Sanity CLI conventions.
1630
+ - Instance display (`show`, `diagnose`, `fire-action`): the boxed header is
1631
+ replaced by a plain `styleText` key-value block (bold workflow + id title,
1632
+ dim aligned rows) and task states show colored status glyphs. An aborted
1633
+ instance shows its abort line in place of a misleading green "Completed".
1634
+ `diagnose` and `fire-action` bodies use the same Title-Case section
1635
+ headings as `show` (e.g. `Tasks`, `Exit transitions`, `Why it's stuck`,
1636
+ `Suggested fix`, `Actions on stage '…'`).
1637
+ - `diagnose`: the rendered "Suggested fix" block now lists only remediations
1638
+ the CLI can actually run (`move-stage`, `abort`); planned verbs the engine
1639
+ names but the CLI can't yet perform are no longer shown there (they remain
1640
+ in `--json`).
1641
+ - `definition show`: drops the boxed header for the same plain `styleText`
1642
+ key-value block (bold name + version title, dim `Title` / `Description` /
1643
+ `Tag` rows — the deploy partition is now shown), and the stage/task/action
1644
+ tree uses a bold `Stages` heading with dim secondary text and a cyan
1645
+ `[initial]` marker. Long descriptions now soft-wrap in the terminal instead
1646
+ of being pre-wrapped to a fixed box width.
1647
+ - `list`: drops the `failed` count column and the never-implemented `--subject`
1648
+ flag; adds a relative `Updated` column (`lastChangedAt`) and a `Tag` column
1649
+ (the listing spans partitions); adds an optional `--tag` filter to match
1650
+ `definition list`; colors the `Status` column; orders by most-recently-changed.
1651
+ - `definition list`: narrows the table — folds the version into the `Workflow`
1652
+ column as `name vN` (this CLI's identifier format), drops the redundant
1653
+ `Definition ID` column (the doc `_id` is just `tag.name.vN`, which the
1654
+ Workflow + Tag columns already show, and no command takes a raw `_id`), and
1655
+ shortens the count headers (`Total stages` → `Stages`, `Instances in flight`
1656
+ → `In flight`, `Total instances` → `Instances`).
1657
+ - `definition diff`: the report colors move from `picocolors` to `styleText`
1658
+ and the summary heading uses the shared `sectionHeader` (`Summary:`) for
1659
+ consistency with the rest of the CLI.
1660
+ - Write verbs (`abort`, `move-stage`, `definition delete`), `tail`, and the
1661
+ shared `lib/fail` / `lib/ops-report` helpers move their colors from
1662
+ `picocolors` to `styleText` too. With that the `picocolors` dependency is
1663
+ removed — the CLI now colors output entirely through `node:util`.
1664
+ - Timestamps now go through `date-fns` like the Sanity CLI — absolute
1665
+ `yyyy-MM-dd HH:mm:ss` for detail views (`show`, `diagnose`, `tail`), relative
1666
+ "… ago" for list tables. A missing or unparseable timestamp falls back to its
1667
+ raw value rather than throwing, so one bad document field can't crash a command.
1668
+ - New `lib/ui.ts` mirrors the Sanity CLI's `sectionHeader` / `formatKeyValue`
1669
+ helpers so they fold into the shared ones when this CLI merges in.
1670
+ - Bumps the `engines.node` floor to `>=20.12`, the first release where
1671
+ `node:util`'s `styleText` (which now owns all coloring) is available.
1672
+
1673
+ - 8bf467e: Add a definition `role` and a `required` flag on state entries — so spawn-only child workflows can be kept out of standalone-start surfaces, and a load-bearing init slot fails fast instead of silently defaulting.
1674
+ - **`role: 'workflow' | 'child'` on a definition (default `'workflow'`).** A `'child'` definition is spawn-only — instantiated by a parent's `task.subworkflows`, never started cold by a human. The exported `isStartableDefinition(definition)` predicate (plus the `WorkflowRole` type) is the single place that decides "can a human start this", so every consumer filters its start picker the same way. Advisory: the engine does **not** refuse a `startInstance` on a `'child'` def — it's a discoverability flag, not a gate. `@sanity/workflow-cli`'s `definition list` gains a **Startable** column derived from the predicate.
1675
+ - **`required?: boolean` on a state entry — the start/spawn counterpart to action-param validation.** A missing `init`-sourced value previously resolved silently to `null`/`[]`, which is what let a cold-started child come up structurally incomplete (a review with no subject, no assignee). A `required` entry the caller doesn't supply — via `initialState` at start, or the parent's `subworkflows.with` at spawn — now throws the exported `RequiredStateNotProvidedError` and creates nothing, exactly as a missing `required` action param already does. Valid only on a workflow-scope `init` entry; `required` on any other scope or source is a deploy error (`defineWorkflow` rejects it with the offending field path).
1676
+
1677
+ The two compose: `role` keeps a child out of pickers; `required` stops the engine from constructing an incomplete instance if a UI (or a human) starts one anyway.
1678
+
1679
+ ### Patch Changes
1680
+
1681
+ - Updated dependencies [c298ee2]
1682
+ - Updated dependencies [8131dd5]
1683
+ - Updated dependencies [8bf467e]
1684
+ - @sanity/workflow-engine@0.8.0
1685
+
1686
+ ## 0.5.2
1687
+
1688
+ ### Patch Changes
1689
+
1690
+ - e618a5f: Fix the release pipeline so `workflow-cli` can publish via CI. `oclif manifest`
1691
+ `import()`s the package's compiled commands, which import the built
1692
+ `@sanity/workflow-engine`; running it inside the publish-time `prepack` depended
1693
+ on a sibling's `dist` being present at that moment and failed `changeset publish`
1694
+ deterministically. The manifest is now generated as an explicit release step
1695
+ after the full workspace build and dropped from `prepack` — it stays gitignored
1696
+ and is still shipped via the package's `files`.
1697
+
1698
+ ## 0.5.1
1699
+
1700
+ ### Patch Changes
1701
+
1702
+ - 07134ae: Give the `StubCommand` exit-code test generous timeout headroom. A full `Config.load` is fast alone but gets starved past the 5s default on a cold CI runner running every package's suite in parallel, so the test flaked with a timeout.
1703
+
1704
+ ## 0.5.0
1705
+
1706
+ ### Minor Changes
1707
+
1708
+ - fb3c98a: Make the workflow CLI publishable — both metadata and runtime.
1709
+
1710
+ Metadata: the package drops `private` / `UNLICENSED` and gains the publish fields the other published packages carry — an `MIT` license, `repository`, `homepage`, `bugs`, `author`, `keywords`, an `engines` floor, and a `publishConfig` that resolves the published `exports` to `dist/` only (stripping the `development` / `source` conditions used for in-repo source resolution). Published with `access: restricted`, matching the rest of the workspace.
1711
+
1712
+ Runtime: the previous build was a library bundle (one `dist/index.js` re-exporting `execute`) and never emitted the oclif commands, so a published host had nothing to run. The build now compiles the whole `src/` tree with `tsc` — emitting `dist/commands/**` and rewriting the repo's explicit `.ts` import specifiers to `.js` via `rewriteRelativeImportExtensions` — and the package ships a production `bin/run.js`, an `oclif.manifest.json` generated at pack time, and an ESM-only `exports` map. `oclif.commands` points at `./dist/commands`; dev (`bin/dev.js`) keeps loading the TS sources via oclif's dist→src resolution.
1713
+
1714
+ ### Patch Changes
1715
+
1716
+ - 32f5e64: Name the remediations that would unstick a stuck instance from the engine, not the CLI.
1717
+
1718
+ `workflow.diagnose` now returns `remediations` alongside the diagnosis — a `SuggestedRemediation[]`, empty unless the instance is `stuck`. Each entry names a surface-neutral `RemediationVerb` (`retry-effect` | `drain-effects` | `reset-task` | `set-stage` | `abort`), whether it's runnable as an engine operation today (`available`), and a one-line rationale. The new `remediationsFor` reasoning plus the `SuggestedRemediation` / `RemediationVerb` types are exported. Previously the cause→fix mapping — including which repair verbs exist versus are still planned — lived only in the CLI, so every other consumer (MCP, a future UI) would have had to re-derive it.
1719
+
1720
+ The CLI `diagnose` command now renders its "suggested fix" block from these remediations — a not-yet-runnable verb is dimmed and marked `(planned)` — instead of hardcoding the prose, and includes `remediations` in `--json` output.
1721
+
1722
+ - df7582f: Fix two stacked bugs that let a threshold-gated workflow auto-advance past a review it couldn't actually evaluate.
1723
+ - **Filters fail closed on unevaluable operands.** A `task.filter` / `transition.filter` that evaluates to GROQ `null` (a referenced operand was missing or incomparable, e.g. `$state.subject.amount > 10000` when the subject isn't loaded) is no longer coerced to `false`. A `null` gate previously _skipped_ the task / fell through the transition — fail-open. Now an unevaluable `task.filter` keeps the task in scope (the stage holds rather than cascading through), an unevaluable transition filter halts selection, and the undecidability is recorded on `TaskEntry.filterEvaluation.unevaluable` so the audit trail distinguishes "genuinely below threshold" from "couldn't read the field". Unevaluability also propagates through nullary predicates (an unevaluable predicate binds `null`, not `false`).
1724
+ - **Content hydration is draft-preferring.** When an instance has no explicit release perspective, content reads now use a drafts-preferring perspective (drafts overlay published) instead of a published-only point read — uniformly across `doc.ref`/`doc.refs` hydration, `type: "query"` state-entry resolution, and `subworkflows.forEach` discovery (single-sourced as `DEFAULT_CONTENT_PERSPECTIVE`). A subject that exists only as a draft — or whose in-flight edits live in the draft — is now what filters evaluate. Instance / ancestor / `system.release` documents continue to read raw. The reactive App SDK adapter (`@sanity/workflow-sdk`) matches: a content doc with no release is read under the `drafts` perspective instead of relying on the SDK's default, so a reactive session and the engine cascade resolve the same draft-aware view. (The Studio adapter already preferred `version ?? draft ?? published`.)
1725
+ - **Diagnostics tell an undecidable hold from a dead-end.** `TransitionEvaluation` now carries `unevaluable`, and `diagnose` reports a new `transition-unevaluable` stuck cause when every task is resolved but an exit filter can't be evaluated (a recoverable hold — the cascade re-fires once the operand resolves) rather than mislabeling it the permanent `no-transition-fires` routing dead-end. `@sanity/workflow-cli`'s `diagnose` renders the distinct cause.
1726
+ - **Single-document writes commit `visibility: 'sync'`.** `create` and `patch().commit()` now set `visibility: 'sync'` explicitly (via the new `WorkflowCommitOptions`) so the engine never reads a stale value back through a query. Adds `WorkflowCommitOptions` / `WorkflowVisibility` to the public client surface.
1727
+
1728
+ - 129258c: Add task `requirements` — a readiness axis for visible-but-not-yet-executable tasks, distinct from ACL and guards.
1729
+
1730
+ A task definition can now declare `requirements: { <name>: <groq-condition> }`: preconditions over the rendered scope that gate _executability_ without affecting visibility. While a requirement is unmet the task stays visible, and every action on it is reported disabled with a new `requirements-unmet` verdict that names the unmet requirements; `TaskEvaluation.unmetRequirements` summarises the same set at the task level so a consumer can explain why the whole task is gated. Requirements are all-of (express any-of inside a single condition), evaluated in the same scope as `filter`, and — like every engine-side check — advisory; the lake remains the enforcement point.
1731
+
1732
+ Diagnostics gain a `blocked` state: an active task held by an unmet requirement is reported as visible-but-not-yet-executable (healthy and transient), distinct from `stuck`, and a requirements-held task no longer masks an actionable sibling in the `waiting` verdict.
1733
+
1734
+ The CLI `fire-action` listing and the MCP server's disabled-reason copy both render the new reason; the CLI `diagnose` command renders the new `blocked` state.
1735
+
1736
+ - Updated dependencies [ef927bc]
1737
+ - Updated dependencies [32f5e64]
1738
+ - Updated dependencies [df7582f]
1739
+ - Updated dependencies [ed4174c]
1740
+ - Updated dependencies [129258c]
1741
+ - @sanity/workflow-engine@0.7.0
1742
+
1743
+ ## 0.4.1
1744
+
1745
+ ### Patch Changes
1746
+
1747
+ - Updated dependencies [c6d1762]
1748
+ - @sanity/workflow-engine@0.6.0
1749
+
1750
+ ## 0.4.0
1751
+
1752
+ ### Minor Changes
1753
+
1754
+ - e2a6d5d: Implement `definition delete` (previously a stub): delete a deployed workflow definition by name — every version by default, one via `--version`. Refuses while non-terminal instances exist unless `--cascade` aborts them first (instances are aborted in place, never deleted; `--reason` lands on each abort's history entry), and refuses while any surviving deployed definition spawn-references the target. Reports the deleted versions, cascade-abort count, and orphaned-guard cleanup.
1755
+ - b8e364d: Add a `definition diff` command that diffs an in-code definition against the deployed version — the latest deployed version of the workflow by default (so a version bump shows what actually changed), or a specific one via `--version`. Remove the `definition enable` and `definition disable` stubs; no engine semantics back them yet.
1756
+ - 4805d29: Add the `diagnose` command: a read-only check that explains why a workflow instance is or isn't progressing, and what would unstick it. It runs a single `workflow.evaluate` and classifies the instance as `progressing`, `waiting` (an active task awaiting a human action — healthy, not stuck), `completed`, `aborted`, or `stuck` with a specific cause (a failed effect, a hung effect, a failed task, or no exit transition firing), printing the evidence and a suggested fix. Supports `--json` for scripting and `--tag` for the environment partition.
1757
+ - 1cd93d2: Add the `fire-action` command — fire an action on an instance to unstick a waiting task. Omit `--action` to list the actions available on the current stage (with their allowed/disabled state and params); pass `--task` + `--action` to fire one, with `--param key=value` for action params and `--as <userId>` / `--as-role <role>` to attribute the fire to a real user so assignee- and role-gated filters pass. Honors `--tag` and `--json`. The shared "ops applied" report block is factored out and reused by `move-stage`.
1758
+
1759
+ ### Patch Changes
1760
+
1761
+ - dbc4afa: Move the instance-reasoning behind the CLI's read commands into the engine so every consumer shares one implementation rather than re-deriving it. The engine now exports the stuck-instance classifier (`diagnoseInstance` with `Diagnosis` / `StuckCause` / `DiagnoseInput`, plus `abortReason`, `openStage`, `assigneesOf`, `diagnoseInputFromEvaluation`), the available-actions projection (`availableActions` with `AvailableAction`), and definition-diff classification (`diffEntry` / `computeDiffEntries` with `DiffEntry` / `DeployTarget`) — all reusing the engine's own doc-id minting and no-op verdict. Two instance-id-keyed verbs compose this with `evaluate`: `workflow.diagnose` and `workflow.availableActions` (also on the `Engine` wrapper).
1762
+
1763
+ The CLI's `diagnose`, `fire-action`, `deploy`, and `definition diff` commands keep only their rendering and now call the engine for the reasoning, and the MCP's `get_workflow_state` projects its action verdicts through the same shared `availableActions`. No behavioural change to the CLI or MCP surfaces.
1764
+
1765
+ - 4805d29: Fix the boxed instance header (shared by `show` and `diagnose`) so the first row's right border aligns with the rest. The id row now uses a plain `instance:` label instead of a width-ambiguous `ℹ` symbol that `boxen`/`string-width` mis-measured, which had been drifting that line's border.
1766
+ - Updated dependencies [dbc4afa]
1767
+ - Updated dependencies [e2a6d5d]
1768
+ - Updated dependencies [aa87a1c]
1769
+ - @sanity/workflow-engine@0.5.0
1770
+
1771
+ ## 0.3.0
1772
+
1773
+ ### Minor Changes
1774
+
1775
+ - 4b5f59a: Wire the `abort` command to the engine's new `workflow.abortInstance`: hard-stop an in-flight instance with an optional `--reason` recorded in history. Already-terminal instances report a warning instead of erroring. Aborted instances surface across the read commands too — `list` shows an `aborted` status (instead of `completed`), and `show`'s header carries the abort timestamp plus the recorded reason.
1776
+ - fcf938a: Migrate to the new workflow authoring DSL: name identity (`name` /
1777
+ `initialStage` / `currentStage` / `instance.definition`), bare state kinds,
1778
+ type-tagged sources, bare op types with `{scope, state}` targets, GROQ-string
1779
+ conditions and effect bindings, `predicates` as a name→GROQ map, explicit task
1780
+ `activation`, action `status` sugar, claim pairs and audit ops, and
1781
+ `subworkflows` fan-out. The example definitions showcase the new sugar; the
1782
+ CLI and MCP projections read the new stored shapes (terminal = stage with no
1783
+ transitions); the React controller's `fireAction` takes `task` instead of
1784
+ `taskId`; the MCP wire names things what they are — `definition` (the
1785
+ definition's `name`) on the `list_workflow_instances` filter and instance
1786
+ projections, and `task` / `action` (names, not ids) on `fire_action` and
1787
+ the per-task projections, replacing `workflow_id` / `task_id` /
1788
+ `action_id`.
1789
+
1790
+ ### Patch Changes
1791
+
1792
+ - Updated dependencies [4b5f59a]
1793
+ - Updated dependencies [fcf938a]
1794
+ - Updated dependencies [6c4e0a0]
1795
+ - Updated dependencies [12e23b0]
1796
+ - Updated dependencies [12e23b0]
1797
+ - @sanity/workflow-engine@0.4.0
1798
+
1799
+ ## 0.2.0
1800
+
1801
+ ### Minor Changes
1802
+
1803
+ - 440be47: Add a `definition show` command that displays a single deployed workflow definition. Pass a workflow id to show its latest version, or pin one with `--version`, and scope to an environment with `--tag`. Renders a boxed header (workflow id, version, title, description) followed by a stage → task → action breakdown, marking the initial stage and each stage's kind.
1804
+
1805
+ ### Patch Changes
1806
+
1807
+ - 0c6ccde: Extract shared definition-query primitives so the "tag-scoped, latest-or-pinned `workflow.definition`" query lives in one place instead of being hand-written at each call site.
1808
+
1809
+ The engine now exports two reusable GROQ primitives:
1810
+ - `WORKFLOW_DEFINITION_TYPE` / `WORKFLOW_INSTANCE_TYPE` — the lake document-type constants, replacing scattered string literals.
1811
+ - `tagScopeFilter(param?)` — the tag-partition GROQ predicate (`count(tags[@ in $engineTags]) > 0`), defaulting to the `engineTags` parameter the `workflow.query` guard expects.
1812
+
1813
+ Internally these compose into a single `definitionLookupGroq` selector for the "latest-or-pinned definition" query. The engine's own lookups (`deploy`, `spawn`, `drain`) and the CLI (`definition show`/`list`, `list`, `deploy`) now build on these primitives, and every tag-scoped query in those paths standardizes on the `$engineTags` parameter — removing the prior `$tags`/`$engineTags` drift.
1814
+
1815
+ - Updated dependencies [41ddd80]
1816
+ - Updated dependencies [0c6ccde]
1817
+ - @sanity/workflow-engine@0.3.0
1818
+
1819
+ ## 0.1.0
1820
+
1821
+ ### Minor Changes
1822
+
1823
+ - e24fe7f: Add a `definition list` command that lists deployed workflow definitions as a table. Filter with `--workflow-id`, or scope to an environment with `--tag` (omit `--tag` to list across all partitions). Each row shows the definition's stage count plus in-flight and total instance counts.
1824
+
1825
+ ### Patch Changes
1826
+
1827
+ - eff2a77: Commands that contact the dataset (`deploy`, `list`, `show`, `tail`, `move-stage`) now fail with a clean, single-line error when a required `SANITY_*` env var is missing, instead of dumping a raw Node stack trace. Missing client config is funnelled through the same `fail()` path that `WORKFLOW_*` config validation already uses.
1828
+ - eff2a77: `deploy` no longer hardcodes its definitions to `@sanity/workflow-examples`. The
1829
+ source is now resolved at runtime from a required `WORKFLOW_DEFS` env var — a
1830
+ module path or package name whose `allDefinitions` export holds the
1831
+ `WorkflowDefinition[]` to deploy — so the CLI is agnostic about which
1832
+ definitions it ships. There is no default: an unset source fails hard rather
1833
+ than silently falling back to a built-in set. This also fixes a latent bug
1834
+ where a built/published CLI would throw, since `@sanity/workflow-examples` was only
1835
+ ever a dev dependency.
1836
+ - 9d434a1: `deploy` and `move-stage` take a `--tag` flag selecting the engine environment partition (e.g. `--tag prod`). The tag resolves `--tag` → `WORKFLOW_TAG` env → required: commands fail hard when no tag is set rather than silently defaulting. This replaces the previous comma-separated `WORKFLOW_TAGS` env var with a single `WORKFLOW_TAG`.
1837
+ - Updated dependencies [d04cbea]
1838
+ - Updated dependencies [870188e]
1839
+ - Updated dependencies [a4f6d81]
1840
+ - Updated dependencies [eff2a77]
1841
+ - Updated dependencies [ce6960d]
1842
+ - Updated dependencies [dff88ff]
1843
+ - Updated dependencies [782272a]
1844
+ - Updated dependencies [2b800a8]
1845
+ - Updated dependencies [0432670]
1846
+ - Updated dependencies [53a0598]
1847
+ - Updated dependencies [c2ad7a9]
1848
+ - @sanity/workflow-engine@0.2.0