@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.cjs CHANGED
@@ -696,6 +696,8 @@ var SKIP_PATTERNS = [
696
696
  /^\[HEARTBEAT/m,
697
697
  /^\[Someone left you a voice message\]/m
698
698
  ];
699
+ var OPENCLAW_SENDER_PATTERN = /"sender_id":\s*"([^"]+)".*?"sender":\s*"([^"]+)"/s;
700
+ var OPENCLAW_SKIP_SENDERS = /* @__PURE__ */ new Set(["city", "owner", "system"]);
699
701
  function detectAgentConversation(messages) {
700
702
  const negative = { isAgentToAgent: false };
701
703
  if (!messages || messages.length === 0) return negative;
@@ -704,6 +706,25 @@ function detectAgentConversation(messages) {
704
706
  const content = contentToString(msg.content);
705
707
  if (!content) continue;
706
708
  if (SKIP_PATTERNS.some((p) => p.test(content))) continue;
709
+ if (content.includes("untrusted metadata") || content.includes("sender_id")) {
710
+ const senderMatch = content.match(OPENCLAW_SENDER_PATTERN);
711
+ if (senderMatch) {
712
+ const [, senderId, senderName] = senderMatch;
713
+ if (!OPENCLAW_SKIP_SENDERS.has(senderId) && !OPENCLAW_SKIP_SENDERS.has(senderName.toLowerCase())) {
714
+ let exchangeType = "chat";
715
+ if (content.includes("[DM from")) exchangeType = "dm";
716
+ else if (content.includes("mentioned you")) exchangeType = "mention";
717
+ else if (content.includes("proposal")) exchangeType = "proposal";
718
+ else if (content.includes("zone chat")) exchangeType = "chat";
719
+ return {
720
+ isAgentToAgent: true,
721
+ otherAgentId: senderName,
722
+ exchangeType
723
+ };
724
+ }
725
+ }
726
+ continue;
727
+ }
707
728
  if (msg.name && msg.role === "user") {
708
729
  return {
709
730
  isAgentToAgent: true,
@@ -975,7 +996,6 @@ function createProxyServer(config, analyzer, overrideUpstreamUrl) {
975
996
  }
976
997
  if (config.auto_extract && extractor && Array.isArray(messages)) {
977
998
  extractor.extract(messages).then(() => {
978
- stats.lessons_extracted++;
979
999
  }).catch(() => {
980
1000
  });
981
1001
  }
@@ -984,7 +1004,6 @@ function createProxyServer(config, analyzer, overrideUpstreamUrl) {
984
1004
  res.end(Buffer.from(responseBuffer));
985
1005
  if (config.auto_extract && extractor && Array.isArray(messages)) {
986
1006
  extractor.extract(messages).then(() => {
987
- stats.lessons_extracted++;
988
1007
  }).catch(() => {
989
1008
  });
990
1009
  }