openclaw-quiubo 2.4.0 → 2.5.2

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";
@@ -12652,6 +12657,9 @@ var RealtimeGateway = class {
12652
12657
  }
12653
12658
  })
12654
12659
  });
12660
+ this.pusherClient.connection.bind("state_change", (states) => {
12661
+ log.info?.(`Pusher state: ${states.previous} \u2192 ${states.current}`);
12662
+ });
12655
12663
  this.pusherClient.connection.bind("connected", () => {
12656
12664
  this.pusherConnected = true;
12657
12665
  log.info?.("Pusher connected");
@@ -12664,6 +12672,12 @@ var RealtimeGateway = class {
12664
12672
  log.warn?.("Pusher disconnected \u2014 falling back to polling");
12665
12673
  if (!this.stopped) this.startPolling();
12666
12674
  });
12675
+ this.pusherClient.connection.bind("unavailable", () => {
12676
+ this.pusherConnected = false;
12677
+ this.stopHeartbeat();
12678
+ log.warn?.("Pusher unavailable \u2014 falling back to polling");
12679
+ if (!this.stopped) this.startPolling();
12680
+ });
12667
12681
  this.pusherClient.connection.bind("error", (error) => {
12668
12682
  log.error?.("Pusher error:", error);
12669
12683
  });
@@ -12676,6 +12690,12 @@ var RealtimeGateway = class {
12676
12690
  log.error?.(`Failed to subscribe to ${channelName}:`, error);
12677
12691
  if (!this.stopped) this.startPolling();
12678
12692
  });
12693
+ setTimeout(() => {
12694
+ if (!this.pusherConnected && !this.stopped) {
12695
+ log.warn?.("Pusher connection timeout (15s) \u2014 starting polling as fallback");
12696
+ this.startPolling();
12697
+ }
12698
+ }, 15e3);
12679
12699
  channel.bind("openclaw:request", (data) => {
12680
12700
  log.info?.("openclaw:request received:", JSON.stringify(data));
12681
12701
  const type = data.type;
@@ -12722,14 +12742,13 @@ var RealtimeGateway = class {
12722
12742
  }
12723
12743
  });
12724
12744
  channel.bind("agent:group-added", (data) => {
12725
- log.info?.(`agent:group-added for group ${data.groupId} (${data.groupName}) triggerMode=${data.triggerMode}`);
12745
+ log.info?.(`agent:group-added for group ${data.groupId} (${data.groupName})`);
12726
12746
  this.botConfigCache.set(data.groupId, {
12727
12747
  enabled: true,
12728
12748
  suppressionMinutes: 10,
12729
12749
  ownerIdentityId: "",
12730
12750
  groupType: data.groupType,
12731
12751
  grantedScopes: data.grantedScopes,
12732
- triggerMode: data.triggerMode,
12733
12752
  source: "directory",
12734
12753
  agentDisplayName: this.agentDisplayName ?? void 0,
12735
12754
  securityMode: data.securityMode
@@ -12743,6 +12762,7 @@ var RealtimeGateway = class {
12743
12762
  log.info?.(`Pusher event: messageId=${data.messageId} groupId=${data.groupId} sender=${data.senderUsername} plaintext=${!!data.plaintext}`);
12744
12763
  if (data.senderId === this.botIdentityId) return;
12745
12764
  this.shouldProcessMessage(data.groupId, data.senderId, {
12765
+ fromPusher: true,
12746
12766
  groupSecurityMode: data.groupSecurityMode,
12747
12767
  groupOwnerIdentityId: data.groupOwnerIdentityId,
12748
12768
  groupType: data.groupType,
@@ -12872,8 +12892,14 @@ var RealtimeGateway = class {
12872
12892
  });
12873
12893
  }
12874
12894
  }
12895
+ const groupIds = new Set(groups.map((g) => g.id));
12896
+ for (const [gid, config] of this.botConfigCache) {
12897
+ if (config.source === "directory" && config.enabled) {
12898
+ groupIds.add(gid);
12899
+ }
12900
+ }
12875
12901
  await Promise.allSettled(
12876
- groups.map((group) => this.pollGroup(group.id))
12902
+ [...groupIds].map((gid) => this.pollGroup(gid))
12877
12903
  );
12878
12904
  } catch (error) {
12879
12905
  this.log.error?.("Poll cycle failed:", error);
@@ -12906,7 +12932,7 @@ var RealtimeGateway = class {
12906
12932
  }
12907
12933
  }
12908
12934
  if (!plaintext) continue;
12909
- const shouldProcess = await this.shouldProcessMessage(groupId, msg.senderIdentityId);
12935
+ const shouldProcess = await this.shouldProcessMessage(groupId, msg.senderIdentityId, { plaintext });
12910
12936
  if (!shouldProcess) continue;
12911
12937
  try {
12912
12938
  await this.onMessage({
@@ -13627,7 +13653,6 @@ var quiuboPlugin = {
13627
13653
  suppressionMinutes: 10,
13628
13654
  ownerIdentityId: "",
13629
13655
  groupType: group.groupType ?? "standard",
13630
- triggerMode: status.triggerMode,
13631
13656
  source: "directory",
13632
13657
  grantedScopes: status.grantedScopes,
13633
13658
  agentDisplayName: resolvedAgentDisplayName
@@ -13648,7 +13673,6 @@ var quiuboPlugin = {
13648
13673
  suppressionMinutes: 10,
13649
13674
  ownerIdentityId: "",
13650
13675
  groupType: "standard",
13651
- triggerMode: status.triggerMode,
13652
13676
  source: "directory",
13653
13677
  grantedScopes: status.grantedScopes,
13654
13678
  agentDisplayName: resolvedAgentDisplayName
@@ -13709,13 +13733,12 @@ var quiuboPlugin = {
13709
13733
  log?.info?.(`[${accountId}] Quiubo: listAgentGroups returned ${agentGroups.length} group(s): ${agentGroups.map((g) => `${g.groupId}(${g.source})`).join(", ")}`);
13710
13734
  for (const ag of agentGroups) {
13711
13735
  if (ag.source === "directory") {
13712
- log?.info?.(`[${accountId}] Quiubo: hydrating directory group ${ag.groupId} (${ag.name}) triggerMode=${ag.triggerMode} enabled=${ag.enabled}`);
13736
+ log?.info?.(`[${accountId}] Quiubo: hydrating directory group ${ag.groupId} (${ag.name}) enabled=${ag.enabled}`);
13713
13737
  gateway.setBotConfig(ag.groupId, {
13714
13738
  enabled: ag.enabled ?? true,
13715
13739
  suppressionMinutes: 10,
13716
13740
  ownerIdentityId: "",
13717
13741
  groupType: ag.groupType ?? "standard",
13718
- triggerMode: ag.triggerMode,
13719
13742
  source: "directory",
13720
13743
  grantedScopes: ag.grantedScopes,
13721
13744
  agentDisplayName: ag.agentDisplayName ?? resolvedAgentDisplayName,