@agent-teams/repository-mutation

中文文档
0.4.2发布于 2026/10/25Apache-2.0TypeScriptES Module零依赖构建来源已验证近 30 天下载 3.7万

Closed, portable repository mutation and exact recovery primitives.

原始使用文档

Repository Mutation

@agent-teams/repository-mutation is the zero-monorepo-dependency leaf for the cooperative repository operation lock, bounded state evidence, closed known-file transactions, exact receipts, and exact-artifact recovery.

Standalone callers protect the shared lock and common transaction evidence. They do not classify an unaccompanied Engineering Foundation local-mode backup; full Foundation local-mode admission remains the responsibility of Foundation's composition wrapper.

Known-file Plan compilation rejects portable case/NFC collisions and every ancestor/descendant relationship across the complete operation set before the Plan digest, journal, or filesystem effects. The path alphabet remains ASCII-only; both composed and decomposed non-ASCII paths are rejected. Valid operation order and digest semantics remain v1-compatible. Persisted v1 evidence is never rewritten: correct journals use only their exact owner-and-kernel build recovery route. Foreign builds cannot take over; impossible, corrupt, or unknown historical bytes remain a manual-only mutation barrier. Known-file apply and recovery remain unsupported on Windows and fail before effects; pure Plan compilation remains portable.

For a valid interrupted journal, use recoverKnownFileTransaction from the recorded owner and kernel artifacts, matching each name, version, and buildIdentity: APPLYING rolls back and COMMITTED completes cleanup. A rebuilt package with the same version cannot take over. Preserve the recorded artifact for the supported recovery window. Impossible historical Plans and unknown evidence require manual resolution; no automatic bridge, schema rewrite, or cleanup is authorized. A failed recovery keeps the journal and mutation barrier.

Current JSON Schema imports use the package's ./schemas/repository-mutation/known-file-transaction-plan/v1.schema.json and ./schemas/repository-mutation/known-file-transaction-receipt/v1.schema.json exports. Their IDs have the same repository-mutation/ prefix. Both retain wire version 1 and protocol agent-teams.repository-mutation.known-file/v1; compiler, receipt digests, and the current transaction envelope (wire version 6) are unchanged. The unprefixed Plan and Receipt schema exports retain exact Foundation 0.21.0 bytes and protocol foundation.replace-known-file/v1. They describe historical data and do not enable the current compiler or journal reader to resume it.

Recover compatible historical known-file journals only through ./mutation in the retained exact @agent-teams/[email protected] artifact, matching its recorded build. Impossible Plans or ambiguous partial effects remain manual. Current public declarations and executable exports stay unchanged. The schema correction requires Authoring, Foundation, and Managed reference closure before the coordinated package set can be published.

The Node adapter also exports retainMutationBarrierOnEvidence(lease) for closed owner-package compositions that must retain a recovery barrier when common mutation evidence exists or cannot be inspected safely. The helper returns whether the barrier was retained. It does not grant mutation authority or revalidate the physical repository root; compositions use observeMutationState(lease) for that identity check and keep admission policy with their owning operation.

observeAtomicFileReplacement({ root, candidate }) returns a NodeAtomicFileReplacement resource contract that owns physical root, parent and temporary observations without exposing the observation identity primitive. Its caller acquires the repository-root lease, creates and validates a safe parent, and performs preimage admission. bindParent, prepare, assertCurrent, replace and cleanup keep the physical observations with this Node adapter. Preparation creates a sibling with exclusive ownership and preserves write, sync and close failures. Cleanup uses the existing identity-matching retirement mechanism and preserves foreign substitutions. Replacement supplies atomic visibility only; the contract grants no lease, preimage compare-and-swap, journal recovery or power-loss durability guarantee.

The Node-only inspectRetiredTemporaryDuplicates(root, filePaths) observation recognizes exact native retired temporary leaves only when stable physical identity and bytes match one canonical sibling with exactly two hardlinks. The canonical file retains ordinary source governance. Unknown geometry, extra files, symlinks, missing counterparts and replaced inodes grant no exemption. This read-only result proves duplicate custody at observation; it does not authenticate historical execution or authorize cleanup, mutation or recovery.

版本与发布记录

@agent-teams/repository-mutation 共发布 11 个版本,首次发布于 2026/09/04;过去 12 个月发布了 11 个版本。最新版本附带 npm provenance 构建来源证明,可追溯到公开的 CI 构建记录。

版本发布日期距今
0.4.2latest2026/10/2513 天前
0.4.12026/10/2315 天前
0.4.02026/10/2117 天前
0.3.02026/10/2118 天前
0.2.22026/09/301 个月前
0.2.12026/09/241 个月前

其他发布通道:bootstrap → 0.0.0。

关于 @agent-teams/repository-mutation 的常见问题

@agent-teams/repository-mutation 是什么?

Closed, portable repository mutation and exact recovery primitives.

如何安装 @agent-teams/repository-mutation?

在项目目录运行 npm install @agent-teams/repository-mutation,或使用 pnpm add / yarn add / bun add。

@agent-teams/repository-mutation 支持 TypeScript 吗?

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

@agent-teams/repository-mutation 支持 ESM 还是 CommonJS?

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

@agent-teams/repository-mutation 需要什么版本的 Node.js?

package.json 的 engines 字段要求 Node.js ^24.18.0 || ^26.0.0。版本不符时 npm 默认只给出警告,开启 engine-strict 后会拒绝安装。

@agent-teams/repository-mutation 可以商用吗?

@agent-teams/repository-mutation 使用 Apache-2.0 许可。宽松许可:允许商业使用、修改和再分发,并附带明确的专利授权;分发时需保留许可与 NOTICE 文件,修改过的文件要注明改动。以上为概括,不构成法律意见,请以许可原文为准。

@agent-teams/repository-mutation 的下载量有多少?

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

@agent-teams/repository-mutation 还在维护吗?

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