natureco-cli 5.6.0 → 5.6.1

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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/src/utils/tools.js +40 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "natureco-cli",
3
- "version": "5.6.0",
3
+ "version": "5.6.1",
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"
@@ -22,15 +22,55 @@ const TOOLS_DIR = path.join(__dirname, '..', 'tools');
22
22
  * { name, description, parameters, execute } varsa kullan,
23
23
  * yoksa dosya adından otomatik üret.
24
24
  */
25
+
26
+ /**
27
+ * v5.6.1: Provider'a gore tool filtrele
28
+ * Groq validator cok kati — sadece basit tool'lar
29
+ * Anthropic, OpenAI tam tool seti kullanir
30
+ */
31
+ function getToolsForProvider(allTools, providerUrl) {
32
+ const url = (providerUrl || '').toLowerCase();
33
+
34
+ // Groq icin minimum tool seti
35
+ if (url.includes('groq.com')) {
36
+ const allowed = ['read_file', 'write_file', 'bash', 'shell_command', 'list_dir', 'soul', 'memory_write', 'memory_search'];
37
+ return allTools.filter(t => allowed.includes(t.name));
38
+ }
39
+
40
+ // Anthropic, OpenAI, MiniMax tam set
41
+ return allTools;
42
+ }
43
+
25
44
  function loadToolDefinitions() {
26
45
  const tools = [];
27
46
  const files = fs.readdirSync(TOOLS_DIR).filter(f => f.endsWith('.js'));
28
47
 
48
+ // v5.6.1: Provider tespiti - Groq icin sadece temel tool'lar
49
+ let isGroq = false;
50
+ try {
51
+ const { getConfig } = require('./config');
52
+ const cfg = getConfig();
53
+ if (cfg.providerUrl && cfg.providerUrl.toLowerCase().includes('groq.com')) {
54
+ isGroq = true;
55
+ }
56
+ } catch (e) {}
57
+
58
+ const GROQ_ALLOWED = new Set([
59
+ 'read_file', 'write_file', 'list_dir', 'bash', 'shell_command',
60
+ 'soul', 'memory_write', 'memory_search', 'filesystem', 'grep_search'
61
+ ]);
62
+
29
63
  for (const file of files) {
30
64
  try {
31
65
  const toolPath = path.join(TOOLS_DIR, file);
32
66
  const mod = require(toolPath);
33
67
 
68
+ // Groq icin sadece temel tool'lar
69
+ if (isGroq) {
70
+ const toolName = mod.name || path.basename(file, '.js');
71
+ if (!GROQ_ALLOWED.has(toolName)) continue;
72
+ }
73
+
34
74
  // Tool metadata çıkar
35
75
  const meta = {
36
76
  name: mod.name || path.basename(file, '.js'),