npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@workflow/world

v5.0.2

Published

The Workflows World interface

Readme

@workflow/world

Core interfaces and types for Workflow SDK storage backends.

This package defines the World interface that abstracts workflow storage, queuing, authentication, and streaming operations. Implementation packages like @workflow/world-local and @workflow/world-vercel provide concrete implementations.

Used internally by @workflow/core and world implementations. Should not be used directly in application code.

Stream writer transport lifetime

A stateful StreamWriteSession may implement release() to retire an idle transport after core has drained a released writer. Unlike dispose(), release must leave subsequent writes and close usable; an adapter can switch that writer to a stateless transport. Neither operation semantically closes the shared stream.

Optional invocation delivery

world.invoke(runId, payload, options?) sends an input to a workflow runner and returns its response. Invoke returns after the runner has processed the payload and may fail if the runner rejects it. The World must route the payload to the active runner, or start or resume the runner if none is active.

Invocation support is optional. A World that implements invoke and enables WorldCapabilities.invoke must guarantee at most one active workflow runner per runId, across all worker processes. Different runs may execute concurrently. A replacement runner may take over after the previous runner stops, so a run can use different processes over its lifetime.

A World that implements invoke calls the existing createQueueHandler callback with { runId, invoke: true, requestId, input }. The runner validates the input, waits for required event writes, and returns a value. The World delivers that value to the caller. The callback must be able to process inputs while the run awaits step work, without starting a second runner for that run. Worlds without invocation support must leave the capability unset.

InvokeOptions accepts an idempotencyKey for retries and a timeoutMs response-wait limit. In invocation mode, the callback's return value is response data, including any timeoutSeconds property. Ordinary workflow wake results use timeoutSeconds to schedule another execution.

World transports can use InvocationOutcome to carry returned values or serialized handler errors. The @workflow/errors/invocation helpers restore known Workflow error classes for the caller. A transport failure leaves the processing outcome unknown. A handler error can occur after event writes have committed.

Step dispatch context

WorkflowInvokePayload.runContext carries the run's deployment ID, spec version, start time, and lineage root. Consumers use this identity to start queued steps without first fetching the run. Run status is not carried on the message: World implementations must reject step_started on terminal runs, including redelivery for a step that still has running status. In-flight steps may still record step_completed or step_failed after the run ends.

Implementation constraint: no mutable module state

A World implementation must not keep mutable state at module scope. Hold it on the World instance, or, when it is genuinely process-wide (an ID generator whose sequence must not fork, a log-once latch), on globalThis via globalSingleton() from @workflow/utils.

@workflow/world-local and @workflow/world-vercel are bundled into the host application's server build, and a bundler keys module identity on (resource, layer): Next.js alone compiles instrument, app-route, ssr and edge as separate module graphs, so one process holds one copy of every module in these packages per layer. A top-level let, or a const holding a Map, is therefore per-copy state rather than the singleton it reads as.

A world loaded at runtime through WORKFLOW_TARGET_WORLD is deduped by Node's module cache and does not have this problem today, but that is a property of how it is loaded, not of how it is written, and it has changed before (vercel/workflow#3493). scripts/lint/module-scope-state.mjs enforces the rule across every published world package; see docs/content/worlds/*/building-a-world.mdx for the author-facing version.