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

@foundryprotocol/0gkit-jobs

v1.0.1

Published

Durable async job runner for 0G compute / storage / DA workflows. Memory / SQLite / Redis backends, zod-typed job definitions, HMAC-signed webhooks, graceful shutdown.

Downloads

76

Readme

@foundryprotocol/0gkit-jobs

Durable async job runner for long-running 0G operations (inference, multi-step agents, batched uploads, DA publishes). Three swappable backends behind one interface; zod-typed jobs.define(); HMAC-signed webhook delivery on state transitions; graceful shutdown via AbortSignal (designed for Vercel Fluid Compute and similar serverless runtimes).

Install

pnpm add @foundryprotocol/0gkit-jobs @foundryprotocol/0gkit-core zod

# redis backend only
pnpm add ioredis

Quickstart

import { JobRunner, jobs } from "@foundryprotocol/0gkit-jobs";
import { MemoryBackend } from "@foundryprotocol/0gkit-jobs/backends/memory";
import { z } from "zod";

const InferenceJob = jobs.define({
  name: "inference",
  input: z.object({ prompt: z.string(), model: z.string() }),
  output: z.object({ text: z.string() }),
  handler: async ({ input, signal }) => {
    // Use `signal` for graceful shutdown; fail-fast in long handlers.
    if (signal.aborted) throw new Error("shutting down");
    return { text: "..." };
  },
});

const runner = new JobRunner({
  backend: new MemoryBackend(),
  signer,
  webhook: { url: process.env.WEBHOOK_URL!, secret: process.env.WEBHOOK_SECRET! },
});
runner.register(InferenceJob);
await runner.start({ concurrency: 4 });

const id = await runner.enqueue(InferenceJob, { prompt: "hi", model: "..." });
const final = await runner.waitFor(id);

Backends

| Backend | Install | When to use | | ------- | ------------------------------- | -------------------------------- | | memory | (built-in) | dev, tests, ephemeral workflows | | sqlite | (built-in via better-sqlite3) | single-node prod, no extra infra | | redis | optional peer ioredis | multi-node prod, fan-out |

Webhook verification (server side)

import { jobs } from "@foundryprotocol/0gkit-jobs";

app.post("/api/jobs/webhook", express.text({ type: "*/*" }), (req, res) => {
  const ok = jobs.verifyWebhook({
    body: req.body,
    signature: req.header("x-0gkit-signature") ?? "",
    secret: process.env.JOBS_SECRET!,
  });
  if (!ok) return res.status(401).send("bad signature");
  // ... dedupe on (jobId + newState)
});

Vercel Fluid Compute

Functions get a grace period on shutdown. Register a beforeExit hook that calls runner.stop({ drain: true, timeoutMs: 25_000 }) so in-flight jobs land cleanly before the instance is reaped.

Error codes

At-least-once delivery

A worker that crashes between handler completion and backend.complete() returning will retry on next claim. Handlers must be idempotent on their inputs — use jobId as the idempotency key for any external side effect. Webhook receivers should dedupe on (jobId, newState).

License

MIT