@openclawcity/become 1.0.28 → 1.0.29

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/cli.js CHANGED
@@ -657,6 +657,8 @@ var SKIP_PATTERNS = [
657
657
  /^\[HEARTBEAT/m,
658
658
  /^\[Someone left you a voice message\]/m
659
659
  ];
660
+ var OPENCLAW_SENDER_PATTERN = /"sender_id":\s*"([^"]+)".*?"sender":\s*"([^"]+)"/s;
661
+ var OPENCLAW_SKIP_SENDERS = /* @__PURE__ */ new Set(["city", "owner", "system"]);
660
662
  function detectAgentConversation(messages) {
661
663
  const negative = { isAgentToAgent: false };
662
664
  if (!messages || messages.length === 0) return negative;
@@ -665,6 +667,25 @@ function detectAgentConversation(messages) {
665
667
  const content = contentToString(msg.content);
666
668
  if (!content) continue;
667
669
  if (SKIP_PATTERNS.some((p) => p.test(content))) continue;
670
+ if (content.includes("untrusted metadata") || content.includes("sender_id")) {
671
+ const senderMatch = content.match(OPENCLAW_SENDER_PATTERN);
672
+ if (senderMatch) {
673
+ const [, senderId, senderName] = senderMatch;
674
+ if (!OPENCLAW_SKIP_SENDERS.has(senderId) && !OPENCLAW_SKIP_SENDERS.has(senderName.toLowerCase())) {
675
+ let exchangeType = "chat";
676
+ if (content.includes("[DM from")) exchangeType = "dm";
677
+ else if (content.includes("mentioned you")) exchangeType = "mention";
678
+ else if (content.includes("proposal")) exchangeType = "proposal";
679
+ else if (content.includes("zone chat")) exchangeType = "chat";
680
+ return {
681
+ isAgentToAgent: true,
682
+ otherAgentId: senderName,
683
+ exchangeType
684
+ };
685
+ }
686
+ }
687
+ continue;
688
+ }
668
689
  if (msg.name && msg.role === "user") {
669
690
  return {
670
691
  isAgentToAgent: true,
@@ -936,7 +957,6 @@ function createProxyServer(config, analyzer, overrideUpstreamUrl) {
936
957
  }
937
958
  if (config.auto_extract && extractor && Array.isArray(messages)) {
938
959
  extractor.extract(messages).then(() => {
939
- stats.lessons_extracted++;
940
960
  }).catch(() => {
941
961
  });
942
962
  }
@@ -945,7 +965,6 @@ function createProxyServer(config, analyzer, overrideUpstreamUrl) {
945
965
  res.end(Buffer.from(responseBuffer));
946
966
  if (config.auto_extract && extractor && Array.isArray(messages)) {
947
967
  extractor.extract(messages).then(() => {
948
- stats.lessons_extracted++;
949
968
  }).catch(() => {
950
969
  });
951
970
  }