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

@infernetprotocol/engine

v0.1.45

Published

Inference engine abstraction for Infernet — pluggable backends (Mojo+MAX, in-process stub) over a stable async-iterator API.

Readme

@infernetprotocol/engine

Pluggable inference engine for the Infernet daemon. One async-iterator API across backends; the consumer (chat executor, future job runners) doesn't care which is loaded.

Backends

| Backend | Where it runs | When it's selected | | -------- | ----------------------------------- | ----------------------------------------------------------- | | ollama | Local Ollama daemon (HTTP) | Default when Ollama is reachable on OLLAMA_HOST | | mojo | External Mojo+MAX binary | INFERNET_ENGINE_BIN set, or backend:"mojo" (experimental) | | stub | In-process canned tokens | Fallback when neither is available — daemon still works |

Ollama is the recommended default. It already solves model download

  • cache, multi-vendor GPU (CUDA / ROCm / Metal), per-platform installers, and a stable streaming chat API. Operators install it once (https://ollama.com), ollama pull qwen2.5:7b, and they're serving.

The mojo backend is kept for the eventual case where a custom Mojo+MAX binary is worth squeezing extra perf out of — see engine/mojo/ for the scaffold.

Usage

import { createEngine } from "@infernetprotocol/engine";

const engine = await createEngine();   // auto-selects backend
const { id, stream, cancel } = engine.generate({
    messages: [{ role: "user", content: "hi" }],
    model: "qwen2.5:7b"
});

for await (const ev of stream) {
    if (ev.type === "token") process.stdout.write(ev.text);
    if (ev.type === "done")  console.log("\nfinished:", ev.reason);
    if (ev.type === "error") throw new Error(ev.message);
}

await engine.shutdown();

Auto-selection precedence

  1. INFERNET_ENGINE_BACKEND env var (explicit override: ollama, mojo, stub)
  2. INFERNET_ENGINE_BIN set → mojo
  3. Ollama reachable on OLLAMA_HOST (default http://localhost:11434) → ollama
  4. stub

Operator setup (typical)

# 1. Install Ollama (one line per platform — see ollama.com).
curl -fsSL https://ollama.com/install.sh | sh

# 2. Pull whichever model your node will serve.
ollama pull qwen2.5:7b      # 4.4 GB — fits a 6+ GB GPU
ollama pull qwen2.5:0.5b    # 400 MB — useful for CPU smoke tests

# 3. Tell the daemon which model this node serves.
INFERNET_ENGINE_MODEL=qwen2.5:7b infernet start

Pick whichever model fits your VRAM. Qwen 2.5 family is a reasonable default; the engine is model-agnostic.

Wire protocol — mojo backend

The Mojo backend communicates with its binary over NDJSON v1 stdio. Source of truth: src/protocol.js; mirrored on the Mojo side in engine/mojo/src/main.mojo. Bumping PROTOCOL_VERSION is a breaking change — both sides must move together.

The Ollama backend talks HTTP to the operator's Ollama daemon, so the v1 protocol is purely an internal-IPC concern there.

Testing

pnpm vitest run tests/engine.test.js — 16 tests covering:

  • Protocol codec round-trip + version mismatch handling
  • NDJSON splitter across chunk boundaries
  • EngineProcess against test/fake-engine.js (Node script speaking the protocol — no Mojo toolchain required)
  • Ollama backend against an in-process fake HTTP server (no real Ollama required) — streaming, cancellation, HTTP errors, missing model
  • createEngine auto-selection