@tencent-connect/openclaw-qqbot 1.6.4-alpha.8 → 1.6.4-alpha.9
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.
|
@@ -223,6 +223,31 @@ function findBash() {
|
|
|
223
223
|
return null;
|
|
224
224
|
}
|
|
225
225
|
}
|
|
226
|
+
/**
|
|
227
|
+
* 将 openclaw.json 中的 qqbot 插件 source 从 "path" 切换为 "npm"。
|
|
228
|
+
* 用于热更新场景:从 npm 拉取新版本后,确保 openclaw 不再从本地源码加载。
|
|
229
|
+
*/
|
|
230
|
+
function switchPluginSourceToNpm() {
|
|
231
|
+
try {
|
|
232
|
+
const homeDir = getHomeDir();
|
|
233
|
+
for (const cli of ["openclaw", "clawdbot", "moltbot"]) {
|
|
234
|
+
const cfgPath = path.join(homeDir, `.${cli}`, `${cli}.json`);
|
|
235
|
+
if (!fs.existsSync(cfgPath))
|
|
236
|
+
continue;
|
|
237
|
+
const cfg = JSON.parse(fs.readFileSync(cfgPath, "utf8"));
|
|
238
|
+
const inst = cfg?.plugins?.installs?.["openclaw-qqbot"];
|
|
239
|
+
if (inst && inst.source !== "npm") {
|
|
240
|
+
inst.source = "npm";
|
|
241
|
+
delete inst.sourcePath;
|
|
242
|
+
fs.writeFileSync(cfgPath, JSON.stringify(cfg, null, 4) + "\n");
|
|
243
|
+
}
|
|
244
|
+
break;
|
|
245
|
+
}
|
|
246
|
+
}
|
|
247
|
+
catch {
|
|
248
|
+
// 非关键操作,静默忽略
|
|
249
|
+
}
|
|
250
|
+
}
|
|
226
251
|
/**
|
|
227
252
|
* 执行热更新:执行脚本(--no-restart) → 立即触发 gateway restart
|
|
228
253
|
*
|
|
@@ -261,6 +286,11 @@ function fireHotUpgrade(targetVersion) {
|
|
|
261
286
|
// 文件替换异常,不执行 restart 以保持现有服务
|
|
262
287
|
return;
|
|
263
288
|
}
|
|
289
|
+
// 文件替换成功,在 restart 之前把 source 从 path 切换为 npm,
|
|
290
|
+
// 确保新进程启动时读到的是 npm source,不会被本地源码覆盖。
|
|
291
|
+
// 必须在 restart 之前同步完成,避免 openclaw 轮询检测到配置变更后
|
|
292
|
+
// 先于我们的 restart 触发非预期的 reload。
|
|
293
|
+
switchPluginSourceToNpm();
|
|
264
294
|
// 文件替换成功,立即触发 gateway restart(不再等后续步骤)
|
|
265
295
|
execFile(cli, ["gateway", "restart"], { timeout: 30_000 }, (restartErr) => {
|
|
266
296
|
if (restartErr) {
|
|
@@ -71,7 +71,7 @@ async function fetchDistTags(log) {
|
|
|
71
71
|
export function triggerUpdateCheck(log) {
|
|
72
72
|
if (_checking)
|
|
73
73
|
return;
|
|
74
|
-
const INTERVAL_MS =
|
|
74
|
+
const INTERVAL_MS = 1 * 60 * 1000;
|
|
75
75
|
if (_lastInfo.checkedAt > 0 && Date.now() - _lastInfo.checkedAt < INTERVAL_MS) {
|
|
76
76
|
return;
|
|
77
77
|
}
|
package/package.json
CHANGED
|
@@ -259,6 +259,25 @@ else
|
|
|
259
259
|
echo "✅ 插件安装命令执行完成"
|
|
260
260
|
echo "安装日志已保存到: $INSTALL_LOG"
|
|
261
261
|
|
|
262
|
+
# 确保 openclaw.json 中的 source 为 path(从 npm 切回 path)
|
|
263
|
+
for _app in openclaw clawdbot moltbot; do
|
|
264
|
+
_cfg="$HOME/.$_app/$_app.json"
|
|
265
|
+
if [ -f "$_cfg" ]; then
|
|
266
|
+
node -e "
|
|
267
|
+
const fs = require('fs');
|
|
268
|
+
const cfg = JSON.parse(fs.readFileSync('$_cfg', 'utf8'));
|
|
269
|
+
const inst = cfg.plugins && cfg.plugins.installs && cfg.plugins.installs['openclaw-qqbot'];
|
|
270
|
+
if (inst && inst.source !== 'path') {
|
|
271
|
+
inst.source = 'path';
|
|
272
|
+
inst.sourcePath = '$PROJ_DIR';
|
|
273
|
+
fs.writeFileSync('$_cfg', JSON.stringify(cfg, null, 4) + '\n');
|
|
274
|
+
console.log(' 已将 plugins.installs.openclaw-qqbot.source 更新为 path');
|
|
275
|
+
}
|
|
276
|
+
" 2>/dev/null || true
|
|
277
|
+
break
|
|
278
|
+
fi
|
|
279
|
+
done
|
|
280
|
+
|
|
262
281
|
# 验证插件目录是否真正创建(防止 "安装成功" 但目录缺失的情况)
|
|
263
282
|
_plugin_dir_ok=0
|
|
264
283
|
for _candidate_name in openclaw-qqbot qqbot openclaw-qq; do
|
package/src/slash-commands.ts
CHANGED
|
@@ -309,6 +309,30 @@ function findBash(): string | null {
|
|
|
309
309
|
}
|
|
310
310
|
}
|
|
311
311
|
|
|
312
|
+
/**
|
|
313
|
+
* 将 openclaw.json 中的 qqbot 插件 source 从 "path" 切换为 "npm"。
|
|
314
|
+
* 用于热更新场景:从 npm 拉取新版本后,确保 openclaw 不再从本地源码加载。
|
|
315
|
+
*/
|
|
316
|
+
function switchPluginSourceToNpm(): void {
|
|
317
|
+
try {
|
|
318
|
+
const homeDir = getHomeDir();
|
|
319
|
+
for (const cli of ["openclaw", "clawdbot", "moltbot"]) {
|
|
320
|
+
const cfgPath = path.join(homeDir, `.${cli}`, `${cli}.json`);
|
|
321
|
+
if (!fs.existsSync(cfgPath)) continue;
|
|
322
|
+
const cfg = JSON.parse(fs.readFileSync(cfgPath, "utf8"));
|
|
323
|
+
const inst = cfg?.plugins?.installs?.["openclaw-qqbot"];
|
|
324
|
+
if (inst && inst.source !== "npm") {
|
|
325
|
+
inst.source = "npm";
|
|
326
|
+
delete inst.sourcePath;
|
|
327
|
+
fs.writeFileSync(cfgPath, JSON.stringify(cfg, null, 4) + "\n");
|
|
328
|
+
}
|
|
329
|
+
break;
|
|
330
|
+
}
|
|
331
|
+
} catch {
|
|
332
|
+
// 非关键操作,静默忽略
|
|
333
|
+
}
|
|
334
|
+
}
|
|
335
|
+
|
|
312
336
|
/**
|
|
313
337
|
* 执行热更新:执行脚本(--no-restart) → 立即触发 gateway restart
|
|
314
338
|
*
|
|
@@ -349,6 +373,12 @@ function fireHotUpgrade(targetVersion?: string): HotUpgradeStartResult {
|
|
|
349
373
|
return;
|
|
350
374
|
}
|
|
351
375
|
|
|
376
|
+
// 文件替换成功,在 restart 之前把 source 从 path 切换为 npm,
|
|
377
|
+
// 确保新进程启动时读到的是 npm source,不会被本地源码覆盖。
|
|
378
|
+
// 必须在 restart 之前同步完成,避免 openclaw 轮询检测到配置变更后
|
|
379
|
+
// 先于我们的 restart 触发非预期的 reload。
|
|
380
|
+
switchPluginSourceToNpm();
|
|
381
|
+
|
|
352
382
|
// 文件替换成功,立即触发 gateway restart(不再等后续步骤)
|
|
353
383
|
execFile(cli, ["gateway", "restart"], { timeout: 30_000 }, (restartErr) => {
|
|
354
384
|
if (restartErr) {
|
package/src/update-checker.ts
CHANGED
|
@@ -84,7 +84,7 @@ export function triggerUpdateCheck(log?: {
|
|
|
84
84
|
debug?: (msg: string) => void;
|
|
85
85
|
}): void {
|
|
86
86
|
if (_checking) return;
|
|
87
|
-
const INTERVAL_MS =
|
|
87
|
+
const INTERVAL_MS = 1 * 60 * 1000;
|
|
88
88
|
if (_lastInfo.checkedAt > 0 && Date.now() - _lastInfo.checkedAt < INTERVAL_MS) {
|
|
89
89
|
return;
|
|
90
90
|
}
|