workflow 5.0.0-beta.27 → 5.0.0-beta.28

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/dist/api.d.ts.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"api.d.ts","sourceRoot":"","sources":["../src/api.ts"],"names":[],"mappings":"AASA,OAAO,mCAAmC,CAAC;AAE3C,YAAY,EACV,KAAK,EACL,gBAAgB,EAChB,eAAe,EACf,WAAW,GACZ,MAAM,wBAAwB,CAAC;AAChC,OAAO,EACL,cAAc,EACd,UAAU,EACV,aAAa,GACd,MAAM,oCAAoC,CAAC;AAC5C,OAAO,EACL,MAAM,EACN,GAAG,EACH,KAAK,sBAAsB,EAC3B,KAAK,6BAA6B,GACnC,MAAM,4BAA4B,CAAC;AACpC,OAAO,EACL,KAAK,YAAY,EACjB,KAAK,GACN,MAAM,8BAA8B,CAAC"}
1
+ {"version":3,"file":"api.d.ts","sourceRoot":"","sources":["../src/api.ts"],"names":[],"mappings":"AAOA,OAAO,mCAAmC,CAAC;AAE3C,YAAY,EACV,KAAK,EACL,gBAAgB,EAChB,eAAe,EACf,WAAW,GACZ,MAAM,wBAAwB,CAAC;AAChC,OAAO,EACL,cAAc,EACd,UAAU,EACV,aAAa,GACd,MAAM,oCAAoC,CAAC;AAC5C,OAAO,EACL,MAAM,EACN,GAAG,EACH,KAAK,sBAAsB,EAC3B,KAAK,6BAA6B,GACnC,MAAM,4BAA4B,CAAC;AACpC,OAAO,EACL,KAAK,YAAY,EACjB,KAAK,GACN,MAAM,8BAA8B,CAAC"}
package/dist/api.js CHANGED
@@ -1,14 +1,12 @@
1
1
  // Side-effect import: ensure `world.ts` is loaded so its module-load
2
2
  // `globalThis[GetWorldFnKey] ??= getWorld` registration fires before any
3
- // host route reaches `getWorldLazy()`. Without this, webpack/turbopack
4
- // tree-shake `world.ts` out of routes that only use `start` (the most
5
- // common host-side entry point) and `getWorldLazy()`'s dynamic-import
6
- // fallback then fails because the bundler inlined `get-world-lazy.js`
7
- // into the route bundle. Resolved to an empty stub via the `workflow`
8
- // export condition in VM/step bundles, so this stays host-only.
3
+ // host route reaches `getWorldLazy()`. Without this, webpack/turbopack can
4
+ // tree-shake `world.ts` out of routes that only use `start`. Resolved to an
5
+ // empty stub via the `workflow` export condition in VM/step bundles, so this
6
+ // stays host-only.
9
7
  // See `@workflow/core/src/runtime/world-init.ts` for the full rationale.
10
8
  import '@workflow/core/runtime/world-init';
11
9
  export { getHookByToken, resumeHook, resumeWebhook, } from '@workflow/core/runtime/resume-hook';
12
10
  export { getRun, Run, } from '@workflow/core/runtime/run';
13
11
  export { start, } from '@workflow/core/runtime/start';
14
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiYXBpLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vc3JjL2FwaS50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxxRUFBcUU7QUFDckUseUVBQXlFO0FBQ3pFLHVFQUF1RTtBQUN2RSxzRUFBc0U7QUFDdEUsc0VBQXNFO0FBQ3RFLHNFQUFzRTtBQUN0RSxzRUFBc0U7QUFDdEUsZ0VBQWdFO0FBQ2hFLHlFQUF5RTtBQUN6RSxPQUFPLG1DQUFtQyxDQUFDO0FBUTNDLE9BQU8sRUFDTCxjQUFjLEVBQ2QsVUFBVSxFQUNWLGFBQWEsR0FDZCxNQUFNLG9DQUFvQyxDQUFDO0FBQzVDLE9BQU8sRUFDTCxNQUFNLEVBQ04sR0FBRyxHQUdKLE1BQU0sNEJBQTRCLENBQUM7QUFDcEMsT0FBTyxFQUVMLEtBQUssR0FDTixNQUFNLDhCQUE4QixDQUFDIiwic291cmNlc0NvbnRlbnQiOlsiLy8gU2lkZS1lZmZlY3QgaW1wb3J0OiBlbnN1cmUgYHdvcmxkLnRzYCBpcyBsb2FkZWQgc28gaXRzIG1vZHVsZS1sb2FkXG4vLyBgZ2xvYm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G93L2NvcmUvcnVudGltZS9zdGFydCc7XG4iXX0=
package/dist/index.d.ts CHANGED
@@ -1,3 +1,4 @@
1
+ import '@workflow/core/runtime/world-init';
1
2
  export * from '@workflow/core';
2
3
  export * from './stdlib.js';
3
4
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,gBAAgB,CAAC;AAC/B,cAAc,aAAa,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAIA,OAAO,mCAAmC,CAAC;AAE3C,cAAc,gBAAgB,CAAC;AAC/B,cAAc,aAAa,CAAC"}
package/dist/index.js CHANGED
@@ -1,3 +1,8 @@
1
+ // Host-side side effect: defineHook().resume() and other top-level helpers can
2
+ // reach getWorldLazy() without importing `workflow/api`. The `workflow` export
3
+ // condition resolves this package entry to `workflow.js` inside VM/workflow
4
+ // bundles, so this init import stays out of sandboxed workflow code.
5
+ import '@workflow/core/runtime/world-init';
1
6
  export * from '@workflow/core';
2
7
  export * from './stdlib.js';
3
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi9zcmMvaW5kZXgudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsY0FBYyxnQkFBZ0IsQ0FBQztBQUMvQixjQUFjLGFBQWEsQ0FBQyIsInNvdXJjZXNDb250ZW50IjpbImV4cG9ydCAqIGZyb20gJ0B3b3JrZmxvdy9jb3JlJztcbmV4cG9ydCAqIGZyb20gJy4vc3RkbGliLmpzJztcbiJdfQ==
8
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi9zcmMvaW5kZXgudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsK0VBQStFO0FBQy9FLCtFQUErRTtBQUMvRSw0RUFBNEU7QUFDNUUscUVBQXFFO0FBQ3JFLE9BQU8sbUNBQW1DLENBQUM7QUFFM0MsY0FBYyxnQkFBZ0IsQ0FBQztBQUMvQixjQUFjLGFBQWEsQ0FBQyIsInNvdXJjZXNDb250ZW50IjpbIi8vIEhvc3Qtc2lkZSBzaWRlIGVmZmVjdDogZGVmaW5lSG9vaygpLnJlc3VtZSgpIGFuZCBvdGhlciB0b3AtbGV2ZWwgaGVscGVycyBjYW5cbi8vIHJlYWNoIGdldFdvcmxkTGF6eSgpIHdpdGhvdXQgaW1wb3J0aW5nIGB3b3JrZmxvdy9hcGlgLiBUaGUgYHdvcmtmbG93YCBleHBvcnRcbi8vIGNvbmRpdGlvbiByZXNvbHZlcyB0aGlzIHBhY2thZ2UgZW50cnkgdG8gYHdvcmtmbG93LmpzYCBpbnNpZGUgVk0vd29ya2Zsb3dcbi8vIGJ1bmRsZXMsIHNvIHRoaXMgaW5pdCBpbXBvcnQgc3RheXMgb3V0IG9mIHNhbmRib3hlZCB3b3JrZmxvdyBjb2RlLlxuaW1wb3J0ICdAd29ya2Zsb3cvY29yZS9ydW50aW1lL3dvcmxkLWluaXQnO1xuXG5leHBvcnQgKiBmcm9tICdAd29ya2Zsb3cvY29yZSc7XG5leHBvcnQgKiBmcm9tICcuL3N0ZGxpYi5qcyc7XG4iXX0=
package/dist/runtime.d.ts CHANGED
@@ -1,2 +1,3 @@
1
- export { createWorld, getWorld, getWorldHandlers, healthCheck, type HealthCheckEndpoint, type HealthCheckOptions, type HealthCheckResult, setWorld, workflowEntrypoint, } from '@workflow/core/runtime';
1
+ import '@workflow/core/runtime/world-init';
2
+ export { createWorld, getWorld, getWorldHandlers, type HealthCheckEndpoint, type HealthCheckOptions, type HealthCheckResult, healthCheck, setWorld, workflowEntrypoint, } from '@workflow/core/runtime';
2
3
  //# sourceMappingURL=runtime.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"runtime.d.ts","sourceRoot":"","sources":["../src/runtime.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,WAAW,EACX,QAAQ,EACR,gBAAgB,EAChB,WAAW,EACX,KAAK,mBAAmB,EACxB,KAAK,kBAAkB,EACvB,KAAK,iBAAiB,EACtB,QAAQ,EACR,kBAAkB,GACnB,MAAM,wBAAwB,CAAC"}
1
+ {"version":3,"file":"runtime.d.ts","sourceRoot":"","sources":["../src/runtime.ts"],"names":[],"mappings":"AAEA,OAAO,mCAAmC,CAAC;AAE3C,OAAO,EACL,WAAW,EACX,QAAQ,EACR,gBAAgB,EAChB,KAAK,mBAAmB,EACxB,KAAK,kBAAkB,EACvB,KAAK,iBAAiB,EACtB,WAAW,EACX,QAAQ,EACR,kBAAkB,GACnB,MAAM,wBAAwB,CAAC"}
package/dist/runtime.js CHANGED
@@ -1,2 +1,5 @@
1
+ // Host-side side effect: runtime-only imports can still reach getWorldLazy()
2
+ // through stream helpers, so register getWorld before exporting runtime APIs.
3
+ import '@workflow/core/runtime/world-init';
1
4
  export { createWorld, getWorld, getWorldHandlers, healthCheck, setWorld, workflowEntrypoint, } from '@workflow/core/runtime';
2
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicnVudGltZS5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uL3NyYy9ydW50aW1lLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLE9BQU8sRUFDTCxXQUFXLEVBQ1gsUUFBUSxFQUNSLGdCQUFnQixFQUNoQixXQUFXLEVBSVgsUUFBUSxFQUNSLGtCQUFrQixHQUNuQixNQUFNLHdCQUF3QixDQUFDIiwic291cmNlc0NvbnRlbnQiOlsiZXhwb3J0IHtcbiAgY3JlYXRlV29ybGQsXG4gIGdldFdvcmxkLFxuICBnZXRXb3JsZEhhbmRsZXJzLFxuICBoZWFsd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NrUmVzdWx0LFxuICBoZWFsdGhDaGVjayxcbiAgc2V0V29ybGQsXG4gIHdvcmtmbG93RW50cnlwb2ludCxcbn0gZnJvbSAnQHdvcmtmbG93L2NvcmUvcnVudGltZSc7XG4iXX0=
@@ -0,0 +1,51 @@
1
+ ---
2
+ title: Build and Diagnostics
3
+ description: Build-time environment variables for manifests, source maps, and development diagnostics.
4
+ type: reference
5
+ summary: Configure generated bundles and build-time diagnostics.
6
+ related:
7
+ - /docs/configuration/framework-options
8
+ - /docs/api-reference/workflow-next/with-workflow
9
+ ---
10
+
11
+ Build and diagnostics variables are read by the compiler, builders, and framework integrations when your app is built or when the dev server starts.
12
+
13
+ ## Source maps
14
+
15
+ ### `WORKFLOW_SOURCEMAP`
16
+
17
+ - Framework option: `sourcemap` where supported
18
+ - Default: `inline` in development, `false` in production
19
+ - Controls source maps for generated workflow bundles.
20
+ - Explicit framework config wins over this environment variable.
21
+
22
+ Accepted values:
23
+
24
+ - `true`, `inline`, or `1` - append an inline base64 source map to each generated bundle.
25
+ - `linked` - write a `.map` file and add a `sourceMappingURL` comment.
26
+ - `external` - write a `.map` file without adding the comment.
27
+ - `both` - emit inline and external source maps.
28
+ - `false` or `0` - omit source maps.
29
+
30
+ ### `WORKFLOW_EMIT_SOURCEMAPS_FOR_DEBUGGING`
31
+
32
+ - Default: disabled
33
+ - Legacy source-map toggle kept for compatibility.
34
+ - Only affects the final workflow wrapper and webhook bundle.
35
+ - Prefer `WORKFLOW_SOURCEMAP` or a framework `sourcemap` option.
36
+
37
+ ## Manifests
38
+
39
+ ### `WORKFLOW_PUBLIC_MANIFEST`
40
+
41
+ - Default: disabled
42
+ - Set `1` to expose the workflow manifest at `/.well-known/workflow/v1/manifest.json`.
43
+ - Useful for e2e tests and tools that need to discover workflows over HTTP.
44
+
45
+ ## Development diagnostics
46
+
47
+ ### `WORKFLOW_DEV_HMR_LOGS`
48
+
49
+ - Default: disabled
50
+ - Set `1` to log workflow rebuild activity during `next dev`.
51
+ - Useful for diagnosing watch and HMR issues.
@@ -0,0 +1,154 @@
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 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
+ ## Health checks
119
+
120
+ ### `--port` / `-p`
121
+
122
+ - Command: `workflow health`
123
+ - Environment variable: `WORKFLOW_LOCAL_BASE_URL`, then `PORT`
124
+ - Default: `3000` when neither env var is set
125
+ - Local server port for health checks.
126
+ - The flag writes `WORKFLOW_LOCAL_BASE_URL`.
127
+
128
+ ## Verbose logging and updates
129
+
130
+ ### `--verbose` / `-v`
131
+
132
+ - Environment variable: `DEBUG`
133
+ - Default: disabled
134
+ - Enables verbose CLI output.
135
+
136
+ ### `WORKFLOW_NO_UPDATE_CHECK`
137
+
138
+ - CLI flag: none
139
+ - Default: update check enabled
140
+ - Set `1` to disable the CLI update check.
141
+
142
+ ## Observability paths
143
+
144
+ ### `WORKFLOW_OBSERVABILITY_CWD`
145
+
146
+ - CLI flag: none
147
+ - Default: `process.cwd()`
148
+ - Working directory used by observability tooling to find `.vercel`, `.workflow-data`, and manifests.
149
+
150
+ ### `WORKFLOW_MANIFEST_PATH`
151
+
152
+ - CLI flag: none
153
+ - Default: inferred
154
+ - 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,12 @@
1
+ {
2
+ "title": "Configuration",
3
+ "pages": [
4
+ "index",
5
+ "framework-options",
6
+ "worlds",
7
+ "runtime-tuning",
8
+ "build-and-diagnostics",
9
+ "cli-and-web-ui"
10
+ ],
11
+ "defaultOpen": false
12
+ }
@@ -0,0 +1,143 @@
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
+ ## Replay and queue delivery
14
+
15
+ ### `WORKFLOW_REPLAY_TIMEOUT_MS`
16
+
17
+ - Default: `240000`
18
+ - Clamp: `30000` to `780000`
19
+ - Charged time budget for replay and orchestration work in one handler invocation.
20
+ - Covers loading events, re-running the workflow function, resolving suspensions, and scheduling follow-up work.
21
+ - Does not include time spent inside inline `"use step"` bodies. Steps are bounded by the platform function duration instead.
22
+
23
+ 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.
24
+
25
+ ### `WORKFLOW_REPLAY_TIMEOUT_MAX_RETRIES`
26
+
27
+ - Default: `3`
28
+ - Queue deliveries that may hit the replay timeout before the run is failed with `REPLAY_TIMEOUT`.
29
+
30
+ ### `WORKFLOW_MAX_QUEUE_DELIVERIES`
31
+
32
+ - Default: `48`
33
+ - Delivery attempts before a run or step is failed gracefully.
34
+ - Can only be lowered. The default is calibrated so Workflow can record failure before the queue expires the message.
35
+
36
+ ### `WORKFLOW_REPLAY_DIVERGENCE_MAX_RETRIES`
37
+
38
+ - Default: `3`
39
+ - Recovery replays before replay divergence is recorded as corruption.
40
+
41
+ ## Inline execution
42
+
43
+ ### `WORKFLOW_V2_TIMEOUT_MS`
44
+
45
+ - Default: `120000`
46
+ - Wall-clock guard for the inline replay loop.
47
+ - Once elapsed, the handler requeues the workflow instead of continuing to run more inline work in the same invocation.
48
+
49
+ ### `WORKFLOW_MAX_INLINE_STEPS`
50
+
51
+ - Default: `3`
52
+ - Clamp: `1` to `16`
53
+ - Number of newly-created steps one invocation runs inline in parallel before queueing the rest.
54
+
55
+ ### `WORKFLOW_TURBO`
56
+
57
+ - Default: enabled
58
+ - Fast path for a run's first delivery.
59
+ - Set `0` or `false` to disable.
60
+
61
+ ### `WORKFLOW_OPTIMISTIC_INLINE_START`
62
+
63
+ - Default: disabled
64
+ - Starts inline step bodies before their `step_started` event is confirmed.
65
+ - Use only when step side effects are idempotent.
66
+ - Set `0` or `false` to force it off, including the first-delivery fast path used by `WORKFLOW_TURBO`.
67
+
68
+ ## Compression and tracing
69
+
70
+ ### `WORKFLOW_DISABLE_COMPRESSION`
71
+
72
+ - Default: compression enabled
73
+ - Set `1` to disable compression when writing payloads.
74
+ - Reads still decompress existing payloads.
75
+
76
+ ### `WORKFLOW_COMPRESSION_CODEC`
77
+
78
+ - Default: automatic
79
+ - Forces the write-side codec to `zstd` or `gzip`.
80
+ - Invalid values are ignored. Automatic mode prefers `zstd` when the current Node.js runtime supports it, otherwise it falls back to `gzip`.
81
+
82
+ ### `WORKFLOW_TRACE_MODE`
83
+
84
+ - Default: `linked`
85
+ - OpenTelemetry span topology for runs.
86
+ - Accepts `linked` or `continuous`.
87
+
88
+ ### `DEBUG`
89
+
90
+ - Default: unset
91
+ - Debug log filter with wildcards and negation.
92
+ - Examples: `workflow:*`, `workflow:*,-workflow:telemetry:*`.
93
+
94
+ ## Queue namespace
95
+
96
+ ### `WORKFLOW_QUEUE_NAMESPACE`
97
+
98
+ - Default: none
99
+ - Queue topic namespace shared by build output and Worlds.
100
+ - Must match `^[a-z][a-z0-9]*$`.
101
+ - Set it consistently at build and runtime.
102
+
103
+ ## Streams and waits
104
+
105
+ These variables are primarily for tests, debugging, or unusual deployments.
106
+
107
+ ### `WORKFLOW_STREAM_FLUSH_INTERVAL_MS`
108
+
109
+ - Default: `10`
110
+ - Stream write buffering interval.
111
+ - Also available as `streamFlushIntervalMs` on Worlds that expose it.
112
+
113
+ ### `WORKFLOW_FRAMED_STREAM_MAX_RECONNECTS`
114
+
115
+ - Default: `50`
116
+ - Consecutive reconnect cap for framed stream readers.
117
+
118
+ ### `WORKFLOW_FRAMED_STREAM_MAX_TOTAL_RECONNECTS`
119
+
120
+ - Default: `1000`
121
+ - Total reconnect cap per stream session.
122
+
123
+ ### `WORKFLOW_WAIT_CONTINUATION_MAX_DELAY_SECONDS`
124
+
125
+ - Default: `82800` (23 hours)
126
+ - Longest single queue delay used for `sleep()` continuations.
127
+ - 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.
128
+
129
+ ### `WORKFLOW_NEAR_ELAPSED_WAIT_THRESHOLD_SECONDS`
130
+
131
+ - Default: `2`
132
+ - Clock-skew tolerance for wait continuations that arrive near their target time.
133
+
134
+ ### `WORKFLOW_DEFERRED_CHECK_DELAY_MS`
135
+
136
+ - Default: `100`
137
+ - Delay before the unconsumed-event check fires.
138
+ - Minimum: `10`.
139
+
140
+ ### `WORKFLOW_LOCK_POLL_INTERVAL_MS`
141
+
142
+ - Default: `10`
143
+ - Poll interval for detecting stream lock release.
@@ -0,0 +1,228 @@
1
+ ---
2
+ title: Worlds
3
+ description: Configure the Workflow backend that stores runs and delivers queue messages.
4
+ type: reference
5
+ summary: Select and configure Local, Postgres, Vercel, or custom Worlds.
6
+ related:
7
+ - /docs/deploying/world/local-world
8
+ - /docs/deploying/world/postgres-world
9
+ - /docs/deploying/world/vercel-world
10
+ ---
11
+
12
+ A [World](/docs/deploying) stores workflow state and delivers queue messages.
13
+
14
+ ## Selecting a World
15
+
16
+ ### `WORKFLOW_TARGET_WORLD`
17
+
18
+ - Surface: environment variable
19
+ - Default: `local` outside Vercel; automatic Vercel World inside Vercel deployments
20
+ - Selects a non-default World module.
21
+
22
+ Outside Vercel, Workflow defaults to the Local World. On Vercel, leave `WORKFLOW_TARGET_WORLD` unset for the normal case; Workflow detects the Vercel deployment and selects the Vercel World automatically.
23
+
24
+ Set `WORKFLOW_TARGET_WORLD` only when you want to use a custom or self-hosted World:
25
+
26
+ - `local` - alias for `@workflow/world-local`.
27
+ - `@workflow/world-postgres` - Postgres World package.
28
+ - `./my-world.ts` - local module exporting a World, `createWorld()`, or a default factory.
29
+ - Any package specifier - custom World package.
30
+
31
+ The `vercel` alias exists for manual selection and tooling, but deployed Vercel apps do not need to set it.
32
+
33
+ Export a configured World from a module when you need factory options instead of pure environment configuration:
34
+
35
+ ```typescript title="my-world.ts" lineNumbers
36
+ import { createWorld } from "@workflow/world-postgres";
37
+
38
+ export default createWorld({
39
+ connectionString: process.env.DATABASE_URL!,
40
+ jobPrefix: "myapp_",
41
+ });
42
+ ```
43
+
44
+ ```bash title=".env"
45
+ WORKFLOW_TARGET_WORLD="./my-world.ts"
46
+ ```
47
+
48
+ ## Local World
49
+
50
+ The Local World is the default outside Vercel and is intended for development.
51
+
52
+ ### `dataDir`
53
+
54
+ - Environment variable: `WORKFLOW_LOCAL_DATA_DIR`
55
+ - Default: `.workflow-data`
56
+ - Directory where runs, steps, events, hooks, streams, and the local manifest are written.
57
+
58
+ ### `baseUrl`
59
+
60
+ - Environment variable: `WORKFLOW_LOCAL_BASE_URL`
61
+ - Default: inferred from the app port
62
+ - Full base URL used when queue messages call back into the app.
63
+ - Overrides `port` and `PORT`.
64
+
65
+ ### `port`
66
+
67
+ - Environment variable: `PORT`
68
+ - Default: auto-detected
69
+ - Local app port used to build the callback URL when `baseUrl` is unset.
70
+
71
+ ### `WORKFLOW_LOCAL_QUEUE_CONCURRENCY`
72
+
73
+ - Factory option: none
74
+ - Default: `1000`
75
+ - Maximum number of concurrent local queue message handlers.
76
+
77
+ ### `WORKFLOW_LOCAL_QUEUE_MAX_VISIBILITY`
78
+
79
+ - Factory option: none
80
+ - Default: unlimited
81
+ - Maximum seconds a local queue message stays hidden before the handler rechecks the run.
82
+
83
+ ### `recoverActiveRuns`
84
+
85
+ - Environment variable: none
86
+ - Default: `true`
87
+ - Re-enqueues pending and running local runs when the World starts.
88
+
89
+ ### `tag`
90
+
91
+ - Environment variable: none
92
+ - Default: unset
93
+ - Scopes local storage files to a tag, mainly for test isolation.
94
+
95
+ ### `streamFlushIntervalMs`
96
+
97
+ - Environment variable fallback: `WORKFLOW_STREAM_FLUSH_INTERVAL_MS`
98
+ - Default: `10`
99
+ - Flush interval for buffered stream writes. The World option wins when set.
100
+
101
+ ## Postgres World
102
+
103
+ The Postgres World is a self-hosted durable backend for long-running server processes.
104
+
105
+ ### `connectionString`
106
+
107
+ - Environment variable: `WORKFLOW_POSTGRES_URL`, then `DATABASE_URL`
108
+ - Default: `postgres://world:world@localhost:5432/world`
109
+ - PostgreSQL connection string used by the runtime World.
110
+ - The `bootstrap` migration command uses the same precedence.
111
+
112
+ ### `pool`
113
+
114
+ - Environment variable: none
115
+ - Default: new `pg.Pool`
116
+ - Existing `pg.Pool` to use instead of constructing one from `connectionString`.
117
+
118
+ ### `jobPrefix`
119
+
120
+ - Environment variable: `WORKFLOW_POSTGRES_JOB_PREFIX`
121
+ - Default: `workflow_`
122
+ - Prefix for Graphile Worker job names.
123
+
124
+ ### `queueConcurrency`
125
+
126
+ - Environment variable: `WORKFLOW_POSTGRES_WORKER_CONCURRENCY`
127
+ - Default: `50`
128
+ - Number of concurrent workers polling for jobs.
129
+ - Also bounds concurrent parent-to-child workflow return-value polls.
130
+
131
+ ### `maxPoolSize`
132
+
133
+ - Environment variable: `WORKFLOW_POSTGRES_MAX_POOL_SIZE`
134
+ - Default: `pg` default
135
+ - Maximum size of the internal `pg.Pool` when the World creates the pool.
136
+
137
+ ### `namespace`
138
+
139
+ - Environment variable fallback: `WORKFLOW_QUEUE_NAMESPACE`
140
+ - Default: none
141
+ - Queue topic namespace. For example, `custom` changes `__wkf_*` topics to `__custom_wkf_*`.
142
+
143
+ ### `streamFlushIntervalMs`
144
+
145
+ - Environment variable fallback: `WORKFLOW_STREAM_FLUSH_INTERVAL_MS`
146
+ - Default: `10`
147
+ - Flush interval for buffered stream writes. The World option wins when set.
148
+
149
+ ## Vercel World
150
+
151
+ The Vercel World is configured automatically inside Vercel deployments. The platform provides the deployment ID, project ID, request authentication, queue integration, storage, and encryption material.
152
+
153
+ Most applications should not set `WORKFLOW_VERCEL_*` variables on Vercel. They configure tooling that talks to a Vercel Workflow project from outside a deployment, such as the `workflow` CLI, the web UI, CI, or tests. The runtime warns if these variables are set in a deployed Vercel function because they do not control runtime configuration there.
154
+
155
+ Platform-provided values such as `VERCEL_DEPLOYMENT_ID`, `VERCEL_PROJECT_ID`, and `VERCEL_DEPLOYMENT_KEY` are read by the runtime inside Vercel deployments. Do not set them yourself.
156
+
157
+ ### `token`
158
+
159
+ - Environment variable: `WORKFLOW_VERCEL_AUTH_TOKEN`, then `VERCEL_TOKEN`, then Vercel CLI login
160
+ - CLI flag: `--authToken`
161
+ - Default: inferred when possible
162
+ - Vercel API token for external tooling. Keep it secret.
163
+
164
+ ### `projectConfig.environment`
165
+
166
+ - Environment variable: `WORKFLOW_VERCEL_ENV`
167
+ - CLI flag: `--env` or `-e`
168
+ - Default: `production`
169
+ - Vercel environment targeted by tooling. Accepts `production` or `preview`.
170
+
171
+ ### `projectConfig.projectId`
172
+
173
+ - Environment variable: `WORKFLOW_VERCEL_PROJECT`
174
+ - CLI flag: `--project`
175
+ - Default: inferred from `.vercel/project.json` when possible
176
+ - Vercel project ID.
177
+
178
+ ### `projectConfig.teamId`
179
+
180
+ - Environment variable: `WORKFLOW_VERCEL_TEAM`
181
+ - CLI flag: `--team`
182
+ - Default: inferred from `.vercel/project.json` when possible
183
+ - Vercel team ID.
184
+
185
+ ### `WORKFLOW_VERCEL_PROJECT_NAME`
186
+
187
+ - Factory option: none
188
+ - CLI flag: none
189
+ - Default: inferred when possible
190
+ - Project slug used for dashboard links.
191
+
192
+ ### `WORKFLOW_VERCEL_BACKEND_URL`
193
+
194
+ - Factory option: none
195
+ - CLI flag: none
196
+ - Default: `https://api.vercel.com/v1/workflow`
197
+ - Workflow API proxy URL for external tooling.
198
+
199
+ ### `VERCEL_WORKFLOW_SERVER_URL`
200
+
201
+ - Factory option: none
202
+ - CLI flag: none
203
+ - Default: unset
204
+ - Direct workflow-server URL override for testing or custom infrastructure. Normal deployments do not need it.
205
+
206
+ ### `VERCEL_QUEUE_MAX_DELAY_SECONDS`
207
+
208
+ - Factory option: none
209
+ - CLI flag: none
210
+ - Default: `82800` (23 hours)
211
+ - Maximum delay for one Vercel Queues continuation message when implementing `sleep()`.
212
+ - Longer sleeps schedule another continuation when the first one fires.
213
+
214
+ `VERCEL_QUEUE_MAX_DELAY_SECONDS` defaults to 23 hours because Vercel Queues message delays are capped by the message TTL, and the default TTL is 24 hours. Workflow stays inside that default and chains continuation messages for longer sleeps.
215
+
216
+ ### `WORKFLOW_REQUEST_TIMEOUT_MS`
217
+
218
+ - Factory option: none
219
+ - CLI flag: none
220
+ - Default: `60000`
221
+ - Per-request timeout for Vercel World HTTP calls to workflow-server.
222
+
223
+ ### `WORKFLOW_MAX_CHUNKS_PER_REQUEST`
224
+
225
+ - Factory option: none
226
+ - CLI flag: none
227
+ - Default: `1000`
228
+ - Maximum stream chunks written in one Vercel World request. Larger batches are split.
@@ -38,7 +38,7 @@ Learn more in the [Observability](/docs/observability) documentation.
38
38
 
39
39
  ## Configuration
40
40
 
41
- The local world works with zero configuration, but you can customize behavior through environment variables or programmatically via `createLocalWorld()`.
41
+ The local world works with zero configuration, but you can customize behavior through environment variables or programmatically via `createWorld()`.
42
42
 
43
43
  ### `WORKFLOW_LOCAL_DATA_DIR`
44
44
 
@@ -56,22 +56,39 @@ Port resolution priority: `baseUrl` > `port` > `PORT` > auto-detected
56
56
 
57
57
  ### `WORKFLOW_LOCAL_QUEUE_CONCURRENCY`
58
58
 
59
- Maximum number of concurrent queue workers. Default: `100`
59
+ Maximum number of concurrent queue message handlers. Default: `1000`
60
+
61
+ ### `WORKFLOW_LOCAL_QUEUE_MAX_VISIBILITY`
62
+
63
+ Maximum number of seconds a local queue message can stay hidden before the handler rechecks the run. Default: unlimited.
64
+
65
+ ### `WORKFLOW_STREAM_FLUSH_INTERVAL_MS`
66
+
67
+ Flush interval, in milliseconds, for buffered stream writes. Default: `10`.
60
68
 
61
69
  ### Programmatic configuration
62
70
 
63
- {/* @skip-typecheck: incomplete code sample */}
64
- ```typescript title="workflow.config.ts" lineNumbers
65
- import { createLocalWorld } from "@workflow/world-local";
71
+ Options passed to `createWorld()` take precedence over the environment variables above. Export the configured World from a module and point `WORKFLOW_TARGET_WORLD` at that module:
66
72
 
67
- const world = createLocalWorld({
73
+ ```typescript title="my-world.ts" lineNumbers
74
+ import { createWorld } from "@workflow/world-local";
75
+
76
+ export default createWorld({
68
77
  dataDir: "./custom-workflow-data",
69
78
  port: 5173,
70
79
  // baseUrl overrides port if set
71
80
  baseUrl: "https://local.example.com:3000",
81
+ recoverActiveRuns: true,
82
+ streamFlushIntervalMs: 10, // overrides WORKFLOW_STREAM_FLUSH_INTERVAL_MS
72
83
  });
73
84
  ```
74
85
 
86
+ ```bash title=".env"
87
+ WORKFLOW_TARGET_WORLD="./my-world.ts"
88
+ ```
89
+
90
+ `createWorld()` also accepts `tag`, which scopes local storage files to a suffix. It is mainly used by test harnesses that share one `.workflow-data` directory.
91
+
75
92
  ## Limitations
76
93
 
77
94
  The local world is designed for development, not production:
@@ -38,7 +38,7 @@ WORKFLOW_TARGET_WORLD="@workflow/world-postgres"
38
38
  WORKFLOW_POSTGRES_URL="postgres://user:password@host:5432/database"
39
39
  ```
40
40
 
41
- Run the migration script to create the necessary tables in your database. Ensure `WORKFLOW_POSTGRES_URL` is set when running this command:
41
+ Run the migration script to create the necessary tables in your database. Ensure `WORKFLOW_POSTGRES_URL` or `DATABASE_URL` is set when running this command:
42
42
 
43
43
  <Tabs items={["npm", "pnpm", "Yarn", "Bun"]}>
44
44
 
@@ -190,15 +190,17 @@ Learn more in the [Observability](/docs/observability) documentation.
190
190
 
191
191
  All configuration options can be set via environment variables or programmatically via `createWorld()`.
192
192
 
193
- ### `WORKFLOW_POSTGRES_URL` (required)
193
+ ### `WORKFLOW_POSTGRES_URL`
194
194
 
195
- PostgreSQL connection string. Falls back to `DATABASE_URL` if not set.
195
+ PostgreSQL connection string used by the runtime World.
196
196
 
197
- Default: `postgres://world:world@localhost:5432/world`
197
+ Precedence: `WORKFLOW_POSTGRES_URL` > `DATABASE_URL` > `postgres://world:world@localhost:5432/world`
198
+
199
+ The `bootstrap` migration command uses the same precedence.
198
200
 
199
201
  ### `WORKFLOW_POSTGRES_JOB_PREFIX`
200
202
 
201
- Prefix for graphile-worker queue job names. Useful when sharing a database between multiple applications.
203
+ Prefix for graphile-worker queue job names. Useful when sharing a database between multiple applications. Default: `workflow_`
202
204
 
203
205
  ### `WORKFLOW_POSTGRES_WORKER_CONCURRENCY`
204
206
 
@@ -208,25 +210,46 @@ This value also bounds how many parent→child workflow polls can be in flight s
208
210
 
209
211
  ### `WORKFLOW_POSTGRES_MAX_POOL_SIZE`
210
212
 
211
- Maximum size of the internal `pg.Pool` used when `createWorld()` constructs the pool. Default: `10`
213
+ Maximum size of the internal `pg.Pool` used when `createWorld()` constructs the pool. Default: the `pg` default (`10`).
212
214
 
213
215
  For higher worker concurrency, Graphile Worker recommends setting `maxPoolSize` to `10` or `queueConcurrency + 2`, whichever is larger.
214
216
 
217
+ ### `WORKFLOW_QUEUE_NAMESPACE`
218
+
219
+ Queue topic namespace shared by build output and the Postgres World. Default: unset.
220
+
221
+ For example, `custom` changes the queue topic prefixes from `__wkf_workflow_` and `__wkf_step_` to `__custom_wkf_workflow_` and `__custom_wkf_step_`. The value must be lowercase alphanumeric and start with a letter.
222
+
223
+ ### `WORKFLOW_STREAM_FLUSH_INTERVAL_MS`
224
+
225
+ Flush interval, in milliseconds, for buffered stream writes. Default: `10`.
226
+
215
227
  ### Programmatic configuration
216
228
 
217
229
  {/*@skip-typecheck: incomplete code sample*/}
218
230
 
219
- ```typescript title="workflow.config.ts" lineNumbers
231
+ ```typescript title="my-world.ts" lineNumbers
220
232
  import { createWorld } from "@workflow/world-postgres";
221
233
 
222
- const world = createWorld({
223
- connectionString: "postgres://user:password@host:5432/database",
234
+ export default createWorld({
235
+ connectionString:
236
+ process.env.WORKFLOW_POSTGRES_URL ?? process.env.DATABASE_URL!,
224
237
  jobPrefix: "myapp_",
238
+ namespace: "myapp",
225
239
  queueConcurrency: 50,
226
240
  maxPoolSize: 52, // overrides WORKFLOW_POSTGRES_MAX_POOL_SIZE
241
+ streamFlushIntervalMs: 10,
227
242
  });
228
243
  ```
229
244
 
245
+ Options passed to `createWorld()` take precedence over the environment variables above. Export the World from a module and point `WORKFLOW_TARGET_WORLD` at that module:
246
+
247
+ You can also pass an existing `pg.Pool` as `pool` instead of a connection string.
248
+
249
+ ```bash title=".env"
250
+ WORKFLOW_TARGET_WORLD="./my-world.ts"
251
+ ```
252
+
230
253
  ## How It Works
231
254
 
232
255
  The Postgres World uses PostgreSQL as a durable backend:
@@ -89,46 +89,79 @@ Learn more in the [Observability](/docs/observability) documentation.
89
89
 
90
90
  ## Configuration
91
91
 
92
- The Vercel World requires no configuration when deployed to Vercel. For advanced use cases, you can override settings programmatically via `createVercelWorld()`.
92
+ In a Vercel deployment, you do not configure the Vercel World yourself. The platform injects everything the runtime needs, including `VERCEL_DEPLOYMENT_ID`, `VERCEL_PROJECT_ID`, per-request OIDC tokens, and `VERCEL_DEPLOYMENT_KEY` for encryption.
93
+
94
+ Do not set those platform-provided values yourself.
95
+
96
+ Most users never need to set the `WORKFLOW_VERCEL_*` variables below. They are only overrides for tools running outside Vercel, such as your laptop or CI, when those tools need to inspect or test a remote Vercel Workflow project and cannot infer the project, team, token, or target environment automatically.
97
+
98
+ For example, you might set them when running `workflow inspect runs --backend vercel` from CI without an interactive `vercel login`, or when running tests against a specific preview deployment. In normal local development, the CLI infers these values from your `.vercel` directory and Vercel CLI login. In a deployed Vercel function, these variables have no effect on runtime configuration, and the runtime warns if they are set there.
93
99
 
94
100
  ### `WORKFLOW_VERCEL_ENV`
95
101
 
96
- The Vercel environment to use. Options: `production`, `preview`, `development`. Automatically detected.
102
+ The Vercel environment to target. Options: `production`, `preview`. Default: `production`.
97
103
 
98
104
  ### `WORKFLOW_VERCEL_AUTH_TOKEN`
99
105
 
100
- Authentication token for API requests. Automatically detected.
106
+ Vercel API authentication token (secret keep it in your environment, not in code). Falls back to `VERCEL_TOKEN`, then to your Vercel CLI login.
101
107
 
102
108
  ### `WORKFLOW_VERCEL_PROJECT`
103
109
 
104
- Vercel project ID for API requests. Automatically detected.
110
+ Vercel project ID (`prj_...`).
111
+
112
+ ### `WORKFLOW_VERCEL_PROJECT_NAME`
113
+
114
+ Vercel project name/slug, used for dashboard links.
105
115
 
106
116
  ### `WORKFLOW_VERCEL_TEAM`
107
117
 
108
- Vercel team ID for API requests. Automatically detected.
118
+ Vercel team ID.
109
119
 
110
120
  ### `WORKFLOW_VERCEL_BACKEND_URL`
111
121
 
112
- Custom base URL for the Vercel workflow API. Automatically detected.
122
+ Custom base URL for the Vercel workflow API proxy. Default: `https://api.vercel.com/v1/workflow`.
123
+
124
+ ### `VERCEL_WORKFLOW_SERVER_URL`
125
+
126
+ Custom workflow-server URL for direct runtime requests, or for the proxy to forward to via `WORKFLOW_VERCEL_BACKEND_URL`. Default: unset; normal deployments should not need this.
127
+
128
+ ### `VERCEL_QUEUE_MAX_DELAY_SECONDS`
129
+
130
+ Maximum delay, in seconds, that Workflow uses for one Vercel Queues continuation message when implementing `sleep()`. If a workflow sleeps longer than this, the runtime schedules another continuation message when the first one fires, repeating until the sleep's target time is reached. Default: `82800` (23 hours).
131
+
132
+ Vercel Queues can delay messages for up to 7 days, capped by the message TTL. Because the default TTL is 24 hours, Workflow uses a 23-hour continuation hop to stay safely inside that default.
133
+
134
+ ### `WORKFLOW_REQUEST_TIMEOUT_MS`
135
+
136
+ Per-request timeout, in milliseconds, for Vercel World HTTP calls to workflow-server. Default: `60000`. Minimum: `1`.
137
+
138
+ ### `WORKFLOW_MAX_CHUNKS_PER_REQUEST`
139
+
140
+ Maximum stream chunks written in one Vercel World request. Larger batches are split across multiple requests. Default: `1000`. Minimum: `1`.
113
141
 
114
142
  ### Programmatic configuration
115
143
 
144
+ `createWorld()` accepts explicit API configuration. It does not read `WORKFLOW_VERCEL_*` automatically, so pass the environment values yourself when you want a configured World module:
145
+
116
146
  {/*@skip-typecheck: incomplete code sample*/}
117
147
 
118
- ```typescript title="workflow.config.ts" lineNumbers
119
- import { createVercelWorld } from "@workflow/world-vercel";
148
+ ```typescript title="my-world.ts" lineNumbers
149
+ import { createWorld } from "@workflow/world-vercel";
120
150
 
121
- const world = createVercelWorld({
151
+ export default createWorld({
122
152
  token: process.env.WORKFLOW_VERCEL_AUTH_TOKEN,
123
- baseUrl: "https://api.vercel.com/v1/workflow",
124
153
  projectConfig: {
125
- projectId: "my-project",
126
- teamId: "my-team",
154
+ projectId: "prj_...",
155
+ teamId: "team_...",
127
156
  environment: "production",
128
157
  },
129
158
  });
130
159
  ```
131
160
 
161
+ ```bash title=".env"
162
+ WORKFLOW_TARGET_WORLD="./my-world.ts"
163
+ ```
164
+
132
165
  ## Versioning
133
166
 
134
167
  On Vercel, workflow runs are pegged to the deployment that started them. This means:
package/docs/meta.json CHANGED
@@ -10,6 +10,7 @@
10
10
  "deploying",
11
11
  "errors",
12
12
  "migration-guides",
13
+ "configuration",
13
14
  "api-reference"
14
15
  ]
15
16
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "workflow",
3
- "version": "5.0.0-beta.27",
3
+ "version": "5.0.0-beta.28",
4
4
  "description": "Workflow SDK - Build durable, resilient, and observable workflows",
5
5
  "main": "dist/typescript-plugin.cjs",
6
6
  "type": "module",
@@ -57,18 +57,18 @@
57
57
  },
58
58
  "dependencies": {
59
59
  "ms": "2.1.3",
60
- "@workflow/astro": "5.0.0-beta.27",
61
- "@workflow/cli": "5.0.0-beta.27",
62
- "@workflow/core": "5.0.0-beta.27",
63
- "@workflow/errors": "5.0.0-beta.9",
60
+ "@workflow/astro": "5.0.0-beta.28",
61
+ "@workflow/cli": "5.0.0-beta.28",
62
+ "@workflow/core": "5.0.0-beta.28",
63
+ "@workflow/errors": "5.0.0-beta.10",
64
64
  "@workflow/typescript-plugin": "5.0.0-beta.5",
65
- "@workflow/utils": "5.0.0-beta.5",
66
- "@workflow/next": "5.0.0-beta.27",
67
- "@workflow/nest": "5.0.0-beta.27",
68
- "@workflow/nitro": "5.0.0-beta.27",
69
- "@workflow/nuxt": "5.0.0-beta.27",
70
- "@workflow/sveltekit": "5.0.0-beta.27",
71
- "@workflow/rollup": "5.0.0-beta.27"
65
+ "@workflow/utils": "5.0.0-beta.6",
66
+ "@workflow/next": "5.0.0-beta.28",
67
+ "@workflow/nest": "5.0.0-beta.28",
68
+ "@workflow/nitro": "5.0.0-beta.28",
69
+ "@workflow/nuxt": "5.0.0-beta.28",
70
+ "@workflow/sveltekit": "5.0.0-beta.28",
71
+ "@workflow/rollup": "5.0.0-beta.28"
72
72
  },
73
73
  "devDependencies": {
74
74
  "@types/ms": "2.1.0",