dsh-tdai-memory 0.4.3 → 0.4.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.
Files changed (64) hide show
  1. package/LICENSE +21 -21
  2. package/README.md +22 -14
  3. package/README.zh.md +21 -13
  4. package/THIRD-PARTY-NOTICES.md +20 -20
  5. package/cordis.patch.yml +8 -8
  6. package/package.json +104 -102
  7. package/vendor/tdai/adapters/index.js +15 -15
  8. package/vendor/tdai/adapters/openclaw/host-adapter.js +83 -83
  9. package/vendor/tdai/adapters/openclaw/index.js +5 -5
  10. package/vendor/tdai/adapters/openclaw/llm-runner.js +69 -69
  11. package/vendor/tdai/adapters/standalone/host-adapter.js +58 -58
  12. package/vendor/tdai/adapters/standalone/index.js +5 -5
  13. package/vendor/tdai/core/conversation/l0-recorder.js +420 -420
  14. package/vendor/tdai/core/hooks/auto-capture.js +236 -236
  15. package/vendor/tdai/core/hooks/auto-recall.js +640 -640
  16. package/vendor/tdai/core/index.js +8 -8
  17. package/vendor/tdai/core/persona/persona-generator.js +184 -184
  18. package/vendor/tdai/core/persona/persona-trigger.js +94 -94
  19. package/vendor/tdai/core/profile/profile-sync.js +200 -200
  20. package/vendor/tdai/core/prompts/l1-dedup.js +72 -72
  21. package/vendor/tdai/core/prompts/l1-extraction.js +34 -34
  22. package/vendor/tdai/core/prompts/persona-generation.js +35 -35
  23. package/vendor/tdai/core/prompts/scene-extraction.js +45 -45
  24. package/vendor/tdai/core/record/l1-dedup.js +318 -318
  25. package/vendor/tdai/core/record/l1-extractor.js +379 -379
  26. package/vendor/tdai/core/record/l1-reader.js +178 -178
  27. package/vendor/tdai/core/record/l1-writer.js +141 -141
  28. package/vendor/tdai/core/report/reporter.js +86 -86
  29. package/vendor/tdai/core/scene/filename-normalizer.js +161 -161
  30. package/vendor/tdai/core/scene/scene-extractor.js +410 -410
  31. package/vendor/tdai/core/scene/scene-format.js +53 -53
  32. package/vendor/tdai/core/scene/scene-index.js +82 -82
  33. package/vendor/tdai/core/scene/scene-navigation.js +57 -57
  34. package/vendor/tdai/core/seed/input.js +404 -404
  35. package/vendor/tdai/core/seed/types.js +9 -9
  36. package/vendor/tdai/core/store/bm25-client.js +117 -117
  37. package/vendor/tdai/core/store/bm25-local.js +68 -68
  38. package/vendor/tdai/core/store/embedding.js +632 -632
  39. package/vendor/tdai/core/store/factory.js +95 -95
  40. package/vendor/tdai/core/store/search-utils.js +54 -54
  41. package/vendor/tdai/core/store/sqlite.js +1632 -1632
  42. package/vendor/tdai/core/store/tcvdb-client.js +221 -221
  43. package/vendor/tdai/core/store/tcvdb.js +1047 -1047
  44. package/vendor/tdai/core/store/types.js +17 -17
  45. package/vendor/tdai/core/tools/conversation-search.js +199 -199
  46. package/vendor/tdai/core/tools/memory-search.js +207 -207
  47. package/vendor/tdai/core/types.js +12 -12
  48. package/vendor/tdai/utils/backup.js +189 -189
  49. package/vendor/tdai/utils/checkpoint.js +360 -360
  50. package/vendor/tdai/utils/clean-context-runner.js +472 -472
  51. package/vendor/tdai/utils/ensure-hook-policy.js +213 -213
  52. package/vendor/tdai/utils/env.js +13 -13
  53. package/vendor/tdai/utils/managed-timer.js +127 -127
  54. package/vendor/tdai/utils/manifest.js +91 -91
  55. package/vendor/tdai/utils/memory-cleaner.js +300 -300
  56. package/vendor/tdai/utils/no-think-fetch.js +109 -109
  57. package/vendor/tdai/utils/openclaw-state-dir.js +26 -26
  58. package/vendor/tdai/utils/pipeline-factory.js +517 -517
  59. package/vendor/tdai/utils/pipeline-manager.js +892 -892
  60. package/vendor/tdai/utils/sanitize.js +360 -360
  61. package/vendor/tdai/utils/serial-queue.js +103 -103
  62. package/vendor/tdai/utils/session-filter.js +88 -88
  63. package/vendor/tdai/utils/text-utils.js +29 -29
  64. package/vendor/tdai/utils/time.js +252 -252
package/LICENSE CHANGED
@@ -1,21 +1,21 @@
1
- MIT License
2
-
3
- Copyright (c) 2026 Scorp1o117
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 Scorp1o117
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,17 +1,25 @@
1
1
  # dsh-tdai-memory
2
-
3
- ## DSH 0.2.1-rc.1
4
-
5
- Supports DSH 0.2.1-rc.1. Compatibility is declared through `engines.dsh` and matching peer ranges, including this exact prerelease. The existing 0.2.0-rc.2 support is retained.
6
2
 
7
- The plugin follows the DSH language setting (Chinese and English in DSH 0.2.0-rc.2), including configuration, status messages and plugin-list metadata. Language-pack locales use the host fallback chain. Switching languages preserves unsaved settings; there is no separate plugin language selector.
8
-
3
+ ## DSH 0.2.1-rc.3
4
+
5
+ Supports DSH 0.2.1-rc.3, including explicit prerelease engines.dsh and peer ranges. This host update adds More navigation menus, keeps unsent drafts on New Session, and follows the official /models listing on the DeepSeek API-key route; the tool, system-prompt, settings and pi-ai interfaces used here remain unchanged, and no removed host API (`ctx.layout.entryVisibility`, `agentPresetNavigation`) was in use.
6
+
7
+ ## DSH 0.2.1-rc.2
8
+
9
+ Supports DSH 0.2.1-rc.2, including explicit prerelease engines.dsh and peer ranges. This host update adds DeepSeek V4.1 Flash 1017 and Search/Fetch APIs; the plugin APIs used here remain unchanged. Existing reasoning settings and the opt-in augmentation policy are preserved.
10
+
11
+ ## DSH 0.2.1-rc.1
12
+
13
+ Supports DSH 0.2.1-rc.1. Compatibility is declared through `engines.dsh` and matching peer ranges, including this exact prerelease. The existing 0.2.0-rc.2 support is retained.
14
+
15
+ The plugin follows the DSH language setting (Chinese and English in DSH 0.2.0-rc.2), including configuration, status messages and plugin-list metadata. Language-pack locales use the host fallback chain. Switching languages preserves unsaved settings; there is no separate plugin language selector.
16
+
9
17
  ## Configuration page (DSH 0.2.0-rc.2 and later)
10
18
 
11
19
  Open **Plugins → Installed → dsh-tdai-memory** from the homepage sidebar to configure and save this plugin. The page uses the official `plugins.bundle.config` interface, without a duplicate entry in global Settings. Web and Desktop share the page. This version requires DSH 0.2.0-rc.2 or a later 0.2.x host; existing configuration is retained.
12
20
 
13
- Choose **Automatic memory** for capture, extraction, recall and search together; **Search existing memory only** disables capture, extraction and automatic recall while keeping search tools; **Pause memory features** disables all four. The main page contains the two model connections. Individual switches, storage paths and tuning remain under **Advanced**. Existing mixed switch values appear as **Custom combination** and are preserved. Select a mode, Save, then restart DSH for pipeline changes (the search-tool switch applies immediately). Only edited fields are written; blank keys and untouched advanced options remain unchanged.
14
-
21
+ Choose **Automatic memory** for capture, extraction, recall and search together; **Search existing memory only** disables capture, extraction and automatic recall while keeping search tools; **Pause memory features** disables all four. The main page contains the two model connections. Individual switches, storage paths and tuning remain under **Advanced**. Existing mixed switch values appear as **Custom combination** and are preserved. Select a mode, Save, then restart DSH for pipeline changes (the search-tool switch applies immediately). Only edited fields are written; blank keys and untouched advanced options remain unchanged.
22
+
15
23
  [![中文文档](https://img.shields.io/badge/%E4%B8%AD%E6%96%87%E6%96%87%E6%A1%A3-blue)](README.zh.md)
16
24
 
17
25
  **GitHub**: [Scorp1o117/dsh-tdai-memory](https://github.com/Scorp1o117/dsh-tdai-memory) · **npm**: [dsh-tdai-memory](https://www.npmjs.com/package/dsh-tdai-memory)
@@ -65,12 +73,12 @@ The data directory reuses the existing `~/.memory-tencentdb/memory-tdai`, so
65
73
  | dsh shell | `index.js`: config mapping, `session/event` + `session/flush` capture, `system-prompt/assemble` recall injection on `agent.ctx`, tool registration, lifecycle |
66
74
  | Fallback | `recall-inject.js`: preset-row recall injection (used when mounted inside an agent preset) |
67
75
 
68
- Recall caches expire after 30 seconds and retain at most 128 sessions per
69
- injection instance. Failed or timed-out recalls are retried on the next assembly.
70
- The preset row also accepts `timeoutMs` (default 4000); reaching this deadline
71
- continues prompt assembly without memory context. Deadline timers are cleared
72
- when recall settles early. Underlying recall work may continue after the deadline.
73
-
76
+ Recall caches expire after 30 seconds and retain at most 128 sessions per
77
+ injection instance. Failed or timed-out recalls are retried on the next assembly.
78
+ The preset row also accepts `timeoutMs` (default 4000); reaching this deadline
79
+ continues prompt assembly without memory context. Deadline timers are cleared
80
+ when recall settles early. Underlying recall work may continue after the deadline.
81
+
74
82
  Hard-won wiring details:
75
83
 
76
84
  - **Capture**: `session/flush` listener (await semantics; must complete before
package/README.zh.md CHANGED
@@ -1,17 +1,25 @@
1
1
  # dsh-tdai-memory
2
-
3
- ## DSH 0.2.1-rc.1
4
-
5
- 支持 DSH 0.2.1-rc.1,通过 `engines.dsh` 和一致的 peer 范围声明兼容,明确包含该预发布版本,并保留已有 0.2.0-rc.2 支持。
6
2
 
7
- 插件跟随 DSH 的语言设置(DSH 0.2.0-rc.2 内置中文和 English),配置页面、状态提示和插件列表名称/简介同步切换。扩展语言使用宿主的回退链。切换语言保留未保存的设置,无需单独选择插件语言。
8
-
3
+ ## DSH 0.2.1-rc.3
4
+
5
+ 适配 DSH 0.2.1-rc.3,明确声明该预发布版本的 engines.dsh 与 peer 范围。宿主新增侧栏/会话「更多」导航菜单、修复新建会话丢失未发送草稿、DeepSeek API Key 路由改跟随官方 /models 模型列表;本插件使用的工具、system-prompt、settings 与 pi-ai 接口保持不变,也未使用任何被移除的宿主 API(`ctx.layout.entryVisibility`、`agentPresetNavigation`)。
6
+
7
+ ## DSH 0.2.1-rc.2
8
+
9
+ 适配 DSH 0.2.1-rc.2,明确声明该预发布版本的 engines.dsh 与 peer 范围。宿主新增 DeepSeek V4.1 Flash 1017 及 Search/Fetch API,本插件使用的接口保持不变。保留已有推理配置及自动补齐显式开启策略。
10
+
11
+ ## DSH 0.2.1-rc.1
12
+
13
+ 支持 DSH 0.2.1-rc.1,通过 `engines.dsh` 和一致的 peer 范围声明兼容,明确包含该预发布版本,并保留已有 0.2.0-rc.2 支持。
14
+
15
+ 插件跟随 DSH 的语言设置(DSH 0.2.0-rc.2 内置中文和 English),配置页面、状态提示和插件列表名称/简介同步切换。扩展语言使用宿主的回退链。切换语言保留未保存的设置,无需单独选择插件语言。
16
+
9
17
  ## 配置入口(DSH 0.2.0-rc.2 起)
10
18
 
11
19
  在首页侧边栏打开 **插件 → 已安装 → dsh-tdai-memory**,直接在插件详情页配置并保存。配置页注册到官方的 `plugins.bundle.config` 接口;全局设置页不再重复显示配置入口。Web 与桌面版使用相同界面,本版要求 DSH 0.2.0-rc.2 或更新的 0.2.x 版本。现有配置无需迁移。
12
20
 
13
- 选择 **自动记忆**,一次开启捕获、提取、召回和搜索;**仅搜索已有记忆** 关闭捕获、提取和自动召回,保留搜索工具;**暂停记忆功能** 关闭全部四项。主页面只展示两个模型的连接信息,独立开关、存储路径和调优参数保留在 **高级设置** 中。已有开关组合显示为 **自定义组合**,不会自动覆盖。选择模式后保存,并重启 DSH 使记忆流水线设置生效(搜索工具开关即时生效)。只写入编辑过的字段,密钥留空及未编辑的高级设置保持原值。
14
-
21
+ 选择 **自动记忆**,一次开启捕获、提取、召回和搜索;**仅搜索已有记忆** 关闭捕获、提取和自动召回,保留搜索工具;**暂停记忆功能** 关闭全部四项。主页面只展示两个模型的连接信息,独立开关、存储路径和调优参数保留在 **高级设置** 中。已有开关组合显示为 **自定义组合**,不会自动覆盖。选择模式后保存,并重启 DSH 使记忆流水线设置生效(搜索工具开关即时生效)。只写入编辑过的字段,密钥留空及未编辑的高级设置保持原值。
22
+
15
23
  **GitHub**: [Scorp1o117/dsh-tdai-memory](https://github.com/Scorp1o117/dsh-tdai-memory) · **npm**: [dsh-tdai-memory](https://www.npmjs.com/package/dsh-tdai-memory) · [English](README.md)
16
24
 
17
25
  [![Enhancement Suite](https://img.shields.io/badge/part%20of-Enhancement%20Suite-3964fe)](https://github.com/Scorp1o117/dsh-enhancement-suite) [![npm](https://img.shields.io/npm/v/dsh-enhancement-suite)](https://www.npmjs.com/package/dsh-enhancement-suite)
@@ -60,11 +68,11 @@ dsh plugin --profile desktop add dsh-tdai-memory@0.3.6
60
68
  | dsh 壳 | `index.js`:配置映射、`session/event`+`session/flush` 捕获、`agent.ctx` 上的 `system-prompt/assemble` waterfall 召回注入、工具注册、生命周期 |
61
69
  | 备用 | `recall-inject.js`:preset 行形态的召回注入(挂在 agent preset 内时用) |
62
70
 
63
- 召回缓存默认 30 秒过期,每个注入实例最多保留 128 个会话。失败或超时的召回
64
- 会在下次组装时重试。preset 行还支持 `timeoutMs`(默认 4000),到达期限后
65
- 不注入记忆并继续组装提示词;提前完成时会清除超时定时器。期限到达后,底层
66
- 召回任务可能仍会继续运行。
67
-
71
+ 召回缓存默认 30 秒过期,每个注入实例最多保留 128 个会话。失败或超时的召回
72
+ 会在下次组装时重试。preset 行还支持 `timeoutMs`(默认 4000),到达期限后
73
+ 不注入记忆并继续组装提示词;提前完成时会清除超时定时器。期限到达后,底层
74
+ 召回任务可能仍会继续运行。
75
+
68
76
  关键接线(都是踩坑换来的):
69
77
 
70
78
  - **捕获**:`session/flush` 监听器(await 语义,headless 退出前必完成);`turn/start` 时间戳做 L0 cursor 下限;turn id 去重
@@ -1,20 +1,20 @@
1
- # Third-party notices
2
-
3
- ## TencentDB Agent Memory core (vendored in `vendor/tdai`)
4
-
5
- `vendor/tdai` is a TypeScript-compiled copy of the host-neutral core of
6
- [TencentCloud/TencentDB-Agent-Memory](https://github.com/TencentCloud/TencentDB-Agent-Memory)
7
- (`tdai-memory-openclaw-plugin`, npm: `@tencentdb-agent-memory/memory-tencentdb`),
8
- compiled with `tsc -p dsh-tsconfig.json` (see the upstream repo for source).
9
- Its runtime dependencies are declared in this package's `dependencies`.
10
-
11
- MIT License — Copyright (c) 2026 TencentCloud
12
-
13
- ## Runtime dependencies
14
-
15
- - `ai` / `@ai-sdk/openai` — Vercel AI SDK (Apache-2.0)
16
- - `@node-rs/jieba` — Rust jieba bindings (MIT)
17
- - `sqlite-vec` — vector search extension for SQLite (Apache-2.0 / MIT)
18
- - `json5` — JSON5 parser (MIT)
19
- - `undici` — HTTP client (MIT)
20
- - `@tencentdb-agent-memory/tcvdb-text` — TencentDB text utilities (MIT)
1
+ # Third-party notices
2
+
3
+ ## TencentDB Agent Memory core (vendored in `vendor/tdai`)
4
+
5
+ `vendor/tdai` is a TypeScript-compiled copy of the host-neutral core of
6
+ [TencentCloud/TencentDB-Agent-Memory](https://github.com/TencentCloud/TencentDB-Agent-Memory)
7
+ (`tdai-memory-openclaw-plugin`, npm: `@tencentdb-agent-memory/memory-tencentdb`),
8
+ compiled with `tsc -p dsh-tsconfig.json` (see the upstream repo for source).
9
+ Its runtime dependencies are declared in this package's `dependencies`.
10
+
11
+ MIT License — Copyright (c) 2026 TencentCloud
12
+
13
+ ## Runtime dependencies
14
+
15
+ - `ai` / `@ai-sdk/openai` — Vercel AI SDK (Apache-2.0)
16
+ - `@node-rs/jieba` — Rust jieba bindings (MIT)
17
+ - `sqlite-vec` — vector search extension for SQLite (Apache-2.0 / MIT)
18
+ - `json5` — JSON5 parser (MIT)
19
+ - `undici` — HTTP client (MIT)
20
+ - `@tencentdb-agent-memory/tcvdb-text` — TencentDB text utilities (MIT)
package/cordis.patch.yml CHANGED
@@ -1,8 +1,8 @@
1
- # dsh-tdai-memory — bundle patch layer
2
- #
3
- # Declares the plugin as a Cordis loader entry, making the package a standard
4
- # profile bundle: `dsh plugin --profile <p> add dsh-tdai-memory` installs and
5
- # mounts it without manual cordis.patch.yml edits.
6
- - insert:
7
- - id: tdai-memory
8
- name: 'dsh-tdai-memory'
1
+ # dsh-tdai-memory — bundle patch layer
2
+ #
3
+ # Declares the plugin as a Cordis loader entry, making the package a standard
4
+ # profile bundle: `dsh plugin --profile <p> add dsh-tdai-memory` installs and
5
+ # mounts it without manual cordis.patch.yml edits.
6
+ - insert:
7
+ - id: tdai-memory
8
+ name: 'dsh-tdai-memory'
package/package.json CHANGED
@@ -1,102 +1,104 @@
1
- {
2
- "name": "dsh-tdai-memory",
3
- "version": "0.4.3",
4
- "description": "DeepSeek Harness 的 TencentDB Agent Memory 移植:L0 对话捕获 → L1 结构化记忆提取 → L2 场景/L3 画像,自动召回注入 + 记忆/对话搜索工具;复用现有 ~/.memory-tencentdb/memory-tdai 数据;附 Web UI 设置栏。",
5
- "type": "module",
6
- "main": "index.js",
7
- "exports": {
8
- ".": "./index.js",
9
- "./client": "./client.js",
10
- "./package.json": "./package.json",
11
- "./locale/*.json": "./locale/*.json"
12
- },
13
- "dsh": {
14
- "bundle": {
15
- "patch": "./cordis.patch.yml"
16
- },
17
- "client": {
18
- "platform": "web"
19
- },
20
- "compatibility": {
21
- "dsh": ">=0.2.0-rc.2 <0.3.0 || 0.2.1-rc.1",
22
- "dshReleases": {
23
- "0.1.5-rc.2": "incompatible",
24
- "0.1.5-rc.3": "incompatible",
25
- "0.1.6-alpha.1": "unknown",
26
- "0.1.6-alpha.2": "unknown",
27
- "0.1.7-alpha.1": "unknown",
28
- "0.1.7-alpha.2": "unknown",
29
- "0.1.7-rc.1": "incompatible",
30
- "0.1.7-rc.2": "incompatible",
31
- "0.2.0-rc.2": "compatible",
32
- "0.2.1-rc.1": "compatible"
33
- },
34
- "node": ">=22.18",
35
- "profiles": [
36
- "web",
37
- "desktop"
38
- ]
39
- }
40
- },
41
- "homepage": "https://github.com/Scorp1o117/dsh-tdai-memory",
42
- "files": [
43
- "locale",
44
- "index.js",
45
- "recall-inject.js",
46
- "recall-runtime.js",
47
- "client.js",
48
- "cordis.patch.yml",
49
- "vendor",
50
- "README.md",
51
- "README.zh.md",
52
- "LICENSE",
53
- "THIRD-PARTY-NOTICES.md"
54
- ],
55
- "keywords": [
56
- "dsh",
57
- "dsh-plugin",
58
- "deepseek-harness",
59
- "memory",
60
- "tencentdb",
61
- "agent-memory",
62
- "rag",
63
- "vector-search",
64
- "persona"
65
- ],
66
- "license": "MIT",
67
- "engines": {
68
- "node": ">=22.18",
69
- "dsh": ">=0.2.0-rc.2 <0.3.0 || 0.2.1-rc.1"
70
- },
71
- "repository": {
72
- "type": "git",
73
- "url": "git+https://github.com/Scorp1o117/dsh-tdai-memory.git"
74
- },
75
- "bugs": {
76
- "url": "https://github.com/Scorp1o117/dsh-tdai-memory/issues"
77
- },
78
- "dependencies": {
79
- "@ai-sdk/openai": "^3.0.53",
80
- "@deepseek-ai/schemastery": "^3.18.4",
81
- "@node-rs/jieba": "^2.0.1",
82
- "@tencentdb-agent-memory/tcvdb-text": "^0.1.1",
83
- "ai": "^6.0.164",
84
- "json5": "^2.2.3",
85
- "sqlite-vec": "0.1.7-alpha.2",
86
- "undici": "^8.1.0"
87
- },
88
- "peerDependencies": {
89
- "react": "^18.2.0",
90
- "@deepseek-ai/dsh-tools": ">=0.2.0-rc.2 <0.3.0 || 0.2.1-rc.1",
91
- "@deepseek-ai/dsh-settings": ">=0.2.0-rc.2 <0.3.0 || 0.2.1-rc.1",
92
- "node-llama-cpp": "^3.19.1"
93
- },
94
- "peerDependenciesMeta": {
95
- "node-llama-cpp": {
96
- "optional": true
97
- }
98
- },
99
- "scripts": {
100
- "test": "node tests/settings-scope-compat.test.mjs && node tests/install-contract.test.mjs && node --test tests/plugin-page.test.mjs tests/client-write-flow.test.mjs tests/tools-registration.test.mjs tests/recall-runtime.test.mjs && node --test tests/locale.test.mjs"
101
- }
102
- }
1
+ {
2
+ "name": "dsh-tdai-memory",
3
+ "version": "0.4.5",
4
+ "description": "DeepSeek Harness 的 TencentDB Agent Memory 移植:L0 对话捕获 → L1 结构化记忆提取 → L2 场景/L3 画像,自动召回注入 + 记忆/对话搜索工具;复用现有 ~/.memory-tencentdb/memory-tdai 数据;附 Web UI 设置栏。",
5
+ "type": "module",
6
+ "main": "index.js",
7
+ "exports": {
8
+ ".": "./index.js",
9
+ "./client": "./client.js",
10
+ "./package.json": "./package.json",
11
+ "./locale/*.json": "./locale/*.json"
12
+ },
13
+ "dsh": {
14
+ "bundle": {
15
+ "patch": "./cordis.patch.yml"
16
+ },
17
+ "client": {
18
+ "platform": "web"
19
+ },
20
+ "compatibility": {
21
+ "dsh": ">=0.2.0-rc.2 <0.3.0 || 0.2.1-rc.1 || 0.2.1-rc.2 || 0.2.1-rc.3",
22
+ "dshReleases": {
23
+ "0.1.5-rc.2": "incompatible",
24
+ "0.1.5-rc.3": "incompatible",
25
+ "0.1.6-alpha.1": "unknown",
26
+ "0.1.6-alpha.2": "unknown",
27
+ "0.1.7-alpha.1": "unknown",
28
+ "0.1.7-alpha.2": "unknown",
29
+ "0.1.7-rc.1": "incompatible",
30
+ "0.1.7-rc.2": "incompatible",
31
+ "0.2.0-rc.2": "compatible",
32
+ "0.2.1-rc.1": "compatible",
33
+ "0.2.1-rc.2": "compatible",
34
+ "0.2.1-rc.3": "compatible"
35
+ },
36
+ "node": ">=22.18",
37
+ "profiles": [
38
+ "web",
39
+ "desktop"
40
+ ]
41
+ }
42
+ },
43
+ "homepage": "https://github.com/Scorp1o117/dsh-tdai-memory",
44
+ "files": [
45
+ "locale",
46
+ "index.js",
47
+ "recall-inject.js",
48
+ "recall-runtime.js",
49
+ "client.js",
50
+ "cordis.patch.yml",
51
+ "vendor",
52
+ "README.md",
53
+ "README.zh.md",
54
+ "LICENSE",
55
+ "THIRD-PARTY-NOTICES.md"
56
+ ],
57
+ "keywords": [
58
+ "dsh",
59
+ "dsh-plugin",
60
+ "deepseek-harness",
61
+ "memory",
62
+ "tencentdb",
63
+ "agent-memory",
64
+ "rag",
65
+ "vector-search",
66
+ "persona"
67
+ ],
68
+ "license": "MIT",
69
+ "engines": {
70
+ "node": ">=22.18",
71
+ "dsh": ">=0.2.0-rc.2 <0.3.0 || 0.2.1-rc.1 || 0.2.1-rc.2 || 0.2.1-rc.3"
72
+ },
73
+ "repository": {
74
+ "type": "git",
75
+ "url": "git+https://github.com/Scorp1o117/dsh-tdai-memory.git"
76
+ },
77
+ "bugs": {
78
+ "url": "https://github.com/Scorp1o117/dsh-tdai-memory/issues"
79
+ },
80
+ "dependencies": {
81
+ "@ai-sdk/openai": "^3.0.53",
82
+ "@deepseek-ai/schemastery": "^3.18.4",
83
+ "@node-rs/jieba": "^2.0.1",
84
+ "@tencentdb-agent-memory/tcvdb-text": "^0.1.1",
85
+ "ai": "^6.0.164",
86
+ "json5": "^2.2.3",
87
+ "sqlite-vec": "0.1.7-alpha.2",
88
+ "undici": "^8.1.0"
89
+ },
90
+ "peerDependencies": {
91
+ "react": "^18.2.0",
92
+ "@deepseek-ai/dsh-tools": ">=0.2.0-rc.2 <0.3.0 || 0.2.1-rc.1 || 0.2.1-rc.2 || 0.2.1-rc.3",
93
+ "@deepseek-ai/dsh-settings": ">=0.2.0-rc.2 <0.3.0 || 0.2.1-rc.1 || 0.2.1-rc.2 || 0.2.1-rc.3",
94
+ "node-llama-cpp": "^3.19.1"
95
+ },
96
+ "peerDependenciesMeta": {
97
+ "node-llama-cpp": {
98
+ "optional": true
99
+ }
100
+ },
101
+ "scripts": {
102
+ "test": "node tests/settings-scope-compat.test.mjs && node tests/install-contract.test.mjs && node --test tests/plugin-page.test.mjs tests/client-write-flow.test.mjs tests/tools-registration.test.mjs tests/recall-runtime.test.mjs && node --test tests/locale.test.mjs"
103
+ }
104
+ }
@@ -1,15 +1,15 @@
1
- /**
2
- * TDAI Adapters — barrel re-export for all host adapter implementations.
3
- *
4
- * Each adapter translates a specific host environment's API into
5
- * the host-neutral HostAdapter interface consumed by TdaiCore.
6
- *
7
- * Directory structure:
8
- * adapters/
9
- * ├── openclaw/ — OpenClaw plugin host (in-process, runEmbeddedPiAgent)
10
- * └── standalone/ — Gateway / Hermes sidecar (HTTP, OpenAI-compatible API)
11
- */
12
- // OpenClaw adapter
13
- export { OpenClawHostAdapter, OpenClawLLMRunner, OpenClawLLMRunnerFactory } from "./openclaw/index.js";
14
- // Standalone adapter
15
- export { StandaloneHostAdapter, StandaloneLLMRunner, StandaloneLLMRunnerFactory } from "./standalone/index.js";
1
+ /**
2
+ * TDAI Adapters — barrel re-export for all host adapter implementations.
3
+ *
4
+ * Each adapter translates a specific host environment's API into
5
+ * the host-neutral HostAdapter interface consumed by TdaiCore.
6
+ *
7
+ * Directory structure:
8
+ * adapters/
9
+ * ├── openclaw/ — OpenClaw plugin host (in-process, runEmbeddedPiAgent)
10
+ * └── standalone/ — Gateway / Hermes sidecar (HTTP, OpenAI-compatible API)
11
+ */
12
+ // OpenClaw adapter
13
+ export { OpenClawHostAdapter, OpenClawLLMRunner, OpenClawLLMRunnerFactory } from "./openclaw/index.js";
14
+ // Standalone adapter
15
+ export { StandaloneHostAdapter, StandaloneLLMRunner, StandaloneLLMRunnerFactory } from "./standalone/index.js";
@@ -1,83 +1,83 @@
1
- /**
2
- * OpenClawHostAdapter — translates OpenClaw's plugin API into TDAI Core's
3
- * unified HostAdapter interface.
4
- *
5
- * This is the "thin shell" that keeps OpenClaw-specific dependencies
6
- * (OpenClawPluginApi, pluginConfig, resolveStateDir, event system)
7
- * confined to the adapter layer while TDAI Core remains host-neutral.
8
- *
9
- * Usage (in index.ts):
10
- * const adapter = new OpenClawHostAdapter({ api, pluginDataDir, config });
11
- * const core = new TdaiCore({ hostAdapter: adapter, config: parsedConfig });
12
- */
13
- import { OpenClawLLMRunnerFactory } from "./llm-runner.js";
14
- // ============================
15
- // OpenClawHostAdapter
16
- // ============================
17
- export class OpenClawHostAdapter {
18
- hostType = "openclaw";
19
- api;
20
- pluginDataDir;
21
- openclawConfig;
22
- runnerFactory;
23
- constructor(opts) {
24
- this.api = opts.api;
25
- this.pluginDataDir = opts.pluginDataDir;
26
- this.openclawConfig = opts.openclawConfig;
27
- this.runnerFactory = new OpenClawLLMRunnerFactory({
28
- config: opts.openclawConfig,
29
- agentRuntime: opts.api.runtime.agent,
30
- logger: opts.api.logger,
31
- });
32
- }
33
- /**
34
- * Build a RuntimeContext from the current OpenClaw session.
35
- *
36
- * In OpenClaw, sessionKey and sessionId come from the event/ctx objects
37
- * passed to hooks. This method returns a context with sensible defaults;
38
- * callers can override sessionKey/sessionId per-hook invocation using
39
- * `buildRuntimeContextForSession()`.
40
- */
41
- getRuntimeContext() {
42
- return {
43
- userId: "default_user",
44
- sessionId: "",
45
- sessionKey: "",
46
- platform: "openclaw",
47
- workspaceDir: process.cwd(),
48
- dataDir: this.pluginDataDir,
49
- };
50
- }
51
- /**
52
- * Build a RuntimeContext for a specific session (used per-hook).
53
- *
54
- * This is an OpenClaw-specific convenience that merges session-level
55
- * identifiers from hook ctx into the base context.
56
- */
57
- buildRuntimeContextForSession(sessionKey, sessionId) {
58
- return {
59
- ...this.getRuntimeContext(),
60
- sessionKey,
61
- sessionId: sessionId ?? "",
62
- };
63
- }
64
- getLogger() {
65
- return this.api.logger;
66
- }
67
- getLLMRunnerFactory() {
68
- return this.runnerFactory;
69
- }
70
- // -- OpenClaw-specific accessors (for index.ts bridge) --------------------
71
- /** Get the raw OpenClaw plugin API (for legacy callers during migration). */
72
- getPluginApi() {
73
- return this.api;
74
- }
75
- /** Get the OpenClaw config object (for legacy callers during migration). */
76
- getOpenClawConfig() {
77
- return this.openclawConfig;
78
- }
79
- /** Get the resolved plugin data directory. */
80
- getPluginDataDir() {
81
- return this.pluginDataDir;
82
- }
83
- }
1
+ /**
2
+ * OpenClawHostAdapter — translates OpenClaw's plugin API into TDAI Core's
3
+ * unified HostAdapter interface.
4
+ *
5
+ * This is the "thin shell" that keeps OpenClaw-specific dependencies
6
+ * (OpenClawPluginApi, pluginConfig, resolveStateDir, event system)
7
+ * confined to the adapter layer while TDAI Core remains host-neutral.
8
+ *
9
+ * Usage (in index.ts):
10
+ * const adapter = new OpenClawHostAdapter({ api, pluginDataDir, config });
11
+ * const core = new TdaiCore({ hostAdapter: adapter, config: parsedConfig });
12
+ */
13
+ import { OpenClawLLMRunnerFactory } from "./llm-runner.js";
14
+ // ============================
15
+ // OpenClawHostAdapter
16
+ // ============================
17
+ export class OpenClawHostAdapter {
18
+ hostType = "openclaw";
19
+ api;
20
+ pluginDataDir;
21
+ openclawConfig;
22
+ runnerFactory;
23
+ constructor(opts) {
24
+ this.api = opts.api;
25
+ this.pluginDataDir = opts.pluginDataDir;
26
+ this.openclawConfig = opts.openclawConfig;
27
+ this.runnerFactory = new OpenClawLLMRunnerFactory({
28
+ config: opts.openclawConfig,
29
+ agentRuntime: opts.api.runtime.agent,
30
+ logger: opts.api.logger,
31
+ });
32
+ }
33
+ /**
34
+ * Build a RuntimeContext from the current OpenClaw session.
35
+ *
36
+ * In OpenClaw, sessionKey and sessionId come from the event/ctx objects
37
+ * passed to hooks. This method returns a context with sensible defaults;
38
+ * callers can override sessionKey/sessionId per-hook invocation using
39
+ * `buildRuntimeContextForSession()`.
40
+ */
41
+ getRuntimeContext() {
42
+ return {
43
+ userId: "default_user",
44
+ sessionId: "",
45
+ sessionKey: "",
46
+ platform: "openclaw",
47
+ workspaceDir: process.cwd(),
48
+ dataDir: this.pluginDataDir,
49
+ };
50
+ }
51
+ /**
52
+ * Build a RuntimeContext for a specific session (used per-hook).
53
+ *
54
+ * This is an OpenClaw-specific convenience that merges session-level
55
+ * identifiers from hook ctx into the base context.
56
+ */
57
+ buildRuntimeContextForSession(sessionKey, sessionId) {
58
+ return {
59
+ ...this.getRuntimeContext(),
60
+ sessionKey,
61
+ sessionId: sessionId ?? "",
62
+ };
63
+ }
64
+ getLogger() {
65
+ return this.api.logger;
66
+ }
67
+ getLLMRunnerFactory() {
68
+ return this.runnerFactory;
69
+ }
70
+ // -- OpenClaw-specific accessors (for index.ts bridge) --------------------
71
+ /** Get the raw OpenClaw plugin API (for legacy callers during migration). */
72
+ getPluginApi() {
73
+ return this.api;
74
+ }
75
+ /** Get the OpenClaw config object (for legacy callers during migration). */
76
+ getOpenClawConfig() {
77
+ return this.openclawConfig;
78
+ }
79
+ /** Get the resolved plugin data directory. */
80
+ getPluginDataDir() {
81
+ return this.pluginDataDir;
82
+ }
83
+ }
@@ -1,5 +1,5 @@
1
- /**
2
- * OpenClaw adapter — barrel exports.
3
- */
4
- export { OpenClawHostAdapter } from "./host-adapter.js";
5
- export { OpenClawLLMRunner, OpenClawLLMRunnerFactory } from "./llm-runner.js";
1
+ /**
2
+ * OpenClaw adapter — barrel exports.
3
+ */
4
+ export { OpenClawHostAdapter } from "./host-adapter.js";
5
+ export { OpenClawLLMRunner, OpenClawLLMRunnerFactory } from "./llm-runner.js";