natureco-cli 2.23.29 → 2.23.31

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 (111) hide show
  1. package/README.md +94 -11
  2. package/bin/natureco.js +495 -94
  3. package/package.json +1 -1
  4. package/src/commands/acp.js +39 -0
  5. package/src/commands/admin-rpc.js +302 -0
  6. package/src/commands/agent.js +280 -0
  7. package/src/commands/agents.js +114 -30
  8. package/src/commands/approvals.js +214 -0
  9. package/src/commands/backup.js +124 -0
  10. package/src/commands/bonjour.js +167 -0
  11. package/src/commands/browser.js +815 -0
  12. package/src/commands/capability.js +237 -0
  13. package/src/commands/channels.js +422 -267
  14. package/src/commands/chat.js +5 -8
  15. package/src/commands/clawbot.js +19 -0
  16. package/src/commands/clickclack.js +130 -0
  17. package/src/commands/code.js +3 -2
  18. package/src/commands/commitments.js +148 -0
  19. package/src/commands/completion.js +84 -0
  20. package/src/commands/config.js +219 -30
  21. package/src/commands/configure.js +110 -0
  22. package/src/commands/crestodian.js +92 -0
  23. package/src/commands/cron.js +239 -19
  24. package/src/commands/daemon.js +90 -0
  25. package/src/commands/dashboard.js +47 -374
  26. package/src/commands/device-pair.js +248 -0
  27. package/src/commands/devices.js +137 -0
  28. package/src/commands/directory.js +179 -0
  29. package/src/commands/dns.js +196 -0
  30. package/src/commands/docs.js +136 -0
  31. package/src/commands/doctor.js +143 -492
  32. package/src/commands/exec-policy.js +80 -0
  33. package/src/commands/gateway-server.js +1155 -24
  34. package/src/commands/gateway.js +492 -249
  35. package/src/commands/health.js +148 -0
  36. package/src/commands/help.js +24 -25
  37. package/src/commands/hooks.js +141 -87
  38. package/src/commands/imessage.js +128 -14
  39. package/src/commands/infer.js +1474 -0
  40. package/src/commands/irc.js +64 -15
  41. package/src/commands/logs.js +122 -99
  42. package/src/commands/mattermost.js +114 -12
  43. package/src/commands/mcp.js +121 -309
  44. package/src/commands/memory-cmd.js +134 -1
  45. package/src/commands/memory.js +128 -0
  46. package/src/commands/message.js +720 -134
  47. package/src/commands/migrate.js +213 -2
  48. package/src/commands/models.js +39 -1
  49. package/src/commands/node.js +98 -0
  50. package/src/commands/nodes.js +362 -0
  51. package/src/commands/oc-path.js +200 -0
  52. package/src/commands/onboard.js +129 -0
  53. package/src/commands/open-prose.js +67 -0
  54. package/src/commands/pairing.js +108 -107
  55. package/src/commands/path.js +206 -0
  56. package/src/commands/plugins.js +35 -1
  57. package/src/commands/policy.js +176 -0
  58. package/src/commands/proxy.js +306 -0
  59. package/src/commands/qr.js +70 -0
  60. package/src/commands/reset.js +101 -94
  61. package/src/commands/sandbox.js +125 -0
  62. package/src/commands/secrets.js +201 -0
  63. package/src/commands/sessions.js +110 -51
  64. package/src/commands/setup.js +102 -543
  65. package/src/commands/signal.js +447 -18
  66. package/src/commands/skills.js +67 -1
  67. package/src/commands/sms.js +123 -19
  68. package/src/commands/status.js +101 -127
  69. package/src/commands/system.js +53 -0
  70. package/src/commands/tasks.js +208 -100
  71. package/src/commands/terminal.js +139 -0
  72. package/src/commands/thread-ownership.js +157 -0
  73. package/src/commands/transcripts.js +95 -0
  74. package/src/commands/tui.js +41 -0
  75. package/src/commands/uninstall.js +73 -92
  76. package/src/commands/update.js +146 -91
  77. package/src/commands/voice.js +82 -0
  78. package/src/commands/vydra.js +98 -0
  79. package/src/commands/webhooks.js +58 -66
  80. package/src/commands/wiki.js +783 -0
  81. package/src/commands/workboard.js +207 -0
  82. package/src/tools/audio_understanding.js +154 -0
  83. package/src/tools/browser.js +112 -0
  84. package/src/tools/canvas.js +104 -0
  85. package/src/tools/document_extract.js +84 -0
  86. package/src/tools/duckduckgo.js +54 -0
  87. package/src/tools/exa_search.js +66 -0
  88. package/src/tools/firecrawl.js +104 -0
  89. package/src/tools/image_generation.js +99 -0
  90. package/src/tools/llm_task.js +118 -0
  91. package/src/tools/media_understanding.js +128 -0
  92. package/src/tools/music_generation.js +113 -0
  93. package/src/tools/parallel_search.js +77 -0
  94. package/src/tools/phone_control.js +80 -0
  95. package/src/tools/phone_control_enhanced.js +184 -0
  96. package/src/tools/searxng.js +61 -0
  97. package/src/tools/speech_to_text.js +135 -0
  98. package/src/tools/text_to_speech.js +105 -0
  99. package/src/tools/thread_ownership.js +88 -0
  100. package/src/tools/video_generation.js +72 -0
  101. package/src/tools/web_readability.js +104 -0
  102. package/src/utils/agents-md.js +85 -0
  103. package/src/utils/api.js +39 -40
  104. package/src/utils/format.js +144 -0
  105. package/src/utils/headless.js +2 -1
  106. package/src/utils/memory.js +200 -0
  107. package/src/utils/parallel-tools.js +106 -0
  108. package/src/utils/sub-agent.js +148 -0
  109. package/src/utils/token-budget.js +304 -0
  110. package/src/utils/tool-runner.js +7 -5
  111. package/src/utils/web-fetch.js +107 -0
@@ -1,70 +1,129 @@
1
+ const chalk = require('chalk');
1
2
  const fs = require('fs');
2
3
  const path = require('path');
3
4
  const os = require('os');
4
- const chalk = require('chalk');
5
- const { listSessions } = require('../utils/sessions');
6
-
7
- async function sessions(action, ...args) {
8
- if (!action || action === 'list') return listSessionsCommand();
9
- if (action === 'delete') {
10
- const id = args[0];
11
- if (!id) {
12
- console.log(chalk.red('\n Session ID gerekli\n'));
13
- console.log(chalk.gray(' Kullanım: natureco sessions delete <id>\n'));
14
- process.exit(1);
15
- }
16
- return deleteSessionCommand(id);
5
+
6
+ const SESSIONS_DIR = path.join(os.homedir(), '.natureco', 'sessions');
7
+
8
+ function ensureDir(dir) {
9
+ if (!fs.existsSync(dir)) fs.mkdirSync(dir, { recursive: true });
10
+ }
11
+
12
+ function sessions(args) {
13
+ const [action, ...params] = args || [];
14
+
15
+ if (!action || action === 'list') return cmdList();
16
+ if (action === 'show') return cmdShow(params[0]);
17
+ if (action === 'cleanup') return cmdCleanup();
18
+ if (action === 'prune') return cmdPrune(parseInt(params[0], 10));
19
+
20
+ console.log(chalk.red(`\n Unknown sessions action: ${action}\n`));
21
+ console.log(chalk.gray(' Usage: natureco sessions <action> [params]'));
22
+ console.log(chalk.gray(' Actions: list, show <id>, cleanup, prune <days>\n'));
23
+ process.exit(1);
24
+ }
25
+
26
+ function getSessions() {
27
+ ensureDir(SESSIONS_DIR);
28
+ const files = fs.readdirSync(SESSIONS_DIR).filter(f => f.endsWith('.json'));
29
+ const sessions = [];
30
+ for (const file of files) {
31
+ const fp = path.join(SESSIONS_DIR, file);
32
+ try {
33
+ const data = JSON.parse(fs.readFileSync(fp, 'utf8'));
34
+ sessions.push({ id: path.basename(file, '.json'), file, data });
35
+ } catch {}
17
36
  }
18
- if (action === 'show') {
19
- const sessionId = args[0];
20
- if (!sessionId) {
21
- console.log(chalk.red('\n ❌ Session ID gerekli\n'));
22
- console.log(chalk.gray(' Kullanım: natureco sessions show <id>\n'));
23
- process.exit(1);
24
- }
25
- return showSession(sessionId);
37
+ return sessions;
38
+ }
39
+
40
+ function cmdList() {
41
+ const sessions = getSessions();
42
+
43
+ console.log(chalk.cyan(`\n Sessions (${sessions.length})\n`));
44
+ console.log(chalk.gray(' ' + '─'.repeat(48)));
45
+
46
+ if (sessions.length === 0) {
47
+ console.log(chalk.gray(' No sessions found.\n'));
48
+ return;
26
49
  }
27
- console.log(chalk.red(`\n ❌ Bilinmeyen komut: ${action}\n`));
28
- console.log(chalk.gray(' Kullanım: natureco sessions [list|delete|show]\n'));
29
- process.exit(1);
50
+
51
+ for (const s of sessions) {
52
+ const msgCount = (s.data.messages || []).length;
53
+ const preview = s.data.preview || s.data.id || s.id;
54
+ const updated = s.data.updatedAt || s.data.savedAt || '';
55
+ console.log(` ${chalk.white(s.id)}`);
56
+ console.log(chalk.gray(` Messages: ${msgCount} · ${preview.toString().slice(0, 60)}`));
57
+ if (updated) console.log(chalk.gray(` Updated: ${updated.slice(0, 10)}`));
58
+ }
59
+ console.log('');
30
60
  }
31
61
 
32
- async function listSessionsCommand() {
33
- const sessions = listSessions();
34
- if (!sessions.length) {
35
- console.log(chalk.gray('\n Kayıtlı oturum yok.\n'));
62
+ function cmdShow(id) {
63
+ if (!id) {
64
+ console.log(chalk.red('\n Usage: natureco sessions show <id>\n'));
65
+ process.exit(1);
66
+ }
67
+
68
+ const sessions = getSessions();
69
+ const found = sessions.find(s => s.id.includes(id));
70
+
71
+ if (!found) {
72
+ console.log(chalk.yellow(`\n Session not found: ${id}\n`));
36
73
  return;
37
74
  }
38
- sessions.forEach(s => {
39
- console.log(` [${s.id}] ${s.savedAt.slice(0, 10)} — ${s.preview || '(boş)'} (${s.messageCount} mesaj)`);
40
- });
41
- console.log();
75
+
76
+ console.log(chalk.cyan(`\n Session: ${found.id}\n`));
77
+ console.log(chalk.gray(' ' + '─'.repeat(48)));
78
+ const msgs = found.data.messages || [];
79
+ console.log(` ${chalk.white('Messages:')} ${chalk.cyan(msgs.length)}`);
80
+ for (const msg of msgs.slice(-10)) {
81
+ const role = msg.role === 'user' ? chalk.green('You') : chalk.cyan('Bot');
82
+ const content = (msg.content || '').slice(0, 200);
83
+ console.log(` ${role}: ${chalk.white(content)}`);
84
+ }
85
+ if (msgs.length > 10) console.log(chalk.gray(` ... and ${msgs.length - 10} more`));
86
+ console.log('');
42
87
  }
43
88
 
44
- async function deleteSessionCommand(id) {
45
- const { deleteSession } = require('../utils/sessions');
46
- const ok = deleteSession(id);
47
- console.log(ok ? chalk.green('\n ✓ Oturum silindi.\n') : chalk.red('\n ❌ Oturum bulunamadı.\n'));
89
+ function cmdCleanup() {
90
+ const sessions = getSessions();
91
+ let removed = 0;
92
+
93
+ for (const s of sessions) {
94
+ const msgs = s.data.messages || [];
95
+ if (msgs.length === 0) {
96
+ try {
97
+ fs.unlinkSync(path.join(SESSIONS_DIR, s.file));
98
+ removed++;
99
+ } catch {}
100
+ }
101
+ }
102
+
103
+ console.log(chalk.gray(`\n Cleaned up ${removed} empty session(s).\n`));
48
104
  }
49
105
 
50
- async function showSession(sessionId) {
51
- const sessionsDir = path.join(os.homedir(), '.natureco', 'sessions');
52
- if (!fs.existsSync(sessionsDir)) {
53
- console.log(chalk.red(`\n ❌ Oturum bulunamadı: ${sessionId}\n`));
106
+ function cmdPrune(days) {
107
+ if (!days || isNaN(days) || days < 1) {
108
+ console.log(chalk.red('\n Usage: natureco sessions prune <days>\n'));
54
109
  process.exit(1);
55
110
  }
56
- const files = fs.readdirSync(sessionsDir).filter(f => f.includes(sessionId) && f.endsWith('.json'));
57
- if (!files.length) {
58
- console.log(chalk.red(`\n Oturum bulunamadı: ${sessionId}\n`));
59
- process.exit(1);
111
+
112
+ const cutoff = Date.now() - days * 86400000;
113
+ const sessions = getSessions();
114
+ let removed = 0;
115
+
116
+ for (const s of sessions) {
117
+ const ts = s.data.updatedAt || s.data.savedAt || '';
118
+ if (ts && new Date(ts).getTime() < cutoff) {
119
+ try {
120
+ fs.unlinkSync(path.join(SESSIONS_DIR, s.file));
121
+ removed++;
122
+ } catch {}
123
+ }
60
124
  }
61
- const data = JSON.parse(fs.readFileSync(path.join(sessionsDir, files[0]), 'utf8'));
62
- console.log(chalk.cyan(`\n Oturum: ${sessionId}`));
63
- console.log(chalk.gray(` ${data.savedAt} · ${data.messages.length} mesaj\n`));
64
- data.messages.forEach((msg, i) => {
65
- console.log(chalk.white(` ${msg.role === 'user' ? 'You' : 'Bot'}: ${msg.content?.slice(0, 200)}`));
66
- });
67
- console.log();
125
+
126
+ console.log(chalk.gray(`\n Pruned ${removed} session(s) older than ${days} day(s).\n`));
68
127
  }
69
128
 
70
129
  module.exports = sessions;