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.
- package/bin/natureco.js +178 -167
- package/package.json +1 -1
- package/src/commands/acp.js +39 -0
- package/src/commands/admin-rpc.js +83 -0
- package/src/commands/agent.js +214 -23
- package/src/commands/agents.js +114 -30
- package/src/commands/approvals.js +172 -11
- package/src/commands/ask.js +1 -1
- package/src/commands/browser.js +815 -0
- package/src/commands/capability.js +195 -22
- package/src/commands/channels.js +422 -267
- package/src/commands/chat.js +5 -8
- package/src/commands/clawbot.js +19 -0
- package/src/commands/code.js +3 -2
- package/src/commands/commitments.js +125 -9
- package/src/commands/completion.js +40 -32
- package/src/commands/config.js +228 -30
- package/src/commands/configure.js +84 -67
- package/src/commands/cron.js +239 -19
- package/src/commands/daemon.js +34 -4
- package/src/commands/dashboard.js +47 -374
- package/src/commands/devices.js +53 -26
- package/src/commands/directory.js +146 -14
- package/src/commands/dns.js +148 -10
- package/src/commands/docs.js +119 -26
- package/src/commands/doctor.js +143 -492
- package/src/commands/exec-policy.js +57 -48
- package/src/commands/gateway.js +492 -249
- package/src/commands/health.js +141 -11
- package/src/commands/help.js +24 -25
- package/src/commands/hooks.js +141 -87
- package/src/commands/infer.js +1442 -41
- package/src/commands/logs.js +122 -99
- package/src/commands/mcp.js +121 -309
- package/src/commands/memory.js +128 -0
- package/src/commands/message.js +720 -140
- package/src/commands/models.js +39 -1
- package/src/commands/node.js +77 -77
- package/src/commands/nodes.js +278 -22
- package/src/commands/onboard.js +115 -56
- package/src/commands/pairing.js +108 -107
- package/src/commands/path.js +206 -0
- package/src/commands/plugins.js +35 -1
- package/src/commands/proxy.js +159 -8
- package/src/commands/qr.js +55 -13
- package/src/commands/reset.js +101 -94
- package/src/commands/secrets.js +104 -21
- package/src/commands/sessions.js +110 -51
- package/src/commands/setup.js +229 -649
- package/src/commands/skills.js +67 -1
- package/src/commands/status.js +101 -127
- package/src/commands/tasks.js +208 -100
- package/src/commands/terminal.js +130 -12
- package/src/commands/transcripts.js +24 -1
- package/src/commands/tui.js +41 -0
- package/src/commands/uninstall.js +73 -92
- package/src/commands/update.js +146 -91
- package/src/commands/web-fetch.js +34 -0
- package/src/commands/webhooks.js +58 -66
- package/src/commands/wiki.js +783 -0
- package/src/utils/agents-md.js +85 -0
- package/src/utils/api.js +40 -41
- package/src/utils/format.js +144 -0
- package/src/utils/headless.js +2 -1
- package/src/utils/parallel-tools.js +106 -0
- package/src/utils/sub-agent.js +148 -0
- package/src/utils/token-budget.js +304 -0
- package/src/utils/tool-runner.js +7 -5
- package/src/utils/web-fetch.js +107 -0
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
const chalk = require('chalk');
|
|
2
|
+
const fs = require('fs');
|
|
3
|
+
const path = require('path');
|
|
4
|
+
const os = require('os');
|
|
5
|
+
|
|
6
|
+
const MEMORY_DIR = path.join(os.homedir(), '.natureco', 'memory');
|
|
7
|
+
const INDEX_FILE = path.join(MEMORY_DIR, 'index.json');
|
|
8
|
+
|
|
9
|
+
function ensureDir(dir) {
|
|
10
|
+
if (!fs.existsSync(dir)) fs.mkdirSync(dir, { recursive: true });
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
function memory(args) {
|
|
14
|
+
const [action, ...params] = args || [];
|
|
15
|
+
|
|
16
|
+
if (!action || action === 'status') return cmdStatus();
|
|
17
|
+
if (action === 'index') return cmdIndex();
|
|
18
|
+
if (action === 'search') return cmdSearch(params.join(' '));
|
|
19
|
+
|
|
20
|
+
console.log(chalk.red(`\n Unknown memory action: ${action}\n`));
|
|
21
|
+
console.log(chalk.gray(' Usage: natureco memory <action> [params]'));
|
|
22
|
+
console.log(chalk.gray(' Actions: status, index, search <query>\n'));
|
|
23
|
+
process.exit(1);
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
function cmdStatus() {
|
|
27
|
+
ensureDir(MEMORY_DIR);
|
|
28
|
+
const files = fs.readdirSync(MEMORY_DIR).filter(f => f.endsWith('.json'));
|
|
29
|
+
let totalSize = 0;
|
|
30
|
+
|
|
31
|
+
for (const file of files) {
|
|
32
|
+
const fp = path.join(MEMORY_DIR, file);
|
|
33
|
+
try { totalSize += fs.statSync(fp).size; } catch {}
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
console.log(chalk.cyan('\n Memory Store Status\n'));
|
|
37
|
+
console.log(chalk.gray(' ' + '─'.repeat(48)));
|
|
38
|
+
console.log(` ${chalk.white('Files:')} ${chalk.cyan(files.length)}`);
|
|
39
|
+
console.log(` ${chalk.white('Size:')} ${chalk.cyan(formatSize(totalSize))}`);
|
|
40
|
+
console.log(` ${chalk.white('Location:')} ${chalk.gray(MEMORY_DIR)}`);
|
|
41
|
+
console.log(chalk.gray(' ' + '─'.repeat(48)));
|
|
42
|
+
console.log('');
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
function cmdIndex() {
|
|
46
|
+
ensureDir(MEMORY_DIR);
|
|
47
|
+
const files = fs.readdirSync(MEMORY_DIR).filter(f => f.endsWith('.json'));
|
|
48
|
+
const index = [];
|
|
49
|
+
|
|
50
|
+
for (const file of files) {
|
|
51
|
+
const fp = path.join(MEMORY_DIR, file);
|
|
52
|
+
try {
|
|
53
|
+
const data = JSON.parse(fs.readFileSync(fp, 'utf8'));
|
|
54
|
+
index.push({
|
|
55
|
+
file,
|
|
56
|
+
keywords: extractKeywords(data),
|
|
57
|
+
size: fs.statSync(fp).size,
|
|
58
|
+
updated: fs.statSync(fp).mtime.toISOString(),
|
|
59
|
+
});
|
|
60
|
+
} catch {}
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
fs.writeFileSync(INDEX_FILE, JSON.stringify(index, null, 2), 'utf8');
|
|
64
|
+
console.log(chalk.green(`\n Index rebuilt: ${index.length} entries\n`));
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
function cmdSearch(query) {
|
|
68
|
+
if (!query) {
|
|
69
|
+
console.log(chalk.red('\n Usage: natureco memory search <query>\n'));
|
|
70
|
+
process.exit(1);
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
if (!fs.existsSync(MEMORY_DIR)) {
|
|
74
|
+
console.log(chalk.yellow('\n No memory directory found.\n'));
|
|
75
|
+
return;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
const files = fs.readdirSync(MEMORY_DIR).filter(f => f.endsWith('.json'));
|
|
79
|
+
const lower = query.toLowerCase();
|
|
80
|
+
let results = [];
|
|
81
|
+
|
|
82
|
+
for (const file of files) {
|
|
83
|
+
const fp = path.join(MEMORY_DIR, file);
|
|
84
|
+
try {
|
|
85
|
+
const content = fs.readFileSync(fp, 'utf8');
|
|
86
|
+
if (content.toLowerCase().includes(lower)) {
|
|
87
|
+
const data = JSON.parse(content);
|
|
88
|
+
results.push({ file, data });
|
|
89
|
+
}
|
|
90
|
+
} catch {}
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
if (results.length === 0) {
|
|
94
|
+
console.log(chalk.yellow(`\n No results for "${query}"\n`));
|
|
95
|
+
return;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
console.log(chalk.cyan(`\n Found ${results.length} memory file(s) for "${query}"\n`));
|
|
99
|
+
for (const r of results) {
|
|
100
|
+
console.log(` ${chalk.white(r.file)}`);
|
|
101
|
+
const keys = Object.keys(r.data).filter(k => {
|
|
102
|
+
const v = typeof r.data[k] === 'string' ? r.data[k] : JSON.stringify(r.data[k]);
|
|
103
|
+
return v.toLowerCase().includes(lower);
|
|
104
|
+
});
|
|
105
|
+
for (const k of keys) {
|
|
106
|
+
console.log(chalk.gray(` ${k}: ${r.data[k]}`));
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
console.log('');
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
function extractKeywords(data) {
|
|
113
|
+
const words = new Set();
|
|
114
|
+
for (const val of Object.values(data)) {
|
|
115
|
+
if (typeof val === 'string') {
|
|
116
|
+
val.split(/\s+/).filter(w => w.length > 3).forEach(w => words.add(w.toLowerCase()));
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
return [...words];
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
function formatSize(bytes) {
|
|
123
|
+
if (bytes < 1024) return `${bytes} B`;
|
|
124
|
+
if (bytes < 1048576) return `${(bytes / 1024).toFixed(1)} KB`;
|
|
125
|
+
return `${(bytes / 1048576).toFixed(1)} MB`;
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
module.exports = memory;
|