natureco-cli 2.2.0 → 2.2.2
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 +4 -1
- package/src/tools/list_dir.js +3 -2
- package/src/utils/api.js +16 -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.2.
|
|
214
|
+
<div class="version-badge" id="version-badge">v2.2.2</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.2.
|
|
344
|
+
version: 'v2.2.2',
|
|
345
345
|
bots: cfg.bots || [],
|
|
346
346
|
telegramToken: cfg.telegramToken || null,
|
|
347
347
|
whatsappConnected: cfg.whatsappConnected || false,
|
package/src/tools/bash.js
CHANGED
|
@@ -18,8 +18,11 @@ module.exports = {
|
|
|
18
18
|
async execute(params) {
|
|
19
19
|
try {
|
|
20
20
|
// Replace /home with actual home directory
|
|
21
|
+
// Handles: /home, /home/Documents, /home/anything
|
|
21
22
|
let command = params.command;
|
|
22
|
-
command = command.replace(/\/home(
|
|
23
|
+
command = command.replace(/\/home(\/[^\s]*)?/g, (match, subpath) => {
|
|
24
|
+
return os.homedir() + (subpath || '');
|
|
25
|
+
});
|
|
23
26
|
|
|
24
27
|
const output = execSync(command, {
|
|
25
28
|
encoding: 'utf-8',
|
package/src/tools/list_dir.js
CHANGED
|
@@ -28,8 +28,9 @@ module.exports = {
|
|
|
28
28
|
dirPath = dirPath.replace(/^~/, os.homedir());
|
|
29
29
|
|
|
30
30
|
// Fix /home path - replace with actual home directory
|
|
31
|
-
|
|
32
|
-
|
|
31
|
+
// Handles: /home, home, /home/Documents, /home/anything
|
|
32
|
+
if (dirPath === '/home' || dirPath === 'home' || dirPath.startsWith('/home/')) {
|
|
33
|
+
dirPath = dirPath.replace(/^\/home/, os.homedir());
|
|
33
34
|
}
|
|
34
35
|
|
|
35
36
|
const absolutePath = path.resolve(dirPath);
|
package/src/utils/api.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
// NatureCo CLI v2.2.
|
|
1
|
+
// NatureCo CLI v2.2.2 - Universal LLM Provider Support
|
|
2
2
|
// Supports: OpenAI, Groq, Together, Fireworks, Perplexity, Mistral, DeepSeek, OpenRouter, Ollama, LM Studio, Anthropic
|
|
3
3
|
|
|
4
|
+
const os = require('os');
|
|
4
5
|
const { getConfig } = require('./config');
|
|
5
6
|
const { getToolDefinitions, executeToolCalls } = require('./tool-runner');
|
|
6
7
|
|
|
@@ -298,8 +299,20 @@ function clearConversation(conversationId) {
|
|
|
298
299
|
* Legacy function for compatibility
|
|
299
300
|
*/
|
|
300
301
|
async function sendMessage(apiKey, botId, message, conversationId = null, skillPrompts = '') {
|
|
301
|
-
//
|
|
302
|
-
const
|
|
302
|
+
// Get user's home directory
|
|
303
|
+
const homeDir = os.homedir();
|
|
304
|
+
|
|
305
|
+
// System prompt for terminal assistant with dynamic home directory
|
|
306
|
+
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.
|
|
307
|
+
|
|
308
|
+
IMPORTANT: The user's home directory is: ${homeDir}
|
|
309
|
+
When listing home directory, always use list_dir with path: "${homeDir}"
|
|
310
|
+
Never use /home/username or /home/john - use the exact path above.
|
|
311
|
+
|
|
312
|
+
The tools automatically handle path conversions:
|
|
313
|
+
- ~ expands to ${homeDir}
|
|
314
|
+
- /home expands to ${homeDir}
|
|
315
|
+
- /home/Documents expands to ${homeDir}/Documents`;
|
|
303
316
|
|
|
304
317
|
return sendMessageToProvider(apiKey, message, conversationId, systemPrompt);
|
|
305
318
|
}
|