@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,9 +1,8 @@
1
1
  'use strict';
2
2
 
3
3
  var chunkSAENRNBJ_cjs = require('./chunk-SAENRNBJ.cjs');
4
- var chunkP6TA5EZT_cjs = require('./chunk-P6TA5EZT.cjs');
5
- var chunk623FVQSN_cjs = require('./chunk-623FVQSN.cjs');
6
- var chunk2J6TF7YI_cjs = require('./chunk-2J6TF7YI.cjs');
4
+ var chunkRUQIMTN5_cjs = require('./chunk-RUQIMTN5.cjs');
5
+ var chunk3FIDHONL_cjs = require('./chunk-3FIDHONL.cjs');
7
6
  var _2020_js = require('ajv/dist/2020.js');
8
7
 
9
8
  // src/history/schema.ts
@@ -24,7 +23,7 @@ var SHARED_DEFS = {
24
23
  type: "object",
25
24
  required: ["errorType", "message"],
26
25
  properties: {
27
- errorType: { enum: [...chunk623FVQSN_cjs.ERROR_TYPES] },
26
+ errorType: { enum: [...chunk3FIDHONL_cjs.ERROR_TYPES] },
28
27
  message: { type: "string" },
29
28
  type: { type: "string" },
30
29
  details: {},
@@ -47,7 +46,7 @@ var SHARED_DEFS = {
47
46
  retryDelay: NON_NEGATIVE_MS,
48
47
  backoffMultiplier: { type: "number", minimum: 1 },
49
48
  maxDelay: NON_NEGATIVE_MS,
50
- retryOnErrorTypes: { type: "array", items: { enum: [...chunk623FVQSN_cjs.ERROR_TYPES] } },
49
+ retryOnErrorTypes: { type: "array", items: { enum: [...chunk3FIDHONL_cjs.ERROR_TYPES] } },
51
50
  nonRetryableErrorTypes: { type: "array", items: { type: "string" } }
52
51
  },
53
52
  additionalProperties: false
@@ -75,17 +74,42 @@ var SHARED_DEFS = {
75
74
  {
76
75
  type: "object",
77
76
  required: ["workflowKey", "workflowId"],
78
- properties: { workflowKey: ID, workflowId: ID },
77
+ description: "The open run of a workflow id, following its continue-as-new chain; firstRunId pins the chain (R2).",
78
+ properties: { workflowKey: ID, workflowId: ID, firstRunId: ID },
79
79
  additionalProperties: false
80
80
  }
81
81
  ]
82
82
  },
83
+ runRetryPolicy: {
84
+ type: "object",
85
+ required: ["initialDelayMs"],
86
+ description: "Run-level retry (11 \xA72.17), in milliseconds. maxAttempts counts every attempt; absent means unlimited, bounded by the execution timeout.",
87
+ properties: {
88
+ maxAttempts: { type: "integer", minimum: 1 },
89
+ initialDelayMs: NON_NEGATIVE_MS,
90
+ backoffMultiplier: { type: "number", minimum: 1 },
91
+ maxDelayMs: NON_NEGATIVE_MS,
92
+ retryOnErrorTypes: { type: "array", items: { enum: [...chunk3FIDHONL_cjs.ERROR_TYPES] } },
93
+ nonRetryableErrorTypes: { type: "array", items: { type: "string" } }
94
+ },
95
+ additionalProperties: false
96
+ },
97
+ timeouts: {
98
+ type: "object",
99
+ description: "The three workflow timeouts (11 \xA72.20), in milliseconds.",
100
+ properties: {
101
+ executionTimeout: NON_NEGATIVE_MS,
102
+ runTimeout: NON_NEGATIVE_MS,
103
+ workflowTaskTimeout: NON_NEGATIVE_MS
104
+ },
105
+ additionalProperties: false
106
+ },
83
107
  childOptions: {
84
108
  type: "object",
85
109
  required: ["parentClosePolicy"],
86
110
  properties: {
87
- parentClosePolicy: { enum: [...chunk623FVQSN_cjs.PARENT_CLOSE_POLICIES] },
88
- cancellationType: { enum: [...chunk623FVQSN_cjs.CHILD_CANCELLATION_TYPES] },
111
+ parentClosePolicy: { enum: [...chunk3FIDHONL_cjs.PARENT_CLOSE_POLICIES] },
112
+ cancellationType: { enum: [...chunk3FIDHONL_cjs.CHILD_CANCELLATION_TYPES] },
89
113
  taskQueue: ID,
90
114
  workflowId: ID,
91
115
  priority: { type: "integer", minimum: 1, maximum: 5 },
@@ -95,9 +119,41 @@ var SHARED_DEFS = {
95
119
  executionTimeout: NON_NEGATIVE_MS,
96
120
  runTimeout: NON_NEGATIVE_MS,
97
121
  workflowTaskTimeout: NON_NEGATIVE_MS,
98
- startDelay: NON_NEGATIVE_MS
122
+ startDelay: NON_NEGATIVE_MS,
123
+ retry: { $ref: "#/$defs/runRetryPolicy" },
124
+ versioningBehavior: { enum: [...chunk3FIDHONL_cjs.VERSIONING_BEHAVIORS] },
125
+ idReusePolicy: { enum: [...chunk3FIDHONL_cjs.WORKFLOW_ID_REUSE_POLICIES] },
126
+ idConflictPolicy: { enum: [...chunk3FIDHONL_cjs.WORKFLOW_ID_CONFLICT_POLICIES] }
99
127
  }
100
128
  },
129
+ legacyCanRetryPolicy: {
130
+ type: "object",
131
+ required: ["retryDelay"],
132
+ 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.",
133
+ properties: {
134
+ maxRetries: { type: "number" },
135
+ retryDelay: { type: "number" },
136
+ backoffMultiplier: { type: "number" },
137
+ maxDelay: { type: "number" },
138
+ retryOnErrorTypes: { type: "array", items: { type: "string" } },
139
+ nonRetryableErrorTypes: { type: "array", items: { type: "string" } }
140
+ },
141
+ additionalProperties: false
142
+ },
143
+ canOptions: {
144
+ type: "object",
145
+ 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.",
146
+ properties: {
147
+ taskQueue: ID,
148
+ retry: {
149
+ oneOf: [{ $ref: "#/$defs/runRetryPolicy" }, { $ref: "#/$defs/legacyCanRetryPolicy" }]
150
+ },
151
+ workflowTaskTimeout: NON_NEGATIVE_MS,
152
+ context: { type: "object" },
153
+ versioningBehavior: { enum: [...chunk3FIDHONL_cjs.VERSIONING_BEHAVIORS] }
154
+ },
155
+ additionalProperties: false
156
+ },
101
157
  headers: STRING_MAP
102
158
  };
103
159
  function command(type, required, properties) {
@@ -125,7 +181,7 @@ var COMMAND_DEFS = {
125
181
  scheduleToCloseTimeout: NON_NEGATIVE_MS,
126
182
  scheduleToStartTimeout: NON_NEGATIVE_MS,
127
183
  heartbeatTimeout: NON_NEGATIVE_MS,
128
- cancellationType: { enum: [...chunk623FVQSN_cjs.ACTIVITY_CANCELLATION_TYPES] },
184
+ cancellationType: { enum: [...chunk3FIDHONL_cjs.ACTIVITY_CANCELLATION_TYPES] },
129
185
  priority: { type: "integer", minimum: 1, maximum: 5 },
130
186
  summary: { type: "string", maxLength: 200 },
131
187
  runOn: { type: "string" }
@@ -171,13 +227,16 @@ var COMMAND_DEFS = {
171
227
  localActivityId: ID,
172
228
  result: {},
173
229
  failure: { $ref: "#/$defs/failure" },
174
- attempts: { type: "integer", minimum: 1 }
230
+ attempts: { type: "integer", minimum: 1 },
231
+ nodeType: ID,
232
+ operation: ID,
233
+ summary: { type: "string", maxLength: 200 }
175
234
  }),
176
235
  oneOf: [{ required: ["result"] }, { required: ["failure"] }]
177
236
  },
178
237
  CONTINUE_AS_NEW: command("CONTINUE_AS_NEW", ["input", "options"], {
179
238
  input: {},
180
- options: { type: "object" }
239
+ options: { $ref: "#/$defs/canOptions" }
181
240
  }),
182
241
  REQUEST_CANCEL_EXTERNAL_RUN: command("REQUEST_CANCEL_EXTERNAL_RUN", ["externalId", "target"], {
183
242
  externalId: ID,
@@ -213,7 +272,7 @@ var EVENT_PAYLOADS = {
213
272
  rootRunId: { type: ["string", "null"] },
214
273
  firstRunId: { type: ["string", "null"] },
215
274
  continuedFromRunId: { type: ["string", "null"] },
216
- parentClosePolicy: { enum: [...chunk623FVQSN_cjs.PARENT_CLOSE_POLICIES] },
275
+ parentClosePolicy: { enum: [...chunk3FIDHONL_cjs.PARENT_CLOSE_POLICIES] },
217
276
  startDelay: NON_NEGATIVE_MS,
218
277
  lastCompletionResult: {},
219
278
  lastFailure: { oneOf: [{ type: "null" }, FAILURE_REF] },
@@ -223,9 +282,26 @@ var EVENT_PAYLOADS = {
223
282
  executionTimeout: NON_NEGATIVE_MS,
224
283
  runTimeout: NON_NEGATIVE_MS,
225
284
  workflowTaskTimeout: NON_NEGATIVE_MS,
226
- versioningBehavior: { enum: ["PINNED", "AUTO_UPGRADE"] },
285
+ versioningBehavior: { enum: [...chunk3FIDHONL_cjs.VERSIONING_BEHAVIORS] },
227
286
  /** Seed of `ctx.random()`/`ctx.uuid()`; the service writes the run id. Absent: `info.runId`. */
228
- randomnessSeed: ID
287
+ randomnessSeed: ID,
288
+ startDelayMs: {
289
+ ...NON_NEGATIVE_MS,
290
+ description: "R2: the start delay of a delayed run (11 \xA72.23); the first task waits for it."
291
+ },
292
+ runAttempt: {
293
+ type: "integer",
294
+ minimum: 1,
295
+ description: "R2: the run-level retry attempt (11 \xA72.17), 1-based."
296
+ },
297
+ businessId: {
298
+ type: "string",
299
+ description: "R2: the workflow id (11 \xA72.1), stored as WorkflowRun.businessId."
300
+ },
301
+ workflowId: { type: "string", description: "R2: the same value as businessId." },
302
+ timeouts: { $ref: "#/$defs/timeouts" },
303
+ retry: { $ref: "#/$defs/runRetryPolicy" },
304
+ priority: { type: "integer", minimum: 1, maximum: 5 }
229
305
  }),
230
306
  WORKFLOW_TASK_SCHEDULED: payload(["taskId"], {
231
307
  taskId: ID,
@@ -244,6 +320,9 @@ var EVENT_PAYLOADS = {
244
320
  type: "integer",
245
321
  minimum: 1,
246
322
  description: "The history length the attempt was leased with (run.taskStartedSeq), when it is not this event's own seq. Required on the WORKFLOW_TASK_STARTED of a transient attempt: input events with a higher seq that precede this event arrived during the attempt and belong to the next activation."
323
+ },
324
+ version: {
325
+ description: "R2: the workflow version whose bundle served the task (it differs from WORKFLOW_STARTED.version after an AUTO_UPGRADE or a versioning override)."
247
326
  }
248
327
  }),
249
328
  WORKFLOW_TASK_COMPLETED: payload(["taskId"], {
@@ -254,7 +333,7 @@ var EVENT_PAYLOADS = {
254
333
  WORKFLOW_TASK_FAILED: payload(["taskId", "attempt", "cause"], {
255
334
  taskId: ID,
256
335
  attempt: { type: "integer", minimum: 1 },
257
- cause: { enum: [...chunk623FVQSN_cjs.TASK_FAILURE_CAUSES] },
336
+ cause: { enum: [...chunk3FIDHONL_cjs.TASK_FAILURE_CAUSES] },
258
337
  message: { type: "string" },
259
338
  stackTrace: { type: "string" },
260
339
  buildId: { type: "string" }
@@ -348,7 +427,7 @@ var EVENT_PAYLOADS = {
348
427
  CHILD_RUN_TIMED_OUT: payload(["childId"], {
349
428
  childId: ID,
350
429
  childRunId: ID,
351
- timeoutType: { enum: ["WORKFLOW_RUN", "WORKFLOW_EXECUTION"] }
430
+ timeoutType: { enum: [...chunk3FIDHONL_cjs.WORKFLOW_TIMEOUT_TYPES] }
352
431
  }),
353
432
  EXTERNAL_RUN_CANCEL_REQUESTED: payload(["externalId", "target"], {
354
433
  externalId: ID,
@@ -382,12 +461,18 @@ var EVENT_PAYLOADS = {
382
461
  LOCAL_ACTIVITY_COMPLETED: payload(["localActivityId", "attempts"], {
383
462
  localActivityId: ID,
384
463
  result: {},
385
- attempts: { type: "integer", minimum: 1 }
464
+ attempts: { type: "integer", minimum: 1 },
465
+ nodeType: ID,
466
+ operation: ID,
467
+ summary: { type: "string" }
386
468
  }),
387
469
  LOCAL_ACTIVITY_FAILED: payload(["localActivityId", "attempts", "failure"], {
388
470
  localActivityId: ID,
389
471
  failure: FAILURE_REF,
390
- attempts: { type: "integer", minimum: 1 }
472
+ attempts: { type: "integer", minimum: 1 },
473
+ nodeType: ID,
474
+ operation: ID,
475
+ summary: { type: "string" }
391
476
  }),
392
477
  SEARCH_ATTRIBUTES_UPSERTED: payload(["attributes"], { attributes: { type: "object" } }),
393
478
  CONTEXT_UPSERTED: payload(["entries"], { entries: { type: "object" } }),
@@ -401,17 +486,45 @@ var EVENT_PAYLOADS = {
401
486
  toSeq: { type: "integer", minimum: 1 },
402
487
  reason: { type: "string" }
403
488
  }),
404
- VERSIONING_OVERRIDE_SET: payload(["override"], { override: {} }),
489
+ VERSIONING_OVERRIDE_SET: payload(["override"], {
490
+ override: {
491
+ description: "The per-run override (11 \xA72.27): { behavior: PINNED, version } pins the run, { behavior: AUTO_UPGRADE } upgrades it, null removes the override.",
492
+ oneOf: [
493
+ { type: "null" },
494
+ {
495
+ type: "object",
496
+ required: ["behavior", "version"],
497
+ properties: { behavior: { const: "PINNED" }, version: {} },
498
+ additionalProperties: false
499
+ },
500
+ {
501
+ type: "object",
502
+ required: ["behavior"],
503
+ properties: { behavior: { const: "AUTO_UPGRADE" } },
504
+ additionalProperties: false
505
+ }
506
+ ]
507
+ },
508
+ actor: {},
509
+ reason: { type: "string" }
510
+ }),
405
511
  WORKFLOW_COMPLETED: payload(["output"], { output: {} }),
406
512
  WORKFLOW_FAILED: payload(["failure"], { failure: FAILURE_REF }),
407
513
  WORKFLOW_CANCELLED: payload([], { details: {} }),
408
514
  WORKFLOW_TERMINATED: payload([], { reason: { type: "string" }, actor: {} }),
409
515
  WORKFLOW_TIMED_OUT: payload(["timeoutType"], {
410
- timeoutType: { enum: ["WORKFLOW_RUN", "WORKFLOW_EXECUTION"] }
516
+ timeoutType: { enum: [...chunk3FIDHONL_cjs.WORKFLOW_TIMEOUT_TYPES] },
517
+ failure: FAILURE_REF
411
518
  }),
412
519
  WORKFLOW_CONTINUED_AS_NEW: payload(["input", "options"], {
413
520
  input: {},
414
- options: { type: "object" },
521
+ // Not canOptions: the event keeps what the service accepted when the run
522
+ // continued, and Phase B (R1) runs stored options that the R2 command shape
523
+ // refuses (fractional delays, a backoff below 1, a long task queue).
524
+ options: {
525
+ type: "object",
526
+ description: "The CONTINUE_AS_NEW options as the service recorded them. New commands are checked against canOptions; histories recorded before R2 may hold any object the R1 contract accepted."
527
+ },
415
528
  newRunId: { type: "string" }
416
529
  })
417
530
  };
@@ -428,32 +541,32 @@ var RUN_EVENT_RECORD = {
428
541
  required: ["seq", "type", "payload", "createdAt"],
429
542
  properties: {
430
543
  seq: { type: "integer", minimum: 1 },
431
- type: { enum: [...chunk623FVQSN_cjs.EVENT_TYPES] },
544
+ type: { enum: [...chunk3FIDHONL_cjs.EVENT_TYPES] },
432
545
  taskId: { type: ["string", "null"] },
433
546
  payload: { type: "object" },
434
547
  createdAt: { type: "string", minLength: 1 },
435
548
  dedupeKey: { type: ["string", "null"] }
436
549
  },
437
- allOf: chunk623FVQSN_cjs.EVENT_TYPES.map((type) => ({
550
+ allOf: chunk3FIDHONL_cjs.EVENT_TYPES.map((type) => ({
438
551
  if: { properties: { type: { const: type } }, required: ["type"] },
439
552
  then: { properties: { payload: { $ref: `#/$defs/payload_${type}` } } }
440
553
  }))
441
554
  };
442
555
  function payloadDefs() {
443
556
  const defs = {};
444
- for (const type of chunk623FVQSN_cjs.EVENT_TYPES) defs[`payload_${type}`] = compact(EVENT_PAYLOADS[type]);
557
+ for (const type of chunk3FIDHONL_cjs.EVENT_TYPES) defs[`payload_${type}`] = compact(EVENT_PAYLOADS[type]);
445
558
  return defs;
446
559
  }
447
560
  function commandDefs() {
448
561
  const defs = {};
449
- for (const type of chunk623FVQSN_cjs.COMMAND_TYPES) defs[`command_${type}`] = COMMAND_DEFS[type];
562
+ for (const type of chunk3FIDHONL_cjs.COMMAND_TYPES) defs[`command_${type}`] = COMMAND_DEFS[type];
450
563
  return defs;
451
564
  }
452
565
  var COMMAND_ONE_OF = {
453
566
  type: "object",
454
567
  required: ["type"],
455
- properties: { type: { enum: [...chunk623FVQSN_cjs.COMMAND_TYPES] } },
456
- allOf: chunk623FVQSN_cjs.COMMAND_TYPES.map((type) => ({
568
+ properties: { type: { enum: [...chunk3FIDHONL_cjs.COMMAND_TYPES] } },
569
+ allOf: chunk3FIDHONL_cjs.COMMAND_TYPES.map((type) => ({
457
570
  if: { properties: { type: { const: type } }, required: ["type"] },
458
571
  then: { $ref: `#/$defs/command_${type}` }
459
572
  }))
@@ -496,7 +609,9 @@ var WORKFLOW_TASK_SCHEMA = {
496
609
  version: {},
497
610
  buildId: { type: "string" },
498
611
  businessId: { type: "string" },
612
+ workflowId: { type: "string" },
499
613
  attempt: { type: "integer", minimum: 1 },
614
+ runAttempt: { type: "integer", minimum: 1 },
500
615
  taskQueue: { type: "string" },
501
616
  parentRunId: { type: ["string", "null"] },
502
617
  rootRunId: { type: ["string", "null"] },
@@ -519,14 +634,51 @@ var WORKFLOW_TASK_SCHEMA = {
519
634
  priority: { type: "integer", minimum: 1, maximum: 5 },
520
635
  summary: { type: "string" },
521
636
  details: { type: "string" },
522
- context: { type: "object" }
637
+ context: { type: "object" },
638
+ memo: { type: "object" },
639
+ versioningBehavior: { enum: [...chunk3FIDHONL_cjs.VERSIONING_BEHAVIORS] },
640
+ retry: { $ref: "#/$defs/runRetryPolicy" }
523
641
  }
524
642
  },
643
+ localActivityRequest: {
644
+ type: "object",
645
+ required: [
646
+ "localActivityId",
647
+ "kind",
648
+ "nodeType",
649
+ "operation",
650
+ "args",
651
+ "retry",
652
+ "startToCloseTimeout",
653
+ "attempt",
654
+ "backoffMs"
655
+ ],
656
+ description: "R2: a local activity the task needs (11 \xA72.12). Run attempt `attempt` after waiting backoffMs, then run the same task again with the outcome in localActivityResults.",
657
+ properties: {
658
+ localActivityId: ID,
659
+ kind: { const: "node" },
660
+ nodeType: ID,
661
+ nodeVersion: { type: "string" },
662
+ operation: ID,
663
+ args: {},
664
+ connection: ID,
665
+ retry: { $ref: "#/$defs/retryPolicy" },
666
+ startToCloseTimeout: {
667
+ type: "integer",
668
+ minimum: 1,
669
+ maximum: chunk3FIDHONL_cjs.LOCAL_ACTIVITY_MAX_TIMEOUT_MS
670
+ },
671
+ attempt: { type: "integer", minimum: 1 },
672
+ backoffMs: NON_NEGATIVE_MS,
673
+ summary: { type: "string", maxLength: 200 }
674
+ },
675
+ additionalProperties: false
676
+ },
525
677
  request: {
526
678
  type: "object",
527
679
  required: ["protocol", "kind", "workflowFn", "info", "history", "nowMs"],
528
680
  properties: {
529
- protocol: { const: chunk623FVQSN_cjs.HISTORY_PROTOCOL },
681
+ protocol: { const: chunk3FIDHONL_cjs.HISTORY_PROTOCOL },
530
682
  kind: { enum: ["task", "query", "verify"] },
531
683
  workflowFn: ID,
532
684
  info: { $ref: "#/$defs/info" },
@@ -552,7 +704,7 @@ var WORKFLOW_TASK_SCHEMA = {
552
704
  required: ["queryId", "name"],
553
705
  properties: {
554
706
  queryId: ID,
555
- name: { enum: [...chunk623FVQSN_cjs.BUILT_IN_QUERIES] },
707
+ name: { enum: [...chunk3FIDHONL_cjs.BUILT_IN_QUERIES] },
556
708
  args: {}
557
709
  }
558
710
  }
@@ -563,10 +715,27 @@ var WORKFLOW_TASK_SCHEMA = {
563
715
  type: "object",
564
716
  required: ["protocol", "outcome", "commands", "logs"],
565
717
  properties: {
566
- protocol: { const: chunk623FVQSN_cjs.HISTORY_PROTOCOL },
718
+ protocol: { const: chunk3FIDHONL_cjs.HISTORY_PROTOCOL },
567
719
  outcome: { enum: ["commands", "failed", "localActivityRequested"] },
568
720
  commands: { type: "array", items: { $ref: "#/$defs/command" } },
569
- localActivityRequests: { type: "array", items: { type: "object" } },
721
+ localActivityRequests: {
722
+ type: "array",
723
+ items: { $ref: "#/$defs/localActivityRequest" }
724
+ },
725
+ unfinishedHandlers: {
726
+ type: "array",
727
+ description: "R2: handlers still running when the terminal command was issued (11 \xA72.18); never set on replay.",
728
+ items: {
729
+ type: "object",
730
+ required: ["kind", "name", "count"],
731
+ properties: {
732
+ kind: { enum: ["signal", "update"] },
733
+ name: { type: "string" },
734
+ count: { type: "integer", minimum: 1 }
735
+ },
736
+ additionalProperties: false
737
+ }
738
+ },
570
739
  queryResults: {
571
740
  type: "array",
572
741
  items: {
@@ -579,7 +748,7 @@ var WORKFLOW_TASK_SCHEMA = {
579
748
  type: "object",
580
749
  required: ["cause", "message"],
581
750
  properties: {
582
- cause: { enum: [...chunk623FVQSN_cjs.TASK_FAILURE_CAUSES] },
751
+ cause: { enum: [...chunk3FIDHONL_cjs.TASK_FAILURE_CAUSES] },
583
752
  message: { type: "string" },
584
753
  stackTrace: { type: "string" },
585
754
  seq: { type: "integer" },
@@ -611,7 +780,7 @@ var HISTORY_FILE_SCHEMA = {
611
780
  required: ["format", "formatVersion", "workflowFn", "events"],
612
781
  properties: {
613
782
  format: { const: HISTORY_FILE_FORMAT },
614
- formatVersion: { const: chunk623FVQSN_cjs.HISTORY_PROTOCOL },
783
+ formatVersion: { const: chunk3FIDHONL_cjs.HISTORY_PROTOCOL },
615
784
  name: { type: "string" },
616
785
  description: { type: "string" },
617
786
  workflowFn: ID,
@@ -729,12 +898,12 @@ function validateCommands(commands, options = {}) {
729
898
  return;
730
899
  }
731
900
  const command2 = checked.command;
732
- if (!chunkP6TA5EZT_cjs.isWorkflowCommandEnabled(command2, options.enabled)) {
901
+ if (!chunkRUQIMTN5_cjs.isWorkflowCommandEnabled(command2, options.enabled) && !(options.relief !== void 0 && chunkRUQIMTN5_cjs.isReliefCommand(command2, options.relief))) {
733
902
  unsupported = true;
734
903
  issues.push({
735
904
  index,
736
905
  code: "commands.unsupported",
737
- message: `${command2.type} is not supported in this release`
906
+ message: chunkRUQIMTN5_cjs.unsupportedMessage(command2, options.enabled)
738
907
  });
739
908
  }
740
909
  const id = idOf(command2);
@@ -743,13 +912,13 @@ function validateCommands(commands, options = {}) {
743
912
  issues.push({ index, code: "commands.duplicateId", message: `${id} is used twice` });
744
913
  ids.add(id);
745
914
  }
746
- if (chunk623FVQSN_cjs.TERMINAL_COMMANDS.has(command2.type) && index !== commands.length - 1)
915
+ if (chunk3FIDHONL_cjs.TERMINAL_COMMANDS.has(command2.type) && index !== commands.length - 1)
747
916
  issues.push({
748
917
  index,
749
918
  code: "commands.terminalNotLast",
750
919
  message: `${command2.type} must be the last command of the batch`
751
920
  });
752
- if (command2.type === "SCHEDULE_ACTIVITY" && !chunk2J6TF7YI_cjs.isActivityNodeTypeAllowed(command2.nodeType))
921
+ if (command2.type === "SCHEDULE_ACTIVITY" && !chunk3FIDHONL_cjs.isActivityNodeTypeAllowed(command2.nodeType))
753
922
  issues.push({
754
923
  index,
755
924
  code: "durable.activityTypeNotAllowed",
@@ -836,7 +1005,7 @@ function parseHistoryFile(input) {
836
1005
  function createHistoryFile(workflowFn, events, extra = {}) {
837
1006
  return {
838
1007
  format: HISTORY_FILE_FORMAT,
839
- formatVersion: chunk623FVQSN_cjs.HISTORY_PROTOCOL,
1008
+ formatVersion: chunk3FIDHONL_cjs.HISTORY_PROTOCOL,
840
1009
  ...extra,
841
1010
  workflowFn,
842
1011
  events
@@ -0,0 +1,166 @@
1
+ 'use strict';
2
+
3
+ var chunkFR7KYWRO_cjs = require('./chunk-FR7KYWRO.cjs');
4
+ var chunkYHBVMOMK_cjs = require('./chunk-YHBVMOMK.cjs');
5
+
6
+ // src/durable/durations.ts
7
+ function toMs(value, what = "duration") {
8
+ const ms = chunkFR7KYWRO_cjs.durationMs(value, "ms");
9
+ if (ms === void 0) throw new TypeError(`${what} "${String(value)}" is not a duration`);
10
+ return Math.round(ms);
11
+ }
12
+ function optionalMs(value, what) {
13
+ return value === void 0 ? void 0 : toMs(value, what);
14
+ }
15
+
16
+ // src/durable/workflow.ts
17
+ var DURABLE_MARKER = "fluidgrids.durable-workflow";
18
+ var MAX_WORKFLOW_TASK_TIMEOUT_MS = 12e4;
19
+ function checkRunOptions(name, options) {
20
+ const where = `workflow("${name}")`;
21
+ for (const key of ["executionTimeout", "runTimeout", "workflowTaskTimeout"]) {
22
+ const value = options[key];
23
+ if (value !== void 0) toMs(value, `${where} ${key}`);
24
+ }
25
+ if (options.workflowTaskTimeout !== void 0 && toMs(options.workflowTaskTimeout) > MAX_WORKFLOW_TASK_TIMEOUT_MS)
26
+ throw new TypeError(`${where}: workflowTaskTimeout may be at most 120 s`);
27
+ if (options.versioningBehavior !== void 0 && options.versioningBehavior !== "PINNED" && options.versioningBehavior !== "AUTO_UPGRADE")
28
+ throw new TypeError(`${where}: versioningBehavior must be PINNED or AUTO_UPGRADE`);
29
+ const retry = options.retry;
30
+ if (retry !== void 0) {
31
+ checkRunRetryKeys(retry, `${where} retry`);
32
+ if (retry.maxAttempts !== void 0 && (!Number.isInteger(retry.maxAttempts) || retry.maxAttempts < 1))
33
+ throw new TypeError(`${where}: retry.maxAttempts must be a positive integer`);
34
+ if (retry.initialDelay !== void 0) toMs(retry.initialDelay, `${where} retry.initialDelay`);
35
+ if (retry.maxDelay !== void 0) toMs(retry.maxDelay, `${where} retry.maxDelay`);
36
+ if (retry.backoffMultiplier !== void 0 && !(Number.isFinite(retry.backoffMultiplier) && retry.backoffMultiplier >= 1))
37
+ throw new TypeError(`${where}: retry.backoffMultiplier must be at least 1`);
38
+ }
39
+ }
40
+ var KEY = /^[a-z0-9][a-z0-9_-]{0,127}$/;
41
+ function workflow(name, optionsOrFn, maybeFn) {
42
+ if (typeof name !== "string" || !KEY.test(name))
43
+ throw new TypeError(
44
+ `workflow() needs a key of lowercase letters, digits, "-" and "_" (got "${String(name)}")`
45
+ );
46
+ const fn = typeof optionsOrFn === "function" ? optionsOrFn : maybeFn;
47
+ const options = typeof optionsOrFn === "function" ? {} : optionsOrFn ?? {};
48
+ if (typeof fn !== "function") throw new TypeError(`workflow("${name}") needs a function`);
49
+ checkRunOptions(name, options);
50
+ return Object.freeze({ __fluidgrids: DURABLE_MARKER, name, options, fn });
51
+ }
52
+ function isDurableWorkflow(value) {
53
+ return typeof value === "object" && value !== null && value.__fluidgrids === DURABLE_MARKER && typeof value.fn === "function";
54
+ }
55
+ function isJsonValue(value, depth = 0) {
56
+ if (depth > 64) return false;
57
+ if (value === null || typeof value === "string" || typeof value === "boolean") return true;
58
+ if (typeof value === "number") return Number.isFinite(value);
59
+ if (Array.isArray(value)) return value.every((item) => isJsonValue(item, depth + 1));
60
+ if (typeof value === "object") {
61
+ if (Object.getPrototypeOf(value) !== Object.prototype && Object.getPrototypeOf(value) !== null)
62
+ return false;
63
+ return Object.values(value).every((item) => isJsonValue(item, depth + 1));
64
+ }
65
+ return false;
66
+ }
67
+ function jsonSchemaOf(schema) {
68
+ if (schema === void 0) return void 0;
69
+ const method = schema.toJSONSchema;
70
+ if (typeof method === "function") {
71
+ const produced = method.call(schema);
72
+ return isJsonValue(produced) && typeof produced === "object" && !Array.isArray(produced) && produced !== null ? produced : void 0;
73
+ }
74
+ return isJsonValue(schema) && !Array.isArray(schema) && schema !== null && typeof schema === "object" ? schema : void 0;
75
+ }
76
+ function interfaceOf(definition) {
77
+ const out = {};
78
+ const input = jsonSchemaOf(definition.options.input);
79
+ const output = jsonSchemaOf(definition.options.output);
80
+ if (input) out.input = input;
81
+ if (output) out.output = output;
82
+ const signals = definition.options.signals ?? [];
83
+ if (signals.length > 0) {
84
+ out.signals = {};
85
+ for (const signal of signals) {
86
+ const entry = {};
87
+ const payload = jsonSchemaOf(signal.schema);
88
+ if (payload) entry.payload = payload;
89
+ if (signal.description !== void 0) entry.description = signal.description;
90
+ out.signals[signal.name] = entry;
91
+ }
92
+ }
93
+ const queries = definition.options.queries ?? [];
94
+ if (queries.length > 0) {
95
+ out.queries = {};
96
+ for (const query of queries)
97
+ out.queries[query.name] = query.description !== void 0 ? { description: query.description } : {};
98
+ }
99
+ const updates = definition.options.updates ?? [];
100
+ if (updates.length > 0) {
101
+ out.updates = {};
102
+ for (const update of updates)
103
+ out.updates[update.name] = update.description !== void 0 ? { description: update.description } : {};
104
+ }
105
+ return out;
106
+ }
107
+ var RUN_RETRY_OPTION_KEYS = /* @__PURE__ */ new Set([
108
+ "maxAttempts",
109
+ "initialDelay",
110
+ "backoffMultiplier",
111
+ "maxDelay",
112
+ "nonRetryableErrorTypes"
113
+ ]);
114
+ var ACTIVITY_RETRY_ONLY_KEYS = /* @__PURE__ */ new Set([
115
+ "retryDelay",
116
+ "maxRetries",
117
+ "retryOnErrorTypes"
118
+ ]);
119
+ function checkRunRetryKeys(retry, where) {
120
+ if (typeof retry !== "object" || retry === null || Array.isArray(retry))
121
+ throw new TypeError(`${where} must be an object`);
122
+ for (const key of Object.keys(retry)) {
123
+ if (RUN_RETRY_OPTION_KEYS.has(key)) continue;
124
+ const hint = ACTIVITY_RETRY_ONLY_KEYS.has(key) ? " (that is the activity retry shape; a run-level retry takes maxAttempts, initialDelay, backoffMultiplier, maxDelay and nonRetryableErrorTypes)" : "";
125
+ throw new TypeError(`${where} has an unknown option "${key}"${hint}`);
126
+ }
127
+ }
128
+ function runRetryPolicyOf(retry) {
129
+ checkRunRetryKeys(retry, "retry");
130
+ const policy = {};
131
+ if (retry.maxAttempts !== void 0) policy.maxAttempts = retry.maxAttempts;
132
+ if (retry.initialDelay !== void 0)
133
+ policy.initialDelayMs = toMs(retry.initialDelay, "retry.initialDelay");
134
+ if (retry.backoffMultiplier !== void 0) policy.backoffMultiplier = retry.backoffMultiplier;
135
+ if (retry.maxDelay !== void 0) policy.maxDelayMs = toMs(retry.maxDelay, "retry.maxDelay");
136
+ if (retry.nonRetryableErrorTypes !== void 0)
137
+ policy.nonRetryableErrorTypes = [...retry.nonRetryableErrorTypes];
138
+ return chunkYHBVMOMK_cjs.explicitRunRetryPolicy(policy);
139
+ }
140
+ function continueAsNewRetryOf(retry) {
141
+ if (typeof retry !== "object" || retry === null || Array.isArray(retry))
142
+ throw new TypeError("continueAsNew retry must be an object");
143
+ const keys = Object.keys(retry);
144
+ const legacy = keys.some((key) => ACTIVITY_RETRY_ONLY_KEYS.has(key));
145
+ if (!legacy) return runRetryPolicyOf(retry);
146
+ if (keys.includes("maxAttempts") || keys.includes("initialDelay"))
147
+ throw new TypeError(
148
+ "continueAsNew retry mixes the activity retry shape (retryDelay, maxRetries) with the run-level one (maxAttempts, initialDelay); use the run-level keys"
149
+ );
150
+ return chunkYHBVMOMK_cjs.explicitRetryPolicy(retry);
151
+ }
152
+
153
+ // src/generated/version.ts
154
+ var SDK_VERSION = "2026.1029.1";
155
+
156
+ exports.DURABLE_MARKER = DURABLE_MARKER;
157
+ exports.MAX_WORKFLOW_TASK_TIMEOUT_MS = MAX_WORKFLOW_TASK_TIMEOUT_MS;
158
+ exports.SDK_VERSION = SDK_VERSION;
159
+ exports.continueAsNewRetryOf = continueAsNewRetryOf;
160
+ exports.interfaceOf = interfaceOf;
161
+ exports.isDurableWorkflow = isDurableWorkflow;
162
+ exports.jsonSchemaOf = jsonSchemaOf;
163
+ exports.optionalMs = optionalMs;
164
+ exports.runRetryPolicyOf = runRetryPolicyOf;
165
+ exports.toMs = toMs;
166
+ exports.workflow = workflow;
@@ -1,5 +1,3 @@
1
- import { durationMs } from './chunk-LNUQE6D6.js';
2
-
3
1
  // src/durable/definitions.ts
4
2
  function checkName(name, what) {
5
3
  if (typeof name !== "string" || name === "" || name.startsWith("__"))
@@ -232,14 +230,4 @@ function failureToError(failure, depth = 0) {
232
230
  return error;
233
231
  }
234
232
 
235
- // src/durable/durations.ts
236
- function toMs(value, what = "duration") {
237
- const ms = durationMs(value, "ms");
238
- if (ms === void 0) throw new TypeError(`${what} "${String(value)}" is not a duration`);
239
- return Math.round(ms);
240
- }
241
- function optionalMs(value, what) {
242
- return value === void 0 ? void 0 : toMs(value, what);
243
- }
244
-
245
- export { ActivityFailure, ApplicationError, CancelledFailure, ChildRunFailure, DeterminismViolation, HistoryLimitExceeded, PhaseCFeatureError, ServerFailure, TerminatedFailure, TimeoutFailure, WorkflowFailure, defineQuery, defineSignal, defineUpdate, errorToFailure, failureToError, isCancellation, isRunFailure, optionalMs, signalName, toMs };
233
+ export { ActivityFailure, ApplicationError, CancelledFailure, ChildRunFailure, DeterminismViolation, HistoryLimitExceeded, PhaseCFeatureError, ServerFailure, TerminatedFailure, TimeoutFailure, WorkflowFailure, defineQuery, defineSignal, defineUpdate, errorToFailure, failureToError, isCancellation, isRunFailure, signalName };