Commit Graph

28 Commits

Author SHA1 Message Date
Will Sather 4670c4b92d feat(core): add optional namespace for queue topic prefix (#2305)
* feat(core): add optional namespace for queue prefix

* fix(world-postgres): job queue prefix validation

* fix: changeset description

Co-authored-by: Peter Wielander <mittgfu@gmail.com>
Signed-off-by: Will Sather <56037657+willsather@users.noreply.github.com>

* fix: add world-postgres to changeset

* fix: world-postgres handle namespaced job queue names

* fix: resolve namespace via env var in core runtime

* fix: world-postgres job queue name task handler

* fix(world-postgres): honor namespace on consumer side

* Fix namespaced queue routing reliability (#2340)

* Fix namespaced queue routing reliability

* Inline queue namespace in generated routes

* Avoid loading Vercel functions during runtime import

---------

Signed-off-by: Will Sather <56037657+willsather@users.noreply.github.com>
Co-authored-by: Peter Wielander <mittgfu@gmail.com>
Co-authored-by: JJ Kasper <jj@jjsweb.site>
2026-06-10 20:21:17 -07:00
Pranay Prakash 0d0bb013d7 Generate local gitignore when using public workflow manifests (#1683)
Co-authored-by: Peter Wielander <peter.wielander@vercel.com>
Co-authored-by: Peter Wielander <mittgfu@gmail.com>
2026-05-22 15:22:25 +02:00
Pranay Prakash 4753abb970 Forward-port SvelteKit queue trigger fix (#1995) 2026-05-14 16:05:23 -07:00
Peter Wielander 6dd5c72d8a Allow disabling step sourcemap with new sourcemap option in builders (#1842) 2026-05-04 11:00:15 +00:00
Peter Wielander 8ea1532e48 [core] Combine flow+step bundle and process steps eagerly (#1338) 2026-05-04 09:53:02 +00:00
Peter Wielander 6dc1b78582 [core] Extend flow route duration to "max" and fail runs where replay takes too long (#1567) 2026-04-01 21:33:39 +00:00
Pranay Prakash beccbc4298 feat: enforce max queue deliveries in handlers with graceful failure (#1344)
* feat: enforce max queue deliveries in handlers with graceful failure

Replace VQS maxDeliveries cap with handler-level enforcement. Handlers
now gracefully fail runs/steps after excessive queue redeliveries,
preventing "phantom stuck" runs.

- Add MAX_QUEUE_DELIVERIES constant (64) and enforce in both workflow
  and step handlers with run_failed/step_failed events
- Remove maxDeliveries from VQS trigger configs (builders + sveltekit)
- Improve world-local queue: safety limit loop, structured logging
  with runId/stepId, backoff delay on failures
- Add MAX_DELIVERIES_EXCEEDED error code

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* address PR review comments

- Expand max-delivery comments explaining minimal-work approach
- Make workflow handler error message verbose (matching step handler)
- Fix comment: "consume the message silently"
- Reduce local queue safety limit from 1000 to 256

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* change MAX_QUEUE_DELIVERIES to 48 and use 5s linear backoff locally

VQS uses linear 5s backoff for attempts 1-32, then exponential capped
at 2h. At 48 attempts total elapsed time is ~20h, safely under the
24h message visibility limit. Local world now uses 5s linear backoff
to approximate VQS timing.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-23 16:58:56 -07:00
Nathan Rajlich 3cc29431b2 Set maxDuration: "max" in vc-config for workflow functions (#1420)
* Set maxDuration: "max" in vc-config for workflow functions

* Use maxDuration: 60 for flow route, "max" for step/webhook

* Remove explicit maxDuration from webhook route, rely on plan default
2026-03-17 14:08:46 -07:00
Casey Gowrie 29347b79ea New vercel queue client with v2beta consumers (#1096) 2026-02-19 22:24:15 +00:00
Nathan Rajlich 661724c01e Expose workflow manifest via HTTP when WORKFLOW_PUBLIC_MANIFEST=1 (#963)
## Summary

When `WORKFLOW_PUBLIC_MANIFEST=1` is set, each framework builder exposes the workflow manifest at `/.well-known/workflow/v1/manifest.json` via the most appropriate mechanism for the framework:

- **Next.js**: Copies manifest to `public/.well-known/workflow/v1/manifest.json` (served as a static file)
- **SvelteKit**: Copies manifest to `static/.well-known/workflow/v1/manifest.json` (served as a static file)
- **Vercel Build Output API** (example workbench): Copies manifest to `.vercel/output/static/.well-known/workflow/v1/manifest.json` (served as a static file)
- **Nitro** (vite, hono, express, fastify, nuxt, nitro-v2, nitro-v3): Registers a virtual handler that reads and serves the manifest JSON
- **Astro**: Generates a `manifest.json.js` page route that returns the manifest JSON
- **NestJS**: Adds a `@Get('manifest.json')` endpoint on the `WorkflowController` (gated by the env var at runtime)

### Other changes

- `BaseBuilder.createManifest()` now returns the manifest JSON string so framework builders can use it
- Added `shouldExposePublicManifest` getter to `BaseBuilder`
- Fixed Astro `LocalBuilder` which was missing the `createManifest()` call that all other framework builders have
- Removed unused `public/` directory and static file copy from the example workbench build script
- Added `WORKFLOW_PUBLIC_MANIFEST` to `turbo.json` build task env so Vercel builds can access it
- Added generated manifest paths to `.gitignore`
2026-02-06 12:22:37 -08:00
Nathan Rajlich 35a9f0cb03 Add subpath export resolution for package IDs (#901)
Fixed a bug in module specifier resolution and added support for package subpath exports in workflow IDs.

### What changed?

- Fixed a caching bug in the module specifier resolution system that could cause incorrect IDs
- Added support for subpath exports in package IDs (e.g., `workflow/internal/builtins@4.0.0`)
- Improved module resolution by passing absolute file paths to the SWC transform
- Enhanced manifest merging to properly combine results from both workflow and step bundles
- Updated builders to return and merge manifests from both workflow and step bundles

### How to test?

1. Build a project that uses subpath exports in packages
2. Verify that workflow IDs correctly include the subpath (e.g., `workflow/internal/builtins@4.0.0`)
3. Test with a project that has multiple builds to ensure module specifier caching works correctly

### Why make this change?

This change addresses an issue where the module specifier cache could return incorrect results, leading to inconsistent workflow IDs. It also adds support for packages with multiple entry points through subpath exports, ensuring that steps with the same name in different subpaths don't collide. This improves the reliability of cross-bundle references and makes the system more robust when working with complex package structures.
2026-02-04 16:49:16 -08:00
Nathan Rajlich dc44dab49d Biome config tweaks and fixes applied (#741) 2026-01-07 12:52:52 -08:00
Nathan Rajlich 7ff68d1753 Pass tsconfig to esbuild for support of "paths" aliases (#705) 2025-12-31 01:00:24 -08:00
Karthik Kalyanaraman e3f0390469 Workflows graph extractor (#455)
---------

Signed-off-by: Karthik Kalyanaraman <karthik@scale3labs.com>
2025-12-27 16:52:19 +01:00
Adrian c9b8d843fd fix: improve port detection reliability with HTTP probing (#590)
* add logs

* fix: sveltekit type error

* feat: add polling for ports

* cleanup logs

* changeset

* fix test

* test

* test

* trigger

* trigger

* trigger

* trigger
2025-12-10 13:06:19 -08:00
Adrian 8d2cabe27e fix: externalize virtual modules in sveltekit builder (#573)
* fix: add virtual modules to sveltekit builder

* add test dynamic import

* changeset

* revert
2025-12-10 11:49:02 -08:00
Adrian 19c271c072 refactor: move request converters to @workflow/builders (#503)
sveltekit and astro use the exact same code for normalizing requests so it's been refactored to `request-converter.ts` inside `@workflow/builders`
2025-12-05 16:02:26 -08:00
Adrian 205b3953f0 refactor: add vite package for hmr (#501)
nitro, sveltekit and astro and additional vite integrations will use `hotUpdate` for hmr in the future. this adds a `@workflow/vite` package to standardize hmr in workflows
2025-12-05 16:00:26 -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
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
Adrian 73b6c68daf remove suppressUndefinedRejections from base builder (#384) 2025-11-21 06:42:28 -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 7ced2d6550 refactor(builder): add suppressUndefinedRejections (#327)
* refactor(builder): add suppressUndefinedRejections

* fix where undefined rejection line should be

* refactor
2025-11-13 11:19:26 -08:00
Adrian 98c36f1eb0 feat: add hmr and fix dev tests (#199)
* add hmr and dev tests for nitro and sveltekit

* changeset

* revert: e2e testing code

* add streams.ts to workbench apps

* fix: test confnigs

* fix: hmr failing on new files for sveltekit plugin

* lockfile

* switch testing to use 3_stream.ts

* fix: sveltekit hmr test file import

* fix: nextjs testing file

* remove stuff

* changeset

* refactor(tests): expose config through matrix config

* fix: add symlink for nextjs turbopack

* add resolve symlinks script

* fix: nextjs-webpack resolve symlinks script
2025-11-07 12:30:39 -08:00
Adrian 355cede4d5 fix(sveltekit): ignore undefined rejections instead of setting global context (#217)
* fix: ignore undefined rejections instead of setting global req context

* changeset

* chore: add comment for info
2025-11-05 10:13:24 -08:00
Copilot 4a821fce7c Fix Windows support by normalizing path separators in workflow IDs (#150)
---------

Signed-off-by: Nathan Rajlich <n@n8.io>
Co-authored-by: Nathan Rajlich <n@n8.io>
2025-11-04 12:13:45 -08:00
Pranay Prakash 744d82f95b feat: add type safety for builder configurations with discriminated unions (#80)
* feat: add type safety for builder configurations with discriminated unions

Improves type safety by creating discriminated union types for builder-specific
configurations, making it clear which configuration options are required for
each builder type.

Changes:
- Created BaseWorkflowConfig interface with common options
- Created StandaloneConfig, VercelBuildOutputConfig, and NextConfig types
- Made WorkflowConfig a discriminated union based on buildTarget
- Added documentation for each configuration type
- Exported new types from @workflow/builders

This enables better IntelliSense and type checking when constructing builder
configurations, preventing invalid configuration combinations at compile time.

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

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

* .

Signed-off-by: Nathan Rajlich <n@n8.io>

---------

Signed-off-by: Nathan Rajlich <n@n8.io>
Co-authored-by: Claude <noreply@anthropic.com>
Co-authored-by: Nathan Rajlich <n@n8.io>
2025-11-03 23:20:39 -08:00
Adrian 05714f7924 feat: add sveltekit support (#131)
* add workbench sveltekit

* add sveltekit package

* fix: use js for generated server routes in svelte

* add test routes for sveltekit workbench

* updates from debugging

* feat: add sveltekit build target

* update user sign up workflow workbench sveltekit

* fix: base builder missing GET route handler for sveltekit

* feat: add vercel builder and check for vercel env

* refactor: workflowPlugin for sveltekit

* ci: add tests to workbench sveltekit

* fix: no start command and vercel builder outputs

* fix: base builder conditions

* .

* add auto adapter sveltekit

* fix: disable checking origin for cross site ci stuff

* allow all trusted origins in svelte config

* fix: add catch for error thrown when waiting for ops

* fix: sveltekit workbench adapter

* test

* test

* refactor: move vercel builder on config resolved

* update package json

* add demo workflow trigger

* test letting sveltekit handle route generation

* fix: exclude git ignore for local builder outputs

* update config

* add debug logs

* update debug

* update turbo.json

* fix env check

* another output

* use top-level await

* ensure vercel functions are patched

* change hook

* update

* fix spread

* debug

* update

* chore: remove vercel builder

* chore: update comments in sveltekit workflow package

* chore: remove console comment

* refactor: workflow svelte plugin

* refactor: simplify local builder config

* chore: remove unused deps

* chore: add comment for workbench svelte app

* chore: add sveltekit export to workflow

* export sveltekit from workflow

* lockfile

* chore: remove unused deps svelte workbench

* update styling

* add sveltekit getting started docs

* update sveltekit docs getting started

* changeset

* Apply suggestion from @vercel[bot]

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

* use proper env var

* Update packages/sveltekit/src/index.ts

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

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

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

* Document CSRF protection bypass in SvelteKit workbench config (#157)

* Initial plan

* docs: add CSRF security warning to svelte.config.js

Co-authored-by: adriandlam <93681064+adriandlam@users.noreply.github.com>

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: adriandlam <93681064+adriandlam@users.noreply.github.com>

* refactor: deduplicate SvelteKit request conversion logic (#156)

* Initial plan

* refactor: extract duplicated SvelteKit request conversion to helper

Co-authored-by: adriandlam <93681064+adriandlam@users.noreply.github.com>

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: adriandlam <93681064+adriandlam@users.noreply.github.com>

* docs: fix getting staretd sveltekit missing folder

* chore: cleanup sveltekit builder after rebase

* lockfile

* fix: sveltekit building logic in base builder

* refactor: move sveltekit builder logic to its own package

* fix: console log base builder

* changeset

* test

* feat: create hmr plugin

* fix: add initial build on load

* fix: check all files for workflows and steps

* add comments for plugin todo

* remove catching error

* fix: missing context for nodejs envs causing waitUntil to fail

* fix: setting global request conext in vercel environments

---------

Co-authored-by: JJ Kasper <jj@jjsweb.site>
Co-authored-by: vercel[bot] <35613825+vercel[bot]@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <198982749+Copilot@users.noreply.github.com>
2025-11-03 21:15:33 -08:00