openclaw-quiubo 2.5.2 → 2.6.0

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
@@ -13391,7 +13391,8 @@ var quiuboPlugin = {
13391
13391
  clients.set(accountId, client);
13392
13392
  accounts.set(accountId, account);
13393
13393
  }
13394
- const groupId = ctx.to ?? ctx.target?.groupId ?? ctx.target?.raw?.groupId;
13394
+ const groupId = resolveOutboundGroupId(ctx);
13395
+ console.log(`[delivery:sendText] ctx.to=${ctx.to}, sessionKey=${ctx.SessionKey ?? ctx.target?.raw?.SessionKey}, conversationLabel=${ctx.target?.raw?.ConversationLabel}, resolved groupId=${groupId}, text=${text?.length ?? 0} chars`);
13395
13396
  if (!groupId) {
13396
13397
  return { ok: false, error: "No groupId in outbound context" };
13397
13398
  }
@@ -13400,6 +13401,7 @@ var quiuboPlugin = {
13400
13401
  return { ok: false, error: "No botIdentityId configured" };
13401
13402
  }
13402
13403
  try {
13404
+ console.log(`[delivery:sendText] calling client.sendMessage(${groupId}, sender=${senderId})`);
13403
13405
  await client.sendMessage(groupId, {
13404
13406
  senderIdentityId: senderId,
13405
13407
  plaintext: text,
@@ -13418,7 +13420,7 @@ var quiuboPlugin = {
13418
13420
  if (ctx.mediaUrl) urls.push(ctx.mediaUrl);
13419
13421
  if (Array.isArray(ctx.mediaUrls)) urls.push(...ctx.mediaUrls);
13420
13422
  const mdAttachments = await readMdAttachments(urls, "agent", void 0, "sendMedia");
13421
- console.log(`[Quiubo:sendMedia] urls=${urls.length}, mdAttachments=${mdAttachments.length} [${mdAttachments.map((a) => a.filename).join(", ")}], media=${Array.isArray(ctx.media) ? ctx.media.length : "no"}`);
13423
+ console.log(`[delivery:sendMedia] urls=${urls.length}, mdAttachments=${mdAttachments.length} [${mdAttachments.map((a) => a.filename).join(", ")}], media=${Array.isArray(ctx.media) ? ctx.media.length : "no"}`);
13422
13424
  const plaintext = text || (mdAttachments.length === 0 ? "[Media attachment]" : "");
13423
13425
  const accountId = ctx.accountId ?? DEFAULT_ACCOUNT_ID;
13424
13426
  let client = clients.get(accountId);
@@ -13434,7 +13436,8 @@ var quiuboPlugin = {
13434
13436
  clients.set(accountId, client);
13435
13437
  accounts.set(accountId, account);
13436
13438
  }
13437
- const groupId = ctx.to ?? ctx.target?.groupId ?? ctx.target?.raw?.groupId;
13439
+ const groupId = resolveOutboundGroupId(ctx);
13440
+ console.log(`[delivery:sendMedia] ctx.to=${ctx.to}, sessionKey=${ctx.SessionKey ?? ctx.target?.raw?.SessionKey}, conversationLabel=${ctx.target?.raw?.ConversationLabel}, resolved groupId=${groupId}`);
13438
13441
  if (!groupId) {
13439
13442
  return { ok: false, error: "No groupId in outbound context" };
13440
13443
  }
@@ -13443,6 +13446,7 @@ var quiuboPlugin = {
13443
13446
  return { ok: false, error: "No botIdentityId configured" };
13444
13447
  }
13445
13448
  try {
13449
+ console.log(`[delivery:sendMedia] calling client.sendMessage(${groupId}, sender=${senderId})`);
13446
13450
  await client.sendMessage(groupId, {
13447
13451
  senderIdentityId: senderId,
13448
13452
  plaintext,
@@ -13818,6 +13822,26 @@ var quiuboPlugin = {
13818
13822
  }
13819
13823
  }
13820
13824
  };
13825
+ function resolveOutboundGroupId(ctx) {
13826
+ const raw = ctx.target?.raw ?? ctx;
13827
+ const label = raw.ConversationLabel ?? ctx.ConversationLabel;
13828
+ if (label) {
13829
+ const id = label.replace(/^quiubo:/i, "").trim();
13830
+ if (id) return id;
13831
+ }
13832
+ const sessionKey = raw.SessionKey ?? ctx.SessionKey;
13833
+ if (sessionKey) {
13834
+ const match = sessionKey.match(/quiubo:([0-9a-f-]{36})/i);
13835
+ if (match) return match[1];
13836
+ }
13837
+ const targetGroupId = ctx.target?.groupId ?? raw.groupId;
13838
+ if (targetGroupId) return targetGroupId;
13839
+ if (ctx.to) {
13840
+ const cleaned = ctx.to.replace(/^quiubo:/i, "").trim();
13841
+ if (cleaned) return cleaned;
13842
+ }
13843
+ return void 0;
13844
+ }
13821
13845
  async function getActivityData(runtime2, log, agentId) {
13822
13846
  try {
13823
13847
  const { readFile: readFile2 } = await import("node:fs/promises");
@@ -13906,7 +13930,7 @@ async function routeInboundMessage(opts) {
13906
13930
  const typingInterval = setInterval(sendTyping, 4e3);
13907
13931
  const agentId = resolveAgentId(cfg, accountId);
13908
13932
  const sessionKey = buildSessionKey(agentId, groupId);
13909
- log?.info?.(`[${accountId}] Quiubo: resolved agentId=${agentId}, sessionKey=${sessionKey}`);
13933
+ log?.info?.(`[${accountId}] [delivery:inbound] agentId=${agentId}, sessionKey=${sessionKey}, To=quiubo:${botIdentityId}, ConversationLabel=quiubo:${groupId}`);
13910
13934
  const ctxPayload = runtime2.channel.reply.finalizeInboundContext({
13911
13935
  Body: text,
13912
13936
  RawBody: text,
@@ -13933,6 +13957,7 @@ async function routeInboundMessage(opts) {
13933
13957
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
13934
13958
  deliver: async (payload, info) => {
13935
13959
  const agentSource = info.kind === "subagent" ? "subagent" : "agent";
13960
+ log?.info?.(`[${accountId}] [delivery:deliver-callback] FIRED for groupId=${groupId} (from closure), kind=${info.kind}, text=${payload.text?.length ?? 0} chars`);
13936
13961
  log?.info?.(`[${accountId}] Quiubo: deliver payload keys=${Object.keys(payload).join(",")}, mediaUrl=${payload.mediaUrl ? "yes" : "no"}, mediaUrls=${Array.isArray(payload.mediaUrls) ? payload.mediaUrls.length : "no"}, media=${Array.isArray(payload.media) ? payload.media.length : "no"}, text=${payload.text?.length ?? 0} chars`);
13937
13962
  if (Array.isArray(payload.media)) {
13938
13963
  for (const m of payload.media) {