@agenticprimitives/agent-account

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

ERC-4337 smart-account substrate: deterministic addressing, factory deployment, ERC-1271 signing, UserOp building.

原始使用文档
文档目录13 节
  1. Use This When
  2. Do Not Use This For
  3. Install
  4. 60-Second Quickstart
  5. Main Concepts
  6. Common Recipes
  7. How it's different
  8. Runtime Support
  9. Security Invariants
  10. Documentation Map
  11. Validation
  12. Status
  13. License

@agenticprimitives/agent-account

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

The address IS the identity.

Every person, organization, service agent, and treasury in this stack is an ERC-4337 Smart Agent address (0x… / CAIP-10 eip155:<chainId>:<address>). Not a username with a wallet attached — the address itself is the canonical identity, and everything else (names, passkeys, profiles, registry entries) is a replaceable facet pointing at it. This package is where that anchor comes from: it derives the address counterfactually, deploys the account, builds UserOperations, and verifies ERC-1271 signatures.

That design choice has a consequence most smart-account SDKs cannot offer: the CREATE2 salt derives from auth methods and user scope — never from a name, never from credential material (ADR-0010, spec 220). Lose a passkey, rotate a signer, change your name — the address never moves, and every delegation it ever issued stays valid (ADR-0011).

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.

Use This When

  • You need counterfactual or deployed Smart Agent addresses (CREATE2 factory).
  • You need createAccount, isDeployed, buildUserOp, or ERC-1271 verify paths.
  • You need bundler helpers (BundlerClient, packed UserOp gas fields).
  • You need quorum / admin payload hashing for custody-gated account actions.

Do Not Use This For

  • Passkey ceremonies, SIWE, OAuth, or JWT sessions → connect-auth.
  • .agent name registration or resolution → agent-naming.
  • AgentCard profiles or endpoint verification → agent-profile.
  • Custodian enrollment, credential recovery, or quorum scheduling → account-custody.
  • Delegation tokens or session authority → delegation.

Install

Workspace-internal; not yet published.

pnpm add @agenticprimitives/agent-account

60-Second Quickstart

import { AgentAccountClient } from '@agenticprimitives/agent-account';
import { deriveSaltFromEmail } from '@agenticprimitives/connect-auth';
import type { Signer } from '@agenticprimitives/connect-auth';

const account = new AgentAccountClient({
  rpcUrl: process.env.RPC_URL!,
  chainId: 84532,
  entryPoint: process.env.ENTRYPOINT_ADDRESS as `0x${string}`,
  factory: process.env.AGENT_FACTORY_ADDRESS as `0x${string}`,
});

// Salt from auth scope — NOT from a .agent name (ADR-0010).
const salt = deriveSaltFromEmail(user.email, 0);
const address = await account.getAddress(bootstrapSigner.address, salt);

if (!(await account.isDeployed(address))) {
  await account.createAccount(
    { owner: bootstrapSigner.address, salt },
    bootstrapSigner as Signer,
  );
}

The address exists before the account does. You can name it, fund it, and issue authority to it counterfactually; deployment happens when it first acts.

Main Concepts

  • Smart Agent address: the canonical identifier; stable across credential rotation (ADR-0011).
  • CREATE2 salt: from auth methods + user scope only — never from .agent names (spec 220).
  • Signer: pluggable interface from connect-auth; this package consumes it.
  • UserOperation: ERC-4337 v0.8 UserOp build path via buildUserOp.

See docs/concepts.md.

Common Recipes

import { buildExecuteCallData, type ContractCall } from '@agenticprimitives/agent-account';

const calls: ContractCall[] = [
  { to: target, value: 0n, data: calldata },
];
const executeData = buildExecuteCallData(calls);
import { encodeWebAuthnSignature, SIG_TYPE_WEBAUTHN } from '@agenticprimitives/agent-account';
// WebAuthn ceremony output is produced by connect-auth; on-chain wire format here.

How it's different

Safe, ZeroDev, and Alchemy Account Kit ship excellent smart accounts — and stop there. The account is a container; who it is, what it may do, and how to prove it are someone else's integration problem. Here the account is the anchor of a substrate: the same address that agent-account derives is what agent-naming resolves, account-custody governs, delegation issues authority from, and audit attributes evidence to. The account contract itself is a thin ERC-7579 modular core (spec 209) — custody, threshold, and session machinery are modules, not inlined features. We ported the patterns worth porting (Safe-style signature packing) without taking a runtime dependency on anyone else's account stack.

Runtime Support

Node and browser via viem. Requires RPC URL for chain reads and transaction submission.

Security Invariants

  • Salt derives from stable keccak inputs; no raw user-supplied salt bytes.
  • EntryPoint version is explicit in client config.
  • Bootstrap signer is distinct from day-to-day custodian signers.

See docs/security.md and AUDIT.md.

Documentation Map

Validation

pnpm check:agent-account
pnpm check:forbidden-terms

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.

License

UNLICENSED.

版本与发布记录

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

版本发布日期距今
1.0.0-alpha.46latest2026/10/2610 天前
1.0.0-alpha.452026/10/2610 天前
1.0.0-alpha.442026/10/1720 天前
1.0.0-alpha.432026/10/1720 天前
1.0.0-alpha.422026/10/1620 天前
1.0.0-alpha.412026/10/1620 天前

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

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

@agenticprimitives/agent-account 是什么?

ERC-4337 smart-account substrate: deterministic addressing, factory deployment, ERC-1271 signing, UserOp building.

如何安装 @agenticprimitives/agent-account?

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

@agenticprimitives/agent-account 支持 TypeScript 吗?

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

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

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

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

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

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

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

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

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