natureco-cli 2.23.30 → 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.
- package/bin/natureco.js +166 -163
- 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/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 +219 -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 +102 -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/webhooks.js +58 -66
- package/src/commands/wiki.js +783 -0
- package/src/utils/agents-md.js +85 -0
- package/src/utils/api.js +39 -40
- 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
|
@@ -1,71 +1,80 @@
|
|
|
1
1
|
const chalk = require('chalk');
|
|
2
|
-
const
|
|
2
|
+
const fs = require('fs');
|
|
3
|
+
const path = require('path');
|
|
4
|
+
const os = require('os');
|
|
5
|
+
|
|
6
|
+
const POLICY_FILE = path.join(os.homedir(), '.natureco', 'exec-policy.json');
|
|
7
|
+
|
|
8
|
+
const PRESETS = {
|
|
9
|
+
strict: { allowCommands: false, allowScripts: false, timeout: 10000, sandbox: 'strict', approvals: 'all' },
|
|
10
|
+
permissive: { allowCommands: true, allowScripts: true, timeout: 60000, sandbox: 'none', approvals: 'none' },
|
|
11
|
+
default: { allowCommands: true, allowScripts: false, timeout: 30000, sandbox: 'isolated', approvals: 'write' },
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
function loadPolicy() {
|
|
15
|
+
if (!fs.existsSync(POLICY_FILE)) return { ...PRESETS.default };
|
|
16
|
+
try { return JSON.parse(fs.readFileSync(POLICY_FILE, 'utf8')); }
|
|
17
|
+
catch { return { ...PRESETS.default }; }
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
function savePolicy(policy) {
|
|
21
|
+
const dir = path.dirname(POLICY_FILE);
|
|
22
|
+
if (!fs.existsSync(dir)) fs.mkdirSync(dir, { recursive: true });
|
|
23
|
+
fs.writeFileSync(POLICY_FILE, JSON.stringify(policy, null, 2), 'utf8');
|
|
24
|
+
}
|
|
3
25
|
|
|
4
26
|
function execPolicy(args) {
|
|
5
27
|
const [action, ...params] = args || [];
|
|
6
28
|
|
|
7
|
-
if (!action || action === 'show') return
|
|
8
|
-
if (action === '
|
|
9
|
-
if (action === '
|
|
29
|
+
if (!action || action === 'show') return cmdShow();
|
|
30
|
+
if (action === 'preset') return cmdPreset(params[0]);
|
|
31
|
+
if (action === 'set') return cmdSet(params[0], params.slice(1).join(' '));
|
|
10
32
|
|
|
11
|
-
console.log(chalk.red(`\n
|
|
12
|
-
console.log(chalk.gray('
|
|
33
|
+
console.log(chalk.red(`\n Unknown exec-policy action: ${action}\n`));
|
|
34
|
+
console.log(chalk.gray(' Usage: natureco exec-policy <action> [params]'));
|
|
35
|
+
console.log(chalk.gray(' Actions: show, preset <name>, set <key> <value>\n'));
|
|
13
36
|
process.exit(1);
|
|
14
37
|
}
|
|
15
38
|
|
|
16
|
-
function
|
|
17
|
-
const
|
|
18
|
-
const policy = config.execPolicy || 'default';
|
|
39
|
+
function cmdShow() {
|
|
40
|
+
const policy = loadPolicy();
|
|
19
41
|
|
|
20
|
-
console.log(chalk.cyan('\n
|
|
42
|
+
console.log(chalk.cyan('\n Execution Policy\n'));
|
|
21
43
|
console.log(chalk.gray(' ' + '─'.repeat(48)));
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
console.log();
|
|
27
|
-
console.log(chalk.gray('
|
|
28
|
-
console.log(chalk.cyan(' natureco exec-policy set <policy>'));
|
|
29
|
-
console.log(chalk.cyan(' natureco exec-policy sync\n'));
|
|
44
|
+
for (const [key, val] of Object.entries(policy)) {
|
|
45
|
+
const display = typeof val === 'boolean' ? (val ? chalk.green('yes') : chalk.red('no')) : chalk.white(val);
|
|
46
|
+
console.log(` ${chalk.white(key)}: ${display}`);
|
|
47
|
+
}
|
|
48
|
+
console.log('');
|
|
49
|
+
console.log(chalk.gray(' Presets: strict, permissive, default\n'));
|
|
30
50
|
}
|
|
31
51
|
|
|
32
|
-
function
|
|
33
|
-
if (!
|
|
34
|
-
console.log(chalk.red(
|
|
52
|
+
function cmdPreset(name) {
|
|
53
|
+
if (!name || !PRESETS[name]) {
|
|
54
|
+
console.log(chalk.red(`\n Unknown preset: ${name}\n`));
|
|
55
|
+
console.log(chalk.gray(' Available presets: strict, permissive, default\n'));
|
|
35
56
|
process.exit(1);
|
|
36
57
|
}
|
|
37
58
|
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
saveConfig(config);
|
|
41
|
-
console.log(chalk.green(`\n ✅ Exec policy: ${policy}\n`));
|
|
59
|
+
savePolicy({ ...PRESETS[name] });
|
|
60
|
+
console.log(chalk.green(`\n Policy set to "${name}" preset.\n`));
|
|
42
61
|
}
|
|
43
62
|
|
|
44
|
-
function
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
const defaults = {
|
|
49
|
-
execPolicy: 'default',
|
|
50
|
-
execAllowCommands: true,
|
|
51
|
-
execTimeout: 30000,
|
|
52
|
-
execSandbox: 'none'
|
|
53
|
-
};
|
|
54
|
-
|
|
55
|
-
let changed = 0;
|
|
56
|
-
for (const [key, val] of Object.entries(defaults)) {
|
|
57
|
-
if (config[key] === undefined) {
|
|
58
|
-
config[key] = val;
|
|
59
|
-
changed++;
|
|
60
|
-
}
|
|
63
|
+
function cmdSet(key, value) {
|
|
64
|
+
if (!key || value === undefined) {
|
|
65
|
+
console.log(chalk.red('\n Usage: natureco exec-policy set <key> <value>\n'));
|
|
66
|
+
process.exit(1);
|
|
61
67
|
}
|
|
62
68
|
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
+
const policy = loadPolicy();
|
|
70
|
+
|
|
71
|
+
if (value === 'true') value = true;
|
|
72
|
+
else if (value === 'false') value = false;
|
|
73
|
+
else if (!isNaN(value)) value = Number(value);
|
|
74
|
+
|
|
75
|
+
policy[key] = value;
|
|
76
|
+
savePolicy(policy);
|
|
77
|
+
console.log(chalk.green(`\n Policy "${key}" set to ${JSON.stringify(value)}.\n`));
|
|
69
78
|
}
|
|
70
79
|
|
|
71
80
|
module.exports = execPolicy;
|