navada-edge-cli 3.0.0 → 3.0.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.
Files changed (2) hide show
  1. package/lib/agent.js +10 -4
  2. package/package.json +1 -1
package/lib/agent.js CHANGED
@@ -536,7 +536,10 @@ async function openAIChat(key, userMessage, conversationHistory = []) {
536
536
  response = await streamOpenAI(key, messages, model);
537
537
  } catch (e) {
538
538
  if (e.message.includes('401') || e.message.includes('429') || e.message.includes('billing')) {
539
- console.log(ui.warn('OpenAI API unavailable, falling back to Grok free tier...'));
539
+ if (!sessionState._openaiWarned) {
540
+ console.log(ui.warn('OpenAI API unavailable, using Grok free tier. /login with a valid key to switch.'));
541
+ sessionState._openaiWarned = true;
542
+ }
540
543
  return grokChat(userMessage, conversationHistory);
541
544
  }
542
545
  throw e;
@@ -718,12 +721,15 @@ async function chat(userMessage, conversationHistory = []) {
718
721
  // Stream the response — fall back to Grok if Anthropic fails (billing, rate limit, etc.)
719
722
  let response;
720
723
  try {
721
- response = await streamAnthropic(effectiveKey, messages, tools);
724
+ response = await streamAnthropic(effectiveAnthropicKey, messages, tools);
722
725
  } catch (e) {
723
726
  const errMsg = e.message || '';
724
727
  // If billing/rate limit/auth error, fall back to free tier
725
728
  if (errMsg.includes('400') || errMsg.includes('401') || errMsg.includes('429') || errMsg.includes('usage limits')) {
726
- console.log(ui.warn('Anthropic API unavailable, falling back to Grok free tier...'));
729
+ if (!sessionState._anthropicWarned) {
730
+ console.log(ui.warn('Anthropic API unavailable, using Grok free tier. /login with a valid key to switch.'));
731
+ sessionState._anthropicWarned = true;
732
+ }
727
733
  return grokChat(userMessage, conversationHistory);
728
734
  }
729
735
  throw e;
@@ -744,7 +750,7 @@ async function chat(userMessage, conversationHistory = []) {
744
750
 
745
751
  messages.push({ role: 'assistant', content: response.content });
746
752
  messages.push({ role: 'user', content: results });
747
- response = await streamAnthropic(effectiveKey, messages, tools);
753
+ response = await streamAnthropic(effectiveAnthropicKey, messages, tools);
748
754
  }
749
755
 
750
756
  // Extract final text (already streamed to stdout)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "navada-edge-cli",
3
- "version": "3.0.0",
3
+ "version": "3.0.2",
4
4
  "description": "Interactive CLI for the NAVADA Edge Network — explore nodes, agents, Cloudflare, AI, Docker, and MCP from your terminal",
5
5
  "main": "lib/cli.js",
6
6
  "bin": {