dsh-plugin-memory 0.19.3 → 0.19.5

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,26 @@
2
2
 
3
3
  所有记录跟随 [Keep a Changelog](https://keepachangelog.com/zh-CN/1.1.0/) 风格;版本号与 `package.json` 保持一致。
4
4
 
5
+ ## [0.19.5] - 2026-11-12
6
+
7
+ ### Fixed
8
+
9
+ - **page-access 记账健壮性**:`agent/inbox/inserted` 监听器整体 try/catch(写盘/渲染异常只 warn,不污染宿主事件分发);`stamped` 集合在 agent 销毁时删除,长期多会话不再累积会话 id。
10
+
11
+ ### Changed
12
+
13
+ - 商店条目更新到 0.19.x(README 与市场描述同步 rc.2 兼容要求:rc.2 用户必须 ≥0.19.2)。
14
+
15
+ ## [0.19.4] - 2026-11-12
16
+
17
+ ### Fixed
18
+
19
+ - **新版本兼容老版本 DSH**:agent 注册表读取改为「`roots()` 优先、失败回退 `list()`」——0.2.1-rc.5 … 0.2.2-rc.1 走老语义(只取根 agent,行为与旧版插件一致),0.2.2-rc.2 走 `list()`;老版用户升级插件不会出现任何行为变化。
20
+
21
+ ### Docs
22
+
23
+ - README 中英增加「双向兼容」说明:同一份 0.19.2+ 构建同时跑在老宿主与 rc.2 上,升级插件不破坏老版本。
24
+
5
25
  ## [0.19.3] - 2026-11-12
6
26
 
7
27
  ### Docs
package/README.md CHANGED
@@ -16,6 +16,8 @@
16
16
 
17
17
  > **⚠️ Using DSH 0.2.2-rc.2 or newer? Upgrade the plugin to 0.19.2+ first.** Early 0.19.x reads `ctx.agents.roots()`, which rc.2 replaced with `list()`; the resulting throw happens inside the **serial** `agent/created` listener, which rejects agent registration — the visible symptom is **sessions can no longer be created while the plugin is enabled**. 0.19.2 reads the registry compatibly (never throws) and the change needs a **full DSH restart** to take effect `/memory` and the panel stay offline-safe meanwhile.
18
18
 
19
+ > **Compatibility is two-way.** 0.19.2+ reads the agent registry with `agents.roots()` first and falls back to `agents.list()`, so the same build runs on legacy hosts (0.2.1-rc.5 … 0.2.2-rc.1) *and* on rc.2. Upgrading the plugin never breaks an older DSH install, and rc.2 support does not drop older versions.
20
+
19
21
  ## What it does
20
22
 
21
23
  A Cordis plugin that gives DSH agents **persistent, cross-session, migratable memory**: plain markdown + git (the *LLM Wiki* pattern), a `SOUL.md` persona, and a boot block **auto-injected through runtime context** — a hard guarantee, not a hope that the model decides to call a skill.
package/README.zh.md CHANGED
@@ -16,6 +16,8 @@
16
16
 
17
17
  > **⚠️ 如果你在用 DSH 0.2.2-rc.2 或更高版本,请务必先把插件升级到 0.19.2+。** 早期 0.19.x 调用了 `ctx.agents.roots()`,而 rc.2 已换成 `list()`;这次抛错发生在 **serial** 的 `agent/created` 监听器里,会**拒绝 agent 注册**——表现就是**开启插件后无法新建会话**。0.19.2 改为兼容读取(绝不抛错),升级后需要**完全重启 DSH** 才生效。
18
18
 
19
+ > **双向兼容。** 0.19.2+ 读取 agent 注册表时**优先 `agents.roots()`、失败回退 `agents.list()`**——同一份构建既支持老宿主(0.2.1-rc.5 … 0.2.2-rc.1),也支持 rc.2。老版本 DSH 用户升级插件不会坏,rc.2 支持也不会丢掉老版本。
20
+
19
21
  ## 它是干什么的
20
22
 
21
23
  一个 Cordis 插件,给 DSH 的 agent 装上**跨会话、可迁移的持久记忆**:纯 markdown + git(*LLM Wiki* 模式)、一份 `SOUL.md` 人格,以及通过 runtime context **自动注入的 boot 块**——硬保证,不靠模型自觉去调 skill。
@@ -26,8 +26,8 @@
26
26
  },
27
27
  "versions": [
28
28
  {
29
- "version": "0.19.2",
30
- "publishTimestamp": 1794411248,
29
+ "version": "0.19.4",
30
+ "publishTimestamp": 1794412124,
31
31
  "source": {
32
32
  "type": "npm"
33
33
  },
package/lib/index.js CHANGED
@@ -275,13 +275,24 @@ export function apply(ctx, config = {}) {
275
275
  * Read the registry compatibly and never throw.
276
276
  */
277
277
  const rootAgents = () => {
278
- try {
279
- const service = ctx.agents
280
- if (service === undefined) return []
281
- if (typeof service.list === 'function') return service.list()
282
- if (typeof service.roots === 'function') return service.roots()
283
- } catch {
284
- // registry not ready yet
278
+ const service = ctx.agents
279
+ if (service === undefined) return []
280
+ // Older hosts (0.2.1-rc.5 ... 0.2.2-rc.1) expose roots(); rc.2 replaced it
281
+ // with list(). Prefer roots so root-only semantics stay identical on old
282
+ // hosts, and fall back to list() on newer ones.
283
+ if (typeof service.roots === 'function') {
284
+ try {
285
+ return service.roots()
286
+ } catch {
287
+ // fall through to list()
288
+ }
289
+ }
290
+ if (typeof service.list === 'function') {
291
+ try {
292
+ return service.list()
293
+ } catch {
294
+ // registry not ready yet
295
+ }
285
296
  }
286
297
  return []
287
298
  }
@@ -575,26 +586,36 @@ export function apply(ctx, config = {}) {
575
586
  if (!isRootAgent(agent)) return
576
587
  agent.ctx.effect(() => {
577
588
  const stopInserted = ctx.on('agent/inbox/inserted', ({ agent: target, message }) => {
578
- if (target?.id !== agent.id) return
579
- if (message?.source?.kind !== 'user') return
580
- if (stamped.has(agent.id)) return
581
- const resolved = store.get()
582
- if (!sessionEnabled(agent, resolved)) return
583
- if (!tracker.shouldInject(agent.id, resolved)) return
584
- stamped.add(agent.id)
589
+ // Never let bookkeeping throw inside the host's event dispatch.
585
590
  try {
586
- const memoryDir = currentMemoryDir
587
- const block = renderBootBlock(memoryDir, { bootFiles, bootMaxChars, bootFileBudgets })
588
- const referenced = extractReferencedPages(block, memoryDir)
589
- const touched = touchPages(memoryDir, [...bootFiles, ...referenced])
590
- if (touched.length > 0) {
591
- ctx.logger?.info?.(`memory: last_access stamped on ${touched.length} page(s)`)
591
+ if (target?.id !== agent.id) return
592
+ if (message?.source?.kind !== 'user') return
593
+ if (stamped.has(agent.id)) return
594
+ const resolved = store.get()
595
+ if (!sessionEnabled(agent, resolved)) return
596
+ if (!tracker.shouldInject(agent.id, resolved)) return
597
+ stamped.add(agent.id)
598
+ try {
599
+ const memoryDir = currentMemoryDir
600
+ const block = renderBootBlock(memoryDir, { bootFiles, bootMaxChars, bootFileBudgets })
601
+ const referenced = extractReferencedPages(block, memoryDir)
602
+ const touched = touchPages(memoryDir, [...bootFiles, ...referenced])
603
+ if (touched.length > 0) {
604
+ ctx.logger?.info?.(`memory: last_access stamped on ${touched.length} page(s)`)
605
+ }
606
+ } catch (error) {
607
+ ctx.logger?.warn?.(`memory: last_access stamp failed: ${error instanceof Error ? error.message : String(error)}`)
592
608
  }
593
609
  } catch (error) {
594
- ctx.logger?.warn?.(`memory: last_access stamp failed: ${error instanceof Error ? error.message : String(error)}`)
610
+ ctx.logger?.warn?.(`memory: page-access listener failed: ${error instanceof Error ? error.message : String(error)}`)
595
611
  }
596
612
  })
597
- return () => stopInserted?.()
613
+ return () => {
614
+ // The session id is unique, so forgetting it on teardown only
615
+ // releases memory; it can never cause a re-stamp of a live session.
616
+ stamped.delete(agent.id)
617
+ stopInserted?.()
618
+ }
598
619
  })
599
620
 
600
621
  } catch (error) {
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.19.3",
4
+ "version": "0.19.5",
5
5
  "license": "MIT",
6
6
  "type": "module",
7
7
  "main": "lib/index.js",