natureco-cli 2.1.0 → 2.1.1
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/tools/bash.js +6 -1
- package/src/tools/list_dir.js +6 -0
- package/src/utils/api.js +1 -1
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.1.
|
|
214
|
+
<div class="version-badge" id="version-badge">v2.1.1</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.1.
|
|
344
|
+
version: 'v2.1.1',
|
|
345
345
|
bots: cfg.bots || [],
|
|
346
346
|
telegramToken: cfg.telegramToken || null,
|
|
347
347
|
whatsappConnected: cfg.whatsappConnected || false,
|
package/src/tools/bash.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
const { execSync } = require('child_process');
|
|
2
|
+
const os = require('os');
|
|
2
3
|
|
|
3
4
|
module.exports = {
|
|
4
5
|
name: 'bash',
|
|
@@ -16,7 +17,11 @@ module.exports = {
|
|
|
16
17
|
|
|
17
18
|
async execute(params) {
|
|
18
19
|
try {
|
|
19
|
-
|
|
20
|
+
// Replace /home with actual home directory
|
|
21
|
+
let command = params.command;
|
|
22
|
+
command = command.replace(/\/home(?=\s|\/|$)/g, os.homedir());
|
|
23
|
+
|
|
24
|
+
const output = execSync(command, {
|
|
20
25
|
encoding: 'utf-8',
|
|
21
26
|
maxBuffer: 10 * 1024 * 1024, // 10MB
|
|
22
27
|
timeout: 30000, // 30 seconds
|
package/src/tools/list_dir.js
CHANGED
|
@@ -26,6 +26,12 @@ module.exports = {
|
|
|
26
26
|
// Expand ~ to home directory
|
|
27
27
|
let dirPath = params.path || '.';
|
|
28
28
|
dirPath = dirPath.replace(/^~/, os.homedir());
|
|
29
|
+
|
|
30
|
+
// Fix /home path - replace with actual home directory
|
|
31
|
+
if (dirPath === '/home' || dirPath === 'home') {
|
|
32
|
+
dirPath = os.homedir();
|
|
33
|
+
}
|
|
34
|
+
|
|
29
35
|
const absolutePath = path.resolve(dirPath);
|
|
30
36
|
|
|
31
37
|
// Check if directory exists
|
package/src/utils/api.js
CHANGED
|
@@ -282,7 +282,7 @@ function clearConversation(conversationId) {
|
|
|
282
282
|
*/
|
|
283
283
|
async function sendMessage(apiKey, botId, message, conversationId = null, skillPrompts = '') {
|
|
284
284
|
// System prompt for terminal assistant
|
|
285
|
-
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). Never say 'run this command' - execute it yourself using tools and show the result.";
|
|
285
|
+
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). Never say 'run this command' - execute it yourself using tools and show the result.\n\nIMPORTANT: For the user's home directory, always use the actual home path (e.g., /Users/username on Mac, /home/username on Linux), NOT /home. The tools automatically handle this conversion.";
|
|
286
286
|
|
|
287
287
|
return sendMessageToProvider(apiKey, message, conversationId, systemPrompt);
|
|
288
288
|
}
|