mirror of
https://github.com/vercel/workflow.git
synced 2026-09-14 19:59:43 +08:00
374dbaaebd
- @workflow/world: snapshots interface is now OPTIONAL on Storage (a World that can't store blobs simply omits it; consumers feature-detect and fall back to full replay) — keeps this a true minor for community worlds. New encodeSnapshotEnvelope/decodeSnapshotEnvelope helpers pack metadata + bytes into ONE self-describing blob; decode validates via the schema (passthrough for forward compat) and returns null for anything torn/corrupt/foreign — never fabricated metadata. - world-local: single envelope file per run replaces the .bin/.json pair — the torn-save window (crash or concurrent load between two renames pairing bytes with another suspension's cursor) is structurally gone. - world-postgres: data column stores the envelope; full metadata round-trips losslessly (new fields need no migration). Columns remain as denormalized observability copies. - world-vercel: envelope is the PUT/GET body, so the full metadata round-trips without any workflow-server change; loads never invent metadata from headers/wall time (undecodable body = clean miss). DELETE treats 404 as success (idempotent like local/postgres). WORLD_SNAPSHOT_DIAG logs gated behind the package's HTTP debug flag.
@workflow/world-vercel
Production workflow backend for Vercel platform deployments.
Integrates with Vercel's infrastructure for storage, queuing, and authentication. Handles workflow persistence and scaling in production environments.
Used by default for deployments on Vercel. Authentication and API endpoints are configured automatically in Vercel deployments.
Custom dispatcher
HTTP requests (including the queue) default to a shared undici RetryAgent that handles connection pooling and retries. Pass a custom dispatcher to override it — e.g. to tune undici on newer Node runtimes:
import { Agent } from 'undici';
import { createWorld } from '@workflow/world-vercel';
import { setWorld } from '@workflow/core/runtime';
setWorld(createWorld({ dispatcher: new Agent({ connections: 16 }) }));
Caller user agent
Pass a User-Agent header to append a caller-specific product token while
preserving the world-vercel token:
import { createWorld } from '@workflow/world-vercel';
const world = createWorld({
headers: { 'User-Agent': 'my-framework/1.2.3' },
});