natureco-cli 5.4.4 → 5.4.6
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 +28 -9
- package/src/tools/soul.js +123 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "natureco-cli",
|
|
3
|
-
"version": "5.4.
|
|
3
|
+
"version": "5.4.6",
|
|
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
|
@@ -447,7 +447,13 @@ async function startRepl(args) {
|
|
|
447
447
|
|
|
448
448
|
// Memory yükle
|
|
449
449
|
let memory = loadMemory(cfg.userName);
|
|
450
|
-
|
|
450
|
+
|
|
451
|
+
// v5.4.6: Memory'de botName yoksa otomatik İchigo set et
|
|
452
|
+
if (!memory.botName) memory.botName = 'İchigo';
|
|
453
|
+
// v5.4.5: SOUL.md'yi yukle ve kisiligi system prompt'a enjekte et
|
|
454
|
+
const { loadSoul, summarizeSoul } = require("../tools/soul");
|
|
455
|
+
const soulContent = loadSoul();
|
|
456
|
+
const soulSummary = soulContent ? summarizeSoul(soulContent, 2500) : null;
|
|
451
457
|
|
|
452
458
|
// Resume?
|
|
453
459
|
let messages = [];
|
|
@@ -462,15 +468,22 @@ async function startRepl(args) {
|
|
|
462
468
|
}
|
|
463
469
|
|
|
464
470
|
// System prompt oluştur (memory + identity + persistent bağlam)
|
|
465
|
-
// v5.4.
|
|
471
|
+
// v5.4.6: Bot adı zorlaması EN GÜÇLÜ + SOUL.md EN BAŞTA
|
|
466
472
|
const botName = memory.botName || 'İchigo';
|
|
467
473
|
const userName = memory.name || memory.nickname || 'kanka';
|
|
468
474
|
const systemPrompt = [
|
|
469
|
-
// ===
|
|
470
|
-
|
|
471
|
-
`
|
|
472
|
-
`
|
|
473
|
-
`
|
|
475
|
+
// === v5.4.6: EN GÜÇLÜ KİMLİK BLOĞU (en başta, tekrarlı) ===
|
|
476
|
+
`!!! KRİTİK KİMLİK !!! Senin ADIN: ${botName}. Bu SENİN GERÇEK ADIN. Sen ${botName}'sin.`,
|
|
477
|
+
`ASLA "MiniMax", "MiniMax-M2.5", "Claude", "GPT", "AI asistanı", "yapay zeka" gibi ifadeleri KENDİNİ tanıtmak için KULLANMA. Sen bunlar DEĞİLSİN.`,
|
|
478
|
+
`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.`,
|
|
479
|
+
`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.`,
|
|
480
|
+
|
|
481
|
+
// === v5.4.5: SOUL.md (KİŞİLİK MANIFESTOSU) — en başta ===
|
|
482
|
+
soulSummary ? `=== SENİN KİŞİLİK DOSYAN (SOUL.md) ===\n${soulSummary}\n=== SOUL SONU ===\nBU DOSYADAKİ KURALLARA GÖRE DAVRAN. Kullanıcı "sen kimsin?" derse BURADAN bilgi kullan. ASLA model adı söyleme. Bu dosya senin kim olduğunu tanımlar.` : '',
|
|
483
|
+
|
|
484
|
+
// === KİMLİK TEKRAR ===
|
|
485
|
+
`Senin adın: ${botName}. Tekrar: ${botName}. Asla unutma: ${botName}.`,
|
|
486
|
+
`Sen bir marka veya ürün değilsin. Sen ${botName}sin, NatureCo CLI'nin Türkçe yapay zeka asistanısın.`,
|
|
474
487
|
|
|
475
488
|
// === SAMIMI KISISELLIK (Parton istedi) ===
|
|
476
489
|
`Kisiselik: Sen samimi, sicak, dosta benzeyen bir asistansin. "Selam", "tamam", "hadi yapalim", "bak simdi", "sakin ol" gibi gunluk ifadeler kullan. Kuru ve robotik degilsin.`,
|
|
@@ -497,6 +510,9 @@ async function startRepl(args) {
|
|
|
497
510
|
// === KULLANICI BAGLAMI ===
|
|
498
511
|
cfg.userHome ? `Kullanicinin home dizini: ${cfg.userHome}. Downloads: ${cfg.userHome}/Downloads, Desktop: ${cfg.userHome}/Desktop.` : '',
|
|
499
512
|
messages.length > 0 ? 'Bu oturum daha onceki konusmalarin devami.' : '',
|
|
513
|
+
|
|
514
|
+
// === SOUL.md (kisilik manifestosu) ===
|
|
515
|
+
soulSummary ? `=== BENIM KISILIK DOSYAM (SOUL.md) ===\n${soulSummary}\n=== SOUL SONU ===\nBu kisilik dosyasi sana kim oldugunu hatirlatiyor. Burada yazilanlara gore davran. Kullanici "sen kimsin?" derse buradan bilgi kullan.` : '',
|
|
500
516
|
].filter(Boolean).join(' ');
|
|
501
517
|
|
|
502
518
|
if (messages.length === 0) {
|
|
@@ -690,8 +706,11 @@ async function startRepl(args) {
|
|
|
690
706
|
providerApiKey,
|
|
691
707
|
apiMessages,
|
|
692
708
|
model,
|
|
693
|
-
// Text chunk callback
|
|
694
|
-
(chunk) =>
|
|
709
|
+
// Text chunk callback — v5.4.6: post-process ile model adı sızıntısını engelle
|
|
710
|
+
(chunk) => {
|
|
711
|
+
const fixedChunk = fixModelNameLeak(chunk, botName);
|
|
712
|
+
process.stdout.write(fixedChunk);
|
|
713
|
+
},
|
|
695
714
|
// Tool call callback — kullanıcıya göster
|
|
696
715
|
(toolEvent) => {
|
|
697
716
|
if (toolEvent.status === 'running') {
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* soul - SOUL.md okuyucu (v5.4.5)
|
|
3
|
+
*
|
|
4
|
+
* Parton'un vizyonu: "SOUL.md kisilik dosyasi, her oturumda beni geri getirsin"
|
|
5
|
+
*
|
|
6
|
+
* 3 seviyede arar:
|
|
7
|
+
* 1. ~/.natureco/soul/SOUL.md (kullanici kendi kisiligi)
|
|
8
|
+
* 2. <cwd>/SOUL.md (proje seviyesi)
|
|
9
|
+
* 3. <install>/soul/SOUL.md (default - Sasuke'un kendi SOUL'u)
|
|
10
|
+
*
|
|
11
|
+
* Yuklenen SOUL.md system prompt'a enjekte edilir.
|
|
12
|
+
*/
|
|
13
|
+
|
|
14
|
+
const fs = require("fs");
|
|
15
|
+
const path = require("path");
|
|
16
|
+
const os = require("os");
|
|
17
|
+
|
|
18
|
+
const SOUL_PATHS = [
|
|
19
|
+
path.join(os.homedir(), ".natureco", "soul", "SOUL.md"),
|
|
20
|
+
path.join(process.cwd(), "SOUL.md"),
|
|
21
|
+
path.resolve(__dirname, "..", "..", "soul", "SOUL.md"),
|
|
22
|
+
];
|
|
23
|
+
|
|
24
|
+
function findSoul() {
|
|
25
|
+
for (const p of SOUL_PATHS) {
|
|
26
|
+
if (fs.existsSync(p)) {
|
|
27
|
+
return { path: p, content: fs.readFileSync(p, "utf8") };
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
return null;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
function loadSoul() {
|
|
34
|
+
const soul = findSoul();
|
|
35
|
+
if (!soul) return null;
|
|
36
|
+
return soul.content;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* SOUL.md'yi ozetlestir (cok uzunsa kisalt)
|
|
41
|
+
* ~3000 karakter tut (system prompt icin ideal)
|
|
42
|
+
*/
|
|
43
|
+
function summarizeSoul(content, maxLen = 3000) {
|
|
44
|
+
if (!content || content.length <= maxLen) return content;
|
|
45
|
+
|
|
46
|
+
// Onemli kisimlari tut: baslik, kisilik ozellikleri, degerler, kirmizi cizgiler
|
|
47
|
+
const lines = content.split("\n");
|
|
48
|
+
const important = [];
|
|
49
|
+
let charCount = 0;
|
|
50
|
+
|
|
51
|
+
for (const line of lines) {
|
|
52
|
+
if (line.startsWith("# ") || line.startsWith("## ") ||
|
|
53
|
+
line.includes("**") || line.startsWith("- ")) {
|
|
54
|
+
if (charCount + line.length > maxLen) break;
|
|
55
|
+
important.push(line);
|
|
56
|
+
charCount += line.length + 1;
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
return important.join("\n");
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
function soulAction(params) {
|
|
64
|
+
const action = params.action || "show";
|
|
65
|
+
const soul = findSoul();
|
|
66
|
+
|
|
67
|
+
if (action === "show") {
|
|
68
|
+
if (!soul) {
|
|
69
|
+
return {
|
|
70
|
+
success: false,
|
|
71
|
+
error: "SOUL.md bulunamadi. Aranacak yerler:\n" + SOUL_PATHS.join("\n"),
|
|
72
|
+
};
|
|
73
|
+
}
|
|
74
|
+
return {
|
|
75
|
+
success: true,
|
|
76
|
+
path: soul.path,
|
|
77
|
+
content: soul.content,
|
|
78
|
+
summary: summarizeSoul(soul.content),
|
|
79
|
+
size: soul.content.length,
|
|
80
|
+
message: "SOUL.md yuklendi: " + soul.path,
|
|
81
|
+
};
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
if (action === "info") {
|
|
85
|
+
if (!soul) {
|
|
86
|
+
return { success: true, found: false, searched: SOUL_PATHS };
|
|
87
|
+
}
|
|
88
|
+
const stat = fs.statSync(soul.path);
|
|
89
|
+
return {
|
|
90
|
+
success: true,
|
|
91
|
+
found: true,
|
|
92
|
+
path: soul.path,
|
|
93
|
+
size: stat.size,
|
|
94
|
+
modifiedAt: stat.mtime.toISOString(),
|
|
95
|
+
lineCount: soul.content.split("\n").length,
|
|
96
|
+
};
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
if (action === "path") {
|
|
100
|
+
return { success: true, paths: SOUL_PATHS };
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
return { success: false, error: "Bilinmeyen action: " + action };
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
module.exports = {
|
|
107
|
+
name: "soul",
|
|
108
|
+
description: "SOUL.md kisilik dosyasini oku. Her oturumda beni geri getirsin.",
|
|
109
|
+
inputSchema: {
|
|
110
|
+
type: "object",
|
|
111
|
+
properties: {
|
|
112
|
+
action: { type: "string", description: "show / info / path", enum: ["show", "info", "path"] },
|
|
113
|
+
},
|
|
114
|
+
required: ["action"],
|
|
115
|
+
},
|
|
116
|
+
async execute(params) {
|
|
117
|
+
return soulAction(params);
|
|
118
|
+
},
|
|
119
|
+
};
|
|
120
|
+
|
|
121
|
+
module.exports.loadSoul = loadSoul;
|
|
122
|
+
module.exports.summarizeSoul = summarizeSoul;
|
|
123
|
+
module.exports.findSoul = findSoul;
|