@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/index.cjs CHANGED
@@ -3269,6 +3269,8 @@ var SKIP_PATTERNS = [
3269
3269
  /^\[HEARTBEAT/m,
3270
3270
  /^\[Someone left you a voice message\]/m
3271
3271
  ];
3272
+ var OPENCLAW_SENDER_PATTERN = /"sender_id":\s*"([^"]+)".*?"sender":\s*"([^"]+)"/s;
3273
+ var OPENCLAW_SKIP_SENDERS = /* @__PURE__ */ new Set(["city", "owner", "system"]);
3272
3274
  function detectAgentConversation(messages) {
3273
3275
  const negative = { isAgentToAgent: false };
3274
3276
  if (!messages || messages.length === 0) return negative;
@@ -3277,6 +3279,25 @@ function detectAgentConversation(messages) {
3277
3279
  const content = contentToString(msg.content);
3278
3280
  if (!content) continue;
3279
3281
  if (SKIP_PATTERNS.some((p) => p.test(content))) continue;
3282
+ if (content.includes("untrusted metadata") || content.includes("sender_id")) {
3283
+ const senderMatch = content.match(OPENCLAW_SENDER_PATTERN);
3284
+ if (senderMatch) {
3285
+ const [, senderId, senderName] = senderMatch;
3286
+ if (!OPENCLAW_SKIP_SENDERS.has(senderId) && !OPENCLAW_SKIP_SENDERS.has(senderName.toLowerCase())) {
3287
+ let exchangeType = "chat";
3288
+ if (content.includes("[DM from")) exchangeType = "dm";
3289
+ else if (content.includes("mentioned you")) exchangeType = "mention";
3290
+ else if (content.includes("proposal")) exchangeType = "proposal";
3291
+ else if (content.includes("zone chat")) exchangeType = "chat";
3292
+ return {
3293
+ isAgentToAgent: true,
3294
+ otherAgentId: senderName,
3295
+ exchangeType
3296
+ };
3297
+ }
3298
+ }
3299
+ continue;
3300
+ }
3280
3301
  if (msg.name && msg.role === "user") {
3281
3302
  return {
3282
3303
  isAgentToAgent: true,
@@ -3548,7 +3569,6 @@ function createProxyServer(config, analyzer, overrideUpstreamUrl) {
3548
3569
  }
3549
3570
  if (config.auto_extract && extractor && Array.isArray(messages)) {
3550
3571
  extractor.extract(messages).then(() => {
3551
- stats.lessons_extracted++;
3552
3572
  }).catch(() => {
3553
3573
  });
3554
3574
  }
@@ -3557,7 +3577,6 @@ function createProxyServer(config, analyzer, overrideUpstreamUrl) {
3557
3577
  res.end(Buffer.from(responseBuffer));
3558
3578
  if (config.auto_extract && extractor && Array.isArray(messages)) {
3559
3579
  extractor.extract(messages).then(() => {
3560
- stats.lessons_extracted++;
3561
3580
  }).catch(() => {
3562
3581
  });
3563
3582
  }