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

aperture-gate

v0.1.0

Published

Gate LLM answers as ON_MAP / UNCERTAIN / OFF_MAP with a honesty.tools calibration certificate — a words-first refusal reader plus a per-model logprob fingerprint probe. Real-time streaming gate included.

Downloads

137

Readme

aperture-gate

Deploy a honesty.tools calibration certificate in JavaScript — gate an LLM's answers as ON_MAP / UNCERTAIN / OFF_MAP. The JS port of the Python aperture-gate, byte-identical in behaviour (verified to 6 decimal places against the same conformance vectors).

Two instruments, words first:

  1. words — if the answer itself refuses or hedges ("no such company", "I couldn't find any record…"), the verdict is OFF_MAP. The model said so; believe it.
  2. fingerprint — otherwise the gate scores [mean logprob, min logprob, mean top-5 entropy, max top-5 entropy] through the certificate's per-model probe. score >= off_map_thrOFF_MAP; >= uncertain_thrUNCERTAIN; else ON_MAP.
  3. With no logprobs and no refusal, the read degrades honestly to ON_MAP (instrument words-only).

The probe is calibrated per model — deploy the certificate for the model you actually serve. It separates grounded answers from confabulated ones about entities; it is not a general lie detector.

Zero runtime dependencies, Node ≥ 18 (uses global fetch), ESM + CJS, TypeScript types included. MIT.

Install

npm install aperture-gate

Quickstart

import { Gate } from "aperture-gate";

// a registry cert id, a model alias, a URL, or the cert object itself
const gate = await Gate.fromCert("openai/gpt-4o-mini");

// 1) words-only read of any text
gate.readText("I couldn't find any record of that company.");
// { verdict: "OFF_MAP", band: "off-map", instrument: "words", ... }

// 2) read a chat.completions response (request logprobs yourself)
const verdict = gate.readResponse(response);

// 3) wrap an openai client (openai>=4) — logprobs requested automatically, verdict on response.aperture
import OpenAI from "openai";
const client = gate.wrap(new OpenAI());
const r = await client.chat.completions.create({ model: "gpt-4o-mini", messages });
console.log(r.aperture.verdict);

// 4) gate a STREAM in real time — the verdict lands before the answer finishes, and can abort it
const client2 = gate.wrap(new OpenAI(), v => v.verdict === "OFF_MAP");   // onVerdict -> truthy aborts
const stream = await client2.chat.completions.create({ model: "gpt-4o-mini", messages, stream: true });
for await (const chunk of stream) {
  process.stdout.write(chunk.choices[0]?.delta?.content ?? "");   // stops early if it reads off-map
}
console.log(stream.aperture);   // scored on the first `window` tokens

The verdict

{ verdict, band, instrument, score, refused, hedge, matched, model, expired, signature_verified, n_tokens, n_scored }

instrument is "words" (a refusal won), "fingerprint" (the logprob probe scored it), or "words-only" (no logprobs were available). expired rides every verdict.

Notes

  • Certificates are ed25519-signed. The Python SDK verifies signatures against the registry's pinned key (pip install 'aperture-gate[verify]'). JS signature verification is a roadmap item — this package surfaces signature_verified: null rather than claim a check it didn't perform.
  • Full method, evidence, and the certificate registry: honesty.tools/docs.