natureco-cli 5.62.0 → 5.64.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.
Files changed (44) hide show
  1. package/CHANGELOG.md +34 -1
  2. package/bin/natureco.js +10 -3
  3. package/package.json +8 -5
  4. package/scripts/benchmark-startup.js +26 -0
  5. package/src/commands/backup.js +3 -3
  6. package/src/commands/chat.js +17 -17
  7. package/src/commands/code.js +49 -14
  8. package/src/commands/code_v5.js +15 -1
  9. package/src/commands/gateway-server.js +128 -24
  10. package/src/commands/git.js +2 -2
  11. package/src/commands/pairing.js +2 -22
  12. package/src/commands/repl.js +118 -112
  13. package/src/tools/agentic-runner.js +41 -33
  14. package/src/tools/memory_write.js +16 -12
  15. package/src/tools/structural_patch.js +25 -0
  16. package/src/tools/workflow.js +10 -2
  17. package/src/utils/agent-core.js +51 -0
  18. package/src/utils/agent-workspace.js +24 -0
  19. package/src/utils/api.js +12 -8
  20. package/src/utils/channel-sdk.js +212 -0
  21. package/src/utils/code-intelligence.js +69 -0
  22. package/src/utils/coding-session.js +54 -0
  23. package/src/utils/delivery-store.js +34 -0
  24. package/src/utils/i18n.js +7 -1
  25. package/src/utils/json-schema.js +43 -0
  26. package/src/utils/lsp-client.js +129 -0
  27. package/src/utils/memory-record.js +49 -0
  28. package/src/utils/pairing-store.js +55 -0
  29. package/src/utils/pattern-detector.js +13 -3
  30. package/src/utils/plugin-registry.js +3 -3
  31. package/src/utils/process-errors.js +14 -7
  32. package/src/utils/runtime-health.js +28 -0
  33. package/src/utils/secret-store.js +90 -0
  34. package/src/utils/secure-sync.js +63 -0
  35. package/src/utils/skill-lifecycle.js +59 -0
  36. package/src/utils/structural-patch.js +68 -0
  37. package/src/utils/sub-agent.js +13 -2
  38. package/src/utils/test-failure-analyzer.js +64 -0
  39. package/src/utils/tool-execution-gateway.js +56 -0
  40. package/src/utils/tool-manifest.js +31 -0
  41. package/src/utils/tool-path-policy.js +49 -0
  42. package/src/utils/tool-result.js +17 -0
  43. package/src/utils/tool-runner.js +81 -53
  44. package/src/utils/tools.js +30 -42
@@ -5,18 +5,16 @@
5
5
  * v5.7.17: Emoji + toolset + check_fn + registry entegrasyonu.
6
6
  */
7
7
 
8
- const fs = require('fs');
9
- const path = require('path');
10
- const { globalRegistry } = require('./registry');
11
- const sandbox = require('./sandbox');
8
+ const { globalRegistry } = require('./registry');
9
+ const sandbox = require('./sandbox');
10
+ const { executeThroughGateway } = require('./tool-execution-gateway');
11
+ const { loadToolManifest } = require('./tool-manifest');
12
12
 
13
13
  // Lazy config read — avoids circular deps
14
14
  function _getSandboxLevel() {
15
15
  try { return sandbox.getLevel(require('./config').getConfig()); } catch { return 'none'; }
16
16
  }
17
17
 
18
- const TOOLS_DIR = path.join(__dirname, '..', 'tools');
19
-
20
18
  // ── Emoji map (central, tek kaynak) ──────────────────────────────────────
21
19
  const EMOJI_MAP = {
22
20
  // File operations
@@ -174,7 +172,7 @@ function getToolsForProvider(allTools, providerUrl) {
174
172
 
175
173
  function loadToolDefinitions() {
176
174
  const tools = [];
177
- const files = fs.readdirSync(TOOLS_DIR).filter(f => f.endsWith('.js'));
175
+ const manifest = loadToolManifest();
178
176
 
179
177
  let isGroq = false;
180
178
  try {
@@ -197,20 +195,19 @@ function loadToolDefinitions() {
197
195
  'soul', 'memory', 'memory_write', 'memory_search', 'filesystem', 'grep_search'
198
196
  ]);
199
197
 
200
- for (const file of files) {
201
- try {
202
- const toolPath = path.join(TOOLS_DIR, file);
203
- const mod = require(toolPath);
204
- const toolName = mod.name || path.basename(file, '.js');
198
+ for (const entry of manifest.values()) {
199
+ try {
200
+ const mod = entry.module;
201
+ const toolName = entry.name;
205
202
 
206
203
  if (isGroq && !GROQ_ALLOWED.has(toolName)) continue;
207
204
  if (disabledTools.has(toolName)) continue;
208
205
 
209
206
  const meta = {
210
207
  name: toolName,
211
- description: mod.description || `${path.basename(file, '.js')} tool`,
212
- parameters: mod.parameters || mod.inputSchema || { type: 'object', properties: {} },
213
- execute: mod.execute || (mod.default && mod.default.execute) || null,
208
+ description: entry.description,
209
+ parameters: entry.inputSchema,
210
+ execute: entry.execute,
214
211
  emoji: EMOJI_MAP[toolName] || '',
215
212
  toolset: TOOLSET_MAP[toolName] || 'general',
216
213
  checkFn: CHECK_FN_MAP[toolName] || null,
@@ -290,33 +287,24 @@ function toOpenAIFormat(toolDefs) {
290
287
  });
291
288
  }
292
289
 
293
- async function executeTool(toolName, args, toolDefs) {
294
- const tool = toolDefs.find(t => t.name === toolName);
295
- if (!tool) return { error: `Tool bulunamadı: ${toolName}` };
296
- if (!tool.execute) return { error: `Tool execute fonksiyonu yok: ${toolName}` };
297
- // checkFn tool disabled? (re-check at runtime with cache)
298
- if (tool.checkFn) {
299
- if (!_cachedCheckFn(tool.checkFn, tool.name)) {
300
- return { error: `${toolName} şu anda kullanılamıyor (check_fn engelledi)` };
301
- }
302
- }
303
-
304
- // Sandbox restrictions for bash/shell_command
305
- if (toolName === 'bash' || toolName === 'shell_command') {
306
- const level = _getSandboxLevel();
307
- const cmd = (args && args.command) || '';
308
- if (level === 'strict' && sandbox.isNetworkCommand(cmd)) {
309
- return { error: 'strict sandbox: network komutları engellendi. Daha düşük sandbox seviyesi kullanın.' };
310
- }
311
- }
312
-
313
- try {
314
- const result = await tool.execute(args || {});
315
- return { result };
316
- } catch (e) {
317
- return { error: e.message || String(e) };
318
- }
319
- }
290
+ async function executeTool(toolName, args, toolDefs) {
291
+ return executeThroughGateway({
292
+ toolName,
293
+ args: args || {},
294
+ resolveTool: name => (toolDefs || []).find(tool => tool.name === name),
295
+ checkAvailability: ({ tool }) => !tool.checkFn || _cachedCheckFn(tool.checkFn, tool.name)
296
+ ? true
297
+ : { allowed: false, reason: `${toolName} şu anda kullanılamıyor (check_fn engelledi)` },
298
+ policyChecks: [({ args: safeArgs }) => {
299
+ if (toolName !== 'bash' && toolName !== 'shell_command') return true;
300
+ const level = _getSandboxLevel();
301
+ if (level === 'strict' && sandbox.isNetworkCommand(safeArgs.command || '')) {
302
+ return { allowed: false, reason: 'strict sandbox: network komutları engellendi. Daha düşük sandbox seviyesi kullanın.' };
303
+ }
304
+ return true;
305
+ }],
306
+ });
307
+ }
320
308
 
321
309
  module.exports = {
322
310
  loadToolDefinitions, toOpenAIFormat, executeTool, getToolsForProvider,