Added support for serializing `this` context when invoking step functions.
### What changed?
- Modified the step function implementation to capture and serialize the `this` context when it's defined and not the global object
- Updated the step invocation queue item interface to include an optional `thisVal` property
- Enhanced the step handler to apply the hydrated `thisVal` when executing step functions
### Why make this change?
This enhancement allows step functions to be invoked with an explicit context object using standard JavaScript methods like `.call()` and `.apply()`. This is particularly useful for step functions that need to access properties from a specific context, enabling more flexible and idiomatic JavaScript patterns within workflows.
The SWC compiler plugin had logic to walk through class static methods
with "use step" / "use workflow", but no actual transformation was being
applied. This fixes that.
* feat: add queue-based health check to bypass Deployment Protection
- Add HealthCheckPayloadSchema and HEALTH_CHECK_STREAM_PREFIX to @workflow/world
- Add healthCheck() method to Queue interface
- Update workflow and step handlers to detect and respond to health check messages
- Implement healthCheck() in world-local, world-vercel, and world-postgres
The queue-based health check sends a message through the queue pipeline,
which bypasses Vercel's Deployment Protection. The handler writes a response
to a stream that the caller reads to confirm health.
This complements the existing HTTP-based ?__health approach which still works
for local development and when bypass headers are available.
* refactor: move healthCheck to core package as utility function
Instead of adding healthCheck to the World interface (which duplicated
the same implementation across all worlds), this is now a utility function
in @workflow/core that takes the World as a parameter.
Usage:
import { healthCheck } from '@workflow/core';
const result = await healthCheck(world, 'workflow');
This is cleaner because:
- Single implementation instead of 3 identical ones
- World implementations remain simple
- No changes needed to the World interface
* .
* refactor: move health check types from world to core
Health check types (HealthCheckPayloadSchema, HealthCheckResult, etc.)
are now defined in @workflow/core since that's where they're used.
The HealthCheckPayloadSchema is still part of QueuePayloadSchema in
world (so the queue accepts health check messages), but it's not
exported from the public API.
* .
* Refactor health check implementation based on code review feedback (#746)
* Initial plan
* Address PR review comments: export types, fix race condition, improve error handling
Co-authored-by: TooTallNate <71256+TooTallNate@users.noreply.github.com>
* Add queue-based health check test and document security considerations
Co-authored-by: TooTallNate <71256+TooTallNate@users.noreply.github.com>
* Replace 'any' type with proper type guards for health check response
Co-authored-by: TooTallNate <71256+TooTallNate@users.noreply.github.com>
* Extract health check queue names as constants and improve type guards
Co-authored-by: TooTallNate <71256+TooTallNate@users.noreply.github.com>
---------
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: TooTallNate <71256+TooTallNate@users.noreply.github.com>
* .
* Fix e2e test
* .
* .
* .
* fix(ai): preserve providerMetadata as providerOptions in multi-turn tool calls (#733)
When tool calls are added to the conversation history, map providerMetadata
to providerOptions following the AI SDK convention. This fixes Gemini thinking
models that require thoughtSignature to be preserved across multi-turn tool calls,
preventing the error 'function call is missing a thought_signature'.
Fixes#727
* Local ui cli flag (#744)
* [web] Increase contrast on attribute items in sidebar (#736)
Signed-off-by: Peter Wielander <mittgfu@gmail.com>
* [world] Remove pause and resume events, actions and states (#751)
* Version Packages (beta) (#735)
* .
* .
* Update turbo inputs to include shared config (#752)
* Update turbo inputs to include shared config
* Apply suggestions from code review
Co-authored-by: vercel[bot] <35613825+vercel[bot]@users.noreply.github.com>
---------
Co-authored-by: vercel[bot] <35613825+vercel[bot]@users.noreply.github.com>
* feat(web): add self-hosted mode for world configuration (#747)
* feat(web): add self-hosted mode for world configuration
When WORKFLOW_TARGET_WORLD env var is set, the web UI operates in
self-hosted mode where the world configuration is locked to server-side
environment variables and cannot be changed via query params or UI.
- Add getHardcodedConfig server action to detect self-hosted mode
- Modify getWorldFromEnv to use server env vars in hardcoded mode
- Create WorldConfigContext to provide config state app-wide
- Update settings sidebar to show locked state with disabled inputs
- Update connection status to show PostgreSQL backend info
- Mask sensitive values (postgres URL) in hardcoded mode UI
* fix: address PR review feedback
- Remove unused ConfigMode type export
- Fix postgres substring to undefined (tooltip has details)
- Extract buildEnvMapFromProcessEnv helper to reduce duplication
- Remove unused EnvMap import from layout-client
- Import HardcodedConfig from web-shared/server instead of re-defining
* Fix: PostgreSQL URL parameter missing from configParsers, causing loss of postgres URL configuration on page reload in dynamic mode
* fix(cli): clear WORKFLOW_TARGET_WORLD when spawning web server
The CLI sets WORKFLOW_TARGET_WORLD as an env var, which the spawned
Next.js server inherits. This caused the web UI to enter self-hosted
mode even when launched via CLI.
Now we explicitly clear WORKFLOW_TARGET_WORLD from the server's
environment so it starts in dynamic mode where config comes from
query params as intended.
* refactor(web): use server-side env vars for world config
BREAKING CHANGE: The web UI no longer supports configuring the world
backend via URL query parameters. Configuration is now read exclusively
from server-side environment variables.
Changes:
- Remove query param parsing from @workflow/web config.ts
- Add ServerConfig interface with non-sensitive display info
- Update all components to use useServerConfig() hook
- Settings sidebar is now read-only
- CLI passes env vars to spawned web server instead of query params
- Server actions use process.env directly (envMap param reserved for future use)
This simplifies the architecture and improves security by never sending
sensitive data (connection strings, auth tokens) to the client.
* fix(web): fix settings sidebar overflow and shorten data dir path
- Add truncate/overflow handling to settings sidebar config values
- Add shortenPath() helper to abbreviate long file paths:
- Replaces home directory with ~
- Shows .../last-two-segments if still too long
- Add title attributes for full path on hover
* Update changeest
---------
Co-authored-by: Vercel <vercel[bot]@users.noreply.github.com>
* Version Packages (beta) (#755)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
* Update packages/world/src/queue.ts
Co-authored-by: Pranay Prakash <pranay.gp@gmail.com>
* [web] Tidy wake-up and re-enqueue buttons (#737)
---------
Signed-off-by: Peter Wielander <mittgfu@gmail.com>
* [cli] Use dotenv to resolve .env and .env.local files on startup (#765)
* Use temporary workflow-server deployment URL
* feat: add queue-based health check to bypass Deployment Protection
- Add HealthCheckPayloadSchema and HEALTH_CHECK_STREAM_PREFIX to @workflow/world
- Add healthCheck() method to Queue interface
- Update workflow and step handlers to detect and respond to health check messages
- Implement healthCheck() in world-local, world-vercel, and world-postgres
The queue-based health check sends a message through the queue pipeline,
which bypasses Vercel's Deployment Protection. The handler writes a response
to a stream that the caller reads to confirm health.
This complements the existing HTTP-based ?__health approach which still works
for local development and when bypass headers are available.
* refactor: move healthCheck to core package as utility function
Instead of adding healthCheck to the World interface (which duplicated
the same implementation across all worlds), this is now a utility function
in @workflow/core that takes the World as a parameter.
Usage:
import { healthCheck } from '@workflow/core';
const result = await healthCheck(world, 'workflow');
This is cleaner because:
- Single implementation instead of 3 identical ones
- World implementations remain simple
- No changes needed to the World interface
* .
* refactor: move health check types from world to core
Health check types (HealthCheckPayloadSchema, HealthCheckResult, etc.)
are now defined in @workflow/core since that's where they're used.
The HealthCheckPayloadSchema is still part of QueuePayloadSchema in
world (so the queue accepts health check messages), but it's not
exported from the public API.
* .
* Refactor health check implementation based on code review feedback (#746)
* Initial plan
* Address PR review comments: export types, fix race condition, improve error handling
Co-authored-by: TooTallNate <71256+TooTallNate@users.noreply.github.com>
* Add queue-based health check test and document security considerations
Co-authored-by: TooTallNate <71256+TooTallNate@users.noreply.github.com>
* Replace 'any' type with proper type guards for health check response
Co-authored-by: TooTallNate <71256+TooTallNate@users.noreply.github.com>
* Extract health check queue names as constants and improve type guards
Co-authored-by: TooTallNate <71256+TooTallNate@users.noreply.github.com>
---------
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: TooTallNate <71256+TooTallNate@users.noreply.github.com>
* .
* Fix e2e test
* .
* .
* .
* .
* .
* Update packages/world/src/queue.ts
Co-authored-by: Pranay Prakash <pranay.gp@gmail.com>
* Use temporary workflow-server deployment URL
* .
* .
---------
Signed-off-by: Peter Wielander <mittgfu@gmail.com>
Co-authored-by: Copilot <198982749+Copilot@users.noreply.github.com>
Co-authored-by: TooTallNate <71256+TooTallNate@users.noreply.github.com>
Co-authored-by: Pranay Prakash <pranay.gp@gmail.com>
Co-authored-by: Peter Wielander <mittgfu@gmail.com>
Co-authored-by: Vercel Release Bot <88769842+vercel-release-bot@users.noreply.github.com>
Co-authored-by: JJ Kasper <jj@jjsweb.site>
Co-authored-by: vercel[bot] <35613825+vercel[bot]@users.noreply.github.com>
Co-authored-by: Vercel <vercel[bot]@users.noreply.github.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
* Refactor e2e tests for errors
* Improve step error tests to check workflow return value
Step error workflows now catch the error and return message/stack,
making assertions cleaner. Tests verify both:
- Workflow return value (caught error message)
- CLI step result (original stack with function names)
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
* Add assertion for stack trace in caught step error
With the fix in step.ts that propagates original stack traces,
we can now verify that caught step errors include function names
directly in the workflow return value (not just via CLI).
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
* logging
* Fix: When a step handler is re-invoked after max retries are exhausted, the step_failed event doesn't include a stack trace, breaking stack trace propagation for this edge case.
This commit fixes the issue reported at packages/core/src/runtime/step-handler.ts:127-146
## Stack trace loss in step_failed event when max retries are exceeded
**What fails:** Step handler does not include stack property in step_failed event when step is re-invoked after max retries exhausted, causing FatalError in workflow to lose original stack trace
**How to reproduce:**
1. Create a step that always fails with an error that includes a stack trace
2. Exhaust all retry attempts (e.g., maxRetries = 3, so 4 total attempts)
3. The step handler is re-invoked (attempt > maxRetries + 1)
4. This triggers the edge case at lines 127-146 in step-handler.ts
5. A step_failed event is created with fatal: true but without stack property
6. When step.ts processes this event (lines 103-104), the stack remains unset since event.eventData.stack is undefined
**Result:** FatalError created in workflow has default stack (from step.ts) instead of original error stack from step execution
**Expected:** Stack trace should be propagated consistently across all error paths. All other step_failed events with fatal: true include stack property (lines 311-313 and 351-353), but edge case was missing it.
**Root cause:** When step handler is re-invoked after max retries exhausted (attempt > maxRetries + 1), the code creates a step_failed event without including step.error?.stack, which contains the previous error information from the last failed attempt. Other code paths capture this correctly.
Co-authored-by: Vercel <vercel[bot]@users.noreply.github.com>
* add withData
* Enable source maps for step bundles and validate in e2e tests
- Move sourcemap generation from intermediate workflow bundle to steps bundle
- Enhance step error tests to validate function names and source files in stack traces
- Remove isLocalDeployment() checks since source maps now work in dev mode
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
* Add changeset for step bundle source maps
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
* Add changeset for core package e2e test improvements
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
* Enable source maps in CI e2e tests
Add NODE_OPTIONS="--enable-source-maps" to all e2e test jobs to ensure
stack traces show original source file paths.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
* Fix step error source map checks for local prod builds
Add hasStepSourceMaps() helper that correctly identifies when source maps
are expected to work:
- Vercel prod: works (production builds have proper source maps)
- Local dev: works (DEV_TEST_CONFIG is set, uses step bundle with inline source maps)
- Local prod: doesn't work (nitro/bundler output doesn't preserve source maps)
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
* Add hasWorkflowSourceMaps() utility for vite-based framework exception
- Add isViteBasedFramework() helper to detect vite, sveltekit, astro apps
- Add hasWorkflowSourceMaps() to check if workflow errors have source maps
(known issue: vite-based frameworks in local deployments don't preserve them)
- Refactor e2e.test.ts to use the new utility instead of inline check
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
* prevent sourcemap checks in nextjs and sveltekit (known offenders)
* improve source maps matrix check
* fix matrix again
* ugh more matrix ignoring
---------
Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
Co-authored-by: Vercel <vercel[bot]@users.noreply.github.com>
* perf: add 5s delay to benchmark steps to simulate real work
* perf: add realistic workloads to benchmark steps
Add realistic workloads to benchmark step functions:
- doWork() - 1 second delay to simulate real computation
- stressTestStep() - 1 second delay to simulate real computation
- genBenchStream() - generates ~5KB of data in 50 chunks
- transformStream() - uppercases stream content (renamed from doubleNumbers)
Add "Slurp Time" metric to stream benchmarks measuring time from
first byte to complete stream consumption, complementing TTFB.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
* fix(e2e): increase dev test timeouts for Windows
Windows file watching and rebuilding is slower than macOS/Linux,
causing the 10s timeouts to fail. Increased to 30s to accommodate.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
* fix(ci): treat community world failures as warnings, not errors
Community world tests/benchmarks are now non-blocking:
- Removed from has_failures check in both tests.yml and benchmarks.yml
- Added separate has_warnings output for community failures
- Split PR comment notices: ❌ for failures, ⚠️ for community warnings
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
* fix: apply PR review suggestions
- Fix chunk size calculation: chunkSize - 11 for ~100 bytes per chunk
- Remove redundant metadata check (always truthy)
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
---------
Co-authored-by: Claude <noreply@anthropic.com>
Add new benchmark workflows to reproduce reported issues with Promise.race
and Promise.all falling over when array sizes exceed a few hundred.
New workflows:
- promiseAllStressTestWorkflow(count) - Tests Promise.all with many concurrent steps
- promiseRaceStressTestLargeWorkflow(count) - Tests Promise.race with Map pattern
New benchmarks at 100, 500, and 1000 concurrent step scales for both
Promise.all and Promise.race patterns.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
* init
Signed-off-by: Sree Narayanan <sreeaadhi07@gmail.com>
* not using my prototype fastify plugin
Signed-off-by: Sree Narayanan <sreeaadhi07@gmail.com>
* renamed workbench dir
Signed-off-by: Sree Narayanan <sreeaadhi07@gmail.com>
* lockfile update
Signed-off-by: Sree Narayanan <sreeaadhi07@gmail.com>
* removed
Signed-off-by: Sree Narayanan <sreeaadhi07@gmail.com>
* symlinked workflows dir
Signed-off-by: Sree Narayanan <sreeaadhi07@gmail.com>
* added readme
Signed-off-by: Sree Narayanan <sreeaadhi07@gmail.com>
* symlinked client page
Signed-off-by: Sree Narayanan <sreeaadhi07@gmail.com>
* scope nitro route to allow renderer fallback
Signed-off-by: Sree Narayanan <sreeaadhi07@gmail.com>
* allow empty json bodies
Signed-off-by: Sree Narayanan <sreeaadhi07@gmail.com>
* comments
Signed-off-by: Sree Narayanan <sreeaadhi07@gmail.com>
* improve error handling and cleanup in /api/trigger
Signed-off-by: Sree Narayanan <sreeaadhi07@gmail.com>
* consistent server replies
Signed-off-by: Sree Narayanan <sreeaadhi07@gmail.com>
* expect json res
Signed-off-by: Sree Narayanan <sreeaadhi07@gmail.com>
* fix json res for e2e test 3,4,5,11
Signed-off-by: Sree Narayanan <sreeaadhi07@gmail.com>
* fix fastify streaming responses
Stream web streams the same way express or hono do. Read the web reader and write each json chunk to reply.raw. Avoids fastifys async iterator quirks that reordered frames and sent undefined data in the output stream tests
Signed-off-by: Sree Narayanan <sreeaadhi07@gmail.com>
* fix stream responses for e2e tests
Signed-off-by: Sree Narayanan <sreeaadhi07@gmail.com>
* clearer comments
Signed-off-by: Sree Narayanan <sreeaadhi07@gmail.com>
* fix streaming res content type. passes all core e2e tests
Signed-off-by: Sree Narayanan <sreeaadhi07@gmail.com>
* updated dev deps fastify bench
Signed-off-by: Sree Narayanan <sreeaadhi07@gmail.com>
* fastify logo (light/dark mode)
Signed-off-by: Sree Narayanan <sreeaadhi07@gmail.com>
* update url
Signed-off-by: Sree Narayanan <sreeaadhi07@gmail.com>
* fastify docs
Signed-off-by: Sree Narayanan <sreeaadhi07@gmail.com>
* Apply suggestions from code review
Co-authored-by: Adrian <me@adriandlam.com>
* Update docs/content/docs/getting-started/fastify.mdx
Co-authored-by: Adrian <me@adriandlam.com>
* Update docs/content/docs/getting-started/fastify.mdx
Co-authored-by: Adrian <me@adriandlam.com>
* Update docs/content/docs/getting-started/fastify.mdx
Co-authored-by: Adrian <me@adriandlam.com>
* Update docs/content/docs/getting-started/fastify.mdx
Co-authored-by: Adrian <me@adriandlam.com>
* Update docs/content/docs/getting-started/fastify.mdx
Co-authored-by: Adrian <me@adriandlam.com>
* Update docs/content/docs/getting-started/fastify.mdx
Co-authored-by: Adrian <me@adriandlam.com>
* Update docs/content/docs/getting-started/fastify.mdx
Co-authored-by: Adrian <me@adriandlam.com>
* Sree Narayanan <sreeaadhi07@gmail.com>
DCO Remediation Commit for Sree Narayanan <sreeaadhi07@gmail.com>
I, Sree Narayanan <sreeaadhi07@gmail.com>, hereby add my Signed-off-by to this commit: c3b6cf9bc4
I, Sree Narayanan <sreeaadhi07@gmail.com>, hereby add my Signed-off-by to this commit: 3628b82c1e
I, Sree Narayanan <sreeaadhi07@gmail.com>, hereby add my Signed-off-by to this commit: 600117f95a
I, Sree Narayanan <sreeaadhi07@gmail.com>, hereby add my Signed-off-by to this commit: 9111151b48
I, Sree Narayanan <sreeaadhi07@gmail.com>, hereby add my Signed-off-by to this commit: aceb6a8ceb
I, Sree Narayanan <sreeaadhi07@gmail.com>, hereby add my Signed-off-by to this commit: b93df58edb
I, Sree Narayanan <sreeaadhi07@gmail.com>, hereby add my Signed-off-by to this commit: 628718750e
I, Sree Narayanan <sreeaadhi07@gmail.com>, hereby add my Signed-off-by to this commit: 7f523e8013
Signed-off-by: Sree Narayanan <sreeaadhi07@gmail.com>
* Apply suggestions from code review
Signed-off-by: Sree Narayanan <sreeaadhi07@gmail.com>
Co-authored-by: Adrian <me@adriandlam.com>
* nit: standardized package.json
Signed-off-by: Sree Narayanan <sreeaadhi07@gmail.com>
* mom, my commits are in vercel CI
Signed-off-by: Sree Narayanan <sreeaadhi07@gmail.com>
* Update docs/content/docs/getting-started/fastify.mdx
Signed-off-by: Sree Narayanan <sreeaadhi07@gmail.com>
Co-authored-by: Adrian <me@adriandlam.com>
* Update workbench/fastify/package.json
Signed-off-by: Sree Narayanan <sreeaadhi07@gmail.com>
Co-authored-by: vercel[bot] <35613825+vercel[bot]@users.noreply.github.com>
* passing workflow error object to err responses
Signed-off-by: Sree Narayanan <sreeaadhi07@gmail.com>
* Update workbench/fastify/nitro.config.ts
Signed-off-by: Sree Narayanan <sreeaadhi07@gmail.com>
Co-authored-by: Adrian <me@adriandlam.com>
* Update workbench/fastify/src/index.ts
Signed-off-by: Sree Narayanan <sreeaadhi07@gmail.com>
Co-authored-by: Adrian <me@adriandlam.com>
* feat: add start pg world plugin
* import createReadStream to serve index.html
Signed-off-by: Sree Narayanan <sreeaadhi07@gmail.com>
* test: add fastify deploy
* fix: add postgres world dep
* use symlink
* chore(deps): remove unused deps from fastify
* docs: update fastify
* Sree Narayanan <sreeaadhi07@gmail.com>
DCO Remediation Commit for Sree Narayanan <sreeaadhi07@gmail.com>
I, Sree Narayanan <sreeaadhi07@gmail.com>, hereby add my Signed-off-by to this commit: 54c3e8a50a663c8e9aacf9c95618f59af1bd2e4c
I, Sree Narayanan <sreeaadhi07@gmail.com>, hereby add my Signed-off-by to this commit: 423f722209c64382e86f9f8821253dc4facffe96
I, Sree Narayanan <sreeaadhi07@gmail.com>, hereby add my Signed-off-by to this commit: f76061627fe8d320ce498d44d0a3234abb6432ab
I, Sree Narayanan <sreeaadhi07@gmail.com>, hereby add my Signed-off-by to this commit: a269b8aa8d2fcf0b605cce5a1486cac481cca16e
I, Sree Narayanan <sreeaadhi07@gmail.com>, hereby add my Signed-off-by to this commit: b3cedf7defdb7f97b37862bf2a736d41a6bc5ec8
I, Sree Narayanan <sreeaadhi07@gmail.com>, hereby add my Signed-off-by to this commit: 596cf21e79bc82a73b56acb9cab1fc33dbfde975
I, Sree Narayanan <sreeaadhi07@gmail.com>, hereby add my Signed-off-by to this commit: 0ea1aa7d95e375d1f04e5501254a9fda815c7694
I, Sree Narayanan <sreeaadhi07@gmail.com>, hereby add my Signed-off-by to this commit: dbc8638b4a952c303e35035204cfdca43b99a059
Signed-off-by: Sree Narayanan <sreeaadhi07@gmail.com>
* remove fromNodeHandler inside fastify app
* debug print to see stream chunks
Signed-off-by: Sree Narayanan <sreeaadhi07@gmail.com>
* use readfile and resolve for root route
* moving index.html to /public
Signed-off-by: Sree Narayanan <sreeaadhi07@gmail.com>
* added back symlinked index.html (to copy during prebuildstep)
Signed-off-by: Sree Narayanan <sreeaadhi07@gmail.com>
* prebuild and postbuild script to copy and remove index.html
Signed-off-by: Sree Narayanan <sreeaadhi07@gmail.com>
* Sree Narayanan <sreeaadhi07@gmail.com>
DCO Remediation Commit for Sree Narayanan <sreeaadhi07@gmail.com>
I, Sree Narayanan <sreeaadhi07@gmail.com>, hereby add my Signed-off-by to this commit: b78bf227f4
I, Sree Narayanan <sreeaadhi07@gmail.com>, hereby add my Signed-off-by to this commit: e7a456548e
I, Sree Narayanan <sreeaadhi07@gmail.com>, hereby add my Signed-off-by to this commit: 37ee9ddaa6
I, Sree Narayanan <sreeaadhi07@gmail.com>, hereby add my Signed-off-by to this commit: 72912dc279
I, Sree Narayanan <sreeaadhi07@gmail.com>, hereby add my Signed-off-by to this commit: 4ebda5b505
I, Sree Narayanan <sreeaadhi07@gmail.com>, hereby add my Signed-off-by to this commit: ccb690f367
I, Sree Narayanan <sreeaadhi07@gmail.com>, hereby add my Signed-off-by to this commit: 6b80913d38
I, Sree Narayanan <sreeaadhi07@gmail.com>, hereby add my Signed-off-by to this commit: c9fb3ebd80
Signed-off-by: Sree Narayanan <sreeaadhi07@gmail.com>
* docs: remove preset in fastify docs
* move public/index.html symlink
* Revert "move public/index.html symlink"
This reverts commit 081d29fe16e7817912d69f1b3a3bcd3a38000d5a.
* removed stream output chunk debug log
Signed-off-by: Sree Narayanan <sreeaadhi07@gmail.com>
* Sree Narayanan <sreeaadhi07@gmail.com>
DCO Remediation Commit for Sree Narayanan <sreeaadhi07@gmail.com>
I, Sree Narayanan <sreeaadhi07@gmail.com>, hereby add my Signed-off-by to this commit: df5dfc9849af3cd9e818cd816feec5586137eae7
I, Sree Narayanan <sreeaadhi07@gmail.com>, hereby add my Signed-off-by to this commit: 809bacb88461da5e92aec5d31d936222407593b6
I, Sree Narayanan <sreeaadhi07@gmail.com>, hereby add my Signed-off-by to this commit: b270d02ee69ac072eaa4538a31ed110edf852cc2
I, Sree Narayanan <sreeaadhi07@gmail.com>, hereby add my Signed-off-by to this commit: cb73ae5b1f3f7059f4c432b8226f8eb9b0492724
I, Sree Narayanan <sreeaadhi07@gmail.com>, hereby add my Signed-off-by to this commit: 2ee3af65040e969b91a491b2bb285cd2ed447e10
I, Sree Narayanan <sreeaadhi07@gmail.com>, hereby add my Signed-off-by to this commit: cab1381b0e08e3453a3e5a66f55d02a8effff0e3
I, Sree Narayanan <sreeaadhi07@gmail.com>, hereby add my Signed-off-by to this commit: 9c7471b2fba60079c71951433d9d0649d8399ba3
I, Sree Narayanan <sreeaadhi07@gmail.com>, hereby add my Signed-off-by to this commit: 4583452a27c704ba474080d0c560a1b1b9724058
Signed-off-by: Sree Narayanan <sreeaadhi07@gmail.com>
* lockfile
* fix
* Sree Narayanan <sreeaadhi07@gmail.com>
DCO Remediation Commit for Sree Narayanan <sreeaadhi07@gmail.com>
I, Sree Narayanan <sreeaadhi07@gmail.com>, hereby add my Signed-off-by to this commit: 40af716dca
I, Sree Narayanan <sreeaadhi07@gmail.com>, hereby add my Signed-off-by to this commit: 672e756cc1
I, Sree Narayanan <sreeaadhi07@gmail.com>, hereby add my Signed-off-by to this commit: 33b9b3e1f4
I, Sree Narayanan <sreeaadhi07@gmail.com>, hereby add my Signed-off-by to this commit: 38ca6e24e9
I, Sree Narayanan <sreeaadhi07@gmail.com>, hereby add my Signed-off-by to this commit: b1ada4ae63
I, Sree Narayanan <sreeaadhi07@gmail.com>, hereby add my Signed-off-by to this commit: 472c3394fd
I, Sree Narayanan <sreeaadhi07@gmail.com>, hereby add my Signed-off-by to this commit: fd154df028
I, Sree Narayanan <sreeaadhi07@gmail.com>, hereby add my Signed-off-by to this commit: 7f1bebe93d
Signed-off-by: Sree Narayanan <sreeaadhi07@gmail.com>
---------
Signed-off-by: Sree Narayanan <sreeaadhi07@gmail.com>
Co-authored-by: Adrian <me@adriandlam.com>
Co-authored-by: vercel[bot] <35613825+vercel[bot]@users.noreply.github.com>
* 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
* 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>
### 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.
* 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>
* 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>
* Proper stacktrace propogation in world
Proper stacktrace propogation in world
* Merge Reconciliation
* Standardize the error type in the world spec
* Deduplicate vercel world utils
* fix undefined type issue
---------
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
* feat: add getPort method for detecting pid port
* lockfile
* update tests and fix getPort usage
* changeset
* docs: update sveltekit getting started
* fix: use pid-port
* fix: not using config port env
* fix: remove unused getPort from world core
* remove unused stuff
* fix: world local config returning port 3000 as fallback
* changeset
* fix: rebase conflicts
* fix: util test missing http import
* changeset
* fix: wrong import for getPort in core runtime
* fix: getPort in @workflow/utils being imported into workflow runtime
* test: simplify sveltekit test
* fix missing import in test
* fix: async await stuff with getPort
* refactor: move getPort to @workflow/utils/get-port
* test: simplfiy getPort tests
* test: fix sveltekit ports
The overloads parsing logic is now covered in unit tests, so we only
need one e2e test for the specific sleep functionality.
Signed-off-by: Nathan Rajlich <n@n8.io>