dsh-mnemon 0.2.16 → 0.3.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.
Files changed (108) hide show
  1. package/README.md +11 -4
  2. package/README.zh-CN.md +11 -4
  3. package/SECURITY.md +12 -5
  4. package/lib/client.js +256 -24
  5. package/lib/contracts.js +36 -0
  6. package/lib/extension-sdk.js +238 -0
  7. package/lib/index.js +1944 -2865
  8. package/lib/kernel.js +1126 -0
  9. package/lib/layers/documents.js +31 -0
  10. package/lib/layers/memory-spaces.js +34 -0
  11. package/lib/layers/runtime.js +27 -0
  12. package/lib/provider-sdk.js +2 -0
  13. package/lib/registry-B9SdBRLo.js +2423 -0
  14. package/lib/strategy-default-three-tier.js +99 -0
  15. package/lib/strategy-sdk.js +56 -0
  16. package/lib/types/packages/contracts/src/index.d.ts +221 -0
  17. package/lib/types/packages/extension-sdk/src/index.d.ts +54 -0
  18. package/lib/types/packages/kernel/src/access.d.ts +14 -0
  19. package/lib/types/packages/kernel/src/catalog.d.ts +42 -0
  20. package/lib/types/packages/kernel/src/index.d.ts +5 -0
  21. package/lib/types/packages/kernel/src/kernel.d.ts +46 -0
  22. package/lib/types/packages/kernel/src/topology.d.ts +25 -0
  23. package/lib/types/packages/kernel/src/view.d.ts +78 -0
  24. package/lib/types/packages/layer-documents/src/index.d.ts +4 -0
  25. package/lib/types/packages/layer-memory-spaces/src/index.d.ts +4 -0
  26. package/lib/types/packages/layer-runtime/src/index.d.ts +4 -0
  27. package/lib/types/packages/provider-sdk/src/index.d.ts +19 -0
  28. package/lib/types/packages/strategy-default-three-tier/src/index.d.ts +7 -0
  29. package/lib/types/packages/strategy-sdk/src/index.d.ts +35 -0
  30. package/lib/types/{client → src/client}/api.d.ts +2 -1
  31. package/lib/types/{client → src/client}/locales.d.ts +34 -0
  32. package/lib/types/{contracts.d.ts → src/contracts.d.ts} +3 -0
  33. package/lib/types/{documents.d.ts → src/documents.d.ts} +7 -2
  34. package/lib/types/src/guidance.d.ts +23 -0
  35. package/lib/types/{index.d.ts → src/index.d.ts} +3 -1
  36. package/lib/types/{lifecycle.d.ts → src/lifecycle.d.ts} +5 -9
  37. package/lib/types/{live-runtime.d.ts → src/live-runtime.d.ts} +30 -3
  38. package/lib/types/{memory-bodies.d.ts → src/memory-bodies.d.ts} +3 -0
  39. package/lib/types/src/memory-receipts.d.ts +21 -0
  40. package/lib/types/src/memory-system/access.d.ts +2 -0
  41. package/lib/types/src/memory-system/catalog.d.ts +2 -0
  42. package/lib/types/src/memory-system/contracts.d.ts +2 -0
  43. package/lib/types/src/memory-system/defaults.d.ts +6 -0
  44. package/lib/types/src/memory-system/index.d.ts +7 -0
  45. package/lib/types/src/memory-system/kernel.d.ts +2 -0
  46. package/lib/types/src/memory-system/topology.d.ts +2 -0
  47. package/lib/types/src/memory-system/view.d.ts +2 -0
  48. package/lib/types/src/memory-view.d.ts +15 -0
  49. package/lib/types/src/provider-sdk.d.ts +4 -0
  50. package/lib/types/src/providers/memory-system.d.ts +6 -0
  51. package/lib/types/src/providers/registry.d.ts +23 -0
  52. package/lib/types/{runtime-memory.d.ts → src/runtime-memory.d.ts} +14 -5
  53. package/lib/types/src/search-tokens.d.ts +5 -0
  54. package/lib/types/{service.d.ts → src/service.d.ts} +9 -1
  55. package/lib/types/{shared → src/shared}/contracts.d.ts +25 -0
  56. package/lib/types/{subagent.d.ts → src/subagent.d.ts} +29 -21
  57. package/lib/types/{tools.d.ts → src/tools.d.ts} +2 -9
  58. package/package.json +42 -6
  59. package/lib/types/guidance.d.ts +0 -11
  60. /package/lib/types/{activity.d.ts → src/activity.d.ts} +0 -0
  61. /package/lib/types/{channels.d.ts → src/channels.d.ts} +0 -0
  62. /package/lib/types/{client → src/client}/GlobalLocationSetting.d.ts +0 -0
  63. /package/lib/types/{client → src/client}/MnemonDialog.d.ts +0 -0
  64. /package/lib/types/{client → src/client}/MnemonLogo.d.ts +0 -0
  65. /package/lib/types/{client → src/client}/MnemonPackSection.d.ts +0 -0
  66. /package/lib/types/{client → src/client}/MnemonSaveAction.d.ts +0 -0
  67. /package/lib/types/{client → src/client}/MnemonSettingsCard.d.ts +0 -0
  68. /package/lib/types/{client → src/client}/MnemonTurnTail.d.ts +0 -0
  69. /package/lib/types/{client → src/client}/MnemonView.d.ts +0 -0
  70. /package/lib/types/{client → src/client}/MnemonViewAppearance.d.ts +0 -0
  71. /package/lib/types/{client → src/client}/ProviderIcon.d.ts +0 -0
  72. /package/lib/types/{client → src/client}/ProviderSettingsSection.d.ts +0 -0
  73. /package/lib/types/{client → src/client}/anchor.d.ts +0 -0
  74. /package/lib/types/{client → src/client}/dsh-compat.d.ts +0 -0
  75. /package/lib/types/{client → src/client}/index.d.ts +0 -0
  76. /package/lib/types/{client → src/client}/settings.d.ts +0 -0
  77. /package/lib/types/{client → src/client}/sidebar-entry.d.ts +0 -0
  78. /package/lib/types/{client → src/client}/use-request-version.d.ts +0 -0
  79. /package/lib/types/{client → src/client}/workspace-controller.d.ts +0 -0
  80. /package/lib/types/{client → src/client}/workspace-mount.d.ts +0 -0
  81. /package/lib/types/{commands.d.ts → src/commands.d.ts} +0 -0
  82. /package/lib/types/{config-values.d.ts → src/config-values.d.ts} +0 -0
  83. /package/lib/types/{config.d.ts → src/config.d.ts} +0 -0
  84. /package/lib/types/{pack.d.ts → src/pack.d.ts} +0 -0
  85. /package/lib/types/{process.d.ts → src/process.d.ts} +0 -0
  86. /package/lib/types/{provider-placement.d.ts → src/provider-placement.d.ts} +0 -0
  87. /package/lib/types/{providers → src/providers}/byterover.d.ts +0 -0
  88. /package/lib/types/{providers → src/providers}/catalog.d.ts +0 -0
  89. /package/lib/types/{providers → src/providers}/hindsight.d.ts +0 -0
  90. /package/lib/types/{providers → src/providers}/holographic.d.ts +0 -0
  91. /package/lib/types/{providers → src/providers}/honcho.d.ts +0 -0
  92. /package/lib/types/{providers → src/providers}/http.d.ts +0 -0
  93. /package/lib/types/{providers → src/providers}/mem0.d.ts +0 -0
  94. /package/lib/types/{providers → src/providers}/openviking.d.ts +0 -0
  95. /package/lib/types/{providers → src/providers}/provider.d.ts +0 -0
  96. /package/lib/types/{providers → src/providers}/retaindb.d.ts +0 -0
  97. /package/lib/types/{providers → src/providers}/supermemory.d.ts +0 -0
  98. /package/lib/types/{recall-quality → src/recall-quality}/contracts.d.ts +0 -0
  99. /package/lib/types/{recall-quality → src/recall-quality}/engine.d.ts +0 -0
  100. /package/lib/types/{recall-quality → src/recall-quality}/index.d.ts +0 -0
  101. /package/lib/types/{recall-quality → src/recall-quality}/policies.d.ts +0 -0
  102. /package/lib/types/{recall-quality → src/recall-quality}/registry.d.ts +0 -0
  103. /package/lib/types/{review-activity.d.ts → src/review-activity.d.ts} +0 -0
  104. /package/lib/types/{rpc.d.ts → src/rpc.d.ts} +0 -0
  105. /package/lib/types/{runner.d.ts → src/runner.d.ts} +0 -0
  106. /package/lib/types/{settings.d.ts → src/settings.d.ts} +0 -0
  107. /package/lib/types/{storage-scope.d.ts → src/storage-scope.d.ts} +0 -0
  108. /package/lib/types/{version-updates.d.ts → src/version-updates.d.ts} +0 -0
package/README.md CHANGED
@@ -3,7 +3,7 @@
3
3
  <p align="center"><strong>English</strong> · <a href="./README.zh-CN.md">简体中文</a></p>
4
4
 
5
5
  <p align="center">
6
- <img src="https://img.shields.io/badge/release-v0.2.16-5b5bd6" alt="release v0.2.16">
6
+ <img src="https://img.shields.io/badge/release-v0.3.0-5b5bd6" alt="release v0.3.0">
7
7
  <img src="https://img.shields.io/badge/memory-3%20tiers-087c5b" alt="three memory tiers">
8
8
  <img src="https://img.shields.io/badge/providers-9-c66a09" alt="nine providers">
9
9
  <img src="https://img.shields.io/badge/Node.js-%E2%89%A520-43853d" alt="Node.js 20 or newer">
@@ -22,7 +22,7 @@
22
22
  <p align="center">
23
23
  <a href="./docs/en/capabilities.md"><strong>Explore the capability map</strong></a> ·
24
24
  <a href="./docs/en/getting-started.md">Start in five minutes</a> ·
25
- <a href="./docs/en/releases/v0.2.16.md">Read the v0.2.16 notes</a> ·
25
+ <a href="./docs/en/releases/v0.3.0.md">Read the v0.3.0 notes</a> ·
26
26
  <a href="https://github.com/omdsh-dev/dsh-mnemon/blob/e6ca446e45bdd17991f3c7c98560456de465282b/docs/assets/media/dsh-mnemon-memory-system-demo.mp4">Watch the widescreen demo</a>
27
27
  </p>
28
28
 
@@ -30,6 +30,8 @@
30
30
 
31
31
  [Mnemon](https://github.com/mnemon-dev/mnemon) remains the official, prioritized native engine. The third tier is replaceable; the first two keep the same storage, workspace, and interaction model regardless of provider.
32
32
 
33
+ Since v0.3.0, the three tiers are the **default topology** of a composable kernel rather than the only shape hard-coded into every entry point. `MemoryBoot` wires trusted Layer, Adapter, Strategy, Guard, and `MemorySource` contributions into one runtime generation. Each user turn pins a lightweight `TurnView`: exact Runtime context enters Wake eagerly, while Documents and Memory Spaces contribute only bounded routing covers and keep complete recall authority Host-side. Users still install one `dsh-mnemon` package and keep the existing settings, tools, RPC, and UI workflow. See the [composable architecture](./docs/en/architecture.md#composable-memory-kernel) and [extension guide](./docs/en/extensions.md).
34
+
33
35
  ## Understand the scope in 30 seconds
34
36
 
35
37
  | Tier | Keep here | How it reaches the Agent | Managed by |
@@ -52,7 +54,11 @@ The tiers are not copies. A useful rule is: **every-turn context goes to Runtime
52
54
  | **Archive Document** | A task Agent creates a searchable cold reference before the Host moves the original | Supervised move |
53
55
  | **Turn memory** | Expands exact recall, write, and Document-search activity; each item navigates to its source | Read-only |
54
56
 
55
- These tasks do not reuse or consume the main conversation history. By default they follow DSH's new-session model route; **Settings → Memory System → Background task Agent** can select a dedicated Provider and model. That fixed route applies to every Mnemon subagent delegation (idle checkpoint review, recall, write, answer, provider placement, memory migration, USER compaction, document archive, and metadata maintenance). With DSH 0.1.1-rc.2, the first-party `deepseek-official/deepseek-v4-flash-vision-exp` route appears with an **Image input** label. Mnemon background jobs still send text-only prompts; multimodal conversation messages keep their DSH attachment references through lifecycle processing, and raw image bytes are never copied into memory.
57
+ Only the rows that explicitly name a task Agent spend a separate model context; **Search** and **Turn memory** are deterministic Host reads.
58
+
59
+ Task Agents do not reuse or consume the main conversation history. By default they follow DSH's new-session model route; **Settings → Memory System → Background task Agent** can select a dedicated Provider and model. That fixed route also applies to bounded Mnemon workers for idle checkpoint review, writes, evidence-bound answers, provider placement, memory migration, USER compaction, Document archiving, and metadata maintenance. Conversation Recall and Related stay direct Host reads and do not use this background route.
60
+
61
+ With DSH 0.1.1-rc.2, the first-party `deepseek-official/deepseek-v4-flash-vision-exp` route appears with an **Image input** label. Mnemon background jobs still send text-only prompts; multimodal conversation messages keep their DSH attachment references through lifecycle processing, and raw image bytes are never copied into memory.
56
62
 
57
63
  ## One Memory Space workflow, nine providers
58
64
 
@@ -197,7 +203,8 @@ See [Operations, security, and troubleshooting](./docs/en/operations.md) for bac
197
203
  | Configure scope, routing, and model selection | [Configuration](./docs/en/configuration.md) |
198
204
  | Back up, update, or troubleshoot | [Operations](./docs/en/operations.md) |
199
205
  | Integrate tools, commands, or RPC | [Interface reference](./docs/en/interfaces.md) |
200
- | Review the release | [v0.2.16 release notes](./docs/en/releases/v0.2.16.md) |
206
+ | Build a Layer, Adapter, Strategy, Guard, or MemorySource extension | [Extension guide](./docs/en/extensions.md) |
207
+ | Review the release | [v0.3.0 release notes](./docs/en/releases/v0.3.0.md) |
201
208
 
202
209
  See the [documentation hub](./docs/en/README.md) for the full map.
203
210
 
package/README.zh-CN.md CHANGED
@@ -3,7 +3,7 @@
3
3
  <p align="center"><a href="./README.md">English</a> · <strong>简体中文</strong></p>
4
4
 
5
5
  <p align="center">
6
- <img src="https://img.shields.io/badge/release-v0.2.16-5b5bd6" alt="发布版本 v0.2.16">
6
+ <img src="https://img.shields.io/badge/release-v0.3.0-5b5bd6" alt="发布版本 v0.3.0">
7
7
  <img src="https://img.shields.io/badge/%E8%AE%B0%E5%BF%86-3%20%E5%B1%82-087c5b" alt="三层记忆">
8
8
  <img src="https://img.shields.io/badge/Provider-9-c66a09" alt="九种 Provider">
9
9
  <img src="https://img.shields.io/badge/Node.js-%E2%89%A520-43853d" alt="Node.js 20 或更新版本">
@@ -22,7 +22,7 @@
22
22
  <p align="center">
23
23
  <a href="./docs/zh-CN/capabilities.md"><strong>先看能力地图</strong></a> ·
24
24
  <a href="./docs/zh-CN/getting-started.md">5 分钟开始</a> ·
25
- <a href="./docs/zh-CN/releases/v0.2.16.md">v0.2.16 升级说明</a> ·
25
+ <a href="./docs/zh-CN/releases/v0.3.0.md">v0.3.0 升级说明</a> ·
26
26
  <a href="https://github.com/omdsh-dev/dsh-mnemon/blob/e6ca446e45bdd17991f3c7c98560456de465282b/docs/assets/media/dsh-mnemon-memory-system-demo.mp4">观看宽屏实机演示</a>
27
27
  </p>
28
28
 
@@ -30,6 +30,8 @@
30
30
 
31
31
  [Mnemon](https://github.com/mnemon-dev/mnemon) 仍是官方优先的原生引擎。可以替换的是第三层;无论选择哪个 Provider,前两层的存储、工作区和交互心智保持不变。
32
32
 
33
+ 从 v0.3.0 开始,三层是可组合内核中的**默认拓扑**,不再是各入口各自写死的唯一结构。`MemoryBoot` 把受信任的 Layer、Adapter、Strategy、Guard 与 `MemorySource` 装配为一代运行图;每个用户回合固定一份轻量 `TurnView`:Runtime 精确内容 eager 进入 Wake,Documents 与 Memory Spaces 只给出有界路由封面,完整召回权限保留在 Host。用户仍只安装一个 `dsh-mnemon`,设置、工具、RPC 与 UI 工作流不变。参见[可组合架构](./docs/zh-CN/architecture.md#可组合记忆内核)与[扩展开发指南](./docs/zh-CN/extensions.md)。
34
+
33
35
  ## 30 秒理解能力边界
34
36
 
35
37
  | 层级 | 适合保存 | 如何进入 Agent 上下文 | 由谁管理 |
@@ -52,7 +54,11 @@
52
54
  | **归档档案** | 任务 Agent 先建立可检索冷引用,Host 验证后移动原文 | 受监督迁移 |
53
55
  | **本回合记忆** | 展开本轮召回、写入和档案检索;点击条目精确跳转 | 只读 |
54
56
 
55
- 这些任务不会复用或挤占主对话历史。默认跟随 DSH 新建会话时的模型路由;也可以在**设置 → 记忆系统 → 后台任务 Agent**单独指定 Provider 与模型。该固定路由同时作用于 coordinator 派发的所有子代理委托(空闲复盘、召回、写入、问答、Provider 选择、记忆迁移、USER 压缩、档案归档、元信息维护)。在 DSH 0.1.1-rc.2 中,第一方 `deepseek-official/deepseek-v4-flash-vision-exp` 路由会标记为**图片输入**。Mnemon 后台任务目前仍只发送文本 Prompt;多模态对话消息在生命周期处理中保留 DSH attachment 引用,不会把原始图片字节复制到记忆。
57
+ 只有明确写出“任务 Agent”的行才会消耗独立模型上下文;**检索**和**本回合记忆**都是确定性的 Host 读取。
58
+
59
+ 任务 Agent 不会复用或挤占主对话历史,默认跟随 DSH 新建会话时的模型路由;也可以在**设置 → 记忆系统 → 后台任务 Agent**单独指定 Provider 与模型。该固定路由也作用于空闲复盘、写入、证据问答、Provider 选择、记忆迁移、USER 压缩、档案归档和元信息维护等受限 Mnemon worker;对话中的 Recall 与 Related 仍由 Host 直接读取,不使用后台路由。
60
+
61
+ 在 DSH 0.1.1-rc.2 中,第一方 `deepseek-official/deepseek-v4-flash-vision-exp` 路由会标记为**图片输入**。Mnemon 后台任务目前仍只发送文本 Prompt;多模态对话消息在生命周期处理中保留 DSH attachment 引用,不会把原始图片字节复制到记忆。
56
62
 
57
63
  ## 一套记忆体工作流,九种 Provider
58
64
 
@@ -197,7 +203,8 @@ dsh plugin --profile headless add "link:/absolute/path/to/dsh-mnemon"
197
203
  | 配置范围、路由与模型 | [配置参考](./docs/zh-CN/configuration.md) |
198
204
  | 备份、更新或排障 | [运维指南](./docs/zh-CN/operations.md) |
199
205
  | 接入工具、命令或 RPC | [接口参考](./docs/zh-CN/interfaces.md) |
200
- | 查看本次升级 | [v0.2.16 发布说明](./docs/zh-CN/releases/v0.2.16.md) |
206
+ | 开发 Layer、Adapter、Strategy、Guard 或 MemorySource 扩展 | [扩展开发指南](./docs/zh-CN/extensions.md) |
207
+ | 查看本次升级 | [v0.3.0 发布说明](./docs/zh-CN/releases/v0.3.0.md) |
201
208
 
202
209
  完整目录见[文档中心](./docs/zh-CN/README.md)。
203
210
 
package/SECURITY.md CHANGED
@@ -6,7 +6,8 @@
6
6
 
7
7
  | Version | Supported |
8
8
  |---|---|
9
- | 0.1.x (npm `dsh-mnemon`) | ✅ |
9
+ | 0.3.x (npm `dsh-mnemon`) | ✅ |
10
+ | < 0.3 | ❌ |
10
11
 
11
12
  Only the latest published version receives security fixes. The plugin targets the DSH mainline snapshot it was verified against; see the compatibility baseline in [README.md](./README.md).
12
13
 
@@ -38,6 +39,7 @@ In scope:
38
39
 
39
40
  - The plugin bundle (`lib/`, `cordis.patch.yml`): data-loss, privilege-escalation, path-traversal, secret-leak, and memory-corruption style issues in plugin code.
40
41
  - The control plane: lock handling, revision conflict checks, atomic writes, and subagent isolation boundaries.
42
+ - The composable-memory boundary: Catalog/Topology generation checks, Strategy permission enforcement, non-bypassable Kernel Guards, and Plan/Receipt integrity.
41
43
  - The WebUI: XSS or injection via rendered memory content.
42
44
 
43
45
  Out of scope:
@@ -49,7 +51,9 @@ Out of scope:
49
51
  ## Known limitations
50
52
 
51
53
  - There is no deterministic credential/secret detection today. Do not write keys, tokens, or private keys into Runtime Memory, Documents, or Memory Spaces.
52
- - Memory data is local; the plugin makes no remote calls, so remote-code-execution exposure is limited to what DSH and your providers already expose.
54
+ - Cordis isolation provides lifecycle ownership and scope composition, not a security sandbox. Layer executors, Provider Adapters, Strategies, and Guards are ordinary JavaScript in the DSH Host process. Install extensions only from trusted sources.
55
+ - Model-generated Strategy source is not executed automatically. Manifests, permission wrapping, replay, and Kernel validation reduce accidental authority but cannot make hostile in-process code safe.
56
+ - Runtime Memory and Documents are local, and Mnemon Native is local by default. Enabled third-party Providers can make network or local-process calls and expose data according to their configured endpoints and credentials.
53
57
 
54
58
  ---
55
59
 
@@ -59,7 +63,8 @@ Out of scope:
59
63
 
60
64
  | 版本 | 支持 |
61
65
  |---|---|
62
- | 0.1.x(npm `dsh-mnemon`) | ✅ |
66
+ | 0.3.x(npm `dsh-mnemon`) | ✅ |
67
+ | < 0.3 | ❌ |
63
68
 
64
69
  仅最新发布版本获得安全修复。插件以验证时的 DSH mainline 快照为兼容基线,见 [README.zh-CN.md](./README.zh-CN.md)。
65
70
 
@@ -79,11 +84,13 @@ Out of scope:
79
84
 
80
85
  ### 范围
81
86
 
82
- **范围内**:插件 bundle 与 `cordis.patch.yml` 中的数据丢失、提权、路径穿越、秘密泄露类问题;控制面(锁、revision 冲突检查、原子写、子 Agent 隔离);WebUI 对记忆内容渲染的 XSS/注入。
87
+ **范围内**:插件 bundle 与 `cordis.patch.yml` 中的数据丢失、提权、路径穿越、秘密泄露类问题;控制面(锁、revision 冲突检查、原子写、子 Agent 隔离);可组合记忆边界(Catalog/Topology generation、Strategy 权限约束、不可绕过的 Kernel Guard、Plan/Receipt 完整性);WebUI 对记忆内容渲染的 XSS/注入。
83
88
 
84
89
  **范围外**:上游依赖(`mnemon`、`cordis`、DSH 核心、React)自身的问题(报告给上游,我们可协助定位与临时规避);功能缺失、文档问题(走普通 issue);你自行写入记忆数据中的凭据或秘密(插件当前没有秘密检测器,见 README 披露)。
85
90
 
86
91
  ### 已知限制
87
92
 
88
93
  - 当前没有确定性的凭据/秘密检测,请勿向热记忆、Documents 或 Memory Spaces 写入密钥、token、私钥。
89
- - 记忆数据全部本地存储,插件不发起远程调用;远程代码执行面受限于 DSH 与你的 provider 既有暴露面。
94
+ - Cordis isolate 提供生命周期所有权和作用域组合,不是安全沙箱。Layer executor、Provider Adapter、Strategy 与 Guard 都是在 DSH Host 进程执行的普通 JavaScript,只能安装受信任来源的扩展。
95
+ - 模型生成的 Strategy 源码不会自动执行。manifest、权限封装、replay 与 Kernel 校验可以降低意外越权,但无法让恶意同进程代码变安全。
96
+ - Runtime Memory 与 Documents 为本地存储,Mnemon Native 默认本地;显式启用的三方 Provider 可能按配置 endpoint 与凭据发起网络调用或本地进程调用,并向对应服务暴露数据。