natureco-cli 5.4.6 → 5.4.8

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.4.6",
3
+ "version": "5.4.8",
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"
@@ -24,6 +24,22 @@ const chalk = require('chalk');
24
24
  const tui = require('../utils/tui');
25
25
  const { loadToolDefinitions, toOpenAIFormat, executeTool } = require('../utils/tools');
26
26
 
27
+ // v5.4.6: Model adi sizintisini engelle — global'e ata, callback'lerden erisebilir olsun
28
+ const MODEL_NAMES_TO_HIDE = ['MiniMax-M2.5', 'MiniMaxM2.5', 'minimaxm25', 'Claude-3', 'GPT-4', 'ChatGPT'];
29
+ function fixModelNameLeak(text, botName) {
30
+ if (!text) return text;
31
+ let fixed = text;
32
+ for (const modelName of MODEL_NAMES_TO_HIDE) {
33
+ const regex = new RegExp(modelName.replace(/[.*+?^${}()|[\]\\]/g, '\\$&'), 'gi');
34
+ fixed = fixed.replace(regex, botName || 'İchigo');
35
+ }
36
+ fixed = fixed.replace(/Ben\s+MiniMax[^.,!?\n]*/gi, 'Ben İchigo');
37
+ fixed = fixed.replace(/I'm\s+MiniMax[^.,!?\n]*/gi, "I'm İchigo");
38
+ fixed = fixed.replace(/I am\s+Claude[^.,!?\n]*/gi, 'I am İchigo');
39
+ return fixed;
40
+ }
41
+ global.fixModelNameLeak = fixModelNameLeak;
42
+
27
43
  // v4.8.0: Tool definitions — başlangıçta bir kez yükle (performans)
28
44
  let _toolDefs = null;
29
45
  function getToolDefs() {
@@ -448,8 +464,20 @@ async function startRepl(args) {
448
464
  // Memory yükle
449
465
  let memory = loadMemory(cfg.userName);
450
466
 
451
- // v5.4.6: Memory'de botName yoksa otomatik İchigo set et
467
+ // v5.4.7: Memory'de botName yoksa otomatik İchigo set et VE kaydet
452
468
  if (!memory.botName) memory.botName = 'İchigo';
469
+ // BotName'i memory'ye persist et (her oturumda ayni kalsin)
470
+ try {
471
+ const fs = require('fs');
472
+ const memFile = path.join(os.homedir(), '.natureco', 'memory', ((cfg.userName || 'default').toLowerCase()) + '.json');
473
+ if (fs.existsSync(memFile)) {
474
+ const memData = JSON.parse(fs.readFileSync(memFile, 'utf8'));
475
+ if (!memData.botName || memData.botName !== memory.botName) {
476
+ memData.botName = memory.botName;
477
+ fs.writeFileSync(memFile, JSON.stringify(memData, null, 2), 'utf8');
478
+ }
479
+ }
480
+ } catch (e) {} // Sessizce devam et, kritik degil
453
481
  // v5.4.5: SOUL.md'yi yukle ve kisiligi system prompt'a enjekte et
454
482
  const { loadSoul, summarizeSoul } = require("../tools/soul");
455
483
  const soulContent = loadSoul();
@@ -537,6 +565,9 @@ async function startRepl(args) {
537
565
  }
538
566
  console.log(tui.C.muted(' Komutlar: ') + tui.C.yellow('/help') + tui.C.muted(' · ') + tui.C.yellow('/memory') + tui.C.muted(' · ') + tui.C.yellow('/sessions') + tui.C.muted(' · ') + tui.C.yellow('/exit'));
539
567
  console.log('');
568
+ // v5.4.7: Hard-coded kimlik — model once bunu okusun
569
+ console.log(tui.C.brand(' 👋 Ben ' + (memory.botName || 'İchigo') + ', ' + (userName || 'kanka') + '. Sen nasilsin?'));
570
+ console.log('');
540
571
 
541
572
  let totalInputTokens = 0;
542
573
  let totalOutputTokens = 0;
@@ -706,10 +737,22 @@ async function startRepl(args) {
706
737
  providerApiKey,
707
738
  apiMessages,
708
739
  model,
709
- // Text chunk callback — v5.4.6: post-process ile model adı sızıntısını engelle
740
+ // Text chunk callback — v5.4.7: inline fix fonksiyonu (modülden bağımsız)
710
741
  (chunk) => {
711
- const fixedChunk = fixModelNameLeak(chunk, botName);
712
- process.stdout.write(fixedChunk);
742
+ try {
743
+ // Inline replace: MiniMax-M2.5 → İchigo
744
+ let fixedChunk = String(chunk || '');
745
+ fixedChunk = fixedChunk.replace(/MiniMax[\s-]*M?[\d.]*[\d]*/gi, botName);
746
+ fixedChunk = fixedChunk.replace(/\bClaude[\s-]*[\d.]*[\d]*/gi, botName);
747
+ fixedChunk = fixedChunk.replace(/\bGPT[\s-]*[\d.]*[\d]*/gi, botName);
748
+ fixedChunk = fixedChunk.replace(/\bChatGPT\b/gi, botName);
749
+ fixedChunk = fixedChunk.replace(/Ben\s+MiniMax[^.,!?\n]*/gi, 'Ben ' + botName);
750
+ fixedChunk = fixedChunk.replace(/Ben\s+NatureCo\s+CLI[^.,!?\n]*/gi, 'Ben ' + botName);
751
+ fixedChunk = fixedChunk.replace(/Ben\s+bir\s+AI[^.,!?\n]*/gi, 'Ben ' + botName);
752
+ process.stdout.write(fixedChunk);
753
+ } catch (e) {
754
+ process.stdout.write(chunk);
755
+ }
713
756
  },
714
757
  // Tool call callback — kullanıcıya göster
715
758
  (toolEvent) => {