@dharma-ai-labs/agent-fabric-contracts

中文文档
0.1.18发布于 2026/10/18MITTypeScriptES Module构建来源已验证近 30 天下载 1.2万

Versioned schemas, signatures, and TypeScript contracts for Dharma Agent Fabric

原始使用文档
文档目录3 节
  1. Signing-expiry recovery possession protocol
  2. Action-decision receipts
  3. Codex task observations

@dharma-ai-labs/agent-fabric-contracts

Versioned TypeScript contracts and validators for Dharma Agent Fabric protocol envelopes, provider capabilities, evidence requests, signed tasks, and receipts. Schema validity establishes structure and integrity; it does not prove factual grounding or reasoning validity.

Signing-expiry recovery possession protocol

parseDeviceSigningRecoveryChallenge(), deviceSigningRecoverySigningPayload() and verifyDeviceSigningRecoveryProof() validate the purpose-separated dharma.device-signing-recovery-challenge/v1 public possession protocol. The challenge binds the existing device and installation, intended recipient, organization, workspace, source selection and policy, protected configuration, native-session binding digest, browser approval intent, exact issuer/audience, previous protected anchor and trust, proposed monotonic trust artifact, encrypted-delivery public key and a maximum 15-minute window. Session bindings are digests, never browser cookies, session tokens or native transcript content.

A valid proof establishes device-key possession only. It is not recipient or owner approval, candidate provenance, server-authenticator verification, a one-use consumption record or permission to modify protected trust. Callers must obtain the expected context from authoritative records, not echo it from the request. The schema checks structure; the parser also checks canonical encodings, timestamps, context equality, increasing generation and changed artifact. Ordinary signing-update verification and historical key windows are unchanged. The server, browser and protected-store recovery flow is not yet connected; these functions alone do not enable production recovery.

Action-decision receipts

dharma.action-decision-receipt/v1 is a short-lived receipt signed by a named KMS key version. It carries exactly one release, block, escalate, or withhold outcome and binds the decision to the organization, task, action, endpoint, workspace, evaluation contract, state envelope, evidence references, and canonical SHA-256 task-action digest. Receipts may live for at most 30 minutes.

Use actionDecisionDigest() over dharma.task-action/v1 and verify the embedded { id, actionDigest, receipt, signature, keyVersion } with verifyActionDecisionReceipt(). buildActionDecisionAcknowledgement() emits the HQ enforcement payload with an executed, contained, or unknown disposition. The acknowledgement is returned inside the existing signed device protocol channel.

Codex task observations

dharma.codex-task-observation/v1 binds one logical named-session work item to its exact retained capture, source and result snapshots, signed repository package, evidence consent, and an independently signed outcome. The record contains hashes and identities; raw source, conversation content, credentials, and private graders are retained separately under their applicable policies.

Use codexTaskLogicalRequestId() to preserve identity across provider retries. verifyCodexTaskObservation() checks the device signature, current enrollment and consent, authoritative retained evidence, package hashes, grading contract, and independent grader signature. The grader key must differ from the device key. Failed and interrupted work can retain failed outcomes; they cannot claim a passing grade. The provider's requested model remains separate from its unreported executed model, and replay is explicitly task-level.

Native observation verification now requires retained.captureBytes from the authorized evidence store. Matching device-supplied hash descriptors are not sufficient. verifyCodexTaskCaptureBytes() checks the exact UTF-8 bytes, the strict v2 capture schema, request/event digests, all scoped identities, event ordering, time bounds, complete coverage and an observed terminal notification. Its inputs and output do not confer disclosure permission or attest execution. Keep raw captures encrypted locally unless separate applicable consent permits retention. A redacted or portable export is different evidence with a different digest; it cannot be passed off as the original capture. Missing original bytes fail closed and do not qualify for native observation admission.

verifyCodexTaskOutcome() applies the same outcome binding, time and independent signature checks without requiring a device-signed observation envelope. A successful result returns the receipt ID, canonical receipt hash and actual grade for task-detail evidence references. Supply authoritative logical work, capture, snapshot, evaluation-contract and public-evidence hashes, the work's terminal state and completion time, the enrolled device key and trusted grader resolver. A verified outcome alone does not prove current consent or enrollment and must not be counted as an admitted learning observation.

The caller must obtain verification inputs from enrollment, authorized evidence storage, and trusted grading records rather than echoing the observation's declarations. Verification does not store or count an observation, deduplicate intake, or perform evaluation, canary, publication, or rollback. Those runtime integrations and real Codex qualification remain required before learning can be reported as operational.

Licensed under MIT.

版本与发布记录

@dharma-ai-labs/agent-fabric-contracts 共发布 17 个版本,首次发布于 2026/08/09;过去 12 个月发布了 17 个版本。最新版本附带 npm provenance 构建来源证明,可追溯到公开的 CI 构建记录。

版本发布日期距今
0.1.18latest2026/10/1824 天前
0.1.172026/10/1725 天前
0.1.162026/10/1330 天前
0.1.152026/10/101 个月前
0.1.142026/10/031 个月前
0.1.132026/10/011 个月前

关于 @dharma-ai-labs/agent-fabric-contracts 的常见问题

@dharma-ai-labs/agent-fabric-contracts 是什么?

Versioned schemas, signatures, and TypeScript contracts for Dharma Agent Fabric

如何安装 @dharma-ai-labs/agent-fabric-contracts?

在项目目录运行 npm install @dharma-ai-labs/agent-fabric-contracts,或使用 pnpm add / yarn add / bun add。

@dharma-ai-labs/agent-fabric-contracts 支持 TypeScript 吗?

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

@dharma-ai-labs/agent-fabric-contracts 支持 ESM 还是 CommonJS?

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

@dharma-ai-labs/agent-fabric-contracts 可以商用吗?

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

@dharma-ai-labs/agent-fabric-contracts 的下载量有多少?

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

@dharma-ai-labs/agent-fabric-contracts 还在维护吗?

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