dsh-plugin-agent-memory 0.1.8 → 0.1.9
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/README.md +1 -1
- package/client.js +21 -3
- package/docs/DETAIL.md +13 -0
- package/index.js +46 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -49,7 +49,7 @@ Open the plugin's settings page (or the panel's gear button) and set:
|
|
|
49
49
|
| `topK` | Max memories per recall (1–10, default 4) |
|
|
50
50
|
| `layers` | Memory layers injected each turn (default `L3,L2`, matching the official proxy) |
|
|
51
51
|
| `timeoutMs` | Per-request timeout (default 6000) |
|
|
52
|
-
| `kernelUrl` | Kernel API base for wiki / code-graph / skills (default: Hub host on port 8420) |
|
|
52
|
+
| `kernelUrl` | Kernel API base for wiki / code-graph / skills (default: Hub host on port 8420). The knowledge service address is discovered from the kernel, and the proxy endpoint is not used |
|
|
53
53
|
| `tools` | Register the four read-only asset tools (default on) |
|
|
54
54
|
| `debug` | Append diagnostics to `~/.dsh/agent-memory-debug.log` (default off, 256 KiB cap) |
|
|
55
55
|
|
package/client.js
CHANGED
|
@@ -138,7 +138,7 @@ window.__ModuleLoader__.load({
|
|
|
138
138
|
const [config, setConfig] = React.useState(null);
|
|
139
139
|
const [configured, setConfigured] = React.useState(true);
|
|
140
140
|
const [health, setHealth] = React.useState({ state: 'idle', text: '连接未检测' });
|
|
141
|
-
const [form, setForm] = React.useState({ hubUrl: '', instanceId: '', userKey: '' });
|
|
141
|
+
const [form, setForm] = React.useState({ hubUrl: '', instanceId: '', kernelUrl: '', userKey: '' });
|
|
142
142
|
const [flags, setFlags] = React.useState({ injectMemory: true, writeMemory: false });
|
|
143
143
|
const [refreshMs, setRefreshMs] = React.useState(10000);
|
|
144
144
|
const [saving, setSaving] = React.useState(false);
|
|
@@ -160,6 +160,7 @@ window.__ModuleLoader__.load({
|
|
|
160
160
|
setForm({
|
|
161
161
|
hubUrl: String(current.hubUrl ?? ''),
|
|
162
162
|
instanceId: String(current.instanceId ?? ''),
|
|
163
|
+
kernelUrl: String(current.kernelUrl ?? ''),
|
|
163
164
|
userKey: '',
|
|
164
165
|
});
|
|
165
166
|
setFlags({
|
|
@@ -181,9 +182,13 @@ window.__ModuleLoader__.load({
|
|
|
181
182
|
json(`${ROUTE}/health`)
|
|
182
183
|
.then((payload) => {
|
|
183
184
|
const agents = (payload.teams ?? []).reduce((total, team) => total + (team.agents ?? 0), 0);
|
|
185
|
+
const down = (payload.services ?? []).filter((service) => service.ok !== true);
|
|
184
186
|
setHealth({
|
|
185
|
-
state: 'ok',
|
|
186
|
-
text:
|
|
187
|
+
state: down.length === 0 && payload.ok !== false ? 'ok' : 'bad',
|
|
188
|
+
text:
|
|
189
|
+
down.length === 0
|
|
190
|
+
? `已连接 · ${payload.user?.username ?? '未知用户'} · ${(payload.teams ?? []).length} 团队 / ${agents} agent`
|
|
191
|
+
: `部分服务不可用:${down.map((service) => `${service.name}(${service.detail})`).join(';')}`,
|
|
187
192
|
});
|
|
188
193
|
})
|
|
189
194
|
.catch((failure) => setHealth({ state: 'bad', text: `连接失败:${String(failure.message ?? failure)}` }));
|
|
@@ -198,6 +203,7 @@ window.__ModuleLoader__.load({
|
|
|
198
203
|
body: JSON.stringify({
|
|
199
204
|
hubUrl: form.hubUrl,
|
|
200
205
|
instanceId: form.instanceId,
|
|
206
|
+
kernelUrl: form.kernelUrl,
|
|
201
207
|
userKey: form.userKey,
|
|
202
208
|
injectMemory: flags.injectMemory,
|
|
203
209
|
refreshMs,
|
|
@@ -402,6 +408,18 @@ window.__ModuleLoader__.load({
|
|
|
402
408
|
onChange: (event) => setForm({ ...form, instanceId: event.target.value }),
|
|
403
409
|
}),
|
|
404
410
|
),
|
|
411
|
+
h(
|
|
412
|
+
'label',
|
|
413
|
+
{ style: fieldStyle },
|
|
414
|
+
h('span', { style: fieldLabelStyle }, '内核地址(选填,默认 Hub 主机名:8420)'),
|
|
415
|
+
h('input', {
|
|
416
|
+
style: inputStyle,
|
|
417
|
+
type: 'text',
|
|
418
|
+
value: form.kernelUrl,
|
|
419
|
+
placeholder: 'http://memhub.example.com:8420',
|
|
420
|
+
onChange: (event) => setForm({ ...form, kernelUrl: event.target.value }),
|
|
421
|
+
}),
|
|
422
|
+
),
|
|
405
423
|
h(
|
|
406
424
|
'label',
|
|
407
425
|
{ style: fieldStyle },
|
package/docs/DETAIL.md
CHANGED
|
@@ -28,6 +28,19 @@
|
|
|
28
28
|
|
|
29
29
|
Host 半侧导出了 `z.object` 形式的 `Config`(`userKey` 标了 `role('secret')`),因此插件详情页也能看到同名字段的表单;字段保存走框架的 `configEditor`,写入后提示重启插件以重建内存状态。
|
|
30
30
|
|
|
31
|
+
## 需要配置哪些服务
|
|
32
|
+
|
|
33
|
+
AM 一套部署有四个服务,插件只用到其中三个,且只有两个需要填:
|
|
34
|
+
|
|
35
|
+
| 服务 | 本实例地址 | 插件是否用 | 配置项 |
|
|
36
|
+
| --- | --- | --- | --- |
|
|
37
|
+
| Panel UI(Memory Hub 控制面) | `:8125` | 用:`auth/verify`、`team/list`、`agent/list`、`chat-memory/*` | `hubUrl` + `userKey`(必填) |
|
|
38
|
+
| Core Gateway(记忆内核) | `:8420` | 用:`/v3/knowledge/list`、`/v3/skill/*` | `kernelUrl`(可留空,按 Hub 主机名 + 8420 推断) |
|
|
39
|
+
| Knowledge 知识服务 | `:8424` | 用:每个资源的 `/tools/list`、`/tools/call` | **不需要配**:地址由内核 `knowledge/list` 返回的 `service_url` 下发,一个实例可能有多个 |
|
|
40
|
+
| Proxy 客户端接入点 | `:8096` | **不用**:那条链路是把整轮 LLM 请求换到 AM,本插件走 Host 内直连 | 无 |
|
|
41
|
+
|
|
42
|
+
「检测连接」会分别探测这三个用到的服务,任何一项挂掉会在面板上直接点名。
|
|
43
|
+
|
|
31
44
|
## 边界
|
|
32
45
|
|
|
33
46
|
- user key 只存在 Host 进程里,浏览器侧只访问本机同源路由,不接触凭据。
|
package/index.js
CHANGED
|
@@ -884,13 +884,58 @@ export function apply(ctx, config) {
|
|
|
884
884
|
owned,
|
|
885
885
|
});
|
|
886
886
|
}
|
|
887
|
+
// The asset tools depend on two more services; report them separately so a
|
|
888
|
+
// broken kernel or knowledge endpoint is visible without reading logs.
|
|
889
|
+
const services = [
|
|
890
|
+
{ name: 'hub', url: settings.hubUrl, ok: true, detail: `user ${me.username || me.userId}` },
|
|
891
|
+
];
|
|
892
|
+
let knowledgeItem = null;
|
|
893
|
+
try {
|
|
894
|
+
const items = await knowledgeResourcesAll();
|
|
895
|
+
knowledgeItem = items[0] ?? null;
|
|
896
|
+
services.push({
|
|
897
|
+
name: 'kernel',
|
|
898
|
+
url: kernelBase(),
|
|
899
|
+
ok: true,
|
|
900
|
+
detail: `${items.length} 个知识资源`,
|
|
901
|
+
});
|
|
902
|
+
} catch (error) {
|
|
903
|
+
services.push({
|
|
904
|
+
name: 'kernel',
|
|
905
|
+
url: kernelBase(),
|
|
906
|
+
ok: false,
|
|
907
|
+
detail: String(error?.message ?? error),
|
|
908
|
+
});
|
|
909
|
+
}
|
|
910
|
+
if (knowledgeItem !== null) {
|
|
911
|
+
try {
|
|
912
|
+
await knowledgeService(knowledgeItem.service_url, '/tools/list', {
|
|
913
|
+
knowledge_id: knowledgeItem.knowledge_id,
|
|
914
|
+
});
|
|
915
|
+
services.push({
|
|
916
|
+
name: 'knowledge',
|
|
917
|
+
url: String(knowledgeItem.service_url),
|
|
918
|
+
ok: true,
|
|
919
|
+
detail: `tools/list 可达(${knowledgeItem.name})`,
|
|
920
|
+
});
|
|
921
|
+
} catch (error) {
|
|
922
|
+
services.push({
|
|
923
|
+
name: 'knowledge',
|
|
924
|
+
url: String(knowledgeItem.service_url),
|
|
925
|
+
ok: false,
|
|
926
|
+
detail: String(error?.message ?? error),
|
|
927
|
+
});
|
|
928
|
+
}
|
|
929
|
+
}
|
|
887
930
|
reply(response, 200, {
|
|
888
|
-
ok:
|
|
931
|
+
ok: services.every((service) => service.ok),
|
|
889
932
|
hubUrl: settings.hubUrl,
|
|
933
|
+
kernelUrl: kernelBase(),
|
|
890
934
|
latencyMs: Date.now() - startedAt,
|
|
891
935
|
user: { userId: me.userId, username: me.username },
|
|
892
936
|
agents: agentCount,
|
|
893
937
|
teams: teamDetails,
|
|
938
|
+
services,
|
|
894
939
|
});
|
|
895
940
|
} catch (error) {
|
|
896
941
|
reply(response, 502, { ok: false, error: String(error?.message ?? error) });
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dsh-plugin-agent-memory",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.9",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Tencent agent-memory integration: pick a team agent as an expert at the composer, recall its memories into each turn, and expose its wiki, code-graph and skill assets as tools.",
|
|
6
6
|
"license": "MIT",
|