@sanity/workflow-studio-plugin 0.32.0 → 0.34.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,175 @@
1
1
  # @sanity/workflow-studio-plugin
2
2
 
3
+ ## 0.34.0
4
+
5
+ ### Minor Changes
6
+
7
+ - 30a515c: **BREAKING:** Workflows Studio packages now target the Sanity UI 4 API. The Studio plugin, shared components, and diagram package each install `@sanity/ui ^4.2.1` for the UI they render; React, styled-components, and Studio remain peer contracts. This does not prevent Studio from hosting unrelated Sanity UI 3 plugins. Upgrade Sanity Studio to 6.15 or later and upgrade every `@sanity/workflow-*` package in the installation to the same release, then reinstall dependencies and commit the updated lockfile. Partial Workflows upgrades can pair packages built for different Sanity UI APIs and fail the Studio build.
8
+
9
+ Docs impact: Update the Studio plugin installation prerequisites and release guidance to require Sanity Studio 6.15 or later and a lockstep Workflows package upgrade.
10
+
11
+ ### Patch Changes
12
+
13
+ - Updated dependencies [30a515c]
14
+ - @sanity/workflow-components@0.34.0
15
+ - @sanity/workflow-diagram@0.34.0
16
+ - @sanity/workflow-studio@0.34.0
17
+ - @sanity/workflow-engine@0.34.0
18
+ - @sanity/workflow-react@0.34.0
19
+
20
+ ## 0.33.0
21
+
22
+ ### Minor Changes
23
+
24
+ - 225e0fb: **BREAKING:** Workflows App SDK and Studio integrations now require `@sanity/sdk` 3.1 or later in the 3.x line, and `@sanity/workflow-sdk` requires the matching `@sanity/sdk-react` 3.1 line when its React entry is used. The previous SDK 2 peer contract is no longer supported. The exported `WorkflowClient`, `TelemetryIntakeClient`, `ProjectUserProfileClient`, and `StudioUserClient` request contracts now pass their target in `url`; the previous `uri` request target is no longer used. The engine's effective client config also accepts the broader `{type: string, id: string}` resource descriptors returned by Sanity client 8.
25
+
26
+ Before upgrading Workflows, upgrade `@sanity/sdk` and `@sanity/sdk-react` together to 3.1 or later. Applications that stay on SDK 2 must stay on an earlier Workflows release. If you implement any of the request contracts named above, update it to read the request target from `url` instead of `uri`; otherwise its request-backed reads will fail. Existing `WorkflowClient.config()` implementations need no change when their resource descriptor already has string `type` and `id` fields. No separate CLI upgrade action is required; its definition-sharing and telemetry requests adopt `url` internally.
27
+
28
+ Before installing, override SDK 3's `@sanity/mutate` dependency to `0.18.2` in your application's root package-manager configuration, reinstall, and commit the updated lockfile. SDK 3.1.0 allows Mutate 0.18.1, which can leave document reads pending with client 8. For npm, set `overrides["@sanity/sdk"]["@sanity/mutate"]` to `"0.18.2"` in `package.json`. For pnpm, set `overrides['@sanity/sdk@3>@sanity/mutate']` to `0.18.2` in `pnpm-workspace.yaml`. Keep the override until your SDK release requires Mutate 0.18.2 or later. Complete examples and verification steps are in the Installation section of the published `@sanity/workflow-sdk` README.
29
+
30
+ Malformed project-member responses now report an inaccessible directory and can recover on a later lookup, instead of being cached as a missing user. No additional upgrade action is required for this correction.
31
+
32
+ **Docs impact:** Update the App SDK and Studio integration installation guidance, package compatibility references, and examples to require Sanity App SDK 3.1 and the consumer Mutate override described in the published `@sanity/workflow-sdk` README; update the client API references for `request({url})`, effective resource descriptors, and directory-response failures.
33
+
34
+ - 8326bbf: Contributors can now develop and inspect the Studio plugin's isolated workflow chrome in a local Storybook, including light and dark themes and representative loading, empty, error, disabled, workflow-status, deadline, and board states.
35
+
36
+ **No upgrade action required.** The workshop adds development tooling without changing the package API or published runtime files.
37
+
38
+ **Docs impact:** None. Storybook is contributor tooling documented in the repository README, not in the published package README.
39
+
40
+ - 7c46aca: Integrations outside Studio can import `AgoStamp`, `ActivityStatusIcon`, and
41
+ `StartIncompleteBadge` from `@sanity/workflow-components`. These workflow atoms
42
+ use the same implementation as the Studio plugin and accept domain values
43
+ without requiring Studio data providers.
44
+
45
+ Studio integrations can import `RunsTable` and `ForMeTable` from
46
+ `@sanity/workflow-studio-plugin`, with `runRowsOf`, `forMeTaskRowsOf`, and their
47
+ supporting types. These tables retain the Workflows tool's document previews,
48
+ member faces, task hints, and virtualized layout. Hosts supply sorted rows and
49
+ selection callbacks, render inside a Studio configured with `workflowStudioPlugin`, and provide a
50
+ height-constrained container with vertical scrolling. Table columns also recover
51
+ when a hidden container becomes visible and continue tracking width changes.
52
+
53
+ **No upgrade action required.** Existing plugin surfaces retain their table
54
+ presentation. Upgrade the Workflows packages together before adopting the new
55
+ exports.
56
+
57
+ **Docs impact:** Update the shared-components API reference for the status,
58
+ timestamp, and start badge atoms, and the Studio plugin reference and custom-tool
59
+ examples for table exports, row builders, providers, and controlled interaction.
60
+
61
+ - 6fba6b3: The Workflows tool now marks needs-attention runs at the grain the reader can
62
+ act on. In the Overview table and on board cards, each late task carries an
63
+ amber dot on its own token, so a stage holding several tasks shows which of
64
+ them are overdue rather than only that the run is. The lateness readout beside
65
+ the tokens shows a span (`4d`) only when every late task shares it, and the
66
+ bare word `overdue` when they differ — a single span standing for tasks late by
67
+ different amounts read as each task's when it was only the oldest one's.
68
+
69
+ The blocked mark moves to the thing it blocks. In the Overview table it sits
70
+ beside the stage name, since a failed activity stops that stage from advancing;
71
+ on a board card it sits in the top right corner. The Overview's separate
72
+ trailing attention column is gone, and its width is split between the widened
73
+ Tasks column and the workflow subject beside it. The For me table keeps its own
74
+ attention column, where a row is a task rather than a run.
75
+
76
+ No upgrade action required — this is presentation only, with no API or
77
+ persisted-shape change. Consumers rendering the tool see the new marks after
78
+ upgrading.
79
+
80
+ **Docs impact:** Update the Workflows tool guide's Overview and board
81
+ descriptions to cover the per-task overdue dot, the shared-span rule for the
82
+ lateness readout, and the blocked mark's placement beside the stage name and in
83
+ a card's corner. No concept or reference page changes.
84
+
85
+ ### Patch Changes
86
+
87
+ - 8874c50: **BREAKING:** A `subject`, `doc.ref`, or `doc.refs` field marked `required: true`
88
+ now requires its selected documents to remain readable after initialization.
89
+ Previously, the flag checked only that an initial value was supplied. Missing
90
+ required targets now produce a fault and prevent normal actions, triggered
91
+ actions, and transitions from advancing, even without an activity requirement
92
+ reading those targets. Abort and direct edits to editable fields remain
93
+ available. Optional references fault only when an unmet runtime condition needs
94
+ their content; completed workflows remain completed.
95
+
96
+ `StuckCause` adds `document-missing`. Update exhaustive handlers before upgrading,
97
+ or their typechecks fail and renderers have no matching branch. Evaluation
98
+ identifies the affected field and reference in `missingDocuments`, with its title
99
+ and completed availability evidence; `blockingMissingDocuments` selects the
100
+ references that prevent progress. The engine checks draft, published, and release
101
+ representations before distinguishing deletion from inaccessible content or
102
+ content outside the workflow perspective. Studio, CLI, and MCP use that same
103
+ result. Failed availability checks report unreadable content and log the cause;
104
+ optional references still permit unrelated actions. Incomplete reads do not
105
+ claim deletion, and an existing task fault keeps
106
+ its recovery controls. The fault clears when the required content becomes
107
+ readable; this release adds no undo-delete operation and does not automatically
108
+ abort workflows.
109
+
110
+ Upgrade every Workflows runtime sharing affected data, including Studio, CLI,
111
+ MCP servers, and deployed Functions, before relying on continued required-target
112
+ availability. Then set the deployment's reviewed `expectedMinReaderModel` to
113
+ `10` before deploying definitions with required content references. Writers stamp
114
+ model 10; this feature requires reader model 10, while documents without it keep
115
+ the floor required by their other features, normally 4, 8, or 9. Existing
116
+ instances remain readable without a backfill and adopt the rule under upgraded
117
+ engines. Their stored floor rises on the next full write, so an older runtime
118
+ can still advance an unstamped existing instance until the fleet is upgraded.
119
+ See `packages/workflow-engine/DATAMODEL.md` for the complete rollout contract.
120
+
121
+ The rendered CLI `show` command evaluates running instances. If evaluation fails,
122
+ it warns and displays stored state; terminal instances and `show --json` retain
123
+ their stored-state behavior.
124
+
125
+ **Docs impact:** Update field requiredness and initialization guidance, required
126
+ reference repair examples, the model-10 readers-first rollout, the diagnostics
127
+ reference for `StuckCause` and `MissingDocument`, CLI `show` and `diagnose`, MCP
128
+ workflow-state guidance, and the Workflows tool and document-view guides for
129
+ loading, deletion, permissions, and perspectives.
130
+
131
+ - 7eb9eca: Correct the API references for field initialization and edits, start requirements,
132
+ transitions, reference IDs, effect handling, reactive state, member controls,
133
+ Studio mappings, test helpers, and GROQ condition outcomes. The references state
134
+ caller constraints and defaults that were missing or incorrect. Package setup
135
+ guidance identifies the public npm packages and supported deployment command;
136
+ the MCP validation description distinguishes validation from deployment checks.
137
+ Runtime behavior and API signatures are unchanged.
138
+
139
+ **No upgrade action required.**
140
+
141
+ **Docs impact:** After release and reference sync, reconcile the modeling,
142
+ runtime, reactive UI, Studio, testing, deployment, MCP, and evaluation-insight
143
+ guides and references with the corrected contracts. Fix affected examples and
144
+ replace redundant API inventories with verified symbol links while preserving
145
+ useful teaching and the CLI/MCP reference material not exposed by TypeDoc.
146
+
147
+ - 2cef086: Internal maintenance consolidates engine action/edit handling and Studio document
148
+ and workflow title sorting. Action and field-edit calls retain their inputs and
149
+ results, and document and workflow titles retain their ordering. Action
150
+ availability, telemetry, and persisted document formats are unchanged.
151
+
152
+ **No upgrade action required.**
153
+
154
+ **Docs impact: None** because public APIs, configuration, and workflow behavior
155
+ are unchanged.
156
+
157
+ - Updated dependencies [3f7c2fd]
158
+ - Updated dependencies [393ac71]
159
+ - Updated dependencies [8874c50]
160
+ - Updated dependencies [0555271]
161
+ - Updated dependencies [b3b2797]
162
+ - Updated dependencies [225e0fb]
163
+ - Updated dependencies [7c46aca]
164
+ - Updated dependencies [7eb9eca]
165
+ - Updated dependencies [2cef086]
166
+ - Updated dependencies [232f811]
167
+ - @sanity/workflow-components@0.33.0
168
+ - @sanity/workflow-engine@0.33.0
169
+ - @sanity/workflow-studio@0.33.0
170
+ - @sanity/workflow-diagram@0.33.0
171
+ - @sanity/workflow-react@0.33.0
172
+
3
173
  ## 0.32.0
4
174
 
5
175
  ### Minor Changes
package/README.md CHANGED
@@ -1,8 +1,7 @@
1
1
  # @sanity/workflow-studio-plugin
2
2
 
3
- > **Status: private, unpublished.** This README describes the intended
4
- > consumer setup for when the package is published. Every
5
- > `@sanity/workflow-*` package is pre-1.0; APIs may change.
3
+ > This package is published on npm. Every `@sanity/workflow-*` package is
4
+ > pre-1.0; APIs may change.
6
5
 
7
6
  Workflows inside Sanity Studio. You describe a workflow in code —
8
7
  stages like _Drafting → Review → Approved_, and the actions that move work
@@ -41,11 +40,27 @@ treat plugin-side checks as a security boundary.
41
40
 
42
41
  ## 1. Install
43
42
 
43
+ Use one matching version for every `@sanity/workflow-*` package in the
44
+ command below. The plugin also requires `sanity ^6.15`, which provides
45
+ `@sanity/ui ^4.2.1`, plus `react ^19`, `styled-components ^6`, and
46
+ `@sanity/sdk ^3.1`.
47
+
48
+ Before installing, select Mutate 0.18.2 for SDK 3 in your application's root
49
+ configuration. For npm, set `overrides["@sanity/sdk"]["@sanity/mutate"]` to
50
+ `"0.18.2"` in `package.json`. For pnpm, set
51
+ `overrides['@sanity/sdk@3>@sanity/mutate']` to `0.18.2` in
52
+ `pnpm-workspace.yaml`. Without this override, an existing lockfile can
53
+ retain Mutate 0.18.1 and leave document reads pending.
54
+
44
55
  ```sh
45
56
  npm install @sanity/workflow-studio-plugin @sanity/workflow-components @sanity/workflow-diagram @sanity/workflow-engine @sanity/workflow-react @sanity/workflow-sdk @sanity/workflow-studio @sanity/workflow-cli
46
57
  ```
47
58
 
48
- Use one matching version for every `@sanity/workflow-*` package in that command; they publish as a fixed runtime stack. The plugin also requires a Studio v6 project (`sanity ^6`, `react ^19`, `styled-components ^6`, `@sanity/sdk ^2.12` — the usual Studio peers).
59
+ Commit the configuration and updated lockfile. Run
60
+ `npm ls @sanity/sdk @sanity/mutate` or `pnpm why @sanity/mutate` and verify SDK 3 resolves Mutate
61
+ 0.18.2. Keep the override until your SDK release requires Mutate 0.18.2 or
62
+ later. The [SDK package's installation guide](https://www.npmjs.com/package/@sanity/workflow-sdk#installation)
63
+ includes complete configuration examples.
49
64
 
50
65
  ## 2. Define a workflow
51
66
 
@@ -124,7 +139,7 @@ export default defineWorkflowConfig({
124
139
  ```
125
140
 
126
141
  ```sh
127
- npx sanity-workflows deploy --tag production # add --dry-run to preview
142
+ npx @sanity/workflow-cli deploy --tag production # add --dry-run to preview
128
143
  ```
129
144
 
130
145
  Auth comes from your `sanity login` session (or a `SANITY_AUTH_TOKEN` env
@@ -390,3 +405,34 @@ see the cookbook recipe
390
405
  - **Failed effects settle as failed** (workflows proceed rather than
391
406
  strand) and can't be retried from the Studio — run consequential effects
392
407
  in the runtime, not the browser.
408
+
409
+ ## Embed instance tables in a custom Studio tool
410
+
411
+ The package exports `RunsTable` (Overview) and `ForMeTable` (assigned tasks),
412
+ plus their prop and row types. They provide the same document previews, member
413
+ faces, deadline formatting, and attention hints as the Workflows tool. Render
414
+ them inside a Studio configured with `workflowStudioPlugin` and a height-constrained container with
415
+ `overflowY: 'auto'`.
416
+
417
+ Use `runRowsOf({previews, definitions, now})` to derive instance rows from the
418
+ instance-preview read and a map of deployed definitions. Supply the complete
419
+ preview result, including settled parent instances, so child runs retain their
420
+ root document attribution. `forMeTaskRowsOf({rows, who})` derives assigned tasks;
421
+ `who` uses the account-global user ID and resolved role names from
422
+ `AssignmentIdentity`.
423
+
424
+ The host owns data loading, filtering, ordering, and selection. Supply rows in
425
+ the displayed order and update them in response to `onSort`. `onSelectRun`
426
+ receives the original `RunRow`, and `onSelect` receives the original
427
+ `ForMeTaskRow`. `selectedId`, `selectedRef`, and `onNavigateKey` let the host
428
+ control focus, arrow-key navigation, and scrolling. Reset the scrolling
429
+ container when changing scope or sort order. Update `now` to refresh timestamps.
430
+
431
+ These exports are tables, without the Workflows tool's filters, URL state,
432
+ loading indicators, empty states, or detail panels. Compose those around them as
433
+ needed. `RunSort`, `ForMeSort`, their column-key types, `RunsScope`, and
434
+ `RunNavigationKeyEvent` describe the controlled table state and callbacks.
435
+
436
+ For integrations outside Studio, `@sanity/workflow-components` exports workflow
437
+ status, timestamp, badge, assignee, and date controls. Compose those atoms in
438
+ your integration’s own views.