natureco-cli 5.6.28 → 5.6.30
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.30",
|
|
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"
|
|
@@ -1398,23 +1398,71 @@ async function startImessageProvider(config) {
|
|
|
1398
1398
|
log('imessage', `using imsg: ${imsgPath}`, 'gray');
|
|
1399
1399
|
global.imessageProvider = { imsgPath };
|
|
1400
1400
|
|
|
1401
|
-
//
|
|
1401
|
+
// v5.6.28: imsg 0.11.1'de 'messages' komutu YOK, 'watch' kullan
|
|
1402
|
+
// watch komutu stream olarak yeni mesajlari verir (JSONL formati)
|
|
1403
|
+
try {
|
|
1404
|
+
const watch = spawn(imsgPath, ['watch', '--format', 'json'], {
|
|
1405
|
+
stdio: ['ignore', 'pipe', 'pipe']
|
|
1406
|
+
});
|
|
1407
|
+
|
|
1408
|
+
watch.stdout.on('data', (data) => {
|
|
1409
|
+
const lines = data.toString().split('\n').filter(Boolean);
|
|
1410
|
+
for (const line of lines) {
|
|
1411
|
+
try {
|
|
1412
|
+
const msg = JSON.parse(line);
|
|
1413
|
+
processImessageMessage(msg, config);
|
|
1414
|
+
} catch {}
|
|
1415
|
+
}
|
|
1416
|
+
});
|
|
1417
|
+
|
|
1418
|
+
watch.stderr.on('data', (data) => {
|
|
1419
|
+
// Hata logla ama durdurma
|
|
1420
|
+
// log('imessage', `watch stderr: ${data.toString().trim()}`, 'yellow');
|
|
1421
|
+
});
|
|
1422
|
+
|
|
1423
|
+
watch.on('error', (e) => {
|
|
1424
|
+
log('imessage', `watch error: ${e.message}, falling back to history polling`, 'yellow');
|
|
1425
|
+
startImessagePollingFallback(imsgPath, config);
|
|
1426
|
+
});
|
|
1427
|
+
|
|
1428
|
+
watch.on('exit', (code) => {
|
|
1429
|
+
log('imessage', `watch exited with code ${code}, restarting in 5s`, 'yellow');
|
|
1430
|
+
setTimeout(() => startImessageProvider(config), 5000);
|
|
1431
|
+
});
|
|
1432
|
+
|
|
1433
|
+
global.imessageProvider.watch = watch;
|
|
1434
|
+
log('imessage', 'watching for new messages (streaming)', 'green');
|
|
1435
|
+
} catch (e) {
|
|
1436
|
+
log('imessage', `failed to start watch: ${e.message}, using polling`, 'yellow');
|
|
1437
|
+
startImessagePollingFallback(imsgPath, config);
|
|
1438
|
+
}
|
|
1439
|
+
}
|
|
1440
|
+
|
|
1441
|
+
function startImessagePollingFallback(imsgPath, config) {
|
|
1442
|
+
// Fallback: history ile polling
|
|
1443
|
+
let lastRowId = null;
|
|
1444
|
+
|
|
1402
1445
|
imessagePollInterval = setInterval(async () => {
|
|
1403
1446
|
try {
|
|
1404
|
-
const
|
|
1447
|
+
const args = ['history', '--format', 'json', '--limit', '10'];
|
|
1448
|
+
if (lastRowId) args.push('--since-rowid', String(lastRowId));
|
|
1449
|
+
const result = execSync(`"${imsgPath}" ${args.join(' ')} 2>/dev/null`, {
|
|
1405
1450
|
encoding: 'utf-8', timeout: 10000, stdio: 'pipe',
|
|
1406
1451
|
});
|
|
1407
1452
|
const lines = result.trim().split('\n').filter(Boolean);
|
|
1408
1453
|
for (const line of lines) {
|
|
1409
1454
|
try {
|
|
1410
1455
|
const msg = JSON.parse(line);
|
|
1411
|
-
|
|
1456
|
+
if (msg.id && (!lastRowId || msg.id > lastRowId)) {
|
|
1457
|
+
lastRowId = msg.id;
|
|
1458
|
+
}
|
|
1459
|
+
processImessageMessage(msg, config);
|
|
1412
1460
|
} catch {}
|
|
1413
1461
|
}
|
|
1414
1462
|
} catch {}
|
|
1415
1463
|
}, 15000);
|
|
1416
1464
|
|
|
1417
|
-
log('imessage', 'polling started (15s interval)', 'green');
|
|
1465
|
+
log('imessage', 'polling started (15s interval, history fallback)', 'green');
|
|
1418
1466
|
}
|
|
1419
1467
|
|
|
1420
1468
|
function findImsgBin() {
|