navada-edge-cli 3.5.5 → 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.
- package/lib/agent.js +28 -10
- 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',
|
|
@@ -34,8 +47,9 @@ You also connect to the NAVADA Edge Network (4 nodes via Tailscale VPN):
|
|
|
34
47
|
When users ask you to DO something — DO IT. Use write_file to create files. Use shell to run commands. Never say "I can't" when you have a tool for it.
|
|
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
|
-
PLATFORM: This machine runs ` + (process.platform === 'win32' ? `Windows. Use Windows paths (
|
|
38
|
-
Keep responses short. Code blocks when needed. No fluff
|
|
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()}.`) + `
|
|
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
|
-
|
|
527
|
-
|
|
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
|
-
|
|
620
|
-
|
|
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;
|
|
@@ -1080,7 +1096,9 @@ async function executeTool(name, input) {
|
|
|
1080
1096
|
function tryLocalAction(userMessage) {
|
|
1081
1097
|
const msg = userMessage.trim();
|
|
1082
1098
|
const home = os.homedir();
|
|
1083
|
-
|
|
1099
|
+
// Windows OneDrive redirects Desktop — check OneDrive first
|
|
1100
|
+
const oneDriveDesktop = path.join(home, 'OneDrive', 'Desktop');
|
|
1101
|
+
const desktop = (process.platform === 'win32' && fs.existsSync(oneDriveDesktop)) ? oneDriveDesktop : path.join(home, 'Desktop');
|
|
1084
1102
|
|
|
1085
1103
|
// Resolve a location phrase to an absolute path (use ORIGINAL case, not lowered)
|
|
1086
1104
|
function resolveLocation(phrase) {
|
|
@@ -1248,7 +1266,7 @@ async function grokChat(userMessage, conversationHistory = []) {
|
|
|
1248
1266
|
|
|
1249
1267
|
// Extract final text
|
|
1250
1268
|
const content = response?.choices?.[0]?.message?.content || '';
|
|
1251
|
-
return content || 'No response.';
|
|
1269
|
+
return cleanOutput(content) || 'No response.';
|
|
1252
1270
|
}
|
|
1253
1271
|
|
|
1254
1272
|
async function fallbackChat(msg) {
|
package/package.json
CHANGED