workflow 5.0.0-beta.43 → 5.0.0-beta.44

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 (182) hide show
  1. package/README.md +6 -4
  2. package/dist/internal/builtins.d.ts +4 -4
  3. package/dist/internal/builtins.js +6 -6
  4. package/docs/ai/chat-session-modeling.mdx +23 -24
  5. package/docs/ai/defining-tools.mdx +5 -6
  6. package/docs/ai/human-in-the-loop.mdx +11 -11
  7. package/docs/ai/index.mdx +20 -20
  8. package/docs/ai/message-queueing.mdx +6 -6
  9. package/docs/ai/meta.json +1 -0
  10. package/docs/ai/resumable-streams.mdx +28 -28
  11. package/docs/ai/sleep-and-delays.mdx +9 -9
  12. package/docs/ai/streaming-updates-from-tools.mdx +4 -4
  13. package/docs/api-reference/vitest/index.mdx +8 -8
  14. package/docs/api-reference/workflow/create-hook.mdx +15 -15
  15. package/docs/api-reference/workflow/create-webhook.mdx +15 -15
  16. package/docs/api-reference/workflow/define-hook.mdx +10 -10
  17. package/docs/api-reference/workflow/fatal-error.mdx +2 -2
  18. package/docs/api-reference/workflow/fetch.mdx +7 -7
  19. package/docs/api-reference/workflow/get-step-metadata.mdx +2 -2
  20. package/docs/api-reference/workflow/get-workflow-metadata.mdx +3 -3
  21. package/docs/api-reference/workflow/get-writable.mdx +7 -7
  22. package/docs/api-reference/workflow/index.mdx +1 -1
  23. package/docs/api-reference/workflow/retryable-error.mdx +1 -1
  24. package/docs/api-reference/workflow/set-attributes.mdx +2 -2
  25. package/docs/api-reference/workflow/sleep.mdx +3 -3
  26. package/docs/api-reference/workflow-ai/durable-agent.mdx +42 -42
  27. package/docs/api-reference/workflow-ai/index.mdx +3 -3
  28. package/docs/api-reference/workflow-ai/workflow-chat-transport.mdx +28 -28
  29. package/docs/api-reference/workflow-api/get-hook-by-token.mdx +11 -11
  30. package/docs/api-reference/workflow-api/get-run.mdx +10 -10
  31. package/docs/api-reference/workflow-api/index.mdx +2 -4
  32. package/docs/api-reference/workflow-api/resume-hook.mdx +14 -14
  33. package/docs/api-reference/workflow-api/resume-webhook.mdx +3 -3
  34. package/docs/api-reference/workflow-api/start.mdx +16 -15
  35. package/docs/api-reference/workflow-astro/workflow.mdx +3 -3
  36. package/docs/api-reference/workflow-errors/entity-conflict-error.mdx +4 -4
  37. package/docs/api-reference/workflow-errors/hook-conflict-error.mdx +4 -4
  38. package/docs/api-reference/workflow-errors/hook-not-found-error.mdx +8 -8
  39. package/docs/api-reference/workflow-errors/index.mdx +6 -6
  40. package/docs/api-reference/workflow-errors/precondition-failed-error.mdx +9 -9
  41. package/docs/api-reference/workflow-errors/run-expired-error.mdx +2 -2
  42. package/docs/api-reference/workflow-errors/run-not-supported-error.mdx +4 -4
  43. package/docs/api-reference/workflow-errors/step-not-registered-error.mdx +5 -5
  44. package/docs/api-reference/workflow-errors/throttle-error.mdx +2 -2
  45. package/docs/api-reference/workflow-errors/too-early-error.mdx +2 -2
  46. package/docs/api-reference/workflow-errors/workflow-error.mdx +4 -4
  47. package/docs/api-reference/workflow-errors/workflow-not-registered-error.mdx +5 -6
  48. package/docs/api-reference/workflow-errors/workflow-run-cancelled-error.mdx +6 -6
  49. package/docs/api-reference/workflow-errors/workflow-run-failed-error.mdx +5 -5
  50. package/docs/api-reference/workflow-errors/workflow-run-not-completed-error.mdx +4 -4
  51. package/docs/api-reference/workflow-errors/workflow-run-not-found-error.mdx +4 -4
  52. package/docs/api-reference/workflow-errors/workflow-runtime-error.mdx +2 -2
  53. package/docs/api-reference/workflow-errors/workflow-world-error.mdx +8 -8
  54. package/docs/api-reference/workflow-globals.mdx +12 -11
  55. package/docs/api-reference/workflow-nest/configure-workflow-controller.mdx +2 -2
  56. package/docs/api-reference/workflow-nest/nest-local-builder.mdx +4 -4
  57. package/docs/api-reference/workflow-nest/workflow-controller.mdx +1 -1
  58. package/docs/api-reference/workflow-nest/workflow-module.mdx +4 -4
  59. package/docs/api-reference/workflow-next/with-workflow.mdx +16 -16
  60. package/docs/api-reference/workflow-nitro/index.mdx +6 -6
  61. package/docs/api-reference/workflow-nuxt/index.mdx +4 -4
  62. package/docs/api-reference/workflow-observability/hydrate-data.mdx +5 -5
  63. package/docs/api-reference/workflow-observability/hydrate-resource-io.mdx +4 -4
  64. package/docs/api-reference/workflow-observability/index.mdx +6 -8
  65. package/docs/api-reference/workflow-observability/observability-revivers.mdx +2 -2
  66. package/docs/api-reference/workflow-observability/parse-class-name.mdx +3 -3
  67. package/docs/api-reference/workflow-observability/parse-step-name.mdx +4 -4
  68. package/docs/api-reference/workflow-observability/parse-workflow-name.mdx +4 -4
  69. package/docs/api-reference/workflow-runtime/create-world.mdx +8 -8
  70. package/docs/api-reference/workflow-runtime/get-world-handlers.mdx +6 -6
  71. package/docs/api-reference/workflow-runtime/get-world.mdx +4 -4
  72. package/docs/api-reference/workflow-runtime/health-check.mdx +1 -1
  73. package/docs/api-reference/workflow-runtime/index.mdx +2 -4
  74. package/docs/api-reference/workflow-runtime/set-world.mdx +15 -13
  75. package/docs/api-reference/workflow-runtime/workflow-entrypoint.mdx +6 -5
  76. package/docs/api-reference/workflow-runtime/world/analytics.mdx +9 -9
  77. package/docs/api-reference/workflow-runtime/world/index.mdx +5 -3
  78. package/docs/api-reference/workflow-runtime/world/queue.mdx +11 -11
  79. package/docs/api-reference/workflow-runtime/world/storage.mdx +62 -28
  80. package/docs/api-reference/workflow-runtime/world/streams.mdx +7 -7
  81. package/docs/api-reference/workflow-serde/index.mdx +1 -1
  82. package/docs/api-reference/workflow-serde/workflow-deserialize.mdx +2 -2
  83. package/docs/api-reference/workflow-serde/workflow-serialize.mdx +7 -7
  84. package/docs/api-reference/workflow-sveltekit/workflow-plugin.mdx +3 -3
  85. package/docs/api-reference/workflow-vite/workflow.mdx +5 -5
  86. package/docs/changelog/attributes-mvp.mdx +39 -39
  87. package/docs/changelog/batched-event-writes.mdx +12 -12
  88. package/docs/changelog/eager-processing.mdx +63 -63
  89. package/docs/changelog/index.mdx +3 -3
  90. package/docs/changelog/lazy-event-creation.md +27 -27
  91. package/docs/changelog/resilient-resume.mdx +5 -5
  92. package/docs/changelog/resilient-start.mdx +14 -14
  93. package/docs/changelog/step-message-ownership.mdx +47 -47
  94. package/docs/changelog/turbo-mode.md +20 -20
  95. package/docs/comparisons/index.mdx +13 -13
  96. package/docs/comparisons/workflow-sdk-vs-aws-agentcore.mdx +15 -15
  97. package/docs/comparisons/workflow-sdk-vs-aws-step-functions.mdx +12 -12
  98. package/docs/comparisons/workflow-sdk-vs-cloudflare-workflows.mdx +11 -11
  99. package/docs/comparisons/workflow-sdk-vs-inngest.mdx +19 -19
  100. package/docs/comparisons/workflow-sdk-vs-temporal.mdx +23 -23
  101. package/docs/comparisons/workflow-sdk-vs-trigger-dev.mdx +18 -17
  102. package/docs/configuration/build-and-diagnostics.mdx +5 -5
  103. package/docs/configuration/cli-and-web-ui.mdx +4 -4
  104. package/docs/configuration/runtime-tuning.mdx +86 -23
  105. package/docs/configuration/worlds.mdx +28 -14
  106. package/docs/cookbook/advanced/child-workflows.mdx +25 -25
  107. package/docs/cookbook/advanced/publishing-libraries.mdx +40 -40
  108. package/docs/cookbook/advanced/serializable-steps.mdx +21 -21
  109. package/docs/cookbook/advanced/upgrading-workflows.mdx +31 -31
  110. package/docs/cookbook/agent-patterns/agent-cancellation.mdx +20 -20
  111. package/docs/cookbook/agent-patterns/human-in-the-loop.mdx +22 -22
  112. package/docs/cookbook/common-patterns/batching.mdx +14 -14
  113. package/docs/cookbook/common-patterns/idempotency.mdx +9 -9
  114. package/docs/cookbook/common-patterns/rate-limiting.mdx +3 -3
  115. package/docs/cookbook/common-patterns/saga.mdx +19 -19
  116. package/docs/cookbook/common-patterns/scheduling.mdx +23 -23
  117. package/docs/cookbook/common-patterns/sequential-and-parallel.mdx +26 -26
  118. package/docs/cookbook/common-patterns/timeouts.mdx +23 -23
  119. package/docs/cookbook/common-patterns/webhooks.mdx +6 -6
  120. package/docs/cookbook/common-patterns/workflow-composition.mdx +19 -19
  121. package/docs/cookbook/index.mdx +22 -22
  122. package/docs/cookbook/integrations/ai-sdk.mdx +43 -41
  123. package/docs/cookbook/integrations/chat-sdk.mdx +34 -34
  124. package/docs/cookbook/integrations/sandbox.mdx +46 -46
  125. package/docs/deploying.mdx +15 -15
  126. package/docs/errors/abort-signal-timeout-in-workflow.mdx +12 -12
  127. package/docs/errors/corrupted-event-log.mdx +11 -11
  128. package/docs/errors/deployment-mismatch.mdx +14 -14
  129. package/docs/errors/fetch-in-workflow.mdx +8 -8
  130. package/docs/errors/hook-conflict.mdx +11 -11
  131. package/docs/errors/index.mdx +1 -1
  132. package/docs/errors/node-js-module-in-workflow.mdx +5 -5
  133. package/docs/errors/replay-divergence.mdx +2 -2
  134. package/docs/errors/runtime-decryption-failed.mdx +12 -12
  135. package/docs/errors/serialization-failed.mdx +40 -12
  136. package/docs/errors/start-invalid-workflow-function.mdx +5 -5
  137. package/docs/errors/step-executed-multiple-times.mdx +2 -2
  138. package/docs/errors/step-not-registered.mdx +5 -5
  139. package/docs/errors/timeout-in-workflow.mdx +8 -8
  140. package/docs/errors/webhook-invalid-respond-with-value.mdx +18 -18
  141. package/docs/errors/webhook-response-not-sent.mdx +16 -16
  142. package/docs/errors/workflow-not-registered.mdx +5 -5
  143. package/docs/foundations/cancellation.mdx +31 -31
  144. package/docs/foundations/errors-and-retries.mdx +42 -11
  145. package/docs/foundations/hooks.mdx +35 -35
  146. package/docs/foundations/idempotency.mdx +9 -9
  147. package/docs/foundations/serialization.mdx +21 -22
  148. package/docs/foundations/starting-workflows.mdx +36 -37
  149. package/docs/foundations/streaming.mdx +46 -41
  150. package/docs/foundations/versioning.mdx +3 -3
  151. package/docs/foundations/workflows-and-steps.mdx +9 -9
  152. package/docs/getting-started/astro.mdx +16 -16
  153. package/docs/getting-started/express.mdx +8 -8
  154. package/docs/getting-started/fastify.mdx +8 -8
  155. package/docs/getting-started/hono.mdx +8 -8
  156. package/docs/getting-started/nestjs.mdx +18 -17
  157. package/docs/getting-started/next.mdx +11 -11
  158. package/docs/getting-started/nitro.mdx +16 -16
  159. package/docs/getting-started/nuxt.mdx +8 -8
  160. package/docs/getting-started/python.mdx +4 -4
  161. package/docs/getting-started/react-router/v7.mdx +1 -1
  162. package/docs/getting-started/react-router/v8.mdx +1 -1
  163. package/docs/getting-started/sveltekit.mdx +14 -14
  164. package/docs/getting-started/tanstack-start.mdx +12 -12
  165. package/docs/getting-started/vite.mdx +8 -8
  166. package/docs/how-it-works/cancellation.mdx +62 -62
  167. package/docs/how-it-works/code-transform.mdx +66 -54
  168. package/docs/how-it-works/encryption.mdx +25 -21
  169. package/docs/how-it-works/event-sourcing.mdx +53 -35
  170. package/docs/how-it-works/framework-integrations.mdx +12 -12
  171. package/docs/how-it-works/understanding-directives.mdx +21 -21
  172. package/docs/internal/index.mdx +6 -6
  173. package/docs/internal/nitro-native-build.mdx +2 -2
  174. package/docs/internal/nitro-web-ui.mdx +4 -4
  175. package/docs/internal/serializable-abort-controller.mdx +7 -7
  176. package/docs/observability/attributes.mdx +3 -3
  177. package/docs/observability/index.mdx +14 -10
  178. package/docs/observability/tracing.mdx +10 -10
  179. package/docs/testing/index.mdx +33 -33
  180. package/docs/testing/server-based.mdx +10 -10
  181. package/docs/whats-new.mdx +185 -0
  182. package/package.json +12 -12
@@ -10,7 +10,7 @@ related:
10
10
  - /docs/api-reference/workflow-runtime/world/storage
11
11
  ---
12
12
 
13
- Hydrates (deserializes) the data fields of a resource returned by the [World SDK](/docs/api-reference/workflow-runtime/world) a workflow run, step, hook, or event. Workflow data is serialized using the [devalue](https://github.com/Rich-Harris/devalue) format, so this is required before displaying step input/output in a UI.
13
+ Hydrates (deserializes) the data fields of a resource returned by the [World SDK](/docs/api-reference/workflow-runtime/world): a workflow run, step, hook, or event. Workflow data is serialized using the [devalue](https://github.com/Rich-Harris/devalue) format, so this is required before displaying step input/output in a user interface.
14
14
 
15
15
  The function dispatches on the resource shape: steps get `input`/`output` hydrated, hooks get `metadata`, events get `eventData`, and runs get `input`/`output`.
16
16
 
@@ -26,7 +26,7 @@ const hydrated = hydrateResourceIO(step, observabilityRevivers); // [!code highl
26
26
  console.log(hydrated.input, hydrated.output);
27
27
  ```
28
28
 
29
- ## API Signature
29
+ ## API signature
30
30
 
31
31
  ### Parameters
32
32
 
@@ -40,12 +40,12 @@ console.log(hydrated.input, hydrated.output);
40
40
  The same resource with its data fields hydrated into plain JavaScript values.
41
41
 
42
42
  <Callout type="info">
43
- Encrypted data fields pass through as raw `Uint8Array` values rather than being decrypted see [Encrypted Data](/docs/api-reference/workflow-observability#encrypted-data).
43
+ Encrypted data fields pass through as raw `Uint8Array` values rather than being decrypted. See [Encrypted Data](/docs/api-reference/workflow-observability#encrypted-data).
44
44
  </Callout>
45
45
 
46
46
  ## Examples
47
47
 
48
- ### Display a Run's Steps with Hydrated I/O
48
+ ### Display a run's steps with hydrated I/O
49
49
 
50
50
  ```typescript lineNumbers
51
51
  import { getWorld } from "workflow/runtime";
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  title: "workflow/observability"
3
- description: Utilities to hydrate serialized step I/O and parse machine-readable workflow names for display.
3
+ description: Utilities to hydrate serialized step input/output (I/O) and parse machine-readable workflow names for display.
4
4
  type: overview
5
5
  summary: Explore utilities for hydrating serialized workflow data and parsing display names in observability tools.
6
6
  keywords:
@@ -16,9 +16,7 @@ keywords:
16
16
  - display name parsing
17
17
  ---
18
18
 
19
- API reference for observability utilities from the `workflow/observability` package.
20
-
21
- The observability package provides utilities for working with workflow data in observability and debugging tools — hydrating serialized step I/O for display, and parsing machine-readable names into display-friendly formats.
19
+ The `workflow/observability` package provides utilities for observability and debugging tools. Use it to hydrate serialized step input/output (I/O) for display and parse machine-readable names into display-friendly formats.
22
20
 
23
21
  ```typescript lineNumbers
24
22
  import { // [!code highlight]
@@ -31,7 +29,7 @@ import { // [!code highlight]
31
29
  } from "workflow/observability"; // [!code highlight]
32
30
  ```
33
31
 
34
- ## Data Hydration
32
+ ## Data hydration
35
33
 
36
34
  <Cards>
37
35
  <Card href="/docs/api-reference/workflow-observability/hydrate-resource-io" title="hydrateResourceIO()">
@@ -45,7 +43,7 @@ import { // [!code highlight]
45
43
  </Card>
46
44
  </Cards>
47
45
 
48
- ## Name Parsing
46
+ ## Name parsing
49
47
 
50
48
  <Cards>
51
49
  <Card href="/docs/api-reference/workflow-observability/parse-step-name" title="parseStepName()">
@@ -59,6 +57,6 @@ import { // [!code highlight]
59
57
  </Card>
60
58
  </Cards>
61
59
 
62
- ## Encrypted Data
60
+ ## Encrypted data
63
61
 
64
- When a [World](/docs/api-reference/workflow-runtime/world) stores encrypted data, the hydration utilities intentionally leave encrypted values untouched: [`hydrateData()`](/docs/api-reference/workflow-observability/hydrate-data) and [`hydrateResourceIO()`](/docs/api-reference/workflow-observability/hydrate-resource-io) return encrypted fields as raw `Uint8Array` values so observability tools can detect them and decide how to render them (for example, the Workflow CLI shows an "Encrypted" placeholder). Decryption is handled by the runtime and the World implementation see [Encryption](/docs/how-it-works/encryption) for how keys are managed.
62
+ When a [World](/docs/api-reference/workflow-runtime/world) stores encrypted data, the hydration utilities intentionally leave encrypted values untouched: [`hydrateData()`](/docs/api-reference/workflow-observability/hydrate-data) and [`hydrateResourceIO()`](/docs/api-reference/workflow-observability/hydrate-resource-io) return encrypted fields as raw `Uint8Array` values so observability tools can detect them and decide how to render them (for example, the Workflow CLI shows an "Encrypted" placeholder). Decryption is handled by the runtime and the World implementation. See [Encryption](/docs/how-it-works/encryption) for how keys are managed.
@@ -8,7 +8,7 @@ related:
8
8
  - /docs/api-reference/workflow-observability/hydrate-data
9
9
  ---
10
10
 
11
- A set of reviver functions that handle the workflow serialization format's workflow-specific types streams, step/workflow function references, class instances, `AbortController`/`AbortSignal`, and `DOMException` reviving them as display-friendly marker objects or strings. Built-in JavaScript types (`Date`, `Map`, `Set`, `RegExp`, etc.) are handled by the devalue format itself and need no revivers.
11
+ A set of reviver functions that handle the workflow serialization format's workflow-specific types (streams, step/workflow function references, class instances, `AbortController`/`AbortSignal`, and `DOMException`), reviving them as display-friendly marker objects or strings. Built-in JavaScript types (`Date`, `Map`, `Set`, `RegExp`, etc.) are handled by the devalue format itself and need no revivers.
12
12
 
13
13
  Pass it as the `revivers` argument to [`hydrateResourceIO()`](/docs/api-reference/workflow-observability/hydrate-resource-io) or [`hydrateData()`](/docs/api-reference/workflow-observability/hydrate-data).
14
14
 
@@ -20,7 +20,7 @@ declare const step: Step; // @setup
20
20
  const hydrated = hydrateResourceIO(step, observabilityRevivers); // [!code highlight]
21
21
  ```
22
22
 
23
- ## API Signature
23
+ ## API signature
24
24
 
25
25
  ```typescript
26
26
  import type { Revivers } from "workflow/observability";
@@ -9,7 +9,7 @@ related:
9
9
  - /docs/api-reference/workflow-serde
10
10
  ---
11
11
 
12
- Serialized class instances reference their class with machine-readable IDs like `class//./src/models//User`. This function parses them into components suitable for display in a UI.
12
+ Serialized class instances reference their class with machine-readable IDs like `class//./src/models//User`. This function parses them into components suitable for display in a user interface.
13
13
 
14
14
  ```typescript lineNumbers
15
15
  import { parseClassName } from "workflow/observability"; // [!code highlight]
@@ -20,7 +20,7 @@ const parsed = parseClassName("class//./src/models//User"); // [!code highlight]
20
20
  // parsed?.functionName → "User"
21
21
  ```
22
22
 
23
- ## API Signature
23
+ ## API signature
24
24
 
25
25
  ### Parameters
26
26
 
@@ -35,7 +35,7 @@ const parsed = parseClassName("class//./src/models//User"); // [!code highlight]
35
35
  | Property | Description |
36
36
  |----------|-------------|
37
37
  | `shortName` | The display name of the class (e.g. `"User"`). |
38
- | `moduleSpecifier` | The module the class is defined in a relative path (`./src/models`) or a package specifier (`point@0.0.1`). |
38
+ | `moduleSpecifier` | The module the class is defined in: a relative path (`./src/models`) or a package specifier (`point@0.0.1`). |
39
39
  | `functionName` | The class name as recorded by the compiler. |
40
40
 
41
41
  Returns `null` when the input is not a valid class ID.
@@ -8,7 +8,7 @@ related:
8
8
  - /docs/api-reference/workflow-observability/parse-class-name
9
9
  ---
10
10
 
11
- Step names are stored as machine-readable identifiers like `step//./src/workflows/order//processPayment`. This function parses them into components suitable for display in a UI.
11
+ Step names are stored as machine-readable identifiers like `step//./src/workflows/order//processPayment`. This function parses them into components suitable for display in a user interface.
12
12
 
13
13
  ```typescript lineNumbers
14
14
  import { parseStepName } from "workflow/observability"; // [!code highlight]
@@ -19,7 +19,7 @@ const parsed = parseStepName("step//./src/workflows/order//processPayment"); //
19
19
  // parsed?.functionName → "processPayment"
20
20
  ```
21
21
 
22
- ## API Signature
22
+ ## API signature
23
23
 
24
24
  ### Parameters
25
25
 
@@ -33,8 +33,8 @@ const parsed = parseStepName("step//./src/workflows/order//processPayment"); //
33
33
 
34
34
  | Property | Description |
35
35
  |----------|-------------|
36
- | `shortName` | The display name the last segment of the function name. For nested steps like `processOrder/chargeCard`, this is `"chargeCard"`. |
37
- | `moduleSpecifier` | The module the step is defined in a relative path (`./src/workflows/order`) or a package specifier (`@myorg/tasks@2.0.0`). |
36
+ | `shortName` | The display name: the last segment of the function name. For nested steps like `processOrder/chargeCard`, this is `"chargeCard"`. |
37
+ | `moduleSpecifier` | The module the step is defined in: a relative path (`./src/workflows/order`) or a package specifier (`@myorg/tasks@2.0.0`). |
38
38
  | `functionName` | The full function name including nesting (e.g. `processOrder/chargeCard`). |
39
39
 
40
40
  Returns `null` when the input is not a valid step name.
@@ -8,7 +8,7 @@ related:
8
8
  - /docs/api-reference/workflow-observability/parse-class-name
9
9
  ---
10
10
 
11
- Workflow names are stored as machine-readable identifiers like `workflow//./src/workflows/order//processOrder`. This function parses them into components suitable for display in a UI for example when listing runs from the [World SDK](/docs/api-reference/workflow-runtime/world/storage), where `run.workflowName` holds the machine-readable form.
11
+ Workflow names are stored as machine-readable identifiers like `workflow//./src/workflows/order//processOrder`. This function parses them into components suitable for display in a user interface, for example when listing runs from the [World SDK](/docs/api-reference/workflow-runtime/world/storage), where `run.workflowName` holds the machine-readable form.
12
12
 
13
13
  ```typescript lineNumbers
14
14
  import { parseWorkflowName } from "workflow/observability"; // [!code highlight]
@@ -19,7 +19,7 @@ const parsed = parseWorkflowName("workflow//./src/workflows/order//processOrder"
19
19
  // parsed?.functionName → "processOrder"
20
20
  ```
21
21
 
22
- ## API Signature
22
+ ## API signature
23
23
 
24
24
  ### Parameters
25
25
 
@@ -34,12 +34,12 @@ const parsed = parseWorkflowName("workflow//./src/workflows/order//processOrder"
34
34
  | Property | Description |
35
35
  |----------|-------------|
36
36
  | `shortName` | The display name. For default exports, falls back to the module's short name (e.g. `"order"` for `./src/workflows/order`). |
37
- | `moduleSpecifier` | The module the workflow is defined in a relative path (`./src/workflows/order`) or a package specifier (`@myorg/flows@1.0.0`). |
37
+ | `moduleSpecifier` | The module the workflow is defined in: a relative path (`./src/workflows/order`) or a package specifier (`@myorg/flows@1.0.0`). |
38
38
  | `functionName` | The full exported function name. |
39
39
 
40
40
  Returns `null` when the input is not a valid workflow name.
41
41
 
42
- ## Example: List Runs with Display Names
42
+ ## Example: list runs with display names
43
43
 
44
44
  ```typescript lineNumbers
45
45
  import { getWorld } from "workflow/runtime";
@@ -2,16 +2,16 @@
2
2
  title: createWorld
3
3
  description: Create a new World instance from environment configuration.
4
4
  type: reference
5
- summary: Use createWorld to instantiate a World from WORKFLOW_TARGET_WORLD environment configuration, bypassing the cached instance.
5
+ summary: Use createWorld to construct a fresh instance of the build-injected World, bypassing the cached instance.
6
6
  prerequisites:
7
7
  - /docs/api-reference/workflow-runtime/get-world
8
8
  related:
9
9
  - /docs/api-reference/workflow-runtime/set-world
10
10
  ---
11
11
 
12
- Creates a new [World](/docs/api-reference/workflow-runtime/world) instance based on environment configuration. The `WORKFLOW_TARGET_WORLD` environment variable determines which World implementation is instantiated (for example the local development World or the Vercel production World).
12
+ Creates a new [World](/docs/api-reference/workflow-runtime/world) instance by invoking the World factory that was statically injected into the bundle at build time. The `WORKFLOW_TARGET_WORLD` environment variable selects the implementation, such as the local development World or the Vercel production World, when the app is built. Changing the variable at runtime has no effect.
13
13
 
14
- Unlike [`getWorld()`](/docs/api-reference/workflow-runtime/get-world), which caches a singleton instance, `createWorld()` constructs a fresh instance on every call. Application code should almost always use `getWorld()` `createWorld()` is for infrastructure code that manages World lifecycles itself.
14
+ Unlike [`getWorld()`](/docs/api-reference/workflow-runtime/get-world), which caches a singleton instance, `createWorld()` constructs a fresh instance on every call. Application code should almost always use `getWorld()`. `createWorld()` is for infrastructure code that manages World lifecycles itself.
15
15
 
16
16
  ```typescript lineNumbers
17
17
  import { createWorld } from "workflow/runtime";
@@ -19,11 +19,11 @@ import { createWorld } from "workflow/runtime";
19
19
  const world = await createWorld(); // [!code highlight]
20
20
  ```
21
21
 
22
- ## API Signature
22
+ ## API signature
23
23
 
24
24
  ### Parameters
25
25
 
26
- This function does not accept any parameters. Configuration is read from environment variables.
26
+ This function does not accept any parameters. Configuration comes from the World that was injected at build time (World implementations typically read their own settings from environment variables when constructed).
27
27
 
28
28
  ### Returns
29
29
 
@@ -33,7 +33,7 @@ Returns a `Promise<World>` with a newly constructed World instance.
33
33
  Tooling that needs to construct a World with explicit (non-environment) configuration should instantiate the specific World implementation directly and register it with [`setWorld()`](/docs/api-reference/workflow-runtime/set-world).
34
34
  </Callout>
35
35
 
36
- ## Related Functions
36
+ ## Related functions
37
37
 
38
- - [`getWorld()`](/docs/api-reference/workflow-runtime/get-world) - Resolve the cached World instance (preferred in application code).
39
- - [`setWorld()`](/docs/api-reference/workflow-runtime/set-world) - Override the cached World instance.
38
+ - [`getWorld()`](/docs/api-reference/workflow-runtime/get-world): Resolve the cached World instance (preferred in application code).
39
+ - [`setWorld()`](/docs/api-reference/workflow-runtime/set-world): Override the cached World instance.
@@ -9,7 +9,7 @@ prerequisites:
9
9
 
10
10
  Returns a restricted view of the [World](/docs/api-reference/workflow-runtime/world) exposing only the members that are safe to use at build time: `createQueueHandler` and `specVersion`. Framework adapters use it while generating workflow route handlers, before the deployment's runtime environment variables exist.
11
11
 
12
- Unlike [`getWorld()`](/docs/api-reference/workflow-runtime/get-world), this function does not cache a fully configured World instance caching at build time would lock in incomplete environment configuration.
12
+ Unlike [`getWorld()`](/docs/api-reference/workflow-runtime/get-world), this function does not cache a fully configured World instance: caching at build time would lock in incomplete environment configuration.
13
13
 
14
14
  ```typescript lineNumbers
15
15
  import { getWorldHandlers } from "workflow/runtime";
@@ -18,7 +18,7 @@ const handlers = await getWorldHandlers(); // [!code highlight]
18
18
  console.log(handlers.specVersion);
19
19
  ```
20
20
 
21
- ## API Signature
21
+ ## API signature
22
22
 
23
23
  ### Parameters
24
24
 
@@ -35,10 +35,10 @@ type WorldHandlers = Pick<World, "createQueueHandler" | "specVersion">;
35
35
  ```
36
36
 
37
37
  <Callout type="warn">
38
- This is SDK infrastructure used by framework adapters and the workflow entrypoint. Application code should use [`getWorld()`](/docs/api-reference/workflow-runtime/get-world) instead.
38
+ This is SDK infrastructure used by framework adapters at build time. Runtime routes and application code should use [`getWorld()`](/docs/api-reference/workflow-runtime/get-world) instead.
39
39
  </Callout>
40
40
 
41
- ## Related Functions
41
+ ## Related functions
42
42
 
43
- - [`getWorld()`](/docs/api-reference/workflow-runtime/get-world) - Resolve the full World instance at runtime.
44
- - [`workflowEntrypoint()`](/docs/api-reference/workflow-runtime/workflow-entrypoint) - The route handler factory built on these handlers.
43
+ - [`getWorld()`](/docs/api-reference/workflow-runtime/get-world): Resolve the full World instance at runtime.
44
+ - [`workflowEntrypoint()`](/docs/api-reference/workflow-runtime/workflow-entrypoint): Create the runtime route handler that shares the full World instance.
@@ -17,7 +17,7 @@ import { getWorld } from "workflow/runtime";
17
17
  const world = await getWorld(); // [!code highlight]
18
18
  ```
19
19
 
20
- ## API Signature
20
+ ## API signature
21
21
 
22
22
  ### Parameters
23
23
 
@@ -50,7 +50,7 @@ The World object provides access to several entity interfaces. See the [World SD
50
50
  </Card>
51
51
  </Cards>
52
52
 
53
- ## Data Hydration
53
+ ## Data hydration
54
54
 
55
55
  Step and run data is serialized using the [devalue](https://github.com/Rich-Harris/devalue) format. Use `workflow/observability` to hydrate it for display:
56
56
 
@@ -63,7 +63,7 @@ const hydrated = hydrateResourceIO(step, observabilityRevivers); // [!code highl
63
63
 
64
64
  See [`workflow/observability`](/docs/api-reference/workflow-observability) for the full hydration and parsing API.
65
65
 
66
- ### List Workflow Runs (Display Names)
66
+ ### List workflow runs (display names)
67
67
 
68
68
  List workflow runs and derive human-readable names from the `workflowName` field:
69
69
 
@@ -114,7 +114,7 @@ export async function GET(req: Request) {
114
114
  and `moduleSpecifier` for display in your UI.
115
115
  </Callout>
116
116
 
117
- ## Related Functions
117
+ ## Related functions
118
118
 
119
119
  - [`getRun()`](/docs/api-reference/workflow-api/get-run) - Higher-level API for working with individual runs by ID.
120
120
  - [`start()`](/docs/api-reference/workflow-api/start) - Start a new workflow run.
@@ -20,7 +20,7 @@ if (!result.healthy) {
20
20
  }
21
21
  ```
22
22
 
23
- ## API Signature
23
+ ## API signature
24
24
 
25
25
  ### Parameters
26
26
 
@@ -5,9 +5,7 @@ type: overview
5
5
  summary: Explore runtime functions for resolving the World instance and configuring workflow infrastructure.
6
6
  ---
7
7
 
8
- API reference for runtime functions from the `workflow/runtime` package.
9
-
10
- The runtime package provides low-level access to the workflow runtime — resolving the [World](/docs/api-reference/workflow-runtime/world) instance that backs storage, queuing, and streaming, and wiring up workflow infrastructure in custom server environments.
8
+ The `workflow/runtime` package provides low-level access to the workflow runtime. Use it to resolve the [World](/docs/api-reference/workflow-runtime/world) instance that backs storage, queuing, and streaming or to wire up workflow infrastructure in custom server environments.
11
9
 
12
10
  ## Functions
13
11
 
@@ -20,7 +18,7 @@ The runtime package provides low-level access to the workflow runtime — resolv
20
18
  </Card>
21
19
  </Cards>
22
20
 
23
- ## Infrastructure Functions
21
+ ## Infrastructure functions
24
22
 
25
23
  These functions are primarily used by framework adapters and custom world setups, and are rarely needed in application code:
26
24
 
@@ -2,14 +2,14 @@
2
2
  title: setWorld
3
3
  description: Override or reset the cached World instance used by the workflow runtime.
4
4
  type: reference
5
- summary: Use setWorld to inject a custom World instance or reset the cache after environment configuration changes.
5
+ summary: Use setWorld to inject a custom World instance or reset the cache to the build-injected World.
6
6
  prerequisites:
7
7
  - /docs/api-reference/workflow-runtime/get-world
8
8
  related:
9
9
  - /docs/api-reference/workflow-runtime/create-world
10
10
  ---
11
11
 
12
- Overrides the cached [World](/docs/api-reference/workflow-runtime/world) instance that [`getWorld()`](/docs/api-reference/workflow-runtime/get-world) returns. Use it to inject a World constructed with explicit configuration (rather than environment variables), or pass `undefined` to clear the cache so the next `getWorld()` call reinitializes from the current environment.
12
+ Overrides the cached [World](/docs/api-reference/workflow-runtime/world) instance that [`getWorld()`](/docs/api-reference/workflow-runtime/get-world) returns. Use it to inject a World constructed with explicit configuration, or pass `undefined` to clear the cache so the next `getWorld()` call reconstructs the World that was statically injected into the bundle at build time.
13
13
 
14
14
  ```typescript lineNumbers
15
15
  import { setWorld, getWorld } from "workflow/runtime";
@@ -20,30 +20,32 @@ setWorld(customWorld); // [!code highlight]
20
20
  const world = await getWorld(); // resolves customWorld
21
21
  ```
22
22
 
23
- ## API Signature
23
+ ## API signature
24
24
 
25
25
  ### Parameters
26
26
 
27
27
  | Parameter | Type | Description |
28
28
  |-----------|------|-------------|
29
- | `world` | `World \| undefined` | The World instance to use, or `undefined` to reset the cache and reinitialize from environment variables on next access |
29
+ | `world` | `World \| undefined` | The World instance to use, or `undefined` to reset the cache so the next access reconstructs the build-injected World |
30
30
 
31
31
  ### Returns
32
32
 
33
33
  This function does not return a value.
34
34
 
35
- ## Example: Reset After Environment Changes
35
+ ## Example: inject a specific World
36
36
 
37
- ```typescript lineNumbers
38
- import { setWorld, getWorld } from "workflow/runtime";
37
+ The build selects the target World via `WORKFLOW_TARGET_WORLD` and statically injects it into the bundle. Changing the environment variable at runtime has no effect. To use a different World at runtime, construct it explicitly with the World package's `createWorld()` factory and inject it:
39
38
 
40
- process.env.WORKFLOW_TARGET_WORLD = "@workflow/world-local";
41
- setWorld(undefined); // clear the cached instance // [!code highlight]
39
+ ```typescript lineNumbers
40
+ import { setWorld } from "workflow/runtime";
41
+ import { createWorld } from "@workflow/world-local";
42
42
 
43
- const world = await getWorld(); // reinitialized with new configuration
43
+ setWorld(createWorld({ dataDir: "/tmp/workflow-test" })); // [!code highlight]
44
44
  ```
45
45
 
46
- ## Related Functions
46
+ Calling `setWorld(undefined)` afterwards restores the build-injected World on the next `getWorld()` call.
47
+
48
+ ## Related functions
47
49
 
48
- - [`getWorld()`](/docs/api-reference/workflow-runtime/get-world) - Resolve the cached World instance.
49
- - [`createWorld()`](/docs/api-reference/workflow-runtime/create-world) - Construct a fresh World from environment configuration.
50
+ - [`getWorld()`](/docs/api-reference/workflow-runtime/get-world): Resolve the cached World instance.
51
+ - [`createWorld()`](/docs/api-reference/workflow-runtime/create-world): Construct a fresh instance of the build-injected World.
@@ -11,7 +11,7 @@ related:
11
11
 
12
12
  Creates the HTTP route handler that executes workflow runs. The handler receives queue messages, replays the workflow from its event log, executes steps inline where possible, and suspends when the workflow waits on sleeps or hooks.
13
13
 
14
- Framework adapters (Next.js, Nitro, SvelteKit, etc.) call this for you and mount the result at `/.well-known/workflow/v1/flow` you only need it when wiring workflow support into a custom server environment.
14
+ Framework adapters (Next.js, Nitro, SvelteKit, etc.) call this for you and mount the result at `/.well-known/workflow/v1/flow`. You only need it when wiring workflow support into a custom server environment.
15
15
 
16
16
  ```typescript lineNumbers
17
17
  import { workflowEntrypoint } from "workflow/runtime";
@@ -23,7 +23,7 @@ const handler = workflowEntrypoint(workflowBundleCode); // [!code highlight]
23
23
  export const POST = (req: Request) => handler(req);
24
24
  ```
25
25
 
26
- ## API Signature
26
+ ## API signature
27
27
 
28
28
  ### Parameters
29
29
 
@@ -36,7 +36,8 @@ export const POST = (req: Request) => handler(req);
36
36
 
37
37
  Returns a fetch-style request handler: `(req: Request) => Promise<Response>`.
38
38
 
39
- ## Related Functions
39
+ ## Related functions
40
40
 
41
- - [`getWorldHandlers()`](/docs/api-reference/workflow-runtime/get-world-handlers) - The build-time World access this handler is built on.
42
- - [`healthCheck()`](/docs/api-reference/workflow-runtime/health-check) - Verify the entrypoint processes queue messages end-to-end.
41
+ - [`getWorld()`](/docs/api-reference/workflow-runtime/get-world): Resolve the runtime World instance this handler shares with workflow execution.
42
+ - [`getWorldHandlers()`](/docs/api-reference/workflow-runtime/get-world-handlers): Access build-time-safe World handlers for framework tooling.
43
+ - [`healthCheck()`](/docs/api-reference/workflow-runtime/health-check): Verify the entrypoint processes queue messages end-to-end.
@@ -20,7 +20,7 @@ keywords:
20
20
  - metadata-only
21
21
  ---
22
22
 
23
- `world.analytics` is an optional, read-only namespace for observability surfaces dashboards, CLIs, and admin tools that list large numbers of runs without touching payload data.
23
+ `world.analytics` is an optional, read-only namespace for observability surfaces: dashboards, command-line interface (CLI) tools, and admin tools that list large numbers of runs without touching payload data.
24
24
 
25
25
  For observability and inspection listings, prefer this namespace over
26
26
  [`world.runs.list()`](/docs/api-reference/workflow-runtime/world/storage#runslist).
@@ -28,10 +28,10 @@ The storage API remains available for operational and payload-bearing reads.
28
28
 
29
29
  It differs from [Storage](/docs/api-reference/workflow-runtime/world/storage) in two ways:
30
30
 
31
- - **Metadata only.** Results never include run input/output, step data, or hook tokens. There is no `resolveData` option.
32
- - **Served from the observability pipeline.** On Vercel, queries are served from the Vercel observability data pipeline, so large listings do not compete with workflow execution. Data is ingested asynchronously and may trail the live state by a few seconds.
31
+ - **Metadata only**: Results never include run input/output, step data, or hook tokens. There is no `resolveData` option.
32
+ - **Served from the observability pipeline**: On Vercel, queries are served from the Vercel observability data pipeline, so large listings do not compete with workflow execution. Data is ingested asynchronously and may trail the live state by a few seconds.
33
33
 
34
- The namespace is optional worlds that don't implement it (such as the local development world) leave it `undefined`, so feature-detect before use:
34
+ The namespace is optional: worlds that don't implement it (such as the local development world) leave it `undefined`, so feature-detect before use:
35
35
 
36
36
  ```typescript lineNumbers
37
37
  import { getWorld } from "workflow/runtime";
@@ -67,13 +67,13 @@ const page = await world.analytics.runs.list({
67
67
  | `params.attributes` | `Record<string, string>` | Only return runs whose latest attributes match every pair (up to 8) |
68
68
  | `params.pagination` | `PaginationOptions` | Cursor pagination |
69
69
 
70
- **Returns:** `PaginatedResponse<AnalyticsRun>` each run includes `runId`, `status`, `workflowName`, `deploymentId`, `attributes`, and lifecycle timestamps.
70
+ **Returns:** `PaginatedResponse<AnalyticsRun>`. Each run includes `runId`, `status`, `workflowName`, `deploymentId`, `attributes`, and lifecycle timestamps.
71
71
 
72
72
  Attribute matching is latest-write-wins: a run whose attribute moved from `"v1"` to `"v2"` no longer matches `{ key: "v1" }`. Reserved `$`-prefixed keys may be used in filters even though user code cannot write them.
73
73
 
74
74
  ### runs.get()
75
75
 
76
- Fetch one run by ID. Point lookups search the full plan window, not just the trailing 24 hours.
76
+ Fetch one run by ID. Point lookups search the full plan window rather than only the trailing 24 hours.
77
77
 
78
78
  ```typescript lineNumbers
79
79
  const run = await world.analytics.runs.get(runId);
@@ -83,7 +83,7 @@ const run = await world.analytics.runs.get(runId);
83
83
 
84
84
  ## analytics.attributes
85
85
 
86
- Discover which [attributes](/docs/observability/attributes) exist on your runs for example to build filter dropdowns over arbitrary user-defined keys.
86
+ Discover which [attributes](/docs/observability/attributes) exist on your runs, for example to build filter dropdowns over arbitrary user-defined keys.
87
87
 
88
88
  ### attributes.list()
89
89
 
@@ -104,7 +104,7 @@ for (const { key, runCount, lastSeenAt } of page.data) {
104
104
  | `params.startTime` / `params.endTime` | `string` | ISO 8601 window; must be provided together |
105
105
  | `params.pagination` | `PaginationOptions` | Cursor pagination |
106
106
 
107
- **Returns:** `PaginatedResponse<AnalyticsAttributeKey>` `{ key, runCount, firstSeenAt, lastSeenAt }`
107
+ **Returns:** `PaginatedResponse<AnalyticsAttributeKey>`: `{ key, runCount, firstSeenAt, lastSeenAt }`
108
108
 
109
109
  ---
110
110
 
@@ -120,7 +120,7 @@ const hooks = await world.analytics.hooks.list({ runId });
120
120
  const waits = await world.analytics.waits.list({ runId, status: "waiting" });
121
121
  ```
122
122
 
123
- Each namespace also has a `get()` for point lookups (`steps.get(runId, stepId)`, `events.get(runId, eventId)`, `hooks.get(hookId)`, `waits.get(runId, waitId)`). Hook listings never include the hook token resolve it separately through the runtime APIs if you need to deliver a payload.
123
+ Each namespace also has a `get()` for point lookups (`steps.get(runId, stepId)`, `events.get(runId, eventId)`, `hooks.get(hookId)`, `waits.get(runId, waitId)`). Hook listings never include the hook token. Resolve it separately through the runtime APIs if you need to deliver a payload.
124
124
 
125
125
  ---
126
126
 
@@ -14,7 +14,7 @@ keywords:
14
14
  - workflow management
15
15
  ---
16
16
 
17
- The World SDK provides direct access to workflow infrastructure runs, steps, events, hooks, streams, and queues plus a metadata-only [Analytics](/docs/api-reference/workflow-runtime/world/analytics) namespace with attribute discovery and filtering. Use it to build observability dashboards, admin panels, debugging tools, and custom workflow management logic.
17
+ The World SDK provides direct access to workflow infrastructure, including runs, steps, events, hooks, streams, and queues. It also provides a metadata-only [Analytics](/docs/api-reference/workflow-runtime/world/analytics) namespace with attribute discovery and filtering. Use it to build observability dashboards, admin panels, debugging tools, and custom workflow management logic.
18
18
 
19
19
  ```typescript lineNumbers
20
20
  import { getWorld } from "workflow/runtime";
@@ -43,9 +43,11 @@ const world = await getWorld(); // [!code highlight]
43
43
  The World SDK is the low-level foundation that higher-level functions like [`getRun()`](/docs/api-reference/workflow-api/get-run) and [`start()`](/docs/api-reference/workflow-api/start) are built on. Use it when you need capabilities beyond what those functions provide.
44
44
  </Callout>
45
45
 
46
- ## Data Hydration
46
+ Beyond these namespaces, the `World` interface carries several top-level members for World authors: `specVersion`, `capabilities`, lifecycle hooks (`start()`/`close()`), `getEncryptionKeyForRun()`, and the optional `createRunId()` / `describeRun()` hooks behind regional run placement and World-specific `inspect` output. [Building a World](/worlds/building-a-world) documents these members.
47
47
 
48
- Step input/output data is serialized using the [devalue](https://github.com/Rich-Harris/devalue) format. To display this data in your UI, use the hydration utilities from `workflow/observability`:
48
+ ## Data hydration
49
+
50
+ The [devalue](https://github.com/Rich-Harris/devalue) format serializes step input/output data. To display this data in your UI, use the hydration utilities from `workflow/observability`:
49
51
 
50
52
  ```typescript lineNumbers
51
53
  import { hydrateResourceIO, observabilityRevivers } from "workflow/observability"; // [!code highlight]
@@ -2,7 +2,7 @@
2
2
  title: Queue
3
3
  description: Low-level queue interface for dispatching workflow invocations.
4
4
  type: reference
5
- summary: "Methods: getDeploymentId(), queue(), createQueueHandler(). Internal queue dispatch — normally handled by the SDK."
5
+ summary: "Methods: getDeploymentId(), queue(), createQueueHandler(). The SDK normally handles internal queue dispatch."
6
6
  prerequisites:
7
7
  - /docs/api-reference/workflow-runtime/get-world
8
8
  related:
@@ -20,7 +20,7 @@ keywords:
20
20
  Queue methods live directly on the `world` object (not nested). They dispatch internal workflow invocations, including queued step work, to the queue backend.
21
21
 
22
22
  <Callout type="warn">
23
- These methods are used internally by the Workflow SDK to dispatch execution. You do not need to call them in normal operations use [`start()`](/docs/api-reference/workflow-api/start) to trigger workflows instead. Direct queue access is only needed if you programmatically create a run via `world.events.create()` with a `run_created` event and need to kick off its initial execution, or for debugging flow resumption.
23
+ The Workflow SDK uses these methods internally to dispatch execution. In normal operations, use [`start()`](/docs/api-reference/workflow-api/start) to trigger workflows instead. You only need direct queue access to start the initial execution of a run you programmatically created via `world.events.create()` with a `run_created` event, or to debug flow resumption.
24
24
  </Callout>
25
25
 
26
26
  ## Import
@@ -29,20 +29,20 @@ Queue methods live directly on the `world` object (not nested). They dispatch in
29
29
  import { getWorld } from "workflow/runtime";
30
30
 
31
31
  const world = await getWorld(); // [!code highlight]
32
- // Queue methods are called directly on world e.g. world.queue()
32
+ // Call queue methods directly on world, for example, world.queue()
33
33
  ```
34
34
 
35
35
  ## Methods
36
36
 
37
37
  ### getDeploymentId()
38
38
 
39
- Get the current deployment ID. Used internally for routing queue messages to the correct deployment.
39
+ Get the current deployment ID. The SDK uses it internally to route queue messages to the correct deployment.
40
40
 
41
41
  ```typescript lineNumbers
42
42
  const deploymentId = await world.getDeploymentId(); // [!code highlight]
43
43
  ```
44
44
 
45
- **Returns:** `string` The current deployment ID
45
+ **Returns:** `string`. The current deployment ID.
46
46
 
47
47
  ### queue()
48
48
 
@@ -58,13 +58,13 @@ const { messageId } = await world.queue(queueName, payload, opts); // [!code hig
58
58
  |-----------|------|-------------|
59
59
  | `queueName` | `ValidQueueName` | The queue name (branded string) |
60
60
  | `message` | `QueuePayload` | Internal SDK payload |
61
- | `opts` | `QueueOptions` | Optional `deploymentId`, `idempotencyKey`, `delaySeconds`, `headers` |
61
+ | `opts` | `QueueOptions` | Optional: `deploymentId`, `idempotencyKey`, `delaySeconds`, `headers`, `region` (regional routing hint), `specVersion` |
62
62
 
63
63
  **Returns:** `{ messageId: MessageId | null }`
64
64
 
65
65
  ### createQueueHandler()
66
66
 
67
- Create an HTTP handler that processes messages from a queue. Used to set up the queue consumer endpoint.
67
+ Create an HTTP handler that processes messages from a queue. Use it to set up the queue consumer endpoint.
68
68
 
69
69
  ```typescript lineNumbers
70
70
  const handler = world.createQueueHandler(prefix, callback); // [!code highlight]
@@ -79,10 +79,10 @@ const handler = world.createQueueHandler(prefix, callback); // [!code highlight]
79
79
 
80
80
  **Returns:** `(req: Request) => Promise<Response>`
81
81
 
82
- `meta.messageId` should be stable across redeliveries of the same message (one ID per enqueued message, reused on every delivery attempt). The runtime records it on inline `step_started` events as a liveness lease so that only a redelivery of the owning message re-executes a crashed inline step before the lease expires (see [Inline step message ownership](/v5/docs/changelog/step-message-ownership)). A World whose queue mints a fresh ID per delivery degrades gracefully crashed inline steps recover via the delayed backstop instead of immediately on redelivery but never wedges or duplicates.
82
+ `meta.messageId` should be stable across redeliveries of the same message (one ID per enqueued message, reused on every delivery attempt). The runtime records it on inline `step_started` events as a liveness lease so that only a redelivery of the owning message re-executes a crashed inline step before the lease expires (see [Inline step message ownership](/docs/changelog/step-message-ownership)). A World whose queue mints a fresh ID per delivery degrades gracefully. Crashed inline steps recover via the delayed backstop instead of immediately on redelivery, but never wedge or duplicate.
83
83
 
84
84
  ## Related
85
85
 
86
- - [start()](/docs/api-reference/workflow-api/start) The standard way to start workflow runs
87
- - [Starting Workflows](/docs/foundations/starting-workflows) Core concepts for workflow invocation
88
- - [Storage](/docs/api-reference/workflow-runtime/world/storage) Create events that trigger queue dispatch
86
+ - [start()](/docs/api-reference/workflow-api/start): The standard way to start workflow runs
87
+ - [Starting Workflows](/docs/foundations/starting-workflows): Core concepts for workflow invocation
88
+ - [Storage](/docs/api-reference/workflow-runtime/world/storage): Create events that trigger queue dispatch