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

@pyco404/agentrail

v0.1.0

Published

A policy engine that sits between an AI agent's payment intent and a signature on Solana — spend caps, allowlists, rate limits, a kill switch, and idempotent reservation/settlement. Run it yourself; you hold the keys.

Readme

AGENTRAIL

Contract Address for $AGENTRAIL:

55VUfgxibnUCYY9eY3jGoiHWB6Uuat3uddLVtVpjXi5A

A policy engine that sits between an AI agent's payment intent and the signature that sends it on Solana — evaluating every request against limits its human owner set, before any money moves.

This is a library, not a service. You install it, run it in your own process, hold your own keys, and fund your own wallets. Nothing here ever touches your money on our behalf. (A hosted version is planned — see Status — but it doesn't exist yet, and won't hold real funds until custody moves off the local keystore described below.)

What it actually does

Every payment goes through the same path, whether it's called directly or via the demo agent's x402 pay-per-call flow:

  1. An agent submits a payment intent (token, amount, payee, an idempotency key).
  2. The policy engine evaluates it — kill switch, token/payee allowlists, per-transaction and rolling-window and lifetime caps, rate limits, time windows, escalation thresholds — and either allows it, denies it with a specific reason, or routes it to a human for approval.
  3. An allowed intent is reserved (budget held) before anything is signed.
  4. The signer signs — or refuses, if the kill switch was thrown in the meantime — and the transaction is submitted to Solana.
  5. The reservation resolves to settled (confirmed on-chain) or released (failed, expired, or denied), never left ambiguous.

docs/operations.md documents the on-call-facing edges of this — the idempotency-key state machine, why the kill switch can't recall a transaction already on the wire, and the runbook for a stuck reservation — worth reading before you build anything that retries payments.

Install

Not on the npm registry yet — see Status. Once published:

npm install @pyco404/agentrail
import { evaluate, evaluateAndReserve, InMemoryReservationStore } from '@pyco404/agentrail';

@pyco404/agentrail ships the core types, the pure policy engine, the reservation/idempotency layer, the chain submission path, and LocalKeyProvider (an encrypted-at-rest local keystore). It does not pull in pg/drizzle-orm — the Postgres-backed store is opt-in, for anyone who wants durable reservations across process restarts; InMemoryReservationStore is enough to get started.

See it pay for something, in 2 minutes

The fastest way to understand the whole path is to watch it happen. src/agent/ is a small demo agent that pays a local x402-gated endpoint per call, on Solana devnet, with a real (worthless, devnet-only) SPL token — real policy checks, real signing, real on-chain settlement, not a simulation.

git clone https://github.com/pyco404/agent-rail
cd agent-rail
npm install

export WALLET_KEYSTORE_PASSPHRASE=$(openssl rand -base64 32)
npm run demo:setup   # provisions a demo mint + two devnet wallets, funds them
npm run demo          # runs the pay-per-call loop

It pays a few times, then hits a real policy denial once its lifetime cap is spent. Press k while it's running to engage the kill switch live and watch the next call get refused before it ever reaches the signer.

A minimal example

import { evaluate } from '@pyco404/agentrail';

const verdict = evaluate(policy, intent, history, new Date());
// { type: 'allow' }
// { type: 'requiresApproval' }
// { type: 'deny', reason: { code: 'per_transaction_cap_exceeded', token, cap } }

evaluate() is pure — a policy, an intent, spend history, and a clock in, exactly one decision out, no I/O. Reserving budget against a wallet's real, persisted history goes through evaluateAndReserve() instead, which wraps the same evaluation in the wallet's transaction lock.

Status

What's actually built, not aspirational — kept honest at agent-rail.xyz/status. Short version: the policy engine, chain submission path, and local signer are built and tested; this npm package (@pyco404/agentrail) is in progress — not yet published to the registry; a hosted HTTP service is planned but not started.

License

MIT — see LICENSE.