natureco-cli 5.14.3 → 5.14.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 +13 -2
- package/src/tools/workflow.js +27 -2
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "natureco-cli",
|
|
3
|
-
"version": "5.14.
|
|
3
|
+
"version": "5.14.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
|
@@ -729,9 +729,20 @@ async function startRepl(args) {
|
|
|
729
729
|
}
|
|
730
730
|
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'));
|
|
731
731
|
console.log('');
|
|
732
|
-
// v5.4.7: Hard-coded kimlik
|
|
732
|
+
// v5.4.7: Hard-coded kimlik — v5.14.5: memory fact'lerinden kullanici adini tespit et
|
|
733
733
|
const displayBotName = memory.botName || 'Asistan';
|
|
734
|
-
const
|
|
734
|
+
const nameFromFact = (() => {
|
|
735
|
+
const facts = memory.facts || [];
|
|
736
|
+
for (const f of facts) {
|
|
737
|
+
const v = (f.value || f || '').trim();
|
|
738
|
+
const lv = v.toLowerCase();
|
|
739
|
+
// "Kullanici adi: Gencay" veya "Kullanıcı adı Gencay" veya "isim: Gencay"
|
|
740
|
+
const match = lv.match(/(?:kullanici\s*adi|kullanıcı\s*adı|isim|name|adı?)\s*:?\s*(.+)/);
|
|
741
|
+
if (match) return match[1].trim();
|
|
742
|
+
}
|
|
743
|
+
return null;
|
|
744
|
+
})();
|
|
745
|
+
const displayUserName = memory.name || nameFromFact || memory.nickname || 'kanka';
|
|
735
746
|
console.log(tui.C.brand(' 👋 Ben ' + displayBotName + ', ' + displayUserName + '. Sen nasilsin?'));
|
|
736
747
|
console.log('');
|
|
737
748
|
|
package/src/tools/workflow.js
CHANGED
|
@@ -20,6 +20,27 @@ function allToolNames() {
|
|
|
20
20
|
} catch { return []; }
|
|
21
21
|
}
|
|
22
22
|
|
|
23
|
+
function loadUserMemory(username) {
|
|
24
|
+
try {
|
|
25
|
+
const file = path.join(os.homedir(), '.natureco', 'memory', `${(username || 'default').toLowerCase()}.json`);
|
|
26
|
+
if (fs.existsSync(file)) {
|
|
27
|
+
const mem = JSON.parse(fs.readFileSync(file, 'utf8'));
|
|
28
|
+
const facts = (mem.facts || []).map(f => f.value || f).filter(Boolean);
|
|
29
|
+
const name = mem.name || '';
|
|
30
|
+
const parts = [];
|
|
31
|
+
if (name) parts.push(`Kullanici adi: ${name}`);
|
|
32
|
+
if (facts.length > 0) parts.push(`Bilinenler: ${facts.slice(0, 10).join('; ')}`);
|
|
33
|
+
return parts.join('\n');
|
|
34
|
+
}
|
|
35
|
+
} catch {}
|
|
36
|
+
return '';
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
function memoryContext() {
|
|
40
|
+
const cfg = loadConfig();
|
|
41
|
+
return loadUserMemory(cfg.userName);
|
|
42
|
+
}
|
|
43
|
+
|
|
23
44
|
function apiCall(providerUrl, apiKey, body) {
|
|
24
45
|
return new Promise((resolve, reject) => {
|
|
25
46
|
const base = providerUrl.replace(/\/+$/, '');
|
|
@@ -84,8 +105,10 @@ async function workflow(params) {
|
|
|
84
105
|
} catch {}
|
|
85
106
|
|
|
86
107
|
if (isSimple) {
|
|
87
|
-
// Passthrough: just chat with LLM, no tools
|
|
88
|
-
const
|
|
108
|
+
// Passthrough: just chat with LLM, no tools — include user memory
|
|
109
|
+
const memCtx = memoryContext();
|
|
110
|
+
const sysMsg = 'Sen yardimci bir asistansin. Kisa ve oz yanit ver.' + (memCtx ? '\n\nKullanici bilgisi:\n' + memCtx : '');
|
|
111
|
+
const chatBody = { model, stream: false, messages: [{ role: 'system', content: sysMsg }, { role: 'user', content: task }], temperature: 0.7, max_tokens: 1000 };
|
|
89
112
|
try {
|
|
90
113
|
const chatResult = await apiCall(providerUrl, providerApiKey, chatBody);
|
|
91
114
|
const reply = chatResult.choices?.[0]?.message?.content || '';
|
|
@@ -96,10 +119,12 @@ async function workflow(params) {
|
|
|
96
119
|
}
|
|
97
120
|
|
|
98
121
|
// Phase 1: LLM plans the workflow
|
|
122
|
+
const memCtx = memoryContext();
|
|
99
123
|
const planPrompt = {
|
|
100
124
|
role: 'system',
|
|
101
125
|
content: 'Sen bir workflow planlama asistanisin. Verilen gorev icin hangi tool\'larin kullanilacagini ve hangi sirayla calisacagini belirle. SADECE JSON formatinda yanit ver, baska bir sey yazma.\n\nKullanilabilir tool\'lar:\n' +
|
|
102
126
|
tools.map(t => '- ' + t).join('\n') +
|
|
127
|
+
(memCtx ? '\n\nKullanici bilgisi:\n' + memCtx : '') +
|
|
103
128
|
'\n\nJSON format:\n{\n "workflowName": "...",\n "description": "...",\n "steps": [\n { "step": 1, "tool": "tool_name", "purpose": "...", "params": { ... } }\n ]\n}\n\nHer adim icin params kismina tool\'un gerektirdigi parametreleri ekle. Adimlar birbirine bagimli olabilir, onceki adimin outputu sonraki adimin inputu olarak kullanilabilir.'
|
|
104
129
|
};
|
|
105
130
|
const planBody = {
|