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/core

v5.8.0

Published

Core runtime and engine for Workflow SDK

Readme

@workflow/core

Core runtime package for Workflow SDK.

Pass the Hook returned by getHookByToken() to resumeHook() to reuse its immutable resume context without another token lookup. JSON, object spreads, and structured cloning preserve this behavior. Cached capabilities are ignored; capable Worlds require an atomic, guarded write. A definite refusal triggers a fresh lookup and ordinary delivery inside the SDK. Uncertain writes are never re-sent. Hooks without resume context retain the run-fallback path.

A stored Hook contains its token. Keep it server-side, or authenticate the whole object (and encrypt it if the token is secret) before carrying it through a client. Deployment metadata controls encryption and wake targeting; validation alone does not establish trust. Trace carriers may contain private baggage.

The CI benchmark suite in e2e/benchmark.test.ts measures time to first step, fan-out, and sequential-step overhead. Streaming delivery performance is measured in durabench; stream correctness remains covered by unit and E2E tests.

Steps wait for released stream writers to drain before recording completion, then release idle transport resources when the World supports it. Reacquiring the same writable remains supported. Aborting a public writable drains its accepted prefix and disposes the underlying writer transport without closing the shared server stream. Source failures in flushable readable pipes propagate to the user-facing reader rather than leaving it waiting for more data. Streams that finish draining after the inline wait budget expires do not force an extra queued continuation unless other background operations remain pending.

Hook registration acknowledgements and token conflicts participate in replay delivery ordering alongside step results, hook payloads, and sleep completions. Concurrent branches awaiting hook.getConflict() preserve their step correlation IDs when replaying an extended event history. setAttributes() acknowledgements take part in the same ordering, so a branch awaiting setAttributes() while another branch is in flight keeps its own step results on replay.

Hook disposals pending when a workflow completes or fails rely on the terminal event's hook cleanup, avoiding redundant hook_disposed events. Disposals still persist when the workflow suspends, a later pending registration needs the same token, or explicit disposal releases a retained token early. Final AbortController.abort() calls still propagate to steps.

Real-time abort streams use a 4-byte big-endian length envelope around the existing serialized payload. Encryption and durable hook events are unchanged. Readers accept both framed packets and older unframed packets, reassembling split transport reads before hydration. Complete legacy packets propagate without waiting for stream close. Cross-deployment start() keeps unframed writes for targets whose core version predates abort framing or cannot be established. resumeHook() retains unframed abort writes until its resume context can attest the receiving runtime separately from the starting client. An abort is also handed directly to readers in the writer's process, so an inline step is aborted even when a zero-retention run's end clears the stream before the step reads it (src/serialization/abort-local.ts).

Failed-run logs include underlying error causes and codes to help diagnose failures such as socket, DNS, and TLS errors. Unreadable causes are marked without preventing the run from being recorded as failed.

Queued step messages carry immutable run identity in runContext, so step execution skips the initial runs.get and fetches the run row only when continuing into workflow replay. Messages from older producers without runContext retain the initial fetch.

When a World advertises capabilities.invoke, resumeHook() sends serialized hook inputs through world.invoke() and waits for the executor's decision. The World calls the existing handler with invoke: true, requestId, and the hook input. Core validates the input, waits for its event write, and returns a decision. Core shares a run's activity state between workflow execution and these input calls.

The event write completes before the response is stored. On Worlds with hookResumeDedup, a stable request identity makes retries reuse the same hook event, including after hook disposal or run completion. Core can process inputs while inline steps wait. Workflow code observes committed inputs at replay boundaries, reusing a retained Node virtual machine when available.

Errors returned by the executor propagate through world.invoke() to the caller of resumeHook().

Register onRunCompleted and onRunFailed handlers with registerLifecycleHooks from workflow/api for best-effort reporting of terminal transitions written by your app. Handlers receive the workflow name without a backend read, a lazy Run instance, and, for failures, an error hydrated from the persisted payload. Callbacks are not retried; the event log remains the system of record. Hook-property getters and reporting failures are isolated from terminal writes. On Vercel, the callback's waitUntil scope also drains background operations for streams hydrated from the persisted failure, including when a handler throws. Cancel readers and release locks when finished; a leaked reader can hold that scope open until the invocation's duration limit. Streams hydrated through run.returnValue are not included in that drain. Register in the workflow executor's host startup, never from workflow or step code. Framework-specific support, hot-reload behavior, and stream cleanup are documented in the lifecycle hooks guide.