dsh-prime-memory 0.26.30 → 0.26.31

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
@@ -1,5 +1,17 @@
1
1
  # 更新日志(Changelog)
2
2
 
3
+ ## [0.26.31] — 2026-11-03
4
+
5
+ - **回填 0.26.30 的测试缺口 + 让 npm 产物与 main 对齐(无运行时行为变更)**
6
+
7
+ > 0.26.30 发布后,Spec 的「测试与门禁」里还有一条只有「不回归」、没有专项断言:`tests/l1-receipts*` 要证明「本条被批内哪条吸收」。本版把它补成真断言,并把映射抽成纯函数 `receiptItemsForAbsorbed()` 供管线与用例共用。
8
+
9
+ - **凭证可审计补全**:吸收项 → `kind='merge'` + `candidateIds=[代表 id]`,`input_digest` 指向代表项;空映射零额外行(特性关闭时凭证与 0.26.30 逐字节一致)。用例:`tests/l1-receipts.test.ts`「§B 批内吸收关系入凭证」。
10
+ - **行为零变更**:本版只做纯函数提取 + 新增用例;`dist/pipeline/l1.js` 的输出与原内联映射同参同果,0.26.30 的运行时行为完全保留。
11
+ - **对齐**:`v0.26.30` 的 tag 停在 `673d033`,之后 main 多了一个测试提交;本版把 tag / npm 产物 / main 重新对齐,避免「装到的其实是 tag 前代码」这类误判。
12
+ - **测试**:全量 **1976 passed / 1 skipped**(195 文件);typecheck 0、lint 0 error;CI(Linux)七步全绿。
13
+ - 未改任何对外契约:无新配置键、无端点变化、无行为分支。
14
+
3
15
  ## [0.26.30] — 2026-11-03
4
16
 
5
17
  - **#22 机理刀三层防线 + 同会话批内去重 + DRSC 提示 + 锁文件修复**
@@ -66,6 +66,19 @@ export interface PreDedupeOpts {
66
66
  tau?: number;
67
67
  onWarn?: (msg: string) => void;
68
68
  }
69
+ /**
70
+ * 把「被吸收 → 代表」关系映射成 receipt 输入项。
71
+ *
72
+ * 为什么用既有 `kind='merge'` + `candidateIds=[代表 id]` 而不新增表列/词表即可:
73
+ * 吸收本质上就是「本条被并入另一条」,`merge` 正是这个词;`candidateIds` 载代表项 id,
74
+ * 于是「本条被批内哪条吸收」只需一次 `(runId, recordId)` 回溯(inputDigest 含代表 id)。
75
+ * 关闭特性时 `absorbedBy` 为空 ⇒ 不产生任何额外行(凭证与改动前逐字节一致)。
76
+ */
77
+ export declare function receiptItemsForAbsorbed(absorbedBy: Record<string, string>): Array<{
78
+ recordId: string;
79
+ candidateIds: [string];
80
+ action: 'merge';
81
+ }>;
69
82
  export interface PreDedupeResult<T> {
70
83
  effective: T[];
71
84
  /** 代表项 record_id → 该正文的向量(候选召回与写侧复用同一份)。 */
@@ -176,6 +176,21 @@ export function clusterByVector(items, vectors, tau) {
176
176
  });
177
177
  return finish(items, clusters);
178
178
  }
179
+ /**
180
+ * 把「被吸收 → 代表」关系映射成 receipt 输入项。
181
+ *
182
+ * 为什么用既有 `kind='merge'` + `candidateIds=[代表 id]` 而不新增表列/词表即可:
183
+ * 吸收本质上就是「本条被并入另一条」,`merge` 正是这个词;`candidateIds` 载代表项 id,
184
+ * 于是「本条被批内哪条吸收」只需一次 `(runId, recordId)` 回溯(inputDigest 含代表 id)。
185
+ * 关闭特性时 `absorbedBy` 为空 ⇒ 不产生任何额外行(凭证与改动前逐字节一致)。
186
+ */
187
+ export function receiptItemsForAbsorbed(absorbedBy) {
188
+ return Object.entries(absorbedBy).map(([absorbedId, repId]) => ({
189
+ recordId: absorbedId,
190
+ candidateIds: [repId],
191
+ action: 'merge',
192
+ }));
193
+ }
179
194
  /**
180
195
  * 一次完成:精确层 → (可选)向量层,并把“代表项→向量”与“被吸收→代表”两表一并交回。
181
196
  *
@@ -16,7 +16,7 @@ import { normTags, normUsageScenario, readCognitiveHall, readWing } from '../met
16
16
  import { acceptTitle } from '../util/md-name.js';
17
17
  import { clampPriority } from '../util/priority.js';
18
18
  import { formatBatchConflictPrompt, getConflictDetectionSystemPrompt } from '../prompts/l1-dedup.js';
19
- import { preDedupeBatch } from './intra-dedupe.js';
19
+ import { preDedupeBatch, receiptItemsForAbsorbed } from './intra-dedupe.js';
20
20
  import { resolveSourceAnchors, withSourceAnchors } from './anchors.js';
21
21
  import { stampValidity, validToSourceOf } from '../store/validity.js';
22
22
  import { familyForType, normPersistence, normScope, resolveRecordFamily, resolveRecordScope, WING_FALLBACK } from '../types.js';
@@ -542,11 +542,7 @@ routeHealth) {
542
542
  // 唯一零痕迹分支,批内吸收不能重蹈)。用既有 `kind='merge'` + candidateIds=[代表 id]:
543
543
  // 不新增表列、不扩词表,回答“本条被批内哪条吸收”只需一次 (runId, recordId) 回溯。
544
544
  // 关闭特性时 intraAbsorbedBy 为空 ⇒ 凭证与改动前逐字节一致。
545
- const absorbedItems = Object.entries(intraAbsorbedBy).map(([absorbedId, repId]) => ({
546
- recordId: absorbedId,
547
- candidateIds: [repId],
548
- action: 'merge',
549
- }));
545
+ const absorbedItems = receiptItemsForAbsorbed(intraAbsorbedBy);
550
546
  const rows = buildReceipts(runId, new Date().toISOString(), [...items, ...absorbedItems]);
551
547
  persistReceiptsSafely((rows) => store.recordReceipts(rows), rows, logger);
552
548
  // §F 追踪捎带:六值决策词表聚合(与凭证同源,runner 侧并入 distill_run 事件)
package/dsh.plugin.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "id": "dsh-prime-memory",
3
3
  "name": "dsh-prime-memory",
4
- "version": "0.26.30",
4
+ "version": "0.26.31",
5
5
  "description": {
6
6
  "en": "Layered distilled memory plugin (L0 capture → L1 atomic memory → L2 scenes → L3 persona) with automatic recall injection before each model step.",
7
7
  "zh": "L0~L3 分层蒸馏记忆插件:自动捕获对话、抽取原子记忆、整合场景块、蒸馏核心画像,并在模型步骤前自动召回注入。"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-prime-memory",
3
- "version": "0.26.30",
3
+ "version": "0.26.31",
4
4
  "publishConfig": {
5
5
  "registry": "https://registry.npmjs.org",
6
6
  "access": "public",