Skip to content

Commit 182a4d4

Browse files
authored
feat(installer, openclaw-plugin): unified installer upgrade (#1020)
- Installer: Python path fix, version compatibility, legacy plugin support (79781f5) - OpenClaw plugin: manifest/FALLBACK optional+required, download retries, optional 404 UX; session-transcript-repair.ts optional in manifest (installer may skip on 404) - context-engine unchanged from base (static session-transcript-repair import) - Docs: INSTALL/INSTALL-ZH; Windows via npm/ov-install; remove install.ps1 and INSTALLER-UPGRADE-PROPOSAL - setup-helper version bump for npm dev line Made-with: Cursor
1 parent 7eb50cb commit 182a4d4

8 files changed

Lines changed: 3339 additions & 796 deletions

File tree

examples/openclaw-plugin/INSTALL-ZH.md

Lines changed: 155 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,9 @@ mv ~/.openclaw/extensions/memory-openviking ~/.openclaw/disabled-extensions/memo
6666

6767
### 正式安装
6868

69-
#### 方式 A:npm 安装(推荐,全平台)
69+
#### 方式 A:npm 安装(推荐,含 Windows)
70+
71+
**Windows** 与 macOS / Linux 相同:在 **PowerShell****cmd** 中执行下面的 `npm``npx``ov-install` 即可(需已安装 Node.js ≥ 22)。指定其它 OpenClaw 数据目录时,把 `--workdir` 换成本机路径(例如 `%USERPROFILE%\.openclaw-second`)。
7072

7173
```bash
7274
npm install -g openclaw-openviking-setup-helper
@@ -84,6 +86,87 @@ ov-install -y
8486
```bash
8587
ov-install --workdir ~/.openclaw-second
8688
```
89+
90+
#### 指定版本(npm / `ov-install`
91+
92+
npm 上的安装助手包名为 [`openclaw-openviking-setup-helper`](https://www.npmjs.com/package/openclaw-openviking-setup-helper)。默认安装最新版;若需固定 **npm 上某一发布版本**,在包名后追加 `@VERSION`(VERSION 为 npm 上可见的 dist-tag 或版本号):
93+
94+
```bash
95+
npm install -g openclaw-openviking-setup-helper
96+
ov-install -y
97+
```
98+
99+
不全局安装、用 npx 直接跑(同样可在包名后加 `@VERSION` 固定安装助手版本):
100+
101+
```bash
102+
npx -y -p openclaw-openviking-setup-helper ov-install -y
103+
```
104+
105+
使用 **`ov-install`** 可指定 **插件代码对应的 Git 引用** 以及 **PyPI 上的 OpenViking 版本**
106+
107+
| 参数 | 含义 |
108+
| --- | --- |
109+
| `--github-repo owner/repo` | 从哪个 GitHub 仓库拉取插件文件(默认:`volcengine/OpenViking`|
110+
| `--plugin-version REF` | 分支、tag 或 commit,用于拉取插件(默认:`main`|
111+
| `--openviking-version VER` | 固定为 `pip install openviking==VER`(不写则安装 PyPI 最新版) |
112+
113+
示例:
114+
115+
```bash
116+
# 安装指定 tag 版本的插件(例如 v0.2.9)
117+
ov-install -y --plugin-version v0.2.9
118+
119+
# 固定 PyPI 上的 OpenViking 版本,插件仍从 main 拉取
120+
ov-install -y --openviking-version 0.2.9
121+
122+
# 同时指定插件 tag 和 OpenViking PyPI 版本
123+
ov-install -y --plugin-version v0.2.9 --openviking-version 0.2.9
124+
125+
# 安装旧版插件链路(如需使用旧插件,请在 v0.2.3-v0.2.6 范围内选择版本)
126+
ov-install -y --plugin-version <legacy-version>
127+
```
128+
129+
等价环境变量:`REPO`(同 `--github-repo`)、`PLUGIN_VERSION` / `BRANCH``OPENVIKING_VERSION`
130+
131+
#### 升级与回滚(`ov-install`
132+
133+
使用 `--update` / `--upgrade-plugin` 时,只会升级**插件本身**到指定 `--plugin-version`,不会升级 OpenViking 服务版本。该模式会:
134+
135+
- 保留现有的 OpenViking 服务版本
136+
- 保留现有的 `~/.openviking/ov.conf`
137+
- 保留当前插件运行配置
138+
- 本地模式下保留 `configPath``port`
139+
- 远端模式下保留 `baseUrl``apiKey``agentId`
140+
- 只清理 `openclaw.json` 中 OpenViking 自己的插件配置,不影响其它插件
141+
- 在替换插件前备份 `openclaw.json` 和上一版插件目录
142+
- 在命令输出中记录升级路径和回滚审计文件位置
143+
144+
不要把 `--update``--openviking-version` 一起使用;如果需要修改 OpenViking 服务版本,请走完整安装流程。
145+
146+
```bash
147+
# 只升级插件到指定 tag
148+
ov-install --update --plugin-version v0.2.9
149+
150+
# 只升级插件到指定分支
151+
ov-install --update --plugin-version dev-branch
152+
153+
# 从指定 GitHub 仓库 + 分支升级插件
154+
ov-install --update --github-repo yourname/OpenViking --plugin-version dev-branch
155+
156+
# 回滚最近一次插件升级
157+
ov-install --rollback
158+
```
159+
160+
升级备份默认保存在:
161+
162+
- `~/.openclaw/.openviking-upgrade-backup/openclaw.json.bak`
163+
- `~/.openclaw/.openviking-upgrade-backup/last-upgrade.json`
164+
- `~/.openclaw/disabled-extensions/<pluginId>-upgrade-backup-*`
165+
166+
`--rollback` 会恢复最近一次 `--update` 生成的 `openclaw.json` 备份和插件目录备份。
167+
168+
**Windows:** 升级与回滚命令与上表相同,在 PowerShell / cmd 中执行即可。
169+
87170
备注:在运行 `npm install -g openclaw-openviking-setup-helper` 命令时,可能会出现没有安装创建虚拟环境的工具的报错提示,可以直接复制报错提示中的解决方案执行:
88171

89172
```bash
@@ -105,25 +188,82 @@ ov-install
105188

106189
#### 方式 B(可选):curl 一键安装(Linux / macOS)
107190

191+
**Windows** 请优先使用上文 **方式 A(`npm` / `ov-install`**`curl | bash` 需要 Bash 环境;若已在 **Git Bash****WSL** 中操作,可执行本节命令。
192+
108193
```bash
109194
curl -fsSL https://raw.githubusercontent.com/volcengine/OpenViking/main/examples/openclaw-plugin/install.sh | bash
110195
```
111196

112197
非交互模式:
113198

114199
```bash
115-
curl -fsSL https://raw.githubusercontent.com/volcengine/OpenViking/main/examples/openclaw-plugin/install.sh | bash -s -y
200+
curl -fsSL https://raw.githubusercontent.com/volcengine/OpenViking/main/examples/openclaw-plugin/install.sh | bash -s -- -y
116201
```
117202

118203
安装到指定 OpenClaw 实例:
119204

120205
```bash
121-
curl -fsSL ... | bash -s -- --workdir ~/.openclaw-openclaw-second
206+
curl -fsSL https://raw.githubusercontent.com/volcengine/OpenViking/main/examples/openclaw-plugin/install.sh | bash -s -- --workdir ~/.openclaw-second -y
122207
```
123208

124-
脚本会自动检测多个 OpenClaw 实例并让你选择。还会提示选择 local/remote 模式——remote 模式连接远端 OpenViking 服务,不需要安装 Python。
209+
#### 指定版本(`install.sh`
125210

126-
出现`installation completed`即代表安装成功。
211+
| 参数 / 环境变量 | 含义 |
212+
| --- | --- |
213+
| `--repo owner/repo``REPO` | 从哪个 GitHub 仓库拉取插件文件(默认:`volcengine/OpenViking`|
214+
| `--plugin-version REF``PLUGIN_VERSION` | 分支、tag 或 commit(默认:`main`;兼容旧变量 `BRANCH`|
215+
| `--openviking-version VER``OPENVIKING_VERSION` | `pip install openviking==VER`(不写则安装 PyPI 最新版) |
216+
217+
示例:
218+
219+
```bash
220+
# 安装指定 tag 版本的插件(例如 v0.2.9)
221+
curl -fsSL https://raw.githubusercontent.com/volcengine/OpenViking/main/examples/openclaw-plugin/install.sh | bash -s -- \
222+
--plugin-version v0.2.9 -y
223+
224+
# 固定 PyPI 上的 OpenViking 版本
225+
curl -fsSL https://raw.githubusercontent.com/volcengine/OpenViking/main/examples/openclaw-plugin/install.sh | bash -s -- \
226+
--openviking-version 0.2.9 -y
227+
228+
# 同时指定插件 tag 和 OpenViking PyPI 版本
229+
curl -fsSL https://raw.githubusercontent.com/volcengine/OpenViking/main/examples/openclaw-plugin/install.sh | bash -s -- \
230+
--plugin-version v0.2.9 --openviking-version 0.2.9 -y
231+
```
232+
233+
#### 升级与回滚(`install.sh`
234+
235+
`curl | bash` 入口现在直接由 `install.sh` 原生执行升级和回滚逻辑,不依赖机器上预先安装全局安装助手,也支持“只升级插件”和“回滚最近一次插件升级”:
236+
237+
```bash
238+
# 只升级插件到指定 tag
239+
curl -fsSL https://raw.githubusercontent.com/volcengine/OpenViking/main/examples/openclaw-plugin/install.sh | bash -s -- \
240+
--update --plugin-version v0.2.9
241+
242+
# 只升级插件到指定分支
243+
curl -fsSL https://raw.githubusercontent.com/volcengine/OpenViking/main/examples/openclaw-plugin/install.sh | bash -s -- \
244+
--update --plugin-version dev-branch
245+
246+
# 从指定 GitHub 仓库 + 分支升级插件
247+
curl -fsSL https://raw.githubusercontent.com/volcengine/OpenViking/main/examples/openclaw-plugin/install.sh | bash -s -- \
248+
--update --repo yourname/OpenViking --plugin-version dev-branch
249+
250+
# 回滚最近一次插件升级
251+
curl -fsSL https://raw.githubusercontent.com/volcengine/OpenViking/main/examples/openclaw-plugin/install.sh | bash -s -- \
252+
--rollback
253+
```
254+
255+
`--update` 模式只改插件,不改 OpenViking 服务版本,因此不要搭配 `--openviking-version`
256+
257+
Shell 原生升级行为:
258+
259+
- 保留当前 local / remote 模式下的插件配置
260+
- 不会重写 `~/.openviking/ov.conf`
261+
- 会把 `openclaw.json` 备份到 `~/.openclaw/.openviking-upgrade-backup/openclaw.json.bak`
262+
- 会把回滚审计写到 `~/.openclaw/.openviking-upgrade-backup/last-upgrade.json`
263+
- 每个插件只保留一份最新的目录备份,位置在 `~/.openclaw/disabled-extensions/`
264+
- 升级成功后会打印 `Upgrade path: <from> -> <to>`
265+
266+
`install.sh` 会检测本机多个 OpenClaw 实例并供选择;首次安装会询问 local/remote;仅升级插件时会复用现有模式与配置。
127267

128268
### 启动OpenClaw + OpenViking
129269

@@ -132,6 +272,13 @@ curl -fsSL ... | bash -s -- --workdir ~/.openclaw-openclaw-second
132272
```bash
133273
source ~/.openclaw/openviking.env && openclaw gateway restart
134274
```
275+
276+
Windows PowerShell 可使用:
277+
278+
```powershell
279+
. "$HOME/.openclaw/openviking.env.ps1"
280+
openclaw gateway restart
281+
```
135282
出现 `openviking: registered context-engine` 代表拉取成功。
136283

137284
接着,执行
@@ -362,12 +509,14 @@ openclaw config set plugins.entries.openviking.config.agentId "my-agent"
362509

363510
### `~/.openclaw/openviking.env`
364511

365-
由安装助手自动生成,记录 Python 路径等环境变量:
512+
由安装器自动生成,记录 Python 路径等环境变量:
366513

367514
```bash
368515
export OPENVIKING_PYTHON='/usr/local/bin/python3'
369516
```
370517

518+
在 Windows PowerShell 下,安装器会生成 `~/.openclaw/openviking.env.ps1`
519+
371520
---
372521

373522
## 日常使用

0 commit comments

Comments
 (0)