@sanity/workflow-engine 0.15.0 → 0.16.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/dist/define.d.cts CHANGED
@@ -1,6 +1,8 @@
1
1
  import * as v from "valibot";
2
2
 
3
- declare type Action = ActionFields<Op, string[]>;
3
+ declare type Action = ActionFields<Op, string[]> & {
4
+ roles?: string[] | undefined;
5
+ };
4
6
 
5
7
  /** Type-mirror of {@link actionFields}, parameterised over the op and
6
8
  * group-membership grammars. */
@@ -9,10 +11,12 @@ declare type ActionFields<TOp, TGroup> = {
9
11
  title?: string | undefined;
10
12
  description?: string | undefined;
11
13
  group?: TGroup | undefined;
14
+ when?: string | undefined;
12
15
  filter?: string | undefined;
13
16
  params?: ActionParam[] | undefined;
14
17
  ops?: TOp[] | undefined;
15
18
  effects?: Effect[] | undefined;
19
+ spawn?: Subworkflows | undefined;
16
20
  };
17
21
 
18
22
  declare type ActionParam = v.InferOutput<typeof ActionParamSchema>;
@@ -58,48 +62,29 @@ declare const ActionParamSchema: v.StrictObjectSchema<
58
62
  declare type Activity = ActivityFields<
59
63
  FieldEntry,
60
64
  Action,
61
- Op,
62
65
  ManualTarget,
63
66
  string[]
64
67
  >;
65
68
 
66
- declare const ACTIVITY_KINDS: readonly [
67
- "user",
68
- "service",
69
- "script",
70
- "manual",
71
- "receive",
72
- ];
73
-
74
- /** Type-mirror of {@link activityFields}, parameterised over field/action/op/target/group. */
75
- declare type ActivityFields<TField, TAction, TOp, TTarget, TGroup> = {
69
+ /** Type-mirror of {@link activityFields}, parameterised over field/action/target/group. */
70
+ declare type ActivityFields<TField, TAction, TTarget, TGroup> = {
76
71
  name: string;
77
72
  title?: string | undefined;
78
73
  description?: string | undefined;
79
74
  groups?: Group[] | undefined;
80
75
  group?: TGroup | undefined;
81
- kind?: ActivityKind | undefined;
82
76
  target?: TTarget | undefined;
83
- activation?: "auto" | "manual" | undefined;
84
77
  filter?: string | undefined;
85
78
  requirements?: Record<string, string> | undefined;
86
- completeWhen?: string | undefined;
87
- failWhen?: string | undefined;
88
- ops?: TOp[] | undefined;
89
- effects?: Effect[] | undefined;
90
79
  actions?: TAction[] | undefined;
91
- subworkflows?: Subworkflows | undefined;
92
80
  fields?: TField[] | undefined;
93
81
  };
94
82
 
95
- declare type ActivityKind = (typeof ACTIVITY_KINDS)[number];
96
-
97
83
  declare type AuthoringAction = AuthoringRawAction | ClaimAction;
98
84
 
99
85
  declare type AuthoringActivity = ActivityFields<
100
86
  AuthoringFieldEntry,
101
87
  AuthoringAction,
102
- AuthoringOp,
103
88
  AuthoringManualTarget,
104
89
  GroupMembership
105
90
  >;
@@ -659,7 +644,7 @@ declare const AuthoringOpSchema: v.VariantSchema<
659
644
  undefined
660
645
  >;
661
646
  readonly status: v.PicklistSchema<
662
- readonly ["pending", "active", "done", "skipped", "failed"],
647
+ readonly ["active", "done", "skipped", "failed"],
663
648
  `Invalid option: expected one of ${string}`
664
649
  >;
665
650
  },
@@ -724,15 +709,21 @@ declare const AuthoringOpSchema: v.VariantSchema<
724
709
  * Authoring action — the stored fields plus two field sugars with one
725
710
  * defined expansion each:
726
711
  *
727
- * - `roles` a `count($actor.roles[@ in [...]]) > 0` membership condition
728
- * ANDed with the authored `filter`. The definition's `roleAliases`
729
- * ({@link RoleAliasesSchema}) widen that membership at desugar time.
712
+ * - `roles` on a fireAction-fired action (no `when`) it desugars to a
713
+ * `count($actor.roles[@ in [...]]) > 0` membership condition ANDed with
714
+ * the authored `filter` (for a caller, "not yours to fire" and "doesn't
715
+ * exist for you" are the same advisory answer). On a CASCADE-FIRED
716
+ * action it stores VERBATIM — the pin on which identities may execute
717
+ * the trigger; folding it into `filter` would make the action's
718
+ * existence depend on whose token happens to cascade. The definition's
719
+ * `roleAliases` ({@link RoleAliasesSchema}) widen the membership either
720
+ * way.
730
721
  * - `status` → a `status.set` op on the firing activity, appended **after**
731
722
  * the authored ops (deliberately never implied: a forgotten explicit
732
723
  * `status` is a visible stall, an implied default silently completes
733
724
  * claim-like actions). Status is the health axis: a decision action
734
725
  * (decline, send back) resolves `done` and writes the decision into a
735
- * field the transition filter reads — `failed` is for work that
726
+ * field the transition trigger reads — `failed` is for work that
736
727
  * genuinely could not complete.
737
728
  */
738
729
  declare type AuthoringRawAction = ActionFields<AuthoringOp, GroupMembership> & {
@@ -753,216 +744,24 @@ declare type AuthoringStage = StageFields<
753
744
  AuthoringEditable
754
745
  >;
755
746
 
756
- declare type AuthoringTransition = TransitionFields<AuthoringTransitionOp> & {
757
- filter?: string | undefined;
747
+ declare type AuthoringStartBlock = StartFields & {
748
+ kind?: StartKind | undefined;
758
749
  };
759
750
 
760
- declare type AuthoringTransitionOp = v.InferOutput<
761
- typeof AuthoringTransitionOpSchema
762
- >;
763
-
764
751
  /**
765
- * Authoring transitions may omit `filter`; desugar fills the safe,
766
- * overwhelmingly-common gate `"$allActivitiesDone"`. "Fire unconditionally"
767
- * stays spellable as an explicit `filter: "true"`.
752
+ * Authoring transitions may omit `when`; desugar fills the safe,
753
+ * overwhelmingly-common trigger `"$allActivitiesDone"`. "Fire unconditionally"
754
+ * stays spellable as an explicit `when: "true"`.
768
755
  */
769
- declare const AuthoringTransitionOpSchema: v.VariantSchema<
770
- "type",
771
- [
772
- v.StrictObjectSchema<
773
- {
774
- readonly type: v.LiteralSchema<"field.set", undefined>;
775
- readonly target: v.StrictObjectSchema<
776
- {
777
- readonly scope: v.OptionalSchema<
778
- v.PicklistSchema<
779
- readonly ["workflow", "stage", "activity"],
780
- `Invalid option: expected one of ${string}`
781
- >,
782
- undefined
783
- >;
784
- readonly field: v.SchemaWithPipe<
785
- readonly [
786
- v.StringSchema<undefined>,
787
- v.MinLengthAction<string, 1, "must be a non-empty string">,
788
- ]
789
- >;
790
- },
791
- undefined
792
- >;
793
- readonly value: v.GenericSchema<ValueExprInternal>;
794
- },
795
- undefined
796
- >,
797
- v.StrictObjectSchema<
798
- {
799
- readonly type: v.LiteralSchema<"field.unset", undefined>;
800
- readonly target: v.StrictObjectSchema<
801
- {
802
- readonly scope: v.OptionalSchema<
803
- v.PicklistSchema<
804
- readonly ["workflow", "stage", "activity"],
805
- `Invalid option: expected one of ${string}`
806
- >,
807
- undefined
808
- >;
809
- readonly field: v.SchemaWithPipe<
810
- readonly [
811
- v.StringSchema<undefined>,
812
- v.MinLengthAction<string, 1, "must be a non-empty string">,
813
- ]
814
- >;
815
- },
816
- undefined
817
- >;
818
- },
819
- undefined
820
- >,
821
- v.StrictObjectSchema<
822
- {
823
- readonly type: v.LiteralSchema<"field.append", undefined>;
824
- readonly target: v.StrictObjectSchema<
825
- {
826
- readonly scope: v.OptionalSchema<
827
- v.PicklistSchema<
828
- readonly ["workflow", "stage", "activity"],
829
- `Invalid option: expected one of ${string}`
830
- >,
831
- undefined
832
- >;
833
- readonly field: v.SchemaWithPipe<
834
- readonly [
835
- v.StringSchema<undefined>,
836
- v.MinLengthAction<string, 1, "must be a non-empty string">,
837
- ]
838
- >;
839
- },
840
- undefined
841
- >;
842
- readonly value: v.GenericSchema<ValueExprInternal>;
843
- },
844
- undefined
845
- >,
846
- v.StrictObjectSchema<
847
- {
848
- readonly type: v.LiteralSchema<"field.updateWhere", undefined>;
849
- readonly target: v.StrictObjectSchema<
850
- {
851
- readonly scope: v.OptionalSchema<
852
- v.PicklistSchema<
853
- readonly ["workflow", "stage", "activity"],
854
- `Invalid option: expected one of ${string}`
855
- >,
856
- undefined
857
- >;
858
- readonly field: v.SchemaWithPipe<
859
- readonly [
860
- v.StringSchema<undefined>,
861
- v.MinLengthAction<string, 1, "must be a non-empty string">,
862
- ]
863
- >;
864
- },
865
- undefined
866
- >;
867
- readonly where: v.SchemaWithPipe<
868
- readonly [
869
- v.StringSchema<undefined>,
870
- v.MinLengthAction<string, 1, "must be a non-empty string">,
871
- ]
872
- >;
873
- readonly value: v.GenericSchema<ValueExprInternal>;
874
- },
875
- undefined
876
- >,
877
- v.StrictObjectSchema<
878
- {
879
- readonly type: v.LiteralSchema<"field.removeWhere", undefined>;
880
- readonly target: v.StrictObjectSchema<
881
- {
882
- readonly scope: v.OptionalSchema<
883
- v.PicklistSchema<
884
- readonly ["workflow", "stage", "activity"],
885
- `Invalid option: expected one of ${string}`
886
- >,
887
- undefined
888
- >;
889
- readonly field: v.SchemaWithPipe<
890
- readonly [
891
- v.StringSchema<undefined>,
892
- v.MinLengthAction<string, 1, "must be a non-empty string">,
893
- ]
894
- >;
895
- },
896
- undefined
897
- >;
898
- readonly where: v.SchemaWithPipe<
899
- readonly [
900
- v.StringSchema<undefined>,
901
- v.MinLengthAction<string, 1, "must be a non-empty string">,
902
- ]
903
- >;
904
- },
905
- undefined
906
- >,
907
- v.StrictObjectSchema<
908
- {
909
- readonly type: v.LiteralSchema<"audit", undefined>;
910
- readonly target: v.StrictObjectSchema<
911
- {
912
- readonly scope: v.OptionalSchema<
913
- v.PicklistSchema<
914
- readonly ["workflow", "stage", "activity"],
915
- `Invalid option: expected one of ${string}`
916
- >,
917
- undefined
918
- >;
919
- readonly field: v.SchemaWithPipe<
920
- readonly [
921
- v.StringSchema<undefined>,
922
- v.MinLengthAction<string, 1, "must be a non-empty string">,
923
- ]
924
- >;
925
- },
926
- undefined
927
- >;
928
- readonly value: v.GenericSchema<ValueExprInternal>;
929
- readonly stampFields: v.OptionalSchema<
930
- v.StrictObjectSchema<
931
- {
932
- readonly actor: v.OptionalSchema<
933
- v.SchemaWithPipe<
934
- readonly [
935
- v.StringSchema<undefined>,
936
- v.MinLengthAction<string, 1, "must be a non-empty string">,
937
- ]
938
- >,
939
- undefined
940
- >;
941
- readonly at: v.OptionalSchema<
942
- v.SchemaWithPipe<
943
- readonly [
944
- v.StringSchema<undefined>,
945
- v.MinLengthAction<string, 1, "must be a non-empty string">,
946
- ]
947
- >,
948
- undefined
949
- >;
950
- },
951
- undefined
952
- >,
953
- undefined
954
- >;
955
- },
956
- undefined
957
- >,
958
- ],
959
- undefined
960
- >;
756
+ declare type AuthoringTransition = TransitionFields & {
757
+ when?: string | undefined;
758
+ };
961
759
 
962
760
  /** The authoring surface: stored primitives plus the define-time sugar. */
963
761
  declare type AuthoringWorkflow = WorkflowFields<
964
762
  AuthoringFieldEntry,
965
- AuthoringStage
763
+ AuthoringStage,
764
+ AuthoringStartBlock
966
765
  >;
967
766
 
968
767
  /**
@@ -1022,25 +821,30 @@ export declare interface ConditionVar {
1022
821
  * The condition-variable inventory — the single source of truth for every
1023
822
  * `$var` the engine binds when it evaluates a {@link Condition}.
1024
823
  *
1025
- * Three evaluation contexts read a definition's GROQ:
824
+ * Four evaluation contexts read a definition's GROQ:
1026
825
  *
1027
826
  * 1. **Rendered condition scope** — every condition site in a definition
1028
- * (transition filters, `completeWhen`/`failWhen`, action filters, effect
1029
- * bindings, `subworkflows` reads, where-op `where`s, editability
1030
- * predicates, author predicates). {@link CONDITION_VARS} is its inventory;
1031
- * each entry's `binding` says when the var actually holds a value. The
827
+ * (transition `when`s, activity filters, action `when`s/filters, effect
828
+ * bindings, `spawn` reads, where-op `where`s, editability predicates,
829
+ * author predicates). {@link CONDITION_VARS} is its inventory; each
830
+ * entry's `binding` says when the var actually holds a value. The
1032
831
  * where-op context is the one closed subset — its bound set is statically
1033
832
  * fixed and deploy-enforced (see the op-where scope's param-name list in
1034
833
  * the op applier).
1035
- * 2. **Filter evaluation without a caller** — the engine's cascade evaluates
1036
- * transition filters and the activity gates (`filter`, `completeWhen`,
1037
- * `failWhen`) with no caller, so only the `'always'`-bound subset carries
1038
- * values there ({@link FILTER_SCOPE_VARS}). Caller-bound vars fail closed —
1039
- * `$assigned` binds its caller-free constant `false`, the rest evaluate to
1040
- * `undefined` — and deploy rejects them at these sites: routing and gate
1041
- * resolution must resolve identically no matter whose token triggers the
1042
- * evaluation.
1043
- * 3. **Guard predicates** — NOT conditions. A lake mutation guard's
834
+ * 2. **Cascade gates** — transition `when`s, activity filters, and a
835
+ * cascade-fired action's `when`/`filter` must resolve identically no
836
+ * matter whose token drives the cascade, so only the `'always'`-bound
837
+ * subset carries values there ({@link FILTER_SCOPE_VARS}). Caller-bound
838
+ * vars fail closed — `$assigned` binds its caller-free constant `false`,
839
+ * the rest evaluate to `undefined` — and deploy rejects them at these
840
+ * sites; a cascade-fired action's per-token gate is `roles`, never its
841
+ * conditions.
842
+ * 3. **The start-filter context** — a definition's `start.filter` evaluates
843
+ * against a CANDIDATE (no instance exists yet): the candidate document is
844
+ * the root, {@link START_FILTER_VARS} are the only bound vars, and
845
+ * `*[...]` reads the WORKFLOW resource's dataset. None of the rendered
846
+ * condition vars exist there.
847
+ * 4. **Guard predicates** — NOT conditions. A lake mutation guard's
1044
848
  * `predicate` is groq-js **delta-mode** GROQ over a document mutation:
1045
849
  * `before()`/`after()`/`identity()` are dialect natives, and the wire
1046
850
  * format binds the identifiers in {@link GUARD_PREDICATE_VARS}. None of
@@ -1054,7 +858,7 @@ export declare interface ConditionVar {
1054
858
  * - `'caller'` — rides the acting caller; without one the var is `undefined`
1055
859
  * (conditions referencing it fail closed). Author predicates may not read
1056
860
  * these — they pre-evaluate once per instance, caller-free.
1057
- * - `'spawn'` — bound only at `subworkflows` sites (the per-row `$row`).
861
+ * - `'spawn'` — bound only at spawn sites (the per-row `$row`).
1058
862
  */
1059
863
  export declare type ConditionVarBinding = "always" | "caller" | "spawn";
1060
864
 
@@ -1187,8 +991,9 @@ declare const EffectSchema: v.StrictObjectSchema<
1187
991
  * doesn't fit its shape — fails the completion (nothing is stored). Omitting
1188
992
  * `outputs` is an EMPTY allowlist: the effect produces nothing, so any returned
1189
993
  * output is rejected — the bound is universal, not opt-in.
1190
- * Why strict: `effectsContext` lives on the instance document, so the allowlist
1191
- * keeps it bounded — a handler can't accidentally spread a whole API response
994
+ * Why strict: outputs land on the instance document's `effectHistory`, so
995
+ * the allowlist keeps it bounded — a handler can't accidentally spread a
996
+ * whole API response
1192
997
  * into the instance — and the declared shapes let tooling (e.g. the simulator's
1193
998
  * drain UI) suggest an effect's exact output keys. Declaring outputs also
1194
999
  * powers the advisory deploy-time producer/consumer lint.
@@ -1254,8 +1059,6 @@ declare type FieldEntryFields<TEditable, TGroup> = FieldBase<
1254
1059
  of?: FieldShape[] | undefined;
1255
1060
  };
1256
1061
 
1257
- declare type FieldOp = v.InferOutput<typeof StoredFieldOpSchema>;
1258
-
1259
1062
  declare type FieldReadExpr = {
1260
1063
  type: "fieldRead";
1261
1064
  scope?: "workflow" | "stage" | undefined;
@@ -1289,9 +1092,8 @@ declare type FieldSourceInternal =
1289
1092
  declare type FieldValueKind = (typeof FIELD_VALUE_KINDS)[number];
1290
1093
 
1291
1094
  /**
1292
- * The subset that holds a value when the engine evaluates filters without a
1293
- * caller (the cascade path: transition filters, activity `filter`/
1294
- * `completeWhen`/`failWhen`).
1095
+ * The subset that holds a value in the cascade gates (transition `when`s,
1096
+ * activity filters, a cascade-fired action's `when`/`filter`).
1295
1097
  */
1296
1098
  export declare const FILTER_SCOPE_VARS: readonly string[];
1297
1099
 
@@ -1565,6 +1367,30 @@ declare type StageFields<TField, TActivity, TTransition, TGuard, TEditable> = {
1565
1367
  editable?: Record<string, TEditable> | undefined;
1566
1368
  };
1567
1369
 
1370
+ declare const START_KINDS: readonly ["interactive", "autonomous"];
1371
+
1372
+ declare type StartBlock = StartFields & {
1373
+ kind: StartKind;
1374
+ };
1375
+
1376
+ /** Type-mirror of {@link startFields}: how standalone runs of this workflow
1377
+ * begin. Stored requires `kind` (desugar fills the `'interactive'` default);
1378
+ * authoring may omit it — so each variant declares it. */
1379
+ declare type StartFields = {
1380
+ filter?: string | undefined;
1381
+ };
1382
+
1383
+ /**
1384
+ * Who initiates a standalone run of this workflow: a person picking it from a
1385
+ * start surface (`'interactive'`, the default) or a system reacting to a
1386
+ * document event (`'autonomous'`). PURE CLASSIFICATION — consumers use it to
1387
+ * shape their surfaces (hide autonomous workflows from human pickers, list
1388
+ * interactive ones for editors); `startInstance` is one verb and one code
1389
+ * path for every kind, and an interactive start of an autonomous workflow is
1390
+ * legal.
1391
+ */
1392
+ declare type StartKind = (typeof START_KINDS)[number];
1393
+
1568
1394
  /**
1569
1395
  * Declared editability of a field — the generic edit seam's gate. Default
1570
1396
  * (absent) is NOT editable: a field is op-only engine working memory unless the
@@ -1587,142 +1413,6 @@ declare const StoredEditableSchema: v.UnionSchema<
1587
1413
  undefined
1588
1414
  >;
1589
1415
 
1590
- /**
1591
- * The `field.*` subset — every mutation op EXCEPT `status.set`. Shared by the
1592
- * boundaries that write fields but must not set an activity status: a transition
1593
- * (its stage's activities are tearing down, so `status.set` has no coherent
1594
- * target) and an effect's completion (an effect is OUTSIDE the activity's own
1595
- * awaiting — it reports its result through fields, never by flipping a status;
1596
- * the activity/stage gate then reads those fields). The full {@link StoredOpSchema}
1597
- * (these plus `status.set`) is what actions and activity boundaries carry.
1598
- */
1599
- declare const StoredFieldOpSchema: v.VariantSchema<
1600
- "type",
1601
- [
1602
- v.StrictObjectSchema<
1603
- {
1604
- readonly type: v.LiteralSchema<"field.set", undefined>;
1605
- readonly target: v.StrictObjectSchema<
1606
- {
1607
- readonly scope: v.PicklistSchema<
1608
- readonly ["workflow", "stage", "activity"],
1609
- `Invalid option: expected one of ${string}`
1610
- >;
1611
- readonly field: v.SchemaWithPipe<
1612
- readonly [
1613
- v.StringSchema<undefined>,
1614
- v.MinLengthAction<string, 1, "must be a non-empty string">,
1615
- ]
1616
- >;
1617
- },
1618
- undefined
1619
- >;
1620
- readonly value: v.GenericSchema<ValueExprInternal>;
1621
- },
1622
- undefined
1623
- >,
1624
- v.StrictObjectSchema<
1625
- {
1626
- readonly type: v.LiteralSchema<"field.unset", undefined>;
1627
- readonly target: v.StrictObjectSchema<
1628
- {
1629
- readonly scope: v.PicklistSchema<
1630
- readonly ["workflow", "stage", "activity"],
1631
- `Invalid option: expected one of ${string}`
1632
- >;
1633
- readonly field: v.SchemaWithPipe<
1634
- readonly [
1635
- v.StringSchema<undefined>,
1636
- v.MinLengthAction<string, 1, "must be a non-empty string">,
1637
- ]
1638
- >;
1639
- },
1640
- undefined
1641
- >;
1642
- },
1643
- undefined
1644
- >,
1645
- v.StrictObjectSchema<
1646
- {
1647
- readonly type: v.LiteralSchema<"field.append", undefined>;
1648
- readonly target: v.StrictObjectSchema<
1649
- {
1650
- readonly scope: v.PicklistSchema<
1651
- readonly ["workflow", "stage", "activity"],
1652
- `Invalid option: expected one of ${string}`
1653
- >;
1654
- readonly field: v.SchemaWithPipe<
1655
- readonly [
1656
- v.StringSchema<undefined>,
1657
- v.MinLengthAction<string, 1, "must be a non-empty string">,
1658
- ]
1659
- >;
1660
- },
1661
- undefined
1662
- >;
1663
- readonly value: v.GenericSchema<ValueExprInternal>;
1664
- },
1665
- undefined
1666
- >,
1667
- v.StrictObjectSchema<
1668
- {
1669
- readonly type: v.LiteralSchema<"field.updateWhere", undefined>;
1670
- readonly target: v.StrictObjectSchema<
1671
- {
1672
- readonly scope: v.PicklistSchema<
1673
- readonly ["workflow", "stage", "activity"],
1674
- `Invalid option: expected one of ${string}`
1675
- >;
1676
- readonly field: v.SchemaWithPipe<
1677
- readonly [
1678
- v.StringSchema<undefined>,
1679
- v.MinLengthAction<string, 1, "must be a non-empty string">,
1680
- ]
1681
- >;
1682
- },
1683
- undefined
1684
- >;
1685
- readonly where: v.SchemaWithPipe<
1686
- readonly [
1687
- v.StringSchema<undefined>,
1688
- v.MinLengthAction<string, 1, "must be a non-empty string">,
1689
- ]
1690
- >;
1691
- readonly value: v.GenericSchema<ValueExprInternal>;
1692
- },
1693
- undefined
1694
- >,
1695
- v.StrictObjectSchema<
1696
- {
1697
- readonly type: v.LiteralSchema<"field.removeWhere", undefined>;
1698
- readonly target: v.StrictObjectSchema<
1699
- {
1700
- readonly scope: v.PicklistSchema<
1701
- readonly ["workflow", "stage", "activity"],
1702
- `Invalid option: expected one of ${string}`
1703
- >;
1704
- readonly field: v.SchemaWithPipe<
1705
- readonly [
1706
- v.StringSchema<undefined>,
1707
- v.MinLengthAction<string, 1, "must be a non-empty string">,
1708
- ]
1709
- >;
1710
- },
1711
- undefined
1712
- >;
1713
- readonly where: v.SchemaWithPipe<
1714
- readonly [
1715
- v.StringSchema<undefined>,
1716
- v.MinLengthAction<string, 1, "must be a non-empty string">,
1717
- ]
1718
- >;
1719
- },
1720
- undefined
1721
- >,
1722
- ],
1723
- undefined
1724
- >;
1725
-
1726
1416
  declare const StoredManualTargetSchema: v.VariantSchema<
1727
1417
  "type",
1728
1418
  [
@@ -1897,7 +1587,7 @@ declare const StoredOpSchema: v.VariantSchema<
1897
1587
  ]
1898
1588
  >;
1899
1589
  readonly status: v.PicklistSchema<
1900
- readonly ["pending", "active", "done", "skipped", "failed"],
1590
+ readonly ["active", "done", "skipped", "failed"],
1901
1591
  `Invalid option: expected one of ${string}`
1902
1592
  >;
1903
1593
  },
@@ -1973,8 +1663,8 @@ declare const SubworkflowsSchema: v.StrictObjectSchema<
1973
1663
  >;
1974
1664
  /**
1975
1665
  * Extra values evaluated in the parent's rendered scope at spawn time and
1976
- * delivered into each subworkflow's `$effects` bag — the parent→child
1977
- * handoff, read exactly like an effect output.
1666
+ * delivered into each subworkflow's `$context` bag — the parent→child
1667
+ * handoff.
1978
1668
  */
1979
1669
  readonly context: v.OptionalSchema<
1980
1670
  v.RecordSchema<
@@ -1996,13 +1686,13 @@ declare const SubworkflowsSchema: v.StrictObjectSchema<
1996
1686
  >;
1997
1687
  /**
1998
1688
  * What happens to still-live children when their cohort's scope stops
1999
- * applying — the spawning stage exits, or a re-entry's `forEach` no longer
1689
+ * applying — the spawning stage exits, or a re-fire's `forEach` no longer
2000
1690
  * discovers their row. `'detach'` (the default) lets them run to
2001
1691
  * completion outside the gate; `'abort'` kills them (recursively). The
2002
1692
  * engine never destroys in-flight work implicitly — `'abort'` is always
2003
1693
  * an authored choice. Note this governs only the CHILDREN's fate; whether
2004
- * the parent may move at all is what gates (`completeWhen`, transition
2005
- * filters over `$subworkflows`) decide.
1694
+ * the parent may move at all is what gates (conditions over
1695
+ * `$subworkflows`) decide.
2006
1696
  */
2007
1697
  readonly onExit: v.OptionalSchema<
2008
1698
  v.PicklistSchema<
@@ -2033,23 +1723,19 @@ declare type TodoListField = FieldBase<AuthoringEditable, GroupMembership> & {
2033
1723
  type: "todoList";
2034
1724
  };
2035
1725
 
2036
- declare type Transition = TransitionFields<TransitionOp> & {
2037
- filter: string;
1726
+ declare type Transition = TransitionFields & {
1727
+ when: string;
2038
1728
  };
2039
1729
 
2040
- /** Type-mirror of {@link transitionFields} minus `filter` — stored requires it,
1730
+ /** Type-mirror of {@link transitionFields} minus `when` — stored requires it,
2041
1731
  * authoring omits it (desugar fills the default), so each variant declares it. */
2042
- declare type TransitionFields<TOp> = {
1732
+ declare type TransitionFields = {
2043
1733
  name: string;
2044
1734
  title?: string | undefined;
2045
1735
  description?: string | undefined;
2046
1736
  to: string;
2047
- ops?: TOp[] | undefined;
2048
- effects?: Effect[] | undefined;
2049
1737
  };
2050
1738
 
2051
- declare type TransitionOp = FieldOp;
2052
-
2053
1739
  declare type ValueExprInternal =
2054
1740
  | LiteralExpr
2055
1741
  | FieldReadExpr
@@ -2314,7 +2000,7 @@ declare const WorkflowConfigSchema: v.ObjectSchema<
2314
2000
  description?: string | undefined;
2315
2001
  groups?: Group[] | undefined;
2316
2002
  lifecycle?: WorkflowLifecycle | undefined;
2317
- applicableWhen?: string | undefined;
2003
+ start?: StartBlock | undefined;
2318
2004
  initialStage: string;
2319
2005
  fields?: FieldEntry[] | undefined;
2320
2006
  stages: Stage[];
@@ -2332,7 +2018,7 @@ declare const WorkflowConfigSchema: v.ObjectSchema<
2332
2018
  description?: string | undefined;
2333
2019
  groups?: Group[] | undefined;
2334
2020
  lifecycle?: WorkflowLifecycle | undefined;
2335
- applicableWhen?: string | undefined;
2021
+ start?: StartBlock | undefined;
2336
2022
  initialStage: string;
2337
2023
  fields?: FieldEntry[] | undefined;
2338
2024
  stages: Stage[];
@@ -2398,7 +2084,7 @@ declare const WorkflowConfigSchema: v.ObjectSchema<
2398
2084
  description?: string | undefined;
2399
2085
  groups?: Group[] | undefined;
2400
2086
  lifecycle?: WorkflowLifecycle | undefined;
2401
- applicableWhen?: string | undefined;
2087
+ start?: StartBlock | undefined;
2402
2088
  initialStage: string;
2403
2089
  fields?: FieldEntry[] | undefined;
2404
2090
  stages: Stage[];
@@ -2458,7 +2144,7 @@ declare const WorkflowConfigSchema: v.ObjectSchema<
2458
2144
  description?: string | undefined;
2459
2145
  groups?: Group[] | undefined;
2460
2146
  lifecycle?: WorkflowLifecycle | undefined;
2461
- applicableWhen?: string | undefined;
2147
+ start?: StartBlock | undefined;
2462
2148
  initialStage: string;
2463
2149
  fields?: FieldEntry[] | undefined;
2464
2150
  stages: Stage[];
@@ -2507,17 +2193,17 @@ declare type WorkflowDefinition = v.InferOutput<
2507
2193
  * mints the next version.
2508
2194
  */
2509
2195
  declare const WorkflowDefinitionSchema: v.GenericSchema<
2510
- WorkflowFields<FieldEntry, Stage>
2196
+ WorkflowFields<FieldEntry, Stage, StartBlock>
2511
2197
  >;
2512
2198
 
2513
- /** Type-mirror of {@link workflowFields}, parameterised over field/stage. */
2514
- declare type WorkflowFields<TField, TStage> = {
2199
+ /** Type-mirror of {@link workflowFields}, parameterised over field/stage/start. */
2200
+ declare type WorkflowFields<TField, TStage, TStart> = {
2515
2201
  name: string;
2516
2202
  title: string;
2517
2203
  description?: string | undefined;
2518
2204
  groups?: Group[] | undefined;
2519
2205
  lifecycle?: WorkflowLifecycle | undefined;
2520
- applicableWhen?: string | undefined;
2206
+ start?: TStart | undefined;
2521
2207
  initialStage: string;
2522
2208
  fields?: TField[] | undefined;
2523
2209
  stages: TStage[];