@agenticprimitives/account-custody

中文文档
1.0.0-alpha.46发布于 2026/10/26MITTypeScriptES Module零依赖近 30 天下载 2481

Custody-layer SDK: CustodyPolicy ABI, CustodyAction enum + arg builders, EIP-712 typed-data helpers, and Custodian/Trustee/CustodyCouncil types. Speaks custody-domain vocabulary only — no delegation / steward / caveat concepts (those belong in @agenticpri

原始使用文档
文档目录6 节
  1. Install
  2. Use
  3. How it's different
  4. Boundary
  5. Validate
  6. Status

@agenticprimitives/account-custody

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

Custody is not authority.

Most stacks blur the two: the key that lets an agent act is also the key that controls the account, so a leaked session becomes a lost identity. This package exists to keep them apart. Credential add, replace, and remove on a Smart Agent are custody-policy operations — gated by trustee quorums, guardian quorums, multi-credential self-recovery, or multi-sig — and are never modeled as delegations (ADR-0011, spec 221). A delegated party can act within its caveats; it can never promote itself into custody.

The payoff is recovery without identity loss. CustodyAction.RecoverAccount performs an atomic add-new + remove-old credential rotation under the account's custody policy. The canonical Smart Agent address never changes; every delegation it ever issued stays valid; only the credential set moves. This package is the TypeScript surface for that machinery: the CustodyPolicy ABI, CustodyAction argument builders, EIP-712 typed data, quorum signature packing, and the custody-domain types.

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.

Install

pnpm add @agenticprimitives/account-custody

Use

import {
  CustodyAction,
  buildRecoverAccountArgs,
  custodyDomain,
  packQuorumSigs,
} from '@agenticprimitives/account-custody';

What you get:

  • custodyPolicyAbi — the ABI for the on-chain CustodyPolicy ERC-7579 module (packages/contracts/src/custody/CustodyPolicy.sol), kept in lockstep with the deployed bytecode.
  • CustodyAction enum (a mirror of the on-chain enum) plus per-action buildXxxArgs encoders — including buildRecoverAccountArgs for credential rotation.
  • EIP-712 typed-data shapes for ScheduleCustodyChangeRequest / ApplyCustodyChangeRequest / CancelScheduledChangeRequest, with custodyDomain({ chainId, verifyingContract }) — guaranteed to hash to the same structHash the Solidity computes.
  • Quorum signature packing (packQuorumSigs) and custody-domain types: Custodian, Trustee, CustodyCouncil, ScheduledChange, CustodyMode, RiskTier.

How it's different

The common pattern for org control and recovery is a third-party multi-sig (Safe) plus a separate recovery product (Argent-style guardians) bolted onto an account they don't define. That works until the seams matter: the multi-sig's notion of "owner" and the recovery product's notion of "guardian" are different identity models, and neither knows about the delegations the account has issued. Here custody is a native ERC-7579 module on the same Smart Agent — quorums, trustees, scheduled changes, and recovery in one policy, designed alongside the delegation layer it explicitly firewalls (spec 213). No third-party multi-sig dependency; we ported the signature-packing patterns worth porting and own the rest.

Boundary

This package speaks custody vocabulary only:

  • Custodian
  • Trustee
  • CustodyCouncil
  • CustodyAction
  • ScheduledChange

It does not own delegation caveats, MCP transport, passkey ceremonies, account deployment, or key-custody providers (note: key-custody is key custody — KMS backends; this is account custody). See CLAUDE.md for routing and spec.md for the contract.

Validate

pnpm --filter @agenticprimitives/account-custody typecheck
pnpm --filter @agenticprimitives/account-custody test

Status

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.

版本与发布记录

@agenticprimitives/account-custody 共发布 45 个版本,首次发布于 2026/06/01;过去 12 个月发布了 45 个版本。

版本发布日期距今
1.0.0-alpha.46latest2026/10/2612 天前
1.0.0-alpha.452026/10/2612 天前
1.0.0-alpha.442026/10/1721 天前
1.0.0-alpha.432026/10/1722 天前
1.0.0-alpha.422026/10/1622 天前
1.0.0-alpha.412026/10/1622 天前

其他发布通道:alpha → 0.1.0-alpha.2。

关于 @agenticprimitives/account-custody 的常见问题

@agenticprimitives/account-custody 是什么?

Custody-layer SDK: CustodyPolicy ABI, CustodyAction enum + arg builders, EIP-712 typed-data helpers, and Custodian/Trustee/CustodyCouncil types. Speaks custody-domain vocabulary only — no delegation / steward / caveat concepts (those belong in @agenticpri

如何安装 @agenticprimitives/account-custody?

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

@agenticprimitives/account-custody 支持 TypeScript 吗?

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

@agenticprimitives/account-custody 支持 ESM 还是 CommonJS?

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

@agenticprimitives/account-custody 可以商用吗?

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

@agenticprimitives/account-custody 的下载量有多少?

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

@agenticprimitives/account-custody 还在维护吗?

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