natureco-cli 2.1.1 → 2.2.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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "natureco-cli",
3
- "version": "2.1.1",
3
+ "version": "2.2.1",
4
4
  "description": "NatureCo AI Bot Terminal Interface",
5
5
  "main": "bin/natureco.js",
6
6
  "bin": {
@@ -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.1</div>
214
+ <div class="version-badge" id="version-badge">v2.2.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.1',
344
+ version: 'v2.2.0',
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(?=\s|\/|$)/g, os.homedir());
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',
@@ -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
- if (dirPath === '/home' || dirPath === 'home') {
32
- dirPath = os.homedir();
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,4 +1,4 @@
1
- // NatureCo CLI v2.1.0 - Universal LLM Provider Support
1
+ // NatureCo CLI v2.2.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 { getConfig } = require('./config');
@@ -7,6 +7,23 @@ const { getToolDefinitions, executeToolCalls } = require('./tool-runner');
7
7
  // Conversation history for multi-turn chat
8
8
  const conversationHistory = new Map();
9
9
 
10
+ /**
11
+ * Check if debug mode is enabled
12
+ */
13
+ function isDebugEnabled() {
14
+ const config = getConfig();
15
+ return config.debug === true || config.debug === 'true';
16
+ }
17
+
18
+ /**
19
+ * Debug log (only if debug mode enabled)
20
+ */
21
+ function debugLog(...args) {
22
+ if (isDebugEnabled()) {
23
+ console.log(...args);
24
+ }
25
+ }
26
+
10
27
  /**
11
28
  * Get provider configuration from config
12
29
  */
@@ -184,12 +201,12 @@ async function sendMessageToProvider(apiKey, message, conversationId = null, sys
184
201
  ? formatToolsForAnthropic()
185
202
  : formatToolsForOpenAI();
186
203
 
187
- console.log('\n[Provider] Sending request...');
188
- console.log('[Provider] URL:', providerConfig.url);
189
- console.log('[Provider] Model:', providerConfig.model);
190
- console.log('[Provider] Type:', providerConfig.isAnthropic ? 'Anthropic' : 'OpenAI-compatible');
191
- console.log('[Provider] Messages:', messages.length);
192
- console.log('[Provider] Tools:', tools.length);
204
+ debugLog('\n[Provider] Sending request...');
205
+ debugLog('[Provider] URL:', providerConfig.url);
206
+ debugLog('[Provider] Model:', providerConfig.model);
207
+ debugLog('[Provider] Type:', providerConfig.isAnthropic ? 'Anthropic' : 'OpenAI-compatible');
208
+ debugLog('[Provider] Messages:', messages.length);
209
+ debugLog('[Provider] Tools:', tools.length);
193
210
 
194
211
  // Tool execution loop (max 10 iterations)
195
212
  let iteration = 0;
@@ -198,21 +215,21 @@ async function sendMessageToProvider(apiKey, message, conversationId = null, sys
198
215
 
199
216
  while (iteration < maxIterations) {
200
217
  iteration++;
201
- console.log(`\n[Provider] Iteration ${iteration}/${maxIterations}`);
218
+ debugLog(`\n[Provider] Iteration ${iteration}/${maxIterations}`);
202
219
 
203
220
  // Call provider API
204
221
  const assistantMessage = providerConfig.isAnthropic
205
222
  ? await sendMessageAnthropic(providerConfig, messages, tools)
206
223
  : await sendMessageOpenAICompatible(providerConfig, messages, tools);
207
224
 
208
- console.log('[Provider] Response type:', assistantMessage.tool_calls ? 'tool_calls' : 'text');
225
+ debugLog('[Provider] Response type:', assistantMessage.tool_calls ? 'tool_calls' : 'text');
209
226
 
210
227
  // Add assistant message to history
211
228
  messages.push(assistantMessage);
212
229
 
213
230
  // Check for tool calls
214
231
  if (assistantMessage.tool_calls && assistantMessage.tool_calls.length > 0) {
215
- console.log(`[Provider] Tool calls: ${assistantMessage.tool_calls.length}`);
232
+ debugLog(`[Provider] Tool calls: ${assistantMessage.tool_calls.length}`);
216
233
 
217
234
  // Execute tools locally
218
235
  const toolCalls = assistantMessage.tool_calls.map(tc => ({
@@ -245,7 +262,7 @@ async function sendMessageToProvider(apiKey, message, conversationId = null, sys
245
262
  }
246
263
 
247
264
  if (iteration >= maxIterations) {
248
- console.log('\n[Provider] Max iterations reached');
265
+ debugLog('\n[Provider] Max iterations reached');
249
266
  finalResponse = finalResponse || 'Max tool execution iterations reached.';
250
267
  }
251
268