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