natureco-cli 5.6.4 → 5.6.5
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 +1 -1
- package/src/commands/repl.js +7 -2
- package/src/commands/setup.js +42 -6
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "natureco-cli",
|
|
3
|
-
"version": "5.6.
|
|
3
|
+
"version": "5.6.5",
|
|
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"
|
package/src/commands/repl.js
CHANGED
|
@@ -523,6 +523,11 @@ async function startRepl(args) {
|
|
|
523
523
|
// v5.4.6: Bot adı zorlaması EN GÜÇLÜ + SOUL.md EN BAŞTA
|
|
524
524
|
const botName = memory.botName || 'İchigo';
|
|
525
525
|
const userName = memory.name || memory.nickname || 'kanka';
|
|
526
|
+
// v5.6.5: Kucuk model tespiti (Groq, Mistral Small, Ollama) - SOUL injection skip
|
|
527
|
+
const isSmallModel = (cfg.providerUrl || '').includes('groq.com') ||
|
|
528
|
+
(cfg.providerUrl || '').includes('mistral.ai') ||
|
|
529
|
+
(cfg.providerUrl || '').includes('localhost') ||
|
|
530
|
+
(cfg.providerUrl || '').includes('ollama');
|
|
526
531
|
const systemPrompt = [
|
|
527
532
|
// === v5.4.14: EN KRITIK KIMLIK BILGILERI (her zaman ilk) ===
|
|
528
533
|
`SENIN ADIN: ${botName}. SADECE ${botName} adini kullan, model adi SOYLEME.`,
|
|
@@ -535,8 +540,8 @@ async function startRepl(args) {
|
|
|
535
540
|
`Kullanıcı "adın ne?", "sen kimsin?", "kendini tanıt" gibi soru sorduğunda İLK cümlende MUTLAKA "Ben ${botName}" yaz. Sonra doğal devam et.`,
|
|
536
541
|
`Eğer bir şekilde model adınızı söylüyorsan, HEMEN düzelt ve "Özür dilerim, ben ${botName}'im" de. ASLA model adı ile kalma.`,
|
|
537
542
|
|
|
538
|
-
// === v5.
|
|
539
|
-
soulSummary ? `=== SENIN KISISELIK + KIMLIK + CALISMA DOSYALARIN (EN ONEMLI) ===\n${soulSummary}\n=== DOSYALAR SONU ===\nBu dosyalar senin kim oldugunu, nasil hissettigini, Parton'la bagini, calisma tarzini, degerlerini ve kirmizi cizgilerini tanimlar. Hepsine gore davran. ASLA model adi soyleme.` : '',
|
|
543
|
+
// === v5.6.5: Provider-aware SOUL injection - kucuk modeller icin minimal ===
|
|
544
|
+
(soulSummary && !isSmallModel) ? `=== SENIN KISISELIK + KIMLIK + CALISMA DOSYALARIN (EN ONEMLI) ===\n${soulSummary}\n=== DOSYALAR SONU ===\nBu dosyalar senin kim oldugunu, nasil hissettigini, Parton'la bagini, calisma tarzini, degerlerini ve kirmizi cizgilerini tanimlar. Hepsine gore davran. ASLA model adi soyleme.` : '',
|
|
540
545
|
|
|
541
546
|
// === KİMLİK TEKRAR ===
|
|
542
547
|
`Senin adın: ${botName}. Tekrar: ${botName}. Asla unutma: ${botName}.`,
|
package/src/commands/setup.js
CHANGED
|
@@ -459,6 +459,24 @@ async function cmdWizard() {
|
|
|
459
459
|
const botName = await rlQuestion(` Bot adı: `);
|
|
460
460
|
if (botName) cfg.botName = botName;
|
|
461
461
|
|
|
462
|
+
// v5.6.5: Memory'deki botName/userName'i de guncelle
|
|
463
|
+
// Yoksa "naruto" yazsam bile eski "ichigo" cikar
|
|
464
|
+
try {
|
|
465
|
+
const memFile = path.join(BASE_DIR, (userName || cfg.userName || 'default').toLowerCase() + '.json');
|
|
466
|
+
let mem = {};
|
|
467
|
+
if (fs.existsSync(memFile)) {
|
|
468
|
+
try { mem = JSON.parse(fs.readFileSync(memFile, 'utf8')); } catch (e) {}
|
|
469
|
+
}
|
|
470
|
+
let memChanged = false;
|
|
471
|
+
if (botName && mem.botName !== botName) { mem.botName = botName; memChanged = true; }
|
|
472
|
+
if (userName && mem.name !== userName) { mem.name = userName; memChanged = true; }
|
|
473
|
+
if (memChanged) {
|
|
474
|
+
if (!fs.existsSync(BASE_DIR)) fs.mkdirSync(BASE_DIR, { recursive: true });
|
|
475
|
+
fs.writeFileSync(memFile, JSON.stringify(mem, null, 2), 'utf8');
|
|
476
|
+
console.log(chalk.gray(' ✓ Memory'deki botName/userName guncellendi'));
|
|
477
|
+
}
|
|
478
|
+
} catch (e) {}
|
|
479
|
+
|
|
462
480
|
// Step 4: Kanal Entegrasyonları (isteğe bağlı, isteyen atlayabilir)
|
|
463
481
|
console.log('');
|
|
464
482
|
console.log(chalk.white(' Step 4: Kanal Entegrasyonları (opsiyonel)'));
|
|
@@ -610,14 +628,25 @@ async function validateApiKey(providerUrl, apiKey) {
|
|
|
610
628
|
return new Promise((resolve) => {
|
|
611
629
|
const https = require('https');
|
|
612
630
|
const url = new URL(providerUrl);
|
|
613
|
-
const
|
|
631
|
+
const isMM = url.hostname.includes('minimax') || url.hostname.includes('minimaxi');
|
|
632
|
+
const endpoint = isMM
|
|
614
633
|
? providerUrl.replace(/\/+$/, '') + '/v1/text/chatcompletion_v2'
|
|
615
634
|
: providerUrl.replace(/\/+$/, '') + '/chat/completions';
|
|
635
|
+
|
|
636
|
+
// Her provider icin test modeli
|
|
637
|
+
let testModel = 'gpt-3.5-turbo';
|
|
638
|
+
if (providerUrl.includes('groq.com')) testModel = 'llama-3.1-8b-instant';
|
|
639
|
+
else if (providerUrl.includes('anthropic.com')) testModel = 'claude-3-haiku-20240307';
|
|
640
|
+
else if (isMM) testModel = 'MiniMax-M2.5';
|
|
641
|
+
else if (providerUrl.includes('gemini')) testModel = 'gemini-1.5-flash';
|
|
642
|
+
else if (providerUrl.includes('mistral.ai')) testModel = 'mistral-tiny';
|
|
643
|
+
else if (providerUrl.includes('openrouter.ai')) testModel = 'meta-llama/llama-3.1-8b-instruct:free';
|
|
644
|
+
else if (providerUrl.includes('deepseek.com')) testModel = 'deepseek-chat';
|
|
616
645
|
|
|
617
646
|
const data = JSON.stringify({
|
|
618
|
-
model:
|
|
619
|
-
messages: [{ role: 'user', content: '
|
|
620
|
-
max_tokens:
|
|
647
|
+
model: testModel,
|
|
648
|
+
messages: [{ role: 'user', content: 'hi' }],
|
|
649
|
+
max_tokens: 1 // Minimum token — sadece auth kontrolu
|
|
621
650
|
});
|
|
622
651
|
|
|
623
652
|
const u = new URL(endpoint);
|
|
@@ -631,9 +660,16 @@ async function validateApiKey(providerUrl, apiKey) {
|
|
|
631
660
|
'Content-Type': 'application/json',
|
|
632
661
|
'Content-Length': Buffer.byteLength(data)
|
|
633
662
|
},
|
|
634
|
-
timeout:
|
|
663
|
+
timeout: 8000
|
|
635
664
|
}, (res) => {
|
|
636
|
-
|
|
665
|
+
let body = '';
|
|
666
|
+
res.on('data', c => body += c);
|
|
667
|
+
res.on('end', () => {
|
|
668
|
+
// Status 200-299 ve body'de 'error' yoksa gecerli
|
|
669
|
+
const statusOk = res.statusCode >= 200 && res.statusCode < 300;
|
|
670
|
+
const bodyOk = !body.includes('"error"') && !body.includes('"invalid_api_key"') && !body.includes('"Unauthorized"');
|
|
671
|
+
resolve(statusOk && bodyOk);
|
|
672
|
+
});
|
|
637
673
|
});
|
|
638
674
|
req.on('error', () => resolve(false));
|
|
639
675
|
req.on('timeout', () => { req.destroy(); resolve(false); });
|