@fluidgrids/workflows 2026.1027.0 → 2026.1028.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 (168) hide show
  1. package/README.md +170 -18
  2. package/dist/activation-BBh1p82z.d.cts +57 -0
  3. package/dist/activation-DnhG7SmF.d.ts +57 -0
  4. package/dist/assemble-BLqQ8lSu.d.cts +39 -0
  5. package/dist/assemble-DWgaXHd-.d.ts +39 -0
  6. package/dist/chunk-2DP2Y6EU.cjs +832 -0
  7. package/dist/chunk-2J6TF7YI.cjs +86 -0
  8. package/dist/chunk-3FOTFQ3J.js +1622 -0
  9. package/dist/chunk-4LYSEANA.js +199 -0
  10. package/dist/{chunk-KUTMY2IO.cjs → chunk-57MSZ24T.cjs} +162 -98
  11. package/dist/{chunk-BWSLWF2E.js → chunk-5HDSBTBX.js} +99 -32
  12. package/dist/chunk-623FVQSN.cjs +251 -0
  13. package/dist/{chunk-4DPEGDPW.js → chunk-6FSHT5IL.js} +4 -4
  14. package/dist/{chunk-REV7ZOA4.js → chunk-7AAZGVKD.js} +1 -35
  15. package/dist/chunk-7NQ37GZU.js +73 -0
  16. package/dist/chunk-ABFZWYHT.js +612 -0
  17. package/dist/{chunk-SS4LT2IP.js → chunk-BD7ZPG53.js} +5 -10
  18. package/dist/chunk-BO6OVILK.js +79 -0
  19. package/dist/chunk-C5OLWZ42.js +245 -0
  20. package/dist/chunk-CBL5JSCC.cjs +75 -0
  21. package/dist/{chunk-LSKSBVL4.cjs → chunk-CPDK3K5N.cjs} +6 -6
  22. package/dist/chunk-CSNWNFKU.cjs +1635 -0
  23. package/dist/chunk-DJYMDLV5.js +227 -0
  24. package/dist/{chunk-X4HKU3MX.js → chunk-E2VK7J2C.js} +3 -1
  25. package/dist/chunk-FMSW2HDF.cjs +267 -0
  26. package/dist/chunk-FQIHX7YI.cjs +80 -0
  27. package/dist/chunk-FR7KYWRO.cjs +41 -0
  28. package/dist/{chunk-AU3YW7FZ.cjs → chunk-GBQ33SIZ.cjs} +46 -51
  29. package/dist/{chunk-RRQ5HOBF.cjs → chunk-GVTZMA5C.cjs} +4 -4
  30. package/dist/chunk-H7KEVW2M.js +816 -0
  31. package/dist/chunk-HR3BN4C4.cjs +27 -0
  32. package/dist/chunk-IISBRUWJ.js +13 -0
  33. package/dist/chunk-JD2VQIDZ.cjs +15 -0
  34. package/dist/{chunk-PL73GJR4.js → chunk-JZ4TOOLN.js} +1 -1
  35. package/dist/chunk-L24YIZY7.cjs +207 -0
  36. package/dist/chunk-LNUQE6D6.js +39 -0
  37. package/dist/{chunk-BYJ7QTLY.cjs → chunk-NEIUQASE.cjs} +13 -13
  38. package/dist/chunk-P6TA5EZT.cjs +634 -0
  39. package/dist/chunk-PDHLTDZB.js +72 -0
  40. package/dist/chunk-PMCM2OH4.js +46 -0
  41. package/dist/chunk-PZCVF76Q.cjs +868 -0
  42. package/dist/{chunk-GO34UHSY.js → chunk-QAN5MZEM.js} +3 -3
  43. package/dist/{chunk-27HASETB.cjs → chunk-QKZL3ONM.cjs} +3 -1
  44. package/dist/chunk-SAENRNBJ.cjs +52 -0
  45. package/dist/{chunk-LMX35GNQ.js → chunk-SMCANK3F.js} +5 -4
  46. package/dist/{chunk-IZQNUNSU.cjs → chunk-SX2PNKKT.cjs} +18 -17
  47. package/dist/{chunk-LRM6JXJA.cjs → chunk-TBDXTV22.cjs} +0 -37
  48. package/dist/chunk-VOKMAAJP.js +848 -0
  49. package/dist/chunk-XB53G2DK.js +25 -0
  50. package/dist/chunk-Z2Y65YOY.cjs +7 -0
  51. package/dist/codegen/index.cjs +9 -7
  52. package/dist/codegen/index.d.cts +2 -2
  53. package/dist/codegen/index.d.ts +2 -2
  54. package/dist/codegen/index.js +6 -5
  55. package/dist/file-BOoHZgoQ.d.cts +1557 -0
  56. package/dist/file-yuPCFU5b.d.ts +1557 -0
  57. package/dist/history/index.cjs +287 -0
  58. package/dist/history/index.d.cts +157 -0
  59. package/dist/history/index.d.ts +157 -0
  60. package/dist/history/index.js +5 -0
  61. package/dist/index.cjs +134 -36
  62. package/dist/index.d.cts +137 -9
  63. package/dist/index.d.ts +137 -9
  64. package/dist/index.js +8 -3
  65. package/dist/ir/index.cjs +161 -165
  66. package/dist/ir/index.d.cts +32 -12
  67. package/dist/ir/index.d.ts +32 -12
  68. package/dist/ir/index.js +54 -61
  69. package/dist/lower-BuSvAFqi.d.cts +129 -0
  70. package/dist/lower-C_Qv_34S.d.ts +129 -0
  71. package/dist/lower-types-nofRXw9c.d.cts +15 -0
  72. package/dist/lower-types-nofRXw9c.d.ts +15 -0
  73. package/dist/{manifest-Duf-gHdO.d.cts → manifest-0OLw0i7k.d.cts} +1 -1
  74. package/dist/{manifest-Bp9ZJlav.d.ts → manifest-C8N6HDYl.d.ts} +1 -1
  75. package/dist/node-evaluator-CJNP4GHX.js +12 -0
  76. package/dist/node-evaluator-DMKPKUWA.cjs +22 -0
  77. package/dist/quickjs/index.cjs +256 -78
  78. package/dist/quickjs/index.d.cts +48 -7
  79. package/dist/quickjs/index.d.ts +48 -7
  80. package/dist/quickjs/index.js +254 -79
  81. package/dist/roundtrip/index.cjs +404 -129
  82. package/dist/roundtrip/index.d.cts +43 -8
  83. package/dist/roundtrip/index.d.ts +43 -8
  84. package/dist/roundtrip/index.js +260 -19
  85. package/dist/runtime/index.cjs +90 -0
  86. package/dist/runtime/index.d.cts +297 -0
  87. package/dist/runtime/index.d.ts +297 -0
  88. package/dist/runtime/index.js +8 -0
  89. package/dist/testing/index.cjs +1057 -0
  90. package/dist/testing/index.d.cts +305 -0
  91. package/dist/testing/index.d.ts +305 -0
  92. package/dist/testing/index.js +1037 -0
  93. package/dist/{types-Dr2Fn1Ax.d.ts → types-BGoPzgcl.d.cts} +1 -1
  94. package/dist/{types-Dr2Fn1Ax.d.cts → types-BGoPzgcl.d.ts} +1 -1
  95. package/dist/types-CpBBjaGX.d.cts +380 -0
  96. package/dist/types-DV-HX_Gt.d.ts +380 -0
  97. package/dist/{assemble-DMOuaxRI.d.ts → workflow-Bpr3vnA_.d.ts} +60 -162
  98. package/dist/workflow-C2a05WUJ.d.ts +444 -0
  99. package/dist/{assemble-BJo9TECS.d.cts → workflow-FXUkpIBc.d.cts} +60 -162
  100. package/dist/workflow-J-yYixny.d.cts +444 -0
  101. package/fixtures/README.md +128 -0
  102. package/fixtures/histories/activity-failure-fails-run.history.json +163 -0
  103. package/fixtures/histories/activity-retry-then-success.history.json +147 -0
  104. package/fixtures/histories/cancel-activity-abandon.history.json +126 -0
  105. package/fixtures/histories/cancel-activity-compensate.history.json +307 -0
  106. package/fixtures/histories/cancel-concurrent-non-cancellable.history.json +234 -0
  107. package/fixtures/histories/cancel-concurrent-scope-timeout.history.json +184 -0
  108. package/fixtures/histories/cancel-condition-after-cancel.history.json +200 -0
  109. package/fixtures/histories/cancel-during-timer.history.json +123 -0
  110. package/fixtures/histories/cancel-saga-compensations.history.json +325 -0
  111. package/fixtures/histories/cancel-scope-timeout.history.json +148 -0
  112. package/fixtures/histories/child-abandon-outlives-parent.history.json +191 -0
  113. package/fixtures/histories/child-cancel-default.history.json +234 -0
  114. package/fixtures/histories/child-cancel-request.history.json +206 -0
  115. package/fixtures/histories/child-durable-child-side.history.json +124 -0
  116. package/fixtures/histories/child-durable-result.history.json +163 -0
  117. package/fixtures/histories/child-failure-caught.history.json +166 -0
  118. package/fixtures/histories/child-graph-by-key.history.json +138 -0
  119. package/fixtures/histories/child-terminated-by-parent-close.history.json +85 -0
  120. package/fixtures/histories/continue-as-new-first-run.history.json +146 -0
  121. package/fixtures/histories/continue-as-new-history-limit.history.json +489 -0
  122. package/fixtures/histories/continue-as-new-last-run.history.json +147 -0
  123. package/fixtures/histories/continue-as-new-suggested.history.json +352 -0
  124. package/fixtures/histories/details-and-context.history.json +176 -0
  125. package/fixtures/histories/deterministic-values.history.json +128 -0
  126. package/fixtures/histories/engine-builtins.history.json +172 -0
  127. package/fixtures/histories/gather-activities.history.json +291 -0
  128. package/fixtures/histories/gather-all-settled.history.json +219 -0
  129. package/fixtures/histories/gather-mixed.history.json +281 -0
  130. package/fixtures/histories/input-during-running-task.history.json +111 -0
  131. package/fixtures/histories/nondeterminism-reordered.history.json +218 -0
  132. package/fixtures/histories/patched-deprecated.history.json +271 -0
  133. package/fixtures/histories/patched-new-run.history.json +270 -0
  134. package/fixtures/histories/patched-old-history.history.json +190 -0
  135. package/fixtures/histories/race-activity-wins.history.json +152 -0
  136. package/fixtures/histories/race-signal-beats-child.history.json +161 -0
  137. package/fixtures/histories/race-timeout-wins.history.json +118 -0
  138. package/fixtures/histories/side-effect-recorded.history.json +153 -0
  139. package/fixtures/histories/signal-buffered-at-start.history.json +157 -0
  140. package/fixtures/histories/signal-default-handler.history.json +187 -0
  141. package/fixtures/histories/signal-handler.history.json +191 -0
  142. package/fixtures/histories/signal-parent-child-side.history.json +132 -0
  143. package/fixtures/histories/signal-parent.history.json +202 -0
  144. package/fixtures/histories/signal-run-delivered.history.json +128 -0
  145. package/fixtures/histories/signal-run-undelivered.history.json +134 -0
  146. package/fixtures/histories/signal-wait.history.json +111 -0
  147. package/fixtures/histories/task-failure-code-error.history.json +137 -0
  148. package/fixtures/histories/task-failure-then-transient-attempt.history.json +140 -0
  149. package/fixtures/histories/timer-condition-met.history.json +201 -0
  150. package/fixtures/histories/timer-condition-timeout.history.json +118 -0
  151. package/fixtures/histories/timer-sleep-once.history.json +118 -0
  152. package/fixtures/histories/timer-sleep-sequence.history.json +210 -0
  153. package/fixtures/histories/update-accepted-completed.history.json +149 -0
  154. package/fixtures/histories/update-with-start-rejected-validation.history.json +91 -0
  155. package/package.json +85 -20
  156. package/schema/history-file.schema.json +2544 -0
  157. package/schema/ir-v2.schema.json +16 -0
  158. package/schema/run-event.schema.json +2374 -0
  159. package/schema/workflow-command.schema.json +1095 -0
  160. package/schema/workflow-task.schema.json +3560 -0
  161. package/dist/chunk-265J2FCH.cjs +0 -33
  162. package/dist/chunk-LUXCXFOE.cjs +0 -269
  163. package/dist/chunk-S34NJE3A.js +0 -262
  164. package/dist/chunk-SRQRLWOS.js +0 -31
  165. package/dist/lower-DcOY8ux0.d.cts +0 -49
  166. package/dist/lower-Dw5grNrI.d.ts +0 -49
  167. package/dist/node-evaluator-2GTUZVPK.cjs +0 -17
  168. package/dist/node-evaluator-RMYEWCXZ.js +0 -8
@@ -0,0 +1,1557 @@
1
+ import { E as ErrorType, a as Json, J as JsonObject } from './types-BGoPzgcl.js';
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-DV-HX_Gt.js';
3
+
4
+ declare const RUN_EVENT_SCHEMA_ID = "https://docs.fluidgrids.ai/schemas/run-event.schema.json";
5
+ declare const WORKFLOW_COMMAND_SCHEMA_ID = "https://docs.fluidgrids.ai/schemas/workflow-command.schema.json";
6
+ declare const WORKFLOW_TASK_SCHEMA_ID = "https://docs.fluidgrids.ai/schemas/workflow-task.schema.json";
7
+ declare const HISTORY_FILE_SCHEMA_ID = "https://docs.fluidgrids.ai/schemas/history-file.schema.json";
8
+ /** The format tag of a history file. */
9
+ declare const HISTORY_FILE_FORMAT = "fluidgrids.history";
10
+ /** One stored history event. */
11
+ declare const RUN_EVENT_SCHEMA: {
12
+ readonly $defs: {
13
+ readonly json: {
14
+ readonly description: "Any JSON value.";
15
+ };
16
+ readonly failure: {
17
+ readonly type: "object";
18
+ readonly required: readonly ["errorType", "message"];
19
+ readonly properties: {
20
+ readonly errorType: {
21
+ readonly enum: readonly ErrorType[];
22
+ };
23
+ readonly message: {
24
+ readonly type: "string";
25
+ };
26
+ readonly type: {
27
+ readonly type: "string";
28
+ };
29
+ readonly details: {};
30
+ readonly nonRetryable: {
31
+ readonly type: "boolean";
32
+ };
33
+ readonly nextRetryDelayMs: {
34
+ readonly type: "integer";
35
+ readonly minimum: 0;
36
+ };
37
+ readonly category: {
38
+ readonly const: "BENIGN";
39
+ };
40
+ readonly timeoutType: {
41
+ readonly type: "string";
42
+ };
43
+ readonly cause: {
44
+ readonly $ref: "#/$defs/failure";
45
+ };
46
+ readonly stackTrace: {
47
+ readonly type: "string";
48
+ };
49
+ readonly source: {
50
+ readonly type: "string";
51
+ };
52
+ };
53
+ readonly additionalProperties: false;
54
+ };
55
+ readonly retryPolicy: {
56
+ readonly type: "object";
57
+ readonly required: readonly ["retryDelay"];
58
+ readonly description: "maxRetries absent means unlimited attempts, bounded by scheduleToCloseTimeout.";
59
+ readonly properties: {
60
+ readonly maxRetries: {
61
+ readonly type: "integer";
62
+ readonly minimum: 0;
63
+ };
64
+ readonly retryDelay: {
65
+ readonly type: "integer";
66
+ readonly minimum: 0;
67
+ };
68
+ readonly backoffMultiplier: {
69
+ readonly type: "number";
70
+ readonly minimum: 1;
71
+ };
72
+ readonly maxDelay: {
73
+ readonly type: "integer";
74
+ readonly minimum: 0;
75
+ };
76
+ readonly retryOnErrorTypes: {
77
+ readonly type: "array";
78
+ readonly items: {
79
+ readonly enum: readonly ErrorType[];
80
+ };
81
+ };
82
+ readonly nonRetryableErrorTypes: {
83
+ readonly type: "array";
84
+ readonly items: {
85
+ readonly type: "string";
86
+ };
87
+ };
88
+ };
89
+ readonly additionalProperties: false;
90
+ };
91
+ readonly runTarget: {
92
+ readonly oneOf: readonly [{
93
+ readonly type: "object";
94
+ readonly required: readonly ["runId"];
95
+ readonly properties: {
96
+ readonly runId: {
97
+ readonly type: "string";
98
+ readonly minLength: 1;
99
+ readonly maxLength: 256;
100
+ };
101
+ };
102
+ readonly additionalProperties: false;
103
+ }, {
104
+ readonly type: "object";
105
+ readonly required: readonly ["parent"];
106
+ readonly properties: {
107
+ readonly parent: {
108
+ readonly const: true;
109
+ };
110
+ };
111
+ readonly additionalProperties: false;
112
+ }, {
113
+ readonly type: "object";
114
+ readonly required: readonly ["childId"];
115
+ readonly properties: {
116
+ readonly childId: {
117
+ readonly type: "string";
118
+ readonly minLength: 1;
119
+ readonly maxLength: 256;
120
+ };
121
+ };
122
+ readonly additionalProperties: false;
123
+ }, {
124
+ readonly type: "object";
125
+ readonly required: readonly ["workflowKey", "workflowId"];
126
+ readonly properties: {
127
+ readonly workflowKey: {
128
+ readonly type: "string";
129
+ readonly minLength: 1;
130
+ readonly maxLength: 256;
131
+ };
132
+ readonly workflowId: {
133
+ readonly type: "string";
134
+ readonly minLength: 1;
135
+ readonly maxLength: 256;
136
+ };
137
+ };
138
+ readonly additionalProperties: false;
139
+ }];
140
+ };
141
+ readonly childOptions: {
142
+ readonly type: "object";
143
+ readonly required: readonly ["parentClosePolicy"];
144
+ readonly properties: {
145
+ readonly parentClosePolicy: {
146
+ readonly enum: readonly ["TERMINATE", "ABANDON", "REQUEST_CANCEL"];
147
+ };
148
+ readonly cancellationType: {
149
+ readonly enum: readonly ["WAIT_CANCELLATION_COMPLETED", "WAIT_CANCELLATION_REQUESTED", "TRY_CANCEL", "ABANDON"];
150
+ };
151
+ readonly taskQueue: {
152
+ readonly type: "string";
153
+ readonly minLength: 1;
154
+ readonly maxLength: 256;
155
+ };
156
+ readonly workflowId: {
157
+ readonly type: "string";
158
+ readonly minLength: 1;
159
+ readonly maxLength: 256;
160
+ };
161
+ readonly priority: {
162
+ readonly type: "integer";
163
+ readonly minimum: 1;
164
+ readonly maximum: 5;
165
+ };
166
+ readonly summary: {
167
+ readonly type: "string";
168
+ readonly maxLength: 200;
169
+ };
170
+ readonly details: {
171
+ readonly type: "string";
172
+ };
173
+ readonly context: {
174
+ readonly type: "object";
175
+ };
176
+ readonly executionTimeout: {
177
+ readonly type: "integer";
178
+ readonly minimum: 0;
179
+ };
180
+ readonly runTimeout: {
181
+ readonly type: "integer";
182
+ readonly minimum: 0;
183
+ };
184
+ readonly workflowTaskTimeout: {
185
+ readonly type: "integer";
186
+ readonly minimum: 0;
187
+ };
188
+ readonly startDelay: {
189
+ readonly type: "integer";
190
+ readonly minimum: 0;
191
+ };
192
+ };
193
+ };
194
+ readonly headers: {
195
+ readonly type: "object";
196
+ readonly additionalProperties: {
197
+ readonly type: "string";
198
+ };
199
+ };
200
+ };
201
+ readonly type: "object";
202
+ readonly required: readonly ["seq", "type", "payload", "createdAt"];
203
+ readonly properties: {
204
+ readonly seq: {
205
+ readonly type: "integer";
206
+ readonly minimum: 1;
207
+ };
208
+ readonly type: {
209
+ readonly enum: readonly ["WORKFLOW_STARTED", "WORKFLOW_TASK_SCHEDULED", "WORKFLOW_TASK_STARTED", "WORKFLOW_TASK_COMPLETED", "WORKFLOW_TASK_FAILED", "WORKFLOW_TASK_TIMED_OUT", "ACTIVITY_SCHEDULED", "ACTIVITY_STARTED", "ACTIVITY_HEARTBEAT", "ACTIVITY_COMPLETED", "ACTIVITY_FAILED", "ACTIVITY_TIMED_OUT", "ACTIVITY_CANCEL_REQUESTED", "ACTIVITY_CANCELLED", "ACTIVITY_PAUSED", "ACTIVITY_UNPAUSED", "ACTIVITY_RESET", "ACTIVITY_OPTIONS_UPDATED", "TIMER_STARTED", "TIMER_FIRED", "TIMER_CANCELLED", "SIGNAL_RECEIVED", "UPDATE_ADMITTED", "UPDATE_ACCEPTED", "UPDATE_COMPLETED", "CHILD_RUN_INITIATED", "CHILD_RUN_STARTED", "CHILD_RUN_COMPLETED", "CHILD_RUN_FAILED", "CHILD_RUN_CANCELLED", "CHILD_RUN_TERMINATED", "CHILD_RUN_TIMED_OUT", "EXTERNAL_RUN_CANCEL_REQUESTED", "EXTERNAL_RUN_CANCEL_RESOLVED", "EXTERNAL_RUN_SIGNALED", "SIDE_EFFECT_RECORDED", "LOCAL_ACTIVITY_COMPLETED", "LOCAL_ACTIVITY_FAILED", "SEARCH_ATTRIBUTES_UPSERTED", "CONTEXT_UPSERTED", "MARKER_RECORDED", "WORKFLOW_CANCEL_REQUESTED", "WORKFLOW_RESET", "VERSIONING_OVERRIDE_SET", "WORKFLOW_COMPLETED", "WORKFLOW_FAILED", "WORKFLOW_CANCELLED", "WORKFLOW_TERMINATED", "WORKFLOW_TIMED_OUT", "WORKFLOW_CONTINUED_AS_NEW"];
210
+ };
211
+ readonly taskId: {
212
+ readonly type: readonly ["string", "null"];
213
+ };
214
+ readonly payload: {
215
+ readonly type: "object";
216
+ };
217
+ readonly createdAt: {
218
+ readonly type: "string";
219
+ readonly minLength: 1;
220
+ };
221
+ readonly dedupeKey: {
222
+ readonly type: readonly ["string", "null"];
223
+ };
224
+ };
225
+ readonly allOf: {
226
+ if: {
227
+ properties: {
228
+ type: {
229
+ const: "WORKFLOW_STARTED" | "WORKFLOW_TASK_SCHEDULED" | "WORKFLOW_TASK_STARTED" | "WORKFLOW_TASK_COMPLETED" | "WORKFLOW_TASK_FAILED" | "WORKFLOW_TASK_TIMED_OUT" | "ACTIVITY_SCHEDULED" | "ACTIVITY_STARTED" | "ACTIVITY_HEARTBEAT" | "ACTIVITY_COMPLETED" | "ACTIVITY_FAILED" | "ACTIVITY_TIMED_OUT" | "ACTIVITY_CANCEL_REQUESTED" | "ACTIVITY_CANCELLED" | "ACTIVITY_PAUSED" | "ACTIVITY_UNPAUSED" | "ACTIVITY_RESET" | "ACTIVITY_OPTIONS_UPDATED" | "TIMER_STARTED" | "TIMER_FIRED" | "TIMER_CANCELLED" | "SIGNAL_RECEIVED" | "UPDATE_ADMITTED" | "UPDATE_ACCEPTED" | "UPDATE_COMPLETED" | "CHILD_RUN_INITIATED" | "CHILD_RUN_STARTED" | "CHILD_RUN_COMPLETED" | "CHILD_RUN_FAILED" | "CHILD_RUN_CANCELLED" | "CHILD_RUN_TERMINATED" | "CHILD_RUN_TIMED_OUT" | "EXTERNAL_RUN_CANCEL_REQUESTED" | "EXTERNAL_RUN_CANCEL_RESOLVED" | "EXTERNAL_RUN_SIGNALED" | "SIDE_EFFECT_RECORDED" | "LOCAL_ACTIVITY_COMPLETED" | "LOCAL_ACTIVITY_FAILED" | "SEARCH_ATTRIBUTES_UPSERTED" | "CONTEXT_UPSERTED" | "MARKER_RECORDED" | "WORKFLOW_CANCEL_REQUESTED" | "WORKFLOW_RESET" | "VERSIONING_OVERRIDE_SET" | "WORKFLOW_COMPLETED" | "WORKFLOW_FAILED" | "WORKFLOW_CANCELLED" | "WORKFLOW_TERMINATED" | "WORKFLOW_TIMED_OUT" | "WORKFLOW_CONTINUED_AS_NEW";
230
+ };
231
+ };
232
+ required: string[];
233
+ };
234
+ then: {
235
+ properties: {
236
+ payload: {
237
+ $ref: string;
238
+ };
239
+ };
240
+ };
241
+ }[];
242
+ readonly $schema: "https://json-schema.org/draft/2020-12/schema";
243
+ readonly $id: "https://docs.fluidgrids.ai/schemas/run-event.schema.json";
244
+ readonly title: "FluidGrids durable-function history event";
245
+ readonly description: "One row of workflow_run_events as the service returns it (offloaded payloads inlined). type is UPPER_SNAKE.";
246
+ };
247
+ /** One workflow-task command. */
248
+ declare const WORKFLOW_COMMAND_SCHEMA: {
249
+ readonly $defs: {
250
+ readonly json: {
251
+ readonly description: "Any JSON value.";
252
+ };
253
+ readonly failure: {
254
+ readonly type: "object";
255
+ readonly required: readonly ["errorType", "message"];
256
+ readonly properties: {
257
+ readonly errorType: {
258
+ readonly enum: readonly ErrorType[];
259
+ };
260
+ readonly message: {
261
+ readonly type: "string";
262
+ };
263
+ readonly type: {
264
+ readonly type: "string";
265
+ };
266
+ readonly details: {};
267
+ readonly nonRetryable: {
268
+ readonly type: "boolean";
269
+ };
270
+ readonly nextRetryDelayMs: {
271
+ readonly type: "integer";
272
+ readonly minimum: 0;
273
+ };
274
+ readonly category: {
275
+ readonly const: "BENIGN";
276
+ };
277
+ readonly timeoutType: {
278
+ readonly type: "string";
279
+ };
280
+ readonly cause: {
281
+ readonly $ref: "#/$defs/failure";
282
+ };
283
+ readonly stackTrace: {
284
+ readonly type: "string";
285
+ };
286
+ readonly source: {
287
+ readonly type: "string";
288
+ };
289
+ };
290
+ readonly additionalProperties: false;
291
+ };
292
+ readonly retryPolicy: {
293
+ readonly type: "object";
294
+ readonly required: readonly ["retryDelay"];
295
+ readonly description: "maxRetries absent means unlimited attempts, bounded by scheduleToCloseTimeout.";
296
+ readonly properties: {
297
+ readonly maxRetries: {
298
+ readonly type: "integer";
299
+ readonly minimum: 0;
300
+ };
301
+ readonly retryDelay: {
302
+ readonly type: "integer";
303
+ readonly minimum: 0;
304
+ };
305
+ readonly backoffMultiplier: {
306
+ readonly type: "number";
307
+ readonly minimum: 1;
308
+ };
309
+ readonly maxDelay: {
310
+ readonly type: "integer";
311
+ readonly minimum: 0;
312
+ };
313
+ readonly retryOnErrorTypes: {
314
+ readonly type: "array";
315
+ readonly items: {
316
+ readonly enum: readonly ErrorType[];
317
+ };
318
+ };
319
+ readonly nonRetryableErrorTypes: {
320
+ readonly type: "array";
321
+ readonly items: {
322
+ readonly type: "string";
323
+ };
324
+ };
325
+ };
326
+ readonly additionalProperties: false;
327
+ };
328
+ readonly runTarget: {
329
+ readonly oneOf: readonly [{
330
+ readonly type: "object";
331
+ readonly required: readonly ["runId"];
332
+ readonly properties: {
333
+ readonly runId: {
334
+ readonly type: "string";
335
+ readonly minLength: 1;
336
+ readonly maxLength: 256;
337
+ };
338
+ };
339
+ readonly additionalProperties: false;
340
+ }, {
341
+ readonly type: "object";
342
+ readonly required: readonly ["parent"];
343
+ readonly properties: {
344
+ readonly parent: {
345
+ readonly const: true;
346
+ };
347
+ };
348
+ readonly additionalProperties: false;
349
+ }, {
350
+ readonly type: "object";
351
+ readonly required: readonly ["childId"];
352
+ readonly properties: {
353
+ readonly childId: {
354
+ readonly type: "string";
355
+ readonly minLength: 1;
356
+ readonly maxLength: 256;
357
+ };
358
+ };
359
+ readonly additionalProperties: false;
360
+ }, {
361
+ readonly type: "object";
362
+ readonly required: readonly ["workflowKey", "workflowId"];
363
+ readonly properties: {
364
+ readonly workflowKey: {
365
+ readonly type: "string";
366
+ readonly minLength: 1;
367
+ readonly maxLength: 256;
368
+ };
369
+ readonly workflowId: {
370
+ readonly type: "string";
371
+ readonly minLength: 1;
372
+ readonly maxLength: 256;
373
+ };
374
+ };
375
+ readonly additionalProperties: false;
376
+ }];
377
+ };
378
+ readonly childOptions: {
379
+ readonly type: "object";
380
+ readonly required: readonly ["parentClosePolicy"];
381
+ readonly properties: {
382
+ readonly parentClosePolicy: {
383
+ readonly enum: readonly ["TERMINATE", "ABANDON", "REQUEST_CANCEL"];
384
+ };
385
+ readonly cancellationType: {
386
+ readonly enum: readonly ["WAIT_CANCELLATION_COMPLETED", "WAIT_CANCELLATION_REQUESTED", "TRY_CANCEL", "ABANDON"];
387
+ };
388
+ readonly taskQueue: {
389
+ readonly type: "string";
390
+ readonly minLength: 1;
391
+ readonly maxLength: 256;
392
+ };
393
+ readonly workflowId: {
394
+ readonly type: "string";
395
+ readonly minLength: 1;
396
+ readonly maxLength: 256;
397
+ };
398
+ readonly priority: {
399
+ readonly type: "integer";
400
+ readonly minimum: 1;
401
+ readonly maximum: 5;
402
+ };
403
+ readonly summary: {
404
+ readonly type: "string";
405
+ readonly maxLength: 200;
406
+ };
407
+ readonly details: {
408
+ readonly type: "string";
409
+ };
410
+ readonly context: {
411
+ readonly type: "object";
412
+ };
413
+ readonly executionTimeout: {
414
+ readonly type: "integer";
415
+ readonly minimum: 0;
416
+ };
417
+ readonly runTimeout: {
418
+ readonly type: "integer";
419
+ readonly minimum: 0;
420
+ };
421
+ readonly workflowTaskTimeout: {
422
+ readonly type: "integer";
423
+ readonly minimum: 0;
424
+ };
425
+ readonly startDelay: {
426
+ readonly type: "integer";
427
+ readonly minimum: 0;
428
+ };
429
+ };
430
+ };
431
+ readonly headers: {
432
+ readonly type: "object";
433
+ readonly additionalProperties: {
434
+ readonly type: "string";
435
+ };
436
+ };
437
+ };
438
+ readonly type: "object";
439
+ readonly required: readonly ["type"];
440
+ readonly properties: {
441
+ readonly type: {
442
+ readonly enum: readonly ["SCHEDULE_ACTIVITY", "REQUEST_CANCEL_ACTIVITY", "START_TIMER", "CANCEL_TIMER", "START_CHILD_RUN", "SIGNAL_RUN", "RECORD_SIDE_EFFECT", "RECORD_MARKER", "COMPLETE_WORKFLOW", "FAIL_WORKFLOW", "CANCEL_WORKFLOW", "UPSERT_CONTEXT", "RECORD_LOCAL_ACTIVITY", "CONTINUE_AS_NEW", "REQUEST_CANCEL_EXTERNAL_RUN", "UPSERT_SEARCH_ATTRIBUTES", "ACCEPT_UPDATE", "REJECT_UPDATE", "COMPLETE_UPDATE"];
443
+ };
444
+ };
445
+ readonly allOf: {
446
+ if: {
447
+ properties: {
448
+ type: {
449
+ const: "SCHEDULE_ACTIVITY" | "REQUEST_CANCEL_ACTIVITY" | "START_TIMER" | "CANCEL_TIMER" | "START_CHILD_RUN" | "SIGNAL_RUN" | "RECORD_SIDE_EFFECT" | "RECORD_MARKER" | "COMPLETE_WORKFLOW" | "FAIL_WORKFLOW" | "CANCEL_WORKFLOW" | "UPSERT_CONTEXT" | "RECORD_LOCAL_ACTIVITY" | "CONTINUE_AS_NEW" | "REQUEST_CANCEL_EXTERNAL_RUN" | "UPSERT_SEARCH_ATTRIBUTES" | "ACCEPT_UPDATE" | "REJECT_UPDATE" | "COMPLETE_UPDATE";
450
+ };
451
+ };
452
+ required: string[];
453
+ };
454
+ then: {
455
+ $ref: string;
456
+ };
457
+ }[];
458
+ readonly $schema: "https://json-schema.org/draft/2020-12/schema";
459
+ readonly $id: "https://docs.fluidgrids.ai/schemas/workflow-command.schema.json";
460
+ readonly title: "FluidGrids workflow-task command";
461
+ readonly description: "A flat object discriminated by an UPPER_SNAKE type. Commands travel as [JSON!]! (DB4). UPSERT_SEARCH_ATTRIBUTES, ACCEPT_UPDATE, REJECT_UPDATE and COMPLETE_UPDATE are defined but refused in Phase B.";
462
+ };
463
+ /** The workflow-task request and result of the runtime ABI. */
464
+ declare const WORKFLOW_TASK_SCHEMA: {
465
+ readonly $schema: "https://json-schema.org/draft/2020-12/schema";
466
+ readonly $id: "https://docs.fluidgrids.ai/schemas/workflow-task.schema.json";
467
+ readonly title: "FluidGrids workflow task (runtime ABI protocol 1)";
468
+ readonly description: "globalThis.__fluidgridsRuntime: start(JSON of request); while (step() === \"more\") drain jobs; complete() returns JSON of result.";
469
+ readonly oneOf: readonly [{
470
+ readonly $ref: "#/$defs/request";
471
+ }, {
472
+ readonly $ref: "#/$defs/result";
473
+ }];
474
+ readonly $defs: {
475
+ readonly event: {
476
+ readonly type: "object";
477
+ readonly required: readonly ["seq", "type", "payload", "createdAt"];
478
+ readonly properties: {
479
+ readonly seq: {
480
+ readonly type: "integer";
481
+ readonly minimum: 1;
482
+ };
483
+ readonly type: {
484
+ readonly enum: readonly ["WORKFLOW_STARTED", "WORKFLOW_TASK_SCHEDULED", "WORKFLOW_TASK_STARTED", "WORKFLOW_TASK_COMPLETED", "WORKFLOW_TASK_FAILED", "WORKFLOW_TASK_TIMED_OUT", "ACTIVITY_SCHEDULED", "ACTIVITY_STARTED", "ACTIVITY_HEARTBEAT", "ACTIVITY_COMPLETED", "ACTIVITY_FAILED", "ACTIVITY_TIMED_OUT", "ACTIVITY_CANCEL_REQUESTED", "ACTIVITY_CANCELLED", "ACTIVITY_PAUSED", "ACTIVITY_UNPAUSED", "ACTIVITY_RESET", "ACTIVITY_OPTIONS_UPDATED", "TIMER_STARTED", "TIMER_FIRED", "TIMER_CANCELLED", "SIGNAL_RECEIVED", "UPDATE_ADMITTED", "UPDATE_ACCEPTED", "UPDATE_COMPLETED", "CHILD_RUN_INITIATED", "CHILD_RUN_STARTED", "CHILD_RUN_COMPLETED", "CHILD_RUN_FAILED", "CHILD_RUN_CANCELLED", "CHILD_RUN_TERMINATED", "CHILD_RUN_TIMED_OUT", "EXTERNAL_RUN_CANCEL_REQUESTED", "EXTERNAL_RUN_CANCEL_RESOLVED", "EXTERNAL_RUN_SIGNALED", "SIDE_EFFECT_RECORDED", "LOCAL_ACTIVITY_COMPLETED", "LOCAL_ACTIVITY_FAILED", "SEARCH_ATTRIBUTES_UPSERTED", "CONTEXT_UPSERTED", "MARKER_RECORDED", "WORKFLOW_CANCEL_REQUESTED", "WORKFLOW_RESET", "VERSIONING_OVERRIDE_SET", "WORKFLOW_COMPLETED", "WORKFLOW_FAILED", "WORKFLOW_CANCELLED", "WORKFLOW_TERMINATED", "WORKFLOW_TIMED_OUT", "WORKFLOW_CONTINUED_AS_NEW"];
485
+ };
486
+ readonly taskId: {
487
+ readonly type: readonly ["string", "null"];
488
+ };
489
+ readonly payload: {
490
+ readonly type: "object";
491
+ };
492
+ readonly createdAt: {
493
+ readonly type: "string";
494
+ readonly minLength: 1;
495
+ };
496
+ readonly dedupeKey: {
497
+ readonly type: readonly ["string", "null"];
498
+ };
499
+ };
500
+ readonly allOf: {
501
+ if: {
502
+ properties: {
503
+ type: {
504
+ const: "WORKFLOW_STARTED" | "WORKFLOW_TASK_SCHEDULED" | "WORKFLOW_TASK_STARTED" | "WORKFLOW_TASK_COMPLETED" | "WORKFLOW_TASK_FAILED" | "WORKFLOW_TASK_TIMED_OUT" | "ACTIVITY_SCHEDULED" | "ACTIVITY_STARTED" | "ACTIVITY_HEARTBEAT" | "ACTIVITY_COMPLETED" | "ACTIVITY_FAILED" | "ACTIVITY_TIMED_OUT" | "ACTIVITY_CANCEL_REQUESTED" | "ACTIVITY_CANCELLED" | "ACTIVITY_PAUSED" | "ACTIVITY_UNPAUSED" | "ACTIVITY_RESET" | "ACTIVITY_OPTIONS_UPDATED" | "TIMER_STARTED" | "TIMER_FIRED" | "TIMER_CANCELLED" | "SIGNAL_RECEIVED" | "UPDATE_ADMITTED" | "UPDATE_ACCEPTED" | "UPDATE_COMPLETED" | "CHILD_RUN_INITIATED" | "CHILD_RUN_STARTED" | "CHILD_RUN_COMPLETED" | "CHILD_RUN_FAILED" | "CHILD_RUN_CANCELLED" | "CHILD_RUN_TERMINATED" | "CHILD_RUN_TIMED_OUT" | "EXTERNAL_RUN_CANCEL_REQUESTED" | "EXTERNAL_RUN_CANCEL_RESOLVED" | "EXTERNAL_RUN_SIGNALED" | "SIDE_EFFECT_RECORDED" | "LOCAL_ACTIVITY_COMPLETED" | "LOCAL_ACTIVITY_FAILED" | "SEARCH_ATTRIBUTES_UPSERTED" | "CONTEXT_UPSERTED" | "MARKER_RECORDED" | "WORKFLOW_CANCEL_REQUESTED" | "WORKFLOW_RESET" | "VERSIONING_OVERRIDE_SET" | "WORKFLOW_COMPLETED" | "WORKFLOW_FAILED" | "WORKFLOW_CANCELLED" | "WORKFLOW_TERMINATED" | "WORKFLOW_TIMED_OUT" | "WORKFLOW_CONTINUED_AS_NEW";
505
+ };
506
+ };
507
+ required: string[];
508
+ };
509
+ then: {
510
+ properties: {
511
+ payload: {
512
+ $ref: string;
513
+ };
514
+ };
515
+ };
516
+ }[];
517
+ };
518
+ readonly command: {
519
+ readonly type: "object";
520
+ readonly required: readonly ["type"];
521
+ readonly properties: {
522
+ readonly type: {
523
+ readonly enum: readonly ["SCHEDULE_ACTIVITY", "REQUEST_CANCEL_ACTIVITY", "START_TIMER", "CANCEL_TIMER", "START_CHILD_RUN", "SIGNAL_RUN", "RECORD_SIDE_EFFECT", "RECORD_MARKER", "COMPLETE_WORKFLOW", "FAIL_WORKFLOW", "CANCEL_WORKFLOW", "UPSERT_CONTEXT", "RECORD_LOCAL_ACTIVITY", "CONTINUE_AS_NEW", "REQUEST_CANCEL_EXTERNAL_RUN", "UPSERT_SEARCH_ATTRIBUTES", "ACCEPT_UPDATE", "REJECT_UPDATE", "COMPLETE_UPDATE"];
524
+ };
525
+ };
526
+ readonly allOf: {
527
+ if: {
528
+ properties: {
529
+ type: {
530
+ const: "SCHEDULE_ACTIVITY" | "REQUEST_CANCEL_ACTIVITY" | "START_TIMER" | "CANCEL_TIMER" | "START_CHILD_RUN" | "SIGNAL_RUN" | "RECORD_SIDE_EFFECT" | "RECORD_MARKER" | "COMPLETE_WORKFLOW" | "FAIL_WORKFLOW" | "CANCEL_WORKFLOW" | "UPSERT_CONTEXT" | "RECORD_LOCAL_ACTIVITY" | "CONTINUE_AS_NEW" | "REQUEST_CANCEL_EXTERNAL_RUN" | "UPSERT_SEARCH_ATTRIBUTES" | "ACCEPT_UPDATE" | "REJECT_UPDATE" | "COMPLETE_UPDATE";
531
+ };
532
+ };
533
+ required: string[];
534
+ };
535
+ then: {
536
+ $ref: string;
537
+ };
538
+ }[];
539
+ };
540
+ readonly info: {
541
+ readonly type: "object";
542
+ readonly required: readonly ["runId", "workspaceId"];
543
+ readonly properties: {
544
+ readonly runId: {
545
+ readonly type: "string";
546
+ readonly minLength: 1;
547
+ readonly maxLength: 256;
548
+ };
549
+ readonly workspaceId: {
550
+ readonly type: "string";
551
+ readonly minLength: 1;
552
+ readonly maxLength: 256;
553
+ };
554
+ readonly workflowKey: {
555
+ readonly type: "string";
556
+ };
557
+ readonly version: {};
558
+ readonly buildId: {
559
+ readonly type: "string";
560
+ };
561
+ readonly businessId: {
562
+ readonly type: "string";
563
+ };
564
+ readonly attempt: {
565
+ readonly type: "integer";
566
+ readonly minimum: 1;
567
+ };
568
+ readonly taskQueue: {
569
+ readonly type: "string";
570
+ };
571
+ readonly parentRunId: {
572
+ readonly type: readonly ["string", "null"];
573
+ };
574
+ readonly rootRunId: {
575
+ readonly type: readonly ["string", "null"];
576
+ };
577
+ readonly firstRunId: {
578
+ readonly type: readonly ["string", "null"];
579
+ };
580
+ readonly continuedFromRunId: {
581
+ readonly type: readonly ["string", "null"];
582
+ };
583
+ readonly lastResult: {};
584
+ readonly lastFailure: {
585
+ readonly oneOf: readonly [{
586
+ readonly type: "null";
587
+ }, {
588
+ readonly $ref: "#/$defs/failure";
589
+ }];
590
+ };
591
+ readonly startedAt: {
592
+ readonly type: "string";
593
+ };
594
+ readonly runStartedAt: {
595
+ readonly type: "string";
596
+ };
597
+ readonly historyLimit: {
598
+ readonly type: "object";
599
+ readonly required: readonly ["events", "bytes"];
600
+ readonly properties: {
601
+ readonly events: {
602
+ readonly type: "integer";
603
+ readonly minimum: 1;
604
+ };
605
+ readonly bytes: {
606
+ readonly type: "integer";
607
+ readonly minimum: 1;
608
+ };
609
+ };
610
+ };
611
+ readonly timeouts: {
612
+ readonly type: "object";
613
+ };
614
+ readonly headers: {
615
+ readonly $ref: "#/$defs/headers";
616
+ };
617
+ readonly priority: {
618
+ readonly type: "integer";
619
+ readonly minimum: 1;
620
+ readonly maximum: 5;
621
+ };
622
+ readonly summary: {
623
+ readonly type: "string";
624
+ };
625
+ readonly details: {
626
+ readonly type: "string";
627
+ };
628
+ readonly context: {
629
+ readonly type: "object";
630
+ };
631
+ };
632
+ };
633
+ readonly request: {
634
+ readonly type: "object";
635
+ readonly required: readonly ["protocol", "kind", "workflowFn", "info", "history", "nowMs"];
636
+ readonly properties: {
637
+ readonly protocol: {
638
+ readonly const: 1;
639
+ };
640
+ readonly kind: {
641
+ readonly enum: readonly ["task", "query", "verify"];
642
+ };
643
+ readonly workflowFn: {
644
+ readonly type: "string";
645
+ readonly minLength: 1;
646
+ readonly maxLength: 256;
647
+ };
648
+ readonly info: {
649
+ readonly $ref: "#/$defs/info";
650
+ };
651
+ readonly history: {
652
+ readonly type: "array";
653
+ readonly items: {
654
+ readonly $ref: "#/$defs/event";
655
+ };
656
+ };
657
+ readonly nowMs: {
658
+ readonly type: "number";
659
+ };
660
+ readonly localActivityResults: {
661
+ readonly type: "array";
662
+ readonly items: {
663
+ readonly type: "object";
664
+ readonly required: readonly ["localActivityId", "attempts"];
665
+ readonly properties: {
666
+ readonly localActivityId: {
667
+ readonly type: "string";
668
+ readonly minLength: 1;
669
+ readonly maxLength: 256;
670
+ };
671
+ readonly result: {};
672
+ readonly failure: {
673
+ readonly $ref: "#/$defs/failure";
674
+ };
675
+ readonly attempts: {
676
+ readonly type: "integer";
677
+ readonly minimum: 1;
678
+ };
679
+ };
680
+ };
681
+ };
682
+ readonly queries: {
683
+ readonly type: "array";
684
+ readonly items: {
685
+ readonly type: "object";
686
+ readonly required: readonly ["queryId", "name"];
687
+ readonly properties: {
688
+ readonly queryId: {
689
+ readonly type: "string";
690
+ readonly minLength: 1;
691
+ readonly maxLength: 256;
692
+ };
693
+ readonly name: {
694
+ readonly enum: readonly BuiltInQueryName[];
695
+ };
696
+ readonly args: {};
697
+ };
698
+ };
699
+ };
700
+ };
701
+ };
702
+ readonly result: {
703
+ readonly type: "object";
704
+ readonly required: readonly ["protocol", "outcome", "commands", "logs"];
705
+ readonly properties: {
706
+ readonly protocol: {
707
+ readonly const: 1;
708
+ };
709
+ readonly outcome: {
710
+ readonly enum: readonly ["commands", "failed", "localActivityRequested"];
711
+ };
712
+ readonly commands: {
713
+ readonly type: "array";
714
+ readonly items: {
715
+ readonly $ref: "#/$defs/command";
716
+ };
717
+ };
718
+ readonly localActivityRequests: {
719
+ readonly type: "array";
720
+ readonly items: {
721
+ readonly type: "object";
722
+ };
723
+ };
724
+ readonly queryResults: {
725
+ readonly type: "array";
726
+ readonly items: {
727
+ readonly type: "object";
728
+ readonly required: readonly ["queryId"];
729
+ readonly properties: {
730
+ readonly queryId: {
731
+ readonly type: "string";
732
+ readonly minLength: 1;
733
+ readonly maxLength: 256;
734
+ };
735
+ readonly value: {};
736
+ readonly error: {
737
+ readonly type: "string";
738
+ };
739
+ };
740
+ };
741
+ };
742
+ readonly failure: {
743
+ readonly type: "object";
744
+ readonly required: readonly ["cause", "message"];
745
+ readonly properties: {
746
+ readonly cause: {
747
+ readonly enum: readonly ["NON_DETERMINISM", "TASK_TIMEOUT", "ISOLATE_MEMORY", "PROTOCOL_MISMATCH", "BUNDLE_UNAVAILABLE", "BUNDLE_INTEGRITY", "WORKFLOW_CODE_ERROR", "HISTORY_LIMIT", "UNSUPPORTED_COMMAND", "INVALID_REQUEST", "INTERNAL"];
748
+ };
749
+ readonly message: {
750
+ readonly type: "string";
751
+ };
752
+ readonly stackTrace: {
753
+ readonly type: "string";
754
+ };
755
+ readonly seq: {
756
+ readonly type: "integer";
757
+ };
758
+ readonly errorType: {
759
+ readonly type: "string";
760
+ };
761
+ };
762
+ };
763
+ readonly logs: {
764
+ readonly type: "array";
765
+ readonly items: {
766
+ readonly type: "object";
767
+ readonly required: readonly ["level", "message"];
768
+ readonly properties: {
769
+ readonly level: {
770
+ readonly enum: readonly ["debug", "info", "warn", "error"];
771
+ };
772
+ readonly message: {
773
+ readonly type: "string";
774
+ };
775
+ readonly data: {};
776
+ };
777
+ };
778
+ };
779
+ readonly stackTrace: {
780
+ readonly type: "string";
781
+ };
782
+ };
783
+ };
784
+ readonly json: {
785
+ readonly description: "Any JSON value.";
786
+ };
787
+ readonly failure: {
788
+ readonly type: "object";
789
+ readonly required: readonly ["errorType", "message"];
790
+ readonly properties: {
791
+ readonly errorType: {
792
+ readonly enum: readonly ErrorType[];
793
+ };
794
+ readonly message: {
795
+ readonly type: "string";
796
+ };
797
+ readonly type: {
798
+ readonly type: "string";
799
+ };
800
+ readonly details: {};
801
+ readonly nonRetryable: {
802
+ readonly type: "boolean";
803
+ };
804
+ readonly nextRetryDelayMs: {
805
+ readonly type: "integer";
806
+ readonly minimum: 0;
807
+ };
808
+ readonly category: {
809
+ readonly const: "BENIGN";
810
+ };
811
+ readonly timeoutType: {
812
+ readonly type: "string";
813
+ };
814
+ readonly cause: {
815
+ readonly $ref: "#/$defs/failure";
816
+ };
817
+ readonly stackTrace: {
818
+ readonly type: "string";
819
+ };
820
+ readonly source: {
821
+ readonly type: "string";
822
+ };
823
+ };
824
+ readonly additionalProperties: false;
825
+ };
826
+ readonly retryPolicy: {
827
+ readonly type: "object";
828
+ readonly required: readonly ["retryDelay"];
829
+ readonly description: "maxRetries absent means unlimited attempts, bounded by scheduleToCloseTimeout.";
830
+ readonly properties: {
831
+ readonly maxRetries: {
832
+ readonly type: "integer";
833
+ readonly minimum: 0;
834
+ };
835
+ readonly retryDelay: {
836
+ readonly type: "integer";
837
+ readonly minimum: 0;
838
+ };
839
+ readonly backoffMultiplier: {
840
+ readonly type: "number";
841
+ readonly minimum: 1;
842
+ };
843
+ readonly maxDelay: {
844
+ readonly type: "integer";
845
+ readonly minimum: 0;
846
+ };
847
+ readonly retryOnErrorTypes: {
848
+ readonly type: "array";
849
+ readonly items: {
850
+ readonly enum: readonly ErrorType[];
851
+ };
852
+ };
853
+ readonly nonRetryableErrorTypes: {
854
+ readonly type: "array";
855
+ readonly items: {
856
+ readonly type: "string";
857
+ };
858
+ };
859
+ };
860
+ readonly additionalProperties: false;
861
+ };
862
+ readonly runTarget: {
863
+ readonly oneOf: readonly [{
864
+ readonly type: "object";
865
+ readonly required: readonly ["runId"];
866
+ readonly properties: {
867
+ readonly runId: {
868
+ readonly type: "string";
869
+ readonly minLength: 1;
870
+ readonly maxLength: 256;
871
+ };
872
+ };
873
+ readonly additionalProperties: false;
874
+ }, {
875
+ readonly type: "object";
876
+ readonly required: readonly ["parent"];
877
+ readonly properties: {
878
+ readonly parent: {
879
+ readonly const: true;
880
+ };
881
+ };
882
+ readonly additionalProperties: false;
883
+ }, {
884
+ readonly type: "object";
885
+ readonly required: readonly ["childId"];
886
+ readonly properties: {
887
+ readonly childId: {
888
+ readonly type: "string";
889
+ readonly minLength: 1;
890
+ readonly maxLength: 256;
891
+ };
892
+ };
893
+ readonly additionalProperties: false;
894
+ }, {
895
+ readonly type: "object";
896
+ readonly required: readonly ["workflowKey", "workflowId"];
897
+ readonly properties: {
898
+ readonly workflowKey: {
899
+ readonly type: "string";
900
+ readonly minLength: 1;
901
+ readonly maxLength: 256;
902
+ };
903
+ readonly workflowId: {
904
+ readonly type: "string";
905
+ readonly minLength: 1;
906
+ readonly maxLength: 256;
907
+ };
908
+ };
909
+ readonly additionalProperties: false;
910
+ }];
911
+ };
912
+ readonly childOptions: {
913
+ readonly type: "object";
914
+ readonly required: readonly ["parentClosePolicy"];
915
+ readonly properties: {
916
+ readonly parentClosePolicy: {
917
+ readonly enum: readonly ["TERMINATE", "ABANDON", "REQUEST_CANCEL"];
918
+ };
919
+ readonly cancellationType: {
920
+ readonly enum: readonly ["WAIT_CANCELLATION_COMPLETED", "WAIT_CANCELLATION_REQUESTED", "TRY_CANCEL", "ABANDON"];
921
+ };
922
+ readonly taskQueue: {
923
+ readonly type: "string";
924
+ readonly minLength: 1;
925
+ readonly maxLength: 256;
926
+ };
927
+ readonly workflowId: {
928
+ readonly type: "string";
929
+ readonly minLength: 1;
930
+ readonly maxLength: 256;
931
+ };
932
+ readonly priority: {
933
+ readonly type: "integer";
934
+ readonly minimum: 1;
935
+ readonly maximum: 5;
936
+ };
937
+ readonly summary: {
938
+ readonly type: "string";
939
+ readonly maxLength: 200;
940
+ };
941
+ readonly details: {
942
+ readonly type: "string";
943
+ };
944
+ readonly context: {
945
+ readonly type: "object";
946
+ };
947
+ readonly executionTimeout: {
948
+ readonly type: "integer";
949
+ readonly minimum: 0;
950
+ };
951
+ readonly runTimeout: {
952
+ readonly type: "integer";
953
+ readonly minimum: 0;
954
+ };
955
+ readonly workflowTaskTimeout: {
956
+ readonly type: "integer";
957
+ readonly minimum: 0;
958
+ };
959
+ readonly startDelay: {
960
+ readonly type: "integer";
961
+ readonly minimum: 0;
962
+ };
963
+ };
964
+ };
965
+ readonly headers: {
966
+ readonly type: "object";
967
+ readonly additionalProperties: {
968
+ readonly type: "string";
969
+ };
970
+ };
971
+ };
972
+ };
973
+ /** A downloaded or recorded history (`fluidgrids history`, conformance fixtures). */
974
+ declare const HISTORY_FILE_SCHEMA: {
975
+ readonly $schema: "https://json-schema.org/draft/2020-12/schema";
976
+ readonly $id: "https://docs.fluidgrids.ai/schemas/history-file.schema.json";
977
+ readonly title: "FluidGrids durable-function history file";
978
+ readonly type: "object";
979
+ readonly required: readonly ["format", "formatVersion", "workflowFn", "events"];
980
+ readonly properties: {
981
+ readonly format: {
982
+ readonly const: "fluidgrids.history";
983
+ };
984
+ readonly formatVersion: {
985
+ readonly const: 1;
986
+ };
987
+ readonly name: {
988
+ readonly type: "string";
989
+ };
990
+ readonly description: {
991
+ readonly type: "string";
992
+ };
993
+ readonly workflowFn: {
994
+ readonly type: "string";
995
+ readonly minLength: 1;
996
+ readonly maxLength: 256;
997
+ };
998
+ readonly source: {
999
+ readonly type: "string";
1000
+ readonly description: "Fixture source module, relative to the file.";
1001
+ };
1002
+ readonly replaySource: {
1003
+ readonly type: "string";
1004
+ readonly description: "Fixture module the replay check runs instead of source (a hotfix or a patched() version).";
1005
+ };
1006
+ readonly replay: {
1007
+ readonly type: "boolean";
1008
+ readonly description: "False for histories that use Phase C features (updates); they are parsed and projected but not replayed.";
1009
+ };
1010
+ readonly info: {
1011
+ readonly $ref: "#/$defs/info";
1012
+ };
1013
+ readonly nowMs: {
1014
+ readonly type: "number";
1015
+ readonly description: "nowMs of the replay request for the conformance check.";
1016
+ };
1017
+ readonly events: {
1018
+ readonly type: "array";
1019
+ readonly items: {
1020
+ readonly $ref: "#/$defs/event";
1021
+ };
1022
+ };
1023
+ readonly expected: {
1024
+ readonly type: "object";
1025
+ readonly description: "The replay result the conformance check must reproduce.";
1026
+ };
1027
+ };
1028
+ readonly $defs: {
1029
+ readonly event: {
1030
+ readonly type: "object";
1031
+ readonly required: readonly ["seq", "type", "payload", "createdAt"];
1032
+ readonly properties: {
1033
+ readonly seq: {
1034
+ readonly type: "integer";
1035
+ readonly minimum: 1;
1036
+ };
1037
+ readonly type: {
1038
+ readonly enum: readonly ["WORKFLOW_STARTED", "WORKFLOW_TASK_SCHEDULED", "WORKFLOW_TASK_STARTED", "WORKFLOW_TASK_COMPLETED", "WORKFLOW_TASK_FAILED", "WORKFLOW_TASK_TIMED_OUT", "ACTIVITY_SCHEDULED", "ACTIVITY_STARTED", "ACTIVITY_HEARTBEAT", "ACTIVITY_COMPLETED", "ACTIVITY_FAILED", "ACTIVITY_TIMED_OUT", "ACTIVITY_CANCEL_REQUESTED", "ACTIVITY_CANCELLED", "ACTIVITY_PAUSED", "ACTIVITY_UNPAUSED", "ACTIVITY_RESET", "ACTIVITY_OPTIONS_UPDATED", "TIMER_STARTED", "TIMER_FIRED", "TIMER_CANCELLED", "SIGNAL_RECEIVED", "UPDATE_ADMITTED", "UPDATE_ACCEPTED", "UPDATE_COMPLETED", "CHILD_RUN_INITIATED", "CHILD_RUN_STARTED", "CHILD_RUN_COMPLETED", "CHILD_RUN_FAILED", "CHILD_RUN_CANCELLED", "CHILD_RUN_TERMINATED", "CHILD_RUN_TIMED_OUT", "EXTERNAL_RUN_CANCEL_REQUESTED", "EXTERNAL_RUN_CANCEL_RESOLVED", "EXTERNAL_RUN_SIGNALED", "SIDE_EFFECT_RECORDED", "LOCAL_ACTIVITY_COMPLETED", "LOCAL_ACTIVITY_FAILED", "SEARCH_ATTRIBUTES_UPSERTED", "CONTEXT_UPSERTED", "MARKER_RECORDED", "WORKFLOW_CANCEL_REQUESTED", "WORKFLOW_RESET", "VERSIONING_OVERRIDE_SET", "WORKFLOW_COMPLETED", "WORKFLOW_FAILED", "WORKFLOW_CANCELLED", "WORKFLOW_TERMINATED", "WORKFLOW_TIMED_OUT", "WORKFLOW_CONTINUED_AS_NEW"];
1039
+ };
1040
+ readonly taskId: {
1041
+ readonly type: readonly ["string", "null"];
1042
+ };
1043
+ readonly payload: {
1044
+ readonly type: "object";
1045
+ };
1046
+ readonly createdAt: {
1047
+ readonly type: "string";
1048
+ readonly minLength: 1;
1049
+ };
1050
+ readonly dedupeKey: {
1051
+ readonly type: readonly ["string", "null"];
1052
+ };
1053
+ };
1054
+ readonly allOf: {
1055
+ if: {
1056
+ properties: {
1057
+ type: {
1058
+ const: "WORKFLOW_STARTED" | "WORKFLOW_TASK_SCHEDULED" | "WORKFLOW_TASK_STARTED" | "WORKFLOW_TASK_COMPLETED" | "WORKFLOW_TASK_FAILED" | "WORKFLOW_TASK_TIMED_OUT" | "ACTIVITY_SCHEDULED" | "ACTIVITY_STARTED" | "ACTIVITY_HEARTBEAT" | "ACTIVITY_COMPLETED" | "ACTIVITY_FAILED" | "ACTIVITY_TIMED_OUT" | "ACTIVITY_CANCEL_REQUESTED" | "ACTIVITY_CANCELLED" | "ACTIVITY_PAUSED" | "ACTIVITY_UNPAUSED" | "ACTIVITY_RESET" | "ACTIVITY_OPTIONS_UPDATED" | "TIMER_STARTED" | "TIMER_FIRED" | "TIMER_CANCELLED" | "SIGNAL_RECEIVED" | "UPDATE_ADMITTED" | "UPDATE_ACCEPTED" | "UPDATE_COMPLETED" | "CHILD_RUN_INITIATED" | "CHILD_RUN_STARTED" | "CHILD_RUN_COMPLETED" | "CHILD_RUN_FAILED" | "CHILD_RUN_CANCELLED" | "CHILD_RUN_TERMINATED" | "CHILD_RUN_TIMED_OUT" | "EXTERNAL_RUN_CANCEL_REQUESTED" | "EXTERNAL_RUN_CANCEL_RESOLVED" | "EXTERNAL_RUN_SIGNALED" | "SIDE_EFFECT_RECORDED" | "LOCAL_ACTIVITY_COMPLETED" | "LOCAL_ACTIVITY_FAILED" | "SEARCH_ATTRIBUTES_UPSERTED" | "CONTEXT_UPSERTED" | "MARKER_RECORDED" | "WORKFLOW_CANCEL_REQUESTED" | "WORKFLOW_RESET" | "VERSIONING_OVERRIDE_SET" | "WORKFLOW_COMPLETED" | "WORKFLOW_FAILED" | "WORKFLOW_CANCELLED" | "WORKFLOW_TERMINATED" | "WORKFLOW_TIMED_OUT" | "WORKFLOW_CONTINUED_AS_NEW";
1059
+ };
1060
+ };
1061
+ required: string[];
1062
+ };
1063
+ then: {
1064
+ properties: {
1065
+ payload: {
1066
+ $ref: string;
1067
+ };
1068
+ };
1069
+ };
1070
+ }[];
1071
+ };
1072
+ readonly info: {
1073
+ readonly type: "object";
1074
+ readonly required: readonly ["runId", "workspaceId"];
1075
+ readonly properties: {
1076
+ readonly runId: {
1077
+ readonly type: "string";
1078
+ readonly minLength: 1;
1079
+ readonly maxLength: 256;
1080
+ };
1081
+ readonly workspaceId: {
1082
+ readonly type: "string";
1083
+ readonly minLength: 1;
1084
+ readonly maxLength: 256;
1085
+ };
1086
+ readonly workflowKey: {
1087
+ readonly type: "string";
1088
+ };
1089
+ readonly version: {};
1090
+ readonly buildId: {
1091
+ readonly type: "string";
1092
+ };
1093
+ readonly businessId: {
1094
+ readonly type: "string";
1095
+ };
1096
+ readonly attempt: {
1097
+ readonly type: "integer";
1098
+ readonly minimum: 1;
1099
+ };
1100
+ readonly taskQueue: {
1101
+ readonly type: "string";
1102
+ };
1103
+ readonly parentRunId: {
1104
+ readonly type: readonly ["string", "null"];
1105
+ };
1106
+ readonly rootRunId: {
1107
+ readonly type: readonly ["string", "null"];
1108
+ };
1109
+ readonly firstRunId: {
1110
+ readonly type: readonly ["string", "null"];
1111
+ };
1112
+ readonly continuedFromRunId: {
1113
+ readonly type: readonly ["string", "null"];
1114
+ };
1115
+ readonly lastResult: {};
1116
+ readonly lastFailure: {
1117
+ readonly oneOf: readonly [{
1118
+ readonly type: "null";
1119
+ }, {
1120
+ readonly $ref: "#/$defs/failure";
1121
+ }];
1122
+ };
1123
+ readonly startedAt: {
1124
+ readonly type: "string";
1125
+ };
1126
+ readonly runStartedAt: {
1127
+ readonly type: "string";
1128
+ };
1129
+ readonly historyLimit: {
1130
+ readonly type: "object";
1131
+ readonly required: readonly ["events", "bytes"];
1132
+ readonly properties: {
1133
+ readonly events: {
1134
+ readonly type: "integer";
1135
+ readonly minimum: 1;
1136
+ };
1137
+ readonly bytes: {
1138
+ readonly type: "integer";
1139
+ readonly minimum: 1;
1140
+ };
1141
+ };
1142
+ };
1143
+ readonly timeouts: {
1144
+ readonly type: "object";
1145
+ };
1146
+ readonly headers: {
1147
+ readonly $ref: "#/$defs/headers";
1148
+ };
1149
+ readonly priority: {
1150
+ readonly type: "integer";
1151
+ readonly minimum: 1;
1152
+ readonly maximum: 5;
1153
+ };
1154
+ readonly summary: {
1155
+ readonly type: "string";
1156
+ };
1157
+ readonly details: {
1158
+ readonly type: "string";
1159
+ };
1160
+ readonly context: {
1161
+ readonly type: "object";
1162
+ };
1163
+ };
1164
+ };
1165
+ readonly json: {
1166
+ readonly description: "Any JSON value.";
1167
+ };
1168
+ readonly failure: {
1169
+ readonly type: "object";
1170
+ readonly required: readonly ["errorType", "message"];
1171
+ readonly properties: {
1172
+ readonly errorType: {
1173
+ readonly enum: readonly ErrorType[];
1174
+ };
1175
+ readonly message: {
1176
+ readonly type: "string";
1177
+ };
1178
+ readonly type: {
1179
+ readonly type: "string";
1180
+ };
1181
+ readonly details: {};
1182
+ readonly nonRetryable: {
1183
+ readonly type: "boolean";
1184
+ };
1185
+ readonly nextRetryDelayMs: {
1186
+ readonly type: "integer";
1187
+ readonly minimum: 0;
1188
+ };
1189
+ readonly category: {
1190
+ readonly const: "BENIGN";
1191
+ };
1192
+ readonly timeoutType: {
1193
+ readonly type: "string";
1194
+ };
1195
+ readonly cause: {
1196
+ readonly $ref: "#/$defs/failure";
1197
+ };
1198
+ readonly stackTrace: {
1199
+ readonly type: "string";
1200
+ };
1201
+ readonly source: {
1202
+ readonly type: "string";
1203
+ };
1204
+ };
1205
+ readonly additionalProperties: false;
1206
+ };
1207
+ readonly retryPolicy: {
1208
+ readonly type: "object";
1209
+ readonly required: readonly ["retryDelay"];
1210
+ readonly description: "maxRetries absent means unlimited attempts, bounded by scheduleToCloseTimeout.";
1211
+ readonly properties: {
1212
+ readonly maxRetries: {
1213
+ readonly type: "integer";
1214
+ readonly minimum: 0;
1215
+ };
1216
+ readonly retryDelay: {
1217
+ readonly type: "integer";
1218
+ readonly minimum: 0;
1219
+ };
1220
+ readonly backoffMultiplier: {
1221
+ readonly type: "number";
1222
+ readonly minimum: 1;
1223
+ };
1224
+ readonly maxDelay: {
1225
+ readonly type: "integer";
1226
+ readonly minimum: 0;
1227
+ };
1228
+ readonly retryOnErrorTypes: {
1229
+ readonly type: "array";
1230
+ readonly items: {
1231
+ readonly enum: readonly ErrorType[];
1232
+ };
1233
+ };
1234
+ readonly nonRetryableErrorTypes: {
1235
+ readonly type: "array";
1236
+ readonly items: {
1237
+ readonly type: "string";
1238
+ };
1239
+ };
1240
+ };
1241
+ readonly additionalProperties: false;
1242
+ };
1243
+ readonly runTarget: {
1244
+ readonly oneOf: readonly [{
1245
+ readonly type: "object";
1246
+ readonly required: readonly ["runId"];
1247
+ readonly properties: {
1248
+ readonly runId: {
1249
+ readonly type: "string";
1250
+ readonly minLength: 1;
1251
+ readonly maxLength: 256;
1252
+ };
1253
+ };
1254
+ readonly additionalProperties: false;
1255
+ }, {
1256
+ readonly type: "object";
1257
+ readonly required: readonly ["parent"];
1258
+ readonly properties: {
1259
+ readonly parent: {
1260
+ readonly const: true;
1261
+ };
1262
+ };
1263
+ readonly additionalProperties: false;
1264
+ }, {
1265
+ readonly type: "object";
1266
+ readonly required: readonly ["childId"];
1267
+ readonly properties: {
1268
+ readonly childId: {
1269
+ readonly type: "string";
1270
+ readonly minLength: 1;
1271
+ readonly maxLength: 256;
1272
+ };
1273
+ };
1274
+ readonly additionalProperties: false;
1275
+ }, {
1276
+ readonly type: "object";
1277
+ readonly required: readonly ["workflowKey", "workflowId"];
1278
+ readonly properties: {
1279
+ readonly workflowKey: {
1280
+ readonly type: "string";
1281
+ readonly minLength: 1;
1282
+ readonly maxLength: 256;
1283
+ };
1284
+ readonly workflowId: {
1285
+ readonly type: "string";
1286
+ readonly minLength: 1;
1287
+ readonly maxLength: 256;
1288
+ };
1289
+ };
1290
+ readonly additionalProperties: false;
1291
+ }];
1292
+ };
1293
+ readonly childOptions: {
1294
+ readonly type: "object";
1295
+ readonly required: readonly ["parentClosePolicy"];
1296
+ readonly properties: {
1297
+ readonly parentClosePolicy: {
1298
+ readonly enum: readonly ["TERMINATE", "ABANDON", "REQUEST_CANCEL"];
1299
+ };
1300
+ readonly cancellationType: {
1301
+ readonly enum: readonly ["WAIT_CANCELLATION_COMPLETED", "WAIT_CANCELLATION_REQUESTED", "TRY_CANCEL", "ABANDON"];
1302
+ };
1303
+ readonly taskQueue: {
1304
+ readonly type: "string";
1305
+ readonly minLength: 1;
1306
+ readonly maxLength: 256;
1307
+ };
1308
+ readonly workflowId: {
1309
+ readonly type: "string";
1310
+ readonly minLength: 1;
1311
+ readonly maxLength: 256;
1312
+ };
1313
+ readonly priority: {
1314
+ readonly type: "integer";
1315
+ readonly minimum: 1;
1316
+ readonly maximum: 5;
1317
+ };
1318
+ readonly summary: {
1319
+ readonly type: "string";
1320
+ readonly maxLength: 200;
1321
+ };
1322
+ readonly details: {
1323
+ readonly type: "string";
1324
+ };
1325
+ readonly context: {
1326
+ readonly type: "object";
1327
+ };
1328
+ readonly executionTimeout: {
1329
+ readonly type: "integer";
1330
+ readonly minimum: 0;
1331
+ };
1332
+ readonly runTimeout: {
1333
+ readonly type: "integer";
1334
+ readonly minimum: 0;
1335
+ };
1336
+ readonly workflowTaskTimeout: {
1337
+ readonly type: "integer";
1338
+ readonly minimum: 0;
1339
+ };
1340
+ readonly startDelay: {
1341
+ readonly type: "integer";
1342
+ readonly minimum: 0;
1343
+ };
1344
+ };
1345
+ };
1346
+ readonly headers: {
1347
+ readonly type: "object";
1348
+ readonly additionalProperties: {
1349
+ readonly type: "string";
1350
+ };
1351
+ };
1352
+ };
1353
+ };
1354
+ /** File name and schema of every generated history schema. */
1355
+ declare const HISTORY_SCHEMA_FILES: ReadonlyArray<readonly [string, unknown]>;
1356
+
1357
+ /** Command helpers shared by validation and the state machine; no schema code. */
1358
+
1359
+ /** One problem found in a command batch or a history. */
1360
+ interface HistoryIssue {
1361
+ /** Index of the command or event. */
1362
+ index: number;
1363
+ code: string;
1364
+ message: string;
1365
+ path?: string;
1366
+ }
1367
+ /**
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.
1370
+ */
1371
+ declare function isCommandEnabled(type: CommandType, enabled?: 'core' | 'parity'): boolean;
1372
+ /**
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.
1378
+ */
1379
+ declare function isWorkflowCommandEnabled(command: WorkflowCommand, enabled?: 'core' | 'parity'): boolean;
1380
+
1381
+ /**
1382
+ * The pure state machine of a durable-function run (DB3): what a command batch
1383
+ * appends (`eventsForCommands`), and what a run looks like after a history
1384
+ * (`applyEvent`, `projectRunState`). The service appends exactly the events
1385
+ * this module returns, the test environment is built on it, and the
1386
+ * conformance fixtures check both against the runtime.
1387
+ *
1388
+ * Nothing here needs a database: the service adds node-type installation,
1389
+ * connection resolution, target lookups and caps on top.
1390
+ */
1391
+
1392
+ type RunStatus = 'RUNNING' | 'COMPLETED' | 'FAILED' | 'CANCELLED' | 'TERMINATED' | 'TIMED_OUT' | 'CONTINUED_AS_NEW';
1393
+ type ActivityStatus = 'SCHEDULED' | 'STARTED' | 'COMPLETED' | 'FAILED' | 'TIMED_OUT' | 'CANCEL_REQUESTED' | 'CANCELLED';
1394
+ interface ActivityState {
1395
+ status: ActivityStatus;
1396
+ attempt: number;
1397
+ nodeType: string;
1398
+ operation: string;
1399
+ scheduledSeq: number;
1400
+ cancellationType?: string;
1401
+ summary?: string;
1402
+ lastFailure?: Failure;
1403
+ }
1404
+ interface TimerState {
1405
+ status: 'PENDING' | 'FIRED' | 'CANCELLED';
1406
+ durationMs: number;
1407
+ fireAt: string;
1408
+ startedSeq: number;
1409
+ summary?: string;
1410
+ }
1411
+ type ChildStatus = 'INITIATED' | 'STARTED' | 'COMPLETED' | 'FAILED' | 'CANCELLED' | 'TERMINATED' | 'TIMED_OUT';
1412
+ interface ChildState {
1413
+ status: ChildStatus;
1414
+ childRunId?: string;
1415
+ workflowKey?: string;
1416
+ workflowFn?: string;
1417
+ parentClosePolicy: ParentClosePolicy;
1418
+ initiatedSeq: number;
1419
+ }
1420
+ interface ExternalState {
1421
+ kind: 'signal' | 'cancel';
1422
+ status: 'PENDING' | 'RESOLVED';
1423
+ ok?: boolean;
1424
+ }
1425
+ /** A run as its history describes it. */
1426
+ interface RunState {
1427
+ status: RunStatus;
1428
+ historyLength: number;
1429
+ /** UTF-8 bytes of the JSON payloads (the inline-bytes cap counts these). */
1430
+ historyBytes: number;
1431
+ workflowFn?: string;
1432
+ input?: Json;
1433
+ output?: Json;
1434
+ failure?: Failure;
1435
+ cancelRequested: boolean;
1436
+ /** The workflow task: none pending, scheduled, or started (by `taskId`). */
1437
+ task: {
1438
+ state: 'NONE' | 'SCHEDULED' | 'STARTED';
1439
+ taskId?: string;
1440
+ attempt: number;
1441
+ };
1442
+ /** Workflow tasks completed so far. */
1443
+ completedTasks: number;
1444
+ /** Consecutive failed attempts of the current task. */
1445
+ taskFailures: number;
1446
+ activities: Record<string, ActivityState>;
1447
+ timers: Record<string, TimerState>;
1448
+ children: Record<string, ChildState>;
1449
+ externals: Record<string, ExternalState>;
1450
+ sideEffects: Record<string, Json>;
1451
+ markers: Record<string, Json>;
1452
+ signalsReceived: number;
1453
+ context: JsonObject;
1454
+ lastEventAt?: string;
1455
+ }
1456
+ /** A history that breaks the state machine (an event that cannot follow the ones before it). */
1457
+ declare class HistoryStateError extends Error {
1458
+ readonly seq: number;
1459
+ constructor(message: string, seq: number);
1460
+ }
1461
+ /** The state before any event. */
1462
+ declare function initialRunState(): RunState;
1463
+ /** UTF-8 length of a string (the history byte caps count UTF-8). */
1464
+ declare function utf8Bytes(text: string): number;
1465
+ /** True while an activity may still produce a result. */
1466
+ declare function isActivityOpen(activity: ActivityState): boolean;
1467
+ /** True while a child may still produce a result. */
1468
+ declare function isChildOpen(child: ChildState): boolean;
1469
+ /**
1470
+ * Apply one event to `state` (mutated and returned). Throws
1471
+ * {@link HistoryStateError} when the event cannot follow the history so far.
1472
+ */
1473
+ declare function applyEvent(state: RunState, event: RunEventRecord): RunState;
1474
+ /** Fold a whole history into a {@link RunState}. */
1475
+ declare function projectRunState(history: readonly RunEventRecord[]): RunState;
1476
+ /** Counts the service checks against its caps (2,000 each by default). */
1477
+ declare function pendingCounts(state: RunState): {
1478
+ activities: number;
1479
+ timers: number;
1480
+ children: number;
1481
+ };
1482
+ interface EventsForCommandsContext {
1483
+ /** The task that produced the commands; written as each event's `taskId`. */
1484
+ taskId: string;
1485
+ /** Task start time (the request's `nowMs`); timers fire at `nowMs + durationMs`. */
1486
+ nowMs: number;
1487
+ /** Which commands are enabled (see `validateCommands`). Default `core`. */
1488
+ enabled?: 'core' | 'parity';
1489
+ }
1490
+ type EventsForCommandsResult = {
1491
+ ok: true;
1492
+ events: RunEventDraft[];
1493
+ } | {
1494
+ ok: false;
1495
+ cause: WorkflowTaskFailureCause;
1496
+ issues: HistoryIssue[];
1497
+ };
1498
+ /**
1499
+ * The events a command batch appends, in order, or why the batch is refused.
1500
+ * Commands must already have passed `validateCommands`; this checks them
1501
+ * against the run (ids not reused, cancels of open work only, the run still
1502
+ * running). `state` is not changed.
1503
+ */
1504
+ declare function eventsForCommands(state: RunState, commands: readonly WorkflowCommand[], context: EventsForCommandsContext): EventsForCommandsResult;
1505
+ /**
1506
+ * The events the service appends when a task completes, before the command
1507
+ * events (C-HIST rule 3): `WORKFLOW_TASK_STARTED` first when the attempt was
1508
+ * transient (nothing was written at its start), then `WORKFLOW_TASK_COMPLETED`.
1509
+ */
1510
+ declare function taskCompletedEvents(options: {
1511
+ taskId: string;
1512
+ attempt: number;
1513
+ transient: boolean;
1514
+ startedAt: string;
1515
+ /** The history length the attempt was leased with (`run.taskStartedSeq`). */
1516
+ historyLength: number;
1517
+ buildId?: string;
1518
+ workerId?: string;
1519
+ }): RunEventDraft[];
1520
+ /**
1521
+ * True when the history has input events no completed workflow task has
1522
+ * delivered, so the run needs a workflow task (the service schedules one after
1523
+ * appending an input or completing a task; the test environment uses the same
1524
+ * rule). Inputs appended while a task ran belong to the next task (C-HIST
1525
+ * rule 5), so they count.
1526
+ */
1527
+ declare function hasUnprocessedInput(history: readonly RunEventRecord[]): boolean;
1528
+
1529
+ interface HistoryFile {
1530
+ format: typeof HISTORY_FILE_FORMAT;
1531
+ formatVersion: typeof HISTORY_PROTOCOL;
1532
+ name?: string;
1533
+ description?: string;
1534
+ workflowFn: string;
1535
+ source?: string;
1536
+ /** Fixture module the replay check runs instead of `source` (hotfixes, `patched()`). */
1537
+ replaySource?: string;
1538
+ /** False for histories that use Phase C features; they are not replayed. */
1539
+ replay?: boolean;
1540
+ info?: WorkflowInfoSnapshot;
1541
+ nowMs?: number;
1542
+ events: RunEventRecord[];
1543
+ expected?: WorkflowTaskResult;
1544
+ }
1545
+ /** A history file that does not match the schema. */
1546
+ declare class HistoryFileError extends Error {
1547
+ readonly issues: string[];
1548
+ constructor(message: string, issues?: string[]);
1549
+ }
1550
+ /** Parse and validate a history file (text or an already parsed value). */
1551
+ declare function parseHistoryFile(input: string | unknown): HistoryFile;
1552
+ /** Build a history file around `events`. */
1553
+ declare function createHistoryFile(workflowFn: string, events: RunEventRecord[], extra?: Partial<Omit<HistoryFile, 'format' | 'formatVersion' | 'workflowFn' | 'events'>>): HistoryFile;
1554
+ /** Serialise a history file the way the CLI and the fixtures write it. */
1555
+ declare function serializeHistoryFile(file: HistoryFile): string;
1556
+
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 };