@agenticprimitives/content-primitives

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

Verifiable Content Substrate SDK: name, resolve, commit, entitlement-gate, and cite off-platform content controlled by third-party rights holders. Owns CanonicalLocus / CorpusManifest / ContentDescriptor / CitationAssertion / Entitlement (FRBR-aligned), d

原始使用文档
文档目录4 节
  1. Model (FRBR)
  2. Quick start
  3. Status
  4. Build

@agenticprimitives/content-primitives

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 verifiable content substrate — name, resolve, commit, entitlement-gate, and cite content that lives off-platform and is controlled by third-party rights holders.

Agents increasingly act on content they do not own: quoting a licensed text, citing a canonical passage, gating access to a rights-held corpus. The naive approaches all fail — copy the text and you violate the license; trust the platform and the citation is unverifiable; mint every passage an identity and the identity layer drowns. This package takes the third path: content is never an agent and never stored. A unit of content gets a deterministic, scheme-anchored address; an issuer (who IS a Smart Agent) signs a commitment to it; readers verify the signature, evaluate the entitlement, and cite the result — all without the text ever entering the substrate (ADR-0033).

The package is strictly content-agnostic: no rendering text in any descriptor or commitment we store (R3), no licensed material in the repo (R1), and the reference grammar is app-injected, never hardcoded (R4). Trust derives from the issuer's signature and access policy, never a platform claim (R5).

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.

Model (FRBR)

FRBRTypeNotes
WorkCanonicalLocusscheme-anchored deterministic locusId; never registered
ManifestationCorpusManifestissuer-owned, Merkle corpusRoot, signed
ItemContentDescriptorcommitment + retrievalPointer + issuer signature — never text
—Entitlement / CitationAssertionW3C VC 2.0 subjects

The FRBR Work/Item split is why this is a new substrate and not another naming-record type: a content locus is an address computed from a reference scheme, while only issuers, corpora owners, and parties are Smart Agents (ADR-0010 still governs them).

Quick start

import {
  buildCanonicalLocus, corpusRef, contentCommitment,
  buildContentDescriptor, verifyContentDescriptor,
  evaluateEntitlement, buildCitationAssertion,
} from '@agenticprimitives/content-primitives';

// 1. App supplies the reference grammar (kept out of the package — R4).
const clauseScheme = { id: 'standard-clause', normalize: (p: string) => /* canonical form */ p };
const locus = buildCanonicalLocus(clauseScheme, 'Part 4, Section 2'); // -> { locusId, path: 'Part4.Section2' }

// 2. Issuer commits to off-platform text + signs a descriptor (no text on-chain — R3).
const commitment = contentCommitment(renderingText); // keccak256, off-platform
const descriptor = await buildContentDescriptor(
  { locusId: locus.locusId, corpusRef: ref, contentType: 'standard-clause',
    commitment, proofPolicy: 'signature', accessPolicy: 'public',
    retrievalPointer: 'content://standard-clause/v3/Part4.Section2', issuer },
  issuerSign, // signs descriptorHash via the issuer SA (ERC-1271)
);

// 3. Reader verifies (signature injected — ADR-0006) + gates + cites.
const ok = await verifyContentDescriptor(descriptor, { verifySignature });
const gate = evaluateEntitlement(descriptor.accessPolicy, descriptor.corpusRef);

Entitlement evaluation is fail-closed; Merkle helpers ship under the /merkle subpath; ERC-1271 signature verification is dependency-injected so the package stays at the base of the graph.

Status

Phases 1–3 (naming, commitment, descriptor verification, entitlement gating, citation) are implemented and tested. ZK proofs and paid access are reserved (Phase 4/5) and throw until implemented — the full SDK surface and phased roadmap live in spec 266 (see spec.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.

Build

pnpm --filter @agenticprimitives/content-primitives typecheck
pnpm --filter @agenticprimitives/content-primitives test
pnpm --filter @agenticprimitives/content-primitives build

版本与发布记录

@agenticprimitives/content-primitives 共发布 36 个版本,首次发布于 2026/06/08;过去 12 个月发布了 36 个版本。

版本发布日期距今
1.0.0-alpha.41latest2026/10/2612 天前
1.0.0-alpha.402026/10/1722 天前
1.0.0-alpha.392026/10/1622 天前
1.0.0-alpha.382026/10/1622 天前
1.0.0-alpha.372026/10/1622 天前
1.0.0-alpha.362026/10/1622 天前

其他发布通道:alpha → 1.0.0-alpha.7。

关于 @agenticprimitives/content-primitives 的常见问题

@agenticprimitives/content-primitives 是什么?

Verifiable Content Substrate SDK: name, resolve, commit, entitlement-gate, and cite off-platform content controlled by third-party rights holders. Owns CanonicalLocus / CorpusManifest / ContentDescriptor / CitationAssertion / Entitlement (FRBR-aligned), d

如何安装 @agenticprimitives/content-primitives?

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

@agenticprimitives/content-primitives 支持 TypeScript 吗?

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

@agenticprimitives/content-primitives 支持 ESM 还是 CommonJS?

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

@agenticprimitives/content-primitives 可以商用吗?

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

@agenticprimitives/content-primitives 的下载量有多少?

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

@agenticprimitives/content-primitives 还在维护吗?

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