natureco-cli 5.39.0 → 5.41.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/CHANGELOG.md CHANGED
@@ -2,6 +2,34 @@
2
2
 
3
3
  All notable changes to NatureCo CLI will be documented in this file.
4
4
 
5
+ ## [5.41.0] - 2026-07-08 — "sub-agent orchestration + plan modu PHANTOM idi, açıldı"
6
+
7
+ Kullanıcının "sub-agent orchestration ve plan modunda açık kalmasın" talebiyle: ikisi de mevcut+çalışır kod (`sub_agent.js`, `plan.js`) AMA agentic-runner `DEFAULT_ALLOWED`'da ve workflow sysMsg'inde YOKTU → agent bunları çağıramıyordu (klasik phantom-tool deseni).
8
+
9
+ ### ✨ Açılan yetenekler (kod vardı, agent erişemiyordu)
10
+ - **sub_agent** (orchestration): agent bir alt-görevi bağımsız bir alt-agent'a devreder (kendi LLM çağrısı, sonucu döner). Birden fazla çağırarak paralel/çok-parçalı orchestration yapar. Güvenli (sadece LLM çağrısı, shell/dosya yok) → safe-mode allowlist'e eklendi.
11
+ - **plan** (plan modu): karmaşık görev için önce plan çıkarır (SADECE metin + `~/.natureco/plans/*.md`, hiçbir işlem yapmaz). safe-mode allowlist'e eklendi.
12
+ - Her ikisi de workflow sysMsg'de tanıtıldı (agent ne zaman/nasıl kullanacağını bilir). Provider-bağımsız (MiniMax/Gemini/OpenAI endpoint routing içeriyor).
13
+
14
+ ### ✓ Doğrulama (agent yolu E2E, MiniMax)
15
+ - plan: agent `plan` aracıyla 10-adımlık detaylı React todo planı çıkardı.
16
+ - sub_agent: agent alt-agent spawn edip "list comprehension nedir" sordurup yanıtı iletti.
17
+ - **çoklu orchestration**: agent İKİ ayrı alt-agent'a iki görev delege etti (5!=120, HTTP 404) ve ikisini özetledi.
18
+ - 533 test yeşil (sub_agent+plan phantom regresyon kilidi), ESLint temiz.
19
+
20
+ ## [5.40.0] - 2026-07-08 — "CROSS-SESSION HAFIZA bozulması düzeltildi (gerçek macOS SSH testinde bulundu)"
21
+
22
+ Gerçek MacBook'a SSH ile bağlanıp canlı test yapılırken bulundu: kullanıcı "projemin gizli kod adı ONYX-7'yi hatırla" dediğinde, yeni oturumda HATIRLANMIYORDU. Kök neden zincirleme çözüldü.
23
+
24
+ ### 🐛 Cross-session hafıza (KRİTİK — kullanıcının en önemli özelliği)
25
+ - **Otomatik fact-extraction masum ifadeleri bozuyordu (asıl kök neden)**: `repl.js` her oturum sonunda regex ile fact çıkarıyordu; pattern `ad[ıi]m?` — **`m` OPSİYONEL** — "kod **adı**", "proje **adı**", "dosya **adı**" gibi tamlamaları "kullanıcı adı" sanıyor, değeri de `toLowerCase()`+`\w+` ile bozuyordu: **"gizli kod adı ZEPHYR-9" → "Kullanici ad: zephyr"**. Agent `memory_write` ile DOĞRU kaydetse bile üzerine bu YANLIŞ fact yazılıyor, recall bozuluyordu. Artık: `m` zorunlu ("benim adım/adım/ismim X" yakalanır, "kod adı" YAKALANMAZ), değer orijinal case'de korunur (ZEPHYR-9 bozulmaz), aşırı geniş `bana .* de` kaldırıldı. Ayrıca konum eki `[dt]e`→`[dt][ae]` (da/de/ta/te), tercih/konum nesnesi fiilden ÖNCE (Türkçe dil bilgisi). Fonksiyon module-level `extractPreferenceFacts`'e taşındı + 5 regresyon testi.
26
+ - **loadUserMemory sıralama**: flat fact'ler dosya sırasıyla ilk 15'i alınıyordu → çok fact olunca EN YENİ kayıt (yeni öğrenilen kod adı) sysMsg'e girmeden kesiliyordu. Artık skor + tarihe göre sıralanıp ilk 25 alınır (en güncel/önemli garanti).
27
+ - **Limit tutarsızlığı**: `repl.js` fact'leri 15'e, `memory_write` 50'ye (MAX_FACTS) kesiyordu — repl'in 15 sert limiti yeni fact'leri sessizce siliyordu. İkisi 50'de (NATURECO_MAX_FACTS) birleştirildi.
28
+ - **memory kaydetme kuralı** (agentic sysMsg): "spesifik değerleri (kod/isim/sayı/tarih) AYNEN koru, doğru etiketle (proje kod adı ≠ kullanıcı adı)" kuralı eklendi.
29
+
30
+ ### ✓ Gerçek macOS (Darwin 25.5.0, arm64) SSH doğrulaması
31
+ node v26.4.0 + natureco kurulu. Doğrulanan: grep_search (ripgrep yolu), code_execution (python3+node), git (log+enjeksiyon+remote-guard), cron_create (oluştur+`cron list`'te görünür+remove), http_request/duckduckgo/memory_tree, agentic chat + write_file, **ve düzeltme sonrası**: "kod adı FALCON-3" → doğru kaydedildi + yeni oturumda hatırlandı. 532 test yeşil (repl-memory regresyon +5), ESLint temiz.
32
+
5
33
  ## [5.39.0] - 2026-07-08 — "CROSS-PLATFORM: grep_search + social_open Windows'ta kırıktı, düzeltildi"
6
34
 
7
35
  Platform-uyumluluk denetimi: 90 aracın 18'i platform-özel. Çekirdek chat/code araçlarının Windows VE macOS'ta çalışması hedeflendi. 2 çekirdek/computer-use aracı saf Windows'ta kırıktı.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "natureco-cli",
3
- "version": "5.39.0",
3
+ "version": "5.41.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"
@@ -20,6 +20,32 @@ const path = require('path');
20
20
  const os = require('os');
21
21
  const https = require('https');
22
22
  const { spawn } = require('child_process');
23
+
24
+ /**
25
+ * v5.40: Oturum-sonu pattern-tabanli isim/tercih cikarimi — SAF fonksiyon (test
26
+ * edilebilir; regresyon kilidi). Eskiden persistSessionToMemory icinde gomuluydu
27
+ * ve "ad[ıi]m?" (m OPSIYONEL) pattern'i "kod adı", "proje adı", "dosya adı" gibi
28
+ * MASUM tamlamalari "kullanici adi" saniyor + degeri lowercase/\w ile bozuyordu
29
+ * ("gizli kod adı ZEPHYR-9" → "Kullanici ad: zephyr"). Bu, agent memory_write ile
30
+ * DOGRU kaydetse bile uzerine YANLIS fact yazip cross-session recall'i bozuyordu.
31
+ * @param {string} content Kullanici mesaji (orijinal case)
32
+ * @returns {Array<{key:string, category:string, value:string}>}
33
+ */
34
+ function extractPreferenceFacts(content) {
35
+ const patterns = [
36
+ // ad: "benim adım X" / "adım X" / "ismim X" — m ZORUNLU; "kod adı" (adı) YAKALANMAZ.
37
+ { match: /(?:benim\s+ad[ıi]m|(?:^|\s)ad[ıi]m|[iı]smim)\s+([A-Za-zÇĞİÖŞÜçğıöşü][\wÇĞİÖŞÜçğıöşü.-]*)/i, category: 'personal', key: 'ad' },
38
+ // tercih/konum: nesne fiilden ONCE gelir (TR) — deger orijinal case korunur.
39
+ { match: /([A-Za-zÇĞİÖŞÜçğıöşü][\wÇĞİÖŞÜçğıöşü.-]*)['’]?[ıi]?\s*(?:seviyorum|hoşlan[ıi]yorum|beğeniyorum)/i, category: 'preference', key: 'sevilen' },
40
+ { match: /([A-Za-zÇĞİÖŞÜçğıöşü][\wÇĞİÖŞÜçğıöşü.-]*)['’]?[dt][ae]\s+(?:yaşıyorum|oturuyorum|kalıyorum)/i, category: 'location', key: 'yer' },
41
+ ];
42
+ const out = [];
43
+ for (const p of patterns) {
44
+ const m = (content || '').match(p.match);
45
+ if (m) out.push({ key: p.key, category: p.category, value: `Kullanici ${p.key}: ${m[1].trim()}` });
46
+ }
47
+ return out;
48
+ }
23
49
  const chalk = require('chalk');
24
50
  const tui = require('../utils/tui');
25
51
  const { loadToolDefinitions, toOpenAIFormat, executeTool } = require('../utils/tools');
@@ -1252,20 +1278,12 @@ async function startRepl(args) {
1252
1278
  // Bot adı sorgulanmış olabilir, mevcut adı koru
1253
1279
  }
1254
1280
 
1255
- // Kisilik tercihleri (genel pattern'ler)
1256
- const prefPatterns = [
1257
- { match: /(?:benim ad[ıi]m?|bana\s+.*de|ad[ıi]m?)\s+(\w+)/i, category: 'personal', key: 'ad' },
1258
- { match: /(?:seviyorum|hoşlan[ıi]yorum|beğeniyorum)\s+(\w+)/i, category: 'preference', key: 'sevilen' },
1259
- { match: /(?:yaşıyorum|oturuyorum|kalıyorum)\s+(\w+)/i, category: 'location', key: 'yer' },
1260
- ];
1261
- for (const p of prefPatterns) {
1262
- const m2 = msg.content.match(p.match);
1263
- if (m2) {
1264
- const val = m2[1].toLowerCase();
1265
- const fact = `Kullanici ${p.key}: ${val}`;
1266
- if (!(memory.facts || []).some(f => f.value === fact)) {
1267
- newFacts.push({ value: fact, score: 6, category: p.category, createdAt: new Date().toISOString() });
1268
- }
1281
+ // v5.40: Kisilik/isim cikarimi module-level SAF extractPreferenceFacts'e
1282
+ // tasindi (test edilebilir + regresyon kilidi). "kod adı"/"proje adı" gibi
1283
+ // masum tamlamalari artik yanlis yakalamiyor; deger orijinal case'de kalir.
1284
+ for (const pf of extractPreferenceFacts(msg.content)) {
1285
+ if (!(memory.facts || []).some(f => (f.value || '').toLowerCase() === pf.value.toLowerCase())) {
1286
+ newFacts.push({ value: pf.value, score: 6, category: pf.category, createdAt: new Date().toISOString() });
1269
1287
  }
1270
1288
  }
1271
1289
  }
@@ -1285,11 +1303,13 @@ async function startRepl(args) {
1285
1303
  factsAdded = uniqueFacts.length;
1286
1304
  }
1287
1305
 
1288
- // Decay (eski fact'leri dusuk skora dusur)
1289
- if (memory.facts && memory.facts.length > 15) {
1290
- // Max 15 fact tut, en dusuk skorlu olanlari sil
1291
- memory.facts.sort((a, b) => (b.score || 5) - (a.score || 5));
1292
- memory.facts = memory.facts.slice(0, 15);
1306
+ // Decay: soft-cap. v5.40: memory_write ile UYUMLU (eski 15 sert limiti yeni
1307
+ // fact'leri sessizce kesiyordu recall kaybina yol aciyordu). 50 = MAX_FACTS.
1308
+ const CAP = (() => { const r = parseInt(process.env.NATURECO_MAX_FACTS || '', 10); return Number.isFinite(r) && r > 0 ? r : 50; })();
1309
+ if (memory.facts && memory.facts.length > CAP) {
1310
+ // En yuksek skor + en yeni once; dusukleri sil.
1311
+ memory.facts.sort((a, b) => ((b.score || 5) - (a.score || 5)) || String(b.updatedAt || b.createdAt || '').localeCompare(String(a.updatedAt || a.createdAt || '')));
1312
+ memory.facts = memory.facts.slice(0, CAP);
1293
1313
  }
1294
1314
  } catch (e) {
1295
1315
  // Sessizce devam et, kritik degil
@@ -1643,3 +1663,5 @@ async function startRepl(args) {
1643
1663
  }
1644
1664
 
1645
1665
  module.exports = startRepl;
1666
+ // v5.40: test icin — cross-session hafiza bozulma regresyonu (kod adı ≠ kullanici adi)
1667
+ module.exports.extractPreferenceFacts = extractPreferenceFacts;
@@ -25,6 +25,8 @@ const DEFAULT_ALLOWED = [
25
25
  'write_file', 'read_file', 'edit_file', 'skill_view', 'bash', 'file_search', 'list_dir', 'grep_search',
26
26
  'memory_write', 'memory_tree', 'cron_create', 'duckduckgo', 'web_search', 'todo_write',
27
27
  'git', 'http_request', 'notebook_edit', 'clarify', 'code_execution',
28
+ // orchestration + planlama (guvenli: sub_agent = alt-LLM cagrisi, plan = metin+.md; shell/sistem yok)
29
+ 'sub_agent', 'plan',
28
30
  // macOS asistan yetenekleri (Windows'ta zarafetle "sadece macOS" der; kullanıcının Mac'inde çalışır)
29
31
  'calendar_add', 'reminder_add', 'notes_add', 'mac_notify',
30
32
  // medya (kullanıcının kendi provider/API'siyle)
@@ -61,12 +61,18 @@ function loadUserMemory(username) {
61
61
  const key = v.trim().toLowerCase();
62
62
  if (!key || seen.has(key)) continue;
63
63
  seen.add(key);
64
- facts.push(v.trim());
64
+ // v5.40: skor + tarih koru — sysMsg'e EN GUNCEL/ONEMLI fact'ler girsin.
65
+ // Eski hali dosya sirasiyla ilk 15'i aliyordu → cok fact olunca en YENI
66
+ // kayit (or. yeni ogrenilen kod adi) kesiliyor, recall basarisiz oluyordu.
67
+ facts.push({ v: v.trim(), score: (f && typeof f.score === 'number') ? f.score : 0, t: (f && (f.updatedAt || f.createdAt)) || '' });
65
68
  }
66
69
  }
70
+ // v5.40: yuksek skor + en yeni once
71
+ facts.sort((a, b) => (b.score - a.score) || String(b.t).localeCompare(String(a.t)));
72
+ const factVals = facts.map(f => f.v);
67
73
  // isim memory.name'de yoksa fact'lerden cikar
68
74
  if (!name) {
69
- for (const f of facts) {
75
+ for (const f of factVals) {
70
76
  const match = f.toLowerCase().match(/(?:kullanici\s*adi?|kullanıcı\s*adı?|isim|name)\s*:?\s*(.+)/);
71
77
  if (match && match[1].trim().length > 2) { name = match[1].trim(); break; }
72
78
  }
@@ -74,7 +80,7 @@ function loadUserMemory(username) {
74
80
  const parts = [];
75
81
  if (name) parts.push(`Kullanici adi: ${name}`);
76
82
  if (botName) parts.push(`Bot adi: ${botName}`);
77
- if (facts.length > 0) parts.push(`Bilinenler: ${facts.slice(0, 15).join('; ')}`);
83
+ if (factVals.length > 0) parts.push(`Bilinenler: ${factVals.slice(0, 25).join('; ')}`);
78
84
  return parts.join('\n');
79
85
  } catch {}
80
86
  return '';
@@ -265,6 +271,8 @@ async function workflow(params) {
265
271
  '- git: git islemi. parametreler: operation (status/diff/log/branches/add/commit), args, message (commit icin). (Basit git icin bunu kullan.)',
266
272
  '- http_request: HTTP istegi at (API cagrisi, webhook, veri cekme). parametreler: url, method, headers, body.',
267
273
  '- code_execution: kod parcasi calistir (sandboxli). parametreler: code, language (python/node/bash).',
274
+ '- sub_agent: bir ALT-GOREVI bagimsiz bir alt-agent\'a devret (kendi LLM cagrisini yapar, sonucu doner). parametreler: task (zorunlu), context (ops.), maxTokens (ops.). Paralel arastirma, odakli alt-problem, ya da ana gorevi bolup parcalari delege etmek icin. Birden fazla cagirarak orchestrate edebilirsin.',
275
+ '- plan: karmasik/cok-adimli bir gorev icin ONCE plan cikar (SADECE plan metni uretir, HICBIR islem yapmaz; ~/.natureco/plans/ altina kaydeder). parametreler: action ("create" veya "list"), task (create icin), depth ("minimal"/"detailed"). Kullanici "plan yap / once planla / adimlari cikar / yol haritasi" derse bunu kullan.',
268
276
  '- notebook_edit: Jupyter (.ipynb) hucre duzenle. parametreler: filePath, ...',
269
277
  '- clarify: kullaniciya netlestirme sorusu sor (belirsizlik varsa). parametreler: question, options.',
270
278
  '- calendar_add / reminder_add / notes_add / mac_notify: macOS Takvim/Hatirlatici/Notlar/bildirim (kullanici macOS ise; degilse arac "sadece macOS" der).',
@@ -273,6 +281,7 @@ async function workflow(params) {
273
281
  '- memory_tree: AGAC-HAFIZA — zengin/kategorize kalici bilgi (proje, karar, teknik not, kisisel detay). action: index|read|search|append; username="' + memUser + '"; append icin: root (1-kisisel|2-teknik|3-kararlar) + branch (dal basligi) + content (yaprak). YENI oturumda hatirlanir.',
274
282
  '\nKurallar:',
275
283
  '- Kullanici kalici bilgi paylasirsa (isim, tercih, parola, proje, karar, onemli detay) ya da "hatirla / not al / kaydet" derse HEMEN KAYDET (username="' + memUser + '"): kisa tek bilgi → memory_write; zengin/kategorize bilgi → memory_tree(append, dogru root/branch). Trivial/gecici seyleri kaydetme.',
284
+ '- KAYIT KALITESI (onemli): fact\'i kullanicinin SOYLEDIGI ANLAMI ve SPESIFIK DEGERLERI koruyarak yaz. Kod/isim/sayi/tarih/parola gibi degerleri AYNEN gecir (or. "gizli kod adi ONYX-7" → fact: "Projenin gizli kod adi ONYX-7" — "ONYX-7"yi "onyx" yapma, kisaltma). Neyin ne oldugunu DOGRU etiketle: proje kod adi ≠ kullanici adi, sifre ≠ isim. Yanlis ozetleme yeni oturumda yanlis hatirlamaya yol acar.',
276
285
  '- Kullaniciya ozel bir sey sorulunca (gecmis, proje, tercih, karar) once memory_tree(search/read) ile ilgili kok/dali OKU (hedefli, tum hafizayi degil). Tek primary: bilgi tek yerde yasar; digerine sadece "bkz:". Credential/secret ASLA duz metin.',
277
286
  '- Bir is YARIM kalirsa ya da kullanici "sonra / yarin / daha sonra yapalim" derse memory_tree(action:append, root:"3-kararlar", branch:"Bekleyen İşler", content:"...") ile kaydet — yeni oturum basinda otomatik hatirlatilir. Bir bekleyen is TAMAMLANINCA memory_tree(action:remove, root:"3-kararlar", query:"<anahtar kelime>") ile kaldir.',
278
287
  '- Guncel/internet bilgisi gerektiren bir soru gelirse ONCE duckduckgo_search ile ara ("internet erisimim yok" DEME — bu arac her zaman calisir, API key gerekmez).',