dsh-plugin-memory 0.18.4 → 0.19.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,24 @@
2
2
 
3
3
  所有记录跟随 [Keep a Changelog](https://keepachangelog.com/zh-CN/1.1.0/) 风格;版本号与 `package.json` 保持一致。
4
4
 
5
+ ## [0.19.1] - 2026-11-11
6
+
7
+ ### Fixed
8
+
9
+ - **开启 memory 后会话不可用(DSH 0.2.2-rc.2)**:`ctx.systemPrompt.context` 的两个 `text` 回调若抛错会让整个 prompt 构建失败、所有会话发不出消息。两个回调(boot / 最近动态)现在整体 try/catch,异常只记录日志并返回空串——最坏情况记忆不注入,会话照常可用。
10
+ - 会话 chip 兼容 rc.2 的 `conversation.input.left` 空 props:宿主不传 `sessionId` 时请求走 `/api/memory/session` 的活跃会话兜底(不再直接隐藏 chip)。
11
+
12
+ ## [0.19.0] - 2026-11-11
13
+
14
+ ### Changed
15
+
16
+ - **兼容 DSH 0.2.2-rc.2**:`engines.dsh` 扩为 `^0.2.1-rc.5 || ^0.2.2-rc.2`,`@deepseek-ai/dsh-skill` / `dsh-system-prompt` 的 peer 范围同步覆盖 `^0.2.2-rc.2`——使用默认 semver 语义的工具/界面不再把插件误判成"不兼容 rc.2"(DSH 自身闸门本来就带 `includePrerelease`)。
17
+ - 设置分区(`settings.section`)注册加容错:宿主 slot 契约变化时,面板入口不显示,但 boot 注入、memory 技能、HTTP 路由、CLI 不受影响。
18
+
19
+ ### Fixed
20
+
21
+ - 按 0.2.2-rc.2 的客户端变更做了防御:侧栏导航服务继续用 `ctx.reflect.get` 懒解析、chip 下拉自绘定位、设置导航图标按文本认领,不依赖 rc.2 调整过的浮层定位与导航内部接口。
22
+
5
23
  ## [0.18.4] - 2026-11-10
6
24
 
7
25
  ### Fixed
package/README.md CHANGED
@@ -12,7 +12,7 @@
12
12
 
13
13
  > Long-term memory for DeepSeek Harness — a portable markdown memory store with a soul, injected at every session start.
14
14
 
15
- **macOS · Windows · Linux** · Node ≥ 18 · DSH `^0.2.1-rc.5` · MIT
15
+ **macOS · Windows · Linux** · Node ≥ 18 · DSH `^0.2.1-rc.5` / `0.2.2-rc.2` · MIT
16
16
 
17
17
  ## What it does
18
18
 
package/README.zh.md CHANGED
@@ -12,7 +12,7 @@
12
12
 
13
13
  > 给 DeepSeek Harness 的长期记忆 —— 一个可迁移的 markdown 记忆库,还带一份灵魂,每次会话启动自动注入。
14
14
 
15
- **macOS · Windows · Linux** 全平台支持 · Node ≥ 18 · DSH `^0.2.1-rc.5` · MIT
15
+ **macOS · Windows · Linux** 全平台支持 · Node ≥ 18 · DSH `^0.2.1-rc.5` / `0.2.2-rc.2` · MIT
16
16
 
17
17
  ## 它是干什么的
18
18
 
@@ -71,7 +71,7 @@ When every file fits inside its equal share this is byte-for-byte the old even-s
71
71
 
72
72
  ## Compatibility
73
73
 
74
- `package.json` declares `engines.dsh: "^0.2.1-rc.5"` and the host enforces it with `semver.satisfies(..., { includePrerelease: true })` — `^0.2.1` or `>=0.2.0` do **not** match the prerelease. The `locale` service (0.11+) and session projections (0.12+) are load-bearing. On older hosts the gate refuses the plugin instead of running it half-broken; at runtime a missing projection degrades gracefully.
74
+ `package.json` declares `engines.dsh: "^0.2.1-rc.5 || ^0.2.2-rc.2"` and the host enforces it with `semver.satisfies(..., { includePrerelease: true })` — `^0.2.1` or `>=0.2.0` do **not** match the prerelease. The `locale` service (0.11+) and session projections (0.12+) are load-bearing. On older hosts the gate refuses the plugin instead of running it half-broken; at runtime a missing projection degrades gracefully.
75
75
 
76
76
  ## Language
77
77
 
@@ -26,13 +26,13 @@
26
26
  },
27
27
  "versions": [
28
28
  {
29
- "version": "0.18.3",
30
- "publishTimestamp": 1794277109,
29
+ "version": "0.19.0",
30
+ "publishTimestamp": 1794409756,
31
31
  "source": {
32
32
  "type": "npm"
33
33
  },
34
34
  "engines": {
35
- "dsh": "^0.2.1-rc.5"
35
+ "dsh": "^0.2.1-rc.5 || ^0.2.2-rc.2"
36
36
  }
37
37
  }
38
38
  ]
package/lib/client.js CHANGED
@@ -1092,9 +1092,14 @@ window.__ModuleLoader__.load({
1092
1092
  const [open, setOpen] = React.useState(false)
1093
1093
  const [error, setError] = React.useState(undefined)
1094
1094
 
1095
+ // Some hosts (e.g. DSH 0.2.2-rc.2) render this slot without a sessionId;
1096
+ // the host route then falls back to the active session.
1097
+ const hasSessionId = typeof sessionId === 'string' && sessionId.length > 0
1095
1098
  const read = () => {
1096
- if (typeof sessionId !== 'string' || sessionId.length === 0) return
1097
- fetch(`${SESSION_URL}?sessionId=${encodeURIComponent(sessionId)}`)
1099
+ const url = hasSessionId
1100
+ ? `${SESSION_URL}?sessionId=${encodeURIComponent(sessionId)}`
1101
+ : SESSION_URL
1102
+ fetch(url)
1098
1103
  .then(async (response) => (response.ok ? response.json() : undefined))
1099
1104
  .then((value) => {
1100
1105
  if (value === undefined) return
@@ -1105,7 +1110,6 @@ window.__ModuleLoader__.load({
1105
1110
  }
1106
1111
 
1107
1112
  React.useEffect(() => {
1108
- if (typeof sessionId !== 'string' || sessionId.length === 0) return undefined
1109
1113
  read()
1110
1114
  const timer = typeof setInterval === 'function' ? setInterval(read, 10000) : undefined
1111
1115
  return () => {
@@ -1121,7 +1125,6 @@ window.__ModuleLoader__.load({
1121
1125
  return () => document.removeEventListener('mousedown', close)
1122
1126
  }, [open])
1123
1127
 
1124
- if (typeof sessionId !== 'string' || sessionId.length === 0) return null
1125
1128
  const enabled = state === undefined ? true : state.ok !== false && state.effective !== false
1126
1129
  const workspaceMuted = state?.workspaceDisabled === true
1127
1130
 
@@ -1131,7 +1134,7 @@ window.__ModuleLoader__.load({
1131
1134
  fetch(SESSION_URL, {
1132
1135
  method: 'POST',
1133
1136
  headers: { 'content-type': 'application/json' },
1134
- body: JSON.stringify({ action, sessionId }),
1137
+ body: JSON.stringify(hasSessionId ? { action, sessionId } : { action }),
1135
1138
  })
1136
1139
  .then(async (response) => {
1137
1140
  const body = await response.json().catch(() => ({}))
@@ -2593,13 +2596,19 @@ window.__ModuleLoader__.load({
2593
2596
  }
2594
2597
  return sectionLabel(active)
2595
2598
  }
2596
- ctx.slots.inject('settings.section', () => ctx.slots.register({
2597
- name: 'settings.section',
2598
- id: 'memory',
2599
- order: 100,
2600
- locale: LOCALE_NS,
2601
- label: labelOf,
2602
- }, MemorySection))
2599
+ // The panel entry is the only slot we own; if a future host changes the
2600
+ // slot contract, keep the rest of the plugin (boot, skill, routes) alive.
2601
+ try {
2602
+ ctx.slots.inject('settings.section', () => ctx.slots.register({
2603
+ name: 'settings.section',
2604
+ id: 'memory',
2605
+ order: 100,
2606
+ locale: LOCALE_NS,
2607
+ label: labelOf,
2608
+ }, MemorySection))
2609
+ } catch {
2610
+ // no settings panel entry on this host
2611
+ }
2603
2612
  // 会话内开关(composer 工具行左侧 chip)。旧宿主可能不声明该 slot:
2604
2613
  // 注册失败只影响 chip,/memory 命令与设置面板入口仍然可用。
2605
2614
  try {
package/lib/index.js CHANGED
@@ -412,38 +412,46 @@ export function apply(ctx, config = {}) {
412
412
  name: 'memory-boot',
413
413
  order: -200,
414
414
  text: (context) => {
415
- // Per-agent gate: no agent context (e.g. a global preview) injects
416
- // unconditionally; an agent injects only once it has spoken and is
417
- // the active session.
418
- const resolved = store.get()
419
- const agent = context?.agent
420
- // User intent first (the session switch), then the two polite gates.
421
- if (agent && !sessionEnabled(agent, resolved)) return ''
422
- if (agent && !tracker.shouldInject(agent.id, resolved)) return ''
423
- // Tone drift rides on the boot block (charged to its budget). Read
424
- // live from the store so the Settings select applies on the next
425
- // prompt build without a reload.
426
- const toneGuide = resolved.toneGuideEnabled
427
- ? buildToneGuide({ intensity: resolved.toneIntensity, language: 'zh' })
428
- : ''
429
- const options = {
430
- bootFiles,
431
- bootMaxChars,
432
- bootFileBudgets,
433
- toneGuide,
434
- // The volatile log tail is injected by `memory-recent` instead.
435
- includeRecentActivity: false,
436
- }
437
- if (agent && resolved.bootSnapshot === 'session') {
438
- const signature = snapshotSignature(resolved, memoryDir)
439
- const hit = bootSnapshots.get(agent.id)
440
- if (hit !== undefined && hit.signature === signature) return hit.text
441
- const text = renderBootBlock(memoryDir, options)
442
- bootSnapshots.set(agent.id, { text, signature })
443
- if (bootSnapshots.size > 64) bootSnapshots.delete(bootSnapshots.keys().next().value)
444
- return text
415
+ // A throwing runtime-context callback fails the whole prompt build and
416
+ // makes every session unusable. Swallow errors: worst case memory is
417
+ // not injected, the session keeps working.
418
+ try {
419
+ // Per-agent gate: no agent context (e.g. a global preview) injects
420
+ // unconditionally; an agent injects only once it has spoken and is
421
+ // the active session.
422
+ const resolved = store.get()
423
+ const agent = context?.agent
424
+ // User intent first (the session switch), then the two polite gates.
425
+ if (agent && !sessionEnabled(agent, resolved)) return ''
426
+ if (agent && !tracker.shouldInject(agent.id, resolved)) return ''
427
+ // Tone drift rides on the boot block (charged to its budget). Read
428
+ // live from the store so the Settings select applies on the next
429
+ // prompt build without a reload.
430
+ const toneGuide = resolved.toneGuideEnabled
431
+ ? buildToneGuide({ intensity: resolved.toneIntensity, language: 'zh' })
432
+ : ''
433
+ const options = {
434
+ bootFiles,
435
+ bootMaxChars,
436
+ bootFileBudgets,
437
+ toneGuide,
438
+ // The volatile log tail is injected by `memory-recent` instead.
439
+ includeRecentActivity: false,
440
+ }
441
+ if (agent && resolved.bootSnapshot === 'session') {
442
+ const signature = snapshotSignature(resolved, memoryDir)
443
+ const hit = bootSnapshots.get(agent.id)
444
+ if (hit !== undefined && hit.signature === signature) return hit.text
445
+ const text = renderBootBlock(memoryDir, options)
446
+ bootSnapshots.set(agent.id, { text, signature })
447
+ if (bootSnapshots.size > 64) bootSnapshots.delete(bootSnapshots.keys().next().value)
448
+ return text
449
+ }
450
+ return renderBootBlock(memoryDir, options)
451
+ } catch (error) {
452
+ ctx.logger?.warn?.(`memory: boot context failed: ${error instanceof Error ? error.message : String(error)}`)
453
+ return ''
445
454
  }
446
- return renderBootBlock(memoryDir, options)
447
455
  },
448
456
  })
449
457
  // The volatile tail (recent log entries) lives in its own segment with a
@@ -452,11 +460,16 @@ export function apply(ctx, config = {}) {
452
460
  name: 'memory-recent',
453
461
  order: 900,
454
462
  text: (context) => {
455
- const resolved = store.get()
456
- const agent = context?.agent
457
- if (agent && !sessionEnabled(agent, resolved)) return ''
458
- if (agent && !tracker.shouldInject(agent.id, resolved)) return ''
459
- return renderRecentActivity(memoryDir)
463
+ try {
464
+ const resolved = store.get()
465
+ const agent = context?.agent
466
+ if (agent && !sessionEnabled(agent, resolved)) return ''
467
+ if (agent && !tracker.shouldInject(agent.id, resolved)) return ''
468
+ return renderRecentActivity(memoryDir)
469
+ } catch (error) {
470
+ ctx.logger?.warn?.(`memory: recent context failed: ${error instanceof Error ? error.message : String(error)}`)
471
+ return ''
472
+ }
460
473
  },
461
474
  })
462
475
  } else {
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.18.4",
4
+ "version": "0.19.1",
5
5
  "license": "MIT",
6
6
  "type": "module",
7
7
  "main": "lib/index.js",
@@ -43,7 +43,7 @@
43
43
  },
44
44
  "engines": {
45
45
  "node": ">=18",
46
- "dsh": "^0.2.1-rc.5"
46
+ "dsh": "^0.2.1-rc.5 || ^0.2.2-rc.2"
47
47
  },
48
48
  "keywords": [
49
49
  "deepseek-harness",
@@ -58,8 +58,8 @@
58
58
  ],
59
59
  "peerDependencies": {
60
60
  "@deepseek-ai/cordis": "^4.0.1",
61
- "@deepseek-ai/dsh-skill": "^0.1.2-alpha.1 || ^0.2.0-rc.1",
62
- "@deepseek-ai/dsh-system-prompt": "^0.1.2-alpha.1 || ^0.2.0-rc.1",
61
+ "@deepseek-ai/dsh-skill": "^0.1.2-alpha.1 || ^0.2.0-rc.1 || ^0.2.2-rc.2",
62
+ "@deepseek-ai/dsh-system-prompt": "^0.1.2-alpha.1 || ^0.2.0-rc.1 || ^0.2.2-rc.2",
63
63
  "@deepseek-ai/schemastery": "^3.18.1"
64
64
  },
65
65
  "repository": {