@workflow/core 5.0.0-beta.42 → 5.0.0-beta.44

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 (220) hide show
  1. package/dist/capabilities.d.ts +4 -4
  2. package/dist/capabilities.js +5 -5
  3. package/dist/capture-stack.d.ts +1 -1
  4. package/dist/capture-stack.js +2 -2
  5. package/dist/class-serialization.d.ts +8 -8
  6. package/dist/class-serialization.js +9 -9
  7. package/dist/classify-error.js +5 -5
  8. package/dist/context-violation-error.d.ts +5 -5
  9. package/dist/context-violation-error.d.ts.map +1 -1
  10. package/dist/context-violation-error.js +5 -5
  11. package/dist/create-hook.d.ts +10 -6
  12. package/dist/create-hook.d.ts.map +1 -1
  13. package/dist/create-hook.js +1 -1
  14. package/dist/define-hook.js +2 -2
  15. package/dist/describe-error.d.ts +7 -7
  16. package/dist/describe-error.js +8 -8
  17. package/dist/encryption.d.ts +5 -5
  18. package/dist/encryption.js +7 -7
  19. package/dist/events-consumer.d.ts +19 -7
  20. package/dist/events-consumer.d.ts.map +1 -1
  21. package/dist/events-consumer.js +33 -12
  22. package/dist/flushable-stream.d.ts +4 -4
  23. package/dist/flushable-stream.js +12 -12
  24. package/dist/global.d.ts +1 -1
  25. package/dist/global.js +1 -1
  26. package/dist/index.d.ts +1 -1
  27. package/dist/index.js +2 -2
  28. package/dist/log-format.d.ts +2 -2
  29. package/dist/log-format.js +5 -5
  30. package/dist/logger.js +4 -4
  31. package/dist/private.d.ts +39 -64
  32. package/dist/private.d.ts.map +1 -1
  33. package/dist/private.js +294 -48
  34. package/dist/replay-payload-cache.d.ts +1 -1
  35. package/dist/replay-payload-cache.js +4 -4
  36. package/dist/runtime/compute-instance.d.ts +4 -3
  37. package/dist/runtime/compute-instance.d.ts.map +1 -1
  38. package/dist/runtime/compute-instance.js +5 -4
  39. package/dist/runtime/constants.d.ts +46 -19
  40. package/dist/runtime/constants.d.ts.map +1 -1
  41. package/dist/runtime/constants.js +76 -38
  42. package/dist/runtime/count-step-started-events.d.ts +7 -7
  43. package/dist/runtime/count-step-started-events.js +4 -4
  44. package/dist/runtime/deployment-guard.d.ts +7 -7
  45. package/dist/runtime/deployment-guard.js +8 -8
  46. package/dist/runtime/get-port-lazy.d.ts +2 -2
  47. package/dist/runtime/get-port-lazy.d.ts.map +1 -1
  48. package/dist/runtime/get-port-lazy.js +37 -30
  49. package/dist/runtime/get-world-lazy.d.ts +2 -2
  50. package/dist/runtime/get-world-lazy.js +3 -3
  51. package/dist/runtime/helpers.d.ts +18 -18
  52. package/dist/runtime/helpers.js +27 -27
  53. package/dist/runtime/quickjs-entrypoint.d.ts +23 -10
  54. package/dist/runtime/quickjs-entrypoint.d.ts.map +1 -1
  55. package/dist/runtime/quickjs-entrypoint.js +200 -81
  56. package/dist/runtime/quickjs-runtime.d.ts +31 -15
  57. package/dist/runtime/quickjs-runtime.d.ts.map +1 -1
  58. package/dist/runtime/quickjs-runtime.js +126 -77
  59. package/dist/runtime/quickjs-serde.d.ts +10 -10
  60. package/dist/runtime/quickjs-serde.js +20 -20
  61. package/dist/runtime/replay-budget.d.ts +4 -4
  62. package/dist/runtime/replay-budget.js +5 -5
  63. package/dist/runtime/replay-recovery-reporter.d.ts +1 -1
  64. package/dist/runtime/replay-recovery-reporter.js +2 -2
  65. package/dist/runtime/resume-hook.d.ts +2 -2
  66. package/dist/runtime/resume-hook.js +27 -27
  67. package/dist/runtime/resume-latency.d.ts +25 -25
  68. package/dist/runtime/resume-latency.d.ts.map +1 -1
  69. package/dist/runtime/resume-latency.js +4 -4
  70. package/dist/runtime/run-id-time.d.ts +2 -2
  71. package/dist/runtime/run-id-time.js +5 -5
  72. package/dist/runtime/run.d.ts +21 -4
  73. package/dist/runtime/run.d.ts.map +1 -1
  74. package/dist/runtime/run.js +154 -35
  75. package/dist/runtime/runs.d.ts +4 -4
  76. package/dist/runtime/runs.js +2 -2
  77. package/dist/runtime/start.d.ts +3 -3
  78. package/dist/runtime/start.d.ts.map +1 -1
  79. package/dist/runtime/start.js +27 -23
  80. package/dist/runtime/step-executor.d.ts +59 -11
  81. package/dist/runtime/step-executor.d.ts.map +1 -1
  82. package/dist/runtime/step-executor.js +116 -42
  83. package/dist/runtime/step-latency.d.ts +20 -14
  84. package/dist/runtime/step-latency.d.ts.map +1 -1
  85. package/dist/runtime/step-latency.js +13 -11
  86. package/dist/runtime/step-ownership.d.ts +6 -6
  87. package/dist/runtime/step-ownership.js +8 -8
  88. package/dist/runtime/step-single-flight.d.ts +1 -1
  89. package/dist/runtime/step-single-flight.d.ts.map +1 -1
  90. package/dist/runtime/step-single-flight.js +17 -11
  91. package/dist/runtime/suspension-handler.d.ts +99 -7
  92. package/dist/runtime/suspension-handler.d.ts.map +1 -1
  93. package/dist/runtime/suspension-handler.js +678 -57
  94. package/dist/runtime/unserializable-step.d.ts +34 -0
  95. package/dist/runtime/unserializable-step.d.ts.map +1 -0
  96. package/dist/runtime/unserializable-step.js +52 -0
  97. package/dist/runtime/vm-mode.d.ts +1 -1
  98. package/dist/runtime/vm-mode.js +2 -2
  99. package/dist/runtime/wait-continuation.d.ts +31 -9
  100. package/dist/runtime/wait-continuation.d.ts.map +1 -1
  101. package/dist/runtime/wait-continuation.js +44 -13
  102. package/dist/runtime/wait-until.d.ts +1 -1
  103. package/dist/runtime/wait-until.js +2 -2
  104. package/dist/runtime/world-compatibility.d.ts +20 -9
  105. package/dist/runtime/world-compatibility.d.ts.map +1 -1
  106. package/dist/runtime/world-compatibility.js +24 -13
  107. package/dist/runtime/world-init.d.ts +5 -5
  108. package/dist/runtime/world-init.js +6 -6
  109. package/dist/runtime/world.d.ts.map +1 -1
  110. package/dist/runtime/world.js +13 -3
  111. package/dist/runtime.d.ts.map +1 -1
  112. package/dist/runtime.js +417 -213
  113. package/dist/sealed-box.d.ts +7 -7
  114. package/dist/sealed-box.js +15 -15
  115. package/dist/serialization/client.js +2 -2
  116. package/dist/serialization/codec-devalue-vm.d.ts +1 -1
  117. package/dist/serialization/codec-devalue-vm.js +4 -4
  118. package/dist/serialization/codec-devalue.d.ts +1 -1
  119. package/dist/serialization/codec-devalue.js +2 -2
  120. package/dist/serialization/codec.d.ts +4 -4
  121. package/dist/serialization/codec.js +2 -2
  122. package/dist/serialization/compression.d.ts +12 -11
  123. package/dist/serialization/compression.d.ts.map +1 -1
  124. package/dist/serialization/compression.js +16 -15
  125. package/dist/serialization/encryption.d.ts +7 -7
  126. package/dist/serialization/encryption.d.ts.map +1 -1
  127. package/dist/serialization/encryption.js +8 -8
  128. package/dist/serialization/errors.js +2 -2
  129. package/dist/serialization/format.d.ts +6 -6
  130. package/dist/serialization/format.js +7 -7
  131. package/dist/serialization/hardened.d.ts +18 -18
  132. package/dist/serialization/hardened.d.ts.map +1 -1
  133. package/dist/serialization/hardened.js +41 -32
  134. package/dist/serialization/index.d.ts +1 -1
  135. package/dist/serialization/index.js +2 -2
  136. package/dist/serialization/reducers/class-vm.d.ts +1 -1
  137. package/dist/serialization/reducers/class-vm.js +2 -2
  138. package/dist/serialization/reducers/class.js +2 -2
  139. package/dist/serialization/reducers/common-vm.js +12 -12
  140. package/dist/serialization/reducers/common.js +12 -12
  141. package/dist/serialization/reducers/step-function-vm.d.ts +1 -1
  142. package/dist/serialization/reducers/step-function-vm.js +2 -2
  143. package/dist/serialization/reducers/step-function.js +2 -2
  144. package/dist/serialization/step.js +2 -2
  145. package/dist/serialization/types.d.ts +5 -5
  146. package/dist/serialization/types.js +2 -2
  147. package/dist/serialization/workflow-vm.d.ts +1 -1
  148. package/dist/serialization/workflow-vm.d.ts.map +1 -1
  149. package/dist/serialization/workflow-vm.js +13 -10
  150. package/dist/serialization-format.d.ts +11 -11
  151. package/dist/serialization-format.d.ts.map +1 -1
  152. package/dist/serialization-format.js +29 -23
  153. package/dist/serialization.d.ts +20 -12
  154. package/dist/serialization.d.ts.map +1 -1
  155. package/dist/serialization.js +141 -99
  156. package/dist/set-attributes.js +2 -2
  157. package/dist/source-map.d.ts +1 -1
  158. package/dist/source-map.d.ts.map +1 -1
  159. package/dist/source-map.js +18 -12
  160. package/dist/step/context-storage.d.ts +5 -5
  161. package/dist/step/context-storage.js +1 -1
  162. package/dist/step/writable-stream.d.ts +3 -3
  163. package/dist/step/writable-stream.js +7 -7
  164. package/dist/step.js +12 -12
  165. package/dist/symbols.d.ts +2 -2
  166. package/dist/symbols.js +3 -3
  167. package/dist/telemetry/semantic-conventions.d.ts +21 -13
  168. package/dist/telemetry/semantic-conventions.d.ts.map +1 -1
  169. package/dist/telemetry/semantic-conventions.js +21 -15
  170. package/dist/telemetry.d.ts +9 -3
  171. package/dist/telemetry.d.ts.map +1 -1
  172. package/dist/telemetry.js +40 -10
  173. package/dist/test-support/orchestrator-context.d.ts.map +1 -1
  174. package/dist/test-support/orchestrator-context.js +12 -2
  175. package/dist/version.d.ts +1 -1
  176. package/dist/version.js +2 -2
  177. package/dist/vm/index.js +4 -4
  178. package/dist/vm/script-cache.d.ts.map +1 -1
  179. package/dist/vm/script-cache.js +23 -17
  180. package/dist/vm/uint8array-base64.js +1 -1
  181. package/dist/workflow/abort-controller.d.ts +1 -1
  182. package/dist/workflow/abort-controller.js +12 -12
  183. package/dist/workflow/create-hook.js +3 -3
  184. package/dist/workflow/get-workflow-metadata.js +2 -2
  185. package/dist/workflow/hook.js +18 -18
  186. package/dist/workflow/set-attributes.d.ts +1 -1
  187. package/dist/workflow/set-attributes.js +2 -2
  188. package/dist/workflow/sleep.js +2 -2
  189. package/dist/workflow/world-init-stub.d.ts +1 -1
  190. package/dist/workflow/world-init-stub.js +2 -2
  191. package/dist/workflow.d.ts +2 -2
  192. package/dist/workflow.js +36 -14
  193. package/docs/api-reference/create-hook.mdx +15 -15
  194. package/docs/api-reference/create-webhook.mdx +15 -15
  195. package/docs/api-reference/define-hook.mdx +10 -10
  196. package/docs/api-reference/fatal-error.mdx +2 -2
  197. package/docs/api-reference/fetch.mdx +7 -7
  198. package/docs/api-reference/get-step-metadata.mdx +2 -2
  199. package/docs/api-reference/get-workflow-metadata.mdx +3 -3
  200. package/docs/api-reference/get-writable.mdx +7 -7
  201. package/docs/api-reference/index.mdx +1 -1
  202. package/docs/api-reference/retryable-error.mdx +1 -1
  203. package/docs/api-reference/set-attributes.mdx +2 -2
  204. package/docs/api-reference/sleep.mdx +3 -3
  205. package/docs/foundations/cancellation.mdx +31 -31
  206. package/docs/foundations/errors-and-retries.mdx +42 -11
  207. package/docs/foundations/hooks.mdx +37 -37
  208. package/docs/foundations/idempotency.mdx +9 -9
  209. package/docs/foundations/serialization.mdx +21 -22
  210. package/docs/foundations/starting-workflows.mdx +36 -37
  211. package/docs/foundations/streaming.mdx +68 -39
  212. package/docs/foundations/versioning.mdx +3 -3
  213. package/docs/foundations/workflows-and-steps.mdx +9 -9
  214. package/docs/how-it-works/cancellation.mdx +62 -62
  215. package/docs/how-it-works/code-transform.mdx +66 -54
  216. package/docs/how-it-works/encryption.mdx +25 -21
  217. package/docs/how-it-works/event-sourcing.mdx +84 -28
  218. package/docs/how-it-works/framework-integrations.mdx +12 -12
  219. package/docs/how-it-works/understanding-directives.mdx +21 -21
  220. package/package.json +7 -7
@@ -1,3 +1,4 @@
1
+ import { globalSingleton } from '@workflow/utils';
1
2
  import { runtimeLogger } from '../logger.js';
2
3
  /**
3
4
  * In-process single-flight for step body execution, keyed by
@@ -8,7 +9,7 @@ import { runtimeLogger } from '../logger.js';
8
9
  * *death proof* only on platforms with a bounded invocation lifetime. On
9
10
  * worlds without an invocation kill bound (world-local's single process,
10
11
  * self-hosted deployments) a delayed backstop can fire while the owning
11
- * execution is still mid-body in the same process. This map absorbs that
12
+ * execution is still mid-body, in the same process. This map absorbs that
12
13
  * race: the loser awaits the winner's settlement and then acks WITHOUT
13
14
  * executing. On Vercel Fluid compute it also absorbs same-instance races
14
15
  * between an owner redelivery and a backstop.
@@ -17,32 +18,37 @@ import { runtimeLogger } from '../logger.js';
17
18
  * after an early ack would consume the loser's queue message while the
18
19
  * winner's outcome is still unknown, potentially orphaning the step with no
19
20
  * message left to drive it. Awaiting settlement first keeps the at-least-once
20
- * envelope intact if the loser's own invocation hits its deadline while
21
+ * envelope intact: if the loser's own invocation hits its deadline while
21
22
  * waiting, its message redelivers and re-checks, degrading gracefully to
22
23
  * polling.
23
24
  *
24
25
  * Cross-instance duplicates (two separate processes racing the same step)
25
- * are out of scope here that is what the ownership lease bounds on
26
+ * are out of scope here; that is what the ownership lease bounds on
26
27
  * platforms where it is a death proof, and the documented residual risk on
27
28
  * multi-instance self-hosted worlds (mitigate by raising
28
29
  * `WORKFLOW_INLINE_OWNERSHIP_LEASE_SECONDS`).
29
30
  */
30
- const inFlightSteps = new Map();
31
+ // On `globalThis` (see `globalSingleton`), not module scope: a per-copy map is
32
+ // not single-flight. Two invocations reaching this module through different
33
+ // bundler layers would each believe they were the only one in the process and
34
+ // both run the step body, degrading in-process dedup to the cross-process
35
+ // residual the doc above scopes out.
36
+ const singleFlight = globalSingleton('@workflow/core//stepSingleFlight', 1, () => ({ inFlight: new Map() }));
31
37
  /**
32
38
  * Run `execute` unless an execution for the same run + step correlation ID is
33
39
  * already in flight in this process. The winner's result is returned to the
34
40
  * winner; a loser awaits the winner's settlement (success OR failure) and
35
41
  * then returns `{ type: 'skipped' }` so its caller acks without running the
36
- * body. A winner failure is not propagated to the loser the winner's own
42
+ * body. A winner failure is not propagated to the loser: the winner's own
37
43
  * queue message redelivers and drives the retry, so exactly one message
38
44
  * keeps owning the outcome.
39
45
  */
40
46
  export async function runStepSingleFlight(runId, correlationId, execute) {
41
47
  const key = `${runId}:${correlationId}`;
42
- const existing = inFlightSteps.get(key);
48
+ const existing = singleFlight.inFlight.get(key);
43
49
  if (existing) {
44
50
  // warn (always printed, unlike debug/info): the single-flight is
45
- // absorbing what would have been a duplicate execution typically a
51
+ // absorbing what would have been a duplicate execution, typically a
46
52
  // delayed backstop or retry message landing in the same process while
47
53
  // the owner is still mid-body. Rare by design; a burst of these means
48
54
  // leases are expiring under live executions (raise
@@ -53,17 +59,17 @@ export async function runStepSingleFlight(runId, correlationId, execute) {
53
59
  }
54
60
  catch {
55
61
  // The winner failed (typically a transient world error). Its own queue
56
- // message redelivers and retries; this loser still just skips.
62
+ // message redelivers and retries; this loser still skips.
57
63
  }
58
64
  return { type: 'skipped' };
59
65
  }
60
66
  const promise = execute();
61
- inFlightSteps.set(key, promise);
67
+ singleFlight.inFlight.set(key, promise);
62
68
  try {
63
69
  return await promise;
64
70
  }
65
71
  finally {
66
- inFlightSteps.delete(key);
72
+ singleFlight.inFlight.delete(key);
67
73
  }
68
74
  }
69
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic3RlcC1zaW5nbGUtZmxpZ2h0LmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vc3JjL3J1bnRpbWUvc3RlcC1zaW5nbGUtZmxpZ2h0LnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLE9BQU8sRUFBRSxhQUFhLEVBQUUsTUFBTSxjQUFjLENBQUM7QUFHN0M7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7OztHQTJCRztBQUNILE1BQU0sYUFBYSxHQUFHLElBQUksR0FBRyxFQUF3QyxDQUFDO0FBRXRFOzs7Ozs7OztHQVFHO0FBQ0gsTUFBTSxDQUFDLEtBQUssVUFBVSxtQkFBbUIsQ0FDdkMsS0FBYSxFQUNiLGFBQXFCLEVBQ3JCLE9BQTJDO0lBRTNDLE1BQU0sR0FBRyxHQUFHLEdBQUcsS0FBSyxJQUFJLGFBQWEsRUFBRSxDQUFDO0lBQ3hDLE1BQU0sUUFBUSxHQUFHLGFBQWEsQ0FBQyxHQUFHLENBQUMsR0FBRyxDQUFDLENBQUM7SUFDeEMsSUFBSSxRQUFRLEVBQUUsQ0FBQztRQUNiLGlFQUFpRTtRQUNqRSxxRUFBcUU7UUFDckUsc0VBQXNFO1FBQ3RFLHNFQUFzRTtRQUN0RSxtREFBbUQ7UUFD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FkeSBpbiBmbGlnaHQgaW4gdGhpcyBwcm9jZXNzOyBhd2FpdGluZyBpdHMgc2V0dGxlbWVudCBpbnN0ZWFkIG9mIGV4ZWN1dGluZyBhZ2FpbicsXG4gICAgICB7IHdvcmtmbG93UnVuSWQ6IHJ1bklkLCBzdGVwSWQ6IGNvcnJlbGF0aW9uSWQgfVxuICAgICk7XG4gICAgdHJ5IHtcbiAgICAgIGF3YWl0IGV4aXN0aW5nO1xuICAgIH0gY2F0Y2gge1xuICAgICAgLy8gVGhlIHdpbm5lciBmYWlsZWQgKHR5cGljYWxseSBhIHRyYW5zaWVudCB3b3JsZCBlcnJvcikuIEl0cyBvd24gcXVldWVcbiAgICAgIC8vIG1lc3NhZ2UgcmVkZWxpdmVycyBhbmQgcmV0cmllczsgdGhpcyBsb3NlciBzdGlsbCBza2lwcy5cbiAgICB9XG4gICAgcmV0dXJuIHsgdHlwZTogJ3NraXBwZWQnIH07XG4gIH1cblxuICBjb25zdCBwcm9taXNlID0gZXhlY3V0ZSgpO1xuICBzaW5nbGVGbGlnaHQuaW5GbGlnaHQuc2V0KGtleSwgcHJvbWlzZSk7XG4gIHRyeSB7XG4gICAgcmV0dXJuIGF3YWl0IHByb21pc2U7XG4gIH0gZmluYWxseSB7XG4gICAgc2luZ2xlRmxpZ2h0LmluRmxpZ2h0LmRlbGV0ZShrZXkpO1xuICB9XG59XG4iXX0=
@@ -3,6 +3,7 @@ import { type SerializedData, type TraceCarrier, type ValidQueueName, type Workf
3
3
  import type { StepInvocationQueueItem, WorkflowSuspension } from '../global.js';
4
4
  import { type LoadedEventLog } from './helpers.js';
5
5
  import { ReplayRecoveryReporter } from './replay-recovery-reporter.js';
6
+ import type { PreclaimedInlineStart } from './step-executor.js';
6
7
  export interface SuspensionHandlerParams {
7
8
  suspension: WorkflowSuspension;
8
9
  world: World;
@@ -12,7 +13,7 @@ export interface SuspensionHandlerParams {
12
13
  /**
13
14
  * The runtime's loaded event log. Every event creation this suspension makes
14
15
  * names the position it was derived from, so a backend that has recorded
15
- * events the replay did not see can report them back on the write or, if
16
+ * events the replay did not see can report them back on the write, or, if
16
17
  * it would rather refuse than report, reject it with a 412. A rejection is
17
18
  * not retried here: the event's correlation id was minted by *this* replay's
18
19
  * seeded sequence, so re-committing it against a corrected log would persist
@@ -34,14 +35,14 @@ export interface SuspensionHandlerParams {
34
35
  replayRecoveryReporter?: ReplayRecoveryReporter;
35
36
  /**
36
37
  * Resilient step dispatch: when provided (and the per-step eligibility gates
37
- * pass see the step ops below), each newly created non-inline step's
38
+ * pass, see the step ops below), each newly created non-inline step's
38
39
  * `step_created` write is parallelized with its step-execution queue
39
40
  * publish, and the queue message carries the serialized step input
40
41
  * (`stepInput`) so the consumer can idempotently re-ensure the event if the
41
42
  * direct write failed transiently. Steps queued this way are reported in
42
43
  * {@link SuspensionHandlerResult.queuedStepCorrelationIds} so the caller
43
44
  * skips them in its own dispatch pass. Omitted by callers that must not
44
- * queue (terminal drain, tests) creates then behave exactly as before.
45
+ * queue (terminal drain, tests); creates then behave exactly as before.
45
46
  */
46
47
  stepDispatch?: {
47
48
  /** The unified workflow queue this run's step messages are published to. */
@@ -52,6 +53,31 @@ export interface SuspensionHandlerParams {
52
53
  */
53
54
  getTraceCarrier: () => Promise<TraceCarrier>;
54
55
  };
56
+ /**
57
+ * Inline step ownership: the queue message ID of the invocation this
58
+ * suspension runs in (the queue handler's meta). When present AND the
59
+ * batched fan-out engages, the lazy-inline steps' deferred writes are
60
+ * folded into the batch as `step_created` + `step_started` pairs (the
61
+ * started row stamped with this ID, exactly like the lazy claim it
62
+ * replaces), pre-claiming the steps the caller is about to run inline. See
63
+ * {@link SuspensionHandlerResult.inlineClaims}. Callers that never
64
+ * inline-execute (terminal drain) omit it, keeping their lazy steps on the
65
+ * plain deferred path.
66
+ */
67
+ ownerMessageId?: string;
68
+ /**
69
+ * Lets the batched fan-out return before every chunk has committed: only
70
+ * the chunk carrying the pre-claimed inline pairs gates the handler's
71
+ * return (its claims are what the caller starts bodies from), while the
72
+ * trailing chunks' commits (and every chunk's in-flush step-message
73
+ * publishes) ride {@link SuspensionHandlerResult.deferredBatchWork}. A
74
+ * caller that opts in MUST await that promise before acking its delivery:
75
+ * the durability contract ("every create durable before ack") moves from
76
+ * the handler's return to that join, and nothing else re-drives a lost
77
+ * trailing chunk. Callers that don't opt in (terminal drain, default)
78
+ * keep the everything-durable-at-return behavior.
79
+ */
80
+ allowDeferredBatchWork?: boolean;
55
81
  }
56
82
  /**
57
83
  * Result of handling a suspension. Returns pending step items so the caller
@@ -64,16 +90,28 @@ export interface SuspensionHandlerResult {
64
90
  * Correlation IDs for which this suspension call actually wrote the
65
91
  * step_created event (as opposed to catching EntityConflictError because
66
92
  * a concurrent handler wrote it first). Only the handler that wrote the
67
- * step_created event should queue / inline-execute the step this
93
+ * step_created event should queue / inline-execute the step; this
68
94
  * guarantees a single owner per step, even when multiple handlers race
69
95
  * into the same batch boundary.
70
96
  */
71
97
  createdStepCorrelationIds: Set<string>;
98
+ /**
99
+ * Correlation IDs of steps whose arguments failed to serialize. Each was
100
+ * finalized here as `step_created` (with a placeholder input; the real
101
+ * input is precisely what refused to serialize) followed by `step_failed`
102
+ * carrying the SerializationError, so the next replay rejects the step's
103
+ * promise and a try/catch around the step call observes the error,
104
+ * exactly like a step-body failure. No step-execution message is
105
+ * dispatched for these, so the caller MUST force an in-process replay:
106
+ * when the failed step was the only pending work, nothing else will ever
107
+ * re-invoke the run to observe the terminal event.
108
+ */
109
+ failedStepCorrelationIds: Set<string>;
72
110
  /**
73
111
  * Correlation IDs of steps this suspension call already published
74
112
  * step-execution queue messages for, via resilient step dispatch (the
75
113
  * `step_created` write parallelized with a `stepInput`-carrying queue
76
- * publish). The caller MUST NOT dispatch these again the message is
114
+ * publish). The caller MUST NOT dispatch these again: the message is
77
115
  * already out (a duplicate would be deduped by its idempotency key, but
78
116
  * costs a wasted round-trip). Empty when {@link SuspensionHandlerParams.stepDispatch}
79
117
  * was not provided or no step was eligible.
@@ -104,6 +142,60 @@ export interface SuspensionHandlerResult {
104
142
  stepName: string;
105
143
  dehydratedInput: SerializedData;
106
144
  }>;
145
+ /**
146
+ * Pre-claimed inline starts, by correlation id: the per-step verdicts of
147
+ * the `step_created` + `step_started` pairs the batched fan-out committed
148
+ * for the lazy-inline steps. A step with an entry here is passed to
149
+ * `executeStep` as `preclaimedStart` INSTEAD of `lazyStepInput`: its
150
+ * input already rode the pair, and the claim is settled: `owned: true`
151
+ * carries the started attempt-1 entity (input re-attached) so the body
152
+ * runs straight off the batch commit with no start write of its own;
153
+ * `owned: false` lost the pair's atomic create-claim to a concurrent
154
+ * writer, and executeStep returns `skipped` without running the body,
155
+ * the same outcome as losing the lazy claim. Empty whenever the fold did
156
+ * not engage (batching off, no `ownerMessageId`, or the lone-inline case,
157
+ * which keeps the optimistic lazy path and its claim/body overlap).
158
+ *
159
+ * Crash window: the pair commits before the caller runs the body, so a
160
+ * crash between them leaves a started step stamped with this message's
161
+ * ID. Redelivery of the same message re-executes it via the owned-recovery
162
+ * path, the exact machinery the lazy claim's crash window already uses.
163
+ */
164
+ inlineClaims: Map<string, PreclaimedInlineStart>;
165
+ /**
166
+ * The highest slot the batched fan-out committed, when it ran. The batch's
167
+ * own events are not in the caller's loaded log (the next reload picks
168
+ * them up), so the caller folds this ceiling into the slot snapshot it
169
+ * hands the inline executions; otherwise every inline terminal write
170
+ * would name a pre-batch position and be answered with a skipped-slot
171
+ * report echoing the events this suspension just wrote. Under
172
+ * {@link SuspensionHandlerParams.allowDeferredBatchWork} this covers the
173
+ * chunks that had committed by the handler's return (always the pair
174
+ * chunk); a trailing chunk that commits later is echoed back on the
175
+ * terminal writes like any foreign event: reports the executor reads for
176
+ * position and discards.
177
+ *
178
+ * So the echo is only fully suppressed for a SINGLE-chunk fold. On a
179
+ * multi-chunk fan-out the bodies start off the pair chunk while trailing
180
+ * chunks are still in flight, and an inline terminal write issued in that
181
+ * window still names a position below them and still draws a report for
182
+ * their events. Bounded (trailing chunks only, large fan-outs only) and
183
+ * self-correcting on the next reload, and recorded so a report seen there
184
+ * reads as expected rather than as a bug.
185
+ */
186
+ batchCommittedSlotCeiling?: number;
187
+ /**
188
+ * The batched fan-out's deferred work, present only when the caller opted
189
+ * in via {@link SuspensionHandlerParams.allowDeferredBatchWork} and
190
+ * trailing work exists: the commits of every chunk except the pair chunk,
191
+ * plus every chunk's step-message publishes (each chained on ITS OWN
192
+ * chunk's commit, so publish-after-create holds per step). The caller
193
+ * MUST await it before acking: a rejection here is a failed suspension
194
+ * write and fails the delivery exactly as it would have at the handler's
195
+ * return. Steps whose messages this work publishes are already in
196
+ * {@link queuedStepCorrelationIds} at return time.
197
+ */
198
+ deferredBatchWork?: Promise<void>;
107
199
  /**
108
200
  * The soonest pending wait, if any: seconds until it elapses and the
109
201
  * correlationId of the wait that produced that timeout. The
@@ -146,12 +238,12 @@ export interface SuspensionHandlerResult {
146
238
  }
147
239
  /**
148
240
  * Handles a workflow suspension by processing all pending operations (hooks, steps, waits).
149
- * Creates events for all operations but does NOT queue step messages returns the pending
241
+ * Creates events for all operations but does NOT queue step messages; returns the pending
150
242
  * steps so the caller can decide which to execute inline vs queue to background.
151
243
  *
152
244
  * Processing order:
153
245
  * 1. Hooks are processed first to prevent race conditions with webhook receivers
154
246
  * 2. Step events and wait events are created in parallel
155
247
  */
156
- export declare function handleSuspension({ suspension, world, run, span, requestId, eventLog, runReadyBarrier, replayRecoveryReporter, stepDispatch, }: SuspensionHandlerParams): Promise<SuspensionHandlerResult>;
248
+ export declare function handleSuspension({ suspension, world, run, span, requestId, eventLog, runReadyBarrier, replayRecoveryReporter, stepDispatch, ownerMessageId, allowDeferredBatchWork, }: SuspensionHandlerParams): Promise<SuspensionHandlerResult>;
157
249
  //# sourceMappingURL=suspension-handler.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"suspension-handler.d.ts","sourceRoot":"","sources":["../../src/runtime/suspension-handler.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,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rB,aAAa,EAAE,MAAM,CAAC;QACtB,QAAQ,EAAE,MAAM,CAAC;QACjB,eAAe,EAAE,cAAc,CAAC;KACjC,CAAC,CAAC;IACH;;;;;;OAMG;IACH,WAAW,CAAC,EAAE;QAAE,OAAO,EAAE,MAAM,CAAC;QAAC,aAAa,EAAE,MAAM,CAAA;KAAE,CAAC;IACzD,0EAA0E;IAC1E,eAAe,EAAE,OAAO,CAAC;IACzB,wFAAwF;IACxF,sBAAsB,EAAE,OAAO,CAAC;IAChC,wEAAwE;IACxE,kBAAkB,EAAE,OAAO,CAAC;IAC5B;;;;;;OAMG;IACH,aAAa,EAAE,OAAO,CAAC;IACvB;;;;;OAKG;IACH,cAAc,EAAE,MAAM,CAAC;IACvB;;;;;OAKG;IACH,sBAAsB,EAAE,OAAO,CAAC;CACjC;AA6ED;;;;;;;;GAQG;AACH,wBAAsB,gBAAgB,CAAC,EACrC,UAAU,EACV,KAAK,EACL,GAAG,EACH,IAAI,EACJ,SAAS,EACT,QAAQ,EACR,eAAe,EACf,sBAAsB,EACtB,YAAY,GACb,EAAE,uBAAuB,GAAG,OAAO,CAAC,uBAAuB,CAAC,CA6uB5D"}
1
+ {"version":3,"file":"suspension-handler.d.ts","sourceRoot":"","sources":["../../src/runtime/suspension-handler.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,oBAAoB,CAAC;AAU/C,OAAO,EAKL,KAAK,cAAc,EAMnB,KAAK,YAAY,EACjB,KAAK,cAAc,EACnB,KAAK,WAAW,EAChB,KAAK,KAAK,EACX,MAAM,iBAAiB,CAAC;AAGzB,OAAO,KAAK,EAGV,uBAAuB,EAEvB,kBAAkB,EACnB,MAAM,cAAc,CAAC;AAiBtB,OAAO,EAGL,KAAK,cAAc,EAKpB,MAAM,cAAc,CAAC;AACtB,OAAO,EAAE,sBAAsB,EAAE,MAAM,+BAA+B,CAAC;AACvE,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,oBAAoB,C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