npm-noxyai 1.0.12 → 1.0.13
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/index-noxyai.js +31 -20
- package/package.json +1 -1
package/index-noxyai.js
CHANGED
|
@@ -17,14 +17,14 @@ function loadConfig() {
|
|
|
17
17
|
if (fs.existsSync(CONFIG_FILE)) {
|
|
18
18
|
try {
|
|
19
19
|
const config = JSON.parse(fs.readFileSync(CONFIG_FILE, 'utf8'));
|
|
20
|
-
if (config.agentMode === undefined) config.agentMode =
|
|
20
|
+
if (config.agentMode === undefined) config.agentMode = false; // Default OFF
|
|
21
21
|
return config;
|
|
22
22
|
} catch(e) {}
|
|
23
23
|
}
|
|
24
24
|
return {
|
|
25
25
|
token: null,
|
|
26
26
|
model: 'auto',
|
|
27
|
-
agentMode:
|
|
27
|
+
agentMode: false // Default to Chat mode
|
|
28
28
|
};
|
|
29
29
|
}
|
|
30
30
|
|
|
@@ -177,7 +177,8 @@ async function chat(prompt, depth = 0) {
|
|
|
177
177
|
if (!config.token) { console.error('❌ Unauthorized: Run "noxyai login"'); return; }
|
|
178
178
|
if (depth > 6) { console.error('\n❌ Reached max reasoning depth. Stopping.'); return; }
|
|
179
179
|
|
|
180
|
-
|
|
180
|
+
// Only add file context in Agent Mode
|
|
181
|
+
const enhancedPrompt = (depth === 0 && config.agentMode) ? getLocalContext() + prompt : prompt;
|
|
181
182
|
|
|
182
183
|
startSpinner(depth === 0 ? 'NoxyAI is thinking...' : 'NoxyAI is analyzing results...');
|
|
183
184
|
|
|
@@ -203,7 +204,8 @@ async function chat(prompt, depth = 0) {
|
|
|
203
204
|
return console.error('\n❌ API Error: ' + errorText);
|
|
204
205
|
}
|
|
205
206
|
|
|
206
|
-
const modelDisplay = config.model === 'auto' ? 'Mamba-Codestral 7B' :
|
|
207
|
+
const modelDisplay = config.model === 'auto' ? 'Mamba-Codestral 7B' :
|
|
208
|
+
config.model === 'Qwen3' ? 'Qwen3 80B' : 'Mamba-Codestral 7B';
|
|
207
209
|
const agentStatus = config.agentMode ? '🤖 Agent' : '💬 Chat';
|
|
208
210
|
console.log(`\n${agentStatus} \x1b[36mNoxyAI (${modelDisplay}):\x1b[0m\n`);
|
|
209
211
|
|
|
@@ -245,13 +247,20 @@ async function chat(prompt, depth = 0) {
|
|
|
245
247
|
}
|
|
246
248
|
}
|
|
247
249
|
|
|
248
|
-
|
|
250
|
+
console.log('\n');
|
|
251
|
+
|
|
252
|
+
// ONLY process agent actions if agent mode is ON AND there are action tags
|
|
249
253
|
if (!config.agentMode) {
|
|
250
|
-
console.log('\n');
|
|
251
254
|
return;
|
|
252
255
|
}
|
|
253
256
|
|
|
254
|
-
|
|
257
|
+
// Check if response contains action tags before processing
|
|
258
|
+
const hasActionTags = /<read>|<search>|<file path=|<execute>/.test(fullResponse);
|
|
259
|
+
if (!hasActionTags) {
|
|
260
|
+
return;
|
|
261
|
+
}
|
|
262
|
+
|
|
263
|
+
console.log('\x1b[32m[Agent] Processing actions...\x1b[0m');
|
|
255
264
|
let agentFeedback = "";
|
|
256
265
|
|
|
257
266
|
// Tool: Read Files
|
|
@@ -347,13 +356,14 @@ function startInteractiveMode() {
|
|
|
347
356
|
const agentStatus = config.agentMode ? '\x1b[32mON\x1b[0m' : '\x1b[31mOFF\x1b[0m';
|
|
348
357
|
|
|
349
358
|
console.log(`\x1b[33mWelcome to NoxyAI Interactive Mode!\x1b[0m`);
|
|
350
|
-
console.log(`Current Model: \x1b[32m${config.model}\x1b[0m`);
|
|
359
|
+
console.log(`Current Model: \x1b[32m${config.model === 'auto' ? 'Mamba-Codestral 7B' : config.model}\x1b[0m`);
|
|
351
360
|
console.log(`Agent Mode: ${agentStatus}`);
|
|
352
361
|
console.log(`\nCommands:`);
|
|
353
|
-
console.log(` \x1b[36m/agent\x1b[0m - Toggle Agent Mode (
|
|
362
|
+
console.log(` \x1b[36m/agent\x1b[0m - Toggle Agent Mode (file/code operations)`);
|
|
354
363
|
console.log(` \x1b[36m/model\x1b[0m - Change AI Model`);
|
|
355
364
|
console.log(` \x1b[36m/clear\x1b[0m - Clear screen`);
|
|
356
365
|
console.log(` \x1b[36m/exit\x1b[0m - Exit\n`);
|
|
366
|
+
console.log(`\x1b[90mTip: In Chat mode, AI responds normally. In Agent mode, it can read/write files and run commands.\x1b[0m\n`);
|
|
357
367
|
|
|
358
368
|
function ask() {
|
|
359
369
|
const prompt = config.agentMode ? '\x1b[36mNoxyAI [Agent] > \x1b[0m' : '\x1b[36mNoxyAI [Chat] > \x1b[0m';
|
|
@@ -376,25 +386,26 @@ function startInteractiveMode() {
|
|
|
376
386
|
const status = config.agentMode ? '\x1b[32mON\x1b[0m' : '\x1b[31mOFF\x1b[0m';
|
|
377
387
|
console.log(`\n\x1b[33m🤖 Agent Mode: ${status}\x1b[0m`);
|
|
378
388
|
if (config.agentMode) {
|
|
379
|
-
console.log('\x1b[36mAgent mode
|
|
380
|
-
console.log(' •
|
|
381
|
-
console.log(' •
|
|
382
|
-
console.log(' •
|
|
389
|
+
console.log('\x1b[36mAgent mode features:\x1b[0m');
|
|
390
|
+
console.log(' • Read & write files');
|
|
391
|
+
console.log(' • Execute terminal commands');
|
|
392
|
+
console.log(' • Web search integration');
|
|
393
|
+
console.log(' • Multi-step autonomous tasks\n');
|
|
394
|
+
} else {
|
|
395
|
+
console.log('\x1b[36mChat mode: Normal AI conversation without file access\x1b[0m\n');
|
|
383
396
|
}
|
|
384
397
|
ask();
|
|
385
398
|
}
|
|
386
399
|
else if (lower === '/model') {
|
|
387
400
|
console.log('\n\x1b[33mSelect an AI Model:\x1b[0m');
|
|
388
|
-
console.log(' \x1b[36m1)\x1b[0m Auto (Mamba-Codestral 7B
|
|
389
|
-
console.log(' \x1b[36m2)\x1b[0m Qwen3
|
|
390
|
-
console.log(' \x1b[36m3)\x1b[0m
|
|
391
|
-
console.log(' \x1b[36m4)\x1b[0m GLM-4 9B Chat');
|
|
401
|
+
console.log(' \x1b[36m1)\x1b[0m Auto (Mamba-Codestral 7B)');
|
|
402
|
+
console.log(' \x1b[36m2)\x1b[0m Qwen3 80B \x1b[32m[Reasoning in Green]\x1b[0m');
|
|
403
|
+
console.log(' \x1b[36m3)\x1b[0m Mamba-Codestral 7B');
|
|
392
404
|
|
|
393
|
-
rl.question('\nEnter number (1-
|
|
405
|
+
rl.question('\nEnter number (1-3): ', (choice) => {
|
|
394
406
|
let selected = 'auto';
|
|
395
407
|
if (choice === '2') selected = 'Qwen3';
|
|
396
408
|
if (choice === '3') selected = 'Mamba-Codestral';
|
|
397
|
-
if (choice === '4') selected = 'GLM-4';
|
|
398
409
|
|
|
399
410
|
config.model = selected;
|
|
400
411
|
saveConfig(config);
|
|
@@ -423,7 +434,7 @@ else if (command === 'help' || command === '--help') {
|
|
|
423
434
|
console.log(`\n \x1b[32mnoxyai\x1b[0m Start Interactive Mode`);
|
|
424
435
|
console.log(` \x1b[32mnoxyai chat "<prompt>"\x1b[0m Run single prompt`);
|
|
425
436
|
console.log(`\n Interactive Commands:`);
|
|
426
|
-
console.log(` \x1b[36m/agent\x1b[0m Toggle Agent Mode (
|
|
437
|
+
console.log(` \x1b[36m/agent\x1b[0m Toggle Agent Mode (file/code operations)`);
|
|
427
438
|
console.log(` \x1b[36m/model\x1b[0m Change AI Model\n`);
|
|
428
439
|
}
|
|
429
440
|
else if (command === 'chat') {
|