eve 0.48.0 → 0.49.1

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 (222) hide show
  1. package/CHANGELOG.md +26 -0
  2. package/dist/src/channel/channel-address.js +1 -1
  3. package/dist/src/channel/types.d.ts +10 -0
  4. package/dist/src/cli/commands/integration-setup.d.ts +1 -0
  5. package/dist/src/cli/commands/integration-setup.js +1 -1
  6. package/dist/src/cli/commands/register-integration-commands.d.ts +1 -1
  7. package/dist/src/cli/commands/register-integration-commands.js +1 -1
  8. package/dist/src/cli/commands/registry-declared-setups.d.ts +1 -0
  9. package/dist/src/cli/commands/registry-declared-setups.js +1 -1
  10. package/dist/src/cli/commands/registry-metadata.d.ts +30 -0
  11. package/dist/src/cli/commands/registry-metadata.js +1 -1
  12. package/dist/src/cli/commands/registry-package.d.ts +6 -0
  13. package/dist/src/cli/commands/registry-package.js +1 -1
  14. package/dist/src/cli/commands/registry-pnpm-build-policy-flow.d.ts +30 -0
  15. package/dist/src/cli/commands/registry-pnpm-build-policy-flow.js +1 -0
  16. package/dist/src/cli/commands/registry-pnpm-build-policy.d.ts +12 -0
  17. package/dist/src/cli/commands/registry-pnpm-build-policy.js +6 -0
  18. package/dist/src/cli/commands/registry-recovery.d.ts +4 -0
  19. package/dist/src/cli/commands/registry-recovery.js +1 -1
  20. package/dist/src/cli/commands/registry.d.ts +1 -1
  21. package/dist/src/cli/commands/registry.js +1 -1
  22. package/dist/src/cli/dev/tui/setup-commands.js +2 -2
  23. package/dist/src/compiled/.vendor-stamp.json +7 -7
  24. package/dist/src/compiled/@workflow/core/attribute-changes.d.ts +2 -4
  25. package/dist/src/compiled/@workflow/core/capabilities.d.ts +10 -9
  26. package/dist/src/compiled/@workflow/core/capture-stack.d.ts +1 -1
  27. package/dist/src/compiled/@workflow/core/class-serialization.d.ts +8 -8
  28. package/dist/src/compiled/@workflow/core/context-violation-error.d.ts +5 -5
  29. package/dist/src/compiled/@workflow/core/create-hook.d.ts +2 -2
  30. package/dist/src/compiled/@workflow/core/describe-error.d.ts +7 -7
  31. package/dist/src/compiled/@workflow/core/encryption.d.ts +5 -5
  32. package/dist/src/compiled/@workflow/core/events-consumer.d.ts +49 -14
  33. package/dist/src/compiled/@workflow/core/flushable-stream.d.ts +4 -4
  34. package/dist/src/compiled/@workflow/core/global.d.ts +4 -2
  35. package/dist/src/compiled/@workflow/core/index.d.ts +1 -1
  36. package/dist/src/compiled/@workflow/core/index.js +2 -2
  37. package/dist/src/compiled/@workflow/core/log-format.d.ts +2 -2
  38. package/dist/src/compiled/@workflow/core/private.d.ts +40 -78
  39. package/dist/src/compiled/@workflow/core/private.js +1 -1
  40. package/dist/src/compiled/@workflow/core/replay-payload-cache.d.ts +13 -17
  41. package/dist/src/compiled/@workflow/core/runtime/compute-instance.d.ts +4 -3
  42. package/dist/src/compiled/@workflow/core/runtime/constants.d.ts +27 -27
  43. package/dist/src/compiled/@workflow/core/runtime/count-step-started-events.d.ts +7 -7
  44. package/dist/src/compiled/@workflow/core/runtime/deployment-guard.d.ts +7 -7
  45. package/dist/src/compiled/@workflow/core/runtime/get-port-lazy.d.ts +2 -2
  46. package/dist/src/compiled/@workflow/core/runtime/get-world-lazy.d.ts +2 -2
  47. package/dist/src/compiled/@workflow/core/runtime/helpers.d.ts +30 -49
  48. package/dist/src/compiled/@workflow/core/runtime/quickjs-entrypoint.d.ts +21 -10
  49. package/dist/src/compiled/@workflow/core/runtime/quickjs-runtime.d.ts +31 -15
  50. package/dist/src/compiled/@workflow/core/runtime/quickjs-serde.d.ts +10 -10
  51. package/dist/src/compiled/@workflow/core/runtime/replay-budget.d.ts +4 -4
  52. package/dist/src/compiled/@workflow/core/runtime/replay-recovery-reporter.d.ts +1 -1
  53. package/dist/src/compiled/@workflow/core/runtime/resume-hook.d.ts +20 -12
  54. package/dist/src/compiled/@workflow/core/runtime/resume-latency.d.ts +37 -30
  55. package/dist/src/compiled/@workflow/core/runtime/run-id-time.d.ts +2 -2
  56. package/dist/src/compiled/@workflow/core/runtime/run.d.ts +22 -5
  57. package/dist/src/compiled/@workflow/core/runtime/runs.d.ts +4 -4
  58. package/dist/src/compiled/@workflow/core/runtime/start.d.ts +3 -3
  59. package/dist/src/compiled/@workflow/core/runtime/step-executor.d.ts +14 -14
  60. package/dist/src/compiled/@workflow/core/runtime/step-latency.d.ts +42 -25
  61. package/dist/src/compiled/@workflow/core/runtime/step-ownership.d.ts +6 -6
  62. package/dist/src/compiled/@workflow/core/runtime/step-single-flight.d.ts +1 -1
  63. package/dist/src/compiled/@workflow/core/runtime/suspension-handler.d.ts +38 -24
  64. package/dist/src/compiled/@workflow/core/runtime/unserializable-step.d.ts +34 -0
  65. package/dist/src/compiled/@workflow/core/runtime/vm-mode.d.ts +2 -2
  66. package/dist/src/compiled/@workflow/core/runtime/wait-continuation.d.ts +31 -9
  67. package/dist/src/compiled/@workflow/core/runtime/wait-until.d.ts +1 -1
  68. package/dist/src/compiled/@workflow/core/runtime/world-compatibility.d.ts +20 -9
  69. package/dist/src/compiled/@workflow/core/runtime/world-init.d.ts +5 -5
  70. package/dist/src/compiled/@workflow/core/runtime.js +3 -3
  71. package/dist/src/compiled/@workflow/core/sealed-box.d.ts +7 -7
  72. package/dist/src/compiled/@workflow/core/serialization/codec-devalue-vm.d.ts +1 -1
  73. package/dist/src/compiled/@workflow/core/serialization/codec-devalue.d.ts +1 -1
  74. package/dist/src/compiled/@workflow/core/serialization/codec.d.ts +4 -4
  75. package/dist/src/compiled/@workflow/core/serialization/compression.d.ts +12 -11
  76. package/dist/src/compiled/@workflow/core/serialization/encryption.d.ts +7 -7
  77. package/dist/src/compiled/@workflow/core/serialization/format.d.ts +6 -6
  78. package/dist/src/compiled/@workflow/core/serialization/hardened.d.ts +23 -22
  79. package/dist/src/compiled/@workflow/core/serialization/index.d.ts +1 -1
  80. package/dist/src/compiled/@workflow/core/serialization/reducers/class-vm.d.ts +1 -1
  81. package/dist/src/compiled/@workflow/core/serialization/reducers/step-function-vm.d.ts +1 -1
  82. package/dist/src/compiled/@workflow/core/serialization/types.d.ts +5 -5
  83. package/dist/src/compiled/@workflow/core/serialization/workflow-vm.d.ts +1 -1
  84. package/dist/src/compiled/@workflow/core/serialization-format.d.ts +11 -11
  85. package/dist/src/compiled/@workflow/core/serialization.d.ts +18 -19
  86. package/dist/src/compiled/@workflow/core/source-map.d.ts +1 -1
  87. package/dist/src/compiled/@workflow/core/step/context-storage.d.ts +5 -5
  88. package/dist/src/compiled/@workflow/core/step/writable-stream.d.ts +3 -3
  89. package/dist/src/compiled/@workflow/core/symbols.d.ts +2 -2
  90. package/dist/src/compiled/@workflow/core/telemetry/semantic-conventions.d.ts +71 -20
  91. package/dist/src/compiled/@workflow/core/telemetry.d.ts +15 -3
  92. package/dist/src/compiled/@workflow/core/version.d.ts +1 -1
  93. package/dist/src/compiled/@workflow/core/vm/script-cache.d.ts +9 -11
  94. package/dist/src/compiled/@workflow/core/workflow/abort-controller.d.ts +1 -1
  95. package/dist/src/compiled/@workflow/core/workflow/set-attributes.d.ts +1 -1
  96. package/dist/src/compiled/@workflow/core/workflow/world-init-stub.d.ts +1 -1
  97. package/dist/src/compiled/@workflow/core/workflow.js +1 -1
  98. package/dist/src/compiled/@workflow/errors/index.d.ts +18 -18
  99. package/dist/src/compiled/@workflow/errors/index.js +1 -1
  100. package/dist/src/compiled/@workflow/world/analytics.d.ts +3 -2
  101. package/dist/src/compiled/@workflow/world/attributes-validation.d.ts +28 -0
  102. package/dist/src/compiled/@workflow/world/attributes.d.ts +8 -107
  103. package/dist/src/compiled/@workflow/world/env-config.d.ts +5 -5
  104. package/dist/src/compiled/@workflow/world/event-metadata.d.ts +132 -0
  105. package/dist/src/compiled/@workflow/world/events.d.ts +42 -96
  106. package/dist/src/compiled/@workflow/world/hooks.d.ts +12 -11
  107. package/dist/src/compiled/@workflow/world/index.d.ts +3 -3
  108. package/dist/src/compiled/@workflow/world/interfaces.d.ts +94 -39
  109. package/dist/src/compiled/@workflow/world/queue.d.ts +29 -22
  110. package/dist/src/compiled/@workflow/world/runs.d.ts +20 -0
  111. package/dist/src/compiled/@workflow/world/slot-identity.d.ts +3 -3
  112. package/dist/src/compiled/@workflow/world/spec-version.d.ts +82 -15
  113. package/dist/src/compiled/@workflow/world/ulid.d.ts +2 -2
  114. package/dist/src/compiled/@workflow/world-local/index.js +5 -5
  115. package/dist/src/compiled/@workflow/world-vercel/index.js +12 -12
  116. package/dist/src/compiled/_chunks/workflow/{attribute-changes-DXbpwBdw.js → attribute-changes-BwAadFfB.js} +3 -3
  117. package/dist/src/compiled/_chunks/workflow/debug-log-CVPstO1D.js +1 -0
  118. package/dist/src/compiled/_chunks/workflow/dist-CgbVZs5l.js +40 -0
  119. package/dist/src/compiled/_chunks/workflow/dist-DjojkP5e.js +3 -0
  120. package/dist/src/compiled/_chunks/workflow/frames-CZ9eHShe.js +3 -0
  121. package/dist/src/compiled/_chunks/workflow/global-singleton-BNinwFrL.js +1 -0
  122. package/dist/src/compiled/_chunks/workflow/private-CZFMABEf.js +1 -0
  123. package/dist/src/compiled/_chunks/workflow/resume-hook-BToMtPbH.js +1 -0
  124. package/dist/src/compiled/_chunks/workflow/run-DzyAoGh4.js +1 -0
  125. package/dist/src/compiled/_chunks/workflow/sleep-3_A5uOp-.js +1 -0
  126. package/dist/src/compiled/_chunks/workflow/undici-DfxNX5og.js +95 -0
  127. package/dist/src/compiled/_chunks/workflow/wait-until-BtySPYD0.js +15 -0
  128. package/dist/src/compiled/_chunks/workflow/ws-transport-PnVVxT0R.js +1 -0
  129. package/dist/src/eve-channel/index.js +1 -1
  130. package/dist/src/execution/agent-handle-dispatch.js +1 -1
  131. package/dist/src/execution/continuation-conflict-step.d.ts +10 -0
  132. package/dist/src/execution/continuation-conflict-step.js +1 -0
  133. package/dist/src/execution/delegated-parent-notification.js +1 -1
  134. package/dist/src/execution/dispatch-runtime-actions-shared.d.ts +7 -29
  135. package/dist/src/execution/dispatch-runtime-actions-shared.js +1 -1
  136. package/dist/src/execution/dispatch-runtime-actions-start.d.ts +33 -0
  137. package/dist/src/execution/dispatch-runtime-actions-start.js +1 -0
  138. package/dist/src/execution/dispatch-runtime-actions-step.js +1 -1
  139. package/dist/src/execution/dispatch-turn-step.js +1 -1
  140. package/dist/src/execution/dynamic-connections.js +1 -1
  141. package/dist/src/execution/inline-turn.js +1 -1
  142. package/dist/src/execution/next-driver-action.d.ts +5 -4
  143. package/dist/src/execution/proxied-deliver-step.js +1 -1
  144. package/dist/src/execution/runtime-errors.d.ts +0 -12
  145. package/dist/src/execution/runtime-errors.js +1 -1
  146. package/dist/src/execution/sandbox/bindings/docker-options.d.ts +1 -1
  147. package/dist/src/execution/sandbox/bindings/docker-options.js +1 -1
  148. package/dist/src/execution/sandbox/bindings/eve-image.d.ts +4 -0
  149. package/dist/src/execution/sandbox/bindings/eve-image.js +1 -0
  150. package/dist/src/execution/sandbox/bindings/microsandbox-options.d.ts +1 -1
  151. package/dist/src/execution/sandbox/bindings/microsandbox-options.js +1 -1
  152. package/dist/src/execution/sandbox/bindings/vercel-create-sdk.js +1 -1
  153. package/dist/src/execution/session-timeout-steps.js +1 -1
  154. package/dist/src/execution/settle-cancelled-turn-step.js +1 -1
  155. package/dist/src/execution/stable-workflow-names.d.ts +2 -2
  156. package/dist/src/execution/subagent-start-local.js +1 -1
  157. package/dist/src/execution/tasks/parent/dispatch-task-step.js +1 -1
  158. package/dist/src/execution/tasks/parent/run-parent.js +1 -1
  159. package/dist/src/execution/tasks/parent/tool-execution.js +1 -1
  160. package/dist/src/execution/tool-run/start.js +1 -1
  161. package/dist/src/execution/tools/subagent/local.js +1 -1
  162. package/dist/src/execution/turn-workflow.js +1 -1
  163. package/dist/src/execution/workflow-entry.d.ts +5 -1
  164. package/dist/src/execution/workflow-entry.js +1 -1
  165. package/dist/src/execution/workflow-runtime.d.ts +12 -12
  166. package/dist/src/execution/workflow-runtime.js +1 -1
  167. package/dist/src/execution/workflow-steps.js +1 -1
  168. package/dist/src/harness/tool-loop.js +1 -1
  169. package/dist/src/internal/application/package.js +1 -1
  170. package/dist/src/internal/workflow/development-world-client.js +1 -1
  171. package/dist/src/packages/eve-catalog/src/index.js +1 -1
  172. package/dist/src/public/channels/slack/activity.d.ts +18 -0
  173. package/dist/src/public/channels/slack/activity.js +1 -0
  174. package/dist/src/public/channels/slack/api.js +1 -1
  175. package/dist/src/public/channels/slack/index.d.ts +1 -0
  176. package/dist/src/public/channels/slack/index.js +1 -1
  177. package/dist/src/public/channels/slack/interaction-cards.js +1 -1
  178. package/dist/src/public/channels/slack/interactions.js +1 -1
  179. package/dist/src/public/channels/slack/slackChannel.d.ts +12 -1
  180. package/dist/src/public/channels/slack/slackChannel.js +1 -1
  181. package/dist/src/public/memory/file/backends/default.js +1 -1
  182. package/dist/src/public/sandbox/docker-sandbox.d.ts +5 -4
  183. package/dist/src/public/sandbox/microsandbox-sandbox.d.ts +1 -1
  184. package/dist/src/public/sandbox/vercel-sandbox.d.ts +3 -1
  185. package/dist/src/setup/flows/registry.js +1 -1
  186. package/dist/src/setup/integrations/file-memory/setup.d.ts +15 -0
  187. package/dist/src/setup/integrations/file-memory/setup.js +2 -0
  188. package/dist/src/setup/integrations/file-memory/vercel.d.ts +103 -0
  189. package/dist/src/setup/integrations/file-memory/vercel.js +1 -0
  190. package/dist/src/setup/integrations/registry.js +1 -1
  191. package/dist/src/setup/integrations/shared/vercel-project.js +1 -1
  192. package/dist/src/setup/scaffold/connections/catalog.js +1 -1
  193. package/dist/src/setup/scaffold/create/project.js +1 -1
  194. package/docs/channels/custom.mdx +4 -0
  195. package/docs/channels/eve.mdx +12 -8
  196. package/docs/channels/mcp.mdx +4 -1
  197. package/docs/channels/slack.mdx +1 -1
  198. package/docs/guides/instrumentation.md +1 -1
  199. package/docs/install-integrations.mdx +5 -0
  200. package/docs/instructions.mdx +1 -1
  201. package/docs/memory/custom-provider.md +214 -0
  202. package/docs/memory/file.md +168 -0
  203. package/docs/memory/meta.json +5 -0
  204. package/docs/memory/overview.mdx +282 -0
  205. package/docs/patterns/multi-tenant-memory.md +12 -20
  206. package/docs/reference/cli.md +28 -23
  207. package/docs/sandbox.mdx +5 -3
  208. package/package.json +8 -8
  209. package/dist/src/compiled/_chunks/workflow/dist-CqvWKNQv.js +0 -3
  210. package/dist/src/compiled/_chunks/workflow/dist-Dk0aQqFO.js +0 -40
  211. package/dist/src/compiled/_chunks/workflow/dist-DpYyXbJv.js +0 -1
  212. package/dist/src/compiled/_chunks/workflow/env-config-L94XftKz.js +0 -1
  213. package/dist/src/compiled/_chunks/workflow/frames-Dl2Hcma4.js +0 -3
  214. package/dist/src/compiled/_chunks/workflow/private-CuQ4HTFC.js +0 -1
  215. package/dist/src/compiled/_chunks/workflow/resume-hook-E-Nkx8q_.js +0 -1
  216. package/dist/src/compiled/_chunks/workflow/run-cIeex2KF.js +0 -1
  217. package/dist/src/compiled/_chunks/workflow/sleep-CxFsdxB_.js +0 -1
  218. package/dist/src/compiled/_chunks/workflow/spec-version-DBUVfF_R.js +0 -1
  219. package/dist/src/compiled/_chunks/workflow/undici-DznrXKcM.js +0 -95
  220. package/dist/src/compiled/_chunks/workflow/wait-until-BZHmJCAW.js +0 -15
  221. package/dist/src/compiled/_chunks/workflow/ws-transport-Ct6yyRWZ.js +0 -1
  222. package/docs/memory.md +0 -408
@@ -10,33 +10,26 @@ type ReplayPayloadField = 'result' | 'error' | 'payload';
10
10
  * those replays. Deserialization still runs against each VM's globals so every
11
11
  * replay receives fresh object graphs and correctly revived Workflow objects.
12
12
  *
13
- * Successful prepared plaintext remains resident for the invocation lifetime.
14
- * Its memory cost is the sum of decrypted and decompressed payload sizes, but
15
- * it never crosses workflow runs or queue deliveries.
13
+ * Successful prepared plaintext and memoized primitive step results remain
14
+ * resident for the invocation lifetime. Their memory never crosses workflow
15
+ * runs or queue deliveries.
16
16
  */
17
17
  export declare class ReplayPayloadCache {
18
- private readonly encryptionKey;
19
18
  private readonly preparer;
20
19
  private readonly preparedPayloads;
21
20
  private readonly primitiveStepResults;
21
+ private readonly encryptionKey;
22
22
  private nextUnscannedEventIndex;
23
- constructor(encryptionKey: PayloadKey | undefined, preparer?: ReplayPayloadPreparer);
23
+ constructor(encryptionKey: PayloadKey | undefined | Promise<PayloadKey | undefined>, preparer?: ReplayPayloadPreparer);
24
+ /** Start preparing an event payload as soon as its frame is decoded. */
25
+ prepareEvent(event: Event): void;
24
26
  /**
25
27
  * Start every missing binary preparation before workflow execution. Failures
26
28
  * are intentionally retained: the ordered event consumer must observe the
27
29
  * original rejection before that entry becomes retryable.
28
30
  */
29
31
  prewarm(workflowRun: WorkflowRun, events: Event[]): Promise<void>;
30
- /**
31
- * Forget how much of the event log has been scanned, so the next
32
- * {@link prewarm} walks it from the start again.
33
- *
34
- * Required before a replay whose event log was reloaded rather than extended:
35
- * a corrected log inserts the events the previous load was missing, which
36
- * shifts every later position, so a positional resume would skip exactly the
37
- * events the reload was for. Already-prepared payloads are kept — they are
38
- * keyed by event id, so re-scanning re-observes them for free.
39
- */
32
+ /** Rescan the next event log after an authoritative replacement. */
40
33
  resetScan(): void;
41
34
  /** Return the workflow input after shared host-side preparation. */
42
35
  prepareWorkflowInput(workflowRun: WorkflowRun): Promise<PreparedReplayPayload>;
@@ -48,8 +41,8 @@ export declare class ReplayPayloadCache {
48
41
  prepareEventPayload(eventId: string, field: ReplayPayloadField, value: unknown): Promise<PreparedReplayPayload>;
49
42
  /**
50
43
  * Reuse final step values only when sharing them across VMs is unobservable.
51
- * Objects and large strings/bigints always run `hydrate` again, producing a
52
- * fresh VM-specific value from the separately cached prepared payload.
44
+ * Objects always run `hydrate` again to produce a fresh VM-specific value;
45
+ * every primitive is safe to reuse directly.
53
46
  */
54
47
  getStepResult(eventId: string, hydrate: () => Promise<unknown>): Promise<unknown>;
55
48
  /**
@@ -61,6 +54,9 @@ export declare class ReplayPayloadCache {
61
54
  private ensurePreparation;
62
55
  /** Normalize synchronous and asynchronous preparers to one promise contract. */
63
56
  private runPreparation;
57
+ /** Start one event's binary payload unless another path already did. */
58
+ private prepareEventIfMissing;
59
+ private startPreparation;
64
60
  private workflowInputKey;
65
61
  private eventPayloadKey;
66
62
  }
@@ -1,12 +1,13 @@
1
1
  /**
2
2
  * Identifier for the compute instance (microVM) this module was loaded into.
3
3
  *
4
- * Vercel exposes no native per-instance id under Fluid compute (`AWS_LAMBDA_*`
4
+ * Vercel exposes no native per-instance ID under Fluid compute (`AWS_LAMBDA_*`
5
5
  * is blocked), so we synthesize one at module load: a prefixed ULID
6
6
  * (`cinst_<ulid>`, per the `wrun_`/`step_` convention) whose timestamp is the
7
7
  * instance's birth time. Stable for the instance's life and shared by every
8
- * invocation it handles — including the concurrent ones Fluid packs onto it;
9
- * cold starts mint fresh ids. Emitted as the OTEL `faas.instance` attribute.
8
+ * invocation it handles, including the concurrent ones Fluid packs onto it;
9
+ * cold starts mint fresh IDs. Emitted as the OpenTelemetry `faas.instance`
10
+ * attribute.
10
11
  */
11
12
  export declare const COMPUTE_INSTANCE_ID: string;
12
13
  //# sourceMappingURL=compute-instance.d.ts.map
@@ -6,7 +6,7 @@ export declare function getMaxQueueDeliveries(): number;
6
6
  /**
7
7
  * Default maximum time allowed for the *replay* portion of a single workflow
8
8
  * handler invocation (in ms). This budget only covers deterministic-replay
9
- * and workflow-VM execution between step boundaries — inline step bodies
9
+ * and workflow-VM execution between step boundaries. Inline step bodies
10
10
  * (`"use step"` functions invoked via `executeStep`) do NOT count against
11
11
  * it. Step bodies are bounded separately by the platform's function
12
12
  * `maxDuration` (e.g. 800s on Vercel Pro Fluid) and `NO_INLINE_REPLAY_AFTER_MS`.
@@ -17,7 +17,7 @@ export declare function getMaxQueueDeliveries(): number;
17
17
  * `RUN_ERROR_CODES.REPLAY_TIMEOUT`.
18
18
  *
19
19
  * Note that on Vercel Hobby (standard functions), the platform `maxDuration`
20
- * is 60s — well below this budget, so the platform SIGTERM will fire first
20
+ * is 60s, well below this budget, so the platform SIGTERM will fire first
21
21
  * and the queue will re-deliver until the visibility window expires. With
22
22
  * Fluid Compute on Hobby the per-function ceiling rises to 300s, still
23
23
  * under the default budget.
@@ -39,13 +39,13 @@ export declare const MAX_REPLAY_TIMEOUT_MS = 780000;
39
39
  *
40
40
  * Reads `process.env.WORKFLOW_REPLAY_TIMEOUT_MS` lazily so tests and
41
41
  * deployments can override per invocation. Invalid / out-of-range values
42
- * fall back to a safe value (no throw — the env var is an escape hatch,
42
+ * fall back to a safe value (no throw: the env var is an escape hatch,
43
43
  * not a hard requirement) and emit a one-time warning so misconfiguration
44
44
  * is observable.
45
45
  */
46
46
  export declare function getReplayTimeoutMs(): number;
47
47
  /**
48
- * Reset the warn-once cache. Test-only — exported so unit tests can
48
+ * Reset the warn-once cache. Test-only: exported so unit tests can
49
49
  * exercise the warn path repeatedly without sharing state.
50
50
  *
51
51
  * @internal
@@ -60,8 +60,8 @@ export declare function getReplayTimeoutMaxRetries(): number;
60
60
  /**
61
61
  * Default maximum number of steps the owned-inline path runs inline (in
62
62
  * parallel) per suspension. The rest are queued to background handlers. Each
63
- * inline step is created lazily — its `step_created` is folded into the
64
- * `step_started` that `executeStep` sends — so inlining N steps saves N queue
63
+ * inline step is created lazily (its `step_created` is folded into the
64
+ * `step_started` that `executeStep` sends), so inlining N steps saves N queue
65
65
  * round-trips for a `Promise.all`-style fan-out. `1` reproduces the
66
66
  * single-inline-step behavior exactly (useful kill-switch).
67
67
  *
@@ -81,7 +81,7 @@ export declare const MAX_MAX_INLINE_STEPS = 16;
81
81
  *
82
82
  * Reads `process.env.WORKFLOW_MAX_INLINE_STEPS` lazily so tests and
83
83
  * deployments can override per invocation. Invalid / out-of-range values fall
84
- * back to a safe value (no throw — the env var is an escape hatch) and emit a
84
+ * back to a safe value (no throw: the env var is an escape hatch) and emit a
85
85
  * one-time warning so misconfiguration is observable.
86
86
  */
87
87
  export declare function getMaxInlineSteps(): number;
@@ -97,8 +97,7 @@ export declare function getMaxInlineSteps(): number;
97
97
  * messages on its fast inline path instead of paying an S3 store+fetch
98
98
  * double-hop for bytes that already live in the event log. Above this size
99
99
  * the dispatch falls back to the sequential path (`step_created` write, then
100
- * a payload-less queue message). Matches `MAX_INLINE_RESUME_PAYLOAD_BYTES`
101
- * on the resilient hook resume path.
100
+ * a payload-less queue message).
102
101
  */
103
102
  export declare const MAX_RESILIENT_STEP_INPUT_BYTES: number;
104
103
  /**
@@ -107,12 +106,13 @@ export declare const MAX_RESILIENT_STEP_INPUT_BYTES: number;
107
106
  * step-execution queue publish, carrying the serialized step input in the
108
107
  * queue message (`stepInput`) so the consumer can idempotently re-ensure the
109
108
  * event if the direct write failed transiently. Mirrors the resilient start
110
- * (`runInput`) and resilient hook resume (`hookInput`) patterns.
109
+ * (`runInput`) pattern (and the legacy lazy hook resume's `hookInput`, which
110
+ * current producers no longer send).
111
111
  *
112
112
  * **Off by default.** Enable via `WORKFLOW_RESILIENT_STEP_DISPATCH=1`.
113
113
  *
114
114
  * The queue publish races the create's verdict, and a create can come back
115
- * refused — as a duplicate this replay should stop pursuing, or as a stale
115
+ * refused: as a duplicate this replay should stop pursuing, or as a stale
116
116
  * write on a World that refuses rather than reports. Either way the message
117
117
  * carrying the payload is already out, so the consumer can materialize a step
118
118
  * whose create was refused, and nothing orders the verdict before the
@@ -127,11 +127,11 @@ export declare function isResilientStepDispatchEnabled(): boolean;
127
127
  * instead of one write per event. Only engages when the World implements the
128
128
  * optional `events.createBatch` AND the run is on slot identity
129
129
  * (specVersion >= 6) AND the suspension carries no attribute/hook writes and
130
- * no resilient step dispatch — everything else keeps the single-event path
130
+ * no resilient step dispatch. Everything else keeps the single-event path
131
131
  * byte-for-byte.
132
132
  *
133
133
  * Reads `process.env.WORKFLOW_BATCH_TRANSITIONS` lazily. Default **ON**;
134
- * disabled only by an explicit `'0'` / `'false'` (case-insensitive) — the
134
+ * disabled only by an explicit `'0'` / `'false'` (case-insensitive), the
135
135
  * operator escape hatch that restores the exact prior one-write-per-event
136
136
  * path, mirroring `WORKFLOW_TURBO`'s kill-switch shape.
137
137
  */
@@ -141,10 +141,10 @@ export declare function isBatchTransitionsEnabled(): boolean;
141
141
  * Mirrors the server's transaction budgets with a comfortable margin: each
142
142
  * fan-out event costs 2 transaction items server-side (entity + event row)
143
143
  * against the 100-item DynamoDB cap, and inline payloads count against a
144
- * 768 KB byte budget — 32 events stays well under both, and a fan-out larger
145
- * than this simply commits in successive batches (split batches lose
144
+ * 768 KB byte budget, so 32 events stays well under both, and a fan-out larger
145
+ * than this commits in successive batches (split batches lose
146
146
  * cross-batch atomicity, which is exactly today's per-event-write crash
147
- * surface — every batch still converges on retry via per-event 409s).
147
+ * surface, and every batch still converges on retry via per-event 409s).
148
148
  */
149
149
  export declare const MAX_BATCH_FANOUT_EVENTS = 32;
150
150
  /**
@@ -155,7 +155,7 @@ export declare const MAX_BATCH_FANOUT_EVENTS = 32;
155
155
  *
156
156
  * Reads `process.env.WORKFLOW_MAX_EVENTS_OVERRIDE` lazily so tests and
157
157
  * deployments can override per invocation. Invalid values fall back to unset
158
- * (no throw — the env var is an escape hatch) and emit a one-time warning.
158
+ * (no throw: the env var is an escape hatch) and emit a one-time warning.
159
159
  */
160
160
  export declare function getMaxEventsOverride(): number | undefined;
161
161
  /**
@@ -165,7 +165,7 @@ export declare function getMaxEventsOverride(): number | undefined;
165
165
  * `step_started` only before the terminal write.
166
166
  *
167
167
  * This can run a step body more than once when handlers race for the same
168
- * step's create-claim — both run the body before one wins. That is unsafe for
168
+ * step's create-claim: both run the body before one wins. That is unsafe for
169
169
  * steps with non-idempotent side effects; in particular, two concurrent runs
170
170
  * of a step that writes to the workflow stream (e.g. an AI agent streaming
171
171
  * tokens) can interleave and corrupt the stream data. So the optimization is
@@ -190,7 +190,7 @@ export declare function isOptimisticInlineStartExplicitlyDisabled(): boolean;
190
190
  * the first invocation* of a run (detected by the entrypoint via `runInput`
191
191
  * presence + `metadata.attempt === 1`): it backgrounds the `run_started` event
192
192
  * creation, skips the initial event-log load (nothing has been written yet),
193
- * and forces optimistic inline step start for that invocation — independent of
193
+ * and forces optimistic inline step start for that invocation, independent of
194
194
  * `WORKFLOW_OPTIMISTIC_INLINE_START`.
195
195
  *
196
196
  * Forcing optimistic start is safe here because the first delivery has no
@@ -208,7 +208,7 @@ export declare function isTurboEnabled(): boolean;
208
208
  * enabled (default ON). When on, the engine hydrates a VM with the
209
209
  * workflow bundle once per function instance, snapshots it, and starts
210
210
  * every invocation by restoring the snapshot instead of re-evaluating
211
- * the bundle — skipping the dominant share of VM startup (measured
211
+ * the bundle, skipping the dominant share of VM startup (measured
212
212
  * ~77ms → ~3ms to first suspension for a 1.3MB bundle). Bundles whose
213
213
  * module scope consumes randomness, reads the clock, or replaces a
214
214
  * serialization intrinsic are detected at hydrate time and
@@ -233,12 +233,12 @@ export declare function isVmRetentionEnabled(): boolean;
233
233
  * Whether inline step ownership is enabled (default ON). When on, the lazy
234
234
  * `step_started` that creates an inline step records the owning queue
235
235
  * message ID, and wake replays that observe an actively-owned step enqueue a
236
- * *delayed backstop* message instead of immediately requeueing it — fixing
236
+ * *delayed backstop* message instead of immediately requeueing it, fixing
237
237
  * duplicate inline step execution when a hook/wait wakes a run mid-step
238
238
  * (vercel/workflow#2780).
239
239
  *
240
240
  * `WORKFLOW_INLINE_OWNERSHIP=0` (or `false`) is the kill switch: dispatch
241
- * reverts to the unconditional immediate requeue. Stamping is unaffected —
241
+ * reverts to the unconditional immediate requeue. Stamping is unaffected:
242
242
  * the recorded ownerMessageId is inert data when the switch is off.
243
243
  */
244
244
  export declare function isInlineOwnershipEnabled(): boolean;
@@ -250,16 +250,16 @@ export declare function isInlineOwnershipEnabled(): boolean;
250
250
  * immediately; past it, they enqueue immediately (today's behavior).
251
251
  *
252
252
  * Why a fixed 860 and not a value derived from the function's `maxDuration`:
253
- * neither runtime nor build time can see the resolved value — builders emit
253
+ * neither runtime nor build time can see the resolved value: builders emit
254
254
  * `maxDuration: 'max'`, which the platform resolves per-plan at deploy, and
255
255
  * no env var or request-context deadline API exposes the result. The bound
256
256
  * comes from a platform rule instead: durations above 800s require explicit
257
257
  * per-function numeric config, so a builder-emitted `'max'` resolves to at
258
- * most 800s — 860s therefore dominates any workflow route's invocation
258
+ * most 800s, and 860s therefore dominates any workflow route's invocation
259
259
  * lifetime plus scheduling slack. Revisit when that ceiling moves (the
260
260
  * 30-minute duration beta becoming reachable via `'max'` would invalidate
261
261
  * the bound). Worlds without an invocation kill bound (world-local,
262
- * self-hosted) get no death proof from any constant — there the in-process
262
+ * self-hosted) get no death proof from any constant. There the in-process
263
263
  * single-flight layer (step-single-flight.ts) is what makes a backstop
264
264
  * firing mid-step harmless.
265
265
  *
@@ -272,13 +272,13 @@ export declare function isInlineOwnershipEnabled(): boolean;
272
272
  export declare const INLINE_OWNERSHIP_LEASE_SECONDS = 860;
273
273
  /**
274
274
  * Upper bound for the lease env override. 900s is the queue's maximum
275
- * per-message delay (SQS cap) — a longer lease would need delay chaining
275
+ * per-message delay (SQS cap). A longer lease would need delay chaining
276
276
  * like long waits use; clamp instead so one delayed message always suffices.
277
277
  */
278
278
  export declare const MAX_INLINE_OWNERSHIP_LEASE_SECONDS = 900;
279
279
  /**
280
280
  * Effective inline-ownership lease. Override via
281
- * `WORKFLOW_INLINE_OWNERSHIP_LEASE_SECONDS` — e.g. raise it on self-hosted
281
+ * `WORKFLOW_INLINE_OWNERSHIP_LEASE_SECONDS`, e.g. raise it on self-hosted
282
282
  * multi-instance worlds with long-running steps to widen the window in which
283
283
  * a live owner is protected from a concurrent backstop execution.
284
284
  */
@@ -2,16 +2,16 @@ import type { Event } from '#compiled/@workflow/world/index.js';
2
2
  /**
3
3
  * Scope for {@link countStepStartedEvents}:
4
4
  * - `{ type: 'ownedBy', messageId }` counts only starts whose
5
- * `eventData.ownerMessageId` matches — i.e. attempts performed by that
5
+ * `eventData.ownerMessageId` matches, i.e. attempts performed by that
6
6
  * owning queue message (inline lazy starts and owned-recovery re-stamps).
7
7
  * - `{ type: 'totalAttempts' }` estimates the step's genuine attempt total
8
- * across its whole lifecycle: unstamped (bare) starts — which only real
9
- * queue-dispatched background deliveries write — plus the starts of the
8
+ * across its whole lifecycle: unstamped (bare) starts, which only real
9
+ * queue-dispatched background deliveries write, plus the starts of the
10
10
  * single most-started owner. A genuine lifecycle has at most one inline
11
11
  * owner phase (ownership is claimed atomically at step creation and
12
12
  * lapses permanently at `step_retrying` or on any bare start), so taking
13
13
  * the max over owners counts that phase's real attempts while invocations
14
- * racing on the same batch — which stamp their own one-off message IDs —
14
+ * racing on the same batch, which stamp their own one-off message IDs,
15
15
  * contribute at most their single largest count instead of accumulating.
16
16
  */
17
17
  export type StepStartScope = {
@@ -29,7 +29,7 @@ export type StepStartScope = {
29
29
  * Concurrent invocations racing on the same pending batch (stale replays,
30
30
  * wake replays, a step message dispatched by a replay that lost the
31
31
  * create-claim race, ...) can each write a `step_started` for the same
32
- * logical attempt — worlds without an atomic start guard (world-local) let
32
+ * logical attempt. Worlds without an atomic start guard (world-local) let
33
33
  * all of them through. Counting those duplicates as "attempts" made the
34
34
  * maxRetries ceiling fire on healthy runs and fail them with a false
35
35
  * "exceeded max retries" (see workflow#3069).
@@ -37,11 +37,11 @@ export type StepStartScope = {
37
37
  * Callers therefore scope the count to the starts their ceiling is actually
38
38
  * about via `scope`:
39
39
  * - the inline owned-recovery ceiling counts only THIS message's starts
40
- * (`ownedBy`) — each real (re)delivery of the owning message stamps its
40
+ * (`ownedBy`): each real (re)delivery of the owning message stamps its
41
41
  * `ownerMessageId` on the start it writes, while racing invocations stamp
42
42
  * their own IDs (or none), so they no longer inflate the count;
43
43
  * - the background-step ceiling counts the lifecycle attempt total
44
- * (`totalAttempts`: bare starts plus the largest single owner's starts) —
44
+ * (`totalAttempts`: bare starts plus the largest single owner's starts),
45
45
  * so a step that exhausted part of its budget under inline ownership
46
46
  * before transitioning to queued/bare retries still trips the combined
47
47
  * ceiling, while racers' one-off stamped duplicates don't accumulate, and
@@ -11,7 +11,7 @@ export type DeploymentAffinityOutcome =
11
11
  /** Misrouted and out of budget (or unroutable); `run_failed` recorded. */
12
12
  | 'failed';
13
13
  /**
14
- * `spanAttributes` is present only on a misrouted delivery — mismatches are
14
+ * `spanAttributes` is present only on a misrouted delivery: mismatches are
15
15
  * rare, so the presence of `workflow.deployment.pinned_id` on a span *is* the
16
16
  * signal that one happened, and `recovered` separates the ones a re-route fixed
17
17
  * from the ones that kept misrouting.
@@ -22,7 +22,7 @@ export interface DeploymentAffinityResult {
22
22
  }
23
23
  /**
24
24
  * Arguments handed to a call site's re-enqueue closure. The guard owns the
25
- * policy — counting, backoff, logging, telemetry, escalation — and the call
25
+ * policy (counting, backoff, logging, telemetry, escalation) and the call
26
26
  * site owns only the shape of the message it needs to put back on the queue.
27
27
  */
28
28
  export interface ReenqueueArgs {
@@ -42,9 +42,9 @@ export interface ReenqueueArgs {
42
42
  * Guards deployment affinity: a run may only execute on the deployment it is
43
43
  * pinned to.
44
44
  *
45
- * A run's `deploymentId` is fixed when it starts — the deployment that called
45
+ * A run's `deploymentId` is fixed when it starts: the deployment that called
46
46
  * `start()`, or whatever `start({ deploymentId })` resolved to (an explicit id
47
- * or `'latest'`) — and no replay or step execution may happen anywhere else:
47
+ * or `'latest'`). No replay or step execution may happen anywhere else:
48
48
  * the bundles here may not match the run's persisted history, and any step
49
49
  * dispatched from here derives the per-run encryption key from the wrong
50
50
  * deployment's master key, which surfaces as a `RuntimeDecryptionError` the
@@ -58,8 +58,8 @@ export interface ReenqueueArgs {
58
58
  * spent, mirroring how a replay divergence gets bounded recovery replays before
59
59
  * being recorded as a corrupted event log.
60
60
  *
61
- * Callers must pass a run entity they already have in hand — every call site
62
- * loads the run for other reasons — so the guard costs no extra round trip.
61
+ * Callers must pass a run entity they already have in hand (every call site
62
+ * loads the run for other reasons), so the guard costs no extra round trip.
63
63
  * (`world.getDeploymentId()` reads the ambient deployment id, e.g.
64
64
  * `VERCEL_DEPLOYMENT_ID`, and does not call the backend either.)
65
65
  *
@@ -92,7 +92,7 @@ export declare function guardDeploymentAffinity({ world, run, requestId, retryCo
92
92
  * Ordering barrier awaited once a mismatch is confirmed, before either
93
93
  * stopping action. Under turbo the `run_started` write is backgrounded, and
94
94
  * both outcomes hand the run off (to a `run_failed` here, or to the pinned
95
- * deployment's own `run_started`) — so that write must have landed first.
95
+ * deployment's own `run_started`), so that write must have landed first.
96
96
  */
97
97
  beforeStop?: () => Promise<void>;
98
98
  }): Promise<DeploymentAffinityResult>;
@@ -10,9 +10,9 @@ export declare function getPortLazy(): Promise<number | undefined>;
10
10
  /**
11
11
  * Resets the per-process port cache. Intended for tests; not used on the hot
12
12
  * path. Callers must let any in-flight lookup settle (await the pending
13
- * `getPortLazy()` call) before resetting: clearing `_inFlight` here does not
13
+ * `getPortLazy()` call) before resetting: clearing `portState.inFlight` here does not
14
14
  * cancel an already-scheduled resolution, so a late `.then` could otherwise
15
- * repopulate `_cachedPort` after the reset and bleed into the next test.
15
+ * repopulate `portState.cachedPort` after the reset and bleed into the next test.
16
16
  */
17
17
  export declare function resetPortCacheForTesting(): void;
18
18
  /**
@@ -9,9 +9,9 @@
9
9
  *
10
10
  * Resolution order, in priority:
11
11
  *
12
- * 1. `globalThis[WorldCacheKey]` — populated by a successful prior
12
+ * 1. `globalThis[WorldCacheKey]`: populated by a successful prior
13
13
  * `getWorld()` call. This is the steady-state hot path.
14
- * 2. `globalThis[GetWorldFnKey]` — populated by the module-load side
14
+ * 2. `globalThis[GetWorldFnKey]`: populated by the module-load side
15
15
  * effect at the bottom of `./world.ts`. Fires on every server bundle
16
16
  * that reaches this file via `workflow` or `workflow/api` (which import
17
17
  * `./world-init.ts` for its side effect; see that file for the full
@@ -20,7 +20,7 @@ export interface HealthCheckResult {
20
20
  /**
21
21
  * `@workflow/core` version of the responding deployment, used for
22
22
  * capability detection (see `getRunCapabilities`). Omitted when the
23
- * responding deployment did not provide the field as a string —
23
+ * responding deployment did not provide the field as a string:
24
24
  * for example, an older `@workflow/core` that predates this field,
25
25
  * or a non-JSON plain-text health response.
26
26
  */
@@ -35,15 +35,15 @@ export interface HealthCheckResult {
35
35
  */
36
36
  encryptionPublicKey?: string;
37
37
  /**
38
- * The responding deployment's `HOOK_RESUME_INPUT_VERSION` — the protocol
39
- * version at which the *consumer* (queue-message target) re-ensures the
38
+ * The responding deployment's `HOOK_RESUME_INPUT_VERSION`: the protocol
39
+ * version at which the *consumer* (queue-message target) materializes the
40
40
  * `hook_received` event from `hookInput` on replay. A cross-deployment
41
41
  * `start()` stamps the *target's* value (not the caller's) into the new
42
- * run's `executionContext.hookResumeInputVersion` so that `resumeHook()`
43
- * only takes the parallel path when the deployment that will actually
44
- * consume the queue message is known to honor `hookInput`. Omitted when the
45
- * responding deployment predates this field (an older consumer that ignores
46
- * `hookInput`), which fails the gate closed.
42
+ * run's `executionContext.hookResumeInputVersion`. Current producers write
43
+ * the event durably before publishing the wake and do not read the marker;
44
+ * OLDER producers still gate their lazy path on it, so it keeps being
45
+ * stamped. Omitted when the responding deployment predates this field,
46
+ * which fails that gate closed.
47
47
  */
48
48
  hookResumeInputVersion?: number;
49
49
  }
@@ -75,7 +75,7 @@ export interface HealthCheckOptions {
75
75
  * Queue namespace of the target deployment (e.g. `'eve'` for topics like
76
76
  * `__eve_wkf_workflow_*`). Falls back to `WORKFLOW_QUEUE_NAMESPACE` in the
77
77
  * calling process. Cross-context callers (e.g. the observability
78
- * dashboard) must pass the target deployment's namespace explicitly —
78
+ * dashboard) must pass the target deployment's namespace explicitly:
79
79
  * the env fallback resolves in the caller's process, and a message
80
80
  * published to a mismatched topic has no consumer, so the check would
81
81
  * always time out.
@@ -93,7 +93,7 @@ export declare function healthCheck(world: World, options?: HealthCheckOptions):
93
93
  * re-sorted. Every append source is already in canonical order relative to the
94
94
  * tail (a cursor-delimited page, or a write-response delta), so receipt order is
95
95
  * the order to keep, and re-sorting here would only cost a pass over the log.
96
- * Nothing downstream may assume the tail is the newest event — see
96
+ * Nothing downstream may assume the tail is the newest event. See
97
97
  * {@link maxEventSlot}.
98
98
  */
99
99
  export declare function appendUniqueEvents(target: Event[], events: readonly Event[], targetIds?: Set<string>): void;
@@ -104,7 +104,7 @@ export declare function appendUniqueEvents(target: Event[], events: readonly Eve
104
104
  *
105
105
  * `preloadedEvents` is loaded `sortOrder: 'asc'` and is never re-sorted
106
106
  * client-side, so a `hook_received` spliced in by the lazy-resume consumer must
107
- * land in `eventId` order — a plain `push` would place a late-committing
107
+ * land in `eventId` order: a plain `push` would place a late-committing
108
108
  * earlier event after events that sort before it, corrupting replay.
109
109
  *
110
110
  * Lexicographic string order is the log's order: a slot id is a fixed-width
@@ -190,7 +190,7 @@ export interface SkippedSlotReport {
190
190
  * would raise the log's highest position past a position whose event is
191
191
  * missing. Later writes read that maximum to say what they have seen, so each
192
192
  * would claim a position it never saw, and the World only reports the span a
193
- * write skips — it would never send the missing one. Dropping costs one more
193
+ * write skips: it would never send the missing one. Dropping costs one more
194
194
  * round of the same events on the next write and keeps the log a prefix of the
195
195
  * truth, which the note above {@link mergeReportedEvents} explains is always an
196
196
  * available answer.
@@ -265,7 +265,7 @@ export declare function findEventSlotGap(events: readonly Event[]): EventSlotGap
265
265
  *
266
266
  * A hole can be transient. The World allocates a slot inside the insert that
267
267
  * occupies it, so two concurrent writers can collide, one retry past the other,
268
- * and the higher slot commit first — leaving a window in which the lower one is
268
+ * and the higher slot commit first, leaving a window in which the lower one is
269
269
  * genuinely absent from a strongly-consistent read and fills in a moment later.
270
270
  * The window is one commit wide, so a short backoff clears it; anything that
271
271
  * survives all three re-reads is a position no write will ever occupy.
@@ -276,7 +276,7 @@ export declare const SLOT_GAP_RECHECK_ATTEMPTS = 3;
276
276
  * out, and return the settled log alongside the hole that survived.
277
277
  *
278
278
  * Reads are strongly consistent, so a hole is not an artifact of *when* the log
279
- * was read — but it can be an artifact of a write that had not committed yet
279
+ * was read, but it can be an artifact of a write that had not committed yet
280
280
  * (see {@link SLOT_GAP_RECHECK_ATTEMPTS}). Distinguishing the two costs a
281
281
  * re-read, which is only ever paid by a replay that already found a hole.
282
282
  *
@@ -295,7 +295,7 @@ export declare function settleEventSlotGap(runId: string, loaded: LoadedEventLog
295
295
  * One integer says it because the World keeps its positions dense: a writer
296
296
  * that names slot N is claiming to hold every event from 1 to N and nothing
297
297
  * above. The World answers by numbering the write above whatever the log has
298
- * actually reached and handing back the events on the slots in between — the
298
+ * actually reached and handing back the events on the slots in between: the
299
299
  * ones this writer decided without.
300
300
  *
301
301
  * Density is the World's invariant, not a claim about this particular read. A
@@ -326,14 +326,14 @@ export declare function slotSnapshotParams(events: readonly Event[]): SlotSnapsh
326
326
  * The events a rejecting World attached to a `PreconditionFailedError`, when it
327
327
  * returned the ones the client's snapshot was missing inline.
328
328
  *
329
- * Returns `null` for anything else — no details, a World that did not implement
329
+ * Returns `null` for anything else: no details, a World that did not implement
330
330
  * this, or a payload that does not narrow cleanly. Callers fall back to
331
331
  * reloading the event log, which is always correct; this is untrusted-shaped
332
332
  * data on a failure path, so nothing here is repaired.
333
333
  *
334
334
  * `runId` is the caller's run. Every event must belong to it: the delta is
335
335
  * merged straight into the replay's log, and one foreign event there is a
336
- * corrupt log rather than a corrected one — the replay would consume a
336
+ * corrupt log rather than a corrected one: the replay would consume a
337
337
  * correlation id for an event that does not exist on this run.
338
338
  */
339
339
  export declare function preconditionEventDelta(error: unknown, runId: string): {
@@ -349,19 +349,19 @@ export type EventCreator = (data: CreateEventRequest, params?: CreateEventParams
349
349
  export declare function withHealthCheck(handler: (req: Request) => Promise<Response>, worldSpecVersion?: number): (req: Request) => Promise<Response>;
350
350
  /**
351
351
  * Idempotency key for a step's background-dispatch queue message, scoped to
352
- * the step's IDENTITY — correlation id plus (hashed) step name — rather than
352
+ * the step's IDENTITY, correlation id plus (hashed) step name, rather than
353
353
  * the bare correlation id.
354
354
  *
355
355
  * The scoping matters for resilient step dispatch under the precondition
356
356
  * guard: a guard-rejected `step_created` leaves its (revoked) step message in
357
357
  * flight, and the corrected replay may re-derive the same correlation id for
358
358
  * a DIFFERENT step. Under a bare-correlationId key the corrected replay's
359
- * dispatch would silently dedupe against the revoked in-flight message —
359
+ * dispatch would silently dedupe against the revoked in-flight message,
360
360
  * which then resolves `skipped` against the re-created entity (the server's
361
- * stepName fence rejects its bare start) — and the legitimate step would
361
+ * stepName fence rejects its bare start), and the legitimate step would
362
362
  * never be executed. Scoping by step name keeps every dedup property that
363
363
  * matters (crash recovery re-dispatch, concurrent handlers, the delayed
364
- * retry sharing the suspension re-dispatch's key — all name the same step)
364
+ * retry sharing the suspension re-dispatch's key: all name the same step)
365
365
  * while letting the corrected schedule's dispatch through.
366
366
  *
367
367
  * Every producer of a step-dispatch (or step-retry) message must use this
@@ -382,34 +382,15 @@ export declare function getQueueOverhead(message: {
382
382
  [k: string]: number;
383
383
  } | undefined;
384
384
  /**
385
- * Returns a memoized accessor for a run's full encryption capability.
386
- *
387
- * The first call resolves the run's key material via
388
- * `world.getEncryptionKeyForRun` (which may do HKDF derivation locally on
389
- * Vercel, or a network fetch from external contexts) and derives a
390
- * {@link PayloadKey} from it; subsequent calls await the same cached promise.
391
- * If the world doesn't support encryption or the run has no key configured,
392
- * the cached value is `undefined`.
393
- *
394
- * The resolved value is deliberately the *full* capability — the symmetric AES
395
- * key plus the run's X25519 keypair — not just a `CryptoKey`. A run reading
396
- * its own event log can encounter sealed (`encp`) payloads that another run
397
- * wrote to it (a cross-deployment hook resumption, say), and opening those
398
- * needs the keypair. Resolving only the symmetric key would leave those
399
- * payloads unopenable and wedge the run.
400
- *
401
- * Used by step / workflow handlers to defer the (potentially expensive)
402
- * key fetch until the first code path that actually needs it — typically
403
- * input hydration on the success path, or error dehydration on a failure
404
- * path. Both paths can race-call the accessor without triggering duplicate
405
- * fetches.
406
- *
407
- * Errors thrown by `getEncryptionKeyForRun` propagate to every caller
408
- * (the cached promise rejects). This is intentional: when encryption is
409
- * configured, we never want to silently fall back to plaintext
410
- * serialization. A propagated error in an event-emission path leaves the
411
- * outer try/catch to log and surface the issue; the queue's redelivery
412
- * semantics will retry the key fetch on the next attempt.
385
+ * Resolve the run's full payload-encryption capability. This includes the
386
+ * symmetric key and X25519 keypair needed to open cross-run sealed payloads.
387
+ * Missing world support or key material resolves to `undefined`; lookup and
388
+ * derivation failures propagate rather than silently falling back to plaintext.
389
+ */
390
+ export declare function resolveRunEncryptionKey(world: World, runOrId: WorkflowRun | string, context?: Record<string, unknown>): Promise<PayloadKey | undefined>;
391
+ /**
392
+ * Return a lazy, memoized accessor around {@link resolveRunEncryptionKey}.
393
+ * Concurrent callers share the same promise, including its rejection.
413
394
  */
414
395
  export declare function memoizeEncryptionKey(world: World, runOrId: WorkflowRun | string): () => Promise<PayloadKey | undefined>;
415
396
  //# sourceMappingURL=helpers.d.ts.map