feat: 渠道插件安装自动 pin 版本,兼容旧版 OpenClaw

- messaging.rs: install_channel_plugin/install_qqbot_plugin/run_channel_action 新增 version 参数
- 微信插件 npx 安装也支持版本 pin(@tencent-weixin/openclaw-weixin-cli@{version})
- channels.js: 安装前自动获取用户 OpenClaw 版本,pin 到基础版本号
- tauri-api.js/dev-api.js: 同步支持 version 参数传递
This commit is contained in:
晴天
2026-03-26 02:57:43 +08:00
parent ee09ebbc98
commit 540da00b91
4 changed files with 69 additions and 31 deletions

View File

@@ -1815,10 +1815,11 @@ const handlers = {
return { valid: true, warnings: ['该平台暂不支持在线校验'] }
},
install_qqbot_plugin() {
install_qqbot_plugin({ version } = {}) {
const bin = findOpenclawBin() || 'openclaw'
const spec = version ? `@tencent-connect/openclaw-qqbot@${version}` : '@tencent-connect/openclaw-qqbot@latest'
try {
execSync(`${bin} plugins install @tencent-connect/openclaw-qqbot@latest`, { timeout: 600000, cwd: homedir() })
execSync(`${bin} plugins install ${spec}`, { timeout: 600000, cwd: homedir() })
return '安装成功'
} catch (e) {
throw new Error('QQBot 插件安装失败: ' + (e.message || e))
@@ -1851,11 +1852,12 @@ const handlers = {
}
},
install_channel_plugin({ packageName, pluginId }) {
install_channel_plugin({ packageName, pluginId, version }) {
if (!packageName || !pluginId) throw new Error('packageName 和 pluginId 不能为空')
const bin = findOpenclawBin() || 'openclaw'
const spec = version ? `${packageName.trim()}@${version}` : packageName.trim()
try {
execSync(`${bin} plugins install ${packageName.trim()}`, { timeout: 120000, cwd: homedir() })
execSync(`${bin} plugins install ${spec}`, { timeout: 120000, cwd: homedir() })
return '安装成功'
} catch (e) {
throw new Error(`插件 ${pluginId} 安装失败: ` + (e.message || e))