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/agent-transaction-audit-schema

v0.1.0

Published

Canonical, protocol-agnostic audit record for agent payments. Normalizes x402/MPP/AP2 into one schema and validates it. Zero runtime deps.

Readme

@harpd/agent-transaction-audit-schema

A canonical, protocol-agnostic audit record for agent payments. Every payment an agent makes or receives — over x402, MPP, or AP2 — should reduce to one AuditRecord, so dashboards, alerts, and compliance reports all agree. Comes with normalizePayment() (convert any protocol into the canonical shape) and validateAuditRecord() (a tiny, zero-dependency validator).

Part of Harpd's open-source agent-commerce toolkit. Pairs with @harpd/x402-logging-middleware (the event shape is compatible) and @harpd/mcp-paid-tool-starter (emit an audit record when a paid tool runs).

Install

npm install @harpd/agent-transaction-audit-schema

Normalize any protocol into one record

import { normalizePayment } from '@harpd/agent-transaction-audit-schema'

// x402
const rec = normalizePayment({
  protocol: 'x402',
  direction: 'outbound',
  actor: { id: 'weather-agent', type: 'agent' },
  counterparty: { id: 'paid-weather-api', type: 'service' },
  raw: { accepts: [{ asset: 'eip155:8453/erc20:0xUSDC', price: '10000' }], payment: { asset: 'eip155:8453/erc20:0xUSDC', amount: 10000, transaction: '0xabc' } },
  status: 'settled',
})

// MPP / AP2 work the same way — pass protocol: 'mpp' | 'ap2' and the raw payload.

Validate before you store

import { validateAuditRecord, AUDIT_RECORD_SCHEMA } from '@harpd/agent-transaction-audit-schema'

const result = validateAuditRecord(rec)
if (!result.ok) {
  console.error('dropped bad audit record:', result.errors)
}

The schema requires: id, protocol (x402|mpp|ap2|other), direction (outbound|inbound), actor.id, counterparty.id, asset, amount, status, timestamp. amountUnit is one of usd|micro-usd|wei|raw.

Why a shared schema

Agent payments are fragmented across protocols, each with its own wire format. Without a canonical record, every consumer re-implements parsing and they drift apart — one service counts micro-usd, another usd, audits silently disagree. This package is the single source of truth; the Harpd collector and dashboard are built on exactly this shape.

License

MIT © Harpd. Issues and PRs welcome at github.com/harpd-dev/agent-transaction-audit-schema.