@workflow/core 5.4.0 → 5.6.0

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 (390) hide show
  1. package/dist/attribute-changes.js +1 -1
  2. package/dist/capabilities.js +1 -1
  3. package/dist/capture-stack.js +1 -1
  4. package/dist/class-serialization.js +1 -1
  5. package/dist/classify-error.d.ts +1 -1
  6. package/dist/classify-error.js +10 -5
  7. package/dist/context-errors.js +1 -1
  8. package/dist/context-violation-error.js +1 -1
  9. package/dist/create-hook.js +1 -1
  10. package/dist/define-hook.js +1 -1
  11. package/dist/describe-error.js +61 -31
  12. package/dist/encryption.js +1 -1
  13. package/dist/events-consumer.js +1 -1
  14. package/dist/flushable-stream.js +1 -1
  15. package/dist/global.js +1 -1
  16. package/dist/index.js +1 -1
  17. package/dist/log-format.js +1 -1
  18. package/dist/logger.js +1 -1
  19. package/dist/private.js +11 -49
  20. package/dist/replay-divergence.js +1 -1
  21. package/dist/replay-payload-cache.d.ts +3 -0
  22. package/dist/replay-payload-cache.js +4 -1
  23. package/dist/runtime/after-terminal-write.js +1 -1
  24. package/dist/runtime/child-run-completion-notify.js +1 -1
  25. package/dist/runtime/child-run-completion.d.ts +3 -2
  26. package/dist/runtime/child-run-completion.js +109 -37
  27. package/dist/runtime/compute-instance.d.ts +6 -3
  28. package/dist/runtime/compute-instance.js +14 -4
  29. package/dist/runtime/constants.d.ts +3 -0
  30. package/dist/runtime/constants.js +4 -1
  31. package/dist/runtime/delivery.js +1 -1
  32. package/dist/runtime/deployment-guard.js +1 -1
  33. package/dist/runtime/dynamic-workflow.js +1 -1
  34. package/dist/runtime/event-limit-warning.js +1 -1
  35. package/dist/runtime/get-port-lazy.js +1 -1
  36. package/dist/runtime/get-world-lazy.js +1 -1
  37. package/dist/runtime/helpers.d.ts +4 -19
  38. package/dist/runtime/helpers.js +6 -21
  39. package/dist/runtime/hook-creation.js +1 -1
  40. package/dist/runtime/hook-wake.js +1 -1
  41. package/dist/runtime/invocations.d.ts +1 -1
  42. package/dist/runtime/invocations.js +1 -1
  43. package/dist/runtime/lifecycle-hooks.js +1 -1
  44. package/dist/runtime/out-of-band-observation.d.ts +25 -4
  45. package/dist/runtime/out-of-band-observation.js +18 -9
  46. package/dist/runtime/queue-auth.d.ts +53 -0
  47. package/dist/runtime/queue-auth.js +149 -0
  48. package/dist/runtime/quickjs-assets.generated.d.ts +1 -1
  49. package/dist/runtime/quickjs-assets.generated.js +3 -3
  50. package/dist/runtime/quickjs-delivery-shared.js +1 -1
  51. package/dist/runtime/quickjs-log-view.d.ts +42 -0
  52. package/dist/runtime/quickjs-log-view.js +90 -1
  53. package/dist/runtime/quickjs-pending-ops.js +1 -1
  54. package/dist/runtime/quickjs-precompiled.d.ts +31 -0
  55. package/dist/runtime/quickjs-precompiled.js +17 -0
  56. package/dist/runtime/quickjs-runtime.d.ts +32 -0
  57. package/dist/runtime/quickjs-runtime.js +146 -69
  58. package/dist/runtime/quickjs-serde.js +48 -9
  59. package/dist/runtime/quickjs-snapshot-codec.js +1 -1
  60. package/dist/runtime/replay-budget.js +1 -1
  61. package/dist/runtime/replay-recovery-reporter.js +1 -1
  62. package/dist/runtime/resume-hook.js +10 -1
  63. package/dist/runtime/resume-latency.js +1 -1
  64. package/dist/runtime/run-id-time.js +1 -1
  65. package/dist/runtime/run-spec-routing.js +1 -1
  66. package/dist/runtime/run-spec-version.js +1 -1
  67. package/dist/runtime/run.d.ts +3 -7
  68. package/dist/runtime/run.js +7 -17
  69. package/dist/runtime/runs.d.ts +2 -1
  70. package/dist/runtime/runs.js +3 -2
  71. package/dist/runtime/spec8/constants.d.ts +1 -49
  72. package/dist/runtime/spec8/constants.js +2 -65
  73. package/dist/runtime/spec8/count-step-started-events.js +1 -1
  74. package/dist/runtime/spec8/delivery.js +83 -47
  75. package/dist/runtime/spec8/inline-steps-in-flight.d.ts +5 -5
  76. package/dist/runtime/spec8/inline-steps-in-flight.js +6 -8
  77. package/dist/runtime/spec8/open-hook-wait-state.js +1 -1
  78. package/dist/runtime/spec8/quickjs-entrypoint.js +7 -3
  79. package/dist/runtime/spec8/step-executor.d.ts +10 -1
  80. package/dist/runtime/spec8/step-executor.js +19 -5
  81. package/dist/runtime/spec8/step-ownership.d.ts +2 -1
  82. package/dist/runtime/spec8/step-ownership.js +3 -2
  83. package/dist/runtime/spec8/step-single-flight.d.ts +40 -2
  84. package/dist/runtime/spec8/step-single-flight.js +20 -4
  85. package/dist/runtime/spec8/suspension-handler.d.ts +1 -1
  86. package/dist/runtime/spec8/suspension-handler.js +7 -7
  87. package/dist/runtime/spec9/consume-after-commit.d.ts +5 -1
  88. package/dist/runtime/spec9/consume-after-commit.js +8 -3
  89. package/dist/runtime/spec9/consumed-position.js +1 -1
  90. package/dist/runtime/spec9/creator-rules.js +1 -1
  91. package/dist/runtime/spec9/deadline.js +1 -1
  92. package/dist/runtime/spec9/delivery.js +288 -110
  93. package/dist/runtime/spec9/fence-refusals.js +1 -1
  94. package/dist/runtime/spec9/in-band-writer.d.ts +10 -0
  95. package/dist/runtime/spec9/in-band-writer.js +21 -3
  96. package/dist/runtime/spec9/live-feed.d.ts +55 -9
  97. package/dist/runtime/spec9/live-feed.js +90 -13
  98. package/dist/runtime/spec9/log-index.d.ts +74 -0
  99. package/dist/runtime/spec9/log-index.js +199 -0
  100. package/dist/runtime/spec9/log-state.d.ts +33 -8
  101. package/dist/runtime/spec9/log-state.js +43 -14
  102. package/dist/runtime/spec9/quickjs-entrypoint.d.ts +20 -4
  103. package/dist/runtime/spec9/quickjs-entrypoint.js +830 -47
  104. package/dist/runtime/spec9/read-deadline.js +1 -1
  105. package/dist/runtime/spec9/run-ahead.d.ts +11 -2
  106. package/dist/runtime/spec9/run-ahead.js +3 -2
  107. package/dist/runtime/spec9/step-delivery.d.ts +40 -1
  108. package/dist/runtime/spec9/step-delivery.js +52 -2
  109. package/dist/runtime/spec9/step-executor.d.ts +27 -2
  110. package/dist/runtime/spec9/step-executor.js +41 -9
  111. package/dist/runtime/spec9/step-handler.js +46 -4
  112. package/dist/runtime/spec9/step-message.js +1 -1
  113. package/dist/runtime/spec9/step-retention.js +1 -1
  114. package/dist/runtime/spec9/step-single-flight.js +1 -1
  115. package/dist/runtime/spec9/step-wait-creation.js +4 -4
  116. package/dist/runtime/spec9/suspension-handler.js +1 -1
  117. package/dist/runtime/spec9/wait-timer.js +1 -1
  118. package/dist/runtime/start-hook-binding.d.ts +7 -6
  119. package/dist/runtime/start-hook-binding.js +13 -10
  120. package/dist/runtime/start-hook-delivery.js +1 -1
  121. package/dist/runtime/start-hook-holder.js +1 -1
  122. package/dist/runtime/start.d.ts +2 -2
  123. package/dist/runtime/start.js +5 -3
  124. package/dist/runtime/step-latency.js +2 -2
  125. package/dist/runtime/step-single-flight.d.ts +10 -1
  126. package/dist/runtime/step-single-flight.js +14 -7
  127. package/dist/runtime/step-streams.js +1 -1
  128. package/dist/runtime/suspension-hooks.js +1 -1
  129. package/dist/runtime/unserializable-step.js +1 -1
  130. package/dist/runtime/vm-mode.js +1 -1
  131. package/dist/runtime/wait-continuation.js +1 -1
  132. package/dist/runtime/wait-until.d.ts +8 -0
  133. package/dist/runtime/wait-until.js +16 -1
  134. package/dist/runtime/world-compatibility.d.ts +4 -4
  135. package/dist/runtime/world-compatibility.js +5 -5
  136. package/dist/runtime/world-init.js +1 -1
  137. package/dist/runtime/world.js +1 -1
  138. package/dist/runtime.d.ts +2 -0
  139. package/dist/runtime.js +51 -17
  140. package/dist/schemas.js +1 -1
  141. package/dist/sealed-box.js +1 -1
  142. package/dist/seeded-nanoid.js +1 -1
  143. package/dist/serialization/abort-stream.js +1 -1
  144. package/dist/serialization/client.js +1 -1
  145. package/dist/serialization/codec-devalue-vm.js +1 -1
  146. package/dist/serialization/codec-devalue.js +26 -1
  147. package/dist/serialization/codec.d.ts +15 -0
  148. package/dist/serialization/codec.js +1 -1
  149. package/dist/serialization/compression.js +1 -1
  150. package/dist/serialization/encryption.js +1 -1
  151. package/dist/serialization/errors.js +1 -1
  152. package/dist/serialization/format.js +1 -1
  153. package/dist/serialization/hardened.js +1 -1
  154. package/dist/serialization/index.js +1 -1
  155. package/dist/serialization/reducers/class-vm.js +1 -1
  156. package/dist/serialization/reducers/class.js +1 -1
  157. package/dist/serialization/reducers/common-vm.js +1 -1
  158. package/dist/serialization/reducers/common.js +1 -1
  159. package/dist/serialization/reducers/step-function-vm.js +1 -1
  160. package/dist/serialization/reducers/step-function.js +1 -1
  161. package/dist/serialization/state-recovery.d.ts +21 -0
  162. package/dist/serialization/state-recovery.js +104 -0
  163. package/dist/serialization/state-refs.d.ts +229 -0
  164. package/dist/serialization/state-refs.js +981 -0
  165. package/dist/serialization/step.js +22 -4
  166. package/dist/serialization/types.js +1 -1
  167. package/dist/serialization/workflow-vm.js +1 -1
  168. package/dist/serialization/workflow.js +1 -1
  169. package/dist/serialization-format.d.ts +8 -15
  170. package/dist/serialization-format.js +41 -4
  171. package/dist/serialization.d.ts +5 -2
  172. package/dist/serialization.js +108 -13
  173. package/dist/set-attributes.js +3 -1
  174. package/dist/set-error-stack.js +1 -1
  175. package/dist/sleep.js +1 -1
  176. package/dist/source-map.js +1 -1
  177. package/dist/state-resolver.d.ts +44 -0
  178. package/dist/state-resolver.js +40 -0
  179. package/dist/state.d.ts +56 -0
  180. package/dist/state.js +227 -0
  181. package/dist/step/context-storage.js +1 -1
  182. package/dist/step/get-closure-vars.js +1 -1
  183. package/dist/step/get-step-metadata.d.ts +11 -0
  184. package/dist/step/get-step-metadata.js +1 -1
  185. package/dist/step/get-workflow-metadata.js +1 -1
  186. package/dist/step/writable-stream.js +1 -1
  187. package/dist/step.js +1 -1
  188. package/dist/symbols.js +1 -1
  189. package/dist/telemetry/semantic-conventions.d.ts +10 -2
  190. package/dist/telemetry/semantic-conventions.js +9 -3
  191. package/dist/telemetry.d.ts +12 -0
  192. package/dist/telemetry.js +27 -1
  193. package/dist/test-support/append-only-world.d.ts +23 -2
  194. package/dist/test-support/append-only-world.js +34 -8
  195. package/dist/test-support/fence-snapshot.js +1 -1
  196. package/dist/test-support/load-events.js +1 -1
  197. package/dist/test-support/orchestrator-context.js +1 -1
  198. package/dist/test-support/orchestrator-harness.d.ts +2 -0
  199. package/dist/test-support/orchestrator-harness.js +1 -1
  200. package/dist/types.js +1 -1
  201. package/dist/util.js +1 -1
  202. package/dist/version.d.ts +1 -1
  203. package/dist/version.js +2 -2
  204. package/dist/vm/index.js +1 -1
  205. package/dist/vm/script-cache.js +1 -1
  206. package/dist/vm/uint8array-base64.js +1 -1
  207. package/dist/vm/uuid.js +1 -1
  208. package/dist/workflow/abort-controller.js +1 -1
  209. package/dist/workflow/attribute-dispatcher.js +1 -1
  210. package/dist/workflow/create-hook.js +1 -1
  211. package/dist/workflow/define-hook.js +1 -1
  212. package/dist/workflow/get-workflow-metadata.js +1 -1
  213. package/dist/workflow/hook.d.ts +6 -0
  214. package/dist/workflow/hook.js +20 -1
  215. package/dist/workflow/index.js +1 -1
  216. package/dist/workflow/set-attributes.js +1 -1
  217. package/dist/workflow/sleep.js +1 -1
  218. package/dist/workflow/world-init-stub.js +1 -1
  219. package/dist/workflow/writable-stream.js +1 -1
  220. package/dist/workflow.js +11 -3
  221. package/docs/api-reference/create-hook.mdx +2 -2
  222. package/docs/api-reference/get-step-metadata.mdx +19 -0
  223. package/docs/foundations/errors-and-retries.mdx +5 -2
  224. package/docs/foundations/serialization.mdx +80 -0
  225. package/docs/how-it-works/event-sourcing.mdx +5 -4
  226. package/docs/how-it-works/framework-integrations.mdx +2 -2
  227. package/package.json +21 -21
  228. package/dist/attribute-changes.d.ts.map +0 -1
  229. package/dist/capabilities.d.ts.map +0 -1
  230. package/dist/capture-stack.d.ts.map +0 -1
  231. package/dist/class-serialization.d.ts.map +0 -1
  232. package/dist/classify-error.d.ts.map +0 -1
  233. package/dist/context-errors.d.ts.map +0 -1
  234. package/dist/context-violation-error.d.ts.map +0 -1
  235. package/dist/create-hook.d.ts.map +0 -1
  236. package/dist/define-hook.d.ts.map +0 -1
  237. package/dist/describe-error.d.ts.map +0 -1
  238. package/dist/encryption.d.ts.map +0 -1
  239. package/dist/events-consumer.d.ts.map +0 -1
  240. package/dist/flushable-stream.d.ts.map +0 -1
  241. package/dist/global.d.ts.map +0 -1
  242. package/dist/index.d.ts.map +0 -1
  243. package/dist/log-format.d.ts.map +0 -1
  244. package/dist/logger.d.ts.map +0 -1
  245. package/dist/private.d.ts.map +0 -1
  246. package/dist/replay-divergence.d.ts.map +0 -1
  247. package/dist/replay-payload-cache.d.ts.map +0 -1
  248. package/dist/runtime/after-terminal-write.d.ts.map +0 -1
  249. package/dist/runtime/child-run-completion-notify.d.ts.map +0 -1
  250. package/dist/runtime/child-run-completion.d.ts.map +0 -1
  251. package/dist/runtime/compute-instance.d.ts.map +0 -1
  252. package/dist/runtime/constants.d.ts.map +0 -1
  253. package/dist/runtime/delivery.d.ts.map +0 -1
  254. package/dist/runtime/deployment-guard.d.ts.map +0 -1
  255. package/dist/runtime/dynamic-workflow.d.ts.map +0 -1
  256. package/dist/runtime/event-limit-warning.d.ts.map +0 -1
  257. package/dist/runtime/get-port-lazy.d.ts.map +0 -1
  258. package/dist/runtime/get-world-lazy.d.ts.map +0 -1
  259. package/dist/runtime/helpers.d.ts.map +0 -1
  260. package/dist/runtime/hook-creation.d.ts.map +0 -1
  261. package/dist/runtime/hook-wake.d.ts.map +0 -1
  262. package/dist/runtime/invocations.d.ts.map +0 -1
  263. package/dist/runtime/lifecycle-hooks.d.ts.map +0 -1
  264. package/dist/runtime/out-of-band-observation.d.ts.map +0 -1
  265. package/dist/runtime/quickjs-assets.generated.d.ts.map +0 -1
  266. package/dist/runtime/quickjs-delivery-shared.d.ts.map +0 -1
  267. package/dist/runtime/quickjs-log-view.d.ts.map +0 -1
  268. package/dist/runtime/quickjs-pending-ops.d.ts.map +0 -1
  269. package/dist/runtime/quickjs-runtime.d.ts.map +0 -1
  270. package/dist/runtime/quickjs-serde.d.ts.map +0 -1
  271. package/dist/runtime/quickjs-snapshot-codec.d.ts.map +0 -1
  272. package/dist/runtime/replay-budget.d.ts.map +0 -1
  273. package/dist/runtime/replay-recovery-reporter.d.ts.map +0 -1
  274. package/dist/runtime/resume-hook.d.ts.map +0 -1
  275. package/dist/runtime/resume-latency.d.ts.map +0 -1
  276. package/dist/runtime/run-id-time.d.ts.map +0 -1
  277. package/dist/runtime/run-spec-routing.d.ts.map +0 -1
  278. package/dist/runtime/run-spec-version.d.ts.map +0 -1
  279. package/dist/runtime/run.d.ts.map +0 -1
  280. package/dist/runtime/runs.d.ts.map +0 -1
  281. package/dist/runtime/spec8/constants.d.ts.map +0 -1
  282. package/dist/runtime/spec8/count-step-started-events.d.ts.map +0 -1
  283. package/dist/runtime/spec8/delivery.d.ts.map +0 -1
  284. package/dist/runtime/spec8/inline-steps-in-flight.d.ts.map +0 -1
  285. package/dist/runtime/spec8/open-hook-wait-state.d.ts.map +0 -1
  286. package/dist/runtime/spec8/quickjs-entrypoint.d.ts.map +0 -1
  287. package/dist/runtime/spec8/step-executor.d.ts.map +0 -1
  288. package/dist/runtime/spec8/step-ownership.d.ts.map +0 -1
  289. package/dist/runtime/spec8/step-single-flight.d.ts.map +0 -1
  290. package/dist/runtime/spec8/suspension-handler.d.ts.map +0 -1
  291. package/dist/runtime/spec9/consume-after-commit.d.ts.map +0 -1
  292. package/dist/runtime/spec9/consumed-position.d.ts.map +0 -1
  293. package/dist/runtime/spec9/creator-rules.d.ts.map +0 -1
  294. package/dist/runtime/spec9/deadline.d.ts.map +0 -1
  295. package/dist/runtime/spec9/delivery.d.ts.map +0 -1
  296. package/dist/runtime/spec9/fence-refusals.d.ts.map +0 -1
  297. package/dist/runtime/spec9/in-band-writer.d.ts.map +0 -1
  298. package/dist/runtime/spec9/live-feed.d.ts.map +0 -1
  299. package/dist/runtime/spec9/log-state.d.ts.map +0 -1
  300. package/dist/runtime/spec9/quickjs-entrypoint.d.ts.map +0 -1
  301. package/dist/runtime/spec9/read-deadline.d.ts.map +0 -1
  302. package/dist/runtime/spec9/run-ahead.d.ts.map +0 -1
  303. package/dist/runtime/spec9/step-delivery.d.ts.map +0 -1
  304. package/dist/runtime/spec9/step-executor.d.ts.map +0 -1
  305. package/dist/runtime/spec9/step-handler.d.ts.map +0 -1
  306. package/dist/runtime/spec9/step-message.d.ts.map +0 -1
  307. package/dist/runtime/spec9/step-retention.d.ts.map +0 -1
  308. package/dist/runtime/spec9/step-single-flight.d.ts.map +0 -1
  309. package/dist/runtime/spec9/step-wait-creation.d.ts.map +0 -1
  310. package/dist/runtime/spec9/suspension-handler.d.ts.map +0 -1
  311. package/dist/runtime/spec9/wait-timer.d.ts.map +0 -1
  312. package/dist/runtime/start-hook-binding.d.ts.map +0 -1
  313. package/dist/runtime/start-hook-delivery.d.ts.map +0 -1
  314. package/dist/runtime/start-hook-holder.d.ts.map +0 -1
  315. package/dist/runtime/start.d.ts.map +0 -1
  316. package/dist/runtime/step-latency.d.ts.map +0 -1
  317. package/dist/runtime/step-single-flight.d.ts.map +0 -1
  318. package/dist/runtime/step-streams.d.ts.map +0 -1
  319. package/dist/runtime/suspension-hooks.d.ts.map +0 -1
  320. package/dist/runtime/unserializable-step.d.ts.map +0 -1
  321. package/dist/runtime/vm-mode.d.ts.map +0 -1
  322. package/dist/runtime/wait-continuation.d.ts.map +0 -1
  323. package/dist/runtime/wait-until.d.ts.map +0 -1
  324. package/dist/runtime/world-compatibility.d.ts.map +0 -1
  325. package/dist/runtime/world-init.d.ts.map +0 -1
  326. package/dist/runtime/world.d.ts.map +0 -1
  327. package/dist/runtime.d.ts.map +0 -1
  328. package/dist/schemas.d.ts.map +0 -1
  329. package/dist/sealed-box.d.ts.map +0 -1
  330. package/dist/seeded-nanoid.d.ts.map +0 -1
  331. package/dist/serialization/abort-stream.d.ts.map +0 -1
  332. package/dist/serialization/client.d.ts.map +0 -1
  333. package/dist/serialization/codec-devalue-vm.d.ts.map +0 -1
  334. package/dist/serialization/codec-devalue.d.ts.map +0 -1
  335. package/dist/serialization/codec.d.ts.map +0 -1
  336. package/dist/serialization/compression.d.ts.map +0 -1
  337. package/dist/serialization/encryption.d.ts.map +0 -1
  338. package/dist/serialization/errors.d.ts.map +0 -1
  339. package/dist/serialization/format.d.ts.map +0 -1
  340. package/dist/serialization/hardened.d.ts.map +0 -1
  341. package/dist/serialization/index.d.ts.map +0 -1
  342. package/dist/serialization/reducers/class-vm.d.ts.map +0 -1
  343. package/dist/serialization/reducers/class.d.ts.map +0 -1
  344. package/dist/serialization/reducers/common-vm.d.ts.map +0 -1
  345. package/dist/serialization/reducers/common.d.ts.map +0 -1
  346. package/dist/serialization/reducers/step-function-vm.d.ts.map +0 -1
  347. package/dist/serialization/reducers/step-function.d.ts.map +0 -1
  348. package/dist/serialization/step.d.ts.map +0 -1
  349. package/dist/serialization/types.d.ts.map +0 -1
  350. package/dist/serialization/workflow-vm.d.ts.map +0 -1
  351. package/dist/serialization/workflow.d.ts.map +0 -1
  352. package/dist/serialization-format.d.ts.map +0 -1
  353. package/dist/serialization.d.ts.map +0 -1
  354. package/dist/set-attributes.d.ts.map +0 -1
  355. package/dist/set-error-stack.d.ts.map +0 -1
  356. package/dist/sleep.d.ts.map +0 -1
  357. package/dist/source-map.d.ts.map +0 -1
  358. package/dist/step/context-storage.d.ts.map +0 -1
  359. package/dist/step/get-closure-vars.d.ts.map +0 -1
  360. package/dist/step/get-step-metadata.d.ts.map +0 -1
  361. package/dist/step/get-workflow-metadata.d.ts.map +0 -1
  362. package/dist/step/writable-stream.d.ts.map +0 -1
  363. package/dist/step.d.ts.map +0 -1
  364. package/dist/symbols.d.ts.map +0 -1
  365. package/dist/telemetry/semantic-conventions.d.ts.map +0 -1
  366. package/dist/telemetry.d.ts.map +0 -1
  367. package/dist/test-support/append-only-world.d.ts.map +0 -1
  368. package/dist/test-support/fence-snapshot.d.ts.map +0 -1
  369. package/dist/test-support/load-events.d.ts.map +0 -1
  370. package/dist/test-support/orchestrator-context.d.ts.map +0 -1
  371. package/dist/test-support/orchestrator-harness.d.ts.map +0 -1
  372. package/dist/types.d.ts.map +0 -1
  373. package/dist/util.d.ts.map +0 -1
  374. package/dist/version.d.ts.map +0 -1
  375. package/dist/vm/index.d.ts.map +0 -1
  376. package/dist/vm/script-cache.d.ts.map +0 -1
  377. package/dist/vm/uint8array-base64.d.ts.map +0 -1
  378. package/dist/vm/uuid.d.ts.map +0 -1
  379. package/dist/workflow/abort-controller.d.ts.map +0 -1
  380. package/dist/workflow/attribute-dispatcher.d.ts.map +0 -1
  381. package/dist/workflow/create-hook.d.ts.map +0 -1
  382. package/dist/workflow/define-hook.d.ts.map +0 -1
  383. package/dist/workflow/get-workflow-metadata.d.ts.map +0 -1
  384. package/dist/workflow/hook.d.ts.map +0 -1
  385. package/dist/workflow/index.d.ts.map +0 -1
  386. package/dist/workflow/set-attributes.d.ts.map +0 -1
  387. package/dist/workflow/sleep.d.ts.map +0 -1
  388. package/dist/workflow/world-init-stub.d.ts.map +0 -1
  389. package/dist/workflow/writable-stream.d.ts.map +0 -1
  390. package/dist/workflow.d.ts.map +0 -1
@@ -1,7 +1,7 @@
1
1
  import type { StepExecutionResult } from './step-executor.js';
2
2
  /**
3
3
  * Single-flight for a step body. This is a required companion to inline step
4
- * ownership (see `isInlineOwnershipEnabled` in `./constants.ts`): the
4
+ * ownership (see `getInlineOwnershipLeaseSeconds` in `./constants.ts`): the
5
5
  * ownership lease is a *death proof* only on platforms with a bounded
6
6
  * invocation lifetime. On worlds without an invocation kill bound
7
7
  * (world-local's single process, self-hosted deployments) a delayed backstop
@@ -25,10 +25,48 @@ import type { StepExecutionResult } from './step-executor.js';
25
25
  * would leave the step created and never run. The loser runs its own attempt
26
26
  * instead, which its claim gates like any other.
27
27
  *
28
+ * The other exception is a winner's `retry` that was folded into the
29
+ * loser's own message: see `carryFoldedRetry`.
30
+ *
28
31
  * Cross-instance duplicates are what the ownership lease bounds on platforms
29
32
  * where it is a death proof, and the documented residual risk on
30
33
  * multi-instance self-hosted worlds (mitigate by raising
31
34
  * `WORKFLOW_INLINE_OWNERSHIP_LEASE_SECONDS`).
32
35
  */
33
- export declare function runStepSingleFlight(runId: string, correlationId: string, execute: () => Promise<StepExecutionResult>, logLevel?: 'debug' | 'warn'): Promise<StepExecutionResult>;
36
+ export declare function runStepSingleFlight(runId: string, correlationId: string, execute: () => Promise<StepExecutionResult>, options?: StepSingleFlightOptions): Promise<StepExecutionResult>;
37
+ export interface StepSingleFlightOptions {
38
+ /**
39
+ * Level of the contention log when this call loses. Fresh inline claims
40
+ * overlap during ordinary wake replays, so they log at `debug`; recovery
41
+ * callers keep `warn`, since repeated overlap can indicate expiring leases.
42
+ */
43
+ logLevel?: 'debug' | 'warn';
44
+ /**
45
+ * Set by a winner that publishes its own `retry` under the step's dispatch
46
+ * key (stepDispatchIdempotencyKey): the node engine's inline executions.
47
+ * The promise settles once that publish is durable, or once the delivery
48
+ * that owns the execution ended without making it (a throttled batch
49
+ * hands the step to its continuation's replay instead). A queued delivery
50
+ * of the same step that is waiting on it was published under that same key
51
+ * and is still in flight, so the queue folds the retry into it
52
+ * (world-local returns the in-flight message's id, queues dedupe a key
53
+ * while its message is in flight, and world-postgres replaces an unlocked
54
+ * job with the same key or drops a later job whose key it has already
55
+ * completed). The QuickJS engine publishes its retries under their own
56
+ * keys, so its winners leave this unset.
57
+ */
58
+ retryPublishedUnderDispatchKeyAfter?: Promise<unknown>;
59
+ /**
60
+ * Set by the queued-step delivery. When it loses to a winner that sets
61
+ * `retryPublishedUnderDispatchKeyAfter` and that winner returns `retry`, it
62
+ * waits for that promise and then returns the `retry` instead of `skipped`,
63
+ * so its message redelivers after the backoff and runs the attempt the
64
+ * folded publish can no longer drive (workflow#4728). Waiting keeps the
65
+ * message in flight until the publish is out, so the publish never lands on
66
+ * a key the message already spent by acking (a sibling of the winner that
67
+ * outlasts the backoff would otherwise let the carried attempt finish and
68
+ * ack first). At most one loser carries a given retry.
69
+ */
70
+ carryFoldedRetry?: boolean;
71
+ }
34
72
  //# sourceMappingURL=step-single-flight.d.ts.map
@@ -1,7 +1,7 @@
1
1
  import { runSingleFlight } from '../step-single-flight.js';
2
2
  /**
3
3
  * Single-flight for a step body. This is a required companion to inline step
4
- * ownership (see `isInlineOwnershipEnabled` in `./constants.ts`): the
4
+ * ownership (see `getInlineOwnershipLeaseSeconds` in `./constants.ts`): the
5
5
  * ownership lease is a *death proof* only on platforms with a bounded
6
6
  * invocation lifetime. On worlds without an invocation kill bound
7
7
  * (world-local's single process, self-hosted deployments) a delayed backstop
@@ -25,12 +25,28 @@ import { runSingleFlight } from '../step-single-flight.js';
25
25
  * would leave the step created and never run. The loser runs its own attempt
26
26
  * instead, which its claim gates like any other.
27
27
  *
28
+ * The other exception is a winner's `retry` that was folded into the
29
+ * loser's own message: see `carryFoldedRetry`.
30
+ *
28
31
  * Cross-instance duplicates are what the ownership lease bounds on platforms
29
32
  * where it is a death proof, and the documented residual risk on
30
33
  * multi-instance self-hosted worlds (mitigate by raising
31
34
  * `WORKFLOW_INLINE_OWNERSHIP_LEASE_SECONDS`).
32
35
  */
33
- export function runStepSingleFlight(runId, correlationId, execute, logLevel = 'warn') {
34
- return runSingleFlight(runId, correlationId, execute, () => ({ type: 'skipped' }), logLevel, (winner) => winner.type === 'skipped');
36
+ export function runStepSingleFlight(runId, correlationId, execute, options = {}) {
37
+ return runSingleFlight(runId, correlationId, execute, async (winner) => {
38
+ if (winner?.settled.type === 'retry' &&
39
+ options.carryFoldedRetry &&
40
+ winner.state.publishedAfter &&
41
+ !winner.state.carried) {
42
+ winner.state.carried = true;
43
+ await winner.state.publishedAfter;
44
+ return winner.settled;
45
+ }
46
+ return { type: 'skipped' };
47
+ }, options.logLevel, (winner) => winner.type === 'skipped', {
48
+ publishedAfter: options.retryPublishedUnderDispatchKeyAfter,
49
+ carried: false,
50
+ });
35
51
  }
36
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic3RlcC1zaW5nbGUtZmxpZ2h0LmpzIiwic291cmNlUm9vdCI6IiI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GVBQWUsQ0FDcEIsS0FBSyxFQUNMLGFBQWEsRUFDYixPQUFPLEVBQ1AsS0FBSyxFQUFFLE1BQU0sRUFBRSxFQUFFO1FBQ2YsSUFDRSxNQUFNLEVBQUUsT0FBTyxDQUFDLElBQUksS0FBSyxPQUFPO1lBQ2hDLE9BQU8sQ0FBQyxnQkFBZ0I7WUFDeEIsTUFBTSxDQUFDLEtBQUssQ0FBQyxjQUFjO1lBQzNCLENBQUMsTUFBTSxDQUFDLEtBQUssQ0FBQyxPQUFPLEVBQ3JCLENBQUM7WUFDRCxNQUFNLENBQUMsS0FBSyxDQUFDLE9BQU8sR0FBRyxJQUFJLENBQUM7WUFDNUIsTUFBTSxNQUFNLENBQUMsS0FBSyxDQUFDLGNBQWMsQ0FBQztZQUNsQyxPQUFPLE1BQU0sQ0FBQyxPQUFPLENBQUM7UUFDeEIsQ0FBQztRQUNELE9BQU8sRUFBRSxJQUFJLEVBQUUsU0FBUyxFQUFFLENBQUM7SUFDN0IsQ0FBQyxFQUNELE9BQU8sQ0FBQyxRQUFRLEVBQ2hCLENBQUMsTUFBTSxFQUFFLEVBQUUsQ0FBQyxNQUFNLENBQUMsSUFBSSxLQUFLLFNBQVMsRUFDckM7UUFDRSxjQUFjLEVBQUUsT0FBTyxDQUFDLG1DQUFtQztRQUMzRCxPQUFPLEVBQUUsS0FBSztLQUNmLENBQ0YsQ0FBQztBQUNKLENBQUMifQ==
@@ -99,7 +99,7 @@ export interface SuspensionHandlerParams {
99
99
  forceClaimVictimWakes?: Set<string>;
100
100
  /**
101
101
  * Steps this invocation is already executing inline from an earlier pass
102
- * of the same delivery (see `isInlineEarlyAdvanceEnabled`). They are left
102
+ * of the same delivery (inline early advance). They are left
103
103
  * out entirely: nothing is created, deferred, or reported in
104
104
  * `pendingSteps` for them, since their own executions write their events.
105
105
  * They still occupy inline slots, so fewer new steps are deferred for