natureco-cli 5.21.0 → 5.22.0

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.21.0",
3
+ "version": "5.22.0",
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"
@@ -1090,6 +1090,8 @@ async function startRepl(args) {
1090
1090
  memorySnapshotBlock, skillsIndexBlock, projectRules,
1091
1091
  crossSessionContext: crossSessionContext || '',
1092
1092
  userHome: cfg.userHome || '',
1093
+ platform: process.platform,
1094
+ desktopPath: cfg.userHome ? path.join(cfg.userHome, 'Desktop') : '',
1093
1095
  hasHistory: messages.length > 0,
1094
1096
  memoryFacts: memory.facts || [],
1095
1097
  };
@@ -1468,7 +1470,8 @@ async function startRepl(args) {
1468
1470
  // v5.13.0: Run workflow FIRST for every request
1469
1471
  process.stdout.write(tui.styled('\r 🔧 workflow... ', { color: tui.PALETTE.muted }));
1470
1472
  const wfToolDefs = getToolDefs();
1471
- const wfResult = await executeTool('workflow', { action: 'run', task: line }, wfToolDefs);
1473
+ const recentHistory = messages.length > 1 ? messages.slice(-10) : [];
1474
+ const wfResult = await executeTool('workflow', { action: 'run', task: line, conversationHistory: recentHistory }, wfToolDefs);
1472
1475
  const wf = wfResult?.result || {};
1473
1476
  if (wf.success !== false) {
1474
1477
  const loaded = wf.skillsLoaded && wf.skillsLoaded.length > 0 ? ` [skill: ${wf.skillsLoaded.join(', ')}]` : '';
@@ -83,7 +83,7 @@ function apiCall(providerUrl, apiKey, body) {
83
83
  }
84
84
 
85
85
  async function workflow(params) {
86
- const { action, task, steps, name, workflowId, regenerateStep } = params;
86
+ const { action, task, steps, name, workflowId, regenerateStep, conversationHistory } = params;
87
87
  const cfg = loadConfig();
88
88
  const tools = allToolNames();
89
89
  ensureDir(WORKFLOW_DIR);
@@ -98,6 +98,19 @@ async function workflow(params) {
98
98
 
99
99
  const skillsIndexBlock = buildSkillIndex();
100
100
 
101
+ // Build chat messages with optional conversation history for context
102
+ function chatMessages(sysMsg, userTask) {
103
+ const msgs = [{ role: 'system', content: sysMsg }];
104
+ if (conversationHistory && Array.isArray(conversationHistory)) {
105
+ for (const m of conversationHistory) {
106
+ if (m._internal) continue;
107
+ msgs.push({ role: m.role, content: m.content || '' });
108
+ }
109
+ }
110
+ msgs.push({ role: 'user', content: userTask });
111
+ return msgs;
112
+ }
113
+
101
114
  // Non-tool-calling model tespiti
102
115
  function supportsToolCalls() {
103
116
  const url = (providerUrl || '').toLowerCase();
@@ -117,7 +130,7 @@ async function workflow(params) {
117
130
  if (!supportsToolCalls()) {
118
131
  const memCtx = memoryContext();
119
132
  const sysMsg = 'Sen yardimci bir asistansin. Kullanici ne istediyse onu dogrudan yap. Dosya olusturulacaksa icerigi eksiksiz olarak yanitla.' + (memCtx ? '\n\nKullanici bilgisi:\n' + memCtx : '') + '\n\n' + skillsIndexBlock;
120
- const chatBody = { model, stream: false, messages: [{ role: 'system', content: sysMsg }, { role: 'user', content: task }], temperature: 0.7, max_tokens: 4000 };
133
+ const chatBody = { model, stream: false, messages: chatMessages(sysMsg, task), temperature: 0.7, max_tokens: 4000 };
121
134
  try {
122
135
  const chatResult = await apiCall(providerUrl, providerApiKey, chatBody);
123
136
  const reply = chatResult.choices?.[0]?.message?.content || '';
@@ -141,10 +154,10 @@ async function workflow(params) {
141
154
  } catch {}
142
155
 
143
156
  if (isSimple) {
144
- // Passthrough: just chat with LLM, no tools — include user memory
157
+ // Passthrough: just chat with LLM, no tools — include user memory + conversation history
145
158
  const memCtx = memoryContext();
146
- const sysMsg = 'Sen yardimci bir asistansin. Kisa ve oz yanit ver.' + (memCtx ? '\n\nKullanici bilgisi:\n' + memCtx : '') + '\n\n' + skillsIndexBlock;
147
- const chatBody = { model, stream: false, messages: [{ role: 'system', content: sysMsg }, { role: 'user', content: task }], temperature: 0.7, max_tokens: 1000 };
159
+ const sysMsg = 'Sen yardimci bir asistansin. Kisa ve oz yanit ver. Konusma gecmisi varsa onceki mesajlari dikkate al.' + (memCtx ? '\n\nKullanici bilgisi:\n' + memCtx : '') + '\n\n' + skillsIndexBlock;
160
+ const chatBody = { model, stream: false, messages: chatMessages(sysMsg, task), temperature: 0.7, max_tokens: 1000 };
148
161
  try {
149
162
  const chatResult = await apiCall(providerUrl, providerApiKey, chatBody);
150
163
  const reply = chatResult.choices?.[0]?.message?.content || '';
@@ -417,6 +430,7 @@ module.exports = {
417
430
  regenerateStep: { type: 'number', description: '(retry) Yeniden calistirilacak adim numarasi' },
418
431
  newParams: { type: 'object', description: '(retry) Yeni parametreler' },
419
432
  description: { type: 'string', description: 'Aciklama' },
433
+ conversationHistory: { type: 'array', description: '(internal) REPL konusma gecmisi', items: { type: 'object' } },
420
434
  },
421
435
  required: ['action'],
422
436
  },
@@ -23,6 +23,8 @@ function buildTiers(opts) {
23
23
  skillsIndexBlock = '',
24
24
  crossSessionContext = '',
25
25
  userHome = '',
26
+ platform = '',
27
+ desktopPath = '',
26
28
  hasHistory = false,
27
29
  memoryFacts = [],
28
30
  projectRules = '',
@@ -58,7 +60,8 @@ function buildTiers(opts) {
58
60
  `ONEMLI: Tool cagirma SIMULE ETME. Sadece duz metin cevap ver. Islem yapmak gerekirse tool'u gercekten cagir.`,
59
61
  `TOOL KURALI: Selamlasma, sohbet, bilgi sorusu, fikir/aciklama isteklerinde TOOL CAGIRMA — dogrudan yanit ver. Bu en hizli ve en ucuz yoldur.`,
60
62
  `EYLEM gerektiren isteklerde (dosya okuma/yazma, komut calistirma, arama, hatirlatici, cok adimli gorev) workflow(action="run", task="<istek>") cagir — uygun tool'lari secip sirayla calistirir.`,
61
- `Tek ve net bir tool yeterliyse (or. read_file, web_search) workflow yerine dogrudan o tool'u cagirabilirsin.`,
63
+ `Tek ve net bir tool yeterliyse (or. read_file, web_search, write_file) workflow yerine dogrudan o tool'u cagirabilirsin.`,
64
+ `DOSYA YAZMA: SADECE write_file tool'unu kullan. "bulk-file-operations", "create-file", "file-write" gibi tool'lar YOK. write_file(content, file_path) kullan. Dosya yolu olarak desktopPath veya userHome kullan.`,
62
65
  `COK KRITIK: Goreve baslamadan ONCE <available_skills> listesini tara. Ilgili skill varsa skill_view(name) ile yukle, SONRA goreve basla.`,
63
66
  `KRITIK: Skill yuklemeden islem yapma. Ilgili skill varsa once yukle.`,
64
67
  `KRITIK: Kullanici kisisel bilgi verdiginde memory(action=add, target=user) ile kaydet.`,
@@ -88,6 +91,8 @@ function buildTiers(opts) {
88
91
 
89
92
  // User environment (stable within session but changes on resume)
90
93
  userHome ? `Kullanicinin home: ${userHome}` : '',
94
+ platform ? `Isletim sistemi: ${platform}` : '',
95
+ desktopPath ? `Masaustu yolu: ${desktopPath}` : '',
91
96
  hasHistory ? 'Bu oturum daha onceki konusmalarin devami.' : '',
92
97
  ].filter(Boolean).join('\n');
93
98