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

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 (71) hide show
  1. package/dist/capabilities.d.ts +6 -5
  2. package/dist/capabilities.d.ts.map +1 -1
  3. package/dist/capabilities.js +14 -12
  4. package/dist/classify-error.d.ts.map +1 -1
  5. package/dist/classify-error.js +13 -3
  6. package/dist/describe-error.d.ts.map +1 -1
  7. package/dist/describe-error.js +16 -1
  8. package/dist/events-consumer.d.ts +29 -6
  9. package/dist/events-consumer.d.ts.map +1 -1
  10. package/dist/events-consumer.js +66 -11
  11. package/dist/private.d.ts +13 -11
  12. package/dist/private.d.ts.map +1 -1
  13. package/dist/private.js +57 -29
  14. package/dist/replay-payload-cache.d.ts +13 -17
  15. package/dist/replay-payload-cache.d.ts.map +1 -1
  16. package/dist/replay-payload-cache.js +55 -57
  17. package/dist/runtime/constants.d.ts +12 -10
  18. package/dist/runtime/constants.d.ts.map +1 -1
  19. package/dist/runtime/constants.js +13 -11
  20. package/dist/runtime/helpers.d.ts +27 -33
  21. package/dist/runtime/helpers.d.ts.map +1 -1
  22. package/dist/runtime/helpers.js +31 -43
  23. package/dist/runtime/quickjs-serde.d.ts.map +1 -1
  24. package/dist/runtime/quickjs-serde.js +62 -1
  25. package/dist/runtime/resume-hook.d.ts +19 -26
  26. package/dist/runtime/resume-hook.d.ts.map +1 -1
  27. package/dist/runtime/resume-hook.js +201 -255
  28. package/dist/runtime/resume-latency.d.ts +8 -11
  29. package/dist/runtime/resume-latency.d.ts.map +1 -1
  30. package/dist/runtime/resume-latency.js +1 -1
  31. package/dist/runtime/run.d.ts.map +1 -1
  32. package/dist/runtime/run.js +9 -13
  33. package/dist/runtime/runs.d.ts.map +1 -1
  34. package/dist/runtime/runs.js +8 -4
  35. package/dist/runtime/start.js +12 -10
  36. package/dist/runtime/suspension-handler.d.ts +54 -1
  37. package/dist/runtime/suspension-handler.d.ts.map +1 -1
  38. package/dist/runtime/suspension-handler.js +83 -20
  39. package/dist/runtime/vm-mode.d.ts +1 -1
  40. package/dist/runtime/vm-mode.d.ts.map +1 -1
  41. package/dist/runtime/vm-mode.js +1 -1
  42. package/dist/runtime.d.ts.map +1 -1
  43. package/dist/runtime.js +318 -119
  44. package/dist/serialization/reducers/common-vm.d.ts.map +1 -1
  45. package/dist/serialization/reducers/common-vm.js +38 -1
  46. package/dist/serialization/reducers/common.d.ts.map +1 -1
  47. package/dist/serialization/reducers/common.js +26 -2
  48. package/dist/serialization/types.d.ts +7 -0
  49. package/dist/serialization/types.d.ts.map +1 -1
  50. package/dist/serialization/types.js +1 -1
  51. package/dist/serialization.d.ts +27 -5
  52. package/dist/serialization.d.ts.map +1 -1
  53. package/dist/serialization.js +185 -44
  54. package/dist/telemetry/semantic-conventions.d.ts +41 -7
  55. package/dist/telemetry/semantic-conventions.d.ts.map +1 -1
  56. package/dist/telemetry/semantic-conventions.js +30 -6
  57. package/dist/telemetry.d.ts +12 -0
  58. package/dist/telemetry.d.ts.map +1 -1
  59. package/dist/telemetry.js +62 -2
  60. package/dist/version.d.ts +1 -1
  61. package/dist/version.js +2 -2
  62. package/dist/vm/script-cache.d.ts +9 -11
  63. package/dist/vm/script-cache.d.ts.map +1 -1
  64. package/dist/vm/script-cache.js +25 -40
  65. package/dist/workflow/sleep.d.ts.map +1 -1
  66. package/dist/workflow/sleep.js +3 -6
  67. package/dist/workflow.d.ts +16 -0
  68. package/dist/workflow.d.ts.map +1 -1
  69. package/dist/workflow.js +72 -27
  70. package/docs/foundations/errors-and-retries.mdx +1 -1
  71. package/package.json +10 -10
@@ -15,12 +15,9 @@ 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
- * `resilientResume` is retained for source compatibility and is never set. It
19
- * signalled a resume whose direct `hook_received` write had failed while the
20
- * queue dispatch succeeded, back when the lazy path raced the two. The lazy
21
- * path no longer writes the event at all (the queue consumer materializes it
22
- * from `hookInput`), so there is no longer a distinction to report, and the
23
- * sequential path never set the flag either. Treat the result as a plain
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
24
21
  * {@link Hook}.
25
22
  */
26
23
  export type ResumedHook = Hook & {
@@ -32,6 +29,22 @@ export type ResumedHook = Hook & {
32
29
  * This function is called externally (e.g., from an API route or server action)
33
30
  * to send data to a hook and resume the associated workflow run.
34
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
+ *
35
48
  * @param tokenOrHook - The unique token identifying the hook, or the hook object itself
36
49
  * @param payload - The data payload to send to the hook
37
50
  * @returns Promise resolving to the {@link ResumedHook}
@@ -56,26 +69,6 @@ export type ResumedHook = Hook & {
56
69
  * ```
57
70
  */
58
71
  export declare function resumeHook<T = any>(tokenOrHook: string | Hook, payload: T, encryptionKeyOverride?: PayloadKey): Promise<ResumedHook>;
59
- /**
60
- * {@link resumeHook} with the `hook_received` event written BEFORE this
61
- * resolves, for the one caller that needs the resume to be durable at that
62
- * instant rather than merely dispatched.
63
- *
64
- * The lazy path leaves the write to the queue consumer, so a normal
65
- * `resumeHook()` resolves while the event is still in flight. That is fine for
66
- * an external resume, whose caller has nothing racing it. It is NOT fine for a
67
- * resume the runtime itself issues as a barrier: a step that aborts a shared
68
- * `AbortController` resumes the hook that records the abort in the event log,
69
- * and that write has to land before the step completes, or the workflow
70
- * continuation `step_completed` enqueues can dispatch the next step with a
71
- * stale, non-aborted signal (see `reviveAbortController` in serialization.ts).
72
- *
73
- * Forcing the eager write costs the round trip the lazy path removes, which is
74
- * the right trade here: this is an internal ordering barrier, not the
75
- * latency-sensitive external resume the optimization targets. The resume span
76
- * reports `resume_fallback_reason: durable_required`.
77
- */
78
- export declare function resumeHookDurable<T = any>(tokenOrHook: string | Hook, payload: T, encryptionKeyOverride?: PayloadKey): Promise<ResumedHook>;
79
72
  /**
80
73
  * Resumes a webhook by sending a {@link https://developer.mozilla.org/en-US/docs/Web/API/Request | Request}
81
74
  * object to a hook identified by its token.
@@ -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;AAOzB,OAAO,EAGL,KAAK,UAAU,EAGhB,MAAM,qBAAqB,CAAC;AA0J7B;;;;;;;;;GASG;AACH,wBAAsB,cAAc,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAGjE;AAED;;;;;;;;;;;GAWG;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,CAoBtB;AAED;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAsB,iBAAiB,CAAC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