dsh-tdai-memory 0.3.5 → 0.4.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.
- package/LICENSE +21 -21
- package/README.md +19 -4
- package/README.zh.md +20 -5
- package/THIRD-PARTY-NOTICES.md +20 -20
- package/client.js +27 -35
- package/cordis.patch.yml +8 -8
- package/index.js +13 -13
- package/package.json +97 -95
- package/recall-inject.js +86 -86
- 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,5 +1,9 @@
|
|
|
1
1
|
# dsh-tdai-memory
|
|
2
2
|
|
|
3
|
+
## Configuration page (DSH 0.2.0-rc.2 and later)
|
|
4
|
+
|
|
5
|
+
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.
|
|
6
|
+
|
|
3
7
|
[](README.zh.md)
|
|
4
8
|
|
|
5
9
|
**GitHub**: [Scorp1o117/dsh-tdai-memory](https://github.com/Scorp1o117/dsh-tdai-memory) · **npm**: [dsh-tdai-memory](https://www.npmjs.com/package/dsh-tdai-memory)
|
|
@@ -11,11 +15,20 @@ Part of the [DeepSeek Harness Enhancement Suite](https://github.com/Scorp1o117/d
|
|
|
11
15
|
A port of **TencentDB Agent Memory** (Tencent Cloud's open-source four-layer
|
|
12
16
|
memory system, originally an OpenClaw plugin) into DeepSeek Harness.
|
|
13
17
|
|
|
14
|
-
## Compatibility (v0.3.
|
|
18
|
+
## Compatibility (v0.3.6)
|
|
19
|
+
|
|
20
|
+
Verified with DSH `0.1.7-rc.2` (Web) and `0.2.0-rc.2` (Desktop runtime) in isolated profiles. The Desktop app uses its own `desktop` profile. Other DSH prereleases remain unverified.
|
|
21
|
+
|
|
22
|
+
## Desktop install
|
|
23
|
+
|
|
24
|
+
Use the Desktop-installed `dsh` command (Application → Manage dsh Command), or the app’s Plugins page. Then install into the Desktop profile:
|
|
25
|
+
|
|
26
|
+
```powershell
|
|
27
|
+
dsh plugin --profile desktop add dsh-tdai-memory@0.3.6
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
Restart the Desktop app to load the client bundle. Desktop keeps its profile under `$DSH_HOME/profiles/desktop`.
|
|
15
31
|
|
|
16
|
-
Tested with DSH `0.1.7-rc.1` and `0.1.7-rc.2` (`next`); npm `latest` is `0.1.5-rc.3`.
|
|
17
|
-
Settings now live in the Profile patch, and the browser uses `configForms`.
|
|
18
|
-
Older hosts require an older plugin release; alpha builds remain `unknown`.
|
|
19
32
|
|
|
20
33
|
## Features
|
|
21
34
|
|
|
@@ -134,3 +147,5 @@ not need it. Users who select the local backend should install and approve
|
|
|
134
147
|
|
|
135
148
|
MIT
|
|
136
149
|
|
|
150
|
+
|
|
151
|
+
Saves use the configuration form API. Rejected writes retain the draft and show an error. Changing a model preserves credentials, and disabling a default-on option explicitly stores `false`.
|
package/README.zh.md
CHANGED
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
# dsh-tdai-memory
|
|
2
2
|
|
|
3
|
+
## 配置入口(DSH 0.2.0-rc.2 起)
|
|
4
|
+
|
|
5
|
+
在首页侧边栏打开 **插件 → 已安装 → dsh-tdai-memory**,直接在插件详情页配置并保存。配置页注册到官方的 `plugins.bundle.config` 接口;全局设置页不再重复显示配置入口。Web 与桌面版使用相同界面,本版要求 DSH 0.2.0-rc.2 或更新的 0.2.x 版本。现有配置无需迁移。
|
|
6
|
+
|
|
3
7
|
**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)
|
|
4
8
|
|
|
5
9
|
[](https://github.com/Scorp1o117/dsh-enhancement-suite) [](https://www.npmjs.com/package/dsh-enhancement-suite)
|
|
@@ -8,11 +12,20 @@
|
|
|
8
12
|
|
|
9
13
|
把 **TencentDB Agent Memory**(腾讯云开源的四层记忆系统,原为 OpenClaw 插件)移植进 DeepSeek Harness。
|
|
10
14
|
|
|
11
|
-
## 兼容性(v0.3.
|
|
15
|
+
## 兼容性(v0.3.6)
|
|
16
|
+
|
|
17
|
+
已在 DSH `0.1.7-rc.2`(Web)与 `0.2.0-rc.2`(桌面端运行时)的一次性 Profile 验证。桌面端使用独立的 `desktop` Profile;其他预发布版本暂未验证。
|
|
18
|
+
|
|
19
|
+
## 桌面端安装
|
|
20
|
+
|
|
21
|
+
在桌面端的“插件”页面安装,或使用桌面端“应用 → 管理 dsh 命令”注册的命令:
|
|
22
|
+
|
|
23
|
+
```powershell
|
|
24
|
+
dsh plugin --profile desktop add dsh-tdai-memory@0.3.6
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
重启桌面端以加载客户端插件。配置位于 `$DSH_HOME/profiles/desktop`。
|
|
12
28
|
|
|
13
|
-
已验证 DSH `0.1.7-rc.1` 与 `0.1.7-rc.2`(npm `next`);npm `latest` 是 `0.1.5-rc.3`。
|
|
14
|
-
设置保存在当前 Profile patch,Web 端使用 `configForms`。
|
|
15
|
-
旧宿主请使用插件旧版;alpha 构建仍标记 `unknown`。
|
|
16
29
|
|
|
17
30
|
## 能力
|
|
18
31
|
|
|
@@ -47,7 +60,7 @@
|
|
|
47
60
|
|
|
48
61
|
## 配置(profile patch + settings)
|
|
49
62
|
|
|
50
|
-
配置以 **settings 命名空间**驱动:profile patch 作为 base 层,`$DSH_HOME/settings.yaml` 的 `tdai-memory:` 节覆盖(LLM/embedding 密钥已迁到 settings.yaml
|
|
63
|
+
配置以 **settings 命名空间**驱动:profile patch 作为 base 层,`$DSH_HOME/settings.yaml` 的 `tdai-memory:` 节覆盖(LLM/embedding 密钥已迁到 settings.yaml)。首页侧边栏插件 → dsh-tdai-memory 可编辑全部字段(v0.2.0,含写-only 密钥);TdaiCore 启动时构建,改动**重启后生效**。
|
|
51
64
|
|
|
52
65
|
```yaml
|
|
53
66
|
# $DSH_HOME/settings.yaml
|
|
@@ -85,3 +98,5 @@ tdai-memory:
|
|
|
85
98
|
- **L1 记忆向量**:随存储写入(8088 embedding 快);L0 向量走后台任务,headless 退出时由 `destroy()` drain
|
|
86
99
|
- **升级**:上游拉新代码后,在 tdai 项目目录重跑 `npx tsc -p dsh-tsconfig.json`(产物在 `dist-dsh/`)
|
|
87
100
|
|
|
101
|
+
|
|
102
|
+
保存使用配置表单 API;宿主拒绝写入时保留草稿并提示错误。只修改模型不会覆盖密钥,关闭默认开启的选项会显式保存 `false`。
|
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/client.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* dsh-tdai-memory — browser half.
|
|
3
3
|
*
|
|
4
|
-
* A
|
|
4
|
+
* A configuration page inside the sidebar Plugins page: edits `tdai-memory`
|
|
5
5
|
* settings namespace (data dir, extraction LLM, embeddings, capture/extract/
|
|
6
6
|
* recall switches, tools) through the settings scope transport plus nested
|
|
7
7
|
* `settings.mutate` ops. TdaiCore is built at startup, so changes apply
|
|
@@ -47,7 +47,7 @@ window.__ModuleLoader__.load({
|
|
|
47
47
|
|
|
48
48
|
// ── locale ────────────────────────────────────────────────────────────
|
|
49
49
|
var NS = "tdaiMemory";
|
|
50
|
-
var inject = ["slots", "locale", "configForms"
|
|
50
|
+
var inject = ["slots", "locale", "configForms"];
|
|
51
51
|
var zh = {
|
|
52
52
|
nav: "记忆",
|
|
53
53
|
intro: "TDAI 记忆配置:L0 捕获 → L1 结构化提取 → 召回注入。密钥只写不读。TdaiCore 在启动时构建,修改后需重启生效。",
|
|
@@ -88,6 +88,7 @@ window.__ModuleLoader__.load({
|
|
|
88
88
|
saved: "已保存(重启后生效)",
|
|
89
89
|
saving: "保存中…",
|
|
90
90
|
error: "保存失败",
|
|
91
|
+
notApplied: "写入未生效,请检查配置后重试",
|
|
91
92
|
unavailable: "设置命名空间不可用(服务端未注册 tdai-memory 命名空间?)",
|
|
92
93
|
overridden: "已覆盖",
|
|
93
94
|
loading: "加载中…"
|
|
@@ -132,6 +133,7 @@ window.__ModuleLoader__.load({
|
|
|
132
133
|
saved: "Saved (applies after restart)",
|
|
133
134
|
saving: "Saving…",
|
|
134
135
|
error: "Save failed",
|
|
136
|
+
notApplied: "Write did not take effect; check the configuration and retry",
|
|
135
137
|
unavailable: "Settings namespace unavailable (tdai-memory namespace not registered server-side?)",
|
|
136
138
|
overridden: "overridden",
|
|
137
139
|
loading: "Loading…"
|
|
@@ -176,7 +178,6 @@ window.__ModuleLoader__.load({
|
|
|
176
178
|
function MemorySection(props) {
|
|
177
179
|
var t = props.t;
|
|
178
180
|
var scope = props.scope;
|
|
179
|
-
var api = props.api;
|
|
180
181
|
var [snapshot, setSnapshot] = react.useState(function () { return scope.getSnapshot(); });
|
|
181
182
|
var ready = snapshot.status === "ready" && snapshot.value !== void 0;
|
|
182
183
|
var [draft, setDraft] = react.useState({});
|
|
@@ -216,6 +217,7 @@ window.__ModuleLoader__.load({
|
|
|
216
217
|
var user = snapshot.user || {};
|
|
217
218
|
|
|
218
219
|
function fieldDraft(f) {
|
|
220
|
+
if (f.secret) return draft[f.key] || "";
|
|
219
221
|
if (f.type === "checkbox") return draft[f.key] !== void 0 ? draft[f.key] : Boolean(getPath(value, f.path));
|
|
220
222
|
return draft[f.key] !== void 0 ? draft[f.key] : String(getPath(value, f.path) ?? "");
|
|
221
223
|
}
|
|
@@ -226,6 +228,7 @@ window.__ModuleLoader__.load({
|
|
|
226
228
|
}
|
|
227
229
|
|
|
228
230
|
function onSave() {
|
|
231
|
+
if (busy || !snapshot.writable) return;
|
|
229
232
|
setBusy(true); setNotice(null); setError(null);
|
|
230
233
|
var ops = [];
|
|
231
234
|
for (var i = 0; i < FIELDS.length; i += 1) {
|
|
@@ -240,7 +243,7 @@ window.__ModuleLoader__.load({
|
|
|
240
243
|
}
|
|
241
244
|
if (f.type === "checkbox") {
|
|
242
245
|
if (Boolean(d) === Boolean(current)) continue;
|
|
243
|
-
ops.push(
|
|
246
|
+
ops.push({ op: "set", path: f.path, value: Boolean(d) });
|
|
244
247
|
continue;
|
|
245
248
|
}
|
|
246
249
|
if (String(d) === String(current ?? "")) continue;
|
|
@@ -248,35 +251,27 @@ window.__ModuleLoader__.load({
|
|
|
248
251
|
ops.push(String(d).trim() === "" ? { op: "unset", path: f.path } : { op: "set", path: f.path, value: f.type === "number" ? Number(d) : d });
|
|
249
252
|
}
|
|
250
253
|
if (ops.length === 0) { setBusy(false); setNotice(t("saved")); return; }
|
|
251
|
-
|
|
252
|
-
ns: "tdai-memory",
|
|
253
|
-
ops: ops,
|
|
254
|
-
...snapshot.revision === void 0 ? {} : { expectedRevision: snapshot.revision }
|
|
255
|
-
}).then(function (response) {
|
|
256
|
-
setBusy(false);
|
|
257
|
-
if (!response.result.ok) {
|
|
258
|
-
var detail = response.result.error || {};
|
|
259
|
-
setError(t("error") + ": " + String(detail.message || detail.code || "unknown"));
|
|
260
|
-
return;
|
|
261
|
-
}
|
|
262
|
-
setNotice(t("saved"));
|
|
263
|
-
if (response.result.value) setDraft(Object.assign({}, valueToDraft(response.result.value)));
|
|
264
|
-
}).catch(function (e) {
|
|
265
|
-
setBusy(false); setError(t("error") + ": " + String(e && e.message || e));
|
|
266
|
-
});
|
|
254
|
+
commit(ops);
|
|
267
255
|
}
|
|
268
256
|
|
|
269
257
|
function onReset() {
|
|
258
|
+
if (busy || !snapshot.writable) return;
|
|
270
259
|
setBusy(true); setNotice(null); setError(null);
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
260
|
+
commit(FIELDS.map(function (f) { return { op: "unset", path: f.path }; }));
|
|
261
|
+
}
|
|
262
|
+
|
|
263
|
+
function commit(ops) {
|
|
264
|
+
// The form owns the transport and the recovery read. A refused Host
|
|
265
|
+
// write resolves false; it must not be displayed as a successful save.
|
|
266
|
+
Promise.resolve().then(function () {
|
|
267
|
+
return scope.mutate(ops, snapshot.revision);
|
|
268
|
+
}).then(function (ok) {
|
|
269
|
+
var next = scope.getSnapshot();
|
|
270
|
+
setSnapshot(next);
|
|
276
271
|
setBusy(false);
|
|
277
|
-
if (!
|
|
272
|
+
if (!ok) { setError(t("error") + ": " + t("notApplied")); return; }
|
|
278
273
|
setNotice(t("saved"));
|
|
279
|
-
if (
|
|
274
|
+
if (next.value) setDraft(valueToDraft(next.value));
|
|
280
275
|
}).catch(function (e) {
|
|
281
276
|
setBusy(false); setError(t("error") + ": " + String(e && e.message || e));
|
|
282
277
|
});
|
|
@@ -336,7 +331,7 @@ window.__ModuleLoader__.load({
|
|
|
336
331
|
var out = {};
|
|
337
332
|
for (var i = 0; i < FIELDS.length; i += 1) {
|
|
338
333
|
var f = FIELDS[i];
|
|
339
|
-
out[f.key] = f.type === "checkbox" ? Boolean(getPath(value, f.path)) : String(getPath(value, f.path) ?? "");
|
|
334
|
+
out[f.key] = f.secret ? "" : f.type === "checkbox" ? Boolean(getPath(value, f.path)) : String(getPath(value, f.path) ?? "");
|
|
340
335
|
}
|
|
341
336
|
return out;
|
|
342
337
|
}
|
|
@@ -346,16 +341,13 @@ window.__ModuleLoader__.load({
|
|
|
346
341
|
var t = ctx.locale.bind(NS);
|
|
347
342
|
ctx.effect(function () { return ctx.locale.register(NS, { zh: zh, en: en }); }, "dsh-tdai-memory: dictionaries");
|
|
348
343
|
var scope = ctx.configForms.get("tdai-memory");
|
|
349
|
-
|
|
350
|
-
ctx.slots.inject("settings.section", function () {
|
|
344
|
+
ctx.slots.inject("plugins.bundle.config", function () {
|
|
351
345
|
return ctx.slots.register({
|
|
352
|
-
name: "
|
|
353
|
-
|
|
354
|
-
order: 26,
|
|
355
|
-
label: function () { return t("nav"); },
|
|
346
|
+
name: "plugins.bundle.config",
|
|
347
|
+
key: "dsh-tdai-memory",
|
|
356
348
|
locale: NS
|
|
357
349
|
}, function (props) {
|
|
358
|
-
return h(MemorySection, Object.assign({}, props, { scope: scope,
|
|
350
|
+
return h(MemorySection, Object.assign({}, props, { scope: scope, t: t }));
|
|
359
351
|
});
|
|
360
352
|
});
|
|
361
353
|
}
|
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/index.js
CHANGED
|
@@ -37,7 +37,7 @@ const Config = z.object({
|
|
|
37
37
|
/** TDAI data directory; default: ~/.memory-tencentdb/memory-tdai. */
|
|
38
38
|
dataDir: z.string().default(""),
|
|
39
39
|
/** LLM used for L1/L2/L3 extraction (OpenAI-compatible). Falls back to TDAI_LLM_* env. */
|
|
40
|
-
llm: z.object({
|
|
40
|
+
llm: z.object({
|
|
41
41
|
baseUrl: z.string().default(""),
|
|
42
42
|
apiKey: z.string().default("").role("secret"),
|
|
43
43
|
model: z.string().default(""),
|
|
@@ -52,34 +52,34 @@ const Config = z.object({
|
|
|
52
52
|
sessionHeaderName: z.string().default("x-opencode-session"),
|
|
53
53
|
/** Fixed session id for LLM requests; empty = persistent auto id. */
|
|
54
54
|
sessionId: z.string().default(""),
|
|
55
|
-
}).default({}),
|
|
55
|
+
}).default({}),
|
|
56
56
|
/** Embedding endpoint (OpenAI-compatible /v1/embeddings). */
|
|
57
|
-
embedding: z.object({
|
|
57
|
+
embedding: z.object({
|
|
58
58
|
baseUrl: z.string().default("http://127.0.0.1:8088/v1"),
|
|
59
59
|
apiKey: z.string().default("").role("secret"),
|
|
60
60
|
model: z.string().default("Qwen3-Embedding-0.6B"),
|
|
61
61
|
dimensions: z.number().default(1024),
|
|
62
62
|
sendDimensions: z.boolean().default(false),
|
|
63
|
-
}).default({}),
|
|
63
|
+
}).default({}),
|
|
64
64
|
/** Capture conversations into L0. */
|
|
65
65
|
captureEnabled: z.boolean().default(true),
|
|
66
66
|
/** L1 extraction pipeline (facts from conversations). */
|
|
67
|
-
extraction: z.object({
|
|
67
|
+
extraction: z.object({
|
|
68
68
|
enabled: z.boolean().default(true),
|
|
69
69
|
/** Conflict detection before storing; extra LLM call, disable if flaky.
|
|
70
70
|
* Off by default: dedup LLM output parsing is flaky (README matches). */
|
|
71
71
|
enableDedup: z.boolean().default(false),
|
|
72
|
-
}).default({}),
|
|
72
|
+
}).default({}),
|
|
73
73
|
/** Recall injection settings. */
|
|
74
|
-
recall: z.object({
|
|
74
|
+
recall: z.object({
|
|
75
75
|
enabled: z.boolean().default(true),
|
|
76
76
|
maxResults: z.number().default(5),
|
|
77
77
|
scoreThreshold: z.number().default(0.3),
|
|
78
78
|
timeoutMs: z.number().default(3000),
|
|
79
|
-
}).default({}),
|
|
79
|
+
}).default({}),
|
|
80
80
|
/** Register the two search tools. */
|
|
81
81
|
toolsEnabled: z.boolean().default(true),
|
|
82
|
-
}).volatile();
|
|
82
|
+
}).volatile();
|
|
83
83
|
|
|
84
84
|
/**
|
|
85
85
|
* Whether a derived message is real human input.
|
|
@@ -390,9 +390,9 @@ function apply(ctx, config) {
|
|
|
390
390
|
// `installSettingsSection` export (the provider now lives at ctx.settings).
|
|
391
391
|
// Inline the same logic via ctx.inject(["settings"]) — works on both
|
|
392
392
|
// 0.1.1 (module export wrapper) and 0.1.2 (ctx.settings) hosts.
|
|
393
|
-
ctx.on("settings/document-updated", (id) => {
|
|
394
|
-
if (id === NS) ctx.logger.warn("[tdai-memory] settings updated; restart to apply (TdaiCore is built at startup)");
|
|
395
|
-
});
|
|
393
|
+
ctx.on("settings/document-updated", (id) => {
|
|
394
|
+
if (id === NS) ctx.logger.warn("[tdai-memory] settings updated; restart to apply (TdaiCore is built at startup)");
|
|
395
|
+
});
|
|
396
396
|
|
|
397
397
|
// Fallback when no settings service ever mounts: build from the entry
|
|
398
398
|
// config. One-shot — if the settings mount arrives later, its build
|
|
@@ -401,7 +401,7 @@ function apply(ctx, config) {
|
|
|
401
401
|
setTimeout(() => {
|
|
402
402
|
if (!builtOnce) {
|
|
403
403
|
builtOnce = true;
|
|
404
|
-
void build(typeof config.get === "function" ? config.get() : config);
|
|
404
|
+
void build(typeof config.get === "function" ? config.get() : config);
|
|
405
405
|
}
|
|
406
406
|
}, 500);
|
|
407
407
|
|
package/package.json
CHANGED
|
@@ -1,95 +1,97 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "dsh-tdai-memory",
|
|
3
|
-
"version": "0.
|
|
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
|
-
},
|
|
12
|
-
"dsh": {
|
|
13
|
-
"bundle": {
|
|
14
|
-
"patch": "./cordis.patch.yml"
|
|
15
|
-
},
|
|
16
|
-
"client": {
|
|
17
|
-
"platform": "web"
|
|
18
|
-
},
|
|
19
|
-
"compatibility": {
|
|
20
|
-
"dsh": ">=0.
|
|
21
|
-
"dshReleases": {
|
|
22
|
-
"0.1.5-rc.2": "incompatible",
|
|
23
|
-
"0.1.5-rc.3": "incompatible",
|
|
24
|
-
"0.1.6-alpha.1": "unknown",
|
|
25
|
-
"0.1.6-alpha.2": "unknown",
|
|
26
|
-
"0.1.7-alpha.1": "unknown",
|
|
27
|
-
"0.1.7-alpha.2": "unknown",
|
|
28
|
-
"0.1.7-rc.1": "
|
|
29
|
-
"0.1.7-rc.2": "
|
|
30
|
-
|
|
31
|
-
|
|
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
|
-
"@
|
|
75
|
-
"@
|
|
76
|
-
"
|
|
77
|
-
"
|
|
78
|
-
"
|
|
79
|
-
"
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
"
|
|
85
|
-
"
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
1
|
+
{
|
|
2
|
+
"name": "dsh-tdai-memory",
|
|
3
|
+
"version": "0.4.0",
|
|
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
|
+
},
|
|
12
|
+
"dsh": {
|
|
13
|
+
"bundle": {
|
|
14
|
+
"patch": "./cordis.patch.yml"
|
|
15
|
+
},
|
|
16
|
+
"client": {
|
|
17
|
+
"platform": "web"
|
|
18
|
+
},
|
|
19
|
+
"compatibility": {
|
|
20
|
+
"dsh": ">=0.2.0-rc.2 <0.3.0",
|
|
21
|
+
"dshReleases": {
|
|
22
|
+
"0.1.5-rc.2": "incompatible",
|
|
23
|
+
"0.1.5-rc.3": "incompatible",
|
|
24
|
+
"0.1.6-alpha.1": "unknown",
|
|
25
|
+
"0.1.6-alpha.2": "unknown",
|
|
26
|
+
"0.1.7-alpha.1": "unknown",
|
|
27
|
+
"0.1.7-alpha.2": "unknown",
|
|
28
|
+
"0.1.7-rc.1": "incompatible",
|
|
29
|
+
"0.1.7-rc.2": "incompatible",
|
|
30
|
+
"0.2.0-rc.2": "compatible"
|
|
31
|
+
},
|
|
32
|
+
"node": ">=22.18",
|
|
33
|
+
"profiles": [
|
|
34
|
+
"web",
|
|
35
|
+
"desktop"
|
|
36
|
+
]
|
|
37
|
+
}
|
|
38
|
+
},
|
|
39
|
+
"homepage": "https://github.com/Scorp1o117/dsh-tdai-memory",
|
|
40
|
+
"files": [
|
|
41
|
+
"index.js",
|
|
42
|
+
"recall-inject.js",
|
|
43
|
+
"client.js",
|
|
44
|
+
"cordis.patch.yml",
|
|
45
|
+
"vendor",
|
|
46
|
+
"README.md",
|
|
47
|
+
"README.zh.md",
|
|
48
|
+
"LICENSE",
|
|
49
|
+
"THIRD-PARTY-NOTICES.md"
|
|
50
|
+
],
|
|
51
|
+
"keywords": [
|
|
52
|
+
"dsh",
|
|
53
|
+
"dsh-plugin",
|
|
54
|
+
"deepseek-harness",
|
|
55
|
+
"memory",
|
|
56
|
+
"tencentdb",
|
|
57
|
+
"agent-memory",
|
|
58
|
+
"rag",
|
|
59
|
+
"vector-search",
|
|
60
|
+
"persona"
|
|
61
|
+
],
|
|
62
|
+
"license": "MIT",
|
|
63
|
+
"engines": {
|
|
64
|
+
"node": ">=22.18"
|
|
65
|
+
},
|
|
66
|
+
"repository": {
|
|
67
|
+
"type": "git",
|
|
68
|
+
"url": "git+https://github.com/Scorp1o117/dsh-tdai-memory.git"
|
|
69
|
+
},
|
|
70
|
+
"bugs": {
|
|
71
|
+
"url": "https://github.com/Scorp1o117/dsh-tdai-memory/issues"
|
|
72
|
+
},
|
|
73
|
+
"dependencies": {
|
|
74
|
+
"@ai-sdk/openai": "^3.0.53",
|
|
75
|
+
"@deepseek-ai/schemastery": "^3.18.4",
|
|
76
|
+
"@node-rs/jieba": "^2.0.1",
|
|
77
|
+
"@tencentdb-agent-memory/tcvdb-text": "^0.1.1",
|
|
78
|
+
"ai": "^6.0.164",
|
|
79
|
+
"json5": "^2.2.3",
|
|
80
|
+
"sqlite-vec": "0.1.7-alpha.2",
|
|
81
|
+
"undici": "^8.1.0"
|
|
82
|
+
},
|
|
83
|
+
"peerDependencies": {
|
|
84
|
+
"react": "^18.2.0",
|
|
85
|
+
"@deepseek-ai/dsh-tools": ">=0.2.0-rc.2 <0.3.0",
|
|
86
|
+
"@deepseek-ai/dsh-settings": ">=0.2.0-rc.2 <0.3.0",
|
|
87
|
+
"node-llama-cpp": "^3.19.1"
|
|
88
|
+
},
|
|
89
|
+
"peerDependenciesMeta": {
|
|
90
|
+
"node-llama-cpp": {
|
|
91
|
+
"optional": true
|
|
92
|
+
}
|
|
93
|
+
},
|
|
94
|
+
"scripts": {
|
|
95
|
+
"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"
|
|
96
|
+
}
|
|
97
|
+
}
|