openclaw-quiubo 2.4.0 → 2.5.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
@@ -12568,6 +12568,11 @@ var RealtimeGateway = class {
12568
12568
  return false;
12569
12569
  }
12570
12570
  if (config.source === "directory") {
12571
+ if (eventData?.fromPusher) return true;
12572
+ if (eventData?.plaintext && !this.matchesMention(eventData.plaintext, config)) {
12573
+ this.log.debug?.(`Skipping polled message in ${groupId}: no @mention`);
12574
+ return false;
12575
+ }
12571
12576
  return true;
12572
12577
  }
12573
12578
  const securityMode = config.securityMode ?? eventData?.groupSecurityMode ?? "PLAINTEXT_SDK";
@@ -12664,6 +12669,12 @@ var RealtimeGateway = class {
12664
12669
  log.warn?.("Pusher disconnected \u2014 falling back to polling");
12665
12670
  if (!this.stopped) this.startPolling();
12666
12671
  });
12672
+ this.pusherClient.connection.bind("unavailable", () => {
12673
+ this.pusherConnected = false;
12674
+ this.stopHeartbeat();
12675
+ log.warn?.("Pusher unavailable \u2014 falling back to polling");
12676
+ if (!this.stopped) this.startPolling();
12677
+ });
12667
12678
  this.pusherClient.connection.bind("error", (error) => {
12668
12679
  log.error?.("Pusher error:", error);
12669
12680
  });
@@ -12676,6 +12687,12 @@ var RealtimeGateway = class {
12676
12687
  log.error?.(`Failed to subscribe to ${channelName}:`, error);
12677
12688
  if (!this.stopped) this.startPolling();
12678
12689
  });
12690
+ setTimeout(() => {
12691
+ if (!this.pusherConnected && !this.stopped) {
12692
+ log.warn?.("Pusher connection timeout (15s) \u2014 starting polling as fallback");
12693
+ this.startPolling();
12694
+ }
12695
+ }, 15e3);
12679
12696
  channel.bind("openclaw:request", (data) => {
12680
12697
  log.info?.("openclaw:request received:", JSON.stringify(data));
12681
12698
  const type = data.type;
@@ -12722,14 +12739,13 @@ var RealtimeGateway = class {
12722
12739
  }
12723
12740
  });
12724
12741
  channel.bind("agent:group-added", (data) => {
12725
- log.info?.(`agent:group-added for group ${data.groupId} (${data.groupName}) triggerMode=${data.triggerMode}`);
12742
+ log.info?.(`agent:group-added for group ${data.groupId} (${data.groupName})`);
12726
12743
  this.botConfigCache.set(data.groupId, {
12727
12744
  enabled: true,
12728
12745
  suppressionMinutes: 10,
12729
12746
  ownerIdentityId: "",
12730
12747
  groupType: data.groupType,
12731
12748
  grantedScopes: data.grantedScopes,
12732
- triggerMode: data.triggerMode,
12733
12749
  source: "directory",
12734
12750
  agentDisplayName: this.agentDisplayName ?? void 0,
12735
12751
  securityMode: data.securityMode
@@ -12743,6 +12759,7 @@ var RealtimeGateway = class {
12743
12759
  log.info?.(`Pusher event: messageId=${data.messageId} groupId=${data.groupId} sender=${data.senderUsername} plaintext=${!!data.plaintext}`);
12744
12760
  if (data.senderId === this.botIdentityId) return;
12745
12761
  this.shouldProcessMessage(data.groupId, data.senderId, {
12762
+ fromPusher: true,
12746
12763
  groupSecurityMode: data.groupSecurityMode,
12747
12764
  groupOwnerIdentityId: data.groupOwnerIdentityId,
12748
12765
  groupType: data.groupType,
@@ -12872,8 +12889,14 @@ var RealtimeGateway = class {
12872
12889
  });
12873
12890
  }
12874
12891
  }
12892
+ const groupIds = new Set(groups.map((g) => g.id));
12893
+ for (const [gid, config] of this.botConfigCache) {
12894
+ if (config.source === "directory" && config.enabled) {
12895
+ groupIds.add(gid);
12896
+ }
12897
+ }
12875
12898
  await Promise.allSettled(
12876
- groups.map((group) => this.pollGroup(group.id))
12899
+ [...groupIds].map((gid) => this.pollGroup(gid))
12877
12900
  );
12878
12901
  } catch (error) {
12879
12902
  this.log.error?.("Poll cycle failed:", error);
@@ -12906,7 +12929,7 @@ var RealtimeGateway = class {
12906
12929
  }
12907
12930
  }
12908
12931
  if (!plaintext) continue;
12909
- const shouldProcess = await this.shouldProcessMessage(groupId, msg.senderIdentityId);
12932
+ const shouldProcess = await this.shouldProcessMessage(groupId, msg.senderIdentityId, { plaintext });
12910
12933
  if (!shouldProcess) continue;
12911
12934
  try {
12912
12935
  await this.onMessage({
@@ -13627,7 +13650,6 @@ var quiuboPlugin = {
13627
13650
  suppressionMinutes: 10,
13628
13651
  ownerIdentityId: "",
13629
13652
  groupType: group.groupType ?? "standard",
13630
- triggerMode: status.triggerMode,
13631
13653
  source: "directory",
13632
13654
  grantedScopes: status.grantedScopes,
13633
13655
  agentDisplayName: resolvedAgentDisplayName
@@ -13648,7 +13670,6 @@ var quiuboPlugin = {
13648
13670
  suppressionMinutes: 10,
13649
13671
  ownerIdentityId: "",
13650
13672
  groupType: "standard",
13651
- triggerMode: status.triggerMode,
13652
13673
  source: "directory",
13653
13674
  grantedScopes: status.grantedScopes,
13654
13675
  agentDisplayName: resolvedAgentDisplayName
@@ -13709,13 +13730,12 @@ var quiuboPlugin = {
13709
13730
  log?.info?.(`[${accountId}] Quiubo: listAgentGroups returned ${agentGroups.length} group(s): ${agentGroups.map((g) => `${g.groupId}(${g.source})`).join(", ")}`);
13710
13731
  for (const ag of agentGroups) {
13711
13732
  if (ag.source === "directory") {
13712
- log?.info?.(`[${accountId}] Quiubo: hydrating directory group ${ag.groupId} (${ag.name}) triggerMode=${ag.triggerMode} enabled=${ag.enabled}`);
13733
+ log?.info?.(`[${accountId}] Quiubo: hydrating directory group ${ag.groupId} (${ag.name}) enabled=${ag.enabled}`);
13713
13734
  gateway.setBotConfig(ag.groupId, {
13714
13735
  enabled: ag.enabled ?? true,
13715
13736
  suppressionMinutes: 10,
13716
13737
  ownerIdentityId: "",
13717
13738
  groupType: ag.groupType ?? "standard",
13718
- triggerMode: ag.triggerMode,
13719
13739
  source: "directory",
13720
13740
  grantedScopes: ag.grantedScopes,
13721
13741
  agentDisplayName: ag.agentDisplayName ?? resolvedAgentDisplayName,