natureco-cli 5.4.4 → 5.4.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 +8 -0
- 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.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
|
@@ -447,6 +447,11 @@ async function startRepl(args) {
|
|
|
447
447
|
|
|
448
448
|
// Memory yükle
|
|
449
449
|
let memory = loadMemory(cfg.userName);
|
|
450
|
+
|
|
451
|
+
// v5.4.5: SOUL.md'yi yukle ve kisiligi system prompt'a enjekte et
|
|
452
|
+
const { loadSoul, summarizeSoul } = require("../tools/soul");
|
|
453
|
+
const soulContent = loadSoul();
|
|
454
|
+
const soulSummary = soulContent ? summarizeSoul(soulContent, 2500) : null;
|
|
450
455
|
if (memory.botName) memory.botName = memory.botName || 'İchigo';
|
|
451
456
|
|
|
452
457
|
// Resume?
|
|
@@ -497,6 +502,9 @@ async function startRepl(args) {
|
|
|
497
502
|
// === KULLANICI BAGLAMI ===
|
|
498
503
|
cfg.userHome ? `Kullanicinin home dizini: ${cfg.userHome}. Downloads: ${cfg.userHome}/Downloads, Desktop: ${cfg.userHome}/Desktop.` : '',
|
|
499
504
|
messages.length > 0 ? 'Bu oturum daha onceki konusmalarin devami.' : '',
|
|
505
|
+
|
|
506
|
+
// === SOUL.md (kisilik manifestosu) ===
|
|
507
|
+
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
508
|
].filter(Boolean).join(' ');
|
|
501
509
|
|
|
502
510
|
if (messages.length === 0) {
|
|
@@ -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;
|