@sanity/workflow-studio-plugin 0.31.0 → 0.32.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,241 @@
1
1
  # @sanity/workflow-studio-plugin
2
2
 
3
+ ## 0.32.0
4
+
5
+ ### Minor Changes
6
+
7
+ - 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.
8
+
9
+ 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.
10
+
11
+ 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.
12
+
13
+ `@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.
14
+
15
+ **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.
16
+
17
+ - e3a8cdd: The Workflows Studio board now shows a compact navigator when its stage lanes extend beyond the viewport. The navigator maps run distribution across stages, tracks which lanes are visible, and lets mouse and keyboard users jump directly to a stage or bring all ending lanes into view.
18
+
19
+ **No upgrade action required.** The navigator appears automatically on overflowing boards.
20
+
21
+ **Docs impact:** Update the Workflows Studio board guide to describe the navigator, its stage-density marks, and its mouse and keyboard navigation.
22
+
23
+ - c56a78f: On a document's Workflows tab, each run card now names itself as **workflow title / current stage** on one line (muted stage, with a round or similar note trailing it). The overflow menu sits beside that copy, and the expand chevron sits at the far right of the header. The header stays the same white as the card body at rest and only picks up the muted fill while you hover the toggle; the menu button is transparent against that fill so it does not flash as a white chip.
24
+
25
+ The stage spine inside an open card is the surface that keeps the muted fill. Stages still ahead of the current one sit on white so they read as not-yet.
26
+
27
+ **No upgrade action required.**
28
+
29
+ **Docs impact:** If a guide or screenshot of the document Workflows tab still shows a stacked title-over-stage-chip header, a left-side chevron, or a muted header at rest, replace it with the breadcrumb line, far-right caret, and hover-only header fill. The spine taking the muted background is the matching interior change.
30
+
31
+ - 6bc9dd9: The Studio plugin now separates the For me view into personal assignments and
32
+ unassigned tasks routed through the viewer's roles in both the Workflows tool
33
+ and document view. Personal task badges and totals exclude role-routed offers,
34
+ and the tool summary reports distinct documents and releases.
35
+
36
+ **No upgrade action required.**
37
+
38
+ **Docs impact:** Update the Workflows tool and Studio document-view guides,
39
+ examples, and screenshots to show the two For me sections and explain that
40
+ badges and totals count only personal assignments.
41
+
42
+ - 0423766: The Workflows tool run inspector now puts Manage (Abort workflow…) under History rather than above it, and renames its section headings from Document/Stages/Manage workflow to Workflow subject/Workflow/Manage.
43
+
44
+ **No upgrade action required.** Editors see the new inspector order and copy on the next Studio plugin release; no project or definition changes are needed.
45
+
46
+ **Docs impact:** Update any Workflows tool screenshots or copy that still show the old inspector section order or section labels.
47
+
48
+ - d356ca0: Activity breadcrumbs in the Studio plugin now use `/` between segments instead of chevron separators — in list rows, activity cards, and modal headers (for example `Article proofread / Proofreading / Proofread the article`).
49
+
50
+ **No upgrade action required.** The change is visual only.
51
+
52
+ **Docs impact:** None — breadcrumb punctuation is not documented separately; release notes may mention the styling alignment if a plugin release note is written.
53
+
54
+ - cdd66c9: The Studio plugin now labels the in-flight termination control **Cancel workflow** (inspector Manage button and the document-tab instance menu), including the confirm dialog and the toasts that report that gesture. The engine abort verb and the **Aborted** terminal-state chip are unchanged.
55
+
56
+ **No upgrade action required.** Editors see the new copy on the next Studio plugin release.
57
+
58
+ **Docs impact:** Update the Studio plugin README and any Workflows tool or document-tab screenshots or copy that still show **Abort workflow**.
59
+
60
+ - 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.
61
+
62
+ 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.
63
+
64
+ `@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.
65
+
66
+ **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.
67
+
68
+ - 6f59494: The Workflows tool's **For me** tab drops its page header — both the **Your tasks** heading and the tab-wide count line above the tables. That count added the tasks you hold only through a role to the ones assigned to you by name, so the number over the page overstated the work waiting on you personally.
69
+
70
+ The count now sits with the rows it describes. The direct-assignment section is titled **Tasks assigned to you** and its subline counts that section's own tasks and the distinct documents they sit on (`3 tasks on 2 documents`), replacing the former "Tasks assigned directly to you" line. The role-assignment section is titled **Tasks sent to your role groups**, with the subline "Assign yourself to pick up tasks".
71
+
72
+ **No upgrade action required.**
73
+
74
+ **Docs impact:** Update the Workflows tool guide and any For me capture that shows the "Your tasks" heading or a tab-wide task count above the tables — the tab now opens straight onto its section headings. Name the first section "Tasks assigned to you" and describe its subline as that section's own task and document count. Name the second section "Tasks sent to your role groups" and its subline "Assign yourself to pick up tasks".
75
+
76
+ - 8d85c4e: The Workflows tool **For me** tab lists one row per assigned activity (including a role you hold), not one row per run — open work and failed (blocked) tasks both appear. Columns are Workflow subject, Task, Opened, Workflow, Due, and Attention — avatar stacks are gone. Opened shows how long the task has been waiting in its current stage. Clicking a row opens a task work panel. The Overview table now calls its first column Workflow subject too, so both tabs use the same name for the document the work belongs to.
77
+
78
+ The tab's rows are split into **Tasks assigned to you** and **Tasks sent to your role groups** tables, with directly assigned work first. A task naming both you and a role you hold appears only in the direct table. Empty sections stay out of the way; when both are empty, the existing all-clear fills the work area.
79
+
80
+ Role-assigned tasks need no generic claim step: the role assignment already lets a matching user perform the task. The role table therefore opens the same task panel and definition-authored actions as the direct table, without adding a synthetic **Claim task** button. A workflow that explicitly defines a claim action still shows that action normally.
81
+
82
+ Overview's run tally moved from above its table into the tool header proper, on a count line under its filter chrome.
83
+
84
+ A mounting tool table no longer paints one frame of provisional column widths before snapping to its real ones, which was visible as a flicker each time you switched tabs.
85
+
86
+ Overview and For me now remain as preserved React activities after their first render. Switching tabs reveals the existing table and its local state instead of rebuilding every row, while the shared run stream, deployed definitions, project members, and release titles remain mounted once above both activities.
87
+
88
+ Reopening a detail panel for a run you looked at recently no longer waits on a rebuild. Discovery and evaluation demand for the four most recently released instances is held for 30 seconds after the last surface lets go, so the reactive session that was already evaluating simply keeps evaluating and the panel paints from it — live state, not a replayed snapshot. In the test Studio a revisit went from roughly 600ms of empty panel to under 100ms; a run neither recently viewed nor currently open holds nothing.
89
+
90
+ The task panel reads as an account of the one task. It is titled by the task and trailed by its `workflow › stage`, its status says who the task waits on (`In progress · with you`, or `· with your role` when a held role is what put it in your list), and assignees appear as the same member-and-role avatar stack used elsewhere in the interface. Every action you can take — including the ones that conclude the task — sits under one **Your actions** heading rather than being split between a top strip and a footer. A link to the underlying document is pinned at the foot of the panel. The activity dialog reached from a run snapshot still opens the same way; its assignee chips now wrap and truncate the way the task panel does.
91
+
92
+ Deadlines now say their exact moment where a reader asks for one. Hovering a **Due** cell on For me reports the deadline in full (`Was due 15 Jul 2026, 10:30`, or `Due 15 Jul 2026` for a day-only due date, which no longer claims a midnight it never declared), and a deadline still ahead shows its date in the cell instead of the relative age that rendered as `just now`. On Overview, the stage-tasks hover card — the one both the avatar stack and the overdue mark open — names each task's exact deadline under its title, so a run with several late tasks no longer reports only the longest span.
93
+
94
+ **No upgrade action required.**
95
+
96
+ **Docs impact:** Update the Workflows tool guide where it describes For me as a run list or mentions Tasks avatars on that tab, and refresh any task-panel screenshot or walkthrough that shows the old titled-"Task" header, the `Description`/`Status`/`Studio document` label block, or actions pinned to a panel footer. Any capture of the tab now needs its separate direct- and role-assignment tables. Explain that role-assigned tasks are immediately actionable and only show a claim action when the workflow defines one. Both tabs call their first column **Workflow subject**, and For me replaces Stage with **Opened**, the time since the task entered its current stage. If the docs state activity status wording, note that the task panel says "In progress" where list columns say "Active", and that failed (blocked) assigned tasks appear as rows alongside open ones. Nothing needs saying about the recently-viewed hold — it is a latency property with no configuration and no behavioural surface. If the docs describe the Due column or the stage-tasks hover card, say that hovering reports the exact deadline and that the card lists each task's own deadline.
97
+
98
+ - c82367b: Multi-assignee fields in activity details now show an add-user icon after the first assignee is selected, making the action to add another assignee clearer.
99
+
100
+ **No upgrade action required.**
101
+
102
+ **Docs impact:** None; this is a visual affordance improvement with no change to documented behavior.
103
+
104
+ - f1603cf: The Workflows tool's "Start workflow" button now uses the ghost face instead of the filled default, so it no longer reads as the page's primary action. Most workflows are not started from this chrome.
105
+
106
+ **No upgrade action required.** The popover, definition list, and start dialog are unchanged.
107
+
108
+ **Docs impact:** Refresh any screenshot of the Workflows tool header that shows a filled "Start workflow" button.
109
+
110
+ - 8c603e7: The Workflows tool's run detail — the panel beside the Overview and the expanded dialog — now leads with the run it holds instead of the generic "Workflow details": the workflow's title, then the stage the run has reached, as `Workflow name / Current stage`. The stage trails the name in lighter weight, and the row still ellipsizes rather than wrapping, so a long workflow name eats into the stage before the header grows. "Workflow details" remains as the header while a run is still resolving and in the not-found state, where there is no run to name.
111
+
112
+ **No upgrade action required.** The change is presentational; no props, routes, or stored state changed.
113
+
114
+ **Docs impact:** Update the Workflows tool guide where it names the run detail panel's header, and re-capture any tool-overview screenshot that shows "Workflow details" as the panel title.
115
+
116
+ - e6589c2: The Workflows tool's "For me" tab now shows an Assignee column on both task
117
+ tables. Each row is one task, so the column shows everyone that task names —
118
+ members and roles alike — which tells an editor who else holds a task they are
119
+ assigned to, and which role a claimable task sits with. Names appear on hover,
120
+ matching the assignee stacks already used elsewhere in the tool.
121
+
122
+ **No upgrade action required.** The column is part of the tool's own layout and
123
+ needs no configuration.
124
+
125
+ **Docs impact:** Update the Workflows tool guide where it describes the "For me"
126
+ tab's two task tables and their columns.
127
+
128
+ - 2d316f1: The Workflows tool now lets Studio users press Down Arrow or Up Arrow on a selected task, run row, or board card to move the inspector to the next or previous item in the displayed order, and shows inspector navigation controls only in the expanded detail view.
129
+
130
+ **No upgrade action required.** The keyboard behavior and streamlined inspector header are available after updating the plugin.
131
+
132
+ **Docs impact:** Update the Workflows tool guide's table, board, and inspector navigation guidance to mention Down and Up Arrow navigation and the expanded-view navigator.
133
+
134
+ - 4b64f4c: The Workflows tool Overview now lets Studio users press Shift+Left Arrow or Shift+Right Arrow to move to the previous or next deployed workflow in the header picker, wrapping at both ends and skipping “All workflows”. The picker menu shows the shortcut.
135
+
136
+ **No upgrade action required.** The shortcut is available after updating the plugin.
137
+
138
+ **Docs impact:** Update the Workflows tool guide where it describes Overview’s workflow picker, table, and board so the Shift+arrow scope switch is documented next to Up/Down run navigation.
139
+
140
+ - 351010b: The assignment picker now lists people first, keeps roles searchable in a separate routing section with alias-aware group counts, and places the current user at the top; role-only tasks show a routed ghost mark whose hover names the route, effective group count, and age. **No upgrade action required.** Existing assignment values and write behavior continue to work unchanged. **Docs impact:** Update the Studio plugin and assignment-picker guides to show the regrouped picker, effective routed-group counts, and the routed-but-unheld task mark.
141
+ - 40c8f4e: The Workflows document view's "Active Workflows" heading now carries the start-workflow "+" directly beside its title instead of alone at the far right of the row, so the affordance reads as belonging to that group rather than as stray chrome in the margin. The heading also drops its instance count — a document runs one or two workflows in practice, so the number was noise — and both group headings ("Active Workflows" and "Finished Workflows") step up from the size-1 semibold to the size-2 medium heading token.
142
+
143
+ **No upgrade action required.** This is presentation only: the start control, the tab switch, and every instance section behave exactly as before.
144
+
145
+ **Docs impact:** Refresh any screenshot of the Workflows document view that shows the "+" in the right margin or a count beside "Active Workflows" — the document-view section of the Studio plugin guide.
146
+
147
+ ### Patch Changes
148
+
149
+ - 34b70d6: Expanding a Workflows tool detail panel now gives you a full-size view of what
150
+ that panel was showing. On the **For me** tab this means the task you were
151
+ reading: its title, status, fields, and **Your actions** all stay put and
152
+ simply get more room. Previously the expand button there opened the whole run
153
+ instead — the "Workflow details" view of stages and history — so the task you
154
+ had selected disappeared and you had to close the dialog to get back to it. The
155
+ **Overview** tab is unchanged: expanding a run still shows that run's details.
156
+
157
+ In both tabs the expanded dialog keeps the previous/next walker and its
158
+ position count, so you can step through the list without collapsing, and
159
+ "Back to the panel" returns you to the docked panel with the same item
160
+ selected.
161
+
162
+ **No upgrade action required.**
163
+
164
+ **Docs impact:** Update the Workflows tool guide wherever it describes the For
165
+ me task panel's expand button or shows the expanded view, since the screenshot
166
+ and description now show the task rather than the run's stages and history. If
167
+ the guide describes expanding as a way to reach a run's history from For me,
168
+ replace that route with opening the run from the Overview tab.
169
+
170
+ - a2ce4a7: **BREAKING:** Mutation guards now have one public compilation path:
171
+ `compileGuards` replaces the singular `compileGuard` export and returns every
172
+ Lake document required for the authored guard. Callers using `compileGuard`
173
+ must switch to `compileGuards` and persist every returned document; retaining
174
+ the old call would either fail to compile after upgrade or omit required
175
+ ID-space siblings. Literal field-seed document IDs now also enforce the Lake's
176
+ 128-character limit and reject double dots; replace an invalid seed with a
177
+ valid resource-local document ID before upgrading. `MutationContext.action` now admits only the
178
+ Lake's `create`, `update`, and `delete` operations, and
179
+ `documentActionDenials` takes their concrete `before` / `after` mutation image
180
+ instead of a prospective document plus authored lifecycle action. Callers of
181
+ that helper must construct the same mutation the Lake will evaluate; otherwise
182
+ their preview can disagree with enforcement. Pure `evaluateFromSnapshot`
183
+ callers that supply dereference-bearing guards must also pass a
184
+ `guardDereference` resolver for stored resource reads; the engine and reactive
185
+ session supply their token-bound client resolver automatically.
186
+
187
+ Mutation guards now deploy edit locks against draft IDs and publish or
188
+ unpublish gates against published IDs using the create, update, and delete
189
+ operations Content Lake evaluates. A guard combining both action classes
190
+ emits separate temporary guard documents, preventing either match from leaking
191
+ into the other ID space. Guard previews bind `document.before` and
192
+ `document.after`, follow stored resource-local references, continue to
193
+ understand temporary guards emitted with the older lifecycle-action vocabulary,
194
+ and reject invalid actions, ID patterns, or predicates before deployment.
195
+
196
+ Existing guard definitions keep their authored shape. Definitions whose guards
197
+ stay within one emitted ID space require no rollout change and retain their
198
+ existing reader floor. A guard that combines direct create/delete actions,
199
+ content updates, or publish/unpublish actions across ID spaces is a detectable
200
+ model-9 feature on both its definition and instances.
201
+
202
+ Before deploying such a definition, upgrade every Studio, CLI, MCP server,
203
+ Function, and other engine runtime sharing its workflow resource, then change
204
+ that deployment's reviewed `expectedMinReaderModel` literal to `9`. This
205
+ readers-first order is required because pre-model-9 engines only know the base
206
+ guard document ID: after a newer engine emits an ID-space sibling, an older
207
+ engine could otherwise advance or abort the instance, retract only the base,
208
+ and leave an advisory lock behind. The affected instance commits reader floor
209
+ 9 before split guards deploy, so an old runtime fails explicitly instead of
210
+ stranding a sibling. Existing affected instances need no data migration; their
211
+ first model-9 commit raises the floor before it can create a split guard.
212
+
213
+ **Docs impact:** Update `docs/reference.md` and the public mutation-guard
214
+ reference to explain publish and unpublish action translation, predicate
215
+ document bindings and dereferencing,
216
+ deploy-time validation errors, and why mixed-ID-space guards emit separate
217
+ documents. Update the prerelease reader-model rollout guide with the conditional
218
+ model-9 adoption sequence, including every shared runtime, the
219
+ `expectedMinReaderModel: 9` change, the old-retractor failure mode, and the fact
220
+ that unaffected definitions retain their existing floor and require no data
221
+ migration. Keep the `@sanity/workflow-engine-test` README's draft-ID examples
222
+ and the root live-parity credential guidance aligned with those contracts.
223
+
224
+ - Updated dependencies [a8ed312]
225
+ - Updated dependencies [2ba0c09]
226
+ - Updated dependencies [2de38fd]
227
+ - Updated dependencies [a2ce4a7]
228
+ - Updated dependencies [2ddd3d7]
229
+ - Updated dependencies [6035672]
230
+ - Updated dependencies [26dd4e5]
231
+ - Updated dependencies [b04580d]
232
+ - Updated dependencies [351010b]
233
+ - @sanity/workflow-engine@0.32.0
234
+ - @sanity/workflow-components@0.32.0
235
+ - @sanity/workflow-react@0.32.0
236
+ - @sanity/workflow-studio@0.32.0
237
+ - @sanity/workflow-diagram@0.32.0
238
+
3
239
  ## 0.31.0
4
240
 
5
241
  ### Minor Changes
package/README.md CHANGED
@@ -18,9 +18,9 @@ and a **Definitions** catalog behind the title row, each definition with its
18
18
  own page. Every one of those is a shareable address, run selection included:
19
19
  a selected row opens the run's detail in a panel beside the list, whose
20
20
  history feed rests at its newest entries with the rest behind **Show all
21
- history**. The panel is also where a running workflow can be stopped: an
22
- **Abort workflow** button below the stage card, against a reason recorded in
23
- the workflow's history. Aborting is open to anyone who can act on the instance, and cannot be
21
+ history**. The panel is also where a running workflow can be stopped: a
22
+ **Cancel workflow** button below the stage card, against a reason recorded in
23
+ the workflow's history. Canceling is open to anyone who can act on the instance, and cannot be
24
24
  undone.
25
25
 
26
26
  Four ideas cover everything in this guide:
@@ -309,10 +309,12 @@ export const handler = documentEventHandler(async ({event, context}) => {
309
309
  client: client as unknown as WorkflowClient,
310
310
  tag: TAG,
311
311
  workflowResource: {type: 'dataset', id: `${projectId}.${dataset}`},
312
- effectHandlers,
313
- // Leave effects this runtime has no handler for pending, for another
314
- // runtime (or the Studio's manual controls) to resolve.
315
- missingHandler: 'skip',
312
+ effects: {
313
+ handlers: effectHandlers,
314
+ // Leave effects this runtime has no handler for pending, for another
315
+ // runtime (or the Studio's manual controls) to resolve.
316
+ missingHandler: 'skip',
317
+ },
316
318
  })
317
319
 
318
320
  await engine.drainEffects({instanceId: event.data._id as string})
@@ -370,7 +372,7 @@ npx sanity blueprints deploy
370
372
  Note: scheduled functions currently require an **organization-scoped**
371
373
  stack — see Sanity's Functions documentation for stack setup. Concurrent
372
374
  runtimes are safe: ticks are idempotent, pending effects carry claims, and
373
- `missingHandler: 'skip'` keeps runtimes out of each other's effects.
375
+ `effects.missingHandler: 'skip'` keeps runtimes out of each other's effects.
374
376
 
375
377
  A third function is worth considering: deleting a document does not cascade
376
378
  into its workflows, so instances whose documents are gone stay in-flight