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
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  title: Nitro
3
- description: This guide will walk through setting up your first workflow in a Nitro v3 project. Along the way, you'll learn more about the concepts that are fundamental to using the Workflow SDK in your own projects.
3
+ description: Set up your first durable workflow in a Nitro v3 project.
4
4
  type: guide
5
5
  summary: Set up Workflow SDK in a Nitro app.
6
6
  prerequisites:
@@ -16,9 +16,9 @@ related:
16
16
  <Steps>
17
17
 
18
18
  <Step>
19
- ## Create Your Nitro Project
19
+ ## Create your Nitro project
20
20
 
21
- Start by creating a new [Nitro v3](https://v3.nitro.build/) project. This command will create a new directory named `nitro-app` and setup a Nitro project inside it.
21
+ Create a [Nitro v3](https://v3.nitro.build/) project in a new directory named `nitro-app`:
22
22
 
23
23
  ```bash
24
24
  npx create-nitro-app
@@ -38,7 +38,7 @@ npm i workflow
38
38
 
39
39
  ### Configure Nitro
40
40
 
41
- Add `workflow/nitro` module to your `nitro.config.ts` This enables usage of the `"use workflow"` and `"use step"` directives.
41
+ Add the `workflow/nitro` module to your `nitro.config.ts`. This enables the `"use workflow"` and `"use step"` directives.
42
42
 
43
43
  ```typescript title="nitro.config.ts" lineNumbers
44
44
  import { defineConfig } from "nitro";
@@ -70,15 +70,15 @@ export default defineConfig({
70
70
  | --- | --- | --- | --- |
71
71
  | `dirs` | `string[]` | — | Directories to scan for workflows and steps. By default, `workflows/` is scanned from the project root and all layer source directories. |
72
72
  | `runtime` | `string` | `'nodejs22.x'` | Node.js runtime version for Vercel Functions (e.g. `'nodejs22.x'`, `'nodejs24.x'`). |
73
- | `sourcemap` | `boolean \| 'inline' \| 'linked' \| 'external' \| 'both'` | `'inline'` (dev) / `false` (prod) | Controls source maps on generated workflow bundles. Accepts the same values as esbuild's `sourcemap` option. Defaults to `'inline'` in development and `false` in production (smaller function bundles helps stay under the Vercel 250MB function size limit). Set it explicitly, or use the `WORKFLOW_SOURCEMAP` environment variable, to override in either environment. |
73
+ | `sourcemap` | `boolean \| 'inline' \| 'linked' \| 'external' \| 'both'` | `'inline'` (dev) / `false` (prod) | Controls source maps on generated workflow bundles. Accepts the same values as esbuild's `sourcemap` option. Defaults to `'inline'` in development and `false` in production (smaller function bundles, which helps stay under the Vercel 250 MB function size limit). Set it explicitly, or use the `WORKFLOW_SOURCEMAP` environment variable, to override in either environment. |
74
74
 
75
75
  <Accordion type="single" collapsible>
76
76
  <AccordionItem value="typescript-intellisense" className="[&_h3]:my-0">
77
77
  <AccordionTrigger className="[&_p]:my-0 text-lg [&_p]:text-foreground">
78
- Setup IntelliSense for TypeScript (Optional)
78
+ Set up IntelliSense for TypeScript (optional)
79
79
  </AccordionTrigger>
80
80
  <AccordionContent className="[&_p]:my-2">
81
- To enable helpful hints in your IDE, setup the workflow plugin in `tsconfig.json`:
81
+ To enable helpful hints in your IDE, set up the workflow plugin in `tsconfig.json`:
82
82
 
83
83
  ```json title="tsconfig.json" lineNumbers
84
84
  {
@@ -102,7 +102,7 @@ To enable helpful hints in your IDE, setup the workflow plugin in `tsconfig.json
102
102
 
103
103
  <Step>
104
104
 
105
- ## Create Your First Workflow
105
+ ## Create your first workflow
106
106
 
107
107
  Create a new file for our first workflow:
108
108
 
@@ -124,14 +124,14 @@ export async function handleUserSignup(email: string) {
124
124
  }
125
125
  ```
126
126
 
127
- We'll fill in those functions next, but let's take a look at this code:
127
+ We'll fill in those functions next, but first review this code:
128
128
 
129
129
  - We define a **workflow** function with the directive `"use workflow"`. Think of the workflow function as the _orchestrator_ of individual **steps**.
130
130
  - The Workflow SDK's `sleep` function allows us to suspend execution of the workflow without using up any resources. A sleep can be a few seconds, hours, days, or even months long.
131
131
 
132
- ## Create Your Workflow Steps
132
+ ## Create your workflow steps
133
133
 
134
- Let's now define those missing functions.
134
+ Define the missing functions.
135
135
 
136
136
  ```typescript title="workflows/user-signup.ts" lineNumbers
137
137
  import { FatalError } from "workflow";
@@ -185,7 +185,7 @@ Taking a look at this code:
185
185
 
186
186
  <Step>
187
187
 
188
- ## Create Your Route Handler
188
+ ## Create your route handler
189
189
 
190
190
  To invoke your new workflow, we'll create a new API route handler at `server/api/signup.post.ts` with the following code:
191
191
 
@@ -204,7 +204,7 @@ export default defineEventHandler(async ({ req }) => {
204
204
  });
205
205
  ```
206
206
 
207
- This Route Handler creates a `POST` request endpoint at `/api/signup` that will trigger your workflow.
207
+ This route handler creates a `POST` request endpoint at `/api/signup` that triggers your workflow.
208
208
 
209
209
  <Callout>
210
210
  Workflows can be triggered from API routes or any server-side
@@ -248,7 +248,7 @@ npx workflow inspect runs
248
248
 
249
249
  ## Deploying to production
250
250
 
251
- Workflow SDK apps currently work best when deployed to [Vercel](https://vercel.com/home) and needs no special configuration.
251
+ Workflow SDK apps currently work best when deployed to [Vercel](https://vercel.com/home) and need no special configuration.
252
252
 
253
253
  <FluidComputeCallout />
254
254
 
@@ -260,7 +260,7 @@ Check the [Deploying](/docs/deploying) section to learn how your workflows can b
260
260
 
261
261
  If you see this error:
262
262
 
263
- ```
263
+ ```text
264
264
  'start' received an invalid workflow function. Ensure the Workflow SDK is configured correctly and the function includes a 'use workflow' directive.
265
265
  ```
266
266
 
@@ -271,7 +271,7 @@ Check both of these first:
271
271
 
272
272
  See [start-invalid-workflow-function](/docs/errors/start-invalid-workflow-function) for full examples and fixes.
273
273
 
274
- ## Next Steps
274
+ ## Next steps
275
275
 
276
276
  - Learn more about the [Foundations](/docs/foundations).
277
277
  - Check [Errors](/docs/errors) if you encounter issues.
@@ -16,7 +16,7 @@ related:
16
16
  <Steps>
17
17
 
18
18
  <Step>
19
- ## Create Your Nuxt Project
19
+ ## Create your Nuxt project
20
20
 
21
21
  Start by creating a new Nuxt project. This command will create a new directory named `nuxt-app` and setup a Nuxt project inside it.
22
22
 
@@ -79,7 +79,7 @@ export default defineNuxtConfig({
79
79
 
80
80
  <Step>
81
81
 
82
- ## Create Your First Workflow
82
+ ## Create your first workflow
83
83
 
84
84
  Create a new file for our first workflow:
85
85
 
@@ -101,14 +101,14 @@ export async function handleUserSignup(email: string) {
101
101
  }
102
102
  ```
103
103
 
104
- We'll fill in those functions next, but let's take a look at this code:
104
+ We'll fill in those functions next. The current code does the following:
105
105
 
106
106
  - We define a **workflow** function with the directive `"use workflow"`. Think of the workflow function as the _orchestrator_ of individual **steps**.
107
107
  - The Workflow SDK's `sleep` function allows us to suspend execution of the workflow without using up any resources. A sleep can be a few seconds, hours, days, or even months long.
108
108
 
109
- ## Create Your Workflow Steps
109
+ ## Create your workflow steps
110
110
 
111
- Let's now define those missing functions.
111
+ Define the missing functions.
112
112
 
113
113
  ```typescript title="server/workflows/user-signup.ts" lineNumbers
114
114
  import { FatalError } from "workflow";
@@ -162,7 +162,7 @@ Taking a look at this code:
162
162
 
163
163
  <Step>
164
164
 
165
- ## Create Your API Route
165
+ ## Create your API route
166
166
 
167
167
  To invoke your new workflow, we'll create a new API route handler at `server/api/signup.post.ts` with the following code:
168
168
 
@@ -239,7 +239,7 @@ Check the [Deploying](/docs/deploying) section to learn how your workflows can b
239
239
 
240
240
  If you see this error:
241
241
 
242
- ```
242
+ ```text
243
243
  'start' received an invalid workflow function. Ensure the Workflow SDK is configured correctly and the function includes a 'use workflow' directive.
244
244
  ```
245
245
 
@@ -250,7 +250,7 @@ Check both of these first:
250
250
 
251
251
  See [start-invalid-workflow-function](/docs/errors/start-invalid-workflow-function) for full examples and fixes.
252
252
 
253
- ## Next Steps
253
+ ## Next steps
254
254
 
255
255
  - Learn more about the [Foundations](/docs/foundations).
256
256
  - Check [Errors](/docs/errors) if you encounter issues.
@@ -20,7 +20,7 @@ The Python SDK is currently in **beta**. APIs and behavior may change. For the l
20
20
 
21
21
  You can build durable workflows in Python using the [`vercel` Python SDK](https://pypi.org/project/vercel/). Your workflow code can pause, resume, and maintain state, just like the JavaScript and TypeScript Workflow SDK.
22
22
 
23
- ## Getting Started
23
+ ## Getting started
24
24
 
25
25
  Add the `vercel` package and workflow entrypoint to `pyproject.toml`:
26
26
 
@@ -93,7 +93,7 @@ async def summarize_draft(*, draft: str):
93
93
  return summary
94
94
  ```
95
95
 
96
- Each step compiles into an isolated route. While the step executes, the workflow suspends without consuming resources. When the step completes, the workflow resumes automatically where it left off.
96
+ Each step executes separately from the workflow orchestrator. While the step executes, the workflow suspends without consuming resources. When the step completes, the workflow resumes automatically where it left off.
97
97
 
98
98
  ## Sleep
99
99
 
@@ -160,11 +160,11 @@ async def resume(approval: Approval):
160
160
 
161
161
  When a hook receives data, the workflow resumes automatically. You don&apos;t need polling, message queues, or manual state management.
162
162
 
163
- ## Learn More
163
+ ## Learn more
164
164
 
165
165
  For comprehensive documentation, examples, and the latest updates, visit the [official Vercel Workflow Python documentation](https://vercel.com/docs/workflows/python).
166
166
 
167
- ## Next Steps
167
+ ## Next steps
168
168
 
169
169
  - Learn more about the [Foundations](/docs/foundations).
170
170
  - Check [Errors](/docs/errors) if you encounter issues.
@@ -234,4 +234,4 @@ Use `workflow({ dirs: ["workflows"] })`, remove the existing `build` directory o
234
234
 
235
235
  ### `vite build` finishes output but does not exit
236
236
 
237
- Use `workflow@5.0.0-beta.33` or later with Nitro v3.
237
+ Use `workflow@5.0.0` or later with Nitro v3.
@@ -229,4 +229,4 @@ Use `workflow({ dirs: ["workflows"] })`, remove the existing `build` directory o
229
229
 
230
230
  ### `vite build` finishes output but does not exit
231
231
 
232
- Use `workflow@5.0.0-beta.33` or later with Nitro v3.
232
+ Use `workflow@5.0.0` or later with Nitro v3.
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  title: SvelteKit
3
- description: This guide will walk through setting up your first workflow in a SvelteKit app. Along the way, you'll learn more about the concepts that are fundamental to using the Workflow SDK in your own projects.
3
+ description: Set up your first durable workflow in a SvelteKit app.
4
4
  type: guide
5
5
  summary: Set up Workflow SDK in a SvelteKit app.
6
6
  prerequisites:
@@ -16,9 +16,9 @@ related:
16
16
  <Steps>
17
17
 
18
18
  <Step>
19
- ## Create Your SvelteKit Project
19
+ ## Create your SvelteKit project
20
20
 
21
- Start by creating a new SvelteKit project. This command will create a new directory named `my-workflow-app` with a minimal setup and setup a SvelteKit project inside it.
21
+ Create a minimal SvelteKit project in a new directory named `my-workflow-app`:
22
22
 
23
23
  ```bash
24
24
  npx sv create my-workflow-app --template=minimal --types=ts --no-add-ons
@@ -54,16 +54,16 @@ export default defineConfig({
54
54
 
55
55
  | Option | Type | Default | Description |
56
56
  | --- | --- | --- | --- |
57
- | `sourcemap` | `boolean \| 'inline' \| 'linked' \| 'external' \| 'both'` | `'inline'` (dev) / `false` (prod) | Controls source maps on generated workflow bundles. Accepts the same values as esbuild's `sourcemap` option. Defaults to `'inline'` in development and `false` in production (smaller function bundles helps stay under the Vercel 250MB function size limit). Set it explicitly, or use the `WORKFLOW_SOURCEMAP` environment variable, to override in either environment. |
57
+ | `sourcemap` | `boolean \| 'inline' \| 'linked' \| 'external' \| 'both'` | `'inline'` (dev) / `false` (prod) | Controls source maps on generated workflow bundles. Accepts the same values as esbuild's `sourcemap` option. Defaults to `'inline'` in development and `false` in production (smaller function bundles, which helps stay under the Vercel 250 MB function size limit). Set it explicitly, or use the `WORKFLOW_SOURCEMAP` environment variable, to override in either environment. |
58
58
 
59
59
  <Accordion type="single" collapsible>
60
60
  <AccordionItem value="typescript-intellisense" className="[&_h3]:my-0">
61
61
  <AccordionTrigger className="text-sm">
62
- ### Setup IntelliSense for TypeScript (Optional)
62
+ ### Set up IntelliSense for TypeScript (optional)
63
63
  </AccordionTrigger>
64
64
  <AccordionContent className="[&_p]:my-2">
65
65
 
66
- To enable helpful hints in your IDE, setup the workflow plugin in `tsconfig.json`:
66
+ To enable helpful hints in your IDE, set up the workflow plugin in `tsconfig.json`:
67
67
 
68
68
  ```json title="tsconfig.json" lineNumbers
69
69
  {
@@ -86,7 +86,7 @@ To enable helpful hints in your IDE, setup the workflow plugin in `tsconfig.json
86
86
 
87
87
  <Step>
88
88
 
89
- ## Create Your First Workflow
89
+ ## Create your first workflow
90
90
 
91
91
  Create a new file for our first workflow:
92
92
 
@@ -109,14 +109,14 @@ export async function handleUserSignup(email: string) {
109
109
 
110
110
  ```
111
111
 
112
- We'll fill in those functions next, but let's take a look at this code:
112
+ We'll fill in those functions next, but first review this code:
113
113
 
114
114
  * We define a **workflow** function with the directive `"use workflow"`. Think of the workflow function as the _orchestrator_ of individual **steps**.
115
115
  * The Workflow SDK's `sleep` function allows us to suspend execution of the workflow without using up any resources. A sleep can be a few seconds, hours, days, or even months long.
116
116
 
117
- ## Create Your Workflow Steps
117
+ ## Create your workflow steps
118
118
 
119
- Let's now define those missing functions.
119
+ Define the missing functions.
120
120
 
121
121
  ```typescript title="workflows/user-signup.ts" lineNumbers
122
122
  import { FatalError } from "workflow"
@@ -169,7 +169,7 @@ We'll dive deeper into workflows, steps, and other ways to suspend or handle eve
169
169
 
170
170
  <Step>
171
171
 
172
- ## Create Your Route Handler
172
+ ## Create your route handler
173
173
 
174
174
  To invoke your new workflow, we'll have to add your workflow to a `POST` API route handler, `src/routes/api/signup/+server.ts` with the following code:
175
175
 
@@ -232,7 +232,7 @@ npx workflow inspect runs
232
232
 
233
233
  ## Deploying to production
234
234
 
235
- Workflow SDK apps currently work best when deployed to [Vercel](https://vercel.com/home) and needs no special configuration.
235
+ Workflow SDK apps currently work best when deployed to [Vercel](https://vercel.com/home) and need no special configuration.
236
236
 
237
237
  <FluidComputeCallout />
238
238
 
@@ -244,7 +244,7 @@ Check the [Deploying](/docs/deploying) section to learn how your workflows can b
244
244
 
245
245
  If you see this error:
246
246
 
247
- ```
247
+ ```text
248
248
  'start' received an invalid workflow function. Ensure the Workflow SDK is configured correctly and the function includes a 'use workflow' directive.
249
249
  ```
250
250
 
@@ -255,7 +255,7 @@ Check both of these first:
255
255
 
256
256
  See [start-invalid-workflow-function](/docs/errors/start-invalid-workflow-function) for full examples and fixes.
257
257
 
258
- ## Next Steps
258
+ ## Next steps
259
259
 
260
260
  * Learn more about the [Foundations](/docs/foundations).
261
261
  * Check [Errors](/docs/errors) if you encounter issues.
@@ -13,14 +13,14 @@ related:
13
13
  text="In this TanStack Start app, run `npm i workflow`. In `vite.config.ts`, import `workflow` from `workflow/vite` and add `workflow()` first in the existing `plugins` array before `tanstackStart()`, `nitro()`, or other plugins. Add `{ &quot;name&quot;: &quot;workflow&quot; }` to `compilerOptions.plugins` in `tsconfig.json` if TypeScript is used. Create `src/workflows/user-signup.ts` with `handleUserSignup(email)`, `&quot;use workflow&quot;`, `sleep`, and `&quot;use step&quot;` helpers. Add `src/routes/api/signup.ts` using `createFileRoute(&quot;/api/signup&quot;)`, a POST server handler, `start` from `workflow/api`, and `json` from `@tanstack/react-start`. Run `npm run dev`, call `curl -X POST --json '{&quot;email&quot;:&quot;hello@example.com&quot;}' http://localhost:3000/api/signup`, and inspect with `npx workflow web` or `npx workflow inspect runs`."
14
14
  />
15
15
 
16
- This guide will walk through setting up your first workflow in a TanStack Start app. Along the way, you'll learn more about the concepts that are fundamental to using the Workflow SDK in your own projects.
16
+ Set up your first durable workflow in a TanStack Start app and learn the core Workflow SDK concepts.
17
17
 
18
18
  ---
19
19
 
20
20
  <Steps>
21
21
 
22
22
  <Step>
23
- ## Create Your TanStack Start Project
23
+ ## Create your TanStack Start project
24
24
 
25
25
  Start by creating a new TanStack Start project:
26
26
 
@@ -42,7 +42,7 @@ npm i workflow
42
42
 
43
43
  ### Configure TanStack Start
44
44
 
45
- TanStack Start runs on Vite, so the Workflow SDK is wired in via the same `workflow/vite` plugin. Add `workflow()` to the existing `plugins` array in your Vite config list it first so the `"use workflow"` and `"use step"` transforms run before any other plugin processes the file.
45
+ TanStack Start runs on Vite, so the Workflow SDK is wired in via the same `workflow/vite` plugin. Add `workflow()` to the existing `plugins` array in your Vite config. List it first so the `"use workflow"` and `"use step"` transforms run before any other plugin processes the file.
46
46
 
47
47
  ```typescript title="vite.config.ts" lineNumbers
48
48
  import { defineConfig } from "vite";
@@ -60,11 +60,11 @@ export default defineConfig({
60
60
  <Accordion type="single" collapsible>
61
61
  <AccordionItem value="typescript-intellisense" className="[&_h3]:my-0">
62
62
  <AccordionTrigger className="text-sm">
63
- ### Setup IntelliSense for TypeScript (Optional)
63
+ ### Set up IntelliSense for TypeScript (optional)
64
64
  </AccordionTrigger>
65
65
  <AccordionContent className="[&_p]:my-2">
66
66
 
67
- To enable helpful hints in your IDE, setup the workflow plugin in `tsconfig.json`:
67
+ To enable helpful hints in your IDE, set up the workflow plugin in `tsconfig.json`:
68
68
 
69
69
  ```json title="tsconfig.json" lineNumbers
70
70
  {
@@ -87,7 +87,7 @@ To enable helpful hints in your IDE, setup the workflow plugin in `tsconfig.json
87
87
 
88
88
  <Step>
89
89
 
90
- ## Create Your First Workflow
90
+ ## Create your first workflow
91
91
 
92
92
  Create a new file for our first workflow:
93
93
 
@@ -107,14 +107,14 @@ export async function handleUserSignup(email: string) {
107
107
  }
108
108
  ```
109
109
 
110
- We'll fill in those functions next, but let's take a look at this code:
110
+ We'll fill in those functions next, but first review this code:
111
111
 
112
112
  * We define a **workflow** function with the directive `"use workflow"`. Think of the workflow function as the _orchestrator_ of individual **steps**.
113
113
  * The Workflow SDK's `sleep` function allows us to suspend execution of the workflow without using up any resources. A sleep can be a few seconds, hours, days, or even months long.
114
114
 
115
- ## Create Your Workflow Steps
115
+ ## Create your workflow steps
116
116
 
117
- Let's now define those missing functions.
117
+ Define the missing functions.
118
118
 
119
119
  ```typescript title="src/workflows/user-signup.ts" lineNumbers
120
120
  import { FatalError } from "workflow"
@@ -167,7 +167,7 @@ We'll dive deeper into workflows, steps, and other ways to suspend or handle eve
167
167
 
168
168
  <Step>
169
169
 
170
- ## Create Your Route Handler
170
+ ## Create your route handler
171
171
 
172
172
  To invoke your new workflow, add a server handler at `src/routes/api/signup.ts`:
173
173
 
@@ -232,13 +232,13 @@ npx workflow inspect runs
232
232
 
233
233
  ## Deploying to production
234
234
 
235
- Workflow SDK apps currently work best when deployed to [Vercel](https://vercel.com/home) and needs no special configuration.
235
+ Workflow SDK apps currently work best when deployed to [Vercel](https://vercel.com/home) and need no special configuration.
236
236
 
237
237
  <FluidComputeCallout />
238
238
 
239
239
  Check the [Deploying](/docs/deploying) section to learn how your workflows can be deployed elsewhere.
240
240
 
241
- ## Next Steps
241
+ ## Next steps
242
242
 
243
243
  * Learn more about the [Foundations](/docs/foundations).
244
244
  * Check [Errors](/docs/errors) if you encounter issues.
@@ -20,7 +20,7 @@ This guide will walk through setting up your first workflow in a Vite app. Along
20
20
  <Steps>
21
21
 
22
22
  <Step>
23
- ## Create Your Vite Project
23
+ ## Create your Vite project
24
24
 
25
25
  Start by creating a new Vite project. This command will create a new directory named `my-workflow-app` with a minimal setup and setup a Vite project inside it.
26
26
 
@@ -91,7 +91,7 @@ To enable helpful hints in your IDE, setup the workflow plugin in `tsconfig.json
91
91
 
92
92
  <Step>
93
93
 
94
- ## Create Your First Workflow
94
+ ## Create your first workflow
95
95
 
96
96
  Create a new file for our first workflow:
97
97
 
@@ -112,14 +112,14 @@ export async function handleUserSignup(email: string) {
112
112
 
113
113
  ```
114
114
 
115
- We'll fill in those functions next, but let's take a look at this code:
115
+ We'll fill in those functions next. The current code does the following:
116
116
 
117
117
  * We define a **workflow** function with the directive `"use workflow"`. Think of the workflow function as the _orchestrator_ of individual **steps**.
118
118
  * The Workflow SDK's `sleep` function allows us to suspend execution of the workflow without using up any resources. A sleep can be a few seconds, hours, days, or even months long.
119
119
 
120
- ## Create Your Workflow Steps
120
+ ## Create your workflow steps
121
121
 
122
- Let's now define those missing functions.
122
+ Define the missing functions.
123
123
 
124
124
  ```typescript title="workflows/user-signup.ts" lineNumbers
125
125
  import { FatalError } from "workflow"
@@ -172,7 +172,7 @@ We'll dive deeper into workflows, steps, and other ways to suspend or handle eve
172
172
 
173
173
  <Step>
174
174
 
175
- ## Create Your Route Handler
175
+ ## Create your route handler
176
176
 
177
177
  To invoke your new workflow, we'll have to add your workflow to a `POST` API route handler, `api/signup.post.ts` with the following code:
178
178
 
@@ -244,7 +244,7 @@ Check the [Deploying](/docs/deploying) section to learn how your workflows can b
244
244
 
245
245
  If you see this error:
246
246
 
247
- ```
247
+ ```text
248
248
  'start' received an invalid workflow function. Ensure the Workflow SDK is configured correctly and the function includes a 'use workflow' directive.
249
249
  ```
250
250
 
@@ -255,7 +255,7 @@ Check both of these first:
255
255
 
256
256
  See [start-invalid-workflow-function](/docs/errors/start-invalid-workflow-function) for full examples and fixes.
257
257
 
258
- ## Next Steps
258
+ ## Next steps
259
259
 
260
260
  * Learn more about the [Foundations](/docs/foundations).
261
261
  * Check [Errors](/docs/errors) if you encounter issues.