@openviking/openclaw-plugin 2026.5.8
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 -0
- package/INSTALL-ZH.md +345 -0
- package/INSTALL.md +362 -0
- package/README.md +315 -0
- package/auto-recall.ts +257 -0
- package/client.ts +828 -0
- package/commands/setup.ts +1002 -0
- package/config.ts +476 -0
- package/context-engine.ts +1700 -0
- package/dist/auto-recall.js +167 -0
- package/dist/client.js +502 -0
- package/dist/commands/setup.js +815 -0
- package/dist/config.js +352 -0
- package/dist/context-engine.js +1324 -0
- package/dist/index.js +1194 -0
- package/dist/memory-ranking.js +221 -0
- package/dist/process-manager.js +127 -0
- package/dist/runtime-utils.js +7 -0
- package/dist/session-transcript-repair.js +427 -0
- package/dist/text-utils.js +453 -0
- package/dist/tool-call-id.js +254 -0
- package/index.ts +1597 -0
- package/install-manifest.json +47 -0
- package/memory-ranking.ts +267 -0
- package/openclaw.plugin.json +331 -0
- package/package.json +75 -0
- package/process-manager.ts +169 -0
- package/runtime-utils.ts +8 -0
- package/session-transcript-repair.ts +530 -0
- package/skills/install-openviking-memory/SKILL.md +665 -0
- package/text-utils.ts +524 -0
- package/tool-call-id.ts +331 -0
package/INSTALL-AGENT.md
ADDED
|
@@ -0,0 +1,355 @@
|
|
|
1
|
+
# OpenViking Plugin Agent Install Guide
|
|
2
|
+
|
|
3
|
+
This guide is for AI agents and operator automation. Prefer deterministic commands, parse JSON output, and ask the user only when a choice changes the outcome.
|
|
4
|
+
|
|
5
|
+
User-facing docs:
|
|
6
|
+
|
|
7
|
+
- [INSTALL.md](./INSTALL.md)
|
|
8
|
+
- [INSTALL-ZH.md](./INSTALL-ZH.md)
|
|
9
|
+
|
|
10
|
+
## Identity
|
|
11
|
+
|
|
12
|
+
This package is the OpenClaw plugin `@openviking/openclaw-plugin`.
|
|
13
|
+
|
|
14
|
+
| User intent | Command |
|
|
15
|
+
| --- | --- |
|
|
16
|
+
| Fresh install, latest | `openclaw plugins install @openviking/openclaw-plugin` |
|
|
17
|
+
| Upgrade plugin to latest | `openclaw plugins install @openviking/openclaw-plugin` |
|
|
18
|
+
| Install or upgrade a specific release | Use the published ClawHub package selector if available; otherwise ask before using backup `ov-install --plugin-version=<REF>` |
|
|
19
|
+
| Upgrade only the plugin | `openclaw plugins install @openviking/openclaw-plugin` |
|
|
20
|
+
| Show installed plugins | `openclaw plugins list` |
|
|
21
|
+
| Backup install when ClawHub is unavailable | `npx -y openclaw-openviking-setup-helper@latest --base-url <URL> [--api-key <KEY>]` |
|
|
22
|
+
| Operate on a specific OpenClaw instance | add `--workdir <path>` |
|
|
23
|
+
| Start missing OpenViking server | `openviking-server init && openviking-server doctor && openviking-server` |
|
|
24
|
+
|
|
25
|
+
Do not install it with:
|
|
26
|
+
|
|
27
|
+
```bash
|
|
28
|
+
clawhub install openviking
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
That installs an AgentSkill, not the plugin. The plugin install command is:
|
|
32
|
+
|
|
33
|
+
```bash
|
|
34
|
+
openclaw plugins install @openviking/openclaw-plugin
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
## Required Inputs
|
|
38
|
+
|
|
39
|
+
Before setup, determine:
|
|
40
|
+
|
|
41
|
+
| Input | Required | How to get it |
|
|
42
|
+
| --- | --- | --- |
|
|
43
|
+
| OpenViking base URL | Yes | Ask user or read `OPENVIKING_BASE_URL` |
|
|
44
|
+
| API key | Usually | Ask user or read `OPENVIKING_API_KEY` |
|
|
45
|
+
| Account ID | Only for root API keys | Ask user if setup reports root-key tenant context is needed |
|
|
46
|
+
| User ID | Only for root API keys | Ask user if setup reports root-key tenant context is needed |
|
|
47
|
+
| Slot replacement approval | Only if another context engine owns the slot | Ask user before using `--force-slot` |
|
|
48
|
+
|
|
49
|
+
Never silently replace another context engine.
|
|
50
|
+
|
|
51
|
+
## Primary Workflow
|
|
52
|
+
|
|
53
|
+
Use this workflow for normal installs and upgrades from published packages.
|
|
54
|
+
|
|
55
|
+
```bash
|
|
56
|
+
openclaw plugins install @openviking/openclaw-plugin
|
|
57
|
+
openclaw openviking setup --base-url <OPENVIKING_URL> --api-key <API_KEY> --json
|
|
58
|
+
openclaw gateway restart
|
|
59
|
+
openclaw openviking status --json
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
If the registry prefix is required:
|
|
63
|
+
|
|
64
|
+
```bash
|
|
65
|
+
openclaw plugins install clawhub:@openviking/openclaw-plugin
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
## Setup JSON Contract
|
|
69
|
+
|
|
70
|
+
Run setup with `--json` whenever possible:
|
|
71
|
+
|
|
72
|
+
```bash
|
|
73
|
+
openclaw openviking setup --base-url <OPENVIKING_URL> --api-key <API_KEY> --json
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
Branch on the result:
|
|
77
|
+
|
|
78
|
+
| JSON result | Meaning | Agent action |
|
|
79
|
+
| --- | --- | --- |
|
|
80
|
+
| `success: true` | Setup completed | Restart gateway, then run status |
|
|
81
|
+
| `success: false`, `action: "slot_blocked"` | Another plugin owns `plugins.slots.contextEngine` | Ask user before rerunning with `--force-slot` |
|
|
82
|
+
| `success: false`, `action: "error"` | Validation failed | Report `error`; do not continue as success |
|
|
83
|
+
| `health.ok: false` | Server unreachable | Check URL/service; use `--allow-offline` only with user approval |
|
|
84
|
+
| `keyProbe.keyType: "root_key"` | Root key requires tenant fields | Rerun with `--account-id <ACCOUNT_ID> --user-id <USER_ID>` |
|
|
85
|
+
| `health.compatibility: "server_too_old"` | Server may not support plugin features | Warn user and recommend server upgrade |
|
|
86
|
+
| `health.compatibility: "server_too_new"` | Plugin may be too old | Warn user and recommend plugin upgrade |
|
|
87
|
+
|
|
88
|
+
Root-key retry:
|
|
89
|
+
|
|
90
|
+
```bash
|
|
91
|
+
openclaw openviking setup \
|
|
92
|
+
--base-url <OPENVIKING_URL> \
|
|
93
|
+
--api-key <ROOT_API_KEY> \
|
|
94
|
+
--account-id <ACCOUNT_ID> \
|
|
95
|
+
--user-id <USER_ID> \
|
|
96
|
+
--json
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
Custom agent routing prefix (optional; only when the user explicitly requests a prefix):
|
|
100
|
+
|
|
101
|
+
```bash
|
|
102
|
+
openclaw openviking setup --base-url <OPENVIKING_URL> --api-key <API_KEY> --agent-prefix <PREFIX> --json
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
Slot replacement retry, only after user approval:
|
|
106
|
+
|
|
107
|
+
```bash
|
|
108
|
+
openclaw openviking setup --base-url <OPENVIKING_URL> --api-key <API_KEY> --force-slot --json
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
Offline config save, only after user approval:
|
|
112
|
+
|
|
113
|
+
```bash
|
|
114
|
+
openclaw openviking setup --base-url <OPENVIKING_URL> --api-key <API_KEY> --allow-offline --json
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
## Status JSON Contract
|
|
118
|
+
|
|
119
|
+
After restart, run:
|
|
120
|
+
|
|
121
|
+
```bash
|
|
122
|
+
openclaw openviking status --json
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
Ready state:
|
|
126
|
+
|
|
127
|
+
```json
|
|
128
|
+
{
|
|
129
|
+
"configured": true,
|
|
130
|
+
"slotActive": true
|
|
131
|
+
}
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
Also inspect:
|
|
135
|
+
|
|
136
|
+
| Field | Use |
|
|
137
|
+
| --- | --- |
|
|
138
|
+
| `health.ok` | Confirms server reachability |
|
|
139
|
+
| `health.version` | Records server version |
|
|
140
|
+
| `health.compatibility` | Determines whether to warn |
|
|
141
|
+
| `config.hasApiKey` | Confirms whether an API key was saved |
|
|
142
|
+
| `config.agent_prefix` | Confirms configured agent prefix when present |
|
|
143
|
+
|
|
144
|
+
## Environment Detection
|
|
145
|
+
|
|
146
|
+
Check tools:
|
|
147
|
+
|
|
148
|
+
```bash
|
|
149
|
+
node -v
|
|
150
|
+
openclaw --version
|
|
151
|
+
```
|
|
152
|
+
|
|
153
|
+
Requirements:
|
|
154
|
+
|
|
155
|
+
- Node.js >= 22
|
|
156
|
+
- OpenClaw >= 2026.4.8
|
|
157
|
+
|
|
158
|
+
Version boundaries:
|
|
159
|
+
|
|
160
|
+
- `2026.4.8` is the minimum supported OpenClaw version for the current `@openviking/openclaw-plugin` plugin.
|
|
161
|
+
- `2026.5.3` starts requiring compiled JavaScript runtime output during package install when a plugin package declares TypeScript entries.
|
|
162
|
+
- `2026.5.4` and later no longer fall back to `.ts` source for installed/global plugin runtime loading when the compiled JavaScript output is missing; the plugin may be skipped.
|
|
163
|
+
- Published ClawHub packages are built before release and include `dist/*.js`, so normal users do not need to build locally.
|
|
164
|
+
- `ov-install` is the backup/source install path. Use it only after the OpenClaw plugin manager or ClawHub path is unavailable/rate-limited, or when the user explicitly asks to install a source ref. For OpenClaw `>= 2026.5.3`, it builds the plugin during installation.
|
|
165
|
+
|
|
166
|
+
### 3. Detect or start OpenViking server
|
|
167
|
+
|
|
168
|
+
The OpenClaw plugin only connects to an OpenViking HTTP server. It does not start the server.
|
|
169
|
+
|
|
170
|
+
Check the default local server first:
|
|
171
|
+
|
|
172
|
+
```bash
|
|
173
|
+
curl -fsS http://127.0.0.1:1933/health
|
|
174
|
+
```
|
|
175
|
+
|
|
176
|
+
If no OpenViking server is running and the user wants a local server:
|
|
177
|
+
|
|
178
|
+
```bash
|
|
179
|
+
pip install openviking --upgrade --force-reinstall
|
|
180
|
+
openviking-server init
|
|
181
|
+
openviking-server doctor
|
|
182
|
+
openviking-server
|
|
183
|
+
```
|
|
184
|
+
|
|
185
|
+
Keep `openviking-server` running while OpenClaw uses the plugin. Use `http://127.0.0.1:1933` as the plugin `baseUrl` for the default local setup.
|
|
186
|
+
|
|
187
|
+
For a remote server, confirm the reachable URL with the user and use that URL as `baseUrl`.
|
|
188
|
+
|
|
189
|
+
If OpenClaw is missing, tell the user to install and initialize OpenClaw:
|
|
190
|
+
|
|
191
|
+
```bash
|
|
192
|
+
npm install -g openclaw
|
|
193
|
+
openclaw onboard
|
|
194
|
+
```
|
|
195
|
+
|
|
196
|
+
### 4. Detect existing install state
|
|
197
|
+
|
|
198
|
+
If the user has multiple OpenClaw state directories, ask which one to operate on before changing config.
|
|
199
|
+
|
|
200
|
+
## Existing State Detection
|
|
201
|
+
|
|
202
|
+
Try status first:
|
|
203
|
+
|
|
204
|
+
```bash
|
|
205
|
+
openclaw openviking status --json
|
|
206
|
+
```
|
|
207
|
+
|
|
208
|
+
If the command is unavailable, install the plugin first. If it returns `configured: true` and `slotActive: true`, do not reinstall unless the user requested upgrade or reconfigure.
|
|
209
|
+
|
|
210
|
+
Manual inspection:
|
|
211
|
+
|
|
212
|
+
```bash
|
|
213
|
+
openclaw config get plugins.entries.openviking.config
|
|
214
|
+
openclaw config get plugins.slots.contextEngine
|
|
215
|
+
openclaw plugins list
|
|
216
|
+
```
|
|
217
|
+
|
|
218
|
+
## Standard Operations
|
|
219
|
+
|
|
220
|
+
Fresh install:
|
|
221
|
+
|
|
222
|
+
```bash
|
|
223
|
+
openclaw plugins install @openviking/openclaw-plugin
|
|
224
|
+
openclaw openviking setup --base-url <OPENVIKING_URL> --api-key <API_KEY> --json
|
|
225
|
+
openclaw gateway restart
|
|
226
|
+
openclaw openviking status --json
|
|
227
|
+
```
|
|
228
|
+
|
|
229
|
+
Reconfigure:
|
|
230
|
+
|
|
231
|
+
```bash
|
|
232
|
+
openclaw openviking setup --reconfigure
|
|
233
|
+
openclaw gateway restart
|
|
234
|
+
openclaw openviking status --json
|
|
235
|
+
```
|
|
236
|
+
|
|
237
|
+
Upgrade:
|
|
238
|
+
|
|
239
|
+
```bash
|
|
240
|
+
openclaw plugins update openviking
|
|
241
|
+
openclaw gateway restart
|
|
242
|
+
openclaw openviking status --json
|
|
243
|
+
```
|
|
244
|
+
|
|
245
|
+
Uninstall:
|
|
246
|
+
|
|
247
|
+
```bash
|
|
248
|
+
openclaw plugins uninstall openviking
|
|
249
|
+
openclaw config set plugins.slots.contextEngine legacy
|
|
250
|
+
openclaw gateway restart
|
|
251
|
+
```
|
|
252
|
+
|
|
253
|
+
Native uninstall may not reset `plugins.slots.contextEngine`. Always run the explicit `config set` step after uninstall.
|
|
254
|
+
|
|
255
|
+
## Config Fields
|
|
256
|
+
|
|
257
|
+
Config path:
|
|
258
|
+
|
|
259
|
+
```text
|
|
260
|
+
plugins.entries.openviking.config
|
|
261
|
+
```
|
|
262
|
+
|
|
263
|
+
Core fields:
|
|
264
|
+
|
|
265
|
+
| Field | Meaning |
|
|
266
|
+
| --- | --- |
|
|
267
|
+
| `mode` | Legacy compatibility field. Expected value: `remote`. |
|
|
268
|
+
| `baseUrl` | OpenViking HTTP endpoint |
|
|
269
|
+
| `apiKey` | OpenViking API key |
|
|
270
|
+
| `agent_prefix` | Optional; prefix for OpenClaw agent IDs when set. Interactive setup accepts only letters, digits, `_`, and `-`. If unset, the plugin follows session agent IDs. |
|
|
271
|
+
| `accountId` | Required for root API keys |
|
|
272
|
+
| `userId` | Required for root API keys |
|
|
273
|
+
|
|
274
|
+
## Verification
|
|
275
|
+
|
|
276
|
+
Quick verification:
|
|
277
|
+
|
|
278
|
+
```bash
|
|
279
|
+
openclaw openviking status --json
|
|
280
|
+
```
|
|
281
|
+
|
|
282
|
+
Manual verification:
|
|
283
|
+
|
|
284
|
+
```bash
|
|
285
|
+
openclaw config get plugins.slots.contextEngine
|
|
286
|
+
openclaw config get plugins.entries.openviking.config
|
|
287
|
+
openclaw logs --follow
|
|
288
|
+
```
|
|
289
|
+
|
|
290
|
+
Expected log signal:
|
|
291
|
+
|
|
292
|
+
```text
|
|
293
|
+
openviking: registered context-engine
|
|
294
|
+
```
|
|
295
|
+
|
|
296
|
+
Optional end-to-end health check from a repository checkout:
|
|
297
|
+
|
|
298
|
+
```bash
|
|
299
|
+
python examples/openclaw-plugin/health_check_tools/ov-healthcheck.py
|
|
300
|
+
```
|
|
301
|
+
|
|
302
|
+
## Migrate From ov-install
|
|
303
|
+
|
|
304
|
+
If ov-install was previously used, clean up before switching to `openclaw plugins install`:
|
|
305
|
+
|
|
306
|
+
Same plugin ID (openviking, >= 0.3.x):
|
|
307
|
+
|
|
308
|
+
```bash
|
|
309
|
+
rm -rf ~/.openclaw/extensions/openviking/
|
|
310
|
+
openclaw plugins install @openviking/openclaw-plugin
|
|
311
|
+
openclaw openviking setup --reconfigure
|
|
312
|
+
openclaw gateway restart
|
|
313
|
+
openclaw openviking status --json
|
|
314
|
+
```
|
|
315
|
+
|
|
316
|
+
Old plugin ID (memory-openviking, < 0.3.x):
|
|
317
|
+
|
|
318
|
+
```bash
|
|
319
|
+
openclaw plugins uninstall memory-openviking 2>/dev/null || true
|
|
320
|
+
openclaw config set plugins.slots.memory none
|
|
321
|
+
rm -rf ~/.openclaw/extensions/memory-openviking/
|
|
322
|
+
openclaw plugins install @openviking/openclaw-plugin
|
|
323
|
+
openclaw openviking setup --base-url <OPENVIKING_URL> --api-key <API_KEY> --json
|
|
324
|
+
openclaw gateway restart
|
|
325
|
+
openclaw openviking status --json
|
|
326
|
+
```
|
|
327
|
+
|
|
328
|
+
Existing config fields are preserved during migration. The new plugin reads old field names at runtime.
|
|
329
|
+
|
|
330
|
+
- `baseUrl`
|
|
331
|
+
- `apiKey`
|
|
332
|
+
- `agent_prefix`: optional; interactive setup accepts only letters, digits, `_`, and `-`
|
|
333
|
+
|
|
334
|
+
## Backup Path: ov-install
|
|
335
|
+
|
|
336
|
+
`ov-install` is the backup path, not the primary user install path. Use it when `openclaw plugins install @openviking/openclaw-plugin` cannot reach ClawHub, is rate-limited, or when the user explicitly wants a source ref / Git branch install.
|
|
337
|
+
|
|
338
|
+
Backup install:
|
|
339
|
+
|
|
340
|
+
```bash
|
|
341
|
+
npm install -g openclaw-openviking-setup-helper
|
|
342
|
+
ov-install
|
|
343
|
+
```
|
|
344
|
+
|
|
345
|
+
Backup/source commands:
|
|
346
|
+
|
|
347
|
+
| Intent | Command |
|
|
348
|
+
| --- | --- |
|
|
349
|
+
| Install from a source ref | `ov-install --plugin-version=<REF>` |
|
|
350
|
+
| Non-interactive backup install | `ov-install --base-url <URL> --api-key <KEY>` |
|
|
351
|
+
| Target a non-default OpenClaw state directory | `ov-install --workdir <PATH>` |
|
|
352
|
+
| Show helper-tracked version | `ov-install --current-version` |
|
|
353
|
+
| Update helper-managed install | `ov-install --update` |
|
|
354
|
+
|
|
355
|
+
For user installs, always try `openclaw plugins install @openviking/openclaw-plugin` first. Choose `ov-install` only as the backup path.
|
package/INSTALL-ZH.md
ADDED
|
@@ -0,0 +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 @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 @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 @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 @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
|
+
| `--version REF` | 指定 Git ref、tag、branch 或发布版本 |
|
|
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 @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 @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 @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)。
|