natureco-cli 5.6.38 → 5.6.40
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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "natureco-cli",
|
|
3
|
-
"version": "5.6.
|
|
3
|
+
"version": "5.6.40",
|
|
4
4
|
"description": "OpenClaw'dan daha güvenli, daha hızlı, daha ucuz AI agent CLI. Multi-agent, self-evolving skills, audit log, maliyet optimizasyonu ve NatureCo platform-native.",
|
|
5
5
|
"bin": {
|
|
6
6
|
"natureco": "bin/natureco.js"
|
|
@@ -1476,19 +1476,38 @@ function findImsgBin() {
|
|
|
1476
1476
|
return null;
|
|
1477
1477
|
}
|
|
1478
1478
|
|
|
1479
|
+
// Track recent outgoing messages to prevent loops
|
|
1480
|
+
const recentOutgoingMessages = new Map(); // sender -> [{text, timestamp}, ...]
|
|
1481
|
+
|
|
1479
1482
|
async function processImessageMessage(msg, config) {
|
|
1480
1483
|
try {
|
|
1481
1484
|
// Deduplicate
|
|
1482
1485
|
if (msg.id && msg.id === imessageLastMessageId) return;
|
|
1483
1486
|
if (msg.id) imessageLastMessageId = msg.id;
|
|
1484
1487
|
|
|
1485
|
-
// Skip outgoing messages
|
|
1486
|
-
if (msg.is_from_me || msg.from_me)
|
|
1488
|
+
// v5.6.39: Skip outgoing messages - TÜM olası field adlarını kontrol et
|
|
1489
|
+
if (msg.is_from_me || msg.isFromMe || msg.from_me || msg.fromMe) {
|
|
1490
|
+
log('imessage', `Skipping own message (is_from_me=true)`, 'gray');
|
|
1491
|
+
return;
|
|
1492
|
+
}
|
|
1487
1493
|
|
|
1488
|
-
const sender = msg.sender || msg.from || msg.address || '';
|
|
1489
|
-
const text = msg.text || msg.message || '';
|
|
1494
|
+
const sender = msg.sender || msg.from || msg.address || msg.handle || '';
|
|
1495
|
+
const text = msg.text || msg.message || msg.body || '';
|
|
1490
1496
|
|
|
1491
1497
|
if (!text.trim() || !sender) return;
|
|
1498
|
+
if (sender === 'me' || sender === 'self') return;
|
|
1499
|
+
|
|
1500
|
+
// v5.6.40: Loop prevention - son gönderdiğimiz mesajla aynıysa skip
|
|
1501
|
+
const recentOut = recentOutgoingMessages.get(sender) || [];
|
|
1502
|
+
const now = Date.now();
|
|
1503
|
+
// 30 saniye içinde aynı mesajı gönderdiysek, bu bize gelen mesaj değil (echo)
|
|
1504
|
+
const isEcho = recentOut.some(m =>
|
|
1505
|
+
m.text === text && (now - m.timestamp) < 30000
|
|
1506
|
+
);
|
|
1507
|
+
if (isEcho) {
|
|
1508
|
+
log('imessage', `Skipping echo of our own message to ${sender}`, 'gray');
|
|
1509
|
+
return;
|
|
1510
|
+
}
|
|
1492
1511
|
|
|
1493
1512
|
log('imessage', `Inbound from ${sender}: "${text.slice(0, 80)}"`, 'cyan');
|
|
1494
1513
|
|
|
@@ -1515,6 +1534,13 @@ async function processImessageMessage(msg, config) {
|
|
|
1515
1534
|
timeout: 15000, stdio: 'pipe',
|
|
1516
1535
|
});
|
|
1517
1536
|
log('imessage', `Reply sent to ${sender} (${reply.length} chars)`, 'green');
|
|
1537
|
+
|
|
1538
|
+
// v5.6.40: Track outgoing message for loop prevention
|
|
1539
|
+
const senderHistory = recentOutgoingMessages.get(sender) || [];
|
|
1540
|
+
senderHistory.push({ text: reply, timestamp: Date.now() });
|
|
1541
|
+
// Keep only last 5 messages
|
|
1542
|
+
if (senderHistory.length > 5) senderHistory.shift();
|
|
1543
|
+
recentOutgoingMessages.set(sender, senderHistory);
|
|
1518
1544
|
}
|
|
1519
1545
|
} catch (err) {
|
|
1520
1546
|
log('imessage', `Message error: ${err.message}`, 'red');
|