openclaw-quiubo 2.6.21 → 2.6.22

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.
package/dist/index.js CHANGED
@@ -8952,8 +8952,8 @@ function getQuiuboRuntime() {
8952
8952
  }
8953
8953
 
8954
8954
  // src/channel.ts
8955
- import { readFile as readFile2 } from "fs/promises";
8956
- import { basename } from "path";
8955
+ import { readFile as readFile2, writeFile as writeFile2, mkdir as mkdir2 } from "fs/promises";
8956
+ import { basename, join as join2 } from "path";
8957
8957
 
8958
8958
  // src/api.ts
8959
8959
  import { randomUUID } from "crypto";
@@ -13256,14 +13256,36 @@ var AgentKeyManager = class {
13256
13256
  };
13257
13257
 
13258
13258
  // src/channel.ts
13259
- function loadOrGenerateKeys(cfg) {
13259
+ var KEYS_DIR = join2(process.env.HOME ?? process.env.USERPROFILE ?? "", ".openclaw", "cron");
13260
+ async function loadOrGenerateKeys(cfg, accountId) {
13261
+ const seedFile = join2(KEYS_DIR, `quiubo-keys-${accountId}.json`);
13262
+ try {
13263
+ const raw = await readFile2(seedFile, "utf-8");
13264
+ const { seed: seedB642 } = JSON.parse(raw);
13265
+ if (seedB642) {
13266
+ const seed = new Uint8Array(Buffer.from(seedB642, "base64"));
13267
+ return { ...deriveKeypairFromSeed(seed), freshlyGenerated: false };
13268
+ }
13269
+ } catch {
13270
+ }
13260
13271
  if (cfg.keys?.seed) {
13261
13272
  const seed = new Uint8Array(Buffer.from(cfg.keys.seed, "base64"));
13262
- return deriveKeypairFromSeed(seed);
13273
+ const keys2 = deriveKeypairFromSeed(seed);
13274
+ await persistSeed(seedFile, cfg.keys.seed);
13275
+ return { ...keys2, freshlyGenerated: false };
13263
13276
  }
13264
13277
  const keys = generateAgentKeypair();
13265
- cfg.keys = { seed: Buffer.from(keys.seed).toString("base64") };
13266
- return keys;
13278
+ const seedB64 = Buffer.from(keys.seed).toString("base64");
13279
+ cfg.keys = { seed: seedB64 };
13280
+ await persistSeed(seedFile, seedB64);
13281
+ return { ...keys, freshlyGenerated: true };
13282
+ }
13283
+ async function persistSeed(seedFile, seedB64) {
13284
+ try {
13285
+ await mkdir2(KEYS_DIR, { recursive: true });
13286
+ await writeFile2(seedFile, JSON.stringify({ seed: seedB64 }), "utf-8");
13287
+ } catch {
13288
+ }
13267
13289
  }
13268
13290
  async function readMdAttachments(mediaUrls, source, log, accountId) {
13269
13291
  const attachments = [];
@@ -13814,9 +13836,9 @@ var quiuboPlugin = {
13814
13836
  resolvedAgentName = match.name;
13815
13837
  log?.info?.(`[${accountId}] Quiubo: resolved agent ${match.name} (${match.id}) for heartbeat, displayName=${resolvedAgentDisplayName}`);
13816
13838
  try {
13817
- const keys = loadOrGenerateKeys(quiuboConfig);
13818
- if (!match.e2eeConfigured) {
13819
- log?.info?.(`[${accountId}] Quiubo: enrolling E2EE keys for agent ${match.id}`);
13839
+ const keys = await loadOrGenerateKeys(quiuboConfig, accountId);
13840
+ if (!match.e2eeConfigured || keys.freshlyGenerated) {
13841
+ log?.info?.(`[${accountId}] Quiubo: ${keys.freshlyGenerated ? "re-" : ""}enrolling E2EE keys for agent ${match.id}`);
13820
13842
  const { challengeId, challenge } = await client.requestKeyChallenge(match.id, {
13821
13843
  signingPublicKey: toBase64(keys.signingPublicKey),
13822
13844
  encryptionPublicKey: toBase64(keys.encryptionPublicKey),
@@ -14081,9 +14103,9 @@ function resolveOutboundGroupId(ctx) {
14081
14103
  async function resolveAnnounceGroupId(accountId, log) {
14082
14104
  try {
14083
14105
  const { readFile: readFile3 } = await import("node:fs/promises");
14084
- const { join: join2 } = await import("node:path");
14106
+ const { join: join3 } = await import("node:path");
14085
14107
  const homeDir = process.env.HOME ?? process.env.USERPROFILE ?? "";
14086
- const cronPath = join2(homeDir, ".openclaw", "cron", "jobs.json");
14108
+ const cronPath = join3(homeDir, ".openclaw", "cron", "jobs.json");
14087
14109
  const raw = await readFile3(cronPath, "utf-8");
14088
14110
  const parsed = JSON.parse(raw);
14089
14111
  const jobs = parsed?.jobs ?? [];
@@ -14105,9 +14127,9 @@ async function resolveAnnounceGroupId(accountId, log) {
14105
14127
  async function getActivityData(runtime2, log, agentId) {
14106
14128
  try {
14107
14129
  const { readFile: readFile3 } = await import("node:fs/promises");
14108
- const { join: join2 } = await import("node:path");
14130
+ const { join: join3 } = await import("node:path");
14109
14131
  const homeDir = process.env.HOME ?? process.env.USERPROFILE ?? "";
14110
- const cronPath = join2(homeDir, ".openclaw", "cron", "jobs.json");
14132
+ const cronPath = join3(homeDir, ".openclaw", "cron", "jobs.json");
14111
14133
  log?.info?.(`getActivityData: reading ${cronPath} (agentId=${agentId})`);
14112
14134
  const raw = await readFile3(cronPath, "utf-8");
14113
14135
  const parsed = JSON.parse(raw);
@@ -14253,6 +14275,13 @@ async function routeInboundMessage(opts) {
14253
14275
  log?.warn?.(`[${accountId}] Quiubo: skipping outbound \u2014 agent lacks send_messages scope for group ${groupId}`);
14254
14276
  return;
14255
14277
  }
14278
+ if (payload.text) {
14279
+ payload.text = payload.text.replace(/\n*Reasoning:\n_[^_]*_\n*/g, "").trim();
14280
+ }
14281
+ if (!payload.text && mdAttachments.length === 0) {
14282
+ log?.debug?.(`[${accountId}] Quiubo: skipping empty reply after reasoning strip`);
14283
+ return;
14284
+ }
14256
14285
  log?.info?.(`[${accountId}] Quiubo: delivering ${info.kind} reply [${payload.text?.length ?? 0} chars, ${mdAttachments.length} attachments]`);
14257
14286
  try {
14258
14287
  let ciphertextOut;