natureco-cli 2.23.30 → 2.23.32

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 (69) hide show
  1. package/bin/natureco.js +178 -167
  2. package/package.json +1 -1
  3. package/src/commands/acp.js +39 -0
  4. package/src/commands/admin-rpc.js +83 -0
  5. package/src/commands/agent.js +214 -23
  6. package/src/commands/agents.js +114 -30
  7. package/src/commands/approvals.js +172 -11
  8. package/src/commands/ask.js +1 -1
  9. package/src/commands/browser.js +815 -0
  10. package/src/commands/capability.js +195 -22
  11. package/src/commands/channels.js +422 -267
  12. package/src/commands/chat.js +5 -8
  13. package/src/commands/clawbot.js +19 -0
  14. package/src/commands/code.js +3 -2
  15. package/src/commands/commitments.js +125 -9
  16. package/src/commands/completion.js +40 -32
  17. package/src/commands/config.js +228 -30
  18. package/src/commands/configure.js +84 -67
  19. package/src/commands/cron.js +239 -19
  20. package/src/commands/daemon.js +34 -4
  21. package/src/commands/dashboard.js +47 -374
  22. package/src/commands/devices.js +53 -26
  23. package/src/commands/directory.js +146 -14
  24. package/src/commands/dns.js +148 -10
  25. package/src/commands/docs.js +119 -26
  26. package/src/commands/doctor.js +143 -492
  27. package/src/commands/exec-policy.js +57 -48
  28. package/src/commands/gateway.js +492 -249
  29. package/src/commands/health.js +141 -11
  30. package/src/commands/help.js +24 -25
  31. package/src/commands/hooks.js +141 -87
  32. package/src/commands/infer.js +1442 -41
  33. package/src/commands/logs.js +122 -99
  34. package/src/commands/mcp.js +121 -309
  35. package/src/commands/memory.js +128 -0
  36. package/src/commands/message.js +720 -140
  37. package/src/commands/models.js +39 -1
  38. package/src/commands/node.js +77 -77
  39. package/src/commands/nodes.js +278 -22
  40. package/src/commands/onboard.js +115 -56
  41. package/src/commands/pairing.js +108 -107
  42. package/src/commands/path.js +206 -0
  43. package/src/commands/plugins.js +35 -1
  44. package/src/commands/proxy.js +159 -8
  45. package/src/commands/qr.js +55 -13
  46. package/src/commands/reset.js +101 -94
  47. package/src/commands/secrets.js +104 -21
  48. package/src/commands/sessions.js +110 -51
  49. package/src/commands/setup.js +229 -649
  50. package/src/commands/skills.js +67 -1
  51. package/src/commands/status.js +101 -127
  52. package/src/commands/tasks.js +208 -100
  53. package/src/commands/terminal.js +130 -12
  54. package/src/commands/transcripts.js +24 -1
  55. package/src/commands/tui.js +41 -0
  56. package/src/commands/uninstall.js +73 -92
  57. package/src/commands/update.js +146 -91
  58. package/src/commands/web-fetch.js +34 -0
  59. package/src/commands/webhooks.js +58 -66
  60. package/src/commands/wiki.js +783 -0
  61. package/src/utils/agents-md.js +85 -0
  62. package/src/utils/api.js +40 -41
  63. package/src/utils/format.js +144 -0
  64. package/src/utils/headless.js +2 -1
  65. package/src/utils/parallel-tools.js +106 -0
  66. package/src/utils/sub-agent.js +148 -0
  67. package/src/utils/token-budget.js +304 -0
  68. package/src/utils/tool-runner.js +7 -5
  69. package/src/utils/web-fetch.js +107 -0
@@ -3,6 +3,7 @@ const os = require('os');
3
3
  const fs = require('fs');
4
4
  const readline = require('readline');
5
5
  const inquirer = require('../utils/inquirer-wrapper');
6
+ const TB = require('../utils/token-budget');
6
7
  const chalk = require('chalk');
7
8
  const { getApiKey, getConfig } = require('../utils/config');
8
9
  const { getBots, sendMessage, _sendMessage } = require('../utils/api');
@@ -14,7 +15,7 @@ const { getCommands, getCommandContent } = require('../utils/commands');
14
15
  const { runHooks } = require('../utils/hooks');
15
16
  const { createSession, loadSession, getLatestSession, addMessageToSession, loadLastSession, listSessions, saveSession } = require('../utils/sessions');
16
17
  const { NatureCoError, ApiError, handleError } = require('../utils/errors');
17
- const { getToolDefinitions, getSessionStats, resetSessionStats } = require('../utils/tool-runner');
18
+ const { getSessionStats, resetSessionStats } = require('../utils/tool-runner');
18
19
 
19
20
  // ── ASCII Logo ────────────────────────────────────────────────────────────────
20
21
  const ASCII_LOGO = [
@@ -133,10 +134,7 @@ async function chat(botName, options = {}) {
133
134
  if (memoryPrompt) systemPrompt += '\n\n' + memoryPrompt;
134
135
  }
135
136
 
136
- const estimatedTokens = Math.ceil(systemPrompt.length / 4);
137
- if (estimatedTokens > 3000) {
138
- systemPrompt = systemPrompt.slice(0, 12000);
139
- }
137
+ systemPrompt = TB.trimSystemPrompt(systemPrompt);
140
138
 
141
139
  // ── Session ─────────────────────────────────────────────────────────────────
142
140
  let session;
@@ -189,7 +187,7 @@ async function chat(botName, options = {}) {
189
187
 
190
188
  // ── Önceki session mesajları ─────────────────────────────────────────────────
191
189
  if (options.resume && session.messages?.length) {
192
- const last = session.messages.slice(-5);
190
+ const last = session.messages.slice(-(TB.load().conversationInContext));
193
191
  last.forEach(msg => {
194
192
  console.log(chalk.white('You ') + msg.user);
195
193
  console.log(chalk.cyan(`${displayBotName} `) + msg.bot);
@@ -334,8 +332,7 @@ async function chat(botName, options = {}) {
334
332
  startLoading();
335
333
 
336
334
  try {
337
- const toolDefinitions = getToolDefinitions();
338
- let response = await _sendMessage(apiKey ?? config.providerApiKey, bot.id, userMessage, conversationId, systemPrompt, toolDefinitions, options);
335
+ let response = await _sendMessage(apiKey ?? config.providerApiKey, bot.id, userMessage, conversationId, systemPrompt, { ...options, noTools: true });
339
336
  stopLoading();
340
337
 
341
338
  if (response?.conversation_id) conversationId = response.conversation_id;
@@ -0,0 +1,19 @@
1
+ const chalk = require('chalk');
2
+
3
+ function clawbot(args) {
4
+ const [action, ...params] = args || [];
5
+
6
+ if (action === 'qr') {
7
+ const qr = require('../commands/qr');
8
+ return qr(['--format', 'clawbot', ...params]);
9
+ }
10
+
11
+ console.log(chalk.cyan('\n 🤖 ClawBot\n'));
12
+ console.log(chalk.gray(' ' + '─'.repeat(48)));
13
+ console.log(chalk.gray(' Legacy namespace for ClawBot operations.\n'));
14
+ console.log(` ${chalk.white('Subcommands:')}`);
15
+ console.log(` ${chalk.cyan('qr')} ${chalk.gray('Show QR pairing code for ClawBot')}`);
16
+ console.log();
17
+ }
18
+
19
+ module.exports = clawbot;
@@ -4,6 +4,7 @@ const fs = require('fs');
4
4
  const readline = require('readline');
5
5
  const { execSync } = require('child_process');
6
6
  const inquirer = require('../utils/inquirer-wrapper');
7
+ const TB = require('../utils/token-budget');
7
8
  const chalk = require('chalk');
8
9
  const { getApiKey, getConfig } = require('../utils/config');
9
10
  const { getBots, getProviderConfig, startMcpServers, sendMessageOpenAICompatible, streamProviderCompletion } = require('../utils/api');
@@ -376,14 +377,14 @@ ${indexPrompt}`;
376
377
  // ── Proje hafızası ────────────────────────────────────────────────────────
377
378
  const projectMemory = loadProjectMemory(workDir);
378
379
  if (projectMemory) {
379
- systemPrompt += `\n\n## Proje Geçmişi (.natureco/project.md)\n${projectMemory.slice(0, 2000)}`;
380
+ systemPrompt += `\n\n## Proje Geçmişi (.natureco/project.md)\n${TB.trimProjectMemory(projectMemory)}`;
380
381
  }
381
382
 
382
383
  // Hedef dosya varsa context'e ekle
383
384
  if (targetFile) {
384
385
  try {
385
386
  const content = fs.readFileSync(path.resolve(targetFile), 'utf-8');
386
- systemPrompt += `\n\n## Odak Dosyası: ${targetFile}\n\`\`\`\n${content.slice(0, 2000)}\n\`\`\``;
387
+ systemPrompt += `\n\n## Odak Dosyası: ${targetFile}\n\`\`\`\n${TB.trimFileContent(content)}\n\`\`\``;
387
388
  } catch {
388
389
  console.log(chalk.yellow(` ⚠️ ${targetFile} okunamadı\n`));
389
390
  }
@@ -1,32 +1,148 @@
1
1
  const chalk = require('chalk');
2
+ const fs = require('fs');
2
3
  const path = require('path');
3
4
  const os = require('os');
4
5
 
6
+ const COMMITMENTS_FILE = path.join(os.homedir(), '.natureco', 'commitments.json');
7
+
8
+ function load() {
9
+ if (!fs.existsSync(COMMITMENTS_FILE)) return [];
10
+ try { return JSON.parse(fs.readFileSync(COMMITMENTS_FILE, 'utf-8')); }
11
+ catch { return []; }
12
+ }
13
+
14
+ function save(items) {
15
+ const dir = path.dirname(COMMITMENTS_FILE);
16
+ if (!fs.existsSync(dir)) fs.mkdirSync(dir, { recursive: true });
17
+ fs.writeFileSync(COMMITMENTS_FILE, JSON.stringify(items, null, 2), 'utf-8');
18
+ }
19
+
20
+ function genId() {
21
+ return Date.now().toString(36) + Math.random().toString(36).slice(2, 6);
22
+ }
23
+
5
24
  function commitments(args) {
6
25
  const [action, ...params] = args || [];
7
26
 
8
- if (!action || action === 'list') return listCommitments();
9
- if (action === 'add') return addCommitment(params.join(' '));
27
+ if (!action || action === 'list') return listC();
28
+ if (action === 'add') return addC(params.join(' '));
29
+ if (action === 'check' || action === 'done') return checkC(params[0]);
30
+ if (action === 'resolve') return resolveC(params[0]);
31
+ if (action === 'pending') return pendingC();
32
+ if (action === 'summary') return summaryC();
33
+ if (action === 'delete') return deleteC(params[0]);
10
34
 
11
35
  console.log(chalk.red(`\n ❌ Bilinmeyen komut: ${action}\n`));
12
- console.log(chalk.gray(' Kullanım: natureco commitments [list|add]\n'));
36
+ console.log(chalk.gray(' Kullanım: natureco commitments [list|add|check|resolve|pending|summary|delete]\n'));
13
37
  process.exit(1);
14
38
  }
15
39
 
16
- function listCommitments() {
40
+ function listC() {
41
+ const items = load();
17
42
  console.log(chalk.cyan('\n 📋 Commitments\n'));
18
43
  console.log(chalk.gray(' ' + '─'.repeat(48)));
19
- console.log(chalk.gray(' No inferred commitments.\n'));
20
- console.log(chalk.gray(' Commitments track follow-up tasks across sessions.'));
21
- console.log(chalk.gray(' They are automatically inferred when running agents.\n'));
44
+ if (items.length === 0) {
45
+ console.log(chalk.gray(' Henüz commitment yok.\n'));
46
+ return;
47
+ }
48
+ for (const c of items) {
49
+ const icon = c.status === 'resolved' ? '✅' : c.status === 'checked' ? '☑️ ' : '⬜';
50
+ console.log(` ${icon} ${chalk[c.status === 'resolved' ? 'gray' : 'white'](c.text)}`);
51
+ console.log(chalk.gray(` [${c.id}] ${c.createdAt.slice(0, 10)}`));
52
+ }
53
+ console.log();
22
54
  }
23
55
 
24
- function addCommitment(text) {
56
+ function addC(text) {
25
57
  if (!text) {
26
58
  console.log(chalk.red('\n ❌ Commitment text gerekli\n'));
27
59
  process.exit(1);
28
60
  }
29
- console.log(chalk.green(`\n ✅ Commitment added: ${text}\n`));
61
+ const items = load();
62
+ const c = { id: genId(), text, status: 'pending', createdAt: new Date().toISOString(), resolvedAt: null };
63
+ items.push(c);
64
+ save(items);
65
+ console.log(chalk.green(`\n ✅ Commitment eklendi: ${c.id}\n`));
66
+ console.log(` ${chalk.white(c.text)}`);
67
+ console.log();
68
+ }
69
+
70
+ function checkC(id) {
71
+ if (!id) {
72
+ console.log(chalk.red('\n ❌ Commitment ID gerekli\n'));
73
+ process.exit(1);
74
+ }
75
+ const items = load();
76
+ const c = items.find(x => x.id === id);
77
+ if (!c) { console.log(chalk.red(`\n ❌ Commitment bulunamadı: ${id}\n`)); process.exit(1); }
78
+ if (c.status === 'resolved') { console.log(chalk.yellow(`\n ⚠️ "${c.text}" zaten çözülmüş\n`)); return; }
79
+ c.status = 'checked';
80
+ save(items);
81
+ console.log(chalk.green(`\n ☑️ "${c.text}" tamamlandı olarak işaretlendi\n`));
82
+ }
83
+
84
+ function resolveC(id) {
85
+ if (!id) {
86
+ const items = load();
87
+ const pending = items.filter(x => x.status !== 'resolved');
88
+ if (pending.length === 0) { console.log(chalk.gray('\n Çözülecek commitment yok\n')); return; }
89
+ for (const c of pending) {
90
+ c.status = 'resolved';
91
+ c.resolvedAt = new Date().toISOString();
92
+ }
93
+ save(items);
94
+ console.log(chalk.green(`\n ✅ ${pending.length} commitment çözüldü\n`));
95
+ return;
96
+ }
97
+ const items = load();
98
+ const c = items.find(x => x.id === id);
99
+ if (!c) { console.log(chalk.red(`\n ❌ Commitment bulunamadı: ${id}\n`)); process.exit(1); }
100
+ c.status = 'resolved';
101
+ c.resolvedAt = new Date().toISOString();
102
+ save(items);
103
+ console.log(chalk.green(`\n ✅ "${c.text}" çözüldü\n`));
104
+ }
105
+
106
+ function pendingC() {
107
+ const items = load().filter(c => c.status !== 'resolved');
108
+ console.log(chalk.cyan('\n ⏳ Bekleyen Commitments\n'));
109
+ console.log(chalk.gray(' ' + '─'.repeat(48)));
110
+ if (items.length === 0) {
111
+ console.log(chalk.gray(' Bekleyen commitment yok.\n'));
112
+ return;
113
+ }
114
+ for (const c of items) {
115
+ console.log(` ${chalk.white(c.text)}`);
116
+ console.log(chalk.gray(` [${c.id}] ${c.createdAt.slice(0, 10)}\n`));
117
+ }
118
+ }
119
+
120
+ function summaryC() {
121
+ const items = load();
122
+ const total = items.length;
123
+ const resolved = items.filter(c => c.status === 'resolved').length;
124
+ const checked = items.filter(c => c.status === 'checked').length;
125
+ const pending = total - resolved - checked;
126
+ console.log(chalk.cyan('\n 📊 Commitments Summary\n'));
127
+ console.log(chalk.gray(' ' + '─'.repeat(48)));
128
+ console.log(` ${chalk.white('Toplam:')} ${total}`);
129
+ console.log(` ${chalk.green('Çözülen:')} ${resolved}`);
130
+ console.log(` ${chalk.yellow('Kontrol:')} ${checked}`);
131
+ console.log(` ${chalk.cyan('Kalan:')} ${pending}`);
132
+ console.log();
133
+ }
134
+
135
+ function deleteC(id) {
136
+ if (!id) {
137
+ console.log(chalk.red('\n ❌ Commitment ID gerekli\n'));
138
+ process.exit(1);
139
+ }
140
+ let items = load();
141
+ const idx = items.findIndex(x => x.id === id);
142
+ if (idx === -1) { console.log(chalk.red(`\n ❌ Commitment bulunamadı: ${id}\n`)); process.exit(1); }
143
+ const removed = items.splice(idx, 1)[0];
144
+ save(items);
145
+ console.log(chalk.gray(`\n 🗑️ "${removed.text}" silindi\n`));
30
146
  }
31
147
 
32
148
  module.exports = commitments;
@@ -1,18 +1,5 @@
1
1
  const chalk = require('chalk');
2
2
 
3
- function completion(args) {
4
- const shell = (args[0] || '').toLowerCase();
5
-
6
- if (!shell || shell === 'bash') return generateBash();
7
- if (shell === 'zsh') return generateZsh();
8
- if (shell === 'fish') return generateFish();
9
- if (shell === 'powershell') return generatePowershell();
10
-
11
- console.log(chalk.red(`\n ❌ Desteklenmeyen shell: ${shell}\n`));
12
- console.log(chalk.gray(' Supported: bash, zsh, fish, powershell\n'));
13
- process.exit(1);
14
- }
15
-
16
3
  function getCommands() {
17
4
  return [
18
5
  'agent', 'agents', 'approvals', 'ask', 'backup', 'bonjour', 'bots',
@@ -26,29 +13,41 @@ function getCommands() {
26
13
  'proxy', 'qr', 'reset', 'run', 'sandbox', 'secrets', 'security', 'sessions',
27
14
  'setup', 'signal', 'skills', 'slack', 'sms', 'status', 'system', 'tasks',
28
15
  'telegram', 'terminal', 'thread-ownership', 'transcripts', 'ultrareview',
29
- 'uninstall', 'update', 'voice', 'vydra', 'webhooks', 'whatsapp', 'workboard'
16
+ 'uninstall', 'update', 'voice', 'vydra', 'webhooks', 'whatsapp', 'workboard',
30
17
  ];
31
18
  }
32
19
 
33
- function generateBash() {
20
+ function completion(params) {
21
+ try {
22
+ const [shell] = params || [];
23
+
24
+ if (!shell || shell === 'bash') return printBash();
25
+ if (shell === 'zsh') return printZsh();
26
+ if (shell === 'fish') return printFish();
27
+ if (shell === 'install') return printInstall();
28
+
29
+ console.log(chalk.red(`\n Unknown shell: ${shell}\n`));
30
+ console.log(chalk.gray(' Usage: natureco completion [bash|zsh|fish|install]\n'));
31
+ } catch (err) {
32
+ console.log(chalk.red(`\n Completion error: ${err.message}\n`));
33
+ }
34
+ }
35
+
36
+ function printBash() {
34
37
  const cmds = getCommands().join(' ');
35
- console.log(`_natureco_completion() {
38
+ console.log(`# natureco bash completion
39
+ _natureco() {
36
40
  local cur prev opts
37
41
  COMPREPLY=()
38
42
  cur="\${COMP_WORDS[COMP_CWORD]}"
39
- prev="\${COMP_WORDS[COMP_CWORD-1]}"
40
43
  opts="${cmds}"
41
-
42
- if [[ \${cur} == * ]] ; then
43
- COMPREPLY=( $(compgen -W "\${opts}" -- \${cur}) )
44
- return 0
45
- fi
44
+ COMPREPLY=( $(compgen -W "\${opts}" -- \${cur}) )
45
+ return 0
46
46
  }
47
- complete -F _natureco_completion natureco`);
47
+ complete -F _natureco natureco`);
48
48
  }
49
49
 
50
- function generateZsh() {
51
- const cmds = getCommands().join(' ');
50
+ function printZsh() {
52
51
  console.log(`#compdef natureco
53
52
  _natureco() {
54
53
  local -a commands
@@ -60,17 +59,26 @@ _natureco() {
60
59
  _natureco "$@"`);
61
60
  }
62
61
 
63
- function generateFish() {
62
+ function printFish() {
64
63
  const cmds = getCommands().join(' ');
65
64
  console.log(`complete -c natureco -f -a "${cmds}"`);
66
65
  }
67
66
 
68
- function generatePowershell() {
69
- console.log(`Register-ArgumentCompleter -Native -CommandName natureco -ScriptBlock {
70
- param($wordToComplete, $commandAst, $cursorPosition)
71
- $commands = @(${getCommands().map(c => `'${c}'`).join(', ')})
72
- $commands | Where-Object { $_ -like "$wordToComplete*" } | ForEach-Object { "'$_'" }
73
- }`);
67
+ function printInstall() {
68
+ console.log(chalk.cyan('\n Shell Completion Installation\n'));
69
+ console.log(chalk.white(' Bash:'));
70
+ console.log(chalk.gray(' natureco completion bash >> ~/.bashrc'));
71
+ console.log(chalk.gray(' source ~/.bashrc'));
72
+ console.log('');
73
+ console.log(chalk.white(' Zsh:'));
74
+ console.log(chalk.gray(' mkdir -p ~/.zsh/completion'));
75
+ console.log(chalk.gray(' natureco completion zsh > ~/.zsh/completion/_natureco'));
76
+ console.log(chalk.gray(' echo "fpath=(~/.zsh/completion \$fpath)" >> ~/.zshrc'));
77
+ console.log(chalk.gray(' echo "autoload -Uz compinit && compinit" >> ~/.zshrc'));
78
+ console.log('');
79
+ console.log(chalk.white(' Fish:'));
80
+ console.log(chalk.gray(' natureco completion fish > ~/.config/fish/completions/natureco.fish'));
81
+ console.log('');
74
82
  }
75
83
 
76
84
  module.exports = completion;