Commit Graph

238 Commits

Author SHA1 Message Date
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
Gal Schlezinger 10ce313d56 postgres: fix tests (#394)
* postgres: use non-deprecated drizzle signatures

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

* postgres: store metadata in the hook

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

* core: do not rely on module cache for world config. instead, use a global and a symbol.

this makes sure that streamers can use in-memory event emitters and that it won't be compiled away into the different flow.js and step.js files.

this was figured out when i was adding a hooks tests to world-testing.

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

* add postgres world to all workbench packages

we try to run them with the postgres world but it's not installed

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

* Replace jsonb with cbor because zero byte does not work in jsonb :(

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

* fix error handling: attempts start at 0 now, and not 1 like when we released. so initial attempt in postgres should reflect that.

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

* drain stuff

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

* fallback metadata to metadataJson

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

* Make code more readable

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

* apply Vade fix

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

---------

Signed-off-by: Gal Schlezinger <gal@spitfire.co.il>
2025-11-23 11:05:20 -08:00
Nathan Rajlich 00e334506c [ai] Make DurableAgent#stream() return a messages array (#362)
* Make `DurableAgent#stream()` return a `messages` array

* Docs updates

* Docs updates

* fix

---------

Co-authored-by: Pranay Prakash <pranay.gp@gmail.com>
2025-11-23 11:02:53 -08:00
Vercel Release Bot 7a230a9ad1 Version Packages (beta) (#387)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
@workflow/world-postgres@4.1.0-beta.13 @workflow/world-testing@4.0.1-beta.20 workflow@4.0.1-beta.19 @workflow/nitro@4.0.1-beta.19 @workflow/next@4.0.1-beta.19 @workflow/cli@4.0.1-beta.19 @workflow/ai@4.0.1-beta.19 @workflow/web-shared@4.0.1-beta.17 @workflow/core@4.0.1-beta.16 @workflow/builders@4.0.1-beta.15 @workflow/world-local@4.0.1-beta.11 @workflow/nuxt@4.0.1-beta.8 workflow@4.0.1-beta.1 @workflow/nitro@4.0.1-beta.1 @workflow/next@4.0.1-beta.1 @workflow/cli@4.0.1-beta.1 @workflow/ai@4.0.1-beta.1 @workflow/sveltekit@4.0.0-beta.13
2025-11-22 07:32:12 -08:00
Pranay Prakash ce50baf96a bring world local back to 4.x 2025-11-22 10:29:36 -05:00
Copilot 34366293a0 Fix streamer bugs and document concurrency limitations in world-local (#391)
* Initial plan

* Fix bugs in world-local: empty chunk handling, type safety, and documentation

Co-authored-by: pranaygp <1797812+pranaygp@users.noreply.github.com>

* Add changeset for world-local bug fixes

Co-authored-by: pranaygp <1797812+pranaygp@users.noreply.github.com>

* Attempt to fix local straming

* fix the actual queue copy problem

* update changeset

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: pranaygp <1797812+pranaygp@users.noreply.github.com>
Co-authored-by: Pranay Prakash <pranay.gp@gmail.com>
2025-11-22 07:26:46 -08:00
Peter Wielander 99611405d4 Fix hydration of events with dates and of step functions (#380) 2025-11-21 13:58:02 -05:00
Adrian 73b6c68daf remove suppressUndefinedRejections from base builder (#384) 2025-11-21 06:42:28 -08:00
Sree Narayanan adfa01224a [docs] Minor corrections to local world and express setup docs (#385)
Signed-off-by: Sree Narayanan <sreeaadhi07@gmail.com>
2025-11-20 23:57:52 -08:00
Vercel Release Bot 2856d665c0 Version Packages (beta) (#375)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
@workflow/world-testing@4.0.1-beta.19 workflow@4.0.1-beta.18 @workflow/nitro@4.0.1-beta.18 @workflow/next@4.0.1-beta.18 @workflow/cli@4.0.1-beta.18 @workflow/builders@4.0.1-beta.14 @workflow/swc-plugin@4.0.1-beta.7 @workflow/nuxt@4.0.1-beta.7 @workflow/world-testing@4.0.1-beta.1 @workflow/sveltekit@4.0.0-beta.12
2025-11-20 14:24:12 -08:00
Copilot 154670ae01 Handle FatalError in DurableAgent tool execution (#376)
* Initial plan

* Fix DurableAgent to handle FatalError in tool calls

Convert FatalError exceptions in tool execution to tool-result errors that get
propagated back to the LLM, mimicking AI SDK behavior. Non-fatal errors are
re-thrown to allow workflow retry mechanisms to handle them.

- Updated executeTool to catch FatalError and convert to error-text tool result
- Added comprehensive tests for error handling scenarios
- All tests passing

Co-authored-by: pranaygp <1797812+pranaygp@users.noreply.github.com>

* Address code review feedback and add changeset

Remove unnecessary type assertion and add changeset for the DurableAgent fix

Co-authored-by: pranaygp <1797812+pranaygp@users.noreply.github.com>

* Update packages/ai/src/agent/durable-agent.ts

* Apply suggestion from @pranaygp

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: pranaygp <1797812+pranaygp@users.noreply.github.com>
Co-authored-by: Peter Wielander <mittgfu@gmail.com>
Co-authored-by: Pranay Prakash <pranay.gp@gmail.com>
2025-11-20 14:17:48 -08:00
Nathan Rajlich 43a3f797d3 [ai] Fix "start" and "finish" chunk events in DurableAgent (#378)
* [ai] Remove "start" and "finish" chunk events

* Wire through sendStart and sendFinish properly

* changeset

---------

Co-authored-by: Pranay Prakash <pranay.gp@gmail.com>
2025-11-20 14:16:21 -08:00
Nathan Rajlich e5c5236363 Fix default export workflow function transformation in workflow mode (#373)
Fixed a bug where default export workflow functions with names (e.g., `export default async function testWorkflow()`) would fail at runtime with `ReferenceError: $$default is not defined`. The SWC plugin now correctly keeps the default export as-is and simply adds the workflowId assignment after it, since the function name is available as a binding in the module scope.

Also adds support for anonymous and arrow function default exports, which previously were not being transformed at all.

Fixes #367.
2025-11-20 12:26:12 -08:00
Nathan Rajlich 1e636e170d [ai] Make writable property be required in DurableAgent#stream() (#365) 2025-11-20 00:19:35 -08:00
Adrian 4b4f93b662 docs: fix framework cards (#372)
* docs: fix framework cards

* docs: fix tanstack start logo light mode

* remove h1 on vite
2025-11-19 17:16:54 -08:00
Adrian 00066be07b feat: add express support (#138)
* refactor: migrate to latest nitro v3

Signed-off-by:  Pooya Parsa <pooya@pi0.io>

* update workaround

* fix(nitro): nitro builder using deprecated srcDir

* fix: testing matrix dirs

* fix(hono): externalize nitro workflow output dir

* chore: format

* fix(nitro): externalize .nitro/workflow folder

* docs(hono): update getting started

* update docs and workbench

* improve plugin patch

* docs: preserve code style

* update `getWorkflowDirs`

* test: fix hono dev config

* fix: wrong api file path in hono dev config

* fix(nitro): check all dirs for builder

* chore: add comments

* add express workbench testing app

* docs: add express wip page

* add workflows symlink for express workbench

* add hook and trigger routes for express workbench

* update server entrypoint to use hook and trigger router

* remove h3 and add express types

* docs: add express getting started guide

* test: wire up express workbench

* Update workbench/express/routes/hook.routes.ts

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

* Update workbench/express/routes/trigger.routes.ts

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

* build: missing deps in workbench express

* build: remove express as dev dep

* lockfile

* build: remove test command from express workbench

* fix: url query parsing

* chore: add README

* remove app hook and trigger routers

* .

* fix: json body not getting parsed in workbench express

* fix: writing streams in workbench

* fix: wrong stream piping express workbench

* update

* fix: json parsing body workbench express

* update

* fix: add js file extension for relative import on workflow express workbench

* test

* refactor: route naming conventions for nitro

* refactore: convert to catch all api on express

* Update workbench/express/package.json

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

* refactor: api file convention

* testing presets

* refactor: use simple `index.ts`

* update

* switch entry format to node

* add generate workflow script to express

* fix: express nitro config

* docs(express): update express getting started

* test: add express

* fix(express): workbench api routes

* fix(express): add workflowsDir to testing matrix

* format

* update gitignore

* fix

* .

* trigger ci

* update workflows dir

* fix: streaming in express

* fix: not json parsing body express

* fix: missing dev test in express

* fix: test matrix for express

* docs(express): update getting started and add rollup dep

* .

* docs: add express card to home page and getting started

* Update docs/content/docs/getting-started/express.mdx

Co-authored-by: Pooya Parsa <pooya@pi0.io>

* docs: fix express

* remove h1 on express

---------

Signed-off-by: Pooya Parsa <pooya@pi0.io>
Co-authored-by: Pooya Parsa <pooya@pi0.io>
Co-authored-by: vercel[bot] <35613825+vercel[bot]@users.noreply.github.com>
2025-11-19 17:12:53 -08:00
Hayden Bleasel 250edc1d52 Update vite.mdx (#371) 2025-11-19 16:25:21 -08:00
Hayden Bleasel c0991b4ff7 Update docs (#349)
* Initial migration

* Remove ExperimentalPackageCallout

* Remove Callout imports

* Add missing dep

* Update postgres-world.mdx

* Add missing deps, remove unused files

* Restore homepage css

* Update logo, fix homepage

* Update run-anywhere.tsx

* Remove duplicate h1 tags

* Fix package install commands

* Update global.css

* Update code-block.tsx

* Fix framework descriptions

* Remove unused files

* Fix steps

* Update sidebar.tsx

* Remove excess horizontal rules

* Remove unused components

* Cleanup home code-block component

* Update route.ts

* Add missing feed dep

* Rename middleware to proxy

* Update next config

* Update route.tsx

* Move generateDefinition call into tsx

* Update page.tsx

* Update sidebar.tsx

* Update layout.tsx

* Remove unused files

* Fix nav

* Update route.ts

* Remove deprecated lint:links

* Load fonts locally

* Update layout.tsx

* Update route.ts

* Update Geistdocs

* Update hero.tsx

* Update search.tsx

* Update search.tsx

* docs: update url structure in chat tools example

* chore: replace gpt-5 reasoning with gpt-5.1

* docs: update instructions for llm to be more workflow-centric

* Revert "docs: update instructions for llm to be more workflow-centric"

This reverts commit 3852820988.

* Update pnpm-lock.yaml

* Update home-layout.tsx

* Update layout.tsx

* Update pnpm-workspace.yaml

---------

Co-authored-by: Adrian Lam <me@adriandlam.com>
2025-11-19 16:17:21 -08:00
Adrian 6a063a3e5f docs: add vite getting started (#285)
* refactor: migrate to latest nitro v3

Signed-off-by:  Pooya Parsa <pooya@pi0.io>

* update workaround

* fix(nitro): nitro builder using deprecated srcDir

* fix: add back nitro config

* fix: testing matrix dirs

* fix(hono): externalize nitro workflow output dir

* chore: format

* fix(nitro): externalize .nitro/workflow folder

* docs(hono): update getting started

* update docs and workbench

* improve plugin patch

* test: fix hono dev config

* fix: wrong api file path in hono dev config

* fix(nitro): check all dirs for builder

* chore: add comments

* refactor: migrate to latest nitro v3

Signed-off-by:  Pooya Parsa <pooya@pi0.io>

* docs: update home page frameworks

* update getting started stuff and add vite page

* docs: update vite getting started page

* Update docs/app/(home)/components/frameworks.tsx

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

* Update docs/content/docs/getting-started/index.mdx

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

* Apply suggestion from @adriandlam

* Update docs/app/(home)/components/frameworks.tsx

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

* lockfile

* lockfile

* docs: update vite getting started guide

* format

* format

* format

* reset packages/nitro/src/index.ts

* docs: fix vite getting started

* docs: fix vite getting started api route

* revert

---------

Signed-off-by: Pooya Parsa <pooya@pi0.io>
Co-authored-by: Pooya Parsa <pooya@pi0.io>
Co-authored-by: vercel[bot] <35613825+vercel[bot]@users.noreply.github.com>
2025-11-19 15:18:50 -08:00
Vercel Release Bot 29892a0f93 Version Packages (beta) (#369) @workflow/world-local@5.0.0-beta.10 @workflow/world-postgres@4.1.0-beta.12 @workflow/world-testing@4.0.1-beta.18 workflow@4.0.1-beta.17 @workflow/nitro@4.0.1-beta.17 @workflow/next@4.0.1-beta.17 @workflow/cli@4.0.1-beta.17 @workflow/ai@4.0.1-beta.17 @workflow/web-shared@4.0.1-beta.16 @workflow/core@4.0.1-beta.15 @workflow/builders@4.0.1-beta.13 @workflow/world-vercel@4.0.1-beta.10 @workflow/nuxt@4.0.1-beta.6 @workflow/sveltekit@4.0.0-beta.11 2025-11-19 11:15:09 -08:00
Nathan Rajlich 3d99d6d38d Update @vercel/oidc and @vercel/queue to fix expired OIDC token edge case (#368) 2025-11-19 11:13:15 -08:00
Vercel Release Bot 70fb4ebc9d Version Packages (beta) (#357)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
@workflow/world-testing@4.0.1-beta.17 workflow@4.0.1-beta.16 @workflow/cli@4.0.1-beta.16 @workflow/ai@4.0.1-beta.16 @workflow/web-shared@4.0.1-beta.15 @workflow/builders@4.0.1-beta.12 @workflow/nuxt@4.0.1-beta.5 @workflow/sveltekit@4.0.0-beta.10
2025-11-19 08:51:25 -08:00
Pranay Prakash 6e41c90ab5 Fix workflow failing because of function timeouts (#322)
* Fix workflow failing because of function timeouts

* Update packages/core/src/runtime.ts

Co-authored-by: Peter Wielander <mittgfu@gmail.com>

---------

Co-authored-by: Peter Wielander <mittgfu@gmail.com>
2025-11-18 17:39:59 -08:00
Nathan Rajlich 0337f16ae0 Fix 'getWritable()' docs page to not write to stream in workflow function (#364) 2025-11-18 17:22:54 -08:00
Pranay Prakash 5afc66eaaa Add e2e tests for postgres world (#356)
* Add e2e tests for postgres world

* Add e2e tests for postgres world

- Add new e2e-local-postgres job to test all workbenches against postgres world
- Configure PostgreSQL service container in GitHub Actions
- Update world-postgres build script to chmod +x the setup.js bin
- Use direct path to setup script in CI for reliability
- Tests run in production mode similar to e2e-local-prod tests
2025-11-17 18:28:00 -08:00
Pooya Parsa ee25bd9d55 refactor: upgrade to latest nitro v3 (#293)
* refactor: migrate to latest nitro v3

Signed-off-by:  Pooya Parsa <pooya@pi0.io>

* update workaround

* fix(nitro): nitro builder using deprecated srcDir

* fix: add back nitro config

* fix: testing matrix dirs

* fix(hono): externalize nitro workflow output dir

* chore: format

* fix(nitro): externalize .nitro/workflow folder

* docs(hono): update getting started

* changeset

* update docs and workbench

* improve plugin patch

* docs: preserve code style

* update `getWorkflowDirs`

* update vite workbench

* test: fix hono dev config

* fix: wrong api file path in hono dev config

* fix(nitro): check all dirs for builder

* chore: add comments

---------

Signed-off-by: Pooya Parsa <pooya@pi0.io>
Co-authored-by: Adrian Lam <me@adriandlam.com>
2025-11-17 16:53:38 -08:00
Vercel Release Bot f1b734129a Version Packages (beta) (#354) @workflow/world-local@5.0.0-beta.9 @workflow/world-testing@4.0.1-beta.16 workflow@4.0.1-beta.15 @workflow/nitro@4.0.1-beta.15 @workflow/next@4.0.1-beta.15 @workflow/cli@4.0.1-beta.15 @workflow/web-shared@4.0.1-beta.14 @workflow/core@4.0.1-beta.13 @workflow/builders@4.0.1-beta.11 @workflow/world-vercel@4.0.1-beta.9 @workflow/world@4.0.1-beta.6 @workflow/nuxt@4.0.1-beta.4 @workflow/sveltekit@4.0.0-beta.9 2025-11-17 14:19:24 -08:00
Peter Wielander 566681a92a [ai] Add stopCondition to DurableAgent and emit error parts to writeable stream (#353) 2025-11-17 13:53:35 -08:00
Peter Wielander 4b70739b50 Core: require specifying runId when writing to stream (#232) 2025-11-17 08:56:42 -08:00
Nathan Rajlich 2fde24e866 Use inline sourcemaps to prevent SWC read import error (#352)
Fixes #338.
2025-11-16 23:36:37 -08:00
vercel[bot] 510c55ba1d Update grammar in workflow docs (#334)
Improved grammar in the workflow documentation as requested.

## Files Modified:

### Core Documentation Files:
- `README.md` - Main repository README
- `docs/content/docs/foundations/index.mdx` - Foundations overview
- `docs/content/docs/foundations/workflows-and-steps.mdx` - Core concepts documentation
- `docs/content/docs/foundations/starting-workflows.mdx` - Workflow startup guide
- `docs/content/docs/foundations/control-flow-patterns.mdx` - Control flow documentation
- `docs/content/docs/foundations/errors-and-retries.mdx` - Error handling guide
- `docs/content/docs/foundations/hooks.mdx` - Hooks and webhooks documentation

### Getting Started Guides:
- `docs/content/docs/getting-started/next.mdx` - Next.js integration guide
- `docs/content/docs/getting-started/hono.mdx` - Hono integration guide

### API Reference:
- `docs/content/docs/api-reference/workflow/sleep.mdx` - Sleep function documentation

### Deployment Documentation:
- `docs/content/docs/deploying/index.mdx` - Deployment guide

## Types of Grammar Issues Fixed:

1. **Articles and Determiners**:
   - Added missing articles ("a", "an", "the") where appropriate
   - Fixed article usage consistency

2. **Verb Forms and Tenses**:
   - Corrected "has passed" → "passes" for better flow
   - Fixed "needs" → "need" for proper subject-verb agreement
   - Changed "will go a long way in helping" → "will go a long way toward helping"

3. **Comma Usage**:
   - Added missing commas in compound sentences
   - Fixed comma placement before "and" in complex sentences
   - Added commas after introductory clauses

4. **Word Choice and Clarity**:
   - Changed "really simple" → "simple" for more professional tone  
   - Fixed "setup" → "set up" (verb form vs noun form)
   - Changed "newly made" → "newly created" for better precision
   - Improved "the external system" → "external systems" for consistency
   - Fixed "propagate the error over to" → "propagate the error to"

5. **Sentence Structure**:
   - Combined fragmented sentences for better flow
   - Fixed run-on sentences by adding proper punctuation
   - Improved parallel structure in lists and descriptions

6. **Punctuation and Formatting**:
   - Changed "Learn more:" → "Learn more": for consistency
   - Fixed em-dash usage (- → —) where appropriate
   - Added backticks around code terms like `start()` for consistency

7. **Pronoun and Reference Clarity**:
   - Fixed unclear pronoun references
   - Made subject-verb agreements consistent
   - Improved clarity of "them" and "it" references

## Implementation Approach:

- Systematically reviewed key documentation files
- Applied consistent grammar rules across all files
- Maintained the existing technical tone and style
- Preserved all code examples and technical accuracy
- Focused on readability improvements without changing meaning

The grammar improvements make the documentation more professional and easier to read while maintaining all technical accuracy and existing functionality.

Co-authored-by: Vercel <vercel[bot]@users.noreply.github.com>
2025-11-16 11:46:16 -08:00
Vercel Release Bot c78bec37b0 Version Packages (beta) (#308)
Signed-off-by: Nathan Rajlich <n@n8.io>
@workflow/world-local@5.0.0-beta.8 @workflow/world-testing@4.0.1-beta.15 workflow@4.0.1-beta.14 @workflow/nitro@4.0.1-beta.14 @workflow/next@4.0.1-beta.14 @workflow/cli@4.0.1-beta.14 @workflow/ai@4.0.1-beta.14 @workflow/web-shared@4.0.1-beta.13 @workflow/core@4.0.1-beta.12 @workflow/web@4.0.1-beta.11 @workflow/world-vercel@4.0.1-beta.8 @workflow/swc-plugin@4.0.1-beta.6 @workflow/world@4.0.1-beta.5 @workflow/errors@4.0.1-beta.5 @workflow/utils@4.0.1-beta.3 @workflow/nuxt@4.0.1-beta.3 @workflow/sveltekit@4.0.0-beta.8
2025-11-16 00:31:36 -08:00
Nathan Rajlich 23f5c1d781 Make tools optional in DurableAgent (#350)
Made the `tools` parameter optional in the `DurableAgent` class.

### What changed?

- Updated the `DurableAgentOptions` interface to make the `tools` property optional
- Modified the constructor to initialize `this.tools` with an empty object (`{}`) when `options.tools` is not provided
2025-11-15 19:30:35 -08:00
Nathan Rajlich 0b848cd25f [swc-plugin-workflow] Fix compiler warnings (#348) 2025-11-15 19:26:48 -08:00
Nathan Rajlich 45b7b41055 Add support for defining model as a step function initializer in DurableAgent (#346)
Added support for defining `model` as a step function initializer in the AI workflow package.

### What changed?

- Modified the `DurableAgent` class to accept either a string model ID or a function that returns a `LanguageModelV2` instance
- Updated the `doStreamStep` function to handle both string model IDs and function initializers
- Added proper error handling for invalid model initialization arguments

### How to test?

Test both initialization methods:

1. Using a string model ID:
```typescript
const agent = new DurableAgent({
  model: 'anthropic/claude-opus',
  // other options
});
```

2. Using a step function initializer:
```typescript
import { xai } from "@ai-sdk/xai"

const agent = new DurableAgent({
  model: async () => {
    "use step";
    return xai("grok-4");
  },
  // other options
});
```

### Why make this change?

This enhancement provides more flexibility in how language models are initialized and used within the workflow. By supporting function initializers, users can now:

- Use custom model instances with specialized configurations
- Implement more complex model initialization logic that wasn't possible with just string identifiers
2025-11-15 19:24:59 -08:00
Nathan Rajlich aecdcdfb75 Add support for step functions nested inside of workflow functions (#345)
Added support for nested step functions inside workflow functions, improving the SWC plugin's ability to handle complex workflow patterns.

### What changed?

- Added support for nested step functions inside workflow functions
- Implemented hoisting of nested step functions in step mode
- Added tracking of default exports that need to be replaced with expressions
- Refactored function processing logic into a dedicated `process_stmt` method
- Fixed directive detection and removal in various contexts
- Improved handling of workflow functions with both file-level and inline directives
- Added conditional body replacement for workflow functions based on directive source
- Added test cases for nested step functions in workflow functions

### How to test?

1. Create a workflow function with a nested step function:
```javascript
export async function example(a, b) {
  "use workflow";

  async function step(a, b) {
    "use step";
    return a + b;
  }

  const val = await step(a, b);
  return val;
}
```

2. Verify the output in different modes:
   - Step mode: The nested step function is hoisted to module level
   - Workflow mode: The nested step function is replaced with a proxy reference
   - Client mode: The workflow function throws an error when called directly

### Why make this change?

This change enables more complex workflow patterns by allowing step functions to be defined inside workflow functions. Previously, all step functions had to be defined at the module level, which limited code organization options. With this change, developers can define step functions closer to where they're used, improving code readability and maintainability while still ensuring proper transformation for all execution modes.
2025-11-15 19:22:42 -08:00
Nathan Rajlich 8002e0f5d3 Add support for step functions defined as object properties (#342)
Added support for step functions defined as object properties in the SWC plugin.

### What changed?

This PR extends the SWC plugin to support step functions defined as object properties. It now handles three different patterns:

1. Arrow functions in object properties: `tool({ execute: async () => { "use step"; ... } })`
2. Function expressions in object properties: `tool({ execute: async function() { "use step"; ... } })`
3. Method syntax in objects: `tool({ async execute() { "use step"; ... } })`

The implementation:
- Detects "use step" directives in object property functions
- Hoists these functions in step mode
- Converts them to step initializer calls in workflow mode
- Properly tracks and registers these functions with appropriate identifiers
- Updates metadata generation to include object property step functions

### How to test?

Test with various object property function patterns:

```javascript
// Arrow function in object property
const weatherTool = tool({
  execute: async ({ location }) => {
    "use step";
    return { location, temperature: 72 };
  }
});

// Function expression in object property
const timeTool = tool({
  execute: async function() {
    "use step";
    return { time: new Date().toISOString() };
  }
});

// Method syntax
const dateTool = tool({
  async execute() {
    "use step";
    return { date: new Date().toDateString() };
  }
});
```

### Why make this change?

This change enables a common pattern in JavaScript where functions are defined as object properties, particularly in AI SDK tool definitions. 

Previously, the SWC plugin only supported top-level function declarations and expressions with the `"use step"` directive. This enhancement provides a more natural developer experience by allowing step functions to be defined directly within their object context.
2025-11-14 23:34:27 -08:00
Nathan Rajlich 6be03f327c Use "stepId" instead of Symbol.for("STEP_FUNCTION_NAME_SYMBOL") for annotating step functions (#341)
Replace `Symbol.for("WORKFLOW_STEP_FUNCTION_NAME")` with a standard `stepId` property for step function annotation.

### What changed?

- Replaced the use of `STEP_FUNCTION_NAME_SYMBOL` (a Symbol) with a regular `stepId` property on step functions
- Updated the serialization logic to check for the `stepId` property instead of the Symbol
- Removed the `STEP_FUNCTION_NAME_SYMBOL` constant from symbols.ts
- Updated tests to reflect this change in implementation

### Why make this change?

This more closely resembles how Workflow functions are annotated with a `workflowId` property.
2025-11-14 23:16:11 -08:00
Nathan Rajlich 5eb588a020 Remove step function identifier transform out of swc-plugin and into useStep() runtime function (#337)
Improved step function serialization by moving the function name symbol definition from the SWC plugin to the runtime.

### What changed?

- Modified `createUseStep` in `packages/core/src/step.ts` to accept a `stepFunctionName` parameter and apply both the name property and the `WORKFLOW_STEP_FUNCTION_NAME` symbol directly to the step function at creation time
- Removed the code in the SWC plugin that was previously responsible for adding the `WORKFLOW_STEP_FUNCTION_NAME` symbol to step functions
- Updated all test outputs to reflect the removal of the redundant symbol definition code

### How to test?

1. Run the existing test suite to ensure all tests pass
2. Create a workflow with step functions and verify that:
   - Step functions maintain their original function names
   - Step functions have the `WORKFLOW_STEP_FUNCTION_NAME` symbol properly attached
   - Serialization and deserialization of step functions works correctly

### Why make this change?

This change improves the architecture by:
1. Moving the responsibility for defining step function metadata to the runtime where it belongs
2. Ensuring step functions maintain their original names, which helps with debugging and error messages
3. Reducing redundancy by defining the symbol in one place instead of having the SWC plugin generate it for each function
4. Making the code more maintainable by centralizing the step function creation logic
2025-11-14 23:07:09 -08:00
Nathan Rajlich f07b2da60f feat: Transform step functions to single useStep() calls via const assignments (#336)
- Modified SWC plugin to convert exported step functions to const declarations
- Instead of wrapping functions (calling useStep on every invocation), functions are now assigned directly to the result of useStep() call
- This ensures useStep() is called only once at module initialization, improving performance
- Applies to both file-level and function-level 'use step' directives
- All step function exports now use pattern: export const fn = globalThis[Symbol.for('WORKFLOW_USE_STEP')](stepId, fnName)
- Updated all test fixtures to reflect the new transformation

Signed-off-by: Nathan Rajlich <n@n8.io>
2025-11-14 15:42:17 -08:00
Pranay Prakash 945a946812 Normalize Workbenches (#283)
* Normalize Workbenches

Normalize trigger scripts across workbenches
fix: include hono in local build test

test: include src dir for test

test: add workflow dir config in test to fix sveltekit dev tests

add temp 7_full in example wokrflow

format

fix(sveltekit): detecting workflow folders and customizable dir

Remove 7_full and 1_simple error
replace API symlink in webpack workbench
Fix sveltekit and vite tests
Fix sveltekit symlinks
Test fixes
Fix sveltekit workflows path
Dont symlink routes in vite
Include e2e tests for hono and vite

fix error tests post normalization

wip - attempted fixes

* Add claude demo command

* fix: normalize workbench tests (#292)

* Proper stacktrace propogation in world

Proper stacktrace propogation in world

* Standardize the error type in the world spec

* Normalize Workbenches

Normalize trigger scripts across workbenches
fix: include hono in local build test

test: include src dir for test

test: add workflow dir config in test to fix sveltekit dev tests

add temp 7_full in example wokrflow

format

fix(sveltekit): detecting workflow folders and customizable dir

Remove 7_full and 1_simple error
replace API symlink in webpack workbench
Fix sveltekit and vite tests
Fix sveltekit symlinks
Test fixes
Fix sveltekit workflows path
Dont symlink routes in vite
Include e2e tests for hono and vite

* fix error tests post normalization

* fix(sveltekit): reading file on hmr delete

* changeset

* fix(vite): add resolve symlink script

* fix(vite): missing building on hmr

* test local builder in vite

* test: increase timeout on hookWorkflow

* test: ignore vite based apps in crossFileWorkflow

* test: fix nitro based apps status codes

* fix: intercept default vite spa handler on 404 workflow routes

* fix: vite hook route returning 422

* test: use 422 for hookWorkflow expected

* test: fix hono returning 404

* chore: add comment to middleware to clarify

* make api route for duplicate case

* revert

* revert: nitro builder

* add back nitro unhandled rejection logic

* test: add hono

* changeset

* fix: unused method

* fix: remove duplicate import

* remove

* chore: add comments to clarify

* test remove vite symlink script

---------

Co-authored-by: Pranay Prakash <pranay.gp@gmail.com>

* refactor: add top level resolve symlinks script

* fix: cleanup builder directories (#319)

* fix: add sveltekit server routes to builder

* fix: remove root workflow dir check

* fix missing root level workflow route

* Fix: The constructor now hardcodes `dirs: ['src/routes', 'src/lib']` which silently ignores any user\-provided `dirs` option passed to the plugin\, breaking the documented API and removing support for custom workflow directories\.

* Fix: The test expectations don\'t match the new implementation of `getWorkflowDirs()`\. The mock provides `scanDirs` which the new code no longer uses\, and the new implementation adds scanning of `routesDir` and `apiDir` instead\.

* fix(nitro): use src dir

---------

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

* refactor(nitro): use suppressUndefinedRejections

* revert: sveltekit builder

---------

Co-authored-by: Adrian <me@adriandlam.com>
Co-authored-by: Vercel <vercel[bot]@users.noreply.github.com>
Co-authored-by: vercel[bot] <35613825+vercel[bot]@users.noreply.github.com>
2025-11-14 10:13:06 -08:00
Adrian 9e179a8c23 ci: move linting links to separate job (#339)
* ci: move linting links to separate job

* ci: add lint workflow

* ci: update job name

* ci: remove bun setup
2025-11-13 19:57:20 -08:00
Peter Wielander 04e7626808 Fix build for nitro v2 (#335) 2025-11-13 12:02:24 -08:00
Saatvik Arya aa015af89d feat(world-local): add baseUrl config and improve port handling (#260) 2025-11-13 11:30:57 -08:00