openclaw-quiubo 2.6.5 → 2.6.9

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
@@ -12599,12 +12599,13 @@ var RealtimeGateway = class {
12599
12599
  */
12600
12600
  async start() {
12601
12601
  this.stopped = false;
12602
+ console.log(`[gw:start] botIdentityId=${this.botIdentityId} pusher=${!!this.pusherConfig} agentId=${this.agentId}`);
12603
+ this.startPolling();
12604
+ if (this.agentId) this.startHeartbeat();
12602
12605
  if (this.pusherConfig) {
12603
12606
  await this.startPusher();
12604
12607
  } else {
12605
- this.log.info?.("No Pusher config \u2014 using polling only");
12606
- this.startPolling();
12607
- if (this.agentId) this.startHeartbeat();
12608
+ console.log("[gw:start] No Pusher config \u2014 polling only");
12608
12609
  }
12609
12610
  }
12610
12611
  /**
@@ -12638,6 +12639,8 @@ var RealtimeGateway = class {
12638
12639
  // ── Pusher ──────────────────────────────────────────────────────
12639
12640
  async startPusher() {
12640
12641
  if (!this.pusherConfig) return;
12642
+ console.log(`[gw:startPusher] botIdentityId=${this.botIdentityId} key=${this.pusherConfig.key} cluster=${this.pusherConfig.cluster}`);
12643
+ this.log.info?.(`[gateway] startPusher called for botIdentityId=${this.botIdentityId}`);
12641
12644
  const { key, cluster } = this.pusherConfig;
12642
12645
  const apiClient = this.client;
12643
12646
  const botIdentityId = this.botIdentityId;
@@ -12658,12 +12661,13 @@ var RealtimeGateway = class {
12658
12661
  })
12659
12662
  });
12660
12663
  this.pusherClient.connection.bind("state_change", (states) => {
12664
+ console.log(`[gw:pusher] state: ${states.previous} \u2192 ${states.current}`);
12661
12665
  log.info?.(`Pusher state: ${states.previous} \u2192 ${states.current}`);
12662
12666
  });
12663
12667
  this.pusherClient.connection.bind("connected", () => {
12664
12668
  this.pusherConnected = true;
12665
- log.info?.("Pusher connected");
12666
- this.stopPolling();
12669
+ console.log("[gw:pusher] connected");
12670
+ log.info?.("Pusher connected (polling continues as safety net)");
12667
12671
  if (this.agentId) this.startHeartbeat();
12668
12672
  });
12669
12673
  this.pusherClient.connection.bind("disconnected", () => {
@@ -12759,11 +12763,11 @@ var RealtimeGateway = class {
12759
12763
  this.botConfigCache.delete(data.groupId);
12760
12764
  });
12761
12765
  channel.bind_global((eventName, data) => {
12762
- if (eventName.startsWith("pusher:") || eventName.startsWith("pusher_")) return;
12763
- log.info?.(`[pusher:raw] event=${eventName} data=${JSON.stringify(data).slice(0, 300)}`);
12766
+ console.log(`[gw:pusher:raw] event=${eventName} data=${JSON.stringify(data).slice(0, 200)}`);
12764
12767
  });
12765
12768
  channel.bind("new-group-message", (data) => {
12766
- log.info?.(`Pusher event: messageId=${data.messageId} groupId=${data.groupId} sender=${data.senderUsername} plaintext=${!!data.plaintext}`);
12769
+ console.log(`[gw:pusher:msg] messageId=${data.messageId} groupId=${data.groupId} sender=${data.senderUsername} plaintext=${!!data.plaintext} ciphertext=${!!data.ciphertext}`);
12770
+ log.info?.(`Pusher event: messageId=${data.messageId} groupId=${data.groupId} sender=${data.senderUsername} plaintext=${!!data.plaintext} ciphertext=${!!data.ciphertext} botId=${this.botIdentityId}`);
12767
12771
  if (data.senderId === this.botIdentityId) return;
12768
12772
  this.shouldProcessMessage(data.groupId, data.senderId, {
12769
12773
  fromPusher: true,
@@ -12790,15 +12794,19 @@ var RealtimeGateway = class {
12790
12794
  return;
12791
12795
  }
12792
12796
  if (data.ciphertext && this.keyManager) {
12797
+ log.info?.(`[e2ee:pusher] group=${data.groupId} msg=${data.messageId} ciphertext=${data.ciphertext.length} chars, attempting decrypt`);
12793
12798
  const epoch = parseGroupEnvelopeEpoch(data.ciphertext);
12799
+ log.info?.(`[e2ee:pusher] group=${data.groupId} parsed epoch=${epoch}`);
12794
12800
  if (epoch !== null) {
12795
12801
  this.keyManager.getEpochKey(data.groupId, epoch).then((cached) => {
12796
12802
  if (!cached) {
12797
- log.warn?.(`No epoch key for group=${data.groupId} epoch=${epoch}, skipping`);
12803
+ log.warn?.(`[e2ee:pusher] No epoch key for group=${data.groupId} epoch=${epoch}, skipping`);
12798
12804
  return;
12799
12805
  }
12806
+ log.info?.(`[e2ee:pusher] group=${data.groupId} got epoch key, decrypting...`);
12800
12807
  try {
12801
12808
  const plaintext = decryptGroupMessage(data.ciphertext, cached.key);
12809
+ log.info?.(`[e2ee:pusher] group=${data.groupId} decrypted OK: ${plaintext?.length} chars \u2014 routing to onMessage`);
12802
12810
  this.cursors.set(data.groupId, data.messageId);
12803
12811
  return Promise.resolve(this.onMessage({
12804
12812
  messageId: data.messageId,
@@ -12809,13 +12817,17 @@ var RealtimeGateway = class {
12809
12817
  createdAt: data.createdAt
12810
12818
  }));
12811
12819
  } catch (decErr) {
12812
- log.error?.(`Decryption failed for message ${data.messageId}: ${decErr}`);
12820
+ log.error?.(`[e2ee:pusher] Decryption failed for message ${data.messageId} in group ${data.groupId}: ${decErr}`);
12813
12821
  }
12814
12822
  }).catch((err) => {
12815
- log.error?.(`Key fetch failed for message ${data.messageId}: ${err}`);
12823
+ log.error?.(`[e2ee:pusher] Key fetch failed for message ${data.messageId} in group ${data.groupId}: ${err}`);
12816
12824
  });
12817
12825
  return;
12826
+ } else {
12827
+ log.warn?.(`[e2ee:pusher] group=${data.groupId} parseGroupEnvelopeEpoch returned null \u2014 falling through to fetchAndRoute`);
12818
12828
  }
12829
+ } else {
12830
+ log.info?.(`[e2ee:pusher] group=${data.groupId} no ciphertext or no keyManager \u2014 falling through (ciphertext=${!!data.ciphertext}, keyManager=${!!this.keyManager})`);
12819
12831
  }
12820
12832
  this.fetchAndRouteMessage(data.groupId, data.messageId);
12821
12833
  }).catch((err) => {
@@ -12868,7 +12880,8 @@ var RealtimeGateway = class {
12868
12880
  // ── Polling (fallback) ──────────────────────────────────────────
12869
12881
  startPolling() {
12870
12882
  if (this.pollTimer) return;
12871
- this.log.info?.(`Polling started (every ${this.pollIntervalMs}ms)`);
12883
+ console.log(`[gw:startPolling] botIdentityId=${this.botIdentityId} interval=${this.pollIntervalMs}ms`);
12884
+ this.log.info?.(`[gateway] startPolling called for botIdentityId=${this.botIdentityId}`);
12872
12885
  this.poll();
12873
12886
  this.pollTimer = setInterval(() => this.poll(), this.pollIntervalMs);
12874
12887
  }
@@ -12879,11 +12892,12 @@ var RealtimeGateway = class {
12879
12892
  }
12880
12893
  }
12881
12894
  async poll() {
12882
- if (this.polling || this.pusherConnected) return;
12895
+ if (this.polling) return;
12883
12896
  this.polling = true;
12884
12897
  try {
12885
12898
  this.clearStaleSuppression();
12886
12899
  const { groups } = await this.client.listGroups(this.botIdentityId);
12900
+ console.log(`[gw:poll] listGroups returned ${groups.length} groups, botConfigCache has ${this.botConfigCache.size} entries`);
12887
12901
  for (const group of groups) {
12888
12902
  if (!this.botConfigCache.has(group.id) && group.settings) {
12889
12903
  const botSettings = group.settings?.bot ?? {};
@@ -12914,6 +12928,7 @@ var RealtimeGateway = class {
12914
12928
  async pollGroup(groupId) {
12915
12929
  try {
12916
12930
  const cursor = this.cursors.get(groupId);
12931
+ console.log(`[gw:pollGroup] group=${groupId} cursor=${cursor ?? "none"}`);
12917
12932
  const { messages } = await this.client.listMessages(groupId, cursor);
12918
12933
  if (messages.length === 0) return;
12919
12934
  const lastMessage = messages[messages.length - 1];
@@ -12937,8 +12952,12 @@ var RealtimeGateway = class {
12937
12952
  }
12938
12953
  if (!plaintext) continue;
12939
12954
  const shouldProcess = await this.shouldProcessMessage(groupId, msg.senderIdentityId, { plaintext });
12940
- if (!shouldProcess) continue;
12955
+ if (!shouldProcess) {
12956
+ console.log(`[gw:pollGroup] skipping msg=${msg.id} in group=${groupId} (shouldProcess=false)`);
12957
+ continue;
12958
+ }
12941
12959
  try {
12960
+ console.log(`[gw:pollGroup] dispatching msg=${msg.id} group=${groupId} text=${plaintext?.slice(0, 60)}`);
12942
12961
  await this.onMessage({
12943
12962
  messageId: msg.id,
12944
12963
  groupId,