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

@remcostoeten/ai-core

v0.2.0

Published

Provider-neutral AI completion contracts, run lifecycle, and deterministic fake provider. Zero dependencies.

Readme

This package is the seam, not the integration. It defines what a completion request is, validates one, runs it against a provider you supply, and guarantees what comes back. Reaching a real vendor is a separate package, @remcostoeten/ai-sdk, so a browser bundle that imports this one pulls in nothing else.

  • Zero dependencies, enforced by a test that bundles this package for the browser and fails if ai, @ai-sdk/*, process.env or a Node built-in appears in the output
  • buildRequest validates against UTF-8 byte budgets and returns a rejection as a value, never as a thrown exception
  • The runtime owns the guarantees: ids reserved before provider lookup, gapless delta sequences from zero, a 4 MiB accumulated ceiling it enforces rather than trusts, and exactly one terminal with nothing after it
  • consumeEvents and accumulate turn a run into text and a typed outcome
  • A deterministic fake provider driven by a script, so a consumer's tests need no network and no key
  • NDJSON helpers to carry events over a wire, bounded per line
  • Cancellation is an AbortSignal; a deadline that fires outranks it and reports timeout, not cancelled

The same seam exists in Rust as ai-core. Both read specs/fixtures/ and run the same eight fake scripts, so segmentation, terminal kind, error category and usage are held identical across the two languages.

Reference is typescript-core.md, worked usage is examples.md, and the wire contract is contracts.md.

Install

npm install @remcostoeten/ai-core

Use

import { buildRequest, consumeEvents, createFakeProvider, createRuntime, successScript } from '@remcostoeten/ai-core'

const runtime = createRuntime({ providers: [createFakeProvider(successScript(['hel', 'lo']))] })

const built = buildRequest({
  requestId: 'request-1',
  providerId: 'fake',
  modelId: 'model',
  messages: [{ role: 'user', content: 'hello' }],
})
if (!built.ok) return reject(built.error.reason)

const started = runtime.stream(built.request)
if (!started.ok) return reject(started.error.reason)

const outcome = await consumeEvents(started.events)
// outcome.status === 'done', outcome.text === 'hello'

Not implemented

Structured output, retries, key rotation, provider fallback or routing, run recording, model listing, and framework helpers for React, Hono, Next.js or Tauri. Each is absent deliberately and recorded in the decision records.

xxx, Remco Stoeten MIT