attention-manifest-protocol 0.4.1 → 0.4.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -11,6 +11,16 @@ project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
11
11
 
12
12
  - Consolidated project guidance into the English and Chinese READMEs; evaluation summaries now remain JSON-only.
13
13
 
14
+ ## [0.4.2] - 2026-10-29
15
+
16
+ ### Fixed
17
+
18
+ - `attention-manifest-protocol/window` now exports ledger compaction and pruning: `planPrune`, `compactLedger`, `verifyCompaction`, `CompactionRefused`, `PruneResult`, `Compaction`, `CompactionOptions`, and the policy types `PrunePolicy`, `PrunePlan`, `PruneDecision`, `PruneReason`, `Checkpoint` and `LedgerKind`. They compiled into `lib/` but were absent from the barrel, so only the deep `window/compaction.js` path could reach them.
19
+
20
+ ### Changed
21
+
22
+ - Both READMEs document compaction and pruning as an architecture component, with the ledger and concept entry points named.
23
+
14
24
  ## [0.4.1] - 2026-10-29
15
25
 
16
26
  Published library build: the package now exposes importable ESM with types.
@@ -11,6 +11,16 @@
11
11
 
12
12
  - 将项目说明收敛到中英文 README;评测汇总只保留 JSON 格式。
13
13
 
14
+ ## [0.4.2] - 2026-10-29
15
+
16
+ ### 修复
17
+
18
+ - `attention-manifest-protocol/window` 现在导出账本层的压缩与剪枝:`planPrune`、`compactLedger`、`verifyCompaction`、`CompactionRefused`、`PruneResult`、`Compaction`、`CompactionOptions`,以及 `PrunePolicy`、`PrunePlan`、`PruneDecision`、`PruneReason`、`Checkpoint`、`LedgerKind` 等策略类型。这些实现此前虽已编译进 `lib/`,却未出现在 barrel 中,只能通过深层路径 `window/compaction.js` 访问。
19
+
20
+ ### 变更
21
+
22
+ - 中英文 README 将压缩与剪枝补为架构构件,并点名账本层与概念层的入口函数。
23
+
14
24
  ## [0.4.1] - 2026-10-29
15
25
 
16
26
  发布库构建:包现在提供可直接导入的 ESM 与类型声明。
package/README.md CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  **English** · [简体中文](README.zh-CN.md) · [Changelog](CHANGELOG.md)
4
4
 
5
- AMP is a metacognitive protocol for agents: declare knowledge and obligations, allocate finite attention, obtain evidence, and record costs and outcomes. The reference implementation is version `0.4.0`, requires **Node.js 24 or later**, and uses Apache-2.0.
5
+ AMP is a metacognitive protocol for agents: declare knowledge and obligations, allocate finite attention, obtain evidence, and record costs and outcomes. The reference implementation is version `0.4.2`, requires **Node.js 24 or later**, and uses Apache-2.0.
6
6
 
7
7
  ## Architecture
8
8
 
@@ -15,6 +15,7 @@ AMP is a metacognitive protocol for agents: declare knowledge and obligations, a
15
15
  | Frame | Freeze one allocation with refs, budgets and explicit exclusions (`ignored`) |
16
16
  | Context | Materialize summaries, relations and bounded detail access |
17
17
  | Receipt | Record actual costs and outcomes for audit and calibration |
18
+ | Compaction | Prune cold or superseded objects with a reason, then replace a verified prefix with a checkpoint |
18
19
 
19
20
  ```text
20
21
  Attention → Frame → Context → Receipt → Ledger
@@ -31,6 +32,7 @@ Context combines a structural tree and typed relationships. Project dependencies
31
32
  - Project trees, project dependency graphs, partial TS/JS import/call/reference graphs and lexical knowledge retrieval.
32
33
  - Structured Markdown/TXT/DOCX/XLSX/PPTX and TeX/LaTeX/BibTeX input with native source locations and summary/detail separation.
33
34
  - `amp.workspace` v1 agent service, seven tools, local runtime integration and MCP stdio.
35
+ - Compaction and pruning at two levels. `planPrune()` decides every drop with a reason and a revisit condition; `compactLedger()` replaces a verified cold prefix with a checkpoint, `verifyCompaction()` re-derives that commitment, and compaction refuses to bury an entry the retained tail still cites. `pruneConcept()` and `compactConceptHistory()` apply the same discipline to concept content and version history.
34
36
 
35
37
  Offline parsers live in `tools/support/`. The runtime stays database-free and uses ports; persistence adapters are separate. Concrete contracts remain in [schemas](docs/schemas/), [examples](docs/examples/) and executable [checks](tools/).
36
38
 
package/README.zh-CN.md CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  [English](README.md) · **简体中文** · [更新日志](CHANGELOG.zh-CN.md)
4
4
 
5
- AMP 是供 agent 使用的元认知协议:声明知识和义务,分配有限注意力,获取证据,记录成本与结果。当前参考实现为 `0.4.0`,要求 **Node.js 24 或以上**,使用 Apache-2.0 许可证。
5
+ AMP 是供 agent 使用的元认知协议:声明知识和义务,分配有限注意力,获取证据,记录成本与结果。当前参考实现为 `0.4.2`,要求 **Node.js 24 或以上**,使用 Apache-2.0 许可证。
6
6
 
7
7
  ## 架构
8
8
 
@@ -15,6 +15,7 @@ AMP 是供 agent 使用的元认知协议:声明知识和义务,分配有限
15
15
  | Frame | 固化本轮引用、预算和显式排除项 `ignored` |
16
16
  | Context | 将分配物化为摘要、关系与受限的详情读取 |
17
17
  | Receipt | 记录实际成本和结果,支持审计与校准 |
18
+ | Compaction(压缩与剪枝) | 按明确理由剪掉冷数据或已失效对象,再用检查点替换已验证的前缀 |
18
19
 
19
20
  ```text
20
21
  Attention 选择 → Frame 固化 → Context 物化 → Receipt 结算 → Ledger
@@ -31,6 +32,7 @@ Context 使用结构树和类型化关系图。项目依赖、导入、调用与
31
32
  - 项目树、项目依赖图、TS/JS 的部分静态导入/调用/引用图,以及知识库词法检索。
32
33
  - Markdown、TXT、DOCX、XLSX、PPTX、TeX/LaTeX/BibTeX 的结构提取、原生定位与摘要/详情分层。
33
34
  - `amp.workspace` v1 服务、7 个 agent 工具、本地运行时接入与 MCP stdio 服务端。
35
+ - 两层压缩与剪枝。`planPrune()` 为每次丢弃给出理由和回看条件;`compactLedger()` 用检查点替换已验证的冷前缀,`verifyCompaction()` 重新推导该承诺,且不会埋掉保留尾部仍然引用的条目。`pruneConcept()` 与 `compactConceptHistory()` 对概念内容和版本历史执行同样的约束。
34
36
 
35
37
  离线解析器位于 `tools/support/`;运行时通过端口接入数据,不依赖数据库,持久化适配器与运行时核心分离。具体契约见 [Schema](docs/schemas/)、[协议示例](docs/examples/) 与 [可执行检查](tools/)。
36
38
 
@@ -2,3 +2,6 @@ export { ContextWindow } from "./window.js";
2
2
  export type { ContextWindowOptions, WindowStats } from "./window.js";
3
3
  export type { Page } from "./page.js";
4
4
  export { pageIdFor, pageKey } from "./page.js";
5
+ export { CompactionRefused, compactLedger, planPrune, verifyCompaction } from "./compaction.js";
6
+ export type { Compaction, CompactionOptions, PruneResult } from "./compaction.js";
7
+ export type { Checkpoint, LedgerKind, PruneDecision, PrunePlan, PrunePolicy, PruneReason } from "./compactionTypes.js";
@@ -1,2 +1,3 @@
1
1
  export { ContextWindow } from "./window.js";
2
2
  export { pageIdFor, pageKey } from "./page.js";
3
+ export { CompactionRefused, compactLedger, planPrune, verifyCompaction } from "./compaction.js";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "attention-manifest-protocol",
3
- "version": "0.4.1",
3
+ "version": "0.4.2",
4
4
  "private": false,
5
5
  "description": "A metacognitive protocol for agent attention and warrant: signed manifests, attention frames with explicit exclusions, receipts, T0-T4 evidence tiers, MCP execution, federation, persistence, agent governance (manifests, credentials, budgets, workflows) and multi-agent delegation.",
6
6
  "keywords": [
@@ -1,4 +1,7 @@
1
- export { ContextWindow } from "./window.ts";
2
- export type { ContextWindowOptions, WindowStats } from "./window.ts";
3
- export type { Page } from "./page.ts";
4
- export { pageIdFor, pageKey } from "./page.ts";
1
+ export { ContextWindow } from "./window.ts";
2
+ export type { ContextWindowOptions, WindowStats } from "./window.ts";
3
+ export type { Page } from "./page.ts";
4
+ export { pageIdFor, pageKey } from "./page.ts";
5
+ export { CompactionRefused, compactLedger, planPrune, verifyCompaction } from "./compaction.ts";
6
+ export type { Compaction, CompactionOptions, PruneResult } from "./compaction.ts";
7
+ export type { Checkpoint, LedgerKind, PruneDecision, PrunePlan, PrunePolicy, PruneReason } from "./compactionTypes.ts";