natureco-cli 2.10.2 → 2.10.5
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
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.10.
|
|
214
|
+
<div class="version-badge" id="version-badge">v2.10.5</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.10.
|
|
344
|
+
version: 'v2.10.5',
|
|
345
345
|
bots: cfg.bots || [],
|
|
346
346
|
telegramToken: cfg.telegramToken || null,
|
|
347
347
|
whatsappConnected: cfg.whatsappConnected || false,
|
|
@@ -138,7 +138,7 @@ async function startGateway() {
|
|
|
138
138
|
|
|
139
139
|
async function runGatewayWorker() {
|
|
140
140
|
// This runs in the background
|
|
141
|
-
log('gateway', 'Starting NatureCo Gateway v2.10.
|
|
141
|
+
log('gateway', 'Starting NatureCo Gateway v2.10.5...', 'green');
|
|
142
142
|
|
|
143
143
|
// Load config
|
|
144
144
|
const { getConfig } = require('../utils/config');
|
package/src/utils/api.js
CHANGED
|
@@ -152,16 +152,20 @@ async function executeMcpTool(toolName, toolArgs) {
|
|
|
152
152
|
|
|
153
153
|
// MCP returns { content: [{ type: 'text', text: '...' }] }
|
|
154
154
|
if (result.content && result.content.length > 0) {
|
|
155
|
-
|
|
156
|
-
|
|
155
|
+
// Extract all text content and join with newlines
|
|
156
|
+
const textContents = result.content
|
|
157
|
+
.filter(c => c.type === 'text')
|
|
158
|
+
.map(c => c.text);
|
|
159
|
+
|
|
160
|
+
if (textContents.length > 0) {
|
|
157
161
|
return {
|
|
158
162
|
success: true,
|
|
159
|
-
output:
|
|
163
|
+
output: textContents.join('\n')
|
|
160
164
|
};
|
|
161
165
|
}
|
|
162
166
|
}
|
|
163
167
|
|
|
164
|
-
// Fallback: return entire result
|
|
168
|
+
// Fallback: return entire result as JSON
|
|
165
169
|
return {
|
|
166
170
|
success: true,
|
|
167
171
|
output: JSON.stringify(result, null, 2)
|
|
@@ -549,7 +553,7 @@ async function sendMessage(apiKey, botId, message, conversationId = null, skillP
|
|
|
549
553
|
const homeDir = os.homedir();
|
|
550
554
|
|
|
551
555
|
// System prompt for terminal assistant with dynamic home directory
|
|
552
|
-
|
|
556
|
+
let 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.
|
|
553
557
|
|
|
554
558
|
IMPORTANT: The user's home directory is: ${homeDir}
|
|
555
559
|
When listing home directory, always use list_dir with path: "${homeDir}"
|
|
@@ -571,6 +575,23 @@ TOOL SELECTION GUIDE:
|
|
|
571
575
|
- bash: Use for all system commands, process info, disk usage, etc.
|
|
572
576
|
- web_search: Use when users ask about current information, news, weather, or anything requiring internet search
|
|
573
577
|
- http_request: Use for API calls, webhooks, fetching URLs, testing endpoints`;
|
|
578
|
+
|
|
579
|
+
// Add MCP tool guidance if MCP servers are loaded
|
|
580
|
+
const mcpTools = getMcpTools();
|
|
581
|
+
if (mcpTools.length > 0) {
|
|
582
|
+
const mcpServerNames = Object.keys(mcpClients);
|
|
583
|
+
|
|
584
|
+
systemPrompt += `\n\nAVAILABLE MCP SERVERS AND TOOLS:`;
|
|
585
|
+
|
|
586
|
+
for (const serverName of mcpServerNames) {
|
|
587
|
+
const serverTools = mcpClients[serverName].tools;
|
|
588
|
+
const toolNames = serverTools.map(t => t.name).join(', ');
|
|
589
|
+
systemPrompt += `\n- ${serverName} server: ${toolNames}`;
|
|
590
|
+
}
|
|
591
|
+
|
|
592
|
+
systemPrompt += `\n\nWhen MCP servers are loaded, ALWAYS prefer MCP tools over local tools for file operations.`;
|
|
593
|
+
systemPrompt += `\nFor example: use read_file from filesystem MCP (NOT local read_file), use list_directory from filesystem MCP (NOT local list_dir).`;
|
|
594
|
+
}
|
|
574
595
|
|
|
575
596
|
return sendMessageToProvider(apiKey, message, conversationId, systemPrompt);
|
|
576
597
|
}
|