@workflow/core 5.0.0-beta.43 → 5.0.0-beta.46

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 (228) hide show
  1. package/dist/attribute-changes.d.ts +3 -5
  2. package/dist/attribute-changes.d.ts.map +1 -1
  3. package/dist/attribute-changes.js +2 -2
  4. package/dist/capabilities.d.ts +6 -6
  5. package/dist/capabilities.js +8 -8
  6. package/dist/capture-stack.d.ts +1 -1
  7. package/dist/capture-stack.js +2 -2
  8. package/dist/class-serialization.d.ts +8 -8
  9. package/dist/class-serialization.js +9 -9
  10. package/dist/classify-error.js +5 -5
  11. package/dist/context-violation-error.d.ts +5 -5
  12. package/dist/context-violation-error.d.ts.map +1 -1
  13. package/dist/context-violation-error.js +5 -5
  14. package/dist/create-hook.d.ts +2 -2
  15. package/dist/create-hook.js +1 -1
  16. package/dist/define-hook.js +2 -2
  17. package/dist/describe-error.d.ts +7 -7
  18. package/dist/describe-error.js +8 -8
  19. package/dist/encryption.d.ts +5 -5
  20. package/dist/encryption.js +7 -7
  21. package/dist/events-consumer.d.ts +20 -8
  22. package/dist/events-consumer.d.ts.map +1 -1
  23. package/dist/events-consumer.js +34 -12
  24. package/dist/flushable-stream.d.ts +4 -4
  25. package/dist/flushable-stream.js +13 -13
  26. package/dist/global.d.ts +4 -2
  27. package/dist/global.d.ts.map +1 -1
  28. package/dist/global.js +8 -5
  29. package/dist/index.d.ts +1 -1
  30. package/dist/index.js +2 -2
  31. package/dist/log-format.d.ts +2 -2
  32. package/dist/log-format.js +5 -5
  33. package/dist/logger.js +4 -4
  34. package/dist/private.d.ts +29 -71
  35. package/dist/private.d.ts.map +1 -1
  36. package/dist/private.js +170 -38
  37. package/dist/replay-payload-cache.d.ts +1 -1
  38. package/dist/replay-payload-cache.js +4 -4
  39. package/dist/runtime/compute-instance.d.ts +4 -3
  40. package/dist/runtime/compute-instance.d.ts.map +1 -1
  41. package/dist/runtime/compute-instance.js +5 -4
  42. package/dist/runtime/constants.d.ts +24 -24
  43. package/dist/runtime/constants.d.ts.map +1 -1
  44. package/dist/runtime/constants.js +49 -43
  45. package/dist/runtime/count-step-started-events.d.ts +7 -7
  46. package/dist/runtime/count-step-started-events.js +4 -4
  47. package/dist/runtime/deployment-guard.d.ts +7 -7
  48. package/dist/runtime/deployment-guard.js +8 -8
  49. package/dist/runtime/get-port-lazy.d.ts +2 -2
  50. package/dist/runtime/get-port-lazy.d.ts.map +1 -1
  51. package/dist/runtime/get-port-lazy.js +37 -30
  52. package/dist/runtime/get-world-lazy.d.ts +2 -2
  53. package/dist/runtime/get-world-lazy.js +3 -3
  54. package/dist/runtime/helpers.d.ts +21 -21
  55. package/dist/runtime/helpers.js +27 -27
  56. package/dist/runtime/quickjs-entrypoint.d.ts +21 -10
  57. package/dist/runtime/quickjs-entrypoint.d.ts.map +1 -1
  58. package/dist/runtime/quickjs-entrypoint.js +206 -81
  59. package/dist/runtime/quickjs-runtime.d.ts +31 -15
  60. package/dist/runtime/quickjs-runtime.d.ts.map +1 -1
  61. package/dist/runtime/quickjs-runtime.js +132 -77
  62. package/dist/runtime/quickjs-serde.d.ts +10 -10
  63. package/dist/runtime/quickjs-serde.js +20 -20
  64. package/dist/runtime/replay-budget.d.ts +4 -4
  65. package/dist/runtime/replay-budget.js +5 -5
  66. package/dist/runtime/replay-recovery-reporter.d.ts +1 -1
  67. package/dist/runtime/replay-recovery-reporter.js +2 -2
  68. package/dist/runtime/resume-hook.d.ts +27 -12
  69. package/dist/runtime/resume-hook.d.ts.map +1 -1
  70. package/dist/runtime/resume-hook.js +200 -200
  71. package/dist/runtime/resume-latency.d.ts +40 -30
  72. package/dist/runtime/resume-latency.d.ts.map +1 -1
  73. package/dist/runtime/resume-latency.js +7 -5
  74. package/dist/runtime/run-id-time.d.ts +2 -2
  75. package/dist/runtime/run-id-time.js +5 -5
  76. package/dist/runtime/run.d.ts +22 -5
  77. package/dist/runtime/run.d.ts.map +1 -1
  78. package/dist/runtime/run.js +106 -11
  79. package/dist/runtime/runs.d.ts +4 -4
  80. package/dist/runtime/runs.js +2 -2
  81. package/dist/runtime/start.d.ts +3 -3
  82. package/dist/runtime/start.d.ts.map +1 -1
  83. package/dist/runtime/start.js +29 -25
  84. package/dist/runtime/step-executor.d.ts +14 -14
  85. package/dist/runtime/step-executor.d.ts.map +1 -1
  86. package/dist/runtime/step-executor.js +54 -39
  87. package/dist/runtime/step-latency.d.ts +42 -25
  88. package/dist/runtime/step-latency.d.ts.map +1 -1
  89. package/dist/runtime/step-latency.js +29 -23
  90. package/dist/runtime/step-ownership.d.ts +6 -6
  91. package/dist/runtime/step-ownership.js +8 -8
  92. package/dist/runtime/step-single-flight.d.ts +1 -1
  93. package/dist/runtime/step-single-flight.d.ts.map +1 -1
  94. package/dist/runtime/step-single-flight.js +17 -11
  95. package/dist/runtime/suspension-handler.d.ts +38 -24
  96. package/dist/runtime/suspension-handler.d.ts.map +1 -1
  97. package/dist/runtime/suspension-handler.js +238 -103
  98. package/dist/runtime/unserializable-step.d.ts +34 -0
  99. package/dist/runtime/unserializable-step.d.ts.map +1 -0
  100. package/dist/runtime/unserializable-step.js +52 -0
  101. package/dist/runtime/vm-mode.d.ts +1 -1
  102. package/dist/runtime/vm-mode.js +2 -2
  103. package/dist/runtime/wait-continuation.d.ts +31 -9
  104. package/dist/runtime/wait-continuation.d.ts.map +1 -1
  105. package/dist/runtime/wait-continuation.js +44 -13
  106. package/dist/runtime/wait-until.d.ts +1 -1
  107. package/dist/runtime/wait-until.js +2 -2
  108. package/dist/runtime/world-compatibility.d.ts +20 -9
  109. package/dist/runtime/world-compatibility.d.ts.map +1 -1
  110. package/dist/runtime/world-compatibility.js +24 -13
  111. package/dist/runtime/world-init.d.ts +5 -5
  112. package/dist/runtime/world-init.js +6 -6
  113. package/dist/runtime/world.d.ts.map +1 -1
  114. package/dist/runtime/world.js +13 -3
  115. package/dist/runtime.d.ts.map +1 -1
  116. package/dist/runtime.js +427 -266
  117. package/dist/sealed-box.d.ts +7 -7
  118. package/dist/sealed-box.js +15 -15
  119. package/dist/serialization/client.js +2 -2
  120. package/dist/serialization/codec-devalue-vm.d.ts +1 -1
  121. package/dist/serialization/codec-devalue-vm.js +4 -4
  122. package/dist/serialization/codec-devalue.d.ts +1 -1
  123. package/dist/serialization/codec-devalue.js +2 -2
  124. package/dist/serialization/codec.d.ts +4 -4
  125. package/dist/serialization/codec.js +2 -2
  126. package/dist/serialization/compression.d.ts +12 -11
  127. package/dist/serialization/compression.d.ts.map +1 -1
  128. package/dist/serialization/compression.js +16 -15
  129. package/dist/serialization/encryption.d.ts +7 -7
  130. package/dist/serialization/encryption.d.ts.map +1 -1
  131. package/dist/serialization/encryption.js +8 -8
  132. package/dist/serialization/errors.js +2 -2
  133. package/dist/serialization/format.d.ts +6 -6
  134. package/dist/serialization/format.js +7 -7
  135. package/dist/serialization/hardened.d.ts +23 -22
  136. package/dist/serialization/hardened.d.ts.map +1 -1
  137. package/dist/serialization/hardened.js +47 -32
  138. package/dist/serialization/index.d.ts +1 -1
  139. package/dist/serialization/index.js +2 -2
  140. package/dist/serialization/reducers/class-vm.d.ts +1 -1
  141. package/dist/serialization/reducers/class-vm.js +2 -2
  142. package/dist/serialization/reducers/class.js +2 -2
  143. package/dist/serialization/reducers/common-vm.js +12 -12
  144. package/dist/serialization/reducers/common.js +12 -12
  145. package/dist/serialization/reducers/step-function-vm.d.ts +1 -1
  146. package/dist/serialization/reducers/step-function-vm.js +2 -2
  147. package/dist/serialization/reducers/step-function.js +2 -2
  148. package/dist/serialization/step.js +2 -2
  149. package/dist/serialization/types.d.ts +5 -5
  150. package/dist/serialization/types.js +2 -2
  151. package/dist/serialization/workflow-vm.d.ts +1 -1
  152. package/dist/serialization/workflow-vm.d.ts.map +1 -1
  153. package/dist/serialization/workflow-vm.js +13 -10
  154. package/dist/serialization-format.d.ts +11 -11
  155. package/dist/serialization-format.d.ts.map +1 -1
  156. package/dist/serialization-format.js +30 -24
  157. package/dist/serialization.d.ts +15 -16
  158. package/dist/serialization.d.ts.map +1 -1
  159. package/dist/serialization.js +116 -109
  160. package/dist/set-attributes.js +2 -2
  161. package/dist/source-map.d.ts +1 -1
  162. package/dist/source-map.d.ts.map +1 -1
  163. package/dist/source-map.js +18 -12
  164. package/dist/step/context-storage.d.ts +5 -5
  165. package/dist/step/context-storage.js +1 -1
  166. package/dist/step/writable-stream.d.ts +3 -3
  167. package/dist/step/writable-stream.js +7 -7
  168. package/dist/step.d.ts.map +1 -1
  169. package/dist/step.js +14 -22
  170. package/dist/symbols.d.ts +2 -2
  171. package/dist/symbols.js +3 -3
  172. package/dist/telemetry/semantic-conventions.d.ts +34 -17
  173. package/dist/telemetry/semantic-conventions.d.ts.map +1 -1
  174. package/dist/telemetry/semantic-conventions.js +32 -17
  175. package/dist/telemetry.d.ts +3 -3
  176. package/dist/telemetry.d.ts.map +1 -1
  177. package/dist/telemetry.js +19 -10
  178. package/dist/test-support/orchestrator-context.d.ts.map +1 -1
  179. package/dist/test-support/orchestrator-context.js +12 -2
  180. package/dist/version.d.ts +1 -1
  181. package/dist/version.js +2 -2
  182. package/dist/vm/index.js +4 -4
  183. package/dist/vm/script-cache.d.ts.map +1 -1
  184. package/dist/vm/script-cache.js +23 -17
  185. package/dist/vm/uint8array-base64.js +1 -1
  186. package/dist/workflow/abort-controller.d.ts +1 -1
  187. package/dist/workflow/abort-controller.js +12 -12
  188. package/dist/workflow/attribute-dispatcher.d.ts.map +1 -1
  189. package/dist/workflow/attribute-dispatcher.js +3 -6
  190. package/dist/workflow/create-hook.js +2 -2
  191. package/dist/workflow/get-workflow-metadata.js +2 -2
  192. package/dist/workflow/hook.d.ts.map +1 -1
  193. package/dist/workflow/hook.js +21 -30
  194. package/dist/workflow/set-attributes.d.ts +1 -1
  195. package/dist/workflow/set-attributes.js +2 -2
  196. package/dist/workflow/sleep.js +2 -2
  197. package/dist/workflow/world-init-stub.d.ts +1 -1
  198. package/dist/workflow/world-init-stub.js +2 -2
  199. package/dist/workflow.d.ts +2 -2
  200. package/dist/workflow.js +26 -13
  201. package/docs/api-reference/create-hook.mdx +15 -15
  202. package/docs/api-reference/create-webhook.mdx +15 -15
  203. package/docs/api-reference/define-hook.mdx +10 -10
  204. package/docs/api-reference/fatal-error.mdx +2 -2
  205. package/docs/api-reference/fetch.mdx +7 -7
  206. package/docs/api-reference/get-step-metadata.mdx +2 -2
  207. package/docs/api-reference/get-workflow-metadata.mdx +3 -3
  208. package/docs/api-reference/get-writable.mdx +7 -7
  209. package/docs/api-reference/index.mdx +1 -1
  210. package/docs/api-reference/retryable-error.mdx +1 -1
  211. package/docs/api-reference/set-attributes.mdx +2 -2
  212. package/docs/api-reference/sleep.mdx +3 -3
  213. package/docs/foundations/cancellation.mdx +31 -31
  214. package/docs/foundations/errors-and-retries.mdx +42 -11
  215. package/docs/foundations/hooks.mdx +35 -35
  216. package/docs/foundations/idempotency.mdx +9 -9
  217. package/docs/foundations/serialization.mdx +21 -22
  218. package/docs/foundations/starting-workflows.mdx +36 -37
  219. package/docs/foundations/streaming.mdx +46 -41
  220. package/docs/foundations/versioning.mdx +3 -3
  221. package/docs/foundations/workflows-and-steps.mdx +9 -9
  222. package/docs/how-it-works/cancellation.mdx +62 -62
  223. package/docs/how-it-works/code-transform.mdx +66 -54
  224. package/docs/how-it-works/encryption.mdx +25 -21
  225. package/docs/how-it-works/event-sourcing.mdx +53 -35
  226. package/docs/how-it-works/framework-integrations.mdx +12 -12
  227. package/docs/how-it-works/understanding-directives.mdx +21 -21
  228. 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,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic3RlcC1zaW5nbGUtZmxpZ2h0LmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vc3JjL3J1bnRpbWUvc3RlcC1zaW5nbGUtZmxpZ2h0LnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLE9BQU8sRUFBRSxhQUFhLEVBQUUsTUFBTSxjQUFjLENBQUM7QUFHN0M7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7OztHQTJCRztBQUNILE1BQU0sYUFBYSxHQUFHLElBQUksR0FBRyxFQUF3QyxDQUFDO0FBRXRFOzs7Ozs7OztHQVFHO0FBQ0gsTUFBTSxDQUFDLEtBQUssVUFBVSxtQkFBbUIsQ0FDdkMsS0FBYSxFQUNiLGFBQXFCLEVBQ3JCLE9BQTJDO0lBRTNDLE1BQU0sR0FBRyxHQUFHLEdBQUcsS0FBSyxJQUFJLGFBQWE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XNlIG1lYW5zXG4gICAgLy8gbGVhc2VzIGFyZSBleHBpcmluZyB1bmRlciBsaXZlIGV4ZWN1dGlvbnMgKHJhaXNlXG4gICAgLy8gV09SS0ZMT1dfSU5MSU5FX09XTkVSU0hJUF9MRUFTRV9TRUNPTkRTKS5cbiAgICBydW50aW1lTG9nZ2VyLndhcm4oXG4gICAgICAnU3RlcCBleGVjdXRpb24gYWxyZWFkeSBpbiBmbGlnaHQgaW4gdGhpcyBwcm9jZXNzOyBhd2FpdGluZyBpdHMgc2V0dGxlbWVudCBpbnN0ZWFkIG9mIGV4ZWN1dGluZyBhZ2FpbicsXG4gICAgICB7IHdvcmtmbG93UnVuSWQ6IHJ1bklkLCBzdGVwSWQ6IGNvcnJlbGF0aW9uSWQgfVxuICAgICk7XG4gICAgdHJ5IHtcbiAgICAgIGF3YWl0IGV4aXN0aW5nO1xuICAgIH0gY2F0Y2gge1xuICAgICAgLy8gVGhlIHdpbm5lciBmYWlsZWQgKHR5cGljYWxseSBhIHRyYW5zaWVudCB3b3JsZCBlcnJvcikuIEl0cyBvd24gcXVldWVcbiAgICAgIC8vIG1lc3NhZ2UgcmVkZWxpdmVycyBhbmQgcmV0cmllczsgdGhpcyBsb3NlciBzdGlsbCBza2lwcy5cbiAgICB9XG4gICAgcmV0dXJuIHsgdHlwZTogJ3NraXBwZWQnIH07XG4gIH1cblxuICBjb25zdCBwcm9taXNlID0gZXhlY3V0ZSgpO1xuICBzaW5nbGVGbGlnaHQuaW5GbGlnaHQuc2V0KGtleSwgcHJvbWlzZSk7XG4gIHRyeSB7XG4gICAgcmV0dXJuIGF3YWl0IHByb21pc2U7XG4gIH0gZmluYWxseSB7XG4gICAgc2luZ2xlRmxpZ2h0LmluRmxpZ2h0LmRlbGV0ZShrZXkpO1xuICB9XG59XG4iXX0=
@@ -1,6 +1,7 @@
1
1
  import type { Span } from '@opentelemetry/api';
2
2
  import { type SerializedData, type TraceCarrier, type ValidQueueName, type WorkflowRun, type World } from '@workflow/world';
3
3
  import type { StepInvocationQueueItem, WorkflowSuspension } from '../global.js';
4
+ import { type GuestCodeExecution } from '../serialization/hardened.js';
4
5
  import { type LoadedEventLog } from './helpers.js';
5
6
  import { ReplayRecoveryReporter } from './replay-recovery-reporter.js';
6
7
  import type { PreclaimedInlineStart } from './step-executor.js';
@@ -13,7 +14,7 @@ export interface SuspensionHandlerParams {
13
14
  /**
14
15
  * The runtime's loaded event log. Every event creation this suspension makes
15
16
  * names the position it was derived from, so a backend that has recorded
16
- * events the replay did not see can report them back on the write or, if
17
+ * events the replay did not see can report them back on the write, or, if
17
18
  * it would rather refuse than report, reject it with a 412. A rejection is
18
19
  * not retried here: the event's correlation id was minted by *this* replay's
19
20
  * seeded sequence, so re-committing it against a corrected log would persist
@@ -35,14 +36,14 @@ export interface SuspensionHandlerParams {
35
36
  replayRecoveryReporter?: ReplayRecoveryReporter;
36
37
  /**
37
38
  * Resilient step dispatch: when provided (and the per-step eligibility gates
38
- * pass see the step ops below), each newly created non-inline step's
39
+ * pass, see the step ops below), each newly created non-inline step's
39
40
  * `step_created` write is parallelized with its step-execution queue
40
41
  * publish, and the queue message carries the serialized step input
41
42
  * (`stepInput`) so the consumer can idempotently re-ensure the event if the
42
43
  * direct write failed transiently. Steps queued this way are reported in
43
44
  * {@link SuspensionHandlerResult.queuedStepCorrelationIds} so the caller
44
45
  * skips them in its own dispatch pass. Omitted by callers that must not
45
- * queue (terminal drain, tests) creates then behave exactly as before.
46
+ * queue (terminal drain, tests); creates then behave exactly as before.
46
47
  */
47
48
  stepDispatch?: {
48
49
  /** The unified workflow queue this run's step messages are published to. */
@@ -57,9 +58,9 @@ export interface SuspensionHandlerParams {
57
58
  * Inline step ownership: the queue message ID of the invocation this
58
59
  * suspension runs in (the queue handler's meta). When present AND the
59
60
  * batched fan-out engages, the lazy-inline steps' deferred writes are
60
- * folded into the batch as `step_created` + `step_started` pairs the
61
+ * folded into the batch as `step_created` + `step_started` pairs (the
61
62
  * 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
+ * replaces), pre-claiming the steps the caller is about to run inline. See
63
64
  * {@link SuspensionHandlerResult.inlineClaims}. Callers that never
64
65
  * inline-execute (terminal drain) omit it, keeping their lazy steps on the
65
66
  * plain deferred path.
@@ -69,8 +70,8 @@ export interface SuspensionHandlerParams {
69
70
  * Lets the batched fan-out return before every chunk has committed: only
70
71
  * the chunk carrying the pre-claimed inline pairs gates the handler's
71
72
  * 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
73
+ * trailing chunks' commits (and every chunk's in-flush step-message
74
+ * publishes) ride {@link SuspensionHandlerResult.deferredBatchWork}. A
74
75
  * caller that opts in MUST await that promise before acking its delivery:
75
76
  * the durability contract ("every create durable before ack") moves from
76
77
  * the handler's return to that join, and nothing else re-drives a lost
@@ -90,16 +91,28 @@ export interface SuspensionHandlerResult {
90
91
  * Correlation IDs for which this suspension call actually wrote the
91
92
  * step_created event (as opposed to catching EntityConflictError because
92
93
  * a concurrent handler wrote it first). Only the handler that wrote the
93
- * step_created event should queue / inline-execute the step this
94
+ * step_created event should queue / inline-execute the step; this
94
95
  * guarantees a single owner per step, even when multiple handlers race
95
96
  * into the same batch boundary.
96
97
  */
97
98
  createdStepCorrelationIds: Set<string>;
99
+ /**
100
+ * Correlation IDs of steps whose arguments failed to serialize. Each was
101
+ * finalized here as `step_created` (with a placeholder input; the real
102
+ * input is precisely what refused to serialize) followed by `step_failed`
103
+ * carrying the SerializationError, so the next replay rejects the step's
104
+ * promise and a try/catch around the step call observes the error,
105
+ * exactly like a step-body failure. No step-execution message is
106
+ * dispatched for these, so the caller MUST force an in-process replay:
107
+ * when the failed step was the only pending work, nothing else will ever
108
+ * re-invoke the run to observe the terminal event.
109
+ */
110
+ failedStepCorrelationIds: Set<string>;
98
111
  /**
99
112
  * Correlation IDs of steps this suspension call already published
100
113
  * step-execution queue messages for, via resilient step dispatch (the
101
114
  * `step_created` write parallelized with a `stepInput`-carrying queue
102
- * publish). The caller MUST NOT dispatch these again the message is
115
+ * publish). The caller MUST NOT dispatch these again: the message is
103
116
  * already out (a duplicate would be deduped by its idempotency key, but
104
117
  * costs a wasted round-trip). Empty when {@link SuspensionHandlerParams.stepDispatch}
105
118
  * was not provided or no step was eligible.
@@ -134,12 +147,12 @@ export interface SuspensionHandlerResult {
134
147
  * Pre-claimed inline starts, by correlation id: the per-step verdicts of
135
148
  * the `step_created` + `step_started` pairs the batched fan-out committed
136
149
  * for the lazy-inline steps. A step with an entry here is passed to
137
- * `executeStep` as `preclaimedStart` INSTEAD of `lazyStepInput` its
150
+ * `executeStep` as `preclaimedStart` INSTEAD of `lazyStepInput`: its
138
151
  * input already rode the pair, and the claim is settled: `owned: true`
139
152
  * carries the started attempt-1 entity (input re-attached) so the body
140
153
  * runs straight off the batch commit with no start write of its own;
141
154
  * `owned: false` lost the pair's atomic create-claim to a concurrent
142
- * writer, and executeStep returns `skipped` without running the body
155
+ * writer, and executeStep returns `skipped` without running the body,
143
156
  * the same outcome as losing the lazy claim. Empty whenever the fold did
144
157
  * not engage (batching off, no `ownerMessageId`, or the lone-inline case,
145
158
  * which keeps the optimistic lazy path and its claim/body overlap).
@@ -147,20 +160,20 @@ export interface SuspensionHandlerResult {
147
160
  * Crash window: the pair commits before the caller runs the body, so a
148
161
  * crash between them leaves a started step stamped with this message's
149
162
  * ID. Redelivery of the same message re-executes it via the owned-recovery
150
- * path the exact machinery the lazy claim's crash window already uses.
163
+ * path, the exact machinery the lazy claim's crash window already uses.
151
164
  */
152
165
  inlineClaims: Map<string, PreclaimedInlineStart>;
153
166
  /**
154
167
  * The highest slot the batched fan-out committed, when it ran. The batch's
155
168
  * own events are not in the caller's loaded log (the next reload picks
156
169
  * them up), so the caller folds this ceiling into the slot snapshot it
157
- * hands the inline executions otherwise every inline terminal write
170
+ * hands the inline executions; otherwise every inline terminal write
158
171
  * would name a pre-batch position and be answered with a skipped-slot
159
172
  * report echoing the events this suspension just wrote. Under
160
173
  * {@link SuspensionHandlerParams.allowDeferredBatchWork} this covers the
161
174
  * chunks that had committed by the handler's return (always the pair
162
175
  * chunk); a trailing chunk that commits later is echoed back on the
163
- * terminal writes like any foreign event reports the executor reads for
176
+ * terminal writes like any foreign event: reports the executor reads for
164
177
  * position and discards.
165
178
  *
166
179
  * So the echo is only fully suppressed for a SINGLE-chunk fold. On a
@@ -168,7 +181,7 @@ export interface SuspensionHandlerResult {
168
181
  * chunks are still in flight, and an inline terminal write issued in that
169
182
  * window still names a position below them and still draws a report for
170
183
  * their events. Bounded (trailing chunks only, large fan-outs only) and
171
- * self-correcting on the next reload recorded so a report seen there
184
+ * self-correcting on the next reload, and recorded so a report seen there
172
185
  * reads as expected rather than as a bug.
173
186
  */
174
187
  batchCommittedSlotCeiling?: number;
@@ -178,7 +191,7 @@ export interface SuspensionHandlerResult {
178
191
  * trailing work exists: the commits of every chunk except the pair chunk,
179
192
  * plus every chunk's step-message publishes (each chained on ITS OWN
180
193
  * chunk's commit, so publish-after-create holds per step). The caller
181
- * MUST await it before acking a rejection here is a failed suspension
194
+ * MUST await it before acking: a rejection here is a failed suspension
182
195
  * write and fails the delivery exactly as it would have at the handler's
183
196
  * return. Steps whose messages this work publishes are already in
184
197
  * {@link queuedStepCorrelationIds} at return time.
@@ -216,17 +229,18 @@ export interface SuspensionHandlerResult {
216
229
  * durably creating the user's hooks doesn't count as runtime overhead.
217
230
  */
218
231
  hookCreationMs: number;
219
- /**
220
- * Whether serializing this suspension's new step inputs was passive (did
221
- * not execute workflow-owned code such as getters, proxy traps, or custom
222
- * serializers). `false` means the retained VM may have diverged from what
223
- * a cold replay would compute, so the caller must demote to replay.
224
- */
225
- retainedStepInputsSafe: boolean;
232
+ /** Exact number of workflow-code executions observed during serialization. */
233
+ serializationBlockerCount: number;
234
+ /** Bounded sample used only for retention diagnostics. */
235
+ serializationBlockers: SuspensionSerializationBlocker[];
236
+ }
237
+ export interface SuspensionSerializationBlocker extends GuestCodeExecution {
238
+ source: 'step_input' | 'hook_metadata' | 'hook_abort';
239
+ correlationId: string;
226
240
  }
227
241
  /**
228
242
  * Handles a workflow suspension by processing all pending operations (hooks, steps, waits).
229
- * Creates events for all operations but does NOT queue step messages returns the pending
243
+ * Creates events for all operations but does NOT queue step messages; returns the pending
230
244
  * steps so the caller can decide which to execute inline vs queue to background.
231
245
  *
232
246
  * Processing order:
@@ -1 +1 @@
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;AAS/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;AActB,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,CAAC;AAEhE,MAAM,WAAW,uBAAuB;IACtC,UAAU,EAAE,kBAAkB,CAAC;IAC/B,KAAK,EAAE,KAAK,CAAC;IACb,GAAG,EAAE,WAAW,CAAC;IACjB,IAAI,CAAC,EAAE,IAAI,CAAC;IACZ,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;;;;;;;;;OASG;IACH,QAAQ,CAAC,EAAE,cAAc,CAAC;IAC1B;;;;;;;;OAQG;IACH,eAAe,CAAC,EAAE,OAAO,CAAC,OAAO,CAAC,CAAC;IACnC,8EAA8E;IAC9E,sBAAsB,CAAC,EAAE,sBAAsB,CAAC;IAChD;;;;;;;;;;OAUG;IACH,YAAY,CAAC,EAAE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AO,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,EACZ,cAAc,EACd,sBAAsB,GACvB,EAAE,uBAAuB,GAAG,OAAO,CAAC,uBAAuB,CAAC,CAoxC5D"}
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;AAEtB,OAAO,EAEL,KAAK,kBAAkB,EAExB,MAAM,8BAA8B,CAAC;AAetC,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,CAAC;AAGhE,MAAM,WAAW,uBAAuB;IACtC,UAAU,EAAE,kBAAkB,CAAC;IAC/B,KAAK,EAAE,KAAK,CAAC;IACb,GAAG,EAAE,WAAW,CAAC;IACjB,IAAI,CAAC,EAAE,IAAI,CAAC;IACZ,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;;;;;;;;;OASG;IACH,QAAQ,CAAC,EAAE,cAAc,CAAC;IAC1B;;;;;;;;OAQG;IACH,eAAe,CAAC,EAAE,OAAO,CAAC,OA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