sage-mem 0.9.5 → 0.9.6

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.
Files changed (2) hide show
  1. package/lib/memory/scan.js +13 -3
  2. package/package.json +1 -1
@@ -10,9 +10,9 @@
10
10
  * 文件可能被手工搬来搬去,随文件走的元数据才不会与文件脱节。
11
11
  */
12
12
 
13
- import { MAX_FILE_BYTES, MEMORY_DIR, RESERVED_FILES } from './config.js'
13
+ import { MAX_FILE_BYTES, MEMORY_DIR } from './config.js'
14
14
  import { parseBaseline, parseFrontmatter } from './frontmatter.js'
15
- import { isMemoryEntry } from './naming.js'
15
+ import { isMemoryEntry, isReserved } from './naming.js'
16
16
  import { warnLog } from './util.js'
17
17
  import { lstat, readFile, readdir } from 'node:fs/promises'
18
18
  import { join } from 'node:path'
@@ -183,7 +183,17 @@ export function identityOf(info) {
183
183
  */
184
184
  export async function reservedIdentitySet(dir = MEMORY_DIR) {
185
185
  const ids = new Set()
186
- for (const name of RESERVED_FILES) {
186
+ /**
187
+ * ⚠️ **不能**拿 `RESERVED_FILES` 里的字符串直接 join 路径:那个集合是小写归一的
188
+ * (`memory.md`),而磁盘上的真名是 `MEMORY.md`。大小写不敏感的文件系统上两者等价、
189
+ * 看不出问题;**大小写敏感的卷上 `lstat(dir/'memory.md')` 直接 ENOENT,整个身份集合
190
+ * 就是空的 —— 保留名保护静默失效**(Linux CI 实测逮到,本地 Windows 永远看不见)。
191
+ *
192
+ * 所以按**目录里的真实名字**取身份,用 `isReserved()`(它自己做大小写归一)判定。
193
+ */
194
+ const names = await readdir(dir).catch(() => [])
195
+ for (const name of names) {
196
+ if (!isReserved(name)) continue
187
197
  const info = await lstat(join(dir, name)).catch(() => null)
188
198
  const id = identityOf(info)
189
199
  if (id) ids.add(id)
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "sage-mem",
3
3
  "description": "File-based memory plugin for DeepSeek Harness (DSH) — cross-session memory in plain markdown files, with a memory star-map view, type/tag filtering, retrieval aliases, and an optional autodream pass that consolidates memories on demand or on a schedule — with per-run rollback points, a per-file change declaration (what changed and why), and a separately selectable model for the consolidation pass",
4
- "version": "0.9.5",
4
+ "version": "0.9.6",
5
5
  "type": "module",
6
6
  "main": "lib/index.js",
7
7
  "exports": {