@openclaw/qqbot 2026.5.7-beta.1 → 2026.5.9-beta.1

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.
@@ -1,7 +1,8 @@
1
- import { C as debugLog } from "./sender-p-B14eLG.js";
2
- import { a as getHomeDir, f as isWindows, l as getQQBotMediaPath, o as getQQBotDataDir } from "./target-parser-Y0prnrXD.js";
1
+ import { S as debugLog } from "./sender-CgdXGY2H.js";
2
+ import { a as getHomeDir, f as isWindows, l as getQQBotMediaPath, o as getQQBotDataDir } from "./target-parser-DQ6J3Qe-.js";
3
3
  import fs from "node:fs";
4
4
  import path from "node:path";
5
+ import { loadJsonFile } from "openclaw/plugin-sdk/json-store";
5
6
  import { AsyncLocalStorage } from "node:async_hooks";
6
7
  //#region extensions/qqbot/src/engine/commands/builtin/state.ts
7
8
  let _resolveVersion = () => "unknown";
@@ -427,9 +428,7 @@ function getConfiguredLogFiles() {
427
428
  "clawdbot",
428
429
  "moltbot"
429
430
  ]) try {
430
- const cfgPath = path.join(homeDir, `.${cli}`, `${cli}.json`);
431
- if (!fs.existsSync(cfgPath)) continue;
432
- const logFile = JSON.parse(fs.readFileSync(cfgPath, "utf8"))?.logging?.file;
431
+ const logFile = loadJsonFile(path.join(homeDir, `.${cli}`, `${cli}.json`))?.logging?.file;
433
432
  if (logFile && typeof logFile === "string") files.push(path.resolve(logFile));
434
433
  break;
435
434
  } catch {}
@@ -501,6 +500,27 @@ function collectCandidateLogDirs() {
501
500
  ]) pushDir(path.join(tmpRoot, name));
502
501
  return Array.from(dirs);
503
502
  }
503
+ function addCollisionSuffix(filePath, suffix) {
504
+ const ext = path.extname(filePath);
505
+ const baseName = path.basename(filePath, ext);
506
+ return path.join(path.dirname(filePath), `${baseName}-${suffix}${ext}`);
507
+ }
508
+ function writeNewTextFileSync(filePath, contents) {
509
+ for (let suffix = 1; suffix <= 100; suffix++) {
510
+ const candidate = suffix === 1 ? filePath : addCollisionSuffix(filePath, suffix);
511
+ try {
512
+ fs.writeFileSync(candidate, contents, {
513
+ encoding: "utf8",
514
+ flag: "wx"
515
+ });
516
+ return candidate;
517
+ } catch (error) {
518
+ if (typeof error === "object" && error && "code" in error && error.code === "EEXIST") continue;
519
+ throw error;
520
+ }
521
+ }
522
+ throw new Error(`Could not find an unused log export filename near ${filePath}`);
523
+ }
504
524
  function collectRecentLogFiles(logDirs) {
505
525
  const candidates = [];
506
526
  const dedupe = /* @__PURE__ */ new Set();
@@ -626,8 +646,7 @@ function buildBotLogsResult() {
626
646
  if (lines.length === 0) return `⚠️ 找到了日志文件,但无法读取。请检查文件权限。`;
627
647
  const tmpDir = getQQBotDataDir("downloads");
628
648
  const timestamp = (/* @__PURE__ */ new Date()).toISOString().replace(/[:.]/g, "-").slice(0, 19);
629
- const tmpFile = path.join(tmpDir, `bot-logs-${timestamp}.txt`);
630
- fs.writeFileSync(tmpFile, lines.join("\n"), "utf8");
649
+ const tmpFile = writeNewTextFileSync(path.join(tmpDir, `bot-logs-${timestamp}.txt`), lines.join("\n"));
631
650
  const fileCount = recentFiles.length;
632
651
  const topSources = Array.from(new Set(recentFiles.map((item) => item.sourceDir))).slice(0, 3);
633
652
  let summaryText = `共 ${fileCount} 个日志文件,包含 ${totalIncluded} 行内容`;
@@ -1,4 +1,4 @@
1
- import { _ as setOpenClawVersion } from "./sender-p-B14eLG.js";
1
+ import { _ as setOpenClawVersion } from "./sender-CgdXGY2H.js";
2
2
  import { createPluginRuntimeStore } from "openclaw/plugin-sdk/runtime-store";
3
3
  //#region extensions/qqbot/src/bridge/runtime.ts
4
4
  const { setRuntime: _setRuntime, getRuntime: getQQBotRuntime } = createPluginRuntimeStore({
@@ -1,2 +1,2 @@
1
- import { r as setQQBotRuntime, t as getQQBotRuntime } from "./runtime-BJAS3eXW.js";
1
+ import { r as setQQBotRuntime, t as getQQBotRuntime } from "./runtime-C3Qpr4Ph.js";
2
2
  export { getQQBotRuntime, setQQBotRuntime };