natureco-cli 2.17.1 → 2.17.4
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/bin/natureco.js +35 -0
- package/package.json +2 -1
- package/src/commands/agents.js +141 -0
- package/src/commands/chat.js +339 -634
- package/src/commands/dashboard.js +2 -2
- package/src/commands/gateway-server.js +6 -3
- package/src/commands/help.js +4 -0
- package/src/commands/pairing.js +107 -0
- package/src/commands/plugins.js +172 -0
- package/src/commands/uninstall.js +92 -0
- package/src/utils/config.js +25 -9
package/bin/natureco.js
CHANGED
|
@@ -308,6 +308,41 @@ program
|
|
|
308
308
|
securityCmd(process.argv.slice(3));
|
|
309
309
|
});
|
|
310
310
|
|
|
311
|
+
program
|
|
312
|
+
.command('agents [action] [params...]')
|
|
313
|
+
.description('Manage agents/bots (list|set|info|add)')
|
|
314
|
+
.action((action, params) => {
|
|
315
|
+
const agentsCmd = require('../src/commands/agents');
|
|
316
|
+
agentsCmd([action, ...(params || [])]);
|
|
317
|
+
});
|
|
318
|
+
|
|
319
|
+
program
|
|
320
|
+
.command('plugins [action] [params...]')
|
|
321
|
+
.description('Manage plugins (list|install|enable|disable|info|doctor)')
|
|
322
|
+
.action((action, params) => {
|
|
323
|
+
const pluginsCmd = require('../src/commands/plugins');
|
|
324
|
+
pluginsCmd([action, ...(params || [])]);
|
|
325
|
+
});
|
|
326
|
+
|
|
327
|
+
program
|
|
328
|
+
.command('pairing [action] [params...]')
|
|
329
|
+
.description('Manage device pairings (list|approve|reject)')
|
|
330
|
+
.action((action, params) => {
|
|
331
|
+
const pairingCmd = require('../src/commands/pairing');
|
|
332
|
+
pairingCmd([action, ...(params || [])]);
|
|
333
|
+
});
|
|
334
|
+
|
|
335
|
+
program
|
|
336
|
+
.command('uninstall')
|
|
337
|
+
.description('Uninstall NatureCo CLI data')
|
|
338
|
+
.option('--all', 'Remove all data including config')
|
|
339
|
+
.option('--yes, -y', 'Skip confirmation')
|
|
340
|
+
.option('--dry-run', 'Preview actions without executing')
|
|
341
|
+
.action(() => {
|
|
342
|
+
const uninstallCmd = require('../src/commands/uninstall');
|
|
343
|
+
uninstallCmd(process.argv.slice(3));
|
|
344
|
+
});
|
|
345
|
+
|
|
311
346
|
program
|
|
312
347
|
.command('help')
|
|
313
348
|
.description('Show help information')
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "natureco-cli",
|
|
3
|
-
"version": "2.17.
|
|
3
|
+
"version": "2.17.4",
|
|
4
4
|
"description": "NatureCo AI Bot Terminal Interface",
|
|
5
5
|
"main": "bin/natureco.js",
|
|
6
6
|
"bin": {
|
|
@@ -25,6 +25,7 @@
|
|
|
25
25
|
"license": "MIT",
|
|
26
26
|
"dependencies": {
|
|
27
27
|
"@whiskeysockets/baileys": "^7.0.0-rc10",
|
|
28
|
+
"blessed": "^0.1.81",
|
|
28
29
|
"boxen": "^5.1.2",
|
|
29
30
|
"chalk": "^4.1.2",
|
|
30
31
|
"commander": "^11.1.0",
|
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
const chalk = require('chalk');
|
|
2
|
+
const inquirer = require('inquirer');
|
|
3
|
+
const { getConfig, saveConfig } = require('../utils/config');
|
|
4
|
+
const { getBots } = require('../utils/api');
|
|
5
|
+
|
|
6
|
+
async function agents(args) {
|
|
7
|
+
const [action, ...params] = (args || []);
|
|
8
|
+
|
|
9
|
+
if (!action || action === 'list') return listAgents();
|
|
10
|
+
if (action === 'set') return setActiveAgent(params[0]);
|
|
11
|
+
if (action === 'info') return agentInfo(params[0]);
|
|
12
|
+
if (action === 'add') return addAgent();
|
|
13
|
+
|
|
14
|
+
console.log(chalk.red(`\n ❌ Bilinmeyen komut: ${action}\n`));
|
|
15
|
+
console.log(chalk.gray(' Kullanım: natureco agents [list|set|info|add]\n'));
|
|
16
|
+
process.exit(1);
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
async function listAgents() {
|
|
20
|
+
const config = getConfig();
|
|
21
|
+
const apiKey = config.providerApiKey || config.apiKey || '';
|
|
22
|
+
|
|
23
|
+
console.log(chalk.gray('\n Agentlar yükleniyor...\n'));
|
|
24
|
+
|
|
25
|
+
let botList = { bots: [] };
|
|
26
|
+
try {
|
|
27
|
+
botList = await getBots(apiKey);
|
|
28
|
+
} catch {}
|
|
29
|
+
|
|
30
|
+
console.log(chalk.gray(' ' + '─'.repeat(48)));
|
|
31
|
+
console.log(chalk.cyan.bold('\n Agentlar (Botlar)\n'));
|
|
32
|
+
|
|
33
|
+
if (!botList.bots?.length) {
|
|
34
|
+
console.log(chalk.gray(' Agent bulunamadı.'));
|
|
35
|
+
console.log(chalk.gray(' Oluşturmak için: ') + chalk.cyan('developers.natureco.me\n'));
|
|
36
|
+
return;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
botList.bots.forEach((bot, i) => {
|
|
40
|
+
const active = config.botName === bot.name ? chalk.green(' ← aktif') : '';
|
|
41
|
+
console.log(chalk.white(` ${i + 1}. ${bot.name}`) + active);
|
|
42
|
+
console.log(chalk.gray(` ID : ${bot.id}`));
|
|
43
|
+
console.log(chalk.gray(` Provider: ${bot.ai_provider || 'groq'}`));
|
|
44
|
+
if (bot.model) console.log(chalk.gray(` Model : ${bot.model}`));
|
|
45
|
+
console.log('');
|
|
46
|
+
});
|
|
47
|
+
|
|
48
|
+
console.log(chalk.gray(' ' + '─'.repeat(48)));
|
|
49
|
+
console.log(chalk.gray(' Değiştirmek için: ') + chalk.cyan('natureco agents set <bot-adı>\n'));
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
async function setActiveAgent(botName) {
|
|
53
|
+
const config = getConfig();
|
|
54
|
+
const apiKey = config.providerApiKey || config.apiKey || '';
|
|
55
|
+
|
|
56
|
+
let botList = { bots: [] };
|
|
57
|
+
try {
|
|
58
|
+
botList = await getBots(apiKey);
|
|
59
|
+
} catch {}
|
|
60
|
+
|
|
61
|
+
if (!botName) {
|
|
62
|
+
if (!botList.bots?.length) {
|
|
63
|
+
console.log(chalk.gray('\n Agent bulunamadı.\n'));
|
|
64
|
+
return;
|
|
65
|
+
}
|
|
66
|
+
const { selected } = await inquirer.prompt([{
|
|
67
|
+
type: 'list',
|
|
68
|
+
name: 'selected',
|
|
69
|
+
message: ' Aktif agent seç:',
|
|
70
|
+
choices: botList.bots.map(b => ({ name: b.name, value: b.name })),
|
|
71
|
+
}]);
|
|
72
|
+
botName = selected;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
const bot = botList.bots?.find(b => b.name === botName || b.id === botName);
|
|
76
|
+
if (!bot && botList.bots?.length) {
|
|
77
|
+
console.log(chalk.red(`\n ❌ Agent bulunamadı: ${botName}\n`));
|
|
78
|
+
process.exit(1);
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
config.botName = botName;
|
|
82
|
+
if (bot?.id) config.defaultBotId = bot.id;
|
|
83
|
+
saveConfig(config);
|
|
84
|
+
|
|
85
|
+
console.log(chalk.green(`\n ✓ Aktif agent: ${botName}\n`));
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
async function agentInfo(botName) {
|
|
89
|
+
const config = getConfig();
|
|
90
|
+
const apiKey = config.providerApiKey || config.apiKey || '';
|
|
91
|
+
const name = botName || config.botName;
|
|
92
|
+
|
|
93
|
+
if (!name) {
|
|
94
|
+
console.log(chalk.gray('\n Agent adı belirtin: natureco agents info <bot-adı>\n'));
|
|
95
|
+
return;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
let botList = { bots: [] };
|
|
99
|
+
try {
|
|
100
|
+
botList = await getBots(apiKey);
|
|
101
|
+
} catch {}
|
|
102
|
+
|
|
103
|
+
const bot = botList.bots?.find(b => b.name === name || b.id === name);
|
|
104
|
+
|
|
105
|
+
console.log('');
|
|
106
|
+
console.log(chalk.gray(' ' + '─'.repeat(48)));
|
|
107
|
+
console.log(chalk.cyan.bold(`\n Agent: ${name}\n`));
|
|
108
|
+
|
|
109
|
+
if (bot) {
|
|
110
|
+
console.log(chalk.gray(' ID : ') + chalk.white(bot.id));
|
|
111
|
+
console.log(chalk.gray(' Provider: ') + chalk.white(bot.ai_provider || 'groq'));
|
|
112
|
+
if (bot.model) console.log(chalk.gray(' Model : ') + chalk.white(bot.model));
|
|
113
|
+
if (bot.system_prompt) {
|
|
114
|
+
console.log(chalk.gray(' Prompt : ') + chalk.white(bot.system_prompt.slice(0, 80) + (bot.system_prompt.length > 80 ? '...' : '')));
|
|
115
|
+
}
|
|
116
|
+
} else {
|
|
117
|
+
console.log(chalk.gray(' (Detay alınamadı)'));
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
// Hafıza bilgisi
|
|
121
|
+
try {
|
|
122
|
+
const { loadMemory } = require('../utils/memory');
|
|
123
|
+
const mem = loadMemory(bot?.id || 'universal-provider');
|
|
124
|
+
if (mem.name || mem.facts?.length) {
|
|
125
|
+
console.log('');
|
|
126
|
+
if (mem.name) console.log(chalk.gray(' Kullanıcı: ') + chalk.white(mem.name));
|
|
127
|
+
console.log(chalk.gray(' Hafıza : ') + chalk.white(`${(mem.facts || []).length} bilgi`));
|
|
128
|
+
}
|
|
129
|
+
} catch {}
|
|
130
|
+
|
|
131
|
+
console.log('');
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
async function addAgent() {
|
|
135
|
+
console.log('');
|
|
136
|
+
console.log(chalk.gray(' Yeni agent oluşturmak için Developers Portal\'ı kullanın:'));
|
|
137
|
+
console.log(chalk.cyan(' developers.natureco.me\n'));
|
|
138
|
+
console.log(chalk.gray(' Oluşturduktan sonra: ') + chalk.cyan('natureco agents list\n'));
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
module.exports = agents;
|