Commit Graph

1497 Commits

Author SHA1 Message Date
Peter Wielander 50f50f44d7 NestJS framework support (#840) 2026-01-26 13:31:22 -08:00
Karthik Kalyan f64b776165 Fix resolve hook theming and token fetching. (#856)
Keep the modal aligned with theme tokens and ensure hook resolution has the token it needs.
2026-01-26 11:51:44 -08:00
Pranay Prakash 243bf8f50d docs: rename Control Flow Patterns to Common Patterns and add new content (#846)
* feat: improve world page metadata and add dynamic OG images

- Update title format to '{Name} World | Workflow DevKit'
- Update worlds index page title to 'Worlds | Workflow DevKit'
- Improve world descriptions in worlds-manifest.json for better SEO
- Add dynamic OG image generation at /worlds/[id]/og
- Add openGraph and twitter metadata to world detail pages

* fix: use opengraph-image.tsx file convention for dynamic OG images

- Replace route-based og/route.tsx with opengraph-image.tsx file convention
- Remove runtime = 'edge' to allow generateStaticParams for static generation
- Simplify page.tsx metadata (Next.js auto-detects opengraph-image.tsx)

* docs: rename Control Flow Patterns to Common Patterns and add new content

- Rename page from control-flow-patterns to common-patterns
- Add redirect for old URL to prevent broken external links
- Add new Timeout Pattern section (Promise.race with sleep)
- Add new Workflow Composition section (direct await vs background execution)
- Implement @setup comment marker to hide type declarations in code examples
- Update navigation and references to new page name

* docs: move Full Example section after Parallel Execution

The Full Example only demonstrates sequential and parallel execution,
so it should come before the new Timeout and Workflow Composition patterns.

* fix: use useLayoutEffect to prevent flash of @setup lines in code blocks

* docs: remove incorrect retry/failure handling guidance from workflow composition
2026-01-26 11:23:37 -08:00
Pranay Prakash 8a146a5bb1 docs: revamp World documentation pages (#763)
* docs: revamp World documentation pages with new structure and design

- Add dedicated world detail pages at /worlds/[id] with MDX-driven content
- Create WorldDetailHero, WorldDetailToc, WorldTestingPerformance components
- Add benchmark history charts and test summary links
- Rewrite local-world, postgres-world, and vercel-world MDX with cleaner structure
- Use h3 headings for configuration options instead of tables/accordions
- Add WorldDataProvider context for passing world data to MDX components
- Add example field to worlds-manifest for linking to example repos
- Update worlds index page design

* fix: update worlds page meta title and description

* feat(docs): improve globe backdrop responsiveness and positioning

- Globe now scales with container width up to 1200px max
- Increased opacity from 20% to 30% for better visibility
- Positioned globe 30% down to show north pole behind header
- Globe component now auto-sizes based on container width

* fix(docs): add light mode support for globe backdrop

* feat: improve world page metadata and add dynamic OG images

- Update title format to '{Name} World | Workflow DevKit'
- Update worlds index page title to 'Worlds | Workflow DevKit'
- Improve world descriptions in worlds-manifest.json for better SEO
- Add dynamic OG image generation at /worlds/[id]/og
- Add openGraph and twitter metadata to world detail pages

* fix: use opengraph-image.tsx file convention for dynamic OG images

- Replace route-based og/route.tsx with opengraph-image.tsx file convention
- Remove runtime = 'edge' to allow generateStaticParams for static generation
- Simplify page.tsx metadata (Next.js auto-detects opengraph-image.tsx)

* docs: improve worlds page UI and restructure deploying section

- Fix globe visibility in light/dark mode
- Fix tooltip positioning on mobile breakpoints
- Remove redundant Documentation button for community worlds
- Add missing pages to Foundations index (streaming, serialization, idempotency)
- Restructure deploying section with new index and building-a-world guide
- Restore original MDX content for official worlds (local, vercel, postgres)
- Auto-expand sidebar folders when child page is active

* docs: simplify worlds page footer sections

* docs: move last updated section under worlds grid

* fix(docs): fix broken links and skip typecheck for interface definitions

- Fix /docs/deploying/world link to /docs/deploying/building-a-world
- Fix /docs/deploying#what-are-worlds invalid anchor to /docs/deploying
- Add @skip-typecheck markers to interface definition code blocks

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

* fix(docs): address PR review feedback

- benchmark-history/route.ts: Add error handling for JSON parsing,
  distinguish 404s from actual errors
- Globe.tsx: Fix hydration mismatch by deferring theme-dependent
  rendering until component is mounted
- sidebar.tsx: Improve path check robustness for active child detection

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

---------

Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-26 11:16:40 -08:00
Nathan Rajlich 00c7961ecb Remove unused getWritable stub function (#855) 2026-01-26 11:13:23 -08:00
Nathan Rajlich b973b8d00f Add support for CBOR responses (#832) 2026-01-23 15:26:17 -08:00
Peter Wielander 57f637653d [world-local] Fix package info stored in data dir showing the wrong version (#718) 2026-01-23 13:46:44 -08:00
Peter Wielander 36f9395044 [docs] Document multi-turn ai sessions with DurableAgent (#759) 2026-01-23 13:31:00 -08:00
Nathan Rajlich bd8116d40b Add WORKFLOW_SERVER_URL_OVERRIDE var to "world-vercel" for testing (#833)
Added `WORKFLOW_SERVER_URL_OVERRIDE` configuration to the Vercel world adapter and removed the deprecated `WORKFLOW_VERCEL_SKIP_PROXY` and `WORKFLOW_VERCEL_BACKEND_URL` environment variables.

### What changed?

- Added a changeset for a patch release across multiple packages
- Removed `WORKFLOW_VERCEL_SKIP_PROXY` environment variable from GitHub workflow tests
- Removed `WORKFLOW_VERCEL_BACKEND_URL` from environment variables in CLI and core packages
- Simplified the URL resolution logic in the Vercel world adapter
- Added support for a `WORKFLOW_SERVER_URL_OVERRIDE` constant for testing against different workflow-server versions
- Added the `x-vercel-workflow-api-url` header when the URL override is set

### How to test?

1. Verify that Vercel deployments continue to work without the removed environment variables
2. Test with a custom workflow server URL by setting the `WORKFLOW_SERVER_URL_OVERRIDE` constant in the world-vercel package

### Why make this change?

This change simplifies the configuration for the Vercel world adapter by removing deprecated environment variables and standardizing on a cleaner approach for specifying the workflow API URL. The new implementation automatically determines whether to use the proxy based on project configuration, making it more intuitive and reducing the need for explicit configuration.
2026-01-23 11:01:45 -08:00
Nathan Rajlich b16a6828af Move "parse-name" into the utils package (#814) 2026-01-23 10:57:52 -08:00
Pranay Prakash 4966b728a8 implement event-sourced architecture (#621)
* perf: implement event-sourced architecture

* Apply suggestions from code review

* Improve invalid event log handling in step/hook/wait

* Handle serialized workflow run errors correctly

* log error in failing test

* Handle queue idempotency in vercel world

* hotfix for error propogation

* Fix: Incorrect HTTP status code 409 should be 410 for terminal run state rejections in postgres storage

* Fix: The code attempts to pass an unsupported `fatal` property when creating a `step_failed` event. The TypeScript schema for `step_failed` events only allows `error` and `stack` properties, so the `fatal` property causes a compilation error.

This commit fixes the issue reported at packages/core/src/runtime/step-handler.ts:133-139

## TypeScript error: Invalid property 'fatal' in step_failed event

**What fails:** TypeScript compilation fails in `packages/core` due to an invalid property in the `step_failed` event creation.

**How to reproduce:**
```bash
cd /vercel/sandbox/primary
pnpm run -F @workflow/core build
```

**Result:**
```
src/runtime/step-handler.ts(133,32): error TS2769: No overload matches this call.
  Overload 1 of 2, '(runId: null, data: { eventType: "run_created"; ... }, gave the following error.
    Argument of type 'string' is not assignable to parameter of type 'null'.
  Overload 2 of 2, '(runId: string, data: CreateEventRequest, params?: CreateEventParams | undefined): Promise<EventResult>', gave the following error.
    Object literal may only specify known properties, and 'fatal' does not exist in type '{ error: any; stack?: string | undefined; }'.
```

**Issue:** The code attempted to pass a `fatal: true` property in the `eventData` object when creating a `step_failed` event. However, the event schema defined in `packages/world/src/events.ts` for `StepFailedEventSchema` only allows `error` and `stack` properties - the `fatal` property is not part of the schema.

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

* Fix: Code silently skips updating workflowRun if result.run is undefined, causing workflows to be incorrectly skipped instead of throwing an error

* Add hook_conflict event type for duplicate token detection

Implements hook_conflict events across all world implementations to handle
cases where a workflow attempts to use a hook token already claimed by another
workflow. Instead of throwing errors, the system now records hook_conflict
events in the event log, enabling deterministic replay.

- Add HookConflictEvent schema to @workflow/world
- Implement hook_conflict in world-local, world-postgres, and suspension-handler
- Update hook consumer to reject promises with WorkflowRuntimeError on conflict
- Add HOOK_CONFLICT error slug with documentation
- Add e2e and unit tests for conflict scenarios

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

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

* Add changeset for hook_conflict events

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

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

* Add unit tests for hook_conflict handling

- Add tests for hook_conflict event in workflow.test.ts
- Fix world-postgres test to not expect removed message field

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

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

* Improve hook-conflict.mdx error guide

- Remove redundant third point in 'Why This Happens' section
- Add example showing how to handle WorkflowRuntimeError for hook conflicts

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

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

* Fix docs validation: add hook-conflict to errors index

- Fix broken link in hook-conflict.mdx (/docs/foundations/webhooks -> /docs/api-reference/workflow/create-webhook)
- Add hook-conflict to errors index page so it's discoverable by the docs link validator

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

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

* Fix world-local tests for hook_conflict event behavior

Update tests to expect hook_conflict events instead of thrown errors when
duplicate hook tokens are used. This aligns with the new event-sourced
approach where conflicts are recorded as events rather than thrown.

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

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

* Add specVersion property to World interface for backwards compatibility

- Add specVersion property to World interface to track world package version
- Add specVersion to WorkflowRun schema and run_created event data
- World implementations (vercel, local, postgres) set specVersion from npm version
- Server can use specVersion to route operations based on world version
- Add specVersion display to observability UI attribute panel
- Add spec_version column to postgres runs schema

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

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

* Add migration for spec_version column in postgres schema

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

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

* Add drizzle migration journal and snapshot for spec_version column

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

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

* Regenerate postgres migration using drizzle-kit

- Properly generates migration with drizzle-kit CLI
- Removes deprecated 'paused' status from enum
- Adds spec_version column

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

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

* Add backwards compatibility for event-sourced runs

- Add RunNotSupportedError for runs requiring newer world versions
- Add semver-based version utilities (isLegacyVersion) to @workflow/world
- World implementations check specVersion and route to legacy handlers
- Legacy runs (< 4.1.0): run_cancelled skips event storage, wait_completed stores event only
- New runs always get current world version (4.1.0-beta.0)
- Make EventResult.event optional for legacy compatibility

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

* Refactor spec version from semver strings to integers

Replace semver-based version compatibility with explicit integer spec versions:
- SPEC_VERSION_LEGACY (1): pre-event-sourcing runs
- SPEC_VERSION_CURRENT (2): event-sourced architecture

Use branded SpecVersion type to enforce importing from @workflow/world.
Remove semver dependency from world, world-local, and world-postgres.

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

* Store error as CBOR in postgres world for consistency with input/output

- Add error_cbor bytea columns to workflow_runs and workflow_steps tables
- Deprecate text error column, rename to errorJson with fallback parsing
- Remove JSON.stringify from error writes (run_failed, step_failed, step_retrying)
- Add parseErrorJson helper for backwards compatibility with legacy data

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

* Use WorkflowRuntimeError and improve run entity handling in core runtime

- Replace generic Error with WorkflowRuntimeError for runtime assertions
- Add explicit check for run entity in run_created response
- Use run.runId instead of event.runId for consistency
- Use actual run status instead of hardcoded 'pending' in attributes

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

* Add specVersion to Step, Hook, and Event entities

- Add specVersion field to Step, Hook, and Event interfaces in @workflow/world
- Add spec_version column to steps, hooks, events tables in postgres schema
- Set specVersion to SPEC_VERSION_CURRENT when creating entities in all worlds
- Update migration to include spec_version columns for all entity tables

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

* Refactor world-local storage into modular files

Split storage.ts (1041 lines) into smaller, focused modules:
- storage/filters.ts: Data filtering helpers
- storage/helpers.ts: ULID and date utilities
- storage/hooks-storage.ts: Hook CRUD operations
- storage/legacy.ts: Legacy event handling
- storage/runs-storage.ts: Run get/list operations
- storage/steps-storage.ts: Step get/list operations
- storage/events-storage.ts: Event create/list operations
- storage/index.ts: Main composition

Also extracted test helpers to test-helpers.ts for reusability.

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

* Remove genversion and World.specVersion property

The World.specVersion string property was never actually read - only
the numeric SPEC_VERSION_CURRENT is used for backwards compatibility.

- Remove genversion dependency and generated version.ts from @workflow/world
- Remove specVersion property from World interface and all implementations
- Minor fix: correct error message to reference 'workflow' package
- Minor fix: correct error source priority in world-vercel events.ts
- Minor fix: update comment in runtime.ts

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

* Remove genversion from world-local, world-postgres, and world-vercel

These packages no longer need genversion since we removed the
World.specVersion property in the previous commit.

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

* Remove version.ts from .gitignore files

No longer needed after removing genversion.

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

* Add legacy/backwards compatibility tests

Tests for world-local and world-postgres covering:
- Legacy runs (specVersion < 2 or null/undefined)
  - run_cancelled handling (updates run, no event stored)
  - wait_completed handling (stores event only)
  - Rejection of unsupported events
  - Hook cleanup on cancellation
- Future runs (specVersion > current)
  - Rejection with RunNotSupportedError
- Current version runs (normal processing)
- Legacy error parsing (errorJson field parsing)

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

* Add hook_received support for legacy runs

When resumeHook() is called on a legacy run (specVersion < 2), the
hook_received event was previously rejected. This adds support for
storing hook_received events on legacy runs without entity mutation,
matching the behavior of wait_completed.

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

* Fix missing genversion in world-vercel

Signed-off-by: Peter Wielander <mittgfu@gmail.com>

* Remove deprecated workflow_completed, workflow_failed, and workflow_started events

Replace with run_completed, run_failed, and run_started equivalents.

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

* Add specVersion to EventWithRefsSchema in world-vercel

The manually-created EventWithRefsSchema was missing the specVersion field,
which caused specVersion to be stripped when using lazy (refs) mode for events.

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

* Wire specVersion from client through world backends

- Core runtime now sends specVersion in run_created eventData
- world-local accepts specVersion from eventData (defaults to current)
- world-postgres accepts specVersion from eventData (defaults to current)

This matches workflow-server behavior where v2 endpoints accept
specVersion from the client, while v1 endpoints default to legacy.

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

* Move specVersion to event object level, propagate to entities

- Add specVersion to BaseEventSchema (event level, not eventData)
- Remove specVersion from RunCreatedEventSchema.eventData
- Core runtime sends specVersion on event object
- world-local reads specVersion from event, propagates to run/step/hook entities
- world-postgres reads specVersion from event, propagates to run/step/hook entities

This ensures specVersion flows from client through event to all created entities.

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

* Update specVersion to be optional in types for backwards compatibility

- specVersion is optional in all entity schemas (runs, steps, hooks, events)
  for backwards compatibility with legacy data in storage
- Runtime always sends specVersion on event requests
- world-local and world-postgres provide fallback to SPEC_VERSION_CURRENT
- Test helpers include specVersion in all event creation calls
- EventWithRefsSchema in world-vercel defaults specVersion to 1 for legacy

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

* Fix world-vercel queue tests missing VERCEL_DEPLOYMENT_ID setup

Two tests were calling queue.queue() without setting up
VERCEL_DEPLOYMENT_ID, causing them to fail with "No deploymentId
provided" error before reaching the code they were testing.

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

* Add specVersion to all event creation calls in core package

The server's CreateEventSchemaV2 requires specVersion on all events,
but only run_created was sending it. This caused 400 Bad Request errors
for all other event types (run_started, run_completed, run_failed,
run_cancelled, step_created, step_started, step_completed, step_failed,
step_retrying, hook_created, hook_received, wait_created, wait_completed).

Now all event creation calls include specVersion: SPEC_VERSION_CURRENT.

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

---------

Signed-off-by: Peter Wielander <mittgfu@gmail.com>
Co-authored-by: Vercel <vercel[bot]@users.noreply.github.com>
Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
Co-authored-by: Peter Wielander <mittgfu@gmail.com>
2026-01-22 17:24:52 -08:00
Michael Han 0b5cc48140 fix(builders): manifest missing workflow-only files (no steps), add tests (#831)
* Fix manifest missing workflow-only files (no steps), add tests

Signed-off-by: voyager14 <21mh124@queensu.ca>

* Update packages/builders/src/base-builder.ts

Co-authored-by: vercel[bot] <35613825+vercel[bot]@users.noreply.github.com>
Signed-off-by: Michael Han <21mh124@queensu.ca>

---------

Signed-off-by: voyager14 <21mh124@queensu.ca>
Signed-off-by: Michael Han <21mh124@queensu.ca>
Co-authored-by: vercel[bot] <35613825+vercel[bot]@users.noreply.github.com>
2026-01-22 17:22:14 -08:00
Vercel Release Bot cd7c03d45d Version Packages (beta) (#819)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
workflow@4.0.1-beta.50
2026-01-22 14:12:34 -08:00
Peter Wielander 549ffbee3c [web-shared] Tone down colors on event list (#828)
* [web-shared] Tone down colors on event list

Signed-off-by: Peter Wielander <mittgfu@gmail.com>

* Update .changeset/mean-experts-hammer.md

Co-authored-by: vercel[bot] <35613825+vercel[bot]@users.noreply.github.com>
Signed-off-by: Peter Wielander <mittgfu@gmail.com>

---------

Signed-off-by: Peter Wielander <mittgfu@gmail.com>
Co-authored-by: vercel[bot] <35613825+vercel[bot]@users.noreply.github.com>
2026-01-22 10:52:37 -08:00
Nathan Rajlich 7023d5e10e Fix getWorld() import naming (#826)
Closes #803.
2026-01-21 23:22:17 -08:00
Nathan Rajlich 5ba82ec4b1 Add workflow health CLI command and web functionality (#816) 2026-01-21 12:48:03 -08:00
Lucas Neves 1533dbbf44 postgres-world: Delete redundant and bugged migration (#804)
* Delete redundant and bugged migration

* DCO Remediation Commit for Lucas Neves <lcneves@gmail.com>

I, Lucas Neves <lcneves@gmail.com>, hereby add my Signed-off-by to this commit: 64705dfe86

Signed-off-by: Lucas Neves <lcneves@gmail.com>

---------

Signed-off-by: Lucas Neves <lcneves@gmail.com>
2026-01-21 11:52:33 -08:00
Nathan Rajlich f3785f04fb Throw an error if no deployment ID was specified (#820) 2026-01-21 09:57:29 -08:00
Nathan Rajlich b05dbd7525 Clamp setTimeout value to 32-bit integer (~25d) for sleep() (#824) 2026-01-21 09:43:06 -08:00
Nathan Rajlich 202c524723 Add retry for filesystem operation errors on Windows (#818) 2026-01-21 01:08:56 -08:00
Vercel Release Bot 3856ce8c20 Version Packages (beta) (#807)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
workflow@4.0.1-beta.49
2026-01-20 18:37:54 -08:00
Nathan Rajlich 8621917f6e Enqueue @workflow/serde for publish 2026-01-20 18:31:47 -08:00
Nathan Rajlich 4c01dd3d02 Update SWC plugin spec.md with latest state of compiler (#815) 2026-01-20 12:24:11 -08:00
Peter Wielander 714b233005 [world-local] Update log message when PORT not set, and make less prominent (#811) 2026-01-20 11:05:20 +01:00
Nathan Rajlich f93e894a6a Show opaque marker when deserializing custom classes and instances in o11y (#809)
* Show opaque marker when deserializing custom classes and instances in o11y

* Add unit tests

* Parse filename from class ID

* color hash

* Try out different colors

* Use color-hash module and HSL transformations

* CLI style tweaks

* Update .changeset/forty-tables-lick.md

Co-authored-by: Peter Wielander <mittgfu@gmail.com>
Signed-off-by: Nathan Rajlich <n@n8.io>

---------

Signed-off-by: Nathan Rajlich <n@n8.io>
Co-authored-by: Peter Wielander <mittgfu@gmail.com>
2026-01-20 01:50:11 -08:00
Karthik Kalyan ee7b1fd244 Fix layout shift flicker in runs table by using refresh hook instead of reload (#808)
* Made a minor fix to use the hook to refresh the runs instead of reloading the entire page. This prevents the layout shift flicker that was happening previously.

Signed-off-by: Karthik Kalyanaraman <karthik.kalyanaraman@vercel.com>

* Update .changeset/pretty-teeth-brush.md

Co-authored-by: Peter Wielander <mittgfu@gmail.com>
Signed-off-by: Karthik Kalyan <105607645+karthikscale3@users.noreply.github.com>

* Hooks table - fix to use the hook to refresh the runs instead of reloading the entire page. This prevents the layout shift flicker that was happening previously.

---------

Signed-off-by: Karthik Kalyanaraman <karthik.kalyanaraman@vercel.com>
Signed-off-by: Karthik Kalyan <105607645+karthikscale3@users.noreply.github.com>
Co-authored-by: Peter Wielander <mittgfu@gmail.com>
2026-01-19 17:57:30 -08:00
Nathan Rajlich 1843704b83 Add support for custom class instance serialization (#762)
Added support for custom class instance serialization across workflow/step boundaries.

### What changed?

- Introduced a new `@workflow/serde` package with `WORKFLOW_SERIALIZE` and `WORKFLOW_DESERIALIZE` symbols
- Enhanced the serialization system to handle custom class instances using these symbols
- Updated the SWC plugin to detect classes with serialization methods and register them
- Added class registry mechanism that works in both step and workflow contexts
- Implemented comprehensive tests for various serialization scenarios

### How to test?

The PR includes a new e2e test `customSerializationWorkflow` that demonstrates the feature:

```typescript
import { WORKFLOW_SERIALIZE, WORKFLOW_DESERIALIZE } from '@workflow/serde';

// Define a class with custom serialization
class Point {
  constructor(public x: number, public y: number) {}

  static [WORKFLOW_SERIALIZE](instance: Point) {
    return { x: instance.x, y: instance.y };
  }

  static [WORKFLOW_DESERIALIZE](data: { x: number; y: number }) {
    return new Point(data.x, data.y);
  }
}

// Use in workflow and steps
export async function customSerializationWorkflow(x: number, y: number) {
  'use workflow';
  const point = new Point(x, y);
  const scaled = await transformPoint(point, 2);
  // ...
}
```

Run the e2e test to verify that class instances are properly serialized and deserialized.

### Why make this change?

Previously, user-defined class instances couldn't be passed between workflows and steps without losing their prototype chain and methods. This change allows developers to define custom serialization/deserialization logic for their classes, enabling proper reconstruction of instances with their full functionality intact when crossing workflow/step boundaries.
2026-01-19 15:38:19 -08:00
Peter Wielander d30e5c0249 [web] Add view to display a list of all events (#806) 2026-01-19 09:52:18 +01:00
Peter Wielander 4247c727b0 [web-shared] Improve spacing, styling, and scroll behavior of trace viewer sidebar (#805) 2026-01-19 09:30:27 +01:00
Vercel Release Bot ee0423887d Version Packages (beta) (#796) 2026-01-18 11:01:53 +01:00
Peter Wielander f491237e1e [ai] Fix collectUiMessages option by accumulating chunks in a separate step call (#784) 2026-01-16 23:58:31 +01:00
Peter Wielander 722c17243c Dedupe release Slack lines by PR number (#793) 2026-01-16 21:59:34 +01:00
Vercel Release Bot 96d17286b1 Version Packages (beta) (#791) workflow@4.0.1-beta.48 2026-01-16 11:06:05 +01:00
JJ Kasper 344c90ff9f Add Next.js pages router entries handling (#792)
* Add Next.js pages router entries handling

* update trigger-pages

* Apply suggestions from code review

Co-authored-by: vercel[bot] <35613825+vercel[bot]@users.noreply.github.com>
Signed-off-by: JJ Kasper <jj@jjsweb.site>

---------

Signed-off-by: JJ Kasper <jj@jjsweb.site>
Co-authored-by: vercel[bot] <35613825+vercel[bot]@users.noreply.github.com>
2026-01-15 19:02:47 -08:00
Nathan Rajlich 49a1c5f2fc Avoid attempting to serialize the "tool" during tool call execution (#790) 2026-01-15 13:43:30 -08:00
Peter Wielander b729d49610 [web] [core] Ensure re-running Run from o11y UI will use specified world (#788) 2026-01-15 20:52:35 +01:00
Vercel Release Bot ac7aa33cd2 Version Packages (beta) (#782) workflow@4.0.1-beta.47 2026-01-15 18:17:40 +01:00
Peter Wielander 7ff6a05cf9 [web] Allow passing user env variables to vercel backend in o11y UI (#787) 2026-01-15 18:06:47 +01:00
Peter Wielander 125d0a666e [web-shared] Safe-access requestId in UI worker (#783) 2026-01-15 10:23:34 +01:00
Peter Wielander abdca8fd52 [web] Observability config overhaul (#774) 2026-01-14 23:22:30 +01:00
Peter Wielander aced2968ba [ci] Post weekly github issue digest to slack (#780) 2026-01-14 22:42:47 +01:00
Nathan Rajlich 315d10fc79 Fix nitro changelog to use the correct "@workflow/nitro" name (#781) 2026-01-14 12:57:41 -08:00
Peter Wielander c4f8033d8e [ci] Post release notes to slack (#779) 2026-01-14 20:29:22 +01:00
Vercel Release Bot 4bd877b474 Version Packages (beta) (#778) workflow@4.0.1-beta.46 2026-01-14 13:25:24 +01:00
Peter Wielander 49bb48a256 [ai] Add collectUIMessages option to accumulate and return UIMessage[] from agent.stream (#768) 2026-01-14 13:17:12 +01:00
Nathan Rajlich 7906429541 Add support for serializing this when invoking step functions (#754)
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.
2026-01-14 00:07:29 -08:00
Nathan Rajlich a2fc53a0dc Support class static methods with "use step" / "use workflow" (#753)
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.
2026-01-13 23:52:26 -08:00
Vercel Release Bot 101585cce0 Version Packages (beta) (#758)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
workflow@4.0.1-beta.45
2026-01-13 14:10:19 -08:00
Joe Haddad 49f650c3a7 Step queue write idempotency (#776)
* fix(core): always write step to queue even if step already exists

This fixes a race condition where:
1. Step is written to workflow database
2. Process crashes/times out before queue write completes
3. Upstream retry occurs
4. Step already exists (409), so queue write was skipped
5. Step sits pending forever with 0 attempts

The queue write already uses an idempotency key (correlation ID),
so duplicate writes are safely deduplicated by the queue service.

* chore: add changeset for step queue idempotency fix

* chore(core): remove dead ops array code from processStep

The ops array was leftover from a previous refactor that used to collect
promises for parallel execution. Nothing was ever pushed to it, making
the waitUntil(Promise.all(ops)) a no-op.

* DCO Remediation Commit for Cursor Agent <cursoragent@cursor.com>

I, Cursor Agent <cursoragent@cursor.com>, hereby add my Signed-off-by to this commit: 6e510f7ad6
I, Cursor Agent <cursoragent@cursor.com>, hereby add my Signed-off-by to this commit: 5394d49c3e
I, Cursor Agent <cursoragent@cursor.com>, hereby add my Signed-off-by to this commit: 23424ff6f9

Signed-off-by: Cursor Agent <cursoragent@cursor.com>

---------

Signed-off-by: Cursor Agent <cursoragent@cursor.com>
Co-authored-by: Cursor Agent <cursoragent@cursor.com>
2026-01-13 14:00:26 -08:00
Nathan Rajlich 3dd5b2708d Make resumeHook() accept a Hook object or string (#773) 2026-01-13 13:29:11 -08:00