natureco-cli 5.14.3 → 5.14.4
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/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.4",
|
|
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/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 = {
|