@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,9 +1,9 @@
1
1
  /**
2
- * QuickJS VM integration with the Workflow DevKit.
2
+ * QuickJS WebAssembly (WASM) VM integration with the Workflow DevKit.
3
3
  *
4
4
  * This module provides the entry point for running workflows in the
5
- * QuickJS WASM VM engine instead of the `node:vm` engine. Both engines
6
- * implement the same event-replay execution model every invocation:
5
+ * QuickJS VM engine instead of the `node:vm` engine. Both engines
6
+ * implement the same event-replay execution model, where every invocation:
7
7
  *
8
8
  * 1. Loads the full event log for the run
9
9
  * 2. Runs the workflow function from the top in a fresh QuickJS VM,
@@ -16,7 +16,7 @@ import type { Span } from '@opentelemetry/api';
16
16
  import { type Event, type RunInput, type WorkflowRun } from '@workflow/world';
17
17
  /**
18
18
  * Returns true when the supplied preloaded events indicate this is the
19
- * first workflow handler invocation for the run i.e. the log contains
19
+ * first workflow handler invocation for the run, i.e. the log contains
20
20
  * nothing beyond `run_created` / `run_started`. In that case the
21
21
  * preloaded events ARE the complete event log and the `events.list`
22
22
  * round-trips can be skipped entirely.
@@ -38,12 +38,12 @@ export declare function isFirstInvocation(preloadedEvents: readonly Event[] | un
38
38
  * This replaces the `node:vm` replay path (runWorkflow + EventsConsumer)
39
39
  * with a QuickJS VM invocation that performs the same full event replay.
40
40
  *
41
- * KNOWN GAP slot snapshot: unlike the node:vm path, no event write in
41
+ * KNOWN GAP (slot snapshot): unlike the node:vm path, no event write in
42
42
  * this file carries {@link CreateEventParams.eventCount}, so a World never
43
43
  * learns which events the writer had not seen and never reports them back.
44
44
  * The engine currently relies on per-(runId, correlationId) event
45
45
  * uniqueness (EntityConflictError dedup) alone. This is a deliberate
46
- * simplification while the engine is experimental wiring the snapshot is
46
+ * simplification while the engine is experimental: wiring the snapshot is
47
47
  * tracked follow-up work; anyone adding new write paths here should not
48
48
  * assume parity with the node engine on this axis.
49
49
  */
@@ -54,8 +54,8 @@ export declare function runWorkflowWithQuickJS(params: {
54
54
  /**
55
55
  * Events returned inline by `events.create('run_started', ...)` or by
56
56
  * the lazy hook fast path's `hook_received` preload. When they indicate
57
- * a first invocation or when `preloadedEventsComplete` attests they
58
- * are the complete log they are used as the event log instead of
57
+ * a first invocation, or when `preloadedEventsComplete` attests they
58
+ * are the complete log, they are used as the event log instead of
59
59
  * fetching via `events.list`, matching the node:vm engine's fast path.
60
60
  */
61
61
  preloadedEvents?: Event[];
@@ -101,11 +101,13 @@ export declare function runWorkflowWithQuickJS(params: {
101
101
  * the in-flight body instead of requeueing the step.
102
102
  */
103
103
  ownerMessageId?: string;
104
+ /** Request ID of the queue invocation, when the queue provides one. */
105
+ requestId?: string;
104
106
  /**
105
107
  * Queue namespace resolved at route registration (runtime.ts). Must be
106
108
  * threaded into every message publish: the builders bake the namespace
107
- * into generated routes, so consumers listen on `__<ns>_wkf_workflow_*`
108
- * a publish without it lands on `__wkf_workflow_*` and is never
109
+ * into generated routes, so consumers listen on `__<ns>_wkf_workflow_*`.
110
+ * A publish without it lands on `__wkf_workflow_*` and is never
109
111
  * picked up.
110
112
  */
111
113
  namespace?: string;
@@ -117,6 +119,17 @@ export declare function runWorkflowWithQuickJS(params: {
117
119
  * invocations to each other and fragment the run view on async queues.
118
120
  */
119
121
  nextTraceCarrier?: () => Promise<Record<string, string>>;
122
+ /**
123
+ * The wait this invocation is the delayed continuation for, if it is one
124
+ * (`WorkflowInvokePayload.waitContinuation`). Read only to decide the next
125
+ * continuation's idempotency key: a continuation that finds its own wait
126
+ * still pending has spent its key, so the re-arm has to advance the attempt
127
+ * or the world's dedupe window drops it and the wait loses its only timer.
128
+ */
129
+ waitContinuation?: {
130
+ correlationId: string;
131
+ attempt: number;
132
+ };
120
133
  }): Promise<{
121
134
  timeoutSeconds?: number;
122
135
  } | void>;
@@ -1 +1 @@
1
- {"version":3,"file":"quickjs-entrypoint.d.ts","sourceRoot":"","sources":["../../src/runtime/quickjs-entrypoint.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,oBAAoB,CAAC;AAS/C,OAAO,EACL,KAAK,KAAK,EAEV,KAAK,QAAQ,EAGb,KAAK,WAAW,EACjB,MAAM,iBAAiB,CAAC;AAiDzB;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,iBAAiB,CAC/B,eAAe,EAAE,SAAS,KAAK,EAAE,GAAG,SAAS,GAC5C,OAAO,CAOT;AAsjBD;;;;;;;;;;;;;;GAcG;AACH,wBAAsB,sBAAsB,CAAC,MAAM,EAAE;IACnD,YAAY,EAAE,MAAM,CAAC;IACrB,YAAY,EAAE,MAAM,CAAC;IACrB,WAAW,EAAE,WAAW,CAAC;IACzB;;;;;;OAMG;IACH,eAAe,CAAC,EAAE,KAAK,EAAE,CAAC;IAC1B;;;;;;OAMG;IACH,uBAAuB,CAAC,EAAE,OAAO,CAAC;IAClC;;;;OAIG;IACH,QAAQ,CAAC,EAAE,Q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