# @sanity/workflow-engine-test

## 0.38.0

### Minor Changes

- ceac057: **BREAKING:** Engine instance commits no longer wait for the Content Lake's query index. `startInstance`, `fireAction`, `editField`, `completeEffect`, `commitEffectOps`, `tick`, `setStage`, `abortInstance`, and `resetActivity` commit at `async` visibility by default, so they return about a second sooner per commit. A GROQ query run straight after one of these calls can miss its change for up to about a second. This affects `engine.query`, `instancesForDocument`, `children`, `definitionsForDocument`, `evaluateStart`, `deleteDefinition`'s in-flight check, and your own GROQ instance lists. The instance a verb returns, `getInstance`, and the by-id reads the engine makes while a verb commits and cascades see the commit at once, and every instance write keeps its `ifRevisionId` compare-and-swap.

  Every one of these verbs accepts a per-call `visibility` (`'async' | 'sync' | 'deferred'`, as in `@sanity/client`). Pass `visibility: 'sync'` on a verb whose result you query by GROQ straight after it, typically in scripts and end-to-end tests. Without it, such a query can read the pre-call state. A definition with a query-sourced field, any `spawn`, or a `singleSubject` start requirement keeps its own instance commits, and those of its ancestor and live child instances, `sync` automatically, so a `singleSubject` start still refuses a second run on a subject started a moment earlier. Definition deploys, definition deletes, and guard writes stay `sync`. The standalone `sweepStaleClaims` now commits at `async` too and takes no `visibility` option. `drainEffects` takes no `visibility` either: its effect completions commit at the default `async` visibility unless the definition rule above makes them `sync`. In the operation protocol, `visibility` travels in the request's `args` for `startInstance`, `fireAction`, `editField`, `abortInstance`, and `tick`, and a Workflows service honours it as a direct call would.

  **BREAKING:** `WorkflowClient` requires `getDocuments(ids, options?)`, which `@sanity/client` and `@sanity-labs/client-fake-for-test` already provide. The engine reads instance documents it may have just written by id. A hand-written client must add the method, or the TypeScript build fails and those reads throw. Its `getDocument` and `getDocuments` must also return every commit already applied, including `async` ones, so read the document endpoint, not GROQ. A patch `commit()` must resolve to the complete committed document with its new `_rev`.

  `@sanity/workflow-engine-test` adds `createBench({laggingQueryIndex: true})`. GROQ queries on that bench do not see `async` commits until `bench.advanceQueryIndex()`, so a test can prove a path never reads its own write back through GROQ. The engine exports `hasEffectHandler(handlers, name)`, the drain's own test for whether a handler map registers an effect: an own entry that is not `undefined`, never an inherited name such as `toString`. The Studio plugin uses it to skip the post-commit effect drain when no pending effect has a Studio handler, and the reactive session no longer re-evaluates on the store echo of its own commit. A reactive session's `fireAction` and `editField` commit first against the instance the session holds; when that copy is stale, the lost race reloads the instance once without counting against the three attempts, so the session throws `ConcurrentFireActionError` or `ConcurrentEditFieldError` no more often than a stateless call.

  <!-- replay: pending.async-instance-commits -->

  **Docs impact:** Add the commit-visibility contract and the `visibility` option to the engine reference and concepts page (`docs/reference.md` § Commit visibility, `docs/concepts.md` § Every instance write is a transaction), note the up-to-one-second GROQ lag wherever instance lists, the inbox, `engine.query`, or `children` are documented, document `getDocuments` and the read-freshness and committed-document obligations in the custom-client requirements, document `laggingQueryIndex` in the test-bench guide, add `hasEffectHandler` to the effect-handler reference, and add the upgrade note to the release notes.

- e5676c7: `createEngine` and every raw `workflow.*` verb accept an optional `access: {actor, grants?, attributes?, localPrincipalId?}` (the existing `WorkflowAccess` type). It names the caller the engine judges by and grants nothing: every write still commits with the engine client's token. Use it when a host commits with its own credential on behalf of someone else, such as a service writing workflow instances for the editor who asked. With `access` set, history rows from `startInstance`, `fireAction`, `editField`, `abortInstance`, `tick` and the effect drainer name `access.actor`; `$actor`, action and abort `roles`, `$can` and `$attributes` are judged from `access` in every verb and in `engine.session()`; and the engine never requests `/users/me`, grants or attributes, nor fills an omitted part from the token, so an omitted `grants` or `attributes` leaves `$can` or `$attributes` unbound. A per-call `grantsFromPath` has no effect, and the subject-write forecast for documents in other resources is skipped. `access.actor.id` must be an account-global user id or a robot id, and `access.actor.kind` one of `person`, `agent` or `system`; anything else throws `ContractViolationError`, and the engine stores only the actor's `kind`, `id`, `roles` and `onBehalfOf`. The engine does not verify the assertion, so pass only an identity the host has authenticated, with `roles` read from the workflow resource's member directory. On a project dataset, also pass `localPrincipalId` so guard previews match the lake's `identity()`. An engine without `access` behaves as before.

  The test bench gains `createBench({committer})`, which commits every wrapped verb, the new `bench.session()`, and engines from `createBenchEngine` with a separate write-capable identity, while the call's identity (the bench default or a per-call `actor` / `grants` / `attributes` / `access` shortcut) reaches the engine as `access`. The same test runs unchanged on the direct and asserted paths.

  **No upgrade action required.** The option is additive; engines and benches that do not set it behave exactly as before.

  **Docs impact:** Document `access` under "Caller identity" in the API reference and in the access and identity concepts, update the audit-trail guide's "Provenance and enforcement" section to say that history names the asserted caller while the Content Lake's own history names the committing credential, and add `committer` and `bench.session()` to the test bench guide.

- cdd07a3: **BREAKING:** `grantsFromPath` is deprecated and ignored on every engine and `workflow.*` verb, `engine.session()`, and the `useWorkflowSession` hooks of `@sanity/workflow-react`, `@sanity/workflow-sdk` and `@sanity/workflow-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 it is removed with the old package names.

  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.

  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.

  **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.

  <!-- replay: pending.engine-write-routing -->

  **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.

- caa6a86: **BREAKING:** The `setStage` admin override is removed. Every stage move now
  goes through a declared transition. This affects engine callers of
  `workflow.setStage` or `Engine.setStage`, test suites that call
  `bench.setStage`, operators who run `sanity workflows set-stage`, and
  consumers of the diagnose `RemediationVerb` vocabulary. Calls to the removed
  API fail to compile, and the CLI no longer recognizes `set-stage`.

  - **Engine:** `workflow.setStage`, `Engine.setStage`, `SetStageArgs`, the
    `REQUEST_TAG.setStage` request tag, and the `WorkflowStageSet` telemetry
    event (`Workflows Engine Stage Set`) are removed. `WorkflowStageTransitioned`
    now always reports `via: 'transition'`.
  - **Test bench:** `bench.setStage` and `BenchSetStageArgs` are removed. Move a
    test instance by firing the actions its transitions read, or by seeding the
    content and fields they read and calling `bench.tick`.
  - **CLI:** `sanity workflows set-stage` is removed.
  - **Diagnose:** `RemediationVerb` replaces `'set-stage'` with `'tick'`. A
    `failed-activity` diagnosis suggests only `reset-activity`. A
    `no-transition-fires` diagnosis suggests `tick` once the content or fields
    the intended transition reads are fixed, then `abort`. The CLI has no `tick`
    command: the rationale tells operators to call `workflow.tick` from code, or
    to let the next commit or a deployed heartbeat re-check. Code that switches
    on `RemediationVerb` must handle `'tick'` and drop `'set-stage'`.
  - **Studio plugin:** a stuck instance with no firing transition now says to
    fix the content or fields the workflow needs instead of telling the editor to
    move the workflow on themselves.

  To recover an instance that `set-stage` used to move, fix the content or
  fields its intended transition reads. Then re-check its transitions: call
  `workflow.tick` from code, or wait for the next commit on the instance or a
  tick from a deployed heartbeat. There is no CLI `tick` command. Reset a failed
  activity with `sanity workflows reset-activity`, or abort the instance with
  `sanity workflows abort`.

  Stored instances keep working unchanged: history rows with `via: 'setStage'`
  still parse, and the CLI and Studio still render them as forced moves.

  <!-- replay: pending.remove-set-stage-override -->

  **Docs impact:** `set-stage` must be purged from the docs completely. Remove
  `setStage` and `set-stage` from the engine API and CLI
  references, the test-bench guide, and any recovery guidance; update the
  diagnose remediation reference to the new verb set; call out the removal and
  the recovery path in the release notes.

- 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/*`.

  **No upgrade action required.**

  **Docs impact:** No docs change: the Workflows service is unreleased.

### Patch Changes

- a1fc434: A `/workflow/capabilities` read that answers 401, 403 or 404 means the project has no Workflows service. `deployDefinitions`, `computeDiffEntries`, `sanity-workflows deploy` and `deploy --dry-run` then continue without the data-model check and log nothing. Any other failure to read capabilities still fails the deploy and asks you to retry.

  By default the test bench's client answers `/workflow/capabilities` with 404, so a bench has no Workflows service and deploys without the data-model check. To test against a service, pass `service` to `createBench`, as in `createBench({service})`.

  **No upgrade action required.**

  **Docs impact:** Update the reader-floor rollout guide and the `ServiceReaderModelError` reference entry to say that capabilities answering 401, 403 or 404 means there is no Workflows service; mention in the test bench guide that the bench has no Workflows service by default.

- Updated dependencies [bb9c414]
- Updated dependencies [ceac057]
- Updated dependencies [0cb1f0c]
- Updated dependencies [74aa45f]
- Updated dependencies [2f32af1]
- Updated dependencies [ddb8c65]
- Updated dependencies [6c4beff]
- Updated dependencies [f20e083]
- Updated dependencies [ba999be]
- Updated dependencies [9c085c8]
- Updated dependencies [e5676c7]
- Updated dependencies [025df76]
- Updated dependencies [cdd07a3]
- Updated dependencies [4f5a100]
- Updated dependencies [0984e59]
- Updated dependencies [e7973da]
- Updated dependencies [7e9a9e1]
- Updated dependencies [e0251b7]
- Updated dependencies [429bf8a]
- Updated dependencies [a1fc434]
- Updated dependencies [10b3f0c]
- Updated dependencies [e0251b7]
- Updated dependencies [c65f2ae]
- Updated dependencies [21b3e35]
- Updated dependencies [caa6a86]
- Updated dependencies [0317021]
- Updated dependencies [3019624]
- Updated dependencies [621c963]
- Updated dependencies [1a3238d]
- Updated dependencies [7623b3e]
  - @sanity/workflow-engine@0.38.0

## 0.37.0

### Minor Changes

- e3ae1ab: **BREAKING:** Code that addresses a workflow deployment uses `partition`
  instead of `tag`. `createEngine`, the SDK and Studio adapter hooks,
  `createBench`, raw workflow verb arguments, MCP tool inputs, and the MCP
  `createWorkflowEngine` address reject `tag`.
  Anyone calling these APIs directly is affected. Until you replace
  `tag: 'prod'` with `partition: 'prod'`, each call throws a migration error
  before any read or write. Upgrade the runtime packages together, pass
  `partition`, and read `engine.partition` / `bench.partition` instead of `.tag`.
  Keep the exact existing value: omitting a non-default value targets different
  data.

  Update these renamed code APIs at the same time:
  - Engine: `validateTag` → `validatePartition`, `tagScopeFilter` →
    `partitionScopeFilter`, `deployedTagsGroq` → `deployedPartitionsGroq`,
    `definitionTagsGroq` → `definitionPartitionsGroq`, and `StartScope.tag` →
    `StartScope.partition`.
  - Test bench: `BENCH_TAG` → `BENCH_PARTITION` and `CreateBenchOptions.tag` →
    `CreateBenchOptions.partition`.
  - MCP: the discovery tool is `workflows_list_partitions` and returns
    `{partitions: [...]}`. The exports `LIST_WORKFLOW_TAGS_TOOL_NAME`,
    `LIST_WORKFLOW_TAGS_DESCRIPTION`, and `WORKFLOW_TAG_DESCRIPTION` are now
    `LIST_WORKFLOW_PARTITIONS_TOOL_NAME`, `LIST_WORKFLOW_PARTITIONS_DESCRIPTION`,
    and `WORKFLOW_PARTITION_DESCRIPTION`. `workflowAddressFromInput` returns
    `partition`.
  - Blueprint runtime (`@sanity/workflow-blueprint/runtime`): `createRuntime`
    requires the deployment `name`; a hand-built deployment object must add the
    configured `name` beside `partition`.
  - CLI: display-row JSON uses `partition`. `list`, `show`, `tail`,
    `definitions list`, and `definitions show` accept `--deployment`, exclusive
    with `--partition`. When an instance ID or definition name is found in
    several deployments, an interactive terminal prompts for one; with `--json`
    or in a non-interactive shell the command fails naming each candidate as
    `name (dataset)` and asks for `--deployment` instead of `--partition`.
    Scripts that matched the old "pass --partition" message should pass
    `--deployment`.

  Content Lake `tag` fields, IDs, references, stored GROQ `$tag` bindings, and
  HTTP request tags stay unchanged. No data migration is needed.

  Configuration you edit rather than call keeps working. A deployment `tag` in
  `sanity.workflow.ts` or `defineWorkflows`, a `tag` in `workflowStudioPlugin`
  options, and the `--tag` / `--all-tags` CLI flags are deprecated. Each
  addresses the same partition and shows a warning naming the replacement: the
  CLI on stderr, the Studio plugin in the browser console, and `defineWorkflows`
  in the console during Blueprint manifest evaluation. The Blueprints provider
  accepts a deprecated deployment `tag` the same way and reports the
  warning in the deploy log. `defineWorkflowConfig` itself prints nothing; it
  returns each message in the new `WorkflowConfig.warnings` array, so code that
  loads a config directly decides where to show them. **No upgrade action required** for
  these yet. Rename them to `partition` (or `--partition` / `--all-partitions`),
  keeping the exact existing value, before the deprecated forms are removed.
  Deleting a `tag` instead of renaming it moves the deployment to the `default`
  partition, where its existing workflows no longer appear. A
  `tag` that is not a string, or that disagrees with an explicit `partition`,
  fails rather than falling back to `default`.

  A deployment you configure in `sanity.workflow.ts` or `defineWorkflows` may
  now omit `partition` when it is alone on its workflow resource, and then uses
  `default`. Multiple deployments on one resource require explicit, distinct
  partitions. `workflowStudioPlugin`'s `partition` is optional too and defaults
  to `default`, and `createRuntime` resolves a deployment that omits it the same
  way. Other code APIs do not: `createEngine`, `useWorkflowEngine` and the other
  adapter hooks, raw verb arguments, and MCP tool inputs still require
  `partition`, and `createBench` uses `BENCH_PARTITION` (`bench`) when you omit
  it. When the plugin finds no
  definitions in its partition, it logs a
  browser console warning naming the partitions that do hold definitions on that
  resource, so a mistyped or forgotten `partition` no longer leaves Studio empty
  without explanation.

  `sanity-workflows blueprints generate` now names each deployment's functions
  and robot token after the deployment `name` instead of its tag (for example
  `wf-prod-runtime` and `wf-prod-start-production-creates` for a deployment named
  `prod`), while runtime scope and filters use `partition`. Upgrade the provider first so it can
  read old serialized state, then regenerate and inspect the Blueprint plan
  before deploying. If a deployment name differs from its old tag, generated
  resources are replaced: plan for the interruption, preserve authored handlers,
  and retire old watchers and schedules.

  **Docs impact:** Update deployment addressing concepts, engine and adapter API
  references (including `WorkflowConfig.warnings`), CLI flags and JSON output
  (including `--deployment` and the ambiguity prompt on the read commands), MCP
  discovery and exported constants, Studio setup examples (the optional
  `partition` and the empty-partition console warning), generated Blueprint
  function names and rollout guidance, and prerelease migration notes using
  `docs/partition-migration.md`.

- c63c0d2: **BREAKING:** `WorkflowEvaluation` gains a required `abort` field. TypeScript code that builds a `WorkflowEvaluation` object by hand, such as a test fixture or a custom adapter, no longer compiles until it adds `abort` (for example `abort: {allowed: true}` for an instance anyone may abort). Evaluations the engine returns already carry it.

  Workflow definitions can declare who may abort a running instance with an optional `abort: {roles: [...]}` block beside `start`. The roles work like an action's `roles`, including `roleAliases`, and are stored as `abort: {filter}`. `abortInstance` refuses a caller outside the roles with the new `AbortDeniedError` (kind `abort-denied`) before writing, for every caller including Administrators. Subworkflows belong to their parent: when a parent aborts, or moves on with `onExit: 'abort'`, its children stop under the parent's rules, not their own abort roles. Instances aborted by `deleteDefinition` are not refused either. `WorkflowEvaluation` gains `abort: {allowed, disabledReason?}`, which renders through `actionRendering` like an action verdict: `filter-failed` means the abort affordance is absent for this actor, and a terminal instance reports `instance-completed` or `instance-aborted`. A definition without the block behaves as before: anyone who can write the instance may abort it. Deploy reports an unknown role in `abort.roles` through the existing project role check.

  The engine writes persisted data model 11. The `abort` block is floor-bearing: definitions carrying it, and instances started from them, require reader model 11, because an older engine ignores the block and lets anyone abort.

  **Upgrade action:** Apart from the `WorkflowEvaluation` migration above, no upgrade action is required for definitions without an `abort` block. Before deploying a definition that adds one, upgrade every Studio, CLI, MCP server, Function, and other runtime sharing the workflow resource to this release, then set the deployment's `expectedMinReaderModel` to `11`. A deploy that acknowledges a lower model is refused with `ReaderModelAcknowledgementError`.

  **Docs impact:** Add the `abort` block to the definition reference (who may abort, the absent default, that every `abortInstance` caller is checked with no exempt role, that subworkflows stop under their parent's rules rather than their own abort roles, that instances `deleteDefinition` aborts with `cascade` are not checked, and how it differs from `start.filter`), document `WorkflowEvaluation.abort` and `AbortDeniedError`, and add the model-11 step to the reader-floor rollout guide.

### Patch Changes

- Updated dependencies [83c7f3a]
- Updated dependencies [af41ca9]
- Updated dependencies [6304d4a]
- Updated dependencies [9ec15d6]
- Updated dependencies [38ede99]
- Updated dependencies [a344726]
- Updated dependencies [1d37767]
- Updated dependencies [2cd9a00]
- Updated dependencies [3594e60]
- Updated dependencies [8196fbe]
- Updated dependencies [5f5e346]
- Updated dependencies [c32ce83]
- Updated dependencies [e3ae1ab]
- Updated dependencies [1fc7db5]
- Updated dependencies [33d5140]
- Updated dependencies [9ce54a2]
- Updated dependencies [9fba4cf]
- Updated dependencies [c63c0d2]
  - @sanity/workflow-engine@0.37.0

## 0.36.0

### Patch Changes

- Updated dependencies [12240b6]
- Updated dependencies [9902088]
- Updated dependencies [9902088]
- Updated dependencies [56a7252]
- Updated dependencies [9902088]
- Updated dependencies [d5da960]
- Updated dependencies [c06a9a8]
- Updated dependencies [cbad3ae]
  - @sanity/workflow-engine@0.36.0

## 0.35.0

### Patch Changes

- Updated dependencies [7e24e4a]
- Updated dependencies [ab8754a]
  - @sanity/workflow-engine@0.35.0

## 0.34.0

### Patch Changes

- @sanity/workflow-engine@0.34.0

## 0.33.0

### Minor Changes

- 0555271: **BREAKING:** `createBenchEngine` now requires its first argument to carry `advance(ms)` alongside
  the client, tag, workflow resource, and `now` clock it already read. The old contract accepted any
  `EngineScope & {now}`, so a hand-rolled scope object compiled; it no longer does. Callers passing a
  `Bench` from `createBench()` — every documented use — are unaffected and need no change. A caller
  that assembles its own scope must add `advance`, which is also what the engine it builds uses to
  wait: the returned engine inherits `sleep: (ms) => advance(ms)`, so an effect's `retry` backoff
  moves the bench clock instead of spending real time and a paced policy runs to its end inside one
  `drainEffects` call. Passing `sleep` in the overrides replaces that, and a substitute must not
  resolve before `ms` has passed on the bench clock, because a policy's pacing and its `expiryMs`
  window are both judged against it. Without the migration a custom scope fails to type-check against
  the new signature.

  **Docs impact:** None. The bench's engine builder is documented by its TSDoc, which states the
  inherited clock and wait; no guide, concept page, or reference article describes the argument shape.

### Patch Changes

- 8874c50: **BREAKING:** A `subject`, `doc.ref`, or `doc.refs` field marked `required: true`
  now requires its selected documents to remain readable after initialization.
  Previously, the flag checked only that an initial value was supplied. Missing
  required targets now produce a fault and prevent normal actions, triggered
  actions, and transitions from advancing, even without an activity requirement
  reading those targets. Abort and direct edits to editable fields remain
  available. Optional references fault only when an unmet runtime condition needs
  their content; completed workflows remain completed.

  `StuckCause` adds `document-missing`. Update exhaustive handlers before upgrading,
  or their typechecks fail and renderers have no matching branch. Evaluation
  identifies the affected field and reference in `missingDocuments`, with its title
  and completed availability evidence; `blockingMissingDocuments` selects the
  references that prevent progress. The engine checks draft, published, and release
  representations before distinguishing deletion from inaccessible content or
  content outside the workflow perspective. Studio, CLI, and MCP use that same
  result. Failed availability checks report unreadable content and log the cause;
  optional references still permit unrelated actions. Incomplete reads do not
  claim deletion, and an existing task fault keeps
  its recovery controls. The fault clears when the required content becomes
  readable; this release adds no undo-delete operation and does not automatically
  abort workflows.

  Upgrade every Workflows runtime sharing affected data, including Studio, CLI,
  MCP servers, and deployed Functions, before relying on continued required-target
  availability. Then set the deployment's reviewed `expectedMinReaderModel` to
  `10` before deploying definitions with required content references. Writers stamp
  model 10; this feature requires reader model 10, while documents without it keep
  the floor required by their other features, normally 4, 8, or 9. Existing
  instances remain readable without a backfill and adopt the rule under upgraded
  engines. Their stored floor rises on the next full write, so an older runtime
  can still advance an unstamped existing instance until the fleet is upgraded.
  See `packages/workflow-engine/DATAMODEL.md` for the complete rollout contract.

  The rendered CLI `show` command evaluates running instances. If evaluation fails,
  it warns and displays stored state; terminal instances and `show --json` retain
  their stored-state behavior.

  **Docs impact:** Update field requiredness and initialization guidance, required
  reference repair examples, the model-10 readers-first rollout, the diagnostics
  reference for `StuckCause` and `MissingDocument`, CLI `show` and `diagnose`, MCP
  workflow-state guidance, and the Workflows tool and document-view guides for
  loading, deletion, permissions, and perspectives.

- 7eb9eca: Correct the API references for field initialization and edits, start requirements,
  transitions, reference IDs, effect handling, reactive state, member controls,
  Studio mappings, test helpers, and GROQ condition outcomes. The references state
  caller constraints and defaults that were missing or incorrect. Package setup
  guidance identifies the public npm packages and supported deployment command;
  the MCP validation description distinguishes validation from deployment checks.
  Runtime behavior and API signatures are unchanged.

  **No upgrade action required.**

  **Docs impact:** After release and reference sync, reconcile the modeling,
  runtime, reactive UI, Studio, testing, deployment, MCP, and evaluation-insight
  guides and references with the corrected contracts. Fix affected examples and
  replace redundant API inventories with verified symbol links while preserving
  useful teaching and the CLI/MCP reference material not exposed by TypeDoc.

- 2cef086: Internal maintenance consolidates engine action/edit handling and Studio document
  and workflow title sorting. Action and field-edit calls retain their inputs and
  results, and document and workflow titles retain their ordering. Action
  availability, telemetry, and persisted document formats are unchanged.

  **No upgrade action required.**

  **Docs impact: None** because public APIs, configuration, and workflow behavior
  are unchanged.

- Updated dependencies [393ac71]
- Updated dependencies [8874c50]
- Updated dependencies [0555271]
- Updated dependencies [b3b2797]
- Updated dependencies [225e0fb]
- Updated dependencies [7eb9eca]
- Updated dependencies [2cef086]
- Updated dependencies [232f811]
  - @sanity/workflow-engine@0.33.0

## 0.32.0

### Minor Changes

- 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.

  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.

  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.

  `@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.

  **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.

- 2de38fd: **BREAKING:** `createEngine` takes its effect settings as one `effects` group. The top-level `effectHandlers`, `effectLeaseMs`, and `missingHandler` options are removed, with no alias and no deprecation shim, so everyone who builds an engine — a Sanity Function drainer, a hosted runtime, a script, a test — must move them into `effects: {handlers, leaseMs, missingHandler}`. An unmigrated TypeScript call stops compiling. An unmigrated plain-JavaScript call still builds an engine, but one with no handlers and the default `fail` policy, so its first drain throws `MissingHandlerError` instead of dispatching.

  Migrate every construction site: `createEngine({client, workflowResource, tag, effectHandlers: H, effectLeaseMs: L, missingHandler: P})` becomes `createEngine({client, workflowResource, tag, effects: {handlers: H, leaseMs: L, missingHandler: P}})`. The resolved values read back off the engine under the same word, so `engine.effectHandlers` and `engine.missingHandler` become `engine.effects.handlers` and `engine.effects.missingHandler`. Nothing about draining changes: the same `fail` default, the same five-minute default lease, and the same claim, dispatch, and deploy-verification semantics. `@sanity/workflow-engine-test`'s `createBenchEngine(bench, overrides)` forwards `CreateEngineArgs` unchanged, so bench engines move their handler and policy overrides into the same group.

  `@sanity/workflow-studio`'s `useWorkflowEngine` follows the engine: its `effectHandlers` and `missingHandler` props are replaced by one `effects` prop taking the engine's exported `EngineEffectsArgs`, so a Studio-side drainer passes `effects: {handlers, missingHandler}`. Keep that object referentially stable, at module scope or through `useMemo` — the hook memoizes the engine on it, and a new object every render rebuilds the engine every render. The `@sanity/workflow-studio-plugin` `effectHandlers` config key is unchanged; the plugin translates it into the group where it builds the engine.

  **Docs impact:** Update the `createEngine` options reference and the effects concepts page for the new group, the missing-handler and claim-lease reference entries that named the old keys, the `useWorkflowEngine` adapter reference, the Studio plugin README's drain-function example, and every cookbook or runtime example that constructs an engine with handlers; carry the migration into the release notes.

- 6537804: The on-demand live parity gate (`test:parity:live`) now includes a guard-enforcement suite: each case deploys a real `system.guard` document to the configured live dataset, performs the write it governs, and asserts both the lake's actual outcome and the engine's optimistic `denyingGuards` verdict against pinned pairs. Split pairs pin the known divergences between engine preview and lake enforcement (the `document.before`/`document.after` dialect gap, reference dereferencing, and the dated-API-version evaluation skip). The suite needs `WORKFLOW_GUARD_AUTHOR_TOKEN` (a robot token whose role carries `manage` on a `_.guards.**` document filter) in addition to the existing `SANITY_*` variables, and fails rather than skips when the target namespace has guard evaluation switched off. It accepts only an error naming the deployed guard as a denial, so authentication, network, and service failures fail the gate instead of satisfying an expected deny. **No upgrade action required** — the default `test` run is unaffected and the new suite skips without the extra credential. Docs impact: None — the gate is an internal verification harness; the enforcement behavior it verifies is documented with the enforcement work itself.
- 26dd4e5: Generated API references now include every type used by a public signature and link cross-package symbols to their authoritative package entry. Caller-facing helper contracts such as field mutation operations, engine operation context types, test-bench argument types, member avatar data, MCP client policy, and Studio user clients are now available as named exports where their public APIs already expose those shapes. GROQ condition consumers can import the documented `COMPARISON_OPS` list alongside its `ComparisonOp` type, while the shared cross-package exhaustiveness helper is an unsupported `@internal` export and is omitted from the reference.

  **No upgrade action required.** Existing imports and runtime behavior remain compatible; consumers may adopt the new named type exports instead of reconstructing those shapes locally.

  **Docs impact:** Refresh the generated API references for the affected packages; no conceptual guides, examples, or migration guidance need changes.

- b04580d: **BREAKING:** The in-memory bench now exposes `GuardDeniedError` when Content Lake-style mutation guards reject client writes, replacing the engine-specific `MutationGuardDeniedError` previously thrown by the fake seam. Bench consumers that catch or assert the old class must import `GuardDeniedError` from `@sanity/workflow-engine-test` and match it instead; without this migration, denial assertions will fail even though the write remains rejected.

  Publish and unpublish tests must also express guards in terms of the lake mutations they commit: publish updates or creates the published document and deletes its draft, while unpublish creates the draft and deletes the published document. Replace synthetic `publish` and `unpublish` guard-action expectations with the applicable `create`, `update`, and `delete` actions.

  The engine's `DocumentValuePermission` and `Grant` types now include the lake's `manage` permission so access configurations can represent identities allowed to author system documents. `DOCUMENT_VALUE_PERMISSIONS` is now exported for consumers that need the complete runtime vocabulary.

  The bench also re-exports `WriteAccessDeniedError`, giving access-control denial assertions the same stable package entry point as mutation-guard denial assertions. No upgrade action is required. Consumers may move existing imports of this class from `@sanity-labs/client-fake-for-test` to `@sanity/workflow-engine-test`.

  **Docs impact:** Update the engine authorization API reference for the `manage` permission and `DOCUMENT_VALUE_PERMISSIONS`, plus the engine test-bench guard and access-denial guidance for the re-exported error classes and underlying publish/unpublish mutations.

### Patch Changes

- 2ba0c09: Generated API references keep navigation between public authoring, resource-alias, and observer helpers while no longer presenting private implementation helpers or private-package README targets as broken links.

  **No upgrade action required.** Runtime behavior and public TypeScript contracts are unchanged.

  **Docs impact:** Regenerate the API reference entries for these packages so their corrected TSDoc and README content is visible.

- a2ce4a7: **BREAKING:** Mutation guards now have one public compilation path:
  `compileGuards` replaces the singular `compileGuard` export and returns every
  Lake document required for the authored guard. Callers using `compileGuard`
  must switch to `compileGuards` and persist every returned document; retaining
  the old call would either fail to compile after upgrade or omit required
  ID-space siblings. Literal field-seed document IDs now also enforce the Lake's
  128-character limit and reject double dots; replace an invalid seed with a
  valid resource-local document ID before upgrading. `MutationContext.action` now admits only the
  Lake's `create`, `update`, and `delete` operations, and
  `documentActionDenials` takes their concrete `before` / `after` mutation image
  instead of a prospective document plus authored lifecycle action. Callers of
  that helper must construct the same mutation the Lake will evaluate; otherwise
  their preview can disagree with enforcement. Pure `evaluateFromSnapshot`
  callers that supply dereference-bearing guards must also pass a
  `guardDereference` resolver for stored resource reads; the engine and reactive
  session supply their token-bound client resolver automatically.

  Mutation guards now deploy edit locks against draft IDs and publish or
  unpublish gates against published IDs using the create, update, and delete
  operations Content Lake evaluates. A guard combining both action classes
  emits separate temporary guard documents, preventing either match from leaking
  into the other ID space. Guard previews bind `document.before` and
  `document.after`, follow stored resource-local references, continue to
  understand temporary guards emitted with the older lifecycle-action vocabulary,
  and reject invalid actions, ID patterns, or predicates before deployment.

  Existing guard definitions keep their authored shape. Definitions whose guards
  stay within one emitted ID space require no rollout change and retain their
  existing reader floor. A guard that combines direct create/delete actions,
  content updates, or publish/unpublish actions across ID spaces is a detectable
  model-9 feature on both its definition and instances.

  Before deploying such a definition, upgrade every Studio, CLI, MCP server,
  Function, and other engine runtime sharing its workflow resource, then change
  that deployment's reviewed `expectedMinReaderModel` literal to `9`. This
  readers-first order is required because pre-model-9 engines only know the base
  guard document ID: after a newer engine emits an ID-space sibling, an older
  engine could otherwise advance or abort the instance, retract only the base,
  and leave an advisory lock behind. The affected instance commits reader floor
  9 before split guards deploy, so an old runtime fails explicitly instead of
  stranding a sibling. Existing affected instances need no data migration; their
  first model-9 commit raises the floor before it can create a split guard.

  **Docs impact:** Update `docs/reference.md` and the public mutation-guard
  reference to explain publish and unpublish action translation, predicate
  document bindings and dereferencing,
  deploy-time validation errors, and why mixed-ID-space guards emit separate
  documents. Update the prerelease reader-model rollout guide with the conditional
  model-9 adoption sequence, including every shared runtime, the
  `expectedMinReaderModel: 9` change, the old-retractor failure mode, and the fact
  that unaffected definitions retain their existing floor and require no data
  migration. Keep the `@sanity/workflow-engine-test` README's draft-ID examples
  and the root live-parity credential guidance aligned with those contracts.

- 2ddd3d7: **BREAKING:** `WorkflowErrorKind` can now be `concurrent-cascade`, paired with
  the new exported `ConcurrentCascadeError`, when an automatic cascade exhausts
  its revision-conflict retry budget. Consumers with exhaustive switches or
  `Record<WorkflowErrorKind, …>` mappings over the previous union must add the
  new member before upgrading; otherwise their TypeScript build will fail.

  Automatic cascade hops now recover from concurrent same-instance commits by
  reloading and re-evaluating state before retrying. Bounded retries for actions,
  field edits, and effect writes now also classify conflicts only at the parent
  instance commit, so a later guard or child-settlement 409 surfaces immediately
  instead of being mislabeled as instance contention. Update exhaustive error
  handling as described above; workflow definitions and stored instances require
  no migration.

  **Docs impact:** Add `ConcurrentCascadeError` to the engine error reference and
  describe automatic cascade conflict recovery.

- Updated dependencies [a8ed312]
- Updated dependencies [2ba0c09]
- Updated dependencies [2de38fd]
- Updated dependencies [a2ce4a7]
- Updated dependencies [2ddd3d7]
- Updated dependencies [6035672]
- Updated dependencies [26dd4e5]
- Updated dependencies [b04580d]
  - @sanity/workflow-engine@0.32.0

## 0.31.0

### Patch Changes

- Updated dependencies [ff72ece]
  - @sanity/workflow-engine@0.31.0

## 0.30.0

### Minor Changes

- 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.

  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.

  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.

  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.

  No reader-fleet rollout or deployment-literal change is required for existing definitions that do not use `roles`.

  **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.

- 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.

  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.

  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.

  **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.

### Patch Changes

- Updated dependencies [210ca63]
- Updated dependencies [a3a8dc0]
- Updated dependencies [a3a8dc0]
- Updated dependencies [a3a8dc0]
- Updated dependencies [90207dc]
- Updated dependencies [b0b1550]
  - @sanity/workflow-engine@0.30.0

## 0.29.0

### Minor Changes

- f44fc33: Workflow conditions can now read the caller's org-level User Attributes (Enterprise) through the advisory `$attributes` variable — for example `$attributes.department == "politics"` on a fireAction action filter, activity requirement, or editable predicate. Values match what lake role filters read via `user::attributes()`, keyed by attribute name with each active scalar or array value. Soft-gate paths (`evaluate`, fireAction filter re-check, editField) fetch the bag; ticks and drainers do not. Expected absences (401/402/403/404 — non-Enterprise, missing feature, forbidden) leave `$attributes` unbound so conditions that read it fail closed; unexpected fetch failures (5xx, network) throw on those soft-gate paths only and are not cached so the next call retries. An empty successful page binds `{}`. When the Management API envelope reports `hasMore: true`, the engine still binds the partial bag and warns (`nextCursor` makes follow-up pagination a small engine change). Engine checks remain advisory; the Content Lake is still the only enforcement point. `$attributes` is never persisted on `Actor` / history. The MCP authoring guide names the new variable alongside the other caller-bound vars. The test bench accepts an `attributes` bag (construction shortcuts and per-call overrides) the same way it accepts `grants`.

  **No upgrade action required.** Existing definitions are unchanged. Authors who want attribute-gated actions opt in by writing `$attributes` in caller-bound condition sites; cascade gates continue to reject caller-bound vars at deploy.

  **Docs impact:** Update the condition-variables reference (`docs/reference.md` § context-bound variables) and any guide that lists `$actor` / `$can` / `$assigned` so `$attributes` and the Enterprise / fail-closed semantics are named; note the spelling difference vs lake `user::attributes()`.

### Patch Changes

- Updated dependencies [f44fc33]
- Updated dependencies [26f25e0]
- Updated dependencies [25bd1fb]
- Updated dependencies [3fd04f1]
  - @sanity/workflow-engine@0.29.0

## 0.28.0

### Patch Changes

- Updated dependencies [1e4a5da]
- Updated dependencies [5050b06]
- Updated dependencies [a044ba5]
  - @sanity/workflow-engine@0.28.0

## 0.27.0

### Patch Changes

- Updated dependencies [780cf93]
  - @sanity/workflow-engine@0.27.0

## 0.26.0

### Patch Changes

- @sanity/workflow-engine@0.26.0

## 0.25.0

### Patch Changes

- Updated dependencies [177d600]
- Updated dependencies [fc12989]
  - @sanity/workflow-engine@0.25.0

## 0.24.0

### Patch Changes

- Updated dependencies [0bc4328]
- Updated dependencies [41a3f02]
  - @sanity/workflow-engine@0.24.0

## 0.23.0

### Patch Changes

- Updated dependencies [94d311e]
- Updated dependencies [795b4bb]
  - @sanity/workflow-engine@0.23.0

## 0.22.0

### Patch Changes

- Updated dependencies [88ba4ba]
  - @sanity/workflow-engine@0.22.0

## 0.21.0

### Minor Changes

- bcc30fe: **BREAKING:** Bench identities model the platform's id namespaces: the default all-access user id is `g-bench-user` (account-global form), and fixtures registering people use `g…`-prefixed ids (robots `p-…`). The bench serves the project-users directory endpoint through the fake client, so legacy-id normalization and namespace-aware assignment are testable end-to-end.
- 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.

  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.

### Patch Changes

- 92e28bd: Fix the reset activity test fixture to use the current reader model.
- cba229e: Fix spawn batch settlement test fixtures to acknowledge the current reader model.
- Updated dependencies [d9394e5]
- Updated dependencies [92e28bd]
- Updated dependencies [f4bc057]
- Updated dependencies [bcc30fe]
- Updated dependencies [e7392af]
- Updated dependencies [fa9c796]
  - @sanity/workflow-engine@0.21.0

## 0.20.0

### Minor Changes

- 7c4dd86: Reduce guard lifecycle request volume and chunk orphan cleanup transactions.
- 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.

### Patch Changes

- bce09fc: Restore automatic effect request tags while preserving concrete handler client APIs, backed by native request-prefix support in the test client.
- 8a76c67: Add incremental reactive-session document feeds, coalesce watched-document emissions, and reuse discovery derivations and Studio layout output. Deleted watched documents now leave the held snapshot instead of remaining as stale evaluation input. The component test runner also has aggregate-suite timeout headroom.
- Updated dependencies [bce09fc]
- Updated dependencies [efb4cd9]
- Updated dependencies [46b0285]
- Updated dependencies [ab5e454]
- Updated dependencies [8a76c67]
- Updated dependencies [e3122cc]
- Updated dependencies [7e8f459]
- Updated dependencies [98e488e]
- Updated dependencies [7c4dd86]
  - @sanity/workflow-engine@0.20.0

## 0.13.1

### Patch Changes

- Updated dependencies [24b11dd]
- Updated dependencies [2005ab7]
- Updated dependencies [24b11dd]
- Updated dependencies [59b40fd]
  - @sanity/workflow-engine@0.19.0

## 0.13.0

### Minor Changes

- 00c089d: **BREAKING:** Require every definition deployment and workflow deployment configuration to state an `expectedMinReaderModel` literal that exactly matches the installed engine's writer capability.

  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.

- 55a54b3: Surfaces understand the new `subject` field kind. Studio plugin: the start dialog's default subject seed lands on a definition's `subject`-kind entry whatever it is named (the doc.ref-named-`subject` convention stays the fallback), subject entries get the document picker / read-only face / state-panel preview / document pill, and mapping validation checks the subject entry's `types` facet. MCP: the subject lookup behind title enrichment prefers the `subject`-kind entry and keeps the name convention as fallback; the authoring guide teaches the kind. Test bench — **BREAKING:** `subjectField` now builds a `subject`-KIND entry value (matching its name and the engine's subject rule); a definition declaring the doc.ref convention needs the new `docRefField(documentId, {name})` instead. `instancesForSubject` matches both single-ref kinds.

### Patch Changes

- 71cd58e: Explain that effect-completion field operations require an explicit workflow or stage target scope when validation rejects a missing scope, and document the requirement on `EffectHandler`.
- 9126299: **BREAKING:** Delete persisted stage guard documents when their stage exits, and remove the lifted-record `GUARD_LIFTED_PREDICATE` and `isGuardLifted` exports.

  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.

- Updated dependencies [239d9f6]
- Updated dependencies [3af2ca0]
- Updated dependencies [7276702]
- Updated dependencies [58f8211]
- Updated dependencies [00c089d]
- Updated dependencies [71cd58e]
- Updated dependencies [cd03973]
- Updated dependencies [d26cc1a]
- Updated dependencies [9126299]
- Updated dependencies [72018af]
- Updated dependencies [5cd8ffd]
- Updated dependencies [b82bda4]
- Updated dependencies [55a54b3]
- Updated dependencies [b82bda4]
- Updated dependencies [4490442]
- Updated dependencies [1540dce]
  - @sanity/workflow-engine@0.18.0

## 0.12.0

### Minor Changes

- 092a0d4: **BREAKING:** runtime-supplied refs written into field state are gated on the deployment's declared resource surface.
  - 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.
  - 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.
  - 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.
  - `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.
  - The CLI wires no `resourceClients`, so refs supplied at runtime through it (`start --field`, `fire-action` ref params) admit the workflow resource only.

- 5a1a9fe: New `startedInstanceFixture(bench)` — a real, minimal started instance built through the bench's actual verbs, for consumers that need a persisted-shape-valid instance document without caring about its workflow (hand-crafted instance stubs do not pass the engine's read parse).
- 1321ba5: The bench exposes `evaluateStart` — the engine's pre-flight of `startInstance`'s gates (the `start.allowed` verdict with its insight, plus the still-missing required inputs), delegating to the verb with the bench clock so `$now` reads the frozen instant.

### Patch Changes

- e683875: The bench `queryInScope` doc now describes the scope the engine actually binds: the caller-free rendered scope (every always-bound condition var, `$fields` with the open stage's overlay merged, `$assigned` at its caller-free `false`, and the author's pre-evaluated `$<predicate>` booleans) — the previous enumeration listed a `$subject` param that was never bound.
- Updated dependencies [f9389e5]
- Updated dependencies [d0c62ea]
- Updated dependencies [c3eed2e]
- Updated dependencies [df4bd80]
- Updated dependencies [092a0d4]
- Updated dependencies [5a1a9fe]
- Updated dependencies [e3a7ba2]
- Updated dependencies [30fed9e]
- Updated dependencies [1321ba5]
- Updated dependencies [e683875]
- Updated dependencies [a8ace4d]
  - @sanity/workflow-engine@0.17.0

## 0.11.0

### Minor Changes

- 4e2b5bb: **BREAKING:** the bench now mirrors the engine's read/write surface exactly instead of paraphrasing it.
  - `editDocument` performs the real write for every action it accepts, so guards scoped to that action are genuinely consulted: `publish` promotes the existing draft onto the published id and `unpublish` retracts it (both through the fake client's document actions, vetted by the guard seam under that action); previously both silently landed as a plain update and a guard scoped to `actions: ['publish']` was never consulted. `create` is no longer accepted — create through the client, which the same seam gates. The return type is now honest: `StoreDocument | undefined` (`undefined` after `delete`/`unpublish`, or when the default identity can't read the written doc) instead of a cast that crashed at runtime.
  - Read helpers sharing an engine verb's name now delegate to that verb with the engine's args shape: `getInstance`/`listPendingEffects` (was `pendingEffects`)/`findPendingEffects` (new)/`children`/`instancesForDocument`/`definitionsForDocument` all take the engine's args objects, and missing/foreign-tag instances throw the engine's typed `InstanceNotFoundError` instead of a bench-local `Error`.
  - `instancesByStage` speaks the engine's filter vocabulary: `definition` (was `workflowName`) and `includeCompleted` (was `openOnly` — polarity AND default flip: in-flight only unless opted in).
  - `deleteDefinition` joins the engine-call wrappers with the same `actor:`/`grants:` identity shortcuts as every other write verb — no more routing around the bench via `createBenchEngine`.

  `@sanity-labs/client-fake-for-test` ^0.8.0 (the document publish/unpublish guard-interception seam) is now a regular dependency — the bench has always imported it at runtime, but it was previously declared only as a devDependency, so an external install got a broken package.

- 6a46db1: **BREAKING:** the definition root's `applicableWhen` moved to `start.filter`, inside a new `start` block — `{kind?: 'interactive' | 'autonomous', filter?: GROQ}` — describing how standalone runs begin. No alias, no dual-read: definitions authored with `applicableWhen` fail the strict parse until rewritten.
  - `start.kind` classifies who initiates a run — a person from a start surface (`'interactive'`, the default; `startKindOf(def)` is the one reading rule) or a system reacting to a document (`'autonomous'`, hidden from human start pickers). Classification only: `startInstance` stays one verb and one code path for every caller and kind — an interactive start of an autonomous workflow is legal. Deploy invariants: a spawn-only (`lifecycle: 'child'`) definition may not declare `start`; an `'autonomous'` kind requires every required input entry to be subject-style (`doc.ref`/`doc.refs` — the shared `isSubjectEntry` rule); a `start.filter` may read only declared **input-sourced** entries via `$fields` (a typo or a query/literal entry is a silent never-pass); and a root-reading filter (`_type == …`, `@`, or a `^` escaping a scan) requires a subject entry, since a read surface with no subject never binds a root.
  - `start.filter` is a **read-side visibility rule, not a gate** — `startInstance` never evaluates it and never throws on it; it starts whenever the caller supplies the required inputs. The filter decides what appears in / is chosen from Start lists: `definitionsForDocument`/applicability and the Studio start control evaluate it in a widened, named start-filter context (`START_FILTER_VARS`) — the candidate document as root, `$tag`/`$definition`/`$now`/`$fields` bound (`$fields` = the caller's input entries as GDR envelopes, so `$fields.<entry>.id` is the GDR URI), and `*[...]` = the workflow resource's dataset. Filters that never scan keep the cheap pure evaluation (`analyzeCondition(...).readsDataset` decides); scanning filters evaluate over a fetched slice of EVERY instance in the tag (completed included — `*` carries no hidden predicate; filters qualify in-flight themselves with `!defined(completedAt)`), so a filter can bound what surfaces (WIP limits, one-run-per-subject). Absent bindings evaluate GROQ-null and fail closed.

- e5f5b77: **BREAKING:** actions become the only payload mechanism — every op, effect, and spawn in the system lives on an action; structure never does.
  - Actions gain `when` (cascade-fired trigger: the engine fires it the moment it's true, at most once per stage visit, level-triggered; never fireAction-able) and `spawn` (the subworkflow block, unlocking caller-triggered and conditional spawn). Fires-on-entry is spelled `when: 'true'`.
  - Deleted from the model: `activation`, activity-level `ops`/`effects`/`subworkflows`, `completeWhen`/`failWhen`, `kind`, and transition `ops`/`effects`. Transitions are pure edges `{name, when, to}` (the condition key renamed from `filter` — trigger semantics). `target` survives as the off-system marker; `kind` is now always derived, plus a new derived executor classification (autonomous / interactive / off-system / hybrid) on activity evaluations.
  - Activities are `active` from stage entry (no `pending` status, no activation moment, no machine-step implicit); a new deploy invariant requires every activity to have a reachable path to a terminal status.
  - A cascade hop is ONE transaction: the current stage's triggered actions run to in-memory fixpoint, then transition selection, then a single CAS commit; chain hops stay separate commits. The per-visit `firedActions` ledger on the activity entry re-arms on re-entry (a stage resets on re-entry). The cascading token executes triggered actions; `roles` on a triggered action pins which identities may execute it (an incapable token leaves it armed).
  - The context bag split: `$effects` now carries completed effects' outputs ONLY (derived from `effectHistory`), and the new `$context` carries the `startInstance` seed plus a parent's `spawn.context` handoff (the persisted `effectsContext` field renamed `context`; `startInstance`'s seed arg renamed accordingly). `$effectStatus` is unchanged.
  - Spawn registry rows key per (activity entry, spawning action), so two spawn actions on one activity can never cross-adopt each other's children.
  - `fireAction` rejects a `when` action (`cascade-fired` verdict); evaluation projects triggered actions as narratable (`triggered: true` + `whenInsight`), never as buttons.

### Patch Changes

- Updated dependencies [11e2d6f]
- Updated dependencies [7510fd5]
- Updated dependencies [01e8042]
- Updated dependencies [79c54db]
- Updated dependencies [6a46db1]
- Updated dependencies [35b9b85]
- Updated dependencies [e5f5b77]
- Updated dependencies [01e8042]
  - @sanity/workflow-engine@0.16.0

## 0.10.0

### Minor Changes

- 65c7b0f: **BREAKING:** `bench.editDocument` now takes a `{set?, unset?, insert?}` patch spec instead of a set-only object — rewrite `patch: {title: 'x'}` as `patch: {set: {title: 'x'}}`. All three op kinds ride the same guarded as-actor write seam in a single commit, so `!defined(...)` predicates and array appends are now testable without bypassing `identity()` routing. A non-delete edit whose patch carries no ops throws, and `action: 'delete'` rejects a patch outright — contradictory input fails loud instead of being dropped.

  New bench surface:
  - `bench.setStage(args)` and `bench.abortInstance(args)` — the two instance-admin verbs join the wrapped set, injecting the bench access default and the bench clock like every other wrapper (previously callers rebuilt an engine by hand and time-based predicates evaluated at wall-clock).
  - `createBenchEngine(bench, overrides?)` is now exported: builds an out-of-band engine that inherits the bench's client, tag, workflow resource, and clock; `overrides` win.
  - The bench exposes its `tag` and `workflowResource`, and the default tag ships as the `BENCH_TAG` constant.

- d192d68: Definitions can now declare which documents they're for, and consumers can discover the right workflow to surface or start — no more hand-maintained per-consumer mapping tables.
  - `types?: string[]` on `doc.ref` / `doc.refs` field entries — the engine's `reference.to`. Absent accepts any type; declaring it on any other kind is a define-time error, as is an empty list or a literal seed whose GDR `type` isn't listed.
  - Optional definition-level `applicableWhen` — GROQ evaluated against a candidate document (the doc is the root; no `$` vars are bound, no lake) for value-level routing like `"_type == 'article' && articleType == 'finance'"`. Deploy validation rejects a parse error, any `$var` read, and any `*` dataset scan — each would make the predicate silently wrong at runtime.
  - Discovery is a pure derivation over deployed definitions: startable ∧ a required subject entry accepts the doc's `_type` ∧ `applicableWhen` passes (a GROQ-null result fails closed; a malformed predicate fails LOUD, naming its definition). Exposed as `applicableDefinitions` / `isDefinitionApplicable` / `acceptsDocumentType`, and as the `definitionsForDocument` verb (namespace + `Engine`) — the startable half of `instancesForDocument`. It takes the LOADED candidate document, considers only the latest deployed version per name, and surfaces ALL matches with no engine ranking. Advisory like every engine-side check.
  - Every hard write door honours `types`: `startInstance` initialFields, the spawn `with` handoff, and `editField` / `field.set` / `field.append` ops (resolved ref entries persist their declared `types`, like `object`/`array` persist `fields`/`of`, so instances stay self-describing). A violation fails hard — API-contract validation, the same tier as a missing required field. The spawn error names the projection footgun when (and only when) it applies: a projected bare id / `_ref` canonicalises with the generic type `"document"`, so a typed child entry needs `{"id": _id, "type": _type}` projected. A query-sourced entry's mismatching lake result is discarded with an audit row, like every other query-shape mismatch.
  - Bench: `definitionsForDocument(document)` read helper.

- d6e92ed: Now published with public npm access (previously restricted) — installable without `@sanity` org membership.

### Patch Changes

- 9f5a40f: Multi-resource bench coverage now proves the engine's auto-derived sibling routing: a subject in a foreign dataset is readable with no `resourceClients`, and a resolver miss reads the derived sibling for the target resource instead of falling back to the workflow client.
- 2511bb5: The `releaseField` fixture builds its `release.ref` envelope through the engine's `releaseRef` constructor, and test expectations track the engine's reworded `instancesQuery` document-filter error.
- 6bbf3ca: **BREAKING:** effect delivery reliability — claim leases with a stale-claim sweeper, and caller-supplied idempotency keys that are actually honored.

  Claim leases (`drainEffects` / `sweepStaleClaims`):
  - Every claim `drainEffects` stamps now carries `leaseExpiresAt` (engine-configurable via `createEngine({effectLeaseMs})`, default 5 minutes). A claim whose lease lapsed no longer protects its entry — the claimer is presumed dead, so a drainer dying between claim and complete no longer wedges the entry forever (previously the only recovery was aborting the whole instance). A claim persisted before leases existed counts as already expired, keeping exactly those stuck entries recoverable. There is deliberately no attempt counter on the claim: the retry count is the `effectClaimReleased` history rows for the entry's `_key` (plus the live claim), and a stored field would drift from that trail.
  - `drainEffects` takes expired claims over in the same CAS write that stamps its own claim, recording an `effectClaimReleased` history row (new `HistoryEntry` variant) with the abandoned claim embedded for audit. The `ifRevisionId` guard is the sweeper election — concurrent recoverers race safely.
  - New standalone `sweepStaleClaims({client, tag, instanceId})` export: force-release expired claims WITHOUT dispatching, for ops/admin housekeeping. Deliberately not an `Engine` verb (same category as the guard-lifecycle helpers) — a drain already self-recovers via takeover. Returns the released entries; the next drain redispatches them.
  - `DrainEffectsResult` gains a required `lost` bucket: entries this drainer dispatched whose completion lost to another party (e.g. a takeover finishing first). Previously that race crashed the drain with `EffectNotFoundError` mid-loop.
  - `EffectHandler`'s TSDoc now states the delivery contract explicitly: **at-least-once — a handler MAY double-run** (crash between dispatch and completion, or a slow dispatch outliving its lease). Check `effectHistory[]` for the run's `ctx.effectKey` before irreversible work, and derive external-system identifiers from `ctx.effectKey` so the receiving system can dedupe.
  - `drainEffects`/`sweepStaleClaims` read the engine clock for claim/lease stamps, so lease timing is deterministic under `createEngine({clock})` (previously drain stamped wall-clock unconditionally).

  Caller idempotency keys (previously a declared-but-dead arg):
  - The commit-owning verbs — `fireAction`, `editField`, `completeEffect`, `setStage`, `abortInstance` — now honor `idempotencyKey`. The first commit records the key on a new `processedRequests[]` instance ledger **in the same CAS write as the operation**, and a blind retry replays instead of double-applying (or, for a completed effect, throwing `EffectNotFoundError`): the op is not re-applied, but the cascade still runs to convergence — repairing the exact crash window a keyed retry exists for (died between the original's commit and its cascade) — so `changed` is `false` unless that cascade moved the instance. The check runs before the verbs' soft gates, so a replay can't die on a gate its own original commit closed (a resolved activity, a moved stage).
  - Ledger rows expire after `idempotencyTtlMs` (engine-scope config, default 24h) and are pruned lazily by later keyed commits; instances whose callers pass no keys never grow the ledger. Reusing a live key on a different verb throws `ContractViolationError`.
  - The moved arg is the breaking part: `idempotencyKey` now lives on `DedupableOperationArgs` (which the five verbs' args extend) instead of `OperationArgs`, so `tick` — which owns no commit and is naturally idempotent — no longer accepts the previously-ignored field.

- adf32f7: **BREAKING:** the `createBench({accessControl})` option is removed — it is subsumed by the identity registry (the identity's grants both render `$can` and gate the fake lake's writes, so identity and enforcement can't disagree), and a supplied `client` is rebound to the bench's default token identity. The bench expresses identities as registered tokens on its fake client: `createBench({currentUser, grants})` registers the default token, per-call `actor:`/`grants:` shortcuts mint cached token-scoped sibling clients, and the engine token-resolves every identity from `/users/me` + the ACL path exactly like production — token and actor can no longer disagree. The bench API is unchanged for tests using the shortcuts. New surface: `bench.clientFor({actor, grants?})` exposes the identity directory directly — the one registration seam for acting as another user (bind its sibling to `createBenchEngine`); omitted grants default to wildcard. New `createBench({executionContext})` passthrough (default `{kind: 'test'}`) for provenance assertions.
- 23cf131: Internal test fixture only (nothing published changes): `multiResourceHarness` accepts two new options — `contentAccessControl` gives the content resource an identity-serving, grant-gated client whose ACL path serves the supplied grants; `wfGrants` swaps the grants on the harness's existing token-bound wf identity (the identity itself stays `{id: 'test'}`).
- 6c21009: Regression tests pinning documented contracts: a guard `match.idPatterns` glob supports multiple `*`s and matches the whole id (anchored — no substring leak), `$can` binds in activity `requirements.*` and in `editable` predicates (unmet under read-only grants, met under update grants), and deploying a guard whose `idRefs` resolve to documents in different resources fails loudly with the single-resource error instead of picking one.
- 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.
- d192d68: **BREAKING:** subworkflow lifecycle is now owned by a workflow-scope registry (`instance.subworkflows`) instead of stage-entry bookkeeping. A child instance is a workflow-level fact; its record now lives (and survives) at workflow scope.
  - Re-entering a spawning stage **adopts** live children whose `forEach` rows are rediscovered instead of spawning a duplicate cohort. Rows that vanished from discovery follow the block's new `onExit` policy — `'detach'` (default) lets the child run to completion outside the gate, `'abort'` kills it. Stage exit applies the same policy to the live cohort.
  - `forEach` rows must carry an identity for adopt-matching: `_key` ?? `_id` for object rows (mint a `_key` in the projection for synthetic rows), the value itself for scalar rows. An identity-less or duplicate-identity row fails the spawn with a teaching error.
  - `abortInstance` now cascades: every live descendant is aborted recursively. An owed abort is recorded ON the child's registry row (`abortPending: {at, reason}` — crash-safe, and kept afterwards as the audit of why); the cascade drains condemned rows, and a condemned row is never adopted into a fresh cohort.
  - `$subworkflows` is now an **always-bound** condition var over ALL registry rows, faceted by `activity` / `definition` / `rowKey` / `status` (`'active' | 'done' | 'aborted'`), with `current` marking the open stage entry's cohort and `stage` the child's current stage — usable in transition filters, requirements, and any stage's gates. The implicit spawn gate scopes itself to the current cohort and settles on not-active (an aborted child releases it); authored gates that assumed spawn-scoped rows must now facet (`$subworkflows[activity == "…" && current && …]`).
  - Live children join the parent's watch-set and snapshot with raw reads, so conditions over child state re-evaluate as children move; a terminal child's state is frozen onto its registry row and its document leaves the watch-set.
  - Child completion propagates through the registry: a detached child (spawning stage exited, parent moved on) still stamps its row and re-cascades the parent; a terminal parent takes the stamp and history record without being reopened; a propagation with no matching registry row records a loud `subworkflowOrphaned` history entry instead of silently dropping.
  - A parent may complete with live detached children — legal, and `diagnose` now reports `liveChildren` on terminal states so consumers can surface it.
  - Removed: `ActivityEntry.spawnedInstances` — the registry replaces it. Instances persisted before the registry have an empty registry, so a spawning activity that was waiting on in-flight children resolves immediately on its next cascade (the cohort gate is vacuously settled) and those children's completions no longer propagate — each is recorded as a `subworkflowOrphaned` history entry on the parent when it terminates. Let in-flight fan-outs finish before upgrading, or expect to re-drive affected parents manually.

- Updated dependencies [4ca17bb]
- Updated dependencies [5143707]
- Updated dependencies [0709ab1]
- Updated dependencies [6bbf3ca]
- Updated dependencies [9f5a40f]
- Updated dependencies [d192d68]
- Updated dependencies [6c21009]
- Updated dependencies [109f900]
- Updated dependencies [109f900]
- Updated dependencies [444b0e6]
- Updated dependencies [2511bb5]
- Updated dependencies [d4fd8e6]
- Updated dependencies [30ed0e8]
- Updated dependencies [2834704]
- Updated dependencies [2511bb5]
- Updated dependencies [2511bb5]
- Updated dependencies [2511bb5]
- Updated dependencies [4607d59]
- Updated dependencies [52f6024]
- Updated dependencies [a8f1cb9]
- Updated dependencies [adf32f7]
- Updated dependencies [5cb0850]
- Updated dependencies [70a136c]
- Updated dependencies [91540de]
- Updated dependencies [8455fbb]
- Updated dependencies [325c2d1]
- Updated dependencies [d6e92ed]
- Updated dependencies [6c21009]
- Updated dependencies [7ffdc77]
- Updated dependencies [325c2d1]
- Updated dependencies [7ffdc77]
- Updated dependencies [ced40e4]
- Updated dependencies [9b1b40d]
- Updated dependencies [8c319b2]
- Updated dependencies [dc64968]
- Updated dependencies [23cf131]
- Updated dependencies [d192d68]
- Updated dependencies [15337f1]
- Updated dependencies [2d1a8e1]
- Updated dependencies [12cdbd6]
- Updated dependencies [437b544]
- Updated dependencies [ced40e4]
  - @sanity/workflow-engine@0.15.0

## 0.9.0

### Minor Changes

- 7a655bd: The bench grows the fixture helpers every consumer was hand-rolling: `subjectField(documentId, {name?, type?})` and `releaseField(releaseName, {name?})` build initial-field entries for the bench's default resource (derived via the engine's GDR constructors, not restated URI strings), and `bench.completePendingEffect({instanceId, effect, ...})` completes a pending effect looked up by name — the idiomatic way to play an external handler reporting its result — throwing loud when no such effect is pending.
- 5c69928: **BREAKING:** runtime API coherence pass — one result shape, one session noun, nameable engine args.
  - `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).
  - `startInstance` now returns `OperationResult` instead of a bare `WorkflowInstance` — its cascade is finally observable. Reach the instance via `result.instance`.
  - 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.
  - 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.
  - 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.
  - Test bench mirrors the engine: `bench.startInstance` returns `OperationResult`, and the `Bench*Args` types are the engine-bound shapes minus `access`.
  - 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`.

- 6ee9068: **BREAKING:** the bench's default `ALL_ACCESS_USER` actor is `kind: 'person'` (was `'user'`), following the engine's actor-kind rename — tests asserting on recorded actor kinds must follow.

### Patch Changes

- d9c8179: Drop the remaining "POC" branding from the guard docs and single-source the persisted guard doc type. Doc comments reference the type via `GUARD_DOC_TYPE` instead of hardcoding the literal, tests build guard ids and `_type` assertions with the exported `GUARD_DOC_TYPE` / `lakeGuardId`, and a contract-pin test pins the persisted wire literals so the eventual stored-type rename is a deliberate act. The `GUARD_DOC_TYPE` doc also notes that the cutover rename is a breaking type change for already-persisted guard docs.
- 0a7979a: Reconcile the guard enforcement story across the public surface. The packages previously asserted both that "the lake enforces guards" and that "enforcement is optimistic — the lake does not enforce `temp.system.guard`". Only the second is true: the lake does not evaluate the guard doc type yet (it is the placeholder for the lake's forthcoming guard primitive), so deployed guards deny optimistically engine-side on every plan and the lake ACL is the only hard gate. Every TSDoc block and README now tells that one story, with `GUARD_DOC_TYPE` as the canonical anchor; the bench's write rejection is described as a simulation of the intended lake contract, not a reproduction of current production behavior.
- 113a796: README: the shared-store sample passes the shipped `tag` argument to `createBench` instead of the renamed-away `tags`.
- Updated dependencies [a0443c4]
- Updated dependencies [a0443c4]
- Updated dependencies [ad9b6f6]
- Updated dependencies [83d5924]
- Updated dependencies [7a655bd]
- Updated dependencies [d9c8179]
- Updated dependencies [0a7979a]
- Updated dependencies [df00bbb]
- Updated dependencies [5c69928]
- Updated dependencies [2f081a3]
- Updated dependencies [df00bbb]
- Updated dependencies [113a796]
- Updated dependencies [df00bbb]
- Updated dependencies [2829643]
- Updated dependencies [6ee9068]
- Updated dependencies [2829643]
- Updated dependencies [a0443c4]
  - @sanity/workflow-engine@0.14.0

## 0.8.0

### Minor Changes

- 5bbc3f0: **BREAKING:** `Bench` methods (and exported test helpers) that took 3+ positional parameters now take a single named options object — e.g. `bench.editDocument({documentId, patch})`, `bench.instancesByStage({workflowName, stage})`, `bench.queryInScope({instanceId, groq})`. Behavior is unchanged — only the calling convention; update call sites to pass a single object.
- 6e51913: Add resource aliases so a definition can reference content portably across deploys. A definition addresses content through a named alias — `@content:<id>` — instead of a hardcoded physical GDR. `deployDefinitions` accepts a `resourceAliases` map binding each alias to a physical `WorkflowResource` (`ResourceAliases`, the sibling of role aliases), and expands every `@<alias>:` reference to its bound physical GDR at deploy: the deployed definition holds only physical references, so no alias and no runtime resolver survive past deploy. Switching environments is just deploying the same source with a different map.

  Expansion runs in the shared deploy planner, before the content fingerprint, so `deployDefinitions` and `definition diff` always fingerprint the same physical content (they can't drift), and rebinding an alias and redeploying the same source surfaces as changed content — a new version — never a silent shift in what the workflow reads. Deploy fails closed when a definition references an alias the deploy doesn't bind, or when a standalone reference expands to a malformed GDR. Expansion is a structural walk that rewrites references in GROQ and literal ref values only, never in `title`/`description` prose. Bare ids and physical GDRs are unchanged, so single-resource setups need no `resourceAliases`. The test bench accepts `resourceAliases` on `deployDefinitions`.

### Patch Changes

- Updated dependencies [416d4c9]
- Updated dependencies [4dfe72a]
- Updated dependencies [5bbc3f0]
- Updated dependencies [0bf7503]
- Updated dependencies [6e51913]
- Updated dependencies [3229f41]
  - @sanity/workflow-engine@0.13.0

## 0.7.0

### Minor Changes

- 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.

  `Action` (the actor-fired command) is unchanged.

  The rename cascades across the whole surface:
  - Authoring: `defineTask` → `defineActivity`; the `tasks:` array on a stage → `activities:`; `Task`/`AuthoringTask` types → `Activity`/`AuthoringActivity`.
  - 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".
  - Status: `TASK_STATUSES`/`TaskStatus` → `ACTIVITY_STATUSES`/`ActivityStatus` (and the terminal-status counterparts); status _values_ are unchanged.
  - Predicate sentinels: `$tasks` → `$activities`, `$allTasksDone` → `$allActivitiesDone`, `$anyTaskFailed` → `$anyActivityFailed`, `$requiredTasksDone` → `$requiredActivitiesDone`, `$task` → `$activity`. Authored GROQ filters referencing the old names must be updated.
  - 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.).
  - `workflow-react`: the `fireAction` argument `{task}` → `{activity}`.

  Nothing referencing "task" remains in the model. This is a deliberate pre-customer breaking change to land the correct, permanent vocabulary.

- 9233cd3: Add `engine.instancesForDocument({document})` — the reverse of the watch-set, finding every in-flight instance whose evaluation depends on a given document. The forward watch-set (`subscriptionDocumentsForInstance` / `collectWatchRefs`) answers "which docs does this instance watch"; this answers "which instances watch this doc", which a non-reactive, content-change-driven runtime (a Sanity Function, an Inngest/durable worker) needs to know which instances a changed document should `tick`. It mirrors the forward method's name (`subscriptionDocumentsForInstance` ↔ `instancesForDocument`) and sits alongside the existing `instancesForSubject` / `instancesByStage` read helpers.

  It matches the same ref set the forward watch-set uses — the instance itself, its ancestors, and the docs named by `doc.ref` / `doc.refs` / `release.ref` field entries on the workflow scope **and the current stage** — via the new pure `instanceWatchesDocument(instance, document)` helper, which derives from `collectWatchRefs`, so forward and reverse stay in lockstep (the same way `hydrateSnapshot`'s load-set does). A coarse GROQ prefilter narrows candidates server-side; the shared matcher does the exact, open-stage-only narrowing. The subject is matched by its full, resource-qualified GDR URI, so a cross-dataset doc never matches a same-id doc in another resource. The test bench gains a matching `bench.instancesForDocument(document)` read helper.

  This replaces the hand-rolled, incomplete GROQ a content forwarder would otherwise write (which misses stage-scope refs, `release.ref`, and ancestors).

### Patch Changes

- Updated dependencies [5b10863]
- Updated dependencies [ae1434e]
- Updated dependencies [d850aef]
- Updated dependencies [9519c76]
- Updated dependencies [9233cd3]
- Updated dependencies [3ea4953]
- Updated dependencies [e5a862a]
  - @sanity/workflow-engine@0.12.0

## 0.6.1

### Patch Changes

- Updated dependencies [3b8f3de]
  - @sanity/workflow-engine@0.11.0

## 0.6.0

### Minor Changes

- fae3553: **BREAKING:** Rename the domain concept **state → fields** across the whole API and persisted data model.

  "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.

  **Authoring DSL**
  - `defineState(...)` → `defineField(...)`
  - The `state: [...]` array on a workflow / stage / task → `fields: [...]`
  - The `$state.<name>` GROQ scope token → `$fields.<name>`
  - A `claim` action's `state:` reference → `field:`
  - A `stateRead` source → `fieldRead`; its `state:` (entry name) → `field:`
  - Op targets address the entry by `field:` instead of `state:`

  **Persisted / wire format**
  - Op type strings `state.set` / `state.unset` / `state.append` / `state.updateWhere` / `state.removeWhere` → `field.*`
  - The stored `state[]` array on instances, stage entries, and task entries → `fields[]`
  - `startInstance({ initialState })` → `startInstance({ initialFields })`

  **Types & functions** (engine)

  `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`.

  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`.

### Patch Changes

- Updated dependencies [fae3553]
  - @sanity/workflow-engine@0.10.0

## 0.5.0

### Minor Changes

- 2e4c980: Add a generic edit seam for declared-editable workflow state.

  State slots can now declare `editable` (default off) and be written directly
  through one `editState` verb — reassign, reschedule, claim-by-hand, append to a
  log — instead of a bespoke action per field.
  - `editable` on a state slot — default off. _Who_ may edit is expressed with
    the gating actions already have, not a new permission concept: `true` (anyone
    in the slot's scope window), a **role list** (the same `action.roles` sugar —
    it desugars to the identical `count($actor.roles[@ in [...]]) > 0` membership
    predicate), or a raw GROQ predicate (checked like `action.filter`). A stage
    may TIGHTEN a slot via an `editable` override map — the override is ANDed with
    the slot's baseline, so it can only narrow, never open a closed slot.
  - `editState` engine verb (and `engine.editState` / `instanceSession.editState`):
    gates on the slot's editability and scope window, applies the edit as a
    `state.*` op (so provenance + history are stamped by the op path), refreshes
    the stage's guards, then cascades — an edit to a value a transition reads can
    move the instance. Advisory like every engine gate; the lake ACL + guards are
    the only hard locks.
  - Scope is the editable window: a workflow slot is editable while the instance
    is live, a stage slot while its stage is current, a task slot while its task
    is active.
  - The projection gains `editableSlots`: each declared-editable slot in scope
    with this actor's edit verdict and the current value's provenance (`setBy` /
    `setAt`, read off `opApplied` history — no denormalised copy). `EditDisabledReason`
    and `EditStateDeniedError` mirror the action verdict surface.
  - `@sanity/workflow-react`'s controller exposes `editState`, threaded through
    the Studio and App SDK adapters.

### Patch Changes

- fd6b866: Add role aliasing to the authoring DSL: a definition-level `roleAliases` map
  ("can be fulfilled by"). It's an authoring convenience — the same capability is
  often carried by different role names depending on how a project deploys its
  Content Lake roles, so rather than enumerate every equivalent role inline in
  each `roles` gate (or fork the definition per deployment), declare once which
  other roles fulfill it. Each key is a role a gate or `assignees` entry names;
  its value lists the roles that also satisfy it. The reserved `"*"` key lists
  roles that fulfill any gate (e.g. `{ "*": ["administrator"] }` for a
  deployment's broad role).

  The map expands the **required** side — never the actor's roles — and is applied
  in both places roles are matched: the `roles` gate bakes the expanded membership
  into its desugared GROQ at define time, and `$assigned` resolves the assignee's
  role through the map at runtime. Expansion is one level (non-transitive).

  This also corrects the misleading `Actor."*"` documentation: an actor's `roles`
  are matched by literal membership only — there is no actor-side wildcard — with
  the definition's `roleAliases` as the sole mechanism for widening, so the
  advisory gate can never grant access the actor was not actually given. Like
  every engine gate it is advisory; the registrant owns keeping the map true to
  the deployment's real Content Lake ACLs.

- Updated dependencies [2e4c980]
- Updated dependencies [fd6b866]
  - @sanity/workflow-engine@0.9.0

## 0.4.2

### Patch Changes

- Updated dependencies [c298ee2]
- Updated dependencies [8131dd5]
- Updated dependencies [8bf467e]
  - @sanity/workflow-engine@0.8.0

## 0.4.1

### Patch Changes

- Updated dependencies [ef927bc]
- Updated dependencies [32f5e64]
- Updated dependencies [df7582f]
- Updated dependencies [ed4174c]
- Updated dependencies [129258c]
  - @sanity/workflow-engine@0.7.0

## 0.4.0

### Minor Changes

- c6d1762: Model the engine tag as a single environment partition: `tags: string[]` becomes `tag: string`.

  The array + set-intersection matching was over-modelled — an engine operates against exactly one environment (test vs prod) at a time. `createEngine`, the raw `workflow.*` args (`DeployDefinitionsArgs`, `StartInstanceArgs`, `OperationArgs`, `EvaluateArgs`, `DeleteDefinitionArgs`), and the stored `workflow.definition` / `workflow.instance` documents now carry a single `tag`. Reads filter by equality (`tag == $tag`) instead of intersection, and `workflow.query` requires a `$tag` filter rather than `$engineTags`. Consumer-authored `type: "query"` state entries that referenced the `$engineTags` scope param now receive `$tag` (a single string) instead. `validateTags` is replaced by `validateTag`, and `canonicalTag` is removed (the tag is the ID prefix directly).

  The `tag` is **required** — there is no default. The engine enforces nothing, so the partition is the only thing keeping reads and writes off the wrong environment; an engine must not guess. `createEngine` requires it, and the CLI (`WORKFLOW_TAG` / `--tag`) and MCP server (`WORKFLOW_TAG`) both fail at startup when it's absent.

  The test bench's `createBench({ tags })` option becomes `createBench({ tag })`.

### Patch Changes

- Updated dependencies [c6d1762]
  - @sanity/workflow-engine@0.6.0

## 0.3.1

### Patch Changes

- Updated dependencies [dbc4afa]
- Updated dependencies [e2a6d5d]
- Updated dependencies [aa87a1c]
  - @sanity/workflow-engine@0.5.0

## 0.3.0

### Minor Changes

- fcf938a: Rebuild the authoring DSL and stored model around generic primitives plus
  define-time sugar. Breaking across the board:
  - **Name identity everywhere.** `name` replaces `id`/`workflowId` on
    definitions, stages, tasks, actions, transitions, state entries, and
    effects; instances carry `definition` + `currentStage` by name. The API
    boundary follows: `startInstance({definition})`,
    `guardsForDefinition({definition})`, `children({task})`, deploy results
    carry `definition`, and guard provenance is `sourceDefinition` /
    `sourceStage`. The pre-rebuild "slot" vocabulary is gone — state values
    validate as state entries (`StateValueShapeError` with `entryType` /
    `entryName`). Bare
    in-array `type` discriminators replace namespaced `_type` kinds
    (`doc.ref`, `assignees`, `state.set`, …). Engine-owned lake doc types are
    `sanity.workflow.definition` / `sanity.workflow.instance`.
  - **Two-layer schemas.** Authoring shapes (primitives + sugar) desugar at
    define-time into the stored definition: the claim pair, the `audit` op
    (stamped append), `roles`/`status` field sugar, lexical scope resolution
    for op targets, and the default `$allTasksDone` transition filter.
    State-entry names and predicate keys must be GROQ-safe identifiers (they
    are referenced as `$state.<name>` / `$<name>` in conditions). Deploy
    invariants reject duplicate names (stages, tasks, actions, transitions,
    state entries per scope, guards across the definition, effects), unknown
    targets, reserved-var shadowing, predicate cross-references and
    caller-scoped vars in predicates, `$can` outside action filters, and
    malformed guard reads.
  - **Ops are the only mutation vocabulary.** `state.set` / `state.unset` /
    `state.append` / `state.updateWhere` / `state.removeWhere` /
    `status.set`, with `{scope, state}` targets resolved at deploy and
    `status.set` as the single task-resolution mechanism (stamps completion +
    history).
  - **Lifecycle payloads.** Tasks own activation (`activation: 'auto' |
    'manual'`, machine-step auto-resolution, `completeWhen`/`failWhen`,
    `subworkflows` fan-out with `$subworkflows` completion gates and parent
    `context` handoff); transitions own exit/arrival (always-filtered,
    first-truthy wins, carry ops + effects); terminal stages are structural
    (no transitions).
  - **One gate mechanism.** Conditions are GROQ over the rendered scope
    (`$self`, `$state`, `$actor`, `$assigned`, `$can`, `$effects`, `$tasks`,
    `$subworkflows`, `$now`, …) with author predicates pre-bound as boolean
    params. Everything engine-side is advisory; hard enforcement is the lake
    ACL plus guards (`temp.system.guard` docs with `metadata` projections and
    name-derived ids).
  - **Effects registry.** Effects are `{name, bindings, input}` with
    GROQ-string bindings over the rendered scope; completed-effect `outputs`
    land in `effectsContext` namespaced under the effect's name and read as
    `$effects['<effect name>'].<output>`.

  The test bench mirrors the new surface (`task` instead of `taskId`,
  name-keyed reads, `effectsContextMap` returning the rendered `$effects`
  map).

- 6c4e0a0: Add `guardsForDefinition` — find every guard a workflow deployed without needing a live instance. Guard docs are stamped with the version-less workflowId, so it spans the datasources statically named across all deployed versions: the workflow resource, plus any resource a guard idRef names statically (a hardcoded GDR literal, directly or via a `stateRead` of a slot whose source is a literal GDR). Guards whose resource is only known per-instance (a `subject`/`init`-sourced slot) are not reachable this way — `guardsForInstance` covers those. Exposed on the engine (`engine.guardsForDefinition({workflowId})`) and the bench (`bench.guardsForDefinition(workflowId)`), reusing the existing `GUARD_DOC_TYPE` + provenance fields.

### Patch Changes

- 12e23b0: New shared primitives so consumers and tests build the engine's shapes exactly the way the engine does:
  - `datasetResourceParts(id)` — the one parser for `<projectId>.<dataset>` resource ids (`gdrFromResource` and the React adapters' routing both delegate to it; malformed ids now fail on empty parts too).
  - `subscriptionDocument(ref)` — build one `SubscriptionDocument` from a `GlobalDocumentReference`, the same construction `subscriptionDocumentsForInstance` uses.
  - `MutationGuardDeniedError.fromGuards({documentId, action, guards})` — the one mapping from denying guard docs to the structured `denied` payload, used by the engine's pre-flight and the test bench's write seam.

- Updated dependencies [4b5f59a]
- Updated dependencies [fcf938a]
- Updated dependencies [6c4e0a0]
- Updated dependencies [12e23b0]
- Updated dependencies [12e23b0]
  - @sanity/workflow-engine@0.4.0

## 0.2.1

### Patch Changes

- 0c6ccde: Compose the engine's shared `WORKFLOW_INSTANCE_TYPE` constant and `tagScopeFilter()` predicate in the test bench's read helpers (`instancesForSubject`, `instancesByStage`) instead of hand-writing the `"workflow.instance"` type literal and the `count(tags[@ in $engineTags]) > 0` tag-scope predicate.
- Updated dependencies [41ddd80]
- Updated dependencies [0c6ccde]
  - @sanity/workflow-engine@0.3.0

## 0.2.0

### Minor Changes

- 2b800a8: Enforce lake mutation guards at the client write seam. The bench-minted `TestClient` is now wired with `@sanity-labs/client-fake-for-test@^0.4.0`'s `mutationGuard` hook, backed by the engine's `denyingGuards` — so **every** write through the bench client is gated against deployed guards (incl. the engine's own content writes), exactly where the real lake enforces, not just in `bench.editDocument`. `editDocument` now writes through the client; its `{as}` actor routes through a token-scoped `withConfig({ accessControl })` sibling so `identity()` resolves correctly. Guard evaluation stays in `@sanity/workflow-engine` (one code path); the client only provides the seam.
- ce6960d: Guard provenance + housekeeping queries.
  - Mutation guard docs now carry explicit `sourceInstanceId` / `sourceDefinitionId` / `sourceStageId` provenance fields, so the engine can find its guards for coherency refresh and housekeeping without parsing them out of `_id`.
  - New `engine.guardsForInstance({instanceId})` returns every guard an instance registered, unioned across the resource the instance lives in and the resource of each `doc.ref`/`doc.refs` GDR it holds in state (same "if it's in the workflow, we pull it in" scope as snapshot hydration).
  - New exported `guardsForInstance` / `guardsForResource` helpers and a centralized `GUARD_DOC_TYPE` constant (single rename point for the eventual `temp.` prefix drop).
  - The bench exposes `guardsForInstance`; its `listGuards` now delegates to `guardsForResource`.

- 0432670: Injectable clock for deterministic time. The engine now threads a single
  `Clock` (`() => string`, default wall-clock) through each verb-driven
  operation, taking one reading per operation so `$now` in filters, the `now`
  op-source, and the timestamps the engine stamps (history `at`, `completedAt`,
  `enteredAt`, `lastChangedAt`, queued/ran effect stamps, query-slot `resolvedAt`)
  all share one instant. Production passes nothing and is unchanged. The clock is
  injected ONCE — via `createEngine({ clock })`, or the test bench's `setNow` /
  `advance` — not as a per-verb option; the raw `workflow.*` verbs accept it only
  through an internal seam, keeping the public `*Args` interfaces free of it. The
  external effect drainer (`drainEffects`) is out of scope and still uses
  wall-clock. The pure
  core (`buildParams`, `resolveSource`) now takes `now` as a value rather than
  reading wall-clock itself, restoring `core/`'s "no `new Date()`" contract.
  `Clock` and `wallClock` are exported from the package root.

  The bench (`@sanity/workflow-engine-test`) exposes the knob: `bench.setNow(iso)`
  freezes time, `bench.advance(ms)` moves it forward, `bench.now()` reads it, and
  `createBench({ now })` starts frozen. The clock is threaded into every wrapped
  verb, so a time-based `completeWhen` / `failWhen` / SLA predicate fires by
  advancing the clock and ticking — without mutating the subject document.

  Also removes the never-implemented `dueAt` hint field from `TaskEntry`: nothing
  ever wrote or read it, so it carried no behaviour. Re-add it with a real
  implementation if a cron-indexing fast-path is built later.

### Patch Changes

- a4f6d81: Bump `@sanity-labs/client-fake-for-test` to 0.5.0 for its new
  `simulateConcurrentEdit` helper, which the bench surfaces (via `bench.client`)
  to drive optimistic-locking races deterministically — used by the concurrent
  `fireAction` coverage.
- 95d7a31: Add a GROQ parity gate that pins the bench's `groq-js` evaluation against a real
  Content Lake. A shared corpus of representative query shapes — filters, nested
  array traversal, aggregations, computed projections, `in`-sets, reference
  matches, and dereferences — runs in CI in-memory (`groq-parity.test.ts`), and an
  on-demand `test:parity:live` script replays the identical cases against a live
  dataset to catch evaluator drift. The live gate is excluded from the default
  `vitest run` and skips itself without `SANITY_*` creds.
- Updated dependencies [d04cbea]
- Updated dependencies [870188e]
- Updated dependencies [a4f6d81]
- Updated dependencies [eff2a77]
- Updated dependencies [ce6960d]
- Updated dependencies [dff88ff]
- Updated dependencies [782272a]
- Updated dependencies [2b800a8]
- Updated dependencies [0432670]
- Updated dependencies [53a0598]
- Updated dependencies [c2ad7a9]
  - @sanity/workflow-engine@0.2.0

## 0.1.0

### Minor Changes

- 43d6b81: Initial release.
  - **`@sanity/workflow-engine`** — a workflow / BPM engine for Sanity content. Define workflows as data (stages, tasks, actions, guards, effects), run them as instances against a Sanity client, gate transitions on GROQ predicates, and queue side effects for runtimes to drain. Multi-tenant via engine-scope tags; ships a typed authoring surface under `@sanity/workflow-engine/define`.
  - **`@sanity/workflow-engine-test`** — an in-memory `createBench` harness for exercising workflows against the engine without a live Sanity client (deploy definitions, start instances, fire actions, assert state).

### Patch Changes

- Updated dependencies [43d6b81]
- Updated dependencies [127be08]
- Updated dependencies [bf62213]
  - @sanity/workflow-engine@0.1.0
