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

agentscore-gate

v1.0.0

Published

Trust gate middleware for x402 services — check agent reputation before serving

Readme

@agentscore/gate

Trust gate middleware for x402 services. Check an AI agent's reputation score before serving requests.

AgentScore is the credit scoring system for the agent economy. Every x402 transaction is indexed, every wallet is scored, and any service can gate access based on trust.

Quick Start

npm install @agentscore/gate
const express = require('express');
const { trustGate } = require('@agentscore/gate');

const app = express();

// Reject agents with score below 50
app.use(trustGate({ minScore: 50 }));

app.get('/api/data', (req, res) => {
  console.log(req.agentScore); // { score: 87, grade: 'A', ... }
  res.json({ data: 'trusted response' });
});

That's it. Five lines to add trust gating to any x402 service.

How It Works

  1. Agent makes a request to your service
  2. Middleware extracts the agent's wallet address
  3. Checks their AgentScore (cached, sub-millisecond after first lookup)
  4. Allows, warns, rate-limits, or rejects based on your threshold

Options

trustGate({
  minScore: 50,          // Minimum score (0-100). Default: 0
  action: 'reject',      // 'reject' | 'warn' | 'log' | 'rate-limit'
  apiKey: 'your-key',    // API key for production (recommended)
  cacheTtlMs: 300000,    // Cache TTL: 5 min default
  failOpen: true,        // Allow if score lookup fails
  allowUnknown: true,    // Allow agents with no history
  unknownScore: 25,      // Score for unknown agents
  onBlock: (req, score, reason) => {
    console.log(`Blocked: ${score?.address} (${reason})`);
  },
})

Actions

| Action | Behavior | |--------|----------| | reject | Returns 403 with score details and improvement guidance | | warn | Allows request, adds X-AgentScore-Warning header | | log | Allows request, logs low-score agents to console | | rate-limit | Allows request, adds rate-limit reduction headers |

Direct Score Lookup

const { getScore, checkTrust } = require('@agentscore/gate');

// Get full score details
const score = await getScore('0xABC...');
console.log(score.grade); // 'A+'

// Simple trust check
const { allowed } = await checkTrust('0xABC...', 60);

Scoring

AgentScore uses a 6-factor model based on on-chain x402 transaction history:

  • Reliability (25%) — Success rate
  • Volume (15%) — Transaction count
  • Consistency (20%) — Regular activity pattern
  • Diversity (15%) — Unique counterparties
  • Recency (15%) — How recently active
  • Tenure (10%) — Time in ecosystem

Grades: A+ (95+), A (85+), A- (75+), B+ (65+), B (55+), B- (45+), C+ (35+), C (25+), D (15+), F (<15)

Response Headers

When an agent passes the gate, these headers are added:

  • X-AgentScore — Numeric score (0-100)
  • X-AgentScore-Grade — Letter grade

Rejection Response

When an agent is blocked:

{
  "error": "Insufficient agent reputation",
  "score": 32,
  "grade": "C+",
  "required": 50,
  "message": "This service requires a minimum AgentScore of 50.",
  "checkYourScore": "https://agentscore.sh/score/0xABC..."
}

Zero Dependencies

This package has no dependencies. It uses native fetch (Node 18+).


AgentScore — by Pylon AI | Website | API Docs