natureco-cli 2.13.12 → 2.13.14
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/utils/api.js +37 -13
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.13.
|
|
214
|
+
<div class="version-badge" id="version-badge">v2.13.14</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.13.
|
|
344
|
+
version: 'v2.13.14',
|
|
345
345
|
bots: cfg.bots || [],
|
|
346
346
|
telegramToken: cfg.telegramToken || null,
|
|
347
347
|
whatsappConnected: cfg.whatsappConnected || false,
|
package/src/utils/api.js
CHANGED
|
@@ -720,8 +720,8 @@ async function sendMessage(apiKey, botId, message, conversationId = null, skillP
|
|
|
720
720
|
// Get user's home directory
|
|
721
721
|
const homeDir = os.homedir();
|
|
722
722
|
|
|
723
|
-
//
|
|
724
|
-
|
|
723
|
+
// Base system prompt for terminal assistant with dynamic home directory
|
|
724
|
+
const baseSystemPrompt = `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.
|
|
725
725
|
|
|
726
726
|
IMPORTANT: The user's home directory is: ${homeDir}
|
|
727
727
|
When listing home directory, always use list_dir with path: "${homeDir}"
|
|
@@ -750,23 +750,29 @@ TOOL SELECTION GUIDE:
|
|
|
750
750
|
- web_search: Use when users ask about current information, news, weather, or anything requiring internet search
|
|
751
751
|
- http_request: Use for API calls, webhooks, fetching URLs, testing endpoints`;
|
|
752
752
|
|
|
753
|
+
let systemPrompt = baseSystemPrompt;
|
|
754
|
+
|
|
753
755
|
// Add MCP tool guidance if MCP servers are loaded
|
|
756
|
+
let mcpPrompt = '';
|
|
754
757
|
const mcpTools = getMcpTools();
|
|
755
758
|
if (mcpTools.length > 0) {
|
|
756
759
|
const mcpServerNames = Object.keys(mcpClients);
|
|
757
760
|
|
|
758
|
-
|
|
761
|
+
mcpPrompt = `\n\nMCP SERVERS (${mcpServerNames.length}):`;
|
|
759
762
|
|
|
760
763
|
for (const serverName of mcpServerNames) {
|
|
761
764
|
const serverTools = mcpClients[serverName].tools;
|
|
762
|
-
|
|
765
|
+
mcpPrompt += `\n- ${serverName}: ${serverTools.length} tools`;
|
|
763
766
|
}
|
|
764
767
|
|
|
765
|
-
|
|
766
|
-
|
|
768
|
+
mcpPrompt += `\n\nWhen filesystem MCP is loaded, use list_directory (not list_dir), read_file from MCP (not local).`;
|
|
769
|
+
mcpPrompt += `\nFor GitHub MCP, prefer list_issues over search_issues.`;
|
|
770
|
+
|
|
771
|
+
systemPrompt += mcpPrompt;
|
|
767
772
|
}
|
|
768
773
|
|
|
769
774
|
// Add available skills information
|
|
775
|
+
let skillsPrompt = '';
|
|
770
776
|
const skillsDir = path.join(homeDir, '.natureco', 'skills');
|
|
771
777
|
if (fs.existsSync(skillsDir)) {
|
|
772
778
|
try {
|
|
@@ -776,20 +782,38 @@ TOOL SELECTION GUIDE:
|
|
|
776
782
|
});
|
|
777
783
|
|
|
778
784
|
if (skills.length > 0) {
|
|
779
|
-
|
|
785
|
+
// Extract skill names and short descriptions (not full SKILL.md content)
|
|
786
|
+
const skillsInfo = skills.map(skill => {
|
|
787
|
+
const skillMd = path.join(skillsDir, skill, 'SKILL.md');
|
|
788
|
+
if (!fs.existsSync(skillMd)) return skill;
|
|
789
|
+
|
|
790
|
+
try {
|
|
791
|
+
const content = fs.readFileSync(skillMd, 'utf8');
|
|
792
|
+
// Extract description from SKILL.md (first 80 chars)
|
|
793
|
+
const descMatch = content.match(/description:\s*(.+)/i);
|
|
794
|
+
const desc = descMatch ? descMatch[1].slice(0, 80) : '';
|
|
795
|
+
return desc ? `${skill}: ${desc}` : skill;
|
|
796
|
+
} catch (err) {
|
|
797
|
+
return skill;
|
|
798
|
+
}
|
|
799
|
+
}).slice(0, 10).join('\n'); // Show max 10 skills
|
|
780
800
|
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
systemPrompt += `\nInstalled skills: ${skills.join(', ')}`;
|
|
786
|
-
}
|
|
801
|
+
const moreSkills = skills.length > 10 ? ` (${skills.length - 10} more)` : '';
|
|
802
|
+
skillsPrompt = `\n\nInstalled skills (${skills.length})${moreSkills}:\n${skillsInfo}\nUse /skills for details.`;
|
|
803
|
+
|
|
804
|
+
systemPrompt += skillsPrompt;
|
|
787
805
|
}
|
|
788
806
|
} catch (err) {
|
|
789
807
|
// Silently skip if skills directory can't be read
|
|
790
808
|
}
|
|
791
809
|
}
|
|
792
810
|
|
|
811
|
+
// Log system prompt components
|
|
812
|
+
console.log('[API] Base system prompt:', baseSystemPrompt.length, 'chars');
|
|
813
|
+
console.log('[API] MCP prompt:', mcpPrompt.length, 'chars');
|
|
814
|
+
console.log('[API] Skills prompt:', skillsPrompt.length, 'chars');
|
|
815
|
+
console.log('[API] Total system prompt:', systemPrompt.length, 'chars, ~', Math.round(systemPrompt.length / 4), 'tokens');
|
|
816
|
+
|
|
793
817
|
return sendMessageToProvider(apiKey, message, conversationId, systemPrompt);
|
|
794
818
|
}
|
|
795
819
|
|