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

@q3labs/pact-monitor

v0.3.0

Published

TypeScript SDK that wraps fetch() to monitor AI agent API reliability and sync call records to the Pact Network scorecard.

Readme

@q3labs/pact-monitor

TypeScript SDK that wraps fetch() to monitor AI agent API reliability and sync call records to the Pact Network scorecard.

Pact Network is a parametric micro-insurance system for AI agent API payments on Solana. The monitor SDK is the data source: it observes real API calls your agent makes, classifies each one as success / timeout / error / schema_mismatch, captures x402/MPP payment metadata when present, and ships the records to the backend so the network can compute actuarially-derived insurance rates for every provider.

Install

npm install @q3labs/pact-monitor

Quick start

import { pactMonitor } from "@q3labs/pact-monitor";

const monitor = pactMonitor({
  apiKey: process.env.PACT_API_KEY,
  // backendUrl defaults to https://pactnetwork.io
});

const res = await monitor.fetch("https://api.example.com/v1/data", {
  method: "GET",
});

const json = await res.json();

The SDK is a drop-in replacement for fetch(). If syncing to the backend fails, the wrapped fetch still returns normally — your agent never breaks because of monitoring.

With schema validation

const res = await monitor.fetch(
  "https://api.example.com/v1/data",
  { method: "GET" },
  {
    expectedSchema: { type: "object", required: ["id", "value"] },
  },
);

Responses that don't match are classified as schema_mismatch.

With x402 / MPP payment extraction

If the response carries x402 or MPP headers (X-Payment-*), the SDK extracts the payment metadata (amount, asset, network, tx hash, settlement status) and includes it in the call record automatically.

Configuration

pactMonitor({
  apiKey: "...",                    // required for sync
  backendUrl: "https://pactnetwork.io",
  syncEnabled: true,
  syncIntervalMs: 30_000,
  syncBatchSize: 50,
  latencyThresholdMs: 30_000,       // classify as timeout above this
  storagePath: ".pact/records.jsonl",
  keypair: { publicKey, secretKey },  // for signed records
});

See src/types.ts for the full option and record shapes.

How records are signed

When a keypair is provided, each batch sent to the backend is Ed25519-signed via tweetnacl and base58-encoded with bs58. The backend verifies the signature against the registered agent public key. See src/signing.ts for the exact payload format.

License

MIT — see LICENSE.