Commit Graph

281 Commits

Author SHA1 Message Date
Vercel Release Bot 00b12be415 Version Packages (beta) (#499) @workflow/world-testing@4.0.1-beta.25 workflow@4.0.1-beta.24 @workflow/nitro@4.0.1-beta.24 @workflow/next@4.0.1-beta.24 @workflow/ai@4.0.1-beta.24 @workflow/web-shared@4.0.1-beta.22 @workflow/core@4.0.1-beta.21 @workflow/builders@4.0.1-beta.20 @workflow/world-vercel@4.0.1-beta.15 @workflow/nuxt@4.0.1-beta.13 @workflow/swc-plugin@4.0.1-beta.10 @workflow/sveltekit@4.0.0-beta.18 @workflow/rollup@4.0.0-beta.4 @workflow/astro@4.0.0-beta.3 2025-12-02 13:01:12 -08:00
Peter Wielander e9494d5816 Update @vercel/queue (#498) 2025-12-02 12:54:50 -08:00
Nathan Rajlich 2f0840bc81 Better error when passing an invalid workflow value to start() (#495) 2025-12-02 12:08:38 -08:00
Nathan Rajlich 555d7a69de Normalize anonymous default export workflow IDs to "default" (#484) 2025-12-02 11:26:29 -08:00
Adrian 71def65656 fix: add private to example astro (#491) 2025-12-02 10:28:24 -08:00
Vercel Release Bot 9916f2a4a6 Version Packages (beta) (#447)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2025-12-02 10:12:48 -08:00
Adrian 95823312e5 fix: path-to-regexp override in package.json (#487) 2025-12-02 09:38:32 -08:00
Peter Wielander 8d4562e856 [world-local] Finish renaming embedded world to local world (#441) 2025-12-02 09:12:40 -08:00
Adrian 1ac5592452 feat: add astro support (#347) 2025-12-02 09:11:46 -08:00
Adrian 2e25421ff0 docs: fix express nitro config (#415)
* docs: fix express nitro config

* docs: remove fromNodeHandler wrapper in express app

* fix: dup import in docs

* docs: fix use srvx toFetchHandler

* docs: express add rollup deps

* test

* simplify express
2025-12-02 09:09:31 -08:00
Hayden Bleasel 103900c058 Patch sidebar indentation bug (#486) 2025-12-02 08:39:08 -08:00
Gal Schlezinger bdde1bd806 core: add span links + message ids to queue spans (#472)
* core: add span links + message ids to queue spans

Signed-off-by: Gal Schlezinger <gal@spitfire.co.il>

* add queue overhead to metrics

Signed-off-by: Gal Schlezinger <gal@spitfire.co.il>

* fix types

Signed-off-by: Gal Schlezinger <gal@spitfire.co.il>

* rename messageId to message.id

Signed-off-by: Gal Schlezinger <gal@spitfire.co.il>

* add changeset

Signed-off-by: Gal Schlezinger <gal@spitfire.co.il>

---------

Signed-off-by: Gal Schlezinger <gal@spitfire.co.il>
2025-12-02 14:11:05 +02:00
Nathan Rajlich e339a2bc77 Add e2e test for spawning child workflows (#475) 2025-12-02 00:30:25 -08:00
Adrian 3c19e909f2 fix: nitro build race conditions (#444)
* test: make dev e2e sequential

* test: increase timeout between tests in dev test

* add logs

* feat: add queue for builds

* refactor: cleanup vite hmr

* chore: cleanup comments

* fix: regex base builder

* test: reduce sleep time between test suites in dev test

* refactor: naming conventions and remove builder value check

* refactor: sveltekit builder queue

* changeset

* fix: regex on base builder workflow code

* test: increase sleep

* format

* fix: make writeFile atomic on workflow entrypoint

* refactor: move build queue to @workflow/builders

* revert: regex stuff with workflow code

* add console log for workflow file changed
2025-12-01 19:55:28 -08:00
Nathan Rajlich 2faddf37f6 Move @workflow/errors package to "dependencies" instead of "devDependencies" (#481) 2025-12-01 17:00:33 -08:00
Adrian cd451e0295 chore(utils): replace execa dependency (#476)
* chore(utils): replace execa dependency

* changeset
2025-12-01 14:15:25 -08:00
Adrian d53bf906ec fix: scan all dirs for standalone builder (#477)
* fix: scan all dirs for standalone builder

* changeset
2025-12-01 13:54:03 -08:00
Adrian bc9b6282c2 fix: @vercel/nft parsing proc file paths in sveltekit adapter (#473)
* fix: build proc paths dynamically

* test

* changeset
2025-12-01 13:00:42 -08:00
Peter Wielander 10c5b91079 [web] Upgrade Next.js to 16 (#465) 2025-12-01 09:23:25 -08:00
Pranay Prakash 6e8e828252 Add stream benchmarks and slightly improve the benchmarking code (#470)
* Add stream benchmarks and cnealup for benchmark code

* 10m delay for local world race

* potential fix for first bute"

* Improve sticky comment stuff

* local world: ignore controller close errors

* show missing data in benchmark comment

* nitrpicks

* Improve leaderboard

* Add benchmark comparisons against main

* changeset
2025-11-30 23:49:37 -08:00
Alex Holovach 34f3f86f31 fix(utils): detect linux ports via /proc (#471)
* fix(utils): detect linux ports via /proc

Signed-off-by: Alex Holovach <alex.holovach@kubiks.ai>

* extract parsePort helper

Signed-off-by: Alex Holovach <alex.holovach@kubiks.ai>

* add changeset

Signed-off-by: Alex Holovach <alex.holovach@kubiks.ai>

---------

Signed-off-by: Alex Holovach <alex.holovach@kubiks.ai>
2025-11-30 14:07:31 -08:00
Peter Wielander 9ea3fa9fd5 [web] Remove peer dependency on world-postgres that can't be resolved during build (#466) 2025-11-30 10:14:33 -08:00
Gal Schlezinger ef8e0e52ab world-postgres: poll faster in pg-boss (#463)
---------

Signed-off-by: Gal Schlezinger <gal@spitfire.co.il>
Co-authored-by: Peter Wielander <mittgfu@gmail.com>
2025-11-30 09:45:40 -08:00
Alex Holovach 109fe593fc [web] add PostgreSQL backend support (#459)
---------

Signed-off-by: Alex Holovach <alex.holovach@kubiks.ai>
2025-11-30 08:42:35 -08:00
Pranay Prakash a8f48c5a08 add benchmarking (#460) 2025-11-29 21:21:49 -08:00
Pranay Prakash 3aee6d7efb Port Peter's Workbench UI to nextjs-turbopack (#458)
* Port Peter's Workspace UI

* Add symlinks for webpack workbench to share UI with turbopack

- Add symlinks for components, hooks, lib directories
- Add symlinks for app/workflows and app/api/workflows
- Install UI dependencies in webpack workbench package.json
- Both webpack and turbopack workbenches now share the same UI code

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>

* Use allWorkflows from @/_workflows instead of custom examples.ts

- Update workflow definitions to include workflowFile field
- Change start route to use allWorkflows like trigger route
- Remove unused examples.ts file
- This allows accessing workflows from any workflow file, not just 99_e2e

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>

* Dynamically generate workflow definitions from allWorkflows

- Remove manual workflow definitions, now auto-generated from _workflows.ts
- Add workflowFile path display in UI (tooltip and fallback description)
- Sort workflows by file name first, then by workflow name
- Fix duplicate key issue by using workflowFile:name as key
- Make description optional since it's inferred from file path

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>

* Add default arguments map for workflows that require parameters

- Create DEFAULT_ARGS_MAP to provide sensible defaults for workflows with parameters
- Includes defaults for: addTenWorkflow, hookWorkflow, webhookWorkflow, hookCleanupTestWorkflow, closureVariableWorkflow
- Workflows without entries in the map get empty args array

This allows all workflows to be started from the UI without needing manual argument input for now.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>

* Fix terminal log colors for better visibility on black background

- Change info logs from text-primary (black in light mode) to text-cyan-400
- Change error logs from text-destructive to text-red-400
- Update stream logs to text-blue-400
- Update result logs to text-green-400
- Change prefix color from text-gray-500 to text-gray-400

All colors now work properly with the terminal's black background regardless of light/dark mode.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>

* Remove toTitleCase transformation, use raw workflow names

- Display workflow names exactly as they are in code (e.g., "addTenWorkflow")
- Remove the toTitleCase helper function
- Simpler and more direct mapping from code to UI

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>

* Use monospace font for workflow names

- Apply font-mono to workflow displayName in both card and tooltip
- Makes workflow names more readable and consistent with code style

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>

* Filter out step functions using workflowId property

- Check for 'workflowId' property added by compiler to identify workflow functions
- More reliable than checking function name endings
- Only functions with "use workflow" directive have workflowId property
- Prevents step functions from appearing in the UI

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>

* Add symlinks for remaining workflow files and dependencies

- Add symlinks for 2_control_flow.ts, 4_ai.ts, 5_hooks.ts to both workbenches
- Install openai and mixpart dependencies needed by these workflows
- Update DEFAULT_ARGS_MAP with arguments for new workflows:
  - ai: sample weather prompt
  - agent: sample weather prompt for Muscat
  - handleUserSignup: example email address
- All 9 workflow files now available in both workbenches

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>

* Group workflows by file with section headers in UI

- Group workflows by workflowFile and render each group separately
- Add section headers showing the file path for each group
- Use monospace font for file path headers
- Increase spacing between sections (space-y-4)
- Improves visual organization when browsing workflows

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>

* Show default arguments instead of file path in workflow cards

- Display default arguments in the card description line (if present)
- Remove redundant file path since it's now shown in section headers
- Use monospace font for argument display
- Workflows without arguments show no description line

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>

* Display default arguments with multi-line formatting

- Use JSON.stringify with indentation (null, 2) for better readability
- Change from <p> to <pre> with whitespace-pre-wrap
- Arguments now display across multiple lines when needed
- Easier to read complex arguments like webhook tokens

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>

* Add workflow runtime duration display with millisecond precision

- Add formatDuration helper to calculate and format runtime
- Show duration in ms, seconds, or minutes based on length
- Formats: "123ms", "5.234s", "2m 15.678s"
- Display duration in monospace font below end time
- Only shown when invocation has completed (endTime exists)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>

* Update default arguments to match e2e test values

- Use arguments from packages/core/e2e/e2e.test.ts for accuracy
- addTenWorkflow: 123 (instead of 5) to match test expectations
- closureVariableWorkflow: 7 (instead of 42) to match test expectations
- Use Math.random().toString(36) for hook/webhook tokens (matches test pattern)
- Add comment referencing e2e test source

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>

---------

Co-authored-by: Claude <noreply@anthropic.com>
2025-11-28 21:43:27 -08:00
Nathan Rajlich 0f1645b8a2 Ignore rejections in waitedUntil promise (#452) 2025-11-28 08:51:22 -08:00
Nathan Rajlich 172e0151ba Add AI provider step wrapper functions (#428) 2025-11-26 23:51:12 -08:00
Nathan Rajlich 5b918611fc Apply workflow function transformation in "step" mode (#420) 2025-11-26 23:35:53 -08:00
Nathan Rajlich 0cacb99fcc Support nested "use step" declarations in non-workflow functions (#418) 2025-11-26 23:20:04 -08:00
Vercel Release Bot 87ad24b3b6 Version Packages (beta) (#416) @workflow/world-postgres@4.1.0-beta.15 @workflow/world-testing@4.0.1-beta.23 workflow@4.0.1-beta.22 @workflow/nitro@4.0.1-beta.22 @workflow/next@4.0.1-beta.22 @workflow/cli@4.0.1-beta.22 @workflow/ai@4.0.1-beta.22 @workflow/web-shared@4.0.1-beta.20 @workflow/core@4.0.1-beta.19 @workflow/world-vercel@4.0.1-beta.13 @workflow/world-local@4.0.1-beta.13 @workflow/nuxt@4.0.1-beta.11 @workflow/swc-plugin@4.0.1-beta.8 @workflow/world@4.0.1-beta.7 @workflow/core@4.0.1-beta.1 @workflow/sveltekit@4.0.0-beta.16 @workflow/rollup@4.0.0-beta.2 2025-11-26 19:55:04 -08:00
Peter Wielander 17904fc7b4 [ai] Pass messages to step functions in DurableAgent and add prepareStep callback (#446) 2025-11-26 19:45:34 -08:00
Adrian 6dd17500da refactor: move rollup plugin to own package (#382)
* refactor: move rollup plugin to own package

* refactor(sveltekit): update sveltekit to use rollup package

* Update packages/rollup/src/index.ts

Co-authored-by: vercel[bot] <35613825+vercel[bot]@users.noreply.github.com>

* chore(deps): missing nitro dep

* chore(deps): remove unused deps from @workflow/rollup

* changeset

* chore: project LICENSE symlinks

* refactor: move @swc/core version to pnpm workspace

* chore: cleanup and add readme

---------

Co-authored-by: vercel[bot] <35613825+vercel[bot]@users.noreply.github.com>
2025-11-26 16:02:13 -08:00
Boris Besemer 40057db00b [world-local] bounded concurrency for queue (#401) 2025-11-26 13:38:22 -08:00
Adrian c6e22d0e43 docs: fix postgres world setup docs (#429) 2025-11-26 10:33:34 -08:00
Adrian cc37184967 fix: ai links in docs agent (#440) 2025-11-26 10:31:02 -08:00
Adrian b042ba70ee fix: externalize bun from step bundle (#425)
* fix: externlize bun from step bundle

* changeset

* fix: add bun to node module esbuild plugin

* feat: add bun to node module esbuild plugin match

* feat: add hint for using bun inside workflow in ts lsp

* fix: add support for bun:* modules
2025-11-26 09:28:59 -08:00
Nathan Rajlich 0ecd2da992 [docs] Add button link to X account (#435) 2025-11-26 08:41:35 -08:00
Nathan Rajlich 07800c29ee Support closure variables for serialized step functions (#366) 2025-11-25 00:29:15 -08:00
Nathan Rajlich 8b470f0c1d Apply SWC transformation on step functions returned from factory function (#360)
Added support for transforming step functions that are returned from factory functions.

### What changed?

Enhanced the SWC plugin to detect and transform step functions that are defined within object literals returned by factory functions. The transformation now properly identifies arrow functions with object literal bodies and processes their step functions accordingly.

Added test fixtures to verify the functionality:
- Created test cases for a factory function that returns an object with a step method
- Added corresponding output files for client, step, and workflow modes

### How to test?

1. Create a factory function that returns an object with methods marked as steps:
```javascript
const myFactory = () => ({
  myStep: async () => {
    'use step';
    await fs.mkdir('test');
  },
});
```

2. Verify that the step function is properly transformed and registered when used in a workflow.

### Why make this change?

This enhancement supports a common pattern where developers create factory functions that return objects containing step methods. Without this change, step functions defined in this pattern weren't being properly transformed, which limited the flexibility of the workflow system.
2025-11-25 00:25:44 -08:00
Nathan Rajlich fb9fd0f893 Add support for closure scope vars in step functions (#358)
### What changed?

- Enhanced the SWC plugin to detect and collect closure variables from nested step functions
- Modified the workflow runtime to pass closure variables to step functions during execution
- Updated the serialization/deserialization logic to handle the new closure variable format
- Added a mechanism to access closure variables within step functions
- Added tests to verify closure variable functionality in nested step functions
- Closure variables are stored on the step function execution's `AsyncLocalStorage`​ context

### Example

```typescript
export async function myWorkflow(baseValue: number) {
  'use workflow';
  const multiplier = 3;
  const prefix = 'Result: ';

  const calculate = async () => {
    'use step';
    const result = baseValue * multiplier;
    return `${prefix}${result}`;
  };

  return await calculate();
}
```

### Why make this change?

Previously, nested step functions couldn't access variables from their parent workflow scope, limiting their usefulness and requiring workarounds like passing all needed values as parameters. This change enables a more natural programming model where step functions can access variables from their enclosing scope, making workflow code more intuitive and reducing the need for explicit parameter passing.
2025-11-25 00:21:05 -08:00
Adrian 71d1757d0f fix: preview package tarballs (#411) 2025-11-24 16:50:04 -08:00
Hayden Bleasel 4f09e128a8 Remove unused dependencies (#405) 2025-11-24 15:23:32 -08:00
Vercel Release Bot 018c5a053e Version Packages (beta) (#410) @workflow/world-testing@4.0.1-beta.22 workflow@4.0.1-beta.21 @workflow/nitro@4.0.1-beta.21 @workflow/next@4.0.1-beta.21 @workflow/cli@4.0.1-beta.21 @workflow/ai@4.0.1-beta.21 @workflow/web-shared@4.0.1-beta.19 @workflow/core@4.0.1-beta.18 @workflow/builders@4.0.1-beta.17 @workflow/nuxt@4.0.1-beta.10 2025-11-24 15:22:23 -08:00
Julian Benegas aba5264174 [ai] Add onStepFinish callback to DurableAgent#stream() (#404) 2025-11-24 15:10:49 -08:00
Peter Wielander 6889dacd08 [world-vercel] log warning when detecting zod v3 during enqueue action (#409) 2025-11-24 15:08:15 -08:00
Vercel Release Bot e5c0380bbd Version Packages (beta) (#396) @workflow/world-postgres@4.1.0-beta.14 @workflow/world-testing@4.0.1-beta.21 workflow@4.0.1-beta.20 @workflow/nitro@4.0.1-beta.20 @workflow/next@4.0.1-beta.20 @workflow/cli@4.0.1-beta.20 @workflow/web-shared@4.0.1-beta.18 @workflow/core@4.0.1-beta.17 @workflow/builders@4.0.1-beta.16 @workflow/world-local@4.0.1-beta.12 @workflow/world-vercel@4.0.1-beta.11 @workflow/nuxt@4.0.1-beta.9 @workflow/errors@4.0.1-beta.6 @workflow/utils@4.0.1-beta.4 @workflow/sveltekit@4.0.0-beta.14 2025-11-24 14:25:39 -08:00
Nathan Rajlich aa5ff3ccd9 Disable Turborepo cache for CI related tasks (#329)
* Disable Turborepo cache for CI related tasks

Disable cache for all tasks except "build"

* Checkout swc-plugin test fixture files with Unix newlines for Windows (#331)
2025-11-24 13:35:43 -08:00
Peter Wielander 2c438c3bd0 [world-vercel] Fix queue call compatibility for zod v3 (#403) 2025-11-24 12:29:40 -08:00
Adrian edb69c3c0d fix: port detection, postgres nitro apps and nitro app testing (#363)
* add debug logs

* add polling for port test

* nuxt may be hmring on ignored files/folders

* Revert "nuxt may be hmring on ignored files/folders"

This reverts commit c57c3f0dd9e1b757825c777e12b63e050ca44227.

* Update packages/utils/src/get-port.ts

Co-authored-by: vercel[bot] <35613825+vercel[bot]@users.noreply.github.com>

* Update packages/world-local/src/config.ts

Co-authored-by: vercel[bot] <35613825+vercel[bot]@users.noreply.github.com>

* Update packages/utils/src/get-port.ts

Co-authored-by: vercel[bot] <35613825+vercel[bot]@users.noreply.github.com>

* revert getPort

* test new pid to port cmd

* extend sleep time on tests

* fix

* fix race condition in tests

* add logs

* add fallback from pid-port

* remove pid-port fallback

* revert config ts

* test: add getPort test

* update tests for concurrent calls

* temp

* trigger rebuild

* feat: add windows get port support

* fix port sorting

* fix parsing logic and filtering

* fformat

* update ports logi

* revert

* windows port hack

* refactor: optional chaining on windows

* test: change ordering of config tests

* remove wrong test

* simplify windows getPort impl

* use execFileSync instead of execFile

* use execa

* disable test cache

* Update packages/utils/src/get-port.ts

Co-authored-by: vercel[bot] <35613825+vercel[bot]@users.noreply.github.com>

* update

* debug

* windows cmd

* Apply suggestion from @Copilot

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* Apply suggestion from @Copilot

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* lockfile

* fix: windows port detection

* simplify stuff

* Apply suggestion from @Copilot

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* test: revert gh copilot

* fix

* increase sleep

* revert logs

* revert turbo

* revert

* revert

* changeset

* Update packages/utils/src/get-port.ts

Co-authored-by: vercel[bot] <35613825+vercel[bot]@users.noreply.github.com>

* format

* init postgres world for express and hono

* add posgres world to nitro config

* add postgres world start to sveltekit

* add postgres world plugin to nitro apps

* Update workbench/sveltekit/src/hooks.server.ts

Co-authored-by: vercel[bot] <35613825+vercel[bot]@users.noreply.github.com>

* Update workbench/vite/vite.config.ts

Co-authored-by: vercel[bot] <35613825+vercel[bot]@users.noreply.github.com>

* fix nuxt plugin

* revert vercel compiled hook on nitro

* .

* revert

* update

* CI WILL BE GREEN

* remove log in nitro

---------

Co-authored-by: vercel[bot] <35613825+vercel[bot]@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2025-11-24 09:30:41 -08:00