dsh-plugin-xujie-memory 0.5.0 → 0.7.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 (84) hide show
  1. package/ACCEPTANCE.md +37 -0
  2. package/BUILD-PROVENANCE.json +53 -0
  3. package/CHANGELOG.md +40 -1
  4. package/LICENSE +21 -21
  5. package/README.md +67 -17
  6. package/README_EN.md +54 -8
  7. package/cordis.patch.yml +49 -49
  8. package/lib/client.js +17219 -0
  9. package/lib/controller.js +307 -0
  10. package/lib/index.js +200 -14
  11. package/lib/typert.host.d.ts +3 -0
  12. package/lib/typert.host.js +15104 -0
  13. package/lib/typert.remote-client.d.ts +40 -0
  14. package/lib/typert.remote-client.d.ts.map +1 -0
  15. package/lib/typert.remote-client.js +15093 -0
  16. package/lib/types.d.ts +13 -0
  17. package/lib/types.js +1 -0
  18. package/package.json +49 -5
  19. package/python/specs/characters/aloof.json +14 -14
  20. package/python/specs/characters/gentle.json +14 -14
  21. package/python/specs/characters/tsundere.json +14 -14
  22. package/python/specs/debt.v1.json +31 -31
  23. package/python/specs/nickname.v1.json +16 -16
  24. package/python/specs/preference.v1.json +16 -16
  25. package/python/xujie_memory/__init__.py +123 -123
  26. package/python/xujie_memory/admission.py +211 -211
  27. package/python/xujie_memory/audit.py +377 -377
  28. package/python/xujie_memory/benchmark.py +281 -281
  29. package/python/xujie_memory/character.py +199 -199
  30. package/python/xujie_memory/console.py +41 -41
  31. package/python/xujie_memory/consolidate.py +356 -356
  32. package/python/xujie_memory/due.py +121 -121
  33. package/python/xujie_memory/emotion.py +573 -573
  34. package/python/xujie_memory/engine.py +1333 -1312
  35. package/python/xujie_memory/errors.py +98 -98
  36. package/python/xujie_memory/importance.py +104 -104
  37. package/python/xujie_memory/judge.py +350 -350
  38. package/python/xujie_memory/management.py +203 -0
  39. package/python/xujie_memory/memory.py +71 -10
  40. package/python/xujie_memory/orchestrator.py +690 -666
  41. package/python/xujie_memory/phrasing.py +292 -292
  42. package/python/xujie_memory/privacy.py +105 -0
  43. package/python/xujie_memory/schema.sql +492 -480
  44. package/python/xujie_memory/server.py +76 -0
  45. package/python/xujie_memory/specs.py +170 -170
  46. package/python/xujie_memory/summary.py +238 -238
  47. package/scripts/build.mjs +19 -0
  48. package/scripts/prepack.mjs +9 -0
  49. package/scripts/test-all.mjs +9 -0
  50. package/scripts/test-node.mjs +10 -0
  51. package/src/client/MemoryPanel.tsx +536 -0
  52. package/src/client/NeuralField.tsx +88 -0
  53. package/src/client/css.d.ts +4 -0
  54. package/src/client/icons.tsx +28 -0
  55. package/src/client/index.tsx +59 -0
  56. package/src/client/memory-adapter.ts +67 -0
  57. package/src/client/model.ts +79 -0
  58. package/src/client/neural/engine.ts +999 -0
  59. package/src/client/neural/morphology.ts +219 -0
  60. package/src/client/panel.css +337 -0
  61. package/src/client/types.ts +6 -0
  62. package/src/controller.ts +88 -0
  63. package/src/generated/typert.host.js +449 -0
  64. package/src/generated/typert.remote-client.js +438 -0
  65. package/src/index.ts +2 -0
  66. package/src/types.ts +13 -0
  67. package/test/cordis-fixture.mjs +5 -0
  68. package/test/management_regression.py +187 -0
  69. package/test/node-regression.entry.mjs +52 -0
  70. package/vendor/DSH-LICENSE.txt +21 -0
  71. package/vendor/THIRD-PARTY.md +6 -0
  72. package/vendor/dsh-protocol/index.ts +484 -0
  73. package/vendor/dsh-protocol/json-value.ts +53 -0
  74. package/vendor/dsh-protocol/owned-value.ts +39 -0
  75. package/vendor/dsh-protocol/principal.ts +17 -0
  76. package/vendor/dsh-protocol/remote-access.ts +38 -0
  77. package/vendor/dsh-protocol/remote-error.ts +49 -0
  78. package/vendor/dsh-protocol/remote-info.ts +161 -0
  79. package/vendor/dsh-protocol/types.ts +939 -0
  80. package/vendor/licenses/jridgewell-gen-mapping-MIT.txt +19 -0
  81. package/vendor/licenses/jridgewell-resolve-uri-MIT.txt +19 -0
  82. package/vendor/licenses/jridgewell-sourcemap-codec-MIT.txt +19 -0
  83. package/vendor/licenses/jridgewell-trace-mapping-MIT.txt +19 -0
  84. package/vendor/licenses/zod-MIT.txt +21 -0
package/ACCEPTANCE.md ADDED
@@ -0,0 +1,37 @@
1
+ # 0.7.0 · DSH 0.2.1-rc.5 验收
2
+
3
+ ## 已验证的范围
4
+
5
+ - 17 项 Python 回归 + 13 项 Node 桥接检查通过;另用原始 0.6 内核创建临时旧库,确认真实升级备份、旧摘要修复、活跃数据保留及升级后编辑。
6
+ - Windows 隔离 DSH Web 宿主以 2000 条模拟原话验证图形上限及图外搜索;抽查不同时间的 8 条均命中,并验证旧记录编辑、删除和重启后持久性。10 路并发执行 20 次写入、20 次图快照和 60 次搜索,全部成功。这不是原生桌面客户端验收或大规模长期运行保证。
7
+ - 临时真实 SQLite / 本地 HTTP:搜索、原子编辑与替代记录、派生画像、删除/摘要清理、跨用户/跨会话隔离、冲突、并发、故障回滚、升级备份与旧残留修复。
8
+ - Host 桥接:使用 Cordis DI 测试替身并连接真实 Python 内核;校验正式生成的 DTO codecs,测试四个工具、owner 限制、缓存隔离/失效及持久化读写。
9
+ - 前端:最终实际构建的 ModuleLoader factory + 共享 React + 测试 main/slots + 临时真实 Python 内核;覆盖旋转、拖转、缩放、搜索、编辑保存、遗忘确认、证据跳转、冲突、空/错误/无权限/加载、减少动态和 390px 窄屏。测试夹具不进入生产前端。
10
+ - 这些测试不等价于启动用户日常使用的 DSH 桌面宿主;未读取真实用户数据库。
11
+
12
+ ## 必须在用户桌面确认
13
+
14
+ 1. 保留 0.6.0 原包和记忆数据备份,以原 profile 安装升级包并重启 rc.5。
15
+ 2. 左侧出现「记忆」;点击后在 DSH 当前应用内部显示页面,不开外部窗口;折叠导航后图标仍可用。
16
+ 3. 看真实 scope 和三层记录;空库不得出现演示人物或虚假记忆。图外旧记录能由搜索打开。
17
+ 4. 旋转/拖拽/缩放、自转暂停与重置;三层结构可辨;搜索能定位;小窗口布局与减少动态效果可用。
18
+ 5. 选一条无关紧要的测试记忆,编辑后保存。刷新页面、重启 DSH 再搜索,须看到新内容;原 trace 失效,画像/召回不再使用旧事实。
19
+ 6. 两处打开同一条记录,第一处修改后第二处保存旧版本,必须提示冲突或记录已替换,而不是覆盖。
20
+ 7. 删除需确认;刷新/重启后搜索与召回不再命中,相关摘要与画像不再活跃。
21
+ 8. 正常对话仍能写入记忆;自动注入不带回已纠正/已删旧材料;记忆内核故障不得阻塞对话。
22
+ 9. 禁用/卸载插件后,侧栏、样式和 Remote 注册应回收,无遗留动画和多余进程。
23
+
24
+ ## 删除与回滚的实际含义
25
+
26
+ - 遗忘是应用层清理,不是磁盘安全擦除,也不删除 DSH 聊天历史。
27
+ - 首次迁移备份 `<dbPath>.pre-0.7.0.bak` 保留迁移前数据,必须私密保存。删除操作不会修改旧备份。
28
+ - 回滚先退出 DSH/内核,保留当前库另存一份,再按需恢复备份与 0.6.0 包。备份之后的新记忆不在旧备份中;不要直接覆盖正在使用的库。
29
+
30
+ ## 界面语义
31
+
32
+ - 光纤、胞体及脉冲是结构性视觉隐喻,不是额外的真实记录;节点计数只统计真实投影。
33
+ - 原话可编辑/忘记;状态、摘要、待澄清项只读,可跳转依据。人设卡由真实库推导,并非独立修改表单。
34
+ - 当前详情时间显示记录版本的 recorded_at;编辑保留内核原始发生时间,但界面显示新版本记录时间。
35
+ - 图默认最近 250 条原话;管理界面搜索当前记忆库的全部有效原话,对话自动召回仍保留最近 800 条候选上限。
36
+
37
+ 最终补充验证:窄屏真实滚轮滚动、触屏手势(代理保存的记录)、切换节点加载时不暴露旧记录操作、同一原话锚点别名切换、卸载回收;桌面/390px 的 24 个三维视角均无层标签重叠或出界。
@@ -0,0 +1,53 @@
1
+ {
2
+ "package": "dsh-plugin-xujie-memory",
3
+ "version": "0.7.0",
4
+ "status": "acceptance-candidate-not-desktop-certified",
5
+ "baseline_sha256": "1e5bbc74cd3208be1066c164ecd8560d60a02e8a8be7a042aa4500a0e7b7c410",
6
+ "target_dsh": "0.2.1-rc.5",
7
+ "official_source": "https://github.com/deepseek-ai/deepseek-harness",
8
+ "official_tag": "dsh-v0.2.1-rc.5",
9
+ "official_commit": "b830ec950faba0a46dda564be3e2d854afed94f1",
10
+ "remote_contract_generator": "official rc.5 WorkspaceTypertGenerator; minimal SDK declaration fixture for build; concrete DTO schemas generated and tested",
11
+ "runtime_rpc": "generated strict descriptors, copied MIT protocol helpers; host-shared Cordis peer",
12
+ "test_boundary": "real temporary SQLite and HTTP; Node DI test double; not a desktop launcher test",
13
+ "windows_runtime": "preserved from supplied 0.6.0; not executed on Linux",
14
+ "frontend": {
15
+ "implementation": "Opus 5.5 delegated frontend rewrite",
16
+ "rendering": "3D coordinate projection; soma/dendrites/axon, depth, pulsing light; decorative morphology is not memory data",
17
+ "validation": "built CJS module-loader factory; simulated DSH main/slots with shared React and actual temporary Python kernel; visual states and motion/drag/zoom/reduced-motion checked",
18
+ "desktop_certification": false,
19
+ "final_integration_fixes": [
20
+ "native scroll in stacked/narrow layout and touch gesture arbitration",
21
+ "no stale detail mutation during selection/loading; save/delete selection lock",
22
+ "same-trace alias selection reload",
23
+ "screen-space three-layer caption collision avoidance"
24
+ ],
25
+ "final_parent_qa": {
26
+ "real_factory": true,
27
+ "real_temporary_kernel_save_delete": true,
28
+ "selection_race": true,
29
+ "same_trace_alias": true,
30
+ "unload_cleanup": true,
31
+ "mobile_wheel_scroll": true,
32
+ "reduced_motion": true,
33
+ "caption_layouts": 24,
34
+ "console_errors": 0
35
+ }
36
+ },
37
+ "regression_results": {
38
+ "python_unittests": 17,
39
+ "node_bridge_checks": 13,
40
+ "actual_supplied_060_database_upgrade": "passed with temporary database; consistent backup, active data retention, residual summary repair and subsequent edit",
41
+ "real_user_data_accessed": false,
42
+ "windows_runtime_bytes": "identical to supplied baseline"
43
+ },
44
+ "stress_verification": {
45
+ "windows_isolated_dsh_web": true,
46
+ "synthetic_active_traces": 2000,
47
+ "old_and_new_search_checks": "8/8",
48
+ "concurrent_http_requests": 100,
49
+ "concurrent_workers": 10,
50
+ "desktop_client_certified": false,
51
+ "description": "Management search scans all active traces in the selected scope; automatic recall remains capped at 800 candidates."
52
+ }
53
+ }
package/CHANGELOG.md CHANGED
@@ -1,5 +1,44 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.7.0(DSH 0.2.1-rc.5 验收构建)
4
+
5
+ - 修复管理界面搜索只能查到最近 800 条原话的问题;自动对话召回仍保留原候选上限。
6
+ - 增加 2000 条记忆的搜索回归和隔离环境并发压力验证。
7
+ - 正式双端插件清单、Host owner-only Remote 服务与应用内记忆面板接入。
8
+ - 原子替换式编辑、版本冲突检测、新增 memory_edit 工具。
9
+ - 遗忘清理摘要、澄清与关联投影;旧库迁移备份及残留修复。
10
+ - 按用户隔离提示词回退缓存;内核操作统一排队,避免编辑与对话写入竞争。
11
+ - 三维旋转/拖拽、三层记忆、模糊搜索、人设卡与持久化管理。
12
+ - 新建测试集;不沿用旧 CHANGELOG 中已丢失测试集的通过数。
13
+ - Windows DSH 桌面真机验收待完成,不宣称已通过。
14
+
15
+ ## 0.6.0(内核 0.52.0)
16
+
17
+ ### 发布前修复
18
+ - 修正三个工具的输出 schema,使其符合 DSH 的原始 JSON Schema 校验。
19
+ - 工具使用实际会话标识与账户,删除后刷新画像投影并清除注入缓存。
20
+ - 移除包内 Python 字节码缓存;新增删除后画像回归测试。
21
+ - 暂无记忆编辑工具和图形化管理界面。
22
+
23
+ ### 新增:主动工具(三个)
24
+ - `memory_search`:按字面/错字模糊检索记忆原话,返回内容、`trace_id` 与权重。只读。
25
+ - `memory_forget`:删一条记忆——软删(内容清空、FTS 移除、依赖它的事实失效并重算,`erased_at` 留审计)。用户说「忘掉这条」时用。
26
+ - `memory_status`:原话/已删/状态/锚点/未确认计数 + 内核健康信息。只读。
27
+ - 内核新增 `POST /memory/forget`、`POST /memory/stats`;`memory.py` 增加 `forget()` 与 `stats()`。
28
+ - 宿主没有 `tools` 服务时静默跳过注册,不影响原本的注入。
29
+
30
+ ### 修复:回声
31
+ - 当前这句不再被当成「相关的旧事」注回去:`/turn` 用 `trace_id` 挡,`/context` 只拿得到文本,改为按内容挡(忽略空白与标点)。两条路都经过 `_recall`,挡在源头。
32
+ - `_recent` 兜底同样过滤当前句,避免同一句被记两笔时漏网。
33
+
34
+ ### 测试
35
+ - 新增 `test/echo.test.mjs`:同句、同句不同标点都不出现;换成无关问句时旧记忆照常出现(消回声不能消记忆)。
36
+ - 新增 `test/tools.test.mjs`:三个工具对真内核跑通——检索 → 删除 → 搜不到 → 已删计数 +1;不存在的 `trace_id` 返回错误。
37
+ - 修 `test/smoke.test.mjs` 的测试替身:插件现在有两组 effect,替身只存最后一个 disposer 会漏掉内核,进程留成孤儿占端口和 sqlite 文件。
38
+
39
+ ### 说明
40
+ - Windows x64 默认使用包内运行时;其他平台使用系统 Python。测试在仓库的内核目录中运行。
41
+
3
42
  ## 0.5.0(内核 0.52.0)
4
43
 
5
44
  ### 性能
@@ -21,7 +60,7 @@
21
60
  - 默认 `scope: user`:画像、偏好、锚点、账跨会话共享;追问熔断仍然按会话计算。`scope: session` 可恢复旧行为。
22
61
  - 去掉 session 模式下的跨会话 `lastContext` 兜底。
23
62
 
24
- ### 准确率(回归集 `test/kernel_regression.py`,31/31)
63
+ ### 历史准确率(原回归集 31/31,因沙箱重置丢失,目前无法复现)
25
64
  - 问句不再生成事实(「你还记得我欠谁钱吗」)。
26
65
  - 「还/本/书/瓶」等单字不再触发记账;日期里的数字(周五、四月)不再当成数量。
27
66
  - 无领域词的闲聊(「哈哈」「我女朋友叫小美」)不再落成偏好。
package/LICENSE CHANGED
@@ -1,21 +1,21 @@
1
- MIT License
2
-
3
- Copyright (c) 2026 Shoren-Syi
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in all
13
- copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- SOFTWARE.
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Shoren-Syi
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,3 +1,36 @@
1
+ # Xujie Memory 0.7.0 · DSH 应用内记忆工作台
2
+
3
+ **目标版本:DeepSeek Harness 0.2.1-rc.5。当前为开发验收构建,尚未在用户的 Windows 桌面宿主上完成真机验收。**
4
+
5
+ ## 0.7 新增
6
+
7
+ - 通过正式 `dsh.client`、`sidebar.panellist` / `main` 插槽提供应用内部的「记忆」页,不另开网站。
8
+ - 三层神经网络界面、原话模糊搜索、人设卡和记忆正文编辑/删除;可见范围来自真实 SQLite 库。
9
+ - 所有管理 Remote 仅允许经过 DSH 验证的 owner 调用。浏览器不持有内核 token,也不直连内核端口。
10
+ - 编辑并非覆盖不可变原话:一次 SQLite 事务中失效旧依据、写入替代原话并重新编码、重算事实与画像、刷新检索。返回的新 trace_id 会替代旧节点。发生时间保留,编辑时间单独留审计。
11
+ - 新增 `memory_edit` 工具。先用 `memory_search` 获取 trace_id 与 content_hash,再带 expected_hash 纠正,冲突时拒绝覆盖。
12
+ - 图中结构性纤维仅作视觉骨架;事实连线来自 evidence、摘要来源、锚点和工作记忆投影,不声称推断出了真实神经/语义关系。
13
+
14
+ ## 数据与升级边界
15
+
16
+ 继续使用原来的 dbPath;默认 `~/.xujie-memory/memory.db`。首次迁移旧库前,会生成 SQLite 一致性备份 `<dbPath>.pre-0.7.0.bak`(不覆盖已有备份)。随后修复旧版遗忘操作可能留下的摘要等派生残留。
17
+
18
+ **备份含迁移前数据,应私密保存。**「遗忘」清理应用记忆库及依赖投影,不等于安全擦除磁盘,不会删除 DSH 聊天记录、外部导出、旧备份或磁盘/WAL 历史。
19
+
20
+ 所有编辑/删除必须等内核成功响应后才视为保存。失败或版本冲突时不显示假成功;版本冲突需要重新加载。图形默认仅展示最近 250 条原话及部分派生节点,超出范围会标明;管理界面搜索覆盖当前记忆库全部有效原话。对话中的自动召回仍使用最近 800 条候选的上限。
21
+
22
+ ## 验收与开发
23
+
24
+ 按安装 0.6.0 时同一 profile 和方式安装本包/解压目录,然后重启 DSH。不要删除记忆数据目录。侧栏应出现「记忆」。逐项验收见 `ACCEPTANCE.md`。
25
+
26
+ `npm install` 安装开发依赖后,`npm run build` 构建浏览器 factory 与 Host 控制器,`npm test` 运行真实临时 SQLite/HTTP 回归及使用 DI 测试替身的 Host 桥接检查。Windows 默认使用包内 Python;其他平台用 python3,或设置 PYTHON。测试不会读取用户实际记忆库。使用正式 rpc 生成物;变更 Remote 签名必须重新运行与 rc.5 对应的 Typert 生成流程,不能只改客户端。
27
+
28
+ 本包保留原 0.6.0 的 Windows x64 Python 运行时;本次 Linux 环境未执行该 Windows 运行时。官方接口取自 `dsh-v0.2.1-rc.5`,commit `b830ec950faba0a46dda564be3e2d854afed94f1`。详细构建来源见 `BUILD-PROVENANCE.json`。
29
+
30
+ ---
31
+
32
+ ## 原有内核使用说明(已更新到 0.7)
33
+
1
34
  # dsh-plugin-xujie-memory
2
35
 
3
36
  [English](README_EN.md) | 简体中文
@@ -39,10 +72,9 @@ flowchart LR
39
72
  2. 把"这个人是谁、我现在记得什么、他专门交代过要记住什么"注入提示词
40
73
  3. 你没说清楚的地方,**最多问一次**,问过就不再提
41
74
 
42
- 它不是"给模型一个 `memory_search` 工具"——工具要模型自己想起来用,
43
- 而记忆的价值恰恰在于**不用想**。
75
+ 记忆会自动注入;需要主动查找或删除时,也可以使用下方工具。
44
76
 
45
- ### 三层记忆(当前版本 0.5.0)
77
+ ### 三层记忆(0.7.0)
46
78
 
47
79
  | 层 | 内容 | 你怎么用 |
48
80
  |---|---|---|
@@ -61,30 +93,47 @@ flowchart LR
61
93
  **模糊搜索**:`POST /memory/search`,两字词、错一个字都能捞;
62
94
  精确检索落空时,自动注入也会降级到模糊匹配。
63
95
 
64
- 本仓库保留 0.5.0 发布包中的内核;上表概括了三层记忆。
96
+ 0.7 以内核 0.52.0 为基线扩展管理接口与一致性逻辑;上表概括了三层记忆。
97
+
98
+ **当前这句不会被当成旧事注回去(0.6 修复)**:`/turn` 用 trace_id 挡,`/context` 只拿得到文本、按内容挡(忽略空白与标点)。换成问别的事,旧记忆照常出现。
99
+
100
+ ---
101
+
102
+ ## 主动工具(0.7)
103
+
104
+ 注入是自动的,但**主动回忆**和**删掉记错的东西**需要有手。0.7 给模型注册了四个工具:
105
+
106
+ | 工具 | 作用 | 副作用 |
107
+ |---|---|---|
108
+ | `memory_search` | 按字面/错字模糊检索原话,返回内容、`trace_id`、`content_hash`、权重 | 只读 |
109
+ | `memory_edit` | 以 `trace_id`、正文和 `expected_hash` 原子纠正原话 | 写,返回新 trace_id |
110
+ | `memory_forget` | 删一条记忆(软删:内容清空、FTS 移除、依赖它的事实失效并重算) | 写,`erased_at` 留审计 |
111
+ | `memory_status` | 原话/已删/状态/锚点/未确认计数 + 内核健康 | 只读 |
112
+
113
+ 用户说「忘掉这条」时,模型可以自己搜到 `trace_id` 再删,不需要你手动清库。
114
+ 对应内核接口:`POST /memory/search`、`POST /memory/forget`、`POST /memory/stats`。
115
+
116
+ 宿主若没有 `tools` 服务(老版本),这些工具静默跳过,注入照常。0.7 新增 memory_edit 工具和应用内图形化管理页,详见本文开头。
65
117
 
66
118
  ---
67
119
 
68
- ## 装上就能用(用户零动作)
120
+ ## 安装本地 0.7 验收包
69
121
 
70
122
  | | |
71
123
  |---|---|
72
- | DSH | 0.2 预览版(`dsh.bundle` 机制) |
124
+ | DSH | **0.2.1-rc.5**(官方 bundle + client 插件机制) |
73
125
  | Node | `^22.19 \|\| >=24` |
74
- | Python | **不用装**:Windows x64 包里自带解释器 |
75
- | 内核 | **不用装**:Python 内核(`python/xujie_memory`)在包里 |
126
+ | Python | Windows x64 包内自带;macOS/Linux 需系统 Python 3.10+ |
76
127
 
77
- ```bash
78
- dsh plugin --profile <你的profile> add <解压后的 dsh-plugin-xujie-memory 目录>
79
- # 新开一个会话即可
80
- ```
81
-
82
- 仓库公开后,也可以从 GitHub 安装指定版本:
128
+ 先备份原包与记忆库,退出 DSH,将本地验收包解压后,按 0.6 使用的原 profile 安装:
83
129
 
84
130
  ```bash
85
- dsh plugin --profile <你的profile> add github:Shoren-Syi/dsh-plugin-xujie-memory#v0.5.0
131
+ dsh plugin --profile <你的profile> add <tgz 解压后含 package.json 的 package 目录>
132
+ # 然后重启 DSH,检查左侧「记忆」入口
86
133
  ```
87
134
 
135
+ **本次交付未发布 npm/GitHub 0.7 标签。** 不要用注册表包名或旧 GitHub v0.6.0 命令替代本地验收包;它们可能装回旧版。不要删除原数据目录。安装失败时保留日志,按 `ACCEPTANCE.md` 回滚。
136
+
88
137
  不需要 `pip install`,不需要填 `repoPath`,不需要另外起服务:
89
138
 
90
139
  - 插件用**包内解释器**(`runtime/win32-x64/python.exe`)拉起**包内内核**
@@ -207,7 +256,7 @@ curl -s --noproxy '*' -X POST http://127.0.0.1:8765/turn \
207
256
 
208
257
  ```
209
258
  dsh-plugin-xujie-memory/
210
- ├── lib/index.js # 薄壳:挂 section / 收事件 / 起内核
259
+ ├── lib/index.js # 薄壳:挂 section / 注册工具 / 收事件 / 起内核
211
260
  ├── python/xujie_memory # Python 内核(零第三方依赖)
212
261
  ├── python/specs # 判定规则
213
262
  ├── runtime/win32-x64/ # 自带解释器(Windows)
@@ -219,6 +268,7 @@ dsh-plugin-xujie-memory/
219
268
 
220
269
  ## 开发验证
221
270
 
222
- `npm test` 运行插件与内核的集成冒烟测试,覆盖会话隔离和注入消息过滤;Windows x64 默认使用包内 Python,其他平台需要 Python 3.10+,也可通过 `PYTHON` 环境变量指定解释器。执行 `npm pack` 可打包当前仓库自带的内核。
271
+ `npm test` 运行新增的管理、事务、隔离、持久化回归和使用 DI 测试替身的 Host 桥接检查。Windows x64 默认使用包内 Python;其他平台需要 Python 3.10+,也可通过 `PYTHON` 指定解释器。执行 `npm pack` 可打包当前仓库自带的内核。
223
272
 
224
273
  本仓库由 0.5.0 发布包恢复。原先的回归测试集因之前的沙箱重置而丢失,发布包中也没有包含原来的 `test/kernel_regression.py` 和内核同步脚本。CHANGELOG 中的 31/31 是历史记录,当前仓库无法复现该回归集;冒烟测试不代表这 31 项回归已通过。
274
+
package/README_EN.md CHANGED
@@ -1,7 +1,28 @@
1
- # dsh-plugin-xujie-memory
1
+ # Xujie Memory 0.7.0 · DSH in-app memory workspace
2
2
 
3
3
  [简体中文](README.md) | English
4
4
 
5
+ **Acceptance candidate for DeepSeek Harness 0.2.1-rc.5; not yet verified in a real Windows DSH desktop.**
6
+
7
+ ## New in 0.7
8
+
9
+ - Native “记忆” page in DSH via the official `sidebar.panellist` and `main` slots; no separate website.
10
+ - A rotating 3D neuronal field with three visible memory layers, fuzzy recall, true person cards, and original-memory edit/forget actions. Decorative fibers are not stored memories or inferred semantic relationships; real evidence edges are distinguished in the legend.
11
+ - Browser management calls use generated Typert Remote contracts and require the authenticated DSH owner. No kernel token or direct kernel URL is exposed to the page.
12
+ - An edit atomically invalidates old evidence and creates a replacement trace, preserving original event time, importance and anchors. Save returns a new trace ID. Dependent facts/person cards and retrieval are recomputed. Conflicting versions are rejected.
13
+ - New `memory_edit` tool: search first to obtain `trace_id` and `content_hash`, then submit `expected_hash` with the correction.
14
+
15
+ ## Upgrade and data boundaries
16
+
17
+ Use the same profile and `dbPath` as 0.6. Before the first old-schema migration, the kernel creates a consistent private backup named `<dbPath>.pre-0.7.0.bak` without overwriting an existing backup. Previously erased residual summaries/projections are repaired once.
18
+
19
+ **The migration backup contains pre-upgrade data. Keep it private.** Forgetting is application-level removal, not secure disk erasure; it does not erase DSH chats, exports, old backups or historical disk/WAL contents.
20
+
21
+ The graph defaults to the latest 250 original traces plus selected derived nodes. Management search covers all active original traces in the selected memory scope; automatic conversational recall retains its latest-800-candidate limit. Derived facts, summaries and clarifications are read-only; follow their evidence to edit original wording. Person cards are derived from actual records, not independent editable profile fields.
22
+
23
+ Install the supplied local candidate archive/extracted folder with the same method and profile used for 0.6, then restart DSH. Registry and GitHub examples from older releases do not install this unpublished candidate. Preserve your data folder and follow `ACCEPTANCE.md` before relying on the upgrade.
24
+
25
+
5
26
  Seamless long-term memory built for DeepSeek Harness (DSH).
6
27
 
7
28
  **The value of memory is not having to think about it.** Xujie-Memory records relevant information locally, assembles memory context, and injects it into the prompt without asking the model to decide whether to call a memory tool. The Windows x64 package includes a runtime and generally requires no extra configuration after installation.
@@ -39,18 +60,42 @@ This compares common design approaches; individual tool-based systems can differ
39
60
 
40
61
  Importance scoring affects how slowly memories fade. Explicit requests such as “remember this” pin an anchor. Retrieval does not reset decay. The kernel also exposes `/memory/mark`, `/memory/curve`, and `/memory/search` endpoints.
41
62
 
63
+ ## Active tools (0.7)
64
+
65
+ Injection is automatic, but **actively recalling** and **removing what was remembered wrong** need a hand. 0.7 registers four tools:
66
+
67
+ | Tool | What it does | Side effect |
68
+ |---|---|---|
69
+ | `memory_search` | Literal/fuzzy search over stored wording; returns content, `trace_id`, `content_hash`, weight | read-only |
70
+ | `memory_edit` | Atomic replacement using `trace_id`, content and `expected_hash` | write; new trace ID |
71
+ | `memory_forget` | Deletes one memory (soft delete: content cleared, FTS row removed, dependent facts invalidated and recomputed) | write; `erased_at` kept for audit |
72
+ | `memory_status` | Counts for stored/erased entries, states, anchors, open items, plus kernel health | read-only |
73
+
74
+ When the user says “forget that”, the model can search for the `trace_id` itself and delete it — no manual database surgery. Kernel endpoints: `POST /memory/search`, `POST /memory/forget`, `POST /memory/stats`.
75
+
76
+ Hosts without a `tools` service skip registration silently; injection keeps working. 0.7 includes the native graphical page and memory editing.
77
+
78
+ The current sentence is no longer injected back as a past event (0.6 fix): `/turn` excludes it by `trace_id`, `/context` by content (whitespace and punctuation ignored). Ask about something else and older memories still appear.
79
+
42
80
  ## Installation
43
81
 
44
- The package targets the DSH 0.2 preview bundle mechanism and Node.js `^22.19 || >=24`. Windows x64 includes Python and the kernel; no separate Python installation or pip dependencies are needed. On macOS and Linux it falls back to system Python 3.10 or newer.
82
+ This candidate targets the DSH 0.2.1-rc.5 bundle/client mechanism and Node.js `^22.19 || >=24`. Windows x64 includes Python and the kernel; no separate Python installation or pip dependencies are needed. On macOS and Linux it falls back to system Python 3.10 or newer.
45
83
 
46
84
  ```bash
47
- dsh plugin --profile <your-profile> add <path-to-extracted-dsh-plugin-xujie-memory>
85
+ dsh plugin --profile <your-profile> add <extracted-package-folder-containing-package.json>
48
86
  ```
49
87
 
50
- When the repository is public, install the tagged version directly from GitHub:
88
+ Install by package name from npm:
51
89
 
52
90
  ```bash
53
- dsh plugin --profile <your-profile> add github:Shoren-Syi/dsh-plugin-xujie-memory#v0.5.0
91
+ dsh plugin --profile <your-profile> add dsh-plugin-xujie-memory
92
+ ```
93
+
94
+ Or install the tagged version directly from GitHub:
95
+
96
+ ```bash
97
+ # Historical 0.6 command only; NOT this unpublished 0.7 candidate:
98
+ dsh plugin --profile <your-profile> add github:Shoren-Syi/dsh-plugin-xujie-memory#v0.6.0
54
99
  ```
55
100
 
56
101
  Start a new session. The plugin starts the bundled kernel automatically. By default the database is stored at `~/.xujie-memory/memory.db`. Kernel failure skips memory for that turn rather than blocking the conversation.
@@ -80,13 +125,14 @@ Only `user/message` events are ingested. Runtime context and agent-instruction m
80
125
  ## Package contents
81
126
 
82
127
  ```text
83
- lib/index.js DSH integration and kernel lifecycle
128
+ lib/index.js DSH integration, tool registration and kernel lifecycle
84
129
  python/xujie_memory/ Python memory kernel
85
130
  python/specs/ Interpretation rules
86
131
  runtime/win32-x64/ Bundled Windows x64 Python runtime
87
132
  cordis.patch.yml DSH bundle patch
88
133
  ```
89
134
 
90
- This repository was reconstructed from the distributed 0.5.0 package. Run `npm test` for the integration smoke test and `npm pack` to package the bundled kernel. Windows x64 uses the bundled Python runtime; other platforms need Python 3.10 or newer. Set `PYTHON` to use a specific interpreter for the smoke test.
135
+ This upgrade is based on the supplied 0.6.0 archive. After installing development dependencies, run `npm run build` and `npm test`: the new suite exercises real temporary SQLite/HTTP and a Cordis DI test double. Browser QA uses a simulated main slot with the built client factory and real temporary kernel, not the real DSH desktop. Run `npm pack` to package built artifacts. Windows x64 uses the bundled Python runtime; other platforms need Python 3.10 or newer. Set `PYTHON` to select an interpreter.
136
+
137
+ The supplied baseline did not contain its historical regression suite. The distribution did not include `test/kernel_regression.py` or the kernel synchronization script. The 31/31 result in the changelog is historical and cannot be reproduced from this repository; the smoke test does not replace that regression suite.
91
138
 
92
- The original regression suite was lost when the previous sandbox was reset. The distribution did not include `test/kernel_regression.py` or the kernel synchronization script. The 31/31 result in the changelog is historical and cannot be reproduced from this repository; the smoke test does not replace that regression suite.
package/cordis.patch.yml CHANGED
@@ -1,49 +1,49 @@
1
- # 这个 bundle 往配置树里插的一行。
2
- #
3
- # `name` 必须是包的**名字**(和 package.json 的 name 一致),
4
- # `id` 是用户之后覆盖配置时的定位锚点——要稳定,不要和别的插件重名。
5
- #
6
- # 注意:DSH 0.2.1-rc.2 要求 patch 文件是**顶层数组**,所以整份内容放在
7
- # 一个 `- insert:` 列表项里(映射形式会被插件安装校验拒绝)。
8
- - insert:
9
- - id: xujie-memory
10
- name: dsh-plugin-xujie-memory
11
- config:
12
- # Python 内核监听地址;宿主的 section 注入和写记忆都走这条本地 HTTP。
13
- endpoint: "http://127.0.0.1:8765"
14
-
15
- # 留空 = 用插件包内自带的 python/ 内核(推荐,装上即用)。
16
- # 只有开发时想指向仓库才填绝对路径。
17
- repoPath: ""
18
-
19
- # 由插件拉起内核进程。设成 false 就要求你另外手动起服务。
20
- autoStart: true
21
-
22
- # 留空 = 用插件包内自带的解释器(runtime/<平台>-<架构>/)。
23
- # 只有想换成本机 Python 时才填。
24
- pythonPath: ""
25
-
26
- # 留空 = ~/.xujie-memory/memory.db;想换位置或跑测试时填绝对路径。
27
- dbPath: ""
28
-
29
- # 一个会话最多主动追问几次。超过之后材料里只剩一句总数。
30
- maxAskedTotal: 6
31
-
32
- # 记忆范围(v0.5):
33
- # user 人物卡/偏好/锚点/账跨会话有效(默认,长期记忆)
34
- # session 每个会话一份、互不相通(0.4 的旧行为)
35
- scope: "user"
36
-
37
- # 内核日志;留空 = 与记忆库同目录的 kernel.log(超过 2MB 自动轮转)。
38
- logFile: ""
39
-
40
- # 插件与内核共享的鉴权 token 文件;留空 = 与记忆库同目录的 token。
41
- tokenFile: ""
42
-
43
- # 宿主若会 await section.text 返回的 Promise,可设为 true:
44
- # 组装提示词时最多等 waitMs 毫秒拿这一轮的记忆。宿主不支持就别开。
45
- asyncSection: false
46
- waitMs: 400
47
-
48
- # 可选诊断文件:宿主 logger 把 info 过滤掉时,用它确认插件挂载/内核就绪。
49
- statusFile: ""
1
+ # 这个 bundle 往配置树里插的一行。
2
+ #
3
+ # `name` 必须是包的**名字**(和 package.json 的 name 一致),
4
+ # `id` 是用户之后覆盖配置时的定位锚点——要稳定,不要和别的插件重名。
5
+ #
6
+ # 注意:DSH 0.2.1-rc.2 要求 patch 文件是**顶层数组**,所以整份内容放在
7
+ # 一个 `- insert:` 列表项里(映射形式会被插件安装校验拒绝)。
8
+ - insert:
9
+ - id: xujie-memory
10
+ name: dsh-plugin-xujie-memory
11
+ config:
12
+ # Python 内核监听地址;宿主的 section 注入和写记忆都走这条本地 HTTP。
13
+ endpoint: "http://127.0.0.1:8765"
14
+
15
+ # 留空 = 用插件包内自带的 python/ 内核(推荐,装上即用)。
16
+ # 只有开发时想指向仓库才填绝对路径。
17
+ repoPath: ""
18
+
19
+ # 由插件拉起内核进程。设成 false 就要求你另外手动起服务。
20
+ autoStart: true
21
+
22
+ # 留空 = 用插件包内自带的解释器(runtime/<平台>-<架构>/)。
23
+ # 只有想换成本机 Python 时才填。
24
+ pythonPath: ""
25
+
26
+ # 留空 = ~/.xujie-memory/memory.db;想换位置或跑测试时填绝对路径。
27
+ dbPath: ""
28
+
29
+ # 一个会话最多主动追问几次。超过之后材料里只剩一句总数。
30
+ maxAskedTotal: 6
31
+
32
+ # 记忆范围(v0.5):
33
+ # user 人物卡/偏好/锚点/账跨会话有效(默认,长期记忆)
34
+ # session 每个会话一份、互不相通(0.4 的旧行为)
35
+ scope: "user"
36
+
37
+ # 内核日志;留空 = 与记忆库同目录的 kernel.log(超过 2MB 自动轮转)。
38
+ logFile: ""
39
+
40
+ # 插件与内核共享的鉴权 token 文件;留空 = 与记忆库同目录的 token。
41
+ tokenFile: ""
42
+
43
+ # 宿主若会 await section.text 返回的 Promise,可设为 true:
44
+ # 组装提示词时最多等 waitMs 毫秒拿这一轮的记忆。宿主不支持就别开。
45
+ asyncSection: false
46
+ waitMs: 400
47
+
48
+ # 可选诊断文件:宿主 logger 把 info 过滤掉时,用它确认插件挂载/内核就绪。
49
+ statusFile: ""