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

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 (78) 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 -5
  5. package/dist/capabilities.d.ts.map +1 -1
  6. package/dist/capabilities.js +14 -12
  7. package/dist/events-consumer.d.ts +30 -7
  8. package/dist/events-consumer.d.ts.map +1 -1
  9. package/dist/events-consumer.js +67 -11
  10. package/dist/flushable-stream.js +2 -2
  11. package/dist/global.d.ts +3 -1
  12. package/dist/global.d.ts.map +1 -1
  13. package/dist/global.js +8 -5
  14. package/dist/private.d.ts +20 -14
  15. package/dist/private.d.ts.map +1 -1
  16. package/dist/private.js +67 -29
  17. package/dist/replay-payload-cache.d.ts +13 -17
  18. package/dist/replay-payload-cache.d.ts.map +1 -1
  19. package/dist/replay-payload-cache.js +55 -57
  20. package/dist/runtime/constants.d.ts +3 -3
  21. package/dist/runtime/constants.d.ts.map +1 -1
  22. package/dist/runtime/constants.js +4 -4
  23. package/dist/runtime/helpers.d.ts +15 -34
  24. package/dist/runtime/helpers.d.ts.map +1 -1
  25. package/dist/runtime/helpers.js +18 -43
  26. package/dist/runtime/quickjs-entrypoint.d.ts.map +1 -1
  27. package/dist/runtime/quickjs-entrypoint.js +8 -1
  28. package/dist/runtime/quickjs-runtime.js +7 -1
  29. package/dist/runtime/resume-hook.d.ts +20 -12
  30. package/dist/runtime/resume-hook.d.ts.map +1 -1
  31. package/dist/runtime/resume-hook.js +195 -249
  32. package/dist/runtime/resume-latency.d.ts +13 -6
  33. package/dist/runtime/resume-latency.d.ts.map +1 -1
  34. package/dist/runtime/resume-latency.js +4 -2
  35. package/dist/runtime/run.d.ts +1 -1
  36. package/dist/runtime/run.d.ts.map +1 -1
  37. package/dist/runtime/run.js +3 -2
  38. package/dist/runtime/start.js +12 -10
  39. package/dist/runtime/step-latency.d.ts +31 -14
  40. package/dist/runtime/step-latency.d.ts.map +1 -1
  41. package/dist/runtime/step-latency.js +19 -13
  42. package/dist/runtime/suspension-handler.d.ts +9 -7
  43. package/dist/runtime/suspension-handler.d.ts.map +1 -1
  44. package/dist/runtime/suspension-handler.js +41 -41
  45. package/dist/runtime/vm-mode.d.ts +1 -1
  46. package/dist/runtime/vm-mode.d.ts.map +1 -1
  47. package/dist/runtime/vm-mode.js +1 -1
  48. package/dist/runtime.d.ts.map +1 -1
  49. package/dist/runtime.js +278 -125
  50. package/dist/serialization/hardened.d.ts +5 -4
  51. package/dist/serialization/hardened.d.ts.map +1 -1
  52. package/dist/serialization/hardened.js +7 -1
  53. package/dist/serialization-format.js +2 -2
  54. package/dist/serialization.d.ts +8 -9
  55. package/dist/serialization.d.ts.map +1 -1
  56. package/dist/serialization.js +32 -25
  57. package/dist/step.d.ts.map +1 -1
  58. package/dist/step.js +3 -11
  59. package/dist/telemetry/semantic-conventions.d.ts +51 -8
  60. package/dist/telemetry/semantic-conventions.d.ts.map +1 -1
  61. package/dist/telemetry/semantic-conventions.js +38 -5
  62. package/dist/telemetry.d.ts +12 -0
  63. package/dist/telemetry.d.ts.map +1 -1
  64. package/dist/telemetry.js +62 -2
  65. package/dist/version.d.ts +1 -1
  66. package/dist/version.js +2 -2
  67. package/dist/vm/script-cache.d.ts +9 -11
  68. package/dist/vm/script-cache.d.ts.map +1 -1
  69. package/dist/vm/script-cache.js +25 -40
  70. package/dist/workflow/attribute-dispatcher.d.ts.map +1 -1
  71. package/dist/workflow/attribute-dispatcher.js +3 -6
  72. package/dist/workflow/hook.d.ts.map +1 -1
  73. package/dist/workflow/hook.js +6 -15
  74. package/dist/workflow.d.ts +16 -0
  75. package/dist/workflow.d.ts.map +1 -1
  76. package/dist/workflow.js +73 -29
  77. package/docs/foundations/errors-and-retries.mdx +1 -1
  78. package/package.json +6 -6
@@ -15,18 +15,10 @@ export declare function getHookByToken(token: string): Promise<Hook>;
15
15
  * The result of {@link resumeHook}: a {@link Hook} augmented with an optional
16
16
  * resilience signal.
17
17
  *
18
- * On the parallel fast path, `resumeHook()` writes the `hook_received` event and
19
- * dispatches the workflow queue message concurrently. When the direct event
20
- * write fails *transiently* (a 429/5xx, a transport error, or an expected
21
- * `(runId, resumeId)` conflict with its own re-ensuring consumer) but the queue
22
- * dispatch succeeds, the resume is still guaranteed: the queue consumer
23
- * idempotently materializes the `hook_received` event from the payload carried
24
- * on the message before replay. In that recovered case the returned hook carries
25
- * `resilientResume: true`.
26
- *
27
- * On the happy path (the direct write landed) and on the sequential fallback
28
- * path, the flag is absent (`undefined`). Callers that don't care about the
29
- * distinction can treat the result as a plain {@link Hook}.
18
+ * `resilientResume` is retained for source compatibility and is never set.
19
+ * `resumeHook()` now requires the durable `hook_received` write and workflow
20
+ * wake to both succeed before it resolves. Treat the result as a plain
21
+ * {@link Hook}.
30
22
  */
31
23
  export type ResumedHook = Hook & {
32
24
  resilientResume?: boolean;
@@ -37,6 +29,22 @@ export type ResumedHook = Hook & {
37
29
  * This function is called externally (e.g., from an API route or server action)
38
30
  * to send data to a hook and resume the associated workflow run.
39
31
  *
32
+ * Resolving means BOTH that the `hook_received` event is durably recorded in
33
+ * the run's event log and that the workflow wake was accepted by the queue, in
34
+ * that order. A {@link HookNotFoundError} means this invocation committed no
35
+ * event. Any other error after the write is ambiguous only in dispatch, never
36
+ * in durability: the event may already be committed, and a later wake of the
37
+ * run (from any source) will deliver it.
38
+ *
39
+ * Prefer passing the token string over a cached {@link Hook} object. A token
40
+ * is looked up fresh, so the live backend can attest its atomic resume claim
41
+ * and the durable write becomes idempotent-on-retry (transport retries of the
42
+ * same write converge on one event). A supplied Hook object may carry a stale
43
+ * attestation, so it is deliberately ignored and the write is claim-less —
44
+ * meaning a lost response cannot be retried safely: retrying at the
45
+ * application level mints a fresh claim and can commit a second
46
+ * `hook_received`.
47
+ *
40
48
  * @param tokenOrHook - The unique token identifying the hook, or the hook object itself
41
49
  * @param payload - The data payload to send to the hook
42
50
  * @returns Promise resolving to the {@link ResumedHook}
@@ -1 +1 @@
1
- {"version":3,"file":"resume-hook.d.ts","sourceRoot":"","sources":["../../src/runtime/resume-hook.ts"],"names":[],"mappings":"AAOA,OAAO,EAGL,KAAK,IAAI,EAUV,MAAM,iBAAiB,CAAC;AAQzB,OAAO,EAGL,KAAK,UAAU,EAGhB,MAAM,qBAAqB,CAAC;AAwJ7B;;;;;;;;;GASG;AACH,wBAAsB,cAAc,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAGjE;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,MAAM,WAAW,GAAG,IAAI,GAAG;IAAE,eAAe,CAAC,EAAE,OAAO,CAAA;CAAE,CAAC;AAE/D;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH,wBAAsB,UAAU,CAAC,CAAC,GAAG,GAAG,EACtC,WAAW,EAAE,MAAM,GAAG,IAAI,EAC1B,OAAO,EAAE,CAAC,EACV,qBAAqB,CAAC,EAAE,UAAU,GACjC,OAAO,CAAC,WAAW,CAAC,CAmBtB;AAkcD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;AACH,wBAAsB,aAAa,CACjC,KAAK,EAAE,MAAM,EACb,OAAO,EAAE,OAAO,GACf,OAAO,CAAC,QAAQ,CAAC,CAqEnB"}
1
+ {"version":3,"file":"resume-hook.d.ts","sourceRoot":"","sources":["../../src/runtime/resume-hook.ts"],"names":[],"mappings":"AAMA,OAAO,EAEL,KAAK,IAAI,EASV,MAAM,iBAAiB,CAAC;AAOzB,OAAO,EAGL,KAAK,UAAU,EAGhB,MAAM,qBAAqB,CAAC;AAiN7B;;;;;;;;;GASG;AACH,wBAAsB,cAAc,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAGjE;AAED;;;;;;;;GAQG;AACH,MAAM,MAAM,WAAW,GAAG,IAAI,GAAG;IAAE,eAAe,CAAC,EAAE,OAAO,CAAA;CAAE,CAAC;AAE/D;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4CG;AACH,wBAAsB,UAAU,CAAC,CAAC,GAAG,GAAG,EACtC,WAAW,EAAE,MAAM,GAAG,IAAI,EAC1B,OAAO,EAAE,CAAC,EACV,qBAAqB,CAAC,EAAE,UAAU,GACjC,OAAO,CAAC,WAAW,CAAC,CAoBtB;AAsUD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;AACH,wBAAsB,aAAa,CACjC,KAAK,EAAE,MAAM,EACb,OAAO,EAAE,OAAO,GACf,OAAO,CAAC,QAAQ,CAAC,CAqEnB"}