natureco-cli 4.6.0 → 4.6.2

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "natureco-cli",
3
- "version": "4.6.0",
3
+ "version": "4.6.2",
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"
@@ -4,9 +4,10 @@ const fs = require('fs');
4
4
  const readline = require('readline');
5
5
  const inquirer = require('../utils/inquirer-wrapper');
6
6
  const TB = require('../utils/token-budget');
7
+ const tui = require('../utils/tui');
7
8
  const chalk = require('chalk');
8
9
  const { getApiKey, getConfig } = require('../utils/config');
9
- const { getBots, sendMessage, _sendMessage } = require('../utils/api');
10
+ const repl = require('./repl');
10
11
  const { getSkillPrompts, getSkills } = require('../utils/skills');
11
12
  const { getAgentsPrompt } = require('../utils/agents');
12
13
  const { addToHistory } = require('../utils/history');
@@ -17,7 +18,6 @@ const { createSession, loadSession, getLatestSession, addMessageToSession, loadL
17
18
  const { NatureCoError, ApiError, handleError } = require('../utils/errors');
18
19
  const { getSessionStats, resetSessionStats } = require('../utils/tool-runner');
19
20
 
20
- // ── ASCII Logo ────────────────────────────────────────────────────────────────
21
21
  const ASCII_LOGO = [
22
22
  '███╗ ██╗ █████╗ ████████╗██╗ ██╗██████╗ ███████╗ ██████╗ ██████╗',
23
23
  '████╗ ██║██╔══██╗╚══██╔══╝██║ ██║██╔══██╗██╔════╝██╔════╝ ██╔═══██╗',
@@ -64,7 +64,28 @@ async function chat(botName, options = {}) {
64
64
  const config = getConfig();
65
65
  const version = require('../../package.json').version;
66
66
 
67
- // ── Session listeleme ──────────────────────────────────────────────────────
67
+ // v4.6+ Modern: chat komutu doğrudan REPL'i başlatır
68
+ // Eski NatureCo backend (api.natureco.me) yerine provider URL kullanılır
69
+ // Avantajlar: TUI engine, cross-session memory, /resume, /sessions
70
+ // Önceki v2.23 davranışı: ASCII art, bot seçimi, inquirer prompt, vb.
71
+ // Bu refactor, eski tüm komutları (session, memory, hooks, custom commands) korur
72
+ // ama provider URL (api.minimax.io, api.groq.com) üzerinden direkt LLM'e bağlanır
73
+ if (config.providerUrl && !config.providerUrl.includes('natureco.me')) {
74
+ // Resume parametresi REPL'e geçir
75
+ const replArgs = [];
76
+ if (options.resume === true || options.resume) {
77
+ replArgs.push('--resume', String(options.resume === true ? 'last' : options.resume));
78
+ }
79
+ console.log('');
80
+ console.log(tui.styled(' 🌿 NatureCo Chat v4.6+', { color: tui.PALETTE.primary, bold: true }));
81
+ console.log(tui.styled(' ' + '─'.repeat(56), { color: tui.PALETTE.border }));
82
+ console.log(tui.C.muted(' Chat komutu artık ') + tui.C.brand('repl') + tui.C.muted(' komutunu çağırıyor (Phase 9 TUI engine)'));
83
+ console.log(tui.C.muted(' Tüm özellikler korundu: memory, sessions, hooks, custom commands'));
84
+ console.log('');
85
+ return repl(replArgs);
86
+ }
87
+
88
+ // Eski v2.23 davranışı (NatureCo backend bağımlı)
68
89
  if (options.list) {
69
90
  const sessions = listSessions('chat');
70
91
  if (!sessions.length) {
@@ -1,5 +1,6 @@
1
1
  const chalk = require('chalk');
2
2
  const F = require('../utils/format');
3
+ const tui = require('../utils/tui');
3
4
  const fs = require('fs');
4
5
  const path = require('path');
5
6
  const os = require('os');
@@ -29,19 +30,25 @@ function cmdRun() {
29
30
  const config = tryRequire('../utils/config');
30
31
  const cfg = config ? config.getConfig() : {};
31
32
 
32
- F.header('System Status');
33
- F.kv('Version', version);
34
- F.kv('Platform', `${process.platform} ${os.release()}`);
33
+ // Phase 9 TUI: round border + iki kolon
34
+ const cardW = 56;
35
+ const lines = [];
36
+ lines.push(tui.styled(' ╭' + '─'.repeat(cardW) + '╮', { color: tui.PALETTE.border }));
37
+ lines.push(tui.styled(' │ ', { color: tui.PALETTE.border }) + tui.C.muted('Version ') + tui.styled(`v${version}`.padEnd(36), { color: tui.PALETTE.text, bold: true }) + tui.styled(' │', { color: tui.PALETTE.border }));
38
+ lines.push(tui.styled(' │ ', { color: tui.PALETTE.border }) + tui.C.muted('Platform ') + tui.styled(`${process.platform} ${os.release()}`.padEnd(36), { color: tui.PALETTE.text }) + tui.styled(' │', { color: tui.PALETTE.border }));
35
39
 
36
40
  const pidFile = path.join(os.homedir(), '.natureco', 'gateway.pid');
37
41
  const gatewayRunning = fs.existsSync(pidFile);
38
- F.dot(gatewayRunning, 'Gateway');
42
+ const gatewayStatus = gatewayRunning
43
+ ? tui.styled(' ✓ Çalışıyor ', { bg: tui.PALETTE.success, color: '#000', bold: true })
44
+ : tui.styled(' ✗ Durmuş ', { bg: tui.PALETTE.muted, color: '#000', bold: true });
45
+ lines.push(tui.styled(' │ ', { color: tui.PALETTE.border }) + tui.C.muted('Gateway ') + gatewayStatus + ' '.repeat(23) + tui.styled(' │', { color: tui.PALETTE.border }));
39
46
 
40
47
  if (cfg.providerUrl) {
41
- F.kv('Provider', cfg.providerUrl);
48
+ lines.push(tui.styled('', { color: tui.PALETTE.border }) + tui.C.muted('Provider ') + tui.styled(cfg.providerUrl.padEnd(36), { color: tui.PALETTE.primary, bold: true }) + tui.styled(' │', { color: tui.PALETTE.border }));
42
49
  }
43
50
  if (cfg.botName) {
44
- F.kv('Bot', cfg.botName);
51
+ lines.push(tui.styled('', { color: tui.PALETTE.border }) + tui.C.muted('Bot ') + tui.styled((cfg.botName || '—').padEnd(36), { color: tui.PALETTE.text }) + tui.styled(' │', { color: tui.PALETTE.border }));
45
52
  }
46
53
 
47
54
  const nodesFile = path.join(os.homedir(), '.natureco', 'nodes.json');
@@ -49,12 +56,14 @@ function cmdRun() {
49
56
  if (fs.existsSync(nodesFile)) {
50
57
  try { nodeCount = Object.keys(JSON.parse(fs.readFileSync(nodesFile, 'utf8'))).length; } catch {}
51
58
  }
52
- F.kv('Nodes', String(nodeCount));
59
+ lines.push(tui.styled('', { color: tui.PALETTE.border }) + tui.C.muted('Nodes ') + tui.styled(String(nodeCount).padEnd(36), { color: tui.PALETTE.text }) + tui.styled(' │', { color: tui.PALETTE.border }));
53
60
 
54
- const channels = cfg.channels || cfg.telegramToken || cfg.whatsappConnected || cfg.discordToken || cfg.slackToken;
55
61
  const channelCount = [cfg.telegramToken, cfg.whatsappConnected, cfg.discordToken, cfg.slackToken].filter(Boolean).length;
56
- F.kv('Channels', String(channelCount));
57
- F.divider();
62
+ lines.push(tui.styled('', { color: tui.PALETTE.border }) + tui.C.muted('Channels ') + tui.styled(String(channelCount).padEnd(36), { color: tui.PALETTE.text }) + tui.styled(' │', { color: tui.PALETTE.border }));
63
+ lines.push(tui.styled(' ╰' + '─'.repeat(cardW) + '╯', { color: tui.PALETTE.border }));
64
+ console.log('\n' + tui.styled(' 🩺 Sistem Durumu', { color: tui.PALETTE.primary, bold: true }));
65
+ console.log(lines.join('\n'));
66
+ console.log('');
58
67
  }
59
68
 
60
69
  function cmdSimple() {
@@ -81,21 +90,26 @@ function cmdUsage() {
81
90
  const config = tryRequire('../utils/config');
82
91
  const cfg = config ? config.getConfig() : {};
83
92
 
84
- F.header('Provider Usage');
85
-
86
- if (cfg.providerUrl) {
87
- const rows = [
88
- ['Provider', cfg.providerUrl],
89
- ['Model', cfg.providerModel || '—'],
90
- ];
91
- const usage = cfg.usage || {};
92
- rows.push(['Tokens', String(usage.totalTokens || '—')]);
93
- rows.push(['Requests', String(usage.totalRequests || '—')]);
94
- rows.push(['Session', String(usage.sessionTokens || '—')]);
95
- F.table(['Key', 'Value'], rows);
96
- } else {
97
- F.info('No provider configured.');
93
+ if (!cfg.providerUrl) {
94
+ console.log('\n' + tui.C.muted(' Provider tanımlı değil.'));
95
+ return;
98
96
  }
97
+
98
+ const usage = cfg.usage || {};
99
+ const rows = [
100
+ { key: 'provider', label: 'Provider', value: cfg.providerUrl },
101
+ { key: 'model', label: 'Model', value: cfg.providerModel || '—' },
102
+ { key: 'tokens', label: 'Tokens', value: String(usage.totalTokens || '—') },
103
+ { key: 'requests', label: 'Requests', value: String(usage.totalRequests || '—') },
104
+ { key: 'session', label: 'Session', value: String(usage.sessionTokens || '—') },
105
+ ];
106
+
107
+ console.log('\n' + tui.styled(' 📊 Provider Kullanımı', { color: tui.PALETTE.primary, bold: true }));
108
+ console.log('\n' + tui.table(rows, [
109
+ { key: 'key', label: 'Anahtar', minWidth: 12, render: r => tui.C.muted(r.key) },
110
+ { key: 'value', label: 'Değer', minWidth: 30, render: r => tui.C.text(r.value) },
111
+ ], { borderStyle: 'round', zebra: true }));
112
+ console.log('');
99
113
  }
100
114
 
101
115
  module.exports = status;