natureco-cli 2.13.6 → 2.13.8

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.13.6",
3
+ "version": "2.13.8",
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.13.6</div>
214
+ <div class="version-badge" id="version-badge">v2.13.8</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.6',
344
+ version: 'v2.13.8',
345
345
  bots: cfg.bots || [],
346
346
  telegramToken: cfg.telegramToken || null,
347
347
  whatsappConnected: cfg.whatsappConnected || false,
package/src/utils/api.js CHANGED
@@ -722,18 +722,15 @@ TOOL SELECTION GUIDE:
722
722
  if (mcpTools.length > 0) {
723
723
  const mcpServerNames = Object.keys(mcpClients);
724
724
 
725
- systemPrompt += `\n\nAVAILABLE MCP SERVERS AND TOOLS:`;
725
+ systemPrompt += `\n\nMCP SERVERS (${mcpServerNames.length}):`;
726
726
 
727
727
  for (const serverName of mcpServerNames) {
728
728
  const serverTools = mcpClients[serverName].tools;
729
- const toolNames = serverTools.map(t => t.name).join(', ');
730
- systemPrompt += `\n- ${serverName} server: ${toolNames}`;
729
+ systemPrompt += `\n- ${serverName}: ${serverTools.length} tools`;
731
730
  }
732
731
 
733
- systemPrompt += `\n\nCRITICAL: When filesystem MCP server is loaded, you MUST use list_directory (NOT list_dir), read_file from MCP (NOT local read_file).`;
734
- systemPrompt += `\nLocal tools are DISABLED when MCP equivalents exist. Always check MCP tools first.`;
735
- systemPrompt += `\nMCP tools have more features and better error handling than local tools.`;
736
- systemPrompt += `\n\nFor GitHub MCP, prefer list_issues over search_issues when listing issues.`;
732
+ systemPrompt += `\n\nWhen filesystem MCP is loaded, use list_directory (not list_dir), read_file from MCP (not local).`;
733
+ systemPrompt += `\nFor GitHub MCP, prefer list_issues over search_issues.`;
737
734
  }
738
735
 
739
736
  // Add available skills information
@@ -747,9 +744,13 @@ TOOL SELECTION GUIDE:
747
744
 
748
745
  if (skills.length > 0) {
749
746
  systemPrompt += `\n\nAVAILABLE SKILLS:`;
750
- systemPrompt += `\nYou have ${skills.length} custom skills installed in ~/.natureco/skills/`;
751
- systemPrompt += `\nSkills: ${skills.join(', ')}`;
752
- systemPrompt += `\nThese skills may contain specialized scripts, tools, or workflows the user has configured.`;
747
+
748
+ // Show only first 10 skills, summarize the rest
749
+ if (skills.length > 10) {
750
+ systemPrompt += `\nInstalled skills (${skills.length} total): ${skills.slice(0, 10).join(', ')} and ${skills.length - 10} more.`;
751
+ } else {
752
+ systemPrompt += `\nInstalled skills: ${skills.join(', ')}`;
753
+ }
753
754
  }
754
755
  } catch (err) {
755
756
  // Silently skip if skills directory can't be read
@@ -23,8 +23,8 @@ function loadMemory(botId) {
23
23
 
24
24
  if (!fs.existsSync(filePath)) {
25
25
  return {
26
- name: null,
27
- botName: null,
26
+ name: '',
27
+ botName: '',
28
28
  preferences: [],
29
29
  facts: [],
30
30
  lastSeen: null,
@@ -33,7 +33,16 @@ function loadMemory(botId) {
33
33
 
34
34
  try {
35
35
  const content = fs.readFileSync(filePath, 'utf8');
36
- const memory = JSON.parse(content);
36
+ const data = JSON.parse(content);
37
+
38
+ // Return with safe defaults for all fields
39
+ const memory = {
40
+ name: data.name || '',
41
+ botName: data.botName || '',
42
+ preferences: data.preferences || [],
43
+ facts: data.facts || [],
44
+ lastSeen: data.lastSeen || null,
45
+ };
37
46
 
38
47
  // Migrate old format to new format
39
48
  if (Array.isArray(memory.preferences) && memory.preferences.length > 0 && typeof memory.preferences[0] === 'string') {
@@ -43,16 +52,11 @@ function loadMemory(botId) {
43
52
  memory.facts = memory.facts.map(f => ({ value: f, score: 5, updatedAt: new Date().toISOString() }));
44
53
  }
45
54
 
46
- // Ensure botName field exists
47
- if (!memory.hasOwnProperty('botName')) {
48
- memory.botName = null;
49
- }
50
-
51
55
  return memory;
52
56
  } catch {
53
57
  return {
54
- name: null,
55
- botName: null,
58
+ name: '',
59
+ botName: '',
56
60
  preferences: [],
57
61
  facts: [],
58
62
  lastSeen: null,
@@ -196,33 +200,45 @@ function extractMemoryFromMessage(message) {
196
200
  function getMemoryPrompt(botId) {
197
201
  const memory = loadMemory(botId);
198
202
 
199
- if (!memory.name && !memory.botName && memory.preferences.length === 0 && memory.facts.length === 0) {
203
+ // Safe defaults for all fields
204
+ const name = memory.name || '';
205
+ const botName = memory.botName || '';
206
+ const preferences = memory.preferences || [];
207
+ const facts = memory.facts || [];
208
+
209
+ if (!name && !botName && preferences.length === 0 && facts.length === 0) {
200
210
  return '';
201
211
  }
202
212
 
203
213
  const parts = [];
204
214
 
205
215
  // Add bot name if set
206
- if (memory.botName) {
207
- parts.push(`Your name is ${memory.botName}.`);
216
+ if (botName) {
217
+ parts.push(`Your name is ${botName}.`);
208
218
  }
209
219
 
210
220
  // Add user memory section
211
- if (memory.name || memory.preferences.length > 0 || memory.facts.length > 0) {
221
+ if (name || preferences.length > 0 || facts.length > 0) {
212
222
  parts.push('## Kullanıcı Hafızası');
213
223
 
214
- if (memory.name) {
215
- parts.push(`İsim: ${memory.name}`);
224
+ if (name) {
225
+ parts.push(`İsim: ${name}`);
216
226
  }
217
227
 
218
- if (memory.preferences.length > 0) {
219
- const sorted = memory.preferences.sort((a, b) => b.score - a.score);
228
+ if (preferences.length > 0) {
229
+ const sorted = preferences.sort((a, b) => b.score - a.score);
220
230
  parts.push(`Tercihler: ${sorted.map(p => p.value).join(', ')}`);
221
231
  }
222
232
 
223
- if (memory.facts.length > 0) {
224
- const sorted = memory.facts.sort((a, b) => b.score - a.score);
225
- parts.push(`Bilgiler: ${sorted.map(f => f.value).join(', ')}`);
233
+ if (facts.length > 0) {
234
+ // Limit to top 15 facts to reduce token usage
235
+ const sorted = facts.sort((a, b) => b.score - a.score);
236
+ const topFacts = sorted.slice(0, 15);
237
+ parts.push(`Bilgiler: ${topFacts.map(f => f.value).join(', ')}`);
238
+
239
+ if (facts.length > 15) {
240
+ parts.push(`(${facts.length - 15} daha fazla bilgi mevcut)`);
241
+ }
226
242
  }
227
243
  }
228
244