@sanity/workflow-studio-plugin 0.0.0 → 0.2.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 ADDED
@@ -0,0 +1,115 @@
1
+ # @sanity/workflow-studio-plugin
2
+
3
+ ## 0.2.0
4
+
5
+ ### Minor Changes
6
+
7
+ - 11e2d6f: Activity rows' status chips gain a settled vocabulary: Done / Skipped / Failed activities now carry their outcome as a chip, and the decision attention state renames from "Decision needed" to "Awaiting decision" (Blocked is unchanged). Pending rows stay chip-less — the dashed status icon and muted title already read as not-yet-open.
8
+ - 11e2d6f: Date and datetime field pills now open a Studio-style calendar picker directly (month dropdown, year stepper, day grid — plus a time row with "Set to current time" on datetime fields) instead of the free-text edit row. A day pick commits immediately; date-only pickers close on pick, while datetime pickers stay open so the time row remains reachable. The action-item due-date control opens the same calendar in place of its native date input, keeping its clear affordance as a footer row.
9
+ - 11e2d6f: The form strip's start affordance now scales with the document type's mapping rows, like the Overview header's "+" already did: one row keeps the direct "Start workflow" button, several open a bottom/left-anchored menu (falling back to top/left) with one start per workflow. The mandatory-workflow gate offers the same choice, and its prompt names the workflow only when exactly one is mapped. `WorkflowFormStrip` and `MandatoryWorkflowGate` now take `mappings` (every row for the doc type) instead of a single `mapping`; `StartWorkflowControl` grew the button's appearance props (`label`, `iconOnly`, `mode`, `tone`) so each surface styles both of its faces at once.
10
+ - 11e2d6f: Redesign the Workflows document view's Overview. Every instance renders as a collapsible accordion section — in-flight runs under "Active Workflows", settled runs under a "Finished Workflows" heading, collapsed by default with the Completed/Aborted chip on the header. Each section carries workflow- and stage-scope field pills (popover editing for scalars, the actor picker, and the combined roles+members assignees picker; a True/False menu for booleans; a modal dialog for todo lists; a pill without an editor opens a read-only popover with the committed value and, when known, the reason it can't be edited). Document-reference pill faces show the resolved preview title, or italic "Untitled" when none resolves; role assignees render on the pill as plain text rather than a badge, so every pill keeps the same height. Sections also carry the stage spine, a next-stage hint card (rendered only for single-transition stages), and the activity rows. The action-items section leaves the Overview: todo items live on the For me tab — now aggregated across every instance with one shared empty state — and in the per-field todo dialog. Completed todos stay listed on For me with a struck-through label instead of vanishing on check; only open work counts toward the tab's number and the form strip's assigned-tasks metric, and the empty state waits until no assigned rows (open or done) remain. The header's start affordance becomes a menu when several workflow definitions map to the document type, and mapping validation verdicts are keyed per mapping row (docType + definition), so two rows sharing a docType keep distinct verdicts. The debug surfaces leave the tab strip: the State (debug) tab is removed, and the activity log moves behind each section's overflow menu as an "Event log (debug)" dialog.
11
+ - e5f5b77: **BREAKING:** follow the engine's actions-only payload model across every plugin surface.
12
+ - A cascade-fired (`when`) action is never a button: it leaves the action rows, the detail-dialog footer, and the checklist tick wiring, and surfaces only as "happens automatically" narration in the activity detail dialog.
13
+ - Filter-existence semantics: an action whose filter failed renders ABSENT — not disabled. The Blocked chip and the blocked-reason panel consider only rendered actions, so an activity whose only actions the engine fires reads as waiting, never blocked.
14
+ - A filter-scoped-out activity does not exist for the visit: it leaves the activities list (the history feed keeps the audit trail); an activity an action resolved `skipped` was real work and stays visible. The `pending` activation lifecycle is gone — activities are active from stage entry (its `EmptyIcon` status glyph leaves the status-icon map with it).
15
+ - The history feed follows the new entries: no activation rows, and a cascade-fired action reads "by the workflow" instead of an actor.
16
+ - `WorkflowMapping.effectsContextBuilder` renamed `contextBuilder` — it seeds `startInstance`'s renamed `context` bag (the `$context` variable).
17
+
18
+ - 11e2d6f: The Overview's stage block is now one bordered card: the spine band sits above a hairline divider, the current stage's work below it. Spine nodes render as bordered pills joined by hairline connectors sized on the theme's space scale, and the definition-missing notice takes the band slot inside the same card. The current-stage chip — on the spine and the form strip — now wears the theme's vibrant primary-button blues: a focus-ring outline with the ghost-primary fg/bg pair. Rows that mix badges into capsized text (the stage heading's round chip, the start dialog's release row) derive the same height whether or not the badge renders. Every spine pill now responds to hover/focus with a stage overview card — title, authored description, where the current stage advances (single-transition stages), the completion moment on past stages, and the activity count on current/upcoming ones. The pills hover like buttons (help cursor) but are not buttons: they drive nothing on click and show no pressed face.
19
+ - 6a46db1: Follow the engine's `start` block (`start.kind` classification + the read-side `start.filter` visibility predicate):
20
+ - workflow-mcp: `list_workflow_definitions` entries carry `startKind` (`'interactive' | 'autonomous'` — a classification, never a restriction).
21
+ - workflow-studio-plugin: start controls adopt the start model — `start.kind: 'autonomous'` mappings render no start affordance (automation owns their genesis), and a `start.filter` that DEFINITIVELY evaluates false on what's known before the dialog opens hides/disables the row with the start-condition reason. The pre-flight is purely additive: it never blocks a start the engine would accept, so every uncertain case (still loading, a dialog-collected `$fields` read, an eval error) shows the row. A failed start surfaces through the dialog's normal error toast.
22
+ - workflow-examples: `expense-approval` demonstrates a `start.filter` — one open approval per expense, as a picker-visibility filter (the Start list won't offer a second; not a gate).
23
+
24
+ - 11e2d6f: The form strip simplifies to one line. A single active instance renders its definition title as plain text beside the current stage in the primary chip — the same `StageChip` face the Overview spine's current node now wears (the chip carries the stage glyph instead of a dot). Several active instances collapse to "N active workflows" with no stages, and the assigned-task count aggregates across the listed runs (held at Loading…/Updating… until every instance's evaluation is trustworthy). Finished runs no longer appear on the strip — the "Show N finished" reveal is gone; the Workflows view owns history. Clicking the line opens the Workflows view without targeting an instance, and the unused `workflowInstance` pane param is removed.
25
+
26
+ ### Patch Changes
27
+
28
+ - 9dc592d: Four document-surface correctness fixes:
29
+ - **Self-registering document hooks.** `useWorkflowsForDocument` now registers the document with discovery on mount and releases it on unmount (refcounted), so reading a document's workflows is what keeps discovery live for it. The footer badges and the publish/delete action lock previously read discovery without registering — on a host-added custom document view, switching away from the form strip dropped the document and the lock silently disengaged while the guard still denied the write. Every surface that reads a document's workflows now inherits registration.
30
+ - **Existence probe sees release versions.** The doc-ref preview's "Document unavailable" probe now matches published, draft, and any release version (`versions.<release>.<id>`) under the raw perspective — a subject persisted only as a release version no longer renders as missing.
31
+ - **The `doc.ref` picker honours the entry's `types` facet.** The start dialog's reference picker and its "Create new" affordance scope to the entry's declared accepted types, falling back to the mapped document type only when the entry declares none — facet-declared entries are pickable and "Create new" mints an accepted type. Several accepted types get a create menu over just those types.
32
+ - **No empty footer for checkbox-only activities.** The activity detail dialog's footer no longer renders an empty band when an activity's only actions are ticks (they render as their item's checkbox, never a footer button).
33
+
34
+ - Updated dependencies [11e2d6f]
35
+ - Updated dependencies [7510fd5]
36
+ - Updated dependencies [01e8042]
37
+ - Updated dependencies [79c54db]
38
+ - Updated dependencies [9dc592d]
39
+ - Updated dependencies [6a46db1]
40
+ - Updated dependencies [35b9b85]
41
+ - Updated dependencies [e5f5b77]
42
+ - Updated dependencies [01e8042]
43
+ - @sanity/workflow-engine@0.16.0
44
+ - @sanity/workflow-react@0.11.0
45
+ - @sanity/workflow-studio@0.7.1
46
+
47
+ ## 0.1.0
48
+
49
+ ### Minor Changes
50
+
51
+ - 325c2d1: Inline field editing reworked around optimistic previews: click-to-edit → click-to-confirm is gone — fields are always-live inputs that preview per keystroke and commit on semantic boundaries (blur / Enter / gesture / unmount), never on a timer. A rejected commit reverts the projection and surfaces a toast. Fields the current stage's expressions read carry a subtle affordance, and when a staged value satisfies a transition filter the field shows a provisional "committing will advance" hint — the consequence signal the confirm click used to provide.
52
+ - 30ed0e8: Notes fields gain a real editor: a notes-shaped array (the `notes` sugar's `{body, actor, at}` rows) renders its log read-only with a textarea + Add arm that appends one full stamped row (`_key`, `body`, the current person as `actor`, `at`) through the edit seam's `append` mode — the engine stamps only a missing `_key` on an edit append, so the plugin supplies the audit columns. Every other array-kind editable field now renders read-only rows instead of the free-text editor, whose string `set` write was a guaranteed shape error. The start dialog routes on the same shape — positively, per sugar: a notes init field seeds one optional stamped opening row through a notes input instead of the todo checklist, whose `{label, status}` rows would have landed silently mis-shaped in the log, and a raw authored `array` (neither sugar) gets the raw JSON input instead of the checklist — unparseable JSON blocks Start, and the parsed text is what the start commits, so checklist rows can no longer land against a foreign declared row shape. Release reads went live: the start gate and the release picker read Studio's release store (`useIsReleaseActive` / `useActiveReleases`) instead of hand-rolled fetch+listen, so an archived release stops being pickable and flips the start gate without a reload — and the gate now blocks while the release store is still loading, where the old hand-rolled read failed open until its fetch returned. Core-layer "no result" values moved from `null` to `undefined` (including `WorkflowEntry.evaluation` and the context lookups); member profile requests URL-encode user ids, and failed field saves log the original error before toasting.
53
+ - 2511bb5: Initial release: the Sanity Studio plugin for `@sanity/workflow-engine` — the form strip, a Workflows document view, stage badges, and the document-action lock.
54
+ - 23cf131: Render the engine's new `subject-permission-denied` disabled reason — the actor lacks write permission on a subject document in that subject's own resource.
55
+
56
+ ### Patch Changes
57
+
58
+ - adf32f7: Studio drains and manual effect completions no longer pin the current Studio user as an actor override — the engine resolves the same identity from the workspace client's token (`/users/me`), so attribution is unchanged and the workaround is gone.
59
+ - 325c2d1: The inline-editing advance hint respects the engine cascade's halt at an unevaluable transition filter: transition selection stops at the first satisfied OR unevaluable filter in declaration order, so a satisfied transition behind an unevaluable one no longer shows a "committing will advance" hint the commit wouldn't perform.
60
+ - 325c2d1: Inline editors no longer lose typed content to the double-fire guard: the notes editor's Add and the action-items add popover check the in-flight guard before clearing, so a submit skipped while another write is in flight keeps the typed text (and the add popover stays open). A free-text field whose commit fails after further typing keeps the newer draft — the failure rolls back only the value that failed.
61
+ - 5143707: `completeEffectFor` types its `status` arg with the engine's exported `EffectCompletionStatus` instead of an inline union — same accepted values, one vocabulary.
62
+ - Updated dependencies [325c2d1]
63
+ - Updated dependencies [4ca17bb]
64
+ - Updated dependencies [5143707]
65
+ - Updated dependencies [0709ab1]
66
+ - Updated dependencies [6bbf3ca]
67
+ - Updated dependencies [9f5a40f]
68
+ - Updated dependencies [d192d68]
69
+ - Updated dependencies [6c21009]
70
+ - Updated dependencies [109f900]
71
+ - Updated dependencies [109f900]
72
+ - Updated dependencies [444b0e6]
73
+ - Updated dependencies [2511bb5]
74
+ - Updated dependencies [d4fd8e6]
75
+ - Updated dependencies [30ed0e8]
76
+ - Updated dependencies [2834704]
77
+ - Updated dependencies [2511bb5]
78
+ - Updated dependencies [2511bb5]
79
+ - Updated dependencies [2511bb5]
80
+ - Updated dependencies [4607d59]
81
+ - Updated dependencies [52f6024]
82
+ - Updated dependencies [a8f1cb9]
83
+ - Updated dependencies [adf32f7]
84
+ - Updated dependencies [adf32f7]
85
+ - Updated dependencies [5cb0850]
86
+ - Updated dependencies [70a136c]
87
+ - Updated dependencies [91540de]
88
+ - Updated dependencies [8455fbb]
89
+ - Updated dependencies [325c2d1]
90
+ - Updated dependencies [d6e92ed]
91
+ - Updated dependencies [6c21009]
92
+ - Updated dependencies [7ffdc77]
93
+ - Updated dependencies [325c2d1]
94
+ - Updated dependencies [7ffdc77]
95
+ - Updated dependencies [ced40e4]
96
+ - Updated dependencies [9b1b40d]
97
+ - Updated dependencies [8c319b2]
98
+ - Updated dependencies [dc64968]
99
+ - Updated dependencies [2834704]
100
+ - Updated dependencies [2511bb5]
101
+ - Updated dependencies [2511bb5]
102
+ - Updated dependencies [9f5a40f]
103
+ - Updated dependencies [325c2d1]
104
+ - Updated dependencies [15337f1]
105
+ - Updated dependencies [23cf131]
106
+ - Updated dependencies [d192d68]
107
+ - Updated dependencies [15337f1]
108
+ - Updated dependencies [2d1a8e1]
109
+ - Updated dependencies [12cdbd6]
110
+ - Updated dependencies [2511bb5]
111
+ - Updated dependencies [437b544]
112
+ - Updated dependencies [114dcae]
113
+ - Updated dependencies [ced40e4]
114
+ - @sanity/workflow-studio@0.7.0
115
+ - @sanity/workflow-engine@0.15.0
package/README.md CHANGED
@@ -64,12 +64,11 @@ export const articleReview = defineWorkflow({
64
64
  {
65
65
  name: 'write',
66
66
  title: 'Write the article',
67
- activation: 'auto',
68
67
  // `status: 'done'` = firing this action completes the activity.
69
68
  actions: [{name: 'submit', title: 'Submit for review', status: 'done'}],
70
69
  },
71
70
  ],
72
- // No filter = the stage advances once all its activities are done.
71
+ // No `when` = the stage advances once all its activities are done.
73
72
  transitions: [{name: 'to-review', title: 'Send to review', to: 'review'}],
74
73
  },
75
74
  {
@@ -79,7 +78,6 @@ export const articleReview = defineWorkflow({
79
78
  {
80
79
  name: 'review',
81
80
  title: 'Review the article',
82
- activation: 'auto',
83
81
  actions: [{name: 'approve', title: 'Approve', status: 'done'}],
84
82
  },
85
83
  ],
@@ -205,10 +203,10 @@ Everything above works with editors driving. Two things need a caller when
205
203
  no editor is looking, and both are small
206
204
  [Sanity Functions](https://www.sanity.io/docs/functions):
207
205
 
208
- - **heartbeat** — definitions can wait on time (`completeWhen` conditions
209
- over `$now`, e.g. an embargo date). Time passing emits no event, so a
210
- schedule must periodically `tick` in-flight instances. Ticking an instance
211
- with nothing due is a no-op.
206
+ - **heartbeat** — definitions can wait on time (`when` triggers over `$now`,
207
+ e.g. an embargo date). Time passing emits no event, so a schedule must
208
+ periodically `tick` in-flight instances. Ticking an instance with nothing
209
+ due is a no-op.
212
210
  - **drain-effects** — definitions can queue **effects** (named side-effects
213
211
  like "publish the subject"). This function runs your handlers for them
214
212
  whenever an instance has pending effects. Effects it has no handler for