@openviking/openclaw-plugin 2026.5.21 → 2026.5.26
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/INSTALL-AGENT.md +355 -355
- package/INSTALL-ZH.md +345 -345
- package/INSTALL.md +362 -362
- package/README.md +338 -338
- package/auto-recall.ts +257 -257
- package/client.ts +939 -939
- package/commands/setup.ts +1002 -1002
- package/config.ts +476 -476
- package/context-engine.ts +1737 -1737
- package/dist/index.js +18 -18
- package/index.ts +1985 -1985
- package/install-manifest.json +47 -47
- package/memory-ranking.ts +267 -267
- package/openclaw.plugin.json +335 -335
- package/package.json +76 -76
- package/process-manager.ts +45 -45
- package/runtime-utils.ts +5 -5
- package/session-transcript-repair.ts +530 -530
- package/skills/install-openviking-memory/SKILL.md +665 -665
- package/text-utils.ts +507 -507
- package/tool-call-id.ts +331 -331
package/INSTALL-ZH.md
CHANGED
|
@@ -1,345 +1,345 @@
|
|
|
1
|
-
# 为 OpenClaw 安装 OpenViking
|
|
2
|
-
|
|
3
|
-
OpenViking 通过 `@openviking/openclaw-plugin` 插件为 OpenClaw 提供长期记忆、知识库检索、语义搜索和 RAG 上下文能力。
|
|
4
|
-
|
|
5
|
-
这份文档同时面向用户和自动化 agent:用户可以按步骤执行,agent 可以按命令和 JSON 结果判断下一步。
|
|
6
|
-
|
|
7
|
-
## 不要把插件和 Skill 装混
|
|
8
|
-
|
|
9
|
-
`@openviking/openclaw-plugin` 是 OpenClaw 插件。
|
|
10
|
-
|
|
11
|
-
不要用下面这个命令安装本插件:
|
|
12
|
-
|
|
13
|
-
```bash
|
|
14
|
-
clawhub install openviking
|
|
15
|
-
```
|
|
16
|
-
|
|
17
|
-
这个命令安装的是名为 `openviking` 的 AgentSkill,不是 OpenClaw 插件。
|
|
18
|
-
|
|
19
|
-
安装插件应使用:
|
|
20
|
-
|
|
21
|
-
```bash
|
|
22
|
-
openclaw plugins install clawhub:@openviking/openclaw-plugin
|
|
23
|
-
```
|
|
24
|
-
|
|
25
|
-
## 前置要求
|
|
26
|
-
|
|
27
|
-
| 组件 | 要求 |
|
|
28
|
-
| --- | --- |
|
|
29
|
-
| Node.js | >= 22 |
|
|
30
|
-
| OpenClaw | >= 2026.4.8 |
|
|
31
|
-
|
|
32
|
-
插件以远程模式连接到已有的 OpenViking 服务。它不会帮你启动 OpenViking server。需要先启动 OpenViking,并保持服务运行,再把插件的 `baseUrl` 指向这个 HTTP 服务。默认本地地址是 `http://127.0.0.1:1933`。
|
|
33
|
-
|
|
34
|
-
OpenClaw 插件包版本边界:
|
|
35
|
-
|
|
36
|
-
- `2026.4.8` 是当前插件支持的最低 OpenClaw 版本。
|
|
37
|
-
- `2026.5.3` 开始,OpenClaw 在安装包时会校验 TypeScript 插件入口是否有编译后的 JavaScript 产物。
|
|
38
|
-
- `2026.5.4` 及之后,已安装/全局插件如果缺少编译后的 JavaScript,运行时不再回退加载 `.ts` 源码,插件可能被跳过。
|
|
39
|
-
- 推荐的 `openclaw plugins install clawhub:@openviking/openclaw-plugin` 会安装已经发布并包含 `dist/*.js` 的插件包,普通用户不需要本地编译。
|
|
40
|
-
- `ov-install` 是备用/源码安装路径。当 ClawHub 或 OpenClaw 插件管理器路径不可用、被限流,或者明确需要测试源码 ref 时才使用。目标 OpenClaw `>= 2026.5.3` 时,它会在安装过程中编译插件。
|
|
41
|
-
|
|
42
|
-
快速检查:
|
|
43
|
-
|
|
44
|
-
```bash
|
|
45
|
-
node -v
|
|
46
|
-
openclaw --version
|
|
47
|
-
```
|
|
48
|
-
|
|
49
|
-
## 启动 OpenViking Server
|
|
50
|
-
|
|
51
|
-
如果 OpenViking 和 OpenClaw 在同一台机器上,最短流程是:
|
|
52
|
-
|
|
53
|
-
```bash
|
|
54
|
-
pip install openviking --upgrade --force-reinstall
|
|
55
|
-
openviking-server init
|
|
56
|
-
openviking-server doctor
|
|
57
|
-
openviking-server
|
|
58
|
-
```
|
|
59
|
-
|
|
60
|
-
`openviking-server init` 用来生成服务端配置,`openviking-server doctor` 用来检查本地模型和 provider 鉴权是否可用,`openviking-server` 才是真正启动 HTTP API 的命令。OpenClaw 使用插件期间,这个服务进程需要一直运行。
|
|
61
|
-
|
|
62
|
-
后台启动可以用:
|
|
63
|
-
|
|
64
|
-
```bash
|
|
65
|
-
mkdir -p ~/.openviking/data/log
|
|
66
|
-
nohup openviking-server > ~/.openviking/data/log/openviking.log 2>&1 &
|
|
67
|
-
```
|
|
68
|
-
|
|
69
|
-
如果 OpenViking 跑在另一台机器上,需要监听可访问的地址和端口,例如:
|
|
70
|
-
|
|
71
|
-
```bash
|
|
72
|
-
openviking-server --host 0.0.0.0 --port 1933
|
|
73
|
-
```
|
|
74
|
-
|
|
75
|
-
然后把 OpenClaw 插件的 `baseUrl` 配成对应地址,例如 `http://your-server:1933`。
|
|
76
|
-
|
|
77
|
-
安装或重启插件前,先确认服务能访问:
|
|
78
|
-
|
|
79
|
-
```bash
|
|
80
|
-
curl http://127.0.0.1:1933/health
|
|
81
|
-
```
|
|
82
|
-
|
|
83
|
-
## 推荐安装方式
|
|
84
|
-
|
|
85
|
-
普通用户、正式环境和 agent 自动安装都优先使用这条路径。
|
|
86
|
-
|
|
87
|
-
### 1. 安装插件
|
|
88
|
-
|
|
89
|
-
```bash
|
|
90
|
-
openclaw plugins install clawhub:@openviking/openclaw-plugin
|
|
91
|
-
```
|
|
92
|
-
|
|
93
|
-
如果你的 OpenClaw 环境需要显式 registry 前缀,使用:
|
|
94
|
-
|
|
95
|
-
```bash
|
|
96
|
-
openclaw plugins install clawhub:@openviking/openclaw-plugin
|
|
97
|
-
```
|
|
98
|
-
|
|
99
|
-
### 2. 配置插件
|
|
100
|
-
|
|
101
|
-
用户交互式配置:
|
|
102
|
-
|
|
103
|
-
```bash
|
|
104
|
-
openclaw openviking setup
|
|
105
|
-
```
|
|
106
|
-
|
|
107
|
-
Agent 非交互配置:
|
|
108
|
-
|
|
109
|
-
```bash
|
|
110
|
-
openclaw openviking setup --base-url <OPENVIKING_URL> --api-key <API_KEY> --json
|
|
111
|
-
```
|
|
112
|
-
|
|
113
|
-
示例:
|
|
114
|
-
|
|
115
|
-
```bash
|
|
116
|
-
openclaw openviking setup --base-url http://127.0.0.1:1933 --api-key sk-xxx --json
|
|
117
|
-
```
|
|
118
|
-
|
|
119
|
-
`setup` 会写入 `plugins.entries.openviking.config`,并激活 `plugins.slots.contextEngine=openviking`。
|
|
120
|
-
|
|
121
|
-
如果 OpenViking 服务暂时不可达,但你仍希望先保存配置:
|
|
122
|
-
|
|
123
|
-
```bash
|
|
124
|
-
openclaw openviking setup --base-url <OPENVIKING_URL> --api-key <API_KEY> --allow-offline --json
|
|
125
|
-
```
|
|
126
|
-
|
|
127
|
-
如果使用 root API key,可能还需要租户上下文:
|
|
128
|
-
|
|
129
|
-
```bash
|
|
130
|
-
openclaw openviking setup \
|
|
131
|
-
--base-url <OPENVIKING_URL> \
|
|
132
|
-
--api-key <ROOT_API_KEY> \
|
|
133
|
-
--account-id <ACCOUNT_ID> \
|
|
134
|
-
--user-id <USER_ID> \
|
|
135
|
-
--json
|
|
136
|
-
```
|
|
137
|
-
|
|
138
|
-
如果已有其他 context engine 占用 slot,setup 默认不会替换。确认要替换时再使用:
|
|
139
|
-
|
|
140
|
-
```bash
|
|
141
|
-
openclaw openviking setup --base-url <OPENVIKING_URL> --api-key <API_KEY> --force-slot --json
|
|
142
|
-
```
|
|
143
|
-
|
|
144
|
-
如需自定义 agent 路由前缀(可选;多数用户留空即可):
|
|
145
|
-
|
|
146
|
-
```bash
|
|
147
|
-
openclaw openviking setup --base-url <OPENVIKING_URL> --api-key <API_KEY> --agent-prefix <PREFIX> --json
|
|
148
|
-
```
|
|
149
|
-
|
|
150
|
-
### 3. 重启 OpenClaw Gateway
|
|
151
|
-
|
|
152
|
-
```bash
|
|
153
|
-
openclaw gateway restart
|
|
154
|
-
```
|
|
155
|
-
|
|
156
|
-
如果你的 OpenClaw 版本使用不同的重启命令,请使用对应的 gateway 重启方式。
|
|
157
|
-
|
|
158
|
-
### 4. 验证
|
|
159
|
-
|
|
160
|
-
```bash
|
|
161
|
-
openclaw openviking status --json
|
|
162
|
-
```
|
|
163
|
-
|
|
164
|
-
期望结果:
|
|
165
|
-
|
|
166
|
-
| JSON 字段 | 期望值 |
|
|
167
|
-
| --- | --- |
|
|
168
|
-
| `configured` | `true` |
|
|
169
|
-
| `slotActive` | `true` |
|
|
170
|
-
| `health.ok` | 服务可达时应为 `true` |
|
|
171
|
-
|
|
172
|
-
也可以直接查看 OpenClaw 配置:
|
|
173
|
-
|
|
174
|
-
```bash
|
|
175
|
-
openclaw config get plugins.entries.openviking.config
|
|
176
|
-
openclaw config get plugins.slots.contextEngine
|
|
177
|
-
```
|
|
178
|
-
|
|
179
|
-
`plugins.slots.contextEngine` 应输出 `openviking`。
|
|
180
|
-
|
|
181
|
-
## Agent 判断规则
|
|
182
|
-
|
|
183
|
-
Agent 应优先使用 `--json`,并根据这些字段判断下一步:
|
|
184
|
-
|
|
185
|
-
| 结果 | 含义 | 建议动作 |
|
|
186
|
-
| --- | --- | --- |
|
|
187
|
-
| `success: true` | 配置已保存,setup 完成 | 重启 gateway,然后执行 status |
|
|
188
|
-
| `success: false`, `action: "slot_blocked"` | 配置可能已保存,但其他插件占用 `contextEngine` | 询问用户后再用 `--force-slot` |
|
|
189
|
-
| `success: false`, `action: "error"` | 校验失败 | 展示 `error`,不要宣称安装成功 |
|
|
190
|
-
| `health.ok: false` | 服务不可达 | 检查 URL/服务状态;只有用户接受时才用 `--allow-offline` |
|
|
191
|
-
| `keyProbe.keyType: "root_key"` | root key 需要租户上下文 | 追加 `--account-id` 和 `--user-id` |
|
|
192
|
-
|
|
193
|
-
## 配置说明
|
|
194
|
-
|
|
195
|
-
插件配置位于:
|
|
196
|
-
|
|
197
|
-
```text
|
|
198
|
-
plugins.entries.openviking.config
|
|
199
|
-
```
|
|
200
|
-
|
|
201
|
-
核心字段:
|
|
202
|
-
|
|
203
|
-
| 字段 | 默认值 | 说明 |
|
|
204
|
-
| --- | --- | --- |
|
|
205
|
-
| `mode` | `remote` | 兼容旧配置的字段。当前只支持 remote。 |
|
|
206
|
-
| `baseUrl` | `http://127.0.0.1:1933` | OpenViking HTTP 地址 |
|
|
207
|
-
| `apiKey` | 空 | OpenViking API key |
|
|
208
|
-
| `agent_prefix` | 空 | OpenClaw agent ID 的可选前缀;若没有 agent ID,插件使用 `main`。交互式配置只接受字母、数字、`_` 和 `-`。 |
|
|
209
|
-
| `accountId` | 空 | 使用 root API key 时需要 |
|
|
210
|
-
| `userId` | 空 | 使用 root API key 时需要 |
|
|
211
|
-
|
|
212
|
-
普通修改优先使用 setup:
|
|
213
|
-
|
|
214
|
-
```bash
|
|
215
|
-
openclaw openviking setup --reconfigure
|
|
216
|
-
```
|
|
217
|
-
|
|
218
|
-
查看当前配置:
|
|
219
|
-
|
|
220
|
-
```bash
|
|
221
|
-
openclaw config get plugins.entries.openviking.config
|
|
222
|
-
```
|
|
223
|
-
|
|
224
|
-
### 配置参数
|
|
225
|
-
|
|
226
|
-
插件连接到已有的远端 OpenViking 服务。
|
|
227
|
-
|
|
228
|
-
| 参数 | 默认值 | 含义 |
|
|
229
|
-
| --- | --- | --- |
|
|
230
|
-
| `baseUrl` | `http://127.0.0.1:1933` | 远端 OpenViking 服务地址 |
|
|
231
|
-
| `apiKey` | 空 | 远端 OpenViking API Key;服务端未开启认证时可不填 |
|
|
232
|
-
| `agent_prefix` | 空 | OpenClaw agent ID 的可选前缀;如果拿不到 agent ID,插件使用 `main`。交互式配置只接受字母、数字、`_` 和 `-` |
|
|
233
|
-
|
|
234
|
-
常见设置:
|
|
235
|
-
|
|
236
|
-
```bash
|
|
237
|
-
openclaw config set plugins.entries.openviking.config.baseUrl http://your-server:1933
|
|
238
|
-
openclaw config set plugins.entries.openviking.config.apiKey your-api-key
|
|
239
|
-
openclaw config set plugins.entries.openviking.config.agent_prefix your-prefix
|
|
240
|
-
```
|
|
241
|
-
|
|
242
|
-
## 升级
|
|
243
|
-
|
|
244
|
-
```bash
|
|
245
|
-
openclaw plugins update openviking
|
|
246
|
-
openclaw gateway restart
|
|
247
|
-
openclaw openviking status --json
|
|
248
|
-
```
|
|
249
|
-
|
|
250
|
-
确认 `configured` 和 `slotActive` 都是 `true`。
|
|
251
|
-
|
|
252
|
-
## 卸载
|
|
253
|
-
|
|
254
|
-
```bash
|
|
255
|
-
openclaw plugins uninstall openviking
|
|
256
|
-
openclaw config set plugins.slots.contextEngine legacy
|
|
257
|
-
openclaw gateway restart
|
|
258
|
-
```
|
|
259
|
-
|
|
260
|
-
当前 OpenClaw 原生卸载不一定会把 `plugins.slots.contextEngine` 恢复为 `legacy`。显式执行 `config set` 可以避免 slot 继续指向已卸载插件。
|
|
261
|
-
|
|
262
|
-
## 可选链路健康检查
|
|
263
|
-
|
|
264
|
-
如果 status 已通过,还想验证 Gateway 到 OpenViking 的完整链路,可以在仓库 checkout 中运行:
|
|
265
|
-
|
|
266
|
-
```bash
|
|
267
|
-
python examples/openclaw-plugin/health_check_tools/ov-healthcheck.py
|
|
268
|
-
```
|
|
269
|
-
|
|
270
|
-
该脚本会注入一次真实对话,并在 OpenViking 侧验证会话捕获、提交、归档和记忆提取。详见 [health_check_tools/HEALTHCHECK-ZH.md](./health_check_tools/HEALTHCHECK-ZH.md)。
|
|
271
|
-
|
|
272
|
-
## 备用路径:ov-install
|
|
273
|
-
|
|
274
|
-
`ov-install` 是备用路径,不是主安装方式。仅当 `openclaw plugins install clawhub:@openviking/openclaw-plugin` 无法访问 ClawHub、被限流,或者你明确需要从 Git 分支/源码 ref 安装测试时使用。
|
|
275
|
-
|
|
276
|
-
先尝试 OpenClaw 插件管理器。如果该路径不可用,再执行:
|
|
277
|
-
|
|
278
|
-
```bash
|
|
279
|
-
npm install -g openclaw-openviking-setup-helper
|
|
280
|
-
ov-install
|
|
281
|
-
```
|
|
282
|
-
|
|
283
|
-
常用备用/源码参数:
|
|
284
|
-
|
|
285
|
-
| 参数 | 含义 |
|
|
286
|
-
| --- | --- |
|
|
287
|
-
| `--workdir PATH` | 指定 OpenClaw state 目录 |
|
|
288
|
-
| `--plugin-version=REF` | 指定插件版本:npm 版本、npm dist-tag 或 Git ref |
|
|
289
|
-
| `--current-version` | 查看 helper 记录的当前版本 |
|
|
290
|
-
| `--base-url URL` | OpenViking 服务器地址(启用非交互模式) |
|
|
291
|
-
| `--api-key KEY` | OpenViking API key |
|
|
292
|
-
| `--agent-prefix PREFIX` | Agent 路由前缀 |
|
|
293
|
-
| `--update` | 更新 helper 管理的安装 |
|
|
294
|
-
|
|
295
|
-
面向用户的安装,请先使用 `openclaw plugins install clawhub:@openviking/openclaw-plugin`。只有作为备用路径时才选择 `ov-install`。
|
|
296
|
-
|
|
297
|
-
## 从 ov-install 迁移到 openclaw plugin install
|
|
298
|
-
|
|
299
|
-
如果之前通过 `ov-install` 安装了 OpenViking,切换到推荐的 `openclaw plugins install` 安装方式前需要清理。
|
|
300
|
-
|
|
301
|
-
### 同一插件 ID(openviking,版本 >= 0.3.x)
|
|
302
|
-
|
|
303
|
-
ov-install 的 context-engine 部署会将文件写入 `~/.openclaw/extensions/openviking/`。通过 npm 安装后,OpenClaw 可能仍从旧目录加载。清理步骤:
|
|
304
|
-
|
|
305
|
-
```bash
|
|
306
|
-
# 删除 ov-install 部署的文件
|
|
307
|
-
rm -rf ~/.openclaw/extensions/openviking/
|
|
308
|
-
|
|
309
|
-
# 通过 OpenClaw 插件管理器安装
|
|
310
|
-
openclaw plugins install clawhub:@openviking/openclaw-plugin
|
|
311
|
-
|
|
312
|
-
# 重新配置(openclaw.json 中的已有配置会保留)
|
|
313
|
-
openclaw openviking setup --reconfigure
|
|
314
|
-
openclaw gateway restart
|
|
315
|
-
openclaw openviking status --json
|
|
316
|
-
```
|
|
317
|
-
|
|
318
|
-
已有的配置字段(`baseUrl`、`apiKey`、`agentId` 等)会保留。新版本在运行时兼容读取旧字段名,无需手动修改配置。
|
|
319
|
-
|
|
320
|
-
### 旧插件 ID(memory-openviking,版本 < 0.3.x)
|
|
321
|
-
|
|
322
|
-
旧版 memory 插件使用了不同的插件 ID 和 slot:
|
|
323
|
-
|
|
324
|
-
```bash
|
|
325
|
-
# 卸载旧插件
|
|
326
|
-
openclaw plugins uninstall memory-openviking 2>/dev/null || true
|
|
327
|
-
|
|
328
|
-
# 清理旧 slot 和文件
|
|
329
|
-
openclaw config set plugins.slots.memory none
|
|
330
|
-
rm -rf ~/.openclaw/extensions/memory-openviking/
|
|
331
|
-
|
|
332
|
-
# 安装新插件
|
|
333
|
-
openclaw plugins install clawhub:@openviking/openclaw-plugin
|
|
334
|
-
openclaw openviking setup --base-url <OPENVIKING_URL> --api-key <API_KEY> --json
|
|
335
|
-
openclaw gateway restart
|
|
336
|
-
openclaw openviking status --json
|
|
337
|
-
```
|
|
338
|
-
|
|
339
|
-
或使用清理脚本:
|
|
340
|
-
|
|
341
|
-
```bash
|
|
342
|
-
bash examples/openclaw-plugin/upgrade_scripts/cleanup-memory-openviking.sh
|
|
343
|
-
```
|
|
344
|
-
|
|
345
|
-
另见:[INSTALL.md](./INSTALL.md) 和 [INSTALL-AGENT.md](./INSTALL-AGENT.md)。
|
|
1
|
+
# 为 OpenClaw 安装 OpenViking
|
|
2
|
+
|
|
3
|
+
OpenViking 通过 `@openviking/openclaw-plugin` 插件为 OpenClaw 提供长期记忆、知识库检索、语义搜索和 RAG 上下文能力。
|
|
4
|
+
|
|
5
|
+
这份文档同时面向用户和自动化 agent:用户可以按步骤执行,agent 可以按命令和 JSON 结果判断下一步。
|
|
6
|
+
|
|
7
|
+
## 不要把插件和 Skill 装混
|
|
8
|
+
|
|
9
|
+
`@openviking/openclaw-plugin` 是 OpenClaw 插件。
|
|
10
|
+
|
|
11
|
+
不要用下面这个命令安装本插件:
|
|
12
|
+
|
|
13
|
+
```bash
|
|
14
|
+
clawhub install openviking
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
这个命令安装的是名为 `openviking` 的 AgentSkill,不是 OpenClaw 插件。
|
|
18
|
+
|
|
19
|
+
安装插件应使用:
|
|
20
|
+
|
|
21
|
+
```bash
|
|
22
|
+
openclaw plugins install clawhub:@openviking/openclaw-plugin
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
## 前置要求
|
|
26
|
+
|
|
27
|
+
| 组件 | 要求 |
|
|
28
|
+
| --- | --- |
|
|
29
|
+
| Node.js | >= 22 |
|
|
30
|
+
| OpenClaw | >= 2026.4.8 |
|
|
31
|
+
|
|
32
|
+
插件以远程模式连接到已有的 OpenViking 服务。它不会帮你启动 OpenViking server。需要先启动 OpenViking,并保持服务运行,再把插件的 `baseUrl` 指向这个 HTTP 服务。默认本地地址是 `http://127.0.0.1:1933`。
|
|
33
|
+
|
|
34
|
+
OpenClaw 插件包版本边界:
|
|
35
|
+
|
|
36
|
+
- `2026.4.8` 是当前插件支持的最低 OpenClaw 版本。
|
|
37
|
+
- `2026.5.3` 开始,OpenClaw 在安装包时会校验 TypeScript 插件入口是否有编译后的 JavaScript 产物。
|
|
38
|
+
- `2026.5.4` 及之后,已安装/全局插件如果缺少编译后的 JavaScript,运行时不再回退加载 `.ts` 源码,插件可能被跳过。
|
|
39
|
+
- 推荐的 `openclaw plugins install clawhub:@openviking/openclaw-plugin` 会安装已经发布并包含 `dist/*.js` 的插件包,普通用户不需要本地编译。
|
|
40
|
+
- `ov-install` 是备用/源码安装路径。当 ClawHub 或 OpenClaw 插件管理器路径不可用、被限流,或者明确需要测试源码 ref 时才使用。目标 OpenClaw `>= 2026.5.3` 时,它会在安装过程中编译插件。
|
|
41
|
+
|
|
42
|
+
快速检查:
|
|
43
|
+
|
|
44
|
+
```bash
|
|
45
|
+
node -v
|
|
46
|
+
openclaw --version
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
## 启动 OpenViking Server
|
|
50
|
+
|
|
51
|
+
如果 OpenViking 和 OpenClaw 在同一台机器上,最短流程是:
|
|
52
|
+
|
|
53
|
+
```bash
|
|
54
|
+
pip install openviking --upgrade --force-reinstall
|
|
55
|
+
openviking-server init
|
|
56
|
+
openviking-server doctor
|
|
57
|
+
openviking-server
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
`openviking-server init` 用来生成服务端配置,`openviking-server doctor` 用来检查本地模型和 provider 鉴权是否可用,`openviking-server` 才是真正启动 HTTP API 的命令。OpenClaw 使用插件期间,这个服务进程需要一直运行。
|
|
61
|
+
|
|
62
|
+
后台启动可以用:
|
|
63
|
+
|
|
64
|
+
```bash
|
|
65
|
+
mkdir -p ~/.openviking/data/log
|
|
66
|
+
nohup openviking-server > ~/.openviking/data/log/openviking.log 2>&1 &
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
如果 OpenViking 跑在另一台机器上,需要监听可访问的地址和端口,例如:
|
|
70
|
+
|
|
71
|
+
```bash
|
|
72
|
+
openviking-server --host 0.0.0.0 --port 1933
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
然后把 OpenClaw 插件的 `baseUrl` 配成对应地址,例如 `http://your-server:1933`。
|
|
76
|
+
|
|
77
|
+
安装或重启插件前,先确认服务能访问:
|
|
78
|
+
|
|
79
|
+
```bash
|
|
80
|
+
curl http://127.0.0.1:1933/health
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
## 推荐安装方式
|
|
84
|
+
|
|
85
|
+
普通用户、正式环境和 agent 自动安装都优先使用这条路径。
|
|
86
|
+
|
|
87
|
+
### 1. 安装插件
|
|
88
|
+
|
|
89
|
+
```bash
|
|
90
|
+
openclaw plugins install clawhub:@openviking/openclaw-plugin
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
如果你的 OpenClaw 环境需要显式 registry 前缀,使用:
|
|
94
|
+
|
|
95
|
+
```bash
|
|
96
|
+
openclaw plugins install clawhub:@openviking/openclaw-plugin
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
### 2. 配置插件
|
|
100
|
+
|
|
101
|
+
用户交互式配置:
|
|
102
|
+
|
|
103
|
+
```bash
|
|
104
|
+
openclaw openviking setup
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
Agent 非交互配置:
|
|
108
|
+
|
|
109
|
+
```bash
|
|
110
|
+
openclaw openviking setup --base-url <OPENVIKING_URL> --api-key <API_KEY> --json
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
示例:
|
|
114
|
+
|
|
115
|
+
```bash
|
|
116
|
+
openclaw openviking setup --base-url http://127.0.0.1:1933 --api-key sk-xxx --json
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
`setup` 会写入 `plugins.entries.openviking.config`,并激活 `plugins.slots.contextEngine=openviking`。
|
|
120
|
+
|
|
121
|
+
如果 OpenViking 服务暂时不可达,但你仍希望先保存配置:
|
|
122
|
+
|
|
123
|
+
```bash
|
|
124
|
+
openclaw openviking setup --base-url <OPENVIKING_URL> --api-key <API_KEY> --allow-offline --json
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
如果使用 root API key,可能还需要租户上下文:
|
|
128
|
+
|
|
129
|
+
```bash
|
|
130
|
+
openclaw openviking setup \
|
|
131
|
+
--base-url <OPENVIKING_URL> \
|
|
132
|
+
--api-key <ROOT_API_KEY> \
|
|
133
|
+
--account-id <ACCOUNT_ID> \
|
|
134
|
+
--user-id <USER_ID> \
|
|
135
|
+
--json
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
如果已有其他 context engine 占用 slot,setup 默认不会替换。确认要替换时再使用:
|
|
139
|
+
|
|
140
|
+
```bash
|
|
141
|
+
openclaw openviking setup --base-url <OPENVIKING_URL> --api-key <API_KEY> --force-slot --json
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
如需自定义 agent 路由前缀(可选;多数用户留空即可):
|
|
145
|
+
|
|
146
|
+
```bash
|
|
147
|
+
openclaw openviking setup --base-url <OPENVIKING_URL> --api-key <API_KEY> --agent-prefix <PREFIX> --json
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
### 3. 重启 OpenClaw Gateway
|
|
151
|
+
|
|
152
|
+
```bash
|
|
153
|
+
openclaw gateway restart
|
|
154
|
+
```
|
|
155
|
+
|
|
156
|
+
如果你的 OpenClaw 版本使用不同的重启命令,请使用对应的 gateway 重启方式。
|
|
157
|
+
|
|
158
|
+
### 4. 验证
|
|
159
|
+
|
|
160
|
+
```bash
|
|
161
|
+
openclaw openviking status --json
|
|
162
|
+
```
|
|
163
|
+
|
|
164
|
+
期望结果:
|
|
165
|
+
|
|
166
|
+
| JSON 字段 | 期望值 |
|
|
167
|
+
| --- | --- |
|
|
168
|
+
| `configured` | `true` |
|
|
169
|
+
| `slotActive` | `true` |
|
|
170
|
+
| `health.ok` | 服务可达时应为 `true` |
|
|
171
|
+
|
|
172
|
+
也可以直接查看 OpenClaw 配置:
|
|
173
|
+
|
|
174
|
+
```bash
|
|
175
|
+
openclaw config get plugins.entries.openviking.config
|
|
176
|
+
openclaw config get plugins.slots.contextEngine
|
|
177
|
+
```
|
|
178
|
+
|
|
179
|
+
`plugins.slots.contextEngine` 应输出 `openviking`。
|
|
180
|
+
|
|
181
|
+
## Agent 判断规则
|
|
182
|
+
|
|
183
|
+
Agent 应优先使用 `--json`,并根据这些字段判断下一步:
|
|
184
|
+
|
|
185
|
+
| 结果 | 含义 | 建议动作 |
|
|
186
|
+
| --- | --- | --- |
|
|
187
|
+
| `success: true` | 配置已保存,setup 完成 | 重启 gateway,然后执行 status |
|
|
188
|
+
| `success: false`, `action: "slot_blocked"` | 配置可能已保存,但其他插件占用 `contextEngine` | 询问用户后再用 `--force-slot` |
|
|
189
|
+
| `success: false`, `action: "error"` | 校验失败 | 展示 `error`,不要宣称安装成功 |
|
|
190
|
+
| `health.ok: false` | 服务不可达 | 检查 URL/服务状态;只有用户接受时才用 `--allow-offline` |
|
|
191
|
+
| `keyProbe.keyType: "root_key"` | root key 需要租户上下文 | 追加 `--account-id` 和 `--user-id` |
|
|
192
|
+
|
|
193
|
+
## 配置说明
|
|
194
|
+
|
|
195
|
+
插件配置位于:
|
|
196
|
+
|
|
197
|
+
```text
|
|
198
|
+
plugins.entries.openviking.config
|
|
199
|
+
```
|
|
200
|
+
|
|
201
|
+
核心字段:
|
|
202
|
+
|
|
203
|
+
| 字段 | 默认值 | 说明 |
|
|
204
|
+
| --- | --- | --- |
|
|
205
|
+
| `mode` | `remote` | 兼容旧配置的字段。当前只支持 remote。 |
|
|
206
|
+
| `baseUrl` | `http://127.0.0.1:1933` | OpenViking HTTP 地址 |
|
|
207
|
+
| `apiKey` | 空 | OpenViking API key |
|
|
208
|
+
| `agent_prefix` | 空 | OpenClaw agent ID 的可选前缀;若没有 agent ID,插件使用 `main`。交互式配置只接受字母、数字、`_` 和 `-`。 |
|
|
209
|
+
| `accountId` | 空 | 使用 root API key 时需要 |
|
|
210
|
+
| `userId` | 空 | 使用 root API key 时需要 |
|
|
211
|
+
|
|
212
|
+
普通修改优先使用 setup:
|
|
213
|
+
|
|
214
|
+
```bash
|
|
215
|
+
openclaw openviking setup --reconfigure
|
|
216
|
+
```
|
|
217
|
+
|
|
218
|
+
查看当前配置:
|
|
219
|
+
|
|
220
|
+
```bash
|
|
221
|
+
openclaw config get plugins.entries.openviking.config
|
|
222
|
+
```
|
|
223
|
+
|
|
224
|
+
### 配置参数
|
|
225
|
+
|
|
226
|
+
插件连接到已有的远端 OpenViking 服务。
|
|
227
|
+
|
|
228
|
+
| 参数 | 默认值 | 含义 |
|
|
229
|
+
| --- | --- | --- |
|
|
230
|
+
| `baseUrl` | `http://127.0.0.1:1933` | 远端 OpenViking 服务地址 |
|
|
231
|
+
| `apiKey` | 空 | 远端 OpenViking API Key;服务端未开启认证时可不填 |
|
|
232
|
+
| `agent_prefix` | 空 | OpenClaw agent ID 的可选前缀;如果拿不到 agent ID,插件使用 `main`。交互式配置只接受字母、数字、`_` 和 `-` |
|
|
233
|
+
|
|
234
|
+
常见设置:
|
|
235
|
+
|
|
236
|
+
```bash
|
|
237
|
+
openclaw config set plugins.entries.openviking.config.baseUrl http://your-server:1933
|
|
238
|
+
openclaw config set plugins.entries.openviking.config.apiKey your-api-key
|
|
239
|
+
openclaw config set plugins.entries.openviking.config.agent_prefix your-prefix
|
|
240
|
+
```
|
|
241
|
+
|
|
242
|
+
## 升级
|
|
243
|
+
|
|
244
|
+
```bash
|
|
245
|
+
openclaw plugins update openviking
|
|
246
|
+
openclaw gateway restart
|
|
247
|
+
openclaw openviking status --json
|
|
248
|
+
```
|
|
249
|
+
|
|
250
|
+
确认 `configured` 和 `slotActive` 都是 `true`。
|
|
251
|
+
|
|
252
|
+
## 卸载
|
|
253
|
+
|
|
254
|
+
```bash
|
|
255
|
+
openclaw plugins uninstall openviking
|
|
256
|
+
openclaw config set plugins.slots.contextEngine legacy
|
|
257
|
+
openclaw gateway restart
|
|
258
|
+
```
|
|
259
|
+
|
|
260
|
+
当前 OpenClaw 原生卸载不一定会把 `plugins.slots.contextEngine` 恢复为 `legacy`。显式执行 `config set` 可以避免 slot 继续指向已卸载插件。
|
|
261
|
+
|
|
262
|
+
## 可选链路健康检查
|
|
263
|
+
|
|
264
|
+
如果 status 已通过,还想验证 Gateway 到 OpenViking 的完整链路,可以在仓库 checkout 中运行:
|
|
265
|
+
|
|
266
|
+
```bash
|
|
267
|
+
python examples/openclaw-plugin/health_check_tools/ov-healthcheck.py
|
|
268
|
+
```
|
|
269
|
+
|
|
270
|
+
该脚本会注入一次真实对话,并在 OpenViking 侧验证会话捕获、提交、归档和记忆提取。详见 [health_check_tools/HEALTHCHECK-ZH.md](./health_check_tools/HEALTHCHECK-ZH.md)。
|
|
271
|
+
|
|
272
|
+
## 备用路径:ov-install
|
|
273
|
+
|
|
274
|
+
`ov-install` 是备用路径,不是主安装方式。仅当 `openclaw plugins install clawhub:@openviking/openclaw-plugin` 无法访问 ClawHub、被限流,或者你明确需要从 Git 分支/源码 ref 安装测试时使用。
|
|
275
|
+
|
|
276
|
+
先尝试 OpenClaw 插件管理器。如果该路径不可用,再执行:
|
|
277
|
+
|
|
278
|
+
```bash
|
|
279
|
+
npm install -g openclaw-openviking-setup-helper
|
|
280
|
+
ov-install
|
|
281
|
+
```
|
|
282
|
+
|
|
283
|
+
常用备用/源码参数:
|
|
284
|
+
|
|
285
|
+
| 参数 | 含义 |
|
|
286
|
+
| --- | --- |
|
|
287
|
+
| `--workdir PATH` | 指定 OpenClaw state 目录 |
|
|
288
|
+
| `--plugin-version=REF` | 指定插件版本:npm 版本、npm dist-tag 或 Git ref |
|
|
289
|
+
| `--current-version` | 查看 helper 记录的当前版本 |
|
|
290
|
+
| `--base-url URL` | OpenViking 服务器地址(启用非交互模式) |
|
|
291
|
+
| `--api-key KEY` | OpenViking API key |
|
|
292
|
+
| `--agent-prefix PREFIX` | Agent 路由前缀 |
|
|
293
|
+
| `--update` | 更新 helper 管理的安装 |
|
|
294
|
+
|
|
295
|
+
面向用户的安装,请先使用 `openclaw plugins install clawhub:@openviking/openclaw-plugin`。只有作为备用路径时才选择 `ov-install`。
|
|
296
|
+
|
|
297
|
+
## 从 ov-install 迁移到 openclaw plugin install
|
|
298
|
+
|
|
299
|
+
如果之前通过 `ov-install` 安装了 OpenViking,切换到推荐的 `openclaw plugins install` 安装方式前需要清理。
|
|
300
|
+
|
|
301
|
+
### 同一插件 ID(openviking,版本 >= 0.3.x)
|
|
302
|
+
|
|
303
|
+
ov-install 的 context-engine 部署会将文件写入 `~/.openclaw/extensions/openviking/`。通过 npm 安装后,OpenClaw 可能仍从旧目录加载。清理步骤:
|
|
304
|
+
|
|
305
|
+
```bash
|
|
306
|
+
# 删除 ov-install 部署的文件
|
|
307
|
+
rm -rf ~/.openclaw/extensions/openviking/
|
|
308
|
+
|
|
309
|
+
# 通过 OpenClaw 插件管理器安装
|
|
310
|
+
openclaw plugins install clawhub:@openviking/openclaw-plugin
|
|
311
|
+
|
|
312
|
+
# 重新配置(openclaw.json 中的已有配置会保留)
|
|
313
|
+
openclaw openviking setup --reconfigure
|
|
314
|
+
openclaw gateway restart
|
|
315
|
+
openclaw openviking status --json
|
|
316
|
+
```
|
|
317
|
+
|
|
318
|
+
已有的配置字段(`baseUrl`、`apiKey`、`agentId` 等)会保留。新版本在运行时兼容读取旧字段名,无需手动修改配置。
|
|
319
|
+
|
|
320
|
+
### 旧插件 ID(memory-openviking,版本 < 0.3.x)
|
|
321
|
+
|
|
322
|
+
旧版 memory 插件使用了不同的插件 ID 和 slot:
|
|
323
|
+
|
|
324
|
+
```bash
|
|
325
|
+
# 卸载旧插件
|
|
326
|
+
openclaw plugins uninstall memory-openviking 2>/dev/null || true
|
|
327
|
+
|
|
328
|
+
# 清理旧 slot 和文件
|
|
329
|
+
openclaw config set plugins.slots.memory none
|
|
330
|
+
rm -rf ~/.openclaw/extensions/memory-openviking/
|
|
331
|
+
|
|
332
|
+
# 安装新插件
|
|
333
|
+
openclaw plugins install clawhub:@openviking/openclaw-plugin
|
|
334
|
+
openclaw openviking setup --base-url <OPENVIKING_URL> --api-key <API_KEY> --json
|
|
335
|
+
openclaw gateway restart
|
|
336
|
+
openclaw openviking status --json
|
|
337
|
+
```
|
|
338
|
+
|
|
339
|
+
或使用清理脚本:
|
|
340
|
+
|
|
341
|
+
```bash
|
|
342
|
+
bash examples/openclaw-plugin/upgrade_scripts/cleanup-memory-openviking.sh
|
|
343
|
+
```
|
|
344
|
+
|
|
345
|
+
另见:[INSTALL.md](./INSTALL.md) 和 [INSTALL-AGENT.md](./INSTALL-AGENT.md)。
|