@workflow/core 4.2.0-beta.73 → 4.2.0-beta.75

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.
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  title: Event Sourcing
3
- description: Learn how Workflow DevKit uses event sourcing internally for debugging and observability.
3
+ description: Learn how Workflow SDK uses event sourcing internally for debugging and observability.
4
4
  type: conceptual
5
5
  summary: Understand the event log that powers workflow replay and debugging.
6
6
  prerequisites:
@@ -10,10 +10,10 @@ related:
10
10
  ---
11
11
 
12
12
  <Callout>
13
- This guide explores how the Workflow DevKit uses event sourcing internally. Understanding these concepts is helpful for debugging and building observability tools, but is not required to use workflows. For getting started with workflows, see the [getting started](/docs/getting-started) guides for your framework.
13
+ This guide explores how the Workflow SDK uses event sourcing internally. Understanding these concepts is helpful for debugging and building observability tools, but is not required to use workflows. For getting started with workflows, see the [getting started](/docs/getting-started) guides for your framework.
14
14
  </Callout>
15
15
 
16
- The Workflow DevKit uses event sourcing to track all state changes in workflow executions. Every mutation creates an event that is persisted to the event log, and entity state is derived by replaying these events.
16
+ The Workflow SDK uses event sourcing to track all state changes in workflow executions. Every mutation creates an event that is persisted to the event log, and entity state is derived by replaying these events.
17
17
 
18
18
  This page explains the event sourcing model and entity lifecycles.
19
19
 
@@ -28,7 +28,7 @@ Event sourcing is a persistence pattern where state changes are stored as a sequ
28
28
  - **Consistency**: Events provide a single source of truth for all entity state
29
29
  - **Recoverability**: State can be reconstructed from the event log after failures
30
30
 
31
- In the Workflow DevKit, the following entity types are managed through events:
31
+ In the Workflow SDK, the following entity types are managed through events:
32
32
 
33
33
  - **Runs**: Workflow execution instances (materialized in storage)
34
34
  - **Steps**: Individual atomic operations within a workflow (materialized in storage)
@@ -243,7 +243,7 @@ This correlation enables:
243
243
 
244
244
  ## Entity IDs
245
245
 
246
- All entities in the Workflow DevKit use a consistent ID format: a 4-character prefix followed by an underscore and a [ULID](https://github.com/ulid/spec) (Universally Unique Lexicographically Sortable Identifier).
246
+ All entities in the Workflow SDK use a consistent ID format: a 4-character prefix followed by an underscore and a [ULID](https://github.com/ulid/spec) (Universally Unique Lexicographically Sortable Identifier).
247
247
 
248
248
  | Entity | Prefix | Example |
249
249
  |--------|--------|---------|
@@ -1,8 +1,8 @@
1
1
  ---
2
2
  title: Framework Integrations
3
- description: Guide for framework authors to integrate Workflow DevKit with custom frameworks or runtimes.
3
+ description: Guide for framework authors to integrate Workflow SDK with custom frameworks or runtimes.
4
4
  type: guide
5
- summary: Build a custom framework integration using the Workflow DevKit compiler and runtime.
5
+ summary: Build a custom framework integration using the Workflow SDK compiler and runtime.
6
6
  prerequisites:
7
7
  - /docs/foundations/workflows-and-steps
8
8
  related:
@@ -10,13 +10,13 @@ related:
10
10
  ---
11
11
 
12
12
  <Callout>
13
- **For users:** If you just want to use Workflow DevKit with an existing framework, check out the [Getting Started](/docs/getting-started) guide instead. This page is for framework authors who want to integrate Workflow DevKit with their framework or runtime.
13
+ **For users:** If you just want to use Workflow SDK with an existing framework, check out the [Getting Started](/docs/getting-started) guide instead. This page is for framework authors who want to integrate Workflow SDK with their framework or runtime.
14
14
  </Callout>
15
15
 
16
- This guide walks you through building a framework integration for Workflow DevKit using Bun as a concrete example. The same principles apply to any JavaScript runtime (Node.js, Deno, Cloudflare Workers, etc.).
16
+ This guide walks you through building a framework integration for Workflow SDK using Bun as a concrete example. The same principles apply to any JavaScript runtime (Node.js, Deno, Cloudflare Workers, etc.).
17
17
 
18
18
  <Callout type="info">
19
- **Prerequisites:** Before building a framework integration, we recommend reading [How the Directives Work](/docs/how-it-works/code-transform) to understand the transformation system that powers Workflow DevKit.
19
+ **Prerequisites:** Before building a framework integration, we recommend reading [How the Directives Work](/docs/how-it-works/code-transform) to understand the transformation system that powers Workflow SDK.
20
20
  </Callout>
21
21
 
22
22
  ## What You'll Build
@@ -46,7 +46,7 @@ flowchart TD
46
46
  style J fill:#a78bfa,stroke:#8b5cf6,color:#000
47
47
  ```
48
48
 
49
- The purple boxes are what you implement—everything else is provided by Workflow DevKit.
49
+ The purple boxes are what you implement—everything else is provided by Workflow SDK.
50
50
 
51
51
  ## Example: Bun Integration
52
52
 
@@ -259,7 +259,7 @@ class MyFrameworkBuilder extends BaseBuilder {
259
259
  }
260
260
  ```
261
261
 
262
- If your framework supports virtual server routes and dev mode watching, make sure to adapt accordingly. Please open a PR to the Workflow DevKit if the base builder class is missing necessary functionality.
262
+ If your framework supports virtual server routes and dev mode watching, make sure to adapt accordingly. Please open a PR to the Workflow SDK if the base builder class is missing necessary functionality.
263
263
 
264
264
  Hook into your framework's build:
265
265
 
@@ -341,8 +341,8 @@ const server = Bun.serve({
341
341
  ```
342
342
 
343
343
  Production framework integrations should handle this routing in the plugin instead of leaving it to the user, and this depends on each framework's unique implementaiton.
344
- Check the Workflow DevKit source code for examples of production framework implementations.
345
- In the future, the Workflow DevKit will emit more routes under the `.well-known/workflow` namespace.
344
+ Check the Workflow SDK source code for examples of production framework implementations.
345
+ In the future, the Workflow SDK will emit more routes under the `.well-known/workflow` namespace.
346
346
 
347
347
  ## Security
348
348
 
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  title: Understanding Directives
3
- description: Explore how JavaScript directives enable the Workflow DevKit's durable execution model.
3
+ description: Explore how JavaScript directives enable the Workflow SDK's durable execution model.
4
4
  type: conceptual
5
5
  summary: Explore the design decisions behind "use workflow" and "use step" directives.
6
6
  prerequisites:
@@ -12,18 +12,18 @@ related:
12
12
  import { File, Folder, Files } from "fumadocs-ui/components/files";
13
13
 
14
14
  <Callout>
15
- This guide explores how JavaScript directives enable the Workflow DevKit's execution model. For getting started with workflows, see the [getting started](/docs/getting-started) guides for your framework.
15
+ This guide explores how JavaScript directives enable the Workflow SDK's execution model. For getting started with workflows, see the [getting started](/docs/getting-started) guides for your framework.
16
16
  </Callout>
17
17
 
18
18
  The Workflow Development Kit uses JavaScript directives (`"use workflow"` and `"use step"`) as the foundation for its durable execution model. Directives provide the compile-time semantic boundary necessary for workflows to suspend, resume, and maintain deterministic behavior across replays.
19
19
 
20
20
  This page explores how directives enable this execution model and the design principles that led us here.
21
21
 
22
- To understand how directives work, let's first understand what workflows and steps are in the Workflow DevKit.
22
+ To understand how directives work, let's first understand what workflows and steps are in the Workflow SDK.
23
23
 
24
24
  ## Workflows and Steps Primer
25
25
 
26
- The Workflow DevKit has two types of functions:
26
+ The Workflow SDK has two types of functions:
27
27
 
28
28
  **Step functions** are side-effecting operations with full Node.js runtime access. Think of them like named RPC calls - they run once, their result is persisted, and they can be [retried on failure](/docs/foundations/errors-and-retries):
29
29
 
@@ -60,7 +60,7 @@ export async function onboardUser(userId: string) {
60
60
  - **If already executed:** Returns the cached result immediately from the event log
61
61
  - **If not yet executed:** Suspends the workflow, enqueues the step for background execution, and resumes later with the result
62
62
 
63
- This replay mechanism requires deterministic code. If `Math.random()` weren't seeded, the first execution might return `0.7` (sending the email) but replay might return `0.3` (skipping it), thus breaking resumption. The Workflow DevKit sandbox provides seeded `Math.random()` and `Date` to ensure consistent behavior across replays.
63
+ This replay mechanism requires deterministic code. If `Math.random()` weren't seeded, the first execution might return `0.7` (sending the email) but replay might return `0.3` (skipping it), thus breaking resumption. The Workflow SDK sandbox provides seeded `Math.random()` and `Date` to ensure consistent behavior across replays.
64
64
 
65
65
  <Callout>
66
66
  For a deeper dive into workflows and steps, see [Workflows and Steps](/docs/foundations/workflows-and-steps).
@@ -85,11 +85,11 @@ JavaScript directives have precedent for changing execution semantics within a d
85
85
 
86
86
  - `"use strict"` (introduced in ECMAScript 5 in 2009, TC39-standardized) changes language rules to make the runtime faster, safer, and more predictable.
87
87
  - `"use client"` and `"use server"` (introduced by [React Server Components](https://react.dev/reference/rsc/server-components)) define an explicit boundary of "where" code gets executed - client-side browser JavaScript vs server-side Node.js.
88
- - `"use workflow"` (introduced by the Workflow DevKit) defines both "where" code runs (in a deterministic sandbox environment) and "how" it runs (deterministic, resumable, sandboxed execution semantics).
88
+ - `"use workflow"` (introduced by the Workflow SDK) defines both "where" code runs (in a deterministic sandbox environment) and "how" it runs (deterministic, resumable, sandboxed execution semantics).
89
89
 
90
90
  Directives provide a build-time contract.
91
91
 
92
- When the Workflow DevKit sees `"use workflow"`, it:
92
+ When the Workflow SDK sees `"use workflow"`, it:
93
93
 
94
94
  - Bundles the workflow and its dependencies into code that can be run in a sandbox
95
95
  - Restricts access to Node.js APIs in that sandbox
@@ -99,7 +99,7 @@ When the Workflow DevKit sees `"use workflow"`, it:
99
99
  In addition to being important to the compiler, `"use workflow"` explicitly signals to the developer that you are entering a different execution mode.
100
100
 
101
101
  <Callout type="info">
102
- The `"use workflow"` directive is also used by the Language Server Plugin shipped with Workflow DevKit to provide IntelliSense to your IDE. Check the [getting started instructions](/docs/getting-started) for your framework for details on setting up the Language Server Plugin.
102
+ The `"use workflow"` directive is also used by the Language Server Plugin shipped with Workflow SDK to provide IntelliSense to your IDE. Check the [getting started instructions](/docs/getting-started) for your framework for details on setting up the Language Server Plugin.
103
103
  </Callout>
104
104
 
105
105
  But we didn't get here immediately. This took some discovery to arrive at:
@@ -298,7 +298,7 @@ Different frameworks and developers have strong opinions about project structure
298
298
 
299
299
  **2. No support for publishable, reusable functions**
300
300
 
301
- We want developers to be able to publish libraries to npm that include step and workflow directives. Ideally, logic that is isomorphic so it could be used with and without Workflow DevKit. File system conventions made this impossible.
301
+ We want developers to be able to publish libraries to npm that include step and workflow directives. Ideally, logic that is isomorphic so it could be used with and without Workflow SDK. File system conventions made this impossible.
302
302
 
303
303
  **3. Migration and code reuse became difficult**
304
304
 
@@ -375,7 +375,7 @@ class MyWorkflow {
375
375
  }
376
376
  ```
377
377
 
378
- The compiler could transform both to be equivalent to WDK's directive approach:
378
+ The compiler could transform both to be equivalent to Workflow SDK's directive approach:
379
379
 
380
380
  ```typescript lineNumbers
381
381
  export const processOrder = async (orderId: string) => {
@@ -461,7 +461,7 @@ export async function badWorkflow() {
461
461
  }
462
462
  ```
463
463
 
464
- In fact, Workflow DevKit will throw an error that links to this error page: [Node.js module in workflow](/docs/errors/node-js-module-in-workflow)
464
+ In fact, Workflow SDK will throw an error that links to this error page: [Node.js module in workflow](/docs/errors/node-js-module-in-workflow)
465
465
 
466
466
  **3. No closure ambiguity**
467
467
 
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@workflow/core",
3
- "version": "4.2.0-beta.73",
4
- "description": "Core runtime and engine for Workflow DevKit",
3
+ "version": "4.2.0-beta.75",
4
+ "description": "Core runtime and engine for Workflow SDK",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
7
7
  "files": [
@@ -77,18 +77,20 @@
77
77
  "ms": "2.1.3",
78
78
  "nanoid": "5.1.6",
79
79
  "seedrandom": "3.0.5",
80
+ "semver": "7.7.4",
80
81
  "ulid": "~3.0.1",
81
82
  "zod": "4.3.6",
82
- "@workflow/errors": "4.1.0-beta.19",
83
+ "@workflow/errors": "4.1.0-beta.20",
83
84
  "@workflow/serde": "4.1.0-beta.2",
84
85
  "@workflow/utils": "4.1.0-beta.13",
85
- "@workflow/world": "4.1.0-beta.14",
86
- "@workflow/world-local": "4.1.0-beta.46",
87
- "@workflow/world-vercel": "4.1.0-beta.45"
86
+ "@workflow/world": "4.1.0-beta.15",
87
+ "@workflow/world-local": "4.1.0-beta.48",
88
+ "@workflow/world-vercel": "4.1.0-beta.46"
88
89
  },
89
90
  "devDependencies": {
90
91
  "@opentelemetry/api": "1.9.0",
91
92
  "@types/debug": "4.1.12",
93
+ "@types/semver": "7.7.1",
92
94
  "@types/node": "22.19.0",
93
95
  "@types/seedrandom": "3.0.8",
94
96
  "cross-env": "10.1.0",