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

@pot-sdk2/x402

v0.1.0

Published

ThoughtProof decision verification hook for x402 payments — verifies whether an agent's payment decision is well-justified before settlement

Readme

@pot-sdk2/x402

Decision verification hook for x402 payments — verifies whether an agent's payment decision is well-justified before settlement executes.

npm License: MIT

The Problem

x402 enables AI agents to pay for services autonomously. The facilitator verifies that the payment is valid (correct signature, sufficient balance, right network).

But nobody verifies whether the decision to pay was well-justified.

An agent can authorize a perfectly valid payment for a service it doesn't need, at a price it shouldn't accept, based on reasoning that wouldn't survive scrutiny.

The Solution

@pot-sdk2/x402 adds a beforeSettle hook to the x402 facilitator that runs ThoughtProof decision verification before settlement executes.

  • Payment valid + decision strong → settle
  • Payment valid + decision weak → hold

Install

npm install @pot-sdk2/x402 pot-sdk @x402/core

Quick Start

import { createThoughtProofHook } from '@pot-sdk2/x402';
import { x402Facilitator } from '@x402/core/facilitator';
import { registerExactEvmScheme } from '@x402/evm/exact/facilitator';

const facilitator = new x402Facilitator();

// Register your payment scheme
registerExactEvmScheme(facilitator, {
  signer: evmSigner,
  networks: 'eip155:8453', // Base
});

// Add ThoughtProof decision verification before settlement
facilitator.onBeforeSettle(createThoughtProofHook({
  providers: [
    { name: 'anthropic', model: 'claude-sonnet-4-20250514', apiKey: process.env.ANTHROPIC_API_KEY! },
    { name: 'deepseek', model: 'deepseek-chat', apiKey: process.env.DEEPSEEK_API_KEY! },
  ],
  stakeLevel: 'medium',      // micro | low | medium | high | critical
  classifyMateriality: true,  // only block on material defects
  debug: true,
}));

// Now settlement includes decision verification
const verifyResult = await facilitator.verify(paymentPayload, requirements);
if (verifyResult.isValid) {
  // This will run ThoughtProof verification before settling
  const settleResult = await facilitator.settle(paymentPayload, requirements);
}

Auto-Stake Detection

Don't want to set stake levels manually? Use createAutoStakeHook — it detects the payment amount and adjusts skepticism automatically:

import { createAutoStakeHook } from '@pot-sdk2/x402';

facilitator.onBeforeSettle(createAutoStakeHook({
  providers: [...],
  classifyMateriality: true,
}));

// $2.50 → micro (threshold 0.40, only material defects block)
// $149  → medium (threshold 0.60, proportional review)
// $5000 → critical (threshold 0.85, full adversarial)

Stake Levels

| Level | Threshold | Critic Mode | Example | |-------|-----------|-------------|---------| | micro | 0.40 | Proportional — material defects only | $2.50 API batch | | low | 0.50 | Proportional — material defects + basic logic | $50 data purchase | | medium | 0.60 | Proportional — reasoning quality + evidence | $500 vendor selection | | high | 0.75 | Adversarial — full skepticism | $5K settlement | | critical | 0.85 | Adversarial — maximum scrutiny | $50K+ / regulated |

How It Works

Agent decides to pay
        ↓
x402 facilitator.verify() — payment valid?
        ↓
x402 facilitator.settle() — execute payment
        ↓
    [beforeSettle hook]
        ↓
ThoughtProof runs multi-model adversarial verification:
  - Is the payment amount proportional to the service?
  - Is there a material defect in the decision reasoning?
  - Would a competent reviewer change this decision?
        ↓
  confidence >= threshold → SETTLE (payment executes)
  confidence < threshold  → HOLD (payment blocked with reason)

Monitoring

facilitator.onBeforeSettle(createThoughtProofHook({
  providers: [...],
  onVerification: (result) => {
    console.log(`Decision: ${result.allowed ? 'ALLOW' : 'HOLD'}`);
    console.log(`Confidence: ${result.confidence}`);
    console.log(`Duration: ${result.durationMs}ms`);
    if (result.materiality) {
      console.log(`Material defects: ${result.materiality.materialCount}`);
    }
    // Send to your monitoring / analytics
  },
}));

The Payment Trust Stack

Identity      → Visa TAP / ERC-8004
Authorization → Mastercard Verifiable Intent
Risk          → t54 / fraud scoring
Decision      → ThoughtProof (@pot-sdk2/x402)  ← you are here
Execution     → x402 facilitator / settlement

Requirements

  • @x402/core >= 2.0.0
  • pot-sdk >= 1.1.0
  • At least 2 LLM provider API keys (for multi-model verification)

License

MIT — ThoughtProof Protocol