natureco-cli 5.27.0 → 5.29.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 +16 -0
- package/package.json +1 -1
- package/src/commands/ask.js +11 -2
- package/src/tools/agentic-runner.js +42 -1
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,22 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes to NatureCo CLI will be documented in this file.
|
|
4
4
|
|
|
5
|
+
## [5.29.0] - 2026-07-04 — "ask KUTU-ÇIKIŞI DÜZELTMESİ + çekirdek komut denetimi"
|
|
6
|
+
|
|
7
|
+
### 🐛 Düzeltme
|
|
8
|
+
- **`natureco ask` kutu-cikisi patliyordu**: `defaultBotId` ayarli degilse "Varsayilan bot ayarlanmamis" ile cikiyordu (birincil komut, yeni kullaniciyi duvara toslatiyordu). Artik ayarli degilse hesaptaki ILK botu otomatik secer; hic bot yoksa net yonlendirme.
|
|
9
|
+
|
|
10
|
+
### ✅ Çekirdek komut denetimi (MiniMax + Gemini ile)
|
|
11
|
+
`ask` (duzeltildi), `chat`, `code`, `memory`, `models`, `cost`, `doctor` (10/10 PASS), `help`, `--version` → hepsi calisiyor. (Harici servis gerektiren discord/telegram/cron/mcp/signal denetim disi.)
|
|
12
|
+
|
|
13
|
+
## [5.28.0] - 2026-07-04 — "AJAN EXEC GÜVENLİK POLİTİKASI (deny-by-default)"
|
|
14
|
+
|
|
15
|
+
### 🔒 Güvenlik
|
|
16
|
+
- **Ajan exec politikasi**: agentic yolda `bash` artik deny-by-default — ajan yalnizca guvenli komut SINIFLARINI otonom calistirir (node/npm/npx/python/pip/go/cargo/git-local/ls/grep/mkdir/test-runner...). Ag/yayin/sistem/ayricalik komutlari (curl, wget, ssh, scp, sudo, git push, npm publish, docker, systemctl...) OTOMATIK CALISTIRILMAZ; zincirdeki gizli komut da yakalanir (`ls && curl` → blok). Neden interaktif y/n degil: pipe/CI/non-TTY'de calismaz + REPL readline'iyla cakisir + kullanici tikla-gec yapar → deny-by-default politika otonom ajan icin daha guvenli. Power-user: `NATURECO_AGENT_EXEC=full`.
|
|
17
|
+
- Katmanli guvenlik: yikici-komut guard (rm -rf) + exec politikasi + bash.js approvals + agentic allowlist (yalnizca 7 arac).
|
|
18
|
+
|
|
19
|
+
Doğrulama: mesru kodlama komutlari (node/npm) E2E calisir; curl/git push/npm publish engellenir; **489 test yeşil**, ESLint temiz.
|
|
20
|
+
|
|
5
21
|
## [5.27.0] - 2026-07-04 — "GEMINI DÜZELTMESİ + DÖNGÜ BİRLEŞTİRME (2 sağlayıcı E2E)"
|
|
6
22
|
|
|
7
23
|
### 🐛 Düzeltme / ✨ İyileştirme
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "natureco-cli",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.29.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"
|
package/src/commands/ask.js
CHANGED
|
@@ -14,10 +14,19 @@ async function ask(question, options = {}) {
|
|
|
14
14
|
}
|
|
15
15
|
|
|
16
16
|
const config = getConfig();
|
|
17
|
-
|
|
17
|
+
let defaultBotId = config.defaultBotId;
|
|
18
18
|
|
|
19
|
+
// defaultBotId ayarli degilse hesaptaki ILK botu otomatik sec — birincil bir komut
|
|
20
|
+
// ("natureco ask ...") kutu-cikisi patlamasin. (chat/code zaten cfg.botName ile calisir.)
|
|
19
21
|
if (!defaultBotId) {
|
|
20
|
-
|
|
22
|
+
try {
|
|
23
|
+
const { bots } = await getBots(apiKey);
|
|
24
|
+
if (bots && bots.length > 0) defaultBotId = bots[0].id;
|
|
25
|
+
} catch { /* ag hatasi — asagida net mesaj */ }
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
if (!defaultBotId) {
|
|
29
|
+
console.log(chalk.red('\n❌ Hiç bot bulunamadı. "natureco chat" ile yerel sağlayıcıyı kullanabilir ya da bir bot oluşturabilirsiniz.\n'));
|
|
21
30
|
process.exit(1);
|
|
22
31
|
}
|
|
23
32
|
|
|
@@ -47,6 +47,42 @@ function defaultIsDangerous(cmd) {
|
|
|
47
47
|
try { return require('../utils/approvals').isDangerousCommand(cmd); } catch { return false; }
|
|
48
48
|
}
|
|
49
49
|
|
|
50
|
+
// Ajan exec politikasi (deny-by-default): ajan yalnizca guvenli komut SINIFLARINI
|
|
51
|
+
// otonom calistirir. Ag/yayin/sistem/ayricalik komutlari (curl, wget, ssh, sudo,
|
|
52
|
+
// git push, npm publish, docker, systemctl...) engellenir — model urettigi komut
|
|
53
|
+
// milyonlarca cihazda kontrolsuz calismasin. Power-user: NATURECO_AGENT_EXEC=full.
|
|
54
|
+
// Interaktif y/n yerine bunu sectik: pipe/CI/non-TTY'de calisir, readline cakismaz,
|
|
55
|
+
// deterministik + test edilebilir (kullanici tikla-gec etmez).
|
|
56
|
+
const AGENT_EXEC_ALLOW = new Set([
|
|
57
|
+
'node', 'npm', 'npx', 'yarn', 'pnpm', 'bun', 'deno',
|
|
58
|
+
'python', 'python3', 'py', 'pip', 'pip3', 'pipx', 'pytest', 'poetry',
|
|
59
|
+
'go', 'cargo', 'rustc', 'java', 'javac', 'mvn', 'gradle', 'ruby', 'gem', 'bundle',
|
|
60
|
+
'php', 'composer', 'dotnet', 'tsc', 'tsx', 'ts-node', 'jest', 'vitest', 'mocha',
|
|
61
|
+
'eslint', 'prettier', 'ruff', 'black', 'flake8', 'mypy', 'make', 'cmake', 'meson', 'ninja',
|
|
62
|
+
'ls', 'dir', 'cat', 'type', 'head', 'tail', 'pwd', 'echo', 'printf', 'grep', 'findstr',
|
|
63
|
+
'find', 'wc', 'which', 'where', 'whereis', 'tree', 'stat', 'file', 'sort', 'uniq', 'diff',
|
|
64
|
+
'mkdir', 'touch', 'cp', 'copy', 'mv', 'move', 'git', 'jq', 'sed', 'awk', 'date', 'env', 'whoami',
|
|
65
|
+
]);
|
|
66
|
+
const AGENT_EXEC_BLOCK_PATTERNS = [
|
|
67
|
+
/\bnpm\s+publish\b/i, /\byarn\s+publish\b/i, /\bpnpm\s+publish\b/i,
|
|
68
|
+
/\bgit\s+push\b/i, /\bgit\s+remote\s+(add|set-url)\b/i,
|
|
69
|
+
/\bnpm\s+(un)?deprecate\b/i, /\bnpm\s+owner\b/i,
|
|
70
|
+
];
|
|
71
|
+
function agentExecAllowed(command) {
|
|
72
|
+
if (String(process.env.NATURECO_AGENT_EXEC || '').toLowerCase() === 'full') return true;
|
|
73
|
+
const cmd = String(command || '').trim();
|
|
74
|
+
if (!cmd) return false;
|
|
75
|
+
if (AGENT_EXEC_BLOCK_PATTERNS.some(re => re.test(cmd))) return false;
|
|
76
|
+
// pipe/zincir (&&, ||, |, ;) ile ayrilmis HER segmentin ilk komutunu dogrula
|
|
77
|
+
const segments = cmd.split(/&&|\|\||\||;/).map(s => s.trim()).filter(Boolean);
|
|
78
|
+
for (const seg of segments) {
|
|
79
|
+
const first = (seg.split(/\s+/)[0] || '').replace(/^["']|["']$/g, '');
|
|
80
|
+
const base = (first.split(/[\\/]/).pop() || '').toLowerCase().replace(/\.(exe|cmd|bat|ps1)$/, '');
|
|
81
|
+
if (!AGENT_EXEC_ALLOW.has(base)) return false;
|
|
82
|
+
}
|
|
83
|
+
return true;
|
|
84
|
+
}
|
|
85
|
+
|
|
50
86
|
/**
|
|
51
87
|
* Model metninden agentic tool cagrilarini cikar.
|
|
52
88
|
* Destekler: <invoke name><parameter name> (opsiyonel <minimax:tool_call> sarmali),
|
|
@@ -249,6 +285,11 @@ async function executeCall(call, opts = {}) {
|
|
|
249
285
|
records.push({ tool: 'bash', status: 'error', args: { command: cmd }, error: 'Yikici/tehlikeli komut ajan modunda engellendi' });
|
|
250
286
|
return { records, feedback: `bash: "${cmd.slice(0, 80)}" yikici/tehlikeli goruldugu icin ajan tarafindan CALISTIRILMADI. Gerekirse kullanici komutu kendisi calistirabilir.` };
|
|
251
287
|
}
|
|
288
|
+
const execOk = opts.agentExecAllowed || agentExecAllowed;
|
|
289
|
+
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.` };
|
|
292
|
+
}
|
|
252
293
|
}
|
|
253
294
|
|
|
254
295
|
let mod;
|
|
@@ -319,4 +360,4 @@ async function runAgentic({ callModel, systemPrompt, historyMessages, task, tool
|
|
|
319
360
|
return { records: allRecords, reply: finalReply, iterations };
|
|
320
361
|
}
|
|
321
362
|
|
|
322
|
-
module.exports = { parseAgenticCalls, stripProtocolTokens, executeCall, runAgentic, expandHome, makeStreamFilter, makeSanitizeStream, TOOL_ALIASES, DEFAULT_ALLOWED };
|
|
363
|
+
module.exports = { parseAgenticCalls, stripProtocolTokens, executeCall, runAgentic, expandHome, makeStreamFilter, makeSanitizeStream, agentExecAllowed, TOOL_ALIASES, DEFAULT_ALLOWED };
|