@sanity/workflow-studio-plugin 0.20.0 → 0.22.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,128 @@
1
1
  # @sanity/workflow-studio-plugin
2
2
 
3
+ ## 0.22.0
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies [88ba4ba]
8
+ - @sanity/workflow-engine@0.22.0
9
+ - @sanity/workflow-components@0.22.0
10
+ - @sanity/workflow-diagram@0.22.0
11
+ - @sanity/workflow-react@0.22.0
12
+ - @sanity/workflow-studio@0.22.0
13
+
14
+ ## 0.21.0
15
+
16
+ ### Minor Changes
17
+
18
+ - cdba5dc: The Workflows tool's task list now starts instance bands collapsed in the Overview segment (For me keeps them open; document groups stay open in both), and remembers explicit expand/collapse toggles across sessions — tracked per segment, stored in localStorage namespaced by engine resource with a versioned payload and a least-recently-toggled cap, degrading to session-only in-memory state when storage is unavailable. Untouched bands always follow the current defaults.
19
+ - 9b7e918: **BREAKING:** the `sanity` peer dependency floor rises from `^6` to `^6.3.0` — the doc-link verdict rides preview-store APIs first published in Studio 6.3.0.
20
+
21
+ Doc-ref faces resolve the referenced document's actual `_type` through one live session store instead of issuing a query per mounted face: every face reading the same document shares a single verdict pipeline into the Studio preview store, which multiplexes all observation over its one global dataset listener with batched hydration. Verdicts are real-time — a document created, published, or deleted mid-session upgrades or demotes its faces as it happens — and remounts (tab switches, dialog opens, list repaints) paint the last verdict instantly while the pipeline re-syncs. Readability gates the verdict: a representation that exists but is unreadable to the current actor fails open (the face is never demoted to "unavailable"), and a document persisted only as a release version resolves through its version document instead of reading as missing.
22
+
23
+ The Workflows tool's orphan detection reads the same live store, so it now agrees with the doc-link faces and with a reloaded tool in real time: deleting a document while the tool is open removes its workflow group from the task views and raises the clean-up banner as it happens, and a restored document re-enters the views the same way. Detection stays conservative — only a confirmed no-representation verdict hides a group; in-flight and unreadable observations report nothing, and a failed one keeps its last confirmed verdict — and the settle flow still re-confirms absence with a fresh lake read before anything irreversible fires.
24
+
25
+ - 809faca: The Workflows tool now detects workflows whose documents have been deleted. Their groups leave the task views (and the document filter), and a banner names how many there are and offers to clean them up after confirmation — under the hood each workflow is aborted where it stands. Detection is conservative: a group counts as orphaned only when every document it presents targets this Studio's content dataset and a lake probe confirms no representation (published, draft, or release version) exists; foreign refs and failed reads keep the group visible. Settling re-confirms absence at run time — a document restored since detection leaves its workflows running, and a failed recheck settles nothing. The summary toast reports each skipped or failed workflow by name, and the run re-probes detection: failed workflows stay detected by the banner for another pass, while a workflow whose document exists again returns to the task views.
26
+ - 38cb271: The plugin logs a UI-engagement telemetry vocabulary through the host Studio's telemetry store — eleven `Editorial Workflows Studio Plugin` events (the surface-qualified prefix keeps them separable from the engine's `Editorial Workflows` outcome events in downstream queries) complementing the engine's outcome vocabulary: surface views (tool and document view with tab attribution, the activity dialog with source attribution, instance detail keyed by instance), the start-dialog funnel (opened vs submitted per entry point, resumes flagged), auto-start runs (silent vs collect, request count), action-control use attributed to its physical surface and overflow-menu path with the UI-visible success flag, todo toggles attributed to their surface and write seam (tick action vs field edit), form-strip clicks, and applied task filters (category keys and value counts only). Payloads carry enums, counts, flags, and the instance id — never customer-authored strings. Events share the host store's session with the engine events, no-op in hosts without a telemetry provider, and a once-per-mount guard keeps StrictMode double-effects from double-counting views.
27
+
28
+ Internally, `StartWorkflowRequest` gains a required `source`, and the start controls, `useFireAction`, and `ActivityDetailDialog` gain surface/source props (none are exported package API). Two reads are deliberately not covered: field-editor opens (the per-kind editors share no open seam; the engine's sampled field-edited event covers actual edits) and the instance-detail entry path (tool list, document-view jump-out, and deep link collapse to one router state).
29
+
30
+ - fa9c796: **BREAKING:** Replace the singular `start.allowed` and activity requirement record with ordered, named requirement arrays.
31
+
32
+ Start readiness now accepts polymorphic `groq` and `singleSubject` nodes:
33
+
34
+ ```ts
35
+ // Before
36
+ start: {allowed: '$fields.approved == true'}
37
+
38
+ // After
39
+ start: {
40
+ requirements: [
41
+ {type: 'groq', name: 'approved', title: 'Approval required', query: '$fields.approved == true'},
42
+ ],
43
+ }
44
+ ```
45
+
46
+ Use `singleSubject` instead of `$subjectHasInFlightInstance` to allow at most one in-flight run of the same definition for a subject. The requirement is definition-scoped and version-blind across deployments:
47
+
48
+ ```ts
49
+ // Before
50
+ start: {allowed: '!$subjectHasInFlightInstance'}
51
+
52
+ // After
53
+ start: {
54
+ requirements: [
55
+ {type: 'singleSubject', name: 'single-subject', description: 'Finish the existing run first.'},
56
+ ],
57
+ }
58
+ ```
59
+
60
+ Activity readiness uses the same ordered descriptor model with `groq` nodes:
61
+
62
+ ```ts
63
+ // Before
64
+ requirements: {
65
+ approved: 'defined($fields.approval)'
66
+ }
67
+
68
+ // After
69
+ requirements: [{type: 'groq', name: 'approved', query: 'defined($fields.approval)'}]
70
+ ```
71
+
72
+ Requirement names must be unique within their owning array. Evaluation preserves author order and reports every unmet requirement with its `name` and optional editor-facing `title` and `description`. Fresh standalone starts enforce the requirements after validating inputs. Resuming an unfinished start and parent-owned spawning continue to bypass start requirements.
73
+
74
+ `evaluateStart()` now returns ordered `requirements` entries containing each descriptor, outcome, and GROQ insight where applicable. Its singular top-level `insight` is removed. `StartNotAllowedError.insight` is replaced by `StartNotAllowedError.unmetRequirements`. Activity evaluation likewise reports unmet requirement descriptors instead of names alone.
75
+
76
+ Rename the public start-requirement analysis helpers and constants:
77
+
78
+ ```ts
79
+ // Before
80
+ explainStartAllowed(args)
81
+ unboundAllowedReads(query, fields)
82
+ START_ALLOWED_VARS
83
+
84
+ // After
85
+ explainStartRequirement(args)
86
+ unboundRequirementReads(query, fields)
87
+ START_REQUIREMENT_VARS
88
+ ```
89
+
90
+ `definitionsForDocument({document, subject})` becomes `definitionsForDocument({document})`. Start applicability no longer needs a separately supplied subject. The engine-owned start dataset projection exposes only `definition`, `subject`, and `completedAt`; authors no longer query raw instance storage for deduplication.
91
+
92
+ Studio pre-flights both requirement kinds against the live document session, disables starts whose requirements are unmet, and renders the authored description or title with a humanized requirement-name fallback. Controls re-enable on the same mount when a blocking run completes.
93
+
94
+ Persisted data model 4 unconditionally raises `minReaderModel` to 4 for new definitions and instances because older readers would ignore readiness arrays and could commit invalid transitions. Upgrade every reader and Function before deploying model-4 writers. Legacy deployed definitions are not normalized; prerelease environments with incompatible definitions may use `sanity-workflows nuke` before redeploying.
95
+
96
+ - bcc30fe: **BREAKING:** Every surface emits and matches the account-global user id (`sanityUserId`) — the one identity namespace the engine stores. Studio member records carry `sanityUserId` alongside the project-scoped id; the plugin's member/picker views, `useAssignmentIdentity()`, display resolution, and the new `useSelfActor()` join through it once, so pickers, "for me" matching, and self-authored actor stamps all speak global ids. `@sanity/workflow-sdk` gains `useProjectMembers(projectId)`, loading the configured project's human members as assignment rows whose `id` is the global user id (display from project profiles). `@sanity/workflow-components`' `ProjectMember.id` is documented as the account-global id, and the new `projectMemberRow` builder is the one place member-row semantics live (global id preferred, membership-id fallback) — both integrations delegate to it. "For me" and assignment matching compare global ids: instances stored with project-scoped assignees stop matching until their next engine commit self-heals them.
97
+
98
+ ### Patch Changes
99
+
100
+ - a5b327d: Adapt Studio assignee controls to the reusable picker's controlled value contract.
101
+ - f4bc057: **BREAKING:** `list_workflow_instances` now returns one page with `has_more` and an optional `next_cursor`; callers that need every match must continue with the cursor. The optional `limit` accepts 1–100 rows and defaults to 25.
102
+
103
+ Bound instance and definition list reads with lake-side filtering and consumer-specific projections.
104
+
105
+ Document filtering now excludes exited-stage references and includes live unresolved child-workflow references. Definition discovery selects and model-gates only the latest deployed version of each workflow name; historical versions remain stored and available to history-oriented APIs.
106
+
107
+ The MCP eval suite now verifies that agents follow list cursors to find a target beyond the first default page, including in persisted Braintrust runs.
108
+
109
+ MCP tool telemetry reports a `cursorUsed` boolean so continued list-page adoption is measurable without sending cursor values, arguments, or results.
110
+
111
+ - Updated dependencies [d9394e5]
112
+ - Updated dependencies [a5b327d]
113
+ - Updated dependencies [a5b327d]
114
+ - Updated dependencies [92e28bd]
115
+ - Updated dependencies [f4bc057]
116
+ - Updated dependencies [bcc30fe]
117
+ - Updated dependencies [e7392af]
118
+ - Updated dependencies [fa9c796]
119
+ - Updated dependencies [bcc30fe]
120
+ - @sanity/workflow-engine@0.21.0
121
+ - @sanity/workflow-components@0.21.0
122
+ - @sanity/workflow-react@0.21.0
123
+ - @sanity/workflow-studio@0.21.0
124
+ - @sanity/workflow-diagram@0.21.0
125
+
3
126
  ## 0.20.0
4
127
 
5
128
  ### Minor Changes
package/README.md CHANGED
@@ -102,7 +102,7 @@ import {articleReview} from './workflows/article-review'
102
102
  export default defineWorkflowConfig({
103
103
  deployments: [
104
104
  {
105
- expectedMinReaderModel: 2,
105
+ expectedMinReaderModel: 4,
106
106
  name: 'production',
107
107
  // The tag namespaces all workflow data — the plugin only sees
108
108
  // definitions and instances deployed under the tag it's configured with.
@@ -376,6 +376,14 @@ stack — see Sanity's Functions documentation for stack setup. Concurrent
376
376
  runtimes are safe: ticks are idempotent, pending effects carry claims, and
377
377
  `missingHandler: 'skip'` keeps runtimes out of each other's effects.
378
378
 
379
+ A third function is worth considering: deleting a document does not cascade
380
+ into its workflows, so instances whose documents are gone stay in-flight
381
+ until something settles them. The Workflows tool detects these and offers
382
+ to settle them all, but that needs an editor looking; a document-delete
383
+ function settles them the moment the deletion happens, on the robot token —
384
+ see the cookbook recipe
385
+ [Handle a deleted subject document](https://www.sanity.io/docs/editorial-workflows/cookbook-handle-deleted-subject).
386
+
379
387
  ## Limitations
380
388
 
381
389
  - **Advisory enforcement.** The plugin's gates and locks are UI; only