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

@sffmc/runtime

v0.16.0

Published

Standalone package: sandboxed JavaScript workflow orchestrator (quickjs-emscripten). Spawns sub-tasks, fans out work in parallel, pipelines multi-step jobs without losing context.

Downloads

894

Readme

@sffmc/runtime

Sandboxed JavaScript workflow orchestrator for OpenCode. Spawns sub-tasks, fans out work in parallel, and pipelines multi-step jobs so you can run 200+ step workflows without losing context or getting stuck in loops.

What it does

@sffmc/runtime registers a workflow() tool on OpenCode. Each call runs a named workflow (a self-contained JavaScript module) inside a quickjs-emscripten sandbox with deterministic I/O, no host filesystem access, and an interruptible tick budget. Workflows return a typed result that flows back to the main agent.

Architecture

v0.16.0 split the original god-classes into focused modules. The orchestrator files (left) wire the helper modules (right) together:

  • packages/runtime/src/runtime.ts — main WorkflowRuntime class. Lifecycle, public API (start/status/wait/cancel/resume), composes the 11 sub-components via the SOLID Services + Callbacks DI container.
  • packages/runtime/src/sandbox.tsrunSandboxed orchestrator (~220 LOC). Wires 6 sandbox services (runtime, eval, pump, deadline, bridge, marshaller) per the SOLID DI container in sandbox-services.ts.
  • packages/runtime/src/persistence.ts — barrel re-exporting 10 modules (runid, script-sha, journal-key, paths, runs, steps, fsync-coalescer, journal, scripts, workflow-persistence).
  • packages/runtime/src/concurrency.ts — per-runtime Concurrency lock map; no module-level globals.
  • packages/runtime/src/flush-manager.ts — debounced journal flush; FlushManager class with scheduled flushes per runID + clearAll() on teardown.
  • packages/runtime/src/counter-manager.tsagentOpts (concurrency caps, deadlines, token budgets).
  • packages/runtime/src/event-emitter.ts — typed events surface for mergeHooks consumers.

Sandbox helpers (5 modules, behind SandboxServices interfaces)

  • sandbox-prelude.ts — PRELUDE globals (parallel, pipeline, mcp.list/call) + buildHostHooks.
  • sandbox-runtime.tscreateSandboxRuntime (memory, stack, deadline interrupt) + hardenDeterminism (mulberry32 PRNG, Date/WeakRef strip).
  • sandbox-eval.tsevalAndDiscard / evalAndReturn with labeled error disposal.
  • sandbox-pump.tsstartMicrotaskPump (adaptive cadence) + createDeadlineRace (wall-clock reject).
  • sandbox-bridge.tsinjectHooks + marshalIn for the host↔guest boundary.
  • sandbox-services.ts — narrow interfaces (SandboxRuntimeFactory, EvalExecutor, MicrotaskPumpFactory, DeadlineFactory, HostBridge, MarshalingService).

Runtime sub-components (4 modules, behind RuntimeServices interfaces)

  • run-completer.ts — completeRun / failRun / settleEntry. Implements IRunCompleter.
  • mcp-dispatcher.ts — list / call. Implements IMcpDispatcher.
  • agent-primitive.ts — spawnAgent / executeAgentCall / runParallel / runPipeline / publishAgentFailed. Implements IAgentPrimitive.
  • child-workflow-primitive.ts — spawn / setPhase / appendLog / start. Implements IChildWorkflowPrimitive.
  • runtime-services.tsRuntimeServices (4 sub-component deps: IRunCompleter, IMcpDispatcher, IAgentPrimitive, IChildWorkflowPrimitive); callbacks inlined per primitive.

Built-in workflows

  • deep-research — Plan / Search / Extract / Group / Crosscheck / Report over a single question, with a 3-judge panel discarding weakly-sourced facts before drafting.
  • See packages/runtime/src/builtin/ for the full registry (7 builtins: deep-research, plan, tdd, refactor, security-audit, doc-gen, lib-migrate).

Configure

# ~/.config/sffmc/runtime.yaml
sandbox:
  max_wall_clock_ms: 3600000   # 1 hour, default
  interrupt_grace_ms: 5000
flush:
  threshold: 50                # buffered events before forced checkpoint
  deadline_ms: 60000           # hard floor: flush at least every 60 s

Install

// ~/.config/opencode/opencode.json
{
  "plugins": [
    "npm:@sffmc/runtime@^0.15.4"
  ]
}

License

MIT