@fluidgrids/workflows 2026.1028.2 → 2026.1029.1

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.
Files changed (118) hide show
  1. package/README.md +72 -10
  2. package/dist/{activation-DnhG7SmF.d.ts → activation-BnVQMv9y.d.ts} +1 -1
  3. package/dist/{activation-BBh1p82z.d.cts → activation-CESehfYi.d.cts} +1 -1
  4. package/dist/{chunk-XHXIDVEC.js → chunk-25BKWR2O.js} +1 -1
  5. package/dist/{chunk-UK3WM7YZ.cjs → chunk-2B37XAFQ.cjs} +44 -8
  6. package/dist/{chunk-DJYMDLV5.js → chunk-2DDULZFM.js} +93 -1
  7. package/dist/{chunk-623FVQSN.cjs → chunk-3FIDHONL.cjs} +104 -0
  8. package/dist/chunk-6QPOJZT6.cjs +1180 -0
  9. package/dist/chunk-7ILGCUI6.js +154 -0
  10. package/dist/chunk-A2OHX3UQ.js +1156 -0
  11. package/dist/{chunk-VOKMAAJP.js → chunk-A36CCOWS.js} +188 -19
  12. package/dist/{chunk-FMSW2HDF.cjs → chunk-ELL2RBML.cjs} +0 -14
  13. package/dist/{chunk-JD2VQIDZ.cjs → chunk-EWYADREB.cjs} +2 -2
  14. package/dist/{chunk-HWJZVOG7.js → chunk-FQSJI5NV.js} +1 -1
  15. package/dist/{chunk-ABFZWYHT.js → chunk-FWBRQWRX.js} +156 -48
  16. package/dist/{chunk-PZCVF76Q.cjs → chunk-I47EENR4.cjs} +209 -40
  17. package/dist/chunk-J3PYFGKA.cjs +166 -0
  18. package/dist/{chunk-C5OLWZ42.js → chunk-KXJDRQ6G.js} +1 -13
  19. package/dist/chunk-M272AHEX.js +25 -0
  20. package/dist/{chunk-VRHHBPT6.js → chunk-MJ5TGYVG.js} +333 -65
  21. package/dist/{chunk-SAOBPYYJ.cjs → chunk-NXFBVDOI.cjs} +3 -3
  22. package/dist/{chunk-XKJA7KX3.js → chunk-OIX4O6UR.js} +38 -2
  23. package/dist/{chunk-FEW3JBYA.cjs → chunk-OKX3FYIM.cjs} +3 -3
  24. package/dist/{chunk-M4BBAERY.cjs → chunk-OMY3CKUZ.cjs} +404 -136
  25. package/dist/chunk-PWIUEWC3.js +81 -0
  26. package/dist/chunk-Q4MWQNJK.cjs +28 -0
  27. package/dist/{chunk-P6TA5EZT.cjs → chunk-RUQIMTN5.cjs} +171 -57
  28. package/dist/{chunk-IISBRUWJ.js → chunk-WXXNCHUY.js} +1 -1
  29. package/dist/chunk-YHBVMOMK.cjs +87 -0
  30. package/dist/codegen/index.d.cts +2 -2
  31. package/dist/codegen/index.d.ts +2 -2
  32. package/dist/collect-BTHjQaSp.d.ts +86 -0
  33. package/dist/collect-CSyOg5XC.d.cts +86 -0
  34. package/dist/{file-BOoHZgoQ.d.cts → file-cgL9l9l8.d.cts} +765 -14
  35. package/dist/{file-yuPCFU5b.d.ts → file-olQudcx5.d.ts} +765 -14
  36. package/dist/history/index.cjs +198 -86
  37. package/dist/history/index.d.cts +49 -10
  38. package/dist/history/index.d.ts +49 -10
  39. package/dist/history/index.js +49 -4
  40. package/dist/index.cjs +64 -51
  41. package/dist/index.d.cts +9 -53
  42. package/dist/index.d.ts +9 -53
  43. package/dist/index.js +5 -4
  44. package/dist/ir/index.cjs +24 -3
  45. package/dist/ir/index.d.cts +43 -4
  46. package/dist/ir/index.d.ts +43 -4
  47. package/dist/ir/index.js +24 -3
  48. package/dist/{lower-BzmUz0sq.d.cts → lower-3S6PsqjJ.d.cts} +40 -6
  49. package/dist/{lower-_-iT4HYs.d.ts → lower-DmZpQ8hJ.d.ts} +40 -6
  50. package/dist/{manifest-C8N6HDYl.d.ts → manifest-BJjrQt77.d.ts} +1 -1
  51. package/dist/{manifest-0OLw0i7k.d.cts → manifest-gRI2Q5Fj.d.cts} +1 -1
  52. package/dist/node-evaluator-SOADN23V.js +14 -0
  53. package/dist/node-evaluator-YGDEXK4U.cjs +24 -0
  54. package/dist/quickjs/index.cjs +25 -24
  55. package/dist/quickjs/index.d.cts +6 -6
  56. package/dist/quickjs/index.d.ts +6 -6
  57. package/dist/quickjs/index.js +8 -7
  58. package/dist/roundtrip/index.cjs +245 -43
  59. package/dist/roundtrip/index.d.cts +86 -9
  60. package/dist/roundtrip/index.d.ts +86 -9
  61. package/dist/roundtrip/index.js +172 -8
  62. package/dist/runtime/index.cjs +21 -20
  63. package/dist/runtime/index.d.cts +49 -7
  64. package/dist/runtime/index.d.ts +49 -7
  65. package/dist/runtime/index.js +8 -7
  66. package/dist/testing/index.cjs +514 -74
  67. package/dist/testing/index.d.cts +127 -10
  68. package/dist/testing/index.d.ts +127 -10
  69. package/dist/testing/index.js +480 -42
  70. package/dist/{types-BGoPzgcl.d.ts → types-Bb2wRnJ5.d.cts} +20 -1
  71. package/dist/{types-BGoPzgcl.d.cts → types-Bb2wRnJ5.d.ts} +20 -1
  72. package/dist/{types-DV-HX_Gt.d.ts → types-CQKOhPTa.d.cts} +122 -14
  73. package/dist/{types-CpBBjaGX.d.cts → types-CnIOinoz.d.ts} +122 -14
  74. package/dist/{workflow-Bpr3vnA_.d.ts → workflow-8uRU9rhL.d.ts} +2 -2
  75. package/dist/{workflow-FXUkpIBc.d.cts → workflow-CZOXUlQ5.d.cts} +2 -2
  76. package/dist/{workflow-C2a05WUJ.d.ts → workflow-DWTPHFbt.d.ts} +124 -12
  77. package/dist/{workflow-J-yYixny.d.cts → workflow-O6e64ZcG.d.cts} +124 -12
  78. package/fixtures/histories/auto-upgrade-patched.history.json +276 -0
  79. package/fixtures/histories/benign-failure.history.json +146 -0
  80. package/fixtures/histories/cancel-activity-try-cancel.history.json +150 -0
  81. package/fixtures/histories/child-cancel-wait-requested.history.json +217 -0
  82. package/fixtures/histories/child-options-roundtrip.history.json +192 -0
  83. package/fixtures/histories/continue-as-new-last-result.history.json +86 -0
  84. package/fixtures/histories/continue-as-new-options.history.json +99 -0
  85. package/fixtures/histories/continue-as-new-r1-long-task-queue.history.json +78 -0
  86. package/fixtures/histories/continue-as-new-r1-retry-options.history.json +83 -0
  87. package/fixtures/histories/execution-timeout-chain.history.json +98 -0
  88. package/fixtures/histories/external-cancel-resolved.history.json +123 -0
  89. package/fixtures/histories/external-cancel-unknown-target.history.json +127 -0
  90. package/fixtures/histories/failure-error-types-fails-run.history.json +144 -0
  91. package/fixtures/histories/handler-drain-warn.history.json +222 -0
  92. package/fixtures/histories/heartbeat-details-on-retry.history.json +145 -0
  93. package/fixtures/histories/local-activity-abandoned-at-completion.history.json +73 -0
  94. package/fixtures/histories/local-activity-cancelled-in-scope.history.json +118 -0
  95. package/fixtures/histories/local-activity-completed.history.json +157 -0
  96. package/fixtures/histories/local-activity-failed.history.json +93 -0
  97. package/fixtures/histories/local-activity-retry-in-task.history.json +88 -0
  98. package/fixtures/histories/run-retry-last-failure.history.json +90 -0
  99. package/fixtures/histories/run-timeout.history.json +159 -0
  100. package/fixtures/histories/schedule-to-start-timeout.history.json +132 -0
  101. package/fixtures/histories/start-delay-signal-ends-delay.history.json +155 -0
  102. package/fixtures/histories/typeerror-task-retry-100.history.json +137 -0
  103. package/package.json +1 -1
  104. package/schema/history-file.schema.json +283 -2
  105. package/schema/ir-v2.schema.json +45 -0
  106. package/schema/run-event.schema.json +264 -2
  107. package/schema/workflow-command.schema.json +178 -1
  108. package/schema/workflow-task.schema.json +392 -4
  109. package/dist/assemble-BLqQ8lSu.d.cts +0 -39
  110. package/dist/assemble-DWgaXHd-.d.ts +0 -39
  111. package/dist/chunk-2J6TF7YI.cjs +0 -86
  112. package/dist/chunk-BO6OVILK.js +0 -79
  113. package/dist/chunk-DHTLALBL.cjs +0 -80
  114. package/dist/chunk-I5LR3D2K.js +0 -869
  115. package/dist/chunk-N23SKIG4.js +0 -73
  116. package/dist/chunk-QQ6ULXHI.cjs +0 -885
  117. package/dist/node-evaluator-4MSDKWOG.cjs +0 -22
  118. package/dist/node-evaluator-SX4LEYQC.js +0 -12
@@ -1,5 +1,5 @@
1
- import { E as ErrorType, a as Json, J as JsonObject } from './types-BGoPzgcl.cjs';
2
- import { d as BuiltInQueryName, m as CommandType, W as WorkflowCommand, F as Failure, P as ParentClosePolicy, T as RunEventDraft, a as WorkflowTaskFailureCause, U as RunEventRecord, v as HISTORY_PROTOCOL, a6 as WorkflowInfoSnapshot, a8 as WorkflowTaskResult } from './types-CpBBjaGX.cjs';
1
+ import { E as ErrorType, J as Json, a as JsonObject } from './types-Bb2wRnJ5.cjs';
2
+ import { e as BuiltInQueryName, W as WorkflowCommand, n as CommandType, F as Failure, P as ParentClosePolicy, Y as RunEventDraft, a as WorkflowTaskFailureCause, Z as RunEventRecord, w as HISTORY_PROTOCOL, ai as WorkflowInfoSnapshot, ak as WorkflowTaskResult } from './types-CQKOhPTa.cjs';
3
3
 
4
4
  declare const RUN_EVENT_SCHEMA_ID = "https://docs.fluidgrids.ai/schemas/run-event.schema.json";
5
5
  declare const WORKFLOW_COMMAND_SCHEMA_ID = "https://docs.fluidgrids.ai/schemas/workflow-command.schema.json";
@@ -123,6 +123,7 @@ declare const RUN_EVENT_SCHEMA: {
123
123
  }, {
124
124
  readonly type: "object";
125
125
  readonly required: readonly ["workflowKey", "workflowId"];
126
+ readonly description: "The open run of a workflow id, following its continue-as-new chain; firstRunId pins the chain (R2).";
126
127
  readonly properties: {
127
128
  readonly workflowKey: {
128
129
  readonly type: "string";
@@ -134,10 +135,70 @@ declare const RUN_EVENT_SCHEMA: {
134
135
  readonly minLength: 1;
135
136
  readonly maxLength: 256;
136
137
  };
138
+ readonly firstRunId: {
139
+ readonly type: "string";
140
+ readonly minLength: 1;
141
+ readonly maxLength: 256;
142
+ };
137
143
  };
138
144
  readonly additionalProperties: false;
139
145
  }];
140
146
  };
147
+ readonly runRetryPolicy: {
148
+ readonly type: "object";
149
+ readonly required: readonly ["initialDelayMs"];
150
+ readonly description: "Run-level retry (11 §2.17), in milliseconds. maxAttempts counts every attempt; absent means unlimited, bounded by the execution timeout.";
151
+ readonly properties: {
152
+ readonly maxAttempts: {
153
+ readonly type: "integer";
154
+ readonly minimum: 1;
155
+ };
156
+ readonly initialDelayMs: {
157
+ readonly type: "integer";
158
+ readonly minimum: 0;
159
+ };
160
+ readonly backoffMultiplier: {
161
+ readonly type: "number";
162
+ readonly minimum: 1;
163
+ };
164
+ readonly maxDelayMs: {
165
+ readonly type: "integer";
166
+ readonly minimum: 0;
167
+ };
168
+ readonly retryOnErrorTypes: {
169
+ readonly type: "array";
170
+ readonly items: {
171
+ readonly enum: readonly ErrorType[];
172
+ };
173
+ };
174
+ readonly nonRetryableErrorTypes: {
175
+ readonly type: "array";
176
+ readonly items: {
177
+ readonly type: "string";
178
+ };
179
+ };
180
+ };
181
+ readonly additionalProperties: false;
182
+ };
183
+ readonly timeouts: {
184
+ readonly type: "object";
185
+ readonly description: "The three workflow timeouts (11 §2.20), in milliseconds.";
186
+ readonly properties: {
187
+ readonly executionTimeout: {
188
+ readonly type: "integer";
189
+ readonly minimum: 0;
190
+ };
191
+ readonly runTimeout: {
192
+ readonly type: "integer";
193
+ readonly minimum: 0;
194
+ };
195
+ readonly workflowTaskTimeout: {
196
+ readonly type: "integer";
197
+ readonly minimum: 0;
198
+ };
199
+ };
200
+ readonly additionalProperties: false;
201
+ };
141
202
  readonly childOptions: {
142
203
  readonly type: "object";
143
204
  readonly required: readonly ["parentClosePolicy"];
@@ -189,8 +250,81 @@ declare const RUN_EVENT_SCHEMA: {
189
250
  readonly type: "integer";
190
251
  readonly minimum: 0;
191
252
  };
253
+ readonly retry: {
254
+ readonly $ref: "#/$defs/runRetryPolicy";
255
+ };
256
+ readonly versioningBehavior: {
257
+ readonly enum: readonly ["PINNED", "AUTO_UPGRADE"];
258
+ };
259
+ readonly idReusePolicy: {
260
+ readonly enum: readonly ["ALLOW_DUPLICATE", "ALLOW_DUPLICATE_FAILED_ONLY", "REJECT_DUPLICATE"];
261
+ };
262
+ readonly idConflictPolicy: {
263
+ readonly enum: readonly ["FAIL", "USE_EXISTING", "TERMINATE_EXISTING"];
264
+ };
192
265
  };
193
266
  };
267
+ readonly legacyCanRetryPolicy: {
268
+ readonly type: "object";
269
+ readonly required: readonly ["retryDelay"];
270
+ readonly description: "The R1 activity-shaped CONTINUE_AS_NEW retry: whatever explicitRetryPolicy wrote from a Partial<RetryPolicy>, so numbers carry no integer or minimum constraint. It never had a meaning, and the service ignores it.";
271
+ readonly properties: {
272
+ readonly maxRetries: {
273
+ readonly type: "number";
274
+ };
275
+ readonly retryDelay: {
276
+ readonly type: "number";
277
+ };
278
+ readonly backoffMultiplier: {
279
+ readonly type: "number";
280
+ };
281
+ readonly maxDelay: {
282
+ readonly type: "number";
283
+ };
284
+ readonly retryOnErrorTypes: {
285
+ readonly type: "array";
286
+ readonly items: {
287
+ readonly type: "string";
288
+ };
289
+ };
290
+ readonly nonRetryableErrorTypes: {
291
+ readonly type: "array";
292
+ readonly items: {
293
+ readonly type: "string";
294
+ };
295
+ };
296
+ };
297
+ readonly additionalProperties: false;
298
+ };
299
+ readonly canOptions: {
300
+ readonly type: "object";
301
+ readonly description: "Options of a CONTINUE_AS_NEW command (C-SCHEMA, frozen in R2). retry is the R2 run-retry policy of the new run, or the R1 activity shape (retryDelay, maxRetries, maxDelay) that R1 bundles wrote and R2 bundles still write for that shape: it never had a meaning, and the service ignores it instead of reading it as a run-retry policy.";
302
+ readonly properties: {
303
+ readonly taskQueue: {
304
+ readonly type: "string";
305
+ readonly minLength: 1;
306
+ readonly maxLength: 256;
307
+ };
308
+ readonly retry: {
309
+ readonly oneOf: readonly [{
310
+ readonly $ref: "#/$defs/runRetryPolicy";
311
+ }, {
312
+ readonly $ref: "#/$defs/legacyCanRetryPolicy";
313
+ }];
314
+ };
315
+ readonly workflowTaskTimeout: {
316
+ readonly type: "integer";
317
+ readonly minimum: 0;
318
+ };
319
+ readonly context: {
320
+ readonly type: "object";
321
+ };
322
+ readonly versioningBehavior: {
323
+ readonly enum: readonly ["PINNED", "AUTO_UPGRADE"];
324
+ };
325
+ };
326
+ readonly additionalProperties: false;
327
+ };
194
328
  readonly headers: {
195
329
  readonly type: "object";
196
330
  readonly additionalProperties: {
@@ -360,6 +494,7 @@ declare const WORKFLOW_COMMAND_SCHEMA: {
360
494
  }, {
361
495
  readonly type: "object";
362
496
  readonly required: readonly ["workflowKey", "workflowId"];
497
+ readonly description: "The open run of a workflow id, following its continue-as-new chain; firstRunId pins the chain (R2).";
363
498
  readonly properties: {
364
499
  readonly workflowKey: {
365
500
  readonly type: "string";
@@ -371,10 +506,70 @@ declare const WORKFLOW_COMMAND_SCHEMA: {
371
506
  readonly minLength: 1;
372
507
  readonly maxLength: 256;
373
508
  };
509
+ readonly firstRunId: {
510
+ readonly type: "string";
511
+ readonly minLength: 1;
512
+ readonly maxLength: 256;
513
+ };
374
514
  };
375
515
  readonly additionalProperties: false;
376
516
  }];
377
517
  };
518
+ readonly runRetryPolicy: {
519
+ readonly type: "object";
520
+ readonly required: readonly ["initialDelayMs"];
521
+ readonly description: "Run-level retry (11 §2.17), in milliseconds. maxAttempts counts every attempt; absent means unlimited, bounded by the execution timeout.";
522
+ readonly properties: {
523
+ readonly maxAttempts: {
524
+ readonly type: "integer";
525
+ readonly minimum: 1;
526
+ };
527
+ readonly initialDelayMs: {
528
+ readonly type: "integer";
529
+ readonly minimum: 0;
530
+ };
531
+ readonly backoffMultiplier: {
532
+ readonly type: "number";
533
+ readonly minimum: 1;
534
+ };
535
+ readonly maxDelayMs: {
536
+ readonly type: "integer";
537
+ readonly minimum: 0;
538
+ };
539
+ readonly retryOnErrorTypes: {
540
+ readonly type: "array";
541
+ readonly items: {
542
+ readonly enum: readonly ErrorType[];
543
+ };
544
+ };
545
+ readonly nonRetryableErrorTypes: {
546
+ readonly type: "array";
547
+ readonly items: {
548
+ readonly type: "string";
549
+ };
550
+ };
551
+ };
552
+ readonly additionalProperties: false;
553
+ };
554
+ readonly timeouts: {
555
+ readonly type: "object";
556
+ readonly description: "The three workflow timeouts (11 §2.20), in milliseconds.";
557
+ readonly properties: {
558
+ readonly executionTimeout: {
559
+ readonly type: "integer";
560
+ readonly minimum: 0;
561
+ };
562
+ readonly runTimeout: {
563
+ readonly type: "integer";
564
+ readonly minimum: 0;
565
+ };
566
+ readonly workflowTaskTimeout: {
567
+ readonly type: "integer";
568
+ readonly minimum: 0;
569
+ };
570
+ };
571
+ readonly additionalProperties: false;
572
+ };
378
573
  readonly childOptions: {
379
574
  readonly type: "object";
380
575
  readonly required: readonly ["parentClosePolicy"];
@@ -426,7 +621,80 @@ declare const WORKFLOW_COMMAND_SCHEMA: {
426
621
  readonly type: "integer";
427
622
  readonly minimum: 0;
428
623
  };
624
+ readonly retry: {
625
+ readonly $ref: "#/$defs/runRetryPolicy";
626
+ };
627
+ readonly versioningBehavior: {
628
+ readonly enum: readonly ["PINNED", "AUTO_UPGRADE"];
629
+ };
630
+ readonly idReusePolicy: {
631
+ readonly enum: readonly ["ALLOW_DUPLICATE", "ALLOW_DUPLICATE_FAILED_ONLY", "REJECT_DUPLICATE"];
632
+ };
633
+ readonly idConflictPolicy: {
634
+ readonly enum: readonly ["FAIL", "USE_EXISTING", "TERMINATE_EXISTING"];
635
+ };
636
+ };
637
+ };
638
+ readonly legacyCanRetryPolicy: {
639
+ readonly type: "object";
640
+ readonly required: readonly ["retryDelay"];
641
+ readonly description: "The R1 activity-shaped CONTINUE_AS_NEW retry: whatever explicitRetryPolicy wrote from a Partial<RetryPolicy>, so numbers carry no integer or minimum constraint. It never had a meaning, and the service ignores it.";
642
+ readonly properties: {
643
+ readonly maxRetries: {
644
+ readonly type: "number";
645
+ };
646
+ readonly retryDelay: {
647
+ readonly type: "number";
648
+ };
649
+ readonly backoffMultiplier: {
650
+ readonly type: "number";
651
+ };
652
+ readonly maxDelay: {
653
+ readonly type: "number";
654
+ };
655
+ readonly retryOnErrorTypes: {
656
+ readonly type: "array";
657
+ readonly items: {
658
+ readonly type: "string";
659
+ };
660
+ };
661
+ readonly nonRetryableErrorTypes: {
662
+ readonly type: "array";
663
+ readonly items: {
664
+ readonly type: "string";
665
+ };
666
+ };
667
+ };
668
+ readonly additionalProperties: false;
669
+ };
670
+ readonly canOptions: {
671
+ readonly type: "object";
672
+ readonly description: "Options of a CONTINUE_AS_NEW command (C-SCHEMA, frozen in R2). retry is the R2 run-retry policy of the new run, or the R1 activity shape (retryDelay, maxRetries, maxDelay) that R1 bundles wrote and R2 bundles still write for that shape: it never had a meaning, and the service ignores it instead of reading it as a run-retry policy.";
673
+ readonly properties: {
674
+ readonly taskQueue: {
675
+ readonly type: "string";
676
+ readonly minLength: 1;
677
+ readonly maxLength: 256;
678
+ };
679
+ readonly retry: {
680
+ readonly oneOf: readonly [{
681
+ readonly $ref: "#/$defs/runRetryPolicy";
682
+ }, {
683
+ readonly $ref: "#/$defs/legacyCanRetryPolicy";
684
+ }];
685
+ };
686
+ readonly workflowTaskTimeout: {
687
+ readonly type: "integer";
688
+ readonly minimum: 0;
689
+ };
690
+ readonly context: {
691
+ readonly type: "object";
692
+ };
693
+ readonly versioningBehavior: {
694
+ readonly enum: readonly ["PINNED", "AUTO_UPGRADE"];
695
+ };
429
696
  };
697
+ readonly additionalProperties: false;
430
698
  };
431
699
  readonly headers: {
432
700
  readonly type: "object";
@@ -561,10 +829,17 @@ declare const WORKFLOW_TASK_SCHEMA: {
561
829
  readonly businessId: {
562
830
  readonly type: "string";
563
831
  };
832
+ readonly workflowId: {
833
+ readonly type: "string";
834
+ };
564
835
  readonly attempt: {
565
836
  readonly type: "integer";
566
837
  readonly minimum: 1;
567
838
  };
839
+ readonly runAttempt: {
840
+ readonly type: "integer";
841
+ readonly minimum: 1;
842
+ };
568
843
  readonly taskQueue: {
569
844
  readonly type: "string";
570
845
  };
@@ -628,8 +903,72 @@ declare const WORKFLOW_TASK_SCHEMA: {
628
903
  readonly context: {
629
904
  readonly type: "object";
630
905
  };
906
+ readonly memo: {
907
+ readonly type: "object";
908
+ };
909
+ readonly versioningBehavior: {
910
+ readonly enum: readonly ["PINNED", "AUTO_UPGRADE"];
911
+ };
912
+ readonly retry: {
913
+ readonly $ref: "#/$defs/runRetryPolicy";
914
+ };
631
915
  };
632
916
  };
917
+ readonly localActivityRequest: {
918
+ readonly type: "object";
919
+ readonly required: readonly ["localActivityId", "kind", "nodeType", "operation", "args", "retry", "startToCloseTimeout", "attempt", "backoffMs"];
920
+ readonly description: "R2: a local activity the task needs (11 §2.12). Run attempt `attempt` after waiting backoffMs, then run the same task again with the outcome in localActivityResults.";
921
+ readonly properties: {
922
+ readonly localActivityId: {
923
+ readonly type: "string";
924
+ readonly minLength: 1;
925
+ readonly maxLength: 256;
926
+ };
927
+ readonly kind: {
928
+ readonly const: "node";
929
+ };
930
+ readonly nodeType: {
931
+ readonly type: "string";
932
+ readonly minLength: 1;
933
+ readonly maxLength: 256;
934
+ };
935
+ readonly nodeVersion: {
936
+ readonly type: "string";
937
+ };
938
+ readonly operation: {
939
+ readonly type: "string";
940
+ readonly minLength: 1;
941
+ readonly maxLength: 256;
942
+ };
943
+ readonly args: {};
944
+ readonly connection: {
945
+ readonly type: "string";
946
+ readonly minLength: 1;
947
+ readonly maxLength: 256;
948
+ };
949
+ readonly retry: {
950
+ readonly $ref: "#/$defs/retryPolicy";
951
+ };
952
+ readonly startToCloseTimeout: {
953
+ readonly type: "integer";
954
+ readonly minimum: 1;
955
+ readonly maximum: 30000;
956
+ };
957
+ readonly attempt: {
958
+ readonly type: "integer";
959
+ readonly minimum: 1;
960
+ };
961
+ readonly backoffMs: {
962
+ readonly type: "integer";
963
+ readonly minimum: 0;
964
+ };
965
+ readonly summary: {
966
+ readonly type: "string";
967
+ readonly maxLength: 200;
968
+ };
969
+ };
970
+ readonly additionalProperties: false;
971
+ };
633
972
  readonly request: {
634
973
  readonly type: "object";
635
974
  readonly required: readonly ["protocol", "kind", "workflowFn", "info", "history", "nowMs"];
@@ -715,10 +1054,31 @@ declare const WORKFLOW_TASK_SCHEMA: {
715
1054
  readonly $ref: "#/$defs/command";
716
1055
  };
717
1056
  };
718
- readonly localActivityRequests: {
1057
+ readonly localActivityRequests: {
1058
+ readonly type: "array";
1059
+ readonly items: {
1060
+ readonly $ref: "#/$defs/localActivityRequest";
1061
+ };
1062
+ };
1063
+ readonly unfinishedHandlers: {
719
1064
  readonly type: "array";
1065
+ readonly description: "R2: handlers still running when the terminal command was issued (11 §2.18); never set on replay.";
720
1066
  readonly items: {
721
1067
  readonly type: "object";
1068
+ readonly required: readonly ["kind", "name", "count"];
1069
+ readonly properties: {
1070
+ readonly kind: {
1071
+ readonly enum: readonly ["signal", "update"];
1072
+ };
1073
+ readonly name: {
1074
+ readonly type: "string";
1075
+ };
1076
+ readonly count: {
1077
+ readonly type: "integer";
1078
+ readonly minimum: 1;
1079
+ };
1080
+ };
1081
+ readonly additionalProperties: false;
722
1082
  };
723
1083
  };
724
1084
  readonly queryResults: {
@@ -894,6 +1254,7 @@ declare const WORKFLOW_TASK_SCHEMA: {
894
1254
  }, {
895
1255
  readonly type: "object";
896
1256
  readonly required: readonly ["workflowKey", "workflowId"];
1257
+ readonly description: "The open run of a workflow id, following its continue-as-new chain; firstRunId pins the chain (R2).";
897
1258
  readonly properties: {
898
1259
  readonly workflowKey: {
899
1260
  readonly type: "string";
@@ -905,10 +1266,70 @@ declare const WORKFLOW_TASK_SCHEMA: {
905
1266
  readonly minLength: 1;
906
1267
  readonly maxLength: 256;
907
1268
  };
1269
+ readonly firstRunId: {
1270
+ readonly type: "string";
1271
+ readonly minLength: 1;
1272
+ readonly maxLength: 256;
1273
+ };
908
1274
  };
909
1275
  readonly additionalProperties: false;
910
1276
  }];
911
1277
  };
1278
+ readonly runRetryPolicy: {
1279
+ readonly type: "object";
1280
+ readonly required: readonly ["initialDelayMs"];
1281
+ readonly description: "Run-level retry (11 §2.17), in milliseconds. maxAttempts counts every attempt; absent means unlimited, bounded by the execution timeout.";
1282
+ readonly properties: {
1283
+ readonly maxAttempts: {
1284
+ readonly type: "integer";
1285
+ readonly minimum: 1;
1286
+ };
1287
+ readonly initialDelayMs: {
1288
+ readonly type: "integer";
1289
+ readonly minimum: 0;
1290
+ };
1291
+ readonly backoffMultiplier: {
1292
+ readonly type: "number";
1293
+ readonly minimum: 1;
1294
+ };
1295
+ readonly maxDelayMs: {
1296
+ readonly type: "integer";
1297
+ readonly minimum: 0;
1298
+ };
1299
+ readonly retryOnErrorTypes: {
1300
+ readonly type: "array";
1301
+ readonly items: {
1302
+ readonly enum: readonly ErrorType[];
1303
+ };
1304
+ };
1305
+ readonly nonRetryableErrorTypes: {
1306
+ readonly type: "array";
1307
+ readonly items: {
1308
+ readonly type: "string";
1309
+ };
1310
+ };
1311
+ };
1312
+ readonly additionalProperties: false;
1313
+ };
1314
+ readonly timeouts: {
1315
+ readonly type: "object";
1316
+ readonly description: "The three workflow timeouts (11 §2.20), in milliseconds.";
1317
+ readonly properties: {
1318
+ readonly executionTimeout: {
1319
+ readonly type: "integer";
1320
+ readonly minimum: 0;
1321
+ };
1322
+ readonly runTimeout: {
1323
+ readonly type: "integer";
1324
+ readonly minimum: 0;
1325
+ };
1326
+ readonly workflowTaskTimeout: {
1327
+ readonly type: "integer";
1328
+ readonly minimum: 0;
1329
+ };
1330
+ };
1331
+ readonly additionalProperties: false;
1332
+ };
912
1333
  readonly childOptions: {
913
1334
  readonly type: "object";
914
1335
  readonly required: readonly ["parentClosePolicy"];
@@ -960,7 +1381,80 @@ declare const WORKFLOW_TASK_SCHEMA: {
960
1381
  readonly type: "integer";
961
1382
  readonly minimum: 0;
962
1383
  };
1384
+ readonly retry: {
1385
+ readonly $ref: "#/$defs/runRetryPolicy";
1386
+ };
1387
+ readonly versioningBehavior: {
1388
+ readonly enum: readonly ["PINNED", "AUTO_UPGRADE"];
1389
+ };
1390
+ readonly idReusePolicy: {
1391
+ readonly enum: readonly ["ALLOW_DUPLICATE", "ALLOW_DUPLICATE_FAILED_ONLY", "REJECT_DUPLICATE"];
1392
+ };
1393
+ readonly idConflictPolicy: {
1394
+ readonly enum: readonly ["FAIL", "USE_EXISTING", "TERMINATE_EXISTING"];
1395
+ };
1396
+ };
1397
+ };
1398
+ readonly legacyCanRetryPolicy: {
1399
+ readonly type: "object";
1400
+ readonly required: readonly ["retryDelay"];
1401
+ readonly description: "The R1 activity-shaped CONTINUE_AS_NEW retry: whatever explicitRetryPolicy wrote from a Partial<RetryPolicy>, so numbers carry no integer or minimum constraint. It never had a meaning, and the service ignores it.";
1402
+ readonly properties: {
1403
+ readonly maxRetries: {
1404
+ readonly type: "number";
1405
+ };
1406
+ readonly retryDelay: {
1407
+ readonly type: "number";
1408
+ };
1409
+ readonly backoffMultiplier: {
1410
+ readonly type: "number";
1411
+ };
1412
+ readonly maxDelay: {
1413
+ readonly type: "number";
1414
+ };
1415
+ readonly retryOnErrorTypes: {
1416
+ readonly type: "array";
1417
+ readonly items: {
1418
+ readonly type: "string";
1419
+ };
1420
+ };
1421
+ readonly nonRetryableErrorTypes: {
1422
+ readonly type: "array";
1423
+ readonly items: {
1424
+ readonly type: "string";
1425
+ };
1426
+ };
1427
+ };
1428
+ readonly additionalProperties: false;
1429
+ };
1430
+ readonly canOptions: {
1431
+ readonly type: "object";
1432
+ readonly description: "Options of a CONTINUE_AS_NEW command (C-SCHEMA, frozen in R2). retry is the R2 run-retry policy of the new run, or the R1 activity shape (retryDelay, maxRetries, maxDelay) that R1 bundles wrote and R2 bundles still write for that shape: it never had a meaning, and the service ignores it instead of reading it as a run-retry policy.";
1433
+ readonly properties: {
1434
+ readonly taskQueue: {
1435
+ readonly type: "string";
1436
+ readonly minLength: 1;
1437
+ readonly maxLength: 256;
1438
+ };
1439
+ readonly retry: {
1440
+ readonly oneOf: readonly [{
1441
+ readonly $ref: "#/$defs/runRetryPolicy";
1442
+ }, {
1443
+ readonly $ref: "#/$defs/legacyCanRetryPolicy";
1444
+ }];
1445
+ };
1446
+ readonly workflowTaskTimeout: {
1447
+ readonly type: "integer";
1448
+ readonly minimum: 0;
1449
+ };
1450
+ readonly context: {
1451
+ readonly type: "object";
1452
+ };
1453
+ readonly versioningBehavior: {
1454
+ readonly enum: readonly ["PINNED", "AUTO_UPGRADE"];
1455
+ };
963
1456
  };
1457
+ readonly additionalProperties: false;
964
1458
  };
965
1459
  readonly headers: {
966
1460
  readonly type: "object";
@@ -1093,10 +1587,17 @@ declare const HISTORY_FILE_SCHEMA: {
1093
1587
  readonly businessId: {
1094
1588
  readonly type: "string";
1095
1589
  };
1590
+ readonly workflowId: {
1591
+ readonly type: "string";
1592
+ };
1096
1593
  readonly attempt: {
1097
1594
  readonly type: "integer";
1098
1595
  readonly minimum: 1;
1099
1596
  };
1597
+ readonly runAttempt: {
1598
+ readonly type: "integer";
1599
+ readonly minimum: 1;
1600
+ };
1100
1601
  readonly taskQueue: {
1101
1602
  readonly type: "string";
1102
1603
  };
@@ -1160,6 +1661,15 @@ declare const HISTORY_FILE_SCHEMA: {
1160
1661
  readonly context: {
1161
1662
  readonly type: "object";
1162
1663
  };
1664
+ readonly memo: {
1665
+ readonly type: "object";
1666
+ };
1667
+ readonly versioningBehavior: {
1668
+ readonly enum: readonly ["PINNED", "AUTO_UPGRADE"];
1669
+ };
1670
+ readonly retry: {
1671
+ readonly $ref: "#/$defs/runRetryPolicy";
1672
+ };
1163
1673
  };
1164
1674
  };
1165
1675
  readonly json: {
@@ -1275,6 +1785,7 @@ declare const HISTORY_FILE_SCHEMA: {
1275
1785
  }, {
1276
1786
  readonly type: "object";
1277
1787
  readonly required: readonly ["workflowKey", "workflowId"];
1788
+ readonly description: "The open run of a workflow id, following its continue-as-new chain; firstRunId pins the chain (R2).";
1278
1789
  readonly properties: {
1279
1790
  readonly workflowKey: {
1280
1791
  readonly type: "string";
@@ -1286,10 +1797,70 @@ declare const HISTORY_FILE_SCHEMA: {
1286
1797
  readonly minLength: 1;
1287
1798
  readonly maxLength: 256;
1288
1799
  };
1800
+ readonly firstRunId: {
1801
+ readonly type: "string";
1802
+ readonly minLength: 1;
1803
+ readonly maxLength: 256;
1804
+ };
1289
1805
  };
1290
1806
  readonly additionalProperties: false;
1291
1807
  }];
1292
1808
  };
1809
+ readonly runRetryPolicy: {
1810
+ readonly type: "object";
1811
+ readonly required: readonly ["initialDelayMs"];
1812
+ readonly description: "Run-level retry (11 §2.17), in milliseconds. maxAttempts counts every attempt; absent means unlimited, bounded by the execution timeout.";
1813
+ readonly properties: {
1814
+ readonly maxAttempts: {
1815
+ readonly type: "integer";
1816
+ readonly minimum: 1;
1817
+ };
1818
+ readonly initialDelayMs: {
1819
+ readonly type: "integer";
1820
+ readonly minimum: 0;
1821
+ };
1822
+ readonly backoffMultiplier: {
1823
+ readonly type: "number";
1824
+ readonly minimum: 1;
1825
+ };
1826
+ readonly maxDelayMs: {
1827
+ readonly type: "integer";
1828
+ readonly minimum: 0;
1829
+ };
1830
+ readonly retryOnErrorTypes: {
1831
+ readonly type: "array";
1832
+ readonly items: {
1833
+ readonly enum: readonly ErrorType[];
1834
+ };
1835
+ };
1836
+ readonly nonRetryableErrorTypes: {
1837
+ readonly type: "array";
1838
+ readonly items: {
1839
+ readonly type: "string";
1840
+ };
1841
+ };
1842
+ };
1843
+ readonly additionalProperties: false;
1844
+ };
1845
+ readonly timeouts: {
1846
+ readonly type: "object";
1847
+ readonly description: "The three workflow timeouts (11 §2.20), in milliseconds.";
1848
+ readonly properties: {
1849
+ readonly executionTimeout: {
1850
+ readonly type: "integer";
1851
+ readonly minimum: 0;
1852
+ };
1853
+ readonly runTimeout: {
1854
+ readonly type: "integer";
1855
+ readonly minimum: 0;
1856
+ };
1857
+ readonly workflowTaskTimeout: {
1858
+ readonly type: "integer";
1859
+ readonly minimum: 0;
1860
+ };
1861
+ };
1862
+ readonly additionalProperties: false;
1863
+ };
1293
1864
  readonly childOptions: {
1294
1865
  readonly type: "object";
1295
1866
  readonly required: readonly ["parentClosePolicy"];
@@ -1341,7 +1912,80 @@ declare const HISTORY_FILE_SCHEMA: {
1341
1912
  readonly type: "integer";
1342
1913
  readonly minimum: 0;
1343
1914
  };
1915
+ readonly retry: {
1916
+ readonly $ref: "#/$defs/runRetryPolicy";
1917
+ };
1918
+ readonly versioningBehavior: {
1919
+ readonly enum: readonly ["PINNED", "AUTO_UPGRADE"];
1920
+ };
1921
+ readonly idReusePolicy: {
1922
+ readonly enum: readonly ["ALLOW_DUPLICATE", "ALLOW_DUPLICATE_FAILED_ONLY", "REJECT_DUPLICATE"];
1923
+ };
1924
+ readonly idConflictPolicy: {
1925
+ readonly enum: readonly ["FAIL", "USE_EXISTING", "TERMINATE_EXISTING"];
1926
+ };
1927
+ };
1928
+ };
1929
+ readonly legacyCanRetryPolicy: {
1930
+ readonly type: "object";
1931
+ readonly required: readonly ["retryDelay"];
1932
+ readonly description: "The R1 activity-shaped CONTINUE_AS_NEW retry: whatever explicitRetryPolicy wrote from a Partial<RetryPolicy>, so numbers carry no integer or minimum constraint. It never had a meaning, and the service ignores it.";
1933
+ readonly properties: {
1934
+ readonly maxRetries: {
1935
+ readonly type: "number";
1936
+ };
1937
+ readonly retryDelay: {
1938
+ readonly type: "number";
1939
+ };
1940
+ readonly backoffMultiplier: {
1941
+ readonly type: "number";
1942
+ };
1943
+ readonly maxDelay: {
1944
+ readonly type: "number";
1945
+ };
1946
+ readonly retryOnErrorTypes: {
1947
+ readonly type: "array";
1948
+ readonly items: {
1949
+ readonly type: "string";
1950
+ };
1951
+ };
1952
+ readonly nonRetryableErrorTypes: {
1953
+ readonly type: "array";
1954
+ readonly items: {
1955
+ readonly type: "string";
1956
+ };
1957
+ };
1958
+ };
1959
+ readonly additionalProperties: false;
1960
+ };
1961
+ readonly canOptions: {
1962
+ readonly type: "object";
1963
+ readonly description: "Options of a CONTINUE_AS_NEW command (C-SCHEMA, frozen in R2). retry is the R2 run-retry policy of the new run, or the R1 activity shape (retryDelay, maxRetries, maxDelay) that R1 bundles wrote and R2 bundles still write for that shape: it never had a meaning, and the service ignores it instead of reading it as a run-retry policy.";
1964
+ readonly properties: {
1965
+ readonly taskQueue: {
1966
+ readonly type: "string";
1967
+ readonly minLength: 1;
1968
+ readonly maxLength: 256;
1969
+ };
1970
+ readonly retry: {
1971
+ readonly oneOf: readonly [{
1972
+ readonly $ref: "#/$defs/runRetryPolicy";
1973
+ }, {
1974
+ readonly $ref: "#/$defs/legacyCanRetryPolicy";
1975
+ }];
1976
+ };
1977
+ readonly workflowTaskTimeout: {
1978
+ readonly type: "integer";
1979
+ readonly minimum: 0;
1980
+ };
1981
+ readonly context: {
1982
+ readonly type: "object";
1983
+ };
1984
+ readonly versioningBehavior: {
1985
+ readonly enum: readonly ["PINNED", "AUTO_UPGRADE"];
1986
+ };
1344
1987
  };
1988
+ readonly additionalProperties: false;
1345
1989
  };
1346
1990
  readonly headers: {
1347
1991
  readonly type: "object";
@@ -1354,7 +1998,19 @@ declare const HISTORY_FILE_SCHEMA: {
1354
1998
  /** File name and schema of every generated history schema. */
1355
1999
  declare const HISTORY_SCHEMA_FILES: ReadonlyArray<readonly [string, unknown]>;
1356
2000
 
1357
- /** Command helpers shared by validation and the state machine; no schema code. */
2001
+ /**
2002
+ * The command feature gate (C-GATE, frozen in SDK R2) and command helpers
2003
+ * shared by validation and the state machine; no schema code.
2004
+ *
2005
+ * Every command needs one or more features. The service builds the set of
2006
+ * features a workspace may use once per command batch, before it locks the
2007
+ * run (in Phase B: {@link PHASE_B_CORE_FEATURES}, plus
2008
+ * {@link PHASE_B_PARITY_FEATURES} when `fluidgrids.durable-parity` is on),
2009
+ * and refuses a batch with a command whose features are not all enabled
2010
+ * (`UNSUPPORTED_COMMAND`; the run stays RUNNING and heals when the flag is
2011
+ * turned back on). Relief commands ({@link isReliefCommand}) answer work the
2012
+ * service already granted and are never refused for a missing flag.
2013
+ */
1358
2014
 
1359
2015
  /** One problem found in a command batch or a history. */
1360
2016
  interface HistoryIssue {
@@ -1365,18 +2021,101 @@ interface HistoryIssue {
1365
2021
  path?: string;
1366
2022
  }
1367
2023
  /**
1368
- * True when the command is enabled: the Phase B core set always, the parity
1369
- * set when `enabled` is `parity`, Phase C commands never.
2024
+ * A feature a command may need (C-GATE).
2025
+ *
2026
+ * - `core`: the Phase B core command set.
2027
+ * - `parity.can`: `CONTINUE_AS_NEW` (enabled in Phase B core).
2028
+ * - `parity.context`: `UPSERT_CONTEXT` (enabled in Phase B core).
2029
+ * - `parity.localActivity`: `RECORD_LOCAL_ACTIVITY`.
2030
+ * - `parity.externalCancel`: `REQUEST_CANCEL_EXTERNAL_RUN` aimed at a run
2031
+ * that is not one of the run's own children.
2032
+ * - `parity.childOptions`: the `START_CHILD_RUN` options new in R2
2033
+ * (anything outside {@link CORE_CHILD_OPTIONS}: `retry`,
2034
+ * `versioningBehavior`, `idReusePolicy`, `idConflictPolicy`).
2035
+ * - `parity.canOptions`: the `CONTINUE_AS_NEW` options new in R2: a run-retry
2036
+ * `retry` and anything outside {@link CORE_CAN_OPTIONS}.
2037
+ * - `parity.workflowIdTarget`: a `SIGNAL_RUN` or `REQUEST_CANCEL_EXTERNAL_RUN`
2038
+ * target given as `{ workflowKey, workflowId }`.
2039
+ * - `c.*`: reserved for Phase C, never enabled in Phase B.
2040
+ */
2041
+ type CommandFeature = 'core' | 'parity.can' | 'parity.context' | 'parity.localActivity' | 'parity.externalCancel' | 'parity.childOptions' | 'parity.canOptions' | 'parity.workflowIdTarget' | 'c.updates' | 'c.searchAttributes' | 'c.userActivity';
2042
+ /** Every feature, in a stable order. */
2043
+ declare const COMMAND_FEATURES: readonly CommandFeature[];
2044
+ /** The features of the Phase B core release (what the service enables without the parity flag). */
2045
+ declare const PHASE_B_CORE_FEATURES: ReadonlySet<CommandFeature>;
2046
+ /** Every Phase B feature: the core set plus what `fluidgrids.durable-parity` enables. */
2047
+ declare const PHASE_B_PARITY_FEATURES: ReadonlySet<CommandFeature>;
2048
+ /**
2049
+ * Child options a Phase B core child may carry: every option the R1 runtime
2050
+ * already wrote into `START_CHILD_RUN` and the Phase B service accepted (it
2051
+ * stored or ignored them). Only the options new in R2 (`retry`,
2052
+ * `versioningBehavior`, `idReusePolicy`, `idConflictPolicy`) need
2053
+ * `parity.childOptions`, so a Phase B workflow behaves the same with the
2054
+ * parity flag off.
2055
+ */
2056
+ declare const CORE_CHILD_OPTIONS: ReadonlySet<string>;
2057
+ /**
2058
+ * Continue-as-new options a Phase B core command may carry: every option the
2059
+ * R1 runtime wrote. `retry` is core only in its R1 (activity) shape, which the
2060
+ * Phase B service ignores ({@link continueAsNewRetryShape}); the R2 run-retry
2061
+ * shape needs `parity.canOptions`.
2062
+ */
2063
+ declare const CORE_CAN_OPTIONS: ReadonlySet<string>;
2064
+ /**
2065
+ * The shape of `CONTINUE_AS_NEW` `options.retry` (C-SCHEMA `canOptions`):
2066
+ *
2067
+ * - `run`: the R2 run-retry policy (`initialDelayMs`, `maxAttempts`, ...),
2068
+ * which the service applies to the new run (11 §2.17);
2069
+ * - `legacy`: the R1 activity shape (`retryDelay`, `maxRetries`, `maxDelay`)
2070
+ * that R1 bundles and histories carry. It never had a meaning: the Phase B
2071
+ * service ignored it, and the service must keep ignoring it rather than
2072
+ * read it as a run-retry policy;
2073
+ * - `none`: no retry option.
2074
+ *
2075
+ * A value with keys of both shapes, or of neither, is `invalid`; the command
2076
+ * schema refuses it.
2077
+ */
2078
+ declare function continueAsNewRetryShape(options: Readonly<Record<string, unknown>>): 'run' | 'legacy' | 'none' | 'invalid';
2079
+ /** The features `command` needs, without duplicates, in {@link COMMAND_FEATURES} order. */
2080
+ declare function commandFeatures(command: WorkflowCommand): CommandFeature[];
2081
+ /**
2082
+ * Which commands are enabled: a feature set (C-GATE), or the deprecated
2083
+ * release levels `core` and `parity`, which keep their R1 meaning (the type
2084
+ * lists of `isCommandEnabled`, with a child-targeted cancel always enabled).
2085
+ */
2086
+ type CommandGate = 'core' | 'parity' | ReadonlySet<CommandFeature>;
2087
+ /**
2088
+ * True when the command type is enabled: the Phase B core set always, the
2089
+ * parity set when `enabled` is `parity`, Phase C commands never.
2090
+ *
2091
+ * @deprecated Since R2; use {@link isWorkflowCommandEnabled} with a feature
2092
+ * set. Kept for one release.
1370
2093
  */
1371
2094
  declare function isCommandEnabled(type: CommandType, enabled?: 'core' | 'parity'): boolean;
1372
2095
  /**
1373
- * True when this command is enabled. Like {@link isCommandEnabled}, except
1374
- * that `REQUEST_CANCEL_EXTERNAL_RUN` aimed at one of the run's own children
1375
- * (`target.childId`) is core: it is how a cancelled scope cancels a child
1376
- * (the default child cancellation type, spec 11 §2.5). Other targets stay
1377
- * parity.
2096
+ * True when every feature `command` needs is enabled. With a release level
2097
+ * (`core`, `parity`) it answers as R1 did: the command type decides, and
2098
+ * `REQUEST_CANCEL_EXTERNAL_RUN` aimed at one of the run's own children is
2099
+ * core.
2100
+ */
2101
+ declare function isWorkflowCommandEnabled(command: WorkflowCommand, enabled?: CommandGate): boolean;
2102
+ /** Why a command is refused by the gate, naming the missing features. */
2103
+ declare function unsupportedMessage(command: WorkflowCommand, enabled?: CommandGate): string;
2104
+ /** What the lease of the current workflow task already granted (C-LEASE). */
2105
+ interface CommandRelief {
2106
+ /** Local activities the lease asked the worker to run (`localActivityRequested`). */
2107
+ grantedLocalActivityIds: readonly string[];
2108
+ /** Updates the lease delivered to the task (Phase C). */
2109
+ deliveredUpdateIds: readonly string[];
2110
+ }
2111
+ /**
2112
+ * True for a command that answers work the lease already granted: a
2113
+ * `RECORD_LOCAL_ACTIVITY` of a granted local activity, or an update reply to
2114
+ * a delivered update. Such commands are accepted even when the flag that
2115
+ * enables new requests of their kind is off (BP7), so turning a flag off never
2116
+ * strands work that was already started.
1378
2117
  */
1379
- declare function isWorkflowCommandEnabled(command: WorkflowCommand, enabled?: 'core' | 'parity'): boolean;
2118
+ declare function isReliefCommand(command: WorkflowCommand, lease: CommandRelief): boolean;
1380
2119
 
1381
2120
  /**
1382
2121
  * The pure state machine of a durable-function run (DB3): what a command batch
@@ -1417,6 +2156,15 @@ interface ChildState {
1417
2156
  parentClosePolicy: ParentClosePolicy;
1418
2157
  initiatedSeq: number;
1419
2158
  }
2159
+ /** A local activity recorded in history (`LOCAL_ACTIVITY_COMPLETED` or `_FAILED`). */
2160
+ interface LocalActivityState {
2161
+ status: 'COMPLETED' | 'FAILED';
2162
+ attempts: number;
2163
+ recordedSeq: number;
2164
+ nodeType?: string;
2165
+ operation?: string;
2166
+ summary?: string;
2167
+ }
1420
2168
  interface ExternalState {
1421
2169
  kind: 'signal' | 'cancel';
1422
2170
  status: 'PENDING' | 'RESOLVED';
@@ -1447,6 +2195,7 @@ interface RunState {
1447
2195
  timers: Record<string, TimerState>;
1448
2196
  children: Record<string, ChildState>;
1449
2197
  externals: Record<string, ExternalState>;
2198
+ localActivities: Record<string, LocalActivityState>;
1450
2199
  sideEffects: Record<string, Json>;
1451
2200
  markers: Record<string, Json>;
1452
2201
  signalsReceived: number;
@@ -1485,7 +2234,9 @@ interface EventsForCommandsContext {
1485
2234
  /** Task start time (the request's `nowMs`); timers fire at `nowMs + durationMs`. */
1486
2235
  nowMs: number;
1487
2236
  /** Which commands are enabled (see `validateCommands`). Default `core`. */
1488
- enabled?: 'core' | 'parity';
2237
+ enabled?: CommandGate;
2238
+ /** What the lease already granted; relief commands pass the gate (see `isReliefCommand`). */
2239
+ relief?: CommandRelief;
1489
2240
  }
1490
2241
  type EventsForCommandsResult = {
1491
2242
  ok: true;
@@ -1554,4 +2305,4 @@ declare function createHistoryFile(workflowFn: string, events: RunEventRecord[],
1554
2305
  /** Serialise a history file the way the CLI and the fixtures write it. */
1555
2306
  declare function serializeHistoryFile(file: HistoryFile): string;
1556
2307
 
1557
- export { type ActivityState as A, parseHistoryFile as B, type ChildState as C, pendingCounts as D, type EventsForCommandsContext as E, projectRunState as F, serializeHistoryFile as G, type HistoryIssue as H, taskCompletedEvents as I, utf8Bytes as J, RUN_EVENT_SCHEMA as R, type TimerState as T, WORKFLOW_COMMAND_SCHEMA as W, type ActivityStatus as a, type ChildStatus as b, type EventsForCommandsResult as c, type ExternalState as d, HISTORY_FILE_FORMAT as e, HISTORY_FILE_SCHEMA as f, HISTORY_FILE_SCHEMA_ID as g, HISTORY_SCHEMA_FILES as h, type HistoryFile as i, HistoryFileError as j, HistoryStateError as k, RUN_EVENT_SCHEMA_ID as l, type RunState as m, type RunStatus as n, WORKFLOW_COMMAND_SCHEMA_ID as o, WORKFLOW_TASK_SCHEMA as p, WORKFLOW_TASK_SCHEMA_ID as q, applyEvent as r, createHistoryFile as s, eventsForCommands as t, hasUnprocessedInput as u, initialRunState as v, isActivityOpen as w, isChildOpen as x, isCommandEnabled as y, isWorkflowCommandEnabled as z };
2308
+ export { type ActivityState as A, continueAsNewRetryShape as B, type CommandGate as C, createHistoryFile as D, type EventsForCommandsContext as E, eventsForCommands as F, hasUnprocessedInput as G, type HistoryIssue as H, initialRunState as I, isActivityOpen as J, isChildOpen as K, type LocalActivityState as L, isCommandEnabled as M, isReliefCommand as N, isWorkflowCommandEnabled as O, PHASE_B_CORE_FEATURES as P, parseHistoryFile as Q, RUN_EVENT_SCHEMA as R, pendingCounts as S, type TimerState as T, projectRunState as U, serializeHistoryFile as V, WORKFLOW_COMMAND_SCHEMA as W, taskCompletedEvents as X, unsupportedMessage as Y, utf8Bytes as Z, type CommandRelief as a, type ActivityStatus as b, COMMAND_FEATURES as c, CORE_CAN_OPTIONS as d, CORE_CHILD_OPTIONS as e, type ChildState as f, type ChildStatus as g, type CommandFeature as h, type EventsForCommandsResult as i, type ExternalState as j, HISTORY_FILE_FORMAT as k, HISTORY_FILE_SCHEMA as l, HISTORY_FILE_SCHEMA_ID as m, HISTORY_SCHEMA_FILES as n, type HistoryFile as o, HistoryFileError as p, HistoryStateError as q, PHASE_B_PARITY_FEATURES as r, RUN_EVENT_SCHEMA_ID as s, type RunState as t, type RunStatus as u, WORKFLOW_COMMAND_SCHEMA_ID as v, WORKFLOW_TASK_SCHEMA as w, WORKFLOW_TASK_SCHEMA_ID as x, applyEvent as y, commandFeatures as z };