workflow 5.0.0-beta.4 → 5.0.0-beta.40
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.
- package/README.md +63 -20
- package/dist/api-workflow.d.ts +1 -1
- package/dist/api-workflow.d.ts.map +1 -1
- package/dist/api-workflow.js +1 -1
- package/dist/api.d.ts +5 -1
- package/dist/api.d.ts.map +1 -1
- package/dist/api.js +12 -2
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +6 -1
- package/dist/internal/builtins.d.ts +17 -0
- package/dist/internal/builtins.d.ts.map +1 -1
- package/dist/internal/builtins.js +65 -1
- package/dist/internal/errors.d.ts +1 -1
- package/dist/internal/errors.d.ts.map +1 -1
- package/dist/internal/errors.js +2 -2
- package/dist/nest-builder.d.ts +2 -0
- package/dist/nest-builder.d.ts.map +1 -0
- package/dist/nest-builder.js +2 -0
- package/dist/nest-vercel-builder.d.ts +2 -0
- package/dist/nest-vercel-builder.d.ts.map +1 -0
- package/dist/nest-vercel-builder.js +2 -0
- package/dist/observability.d.ts +1 -1
- package/dist/observability.js +2 -2
- package/dist/runtime.d.ts +2 -1
- package/dist/runtime.d.ts.map +1 -1
- package/dist/runtime.js +5 -2
- package/docs/ai/chat-session-modeling.mdx +7 -3
- package/docs/ai/defining-tools.mdx +2 -2
- package/docs/ai/index.mdx +30 -25
- package/docs/ai/message-queueing.mdx +10 -10
- package/docs/ai/resumable-streams.mdx +9 -1
- package/docs/api-reference/index.mdx +24 -0
- package/docs/api-reference/meta.json +8 -0
- package/docs/api-reference/vitest/index.mdx +28 -7
- package/docs/api-reference/workflow/create-hook.mdx +79 -0
- package/docs/api-reference/workflow/create-webhook.mdx +1 -0
- package/docs/api-reference/workflow/define-hook.mdx +26 -24
- package/docs/api-reference/workflow/fatal-error.mdx +29 -7
- package/docs/api-reference/workflow/fetch.mdx +8 -4
- package/docs/api-reference/workflow/index.mdx +3 -0
- package/docs/api-reference/workflow/set-attributes.mdx +61 -0
- package/docs/api-reference/workflow/sleep.mdx +1 -1
- package/docs/api-reference/workflow-ai/durable-agent.mdx +7 -45
- package/docs/api-reference/workflow-ai/index.mdx +2 -2
- package/docs/api-reference/workflow-ai/workflow-chat-transport.mdx +44 -1
- package/docs/api-reference/workflow-api/get-hook-by-token.mdx +9 -0
- package/docs/api-reference/workflow-api/get-run.mdx +25 -0
- package/docs/api-reference/workflow-api/index.mdx +6 -8
- package/docs/api-reference/workflow-api/resume-hook.mdx +60 -1
- package/docs/api-reference/workflow-api/resume-webhook.mdx +6 -4
- package/docs/api-reference/workflow-api/start.mdx +39 -6
- package/docs/api-reference/workflow-astro/index.mdx +18 -0
- package/docs/api-reference/workflow-astro/meta.json +4 -0
- package/docs/api-reference/workflow-astro/workflow.mdx +45 -0
- package/docs/api-reference/workflow-errors/hook-conflict-error.mdx +60 -0
- package/docs/api-reference/workflow-errors/index.mdx +88 -0
- package/docs/api-reference/workflow-errors/meta.json +6 -0
- package/docs/api-reference/workflow-errors/precondition-failed-error.mdx +68 -0
- package/docs/api-reference/workflow-errors/run-not-supported-error.mdx +58 -0
- package/docs/api-reference/workflow-errors/workflow-error.mdx +52 -0
- package/docs/api-reference/workflow-errors/workflow-run-failed-error.mdx +16 -6
- package/docs/api-reference/workflow-errors/workflow-run-not-completed-error.mdx +58 -0
- package/docs/api-reference/workflow-errors/workflow-runtime-error.mdx +58 -0
- package/docs/api-reference/workflow-globals.mdx +4 -1
- package/docs/api-reference/workflow-nest/configure-workflow-controller.mdx +33 -0
- package/docs/api-reference/workflow-nest/index.mdx +31 -0
- package/docs/api-reference/workflow-nest/meta.json +9 -0
- package/docs/api-reference/workflow-nest/nest-local-builder.mdx +64 -0
- package/docs/api-reference/workflow-nest/workflow-controller.mdx +40 -0
- package/docs/api-reference/workflow-nest/workflow-module.mdx +74 -0
- package/docs/api-reference/workflow-next/with-workflow.mdx +56 -2
- package/docs/api-reference/workflow-nitro/index.mdx +60 -0
- package/docs/api-reference/workflow-nuxt/index.mdx +48 -0
- package/docs/api-reference/workflow-observability/hydrate-data.mdx +35 -0
- package/docs/api-reference/workflow-observability/hydrate-resource-io.mdx +62 -0
- package/docs/api-reference/workflow-observability/index.mdx +64 -0
- package/docs/api-reference/workflow-observability/meta.json +11 -0
- package/docs/api-reference/workflow-observability/observability-revivers.mdx +50 -0
- package/docs/api-reference/workflow-observability/parse-class-name.mdx +41 -0
- package/docs/api-reference/workflow-observability/parse-step-name.mdx +40 -0
- package/docs/api-reference/workflow-observability/parse-workflow-name.mdx +55 -0
- package/docs/api-reference/workflow-runtime/create-world.mdx +39 -0
- package/docs/api-reference/workflow-runtime/get-world-handlers.mdx +44 -0
- package/docs/api-reference/{workflow-api → workflow-runtime}/get-world.mdx +7 -10
- package/docs/api-reference/workflow-runtime/health-check.mdx +50 -0
- package/docs/api-reference/workflow-runtime/index.mdx +43 -0
- package/docs/api-reference/workflow-runtime/meta.json +12 -0
- package/docs/api-reference/workflow-runtime/set-world.mdx +49 -0
- package/docs/api-reference/workflow-runtime/workflow-entrypoint.mdx +42 -0
- package/docs/api-reference/workflow-runtime/world/analytics.mdx +138 -0
- package/docs/api-reference/{workflow-api → workflow-runtime}/world/index.mdx +10 -10
- package/docs/api-reference/workflow-runtime/world/meta.json +4 -0
- package/docs/api-reference/{workflow-api → workflow-runtime}/world/queue.mdx +8 -6
- package/docs/api-reference/{workflow-api → workflow-runtime}/world/storage.mdx +18 -5
- package/docs/api-reference/{workflow-api → workflow-runtime}/world/streams.mdx +2 -2
- package/docs/api-reference/workflow-serde/index.mdx +0 -1
- package/docs/api-reference/workflow-serde/workflow-deserialize.mdx +1 -2
- package/docs/api-reference/workflow-serde/workflow-serialize.mdx +2 -2
- package/docs/api-reference/workflow-sveltekit/index.mdx +18 -0
- package/docs/api-reference/workflow-sveltekit/meta.json +4 -0
- package/docs/api-reference/workflow-sveltekit/workflow-plugin.mdx +42 -0
- package/docs/api-reference/workflow-vite/index.mdx +18 -0
- package/docs/api-reference/workflow-vite/meta.json +4 -0
- package/docs/api-reference/workflow-vite/workflow.mdx +48 -0
- package/docs/changelog/attributes-mvp.mdx +380 -0
- package/docs/changelog/eager-processing.mdx +269 -0
- package/docs/changelog/index.mdx +3 -1
- package/docs/changelog/lazy-event-creation.md +127 -0
- package/docs/changelog/meta.json +9 -1
- package/docs/changelog/resilient-resume.mdx +22 -0
- package/docs/changelog/resilient-start.mdx +31 -283
- package/docs/changelog/step-message-ownership.mdx +360 -0
- package/docs/changelog/turbo-mode.md +87 -0
- package/docs/comparisons/index.mdx +66 -0
- package/docs/comparisons/meta.json +11 -0
- package/docs/comparisons/workflow-sdk-vs-aws-agentcore.mdx +55 -0
- package/docs/comparisons/workflow-sdk-vs-aws-step-functions.mdx +111 -0
- package/docs/comparisons/workflow-sdk-vs-cloudflare-workflows.mdx +71 -0
- package/docs/comparisons/workflow-sdk-vs-inngest.mdx +102 -0
- package/docs/comparisons/workflow-sdk-vs-temporal.mdx +123 -0
- package/docs/comparisons/workflow-sdk-vs-trigger-dev.mdx +103 -0
- package/docs/configuration/build-and-diagnostics.mdx +70 -0
- package/docs/configuration/cli-and-web-ui.mdx +182 -0
- package/docs/configuration/framework-options.mdx +165 -0
- package/docs/configuration/index.mdx +32 -0
- package/docs/configuration/meta.json +12 -0
- package/docs/configuration/runtime-tuning.mdx +276 -0
- package/docs/configuration/worlds.mdx +275 -0
- package/docs/cookbook/advanced/child-workflows.mdx +203 -256
- package/docs/cookbook/advanced/meta.json +1 -1
- package/docs/cookbook/advanced/publishing-libraries.mdx +33 -24
- package/docs/cookbook/advanced/serializable-steps.mdx +12 -4
- package/docs/cookbook/advanced/upgrading-workflows.mdx +199 -0
- package/docs/cookbook/agent-patterns/agent-cancellation.mdx +34 -75
- package/docs/cookbook/agent-patterns/durable-agent.mdx +14 -142
- package/docs/cookbook/agent-patterns/human-in-the-loop.mdx +11 -3
- package/docs/cookbook/common-patterns/batching.mdx +4 -0
- package/docs/cookbook/common-patterns/idempotency.mdx +40 -52
- package/docs/cookbook/common-patterns/rate-limiting.mdx +5 -1
- package/docs/cookbook/common-patterns/saga.mdx +6 -2
- package/docs/cookbook/common-patterns/scheduling.mdx +12 -0
- package/docs/cookbook/common-patterns/sequential-and-parallel.mdx +4 -0
- package/docs/cookbook/common-patterns/timeouts.mdx +6 -1
- package/docs/cookbook/common-patterns/webhooks.mdx +4 -0
- package/docs/cookbook/common-patterns/workflow-composition.mdx +19 -16
- package/docs/cookbook/index.mdx +3 -3
- package/docs/cookbook/integrations/ai-sdk.mdx +64 -28
- package/docs/cookbook/integrations/chat-sdk.mdx +17 -0
- package/docs/cookbook/integrations/sandbox.mdx +17 -0
- package/docs/{deploying/index.mdx → deploying.mdx} +7 -7
- package/docs/errors/abort-signal-timeout-in-workflow.mdx +84 -0
- package/docs/errors/corrupted-event-log.mdx +5 -5
- package/docs/errors/deployment-mismatch.mdx +71 -0
- package/docs/errors/fetch-in-workflow.mdx +4 -0
- package/docs/errors/hook-conflict.mdx +60 -4
- package/docs/errors/index.mdx +1 -35
- package/docs/errors/node-js-module-in-workflow.mdx +4 -0
- package/docs/errors/replay-divergence.mdx +27 -0
- package/docs/errors/runtime-decryption-failed.mdx +77 -0
- package/docs/errors/serialization-failed.mdx +4 -0
- package/docs/errors/start-invalid-workflow-function.mdx +4 -0
- package/docs/errors/step-executed-multiple-times.mdx +23 -0
- package/docs/errors/step-not-registered.mdx +1 -1
- package/docs/errors/timeout-in-workflow.mdx +4 -0
- package/docs/errors/webhook-response-not-sent.mdx +4 -0
- package/docs/foundations/cancellation.mdx +459 -0
- package/docs/foundations/errors-and-retries.mdx +7 -3
- package/docs/foundations/hooks.mdx +29 -0
- package/docs/foundations/idempotency.mdx +243 -11
- package/docs/foundations/index.mdx +1 -23
- package/docs/foundations/meta.json +3 -1
- package/docs/foundations/serialization.mdx +77 -41
- package/docs/foundations/starting-workflows.mdx +79 -2
- package/docs/foundations/streaming.mdx +14 -23
- package/docs/foundations/versioning.mdx +263 -0
- package/docs/getting-started/astro.mdx +12 -2
- package/docs/getting-started/express.mdx +6 -2
- package/docs/getting-started/fastify.mdx +6 -2
- package/docs/getting-started/hono.mdx +6 -2
- package/docs/getting-started/index.mdx +16 -10
- package/docs/getting-started/meta.json +4 -1
- package/docs/getting-started/nestjs.mdx +77 -3
- package/docs/getting-started/next.mdx +12 -6
- package/docs/getting-started/nitro.mdx +28 -2
- package/docs/getting-started/nuxt.mdx +6 -2
- package/docs/getting-started/python.mdx +24 -18
- package/docs/getting-started/react-router/index.mdx +33 -0
- package/docs/getting-started/react-router/meta.json +5 -0
- package/docs/getting-started/react-router/v7.mdx +237 -0
- package/docs/getting-started/react-router/v8.mdx +232 -0
- package/docs/getting-started/sveltekit.mdx +12 -2
- package/docs/getting-started/tanstack-start.mdx +245 -0
- package/docs/getting-started/vite.mdx +6 -2
- package/docs/how-it-works/cancellation.mdx +287 -0
- package/docs/how-it-works/code-transform.mdx +21 -17
- package/docs/how-it-works/encryption.mdx +5 -5
- package/docs/how-it-works/event-sourcing.mdx +6 -6
- package/docs/how-it-works/framework-integrations.mdx +96 -337
- package/docs/how-it-works/meta.json +2 -1
- package/docs/internal/index.mdx +21 -0
- package/docs/internal/meta.json +10 -0
- package/docs/internal/nitro-native-build.mdx +38 -0
- package/docs/internal/nitro-web-ui.mdx +24 -0
- package/docs/internal/serializable-abort-controller.mdx +148 -0
- package/docs/meta.json +2 -2
- package/docs/observability/attributes.mdx +112 -0
- package/docs/observability/index.mdx +20 -1
- package/docs/observability/meta.json +1 -1
- package/docs/observability/tracing.mdx +124 -0
- package/docs/testing/index.mdx +2 -2
- package/package.json +17 -13
- package/docs/api-reference/workflow-api/world/meta.json +0 -4
- package/docs/api-reference/workflow-api/world/observability.mdx +0 -164
- package/docs/cookbook/advanced/distributed-abort-controller.mdx +0 -318
- package/docs/deploying/building-a-world.mdx +0 -251
- package/docs/deploying/meta.json +0 -4
- package/docs/deploying/world/local-world.mdx +0 -84
- package/docs/deploying/world/meta.json +0 -4
- package/docs/deploying/world/postgres-world.mdx +0 -222
- package/docs/deploying/world/vercel-world.mdx +0 -179
- package/docs/migration-guides/index.mdx +0 -34
- package/docs/migration-guides/meta.json +0 -9
- package/docs/migration-guides/migrating-from-aws-step-functions.mdx +0 -363
- package/docs/migration-guides/migrating-from-inngest.mdx +0 -314
- package/docs/migration-guides/migrating-from-temporal.mdx +0 -318
- package/docs/migration-guides/migrating-from-trigger-dev.mdx +0 -337
|
@@ -0,0 +1,182 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: CLI and Web UI
|
|
3
|
+
description: CLI flags and environment variables for inspecting local, Postgres, and Vercel Workflow runs.
|
|
4
|
+
type: reference
|
|
5
|
+
summary: Configure workflow inspect, workflow cancel, workflow web, workflow health, and observability tooling.
|
|
6
|
+
related:
|
|
7
|
+
- /docs/observability
|
|
8
|
+
- /docs/configuration/worlds
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
The `workflow` CLI uses flags first, then environment variables, then defaults or local inference.
|
|
12
|
+
|
|
13
|
+
Vercel project and auth settings can often be inferred from `.vercel/project.json` and your Vercel CLI login.
|
|
14
|
+
|
|
15
|
+
## Target backend
|
|
16
|
+
|
|
17
|
+
### `--backend` / `-b`
|
|
18
|
+
|
|
19
|
+
- Environment variable: `WORKFLOW_TARGET_WORLD`
|
|
20
|
+
- Default: `local`
|
|
21
|
+
- Backend to inspect: `local`, `vercel`, or a World package.
|
|
22
|
+
|
|
23
|
+
### `--authToken` / `-a`
|
|
24
|
+
|
|
25
|
+
- Environment variable: `WORKFLOW_VERCEL_AUTH_TOKEN`
|
|
26
|
+
- Default: Vercel CLI login
|
|
27
|
+
- Vercel token for `--backend vercel`.
|
|
28
|
+
|
|
29
|
+
### `--project`
|
|
30
|
+
|
|
31
|
+
- Environment variable: `WORKFLOW_VERCEL_PROJECT`
|
|
32
|
+
- Default: inferred when possible
|
|
33
|
+
- Vercel project ID for `--backend vercel`.
|
|
34
|
+
|
|
35
|
+
### `--team`
|
|
36
|
+
|
|
37
|
+
- Environment variable: `WORKFLOW_VERCEL_TEAM`
|
|
38
|
+
- Default: inferred when possible
|
|
39
|
+
- Vercel team ID for `--backend vercel`.
|
|
40
|
+
|
|
41
|
+
### `WORKFLOW_VERCEL_PROJECT_NAME`
|
|
42
|
+
|
|
43
|
+
- CLI flag: none
|
|
44
|
+
- Default: inferred when possible
|
|
45
|
+
- Vercel project slug used for dashboard links.
|
|
46
|
+
|
|
47
|
+
### `--env` / `-e`
|
|
48
|
+
|
|
49
|
+
- Environment variable: `WORKFLOW_VERCEL_ENV`
|
|
50
|
+
- Default: `production`
|
|
51
|
+
- Vercel environment for `--backend vercel`.
|
|
52
|
+
- Accepts `production` or `preview`.
|
|
53
|
+
|
|
54
|
+
## Web UI
|
|
55
|
+
|
|
56
|
+
### `--web` / `-w`
|
|
57
|
+
|
|
58
|
+
- Environment variable: none
|
|
59
|
+
- Default: disabled
|
|
60
|
+
- Opens the relevant dashboard or web UI instead of printing terminal output.
|
|
61
|
+
|
|
62
|
+
### `--webPort`
|
|
63
|
+
|
|
64
|
+
- Environment variable: `WORKFLOW_WEB_PORT`
|
|
65
|
+
- Default: `3456`
|
|
66
|
+
- Port for the local web UI server.
|
|
67
|
+
|
|
68
|
+
### `--noBrowser`
|
|
69
|
+
|
|
70
|
+
- Environment variable: `WORKFLOW_DISABLE_BROWSER_OPEN`
|
|
71
|
+
- Default: browser opens
|
|
72
|
+
- Prevents the CLI from opening a browser for web UI commands.
|
|
73
|
+
|
|
74
|
+
### `--localUi`
|
|
75
|
+
|
|
76
|
+
- Environment variable: `WORKFLOW_LOCAL_UI`
|
|
77
|
+
- Default: disabled
|
|
78
|
+
- Uses the local web UI instead of the Vercel dashboard when inspecting Vercel.
|
|
79
|
+
|
|
80
|
+
### `--url`
|
|
81
|
+
|
|
82
|
+
- Environment variable: none
|
|
83
|
+
- Default: disabled
|
|
84
|
+
- Prints the dashboard or run deep-link URL instead of opening a browser or starting a local server.
|
|
85
|
+
|
|
86
|
+
## Output and filtering
|
|
87
|
+
|
|
88
|
+
### `--json` / `-j`
|
|
89
|
+
|
|
90
|
+
- Environment variable: none
|
|
91
|
+
- Default: disabled
|
|
92
|
+
- Prints machine-readable JSON where the command supports it.
|
|
93
|
+
|
|
94
|
+
### `--sort`
|
|
95
|
+
|
|
96
|
+
- Environment variable: none
|
|
97
|
+
- Default: `desc`
|
|
98
|
+
- Sort order for list commands. Accepts `asc` or `desc`.
|
|
99
|
+
|
|
100
|
+
### `--limit`
|
|
101
|
+
|
|
102
|
+
- Environment variable: none
|
|
103
|
+
- Default: `20`
|
|
104
|
+
- Number of items returned per page for list commands.
|
|
105
|
+
|
|
106
|
+
### `--cursor`
|
|
107
|
+
|
|
108
|
+
- Environment variable: none
|
|
109
|
+
- Default: unset
|
|
110
|
+
- Pagination cursor for list commands.
|
|
111
|
+
|
|
112
|
+
### `--interactive` / `-i`
|
|
113
|
+
|
|
114
|
+
- Environment variable: none
|
|
115
|
+
- Default: disabled
|
|
116
|
+
- Enables keyboard-controlled pagination for supported list commands.
|
|
117
|
+
|
|
118
|
+
## Bulk cancel
|
|
119
|
+
|
|
120
|
+
`workflow cancel <run-id>` cancels one run. Given a filter instead, it bulk-cancels a batch; bulk mode requires `--status` or `--workflowName`.
|
|
121
|
+
|
|
122
|
+
### `--status`
|
|
123
|
+
|
|
124
|
+
- Command: `workflow cancel`
|
|
125
|
+
- Default: unset
|
|
126
|
+
- Restricts the batch to this status. Only `pending` and `running` are accepted — terminal runs cannot be cancelled.
|
|
127
|
+
|
|
128
|
+
### `--workflowName` / `-n`
|
|
129
|
+
|
|
130
|
+
- Command: `workflow cancel`
|
|
131
|
+
- Default: unset
|
|
132
|
+
- Restricts the batch to one workflow. Expects the generated workflow ID from `workflow inspect runs`, not the short function name.
|
|
133
|
+
|
|
134
|
+
### `--limit` (cancel)
|
|
135
|
+
|
|
136
|
+
- Command: `workflow cancel`
|
|
137
|
+
- Default: `50`
|
|
138
|
+
- Maximum runs to cancel in one batch (1–500). Only one batch is cancelled per invocation; re-run to cancel the next.
|
|
139
|
+
|
|
140
|
+
### `--confirm` / `-y`
|
|
141
|
+
|
|
142
|
+
- Command: `workflow cancel`
|
|
143
|
+
- Default: disabled
|
|
144
|
+
- Skips the interactive confirmation prompt.
|
|
145
|
+
|
|
146
|
+
## Health checks
|
|
147
|
+
|
|
148
|
+
### `--port` / `-p`
|
|
149
|
+
|
|
150
|
+
- Command: `workflow health`
|
|
151
|
+
- Environment variable: `WORKFLOW_LOCAL_BASE_URL`, then `PORT`
|
|
152
|
+
- Default: `3000` when neither env var is set
|
|
153
|
+
- Local server port for health checks.
|
|
154
|
+
- The flag writes `WORKFLOW_LOCAL_BASE_URL`.
|
|
155
|
+
|
|
156
|
+
## Verbose logging and updates
|
|
157
|
+
|
|
158
|
+
### `--verbose` / `-v`
|
|
159
|
+
|
|
160
|
+
- Environment variable: `DEBUG`
|
|
161
|
+
- Default: disabled
|
|
162
|
+
- Enables verbose CLI output.
|
|
163
|
+
|
|
164
|
+
### `WORKFLOW_NO_UPDATE_CHECK`
|
|
165
|
+
|
|
166
|
+
- CLI flag: none
|
|
167
|
+
- Default: update check enabled
|
|
168
|
+
- Set `1` to disable the CLI update check.
|
|
169
|
+
|
|
170
|
+
## Observability paths
|
|
171
|
+
|
|
172
|
+
### `WORKFLOW_OBSERVABILITY_CWD`
|
|
173
|
+
|
|
174
|
+
- CLI flag: none
|
|
175
|
+
- Default: `process.cwd()`
|
|
176
|
+
- Working directory used by observability tooling to find `.vercel`, `.workflow-data`, and manifests.
|
|
177
|
+
|
|
178
|
+
### `WORKFLOW_MANIFEST_PATH`
|
|
179
|
+
|
|
180
|
+
- CLI flag: none
|
|
181
|
+
- Default: inferred
|
|
182
|
+
- Explicit path to the workflow manifest for the web UI.
|
|
@@ -0,0 +1,165 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Framework Options
|
|
3
|
+
description: Build-time and dev-server configuration for Workflow framework integrations.
|
|
4
|
+
type: reference
|
|
5
|
+
summary: Configure Workflow through framework plugins and module options.
|
|
6
|
+
related:
|
|
7
|
+
- /docs/api-reference/workflow-next/with-workflow
|
|
8
|
+
- /docs/configuration/build-and-diagnostics
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
Framework options are read at build or dev-server startup. Use them for settings that belong in source control, such as source-map behavior or framework-specific output paths.
|
|
12
|
+
|
|
13
|
+
## Next.js
|
|
14
|
+
|
|
15
|
+
`withWorkflow()` accepts an optional second argument.
|
|
16
|
+
|
|
17
|
+
### `workflows.local.port`
|
|
18
|
+
|
|
19
|
+
- Environment override: `PORT`
|
|
20
|
+
- Default: auto-detected
|
|
21
|
+
- Local-only. Sets the application port used by the Local World when queue messages call back into the app.
|
|
22
|
+
- The option writes `PORT` for non-Vercel builds.
|
|
23
|
+
|
|
24
|
+
### `workflows.sourcemap`
|
|
25
|
+
|
|
26
|
+
- Environment override: `WORKFLOW_SOURCEMAP`
|
|
27
|
+
- Default: `inline` in development, `false` in production
|
|
28
|
+
- Controls source maps for generated workflow bundles.
|
|
29
|
+
- Explicit config wins over `WORKFLOW_SOURCEMAP`.
|
|
30
|
+
|
|
31
|
+
```typescript title="next.config.ts" lineNumbers
|
|
32
|
+
import { withWorkflow } from "workflow/next";
|
|
33
|
+
|
|
34
|
+
export default withWorkflow(
|
|
35
|
+
{},
|
|
36
|
+
{
|
|
37
|
+
workflows: {
|
|
38
|
+
local: {
|
|
39
|
+
port: 4000,
|
|
40
|
+
},
|
|
41
|
+
sourcemap: false,
|
|
42
|
+
},
|
|
43
|
+
}
|
|
44
|
+
);
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
## Nitro and Nuxt
|
|
48
|
+
|
|
49
|
+
Configure Workflow through the Nitro `workflow` module options.
|
|
50
|
+
|
|
51
|
+
### `workflow.dirs`
|
|
52
|
+
|
|
53
|
+
- Environment override: none
|
|
54
|
+
- Default: `["workflows"]`
|
|
55
|
+
- Directories scanned for workflow files.
|
|
56
|
+
|
|
57
|
+
### `workflow.typescriptPlugin`
|
|
58
|
+
|
|
59
|
+
- Environment override: none
|
|
60
|
+
- Default: `false` for raw Nitro, `true` through the Nuxt module
|
|
61
|
+
- Enables the Workflow TypeScript language-service plugin in generated `tsconfig.json`.
|
|
62
|
+
- This affects editor diagnostics and completions. Workflow builds do not require it.
|
|
63
|
+
- Raw Nitro leaves it opt-in because it changes TypeScript editor behavior. Nuxt enables it by default because the Nuxt module owns the generated `tsconfig.json` flow.
|
|
64
|
+
|
|
65
|
+
### `workflow.runtime`
|
|
66
|
+
|
|
67
|
+
- Environment override: none
|
|
68
|
+
- Default: framework default
|
|
69
|
+
- Node.js runtime emitted for Vercel Functions, such as `nodejs22.x` or `nodejs24.x`.
|
|
70
|
+
|
|
71
|
+
### `workflow.sourcemap`
|
|
72
|
+
|
|
73
|
+
- Environment override: `WORKFLOW_SOURCEMAP`
|
|
74
|
+
- Default: `inline` in development, `false` in production
|
|
75
|
+
- Controls source maps for generated workflow bundles.
|
|
76
|
+
|
|
77
|
+
## NestJS
|
|
78
|
+
|
|
79
|
+
Configure Workflow through `WorkflowModule.forRoot()`.
|
|
80
|
+
|
|
81
|
+
### `workingDir`
|
|
82
|
+
|
|
83
|
+
- Environment override: none
|
|
84
|
+
- Default: `process.cwd()`
|
|
85
|
+
- Application root used for workflow discovery and bundling.
|
|
86
|
+
|
|
87
|
+
### `dirs`
|
|
88
|
+
|
|
89
|
+
- Environment override: none
|
|
90
|
+
- Default: `["src"]`
|
|
91
|
+
- Directories scanned for workflow files.
|
|
92
|
+
|
|
93
|
+
### `outDir`
|
|
94
|
+
|
|
95
|
+
- Environment override: none
|
|
96
|
+
- Default: `.nestjs/workflow`
|
|
97
|
+
- Directory for generated workflow bundles.
|
|
98
|
+
|
|
99
|
+
### `watch`
|
|
100
|
+
|
|
101
|
+
- Environment override: none
|
|
102
|
+
- Default: `false`
|
|
103
|
+
- Rebuilds workflow bundles during development.
|
|
104
|
+
|
|
105
|
+
### `moduleType`
|
|
106
|
+
|
|
107
|
+
- Environment override: none
|
|
108
|
+
- Default: `es6`
|
|
109
|
+
- Set to `commonjs` when the Nest app compiles TypeScript to CJS through SWC.
|
|
110
|
+
|
|
111
|
+
### `distDir`
|
|
112
|
+
|
|
113
|
+
- Environment override: none
|
|
114
|
+
- Default: `dist`
|
|
115
|
+
- Compiled JavaScript output directory used by the CJS import rewrite.
|
|
116
|
+
|
|
117
|
+
### `sourcemap`
|
|
118
|
+
|
|
119
|
+
- Environment override: `WORKFLOW_SOURCEMAP`
|
|
120
|
+
- Default: `inline` in development, `false` in production
|
|
121
|
+
- Controls source maps for generated workflow bundles.
|
|
122
|
+
|
|
123
|
+
### `skipBuild`
|
|
124
|
+
|
|
125
|
+
- Environment override: none
|
|
126
|
+
- Default: `false`
|
|
127
|
+
- Skips bundle generation when bundles are already pre-built.
|
|
128
|
+
|
|
129
|
+
## Astro
|
|
130
|
+
|
|
131
|
+
### `sourcemap`
|
|
132
|
+
|
|
133
|
+
- Environment override: `WORKFLOW_SOURCEMAP`
|
|
134
|
+
- Default: `inline` in development, `false` in production
|
|
135
|
+
- Controls source maps for generated workflow bundles.
|
|
136
|
+
|
|
137
|
+
## SvelteKit
|
|
138
|
+
|
|
139
|
+
### `sourcemap`
|
|
140
|
+
|
|
141
|
+
- Environment override: `WORKFLOW_SOURCEMAP`
|
|
142
|
+
- Default: `inline` in development, `false` in production
|
|
143
|
+
- Controls source maps for generated workflow bundles.
|
|
144
|
+
|
|
145
|
+
## Rollup
|
|
146
|
+
|
|
147
|
+
### `exclude`
|
|
148
|
+
|
|
149
|
+
- Environment override: none
|
|
150
|
+
- Default: `[]`
|
|
151
|
+
- Path prefixes skipped by the directive transform.
|
|
152
|
+
|
|
153
|
+
## Source-map values
|
|
154
|
+
|
|
155
|
+
`WORKFLOW_SOURCEMAP` accepts these values:
|
|
156
|
+
|
|
157
|
+
- `true`, `inline`, or `1` - append an inline base64 source map to each generated bundle.
|
|
158
|
+
- `linked` - write a `.map` file and add a `sourceMappingURL` comment.
|
|
159
|
+
- `external` - write a `.map` file without adding the comment.
|
|
160
|
+
- `both` - emit inline and external source maps.
|
|
161
|
+
- `false` or `0` - omit source maps.
|
|
162
|
+
|
|
163
|
+
<Callout type="info">
|
|
164
|
+
The legacy `WORKFLOW_EMIT_SOURCEMAPS_FOR_DEBUGGING=1` variable still works, but it only affects the final workflow wrapper and webhook bundle. Prefer `WORKFLOW_SOURCEMAP` or a framework `sourcemap` option.
|
|
165
|
+
</Callout>
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Configuration
|
|
3
|
+
description: Reference for Workflow SDK configuration options, environment variables, and CLI overrides.
|
|
4
|
+
type: conceptual
|
|
5
|
+
summary: Configure framework integrations, Worlds, runtime tuning, builds, and CLI observability.
|
|
6
|
+
prerequisites:
|
|
7
|
+
- /docs/foundations/workflows-and-steps
|
|
8
|
+
related:
|
|
9
|
+
- /docs/configuration/framework-options
|
|
10
|
+
- /docs/configuration/worlds
|
|
11
|
+
- /docs/configuration/runtime-tuning
|
|
12
|
+
- /docs/configuration/build-and-diagnostics
|
|
13
|
+
- /docs/configuration/cli-and-web-ui
|
|
14
|
+
---
|
|
15
|
+
|
|
16
|
+
Workflow SDK is configured through typed framework options, World factory options, environment variables, and CLI flags.
|
|
17
|
+
|
|
18
|
+
When more than one surface controls the same setting, the usual precedence is:
|
|
19
|
+
|
|
20
|
+
```txt
|
|
21
|
+
explicit option or CLI flag > environment variable > built-in default
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
Invalid environment variable values do not crash the app. They log a warning and fall back to the default, or to the documented clamp range.
|
|
25
|
+
|
|
26
|
+
## Configuration areas
|
|
27
|
+
|
|
28
|
+
- [Framework options](/docs/configuration/framework-options) - build-time and dev-server options for Next.js, Nitro, NestJS, Astro, SvelteKit, and Rollup.
|
|
29
|
+
- [Worlds](/docs/configuration/worlds) - `WORKFLOW_TARGET_WORLD`, Local World, Postgres World, and Vercel World configuration.
|
|
30
|
+
- [Runtime tuning](/docs/configuration/runtime-tuning) - replay budgets, inline execution, queue delivery limits, compression, tracing, and advanced runtime escape hatches.
|
|
31
|
+
- [Build and diagnostics](/docs/configuration/build-and-diagnostics) - public manifests, HMR logs, and source-map controls.
|
|
32
|
+
- [CLI and web UI](/docs/configuration/cli-and-web-ui) - `workflow inspect`, `workflow web`, `workflow health`, and observability environment overrides.
|
|
@@ -0,0 +1,276 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Runtime Tuning
|
|
3
|
+
description: Runtime environment variables for replay, inline execution, queue delivery, compression, tracing, and advanced limits.
|
|
4
|
+
type: reference
|
|
5
|
+
summary: Tune Workflow runtime behavior where workflows execute.
|
|
6
|
+
related:
|
|
7
|
+
- /docs/configuration/worlds
|
|
8
|
+
- /docs/how-it-works/event-sourcing
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
Runtime variables are read where workflows execute. Set them on the deployment or dev server.
|
|
12
|
+
|
|
13
|
+
## Client polling
|
|
14
|
+
|
|
15
|
+
### `WORKFLOW_RETURN_VALUE_POLL_INTERVAL_MS`
|
|
16
|
+
|
|
17
|
+
- Default: `1000`
|
|
18
|
+
- Minimum: `1`
|
|
19
|
+
- Delay between status requests made by [`Run.returnValue`](/docs/api-reference/workflow-api/get-run) while a workflow run is not yet complete.
|
|
20
|
+
- Increase it to reduce polling traffic at the cost of noticing completion later.
|
|
21
|
+
- This variable is read by the process awaiting `Run.returnValue`, such as an E2E test runner, rather than by the workflow deployment.
|
|
22
|
+
|
|
23
|
+
## Replay and queue delivery
|
|
24
|
+
|
|
25
|
+
### `WORKFLOW_REPLAY_TIMEOUT_MS`
|
|
26
|
+
|
|
27
|
+
- Default: `240000`
|
|
28
|
+
- Clamp: `30000` to `780000`
|
|
29
|
+
- Charged time budget for replay and orchestration work in one handler invocation.
|
|
30
|
+
- Covers loading events, re-running the workflow function, resolving suspensions, and scheduling follow-up work.
|
|
31
|
+
- Does not include time spent inside inline `"use step"` bodies. Steps are bounded by the platform function duration instead.
|
|
32
|
+
|
|
33
|
+
For example, a workflow can run a 10-minute inline step even with `WORKFLOW_REPLAY_TIMEOUT_MS=300000`, because the replay budget is paused while the step body runs.
|
|
34
|
+
|
|
35
|
+
### `WORKFLOW_REPLAY_TIMEOUT_MAX_RETRIES`
|
|
36
|
+
|
|
37
|
+
- Default: `3`
|
|
38
|
+
- Queue deliveries that may hit the replay timeout before the run is failed with `REPLAY_TIMEOUT`.
|
|
39
|
+
|
|
40
|
+
### `WORKFLOW_MAX_QUEUE_DELIVERIES`
|
|
41
|
+
|
|
42
|
+
- Default: `48`
|
|
43
|
+
- Delivery attempts before a run or step is failed gracefully.
|
|
44
|
+
- Can only be lowered. The default is calibrated so Workflow can record failure before the queue expires the message.
|
|
45
|
+
|
|
46
|
+
### `WORKFLOW_REPLAY_DIVERGENCE_MAX_RETRIES`
|
|
47
|
+
|
|
48
|
+
- Default: `3`
|
|
49
|
+
- Recovery replays before replay divergence is recorded as corruption.
|
|
50
|
+
|
|
51
|
+
### `WORKFLOW_DISABLE_LAZY_HOOK_RESUME`
|
|
52
|
+
|
|
53
|
+
- Default: enabled (lazy hook resume on)
|
|
54
|
+
- Resuming a hook persists the `hook_received` event and publishes the workflow invocation concurrently, cutting a round trip off resume latency. On this parallel path the queue message also carries the payload, so a transient event-write failure still resumes the run — the queue consumer re-ensures the `hook_received` event before replay. A backend `(runId, resumeId)` constraint keeps the two writers converging on exactly one event.
|
|
55
|
+
- The runtime falls back to the sequential path automatically when the consumer or backend does not attest dedup support (or the payload is too large to inline on the queue message). On the sequential path the event is written *before* dispatch and its failure fails the resume — the fallback trades that resilience away to stay safe when dedup is not enforced, it does not preserve it.
|
|
56
|
+
- Set `1` to force the sequential path as a kill switch. The chosen strategy is reported on the resume span as `workflow.hook.resume_strategy`.
|
|
57
|
+
|
|
58
|
+
### `WORKFLOW_DEPLOYMENT_MISMATCH_MAX_RETRIES`
|
|
59
|
+
|
|
60
|
+
- Default: `3`
|
|
61
|
+
- Times a delivery that reached a deployment other than the one its run is pinned to is re-routed to that deployment before the run is failed with [`DEPLOYMENT_MISMATCH`](/docs/errors/deployment-mismatch).
|
|
62
|
+
- Re-routed deliveries back off exponentially (1s, 2s, 4s). Set to `0` to fail the run on the first misrouted delivery.
|
|
63
|
+
- Only applies to Worlds with atomic, immutable deployments (the Vercel World). A run whose pinned deployment cannot be reached at all fails immediately regardless of this value.
|
|
64
|
+
- Transient or unknown queue publishing failures use normal queue redelivery and do not consume this budget.
|
|
65
|
+
|
|
66
|
+
### `WORKFLOW_PRECONDITION_GUARD`
|
|
67
|
+
|
|
68
|
+
- Default: enabled
|
|
69
|
+
- An optimistic-concurrency guard for event creation: replay-context event creations describe the snapshot they replayed from — its latest event timestamp (`stateUpdatedAt`), the number of events it contains (`stateEventCount`), and its event-log cursor (`stateCursor`) — and a backend that supports the guard rejects a creation with 412 ([`PreconditionFailedError`](/docs/api-reference/workflow-errors/precondition-failed-error)) when a newer out-of-band event (a received hook or a completed step) was recorded after that snapshot, or when the snapshot is missing an event recorded at or before it.
|
|
70
|
+
- On rejection the runtime restarts the replay in the same invocation from a corrected event log, and falls back to a re-invocation with a fresh replay once the restart budget is spent. The rejected write is never retried as-is: a replay working from a corrected log derives different events, so only a fresh replay may write again.
|
|
71
|
+
- When enabled — and the World declares that it enforces the guard (`capabilities.preconditionGuard`; the Vercel World does) — the runtime also keeps the per-step event-log delta optimization (consuming the delta returned by a step's terminal write instead of issuing an extra `events.list` per step) active while the run has an open hook. Without an enforced guard, an open hook disables it.
|
|
72
|
+
- While a hook is open on a guard-enforcing deployment, inline steps take the await-then-run path even when optimistic inline start is enabled: the step's `step_started` claim carries the snapshot and is awaited before the body runs, so a claim the backend rejects as stale never executes user code.
|
|
73
|
+
- Backends that do not support the guard ignore the snapshot; they must not declare the capability, so guard-dependent optimizations stay off against them even when the flag is set.
|
|
74
|
+
- The guard only ever rejects on evidence, and it fails open in every other case: a backend that cannot decide — because its record of recent events is incomplete, has expired, or covers only part of the run's history — must accept the write. A rejection therefore always means the snapshot really was incomplete, but the absence of one does not prove it was complete. Busy runs (wide step fan-outs, high hook volume) are the most likely to skip the check.
|
|
75
|
+
- As a result, 412 volume describes a workload rather than the health of a deployment, and a run that never sees one is not evidence the guard is inactive.
|
|
76
|
+
- Set `0` to disable.
|
|
77
|
+
|
|
78
|
+
### `WORKFLOW_PRECONDITION_MAX_INPROCESS_RESTARTS`
|
|
79
|
+
|
|
80
|
+
- Default: `3`
|
|
81
|
+
- How many times a single invocation restarts its replay in-process after a rejected event creation before it falls back to a re-invocation.
|
|
82
|
+
- A restart reloads the event log and rebuilds the workflow from scratch, so it costs a replay but no queue round trip. A World may attach the missing events to its rejection, in which case the first restart needs no event-log request at all.
|
|
83
|
+
|
|
84
|
+
### `WORKFLOW_PRECONDITION_MAX_REINVOCATIONS`
|
|
85
|
+
|
|
86
|
+
- Default: `5`
|
|
87
|
+
- How many re-invocations one run may spend on rejected event creations before it is failed with `RUNTIME_ERROR`.
|
|
88
|
+
- Counted on the run's queue messages rather than per invocation, because a re-invocation enqueues a fresh message and so restarts the ordinary delivery count. Without this budget a run whose event log keeps growing faster than it can be read would cycle indefinitely.
|
|
89
|
+
|
|
90
|
+
### `WORKFLOW_PRECONDITION_REINVOKE_DELAY_SECONDS`
|
|
91
|
+
|
|
92
|
+
- Default: `2`
|
|
93
|
+
- Delay before a re-invocation caused by a rejected event creation.
|
|
94
|
+
- Unlike an in-process restart, which re-reads immediately, a re-invocation only happens once the in-process budget failed to catch up — so the delay gives the other writers a moment to quiesce.
|
|
95
|
+
|
|
96
|
+
### `WORKFLOW_PER_KIND_CORRELATION_IDS`
|
|
97
|
+
|
|
98
|
+
- Default: disabled
|
|
99
|
+
- Experimental. Gives each kind of entity a workflow creates — steps, waits, hooks, attribute writes, abort controllers, stream IDs — its own sequence of correlation IDs.
|
|
100
|
+
- With one sequence shared by every kind, an ID is an ordinal over the whole run, so a single extra draw of any kind shifts every ID after it. Two concurrent replays of the same run that disagree about one `sleep()` then assign different IDs to every step that follows, and each writes events the other can neither match nor consume, which fails the run with `CORRUPTED_EVENT_LOG`. Per-kind sequences confine that to the kind that actually differs.
|
|
101
|
+
- IDs remain ordered within a kind, so hooks created by your workflow are still listed in creation order. A hook the runtime creates for you, such as the one backing an abort controller, draws from its own kind and so is listed at an arbitrary position relative to your hooks rather than at its creation position.
|
|
102
|
+
- A run must replay under the scheme that minted its IDs. A replay that switches schemes mid-run assigns IDs its own earlier events do not carry, so it can consume none of them and the run fails.
|
|
103
|
+
- On Vercel, a run keeps replaying on the deployment it started on, so it only ever sees the value baked into that deployment. Changing the setting affects new runs only.
|
|
104
|
+
- Elsewhere — `@workflow/world-postgres`, `@workflow/world-local`, any self-hosted process — nothing pins a run to the code that started it. Turn the setting on during a quiet window with no runs in flight, and roll the new value out to your whole fleet at once: a rolling deploy that leaves both values live replays one run under two schemes concurrently, which is the failure the setting exists to reduce.
|
|
105
|
+
- Set `1` to enable.
|
|
106
|
+
|
|
107
|
+
## Inline execution
|
|
108
|
+
|
|
109
|
+
### `WORKFLOW_V2_TIMEOUT_MS`
|
|
110
|
+
|
|
111
|
+
- Default: `120000`
|
|
112
|
+
- Wall-clock guard for the inline replay loop.
|
|
113
|
+
- Once elapsed, the handler requeues the workflow instead of continuing to run more inline work in the same invocation.
|
|
114
|
+
|
|
115
|
+
### `WORKFLOW_MAX_INLINE_STEPS`
|
|
116
|
+
|
|
117
|
+
- Default: `3`
|
|
118
|
+
- Clamp: `1` to `16`
|
|
119
|
+
- Number of newly-created steps one invocation runs inline in parallel before queueing the rest.
|
|
120
|
+
|
|
121
|
+
### `WORKFLOW_TURBO`
|
|
122
|
+
|
|
123
|
+
- Default: enabled
|
|
124
|
+
- Fast path for a run's first delivery.
|
|
125
|
+
- Stops forcing optimistic inline step start once the run creates a hook or wait.
|
|
126
|
+
- Set `0` or `false` to disable.
|
|
127
|
+
|
|
128
|
+
### `WORKFLOW_OPTIMISTIC_INLINE_START`
|
|
129
|
+
|
|
130
|
+
- Default: disabled
|
|
131
|
+
- Starts inline step bodies before their `step_started` event is confirmed.
|
|
132
|
+
- Use only when step side effects are idempotent.
|
|
133
|
+
- Set `0` or `false` to force it off, including the first-delivery fast path used by `WORKFLOW_TURBO`.
|
|
134
|
+
|
|
135
|
+
### `WORKFLOW_RETAINED_VM`
|
|
136
|
+
|
|
137
|
+
- Default: enabled
|
|
138
|
+
- Keeps the suspended workflow VM alive across inline steps within one invocation, so each iteration of the inline loop appends only the newly written events instead of replaying the whole event log in a fresh VM.
|
|
139
|
+
- Suspensions involving hooks, waits, or attributes — and any replay divergence — always fall back to a full replay.
|
|
140
|
+
- Step inputs made of plain data (objects, arrays, primitives) and standard built-ins (`Map`, `Set`, `Date`, `RegExp`, typed arrays, `ArrayBuffer`, `URL`, `Headers`) keep the VM retained. Patching or polyfilling built-in prototypes doesn't change that: serialization never calls them. A boundary falls back to a full replay only when serializing its arguments runs code the workflow controls — a getter, a proxy, a custom class serializer — or computes an `Error`'s stack trace.
|
|
141
|
+
- Set `0` or `false` to replay from scratch in a fresh VM on every iteration.
|
|
142
|
+
|
|
143
|
+
### `WORKFLOW_INLINE_OWNERSHIP`
|
|
144
|
+
|
|
145
|
+
- Default: enabled
|
|
146
|
+
- Records which queue message owns each inline step execution, so a wake (hook resume, elapsed wait) that replays the run mid-step schedules a delayed backstop instead of immediately re-dispatching — and re-executing — the step. See [Inline step message ownership](/v5/docs/changelog/step-message-ownership).
|
|
147
|
+
- Set `0` or `false` to revert to the previous unconditional immediate re-dispatch.
|
|
148
|
+
|
|
149
|
+
### `WORKFLOW_INLINE_OWNERSHIP_LEASE_SECONDS`
|
|
150
|
+
|
|
151
|
+
- Default: `860`
|
|
152
|
+
- Clamp: `1` to `900`
|
|
153
|
+
- How long after an inline step's latest `step_started` other invocations assume its owner may still be executing the body. Within the lease they defer the step's backstop message; past it they enqueue immediately.
|
|
154
|
+
- Raise this on self-hosted multi-instance deployments whose inline steps run longer than the default (the default is sized for Vercel's function duration ceiling).
|
|
155
|
+
|
|
156
|
+
## Workflow VM engine
|
|
157
|
+
|
|
158
|
+
### `WORKFLOW_VM`
|
|
159
|
+
|
|
160
|
+
- Default: `node`
|
|
161
|
+
- Values: `node` or `quickjs`
|
|
162
|
+
- Selects the sandboxed VM engine that executes workflow functions (`"use workflow"`). Step functions are unaffected — they always run with full Node.js access.
|
|
163
|
+
- `node` (default) runs workflow code in a [`node:vm`](https://nodejs.org/api/vm.html) context.
|
|
164
|
+
- `quickjs` (experimental) runs workflow code in a [QuickJS](https://github.com/quickjs-ng/quickjs) VM compiled to WebAssembly (via [`quickjs-wasi`](https://github.com/vercel-labs/quickjs-wasi)). Both engines implement the same event-replay execution model (seeded PRNG, deterministic clock, and correlation-ID sequences are identical), but the **global surface is not identical** — see the differences below before switching an existing deployment. The QuickJS engine is intended for platforms that do not implement `node:vm`, and is the foundation for future VM-memory snapshotting.
|
|
165
|
+
- Global-surface differences under `quickjs` (workflow functions only — step functions always have full Node.js):
|
|
166
|
+
- `crypto.getRandomValues()` and `crypto.randomUUID()` are provided and deterministic (seeded like the node engine's). All `crypto.subtle.*` methods throw with guidance to move to a step function — including `digest`, which the node engine supports.
|
|
167
|
+
- `Intl` is not available (QuickJS has no ICU). The `Intl.*` constructors throw, and `toLocaleString`-family methods (including `localeCompare`) throw when called **with an explicit locale** — calling them without arguments keeps the engine default. Perform locale-sensitive formatting in a step function.
|
|
168
|
+
- `WebAssembly` and `Atomics` are not available.
|
|
169
|
+
- `process` exposes only a frozen copy of `env`, matching the node engine.
|
|
170
|
+
- The engine choice is stamped into the run's `executionContext` when the run starts, so a run keeps executing on the engine it started on even if the deployment's `WORKFLOW_VM` changes. Runs without a stamped engine use the handler's `WORKFLOW_VM` value.
|
|
171
|
+
- Unknown values throw at startup.
|
|
172
|
+
|
|
173
|
+
## Compression and tracing
|
|
174
|
+
|
|
175
|
+
### `WORKFLOW_DISABLE_COMPRESSION`
|
|
176
|
+
|
|
177
|
+
- Default: compression enabled
|
|
178
|
+
- Set `1` to disable compression when writing payloads.
|
|
179
|
+
- Reads still decompress existing payloads.
|
|
180
|
+
|
|
181
|
+
### `WORKFLOW_COMPRESSION_CODEC`
|
|
182
|
+
|
|
183
|
+
- Default: automatic
|
|
184
|
+
- Forces the write-side codec to `zstd` or `gzip`.
|
|
185
|
+
- Invalid values are ignored. Automatic mode prefers `zstd` when the current Node.js runtime supports it, otherwise it falls back to `gzip`.
|
|
186
|
+
|
|
187
|
+
### `WORKFLOW_TRACE_MODE`
|
|
188
|
+
|
|
189
|
+
- Default: `linked`
|
|
190
|
+
- OpenTelemetry span topology for runs.
|
|
191
|
+
- Accepts `linked` or `continuous`.
|
|
192
|
+
|
|
193
|
+
### `DEBUG`
|
|
194
|
+
|
|
195
|
+
- Default: unset
|
|
196
|
+
- Debug log filter with wildcards and negation.
|
|
197
|
+
- Examples: `workflow:*`, `workflow:*,-workflow:telemetry:*`.
|
|
198
|
+
|
|
199
|
+
## Transport
|
|
200
|
+
|
|
201
|
+
### `WORKFLOW_H2_MULTIPLEX`
|
|
202
|
+
|
|
203
|
+
- Default: enabled
|
|
204
|
+
- On the Vercel World, lets concurrent event-log requests share one HTTP/2 connection instead of one connection per in-flight request.
|
|
205
|
+
- Set `0` to send one event request per connection.
|
|
206
|
+
|
|
207
|
+
## Queue namespace
|
|
208
|
+
|
|
209
|
+
### `WORKFLOW_QUEUE_NAMESPACE`
|
|
210
|
+
|
|
211
|
+
- Default: none
|
|
212
|
+
- Queue topic namespace shared by build output and Worlds.
|
|
213
|
+
- Must match `^[a-z][a-z0-9]*$`.
|
|
214
|
+
- Set it consistently at build and runtime.
|
|
215
|
+
|
|
216
|
+
## Streams and waits
|
|
217
|
+
|
|
218
|
+
These variables are primarily for tests, debugging, or unusual deployments.
|
|
219
|
+
|
|
220
|
+
### `WORKFLOW_STREAM_FLUSH_INTERVAL_MS`
|
|
221
|
+
|
|
222
|
+
- Default: `0` (dispatch the first chunk of an idle stream immediately)
|
|
223
|
+
- Group-commit window for the *leading* chunk of an idle stream. `0` sends it at once; a positive value holds it up to that many milliseconds to collect a group — an opt-in trade of first-chunk latency for larger batches, useful for slow-but-steady producers. Chunks arriving while a request is already in flight always coalesce into the next group regardless of this setting.
|
|
224
|
+
- Also available as `streamFlushIntervalMs` on Worlds that expose it (the env var, when set, takes precedence over the World option).
|
|
225
|
+
|
|
226
|
+
### `WORKFLOW_STREAM_MAX_INFLIGHT_CHUNKS`
|
|
227
|
+
|
|
228
|
+
- Default: `1000`
|
|
229
|
+
- Flow-control bound: how many stream chunks may be read-but-not-yet-durably-written while writes are coalesced. Once this many are outstanding, the producer pauses reading until a batch is written. Bounds in-memory buffering; distinct from the per-request batch caps below.
|
|
230
|
+
|
|
231
|
+
### `WORKFLOW_STREAM_MAX_CHUNKS_PER_BATCH`
|
|
232
|
+
|
|
233
|
+
- Default: `1000`
|
|
234
|
+
- Wire limit: maximum number of chunks sent in a single coalesced multi-write. Larger bursts are split across requests so one request can't exceed the server's per-multi-write chunk cap.
|
|
235
|
+
|
|
236
|
+
### `WORKFLOW_STREAM_MAX_BYTES_PER_BATCH`
|
|
237
|
+
|
|
238
|
+
- Default: `1048576` (1 MiB)
|
|
239
|
+
- Wire limit: maximum cumulative bytes in a single coalesced multi-write, so large chunks don't produce a request body that platform limits reject. A single chunk larger than this is still sent on its own.
|
|
240
|
+
|
|
241
|
+
### `WORKFLOW_STREAM_MAX_BUFFERED_BYTES`
|
|
242
|
+
|
|
243
|
+
- Default: `8388608` (8 MiB)
|
|
244
|
+
- Flow-control bound: maximum cumulative bytes accepted into the stream writer's group-commit buffer before `write()` applies backpressure. The byte-denominated counterpart of `WORKFLOW_STREAM_MAX_INFLIGHT_CHUNKS`; distinct from `WORKFLOW_STREAM_MAX_BYTES_PER_BATCH`, which only splits how much goes out in one request.
|
|
245
|
+
|
|
246
|
+
### `WORKFLOW_FRAMED_STREAM_MAX_RECONNECTS`
|
|
247
|
+
|
|
248
|
+
- Default: `50`
|
|
249
|
+
- Consecutive reconnect cap for framed stream readers.
|
|
250
|
+
|
|
251
|
+
### `WORKFLOW_FRAMED_STREAM_MAX_TOTAL_RECONNECTS`
|
|
252
|
+
|
|
253
|
+
- Default: `1000`
|
|
254
|
+
- Total reconnect cap per stream session.
|
|
255
|
+
|
|
256
|
+
### `WORKFLOW_WAIT_CONTINUATION_MAX_DELAY_SECONDS`
|
|
257
|
+
|
|
258
|
+
- Default: `82800` (23 hours)
|
|
259
|
+
- Longest single queue delay used for `sleep()` continuations.
|
|
260
|
+
- If a wait is longer than this, Workflow queues one continuation for the maximum delay, then queues another continuation after that message fires, repeating until the wait's target time is reached.
|
|
261
|
+
|
|
262
|
+
### `WORKFLOW_NEAR_ELAPSED_WAIT_THRESHOLD_SECONDS`
|
|
263
|
+
|
|
264
|
+
- Default: `2`
|
|
265
|
+
- Clock-skew tolerance for wait continuations that arrive near their target time.
|
|
266
|
+
|
|
267
|
+
### `WORKFLOW_DEFERRED_CHECK_DELAY_MS`
|
|
268
|
+
|
|
269
|
+
- Default: `100`
|
|
270
|
+
- Delay before the unconsumed-event check fires.
|
|
271
|
+
- Minimum: `10`.
|
|
272
|
+
|
|
273
|
+
### `WORKFLOW_LOCK_POLL_INTERVAL_MS`
|
|
274
|
+
|
|
275
|
+
- Default: `10`
|
|
276
|
+
- Poll interval for detecting stream lock release.
|