fix(wechat): 便携包打包微信插件 + 修连接成功却报「插件未安装」的矛盾提示

根因:微信插件 @tencent-weixin/openclaw-weixin 是独立 npm 包,但 setup/CI
从没装过它,portable/app/ 又被 gitignore —— 发布包 app/extensions/ 是空的,
客户扫码连上后 config-server 找不到插件源,报「插件未安装」。

- release.yml: 装 @tencent-weixin/openclaw-weixin@latest 到 app/extensions/
  (npm 包自带 dist/index.js 无需 build;显式把 qrcode-terminal 放进插件
   node_modules 以满足 server.js:52 的硬要求)
- config-server/public/index.html: 去掉「连接成功」却又「插件未安装」的自相
  矛盾提示。后端已自动装插件+写好 openclaw.json+存账号,只需重启即可,
  不再暴露 pluginInstalled 内部状态吓客户,改为清晰的「重启 U-Claw 即可用」
- config-server/server.js: 插件 copy 失败时容错(不抛错中断 confirmed 流程)

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
hfshfg
2026-06-17 19:33:25 +08:00
parent 7b561009a5
commit 4fab64e877
3 changed files with 42 additions and 6 deletions

View File

@@ -197,9 +197,15 @@ function ensureWeChatPluginInstalled() {
return { installed: true };
}
// Copy from USB to ~/.openclaw/extensions/
const extDir = path.join(OPENCLAW_DIR, 'extensions');
fs.mkdirSync(extDir, { recursive: true });
copyDirSync(USB_PLUGIN_DIR, INSTALLED_PLUGIN_DIR);
// 容错copy 失败不抛错中断整个 confirmed 流程(账号保存 + openclaw.json 已/将写好)。
try {
const extDir = path.join(OPENCLAW_DIR, 'extensions');
fs.mkdirSync(extDir, { recursive: true });
copyDirSync(USB_PLUGIN_DIR, INSTALLED_PLUGIN_DIR);
} catch (e) {
console.error('WeChat plugin copy failed:', e.message);
return { installed: false, warning: e.message };
}
return { installed: fs.existsSync(path.join(INSTALLED_PLUGIN_DIR, 'openclaw.plugin.json')) };
}