dsh-plugin-memory 0.8.0 → 0.8.1

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
@@ -2,6 +2,22 @@
2
2
 
3
3
  所有记录跟随 [Keep a Changelog](https://keepachangelog.com/zh-CN/1.1.0/) 风格;版本号与 `package.json` 保持一致。
4
4
 
5
+ ## [0.8.1] - 2026-09-28
6
+
7
+ ### Fixed(DSH session format v4 兼容)
8
+
9
+ - **修复注入消息被 v4 拒绝导致的运行失败**:`recall-nudge` 与 `digest-guard` 生成的消息 source 从 `{ kind: 'plugin', plugin: 'memory' }` 改为 **`{ kind: 'plugin:memory' }`**。
10
+ - **症状**:`SessionFormatError: format v4 message requires a producer-owned source kind`。它被 `dsh-agent-loop` 当作非 LLM 错误包成 `{ message, code: 'UNKNOWN' }`,界面上显示为 `... source kind UNKNOWN`——**`UNKNOWN` 是错误码,不是 kind 值**。
11
+ - **原因**:session format **v4**(官方 DeepSeek Harness **0.1.7+**)的原生准入 `source()` 明确拒绝 `kind === "plugin"` 这一 v3 时代的 wrapper,要求 producer-owned kind;第三方插件的形态是 `plugin:<name>`(`producerKind()` 的兜底分支)。
12
+ - **兼容性门槛(重要)**:v4 校验与 v3 的 `SOURCE_KINDS` 白名单**互斥**——v3 白名单里只有 `plugin`,没有 `plugin:memory`,所以**无法同时兼容两版**。**本版起要求 DSH session format v4(官方 0.1.7+)**;旧版 DSH 请停留在 0.8.0。
13
+ - **历史 session 不受影响**:v3→v4 迁移的 `rewritePluginSource()` 会自动把旧 wrapper 转换成新格式,只有**新注入**的消息需要改。
14
+
15
+ ### Tests
16
+
17
+ - `test/recall-nudge.test.mjs` / `test/digest-guard.test.mjs` 的 source 断言改为 `deepEqual(source, { kind: 'plugin:memory' })`——顺带卡住「不得再带 `plugin` 字段」。
18
+ - 先写测试并确认其失败(`actual: {kind:'plugin',plugin:'memory'}` vs `expected: {kind:'plugin:memory'}`)后才改实现。
19
+ - 单测 **32/32 通过**。全量 151 项中 3 项失败(`insights-route` / `page-access` / `plugin-metadata`)为既有的 `@deepseek-ai/schemastery` 依赖缺失,已用 `git stash` 基线对比确认**与本次改动无关**。
20
+
5
21
  ## [0.8.0] - 2026-09-24
6
22
 
7
23
  ### Added(checkup 报告 + 注入瘦身 + 日志修复)
package/README.md CHANGED
@@ -69,6 +69,16 @@ dsh plugin --profile <profile> add dsh-plugin-memory
69
69
 
70
70
  重启 profile(DSH Desktop 重启应用)后生效。
71
71
 
72
+ > 📌 **版本要求:DSH session format v4(官方 DeepSeek Harness 0.1.7+)**
73
+ >
74
+ > 注入消息的 source 使用 producer-owned kind `plugin:memory`。v4 的原生准入明确拒绝 v3 时代的
75
+ > `{ kind: 'plugin', plugin: 'memory' }` wrapper,报
76
+ > `format v4 message requires a producer-owned source kind`(该错误被包成 `code: "UNKNOWN"`,
77
+ > 所以在界面上会显示成 `... source kind UNKNOWN`——`UNKNOWN` 是错误码,不是 kind 值)。
78
+ >
79
+ > v4 与 v3 的白名单**互斥**(v3 只认 `plugin`),因此无法同时兼容两版。
80
+ > **0.8.0 及更早版本在 v4 上会触发该错误**;旧版 DSH 请停留在 0.8.0。
81
+
72
82
  > ⚠️ **不要**再往 profile 的 `cordis.patch.yml` 里手写 `- insert: {id: dsh-memory, ...}`:
73
83
  > 那会与 bundle manifest 的自动挂载产生两条同名 entry,整个 profile 会以
74
84
  > `duplicate loader entry id "dsh-memory"` 启动失败(2026-08-18 实机事故)。
@@ -78,7 +78,7 @@ export function lastStoreWriteMs(memoryDir) {
78
78
  * @param {number} staleMinutes how long the store has been unwritten
79
79
  * @param {{ indexHint?: string }} [options] optional routing-table drift line,
80
80
  * rendered on its own so the message stays a checklist, not a paragraph
81
- * @returns {{ id: string, role: 'user', content: [{type:'text', text:string}], source: {kind:'plugin', plugin:string} }}
81
+ * @returns {{ id: string, role: 'user', content: [{type:'text', text:string}], source: {kind:'plugin:memory'} }}
82
82
  */
83
83
  export function buildDigestNudgeMessage(staleMinutes, options = {}) {
84
84
  const hint = typeof options.hint === 'string' ? options.hint.trim() : ''
@@ -100,7 +100,10 @@ export function buildDigestNudgeMessage(staleMinutes, options = {}) {
100
100
  '完成后继续手头的事即可,不要开启新任务。',
101
101
  ].join('\n'),
102
102
  }],
103
- source: { kind: 'plugin', plugin: 'memory' },
103
+ // Session format v4 admits only a producer-owned kind. The retired
104
+ // {kind:'plugin', plugin:'memory'} wrapper is rejected at adoption
105
+ // ("format v4 message requires a producer-owned source kind").
106
+ source: { kind: 'plugin:memory' },
104
107
  }
105
108
  }
106
109
 
@@ -69,7 +69,7 @@ export function listRecallCandidates(memoryDir, count = 3) {
69
69
  * not a command: first-person, Small-Blue voice, explicitly bounded by
70
70
  * "only what's really in memory, never invent, don't repeat yourself".
71
71
  * @param {string[]} candidates optional seed headlines
72
- * @returns {{ id: string, role: 'user', content: [{type:'text', text:string}], source: {kind:'plugin', plugin:string} }}
72
+ * @returns {{ id: string, role: 'user', content: [{type:'text', text:string}], source: {kind:'plugin:memory'} }}
73
73
  */
74
74
  export function buildRecallNudgeMessage(candidates) {
75
75
  const list = Array.isArray(candidates)
@@ -92,7 +92,10 @@ export function buildRecallNudgeMessage(candidates) {
92
92
  seed,
93
93
  ].filter(Boolean).join('\n'),
94
94
  }],
95
- source: { kind: 'plugin', plugin: 'memory' },
95
+ // Session format v4 admits only a producer-owned kind. The retired
96
+ // {kind:'plugin', plugin:'memory'} wrapper is rejected at adoption
97
+ // ("format v4 message requires a producer-owned source kind").
98
+ source: { kind: 'plugin:memory' },
96
99
  }
97
100
  }
98
101
 
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "dsh-plugin-memory",
3
3
  "description": "Long-term memory plugin for DeepSeek Harness: persistent cross-session markdown memory with a soul/persona file, auto-injected at every session start, plus remember/recall/consolidate/forget workflows and portable migration tooling.",
4
- "version": "0.8.0",
4
+ "version": "0.8.1",
5
5
  "license": "MIT",
6
6
  "type": "module",
7
7
  "main": "lib/index.js",