@agenticprimitives/types

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

Cross-cutting branded types and chain primitives shared across @agenticprimitives/* packages.

原始使用文档
文档目录5 节
  1. Install
  2. Exports
  3. How it's different from a typical types package
  4. Status
  5. Validate

@agenticprimitives/types

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 shared type vocabulary that keeps thirty packages pointing at one identity.

A trust substrate lives or dies on agreement about what an identity is. types is where that agreement is written down as the compiler's problem: branded primitives (Address, Hex, ChainId, Caip10Address) and the cross-cutting identity shapes (CanonicalAgentIdentity, AgentType, AgentSession, CredentialPrincipal, Assurance) that every @agenticprimitives/* package shares. Because the brands are phantom types, a raw string cannot masquerade as an address and a CAIP-10 subject cannot be confused with a bare EVM address — across package boundaries, at compile time, with zero runtime cost.

It is also where the doctrine becomes a type. CanonicalAgentIdentity is the ADR-0010 rule — the agent's identity IS its Smart Agent address — as an alias of Address, and AgentSession deliberately has no owner field (ADR-0016): the SSO session names the agent itself, never a vendor-side owner. Types-only, zero dependencies, no runtime code; it is the leaf every other package depends on and the reason the dependency graph has no back-edges.

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/types

Exports

import type { Address, Hex, ChainId, BrandedId } from '@agenticprimitives/types';

type SessionId = BrandedId<'SessionId'>;
const chain: ChainId = 1 as ChainId;
const account: Address = '0x...';

Also exported: CanonicalAgentIdentity (ADR-0010 alias of Address); Caip10Address, CanonicalAgentId, Caip10Parts (CAIP-10 brand — the type lives here, the runtime builder lives in agent-profile); AgentType ('person' | 'org' | 'service') and NameContext (display-only injection shape); and the SSO/session shapes AgentSession, CredentialPrincipal, Assurance, CredentialKind, CredentialRole (specs 223/224).

How it's different from a typical types package

Most monorepo types packages are junk drawers that grow until everything depends on everything. This one is governed:

  • Admission rule: a type lands here only when ≥ 2 packages consume it and it cannot live anywhere lower. Single-consumer types stay in their package.
  • No runtime, ever. No functions, no constants with behavior, no side effects. Even the CAIP-10 builder is excluded — only the brand lives here.
  • Shared shapes without runtime coupling. AgentSession lives here precisely so identity-directory, connect, and relying-site SDKs can agree on the token shape without importing each other.

The result is a leaf package small enough to audit in one sitting, strong enough to make identity confusion a compile error.

Status

Minimal by design — adding a type requires ≥ 2 consuming packages. Testnet/pilot-ready. Production launch is gated on the public checklist in the root README.md Status section — including third-party contract audit and governance key rotation. Track every security finding live in docs/audits/findings.yaml.

Validate

pnpm --filter @agenticprimitives/types typecheck
pnpm check:forbidden-terms

版本与发布记录

@agenticprimitives/types 共发布 45 个版本,首次发布于 2026/05/31;过去 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/types 的常见问题

@agenticprimitives/types 是什么?

Cross-cutting branded types and chain primitives shared across @agenticprimitives/* packages.

如何安装 @agenticprimitives/types?

在项目目录运行 npm install @agenticprimitives/types,或使用 pnpm add / yarn add / bun add。

@agenticprimitives/types 支持 TypeScript 吗?

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

@agenticprimitives/types 支持 ESM 还是 CommonJS?

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

@agenticprimitives/types 可以商用吗?

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

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

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

@agenticprimitives/types 还在维护吗?

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