@agenticprimitives/agreements

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

Commitment-only AgreementRegistry SDK. Owns AgreementCredential shape (PD-22) + commitment math + bilateral status transitions + joint-assertion gateway.

原始使用文档
文档目录4 节
  1. What ships today
  2. How it's different
  3. Status
  4. Build

@agenticprimitives/agreements

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

Two agents strike a deal. The chain should be able to prove the deal existed and how it ended — without ever learning what it was. Most on-chain agreement records leak by design: parties, terms, schedules, all readable forever. This package is the SDK for AgreementRegistry.sol, a commitment-only registry — the chain stores keccak commitments over the party set, issuer, terms, and schedule, plus a status machine (ACTIVE → COMPLETED / DISPUTED / REVOKED). The human-readable agreement is a W3C verifiable credential held off chain by the parties; the chain holds only enough to anchor and adjudicate it.

Status transitions are as strict as registration is private: the contract recomputes the transition digest from the commitment, target status, and nullifier on chain, and requires party signatures over that recomputed value — never a caller-supplied hash, and never an issuer-only revoke.

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

The W1 foundational slice — commitment math, typehashes, and payload shapes the contract relies on:

  • Commitment math — computeAgreementCommitment(...) (spec 241 §3), partySetCommitment(party1, party2), issuerCommitment(issuer), bytesCommitment(value) for terms/schedule hashes.
  • STATUS — discriminators matching AgreementRegistry.STATUS_* (NONE / ACTIVE / COMPLETED / DISPUTED / REVOKED).
  • TRANSITION_TYPEHASH + transitionDigest(...) — the digest parties sign for a status transition. updateStatus recomputes it on chain (RW1-3, ADR-0027); chainId and the registry address are bound against cross-chain replay (AGR-1).
  • AGREEMENT_ISSUER_TYPEHASH + issuerAttestationDigest(...) — the issuer's registration attestation, recomputed and verified on chain (SC-1).
  • nullifierFor(...) — per-transition one-shot nullifier derivation.
  • Payload shapes — AgreementIssuancePayload, StatusUpdatePayload (including the RW1-2 revealed-party fields the contract uses to recompute the commitment and check each signer is a party).

Every typehash MUST byte-equal its AgreementRegistry.sol constant — enforced by the cross-stack check:eip712-typehash-equality CI gate.

Planned for later waves per the W1 implementation wave plan: the AgreementCredential shape (PD-22), AgreementRegistryClient read client, and the joint-assertion gateway helper that lets attestations verify an agreement back-pointer before asserting on it.

How it's different

Against EAS-style attestation registries and e-signature platforms:

  1. Commitment-only on chain. No party addresses, no terms, no schedule in register(...) calldata — a static-analysis regression test enforces it (AR-12). Even timestamps are epoch-bucketed (spec 241 §3.4). Attestation registries publish the claim; this registry publishes only its shadow.
  2. The chain recomputes; it never trusts. Transition digests and issuer attestations are recomputed on chain from revealed components — a leaked signature cannot be replayed against a different agreement, status, chain, or registry deployment.
  3. No issuer-only exit. Completion, dispute, and revocation follow the bilateral / either-party matrix of spec 241 §5.4.1. The issuer who notarized the agreement cannot unilaterally kill it (D-18).
  4. Contracts and SDK are one artifact. Typehash parity is CI-gated, so the client cannot drift from the chain — the failure mode that quietly breaks stitched signing stacks.

Status

Foundational (W1) — code shipped; not production enforcement. The commitment math, typehashes, and payload shapes above are real and gate-checked; the credential shape, read client, and gateway land in Wave 4 per the wave plan. See AUDIT.md.

Testnet/pilot-ready. Production launch is gated on the public checklist in the root README — including third-party contract audit and governance key rotation. Track every security finding live in docs/audits/findings.yaml.

Owns spine layers: layer 8. Authoritative spec: specs/241-agreement-commitment-registry.md — see spec.md for the symlink. Bounded surface: CLAUDE.md + capability.manifest.json.

Build

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

版本与发布记录

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

版本发布日期距今
0.0.0-alpha.43latest2026/10/2610 天前
0.0.0-alpha.422026/10/2610 天前
0.0.0-alpha.412026/10/1720 天前
0.0.0-alpha.402026/10/1720 天前
0.0.0-alpha.392026/10/1620 天前
0.0.0-alpha.382026/10/1620 天前

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

关于 @agenticprimitives/agreements 的常见问题

@agenticprimitives/agreements 是什么?

Commitment-only AgreementRegistry SDK. Owns AgreementCredential shape (PD-22) + commitment math + bilateral status transitions + joint-assertion gateway.

如何安装 @agenticprimitives/agreements?

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

@agenticprimitives/agreements 支持 TypeScript 吗?

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

@agenticprimitives/agreements 支持 ESM 还是 CommonJS?

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

@agenticprimitives/agreements 可以商用吗?

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

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

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

@agenticprimitives/agreements 还在维护吗?

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