@sanity/workflow-engine 0.30.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/dist/index.d.ts CHANGED
@@ -99,6 +99,8 @@ export declare function aclPathForResource(
99
99
  * only when cascade-fired (the pin on which identities may execute the
100
100
  * trigger); a fireAction-fired action's `roles` folds into `filter` at
101
101
  * desugar instead.
102
+ *
103
+ * @interface
102
104
  */
103
105
  export declare type Action = ActionFields<Op, string[]> & {
104
106
  roles?: string[] | undefined;
@@ -185,10 +187,15 @@ export declare interface ActionEvaluation {
185
187
  /** Derived state of a cascade-fired action's `when` trigger — what would
186
188
  * fire it. Present iff the action declares `when`. */
187
189
  whenInsight?: ConditionInsight;
190
+ /** A canonical `$assigned` filter leg withheld this absent action. The
191
+ * action still follows filter-existence semantics; this metadata lets the
192
+ * owning activity explain who currently holds the work. */
193
+ holderGate?: {
194
+ holders: Assignee[];
195
+ };
188
196
  }
189
197
 
190
- /** Type-mirror of {@link actionFields}, parameterised over the op and
191
- * group-membership grammars. */
198
+ /** @inline */
192
199
  declare type ActionFields<TOp, TGroup> = {
193
200
  name: string;
194
201
  semantics?: ActionSemantic[] | undefined;
@@ -210,6 +217,8 @@ export declare type ActionName = string;
210
217
  * or queuing effects: a missing required param throws
211
218
  * `ActionParamsInvalidError` and the action does not commit. Resolved values
212
219
  * feed `ValueExpr.param` lookups.
220
+ *
221
+ * @interface
213
222
  */
214
223
  export declare type ActionParam = v.InferOutput<typeof ActionParamSchema>;
215
224
 
@@ -390,6 +399,11 @@ export declare function actionVerdict(
390
399
  action: ActionEvaluation,
391
400
  ): AvailableAction;
392
401
 
402
+ /** The members that own work after direct-user membership shadows every role route. */
403
+ export declare function activeAssignmentMembers(
404
+ members: readonly Assignee[],
405
+ ): readonly Assignee[];
406
+
393
407
  /**
394
408
  * A unit of work carrying no payload of its own — every op, effect, and
395
409
  * spawn lives on an action; an activity contributes scoped `fields`
@@ -403,6 +417,8 @@ export declare function actionVerdict(
403
417
  * `requirements` are readiness gates orthogonal to `filter` — an unmet one
404
418
  * keeps the activity visible but disables its actions with a
405
419
  * `requirements-unmet` verdict; distinct from ACL and guards.
420
+ *
421
+ * @interface
406
422
  */
407
423
  export declare type Activity = ActivityFields<
408
424
  FieldEntry,
@@ -454,19 +470,6 @@ export declare const ACTIVITY_KINDS: readonly [
454
470
  "receive",
455
471
  ];
456
472
 
457
- /**
458
- * An activity is `active` from stage entry (or `skipped` when its `filter`
459
- * excluded it) until a terminal status resolves it — there is no pre-active
460
- * state. The authored action `status:` sugar (and the `status.set` op it
461
- * desugars to) is constrained to {@link TerminalActivityStatus}.
462
- */
463
- declare const ACTIVITY_STATUSES: readonly [
464
- "active",
465
- "done",
466
- "skipped",
467
- "failed",
468
- ];
469
-
470
473
  /** The activity slice of a stage rollup — total by construction, like
471
474
  * {@link stageAutonomyOf}. */
472
475
  export declare function activityAutonomyOf(
@@ -564,7 +567,7 @@ export declare interface ActivityEvaluation {
564
567
  actions: ActionEvaluation[];
565
568
  }
566
569
 
567
- /** Type-mirror of {@link activityFields}, parameterised over field/action/target/group. */
570
+ /** @inline */
568
571
  declare type ActivityFields<TField, TAction, TTarget, TGroup> = {
569
572
  name: string;
570
573
  semantics?: Semantic[] | undefined;
@@ -583,7 +586,13 @@ export declare type ActivityKind = (typeof ACTIVITY_KINDS)[number];
583
586
 
584
587
  export declare type ActivityName = string;
585
588
 
586
- export declare type ActivityStatus = (typeof ACTIVITY_STATUSES)[number];
589
+ /**
590
+ * An activity is `active` from stage entry (or `skipped` when its `filter`
591
+ * excluded it) until a terminal status resolves it — there is no pre-active
592
+ * state. The authored action `status:` sugar (and the `status.set` op it
593
+ * desugars to) is constrained to {@link TerminalActivityStatus}.
594
+ */
595
+ export declare type ActivityStatus = "active" | "done" | "skipped" | "failed";
587
596
 
588
597
  /**
589
598
  * Who is acting — advisory provenance, not an authenticated principal. The
@@ -633,7 +642,7 @@ export declare interface Actor {
633
642
  */
634
643
  export declare const ACTOR_KINDS: readonly ["person", "agent", "system"];
635
644
 
636
- /** Runtime counterpart of {@link expandRequiredRoles}; both expand only the required side. */
645
+ /** Runtime role check; like alias expansion, it expands only the required side. */
637
646
  export declare function actorFulfillsRole({
638
647
  actorRoles,
639
648
  required,
@@ -646,6 +655,13 @@ export declare function actorFulfillsRole({
646
655
 
647
656
  export declare type ActorKind = (typeof ACTOR_KINDS)[number];
648
657
 
658
+ /** Assignment ownership for runtime actors, with authorization aliases applied to role members. */
659
+ export declare function actorMatchesAssignment(args: {
660
+ actor: Actor | undefined;
661
+ members: readonly Assignee[];
662
+ roleAliases?: RoleAliases | undefined;
663
+ }): boolean;
664
+
649
665
  export declare type ActorResolution<User> =
650
666
  | {
651
667
  readonly status: "resolved";
@@ -720,9 +736,8 @@ export declare function assertReaderModelAcknowledgement(
720
736
  ): asserts expectedMinReaderModel is number;
721
737
 
722
738
  /**
723
- * One member of an `assignees`-kind entry's value and the value of the
724
- * singular `assignee` kind. The WHO-FOR spec the inbox reverse-query and the
725
- * rendered `$assigned` gate match against. A `role` member names a capability
739
+ * One member of an assignment entry's value, matched by the inbox reverse-query
740
+ * and rendered `$assigned` gate. A `role` member names a capability
726
741
  * (fulfilled by whoever deploys that role), not a concrete principal — which
727
742
  * is what distinguishes it from {@link Actor}. `id` here is a SYSTEM
728
743
  * identifier (a principal), not authored identity.
@@ -737,6 +752,56 @@ export declare type Assignee =
737
752
  role: string;
738
753
  };
739
754
 
755
+ export declare interface AssignmentIdentity {
756
+ readonly userId: string;
757
+ readonly roles: readonly string[];
758
+ }
759
+
760
+ /** @inline */
761
+ declare type AssignmentInstance = Pick<
762
+ WorkflowInstance,
763
+ "currentStage" | "stages"
764
+ >;
765
+
766
+ export declare type AssignmentMatch = "user" | "role" | undefined;
767
+
768
+ /** Whether an identity owns the assignment directly or through a literal project role. */
769
+ export declare function assignmentMatch(
770
+ members: readonly Assignee[],
771
+ identity: AssignmentIdentity,
772
+ ): AssignmentMatch;
773
+
774
+ /** Every member stored in assignment entries, preserving field and member order. */
775
+ export declare function assignmentMembers(
776
+ entries: readonly ResolvedFieldEntry[],
777
+ ): readonly Assignee[];
778
+
779
+ export declare function assignmentPrefilter(
780
+ assignment: NonNullable<InstancesQueryFilter["assignment"]>,
781
+ params: Record<string, string | string[]>,
782
+ ): string;
783
+
784
+ export declare type AssignmentState = "unrouted" | "routed" | "held";
785
+
786
+ /** Classify one assignment slot by whether it has no route, role routes, or a user holder. */
787
+ export declare function assignmentState(
788
+ members: readonly Assignee[],
789
+ ): AssignmentState;
790
+
791
+ export declare interface AssignmentStateCounts {
792
+ readonly unrouted: number;
793
+ readonly routed: number;
794
+ readonly held: number;
795
+ }
796
+
797
+ /** Viewer-scoped assignment counts at assignment-slot grain. Unrouted work is
798
+ * visible to every viewer; routed and held count only work offered to or
799
+ * held by the supplied identity. */
800
+ export declare function assignmentStateCounts(
801
+ assignments: readonly (readonly Assignee[])[],
802
+ identity: AssignmentIdentity,
803
+ ): AssignmentStateCounts;
804
+
740
805
  export { AtomInsight };
741
806
 
742
807
  export { atomReadsDataset };
@@ -766,8 +831,7 @@ export declare const AUTHORING_DISPLAY: {
766
831
  };
767
832
 
768
833
  /**
769
- * The stored action fields plus two authoring sugars, or the
770
- * {@link ClaimAction} pair-half. `roles`: on a fireAction-fired action (no
834
+ * The stored action fields plus authoring sugar. `roles`: on a fireAction-fired action (no
771
835
  * `when`) it desugars into a `count($actor.roles[@ in [...]]) > 0` condition
772
836
  * ANDed with `filter`; on a CASCADE-FIRED action it stores VERBATIM instead —
773
837
  * the pin on which identities may execute the trigger, since folding it into
@@ -777,8 +841,9 @@ export declare const AUTHORING_DISPLAY: {
777
841
  * deliberately never implied, so a forgotten `status` is a visible stall
778
842
  * rather than a silently completed action.
779
843
  */
780
- export declare type AuthoringAction = AuthoringRawAction | ClaimAction;
844
+ export declare type AuthoringAction = AuthoringRawAction;
781
845
 
846
+ /** @interface */
782
847
  export declare type AuthoringActivity = ActivityFields<
783
848
  AuthoringFieldEntry,
784
849
  AuthoringAction,
@@ -792,41 +857,30 @@ export declare type AuthoringActivity = ActivityFields<
792
857
  * predicate `action.roles` produces. `true` opens the field to anyone in its
793
858
  * window; a bare string is a raw predicate.
794
859
  */
795
- export declare type AuthoringEditable = v.InferOutput<
796
- typeof AuthoringEditableSchema
797
- >;
798
-
799
- declare const AuthoringEditableSchema: v.UnionSchema<
800
- [
801
- v.LiteralSchema<true, undefined>,
802
- v.ArraySchema<
803
- v.SchemaWithPipe<
804
- readonly [
805
- v.StringSchema<undefined>,
806
- v.MinLengthAction<string, 1, "must be a non-empty string">,
807
- ]
808
- >,
809
- undefined
810
- >,
811
- v.SchemaWithPipe<
812
- readonly [
813
- v.StringSchema<undefined>,
814
- v.MinLengthAction<string, 1, "must be a non-empty string">,
815
- ]
816
- >,
817
- ],
818
- undefined
819
- >;
860
+ export declare type AuthoringEditable = true | string[] | string;
820
861
 
862
+ /**
863
+ * A raw field entry or one of the authoring-only field sugars. `todoList`
864
+ * expands to an array of objects with `label`, `status`, optional `assignee`,
865
+ * and optional `dueDate`; that due date remains an ordinary date field.
866
+ * `notes` expands to an array of audit-shaped objects with `body`, `actor`,
867
+ * and `at` fields. Sugar type names are compiled away and never become stored
868
+ * field kinds.
869
+ */
821
870
  export declare type AuthoringFieldEntry =
822
871
  | AuthoringRawFieldEntry
823
- | ClaimField
824
872
  | TodoListField
825
873
  | NotesField;
826
874
 
827
- /** A field reference with `scope` optional; desugar resolves it lexically
828
- * (activity stage workflow) into {@link StoredFieldRef}. */
829
- declare type AuthoringFieldRef = v.InferOutput<typeof AuthoringFieldRefSchema>;
875
+ /**
876
+ * A field reference with `scope` optional; desugar resolves it lexically
877
+ * (activity stage → workflow) into {@link StoredFieldRef}.
878
+ *
879
+ * @interface
880
+ */
881
+ export declare type AuthoringFieldRef = v.InferOutput<
882
+ typeof AuthoringFieldRefSchema
883
+ >;
830
884
 
831
885
  declare const AuthoringFieldRefSchema: v.StrictObjectSchema<
832
886
  {
@@ -844,8 +898,12 @@ declare const AuthoringFieldRefSchema: v.StrictObjectSchema<
844
898
  undefined
845
899
  >;
846
900
 
847
- /** {@link Guard}'s contract as authored: `match.idRefs` and `metadata` carry
848
- * typed {@link GuardRead} values that deploy resolves to bare ones. */
901
+ /**
902
+ * {@link Guard}'s contract as authored: `match.idRefs` and `metadata` carry
903
+ * typed {@link GuardRead} values that deploy resolves to bare ones.
904
+ *
905
+ * @interface
906
+ */
849
907
  export declare type AuthoringGuard = v.InferOutput<typeof AuthoringGuardSchema>;
850
908
 
851
909
  declare const AuthoringGuardSchema: v.StrictObjectSchema<
@@ -873,105 +931,7 @@ declare const AuthoringGuardSchema: v.StrictObjectSchema<
873
931
  undefined
874
932
  >;
875
933
  idRefs: v.OptionalSchema<
876
- v.ArraySchema<
877
- v.VariantSchema<
878
- "type",
879
- [
880
- v.StrictObjectSchema<
881
- {
882
- readonly type: v.LiteralSchema<"self", undefined>;
883
- },
884
- undefined
885
- >,
886
- v.StrictObjectSchema<
887
- {
888
- readonly type: v.LiteralSchema<"now", undefined>;
889
- },
890
- undefined
891
- >,
892
- v.StrictObjectSchema<
893
- {
894
- readonly type: v.LiteralSchema<"fieldRead", undefined>;
895
- readonly field: v.SchemaWithPipe<
896
- readonly [
897
- v.StringSchema<undefined>,
898
- v.RegexAction<string, string>,
899
- ]
900
- >;
901
- readonly path: v.OptionalSchema<
902
- v.SchemaWithPipe<
903
- readonly [
904
- v.SchemaWithPipe<
905
- readonly [
906
- v.StringSchema<undefined>,
907
- v.MinLengthAction<
908
- string,
909
- 1,
910
- "must be a non-empty string"
911
- >,
912
- ]
913
- >,
914
- v.CheckAction<
915
- string,
916
- "a guard read path cannot contain a line break"
917
- >,
918
- ]
919
- >,
920
- undefined
921
- >;
922
- },
923
- undefined
924
- >,
925
- v.StrictObjectSchema<
926
- {
927
- readonly type: v.LiteralSchema<"effectsRead", undefined>;
928
- readonly effect: v.SchemaWithPipe<
929
- readonly [
930
- v.SchemaWithPipe<
931
- readonly [
932
- v.StringSchema<undefined>,
933
- v.MinLengthAction<
934
- string,
935
- 1,
936
- "must be a non-empty string"
937
- >,
938
- ]
939
- >,
940
- v.CheckAction<
941
- string,
942
- "an effect name cannot contain `'`"
943
- >,
944
- ]
945
- >;
946
- readonly path: v.OptionalSchema<
947
- v.SchemaWithPipe<
948
- readonly [
949
- v.SchemaWithPipe<
950
- readonly [
951
- v.StringSchema<undefined>,
952
- v.MinLengthAction<
953
- string,
954
- 1,
955
- "must be a non-empty string"
956
- >,
957
- ]
958
- >,
959
- v.CheckAction<
960
- string,
961
- "a guard read path cannot contain a line break"
962
- >,
963
- ]
964
- >,
965
- undefined
966
- >;
967
- },
968
- undefined
969
- >,
970
- ],
971
- undefined
972
- >,
973
- undefined
974
- >,
934
+ v.ArraySchema<v.GenericSchema<GuardRead>, undefined>,
975
935
  undefined
976
936
  >;
977
937
  idPatterns: v.OptionalSchema<
@@ -998,492 +958,79 @@ declare const AuthoringGuardSchema: v.StrictObjectSchema<
998
958
  v.MinLengthAction<
999
959
  ("create" | "update" | "delete" | "publish" | "unpublish")[],
1000
960
  1,
1001
- "a guard must match at least one action"
1002
- >,
1003
- ]
1004
- >;
1005
- },
1006
- undefined
1007
- >;
1008
- predicate: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
1009
- metadata: v.OptionalSchema<
1010
- v.RecordSchema<
1011
- v.SchemaWithPipe<
1012
- readonly [
1013
- v.StringSchema<undefined>,
1014
- v.MinLengthAction<string, 1, "must be a non-empty string">,
1015
- ]
1016
- >,
1017
- v.VariantSchema<
1018
- "type",
1019
- [
1020
- v.StrictObjectSchema<
1021
- {
1022
- readonly type: v.LiteralSchema<"self", undefined>;
1023
- },
1024
- undefined
1025
- >,
1026
- v.StrictObjectSchema<
1027
- {
1028
- readonly type: v.LiteralSchema<"now", undefined>;
1029
- },
1030
- undefined
1031
- >,
1032
- v.StrictObjectSchema<
1033
- {
1034
- readonly type: v.LiteralSchema<"fieldRead", undefined>;
1035
- readonly field: v.SchemaWithPipe<
1036
- readonly [
1037
- v.StringSchema<undefined>,
1038
- v.RegexAction<string, string>,
1039
- ]
1040
- >;
1041
- readonly path: v.OptionalSchema<
1042
- v.SchemaWithPipe<
1043
- readonly [
1044
- v.SchemaWithPipe<
1045
- readonly [
1046
- v.StringSchema<undefined>,
1047
- v.MinLengthAction<
1048
- string,
1049
- 1,
1050
- "must be a non-empty string"
1051
- >,
1052
- ]
1053
- >,
1054
- v.CheckAction<
1055
- string,
1056
- "a guard read path cannot contain a line break"
1057
- >,
1058
- ]
1059
- >,
1060
- undefined
1061
- >;
1062
- },
1063
- undefined
1064
- >,
1065
- v.StrictObjectSchema<
1066
- {
1067
- readonly type: v.LiteralSchema<"effectsRead", undefined>;
1068
- readonly effect: v.SchemaWithPipe<
1069
- readonly [
1070
- v.SchemaWithPipe<
1071
- readonly [
1072
- v.StringSchema<undefined>,
1073
- v.MinLengthAction<
1074
- string,
1075
- 1,
1076
- "must be a non-empty string"
1077
- >,
1078
- ]
1079
- >,
1080
- v.CheckAction<string, "an effect name cannot contain `'`">,
1081
- ]
1082
- >;
1083
- readonly path: v.OptionalSchema<
1084
- v.SchemaWithPipe<
1085
- readonly [
1086
- v.SchemaWithPipe<
1087
- readonly [
1088
- v.StringSchema<undefined>,
1089
- v.MinLengthAction<
1090
- string,
1091
- 1,
1092
- "must be a non-empty string"
1093
- >,
1094
- ]
1095
- >,
1096
- v.CheckAction<
1097
- string,
1098
- "a guard read path cannot contain a line break"
1099
- >,
1100
- ]
1101
- >,
1102
- undefined
1103
- >;
1104
- },
1105
- undefined
1106
- >,
1107
- ],
1108
- undefined
1109
- >,
1110
- undefined
1111
- >,
1112
- undefined
1113
- >;
1114
- },
1115
- undefined
1116
- >;
1117
-
1118
- /** Like {@link ManualTarget}, but the `field` variant also accepts a bare
1119
- * field name; desugar normalises it into {@link AuthoringFieldRef}. */
1120
- export declare type AuthoringManualTarget = v.InferOutput<
1121
- typeof AuthoringManualTargetSchema
1122
- >;
1123
-
1124
- declare const AuthoringManualTargetSchema: v.VariantSchema<
1125
- "type",
1126
- [
1127
- v.StrictObjectSchema<
1128
- {
1129
- readonly type: v.LiteralSchema<"url", undefined>;
1130
- readonly url: v.SchemaWithPipe<
1131
- readonly [
1132
- v.StringSchema<undefined>,
1133
- v.UrlAction<string, "must be a valid URL">,
1134
- v.CheckAction<string, "must be an http(s) URL">,
1135
- ]
1136
- >;
1137
- },
1138
- undefined
1139
- >,
1140
- v.StrictObjectSchema<
1141
- {
1142
- readonly type: v.LiteralSchema<"field", undefined>;
1143
- readonly field: v.UnionSchema<
1144
- [
1145
- v.SchemaWithPipe<
1146
- readonly [
1147
- v.StringSchema<undefined>,
1148
- v.MinLengthAction<string, 1, "must be a non-empty string">,
1149
- ]
1150
- >,
1151
- v.StrictObjectSchema<
1152
- {
1153
- readonly scope: v.OptionalSchema<
1154
- v.PicklistSchema<
1155
- readonly ["workflow", "stage", "activity"],
1156
- string
1157
- >,
1158
- undefined
1159
- >;
1160
- readonly field: v.SchemaWithPipe<
1161
- readonly [
1162
- v.StringSchema<undefined>,
1163
- v.MinLengthAction<string, 1, "must be a non-empty string">,
1164
- ]
1165
- >;
1166
- },
1167
- undefined
1168
- >,
1169
- ],
1170
- undefined
1171
- >;
1172
- },
1173
- undefined
1174
- >,
1175
- ],
1176
- undefined
1177
- >;
1178
-
1179
- /** Like {@link Op}, plus: `status.set`'s `activity` is optional (desugar fills
1180
- * the firing activity), and the `audit` sugar — a stamped append merging
1181
- * `actor`/`at` {@link ValueExpr} fields into its own value. */
1182
- export declare type AuthoringOp = v.InferOutput<typeof AuthoringOpSchema>;
1183
-
1184
- declare const AuthoringOpSchema: v.VariantSchema<
1185
- "type",
1186
- [
1187
- v.StrictObjectSchema<
1188
- {
1189
- readonly type: v.LiteralSchema<"field.set", undefined>;
1190
- readonly target: v.StrictObjectSchema<
1191
- {
1192
- readonly scope: v.OptionalSchema<
1193
- v.PicklistSchema<
1194
- readonly ["workflow", "stage", "activity"],
1195
- string
1196
- >,
1197
- undefined
1198
- >;
1199
- readonly field: v.SchemaWithPipe<
1200
- readonly [
1201
- v.StringSchema<undefined>,
1202
- v.MinLengthAction<string, 1, "must be a non-empty string">,
1203
- ]
1204
- >;
1205
- },
1206
- undefined
1207
- >;
1208
- readonly value: v.GenericSchema<ValueExprInternal>;
1209
- },
1210
- undefined
1211
- >,
1212
- v.StrictObjectSchema<
1213
- {
1214
- readonly type: v.LiteralSchema<"field.setIfMissing", undefined>;
1215
- readonly target: v.StrictObjectSchema<
1216
- {
1217
- readonly scope: v.OptionalSchema<
1218
- v.PicklistSchema<
1219
- readonly ["workflow", "stage", "activity"],
1220
- string
1221
- >,
1222
- undefined
1223
- >;
1224
- readonly field: v.SchemaWithPipe<
1225
- readonly [
1226
- v.StringSchema<undefined>,
1227
- v.MinLengthAction<string, 1, "must be a non-empty string">,
1228
- ]
1229
- >;
1230
- },
1231
- undefined
1232
- >;
1233
- readonly value: v.GenericSchema<ValueExprInternal>;
1234
- },
1235
- undefined
1236
- >,
1237
- v.StrictObjectSchema<
1238
- {
1239
- readonly type: v.LiteralSchema<"field.unset", undefined>;
1240
- readonly target: v.StrictObjectSchema<
1241
- {
1242
- readonly scope: v.OptionalSchema<
1243
- v.PicklistSchema<
1244
- readonly ["workflow", "stage", "activity"],
1245
- string
1246
- >,
1247
- undefined
1248
- >;
1249
- readonly field: v.SchemaWithPipe<
1250
- readonly [
1251
- v.StringSchema<undefined>,
1252
- v.MinLengthAction<string, 1, "must be a non-empty string">,
1253
- ]
1254
- >;
1255
- },
1256
- undefined
1257
- >;
1258
- },
1259
- undefined
1260
- >,
1261
- v.StrictObjectSchema<
1262
- {
1263
- readonly type: v.LiteralSchema<"field.append", undefined>;
1264
- readonly target: v.StrictObjectSchema<
1265
- {
1266
- readonly scope: v.OptionalSchema<
1267
- v.PicklistSchema<
1268
- readonly ["workflow", "stage", "activity"],
1269
- string
1270
- >,
1271
- undefined
1272
- >;
1273
- readonly field: v.SchemaWithPipe<
1274
- readonly [
1275
- v.StringSchema<undefined>,
1276
- v.MinLengthAction<string, 1, "must be a non-empty string">,
1277
- ]
1278
- >;
1279
- },
1280
- undefined
1281
- >;
1282
- readonly value: v.GenericSchema<ValueExprInternal>;
1283
- },
1284
- undefined
1285
- >,
1286
- v.StrictObjectSchema<
1287
- {
1288
- readonly type: v.LiteralSchema<"field.inc", undefined>;
1289
- readonly target: v.StrictObjectSchema<
1290
- {
1291
- readonly scope: v.OptionalSchema<
1292
- v.PicklistSchema<
1293
- readonly ["workflow", "stage", "activity"],
1294
- string
1295
- >,
1296
- undefined
1297
- >;
1298
- readonly field: v.SchemaWithPipe<
1299
- readonly [
1300
- v.StringSchema<undefined>,
1301
- v.MinLengthAction<string, 1, "must be a non-empty string">,
1302
- ]
1303
- >;
1304
- },
1305
- undefined
1306
- >;
1307
- readonly value: v.OptionalSchema<
1308
- v.GenericSchema<ValueExprInternal>,
1309
- undefined
1310
- >;
1311
- },
1312
- undefined
1313
- >,
1314
- v.StrictObjectSchema<
1315
- {
1316
- readonly type: v.LiteralSchema<"field.dec", undefined>;
1317
- readonly target: v.StrictObjectSchema<
1318
- {
1319
- readonly scope: v.OptionalSchema<
1320
- v.PicklistSchema<
1321
- readonly ["workflow", "stage", "activity"],
1322
- string
1323
- >,
1324
- undefined
1325
- >;
1326
- readonly field: v.SchemaWithPipe<
1327
- readonly [
1328
- v.StringSchema<undefined>,
1329
- v.MinLengthAction<string, 1, "must be a non-empty string">,
1330
- ]
1331
- >;
1332
- },
1333
- undefined
1334
- >;
1335
- readonly value: v.OptionalSchema<
1336
- v.GenericSchema<ValueExprInternal>,
1337
- undefined
1338
- >;
1339
- },
1340
- undefined
1341
- >,
1342
- v.StrictObjectSchema<
1343
- {
1344
- readonly type: v.LiteralSchema<"field.updateWhere", undefined>;
1345
- readonly target: v.StrictObjectSchema<
1346
- {
1347
- readonly scope: v.OptionalSchema<
1348
- v.PicklistSchema<
1349
- readonly ["workflow", "stage", "activity"],
1350
- string
1351
- >,
1352
- undefined
1353
- >;
1354
- readonly field: v.SchemaWithPipe<
1355
- readonly [
1356
- v.StringSchema<undefined>,
1357
- v.MinLengthAction<string, 1, "must be a non-empty string">,
1358
- ]
1359
- >;
1360
- },
1361
- undefined
1362
- >;
1363
- readonly where: v.SchemaWithPipe<
1364
- readonly [
1365
- v.StringSchema<undefined>,
1366
- v.MinLengthAction<string, 1, "must be a non-empty string">,
1367
- ]
1368
- >;
1369
- readonly value: v.GenericSchema<ValueExprInternal>;
1370
- },
1371
- undefined
1372
- >,
1373
- v.StrictObjectSchema<
1374
- {
1375
- readonly type: v.LiteralSchema<"field.removeWhere", undefined>;
1376
- readonly target: v.StrictObjectSchema<
1377
- {
1378
- readonly scope: v.OptionalSchema<
1379
- v.PicklistSchema<
1380
- readonly ["workflow", "stage", "activity"],
1381
- string
1382
- >,
1383
- undefined
1384
- >;
1385
- readonly field: v.SchemaWithPipe<
1386
- readonly [
1387
- v.StringSchema<undefined>,
1388
- v.MinLengthAction<string, 1, "must be a non-empty string">,
1389
- ]
1390
- >;
1391
- },
1392
- undefined
1393
- >;
1394
- readonly where: v.SchemaWithPipe<
1395
- readonly [
1396
- v.StringSchema<undefined>,
1397
- v.MinLengthAction<string, 1, "must be a non-empty string">,
1398
- ]
1399
- >;
1400
- },
1401
- undefined
1402
- >,
1403
- v.StrictObjectSchema<
1404
- {
1405
- readonly type: v.LiteralSchema<"status.set", undefined>;
1406
- readonly activity: v.OptionalSchema<
1407
- v.SchemaWithPipe<
1408
- readonly [
1409
- v.StringSchema<undefined>,
1410
- v.MinLengthAction<string, 1, "must be a non-empty string">,
1411
- ]
1412
- >,
1413
- undefined
1414
- >;
1415
- readonly status: v.PicklistSchema<
1416
- readonly ["active", "done", "skipped", "failed"],
1417
- string
1418
- >;
1419
- },
1420
- undefined
1421
- >,
1422
- v.StrictObjectSchema<
1423
- {
1424
- readonly type: v.LiteralSchema<"audit", undefined>;
1425
- readonly target: v.StrictObjectSchema<
1426
- {
1427
- readonly scope: v.OptionalSchema<
1428
- v.PicklistSchema<
1429
- readonly ["workflow", "stage", "activity"],
1430
- string
1431
- >,
1432
- undefined
1433
- >;
1434
- readonly field: v.SchemaWithPipe<
1435
- readonly [
1436
- v.StringSchema<undefined>,
1437
- v.MinLengthAction<string, 1, "must be a non-empty string">,
1438
- ]
1439
- >;
1440
- },
1441
- undefined
1442
- >;
1443
- readonly value: v.GenericSchema<ValueExprInternal>;
1444
- readonly stampFields: v.OptionalSchema<
1445
- v.StrictObjectSchema<
1446
- {
1447
- readonly actor: v.OptionalSchema<
1448
- v.SchemaWithPipe<
1449
- readonly [
1450
- v.StringSchema<undefined>,
1451
- v.MinLengthAction<string, 1, "must be a non-empty string">,
1452
- ]
1453
- >,
1454
- undefined
1455
- >;
1456
- readonly at: v.OptionalSchema<
1457
- v.SchemaWithPipe<
1458
- readonly [
1459
- v.StringSchema<undefined>,
1460
- v.MinLengthAction<string, 1, "must be a non-empty string">,
1461
- ]
1462
- >,
1463
- undefined
1464
- >;
1465
- },
1466
- undefined
1467
- >,
1468
- undefined
961
+ "a guard must match at least one action"
962
+ >,
963
+ ]
1469
964
  >;
1470
965
  },
1471
966
  undefined
1472
- >,
1473
- ],
967
+ >;
968
+ predicate: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
969
+ metadata: v.OptionalSchema<
970
+ v.RecordSchema<
971
+ v.SchemaWithPipe<
972
+ readonly [
973
+ v.StringSchema<undefined>,
974
+ v.MinLengthAction<string, 1, "must be a non-empty string">,
975
+ ]
976
+ >,
977
+ v.GenericSchema<GuardRead>,
978
+ undefined
979
+ >,
980
+ undefined
981
+ >;
982
+ },
1474
983
  undefined
1475
984
  >;
1476
985
 
986
+ /** Like {@link ManualTarget}, but the `field` variant also accepts a bare
987
+ * field name; desugar normalises it into {@link AuthoringFieldRef}. */
988
+ export declare type AuthoringManualTarget =
989
+ | {
990
+ type: "url";
991
+ url: string;
992
+ }
993
+ | {
994
+ type: "field";
995
+ field: string | AuthoringFieldRef;
996
+ };
997
+
998
+ /** Like {@link Op}, plus: `status.set`'s `activity` is optional (desugar fills
999
+ * the firing activity), and the `audit` sugar — a stamped append merging
1000
+ * `actor`/`at` {@link ValueExpr} fields into its own value.
1001
+ */
1002
+ export declare type AuthoringOp =
1003
+ | FieldMutationOp<AuthoringFieldRef>
1004
+ | {
1005
+ type: "status.set";
1006
+ activity?: string | undefined;
1007
+ status: ActivityStatus;
1008
+ }
1009
+ | {
1010
+ type: "audit";
1011
+ target: AuthoringFieldRef;
1012
+ value: ValueExpr;
1013
+ stampFields?:
1014
+ | {
1015
+ actor?: string | undefined;
1016
+ at?: string | undefined;
1017
+ }
1018
+ | undefined;
1019
+ };
1020
+
1021
+ /** @inline */
1477
1022
  declare type AuthoringRawAction = ActionFields<AuthoringOp, GroupMembership> & {
1478
1023
  roles?: string[] | undefined;
1479
1024
  status?: TerminalActivityStatus | undefined;
1480
1025
  };
1481
1026
 
1027
+ /** @inline */
1482
1028
  declare type AuthoringRawFieldEntry = FieldEntryFields<
1483
1029
  AuthoringEditable,
1484
1030
  GroupMembership
1485
1031
  >;
1486
1032
 
1033
+ /** @interface */
1487
1034
  export declare type AuthoringStage = StageFields<
1488
1035
  AuthoringFieldEntry,
1489
1036
  AuthoringActivity,
@@ -1505,7 +1052,11 @@ export declare type AuthoringTransition = TransitionFields & {
1505
1052
  when?: string | undefined;
1506
1053
  };
1507
1054
 
1508
- /** The authoring surface: stored primitives plus the define-time sugar. */
1055
+ /**
1056
+ * The authoring surface: stored primitives plus the define-time sugar.
1057
+ *
1058
+ * @interface
1059
+ */
1509
1060
  export declare type AuthoringWorkflow = WorkflowFields<
1510
1061
  AuthoringFieldEntry,
1511
1062
  AuthoringStage,
@@ -1679,31 +1230,6 @@ export declare interface ChoiceOptions {
1679
1230
 
1680
1231
  export declare type ChoiceValue = string | number;
1681
1232
 
1682
- /** The action half of the mirrored claim pair: `field` names the actor-valued entry this action claims, resolved lexically, and the expansion
1683
- * adds a no-steal `!defined($fields.<field>)` filter ANDed with `roles`/`filter` plus a `field.set` ← actor op. `ops`/`status` are reserved (strictObject rejects them). */
1684
- declare type ClaimAction = {
1685
- type: "claim";
1686
- name: string;
1687
- title?: string | undefined;
1688
- description?: string | undefined;
1689
- group?: GroupMembership | undefined;
1690
- field: string | AuthoringFieldRef;
1691
- roles?: string[] | undefined;
1692
- filter?: string | undefined;
1693
- params?: ActionParam[] | undefined;
1694
- effects?: Effect[] | undefined;
1695
- };
1696
-
1697
- /** The field half of the mirrored claim pair, expanding strictly within this entry: an `actor`
1698
- * working-memory field with no `initialValue` — the paired {@link ClaimAction}'s op fills it. */
1699
- declare type ClaimField = {
1700
- type: "claim";
1701
- name: string;
1702
- title?: string | undefined;
1703
- description?: string | undefined;
1704
- group?: GroupMembership | undefined;
1705
- };
1706
-
1707
1233
  export declare interface ClassifiedPrincipal {
1708
1234
  namespace: PrincipalNamespace;
1709
1235
  /**
@@ -1744,9 +1270,14 @@ export declare function clientConfigFromResource(res: WorkflowResource):
1744
1270
  resource: WorkflowResource;
1745
1271
  };
1746
1272
 
1747
- /** The router {@link buildClientForGdr} builds total: every parsed GDR
1273
+ /** The total GDR router — every parsed GDR
1748
1274
  * resolves to a client, or the router throws. */
1749
- declare type ClientForGdr = (parsed: ParsedGdr) => WorkflowClient;
1275
+ export declare type ClientForGdr = (parsed: ParsedGdr) => WorkflowClient;
1276
+
1277
+ /** Stored-resource dereferencing for write pre-flights and host previews. */
1278
+ export declare function clientGuardDereference(
1279
+ client: Pick<WorkflowClient, "getDocument">,
1280
+ ): GuardDereference;
1750
1281
 
1751
1282
  /** Native project-user response returned by Sanity's project API. */
1752
1283
  export declare interface ClientProjectUser {
@@ -1792,7 +1323,7 @@ export declare function clientProjectUserDirectory(
1792
1323
  * `createEngine({ clock })`, and tests use `@sanity/workflow-engine-test`'s
1793
1324
  * `setNow` / `advance` (the bench wraps the same seam). It is deliberately
1794
1325
  * NOT a field on the public per-verb `*Args` — the raw `workflow.*` verbs
1795
- * accept it only through the internal {@link Clocked} seam, so prod code
1326
+ * accept it only through the {@link Clocked} composition seam, so prod code
1796
1327
  * can't trivially override engine time by accident.
1797
1328
  *
1798
1329
  * `drainEffects` and `sweepStaleClaims` read the same engine clock for
@@ -1802,19 +1333,18 @@ export declare function clientProjectUserDirectory(
1802
1333
  export declare type Clock = () => string;
1803
1334
 
1804
1335
  /**
1805
- * Internal clock-injection seam for the raw `workflow.*` verbs. NOT part
1806
- * of the public per-verb args (it is deliberately not re-exported from the
1807
- * package root) production injects a clock ONCE via
1808
- * `createEngine({ clock })`, and the test bench via its `setNow` /
1809
- * `advance`. This intersection just lets those two callers thread the
1810
- * clock into a raw verb without `clock` cluttering every documented
1811
- * `*Args` interface as if it were an everyday option.
1336
+ * Optional clock-injection field on the raw `workflow.*` verbs. It is
1337
+ * exported because those verbs expose this composition helper in their
1338
+ * public signatures, but production normally injects a clock once via
1339
+ * `createEngine({ clock })`, and the test bench controls it through
1340
+ * `setNow` / `advance`. The documented `*Args` interfaces omit `clock`
1341
+ * because it is infrastructure context, not an everyday per-call option.
1812
1342
  */
1813
- declare type Clocked<T> = T & {
1343
+ export declare type Clocked<T> = T & {
1814
1344
  clock?: Clock;
1815
1345
  };
1816
1346
 
1817
- declare interface CommitEffectOpsArgs extends DedupableOperationArgs {
1347
+ export declare interface CommitEffectOpsArgs extends DedupableOperationArgs {
1818
1348
  /** The `_key` of the pending effect being reported on. */
1819
1349
  effectKey: string;
1820
1350
  /**
@@ -1841,7 +1371,7 @@ declare interface CommitEffectOpsArgs extends DedupableOperationArgs {
1841
1371
  */
1842
1372
  ops: FieldOp[];
1843
1373
  /** Lease duration the successful commit renews the claim to — the
1844
- * drain's `effectLeaseMs`. Default `DEFAULT_EFFECT_LEASE_MS` (5 min). */
1374
+ * drain's `effects.leaseMs`. Default `DEFAULT_EFFECT_LEASE_MS` (5 min). */
1845
1375
  leaseMs?: number;
1846
1376
  }
1847
1377
 
@@ -1862,10 +1392,19 @@ export declare interface CompiledQuery {
1862
1392
  params: Record<string, string | string[]>;
1863
1393
  }
1864
1394
 
1865
- /** Deliberately carries NO engine data-model stamp: the guard doc format is the lake's forthcoming contract, not ours to grow fields on (see DATAMODEL.md). */
1866
- export declare function compileGuard(args: CompileGuardArgs): MutationGuardDoc;
1395
+ /**
1396
+ * Translate one authored guard into the temporary documents that preview its
1397
+ * eventual Content Lake enforcement.
1398
+ * Content edits target draft ids, instance updates keep the instance id, and
1399
+ * publish or unpublish targets published ids using the Lake operations those
1400
+ * lifecycle writes perform. A mixed guard emits one document per id space so
1401
+ * its action and id facets never form an unintended cross-product.
1402
+ */
1403
+ export declare function compileGuards(
1404
+ args: CompileGuardsArgs,
1405
+ ): [MutationGuardDoc, ...MutationGuardDoc[]];
1867
1406
 
1868
- declare interface CompileGuardArgs extends MutationGuardBody {
1407
+ export declare interface CompileGuardsArgs extends MutationGuardBody {
1869
1408
  id: string;
1870
1409
  }
1871
1410
 
@@ -1924,6 +1463,17 @@ export declare function computeDiffEntries<
1924
1463
  target: DeployTarget;
1925
1464
  }): Promise<DiffEntry[]>;
1926
1465
 
1466
+ /**
1467
+ * Thrown when one automatic cascade hop loses every optimistic-locking
1468
+ * attempt. An earlier verb commit may already have landed; invoke `tick`
1469
+ * after re-reading the instance to resume convergence when contention subsides.
1470
+ */
1471
+ export declare class ConcurrentCascadeError extends WorkflowError<"concurrent-cascade"> {
1472
+ readonly instanceId: string;
1473
+ readonly attempts: number;
1474
+ constructor(args: { instanceId: string; attempts: number });
1475
+ }
1476
+
1927
1477
  /** {@link ConcurrentCompleteEffectError}'s mid-dispatch sibling: a
1928
1478
  * `commitEffectOps` commit lost every optimistic-locking attempt. Nothing
1929
1479
  * was written; the report may be retried under the same idempotency key. */
@@ -1984,7 +1534,7 @@ export declare class ConcurrentEditFieldError extends WorkflowError<"concurrent-
1984
1534
 
1985
1535
  /**
1986
1536
  * Thrown when a `fireAction` commit loses the optimistic-locking race on
1987
- * all {@link CONCURRENT_COMMIT_MAX_ATTEMPTS} attempts every reload +
1537
+ * every commit attempteach reload +
1988
1538
  * `ifRevisionId` retry was beaten by another writer committing first.
1989
1539
  * Surfacing it (rather than silently overwriting) lets the caller decide
1990
1540
  * whether to retry later or report a write storm; nothing was committed
@@ -2011,7 +1561,7 @@ export declare class ConcurrentFireActionError extends WorkflowError<"concurrent
2011
1561
  * never a `_type` scan over the lake (rejected at deploy).
2012
1562
  *
2013
1563
  * There is no `{ref, args}` wrapper: parameterized reuse is a define-time
2014
- * TypeScript function producing a condition string (see the {@link groq} tag).
1564
+ * TypeScript function producing a condition string (see the {@link define.groq | groq} tag).
2015
1565
  */
2016
1566
  export declare type Condition = string;
2017
1567
 
@@ -2063,7 +1613,7 @@ export { ConditionRead };
2063
1613
  * then per stage — transitions, activities (filter, requirements, action
2064
1614
  * filters and `when` triggers), editable gates, tighten-overrides.
2065
1615
  * Editable gates resolve through the same helper the runtime projection uses
2066
- * ({@link editableFieldsInStage}: entry `editable` ANDed with the stage
1616
+ * (entry `editable` ANDed with the stage
2067
1617
  * tighten-override), so every live editable-field address exists here with
2068
1618
  * the same EFFECTIVE predicate the edit insight explains — including
2069
1619
  * override-only gates on `editable: true` entries, and workflow-scope fields
@@ -2098,7 +1648,7 @@ export declare type ConditionVarBinding = "always" | "caller" | "spawn";
2098
1648
  /**
2099
1649
  * The one-doc read a reactive adapter subscribes with to observe a content doc
2100
1650
  * under a perspective stack. It uses the same perspective semantics as
2101
- * {@link hydrateSnapshot}: draft/version content is projected onto the published
1651
+ * `hydrateSnapshot`: draft/version content is projected onto the published
2102
1652
  * id, and a doc that exists only as a draft or release version remains visible.
2103
1653
  */
2104
1654
  export declare function contentDocQuery(documentId: string): CompiledQuery;
@@ -2139,7 +1689,7 @@ export declare function contentDraftFallback(args: {
2139
1689
  * Note: this resolves a **single** release — the documented `instance.perspective`
2140
1690
  * shapes (`[release]` / `[release, "drafts"]`). The stores' per-doc reads take
2141
1691
  * one release, so a multi-release stack can't be observed through them; the
2142
- * engine's own fetch path ({@link hydrateSnapshot}) — and the SDK adapter's
1692
+ * engine's own fetch path (`hydrateSnapshot`) — and the SDK adapter's
2143
1693
  * query-store route for stacks without a `'drafts'` entry — honour the full
2144
1694
  * stack via `client.fetch({perspective})`.
2145
1695
  */
@@ -2250,15 +1800,12 @@ export declare class ContractViolationError extends WorkflowError<"contract-viol
2250
1800
  * {@link Engine.subscriptionDocumentsForInstance} (need the pinned
2251
1801
  * binding), {@link Engine.drainEffects} and
2252
1802
  * {@link Engine.verifyDeployedDefinitions} (need the construction-time
2253
- * `effectHandlers` / `missingHandler` / `loggerFactory`).
1803
+ * `effects` / `loggerFactory`).
2254
1804
  * - Namespace-only: `workflow.permissions` — pure grant helpers that need
2255
1805
  * no engine scope.
2256
1806
  *
2257
- * Effect handlers + missingHandler feed {@link Engine.drainEffects}
2258
- * (dispatch of unclaimed pending effects) and
2259
- * {@link Engine.verifyDeployedDefinitions} (the startup audit of
2260
- * deployed effect names). They don't change `fireAction` / `tick` /
2261
- * `completeEffect` — the runtime still decides when to drain and
1807
+ * The {@link EngineEffectsArgs} group changes nothing about `fireAction` /
1808
+ * `tick` / `completeEffect` the runtime still decides when to drain, and
2262
1809
  * reports outcomes via `completeEffect`.
2263
1810
  */
2264
1811
  export declare function createEngine<Client extends WorkflowClient>(
@@ -2267,8 +1814,8 @@ export declare function createEngine<Client extends WorkflowClient>(
2267
1814
 
2268
1815
  /**
2269
1816
  * The {@link EngineScopeArgs} scope pinned at construction, plus the
2270
- * engine-only extras (`effectHandlers` / `missingHandler` / `loggerFactory`
2271
- * feed `drainEffects` + `verifyDeployedDefinitions`). The `tag` partition is
1817
+ * engine-only extras (`effects` and `loggerFactory` feed `drainEffects` +
1818
+ * `verifyDeployedDefinitions`). The `tag` partition is
2272
1819
  * required and never defaulted — the engine enforces nothing, so the
2273
1820
  * partition is the only thing keeping reads and writes off the wrong
2274
1821
  * environment.
@@ -2277,18 +1824,8 @@ export declare interface CreateEngineArgs<
2277
1824
  Client extends WorkflowClient = WorkflowClient,
2278
1825
  > extends EngineScopeArgs {
2279
1826
  client: Client;
2280
- effectHandlers?: Record<string, EffectHandler<Client>>;
2281
- missingHandler?: MissingHandlerPolicy;
1827
+ effects?: EngineEffectsArgs<Client>;
2282
1828
  loggerFactory?: LoggerFactory;
2283
- /**
2284
- * Lease duration `drainEffects` stamps on each pending-effect claim.
2285
- * Past the lease the claimer is presumed dead: the entry becomes
2286
- * recoverable by another drain's takeover or by
2287
- * the standalone `sweepStaleClaims` export. Default 5 minutes — size it well above
2288
- * the slowest handler's honest runtime, since a live-but-slow dispatch
2289
- * that outlives its lease can be redispatched (see {@link EffectHandler}).
2290
- */
2291
- effectLeaseMs?: number;
2292
1829
  /**
2293
1830
  * Deterministic-time seam, pinned once for this engine and threaded
2294
1831
  * into every verb it drives — `$now`, the `now` op-source, and the
@@ -2459,10 +1996,28 @@ export declare const DATA_MODEL_CHANGES: readonly [
2459
1996
  applicability: "detectable";
2460
1997
  summary: "Assignee fields may restrict newly assigned users and collective roles by role.";
2461
1998
  }>,
1999
+ Readonly<{
2000
+ id: "split-guard-id-spaces";
2001
+ introducedInModel: 9;
2002
+ minReaderModel: 9;
2003
+ documentTypes: readonly ["definition", "instance"];
2004
+ compatibility: "reader-floor";
2005
+ applicability: "detectable";
2006
+ summary: "Guards spanning edit and lifecycle id spaces emit independently retractable documents.";
2007
+ }>,
2008
+ Readonly<{
2009
+ id: "singular-assignee-lists";
2010
+ introducedInModel: 9;
2011
+ minReaderModel: 9;
2012
+ documentTypes: readonly ["definition", "instance"];
2013
+ compatibility: "reader-floor";
2014
+ applicability: "detectable";
2015
+ summary: "Singular assignee fields use member lists with at most one user and any number of roles.";
2016
+ }>,
2462
2017
  ];
2463
2018
 
2464
2019
  /** The maximum reader floor this writer can emit for a detectable feature. */
2465
- export declare const DATA_MODEL_MAX_READER = 8;
2020
+ export declare const DATA_MODEL_MAX_READER = 9;
2466
2021
 
2467
2022
  /**
2468
2023
  * The unconditional model-4 reader floor for every engine-owned document.
@@ -2484,7 +2039,7 @@ export declare const DATA_MODEL_MIN_READER = 4;
2484
2039
  * `minReaderModel` floor. Declare every bump in `DATAMODEL.md`; the model-surface snapshot test
2485
2040
  * fails on undeclared drift.
2486
2041
  */
2487
- export declare const DATA_MODEL_VERSION = 8;
2042
+ export declare const DATA_MODEL_VERSION = 9;
2488
2043
 
2489
2044
  export declare interface DataModelChange {
2490
2045
  readonly id: string;
@@ -2561,7 +2116,7 @@ export declare interface DedupableOperationArgs extends OperationArgs {
2561
2116
  export declare const DEFAULT_CONTENT_PERSPECTIVE = "drafts";
2562
2117
 
2563
2118
  /** How long a fresh claim's lease runs unless the engine configured
2564
- * `effectLeaseMs`. */
2119
+ * `effects.leaseMs`. */
2565
2120
  export declare const DEFAULT_EFFECT_LEASE_MS: number;
2566
2121
 
2567
2122
  /** How long a recorded idempotency key dedupes retries, unless the caller
@@ -2609,7 +2164,7 @@ export declare interface DefinitionGroupSite {
2609
2164
  members: GroupMember[];
2610
2165
  }
2611
2166
 
2612
- declare interface DefinitionGuardsQueryArgs {
2167
+ export declare interface DefinitionGuardsQueryArgs {
2613
2168
  client: WorkflowClient;
2614
2169
  clientForGdr: ClientForGdr;
2615
2170
  workflowResource: WorkflowResource;
@@ -2661,6 +2216,11 @@ export declare class DefinitionNotFoundError extends WorkflowError<"definition-n
2661
2216
  constructor(args: { definition: string; version?: number });
2662
2217
  }
2663
2218
 
2219
+ /** Every literal project role a stored definition references, deduplicated in encounter order. */
2220
+ export declare function definitionRoleNames(
2221
+ definition: WorkflowDefinition,
2222
+ ): readonly string[];
2223
+
2664
2224
  export declare interface DefinitionsForDocumentArgs {
2665
2225
  /**
2666
2226
  * The LOADED candidate document — unlike {@link InstancesForDocumentArgs},
@@ -2785,6 +2345,7 @@ export declare function denyingGuards(args: {
2785
2345
  type?: string;
2786
2346
  };
2787
2347
  context: MutationContext;
2348
+ dereference?: GuardDereference;
2788
2349
  }): Promise<MutationGuardDoc[]>;
2789
2350
 
2790
2351
  export declare interface DeployDefinitionResult {
@@ -2842,14 +2403,13 @@ export declare interface DeployDefinitionsResult {
2842
2403
  /** A definition as fetched back from the lake. The document carries `_id` plus
2843
2404
  * the deploy-stamped envelope the authored {@link WorkflowDefinition} never
2844
2405
  * had: the assigned `version` and the content fingerprint it was minted from
2845
- * ({@link hashDefinitionContent}). A pre-fingerprint document may lack
2846
- * `contentHash` at runtime — see {@link LatestDeployed}. */
2406
+ * ({@link hashDefinitionContent}). */
2847
2407
  export declare type DeployedDefinition = WorkflowDefinition & {
2848
2408
  _id: string;
2849
2409
  tag?: string;
2850
2410
  version: number;
2851
- /** Optional: a document deployed before content-addressing has none — see
2852
- * {@link LatestDeployed}. Every version this engine deploys carries one. */
2411
+ /** Optional: a document deployed before content-addressing has none. Every
2412
+ * version this engine deploys carries one. */
2853
2413
  contentHash?: string;
2854
2414
  /** Engine data-model stamp (see {@link DATA_MODEL_VERSION}) — absent on
2855
2415
  * documents deployed before the stamp existed (model 0). */
@@ -3089,16 +2649,17 @@ export declare interface DiagnoseResult {
3089
2649
  }
3090
2650
 
3091
2651
  /**
3092
- * How an in-flight instance reads right now. `waiting` and `blocked` are both
3093
- * HEALTHY, not stuck: `waiting` means an active activity has an available
3094
- * action and advances when someone acts how long a workflow is "allowed" to
3095
- * wait is workflow- and team-specific, not this classifier's call — while
3096
- * `blocked` means an active activity's declared requirements aren't all met
2652
+ * How an instance reads right now. `waiting` and `blocked` are both healthy,
2653
+ * not stuck. A `waiting` result says whether the activity awaits an
2654
+ * action available to this caller (`caller`), a manual action that this caller
2655
+ * cannot currently take (`manual-action`), or a cascade-fired action
2656
+ * (`automation`). How long a workflow is "allowed" to wait is workflow- and
2657
+ * team-specific, not this classifier's call. `blocked` means an active
2658
+ * activity's declared requirements aren't all met
3097
2659
  * yet, and flips to `waiting` once they hold (typically a sibling activity
3098
- * completing, or content landing). `completed` and `aborted` carry
3099
- * `liveChildren` when spawned work is still running: a parent finishing while
3100
- * detached children run is legal — detach means detach — but a consumer
3101
- * should surface it loudly.
2660
+ * completing, or content landing). Completed and aborted results include
2661
+ * `liveChildren` while detached spawned work remains active; consumers should
2662
+ * surface it prominently.
3102
2663
  */
3103
2664
  export declare type Diagnosis =
3104
2665
  | {
@@ -3109,6 +2670,7 @@ export declare type Diagnosis =
3109
2670
  activity: string;
3110
2671
  assignees: Assignee[];
3111
2672
  actions: string[];
2673
+ waitingFor: "automation" | "caller" | "manual-action";
3112
2674
  }
3113
2675
  | {
3114
2676
  state: "blocked";
@@ -3148,7 +2710,7 @@ export declare interface DiffEntry {
3148
2710
 
3149
2711
  /**
3150
2712
  * Classifies `def` against the latest deployed version of its name via
3151
- * {@link planDefinitionDeploy} — a content change is always a new version,
2713
+ * the deploy planner — a content change is always a new version,
3152
2714
  * never an in-place update. `def` passes the same boundary parse deploy uses
3153
2715
  * ({@link parseDefinitionInput}), so diff and deploy accept and reject the
3154
2716
  * same input shape.
@@ -3279,26 +2841,25 @@ export declare interface DisplayMetadata {
3279
2841
  export declare function displayTitle(typeKey: string | undefined): string;
3280
2842
 
3281
2843
  /** Document-value permissions. Grants ({@link Grant} in ./authorization.ts) compose most-permissive-wins. */
3282
- declare const DOCUMENT_VALUE_PERMISSIONS: readonly ["create", "read", "update"];
2844
+ export declare const DOCUMENT_VALUE_PERMISSIONS: readonly [
2845
+ "create",
2846
+ "manage",
2847
+ "read",
2848
+ "update",
2849
+ ];
3283
2850
 
3284
2851
  /**
3285
- * The guards that would deny a PROSPECTIVE lake action on a document — the
3286
- * disable-this-button pre-flight, evaluated before any concrete mutation
3287
- * exists. Advisory, like every guard verdict: the check explains and
3288
- * disables, it never enforces.
2852
+ * The guards that deny a concrete Lake mutation image. Advisory, like every
2853
+ * engine-side guard verdict: the check explains and disables, it never
2854
+ * enforces.
3289
2855
  */
3290
2856
  export declare function documentActionDenials(
3291
2857
  args: DocumentActionDenialsArgs,
3292
2858
  ): Promise<MutationGuardDoc[]>;
3293
2859
 
3294
2860
  export declare interface DocumentActionDenialsArgs {
3295
- /** The document's current value both `before` and `after` of the
3296
- * pre-flighted action (a prospective check has no concrete mutation, so
3297
- * delta predicates see "no change"). */
3298
- doc: {
3299
- _id: string;
3300
- _type: string;
3301
- } & Record<string, unknown>;
2861
+ /** The concrete Lake mutation the action will perform. */
2862
+ mutation: MutationContext;
3302
2863
  /** The datasource the document lives in. A guard applies solely within the
3303
2864
  * datasource it is registered in, so a same-id match from a foreign
3304
2865
  * datasource can never gate this action and must not flip verdicts. */
@@ -3306,15 +2867,15 @@ export declare interface DocumentActionDenialsArgs {
3306
2867
  type: string;
3307
2868
  id: string;
3308
2869
  };
3309
- action: MutationGuardAction;
3310
2870
  guards: readonly MutationGuardDoc[];
3311
2871
  /** The caller's principal id in the guarded resource's own namespace,
3312
2872
  * resolved as `identity()` in predicates. */
3313
2873
  identity?: string;
2874
+ /** Resource-local stored-document lookup for predicates using `->`. */
2875
+ dereference?: GuardDereference;
3314
2876
  }
3315
2877
 
3316
- /** Compile-time mirror of {@link isDocumentEnvelopeKey}: the keys the
3317
- * boundary strips rather than rejects. */
2878
+ /** @inline */
3318
2879
  declare type DocumentEnvelopeKey =
3319
2880
  | `_${string}`
3320
2881
  | "tag"
@@ -3442,7 +3003,7 @@ export declare function driverKind(actor: Actor): DriverKind;
3442
3003
  * to decide who-may-edit. ADVISORY like every engine gate — it disables the
3443
3004
  * inline field and explains; a {@link Guard} declares the intended write-lock.
3444
3005
  */
3445
- export declare type Editable = v.InferOutput<typeof StoredEditableSchema>;
3006
+ export declare type Editable = true | string;
3446
3007
 
3447
3008
  /**
3448
3009
  * One declared-editable field in the current scope, projected for an actor: its
@@ -3586,6 +3147,8 @@ export declare type EditMode = "set" | "append" | "unset";
3586
3147
  * completion and nothing is stored. Omitting `outputs` is an EMPTY allowlist,
3587
3148
  * so ANY returned output is rejected and fails the completion — the bound is
3588
3149
  * universal, not opt-in.
3150
+ *
3151
+ * @interface
3589
3152
  */
3590
3153
  export declare type Effect = v.InferOutput<typeof EffectSchema>;
3591
3154
 
@@ -3599,15 +3162,6 @@ export declare const EFFECT_COMMIT_DISPATCH_CAP = 200;
3599
3162
  * (its queue depth stays ≤ 1). */
3600
3163
  export declare const EFFECT_COMMIT_QUEUE_DEPTH = 32;
3601
3164
 
3602
- /**
3603
- * Every terminal state an effect run can record. `done` and `failed` are
3604
- * reported through completion ({@link EffectCompletionStatus}); `cancelled`
3605
- * is engine-stamped only — an abort cancelling the entry before dispatch.
3606
- * A cancellation is not a failure: anything counting failures (dashboards,
3607
- * retry tooling) must not count aborted-away effects among them.
3608
- */
3609
- declare const EFFECT_RUN_STATUSES: readonly ["done", "failed", "cancelled"];
3610
-
3611
3165
  /**
3612
3166
  * A `ctx.commitOps` / `ctx.setProgress` call hit one of the dispatch's
3613
3167
  * bounds. Thrown synchronously at the call site, not as a promise rejection:
@@ -3666,7 +3220,7 @@ export declare type EffectHandler<
3666
3220
  } | void>;
3667
3221
  }["bivarianceHack"];
3668
3222
 
3669
- declare type EffectHandlerContext<Client extends WorkflowClient> = {
3223
+ export declare type EffectHandlerContext<Client extends WorkflowClient> = {
3670
3224
  /** A concrete sibling of the `createEngine` client, bound to the workflow resource with the
3671
3225
  * same credentials; untagged handler requests carry the `workflow.effect` tag by default. */
3672
3226
  client: Client;
@@ -3784,7 +3338,14 @@ export declare function effectOutputsMap(
3784
3338
  instance: Pick<WorkflowInstance, "effectHistory">,
3785
3339
  ): Record<string, unknown>;
3786
3340
 
3787
- export declare type EffectRunStatus = (typeof EFFECT_RUN_STATUSES)[number];
3341
+ /**
3342
+ * Every terminal state an effect run can record. `done` and `failed` are
3343
+ * reported through completion ({@link EffectCompletionStatus}); `cancelled`
3344
+ * is engine-stamped only — an abort cancelling the entry before dispatch.
3345
+ * A cancellation is not a failure: anything counting failures (dashboards,
3346
+ * retry tooling) must not count aborted-away effects among them.
3347
+ */
3348
+ export declare type EffectRunStatus = "done" | "failed" | "cancelled";
3788
3349
 
3789
3350
  declare const EffectSchema: v.StrictObjectSchema<
3790
3351
  {
@@ -3840,8 +3401,7 @@ export declare interface Engine {
3840
3401
  readonly client: WorkflowClient;
3841
3402
  readonly tag: string;
3842
3403
  readonly workflowResource: WorkflowResource;
3843
- readonly effectHandlers: Readonly<Record<string, EffectHandler>>;
3844
- readonly missingHandler: MissingHandlerPolicy;
3404
+ readonly effects: ResolvedEngineEffects;
3845
3405
  readonly logger: LoggerFactory;
3846
3406
  /** The resolved telemetry logger ({@link noopTelemetry} unless injected) —
3847
3407
  * exposed so adapters built on the engine log through the same seam. */
@@ -3979,13 +3539,13 @@ export declare interface Engine {
3979
3539
  drainEffects: (args: DrainEffectsArgs) => Promise<DrainEffectsResult>;
3980
3540
  /**
3981
3541
  * Inspect every deployed definition in the engine's tag and apply
3982
- * the configured missingHandler policy at `phase: "deploy"` for any
3542
+ * the configured `effects.missingHandler` policy at `phase: "deploy"` for any
3983
3543
  * effect name without a registered handler. Catches "definition
3984
3544
  * shipped, handler removed" misconfigurations at startup instead of
3985
3545
  * three days later when the effect fires.
3986
3546
  *
3987
3547
  * Returns the list of (definitionId, name, locations) tuples it saw.
3988
- * Throws if missingHandler resolved as "fail" for any of them.
3548
+ * Throws if `effects.missingHandler` resolved as "fail" for any of them.
3989
3549
  */
3990
3550
  verifyDeployedDefinitions: () => Promise<VerifyDeployedDefinitionsResult>;
3991
3551
  }
@@ -4004,6 +3564,31 @@ export declare interface Engine {
4004
3564
  */
4005
3565
  export declare const ENGINE_API_VERSION = "2026-04-29";
4006
3566
 
3567
+ /**
3568
+ * Everything this engine needs to run pending effects, in one group.
3569
+ * {@link Engine.drainEffects} dispatches through `handlers` under a
3570
+ * `leaseMs` claim, and both the drain and
3571
+ * {@link Engine.verifyDeployedDefinitions} apply `missingHandler` to an effect
3572
+ * name no handler covers.
3573
+ */
3574
+ export declare interface EngineEffectsArgs<
3575
+ Client extends WorkflowClient = WorkflowClient,
3576
+ > {
3577
+ /** Effect handlers keyed by the effect name the definition queues. */
3578
+ handlers?: Record<string, EffectHandler<Client>>;
3579
+ /**
3580
+ * Lease duration `drainEffects` stamps on each pending-effect claim.
3581
+ * Past the lease the claimer is presumed dead: the entry becomes
3582
+ * recoverable by another drain's takeover or by
3583
+ * the standalone `sweepStaleClaims` export. Default 5 minutes — size it well above
3584
+ * the slowest handler's honest runtime, since a live-but-slow dispatch
3585
+ * that outlives its lease can be redispatched (see {@link EffectHandler}).
3586
+ */
3587
+ leaseMs?: number;
3588
+ /** What to do with an effect name `handlers` doesn't cover. Default `fail`. */
3589
+ missingHandler?: MissingHandlerPolicy;
3590
+ }
3591
+
4007
3592
  export declare interface EngineLogger {
4008
3593
  info: (message: string, extra?: Record<string, unknown>) => void;
4009
3594
  warn: (message: string, extra?: Record<string, unknown>) => void;
@@ -4066,7 +3651,7 @@ export declare interface EngineScopeArgs {
4066
3651
  /**
4067
3652
  * Pull the {@link GlobalDocumentReference} values out of `doc.ref` /
4068
3653
  * `subject` / `doc.refs` (content) field entries. Content only — release
4069
- * field entries come from {@link entryReleaseRefs}, so guard discovery (which
3654
+ * field entries come from the shared release-ref projection, so guard discovery (which
4070
3655
  * reads this via `collectEntryDocUris`) stays scoped to content docs.
4071
3656
  */
4072
3657
  export declare function entryDocRefs(
@@ -4098,12 +3683,14 @@ export declare interface EvaluateArgs {
4098
3683
  }
4099
3684
 
4100
3685
  /**
4101
- * The pure projection at the heart of {@link evaluateInstance}: given an
3686
+ * The pure projection at the heart of runtime evaluation: given an
4102
3687
  * instance, its definition, the resolved actor/grants, and a snapshot,
4103
- * compute "what can this actor do right now, and why not the rest." No
4104
- * I/O feed it a fresh snapshot (e.g. rebuilt from a live store on
4105
- * change) for reactive re-evaluation. Best-effort by design: verdicts are
4106
- * advisory, not enforcement.
3688
+ * compute "what can this actor do right now, and why not the rest." The
3689
+ * supplied snapshot is never refetched; guards using `->` may call the
3690
+ * supplied {@link EvaluateFromSnapshotArgs.guardDereference} resolver.
3691
+ * Feed it a fresh snapshot (e.g. rebuilt from a live store on change) for
3692
+ * reactive re-evaluation. Best-effort by design: verdicts are advisory,
3693
+ * not enforcement.
4107
3694
  */
4108
3695
  export declare function evaluateFromSnapshot(
4109
3696
  args: EvaluateFromSnapshotArgs,
@@ -4134,7 +3721,7 @@ export declare interface EvaluateFromSnapshotArgs {
4134
3721
  attributes?: UserAttributes;
4135
3722
  /**
4136
3723
  * The in-memory snapshot to evaluate against. The caller assembles it
4137
- * from whatever source — a fetch (see {@link evaluateInstance}) or a
3724
+ * from whatever source — a fetch-backed evaluation or a
4138
3725
  * live store. The `_id` of every doc must be in GDR-URI form, as
4139
3726
  * {@link buildSnapshot} produces.
4140
3727
  */
@@ -4151,9 +3738,14 @@ export declare interface EvaluateFromSnapshotArgs {
4151
3738
  * doc, so a guard that matches the instance and denies that write disables
4152
3739
  * every action with `mutation-guard-denied`. Omit to skip the gate in this
4153
3740
  * projection — the engine's verb paths load live guards and re-check at
4154
- * commit time ({@link evaluateInstance} fetches them itself).
3741
+ * commit time (the runtime evaluation path fetches them itself).
4155
3742
  */
4156
3743
  guards?: readonly MutationGuardDoc[];
3744
+ /**
3745
+ * Stored-resource lookup for guard predicates using `->`. Omit when no
3746
+ * guard can dereference; missing lookups resolve `null` and deny fail-closed.
3747
+ */
3748
+ guardDereference?: GuardDereference;
4157
3749
  /**
4158
3750
  * Per-FOREIGN-subject-resource access — the actor's ACL grants PLUS the
4159
3751
  * actor's principal id in that resource's own namespace — keyed by
@@ -4161,20 +3753,22 @@ export declare interface EvaluateFromSnapshotArgs {
4161
3753
  * effects-bearing actions ({@link SubjectPermissionDenial}). A resource
4162
3754
  * appears only when both halves resolved; omit it (or the whole map) to
4163
3755
  * skip that resource's forecast (degrade open — the subject's lake still
4164
- * enforces). {@link evaluateInstance} resolves this through each
4165
- * resource's own client via {@link subjectResourceGrants}.
3756
+ * enforces). The runtime evaluation path resolves this through each
3757
+ * resource's own client.
4166
3758
  */
4167
3759
  resourceGrants?: ReadonlyMap<string, SubjectResourceAccess>;
4168
3760
  }
4169
3761
 
4170
3762
  /**
4171
3763
  * Evaluate a guard predicate against a mutation. Returns `true` only when the
4172
- * predicate is strictly `true` (ALLOW). Empty predicate denies. Fail-closed:
4173
- * any thrown error or non-`true` result denies.
3764
+ * predicate is strictly `true` (ALLOW). Empty predicates, parse failures, and
3765
+ * non-`true` results deny. A supplied dereference resolver's failure propagates
3766
+ * so infrastructure errors cannot masquerade as guard verdicts.
4174
3767
  */
4175
3768
  export declare function evaluateMutationGuard(args: {
4176
3769
  guard: MutationGuardDoc;
4177
3770
  context: MutationContext;
3771
+ dereference?: GuardDereference;
4178
3772
  }): Promise<boolean>;
4179
3773
 
4180
3774
  /** Args for `evaluateStart` — the pre-flight read of `startInstance`'s gates
@@ -4297,14 +3891,14 @@ export declare type ExecutorClassification =
4297
3891
  * alias isn't bound: the check that stops a portable definition from deploying
4298
3892
  * against the wrong (or no) resource.
4299
3893
  *
4300
- * Runs at deploy (inside {@link planDefinitionDeploy}), BEFORE the content
3894
+ * Runs during deploy planning, BEFORE the content
4301
3895
  * fingerprint, so a deployed definition never carries a logical alias. The
4302
3896
  * stored references are physical, and a rebind (same source, a different alias
4303
3897
  * map) surfaces as changed content — a new version, never a silent shift in what
4304
3898
  * the workflow reads. A no-op when the definition references no aliases.
4305
3899
  *
4306
- * Rewrites string VALUES only (via the shared {@link mapJsonStrings} deep-walk),
4307
- * skipping the prose fields in {@link PROSE_KEYS}. A reference that stands alone
3900
+ * Rewrites string VALUES only through a shared deep walk, skipping known prose
3901
+ * fields. A reference that stands alone
4308
3902
  * (the whole value is `@<alias>:<id>`, e.g. a literal `doc.ref`) must expand to a
4309
3903
  * well-formed GDR — a malformed one (`@content:a:b`, an empty id) is rejected
4310
3904
  * here rather than failing when an instance later reads it.
@@ -4449,13 +4043,6 @@ export declare const FIELD_KIND_DISPLAY: {
4449
4043
  };
4450
4044
  };
4451
4045
 
4452
- /**
4453
- * The three field scopes a field entry can live in. Also the
4454
- * group-declaration levels: a `groups` array lives at exactly these three
4455
- * nodes, so `DefinitionGroupSite.level` reuses this vocabulary.
4456
- */
4457
- declare const FIELD_SCOPES: readonly ["workflow", "stage", "activity"];
4458
-
4459
4046
  /**
4460
4047
  * The kinds a VALUE can take — scalars aligned to Sanity's names, the
4461
4048
  * reference kinds, the actor/assignee identities, and the two compositional
@@ -4490,8 +4077,7 @@ declare const FIELD_VALUE_KINDS: readonly [
4490
4077
  "array",
4491
4078
  ];
4492
4079
 
4493
- /** Type-mirror of {@link fieldBase}, parameterised over the `editable` and
4494
- * `group` grammars (stored membership is the canonical list form). */
4080
+ /** @inline */
4495
4081
  declare type FieldBase<TEditable, TGroup> = {
4496
4082
  name: string;
4497
4083
  title?: string | undefined;
@@ -4509,11 +4095,14 @@ export declare interface FieldDescription {
4509
4095
  proposals: InsightPhrase[];
4510
4096
  }
4511
4097
 
4512
- /** One declared field entry as authored and stored: name, value kind, and its scope's sourcing and editability. */
4098
+ /**
4099
+ * One declared field entry as authored and stored: name, value kind, and its scope's sourcing and editability.
4100
+ *
4101
+ * @interface
4102
+ */
4513
4103
  export declare type FieldEntry = FieldEntryFields<Editable, string[]>;
4514
4104
 
4515
- /** Type-mirror of {@link fieldEntryFields}: a raw field entry of the given
4516
- * editability and group-membership grammars. */
4105
+ /** @inline */
4517
4106
  declare type FieldEntryFields<TEditable, TGroup> = FieldBase<
4518
4107
  TEditable,
4519
4108
  TGroup
@@ -4550,11 +4139,58 @@ export declare interface FieldInsight {
4550
4139
 
4551
4140
  export declare type FieldKind = keyof FieldValueMap;
4552
4141
 
4142
+ /** A field mutation targeting the supplied field-reference shape. */
4143
+ export declare type FieldMutationOp<
4144
+ TTarget extends {
4145
+ field: string;
4146
+ },
4147
+ > =
4148
+ | {
4149
+ type: "field.set";
4150
+ target: TTarget;
4151
+ value: ValueExpr;
4152
+ }
4153
+ | {
4154
+ type: "field.setIfMissing";
4155
+ target: TTarget;
4156
+ value: ValueExpr;
4157
+ }
4158
+ | {
4159
+ type: "field.unset";
4160
+ target: TTarget;
4161
+ }
4162
+ | {
4163
+ type: "field.append";
4164
+ target: TTarget;
4165
+ value: ValueExpr;
4166
+ }
4167
+ | {
4168
+ type: "field.inc";
4169
+ target: TTarget;
4170
+ value?: ValueExpr | undefined;
4171
+ }
4172
+ | {
4173
+ type: "field.dec";
4174
+ target: TTarget;
4175
+ value?: ValueExpr | undefined;
4176
+ }
4177
+ | {
4178
+ type: "field.updateWhere";
4179
+ target: TTarget;
4180
+ where: Condition;
4181
+ value: ValueExpr;
4182
+ }
4183
+ | {
4184
+ type: "field.removeWhere";
4185
+ target: TTarget;
4186
+ where: Condition;
4187
+ };
4188
+
4553
4189
  /**
4554
4190
  * A stored field mutation. `field.inc` and `field.dec` use the same names as
4555
4191
  * `@sanity/client` patches and default an omitted `value` to a delta of `1`.
4556
4192
  */
4557
- export declare type FieldOp = v.InferOutput<typeof StoredFieldOpSchema>;
4193
+ export declare type FieldOp = FieldMutationOp<StoredFieldRef>;
4558
4194
 
4559
4195
  /**
4560
4196
  * A concrete value a blocking atom pins for this field, with the verified
@@ -4568,6 +4204,7 @@ export declare interface FieldProposal {
4568
4204
  consequences: SiteConsequence[];
4569
4205
  }
4570
4206
 
4207
+ /** @inline */
4571
4208
  declare type FieldReadExpr = {
4572
4209
  type: "fieldRead";
4573
4210
  scope?: "workflow" | "stage" | undefined;
@@ -4575,7 +4212,12 @@ declare type FieldReadExpr = {
4575
4212
  path?: string | undefined;
4576
4213
  };
4577
4214
 
4578
- export declare type FieldScope = (typeof FIELD_SCOPES)[number];
4215
+ /**
4216
+ * The three field scopes a field entry can live in. Also the
4217
+ * group-declaration levels: a `groups` array lives at exactly these three
4218
+ * nodes, so `DefinitionGroupSite.level` reuses this vocabulary.
4219
+ */
4220
+ export declare type FieldScope = "workflow" | "stage" | "activity";
4579
4221
 
4580
4222
  /**
4581
4223
  * A sub-field shape used inside an `object`'s `fields` or an `array`'s `of` —
@@ -4607,6 +4249,7 @@ export declare interface FieldShape {
4607
4249
  */
4608
4250
  export declare type FieldSource = FieldSourceInternal;
4609
4251
 
4252
+ /** @inline */
4610
4253
  declare type FieldSourceInternal =
4611
4254
  | {
4612
4255
  type: "input";
@@ -4655,8 +4298,8 @@ export declare interface FieldValueMap {
4655
4298
  dueDatetime: string | null;
4656
4299
  url: string | null;
4657
4300
  actor: Actor | null;
4658
- /** A single {@link Assignee} the singular of {@link FieldValueMap.assignees}. */
4659
- assignee: Assignee | null;
4301
+ /** Assignment members with at most one user; role members do not consume that cardinality. */
4302
+ assignee: Assignee[];
4660
4303
  assignees: Assignee[];
4661
4304
  /** An object with named sub-fields; the value is keyed by sub-field name. */
4662
4305
  object: Record<string, unknown> | null;
@@ -5018,33 +4661,15 @@ export declare function groupSitesOf(
5018
4661
  ): DefinitionGroupSite[];
5019
4662
 
5020
4663
  /**
5021
- * A lake mutation guard. A FOREIGN CONTRACT mirrored 1:1: `match`,
5022
- * `predicate`, and `metadata` are the content lake's persisted guard-document
5023
- * API, not engine-invented surface — the stored form keeps the lake's
5024
- * vocabulary verbatim. The engine adds exactly two things: `name` (a
5025
- * lake-id-segment, `^[a-z0-9][a-z0-9-]*$`, unique per definition — the lake
5026
- * `_id` derives from `(instanceId, name)` at stage entry) and the deploy-time
5027
- * read VALUES on `match.idRefs` / `metadata` (a typed {@link GuardRead} when
5028
- * authoring, resolved to bare values at deploy). `match` selects mutations by
5029
- * `types` (empty matches any), `idRefs` (field reads resolved to bare ids),
5030
- * `idPatterns` (bare glob ids), and `actions` (at least one). `predicate` is
5031
- * lake GROQ in a distinct delta-mode eval context (`before()`/`after()`,
5032
- * `mutation`, `guard`, `identity()`, bare ids/fields only): strictly `true`
5033
- * ALLOWS the mutation; anything else — false, null, an evaluation error, or
5034
- * an omitted/empty predicate — DENIES. `metadata` is the only bridge from
5035
- * that eval context (which cannot see `$fields`) to workflow fields, read as
5036
- * `guard.metadata.*` and re-synced by the post-field-op guard refresh. The
5037
- * lake does not enforce the guard document type yet: a deployed guard denies
5038
- * optimistically engine-side, and the lake ACL is the only hard gate until
5039
- * guard enforcement ships.
4664
+ * A stored workflow guard. Its string reads and authored lifecycle actions
4665
+ * remain unresolved until stage entry produces the Lake-shaped documents
4666
+ * deployed for that stage.
4667
+ *
4668
+ * @interface
5040
4669
  */
5041
4670
  export declare type Guard = v.InferOutput<typeof GuardSchema>;
5042
4671
 
5043
4672
  /**
5044
- * The lake document type for a mutation guard. Single source of truth — both
5045
- * the runtime value (id construction, `compileGuard`, queries) and the
5046
- * {@link MutationGuardDoc} `_type` literal derive from here.
5047
- *
5048
4673
  * The enforcement story hangs off this type: the lake does not evaluate
5049
4674
  * this doc type — it is the engine's placeholder for the lake's
5050
4675
  * forthcoming guard primitive (the lake reserves `system.*`). Until that
@@ -5061,21 +4686,21 @@ export declare const GUARD_OWNER = "robot:workflow-engine";
5061
4686
  * The identifiers a lake mutation guard's `predicate` reads — the wire
5062
4687
  * dialect, not the condition scope (so no {@link ConditionVarBinding}: these
5063
4688
  * bind only when a guard evaluates a mutation). `before()`/`after()`/
5064
- * `identity()` are groq-js delta-mode natives on top of these. Bound in one
5065
- * place: `guardPredicateParams` in the guard evaluator.
4689
+ * `identity()` are groq-js delta-mode natives on top of these. The guard
4690
+ * evaluator must bind every entry here at the predicate root.
5066
4691
  */
5067
4692
  export declare const GUARD_PREDICATE_VARS: readonly {
5068
4693
  name: string;
5069
4694
  description: string;
5070
4695
  }[];
5071
4696
 
5072
- export declare type GuardAction = v.InferOutput<typeof GuardActionSchema>;
4697
+ export declare type GuardAction = MutationGuardAction;
5073
4698
 
5074
- declare const GuardActionSchema: v.PicklistSchema<
5075
- readonly ["create", "update", "delete", "publish", "unpublish"],
5076
- string
5077
- >;
4699
+ export declare type GuardDereference = (ref: {
4700
+ _ref: string;
4701
+ }) => PromiseLike<Record<string, unknown> | null>;
5078
4702
 
4703
+ /** The stored document, pattern, type, and authored-action facets a guard matches. */
5079
4704
  export declare type GuardMatch = Guard["match"];
5080
4705
 
5081
4706
  /**
@@ -5106,86 +4731,23 @@ export declare function guardMatches({
5106
4731
  * matched by anchored regexes, so a line break in a path would print an
5107
4732
  * unparseable read.
5108
4733
  */
5109
- export declare type GuardRead = v.InferOutput<typeof GuardReadSchema>;
5110
-
5111
- declare const GuardReadSchema: v.VariantSchema<
5112
- "type",
5113
- [
5114
- v.StrictObjectSchema<
5115
- {
5116
- readonly type: v.LiteralSchema<"self", undefined>;
5117
- },
5118
- undefined
5119
- >,
5120
- v.StrictObjectSchema<
5121
- {
5122
- readonly type: v.LiteralSchema<"now", undefined>;
5123
- },
5124
- undefined
5125
- >,
5126
- v.StrictObjectSchema<
5127
- {
5128
- readonly type: v.LiteralSchema<"fieldRead", undefined>;
5129
- readonly field: v.SchemaWithPipe<
5130
- readonly [v.StringSchema<undefined>, v.RegexAction<string, string>]
5131
- >;
5132
- readonly path: v.OptionalSchema<
5133
- v.SchemaWithPipe<
5134
- readonly [
5135
- v.SchemaWithPipe<
5136
- readonly [
5137
- v.StringSchema<undefined>,
5138
- v.MinLengthAction<string, 1, "must be a non-empty string">,
5139
- ]
5140
- >,
5141
- v.CheckAction<
5142
- string,
5143
- "a guard read path cannot contain a line break"
5144
- >,
5145
- ]
5146
- >,
5147
- undefined
5148
- >;
5149
- },
5150
- undefined
5151
- >,
5152
- v.StrictObjectSchema<
5153
- {
5154
- readonly type: v.LiteralSchema<"effectsRead", undefined>;
5155
- readonly effect: v.SchemaWithPipe<
5156
- readonly [
5157
- v.SchemaWithPipe<
5158
- readonly [
5159
- v.StringSchema<undefined>,
5160
- v.MinLengthAction<string, 1, "must be a non-empty string">,
5161
- ]
5162
- >,
5163
- v.CheckAction<string, "an effect name cannot contain `'`">,
5164
- ]
5165
- >;
5166
- readonly path: v.OptionalSchema<
5167
- v.SchemaWithPipe<
5168
- readonly [
5169
- v.SchemaWithPipe<
5170
- readonly [
5171
- v.StringSchema<undefined>,
5172
- v.MinLengthAction<string, 1, "must be a non-empty string">,
5173
- ]
5174
- >,
5175
- v.CheckAction<
5176
- string,
5177
- "a guard read path cannot contain a line break"
5178
- >,
5179
- ]
5180
- >,
5181
- undefined
5182
- >;
5183
- },
5184
- undefined
5185
- >,
5186
- ],
5187
- undefined
5188
- >;
4734
+ export declare type GuardRead =
4735
+ | {
4736
+ type: "self";
4737
+ }
4738
+ | {
4739
+ type: "now";
4740
+ }
4741
+ | {
4742
+ type: "fieldRead";
4743
+ field: string;
4744
+ path?: string | undefined;
4745
+ }
4746
+ | {
4747
+ type: "effectsRead";
4748
+ effect: string;
4749
+ path?: string | undefined;
4750
+ };
5189
4751
 
5190
4752
  declare const GuardSchema: v.StrictObjectSchema<
5191
4753
  {
@@ -5235,21 +4797,12 @@ declare const GuardSchema: v.StrictObjectSchema<
5235
4797
  >,
5236
4798
  undefined
5237
4799
  >;
5238
- actions: v.SchemaWithPipe<
5239
- readonly [
5240
- v.ArraySchema<
5241
- v.PicklistSchema<
5242
- readonly ["create", "update", "delete", "publish", "unpublish"],
5243
- string
5244
- >,
5245
- undefined
5246
- >,
5247
- v.MinLengthAction<
5248
- ("create" | "update" | "delete" | "publish" | "unpublish")[],
5249
- 1,
5250
- "a guard must match at least one action"
5251
- >,
5252
- ]
4800
+ actions: v.ArraySchema<
4801
+ v.PicklistSchema<
4802
+ readonly ["create", "update", "delete", "publish", "unpublish"],
4803
+ string
4804
+ >,
4805
+ undefined
5253
4806
  >;
5254
4807
  },
5255
4808
  undefined
@@ -5282,7 +4835,7 @@ declare const GuardSchema: v.StrictObjectSchema<
5282
4835
  * its guards statically name — no live instance required. Guard docs are
5283
4836
  * stamped with the version-less definition, so this spans the datasources
5284
4837
  * declared across ALL deployed versions
5285
- * ({@link DefinitionGuardsQueryArgs.definitions}), not just the latest.
4838
+ * (`definitions`), not just the latest.
5286
4839
  *
5287
4840
  * A datasource is statically reachable when a guard idRef resolves to a
5288
4841
  * hardcoded GDR literal — directly, or via a `fieldRead` of a field entry whose
@@ -5328,7 +4881,7 @@ export { guillemets };
5328
4881
  * Advisory, like every engine check (the lake is the only enforcement point):
5329
4882
  * FNV-1a is a fast, deterministic, dependency-free, isomorphic digest — enough
5330
4883
  * to detect honest change and drift, not a tamper-proof seal. Kept synchronous
5331
- * so the pure planning path ({@link planDefinitionDeploy}) needs no `await`.
4884
+ * so the pure planning path needs no `await`.
5332
4885
  */
5333
4886
  export declare function hashDefinitionContent(def: WorkflowDefinition): string;
5334
4887
 
@@ -5424,6 +4977,7 @@ export declare type HistoryEntry = HistoryEvent & {
5424
4977
  executionContext?: ExecutionContext;
5425
4978
  };
5426
4979
 
4980
+ /** @inline */
5427
4981
  declare type HistoryEvent =
5428
4982
  | {
5429
4983
  _key: string;
@@ -5593,6 +5147,14 @@ export declare interface HydratedSnapshot {
5593
5147
  knownIds: Set<string>;
5594
5148
  }
5595
5149
 
5150
+ /** Assignment ownership for list/read surfaces. Role aliases deliberately do
5151
+ * not apply: aliases widen authorization, not whose inbox a literal pool
5152
+ * member routes work into. */
5153
+ export declare function identityMatchesAssignment(
5154
+ members: readonly Assignee[],
5155
+ identity: AssignmentIdentity,
5156
+ ): boolean;
5157
+
5596
5158
  /**
5597
5159
  * The in-flight arm — the one spelling of "not completed/aborted" every
5598
5160
  * list surface's `includeCompleted` filter negates (the engine stamps
@@ -5712,6 +5274,12 @@ export declare type InsightSite =
5712
5274
  activity?: string;
5713
5275
  };
5714
5276
 
5277
+ /** Viewer-scoped assignment counts across active activities in the open stage. */
5278
+ export declare function instanceAssignmentStateCounts(
5279
+ instance: AssignmentInstance,
5280
+ identity: AssignmentIdentity,
5281
+ ): AssignmentStateCounts;
5282
+
5715
5283
  /**
5716
5284
  * The tag's instance partition as a listen filter — the one shared change
5717
5285
  * feed a preview store keeps itself fresh from (an event names the touched
@@ -5725,9 +5293,9 @@ export declare function instanceChangesQuery(args: {
5725
5293
 
5726
5294
  /**
5727
5295
  * Mint the Sanity document `_id` for a workflow instance — a fresh
5728
- * {@link randomKey} suffix, so every instance (root or spawned child) gets a
5296
+ * random suffix, so every instance (root or spawned child) gets a
5729
5297
  * unique doc id under its tag. Lives in the shell, not `core/`, because it
5730
- * draws randomness; the deterministic {@link definitionDocId} is the pure-core
5298
+ * draws randomness; the deterministic `definitionDocId` is the pure-core
5731
5299
  * counterpart. Bare form — Sanity rejects `:` in document IDs, so this is
5732
5300
  * never a GDR URI.
5733
5301
  */
@@ -5745,7 +5313,7 @@ export declare function instanceDocId(tag: string): string;
5745
5313
  */
5746
5314
  export declare function instanceGuardQuery(instanceId: string): CompiledQuery;
5747
5315
 
5748
- declare interface InstanceGuardsQueryArgs {
5316
+ export declare interface InstanceGuardsQueryArgs {
5749
5317
  client: WorkflowClient;
5750
5318
  clientForGdr: ClientForGdr;
5751
5319
  instance: WorkflowInstance;
@@ -5822,8 +5390,9 @@ export declare interface InstanceSession {
5822
5390
  /** Best-effort projection against the held content + held guards. The first
5823
5391
  * call resolves the caller's identity/grants from the client's token over
5824
5392
  * the network (cached per client) — plus each foreign subject resource's
5825
- * grants through its own client, for the subject-write forecast;
5826
- * evaluation itself runs in-memory on groq-js. */
5393
+ * grants through its own client, for the subject-write forecast. The held
5394
+ * snapshot is not refetched; a guard predicate using `->` reads its target
5395
+ * through the bound engine client. */
5827
5396
  evaluate(): Promise<WorkflowEvaluation>;
5828
5397
  /** Advance the instance against the held content: cascade auto-transitions,
5829
5398
  * deploy guards, queue effects, commit with `ifRevisionId`. */
@@ -5930,6 +5499,14 @@ export declare interface InstancesQueryFilter {
5930
5499
  definition?: string;
5931
5500
  /** Current stage name. */
5932
5501
  stage?: string;
5502
+ /** Current viewer assignment filter. `unrouted` needs no identity match;
5503
+ * `routed` matches literal role members only while no user holds the
5504
+ * activity; `held` matches the direct user and shadows every role. */
5505
+ assignment?: {
5506
+ userId: string;
5507
+ roles?: readonly string[] | undefined;
5508
+ states?: readonly AssignmentState[] | undefined;
5509
+ };
5933
5510
  /** Include completed/aborted instances (default: in-flight only). */
5934
5511
  includeCompleted?: boolean;
5935
5512
  /**
@@ -5957,9 +5534,9 @@ export declare interface InstancesQueryFilter {
5957
5534
  /**
5958
5535
  * Whether {@link document} is in {@link instance}'s reactive watch-set — the
5959
5536
  * reverse of {@link subscriptionDocumentsForInstance}. Both derive from
5960
- * {@link collectWatchRefs}, the single source of truth, so "which docs does
5537
+ * the shared watch-ref collector, the single source of truth, so "which docs does
5961
5538
  * this instance watch" and "which instances watch this doc" stay in lockstep
5962
- * — the same way {@link hydrateSnapshot}'s load-set does. Matching is on the
5539
+ * — the same way `hydrateSnapshot`'s load-set does. Matching is on the
5963
5540
  * resource-qualified GDR URI, so a cross-dataset subject (`dataset:A:ds:doc`)
5964
5541
  * never matches a same-id doc in another resource (`dataset:B:ds:doc`).
5965
5542
  *
@@ -6190,6 +5767,9 @@ export declare function lakeGuardId(args: {
6190
5767
  guardName: string;
6191
5768
  }): string;
6192
5769
 
5770
+ /** The write operations Content Lake exposes to mutation guards. */
5771
+ export declare type LakeMutationGuardAction = "create" | "update" | "delete";
5772
+
6193
5773
  /**
6194
5774
  * The one rule every lake-facing identity check (guard previews/pre-flights, `$can` grant filters)
6195
5775
  * must resolve through to agree with the lake's own `identity()`; binding `actor.id` directly at a
@@ -6248,6 +5828,7 @@ export declare function lintEffectOutputs(
6248
5828
  definition: WorkflowDefinition,
6249
5829
  ): string[];
6250
5830
 
5831
+ /** @inline */
6251
5832
  declare type LiteralExpr = {
6252
5833
  type: "literal";
6253
5834
  value: unknown;
@@ -6275,9 +5856,15 @@ export declare interface LogicalRef {
6275
5856
  * reference whose resolved document the consumer opens; deploy checks the
6276
5857
  * `field` variant points at a doc-valued entry.
6277
5858
  */
6278
- export declare type ManualTarget = v.InferOutput<
6279
- typeof StoredManualTargetSchema
6280
- >;
5859
+ export declare type ManualTarget =
5860
+ | {
5861
+ type: "url";
5862
+ url: string;
5863
+ }
5864
+ | {
5865
+ type: "field";
5866
+ field: StoredFieldRef;
5867
+ };
6281
5868
 
6282
5869
  /** Returns true iff `document` survives `filter`'s GROQ predicate under the supplied identity. */
6283
5870
  declare function matchesFilter(args: {
@@ -6314,7 +5901,7 @@ export declare interface MissingHandlerDrainInfo {
6314
5901
  }
6315
5902
 
6316
5903
  /**
6317
- * The `missingHandler: 'fail'` policy tripped: an effect names a handler the
5904
+ * The `effects.missingHandler: 'fail'` policy tripped: an effect names a handler the
6318
5905
  * runtime never registered. `info` carries the phase-specific location
6319
5906
  * (deploy verification vs a drain attempt) so the runtime that opted into
6320
5907
  * failing can report exactly which handler is missing where.
@@ -6339,9 +5926,9 @@ export declare type MissingHandlerPolicy =
6339
5926
  * required when it is `required` AND `input`-sourced (the only combination
6340
5927
  * deploy admits), and as provided when a supplied value matches its name AND
6341
5928
  * kind with a real (non-null) value. Keys on the same name+type as the input
6342
- * read in {@link resolveInputValue}, but is stricter: a present-but-null/
5929
+ * read during input resolution, but is stricter: a present-but-null/
6343
5930
  * undefined value counts as absent here (a required field needs a real
6344
- * value), whereas {@link resolveInputValue} passes a null fill straight
5931
+ * value), whereas input resolution passes a null fill straight
6345
5932
  * through. Exported so pre-flight validators (e.g. mapping validation) share
6346
5933
  * the engine's own rule instead of mirroring it.
6347
5934
  */
@@ -6373,15 +5960,6 @@ export declare class ModelVersionAheadError extends WorkflowError<"model-version
6373
5960
  /** A document with no stamp, or a non-number stamp (foreign data this engine never wrote), reads as model 0. */
6374
5961
  export declare function modelVersionOf(doc: object): number;
6375
5962
 
6376
- /** The lake operations a guard can gate — see the guard types in ./authorization.ts. */
6377
- declare const MUTATION_GUARD_ACTIONS: readonly [
6378
- "create",
6379
- "update",
6380
- "delete",
6381
- "publish",
6382
- "unpublish",
6383
- ];
6384
-
6385
5963
  /**
6386
5964
  * Inputs to predicate evaluation: the delta-mode natives `before()`/`after()`,
6387
5965
  * the `mutation`, the `guard`, and `identity()`. `before` is null on create,
@@ -6400,7 +5978,7 @@ export declare interface MutationContext {
6400
5978
  _type: string;
6401
5979
  } & Record<string, unknown>)
6402
5980
  | null;
6403
- action: MutationGuardAction;
5981
+ action: LakeMutationGuardAction;
6404
5982
  /**
6405
5983
  * The caller's principal id in the guarded resource's own namespace
6406
5984
  * (what that lake's `identity()` returns), resolved as `identity()` in
@@ -6410,8 +5988,11 @@ export declare interface MutationContext {
6410
5988
  identity?: string;
6411
5989
  }
6412
5990
 
5991
+ /** Lake operations plus the authored lifecycle actions the compiler translates. */
6413
5992
  export declare type MutationGuardAction =
6414
- (typeof MUTATION_GUARD_ACTIONS)[number];
5993
+ | LakeMutationGuardAction
5994
+ | "publish"
5995
+ | "unpublish";
6415
5996
 
6416
5997
  /**
6417
5998
  * The persisted body of a mutation guard — every field except the lake system
@@ -6444,7 +6025,11 @@ export declare interface MutationGuardBody {
6444
6025
  description?: string;
6445
6026
  /** Bare document ids (resource-local; both published and `drafts.` forms). */
6446
6027
  match: MutationGuardMatch;
6447
- /** GROQ; empty string = unconditional deny. Bare ids/fields only — no GDRs. */
6028
+ /**
6029
+ * Lake delta-mode GROQ. The root exposes `document.before`,
6030
+ * `document.after`, `mutation`, and `guard`; `identity()` and resource-local
6031
+ * reference dereferencing are available. Empty string is unconditional deny.
6032
+ */
6448
6033
  predicate: string;
6449
6034
  /** Caller-owned projected state the predicate reads as `guard.metadata.*`. */
6450
6035
  metadata: Record<string, unknown>;
@@ -6483,7 +6068,7 @@ export declare class MutationGuardDeniedError extends WorkflowError<"mutation-gu
6483
6068
  */
6484
6069
  static fromGuards(args: {
6485
6070
  documentId: string;
6486
- action: MutationGuardAction;
6071
+ action: LakeMutationGuardAction;
6487
6072
  guards: readonly MutationGuardDoc[];
6488
6073
  }): MutationGuardDeniedError;
6489
6074
  }
@@ -6541,15 +6126,20 @@ export declare interface NoteItem {
6541
6126
  at?: string | null;
6542
6127
  }
6543
6128
 
6544
- /** An append-only audit/comment log: sugar over `array of object {body, actor, at}` — the `actor`/`at`
6545
- * names match the `audit` op's stamp fields, so it pairs with it. Never a stored kind. */
6129
+ /** @inline */
6546
6130
  declare type NotesField = FieldBase<AuthoringEditable, GroupMembership> & {
6547
6131
  type: "notes";
6548
6132
  };
6549
6133
 
6550
6134
  /** A `field.updateWhere` / `field.removeWhere` op's `where` selects rows to
6551
6135
  * mutate with rendered-scope GROQ (`$row`, `$params` bound) — row selection, not a gate; an unevaluable row never matches. */
6552
- export declare type Op = v.InferOutput<typeof StoredOpSchema>;
6136
+ export declare type Op =
6137
+ | FieldOp
6138
+ | {
6139
+ type: "status.set";
6140
+ activity: string;
6141
+ status: ActivityStatus;
6142
+ };
6553
6143
 
6554
6144
  /**
6555
6145
  * Op `type` discriminators — the stored mutation primitives.
@@ -6602,6 +6192,11 @@ export declare interface OpAppliedSummary {
6602
6192
  resolved?: Record<string, unknown>;
6603
6193
  }
6604
6194
 
6195
+ /** Assignment members for each active activity in the instance's open stage. */
6196
+ export declare function openActivityAssignments(
6197
+ instance: AssignmentInstance,
6198
+ ): readonly (readonly Assignee[])[];
6199
+
6605
6200
  export declare interface OperationArgs {
6606
6201
  instanceId: string;
6607
6202
  /**
@@ -6612,9 +6207,10 @@ export declare interface OperationArgs {
6612
6207
 
6613
6208
  /**
6614
6209
  * What a state-changing verb reports back. Every mutating verb —
6615
- * `startInstance`, `fireAction`, `editField`, `completeEffect`, `tick`,
6616
- * `setStage`, `abortInstance` — returns this one shape, on the namespace,
6617
- * the `Engine`, and the reactive session alike.
6210
+ * `startInstance`, `fireAction`, `editField`, `completeEffect`,
6211
+ * `commitEffectOps`, `tick`, `setStage`, `abortInstance`, `resetActivity`
6212
+ * returns this one shape, on the namespace, the `Engine`, and the reactive
6213
+ * session alike.
6618
6214
  */
6619
6215
  export declare interface OperationResult {
6620
6216
  /** The instance after the operation + all cascading auto-transitions. */
@@ -6634,6 +6230,14 @@ export declare interface OperationResult {
6634
6230
  * during the action commit. Surfaced for caller-side assertions and
6635
6231
  * audit. */
6636
6232
  ranOps?: OpAppliedSummary[];
6233
+ /**
6234
+ * The nearest future instant (ISO 8601) at which the clock alone changes what
6235
+ * the instance evaluates to; schedule the next `tick` for it. Derived per
6236
+ * call, never persisted. Absent on a terminal instance, when no site yields a
6237
+ * boundary from the instance's values, and for a gate reading `$now` beside a
6238
+ * caller variable, which {@link WorkflowEvaluation.nextEvaluationAt} carries.
6239
+ */
6240
+ nextEvaluationAt?: string;
6637
6241
  }
6638
6242
 
6639
6243
  export { OUTCOME_MARKS };
@@ -6725,7 +6329,7 @@ export declare function parseResourceGdr(uri: string): WorkflowResource;
6725
6329
  /**
6726
6330
  * A stage's multi-guard deploy failed *after* at least one guard already landed.
6727
6331
  * Those partial locks can't be cleanly undone (guard docs have no transactional
6728
- * deploy). Inside the engine {@link deployOrRollback} rolls the state move back
6332
+ * deploy). Inside the engine `deployOrRollback` rolls the state move back
6729
6333
  * and escalates this to a loud {@link WorkflowStateDivergedError}; a caller that
6730
6334
  * invokes {@link deployStageGuards} directly (without that rollback wrapper) can
6731
6335
  * also see it, so it's exported to be catchable by type.
@@ -6733,7 +6337,14 @@ export declare function parseResourceGdr(uri: string): WorkflowResource;
6733
6337
  export declare class PartialGuardDeployError extends WorkflowError<"partial-guard-deploy"> {
6734
6338
  readonly stageName: string;
6735
6339
  readonly deployed: number;
6736
- constructor(args: { stageName: string; deployed: number; cause: unknown });
6340
+ /** The cleanup failure, when newly created guards could not be retracted. */
6341
+ readonly rollbackError?: unknown;
6342
+ constructor(args: {
6343
+ stageName: string;
6344
+ deployed: number;
6345
+ cause: unknown;
6346
+ rollbackError?: unknown;
6347
+ });
6737
6348
  }
6738
6349
 
6739
6350
  export declare interface PendingEffect {
@@ -6913,8 +6524,8 @@ export declare function projectStartSliceRow(
6913
6524
  * representation's stored id rides along as `_originalId` — session-side
6914
6525
  * conditions (including the `_originalId in path("versions.**")` shape) then
6915
6526
  * read the same projected identity as the engine's perspective-aware hydration.
6916
- * Strict by construction: only the ids in
6917
- * {@link watchRefRepresentations} are accepted — an id that merely *ends* in
6527
+ * Strict by construction: only a canonical watch-reference representation is
6528
+ * accepted — an id that merely *ends* in
6918
6529
  * the watched id (another doc's dotted id under a version prefix), a release
6919
6530
  * the perspective doesn't read, or a draft the perspective makes invisible is
6920
6531
  * a store routing bug, and projecting it would make content the engine's read
@@ -6956,7 +6567,7 @@ export declare interface QueryInScopeArgs extends InstanceRefArgs, QueryArgs {}
6956
6567
  export { quoted };
6957
6568
 
6958
6569
  export declare const READER_MODEL_ROLLOUT_URL =
6959
- "https://www.sanity.io/docs/editorial-workflows/prerelease";
6570
+ "https://www.sanity.io/docs/workflows/prerelease";
6960
6571
 
6961
6572
  /** A producer has not acknowledged the floor required by its submitted definitions. */
6962
6573
  export declare class ReaderModelAcknowledgementError extends WorkflowError<"reader-model-acknowledgement"> {
@@ -6964,10 +6575,9 @@ export declare class ReaderModelAcknowledgementError extends WorkflowError<"read
6964
6575
  readonly expectedMinReaderModel: unknown;
6965
6576
  readonly requiredMinReaderModel: number;
6966
6577
  readonly engineMinReaderModel = 4;
6967
- readonly engineMaxReaderModel = 8;
6968
- readonly engineModelVersion = 8;
6969
- readonly documentationUrl =
6970
- "https://www.sanity.io/docs/editorial-workflows/prerelease";
6578
+ readonly engineMaxReaderModel = 9;
6579
+ readonly engineModelVersion = 9;
6580
+ readonly documentationUrl = "https://www.sanity.io/docs/workflows/prerelease";
6971
6581
  constructor(
6972
6582
  expectedMinReaderModel: unknown,
6973
6583
  options?: {
@@ -6998,7 +6608,7 @@ export declare function readInstancePreviewDoc(
6998
6608
  * perspective; everything else is content and resolves to its
6999
6609
  * version/draft/published form. This is the single encoding of the rule
7000
6610
  * the {@link WatchSet} `perspective` contract describes to consumers, and
7001
- * the rule {@link hydrateSnapshot} applies on the fetch side.
6611
+ * the rule `hydrateSnapshot` applies on the fetch side.
7002
6612
  */
7003
6613
  export declare function readsRaw(ref: { type: string }): boolean;
7004
6614
 
@@ -7123,7 +6733,7 @@ export declare function releaseRef({
7123
6733
  * half. Empty unless the instance is `stuck`: a `waiting` instance advances on
7124
6734
  * its own next action (see `availableActions`), and terminal or `progressing`
7125
6735
  * ones need nothing. Each verb is flagged
7126
- * {@link SuggestedRemediation.available} from {@link RUNNABLE_VERBS}.
6736
+ * {@link SuggestedRemediation.available} from the runnable-verb vocabulary.
7127
6737
  */
7128
6738
  export declare function remediationsFor(
7129
6739
  diagnosis: Diagnosis,
@@ -7181,6 +6791,7 @@ export declare function requiredReaderModel(
7181
6791
  document: unknown,
7182
6792
  ): number;
7183
6793
 
6794
+ /** @inline */
7184
6795
  declare type RequirementBase = {
7185
6796
  name: string;
7186
6797
  title?: string | undefined;
@@ -7202,8 +6813,6 @@ export declare interface RequirementDescriptor {
7202
6813
  */
7203
6814
  export declare const RESERVED_CONDITION_VARS: readonly string[];
7204
6815
 
7205
- declare const RESET_ACTIVITY_TARGETS: readonly ["active", "skipped"];
7206
-
7207
6816
  export declare interface ResetActivityArgs extends DedupableOperationArgs {
7208
6817
  /** Name of the activity to reset, within the instance's current stage. */
7209
6818
  activity: string;
@@ -7237,8 +6846,7 @@ export declare type ResetActivityResult =
7237
6846
  * fire). `done` is deliberately absent: a reset is recovery, not a silent
7238
6847
  * declaration that the work succeeded.
7239
6848
  */
7240
- export declare type ResetActivityTarget =
7241
- (typeof RESET_ACTIVITY_TARGETS)[number];
6849
+ export declare type ResetActivityTarget = "active" | "skipped";
7242
6850
 
7243
6851
  /**
7244
6852
  * Resolve the engine's `WorkflowAccess` for a client — actor and grants
@@ -7280,6 +6888,12 @@ export declare interface ResolveClientActorArgs {
7280
6888
  readonly projectId: string;
7281
6889
  }
7282
6890
 
6891
+ /** {@link EngineEffectsArgs} after the engine applied its defaults. */
6892
+ export declare interface ResolvedEngineEffects {
6893
+ readonly handlers: Readonly<Record<string, EffectHandler>>;
6894
+ readonly missingHandler: MissingHandlerPolicy;
6895
+ }
6896
+
7283
6897
  /**
7284
6898
  * A resolved field entry as the engine persists it on an instance.
7285
6899
  * Discriminated by `_type` (bare — unique within this union); the `value`
@@ -7399,7 +7013,7 @@ export declare function resourceFromParsed(parsed: ParsedGdr): WorkflowResource;
7399
7013
  export declare function resourceGdr(res: WorkflowResource): string;
7400
7014
 
7401
7015
  /** Args for the single-resource ref constructors ({@link refCanvas}, {@link refMediaLibrary}, {@link refDashboard}). */
7402
- declare interface ResourceRefArgs<TType extends string> {
7016
+ export declare interface ResourceRefArgs<TType extends string> {
7403
7017
  resourceId: string;
7404
7018
  documentId: string;
7405
7019
  type: TType;
@@ -7437,35 +7051,7 @@ export declare function retractStageGuards(args: StageGuardArgs): Promise<void>;
7437
7051
  * literal ownership values and are not widened by this map. The authored `"*"`
7438
7052
  * key lists universal fulfillers and is normalized before persistence.
7439
7053
  */
7440
- export declare type RoleAliases = v.InferOutput<typeof RoleAliasesSchema>;
7441
-
7442
- declare const RoleAliasesSchema: v.RecordSchema<
7443
- v.SchemaWithPipe<
7444
- readonly [
7445
- v.StringSchema<undefined>,
7446
- v.MinLengthAction<string, 1, "must be a non-empty string">,
7447
- ]
7448
- >,
7449
- v.SchemaWithPipe<
7450
- readonly [
7451
- v.ArraySchema<
7452
- v.SchemaWithPipe<
7453
- readonly [
7454
- v.StringSchema<undefined>,
7455
- v.MinLengthAction<string, 1, "must be a non-empty string">,
7456
- ]
7457
- >,
7458
- undefined
7459
- >,
7460
- v.MinLengthAction<
7461
- string[],
7462
- 1,
7463
- "a role alias must list at least one fulfilling role"
7464
- >,
7465
- ]
7466
- >,
7467
- undefined
7468
- >;
7054
+ export declare type RoleAliases = Record<string, string[]>;
7469
7055
 
7470
7056
  /** Whether two workflow resources address the same place. */
7471
7057
  export declare function sameResource(
@@ -7585,6 +7171,12 @@ export declare interface SiteConsequence {
7585
7171
  after: ConditionOutcome;
7586
7172
  }
7587
7173
 
7174
+ /** Pure resource-local dereferencing for held snapshot evaluation. */
7175
+ export declare function snapshotGuardDereference(args: {
7176
+ snapshot: HydratedSnapshot;
7177
+ resource: WorkflowResource;
7178
+ }): GuardDereference;
7179
+
7588
7180
  /** One statically invalid parent-to-child spawn contract found at deploy. */
7589
7181
  export declare type SpawnContractIssue =
7590
7182
  | {
@@ -7617,6 +7209,8 @@ export declare class SpawnContractsInvalidError extends WorkflowError<"spawn-con
7617
7209
  * own `editable` is the ceiling, ANDed with the stage value at runtime, so an
7618
7210
  * override can only NARROW — never open a field the baseline left closed. An
7619
7211
  * unlisted field inherits its baseline.
7212
+ *
7213
+ * @interface
7620
7214
  */
7621
7215
  export declare type Stage = StageFields<
7622
7216
  FieldEntry,
@@ -7663,7 +7257,7 @@ export declare interface StageEvaluation {
7663
7257
  autonomy: StageAutonomy;
7664
7258
  }
7665
7259
 
7666
- /** Type-mirror of {@link stageFields}, parameterised over field/activity/transition/guard/editable. */
7260
+ /** @inline */
7667
7261
  declare type StageFields<TField, TActivity, TTransition, TGuard, TEditable> = {
7668
7262
  name: string;
7669
7263
  semantics?: Semantic[] | undefined;
@@ -7677,7 +7271,7 @@ declare type StageFields<TField, TActivity, TTransition, TGuard, TEditable> = {
7677
7271
  editable?: Record<string, TEditable> | undefined;
7678
7272
  };
7679
7273
 
7680
- declare interface StageGuardArgs {
7274
+ export declare interface StageGuardArgs {
7681
7275
  client: WorkflowClient;
7682
7276
  clientForGdr: ClientForGdr;
7683
7277
  instance: WorkflowInstance;
@@ -7738,8 +7332,6 @@ export declare const START_FILTER_VARS: readonly {
7738
7332
  description: string;
7739
7333
  }[];
7740
7334
 
7741
- declare const START_KINDS: readonly ["interactive", "autonomous"];
7742
-
7743
7335
  /**
7744
7336
  * The vars a definition's start GROQ requirements read — the start-time readiness
7745
7337
  * dialect: everything the filter context binds ({@link START_FILTER_VARS})
@@ -7829,6 +7421,7 @@ export declare interface StartEvaluation {
7829
7421
  invalidInitialFields: InitialFieldIssue[];
7830
7422
  }
7831
7423
 
7424
+ /** @inline */
7832
7425
  declare type StartFields = {
7833
7426
  filter?: string | undefined;
7834
7427
  requirements?: StartRequirement[] | undefined;
@@ -7837,7 +7430,7 @@ declare type StartFields = {
7837
7430
  /**
7838
7431
  * Project caller-supplied `initialFields` into the `$fields` map the
7839
7432
  * start-requirement context binds: one key per declared `input`-sourced entry,
7840
- * resolved through {@link suppliedFieldFor} — the predicate can only ever see
7433
+ * resolved through the supplied-field lookup — the predicate can only ever see
7841
7434
  * a value the input resolution would persist, and an undeclared supplied name
7842
7435
  * never leaks in. Unsupplied (or null-supplied) entries stay unbound, so a
7843
7436
  * read of one is GROQ null. Document references bind as their GDR envelopes
@@ -7927,7 +7520,7 @@ export declare interface StartInstanceArgs {
7927
7520
  * path for every kind, and an interactive start of an autonomous workflow is
7928
7521
  * legal.
7929
7522
  */
7930
- export declare type StartKind = (typeof START_KINDS)[number];
7523
+ export declare type StartKind = "interactive" | "autonomous";
7931
7524
 
7932
7525
  /**
7933
7526
  * The declared {@link StartKind} of a definition, defaulting the absent
@@ -7954,325 +7547,108 @@ export declare function startKindOf(definition: {
7954
7547
  */
7955
7548
  export declare class StartNotAllowedError extends WorkflowError<"start-not-allowed"> {
7956
7549
  readonly definition: string;
7957
- readonly unmetRequirements: RequirementDescriptor[];
7958
- constructor(args: {
7959
- definition: string;
7960
- unmetRequirements: RequirementDescriptor[];
7961
- });
7962
- }
7963
-
7964
- /**
7965
- * Thrown when a start fails AFTER its create committed but BEFORE priming:
7966
- * the instance document exists, unprimed (see {@link isUnprimed}) — a
7967
- * genuinely failed start, but a RESUMABLE one. The error names the id so
7968
- * every surface's failure message can point at the retry rail: retrying
7969
- * `startInstance` with this `instanceId` finishes the start instead of
7970
- * creating a duplicate; aborting the instance discards it.
7971
- */
7972
- export declare class StartNotPrimedError extends WorkflowError<"start-not-primed"> {
7973
- readonly instanceId: string;
7974
- constructor(args: { instanceId: string; cause: unknown });
7975
- }
7976
-
7977
- /**
7978
- * Thrown when a start's first cascade fails AFTER the instance was created
7979
- * and primed: the run exists — stage entered, activities active, guards
7980
- * deployed — it just hasn't auto-advanced to a stable stage yet. Callers
7981
- * must not present this as a failed start: the workflow IS running, and a
7982
- * `tick` (or retrying `startInstance` with the same `instanceId`) resumes
7983
- * the settling.
7984
- */
7985
- export declare class StartNotSettledError extends WorkflowError<"start-not-settled"> {
7986
- readonly instanceId: string;
7987
- /** The primed instance re-read after the cascade failure — absent when
7988
- * that best-effort read also failed. */
7989
- readonly instance?: WorkflowInstance;
7990
- constructor(args: {
7991
- instanceId: string;
7992
- instance?: WorkflowInstance;
7993
- cause: unknown;
7994
- });
7995
- }
7996
-
7997
- /** Advisory only, per {@link isStartableDefinition} — a start surface has no parent context to give a spawn-only child, so it rejects fast with this message instead. */
7998
- export declare function startRefusal(definition: {
7999
- lifecycle?: WorkflowLifecycle | undefined;
8000
- }): string | undefined;
8001
-
8002
- /** Every named readiness requirement accepted by workflow `start.requirements`. */
8003
- export declare type StartRequirement =
8004
- | GroqRequirement
8005
- | SingleSubjectRequirement;
8006
-
8007
- export declare interface StartRequirementEvaluation extends RequirementDescriptor {
8008
- /** Whether this requirement is satisfied, unsatisfied, or not yet decidable. */
8009
- outcome: ConditionOutcome;
8010
- /** GROQ explanation; absent for non-GROQ requirement kinds. */
8011
- insight?: ConditionInsight | undefined;
8012
- }
8013
-
8014
- /**
8015
- * The caller-side half of the start contexts — everything the evaluating
8016
- * surface knows that the definition doesn't. Every member is optional
8017
- * because the surfaces genuinely differ (a pure consumer may hold no clock):
8018
- * An absent binding evaluates each read of it to GROQ null, and where that
8019
- * null lands decides the verdict — a predicate that can't decide without
8020
- * the binding fails closed, while a count-of-matches clause over values
8021
- * every row stores passes vacuously (in GROQ null equals only null, so the
8022
- * unbound read matches no stored value). The vars themselves are
8023
- * inventoried in `START_FILTER_VARS` / `START_REQUIREMENT_VARS`; the caller's
8024
- * `$fields` map is NOT scope — `start.filter` never binds it, and
8025
- * `explainStartRequirement` takes it as its own argument.
8026
- */
8027
- export declare interface StartScope {
8028
- /** The engine's tag partition — binds `$tag`. */
8029
- tag?: string | undefined;
8030
- /** ISO clock reading — binds `$now`. */
8031
- now?: string | undefined;
8032
- /** Resource-qualified identity of the prospective subject. Unlike a loaded
8033
- * document's bare `_id`, this stays collision-free across resources. */
8034
- subject?: GdrUri | undefined;
8035
- /**
8036
- * The engine-owned start slice, for predicates that read `*[...]` or for a
8037
- * `singleSubject` requirement — invoked lazily only when evaluation needs it.
8038
- * Each row exposes exactly `{definition, subject, completedAt}`; completed
8039
- * rows are included, so authors qualify in-flight
8040
- * themselves (`!defined(completedAt)`). Absent ⇒ a dataset-reading filter
8041
- * fails closed (this surface cannot see the dataset, so it cannot decide),
8042
- * while a dataset-reading requirement THROWS — see
8043
- * {@link explainStartRequirement}.
8044
- */
8045
- fetchDataset?: (() => Promise<unknown[]>) | undefined;
8046
- }
8047
-
8048
- export declare interface StartSliceRow {
8049
- definition: string;
8050
- subject: GdrUri | null;
8051
- completedAt: string | null;
8052
- }
8053
-
8054
- declare const StoredEditableSchema: v.UnionSchema<
8055
- [
8056
- v.LiteralSchema<true, undefined>,
8057
- v.SchemaWithPipe<
8058
- readonly [
8059
- v.StringSchema<undefined>,
8060
- v.MinLengthAction<string, 1, "must be a non-empty string">,
8061
- ]
8062
- >,
8063
- ],
8064
- undefined
8065
- >;
8066
-
8067
- /**
8068
- * The `field.*` subset — every mutation op EXCEPT `status.set`. Shared by the
8069
- * boundaries that write fields but must not set an activity status: a transition
8070
- * (its stage's activities are tearing down, so `status.set` has no coherent
8071
- * target) and an effect's completion (an effect is OUTSIDE the activity's own
8072
- * awaiting — it reports its result through fields, never by flipping a status;
8073
- * the activity/stage gate then reads those fields). The full {@link StoredOpSchema}
8074
- * (these plus `status.set`) is what actions and activity boundaries carry.
8075
- */
8076
- declare const StoredFieldOpSchema: v.VariantSchema<
8077
- "type",
8078
- [
8079
- v.StrictObjectSchema<
8080
- {
8081
- readonly type: v.LiteralSchema<"field.set", undefined>;
8082
- readonly target: v.StrictObjectSchema<
8083
- {
8084
- readonly scope: v.PicklistSchema<
8085
- readonly ["workflow", "stage", "activity"],
8086
- string
8087
- >;
8088
- readonly field: v.SchemaWithPipe<
8089
- readonly [
8090
- v.StringSchema<undefined>,
8091
- v.MinLengthAction<string, 1, "must be a non-empty string">,
8092
- ]
8093
- >;
8094
- },
8095
- undefined
8096
- >;
8097
- readonly value: v.GenericSchema<ValueExprInternal>;
8098
- },
8099
- undefined
8100
- >,
8101
- v.StrictObjectSchema<
8102
- {
8103
- readonly type: v.LiteralSchema<"field.setIfMissing", undefined>;
8104
- readonly target: v.StrictObjectSchema<
8105
- {
8106
- readonly scope: v.PicklistSchema<
8107
- readonly ["workflow", "stage", "activity"],
8108
- string
8109
- >;
8110
- readonly field: v.SchemaWithPipe<
8111
- readonly [
8112
- v.StringSchema<undefined>,
8113
- v.MinLengthAction<string, 1, "must be a non-empty string">,
8114
- ]
8115
- >;
8116
- },
8117
- undefined
8118
- >;
8119
- readonly value: v.GenericSchema<ValueExprInternal>;
8120
- },
8121
- undefined
8122
- >,
8123
- v.StrictObjectSchema<
8124
- {
8125
- readonly type: v.LiteralSchema<"field.unset", undefined>;
8126
- readonly target: v.StrictObjectSchema<
8127
- {
8128
- readonly scope: v.PicklistSchema<
8129
- readonly ["workflow", "stage", "activity"],
8130
- string
8131
- >;
8132
- readonly field: v.SchemaWithPipe<
8133
- readonly [
8134
- v.StringSchema<undefined>,
8135
- v.MinLengthAction<string, 1, "must be a non-empty string">,
8136
- ]
8137
- >;
8138
- },
8139
- undefined
8140
- >;
8141
- },
8142
- undefined
8143
- >,
8144
- v.StrictObjectSchema<
8145
- {
8146
- readonly type: v.LiteralSchema<"field.append", undefined>;
8147
- readonly target: v.StrictObjectSchema<
8148
- {
8149
- readonly scope: v.PicklistSchema<
8150
- readonly ["workflow", "stage", "activity"],
8151
- string
8152
- >;
8153
- readonly field: v.SchemaWithPipe<
8154
- readonly [
8155
- v.StringSchema<undefined>,
8156
- v.MinLengthAction<string, 1, "must be a non-empty string">,
8157
- ]
8158
- >;
8159
- },
8160
- undefined
8161
- >;
8162
- readonly value: v.GenericSchema<ValueExprInternal>;
8163
- },
8164
- undefined
8165
- >,
8166
- v.StrictObjectSchema<
8167
- {
8168
- readonly type: v.LiteralSchema<"field.inc", undefined>;
8169
- readonly target: v.StrictObjectSchema<
8170
- {
8171
- readonly scope: v.PicklistSchema<
8172
- readonly ["workflow", "stage", "activity"],
8173
- string
8174
- >;
8175
- readonly field: v.SchemaWithPipe<
8176
- readonly [
8177
- v.StringSchema<undefined>,
8178
- v.MinLengthAction<string, 1, "must be a non-empty string">,
8179
- ]
8180
- >;
8181
- },
8182
- undefined
8183
- >;
8184
- readonly value: v.OptionalSchema<
8185
- v.GenericSchema<ValueExprInternal>,
8186
- undefined
8187
- >;
8188
- },
8189
- undefined
8190
- >,
8191
- v.StrictObjectSchema<
8192
- {
8193
- readonly type: v.LiteralSchema<"field.dec", undefined>;
8194
- readonly target: v.StrictObjectSchema<
8195
- {
8196
- readonly scope: v.PicklistSchema<
8197
- readonly ["workflow", "stage", "activity"],
8198
- string
8199
- >;
8200
- readonly field: v.SchemaWithPipe<
8201
- readonly [
8202
- v.StringSchema<undefined>,
8203
- v.MinLengthAction<string, 1, "must be a non-empty string">,
8204
- ]
8205
- >;
8206
- },
8207
- undefined
8208
- >;
8209
- readonly value: v.OptionalSchema<
8210
- v.GenericSchema<ValueExprInternal>,
8211
- undefined
8212
- >;
8213
- },
8214
- undefined
8215
- >,
8216
- v.StrictObjectSchema<
8217
- {
8218
- readonly type: v.LiteralSchema<"field.updateWhere", undefined>;
8219
- readonly target: v.StrictObjectSchema<
8220
- {
8221
- readonly scope: v.PicklistSchema<
8222
- readonly ["workflow", "stage", "activity"],
8223
- string
8224
- >;
8225
- readonly field: v.SchemaWithPipe<
8226
- readonly [
8227
- v.StringSchema<undefined>,
8228
- v.MinLengthAction<string, 1, "must be a non-empty string">,
8229
- ]
8230
- >;
8231
- },
8232
- undefined
8233
- >;
8234
- readonly where: v.SchemaWithPipe<
8235
- readonly [
8236
- v.StringSchema<undefined>,
8237
- v.MinLengthAction<string, 1, "must be a non-empty string">,
8238
- ]
8239
- >;
8240
- readonly value: v.GenericSchema<ValueExprInternal>;
8241
- },
8242
- undefined
8243
- >,
8244
- v.StrictObjectSchema<
8245
- {
8246
- readonly type: v.LiteralSchema<"field.removeWhere", undefined>;
8247
- readonly target: v.StrictObjectSchema<
8248
- {
8249
- readonly scope: v.PicklistSchema<
8250
- readonly ["workflow", "stage", "activity"],
8251
- string
8252
- >;
8253
- readonly field: v.SchemaWithPipe<
8254
- readonly [
8255
- v.StringSchema<undefined>,
8256
- v.MinLengthAction<string, 1, "must be a non-empty string">,
8257
- ]
8258
- >;
8259
- },
8260
- undefined
8261
- >;
8262
- readonly where: v.SchemaWithPipe<
8263
- readonly [
8264
- v.StringSchema<undefined>,
8265
- v.MinLengthAction<string, 1, "must be a non-empty string">,
8266
- ]
8267
- >;
8268
- },
8269
- undefined
8270
- >,
8271
- ],
8272
- undefined
8273
- >;
7550
+ readonly unmetRequirements: RequirementDescriptor[];
7551
+ constructor(args: {
7552
+ definition: string;
7553
+ unmetRequirements: RequirementDescriptor[];
7554
+ });
7555
+ }
7556
+
7557
+ /**
7558
+ * Thrown when a start fails AFTER its create committed but BEFORE priming:
7559
+ * the instance document exists, unprimed (see {@link isUnprimed}) — a
7560
+ * genuinely failed start, but a RESUMABLE one. The error names the id so
7561
+ * every surface's failure message can point at the retry rail: retrying
7562
+ * `startInstance` with this `instanceId` finishes the start instead of
7563
+ * creating a duplicate; aborting the instance discards it.
7564
+ */
7565
+ export declare class StartNotPrimedError extends WorkflowError<"start-not-primed"> {
7566
+ readonly instanceId: string;
7567
+ constructor(args: { instanceId: string; cause: unknown });
7568
+ }
7569
+
7570
+ /**
7571
+ * Thrown when a start's first cascade fails AFTER the instance was created
7572
+ * and primed: the run exists — stage entered, activities active, guards
7573
+ * deployed — it just hasn't auto-advanced to a stable stage yet. Callers
7574
+ * must not present this as a failed start: the workflow IS running, and a
7575
+ * `tick` (or retrying `startInstance` with the same `instanceId`) resumes
7576
+ * the settling.
7577
+ */
7578
+ export declare class StartNotSettledError extends WorkflowError<"start-not-settled"> {
7579
+ readonly instanceId: string;
7580
+ /** The primed instance re-read after the cascade failure — absent when
7581
+ * that best-effort read also failed. */
7582
+ readonly instance?: WorkflowInstance;
7583
+ constructor(args: {
7584
+ instanceId: string;
7585
+ instance?: WorkflowInstance;
7586
+ cause: unknown;
7587
+ });
7588
+ }
7589
+
7590
+ /** Advisory only, per {@link isStartableDefinition} — a start surface has no parent context to give a spawn-only child, so it rejects fast with this message instead. */
7591
+ export declare function startRefusal(definition: {
7592
+ lifecycle?: WorkflowLifecycle | undefined;
7593
+ }): string | undefined;
7594
+
7595
+ /** Every named readiness requirement accepted by workflow `start.requirements`. */
7596
+ export declare type StartRequirement =
7597
+ | GroqRequirement
7598
+ | SingleSubjectRequirement;
7599
+
7600
+ export declare interface StartRequirementEvaluation extends RequirementDescriptor {
7601
+ /** Whether this requirement is satisfied, unsatisfied, or not yet decidable. */
7602
+ outcome: ConditionOutcome;
7603
+ /** GROQ explanation; absent for non-GROQ requirement kinds. */
7604
+ insight?: ConditionInsight | undefined;
7605
+ }
7606
+
7607
+ /**
7608
+ * The caller-side half of the start contexts — everything the evaluating
7609
+ * surface knows that the definition doesn't. Every member is optional
7610
+ * because the surfaces genuinely differ (a pure consumer may hold no clock):
7611
+ * An absent binding evaluates each read of it to GROQ null, and where that
7612
+ * null lands decides the verdict — a predicate that can't decide without
7613
+ * the binding fails closed, while a count-of-matches clause over values
7614
+ * every row stores passes vacuously (in GROQ null equals only null, so the
7615
+ * unbound read matches no stored value). The vars themselves are
7616
+ * inventoried in `START_FILTER_VARS` / `START_REQUIREMENT_VARS`; the caller's
7617
+ * `$fields` map is NOT scope — `start.filter` never binds it, and
7618
+ * `explainStartRequirement` takes it as its own argument.
7619
+ */
7620
+ export declare interface StartScope {
7621
+ /** The engine's tag partition — binds `$tag`. */
7622
+ tag?: string | undefined;
7623
+ /** ISO clock reading — binds `$now`. */
7624
+ now?: string | undefined;
7625
+ /** Resource-qualified identity of the prospective subject. Unlike a loaded
7626
+ * document's bare `_id`, this stays collision-free across resources. */
7627
+ subject?: GdrUri | undefined;
7628
+ /**
7629
+ * The engine-owned start slice, for predicates that read `*[...]` or for a
7630
+ * `singleSubject` requirement — invoked lazily only when evaluation needs it.
7631
+ * Each row exposes exactly `{definition, subject, completedAt}`; completed
7632
+ * rows are included, so authors qualify in-flight
7633
+ * themselves (`!defined(completedAt)`). Absent ⇒ a dataset-reading filter
7634
+ * fails closed (this surface cannot see the dataset, so it cannot decide),
7635
+ * while a dataset-reading requirement THROWS — see
7636
+ * {@link explainStartRequirement}.
7637
+ */
7638
+ fetchDataset?: (() => Promise<unknown[]>) | undefined;
7639
+ }
7640
+
7641
+ export declare interface StartSliceRow {
7642
+ definition: string;
7643
+ subject: GdrUri | null;
7644
+ completedAt: string | null;
7645
+ }
8274
7646
 
8275
- /** A field reference with `scope` already resolved — the form every op target carries. */
7647
+ /**
7648
+ * A field reference with `scope` already resolved — the form every op target carries.
7649
+ *
7650
+ * @interface
7651
+ */
8276
7652
  export declare type StoredFieldRef = v.InferOutput<typeof StoredFieldRefSchema>;
8277
7653
 
8278
7654
  declare const StoredFieldRefSchema: v.StrictObjectSchema<
@@ -8291,262 +7667,6 @@ declare const StoredFieldRefSchema: v.StrictObjectSchema<
8291
7667
  undefined
8292
7668
  >;
8293
7669
 
8294
- declare const StoredManualTargetSchema: v.VariantSchema<
8295
- "type",
8296
- [
8297
- v.StrictObjectSchema<
8298
- {
8299
- readonly type: v.LiteralSchema<"url", undefined>;
8300
- readonly url: v.SchemaWithPipe<
8301
- readonly [
8302
- v.StringSchema<undefined>,
8303
- v.UrlAction<string, "must be a valid URL">,
8304
- v.CheckAction<string, "must be an http(s) URL">,
8305
- ]
8306
- >;
8307
- },
8308
- undefined
8309
- >,
8310
- v.StrictObjectSchema<
8311
- {
8312
- readonly type: v.LiteralSchema<"field", undefined>;
8313
- readonly field: v.StrictObjectSchema<
8314
- {
8315
- readonly scope: v.PicklistSchema<
8316
- readonly ["workflow", "stage", "activity"],
8317
- string
8318
- >;
8319
- readonly field: v.SchemaWithPipe<
8320
- readonly [
8321
- v.StringSchema<undefined>,
8322
- v.MinLengthAction<string, 1, "must be a non-empty string">,
8323
- ]
8324
- >;
8325
- },
8326
- undefined
8327
- >;
8328
- },
8329
- undefined
8330
- >,
8331
- ],
8332
- undefined
8333
- >;
8334
-
8335
- declare const StoredOpSchema: v.VariantSchema<
8336
- "type",
8337
- [
8338
- v.StrictObjectSchema<
8339
- {
8340
- readonly type: v.LiteralSchema<"field.set", undefined>;
8341
- readonly target: v.StrictObjectSchema<
8342
- {
8343
- readonly scope: v.PicklistSchema<
8344
- readonly ["workflow", "stage", "activity"],
8345
- string
8346
- >;
8347
- readonly field: v.SchemaWithPipe<
8348
- readonly [
8349
- v.StringSchema<undefined>,
8350
- v.MinLengthAction<string, 1, "must be a non-empty string">,
8351
- ]
8352
- >;
8353
- },
8354
- undefined
8355
- >;
8356
- readonly value: v.GenericSchema<ValueExprInternal>;
8357
- },
8358
- undefined
8359
- >,
8360
- v.StrictObjectSchema<
8361
- {
8362
- readonly type: v.LiteralSchema<"field.setIfMissing", undefined>;
8363
- readonly target: v.StrictObjectSchema<
8364
- {
8365
- readonly scope: v.PicklistSchema<
8366
- readonly ["workflow", "stage", "activity"],
8367
- string
8368
- >;
8369
- readonly field: v.SchemaWithPipe<
8370
- readonly [
8371
- v.StringSchema<undefined>,
8372
- v.MinLengthAction<string, 1, "must be a non-empty string">,
8373
- ]
8374
- >;
8375
- },
8376
- undefined
8377
- >;
8378
- readonly value: v.GenericSchema<ValueExprInternal>;
8379
- },
8380
- undefined
8381
- >,
8382
- v.StrictObjectSchema<
8383
- {
8384
- readonly type: v.LiteralSchema<"field.unset", undefined>;
8385
- readonly target: v.StrictObjectSchema<
8386
- {
8387
- readonly scope: v.PicklistSchema<
8388
- readonly ["workflow", "stage", "activity"],
8389
- string
8390
- >;
8391
- readonly field: v.SchemaWithPipe<
8392
- readonly [
8393
- v.StringSchema<undefined>,
8394
- v.MinLengthAction<string, 1, "must be a non-empty string">,
8395
- ]
8396
- >;
8397
- },
8398
- undefined
8399
- >;
8400
- },
8401
- undefined
8402
- >,
8403
- v.StrictObjectSchema<
8404
- {
8405
- readonly type: v.LiteralSchema<"field.append", undefined>;
8406
- readonly target: v.StrictObjectSchema<
8407
- {
8408
- readonly scope: v.PicklistSchema<
8409
- readonly ["workflow", "stage", "activity"],
8410
- string
8411
- >;
8412
- readonly field: v.SchemaWithPipe<
8413
- readonly [
8414
- v.StringSchema<undefined>,
8415
- v.MinLengthAction<string, 1, "must be a non-empty string">,
8416
- ]
8417
- >;
8418
- },
8419
- undefined
8420
- >;
8421
- readonly value: v.GenericSchema<ValueExprInternal>;
8422
- },
8423
- undefined
8424
- >,
8425
- v.StrictObjectSchema<
8426
- {
8427
- readonly type: v.LiteralSchema<"field.inc", undefined>;
8428
- readonly target: v.StrictObjectSchema<
8429
- {
8430
- readonly scope: v.PicklistSchema<
8431
- readonly ["workflow", "stage", "activity"],
8432
- string
8433
- >;
8434
- readonly field: v.SchemaWithPipe<
8435
- readonly [
8436
- v.StringSchema<undefined>,
8437
- v.MinLengthAction<string, 1, "must be a non-empty string">,
8438
- ]
8439
- >;
8440
- },
8441
- undefined
8442
- >;
8443
- readonly value: v.OptionalSchema<
8444
- v.GenericSchema<ValueExprInternal>,
8445
- undefined
8446
- >;
8447
- },
8448
- undefined
8449
- >,
8450
- v.StrictObjectSchema<
8451
- {
8452
- readonly type: v.LiteralSchema<"field.dec", undefined>;
8453
- readonly target: v.StrictObjectSchema<
8454
- {
8455
- readonly scope: v.PicklistSchema<
8456
- readonly ["workflow", "stage", "activity"],
8457
- string
8458
- >;
8459
- readonly field: v.SchemaWithPipe<
8460
- readonly [
8461
- v.StringSchema<undefined>,
8462
- v.MinLengthAction<string, 1, "must be a non-empty string">,
8463
- ]
8464
- >;
8465
- },
8466
- undefined
8467
- >;
8468
- readonly value: v.OptionalSchema<
8469
- v.GenericSchema<ValueExprInternal>,
8470
- undefined
8471
- >;
8472
- },
8473
- undefined
8474
- >,
8475
- v.StrictObjectSchema<
8476
- {
8477
- readonly type: v.LiteralSchema<"field.updateWhere", undefined>;
8478
- readonly target: v.StrictObjectSchema<
8479
- {
8480
- readonly scope: v.PicklistSchema<
8481
- readonly ["workflow", "stage", "activity"],
8482
- string
8483
- >;
8484
- readonly field: v.SchemaWithPipe<
8485
- readonly [
8486
- v.StringSchema<undefined>,
8487
- v.MinLengthAction<string, 1, "must be a non-empty string">,
8488
- ]
8489
- >;
8490
- },
8491
- undefined
8492
- >;
8493
- readonly where: v.SchemaWithPipe<
8494
- readonly [
8495
- v.StringSchema<undefined>,
8496
- v.MinLengthAction<string, 1, "must be a non-empty string">,
8497
- ]
8498
- >;
8499
- readonly value: v.GenericSchema<ValueExprInternal>;
8500
- },
8501
- undefined
8502
- >,
8503
- v.StrictObjectSchema<
8504
- {
8505
- readonly type: v.LiteralSchema<"field.removeWhere", undefined>;
8506
- readonly target: v.StrictObjectSchema<
8507
- {
8508
- readonly scope: v.PicklistSchema<
8509
- readonly ["workflow", "stage", "activity"],
8510
- string
8511
- >;
8512
- readonly field: v.SchemaWithPipe<
8513
- readonly [
8514
- v.StringSchema<undefined>,
8515
- v.MinLengthAction<string, 1, "must be a non-empty string">,
8516
- ]
8517
- >;
8518
- },
8519
- undefined
8520
- >;
8521
- readonly where: v.SchemaWithPipe<
8522
- readonly [
8523
- v.StringSchema<undefined>,
8524
- v.MinLengthAction<string, 1, "must be a non-empty string">,
8525
- ]
8526
- >;
8527
- },
8528
- undefined
8529
- >,
8530
- v.StrictObjectSchema<
8531
- {
8532
- readonly type: v.LiteralSchema<"status.set", undefined>;
8533
- readonly activity: v.SchemaWithPipe<
8534
- readonly [
8535
- v.StringSchema<undefined>,
8536
- v.MinLengthAction<string, 1, "must be a non-empty string">,
8537
- ]
8538
- >;
8539
- readonly status: v.PicklistSchema<
8540
- readonly ["active", "done", "skipped", "failed"],
8541
- string
8542
- >;
8543
- },
8544
- undefined
8545
- >,
8546
- ],
8547
- undefined
8548
- >;
8549
-
8550
7670
  export declare function stripSystemFields(
8551
7671
  doc: Record<string, unknown>,
8552
7672
  ): Record<string, unknown>;
@@ -8610,7 +7730,7 @@ export declare interface SubjectPermissionDenial {
8610
7730
  permission: DocumentValuePermission;
8611
7731
  }
8612
7732
 
8613
- declare interface SubjectResourceAccess {
7733
+ export declare interface SubjectResourceAccess {
8614
7734
  grants: Grant[];
8615
7735
  /** The actor's principal id in this resource's own namespace: per-project user id for a dataset resource, account-global id for an org-level one. */
8616
7736
  actorId: string;
@@ -8731,6 +7851,8 @@ export declare interface SubworkflowEntry {
8731
7851
  * (default) lets them run to completion, `'abort'` kills them recursively —
8732
7852
  * always an authored choice, never automatic. Whether the PARENT may move at
8733
7853
  * all is a separate gate over `$subworkflows`.
7854
+ *
7855
+ * @interface
8734
7856
  */
8735
7857
  export declare type Subworkflows = v.InferOutput<typeof SubworkflowsSchema>;
8736
7858
 
@@ -8862,13 +7984,15 @@ export declare const SYSTEM_IDENTITY = "<system>";
8862
7984
  export declare function tagScopeFilter(): string;
8863
7985
 
8864
7986
  /**
8865
- * Internal telemetry-injection seam for the raw `workflow.*` verbs — the
8866
- * telemetry twin of the `Clocked` seam in `clock.ts`, deliberately not
8867
- * re-exported from the package root. Production injects a logger ONCE via
8868
- * `createEngine({ telemetry })`; a raw-namespace caller that omits it
8869
- * emits nothing (the verbs default to {@link noopTelemetry}).
7987
+ * Optional telemetry-injection field on the raw `workflow.*` verbs — the
7988
+ * telemetry twin of the `Clocked` seam in `clock.ts`. It is exported
7989
+ * because those verbs expose this composition helper in their public
7990
+ * signatures, but production normally injects a logger once via
7991
+ * `createEngine({ telemetry })`, not as an everyday per-call option. A
7992
+ * raw-namespace caller that omits it emits nothing (the verbs default to
7993
+ * {@link noopTelemetry}).
8870
7994
  */
8871
- declare type Telemetered<T> = T & {
7995
+ export declare type Telemetered<T> = T & {
8872
7996
  telemetry?: WorkflowTelemetryLogger;
8873
7997
  };
8874
7998
 
@@ -8914,14 +8038,7 @@ export declare interface TelemetryIntakeClient {
8914
8038
  * `$allActivitiesDone` — a `failed` activity blocks it permanently, surfacing
8915
8039
  * via `$anyActivityFailed`.
8916
8040
  */
8917
- declare const TERMINAL_ACTIVITY_STATUSES: readonly [
8918
- "done",
8919
- "skipped",
8920
- "failed",
8921
- ];
8922
-
8923
- export declare type TerminalActivityStatus =
8924
- (typeof TERMINAL_ACTIVITY_STATUSES)[number];
8041
+ export declare type TerminalActivityStatus = "done" | "skipped" | "failed";
8925
8042
 
8926
8043
  /** See {@link terminalState}. */
8927
8044
  export declare type TerminalState = "aborted" | "completed" | "in-flight";
@@ -8944,8 +8061,7 @@ export declare function terminalState(
8944
8061
  */
8945
8062
  export declare function toBareId(id: string): string;
8946
8063
 
8947
- /** Ad-hoc, status-tracked work items: sugar over `array of object {label, status, assignee?, dueDate?}`; a plain checklist is that with `{label, status}` alone.
8948
- * Its `dueDate` is a `date` column named `dueDate`, not the elevated `dueDate` kind, which reserves one deadline slot per level. Never a stored kind. */
8064
+ /** @inline */
8949
8065
  declare type TodoListField = FieldBase<AuthoringEditable, GroupMembership> & {
8950
8066
  type: "todoList";
8951
8067
  };
@@ -8963,7 +8079,8 @@ export declare interface TodoListItem {
8963
8079
  _key: string;
8964
8080
  label: string;
8965
8081
  status?: string | null;
8966
- assignee?: Assignee | null;
8082
+ /** Singular assignment slot: any number of routing roles and at most one user. */
8083
+ assignee?: Assignee[];
8967
8084
  dueDate?: string | null;
8968
8085
  }
8969
8086
 
@@ -9004,8 +8121,7 @@ export declare interface TransitionEvaluation {
9004
8121
  insight: ConditionInsight;
9005
8122
  }
9006
8123
 
9007
- /** Type-mirror of {@link transitionFields} minus `when` — stored requires it,
9008
- * authoring omits it (desugar fills the default), so each variant declares it. */
8124
+ /** @inline */
9009
8125
  declare type TransitionFields = {
9010
8126
  name: string;
9011
8127
  title?: string | undefined;
@@ -9095,7 +8211,7 @@ export declare function validateDefinition(
9095
8211
 
9096
8212
  export declare function validateTag(tag: string): void;
9097
8213
 
9098
- declare interface ValidationIssue {
8214
+ export declare interface ValidationIssue {
9099
8215
  path: ReadonlyArray<PropertyKey>;
9100
8216
  message: string;
9101
8217
  }
@@ -9108,6 +8224,7 @@ declare interface ValidationIssue {
9108
8224
  */
9109
8225
  export declare type ValueExpr = ValueExprInternal;
9110
8226
 
8227
+ /** @inline */
9111
8228
  declare type ValueExprInternal =
9112
8229
  | LiteralExpr
9113
8230
  | FieldReadExpr
@@ -9226,9 +8343,8 @@ export declare const workflow: {
9226
8343
  /**
9227
8344
  * Remove a deployed definition (all versions, or one via `version`). Refuses
9228
8345
  * while non-terminal instances exist unless `cascade` aborts them first —
9229
- * instances are never deleted, only aborted in place; see
9230
- * {@link deleteDefinitionInternal} for the full contract (spawn-referrer
9231
- * check, guard-doc housekeeping).
8346
+ * instances are never deleted, only aborted in place. The operation also
8347
+ * checks spawn referrers and cleans up guard documents.
9232
8348
  */
9233
8349
  deleteDefinition: (
9234
8350
  rawArgs: Clocked<Telemetered<DeleteDefinitionArgs & EngineScopeArgs>>,
@@ -9345,8 +8461,8 @@ export declare const workflow: {
9345
8461
  ) => Promise<OperationResult>;
9346
8462
  /**
9347
8463
  * Admin override — hard-stop an in-flight instance where it stands. No stage
9348
- * move, no transition effects, pending effects cancelled; see
9349
- * {@link abortAndPropagate} for the abort + ancestor-propagation contract.
8464
+ * move, no transition effects, pending effects cancelled. The abort
8465
+ * propagates through affected ancestor instances.
9350
8466
  * Propagated, not cascaded — the instance is terminal, so `cascaded` is
9351
8467
  * always `0` and ancestor movement is reported on the ancestors, not here.
9352
8468
  * `changed: false` means the instance was already terminal.
@@ -9535,8 +8651,6 @@ export declare const WORKFLOW_DEFINITION_TYPE = "sanity.workflow.definition";
9535
8651
  */
9536
8652
  export declare const WORKFLOW_INSTANCE_TYPE = "sanity.workflow.instance";
9537
8653
 
9538
- declare const WORKFLOW_LIFECYCLES: readonly ["standalone", "child"];
9539
-
9540
8654
  /**
9541
8655
  * The engine's view of "who am I, what can I do?". `actor` is who
9542
8656
  * the engine stamps onto history / `completedBy` / `ValueExpr.actor` —
@@ -9776,6 +8890,8 @@ export declare interface WorkflowCommitOptions {
9776
8890
  * logger unconditionally (CI and `DO_NOT_TRACK` included), and consent,
9777
8891
  * environment suppression, and transport become this implementation's
9778
8892
  * business.
8893
+ *
8894
+ * @interface
9779
8895
  */
9780
8896
  export declare type WorkflowConfig = v.InferOutput<typeof WorkflowConfigSchema>;
9781
8897
 
@@ -10428,6 +9544,8 @@ declare const WorkflowConfigSchema: v.ObjectSchema<
10428
9544
  * conditions — each `name: groq` entry is pre-evaluated and bound as the
10429
9545
  * boolean `$name` var; redefining a built-in var is a deploy error, never a
10430
9546
  * silent shadow.
9547
+ *
9548
+ * @interface
10431
9549
  */
10432
9550
  export declare type WorkflowDefinition = v.InferOutput<
10433
9551
  typeof WorkflowDefinitionSchema
@@ -10483,7 +9601,7 @@ export declare interface WorkflowDefinitionDeployedData {
10483
9601
  * fetch results are typed (`Record<string, unknown>`), which pass through to
10484
9602
  * the runtime boundary parse. Everything precisely typed gets the exact
10485
9603
  * {@link WorkflowDefinition} contract: beyond the document envelope
10486
- * ({@link DocumentEnvelopeKey}, so a typed {@link DeployedDefinition} passes
9604
+ * (the closed system-key union, so a typed {@link DeployedDefinition} passes
10487
9605
  * castless), unknown keys are `never` — a typo'd literal is a compile error,
10488
9606
  * never a silent collapse to the record arm.
10489
9607
  */
@@ -10603,6 +9721,7 @@ export declare type WorkflowErrorKind =
10603
9721
  | "partial-guard-deploy"
10604
9722
  | "start-not-primed"
10605
9723
  | "start-not-settled"
9724
+ | "concurrent-cascade"
10606
9725
  | "concurrent-fire-action"
10607
9726
  | "concurrent-edit-field"
10608
9727
  | "concurrent-complete-effect"
@@ -10630,7 +9749,7 @@ export declare interface WorkflowEvaluation {
10630
9749
  semantics?: Semantic[] | undefined;
10631
9750
  actor: Actor;
10632
9751
  currentStage: StageEvaluation;
10633
- /** Active activities whose assignees-kind field entry matches the actor. */
9752
+ /** Active activities whose singular or plural assignment entry matches the actor. */
10634
9753
  pendingOnYou: ActivityEvaluation[];
10635
9754
  /** True if at least one action on any active activity is allowed. */
10636
9755
  canInteract: boolean;
@@ -10656,6 +9775,14 @@ export declare interface WorkflowEvaluation {
10656
9775
  * evaluation time, so their legs report `conditional`.
10657
9776
  */
10658
9777
  autonomy: WorkflowAutonomy;
9778
+ /**
9779
+ * The nearest future instant (ISO 8601) at which the clock alone changes this
9780
+ * projection; re-evaluate then. Includes a gate reading `$now` beside
9781
+ * `$actor`, `$assigned`, `$can`, or `$attributes`, evaluated in this actor's
9782
+ * scopes. Derived per call, never persisted. Absent on a terminal instance
9783
+ * and when no site yields a boundary from those scopes.
9784
+ */
9785
+ nextEvaluationAt?: string;
10659
9786
  }
10660
9787
 
10661
9788
  export declare interface WorkflowFetchOptions {
@@ -10683,7 +9810,7 @@ export declare interface WorkflowFieldEditedData extends InstanceScopedEventData
10683
9810
  mode: EditMode;
10684
9811
  }
10685
9812
 
10686
- /** Type-mirror of {@link workflowFields}, parameterised over field/stage/start. */
9813
+ /** @inline */
10687
9814
  declare type WorkflowFields<TField, TStage, TStart> = {
10688
9815
  name: string;
10689
9816
  semantics?: Semantic[] | undefined;
@@ -10906,7 +10033,7 @@ export declare interface WorkflowInstanceTickedData extends InstanceScopedEventD
10906
10033
  /** How instances of a definition come to exist: started standalone (the
10907
10034
  * default) or spawned by a parent. `'child'` is spawn-only — see
10908
10035
  * {@link isStartableDefinition}. */
10909
- export declare type WorkflowLifecycle = (typeof WORKFLOW_LIFECYCLES)[number];
10036
+ export declare type WorkflowLifecycle = "standalone" | "child";
10910
10037
 
10911
10038
  /**
10912
10039
  * The subset of `@sanity/client` the engine actually needs. The