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.
- package/README.md +94 -11
- package/bin/natureco.js +495 -94
- package/package.json +1 -1
- package/src/commands/acp.js +39 -0
- package/src/commands/admin-rpc.js +302 -0
- package/src/commands/agent.js +280 -0
- package/src/commands/agents.js +114 -30
- package/src/commands/approvals.js +214 -0
- package/src/commands/backup.js +124 -0
- package/src/commands/bonjour.js +167 -0
- package/src/commands/browser.js +815 -0
- package/src/commands/capability.js +237 -0
- package/src/commands/channels.js +422 -267
- package/src/commands/chat.js +5 -8
- package/src/commands/clawbot.js +19 -0
- package/src/commands/clickclack.js +130 -0
- package/src/commands/code.js +3 -2
- package/src/commands/commitments.js +148 -0
- package/src/commands/completion.js +84 -0
- package/src/commands/config.js +219 -30
- package/src/commands/configure.js +110 -0
- package/src/commands/crestodian.js +92 -0
- package/src/commands/cron.js +239 -19
- package/src/commands/daemon.js +90 -0
- package/src/commands/dashboard.js +47 -374
- package/src/commands/device-pair.js +248 -0
- package/src/commands/devices.js +137 -0
- package/src/commands/directory.js +179 -0
- package/src/commands/dns.js +196 -0
- package/src/commands/docs.js +136 -0
- package/src/commands/doctor.js +143 -492
- package/src/commands/exec-policy.js +80 -0
- package/src/commands/gateway-server.js +1155 -24
- package/src/commands/gateway.js +492 -249
- package/src/commands/health.js +148 -0
- package/src/commands/help.js +24 -25
- package/src/commands/hooks.js +141 -87
- package/src/commands/imessage.js +128 -14
- package/src/commands/infer.js +1474 -0
- package/src/commands/irc.js +64 -15
- package/src/commands/logs.js +122 -99
- package/src/commands/mattermost.js +114 -12
- package/src/commands/mcp.js +121 -309
- package/src/commands/memory-cmd.js +134 -1
- package/src/commands/memory.js +128 -0
- package/src/commands/message.js +720 -134
- package/src/commands/migrate.js +213 -2
- package/src/commands/models.js +39 -1
- package/src/commands/node.js +98 -0
- package/src/commands/nodes.js +362 -0
- package/src/commands/oc-path.js +200 -0
- package/src/commands/onboard.js +129 -0
- package/src/commands/open-prose.js +67 -0
- package/src/commands/pairing.js +108 -107
- package/src/commands/path.js +206 -0
- package/src/commands/plugins.js +35 -1
- package/src/commands/policy.js +176 -0
- package/src/commands/proxy.js +306 -0
- package/src/commands/qr.js +70 -0
- package/src/commands/reset.js +101 -94
- package/src/commands/sandbox.js +125 -0
- package/src/commands/secrets.js +201 -0
- package/src/commands/sessions.js +110 -51
- package/src/commands/setup.js +102 -543
- package/src/commands/signal.js +447 -18
- package/src/commands/skills.js +67 -1
- package/src/commands/sms.js +123 -19
- package/src/commands/status.js +101 -127
- package/src/commands/system.js +53 -0
- package/src/commands/tasks.js +208 -100
- package/src/commands/terminal.js +139 -0
- package/src/commands/thread-ownership.js +157 -0
- package/src/commands/transcripts.js +95 -0
- package/src/commands/tui.js +41 -0
- package/src/commands/uninstall.js +73 -92
- package/src/commands/update.js +146 -91
- package/src/commands/voice.js +82 -0
- package/src/commands/vydra.js +98 -0
- package/src/commands/webhooks.js +58 -66
- package/src/commands/wiki.js +783 -0
- package/src/commands/workboard.js +207 -0
- package/src/tools/audio_understanding.js +154 -0
- package/src/tools/browser.js +112 -0
- package/src/tools/canvas.js +104 -0
- package/src/tools/document_extract.js +84 -0
- package/src/tools/duckduckgo.js +54 -0
- package/src/tools/exa_search.js +66 -0
- package/src/tools/firecrawl.js +104 -0
- package/src/tools/image_generation.js +99 -0
- package/src/tools/llm_task.js +118 -0
- package/src/tools/media_understanding.js +128 -0
- package/src/tools/music_generation.js +113 -0
- package/src/tools/parallel_search.js +77 -0
- package/src/tools/phone_control.js +80 -0
- package/src/tools/phone_control_enhanced.js +184 -0
- package/src/tools/searxng.js +61 -0
- package/src/tools/speech_to_text.js +135 -0
- package/src/tools/text_to_speech.js +105 -0
- package/src/tools/thread_ownership.js +88 -0
- package/src/tools/video_generation.js +72 -0
- package/src/tools/web_readability.js +104 -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/memory.js +200 -0
- 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
package/src/commands/update.js
CHANGED
|
@@ -1,91 +1,146 @@
|
|
|
1
|
-
const chalk = require('chalk');
|
|
2
|
-
const
|
|
3
|
-
const
|
|
4
|
-
const
|
|
5
|
-
const
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
console.log(chalk.
|
|
74
|
-
|
|
75
|
-
console.log('');
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
1
|
+
const chalk = require('chalk');
|
|
2
|
+
const fs = require('fs');
|
|
3
|
+
const path = require('path');
|
|
4
|
+
const os = require('os');
|
|
5
|
+
const { execSync } = require('child_process');
|
|
6
|
+
const readline = require('readline');
|
|
7
|
+
|
|
8
|
+
const VERSION_FILE = path.join(os.homedir(), '.natureco', 'version.json');
|
|
9
|
+
|
|
10
|
+
function rlQuestion(query) {
|
|
11
|
+
const rl = readline.createInterface({ input: process.stdin, output: process.stdout });
|
|
12
|
+
return new Promise(resolve => {
|
|
13
|
+
rl.question(query, answer => { rl.close(); resolve(answer.trim().toLowerCase()); });
|
|
14
|
+
});
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
function loadVersion() {
|
|
18
|
+
if (!fs.existsSync(VERSION_FILE)) return { installed: null, checked: null };
|
|
19
|
+
try { return JSON.parse(fs.readFileSync(VERSION_FILE, 'utf8')); }
|
|
20
|
+
catch { return { installed: null, checked: null }; }
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
function saveVersion(data) {
|
|
24
|
+
const dir = path.dirname(VERSION_FILE);
|
|
25
|
+
if (!fs.existsSync(dir)) fs.mkdirSync(dir, { recursive: true });
|
|
26
|
+
fs.writeFileSync(VERSION_FILE, JSON.stringify(data, null, 2), 'utf8');
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
function getCurrentVersion() {
|
|
30
|
+
try {
|
|
31
|
+
const pkg = require('../../package.json');
|
|
32
|
+
return pkg.version;
|
|
33
|
+
} catch {
|
|
34
|
+
return '0.0.0';
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
function getLatestVersion() {
|
|
39
|
+
try {
|
|
40
|
+
const result = execSync('npm view natureco-cli version', { encoding: 'utf8', stdio: ['pipe', 'pipe', 'ignore'] });
|
|
41
|
+
return result.trim();
|
|
42
|
+
} catch {
|
|
43
|
+
return null;
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
async function update(params) {
|
|
48
|
+
try {
|
|
49
|
+
const [action] = params || [];
|
|
50
|
+
|
|
51
|
+
if (!action || action === 'status') return cmdStatus();
|
|
52
|
+
if (action === 'run') return await cmdRun();
|
|
53
|
+
if (action === 'wizard') return await cmdWizard();
|
|
54
|
+
|
|
55
|
+
console.log(chalk.red(`\n Unknown update action: ${action}\n`));
|
|
56
|
+
console.log(chalk.gray(' Usage: natureco update [run|status|wizard]\n'));
|
|
57
|
+
} catch (err) {
|
|
58
|
+
console.log(chalk.red(`\n Update error: ${err.message}\n`));
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
function cmdStatus() {
|
|
63
|
+
const current = getCurrentVersion();
|
|
64
|
+
const latest = getLatestVersion();
|
|
65
|
+
const ver = loadVersion();
|
|
66
|
+
|
|
67
|
+
console.log(chalk.cyan('\n Update Status\n'));
|
|
68
|
+
console.log(chalk.white(' Installed: ') + chalk.cyan('v' + current));
|
|
69
|
+
|
|
70
|
+
if (latest) {
|
|
71
|
+
console.log(chalk.white(' Latest: ') + chalk.cyan('v' + latest));
|
|
72
|
+
if (current === latest) {
|
|
73
|
+
console.log(chalk.green(' ✓ You are up to date.\n'));
|
|
74
|
+
} else {
|
|
75
|
+
console.log(chalk.yellow(' Update available: v' + current + ' → v' + latest + '\n'));
|
|
76
|
+
}
|
|
77
|
+
} else {
|
|
78
|
+
console.log(chalk.gray(' Could not check latest version.\n'));
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
saveVersion({ installed: current, checked: new Date().toISOString(), latest: latest || ver.latest });
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
async function cmdRun() {
|
|
85
|
+
const current = getCurrentVersion();
|
|
86
|
+
const latest = getLatestVersion();
|
|
87
|
+
|
|
88
|
+
if (!latest) {
|
|
89
|
+
console.log(chalk.yellow('\n Could not fetch latest version. Check your internet connection.\n'));
|
|
90
|
+
return;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
if (current === latest) {
|
|
94
|
+
console.log(chalk.green('\n Already up to date (v' + current + ').\n'));
|
|
95
|
+
return;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
console.log(chalk.cyan('\n Updating: v' + current + ' → v' + latest + '\n'));
|
|
99
|
+
|
|
100
|
+
try {
|
|
101
|
+
execSync('npm update -g natureco-cli', { stdio: 'inherit' });
|
|
102
|
+
saveVersion({ installed: latest, updated: new Date().toISOString(), latest });
|
|
103
|
+
console.log(chalk.green('\n ✓ Updated to v' + latest + '\n'));
|
|
104
|
+
} catch (e) {
|
|
105
|
+
console.log(chalk.red('\n Update failed: ' + e.message + '\n'));
|
|
106
|
+
console.log(chalk.gray(' Try: npm install -g natureco-cli@latest\n'));
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
async function cmdWizard() {
|
|
111
|
+
const current = getCurrentVersion();
|
|
112
|
+
const latest = getLatestVersion();
|
|
113
|
+
|
|
114
|
+
console.log(chalk.cyan('\n Update Wizard\n'));
|
|
115
|
+
|
|
116
|
+
if (!latest) {
|
|
117
|
+
console.log(chalk.yellow(' Could not check for updates.\n'));
|
|
118
|
+
return;
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
console.log(chalk.white(' Current: v' + current));
|
|
122
|
+
console.log(chalk.white(' Latest: v' + latest));
|
|
123
|
+
|
|
124
|
+
if (current === latest) {
|
|
125
|
+
console.log(chalk.green('\n You are up to date!\n'));
|
|
126
|
+
return;
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
const answer = await rlQuestion(chalk.yellow(' Update to v' + latest + '? [Y/n]: '));
|
|
130
|
+
if (answer === 'n' || answer === 'no') {
|
|
131
|
+
console.log(chalk.gray('\n Skipped.\n'));
|
|
132
|
+
return;
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
console.log(chalk.gray('\n Installing...\n'));
|
|
136
|
+
|
|
137
|
+
try {
|
|
138
|
+
execSync('npm install -g natureco-cli@latest', { stdio: 'inherit' });
|
|
139
|
+
saveVersion({ installed: latest, updated: new Date().toISOString(), latest });
|
|
140
|
+
console.log(chalk.green('\n ✓ Updated to v' + latest + '\n'));
|
|
141
|
+
} catch (e) {
|
|
142
|
+
console.log(chalk.red('\n Update failed: ' + e.message + '\n'));
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
module.exports = update;
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
const chalk = require('chalk');
|
|
2
|
+
const { getConfig, saveConfig } = require('../utils/config');
|
|
3
|
+
|
|
4
|
+
const PROVIDER_LABELS = {
|
|
5
|
+
openai: 'OpenAI',
|
|
6
|
+
elevenlabs: 'ElevenLabs',
|
|
7
|
+
microsoft: 'Microsoft (Azure)',
|
|
8
|
+
deepgram: 'Deepgram',
|
|
9
|
+
google: 'Google Cloud'
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
function mask(str, keep = 6) {
|
|
13
|
+
if (!str) return '(unset)';
|
|
14
|
+
return str.length <= keep ? '***' : `${str.slice(0, keep)}…`;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
async function voice(args) {
|
|
18
|
+
const [action, ...params] = args || [];
|
|
19
|
+
|
|
20
|
+
if (!action || action === 'status') return statusVoice();
|
|
21
|
+
if (action === 'providers') return listProviders();
|
|
22
|
+
if (action === 'set') return setVoiceProvider(params);
|
|
23
|
+
|
|
24
|
+
console.log(chalk.red(`\n ❌ Unknown command: ${action}\n`));
|
|
25
|
+
console.log(chalk.gray(' Usage: natureco voice [status|providers|set]\n'));
|
|
26
|
+
process.exit(1);
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
function statusVoice() {
|
|
30
|
+
const config = getConfig();
|
|
31
|
+
const ttsConfig = config.tts || {};
|
|
32
|
+
const provider = ttsConfig.provider || 'openai';
|
|
33
|
+
const voiceId = ttsConfig.voiceId;
|
|
34
|
+
const apiKey = ttsConfig.apiKey || config[`${provider}ApiKey`] || process.env[`${provider.toUpperCase()}_API_KEY`];
|
|
35
|
+
|
|
36
|
+
console.log(chalk.cyan('\n 🎤 Voice Status\n'));
|
|
37
|
+
console.log(chalk.gray(' ' + '─'.repeat(48)));
|
|
38
|
+
console.log(` ${chalk.white('Provider:')} ${chalk.cyan(provider)}`);
|
|
39
|
+
console.log(` ${chalk.white('Voice ID:')} ${chalk.cyan(voiceId || '(default)')}`);
|
|
40
|
+
console.log(` ${chalk.white('API Key:')} ${chalk.gray(mask(apiKey))}`);
|
|
41
|
+
console.log(chalk.gray('\n Commands:'));
|
|
42
|
+
console.log(chalk.cyan(' natureco voice providers') + chalk.gray(' List available providers'));
|
|
43
|
+
console.log(chalk.cyan(' natureco voice set <provider> [voiceId]') + chalk.gray(' Set voice provider'));
|
|
44
|
+
console.log();
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
function listProviders() {
|
|
48
|
+
console.log(chalk.cyan('\n 🎤 Voice Providers\n'));
|
|
49
|
+
console.log(chalk.gray(' ' + '─'.repeat(48)));
|
|
50
|
+
|
|
51
|
+
for (const [id, label] of Object.entries(PROVIDER_LABELS)) {
|
|
52
|
+
console.log(` ${chalk.white(label)} ${chalk.gray(`(${id})`)}`);
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
console.log(chalk.gray('\n Set provider:'));
|
|
56
|
+
console.log(chalk.cyan(' natureco voice set openai'));
|
|
57
|
+
console.log(chalk.cyan(' natureco voice set elevenlabs [voiceId]'));
|
|
58
|
+
console.log();
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
function setVoiceProvider(args) {
|
|
62
|
+
const provider = args[0];
|
|
63
|
+
const voiceId = args.slice(1).join(' ') || '';
|
|
64
|
+
|
|
65
|
+
if (!provider || !PROVIDER_LABELS[provider]) {
|
|
66
|
+
console.log(chalk.red(`\n ❌ Unknown provider: ${provider}\n`));
|
|
67
|
+
console.log(chalk.gray(' Available: ' + Object.keys(PROVIDER_LABELS).join(', ')));
|
|
68
|
+
console.log();
|
|
69
|
+
process.exit(1);
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
const config = getConfig();
|
|
73
|
+
if (!config.tts) config.tts = {};
|
|
74
|
+
config.tts.provider = provider;
|
|
75
|
+
if (voiceId) config.tts.voiceId = voiceId;
|
|
76
|
+
else delete config.tts.voiceId;
|
|
77
|
+
saveConfig(config);
|
|
78
|
+
|
|
79
|
+
console.log(chalk.green(`\n ✅ Voice provider set to ${PROVIDER_LABELS[provider]}${voiceId ? ` (voice: ${voiceId})` : ''}\n`));
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
module.exports = voice;
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
const chalk = require('chalk');
|
|
2
|
+
const { getConfig, saveConfig } = require('../utils/config');
|
|
3
|
+
|
|
4
|
+
const VYDRA_ENDPOINTS = {
|
|
5
|
+
'vydra-image': {
|
|
6
|
+
name: 'Vydra Image Generation',
|
|
7
|
+
endpoint: 'https://api.vydra.ai/v1/images/generations',
|
|
8
|
+
docs: 'https://docs.vydra.ai/image-generation'
|
|
9
|
+
},
|
|
10
|
+
'vydra-video': {
|
|
11
|
+
name: 'Vydra Video Generation',
|
|
12
|
+
endpoint: 'https://api.vydra.ai/v1/video/generations',
|
|
13
|
+
docs: 'https://docs.vydra.ai/video-generation'
|
|
14
|
+
},
|
|
15
|
+
'vydra-music': {
|
|
16
|
+
name: 'Vydra Music Generation',
|
|
17
|
+
endpoint: 'https://api.vydra.ai/v1/music/generations',
|
|
18
|
+
docs: 'https://docs.vydra.ai/music-generation'
|
|
19
|
+
}
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
function vydra(args) {
|
|
23
|
+
const [action, ...params] = args || [];
|
|
24
|
+
|
|
25
|
+
if (!action || action === 'status') return statusVydra();
|
|
26
|
+
if (action === 'configure') return configureVydra(params[0], params[1]);
|
|
27
|
+
if (action === 'test') return testVydra();
|
|
28
|
+
|
|
29
|
+
console.log(chalk.red(`\n ❌ Bilinmeyen komut: ${action}\n`));
|
|
30
|
+
console.log(chalk.gray(' Kullanım: natureco vydra [status|configure|test]\n'));
|
|
31
|
+
process.exit(1);
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
function statusVydra() {
|
|
35
|
+
const config = getConfig();
|
|
36
|
+
const apiKey = config.vydraApiKey || process.env.VYDRA_API_KEY;
|
|
37
|
+
|
|
38
|
+
console.log(chalk.cyan('\n 🎬 Vydra Media Provider\n'));
|
|
39
|
+
console.log(chalk.gray(' ' + '─'.repeat(48)));
|
|
40
|
+
console.log(` ${chalk.white('API Key:')} ${apiKey ? chalk.green('Configured') : chalk.red('Not set')}`);
|
|
41
|
+
console.log(chalk.gray('\n Available endpoints:\n'));
|
|
42
|
+
|
|
43
|
+
for (const [id, ep] of Object.entries(VYDRA_ENDPOINTS)) {
|
|
44
|
+
const configured = apiKey ? chalk.green('✅') : chalk.gray('⏸️');
|
|
45
|
+
console.log(` ${configured} ${chalk.white(ep.name)}`);
|
|
46
|
+
console.log(` ${chalk.gray(ep.endpoint)}`);
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
console.log(chalk.gray('\n Commands:'));
|
|
50
|
+
console.log(chalk.cyan(' configure <key>') + chalk.gray(' Set Vydra API key'));
|
|
51
|
+
console.log(chalk.cyan(' test') + chalk.gray(' Test API connection'));
|
|
52
|
+
console.log();
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
function configureVydra(key) {
|
|
56
|
+
if (!key) {
|
|
57
|
+
console.log(chalk.red('\n ❌ API key gerekli\n'));
|
|
58
|
+
process.exit(1);
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
const config = getConfig();
|
|
62
|
+
config.vydraApiKey = key;
|
|
63
|
+
saveConfig(config);
|
|
64
|
+
console.log(chalk.green('\n ✅ Vydra API key saved\n'));
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
async function testVydra() {
|
|
68
|
+
const config = getConfig();
|
|
69
|
+
const apiKey = config.vydraApiKey || process.env.VYDRA_API_KEY;
|
|
70
|
+
|
|
71
|
+
if (!apiKey) {
|
|
72
|
+
console.log(chalk.red('\n ❌ Vydra API key gerekli\n'));
|
|
73
|
+
console.log(chalk.cyan(' natureco vydra configure <your-api-key>\n'));
|
|
74
|
+
process.exit(1);
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
console.log(chalk.cyan('\n Testing Vydra API connection...\n'));
|
|
78
|
+
|
|
79
|
+
for (const [id, ep] of Object.entries(VYDRA_ENDPOINTS)) {
|
|
80
|
+
try {
|
|
81
|
+
const response = await fetch(ep.endpoint, {
|
|
82
|
+
method: 'HEAD',
|
|
83
|
+
headers: { 'Authorization': `Bearer ${apiKey}` }
|
|
84
|
+
});
|
|
85
|
+
console.log(` ${response.ok ? chalk.green('✅') : chalk.red('❌')} ${chalk.white(ep.name)} ${chalk.gray(`(${response.status})`)}`);
|
|
86
|
+
} catch (err) {
|
|
87
|
+
console.log(` ${chalk.red('❌')} ${chalk.white(ep.name)} ${chalk.gray(`(${err.message})`)}`);
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
console.log(chalk.gray('\n Vydra API endpoints are available as providers for:'));
|
|
92
|
+
console.log(chalk.cyan(' image_generation') + chalk.gray(' tool (provider: vydra)'));
|
|
93
|
+
console.log(chalk.cyan(' video_generation') + chalk.gray(' tool (provider: vydra)'));
|
|
94
|
+
console.log(chalk.cyan(' music_generation') + chalk.gray(' tool (provider: vydra)'));
|
|
95
|
+
console.log();
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
module.exports = vydra;
|
package/src/commands/webhooks.js
CHANGED
|
@@ -1,79 +1,71 @@
|
|
|
1
1
|
const chalk = require('chalk');
|
|
2
|
-
const
|
|
3
|
-
const
|
|
2
|
+
const fs = require('fs');
|
|
3
|
+
const path = require('path');
|
|
4
|
+
const os = require('os');
|
|
4
5
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
if (
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
console.log(chalk.gray('Available actions: connect, disconnect, status, list\n'));
|
|
12
|
-
process.exit(1);
|
|
6
|
+
const WEBHOOKS_FILE = path.join(os.homedir(), '.natureco', 'webhooks.json');
|
|
7
|
+
|
|
8
|
+
function loadWebhooks() {
|
|
9
|
+
if (!fs.existsSync(WEBHOOKS_FILE)) return [];
|
|
10
|
+
try { return JSON.parse(fs.readFileSync(WEBHOOKS_FILE, 'utf8')); }
|
|
11
|
+
catch { return []; }
|
|
13
12
|
}
|
|
14
13
|
|
|
15
|
-
|
|
16
|
-
const
|
|
17
|
-
if (!
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
};
|
|
33
|
-
webhooks.push(entry);
|
|
34
|
-
config.webhooks = webhooks;
|
|
35
|
-
config.webhookEnabled = true;
|
|
36
|
-
saveConfig(config);
|
|
37
|
-
console.log(chalk.green('\n✅ Webhook eklendi!\n'));
|
|
38
|
-
console.log(chalk.cyan('ID:'), chalk.white(entry.id));
|
|
39
|
-
console.log(chalk.cyan('İsim:'), chalk.white(entry.name));
|
|
40
|
-
console.log(chalk.cyan('Yol:'), chalk.white(entry.path));
|
|
41
|
-
console.log(chalk.gray('\nGateway ile başlatmak için: natureco gateway start\n'));
|
|
14
|
+
function saveWebhooks(webhooks) {
|
|
15
|
+
const dir = path.dirname(WEBHOOKS_FILE);
|
|
16
|
+
if (!fs.existsSync(dir)) fs.mkdirSync(dir, { recursive: true });
|
|
17
|
+
fs.writeFileSync(WEBHOOKS_FILE, JSON.stringify(webhooks, null, 2), 'utf8');
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
function webhooks(args) {
|
|
21
|
+
const [action, subAction, ...params] = args || [];
|
|
22
|
+
|
|
23
|
+
if (!action || action === 'list') return cmdList();
|
|
24
|
+
if (action === 'gmail' && subAction === 'setup') return cmdGmailSetup();
|
|
25
|
+
if (action === 'gmail' && subAction === 'run') return cmdGmailRun();
|
|
26
|
+
|
|
27
|
+
console.log(chalk.red(`\n Unknown webhooks action: ${action} ${subAction || ''}\n`));
|
|
28
|
+
console.log(chalk.gray(' Usage: natureco webhooks <action> [params]'));
|
|
29
|
+
console.log(chalk.gray(' Actions: list, gmail setup, gmail run\n'));
|
|
30
|
+
process.exit(1);
|
|
42
31
|
}
|
|
43
32
|
|
|
44
|
-
|
|
45
|
-
const
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
33
|
+
function cmdList() {
|
|
34
|
+
const webhooks = loadWebhooks();
|
|
35
|
+
|
|
36
|
+
console.log(chalk.cyan(`\n Webhooks (${webhooks.length})\n`));
|
|
37
|
+
console.log(chalk.gray(' ' + '─'.repeat(48)));
|
|
38
|
+
|
|
39
|
+
if (webhooks.length === 0) {
|
|
40
|
+
console.log(chalk.gray(' No webhooks configured.\n'));
|
|
41
|
+
return;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
for (const w of webhooks) {
|
|
45
|
+
console.log(` ${chalk.white(w.name || w.id || 'unnamed')}`);
|
|
46
|
+
if (w.url) console.log(chalk.gray(` URL: ${w.url}`));
|
|
47
|
+
if (w.path) console.log(chalk.gray(` Path: ${w.path}`));
|
|
48
|
+
if (w.type) console.log(chalk.gray(` Type: ${w.type}`));
|
|
49
|
+
}
|
|
50
|
+
console.log('');
|
|
54
51
|
}
|
|
55
52
|
|
|
56
|
-
function
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
console.log(
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
});
|
|
53
|
+
function cmdGmailSetup() {
|
|
54
|
+
console.log(chalk.cyan('\n Gmail Pub/Sub Webhook Setup\n'));
|
|
55
|
+
console.log(chalk.gray(' ' + '─'.repeat(48)));
|
|
56
|
+
console.log(` ${chalk.white('Status:')} ${chalk.yellow('Not configured')}`);
|
|
57
|
+
console.log('');
|
|
58
|
+
console.log(chalk.gray(' To set up Gmail webhooks:'));
|
|
59
|
+
console.log(chalk.gray(' 1. Enable Gmail API in Google Cloud Console'));
|
|
60
|
+
console.log(chalk.gray(' 2. Create a Pub/Sub topic'));
|
|
61
|
+
console.log(chalk.gray(' 3. Configure the push endpoint'));
|
|
62
|
+
console.log(chalk.gray(' 4. Run: natureco webhooks gmail run'));
|
|
63
|
+
console.log('');
|
|
68
64
|
}
|
|
69
65
|
|
|
70
|
-
function
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
if (webhooks.length === 0) { console.log(chalk.gray('\n⚠️ No webhooks configured\n')); console.log(chalk.gray('Add with: natureco webhooks connect\n')); return; }
|
|
74
|
-
console.log(chalk.green(`\n✅ Webhooks active (${webhooks.length} route(s))\n`));
|
|
75
|
-
webhooks.forEach(w => console.log(chalk.white(` ${w.path} → ${w.name}`)));
|
|
76
|
-
console.log(chalk.gray('\nDisconnect with: natureco webhooks disconnect\n'));
|
|
66
|
+
function cmdGmailRun() {
|
|
67
|
+
console.log(chalk.cyan('\n Triggering Gmail Webhook\n'));
|
|
68
|
+
console.log(chalk.gray(' (Stub — Gmail webhook execution not implemented)\n'));
|
|
77
69
|
}
|
|
78
70
|
|
|
79
71
|
module.exports = webhooks;
|