sage-mem 2.15.10 → 2.15.12

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/README.en.md CHANGED
@@ -12,7 +12,7 @@
12
12
 
13
13
  **Cross-session memory for DeepSeek Harness — plain markdown files, no database, no worker.**
14
14
 
15
- **Current release: `2.15.10`** — the npm badge above is the dynamic source of truth. **Contract baseline: `1.0.0`** — the first stable release, whose public commitments, the capability boundaries and the list of things it explicitly cannot do are frozen in the
15
+ **Current release: `2.15.12`** — the npm badge above is the dynamic source of truth. **Contract baseline: `1.0.0`** — the first stable release, whose public commitments, the capability boundaries and the list of things it explicitly cannot do are frozen in the
16
16
  [frozen contract](https://github.com/gezi-wen/sage-mem/blob/main/docs/1.0.0-contract.md).
17
17
 
18
18
  If it is useful to you, a Star is the most direct feedback.
package/README.md CHANGED
@@ -14,7 +14,7 @@
14
14
 
15
15
  > File-based cross-session memory for DeepSeek Harness — every memory is a plain markdown file you can open, edit and delete. No database, no worker, no port.
16
16
 
17
- **当前发布版本:`2.15.10`** —— 顶部 npm 徽章是动态权威。**契约基线:`1.0.0`** —— 第一个稳定版,公开承诺、能力边界与「明确做不到」的清单冻结在
17
+ **当前发布版本:`2.15.12`** —— 顶部 npm 徽章是动态权威。**契约基线:`1.0.0`** —— 第一个稳定版,公开承诺、能力边界与「明确做不到」的清单冻结在
18
18
  [契约冻结](https://github.com/gezi-wen/sage-mem/blob/main/docs/1.0.0-contract.md)。
19
19
 
20
20
  如果它对你有用,给个 Star 是最直接的反馈。
@@ -0,0 +1,60 @@
1
+ /**
2
+ * 注入调试账的结果形状(2026-11-22 从 `typert.host.js` 拆出)。
3
+ *
4
+ * 为什么单独一份:`typert.host.js` 有 1160 行那条守卫(契约面不许无限膨胀)。2.15.11 补
5
+ * `gated` / `validitySuppressed` 时又贴顶,按 D47 的口径「先想能不能挪走」——把这一族纯形状
6
+ * 挪出来,invocation 声明仍留在 `typert.host.js`。
7
+ *
8
+ * 依赖方向:只依赖 zod。
9
+ */
10
+ import { z } from 'zod'
11
+
12
+ /** 一条打分(文件 + 分数)。 */
13
+ export const recallDebugScoreSchema = z.object({
14
+ 'file': z.string().readonly(),
15
+ 'score': z.number().readonly(),
16
+ }).readonly()
17
+
18
+ /**
19
+ * 一步装配的调试记录。
20
+ *
21
+ * `gated` 与 `validitySuppressed` 是「这条记忆为什么没进来」的两个主要线索:
22
+ * 前者把「同题同目录没重算」与「算过了但没东西可给」分开(两者 `outcome` 都是 `empty`),
23
+ * 后者列出被失效 / 待裁决矛盾挡掉的条目。
24
+ */
25
+ export const recallDebugRecordSchema = z.object({
26
+ 'at': z.number().readonly(),
27
+ 'sessionId': z.string().readonly(),
28
+ 'query': z.string().readonly(),
29
+ // injected | card-only | empty:这一步到底注进去了什么
30
+ 'outcome': z.string().readonly(),
31
+ 'deduped': z.boolean().readonly(),
32
+ 'baseline': z.number().readonly(),
33
+ 'scanned': z.number().readonly(),
34
+ 'hits': z.number().readonly(),
35
+ 'scores': z.array(recallDebugScoreSchema).readonly(),
36
+ 'body': z.array(recallDebugScoreSchema).readonly(),
37
+ 'picked': z.array(z.string()).readonly(),
38
+ 'injected': z.array(z.string()).readonly(),
39
+ // chars = 这一步正文;sessionChars = 本代累计;cardChars = 这一步的卡
40
+ 'chars': z.number().readonly(),
41
+ 'sessionChars': z.number().readonly(),
42
+ 'cardChars': z.number().readonly(),
43
+ 'skippedByBudget': z.number().readonly(),
44
+ 'card': z.string().readonly(),
45
+ 'gated': z.boolean().readonly().optional(),
46
+ // ⚠️ 2.15.11 定为可选:有的分支(短路、早期返回)不带这个键,写成必填会让整条调用被判坏 ——
47
+ // 那正是这一族 bug 的形态。
48
+ 'validitySuppressed': z.array(z.object({
49
+ 'file': z.string().readonly(),
50
+ 'reason': z.string().readonly(),
51
+ 'label': z.string().readonly(),
52
+ 'conflictId': z.string().readonly().optional(),
53
+ }).readonly()).readonly().optional(),
54
+ }).readonly()
55
+
56
+ /** 开关关着时 records 是空数组、enabled 是 false —— 面板据此不显示入口。 */
57
+ export const recallDebugResultSchema = z.object({
58
+ 'enabled': z.boolean().readonly(),
59
+ 'records': z.array(recallDebugRecordSchema).readonly(),
60
+ }).readonly()
@@ -6,6 +6,7 @@
6
6
  */
7
7
  import { z } from 'zod'
8
8
  import { checkpointsResultSchema } from './shared/checkpoints-schema.js'
9
+ import { recallDebugResultSchema } from './shared/recall-debug-schema.js'
9
10
  import { MD_NAME_PATTERN } from './shared/md-name.js'
10
11
  import { MAX_FILE_BYTES, MAX_RAW_BYTES } from './shared/limits.js'
11
12
 
@@ -204,6 +205,12 @@ const auditReportSchema = z.object({
204
205
  // 归档/恢复中途崩溃留下的私有名残留(`*.md.archiving-<hex>`)。它可能装着用户唯一
205
206
  // 一份内容,所以体检必须报出来 —— strict 不声明它就等于界面上永远看不见。
206
207
  'strays': z.array(auditItemSchema).readonly(),
208
+ // 2.15.12(M6):索引有多份大小写变体(这一类**算进 problems**,不声明就没有渲染位置),
209
+ // 以及本库用的是哪一份索引文件。两者都在真实返回值里 —— 不声明就是「徽标亮着、清单里一行都没有」。
210
+ // ⚠️ 两者都写成可选:有的审计分支(无索引 / 只跑体积那一档)不带它们,
211
+ // 写成必填会让整条 udit 调用被判坏 —— 那正是这一族缺陷的形态。
212
+ 'indexConflicts': z.array(auditItemSchema).readonly().optional(),
213
+ 'indexFile': z.string().readonly().nullable().optional(),
207
214
  // 2.0.0:有效性标注的**提示**(不进 problems —— problems 是唯一健康数字)。
208
215
  // 不声明的话 strict 会把它剥掉,面板与设置页就永远看不到「某个字段格式坏了」。
209
216
  'validityHints': z.array(z.object({
@@ -344,20 +351,7 @@ const rawFileContentSchema = z.string().max(MAX_RAW_BYTES)
344
351
  // 一个永远 undefined 的格子(与 R01 漏四个配置字段同一类错误)。
345
352
  // 写法比相邻 schema 紧凑(一行多字段):本文件已有 ≤900 行的结构守卫
346
353
  // (test/structure-test.mjs),加一条 remote 不能把文件顶爆。
347
- const recallDebugScoreSchema = z.object({ 'file': z.string().readonly(), 'score': z.number().readonly() }).readonly()
348
- const recallDebugRecordSchema = z.object({
349
- 'at': z.number().readonly(), 'sessionId': z.string().readonly(), 'query': z.string().readonly(),
350
- // injected | card-only | empty:这一步到底注进去了什么
351
- 'outcome': z.string().readonly(), 'deduped': z.boolean().readonly(), 'baseline': z.number().readonly(),
352
- 'scanned': z.number().readonly(), 'hits': z.number().readonly(),
353
- 'scores': z.array(recallDebugScoreSchema).readonly(), 'body': z.array(recallDebugScoreSchema).readonly(),
354
- 'picked': z.array(z.string()).readonly(), 'injected': z.array(z.string()).readonly(),
355
- // chars = 这一步正文;sessionChars = 本代累计;cardChars = 这一步的卡
356
- 'chars': z.number().readonly(), 'sessionChars': z.number().readonly(), 'cardChars': z.number().readonly(),
357
- 'skippedByBudget': z.number().readonly(), 'card': z.string().readonly(),
358
- }).readonly()
359
- // 开关关着时 records 是空数组、enabled 是 false —— 面板据此不显示入口。
360
- const recallDebugResultSchema = z.object({ 'enabled': z.boolean().readonly(), 'records': z.array(recallDebugRecordSchema).readonly() }).readonly()
354
+
361
355
 
362
356
  // ── autodream(夜间记忆整理)───────────────────────────────────────────────
363
357
  // 配置的每一项都可写;lastResult 是一个「成功/失败两条分支共用」的结构,
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "sage-mem",
3
3
  "description": "Cross-session memory for DeepSeek Harness — plain markdown files, no database, no worker.",
4
- "version": "2.15.10",
4
+ "version": "2.15.12",
5
5
  "type": "module",
6
6
  "main": "lib/index.js",
7
7
  "icon": "./icon.png",