natureco-cli 5.29.0 → 5.30.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,15 @@
2
2
 
3
3
  All notable changes to NatureCo CLI will be documented in this file.
4
4
 
5
+ ## [5.30.0] - 2026-07-04 — "TAM KONTROL MODU (sahip opt-in: tüm araç+skill + computer-use)"
6
+
7
+ ### ✨ Yeni
8
+ - **Tam kontrol modu** (`natureco config set agentExec full` veya `NATURECO_AGENT_EXEC=full`): sahibi opt-in yapinca ajan **TUM araclara + skill'lere** erisir ve **her shell komutunu** calistirabilir (yikici komutlar — rm -rf — tam modda bile bloklu kalir). Computer-use araclari: `mac_app_open` (WhatsApp/Chrome/Spotify ac), `browser` (Playwright otomasyonu), `computer_use` (GUI: tikla/yaz/ekran goruntusu), `social_open` (muzik/video), `macos_screenshot`. Full modda sistem prompt'u bu araclari modele tanitir ("yapamam deme, ilgili araci cagir").
9
+ - Safe modda (varsayilan) `open`/`start`/`xdg-open` (uygulama/URL ac) da izinli — asistan temel acma islerini yapar.
10
+ - **Iki kademeli guvenlik**: Safe (varsayilan, milyonlar) = dosya araclari + guvenli shell. Full (sahip opt-in) = her sey. Katmanli: yikici-komut guard her modda aktif.
11
+
12
+ Doğrulama: full modda `browser` araci E2E (example.com → "Example Domain"); **492 test yeşil**, ESLint temiz.
13
+
5
14
  ## [5.29.0] - 2026-07-04 — "ask KUTU-ÇIKIŞI DÜZELTMESİ + çekirdek komut denetimi"
6
15
 
7
16
  ### 🐛 Düzeltme
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "natureco-cli",
3
- "version": "5.29.0",
3
+ "version": "5.30.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"
@@ -62,13 +62,18 @@ const AGENT_EXEC_ALLOW = new Set([
62
62
  'ls', 'dir', 'cat', 'type', 'head', 'tail', 'pwd', 'echo', 'printf', 'grep', 'findstr',
63
63
  'find', 'wc', 'which', 'where', 'whereis', 'tree', 'stat', 'file', 'sort', 'uniq', 'diff',
64
64
  'mkdir', 'touch', 'cp', 'copy', 'mv', 'move', 'git', 'jq', 'sed', 'awk', 'date', 'env', 'whoami',
65
+ 'open', 'start', 'xdg-open', 'explorer', // uygulama/URL/dosya ac (dusuk risk, asistan icin gerekli)
65
66
  ]);
66
67
  const AGENT_EXEC_BLOCK_PATTERNS = [
67
68
  /\bnpm\s+publish\b/i, /\byarn\s+publish\b/i, /\bpnpm\s+publish\b/i,
68
69
  /\bgit\s+push\b/i, /\bgit\s+remote\s+(add|set-url)\b/i,
69
70
  /\bnpm\s+(un)?deprecate\b/i, /\bnpm\s+owner\b/i,
70
71
  ];
71
- function agentExecAllowed(command) {
72
+ // Full modda ("agentExec: full") acilan computer-use araclari: tarayici otomasyonu,
73
+ // uygulama ac/kapat, GUI (tikla/yaz/ekran goruntusu). Safe modda (varsayilan) KAPALI.
74
+ const FULL_TOOLS = ['browser', 'browser_use', 'mac_app_open', 'mac_app_quit', 'social_open', 'computer_use', 'macos_screenshot'];
75
+ function agentExecAllowed(command, opts) {
76
+ if (opts && opts.full) return true;
72
77
  if (String(process.env.NATURECO_AGENT_EXEC || '').toLowerCase() === 'full') return true;
73
78
  const cmd = String(command || '').trim();
74
79
  if (!cmd) return false;
@@ -262,9 +267,10 @@ async function executeCall(call, opts = {}) {
262
267
  return { records, feedback: feedbacks.join('\n') };
263
268
  }
264
269
 
265
- if (!allowed.has(norm)) {
266
- records.push({ tool: rawTool, status: 'error', error: 'Bu modda kullanilamayan arac: ' + rawTool });
267
- return { records, feedback: `${rawTool}: bu arac bu modda kullanilamaz (izin verilenler: ${[...allowed].join(', ')})` };
270
+ // Full modda (sahibin opt-in'i) TUM araclar acik; safe modda sadece allowlist.
271
+ if (!opts.execFull && !allowed.has(norm)) {
272
+ records.push({ tool: rawTool, status: 'error', error: 'Guvenli modda kapali arac: ' + rawTool });
273
+ return { records, feedback: `${rawTool}: guvenli modda kapali. Tum arac+skill'ler icin tam mod: "natureco config set agentExec full" (veya NATURECO_AGENT_EXEC=full). Guvenli modda acik: ${[...allowed].join(', ')}` };
268
274
  }
269
275
 
270
276
  const args = { ...(call.args || {}) };
@@ -285,10 +291,10 @@ async function executeCall(call, opts = {}) {
285
291
  records.push({ tool: 'bash', status: 'error', args: { command: cmd }, error: 'Yikici/tehlikeli komut ajan modunda engellendi' });
286
292
  return { records, feedback: `bash: "${cmd.slice(0, 80)}" yikici/tehlikeli goruldugu icin ajan tarafindan CALISTIRILMADI. Gerekirse kullanici komutu kendisi calistirabilir.` };
287
293
  }
288
- const execOk = opts.agentExecAllowed || agentExecAllowed;
294
+ const execOk = opts.agentExecAllowed || ((c) => agentExecAllowed(c, { full: opts.execFull }));
289
295
  if (!execOk(cmd)) {
290
- records.push({ tool: 'bash', status: 'error', args: { command: cmd }, error: 'Ajan exec politikasi disinda' });
291
- return { records, feedback: `bash: "${cmd.slice(0, 80)}" ajan guvenlik politikasi disinda (ag/yayin/sistem komutu olabilir). Otomatik CALISTIRILMADI. Kullanici manuel calistirabilir; tum komutlara izin: NATURECO_AGENT_EXEC=full.` };
296
+ records.push({ tool: 'bash', status: 'error', args: { command: cmd }, error: 'Guvenli mod exec politikasi disinda' });
297
+ return { records, feedback: `bash: "${cmd.slice(0, 80)}" guvenli mod politikasi disinda (ag/yayin/sistem). Tam kontrol icin: "natureco config set agentExec full" (veya NATURECO_AGENT_EXEC=full). Yikici komutlar (rm -rf) tam modda bile bloklu.` };
292
298
  }
293
299
  }
294
300
 
@@ -320,12 +326,12 @@ async function executeCall(call, opts = {}) {
320
326
  * callModel(messages) => Promise<{ content, toolCalls }>
321
327
  * Donus: { records, reply, iterations }
322
328
  */
323
- async function runAgentic({ callModel, systemPrompt, historyMessages, task, toolsDir, loadTool, allowed, maxIterations = 15 }) {
329
+ async function runAgentic({ callModel, systemPrompt, historyMessages, task, toolsDir, loadTool, allowed, execFull, maxIterations = 15 }) {
324
330
  const messages = [{ role: 'system', content: systemPrompt }];
325
331
  for (const mm of historyMessages || []) messages.push({ role: mm.role, content: mm.content || '' });
326
332
  messages.push({ role: 'user', content: task });
327
333
 
328
- const allowedSet = allowed ? new Set(allowed) : new Set(DEFAULT_ALLOWED);
334
+ const allowedSet = allowed ? new Set(allowed) : new Set([...DEFAULT_ALLOWED, ...(execFull ? FULL_TOOLS : [])]);
329
335
  const allRecords = [];
330
336
  let finalReply = '';
331
337
  let iterations = 0;
@@ -343,7 +349,7 @@ async function runAgentic({ callModel, systemPrompt, historyMessages, task, tool
343
349
  messages.push({ role: 'assistant', content: content || '' });
344
350
  const feedbacks = [];
345
351
  for (const call of calls) {
346
- const { records, feedback } = await executeCall(call, { toolsDir, loadTool, allowed: allowedSet });
352
+ const { records, feedback } = await executeCall(call, { toolsDir, loadTool, allowed: allowedSet, execFull });
347
353
  allRecords.push(...records);
348
354
  feedbacks.push(feedback);
349
355
  }
@@ -222,6 +222,23 @@ async function workflow(params) {
222
222
  const { runAgentic } = require('./agentic-runner');
223
223
  const memCtx = memoryContext();
224
224
  const desktop = path.join(os.homedir(), 'Desktop');
225
+ // Tam mod (sahibin opt-in'i): tum arac+skill'ler acilir, keyfi shell (yikici haric).
226
+ const execFull = cfg.agentExec === 'full' || cfg.computerUse === true || String(process.env.NATURECO_AGENT_EXEC || '').toLowerCase() === 'full';
227
+ let fullToolsBlock = '';
228
+ if (execFull) {
229
+ const allNames = tools.filter(t => t !== 'workflow');
230
+ fullToolsBlock = [
231
+ '\n\nTAM MOD ACIK — su araclara da ERISIMIN VAR; o an ne gerekiyorsa dogrudan cagir:',
232
+ '- mac_app_open: macOS uygulamasi ac. parametre: appName (orn. "WhatsApp", "Google Chrome", "Spotify")',
233
+ '- mac_app_quit: macOS uygulamasi kapat. parametre: appName',
234
+ '- browser: tarayici otomasyonu (Playwright). parametreler: action ("open"/"screenshot"/"html"/"evaluate"), url, script',
235
+ '- computer_use: GUI otomasyonu. parametreler: action ("screenshot"/"click"/"type"/"keypress"/"scroll"), x, y, text, key',
236
+ '- social_open: muzik/video/sosyal ac. parametreler: query, platform (spotify/youtube...)',
237
+ '- macos_screenshot: ekran goruntusu al',
238
+ '- bash ile de acabilirsin: "open -a WhatsApp", "open https://...", "start chrome https://..."',
239
+ '\nTum arac listesi (isimle cagir; parametre yanlissa <tool_results> duzeltir): ' + allNames.join(', '),
240
+ ].join('\n');
241
+ }
225
242
  const sysMsg = [
226
243
  'Sen NatureCo adli, arac kullanabilen bir yapay zeka ajanisin. Kullanicinin istegini SADECE anlatarak degil, ARACLARI cagirarak fiilen gerceklestir.',
227
244
  memCtx ? '\nKullanici bilgisi:\n' + memCtx : '',
@@ -244,6 +261,8 @@ async function workflow(params) {
244
261
  '- Goreceli yol yerine TAM yol kullan.',
245
262
  '- Arac sonuclari <tool_results> icinde geri gelir; gorev bitince ARAC CAGIRMADAN tek cumlelik ozet yaz.',
246
263
  '- Basit sohbet/selamlasma ise arac cagirma, dogrudan kisa yanit ver.',
264
+ execFull ? '- Kullanici uygulama ac / tarayici kontrol / muzik cal / ekran / GUI istediyse yukaridaki computer-use araclarini KULLAN — "yapamam/engellendi" DEME, dogrudan ilgili araci cagir.' : '',
265
+ fullToolsBlock,
247
266
  skillsIndexBlock ? '\n\n' + skillsIndexBlock : '',
248
267
  ].filter(Boolean).join('\n');
249
268
 
@@ -276,7 +295,7 @@ async function workflow(params) {
276
295
  try {
277
296
  const { records, reply } = await runAgentic({
278
297
  callModel, systemPrompt: sysMsg, historyMessages, task,
279
- toolsDir: __dirname, maxIterations: 15,
298
+ toolsDir: __dirname, execFull, maxIterations: 15,
280
299
  });
281
300
  const fileWrites = records.filter(r => r.tool === 'write_file' && r.status === 'done');
282
301
  let finalReply = reply || '';