openclaw-quiubo 2.6.17 → 2.6.19

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
@@ -13601,10 +13601,13 @@ var quiuboPlugin = {
13601
13601
  clients.set(accountId, client);
13602
13602
  accounts.set(accountId, account);
13603
13603
  }
13604
- const groupId = resolveOutboundGroupId(ctx);
13605
- log?.info?.(`[${accountId}] [outbound:sendText] resolved groupId=${groupId}, text=${text?.length ?? 0} chars, ctx.to=${ctx.to}, ConversationLabel=${ctx.target?.raw?.ConversationLabel ?? ctx.ConversationLabel}`);
13604
+ let groupId = resolveOutboundGroupId(ctx);
13606
13605
  if (!groupId) {
13607
- log?.error?.(`[${accountId}] [outbound:sendText] no groupId \u2014 ctx keys=${Object.keys(ctx).join(",")}, target keys=${ctx.target ? Object.keys(ctx.target).join(",") : "none"}`);
13606
+ groupId = await resolveAnnounceGroupId(accountId, log);
13607
+ }
13608
+ log?.info?.(`[${accountId}] [outbound:sendText] groupId=${groupId}, text=${text?.length ?? 0} chars, ctx.to=${ctx.to}, ConversationLabel=${ctx.target?.raw?.ConversationLabel ?? ctx.ConversationLabel}, SessionKey=${ctx.target?.raw?.SessionKey ?? ctx.SessionKey}`);
13609
+ if (!groupId) {
13610
+ log?.error?.(`[${accountId}] [outbound:sendText] no groupId \u2014 ctx keys=${Object.keys(ctx).join(",")}, target=${ctx.target ? JSON.stringify(Object.keys(ctx.target)) : "none"}, raw=${ctx.target?.raw ? JSON.stringify(Object.keys(ctx.target.raw)) : "none"}`);
13608
13611
  return { ok: false, error: "No groupId in outbound context" };
13609
13612
  }
13610
13613
  const senderId = account.botIdentityId;
@@ -13649,8 +13652,11 @@ var quiuboPlugin = {
13649
13652
  clients.set(accountId, client);
13650
13653
  accounts.set(accountId, account);
13651
13654
  }
13652
- const groupId = resolveOutboundGroupId(ctx);
13653
- log?.info?.(`[${accountId}] [outbound:sendMedia] resolved groupId=${groupId}, urls=${urls.length}, attachments=${mdAttachments.length}`);
13655
+ let groupId = resolveOutboundGroupId(ctx);
13656
+ if (!groupId) {
13657
+ groupId = await resolveAnnounceGroupId(accountId, log);
13658
+ }
13659
+ log?.info?.(`[${accountId}] [outbound:sendMedia] groupId=${groupId}, urls=${urls.length}, attachments=${mdAttachments.length}`);
13654
13660
  if (!groupId) {
13655
13661
  log?.error?.(`[${accountId}] [outbound:sendMedia] no groupId \u2014 ctx keys=${Object.keys(ctx).join(",")}`);
13656
13662
  return { ok: false, error: "No groupId in outbound context" };
@@ -14050,7 +14056,6 @@ var quiuboPlugin = {
14050
14056
  };
14051
14057
  function resolveOutboundGroupId(ctx) {
14052
14058
  const raw = ctx.target?.raw ?? ctx;
14053
- const UUID_RE = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
14054
14059
  const label = raw.ConversationLabel ?? ctx.ConversationLabel;
14055
14060
  if (label) {
14056
14061
  const id = label.replace(/^quiubo:/i, "").trim();
@@ -14063,9 +14068,29 @@ function resolveOutboundGroupId(ctx) {
14063
14068
  }
14064
14069
  const targetGroupId = ctx.target?.groupId ?? raw.groupId;
14065
14070
  if (targetGroupId) return targetGroupId;
14066
- const to = ctx.to ?? raw.to;
14067
- if (to && UUID_RE.test(to)) {
14068
- return to;
14071
+ return void 0;
14072
+ }
14073
+ async function resolveAnnounceGroupId(accountId, log) {
14074
+ try {
14075
+ const { readFile: readFile3 } = await import("node:fs/promises");
14076
+ const { join: join2 } = await import("node:path");
14077
+ const homeDir = process.env.HOME ?? process.env.USERPROFILE ?? "";
14078
+ const cronPath = join2(homeDir, ".openclaw", "cron", "jobs.json");
14079
+ const raw = await readFile3(cronPath, "utf-8");
14080
+ const parsed = JSON.parse(raw);
14081
+ const jobs = parsed?.jobs ?? [];
14082
+ for (const job of jobs) {
14083
+ if (job.enabled === false) continue;
14084
+ const delivery = job.delivery;
14085
+ if (!delivery) continue;
14086
+ if (delivery.channel !== "quiubo") continue;
14087
+ if (delivery.to) {
14088
+ log?.info?.(`[${accountId}] [resolveAnnounceGroupId] found cron job ${job.id} \u2192 delivery.to=${delivery.to}`);
14089
+ return delivery.to;
14090
+ }
14091
+ }
14092
+ } catch (err) {
14093
+ log?.warn?.(`[${accountId}] [resolveAnnounceGroupId] failed to read cron jobs: ${err}`);
14069
14094
  }
14070
14095
  return void 0;
14071
14096
  }