natureco-cli 2.6.2 → 2.7.0
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 +1 -1
- package/src/commands/dashboard.js +2 -2
- package/src/commands/gateway-server.js +1 -1
- package/src/tools/http.js +37 -15
- package/src/utils/api.js +4 -3
package/package.json
CHANGED
|
@@ -211,7 +211,7 @@ body::before{
|
|
|
211
211
|
<div class="header-bot-name" id="header-bot-name">Nature Bot</div>
|
|
212
212
|
<div class="header-bot-model" id="header-bot-model">NatureCo</div>
|
|
213
213
|
</div>
|
|
214
|
-
<div class="version-badge" id="version-badge">v2.
|
|
214
|
+
<div class="version-badge" id="version-badge">v2.7.0</div>
|
|
215
215
|
</div>
|
|
216
216
|
<div class="messages" id="messages"></div>
|
|
217
217
|
<div class="input-area">
|
|
@@ -341,7 +341,7 @@ function dashboard(action) {
|
|
|
341
341
|
apiKey: cfg.apiKey,
|
|
342
342
|
defaultBot: cfg.defaultBot,
|
|
343
343
|
defaultBotId: cfg.defaultBotId,
|
|
344
|
-
version: 'v2.
|
|
344
|
+
version: 'v2.7.0',
|
|
345
345
|
bots: cfg.bots || [],
|
|
346
346
|
telegramToken: cfg.telegramToken || null,
|
|
347
347
|
whatsappConnected: cfg.whatsappConnected || false,
|
|
@@ -128,7 +128,7 @@ async function startGateway() {
|
|
|
128
128
|
|
|
129
129
|
async function runGatewayWorker() {
|
|
130
130
|
// This runs in the background
|
|
131
|
-
log('gateway', 'Starting NatureCo Gateway v2.
|
|
131
|
+
log('gateway', 'Starting NatureCo Gateway v2.7.0...', 'green');
|
|
132
132
|
|
|
133
133
|
// Load config
|
|
134
134
|
const { getConfig } = require('../utils/config');
|
package/src/tools/http.js
CHANGED
|
@@ -1,25 +1,26 @@
|
|
|
1
1
|
module.exports = {
|
|
2
|
-
name: '
|
|
3
|
-
description: 'Make HTTP requests',
|
|
2
|
+
name: 'http_request',
|
|
3
|
+
description: 'Make HTTP requests to any URL (GET, POST, PUT, DELETE, PATCH)',
|
|
4
4
|
inputSchema: {
|
|
5
5
|
type: 'object',
|
|
6
6
|
properties: {
|
|
7
|
-
url: {
|
|
8
|
-
type: 'string',
|
|
9
|
-
description: 'URL to request'
|
|
10
|
-
},
|
|
11
7
|
method: {
|
|
12
8
|
type: 'string',
|
|
13
|
-
description: 'HTTP method
|
|
9
|
+
description: 'HTTP method: GET, POST, PUT, DELETE, PATCH',
|
|
10
|
+
enum: ['GET', 'POST', 'PUT', 'DELETE', 'PATCH'],
|
|
14
11
|
default: 'GET'
|
|
15
12
|
},
|
|
13
|
+
url: {
|
|
14
|
+
type: 'string',
|
|
15
|
+
description: 'Full URL to request'
|
|
16
|
+
},
|
|
16
17
|
headers: {
|
|
17
18
|
type: 'object',
|
|
18
|
-
description: '
|
|
19
|
+
description: 'Optional headers (key-value pairs)'
|
|
19
20
|
},
|
|
20
21
|
body: {
|
|
21
|
-
type: '
|
|
22
|
-
description: '
|
|
22
|
+
type: 'object',
|
|
23
|
+
description: 'Optional request body (for POST/PUT/PATCH)'
|
|
23
24
|
}
|
|
24
25
|
},
|
|
25
26
|
required: ['url']
|
|
@@ -27,24 +28,45 @@ module.exports = {
|
|
|
27
28
|
|
|
28
29
|
async execute(params) {
|
|
29
30
|
try {
|
|
31
|
+
const method = (params.method || 'GET').toUpperCase();
|
|
32
|
+
|
|
30
33
|
const options = {
|
|
31
|
-
method
|
|
32
|
-
headers:
|
|
34
|
+
method,
|
|
35
|
+
headers: {
|
|
36
|
+
'Content-Type': 'application/json',
|
|
37
|
+
'User-Agent': 'NatureCo-CLI/2.7.0',
|
|
38
|
+
...(params.headers || {})
|
|
39
|
+
}
|
|
33
40
|
};
|
|
34
41
|
|
|
35
|
-
|
|
36
|
-
|
|
42
|
+
// Add body for POST/PUT/PATCH
|
|
43
|
+
if (params.body && ['POST', 'PUT', 'PATCH'].includes(method)) {
|
|
44
|
+
options.body = JSON.stringify(params.body);
|
|
37
45
|
}
|
|
38
46
|
|
|
39
47
|
const response = await fetch(params.url, options);
|
|
40
48
|
const text = await response.text();
|
|
41
49
|
|
|
50
|
+
// Try to parse as JSON
|
|
51
|
+
let data;
|
|
52
|
+
try {
|
|
53
|
+
data = JSON.parse(text);
|
|
54
|
+
} catch {
|
|
55
|
+
data = text;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
// Truncate large responses
|
|
59
|
+
if (typeof data === 'string' && data.length > 2000) {
|
|
60
|
+
data = data.slice(0, 2000) + '... (truncated)';
|
|
61
|
+
}
|
|
62
|
+
|
|
42
63
|
return {
|
|
43
64
|
success: true,
|
|
44
65
|
status: response.status,
|
|
66
|
+
ok: response.ok,
|
|
45
67
|
statusText: response.statusText,
|
|
46
68
|
headers: Object.fromEntries(response.headers.entries()),
|
|
47
|
-
|
|
69
|
+
data: data
|
|
48
70
|
};
|
|
49
71
|
} catch (error) {
|
|
50
72
|
return {
|
package/src/utils/api.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// NatureCo CLI v2.
|
|
1
|
+
// NatureCo CLI v2.7.0 - Universal LLM Provider Support
|
|
2
2
|
// Supports: OpenAI, Groq, Together, Fireworks, Perplexity, Mistral, DeepSeek, OpenRouter, Ollama, LM Studio, Anthropic
|
|
3
3
|
|
|
4
4
|
const fs = require('fs');
|
|
@@ -384,7 +384,7 @@ async function sendMessage(apiKey, botId, message, conversationId = null, skillP
|
|
|
384
384
|
const homeDir = os.homedir();
|
|
385
385
|
|
|
386
386
|
// System prompt for terminal assistant with dynamic home directory
|
|
387
|
-
const systemPrompt = `You are a terminal assistant. When users ask for file listing, command execution, or directory viewing, you MUST use the available tools (bash, read_file, write_file, list_dir, web_search). Never say 'run this command' - execute it yourself using tools and show the result.
|
|
387
|
+
const systemPrompt = `You are a terminal assistant. When users ask for file listing, command execution, or directory viewing, you MUST use the available tools (bash, read_file, write_file, list_dir, web_search, http_request). Never say 'run this command' - execute it yourself using tools and show the result.
|
|
388
388
|
|
|
389
389
|
IMPORTANT: The user's home directory is: ${homeDir}
|
|
390
390
|
When listing home directory, always use list_dir with path: "${homeDir}"
|
|
@@ -404,7 +404,8 @@ TOOL SELECTION GUIDE:
|
|
|
404
404
|
- bash with "cat file | head -100": Use for .sh, .py, .js, .ts, .env, config files, or any file with special characters
|
|
405
405
|
- list_dir: Use for directory listings
|
|
406
406
|
- bash: Use for all system commands, process info, disk usage, etc.
|
|
407
|
-
- web_search: Use when users ask about current information, news, weather, or anything requiring internet search
|
|
407
|
+
- web_search: Use when users ask about current information, news, weather, or anything requiring internet search
|
|
408
|
+
- http_request: Use for API calls, webhooks, fetching URLs, testing endpoints`;
|
|
408
409
|
|
|
409
410
|
return sendMessageToProvider(apiKey, message, conversationId, systemPrompt);
|
|
410
411
|
}
|