dsh-tdai-memory 0.4.2 → 0.4.4
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/LICENSE +21 -21
- package/README.md +8 -0
- package/README.zh.md +8 -0
- package/THIRD-PARTY-NOTICES.md +20 -20
- package/cordis.patch.yml +8 -8
- package/package.json +103 -100
- package/vendor/tdai/adapters/index.js +15 -15
- package/vendor/tdai/adapters/openclaw/host-adapter.js +83 -83
- package/vendor/tdai/adapters/openclaw/index.js +5 -5
- package/vendor/tdai/adapters/openclaw/llm-runner.js +69 -69
- package/vendor/tdai/adapters/standalone/host-adapter.js +58 -58
- package/vendor/tdai/adapters/standalone/index.js +5 -5
- package/vendor/tdai/core/conversation/l0-recorder.js +420 -420
- package/vendor/tdai/core/hooks/auto-capture.js +236 -236
- package/vendor/tdai/core/hooks/auto-recall.js +640 -640
- package/vendor/tdai/core/index.js +8 -8
- package/vendor/tdai/core/persona/persona-generator.js +184 -184
- package/vendor/tdai/core/persona/persona-trigger.js +94 -94
- package/vendor/tdai/core/profile/profile-sync.js +200 -200
- package/vendor/tdai/core/prompts/l1-dedup.js +72 -72
- package/vendor/tdai/core/prompts/l1-extraction.js +34 -34
- package/vendor/tdai/core/prompts/persona-generation.js +35 -35
- package/vendor/tdai/core/prompts/scene-extraction.js +45 -45
- package/vendor/tdai/core/record/l1-dedup.js +318 -318
- package/vendor/tdai/core/record/l1-extractor.js +379 -379
- package/vendor/tdai/core/record/l1-reader.js +178 -178
- package/vendor/tdai/core/record/l1-writer.js +141 -141
- package/vendor/tdai/core/report/reporter.js +86 -86
- package/vendor/tdai/core/scene/filename-normalizer.js +161 -161
- package/vendor/tdai/core/scene/scene-extractor.js +410 -410
- package/vendor/tdai/core/scene/scene-format.js +53 -53
- package/vendor/tdai/core/scene/scene-index.js +82 -82
- package/vendor/tdai/core/scene/scene-navigation.js +57 -57
- package/vendor/tdai/core/seed/input.js +404 -404
- package/vendor/tdai/core/seed/types.js +9 -9
- package/vendor/tdai/core/store/bm25-client.js +117 -117
- package/vendor/tdai/core/store/bm25-local.js +68 -68
- package/vendor/tdai/core/store/embedding.js +632 -632
- package/vendor/tdai/core/store/factory.js +95 -95
- package/vendor/tdai/core/store/search-utils.js +54 -54
- package/vendor/tdai/core/store/sqlite.js +1632 -1632
- package/vendor/tdai/core/store/tcvdb-client.js +221 -221
- package/vendor/tdai/core/store/tcvdb.js +1047 -1047
- package/vendor/tdai/core/store/types.js +17 -17
- package/vendor/tdai/core/tools/conversation-search.js +199 -199
- package/vendor/tdai/core/tools/memory-search.js +207 -207
- package/vendor/tdai/core/types.js +12 -12
- package/vendor/tdai/utils/backup.js +189 -189
- package/vendor/tdai/utils/checkpoint.js +360 -360
- package/vendor/tdai/utils/clean-context-runner.js +472 -472
- package/vendor/tdai/utils/ensure-hook-policy.js +213 -213
- package/vendor/tdai/utils/env.js +13 -13
- package/vendor/tdai/utils/managed-timer.js +127 -127
- package/vendor/tdai/utils/manifest.js +91 -91
- package/vendor/tdai/utils/memory-cleaner.js +300 -300
- package/vendor/tdai/utils/no-think-fetch.js +109 -109
- package/vendor/tdai/utils/openclaw-state-dir.js +26 -26
- package/vendor/tdai/utils/pipeline-factory.js +517 -517
- package/vendor/tdai/utils/pipeline-manager.js +892 -892
- package/vendor/tdai/utils/sanitize.js +360 -360
- package/vendor/tdai/utils/serial-queue.js +103 -103
- package/vendor/tdai/utils/session-filter.js +88 -88
- package/vendor/tdai/utils/text-utils.js +29 -29
- 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,4 +1,12 @@
|
|
|
1
1
|
# dsh-tdai-memory
|
|
2
|
+
|
|
3
|
+
## DSH 0.2.1-rc.2
|
|
4
|
+
|
|
5
|
+
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.
|
|
6
|
+
|
|
7
|
+
## DSH 0.2.1-rc.1
|
|
8
|
+
|
|
9
|
+
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.
|
|
2
10
|
|
|
3
11
|
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.
|
|
4
12
|
|
package/README.zh.md
CHANGED
|
@@ -1,4 +1,12 @@
|
|
|
1
1
|
# dsh-tdai-memory
|
|
2
|
+
|
|
3
|
+
## DSH 0.2.1-rc.2
|
|
4
|
+
|
|
5
|
+
适配 DSH 0.2.1-rc.2,明确声明该预发布版本的 engines.dsh 与 peer 范围。宿主新增 DeepSeek V4.1 Flash 1017 及 Search/Fetch API,本插件使用的接口保持不变。保留已有推理配置及自动补齐显式开启策略。
|
|
6
|
+
|
|
7
|
+
## DSH 0.2.1-rc.1
|
|
8
|
+
|
|
9
|
+
支持 DSH 0.2.1-rc.1,通过 `engines.dsh` 和一致的 peer 范围声明兼容,明确包含该预发布版本,并保留已有 0.2.0-rc.2 支持。
|
|
2
10
|
|
|
3
11
|
插件跟随 DSH 的语言设置(DSH 0.2.0-rc.2 内置中文和 English),配置页面、状态提示和插件列表名称/简介同步切换。扩展语言使用宿主的回退链。切换语言保留未保存的设置,无需单独选择插件语言。
|
|
4
12
|
|
package/THIRD-PARTY-NOTICES.md
CHANGED
|
@@ -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,100 +1,103 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "dsh-tdai-memory",
|
|
3
|
-
"version": "0.4.
|
|
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",
|
|
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
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
"
|
|
45
|
-
"
|
|
46
|
-
"
|
|
47
|
-
"
|
|
48
|
-
"
|
|
49
|
-
"
|
|
50
|
-
"
|
|
51
|
-
"
|
|
52
|
-
"
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
"
|
|
58
|
-
"
|
|
59
|
-
"
|
|
60
|
-
"
|
|
61
|
-
"
|
|
62
|
-
"
|
|
63
|
-
"
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
"
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
"url": "https://github.com/Scorp1o117/dsh-tdai-memory
|
|
75
|
-
},
|
|
76
|
-
"
|
|
77
|
-
"
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
"@
|
|
81
|
-
"ai": "^
|
|
82
|
-
"
|
|
83
|
-
"
|
|
84
|
-
"
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
"
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
"
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
"node-llama-cpp":
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
}
|
|
100
|
-
|
|
1
|
+
{
|
|
2
|
+
"name": "dsh-tdai-memory",
|
|
3
|
+
"version": "0.4.4",
|
|
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",
|
|
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
|
+
},
|
|
35
|
+
"node": ">=22.18",
|
|
36
|
+
"profiles": [
|
|
37
|
+
"web",
|
|
38
|
+
"desktop"
|
|
39
|
+
]
|
|
40
|
+
}
|
|
41
|
+
},
|
|
42
|
+
"homepage": "https://github.com/Scorp1o117/dsh-tdai-memory",
|
|
43
|
+
"files": [
|
|
44
|
+
"locale",
|
|
45
|
+
"index.js",
|
|
46
|
+
"recall-inject.js",
|
|
47
|
+
"recall-runtime.js",
|
|
48
|
+
"client.js",
|
|
49
|
+
"cordis.patch.yml",
|
|
50
|
+
"vendor",
|
|
51
|
+
"README.md",
|
|
52
|
+
"README.zh.md",
|
|
53
|
+
"LICENSE",
|
|
54
|
+
"THIRD-PARTY-NOTICES.md"
|
|
55
|
+
],
|
|
56
|
+
"keywords": [
|
|
57
|
+
"dsh",
|
|
58
|
+
"dsh-plugin",
|
|
59
|
+
"deepseek-harness",
|
|
60
|
+
"memory",
|
|
61
|
+
"tencentdb",
|
|
62
|
+
"agent-memory",
|
|
63
|
+
"rag",
|
|
64
|
+
"vector-search",
|
|
65
|
+
"persona"
|
|
66
|
+
],
|
|
67
|
+
"license": "MIT",
|
|
68
|
+
"engines": {
|
|
69
|
+
"node": ">=22.18",
|
|
70
|
+
"dsh": ">=0.2.0-rc.2 <0.3.0 || 0.2.1-rc.1 || 0.2.1-rc.2"
|
|
71
|
+
},
|
|
72
|
+
"repository": {
|
|
73
|
+
"type": "git",
|
|
74
|
+
"url": "git+https://github.com/Scorp1o117/dsh-tdai-memory.git"
|
|
75
|
+
},
|
|
76
|
+
"bugs": {
|
|
77
|
+
"url": "https://github.com/Scorp1o117/dsh-tdai-memory/issues"
|
|
78
|
+
},
|
|
79
|
+
"dependencies": {
|
|
80
|
+
"@ai-sdk/openai": "^3.0.53",
|
|
81
|
+
"@deepseek-ai/schemastery": "^3.18.4",
|
|
82
|
+
"@node-rs/jieba": "^2.0.1",
|
|
83
|
+
"@tencentdb-agent-memory/tcvdb-text": "^0.1.1",
|
|
84
|
+
"ai": "^6.0.164",
|
|
85
|
+
"json5": "^2.2.3",
|
|
86
|
+
"sqlite-vec": "0.1.7-alpha.2",
|
|
87
|
+
"undici": "^8.1.0"
|
|
88
|
+
},
|
|
89
|
+
"peerDependencies": {
|
|
90
|
+
"react": "^18.2.0",
|
|
91
|
+
"@deepseek-ai/dsh-tools": ">=0.2.0-rc.2 <0.3.0 || 0.2.1-rc.1 || 0.2.1-rc.2",
|
|
92
|
+
"@deepseek-ai/dsh-settings": ">=0.2.0-rc.2 <0.3.0 || 0.2.1-rc.1 || 0.2.1-rc.2",
|
|
93
|
+
"node-llama-cpp": "^3.19.1"
|
|
94
|
+
},
|
|
95
|
+
"peerDependenciesMeta": {
|
|
96
|
+
"node-llama-cpp": {
|
|
97
|
+
"optional": true
|
|
98
|
+
}
|
|
99
|
+
},
|
|
100
|
+
"scripts": {
|
|
101
|
+
"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"
|
|
102
|
+
}
|
|
103
|
+
}
|
|
@@ -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";
|