memory-eternal 0.15.0 → 0.17.0

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/lib/db.js CHANGED
@@ -221,6 +221,25 @@ function initTables(db) {
221
221
  created_at TEXT DEFAULT (datetime('now'))
222
222
  );
223
223
 
224
+ -- 记忆账本:召回注入 / 蒸馏调用的开销流水(回答「到底省不省 token」)
225
+ CREATE TABLE IF NOT EXISTS ledger (
226
+ id INTEGER PRIMARY KEY AUTOINCREMENT,
227
+ ts INTEGER NOT NULL,
228
+ kind TEXT NOT NULL,
229
+ session TEXT DEFAULT '',
230
+ results INTEGER DEFAULT 0,
231
+ chars INTEGER DEFAULT 0,
232
+ chars_in INTEGER DEFAULT 0,
233
+ llm_calls INTEGER DEFAULT 0,
234
+ provider TEXT DEFAULT '',
235
+ model TEXT DEFAULT '',
236
+ ms INTEGER DEFAULT 0,
237
+ ok INTEGER DEFAULT 1,
238
+ note TEXT DEFAULT ''
239
+ );
240
+ CREATE INDEX IF NOT EXISTS idx_ledger_ts ON ledger(ts);
241
+ CREATE INDEX IF NOT EXISTS idx_ledger_kind ON ledger(kind);
242
+
224
243
  -- 审核日志:记录所有 status 变更,不可篡改
225
244
  CREATE TABLE IF NOT EXISTS audit_log (
226
245
  id INTEGER PRIMARY KEY AUTOINCREMENT,
package/lib/ledger.js ADDED
@@ -0,0 +1,107 @@
1
+ // 记忆账本:记录「记忆本身的开销」——召回注入了多少字符、蒸馏调了多少次 LLM。
2
+ //
3
+ // 为什么要有它:README 一直说「省 token」,但省不省取决于「被避免的上下文开销」是否大于
4
+ // 「注入 + 蒸馏调用」的成本。没有账本,所有调参都是猜;有账本后至少能回答「我们花了多少」,
5
+ // 再结合召回有用率(feedback 表)判断净收益方向。
6
+ //
7
+ // 只记账,不参与主流程:任何异常都吞掉,绝不能让统计把沉淀/召回弄失败。
8
+
9
+ import { getDb } from './db.js'
10
+
11
+ const DAY_MS = 86400000
12
+
13
+ /** 记一条流水。失败静默返回 false。 */
14
+ export function recordLedger(root, entry = {}) {
15
+ try {
16
+ const db = getDb(root)
17
+ db.prepare(`
18
+ INSERT INTO ledger (ts, kind, session, results, chars, chars_in, llm_calls, provider, model, ms, ok, note)
19
+ VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
20
+ `).run(
21
+ Number(entry.ts) || Date.now(),
22
+ String(entry.kind || 'other').slice(0, 20),
23
+ String(entry.session || '').slice(0, 80),
24
+ Math.max(0, Number(entry.results) || 0),
25
+ Math.max(0, Number(entry.chars) || 0),
26
+ Math.max(0, Number(entry.charsIn) || 0),
27
+ Math.max(0, Number(entry.llmCalls) || 0),
28
+ String(entry.provider || '').slice(0, 60),
29
+ String(entry.model || '').slice(0, 80),
30
+ Math.max(0, Number(entry.ms) || 0),
31
+ entry.ok === false ? 0 : 1,
32
+ String(entry.note || '').slice(0, 200),
33
+ )
34
+ return true
35
+ } catch { return false }
36
+ }
37
+
38
+ const localDay = (ts) => {
39
+ const d = new Date(Number(ts) || 0)
40
+ const p = (n) => String(n).padStart(2, '0')
41
+ return `${d.getFullYear()}-${p(d.getMonth() + 1)}-${p(d.getDate())}`
42
+ }
43
+
44
+ /**
45
+ * 近 N 天汇总(默认 7 天,最多 90 天)。
46
+ * - totals:召回次数/注入字符、沉淀次数/LLM 调用/输入输出字符、粗估 token
47
+ * - byDay:逐日明细(used by 面板画趋势)
48
+ * - feedback:召回有用率(feedback 表,只有 agent 显式标记才有数据)
49
+ */
50
+ export function ledgerSummary(root, { days = 7, now = Date.now() } = {}) {
51
+ const db = getDb(root)
52
+ const n = Math.min(Math.max(Math.floor(Number(days) || 7), 1), 90)
53
+ const cutoff = Number(now) - n * DAY_MS
54
+ const rows = db.prepare('SELECT * FROM ledger WHERE ts >= ? ORDER BY ts').all(cutoff)
55
+ const recalls = rows.filter((r) => r.kind === 'recall')
56
+ const captures = rows.filter((r) => r.kind === 'capture')
57
+ const sum = (arr, k) => arr.reduce((s, r) => s + (Number(r[k]) || 0), 0)
58
+
59
+ const byDay = []
60
+ const index = new Map()
61
+ for (let i = n - 1; i >= 0; i--) {
62
+ const key = localDay(Number(now) - i * DAY_MS)
63
+ const row = { date: key, recalls: 0, injectedChars: 0, captures: 0, llmCalls: 0, captureInChars: 0, captureOutChars: 0 }
64
+ index.set(key, row)
65
+ byDay.push(row)
66
+ }
67
+ for (const r of rows) {
68
+ const row = index.get(localDay(r.ts))
69
+ if (!row) continue
70
+ if (r.kind === 'recall') { row.recalls += 1; row.injectedChars += Number(r.chars) || 0 }
71
+ if (r.kind === 'capture') { row.captures += 1; row.llmCalls += Number(r.llm_calls) || 0; row.captureInChars += Number(r.chars_in) || 0; row.captureOutChars += Number(r.chars) || 0 }
72
+ }
73
+
74
+ // 召回有用率:只有调用方显式回传 useful 时才有数据;没有数据时 rate = null(不要假装 0%)
75
+ let useful = 0
76
+ let useless = 0
77
+ try {
78
+ const fb = db.prepare("SELECT useful, COUNT(*) AS n FROM feedback WHERE created_at >= datetime('now', ?) GROUP BY useful").all(`-${n} days`)
79
+ for (const r of fb) { if (Number(r.useful) === 1) useful = Number(r.n) || 0; else useless = Number(r.n) || 0 }
80
+ } catch { /* feedback 表缺失也不影响账本 */ }
81
+
82
+ const injectedChars = sum(recalls, 'chars')
83
+ const captureInChars = sum(captures, 'chars_in')
84
+ const captureOutChars = sum(captures, 'chars')
85
+ // 粗估 token:中英混排约 2 字符 ≈ 1 token(保守口径,只用于看量级,不做计费)
86
+ const estTokens = Math.round((injectedChars + captureInChars + captureOutChars) / 2)
87
+
88
+ return {
89
+ ok: true,
90
+ days: n,
91
+ since: cutoff,
92
+ totals: {
93
+ recalls: recalls.length,
94
+ recallResults: sum(recalls, 'results'),
95
+ injectedChars,
96
+ captures: captures.length,
97
+ captureOk: captures.filter((r) => Number(r.ok) === 1).length,
98
+ captureFail: captures.filter((r) => Number(r.ok) !== 1).length,
99
+ llmCalls: sum(captures, 'llm_calls'),
100
+ captureInChars,
101
+ captureOutChars,
102
+ estTokens,
103
+ },
104
+ byDay,
105
+ feedback: { useful, useless, total: useful + useless, rate: useful + useless ? useful / (useful + useless) : null },
106
+ }
107
+ }
package/lib/mcp.js CHANGED
@@ -16,6 +16,7 @@
16
16
  import readline from 'node:readline'
17
17
  import { search, overview, stats, ensureVault, listCards, countCards } from './vault.js'
18
18
  import { runStandaloneCapture, defaultVaultDir } from './capture-run.js'
19
+ import { recordLedger } from './ledger.js'
19
20
 
20
21
  const SUPPORTED_PROTOCOL_VERSIONS = ['2025-06-18', '2025-03-26', '2024-11-05']
21
22
  const DEFAULT_PROTOCOL_VERSION = '2024-11-05'
@@ -83,13 +84,18 @@ export async function callTool(name, args, vaultRoot, meta = {}) {
83
84
  if (!query) return toolResult('(未提供检索词)')
84
85
  const limit = Math.min(Math.max(Number(args?.limit) || 5, 1), 20)
85
86
  const hits = await search(vaultRoot, query, { limit, minScore: 2 })
86
- if (hits.length === 0) return toolResult(`记忆库中没有与「${query}」相关的内容。`)
87
+ if (hits.length === 0) {
88
+ recordLedger(vaultRoot, { kind: 'recall', results: 0, chars: 0, note: query.slice(0, 120) })
89
+ return toolResult(`记忆库中没有与「${query}」相关的内容。`)
90
+ }
87
91
  const lines = hits.map((h, i) => {
88
92
  const tags = h.tags.length ? ` [${h.tags.join(', ')}]` : ''
89
93
  const snippet = String(h.summary || '').replace(/\s+/g, ' ').trim().slice(0, 130)
90
94
  return `### ${i + 1}. ${h.title}${tags}\n路径:${h.path}\n${snippet}`
91
95
  })
92
- return toolResult(`从记忆核心检索到 ${hits.length} 条相关卡片:\n\n${lines.join('\n\n')}`)
96
+ const out = `从记忆核心检索到 ${hits.length} 条相关卡片:\n\n${lines.join('\n\n')}`
97
+ recordLedger(vaultRoot, { kind: 'recall', results: hits.length, chars: out.length, note: query.slice(0, 120) })
98
+ return toolResult(out)
93
99
  }
94
100
  case 'memory_capture': {
95
101
  const text = String(args?.text || '')
package/lib/setup.js CHANGED
@@ -19,6 +19,39 @@ export const PACKAGE_ROOT = path.join(__dirname, '..')
19
19
  export const BIN_PATH = path.join(PACKAGE_ROOT, 'bin', 'dsh-memory.mjs')
20
20
 
21
21
  const home = os.homedir()
22
+ const appdataDir = process.env.APPDATA || path.join(home, 'AppData', 'Roaming')
23
+
24
+ /** 从 MCP 客户端 JSON 配置里列出 server 名(兼容 mcpServers 与 VS Code 的 servers 两种键名)。 */
25
+ function listMcpServers(cfg, keys = ['mcpServers', 'servers']) {
26
+ if (!cfg || typeof cfg !== 'object') return []
27
+ for (const k of keys) {
28
+ const v = cfg[k]
29
+ if (v && typeof v === 'object' && !Array.isArray(v)) return Object.keys(v)
30
+ }
31
+ return []
32
+ }
33
+
34
+ /** 从 codex config.toml 里列出所有 [mcp_servers.<name>] 的 name(跳过 .env 这类二级段)。 */
35
+ function listCodexMcpServers(text) {
36
+ const names = []
37
+ for (const m of String(text || '').matchAll(/^\s*\[mcp_servers\.([A-Za-z0-9_-]+)\]\s*$/gm)) names.push(m[1])
38
+ return [...new Set(names)]
39
+ }
40
+
41
+ /**
42
+ * 只读兼容性探测清单:除可一键挂载的 claude-code / codex / cursor 之外,
43
+ * 自动识别本机常见的 MCP 客户端(存在配置文件才列出),并列出它们已配置的 MCP server。
44
+ * detectedOnly = 只展示,不提供安装/卸载按钮(不改不认识的配置格式)。
45
+ */
46
+ const DETECT_ONLY_CLIENTS = [
47
+ { name: 'gemini-cli', label: 'Gemini CLI', paths: () => [path.join(home, '.gemini', 'settings.json')] },
48
+ { name: 'windsurf', label: 'Windsurf', paths: () => [path.join(home, '.codeium', 'windsurf', 'mcp_config.json')] },
49
+ { name: 'cline', label: 'Cline', paths: () => [
50
+ path.join(appdataDir, 'Code', 'User', 'globalStorage', 'saoudrizwan.claude-dev', 'settings', 'cline_mcp_settings.json'),
51
+ path.join(appdataDir, 'Cursor', 'User', 'globalStorage', 'saoudrizwan.claude-dev', 'settings', 'cline_mcp_settings.json'),
52
+ ] },
53
+ { name: 'vscode', label: 'VS Code', paths: () => [path.join(appdataDir, 'Code', 'User', 'mcp.json')], keys: ['servers'] },
54
+ ]
22
55
 
23
56
  async function exists(p) {
24
57
  try { await fs.access(p); return true } catch { return false }
@@ -350,7 +383,7 @@ export async function getSetupStatus({ nodePath = process.execPath } = {}) {
350
383
  // claude-code
351
384
  const claudeJson = path.join(home, '.claude.json')
352
385
  if (!(await exists(claudeJson))) {
353
- agents.push({ name: 'claude-code', installed: false, mcpConfigured: false, hook: 'unknown' })
386
+ agents.push({ name: 'claude-code', label: 'Claude Code', compat: 'managed', installed: false, mcpConfigured: false, hook: 'unknown', servers: [] })
354
387
  } else {
355
388
  let cfg = null
356
389
  try { cfg = JSON.parse(await fs.readFile(claudeJson, 'utf8')) } catch {}
@@ -358,6 +391,9 @@ export async function getSetupStatus({ nodePath = process.execPath } = {}) {
358
391
  const mcpExists = !!entry
359
392
  agents.push({
360
393
  name: 'claude-code',
394
+ label: 'Claude Code',
395
+ compat: 'managed',
396
+ servers: listMcpServers(cfg),
361
397
  installed: true,
362
398
  mcpConfigured: mcpExists,
363
399
  mcpMatchesCurrentNode: mcpExists && sameMcpEntry(entry, want),
@@ -381,7 +417,7 @@ export async function getSetupStatus({ nodePath = process.execPath } = {}) {
381
417
  // codex
382
418
  const codexToml = path.join(home, '.codex', 'config.toml')
383
419
  if (!(await exists(codexToml))) {
384
- agents.push({ name: 'codex', installed: false, mcpConfigured: false })
420
+ agents.push({ name: 'codex', label: 'Codex CLI / Desktop', compat: 'managed', installed: false, mcpConfigured: false, servers: [] })
385
421
  } else {
386
422
  const text = await fs.readFile(codexToml, 'utf8')
387
423
  const has = /^\[mcp_servers\.memory\]$/m.test(text)
@@ -392,6 +428,9 @@ export async function getSetupStatus({ nodePath = process.execPath } = {}) {
392
428
  if (has) configuredNodePath = parseCodexMemoryEntry(text).command
393
429
  agents.push({
394
430
  name: 'codex',
431
+ label: 'Codex CLI / Desktop',
432
+ compat: 'managed',
433
+ servers: listCodexMcpServers(text),
395
434
  installed: true,
396
435
  mcpConfigured: has,
397
436
  mcpMatchesCurrentNode: has && configuredNodePath === nodePath,
@@ -405,9 +444,9 @@ export async function getSetupStatus({ nodePath = process.execPath } = {}) {
405
444
  const cursorJson = path.join(home, '.cursor', 'mcp.json')
406
445
  const cursorDir = path.join(home, '.cursor')
407
446
  if (!(await exists(cursorDir))) {
408
- agents.push({ name: 'cursor', installed: false, mcpConfigured: false, reason: '~/.cursor 不存在' })
447
+ agents.push({ name: 'cursor', label: 'Cursor', compat: 'managed', installed: false, mcpConfigured: false, servers: [], reason: '~/.cursor 不存在' })
409
448
  } else if (!(await exists(cursorJson))) {
410
- agents.push({ name: 'cursor', installed: true, mcpConfigured: false, mcpPath: cursorJson })
449
+ agents.push({ name: 'cursor', label: 'Cursor', compat: 'managed', installed: true, mcpConfigured: false, servers: [], mcpPath: cursorJson })
411
450
  } else {
412
451
  try {
413
452
  const cfg = JSON.parse(await fs.readFile(cursorJson, 'utf8'))
@@ -415,6 +454,9 @@ export async function getSetupStatus({ nodePath = process.execPath } = {}) {
415
454
  const mcpExists = !!entry
416
455
  agents.push({
417
456
  name: 'cursor',
457
+ label: 'Cursor',
458
+ compat: 'managed',
459
+ servers: listMcpServers(cfg),
418
460
  installed: true,
419
461
  mcpConfigured: mcpExists,
420
462
  mcpMatchesCurrentNode: mcpExists && sameMcpEntry(entry, want),
@@ -425,7 +467,27 @@ export async function getSetupStatus({ nodePath = process.execPath } = {}) {
425
467
  })
426
468
  } catch { agents.push({ name: 'cursor', installed: true, mcpConfigured: false, mcpPath: cursorJson, reason: 'JSON 解析失败' }) }
427
469
  }
428
- return { ok: true, agents, lastCheckedAt: Date.now(), want: { command: nodePath, args: want.args } }
470
+ // 兼容性探测:只列出「本机确实存在配置文件」的其它 MCP 客户端(只读,不提供挂载按钮)
471
+ for (const spec of DETECT_ONLY_CLIENTS) {
472
+ let mcpPath = ''
473
+ for (const p of spec.paths()) { if (await exists(p)) { mcpPath = p; break } }
474
+ if (!mcpPath) continue
475
+ let servers = []
476
+ let reason = ''
477
+ try { servers = listMcpServers(JSON.parse(await fs.readFile(mcpPath, 'utf8')), spec.keys) } catch { reason = 'JSON 解析失败' }
478
+ agents.push({
479
+ name: spec.name, label: spec.label, installed: true, detectedOnly: true, compat: 'detected',
480
+ mcpConfigured: servers.includes('memory'), servers, mcpPath, reason,
481
+ })
482
+ }
483
+ const allServers = [...new Set(agents.flatMap((a) => a.servers || []))]
484
+ const summary = {
485
+ detectedAgents: agents.filter((a) => a.installed).length,
486
+ mountedAgents: agents.filter((a) => a.mcpConfigured).length,
487
+ totalServers: allServers.length,
488
+ allServers,
489
+ }
490
+ return { ok: true, agents, summary, lastCheckedAt: Date.now(), want: { command: nodePath, args: want.args } }
429
491
  }
430
492
 
431
493
  // -- 会话结束自动沉淀 hook(connect <agent>,agentmemory 的 `connect --with-hooks` 兜底路径)--
@@ -1,36 +1,36 @@
1
- {
2
- "manifestVersion": 1,
3
- "id": "memory-eternal",
4
- "publisher": "eternalnight996",
5
- "name": "memory-eternal",
6
- "version": "0.15.0",
7
- "description": "Memory Atlas for Orca: open the local memory vault, pending review and knowledge graph from a sandboxed Orca panel.",
8
- "author": {
9
- "name": "EternalNight996",
10
- "url": "https://github.com/EternalNight996"
11
- },
12
- "repository": "https://github.com/EternalNight996/memory-eternal",
13
- "icon": "assets/icon.png",
14
- "engines": {
15
- "orca": ">=1.4.0"
16
- },
17
- "pluginApi": 1,
18
- "contributes": {
19
- "panels": [
20
- {
21
- "id": "memory",
22
- "title": "记忆",
23
- "icon": "brain",
24
- "entry": "panel.html"
25
- }
26
- ]
27
- },
28
- "capabilities": [
29
- {
30
- "kind": "workspace:read"
31
- },
32
- {
33
- "kind": "terminal:send"
34
- }
35
- ]
36
- }
1
+ {
2
+ "manifestVersion": 1,
3
+ "id": "memory-eternal",
4
+ "publisher": "eternalnight996",
5
+ "name": "memory-eternal",
6
+ "version": "0.17.0",
7
+ "description": "Memory Atlas for Orca: open the local memory vault, pending review and knowledge graph from a sandboxed Orca panel.",
8
+ "author": {
9
+ "name": "EternalNight996",
10
+ "url": "https://github.com/EternalNight996"
11
+ },
12
+ "repository": "https://github.com/EternalNight996/memory-eternal",
13
+ "icon": "assets/icon.png",
14
+ "engines": {
15
+ "orca": ">=1.4.0"
16
+ },
17
+ "pluginApi": 1,
18
+ "contributes": {
19
+ "panels": [
20
+ {
21
+ "id": "memory",
22
+ "title": "记忆",
23
+ "icon": "brain",
24
+ "entry": "panel.html"
25
+ }
26
+ ]
27
+ },
28
+ "capabilities": [
29
+ {
30
+ "kind": "workspace:read"
31
+ },
32
+ {
33
+ "kind": "terminal:send"
34
+ }
35
+ ]
36
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "memory-eternal",
3
- "version": "0.15.0",
3
+ "version": "0.17.0",
4
4
  "description": "记忆核心(Memory Eternal):自研的 DeepSeek Harness 记忆插件,不移植任何既有记忆框架——对话结束后自动沉淀知识卡到本地 Markdown Vault(自研去重、自研 CJK 检索、可 git 管理),设置页提供图形化知识库(统计 / 搜索 / 知识图谱 + 侧边栏一键弹窗),Agent 通过 memory_recall 工具按需召回历史上下文。零人工干预。",
5
5
  "icon": "assets/icon.png",
6
6
  "license": "MIT",
@@ -43,7 +43,7 @@
43
43
  ".mcp.json",
44
44
  "cordis.patch.yml",
45
45
  "README.md",
46
- "README.en.md",
46
+ "README.zh-CN.md",
47
47
  "LICENSE"
48
48
  ],
49
49
  "engines": {
@@ -70,7 +70,7 @@
70
70
  "release": "node scripts/release.mjs",
71
71
  "release:dry": "node scripts/release.mjs --dry-run",
72
72
  "panel-check": "node scripts/panel-check.mjs",
73
- "test": "node build.mjs && node tests/vault.test.mjs && node tests/capture.test.mjs && node tests/capture-route.test.mjs && node tests/stall.test.mjs && node tests/vault-path.test.mjs && node tests/vault-resolve.test.mjs && node tests/minhash.test.mjs && node tests/settings-save.test.mjs && node tests/config-coverage.test.mjs && node tests/config-sync.test.mjs && node tests/config-merge.test.mjs && node tests/sse.test.mjs && node tests/api.test.mjs && node tests/import-roundtrip.test.mjs && node tests/graph-perf.test.mjs && node tests/settings-compat.test.mjs && node tests/node-bin.test.mjs && node tests/watchdog-lock.test.mjs && node tests/markdown.test.mjs && node tests/feedback.test.mjs && node tests/graph-lod.test.mjs && node tests/ssr.test.mjs && node tests/web-assets.test.mjs && node tests/manifests.test.mjs && node tests/two-store.test.mjs && node tests/noise-gate.test.mjs && node tests/e2e-recall.test.mjs && node tests/issue-fixes.test.mjs && node tests/issue-fixes-2.test.mjs && node tests/issue-fixes-3.test.mjs && node tests/watchdog-orphans.test.mjs && node tests/watchdog-restart.test.mjs && node tests/readme-i18n.test.mjs && node tests/issue-fixes-4.test.mjs && node tests/host-drain.test.mjs && node tests/e2e-host-drain.mjs && node tests/issue-fixes-5.test.mjs && node tests/issue-fixes-6.test.mjs && node tests/capture-json-repair.test.mjs && node tests/csrf-origin.test.mjs && node tests/watchdog-orphan-web.test.mjs && node tests/config-validate.test.mjs && node tests/issue-fixes-8.test.mjs && node tests/issue-fixes-9.test.mjs && node tests/release-verify.test.mjs && node tests/refine.test.mjs && node tests/db-restore.test.mjs && node tests/align.test.mjs && node tests/tags-normalize.test.mjs && node tests/resident-state.test.mjs && node tests/llm-route.test.mjs && node tests/host-managed.test.mjs && node tests/replace-claim.test.mjs && node tests/version-check-self.test.mjs && node tests/setup-codex.test.mjs && node tests/listener-netstat.test.mjs && node tests/issue-46-overlay.test.mjs && node tests/graph-initial-zoom.test.mjs && node tests/card-head-actions.test.mjs && node tests/card-reader-ux.test.mjs && node tests/tag-filter.test.mjs && node tests/ui-overflow.test.mjs && node tests/version-card-state.test.mjs && node tests/llm-routes-proxy.test.mjs && node tests/model-strikes.test.mjs && node tests/support-bundle.test.mjs && node tests/health-panel.test.mjs && node tests/issue-48-timeout.test.mjs"
73
+ "test": "node build.mjs && node tests/vault.test.mjs && node tests/capture.test.mjs && node tests/capture-route.test.mjs && node tests/stall.test.mjs && node tests/vault-path.test.mjs && node tests/vault-resolve.test.mjs && node tests/minhash.test.mjs && node tests/settings-save.test.mjs && node tests/config-coverage.test.mjs && node tests/config-sync.test.mjs && node tests/config-merge.test.mjs && node tests/sse.test.mjs && node tests/api.test.mjs && node tests/import-roundtrip.test.mjs && node tests/graph-perf.test.mjs && node tests/settings-compat.test.mjs && node tests/node-bin.test.mjs && node tests/watchdog-lock.test.mjs && node tests/markdown.test.mjs && node tests/feedback.test.mjs && node tests/graph-lod.test.mjs && node tests/graph-warmup.test.mjs && node tests/loading-hints.test.mjs && node tests/web-entry.test.mjs && node tests/tui-scroll.test.mjs && node tests/tui-audit-scene.test.mjs && node tests/tui-plugin-boot.test.mjs && node tests/capture-session-id.test.mjs && node tests/ssr.test.mjs && node tests/window-controls.test.mjs && node tests/web-assets.test.mjs && node tests/manifests.test.mjs && node tests/two-store.test.mjs && node tests/noise-gate.test.mjs && node tests/e2e-recall.test.mjs && node tests/issue-fixes.test.mjs && node tests/issue-fixes-2.test.mjs && node tests/issue-fixes-3.test.mjs && node tests/watchdog-orphans.test.mjs && node tests/watchdog-restart.test.mjs && node tests/readme-i18n.test.mjs && node tests/issue-fixes-4.test.mjs && node tests/host-drain.test.mjs && node tests/e2e-host-drain.mjs && node tests/issue-fixes-5.test.mjs && node tests/issue-fixes-6.test.mjs && node tests/capture-json-repair.test.mjs && node tests/csrf-origin.test.mjs && node tests/watchdog-orphan-web.test.mjs && node tests/config-validate.test.mjs && node tests/issue-fixes-8.test.mjs && node tests/issue-fixes-9.test.mjs && node tests/release-verify.test.mjs && node tests/refine.test.mjs && node tests/db-restore.test.mjs && node tests/align.test.mjs && node tests/tags-normalize.test.mjs && node tests/resident-state.test.mjs && node tests/llm-route.test.mjs && node tests/host-managed.test.mjs && node tests/replace-claim.test.mjs && node tests/version-check-self.test.mjs && node tests/setup-codex.test.mjs && node tests/listener-netstat.test.mjs && node tests/issue-46-overlay.test.mjs && node tests/graph-initial-zoom.test.mjs && node tests/card-head-actions.test.mjs && node tests/card-reader-ux.test.mjs && node tests/tag-filter.test.mjs && node tests/ui-overflow.test.mjs && node tests/version-card-state.test.mjs && node tests/llm-routes-proxy.test.mjs && node tests/model-strikes.test.mjs && node tests/support-bundle.test.mjs && node tests/health-panel.test.mjs && node tests/issue-48-timeout.test.mjs && node tests/ledger.test.mjs"
74
74
  },
75
75
  "dependencies": {
76
76
  "@deepseek-ai/schemastery": "^3.18.1"
@@ -116,7 +116,10 @@
116
116
  "notes": "Read/write under ~/.dsh/memory-vault only (plugin-private Markdown vault). No outbound network, no credentials, no shell. Hooks/MCP run via the `node` binary that hosts the DSH process."
117
117
  },
118
118
  "lifecycle": {
119
- "scripts": ["prepare", "prepublishOnly"],
119
+ "scripts": [
120
+ "prepare",
121
+ "prepublishOnly"
122
+ ],
120
123
  "details": {
121
124
  "prepare": "node build.mjs",
122
125
  "prepublishOnly": "node build.mjs"
@@ -132,15 +132,16 @@ let notes = ''
132
132
  if (notesFile) {
133
133
  notes = fs.readFileSync(path.resolve(ROOT, notesFile), 'utf8')
134
134
  } else {
135
- // 从 README 更新日志表里取该版本那一行(| **v0.10.0** | 日期 | 说明 |)
136
- const readme = fs.readFileSync(path.join(ROOT, 'README.md'), 'utf8')
137
- const row = readme.split(/\r?\n/).find((l) => l.startsWith(`| **${tag}**`))
135
+ // 从 docs/CHANGELOG.md 取该版本那一行(| **v0.10.0** | 日期 | 说明 |);README 精简为落地页后兼容旧位置
136
+ const logFile = ['docs/CHANGELOG.md', 'README.md'].map((f) => path.join(ROOT, f)).find((f) => fs.existsSync(f))
137
+ const logText = logFile ? fs.readFileSync(logFile, 'utf8') : ''
138
+ const row = logText.split(/\r?\n/).find((l) => l.startsWith(`| **${tag}**`))
138
139
  notes = [
139
140
  `## ${tag}`,
140
141
  '',
141
142
  `npm: https://www.npmjs.com/package/memory-eternal/v/${pkg.version}`,
142
143
  '',
143
- row ? row.replace(/^\|\s*/, '').replace(/\s*\|\s*$/, '').split(/\s*\|\s*/).slice(1).join(' — ') : '(README 更新日志里没有这一版,请用 --notes-file 指定)',
144
+ row ? row.replace(/^\|\s*/, '').replace(/\s*\|\s*$/, '').split(/\s*\|\s*/).slice(1).join(' — ') : '(CHANGELOG 里没有这一版,请用 --notes-file 指定)',
144
145
  ].join('\n')
145
146
  }
146
147
  say(notes.split('\n').slice(0, 6).join('\n') + (notes.split('\n').length > 6 ? '\n…' : ''))