@workflow/core 5.0.0-beta.5 → 5.0.0-beta.51
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 +5 -0
- package/dist/attribute-changes.d.ts +5 -0
- package/dist/attribute-changes.d.ts.map +1 -0
- package/dist/attribute-changes.js +25 -0
- package/dist/capabilities.d.ts +35 -2
- package/dist/capabilities.d.ts.map +1 -1
- package/dist/capabilities.js +74 -5
- package/dist/capture-stack.d.ts +1 -1
- package/dist/capture-stack.js +2 -2
- package/dist/class-serialization.d.ts +32 -0
- package/dist/class-serialization.d.ts.map +1 -1
- package/dist/class-serialization.js +37 -1
- package/dist/classify-error.d.ts +19 -3
- package/dist/classify-error.d.ts.map +1 -1
- package/dist/classify-error.js +98 -6
- package/dist/context-violation-error.d.ts +5 -5
- package/dist/context-violation-error.d.ts.map +1 -1
- package/dist/context-violation-error.js +8 -6
- package/dist/create-hook.d.ts +72 -7
- package/dist/create-hook.d.ts.map +1 -1
- package/dist/create-hook.js +1 -1
- package/dist/define-hook.js +2 -2
- package/dist/describe-error.d.ts +7 -7
- package/dist/describe-error.d.ts.map +1 -1
- package/dist/describe-error.js +97 -12
- package/dist/encryption.d.ts +38 -4
- package/dist/encryption.d.ts.map +1 -1
- package/dist/encryption.js +96 -14
- package/dist/events-consumer.d.ts +297 -0
- package/dist/events-consumer.d.ts.map +1 -1
- package/dist/events-consumer.js +673 -42
- package/dist/flushable-stream.d.ts +97 -1
- package/dist/flushable-stream.d.ts.map +1 -1
- package/dist/flushable-stream.js +291 -11
- package/dist/global.d.ts +36 -2
- package/dist/global.d.ts.map +1 -1
- package/dist/global.js +21 -6
- package/dist/index.d.ts +2 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -2
- package/dist/log-format.d.ts +2 -2
- package/dist/log-format.js +19 -12
- package/dist/logger.d.ts +1 -0
- package/dist/logger.d.ts.map +1 -1
- package/dist/logger.js +10 -6
- package/dist/private.d.ts +226 -9
- package/dist/private.d.ts.map +1 -1
- package/dist/private.js +626 -7
- package/dist/replay-divergence.d.ts +25 -0
- package/dist/replay-divergence.d.ts.map +1 -0
- package/dist/replay-divergence.js +61 -0
- package/dist/replay-payload-cache.d.ts +64 -0
- package/dist/replay-payload-cache.d.ts.map +1 -0
- package/dist/replay-payload-cache.js +158 -0
- package/dist/runtime/compute-instance.d.ts +13 -0
- package/dist/runtime/compute-instance.d.ts.map +1 -0
- package/dist/runtime/compute-instance.js +14 -0
- package/dist/runtime/constants.d.ts +315 -0
- package/dist/runtime/constants.d.ts.map +1 -1
- package/dist/runtime/constants.js +502 -16
- package/dist/runtime/count-step-started-events.d.ts +52 -0
- package/dist/runtime/count-step-started-events.d.ts.map +1 -0
- package/dist/runtime/count-step-started-events.js +72 -0
- package/dist/runtime/deployment-guard.d.ts +99 -0
- package/dist/runtime/deployment-guard.d.ts.map +1 -0
- package/dist/runtime/deployment-guard.js +154 -0
- package/dist/runtime/get-port-lazy.d.ts +15 -0
- package/dist/runtime/get-port-lazy.d.ts.map +1 -1
- package/dist/runtime/get-port-lazy.js +75 -6
- package/dist/runtime/get-world-lazy.d.ts +5 -14
- package/dist/runtime/get-world-lazy.d.ts.map +1 -1
- package/dist/runtime/get-world-lazy.js +19 -29
- package/dist/runtime/helpers.d.ts +415 -29
- package/dist/runtime/helpers.d.ts.map +1 -1
- package/dist/runtime/helpers.js +686 -57
- package/dist/runtime/quickjs-assets.generated.d.ts +14 -0
- package/dist/runtime/quickjs-assets.generated.d.ts.map +1 -0
- package/dist/runtime/quickjs-assets.generated.js +30 -0
- package/dist/runtime/quickjs-entrypoint.d.ts +158 -0
- package/dist/runtime/quickjs-entrypoint.d.ts.map +1 -0
- package/dist/runtime/quickjs-entrypoint.js +1863 -0
- package/dist/runtime/quickjs-log-view.d.ts +129 -0
- package/dist/runtime/quickjs-log-view.d.ts.map +1 -0
- package/dist/runtime/quickjs-log-view.js +229 -0
- package/dist/runtime/quickjs-runtime.d.ts +244 -0
- package/dist/runtime/quickjs-runtime.d.ts.map +1 -0
- package/dist/runtime/quickjs-runtime.js +2427 -0
- package/dist/runtime/quickjs-serde.d.ts +107 -0
- package/dist/runtime/quickjs-serde.d.ts.map +1 -0
- package/dist/runtime/quickjs-serde.js +2159 -0
- package/dist/runtime/replay-budget.d.ts +97 -0
- package/dist/runtime/replay-budget.d.ts.map +1 -0
- package/dist/runtime/replay-budget.js +139 -0
- package/dist/runtime/replay-recovery-reporter.d.ts +36 -0
- package/dist/runtime/replay-recovery-reporter.d.ts.map +1 -0
- package/dist/runtime/replay-recovery-reporter.js +64 -0
- package/dist/runtime/resume-hook.d.ts +91 -8
- package/dist/runtime/resume-hook.d.ts.map +1 -1
- package/dist/runtime/resume-hook.js +512 -89
- package/dist/runtime/resume-latency.d.ts +150 -0
- package/dist/runtime/resume-latency.d.ts.map +1 -0
- package/dist/runtime/resume-latency.js +155 -0
- package/dist/runtime/run-id-time.d.ts +19 -0
- package/dist/runtime/run-id-time.d.ts.map +1 -0
- package/dist/runtime/run-id-time.js +42 -0
- package/dist/runtime/run.d.ts +72 -7
- package/dist/runtime/run.d.ts.map +1 -1
- package/dist/runtime/run.js +280 -53
- package/dist/runtime/runs.d.ts +54 -3
- package/dist/runtime/runs.d.ts.map +1 -1
- package/dist/runtime/runs.js +126 -16
- package/dist/runtime/start.d.ts +101 -2
- package/dist/runtime/start.d.ts.map +1 -1
- package/dist/runtime/start.js +352 -61
- package/dist/runtime/step-executor.d.ts +186 -5
- package/dist/runtime/step-executor.d.ts.map +1 -1
- package/dist/runtime/step-executor.js +768 -130
- package/dist/runtime/step-latency.d.ts +220 -0
- package/dist/runtime/step-latency.d.ts.map +1 -0
- package/dist/runtime/step-latency.js +215 -0
- package/dist/runtime/step-ownership.d.ts +72 -0
- package/dist/runtime/step-ownership.d.ts.map +1 -0
- package/dist/runtime/step-ownership.js +114 -0
- package/dist/runtime/step-single-flight.d.ts +12 -0
- package/dist/runtime/step-single-flight.d.ts.map +1 -0
- package/dist/runtime/step-single-flight.js +75 -0
- package/dist/runtime/suspension-handler.d.ts +247 -7
- package/dist/runtime/suspension-handler.d.ts.map +1 -1
- package/dist/runtime/suspension-handler.js +1304 -125
- package/dist/runtime/unserializable-step.d.ts +34 -0
- package/dist/runtime/unserializable-step.d.ts.map +1 -0
- package/dist/runtime/unserializable-step.js +52 -0
- package/dist/runtime/vm-mode.d.ts +44 -0
- package/dist/runtime/vm-mode.d.ts.map +1 -0
- package/dist/runtime/vm-mode.js +62 -0
- package/dist/runtime/vm-serde-bundle.generated.d.ts +14 -0
- package/dist/runtime/vm-serde-bundle.generated.d.ts.map +1 -0
- package/dist/runtime/vm-serde-bundle.generated.js +16 -0
- package/dist/runtime/wait-continuation.d.ts +106 -0
- package/dist/runtime/wait-continuation.d.ts.map +1 -0
- package/dist/runtime/wait-continuation.js +136 -0
- package/dist/runtime/wait-until.d.ts +18 -0
- package/dist/runtime/wait-until.d.ts.map +1 -0
- package/dist/runtime/wait-until.js +42 -0
- package/dist/runtime/world-compatibility.d.ts +32 -0
- package/dist/runtime/world-compatibility.d.ts.map +1 -0
- package/dist/runtime/world-compatibility.js +44 -0
- package/dist/runtime/world-init.d.ts +17 -42
- package/dist/runtime/world-init.d.ts.map +1 -1
- package/dist/runtime/world-init.js +18 -43
- package/dist/runtime/world.d.ts +14 -2
- package/dist/runtime/world.d.ts.map +1 -1
- package/dist/runtime/world.js +75 -19
- package/dist/runtime.d.ts +10 -6
- package/dist/runtime.d.ts.map +1 -1
- package/dist/runtime.js +3911 -489
- package/dist/sealed-box.d.ts +167 -0
- package/dist/sealed-box.d.ts.map +1 -0
- package/dist/sealed-box.js +571 -0
- package/dist/serialization/client.d.ts +3 -3
- package/dist/serialization/client.d.ts.map +1 -1
- package/dist/serialization/client.js +8 -4
- package/dist/serialization/codec-devalue-vm.d.ts +16 -0
- package/dist/serialization/codec-devalue-vm.d.ts.map +1 -0
- package/dist/serialization/codec-devalue-vm.js +148 -0
- package/dist/serialization/codec-devalue.d.ts +1 -1
- package/dist/serialization/codec-devalue.d.ts.map +1 -1
- package/dist/serialization/codec-devalue.js +24 -6
- package/dist/serialization/codec.d.ts +37 -2
- package/dist/serialization/codec.d.ts.map +1 -1
- package/dist/serialization/codec.js +2 -2
- package/dist/serialization/compression.d.ts +105 -0
- package/dist/serialization/compression.d.ts.map +1 -0
- package/dist/serialization/compression.js +261 -0
- package/dist/serialization/encryption.d.ts +119 -17
- package/dist/serialization/encryption.d.ts.map +1 -1
- package/dist/serialization/encryption.js +152 -17
- package/dist/serialization/errors.d.ts +13 -0
- package/dist/serialization/errors.d.ts.map +1 -1
- package/dist/serialization/errors.js +20 -2
- package/dist/serialization/format.d.ts +6 -6
- package/dist/serialization/format.js +7 -7
- package/dist/serialization/hardened.d.ts +156 -0
- package/dist/serialization/hardened.d.ts.map +1 -0
- package/dist/serialization/hardened.js +538 -0
- package/dist/serialization/index.d.ts +10 -8
- package/dist/serialization/index.d.ts.map +1 -1
- package/dist/serialization/index.js +10 -8
- package/dist/serialization/reducers/class-vm.d.ts +20 -0
- package/dist/serialization/reducers/class-vm.d.ts.map +1 -0
- package/dist/serialization/reducers/class-vm.js +77 -0
- package/dist/serialization/reducers/class.d.ts.map +1 -1
- package/dist/serialization/reducers/class.js +11 -6
- package/dist/serialization/reducers/common-vm.d.ts +15 -0
- package/dist/serialization/reducers/common-vm.d.ts.map +1 -0
- package/dist/serialization/reducers/common-vm.js +616 -0
- package/dist/serialization/reducers/common.d.ts +1 -1
- package/dist/serialization/reducers/common.d.ts.map +1 -1
- package/dist/serialization/reducers/common.js +202 -62
- package/dist/serialization/reducers/step-function-vm.d.ts +44 -0
- package/dist/serialization/reducers/step-function-vm.d.ts.map +1 -0
- package/dist/serialization/reducers/step-function-vm.js +97 -0
- package/dist/serialization/reducers/step-function.d.ts.map +1 -1
- package/dist/serialization/reducers/step-function.js +25 -9
- package/dist/serialization/step.d.ts +4 -4
- package/dist/serialization/step.d.ts.map +1 -1
- package/dist/serialization/step.js +9 -5
- package/dist/serialization/types.d.ts +80 -1
- package/dist/serialization/types.d.ts.map +1 -1
- package/dist/serialization/types.js +15 -1
- package/dist/serialization/workflow-vm.d.ts +29 -0
- package/dist/serialization/workflow-vm.d.ts.map +1 -0
- package/dist/serialization/workflow-vm.js +74 -0
- package/dist/serialization-format.d.ts +64 -8
- package/dist/serialization-format.d.ts.map +1 -1
- package/dist/serialization-format.js +225 -73
- package/dist/serialization.d.ts +262 -34
- package/dist/serialization.d.ts.map +1 -1
- package/dist/serialization.js +1885 -277
- package/dist/set-attributes.d.ts +13 -0
- package/dist/set-attributes.d.ts.map +1 -0
- package/dist/set-attributes.js +60 -0
- package/dist/source-map.d.ts +25 -0
- package/dist/source-map.d.ts.map +1 -1
- package/dist/source-map.js +154 -10
- package/dist/step/context-storage.d.ts +63 -2
- package/dist/step/context-storage.d.ts.map +1 -1
- package/dist/step/context-storage.js +7 -5
- package/dist/step/writable-stream.d.ts +3 -3
- package/dist/step/writable-stream.d.ts.map +1 -1
- package/dist/step/writable-stream.js +80 -13
- package/dist/step.d.ts.map +1 -1
- package/dist/step.js +148 -27
- package/dist/symbols.d.ts +50 -0
- package/dist/symbols.d.ts.map +1 -1
- package/dist/symbols.js +51 -1
- package/dist/telemetry/semantic-conventions.d.ts +433 -2
- package/dist/telemetry/semantic-conventions.d.ts.map +1 -1
- package/dist/telemetry/semantic-conventions.js +319 -3
- package/dist/telemetry.d.ts +91 -0
- package/dist/telemetry.d.ts.map +1 -1
- package/dist/telemetry.js +244 -17
- package/dist/test-support/orchestrator-context.d.ts +25 -0
- package/dist/test-support/orchestrator-context.d.ts.map +1 -0
- package/dist/test-support/orchestrator-context.js +107 -0
- package/dist/types.d.ts +6 -0
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js +23 -1
- package/dist/util.d.ts +0 -5
- package/dist/util.d.ts.map +1 -1
- package/dist/util.js +1 -15
- package/dist/version.d.ts +1 -1
- package/dist/version.d.ts.map +1 -1
- package/dist/version.js +2 -2
- package/dist/vm/index.d.ts.map +1 -1
- package/dist/vm/index.js +84 -14
- package/dist/vm/script-cache.d.ts +26 -0
- package/dist/vm/script-cache.d.ts.map +1 -0
- package/dist/vm/script-cache.js +131 -0
- package/dist/vm/uint8array-base64.js +1 -1
- package/dist/workflow/abort-controller.d.ts +2 -2
- package/dist/workflow/abort-controller.d.ts.map +1 -1
- package/dist/workflow/abort-controller.js +88 -21
- package/dist/workflow/attribute-dispatcher.d.ts +6 -0
- package/dist/workflow/attribute-dispatcher.d.ts.map +1 -0
- package/dist/workflow/attribute-dispatcher.js +45 -0
- package/dist/workflow/create-hook.d.ts.map +1 -1
- package/dist/workflow/create-hook.js +24 -3
- package/dist/workflow/get-workflow-metadata.js +2 -2
- package/dist/workflow/hook.d.ts.map +1 -1
- package/dist/workflow/hook.js +304 -47
- package/dist/workflow/index.d.ts +1 -0
- package/dist/workflow/index.d.ts.map +1 -1
- package/dist/workflow/index.js +2 -1
- package/dist/workflow/set-attributes.d.ts +68 -0
- package/dist/workflow/set-attributes.d.ts.map +1 -0
- package/dist/workflow/set-attributes.js +60 -0
- package/dist/workflow/sleep.d.ts.map +1 -1
- package/dist/workflow/sleep.js +58 -12
- package/dist/workflow/world-init-stub.d.ts +3 -3
- package/dist/workflow/world-init-stub.js +4 -4
- package/dist/workflow.d.ts +95 -3
- package/dist/workflow.d.ts.map +1 -1
- package/dist/workflow.js +900 -561
- package/docs/api-reference/create-hook.mdx +89 -10
- package/docs/api-reference/create-webhook.mdx +16 -15
- package/docs/api-reference/define-hook.mdx +35 -33
- package/docs/api-reference/fatal-error.mdx +30 -8
- package/docs/api-reference/fetch.mdx +14 -10
- package/docs/api-reference/get-step-metadata.mdx +2 -2
- package/docs/api-reference/get-workflow-metadata.mdx +3 -3
- package/docs/api-reference/get-writable.mdx +7 -7
- package/docs/api-reference/index.mdx +4 -1
- package/docs/api-reference/retryable-error.mdx +1 -1
- package/docs/api-reference/set-attributes.mdx +61 -0
- package/docs/api-reference/sleep.mdx +4 -4
- package/docs/foundations/cancellation.mdx +31 -32
- package/docs/foundations/errors-and-retries.mdx +42 -11
- package/docs/foundations/hooks.mdx +64 -35
- package/docs/foundations/idempotency.mdx +244 -12
- package/docs/foundations/index.mdx +1 -23
- package/docs/foundations/meta.json +2 -1
- package/docs/foundations/serialization.mdx +21 -22
- package/docs/foundations/starting-workflows.mdx +106 -30
- package/docs/foundations/streaming.mdx +108 -60
- package/docs/foundations/versioning.mdx +263 -0
- package/docs/foundations/workflows-and-steps.mdx +9 -9
- package/docs/how-it-works/cancellation.mdx +63 -63
- package/docs/how-it-works/code-transform.mdx +83 -67
- package/docs/how-it-works/encryption.mdx +30 -26
- package/docs/how-it-works/event-sourcing.mdx +125 -34
- package/docs/how-it-works/framework-integrations.mdx +96 -337
- package/docs/how-it-works/understanding-directives.mdx +22 -22
- package/package.json +24 -15
- package/dist/runtime/step-handler.d.ts +0 -2
- package/dist/runtime/step-handler.d.ts.map +0 -1
- package/dist/runtime/step-handler.js +0 -776
|
@@ -1,4 +1,319 @@
|
|
|
1
1
|
export declare const MAX_QUEUE_DELIVERIES = 48;
|
|
2
|
+
/**
|
|
3
|
+
* Effective max queue deliveries. Override via `WORKFLOW_MAX_QUEUE_DELIVERIES`.
|
|
4
|
+
*/
|
|
5
|
+
export declare function getMaxQueueDeliveries(): number;
|
|
6
|
+
/**
|
|
7
|
+
* Default maximum time allowed for the *replay* portion of a single workflow
|
|
8
|
+
* handler invocation (in ms). This budget only covers deterministic-replay
|
|
9
|
+
* and workflow-VM execution between step boundaries. Inline step bodies
|
|
10
|
+
* (`"use step"` functions invoked via `executeStep`) do NOT count against
|
|
11
|
+
* it. Step bodies are bounded separately by the platform's function
|
|
12
|
+
* `maxDuration` (e.g. 800s on Vercel Pro Fluid) and `NO_INLINE_REPLAY_AFTER_MS`.
|
|
13
|
+
*
|
|
14
|
+
* If the non-step ("replay") time within a single invocation exceeds this
|
|
15
|
+
* budget, the handler rejects so the queue can retry. After
|
|
16
|
+
* `REPLAY_TIMEOUT_MAX_RETRIES` exhausted attempts the run is failed with
|
|
17
|
+
* `RUN_ERROR_CODES.REPLAY_TIMEOUT`.
|
|
18
|
+
*
|
|
19
|
+
* Note that on Vercel Hobby (standard functions), the platform `maxDuration`
|
|
20
|
+
* is 60s, well below this budget, so the platform SIGTERM will fire first
|
|
21
|
+
* and the queue will re-deliver until the visibility window expires. With
|
|
22
|
+
* Fluid Compute on Hobby the per-function ceiling rises to 300s, still
|
|
23
|
+
* under the default budget.
|
|
24
|
+
*
|
|
25
|
+
* Override via the `WORKFLOW_REPLAY_TIMEOUT_MS` env var (clamped to
|
|
26
|
+
* `MIN_REPLAY_TIMEOUT_MS`..`MAX_REPLAY_TIMEOUT_MS`).
|
|
27
|
+
*/
|
|
2
28
|
export declare const REPLAY_TIMEOUT_MS = 240000;
|
|
29
|
+
/** Lower bound for the replay-timeout env var override. */
|
|
30
|
+
export declare const MIN_REPLAY_TIMEOUT_MS = 30000;
|
|
31
|
+
/**
|
|
32
|
+
* Upper bound for the replay-timeout env var override. 780s leaves ≥20s of
|
|
33
|
+
* headroom under Vercel Pro Fluid's 800s function ceiling so the handler
|
|
34
|
+
* can write `run_failed` before SIGTERM.
|
|
35
|
+
*/
|
|
36
|
+
export declare const MAX_REPLAY_TIMEOUT_MS = 780000;
|
|
37
|
+
/**
|
|
38
|
+
* Resolve the effective replay-timeout budget for the current process.
|
|
39
|
+
*
|
|
40
|
+
* Reads `process.env.WORKFLOW_REPLAY_TIMEOUT_MS` lazily so tests and
|
|
41
|
+
* deployments can override per invocation. Invalid / out-of-range values
|
|
42
|
+
* fall back to a safe value (no throw: the env var is an escape hatch,
|
|
43
|
+
* not a hard requirement) and emit a one-time warning so misconfiguration
|
|
44
|
+
* is observable.
|
|
45
|
+
*/
|
|
46
|
+
export declare function getReplayTimeoutMs(): number;
|
|
47
|
+
/**
|
|
48
|
+
* Reset the warn-once cache. Test-only: exported so unit tests can
|
|
49
|
+
* exercise the warn path repeatedly without sharing state.
|
|
50
|
+
*
|
|
51
|
+
* @internal
|
|
52
|
+
*/
|
|
53
|
+
export declare function _resetReplayTimeoutWarnCacheForTests(): void;
|
|
3
54
|
export declare const REPLAY_TIMEOUT_MAX_RETRIES = 3;
|
|
55
|
+
/**
|
|
56
|
+
* Effective replay-timeout retry budget. Override via
|
|
57
|
+
* `WORKFLOW_REPLAY_TIMEOUT_MAX_RETRIES`.
|
|
58
|
+
*/
|
|
59
|
+
export declare function getReplayTimeoutMaxRetries(): number;
|
|
60
|
+
/**
|
|
61
|
+
* Default maximum number of steps the owned-inline path runs inline (in
|
|
62
|
+
* parallel) per suspension. The rest are queued to background handlers. Each
|
|
63
|
+
* inline step is created lazily (its `step_created` is folded into the
|
|
64
|
+
* `step_started` that `executeStep` sends), so inlining N steps saves N queue
|
|
65
|
+
* round-trips for a `Promise.all`-style fan-out. `1` reproduces the
|
|
66
|
+
* single-inline-step behavior exactly (useful kill-switch).
|
|
67
|
+
*
|
|
68
|
+
* Override via `WORKFLOW_MAX_INLINE_STEPS` (clamped to
|
|
69
|
+
* `MIN_MAX_INLINE_STEPS`..`MAX_MAX_INLINE_STEPS`).
|
|
70
|
+
*/
|
|
71
|
+
export declare const MAX_INLINE_STEPS = 3;
|
|
72
|
+
/** Lower bound for the inline-steps env override (1 = single inline step). */
|
|
73
|
+
export declare const MIN_MAX_INLINE_STEPS = 1;
|
|
74
|
+
/**
|
|
75
|
+
* Upper bound for the inline-steps env override. Inline bodies run in parallel
|
|
76
|
+
* within one function invocation, so this caps memory/CPU fan-out per handler.
|
|
77
|
+
*/
|
|
78
|
+
export declare const MAX_MAX_INLINE_STEPS = 16;
|
|
79
|
+
/**
|
|
80
|
+
* Resolve the effective max number of inline steps for the current process.
|
|
81
|
+
*
|
|
82
|
+
* Reads `process.env.WORKFLOW_MAX_INLINE_STEPS` lazily so tests and
|
|
83
|
+
* deployments can override per invocation. Invalid / out-of-range values fall
|
|
84
|
+
* back to a safe value (no throw: the env var is an escape hatch) and emit a
|
|
85
|
+
* one-time warning so misconfiguration is observable.
|
|
86
|
+
*/
|
|
87
|
+
export declare function getMaxInlineSteps(): number;
|
|
88
|
+
/**
|
|
89
|
+
* Upper bound on the serialized step input that resilient step dispatch will
|
|
90
|
+
* inline into the queue message's `stepInput`.
|
|
91
|
+
*
|
|
92
|
+
* Vercel Queues has no hard message-size cap (bodies above its ~256 KB
|
|
93
|
+
* inline threshold transparently spill to S3-backed storage), so this bound
|
|
94
|
+
* is a cost/latency choice, not a rejection guard: the message also carries
|
|
95
|
+
* the runId, stepId, stepName, and trace carrier alongside CBOR framing
|
|
96
|
+
* overhead, and staying under the queue's inline threshold keeps step
|
|
97
|
+
* messages on its fast inline path instead of paying an S3 store+fetch
|
|
98
|
+
* double-hop for bytes that already live in the event log. Above this size
|
|
99
|
+
* the dispatch falls back to the sequential path (`step_created` write, then
|
|
100
|
+
* a payload-less queue message).
|
|
101
|
+
*/
|
|
102
|
+
export declare const MAX_RESILIENT_STEP_INPUT_BYTES: number;
|
|
103
|
+
/**
|
|
104
|
+
* Whether resilient step dispatch is enabled: the suspension handler
|
|
105
|
+
* parallelizes each newly created step's `step_created` event write with its
|
|
106
|
+
* step-execution queue publish, carrying the serialized step input in the
|
|
107
|
+
* queue message (`stepInput`) so the consumer can idempotently re-ensure the
|
|
108
|
+
* event if the direct write failed transiently. Mirrors the resilient start
|
|
109
|
+
* (`runInput`) pattern (and the legacy lazy hook resume's `hookInput`, which
|
|
110
|
+
* current producers no longer send).
|
|
111
|
+
*
|
|
112
|
+
* **Off by default.** Enable via `WORKFLOW_RESILIENT_STEP_DISPATCH=1`.
|
|
113
|
+
*
|
|
114
|
+
* The queue publish races the create's verdict, and a create can come back
|
|
115
|
+
* refused: as a duplicate this replay should stop pursuing, or as a stale
|
|
116
|
+
* write on a World that refuses rather than reports. Either way the message
|
|
117
|
+
* carrying the payload is already out, so the consumer can materialize a step
|
|
118
|
+
* whose create was refused, and nothing orders the verdict before the
|
|
119
|
+
* consumer's redelivery re-ensure. Enabling this trades that window for the
|
|
120
|
+
* latency the parallel publish saves.
|
|
121
|
+
*/
|
|
122
|
+
export declare function isResilientStepDispatchEnabled(): boolean;
|
|
123
|
+
/**
|
|
124
|
+
* Whether batched event transitions are enabled: the suspension handler folds
|
|
125
|
+
* a clean fan-out's `step_created` + `wait_created` writes into one
|
|
126
|
+
* `world.events.createBatch` call (one durable write, per-event outcomes)
|
|
127
|
+
* instead of one write per event. Only engages when the World implements the
|
|
128
|
+
* optional `events.createBatch` AND the run is on slot identity
|
|
129
|
+
* (specVersion >= 6) AND the suspension carries no attribute/hook writes and
|
|
130
|
+
* no resilient step dispatch. Everything else keeps the single-event path
|
|
131
|
+
* byte-for-byte.
|
|
132
|
+
*
|
|
133
|
+
* Reads `process.env.WORKFLOW_BATCH_TRANSITIONS` lazily. Default **ON**;
|
|
134
|
+
* disabled only by an explicit `'0'` / `'false'` (case-insensitive), the
|
|
135
|
+
* operator escape hatch that restores the exact prior one-write-per-event
|
|
136
|
+
* path, mirroring `WORKFLOW_TURBO`'s kill-switch shape.
|
|
137
|
+
*/
|
|
138
|
+
export declare function isBatchTransitionsEnabled(): boolean;
|
|
139
|
+
/**
|
|
140
|
+
* Ceiling on events per `createBatch` call from the batched fan-out fold.
|
|
141
|
+
* Mirrors the server's transaction budgets with a comfortable margin: each
|
|
142
|
+
* fan-out event costs 2 transaction items server-side (entity + event row)
|
|
143
|
+
* against the 100-item DynamoDB cap, and inline payloads count against a
|
|
144
|
+
* 768 KB byte budget, so 32 events stays well under both, and a fan-out larger
|
|
145
|
+
* than this commits in successive batches (split batches lose
|
|
146
|
+
* cross-batch atomicity, which is exactly today's per-event-write crash
|
|
147
|
+
* surface, and every batch still converges on retry via per-event 409s).
|
|
148
|
+
*/
|
|
149
|
+
export declare const MAX_BATCH_FANOUT_EVENTS = 32;
|
|
150
|
+
/**
|
|
151
|
+
* Optional client-side override for the server-supplied per-run event ceiling.
|
|
152
|
+
* When set to a positive integer, the runtime clamps the server's limit *down*
|
|
153
|
+
* to this value (never raises it) so enforcement can be exercised without a
|
|
154
|
+
* server-side change. `undefined` (unset) ⇒ use the server value as-is.
|
|
155
|
+
*
|
|
156
|
+
* Reads `process.env.WORKFLOW_MAX_EVENTS_OVERRIDE` lazily so tests and
|
|
157
|
+
* deployments can override per invocation. Invalid values fall back to unset
|
|
158
|
+
* (no throw: the env var is an escape hatch) and emit a one-time warning.
|
|
159
|
+
*/
|
|
160
|
+
export declare function getMaxEventsOverride(): number | undefined;
|
|
161
|
+
/**
|
|
162
|
+
* Whether optimistic inline step start is enabled. When on, the owned-inline
|
|
163
|
+
* path begins running a brand-new step's body *before* its lazy `step_started`
|
|
164
|
+
* network call resolves (the input is already known locally), awaiting the
|
|
165
|
+
* `step_started` only before the terminal write.
|
|
166
|
+
*
|
|
167
|
+
* This can run a step body more than once when handlers race for the same
|
|
168
|
+
* step's create-claim: both run the body before one wins. That is unsafe for
|
|
169
|
+
* steps with non-idempotent side effects; in particular, two concurrent runs
|
|
170
|
+
* of a step that writes to the workflow stream (e.g. an AI agent streaming
|
|
171
|
+
* tokens) can interleave and corrupt the stream data. So the optimization is
|
|
172
|
+
* **off by default** and must be explicitly opted into per deployment.
|
|
173
|
+
*
|
|
174
|
+
* Reads `process.env.WORKFLOW_OPTIMISTIC_INLINE_START` lazily. Default OFF;
|
|
175
|
+
* enabled only by an explicit `'1'` / `'true'`.
|
|
176
|
+
*/
|
|
177
|
+
export declare function isOptimisticInlineStartEnabled(): boolean;
|
|
178
|
+
/**
|
|
179
|
+
* Whether an operator has **explicitly disabled** optimistic inline start via
|
|
180
|
+
* `WORKFLOW_OPTIMISTIC_INLINE_START=0` / `=false`. Distinct from "unset": unset
|
|
181
|
+
* leaves the optimization off by default but lets turbo force it on; an explicit
|
|
182
|
+
* `0`/`false` is an operator opt-out that turbo must honor (turbo's forced
|
|
183
|
+
* optimistic start still runs a step body before `step_started`/`run_started` is
|
|
184
|
+
* confirmed, the property such an operator is opting out of), so
|
|
185
|
+
* `forceOptimisticStart` defers to this. Reads the env var lazily.
|
|
186
|
+
*/
|
|
187
|
+
export declare function isOptimisticInlineStartExplicitlyDisabled(): boolean;
|
|
188
|
+
/**
|
|
189
|
+
* Whether "turbo mode" is enabled. Turbo mode fast-paths the *first delivery of
|
|
190
|
+
* the first invocation* of a run (detected by the entrypoint via `runInput`
|
|
191
|
+
* presence + `metadata.attempt === 1`): it backgrounds the `run_started` event
|
|
192
|
+
* creation, skips the initial event-log load (nothing has been written yet),
|
|
193
|
+
* and forces optimistic inline step start for that invocation, independent of
|
|
194
|
+
* `WORKFLOW_OPTIMISTIC_INLINE_START`.
|
|
195
|
+
*
|
|
196
|
+
* Forcing optimistic start is safe here because the first delivery has no
|
|
197
|
+
* concurrent peer handler to race the step create-claim, so a step body runs
|
|
198
|
+
* exactly once. That single-handler guarantee ends as soon as the run creates a
|
|
199
|
+
* hook or wait (which introduce resume/parallel invocations), so the runtime
|
|
200
|
+
* exits turbo at that point.
|
|
201
|
+
*
|
|
202
|
+
* Reads `process.env.WORKFLOW_TURBO` lazily. Default **ON**; disabled only by an
|
|
203
|
+
* explicit `'0'` / `'false'` (case-insensitive).
|
|
204
|
+
*/
|
|
205
|
+
export declare function isTurboEnabled(): boolean;
|
|
206
|
+
/**
|
|
207
|
+
* Whether the QuickJS engine's baseline-snapshot startup optimization is
|
|
208
|
+
* enabled (default ON). When on, the engine hydrates a VM with the
|
|
209
|
+
* workflow bundle once per function instance, snapshots it, and starts
|
|
210
|
+
* every invocation by restoring the snapshot instead of re-evaluating
|
|
211
|
+
* the bundle, skipping the dominant share of VM startup (measured
|
|
212
|
+
* ~77ms → ~3ms to first suspension for a 1.3MB bundle). Bundles whose
|
|
213
|
+
* module scope consumes randomness, reads the clock, or replaces a
|
|
214
|
+
* serialization intrinsic are detected at hydrate time and
|
|
215
|
+
* automatically fall back to per-invocation fresh evaluation (see
|
|
216
|
+
* prepareBaselineSnapshot). Set WORKFLOW_QUICKJS_BASELINE_SNAPSHOT=0 to
|
|
217
|
+
* disable.
|
|
218
|
+
*/
|
|
219
|
+
export declare function isQuickJSBaselineSnapshotEnabled(): boolean;
|
|
220
|
+
/**
|
|
221
|
+
* Whether the Node.js inline loop retains a suspended workflow VM within one
|
|
222
|
+
* invocation (default ON). When on, a step- or attribute-driven suspension can
|
|
223
|
+
* keep the live VM, event consumer, and hydrated state even with open hooks or
|
|
224
|
+
* waits. The next loop iteration appends newly durable events instead of
|
|
225
|
+
* rebuilding the `vm.Context` and replaying the whole event log. Hook- or
|
|
226
|
+
* wait-only suspensions park the invocation, while replay divergence falls back
|
|
227
|
+
* to the ordinary durable replay path. QuickJS manages its own retained loop.
|
|
228
|
+
*
|
|
229
|
+
* `WORKFLOW_RETAINED_VM=0` (or `false`) is the kill switch: every iteration
|
|
230
|
+
* replays the Node.js engine from scratch in a fresh VM, matching the
|
|
231
|
+
* pre-retention behavior.
|
|
232
|
+
*/
|
|
233
|
+
export declare function isVmRetentionEnabled(): boolean;
|
|
234
|
+
/**
|
|
235
|
+
* Whether inline step ownership is enabled (default ON). When on, the lazy
|
|
236
|
+
* `step_started` that creates an inline step records the owning queue
|
|
237
|
+
* message ID, and wake replays that observe an actively-owned step enqueue a
|
|
238
|
+
* *delayed backstop* message instead of immediately requeueing it, fixing
|
|
239
|
+
* duplicate inline step execution when a hook/wait wakes a run mid-step
|
|
240
|
+
* (vercel/workflow#2780).
|
|
241
|
+
*
|
|
242
|
+
* `WORKFLOW_INLINE_OWNERSHIP=0` (or `false`) is the kill switch: dispatch
|
|
243
|
+
* reverts to the unconditional immediate requeue. Stamping is unaffected:
|
|
244
|
+
* the recorded ownerMessageId is inert data when the switch is off.
|
|
245
|
+
*/
|
|
246
|
+
export declare function isInlineOwnershipEnabled(): boolean;
|
|
247
|
+
/**
|
|
248
|
+
* Default inline-ownership lease, in seconds: how long after a step's latest
|
|
249
|
+
* (stamped) `step_started` a non-owner invocation assumes the owning
|
|
250
|
+
* invocation may still be alive. Within the lease, wake replays enqueue the
|
|
251
|
+
* step's backstop message with `delaySeconds = lease remaining` instead of
|
|
252
|
+
* immediately; past it, they enqueue immediately (today's behavior).
|
|
253
|
+
*
|
|
254
|
+
* Why a fixed 860 and not a value derived from the function's `maxDuration`:
|
|
255
|
+
* neither runtime nor build time can see the resolved value: builders emit
|
|
256
|
+
* `maxDuration: 'max'`, which the platform resolves per-plan at deploy, and
|
|
257
|
+
* no env var or request-context deadline API exposes the result. The bound
|
|
258
|
+
* comes from a platform rule instead: durations above 800s require explicit
|
|
259
|
+
* per-function numeric config, so a builder-emitted `'max'` resolves to at
|
|
260
|
+
* most 800s, and 860s therefore dominates any workflow route's invocation
|
|
261
|
+
* lifetime plus scheduling slack. Revisit when that ceiling moves (the
|
|
262
|
+
* 30-minute duration beta becoming reachable via `'max'` would invalidate
|
|
263
|
+
* the bound). Worlds without an invocation kill bound (world-local,
|
|
264
|
+
* self-hosted) get no death proof from any constant. There the in-process
|
|
265
|
+
* single-flight layer (step-single-flight.ts) is what makes a backstop
|
|
266
|
+
* firing mid-step harmless.
|
|
267
|
+
*
|
|
268
|
+
* 860 also stays under the queue's 900s maximum delay (SQS cap), so a
|
|
269
|
+
* backstop's full lease remainder always fits in a single delayed message.
|
|
270
|
+
*
|
|
271
|
+
* Override via `WORKFLOW_INLINE_OWNERSHIP_LEASE_SECONDS` (clamped to
|
|
272
|
+
* 1..`MAX_INLINE_OWNERSHIP_LEASE_SECONDS`).
|
|
273
|
+
*/
|
|
274
|
+
export declare const INLINE_OWNERSHIP_LEASE_SECONDS = 860;
|
|
275
|
+
/**
|
|
276
|
+
* Upper bound for the lease env override. 900s is the queue's maximum
|
|
277
|
+
* per-message delay (SQS cap). A longer lease would need delay chaining
|
|
278
|
+
* like long waits use; clamp instead so one delayed message always suffices.
|
|
279
|
+
*/
|
|
280
|
+
export declare const MAX_INLINE_OWNERSHIP_LEASE_SECONDS = 900;
|
|
281
|
+
/**
|
|
282
|
+
* Effective inline-ownership lease. Override via
|
|
283
|
+
* `WORKFLOW_INLINE_OWNERSHIP_LEASE_SECONDS`, e.g. raise it on self-hosted
|
|
284
|
+
* multi-instance worlds with long-running steps to widen the window in which
|
|
285
|
+
* a live owner is protected from a concurrent backstop execution.
|
|
286
|
+
*/
|
|
287
|
+
export declare function getInlineOwnershipLeaseSeconds(): number;
|
|
288
|
+
export declare const REPLAY_DIVERGENCE_MAX_RETRIES = 3;
|
|
289
|
+
/**
|
|
290
|
+
* Effective replay-divergence recovery budget. Override via
|
|
291
|
+
* `WORKFLOW_REPLAY_DIVERGENCE_MAX_RETRIES`.
|
|
292
|
+
*/
|
|
293
|
+
export declare function getReplayDivergenceMaxRetries(): number;
|
|
294
|
+
export declare const PRECONDITION_MAX_INPROCESS_RESTARTS = 3;
|
|
295
|
+
/**
|
|
296
|
+
* Effective in-process replay-restart budget for stale-snapshot rejections.
|
|
297
|
+
* Override via `WORKFLOW_PRECONDITION_MAX_INPROCESS_RESTARTS`.
|
|
298
|
+
*/
|
|
299
|
+
export declare function getPreconditionMaxInProcessRestarts(): number;
|
|
300
|
+
export declare const PRECONDITION_MAX_REINVOCATIONS = 5;
|
|
301
|
+
/**
|
|
302
|
+
* Effective per-run budget for re-invocations caused by stale-snapshot
|
|
303
|
+
* rejections. Override via `WORKFLOW_PRECONDITION_MAX_REINVOCATIONS`.
|
|
304
|
+
*/
|
|
305
|
+
export declare function getPreconditionMaxReinvocations(): number;
|
|
306
|
+
export declare const PRECONDITION_REINVOKE_DELAY_SECONDS = 2;
|
|
307
|
+
/**
|
|
308
|
+
* Effective delay before a precondition re-invocation. Override via
|
|
309
|
+
* `WORKFLOW_PRECONDITION_REINVOKE_DELAY_SECONDS`.
|
|
310
|
+
*/
|
|
311
|
+
export declare function getPreconditionReinvokeDelaySeconds(): number;
|
|
312
|
+
export declare const DEPLOYMENT_MISMATCH_MAX_RETRIES = 3;
|
|
313
|
+
/**
|
|
314
|
+
* Effective deployment-mismatch re-route budget. Override via
|
|
315
|
+
* `WORKFLOW_DEPLOYMENT_MISMATCH_MAX_RETRIES`; `0` fails the run on the first
|
|
316
|
+
* misrouted delivery instead of attempting recovery.
|
|
317
|
+
*/
|
|
318
|
+
export declare function getDeploymentMismatchMaxRetries(): number;
|
|
4
319
|
//# sourceMappingURL=constants.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../src/runtime/constants.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../src/runtime/constants.ts"],"names":[],"mappings":"AAsBA,eAAO,MAAM,oBAAoB,KAAK,CAAC;AAEvC;;GAEG;AACH,wBAAgB,qBAAqB,IAAI,MAAM,CAW9C;AAED;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,eAAO,MAAM,iBAAiB,SAAU,CAAC;AAEzC,2DAA2D;AAC3D,eAAO,MAAM,qBAAqB,QAAS,CAAC;AAE5C;;;;GAIG;AACH,eAAO,MAAM,qBAAqB,SAAU,CAAC;AAwB7C;;;;;;;;GAQG;AACH,wBAAgB,kBAAkB,IAAI,MAAM,CA6B3C;AAED;;;;;GAKG;AACH,wBAAgB,oCAAoC,IAAI,IAAI,CAE3D;AAMD,eAAO,MAAM,0BAA0B,IAAI,CAAC;AAE5C;;;GAGG;AACH,wBAAgB,0BAA0B,IAAI,MAAM,CAMnD;AAED;;;;;;;;;;GAUG;AACH,eAAO,MAAM,gBAAgB,IAAI,CAAC;AAElC,8EAA8E;AAC9E,eAAO,MAAM,oBAAoB,IAAI,CAAC;AAEtC;;;GAGG;AACH,eAAO,MAAM,oBAAoB,KAAK,CAAC;AAEvC;;;;;;;GAOG;AACH,wBAAgB,iBAAiB,IAAI,MAAM,CA2B1C;AAED;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,8BAA8B,QAAa,CAAC;AAEzD;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,8BAA8B,IAAI,OAAO,CAExD;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,yBAAyB,IAAI,OAAO,CAInD;AAED;;;;;;;;;GASG;AACH,eAAO,MAAM,uBAAuB,KAAK,CAAC;AAE1C;;;;;;;;;GASG;AACH,wBAAgB,oBAAoB,IAAI,MAAM,GAAG,SAAS,CAezD;AAED;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,8BAA8B,IAAI,OAAO,CAIxD;AAED;;;;;;;;GAQG;AACH,wBAAgB,yCAAyC,IAAI,OAAO,CAInE;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,cAAc,IAAI,OAAO,CAIxC;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,gCAAgC,IAAI,OAAO,CAI1D;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,oBAAoB,IAAI,OAAO,CAI9C;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,wBAAwB,IAAI,OAAO,CAIlD;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,eAAO,MAAM,8BAA8B,MAAM,CAAC;AAElD;;;;GAIG;AACH,eAAO,MAAM,kCAAkC,MAAM,CAAC;AAEtD;;;;;GAKG;AACH,wBAAgB,8BAA8B,IAAI,MAAM,CAMvD;AAKD,eAAO,MAAM,6BAA6B,IAAI,CAAC;AAE/C;;;GAGG;AACH,wBAAgB,6BAA6B,IAAI,MAAM,CAMtD;AAQD,eAAO,MAAM,mCAAmC,IAAI,CAAC;AAErD;;;GAGG;AACH,wBAAgB,mCAAmC,IAAI,MAAM,CAM5D;AASD,eAAO,MAAM,8BAA8B,IAAI,CAAC;AAEhD;;;GAGG;AACH,wBAAgB,+BAA+B,IAAI,MAAM,CAMxD;AAMD,eAAO,MAAM,mCAAmC,IAAI,CAAC;AAErD;;;GAGG;AACH,wBAAgB,mCAAmC,IAAI,MAAM,CAM5D;AAKD,eAAO,MAAM,+BAA+B,IAAI,CAAC;AAEjD;;;;GAIG;AACH,wBAAgB,+BAA+B,IAAI,MAAM,CAMxD"}
|