@agenticprimitives/payments

中文文档
0.0.0-alpha.42发布于 2026/10/26MITTypeScriptES Module近 30 天下载 4644

PaymentMandate + ContextBinding + MandateConstraints + open/closed mode discrimination. Three W1 rails (x402, wallet, sponsored-userop). PaymentReceipt asserted into AttestationRegistry per ADR-0023.

原始使用文档
文档目录5 节
  1. What ships today
  2. What lands in Wave 6 (designed, not shipped)
  3. Where this is heading / market context
  4. Build
  5. Status — honest version

@agenticprimitives/payments

Part of Agentic Primitives — the open-source trust substrate for agentic applications: identity that can sign, authority checked at act time, evidence the owner carries. Developer kit · All packages

Status: STUB (Wave 0.5 of the W1 implementation wave). Typed primitives and invariant guards ship today; the EIP-712 mandate signer and the three W1 rails land in Wave 6 per the w1 implementation wave plan. A recent self-audit flagged this package's docs for overclaiming (NEW-PMT-1); this README is written to the actual surface.

Machine payments arrived. x402 made HTTP-native pay-per-request real; Google's AP2 defined mandates for agent-initiated spend. What neither ships — what nobody ships — is machine payments scoped by the same delegation, custody, and audit substrate that governs everything else the agent does. "This agent may spend up to this amount, for this task, on this rail, until Friday — signed by a smart account, bound to the work it pays for, receipted into an attestation registry" is the combination the agent economy actually needs, and it only exists when payments are a layer of one system rather than a bolted-on rail.

This package is the designed payments slice of that substrate — spine Layer 9b, the PaymentMandate — spec'd in full, scaffolded now, landing in the implementation waves.

Part of agenticprimitives — the trust substrate for the agent economy: one canonical Smart Agent identity with custody, delegation, naming, credentials, and audit evidence designed as one system.

What ships today

Typed primitives and pure invariant guards — no signing, no execution, no money moves:

  • PaymentMandate type — payer, payee, granter, rail, AmountPolicy (exact / range / formula), maxRedemptions, validity window, mode, and an optional delegationRef linking the mandate to the delegation that authorized it.
  • ContextBinding + assertContextBindingValid — PMT-3.1 enforced: every mandate must bind to at least one of intent / agreement / task / artifact / HTTP resource. No context-free spend.
  • MandateConstraints — AP2-aligned aggregate scope: cumulative caps, redemption frequency windows, category allow/deny, geo-fencing.
  • Open/closed mode discrimination + assertClosedMandateInvariants — PMT-INV-14 enforced: a closed (final-charge) mandate is always one-shot.
  • computeMandateId — deterministic keccak-256 mandate identity over payer + nonce + rail + chain.
  • PaymentRailExecutor interface + registerRail / getRail — the extension point every rail (current and future, including the reserved confidential family) implements.

What lands in Wave 6 (designed, not shipped)

The EIP-712 typed-data builder, SA signing and ERC-1271 verification (no raw EOA signatures — PMT-INV-12), redeemPaymentMandate, and the three W1 rails: rails/wallet (SA-to-SA transfer via UserOp), rails/x402 (HTTP-native per x402.org + reference facilitator), and rails/sponsored-userop (paymaster-sponsored, no value moved). Plus PaymentReceipt — an immutable, non-revocable credential asserted into the attestation registry per ADR-0023, so every redemption leaves first-class evidence. Confidential rails (Aztec-style, Zcash-style, ZK paymasters) are a reserved W2 sub-module family.

Where this is heading / market context

  • x402 proved HTTP-native machine payments; it is one of our three W1 rails, not a competitor.
  • Google AP2 defined mandate semantics for agent spend; MandateConstraints is deliberately AP2-aligned so the substrate speaks the emerging lingua franca.
  • The gap both leave open: x402 and AP2 authorize a payment; neither anchors it to a canonical on-chain identity with custody policy, a revocable delegation chain, and an audit trail behind it. Delegation-scoped machine payments — mandate references delegation, delegation references the Smart Agent, every step receipted — is the combination this layer exists to ship.

Authoritative spec: spec 243 — payments (see spec.md). Owns spine layer 9b; bounded surface in CLAUDE.md and capability.manifest.json.

Build

pnpm --filter @agenticprimitives/payments typecheck
pnpm --filter @agenticprimitives/payments test
pnpm --filter @agenticprimitives/payments build

Status — honest version

STUB. Nothing here signs or settles a payment today; treat the rails and the EIP-712 surface as spec'd commitments. The audit finding that this package's docs once claimed more (NEW-PMT-1) is public — transparency about the gap is the point. Wave sequencing: w1-implementation-wave-plan.md.

版本与发布记录

@agenticprimitives/payments 共发布 40 个版本,首次发布于 2026/06/11;过去 12 个月发布了 40 个版本。

版本发布日期距今
0.0.0-alpha.42latest2026/10/2612 天前
0.0.0-alpha.412026/10/2612 天前
0.0.0-alpha.402026/10/1721 天前
0.0.0-alpha.392026/10/1722 天前
0.0.0-alpha.382026/10/1622 天前
0.0.0-alpha.372026/10/1622 天前

其他发布通道:alpha → 0.0.0-alpha.3。

关于 @agenticprimitives/payments 的常见问题

@agenticprimitives/payments 是什么?

PaymentMandate + ContextBinding + MandateConstraints + open/closed mode discrimination. Three W1 rails (x402, wallet, sponsored-userop). PaymentReceipt asserted into AttestationRegistry per ADR-0023.

如何安装 @agenticprimitives/payments?

在项目目录运行 npm install @agenticprimitives/payments,或使用 pnpm add / yarn add / bun add。它还需要宿主项目提供 peer 依赖:viem(^2.52.2)。npm 7 及以上与 pnpm 8 及以上默认会自动安装必需的 peer 依赖,Yarn 需要手动安装。

@agenticprimitives/payments 支持 TypeScript 吗?

支持。包内自带 TypeScript 类型声明(package.json 声明了 types 入口),安装后即可获得类型提示,无需再安装 @types 包。

@agenticprimitives/payments 支持 ESM 还是 CommonJS?

以 ES Module 形式发布,推荐使用 import 引入。在 CommonJS 项目中,Node.js 20.19+ / 22.12+ 可以直接 require() 不含顶层 await 的 ES Module,更早的版本需要改用动态 import()。

@agenticprimitives/payments 可以商用吗?

@agenticprimitives/payments 使用 MIT 许可。宽松许可:允许商业使用、修改和再分发,通常只需在分发时保留原版权与许可声明。以上为概括,不构成法律意见,请以许可原文为准。

@agenticprimitives/payments 的下载量有多少?

根据 npm 官方下载统计,@agenticprimitives/payments 在 2026/10/05 – 2026/11/03 这 30 天内被下载 4,644 次,日均约 155 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入,适合横向比较热度,不能直接等同于使用人数。

@agenticprimitives/payments 还在维护吗?

最新版本 0.0.0-alpha.42 发布于 2026/10/26(12 天前);至今共发布 40 个版本,其中过去 12 个月发布了 40 个;首次发布于 2026/06/11。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。