navada-edge-cli 3.5.6 → 3.5.7

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 +24 -8
  2. package/package.json +1 -1
package/lib/agent.js CHANGED
@@ -14,6 +14,19 @@ const config = require('./config');
14
14
  // NAVADA Edge Agent — personality + tools + routing
15
15
  // ---------------------------------------------------------------------------
16
16
 
17
+ // Strip markdown formatting for clean terminal output
18
+ function cleanOutput(text) {
19
+ if (typeof text !== 'string') return text;
20
+ return text
21
+ .replace(/\*\*(.+?)\*\*/g, '$1') // **bold** → plain
22
+ .replace(/\*(.+?)\*/g, '$1') // *italic* → plain
23
+ .replace(/__(.+?)__/g, '$1') // __underline__ → plain
24
+ .replace(/^#{1,6}\s+/gm, '') // ### headers → plain
25
+ .replace(/---+/g, '') // horizontal rules → remove
26
+ .replace(/\s--\s/g, ' ') // spaced -- → space
27
+ .replace(/--/g, ', '); // remaining -- → comma
28
+ }
29
+
17
30
  const IDENTITY = {
18
31
  name: 'NAVADA Edge',
19
32
  role: 'AI Infrastructure Agent',
@@ -35,7 +48,8 @@ When users ask you to DO something — DO IT. Use write_file to create files. Us
35
48
  When asked to generate diagrams — use write_file to create Mermaid (.mmd), SVG, or HTML files. You can also use python_exec with matplotlib/graphviz for complex diagrams.
36
49
  When asked to create, edit, or delete files — use the file tools directly. You are a terminal agent with FULL access.
37
50
  PLATFORM: This machine runs ` + (process.platform === 'win32' ? `Windows. Use Windows paths. Desktop = ${fs.existsSync(path.join(os.homedir(), 'OneDrive', 'Desktop')) ? path.join(os.homedir(), 'OneDrive', 'Desktop') : path.join(os.homedir(), 'Desktop')}. Home = ${os.homedir()}.` : `${process.platform}. Home = ${os.homedir()}.`) + `
38
- Keep responses short. Code blocks when needed. No fluff.`,
51
+ Keep responses short. Code blocks when needed. No fluff.
52
+ FORMATTING: Never use markdown formatting like **bold**, *italic*, ### headers, or -- dashes. Write plain text only. This is a terminal, not a web page.`,
39
53
  founder: {
40
54
  name: 'Leslie (Lee) Akpareva',
41
55
  title: 'Principal AI Consultant & Founder, NAVADA Edge Network',
@@ -443,7 +457,7 @@ function streamFreeTier(endpoint, messages) {
443
457
  const delta = parsed.choices?.[0]?.delta;
444
458
  // Grok-3-mini streams reasoning_content first, then content — skip reasoning
445
459
  if (delta?.reasoning_content && !delta?.content) continue;
446
- const text = delta?.content || '';
460
+ const text = cleanOutput(delta?.content || '');
447
461
  if (text) {
448
462
  process.stdout.write(text);
449
463
  fullContent += text;
@@ -523,8 +537,9 @@ function streamAnthropic(key, messages, tools, system) {
523
537
 
524
538
  case 'content_block_delta':
525
539
  if (event.delta?.type === 'text_delta') {
526
- process.stdout.write(event.delta.text);
527
- currentText += event.delta.text;
540
+ const clean = cleanOutput(event.delta.text);
541
+ process.stdout.write(clean);
542
+ currentText += clean;
528
543
  } else if (event.delta?.type === 'input_json_delta') {
529
544
  const last = contentBlocks[contentBlocks.length - 1];
530
545
  if (last?.type === 'tool_use') last.input += event.delta.partial_json;
@@ -616,8 +631,9 @@ function streamOpenAI(key, messages, model = 'gpt-4o') {
616
631
  if (finish) finishReason = finish;
617
632
 
618
633
  if (delta?.content) {
619
- process.stdout.write(delta.content);
620
- fullContent += delta.content;
634
+ const clean = cleanOutput(delta.content);
635
+ process.stdout.write(clean);
636
+ fullContent += clean;
621
637
  }
622
638
 
623
639
  // Accumulate tool calls
@@ -696,7 +712,7 @@ function streamGemini(key, messages, model = 'gemini-2.0-flash') {
696
712
  if (!data) continue;
697
713
  try {
698
714
  const parsed = JSON.parse(data);
699
- const text = parsed.candidates?.[0]?.content?.parts?.[0]?.text || '';
715
+ const text = cleanOutput(parsed.candidates?.[0]?.content?.parts?.[0]?.text || '');
700
716
  if (text) {
701
717
  process.stdout.write(text);
702
718
  fullContent += text;
@@ -1250,7 +1266,7 @@ async function grokChat(userMessage, conversationHistory = []) {
1250
1266
 
1251
1267
  // Extract final text
1252
1268
  const content = response?.choices?.[0]?.message?.content || '';
1253
- return content || 'No response.';
1269
+ return cleanOutput(content) || 'No response.';
1254
1270
  }
1255
1271
 
1256
1272
  async function fallbackChat(msg) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "navada-edge-cli",
3
- "version": "3.5.6",
3
+ "version": "3.5.7",
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": {