natureco-cli 2.23.10 → 2.23.12

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.23.10",
3
+ "version": "2.23.12",
4
4
  "description": "NatureCo AI Bot Terminal Interface",
5
5
  "bin": {
6
6
  "natureco": "bin/natureco.js"
@@ -126,9 +126,13 @@ async function chat(botName, options = {}) {
126
126
  const memoryPrompt = getMemoryPrompt(bot.id);
127
127
 
128
128
  let systemPrompt = '';
129
- if (skillPrompts) systemPrompt += skillPrompts;
130
- if (agentsPrompt) systemPrompt += `\n\n## Project Instructions\n${agentsPrompt}`;
131
- if (memoryPrompt) systemPrompt += '\n\n' + memoryPrompt;
129
+ if (config.providerUrl && config.providerUrl.includes('natureco.me')) {
130
+ systemPrompt = 'Sen yardımcı bir AI asistansın.';
131
+ } else {
132
+ if (skillPrompts) systemPrompt += skillPrompts;
133
+ if (agentsPrompt) systemPrompt += `\n\n## Project Instructions\n${agentsPrompt}`;
134
+ if (memoryPrompt) systemPrompt += '\n\n' + memoryPrompt;
135
+ }
132
136
 
133
137
  // ── Session ─────────────────────────────────────────────────────────────────
134
138
  let session;
package/src/utils/api.js CHANGED
@@ -18,9 +18,6 @@ const conversationHistory = new Map();
18
18
  // MCP clients (server name -> { client, tools })
19
19
  const mcpClients = {};
20
20
 
21
- // Cache for NatureCo user_id
22
- let _cachedUserId = null;
23
-
24
21
  /**
25
22
  * Generate default conversation ID based on provider config
26
23
  */
@@ -427,60 +424,14 @@ function formatToolsForAnthropic() {
427
424
  }));
428
425
  }
429
426
 
430
- /**
431
- * Get NatureCo user_id (cached)
432
- */
433
- async function getNatureCoUserId(apiKey) {
434
- if (_cachedUserId) return _cachedUserId;
435
- const result = await validateApiKey(apiKey);
436
- if (!result.valid || !result.user?.id) {
437
- throw new Error('Failed to get user_id: ' + (result.error || 'invalid API key'));
438
- }
439
- _cachedUserId = result.user.id;
440
- return _cachedUserId;
441
- }
442
-
443
- /**
444
- * Send message to NatureCo /api/agent/message endpoint
445
- */
446
- async function sendMessageNatureCo(providerConfig, messages, tools) {
447
- const lastUserMsg = [...messages].reverse().find(m => m.role === 'user');
448
- if (!lastUserMsg) throw new Error('No user message found');
449
-
450
- const userId = await getNatureCoUserId(providerConfig.apiKey);
451
-
452
- const response = await fetch('https://api.natureco.me/api/agent/message', {
453
- method: 'POST',
454
- headers: {
455
- 'Authorization': `Bearer ${providerConfig.apiKey}`,
456
- 'Content-Type': 'application/json',
457
- },
458
- body: JSON.stringify({
459
- message: lastUserMsg.content,
460
- user_id: userId,
461
- }),
462
- });
463
-
464
- if (!response.ok) {
465
- throw new Error(`NatureCo API error: ${response.status} - ${await response.text()}`);
466
- }
467
-
468
- const data = await response.json();
469
- return {
470
- role: 'assistant',
471
- content: data.response || '',
472
- };
473
- }
474
-
475
427
  /**
476
428
  * Send message to OpenAI-compatible provider (Groq, OpenAI, Together, etc.)
477
429
  */
478
430
  async function sendMessageOpenAICompatible(providerConfig, messages, tools) {
479
- if (providerConfig.url.includes('api.natureco.me')) {
480
- return sendMessageNatureCo(providerConfig, messages, tools);
481
- }
482
431
  const baseUrl = providerConfig.url.replace(/\/+$/, '');
483
- const endpoint = `${baseUrl}/chat/completions`;
432
+ const endpoint = baseUrl.includes('api.natureco.me')
433
+ ? 'https://api.natureco.me/api/v1/chat/completions'
434
+ : `${baseUrl}/chat/completions`;
484
435
 
485
436
  const requestBody = {
486
437
  model: providerConfig.model,
@@ -780,7 +731,14 @@ async function sendMessage(apiKey, botId, message, conversationId = null, chatSy
780
731
 
781
732
  // Get config to check MCP status
782
733
  const config = getConfig();
783
-
734
+ const providerConfig = getProviderConfig();
735
+
736
+ // NatureCo — minimal system prompt, skip tool descriptions/MCP
737
+ if (providerConfig && providerConfig.url.includes('api.natureco.me')) {
738
+ const prompt = chatSystemPrompt || 'Sen yardımcı bir AI asistansın.';
739
+ return sendMessageToProvider(apiKey, message, conversationId, prompt, options);
740
+ }
741
+
784
742
  // Base system prompt — sıkıştırılmış (~120 token)
785
743
  const toolDefs = getToolDefinitions();
786
744
  const toolsDesc = toolDefs.map(t => t.name + (t.description ? ' (' + t.description.slice(0, 30) + ')' : '')).join(', ');
@@ -920,15 +878,10 @@ async function streamProviderCompletion(providerConfig, messages, tools) {
920
878
  }
921
879
 
922
880
  async function streamOpenAICompletion(providerConfig, messages, tools) {
923
- // NatureCo endpoint doesn't support streaming — fall back to non-streaming
924
- if (providerConfig.url.includes('api.natureco.me')) {
925
- const msg = await sendMessageNatureCo(providerConfig, messages, tools);
926
- process.stdout.write(msg.content);
927
- process.stdout.write('\n');
928
- return { type: 'text', content: msg.content };
929
- }
930
881
  const baseUrl = providerConfig.url.replace(/\/+$/, '');
931
- const endpoint = `${baseUrl}/chat/completions`;
882
+ const endpoint = baseUrl.includes('api.natureco.me')
883
+ ? 'https://api.natureco.me/api/v1/chat/completions'
884
+ : `${baseUrl}/chat/completions`;
932
885
 
933
886
  const requestBody = {
934
887
  model: providerConfig.model,