* 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>
* fix: externlize bun from step bundle
* changeset
* fix: add bun to node module esbuild plugin
* feat: add bun to node module esbuild plugin match
* feat: add hint for using bun inside workflow in ts lsp
* fix: add support for bun:* modules
Added support for transforming step functions that are returned from factory functions.
### What changed?
Enhanced the SWC plugin to detect and transform step functions that are defined within object literals returned by factory functions. The transformation now properly identifies arrow functions with object literal bodies and processes their step functions accordingly.
Added test fixtures to verify the functionality:
- Created test cases for a factory function that returns an object with a step method
- Added corresponding output files for client, step, and workflow modes
### How to test?
1. Create a factory function that returns an object with methods marked as steps:
```javascript
const myFactory = () => ({
myStep: async () => {
'use step';
await fs.mkdir('test');
},
});
```
2. Verify that the step function is properly transformed and registered when used in a workflow.
### Why make this change?
This enhancement supports a common pattern where developers create factory functions that return objects containing step methods. Without this change, step functions defined in this pattern weren't being properly transformed, which limited the flexibility of the workflow system.
### 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.
* 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)
* 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>
* 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>
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.