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

@harpd/observe

v1.1.0

Published

Harpd x402 V2 observability + budget-control SDK for agent payments — the 4 lifecycle hooks, sitting above any Facilitator.

Readme

@harpd/observe

The x402 V2 observability + budget-control extension for Harpd — the neutral observability & control layer for agent payments, sitting above any Facilitator.

Zero runtime dependencies. Runs in Node and the browser.

What it does

Registers the 4 x402 V2 lifecycle hooks and forwards every payment event to a Harpd collector. Harpd never touches funds or signing keys; it only observes and, when budgetControl is on, makes a pre-payment allow/deny decision.

| Hook | Purpose | |------|----------| | before-payment | Records intent; if budgetControl, returns the collector's atomic budget decision | | after-payment | Records the payment event (amount, endpoint, agent, txHash, facilitator) | | before-settlement | Records settlement intent | | after-settlement | Records settlement result + triggers read-only on-chain verification |

Usage

import { harpdPlugin, simulatePayment } from '@harpd/observe'

const plugin = harpdPlugin({
  apiKey: 'harpd_live_xxx',
  endpoint: 'https://collector.harpd.workers.dev',
  budgetControl: true, // Phase 1 — block at the pre-payment hook
})

// In a real x402 V2 client, register `plugin` with your SDK:
//   const client = new x402.Client({ facilitator: 'coinbase', plugins: [plugin] })
//   await client.fetch('https://api.example.com/premium-data')

// Without a live Facilitator, drive the hooks in payment order:
await simulatePayment(plugin, {
  agentId: 'agent-1',
  url: 'https://api.example.com/premium-data',
  amount: 1_000_000, // USDC 6dp → $1.00
  asset: 'eip155:8453/erc20:0xusdc',
  chain: 'eip155:8453',
  txHash: '0xconfirmed_abc',
  facilitator: 'coinbase',
  settlementStatus: 'confirmed',
})

Server side

import { harpdServerPlugin } from '@harpd/observe'

const serverPlugin = harpdServerPlugin({
  apiKey: 'harpd_live_xxx',
  endpoint: 'https://collector.harpd.workers.dev',
})
// Register with your x402 V2 server middleware (e.g. @x402/paywall plugins).

Strict control-plane settlement

Use settlePayment when every settlement must pass through Harpd policy, budget, idempotency, facilitator verification and the commercial ledger:

import { settlePayment } from '@harpd/observe'

await settlePayment({ apiKey: 'harpd_live_xxx', endpoint: 'https://api.harpd.com' }, {
  agentId: 'agent-1', url: 'https://api.example.com/premium-data',
  amount: 1_000_000, asset: 'eip155:8453/erc20:0xusdc', chain: 'eip155:8453',
  idempotencyKey: 'order-123',
})

Direct after-settlement ingest is rejected in production; use this method or POST /v1/gateway/settle instead.

Contract

  • Events POST to {endpoint}/v1/events as a JSON array, authenticated by the X-Harpd-Key header.
  • The pre-payment budget decision comes from GET {endpoint}/v1/budget/check.
  • After settlement, POST {endpoint}/v1/verify-onchain triggers read-only eth_getTransactionReceipt verification + reconciliation.

See harpd/v2 for the collector (Cloudflare Worker + D1 + Drizzle).