@workflow/core 5.0.0-beta.44 → 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 (58) 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 +2 -2
  5. package/dist/capabilities.js +4 -4
  6. package/dist/events-consumer.d.ts +1 -1
  7. package/dist/events-consumer.d.ts.map +1 -1
  8. package/dist/events-consumer.js +3 -2
  9. package/dist/flushable-stream.js +2 -2
  10. package/dist/global.d.ts +3 -1
  11. package/dist/global.d.ts.map +1 -1
  12. package/dist/global.js +8 -5
  13. package/dist/private.d.ts +9 -7
  14. package/dist/private.d.ts.map +1 -1
  15. package/dist/private.js +11 -1
  16. package/dist/runtime/helpers.d.ts +3 -3
  17. package/dist/runtime/helpers.js +1 -1
  18. package/dist/runtime/quickjs-entrypoint.d.ts.map +1 -1
  19. package/dist/runtime/quickjs-entrypoint.js +8 -1
  20. package/dist/runtime/quickjs-runtime.js +7 -1
  21. package/dist/runtime/resume-hook.d.ts +27 -12
  22. package/dist/runtime/resume-hook.d.ts.map +1 -1
  23. package/dist/runtime/resume-hook.js +182 -182
  24. package/dist/runtime/resume-latency.d.ts +16 -6
  25. package/dist/runtime/resume-latency.d.ts.map +1 -1
  26. package/dist/runtime/resume-latency.js +4 -2
  27. package/dist/runtime/run.d.ts +1 -1
  28. package/dist/runtime/run.d.ts.map +1 -1
  29. package/dist/runtime/run.js +3 -2
  30. package/dist/runtime/start.js +3 -3
  31. package/dist/runtime/step-latency.d.ts +31 -14
  32. package/dist/runtime/step-latency.d.ts.map +1 -1
  33. package/dist/runtime/step-latency.js +19 -13
  34. package/dist/runtime/suspension-handler.d.ts +9 -7
  35. package/dist/runtime/suspension-handler.d.ts.map +1 -1
  36. package/dist/runtime/suspension-handler.js +41 -41
  37. package/dist/runtime.d.ts.map +1 -1
  38. package/dist/runtime.js +133 -66
  39. package/dist/serialization/hardened.d.ts +5 -4
  40. package/dist/serialization/hardened.d.ts.map +1 -1
  41. package/dist/serialization/hardened.js +7 -1
  42. package/dist/serialization-format.js +2 -2
  43. package/dist/serialization.d.ts +5 -6
  44. package/dist/serialization.d.ts.map +1 -1
  45. package/dist/serialization.js +19 -12
  46. package/dist/step.d.ts.map +1 -1
  47. package/dist/step.js +3 -11
  48. package/dist/telemetry/semantic-conventions.d.ts +14 -5
  49. package/dist/telemetry/semantic-conventions.d.ts.map +1 -1
  50. package/dist/telemetry/semantic-conventions.js +13 -4
  51. package/dist/version.d.ts +1 -1
  52. package/dist/version.js +2 -2
  53. package/dist/workflow/attribute-dispatcher.d.ts.map +1 -1
  54. package/dist/workflow/attribute-dispatcher.js +3 -6
  55. package/dist/workflow/hook.d.ts.map +1 -1
  56. package/dist/workflow/hook.js +6 -15
  57. package/dist/workflow.js +7 -8
  58. package/package.json +4 -4
@@ -15,18 +15,13 @@ 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. 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
24
+ * {@link Hook}.
30
25
  */
31
26
  export type ResumedHook = Hook & {
32
27
  resilientResume?: boolean;
@@ -61,6 +56,26 @@ export type ResumedHook = Hook & {
61
56
  * ```
62
57
  */
63
58
  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>;
64
79
  /**
65
80
  * Resumes a webhook by sending a {@link https://developer.mozilla.org/en-US/docs/Web/API/Request | Request}
66
81
  * 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;AAQzB,OAAO,EAGL,KAAK,UAAU,EAGhB,MAAM,qBAAqB,CAAC;AAwJ7B;;;;;;;;;GASG;AACH,w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