fleetbo-cockpit-cli 1.0.40 → 1.0.41
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/cli.js +19 -10
- package/package.json +1 -1
package/cli.js
CHANGED
|
@@ -459,12 +459,13 @@ if (command === 'alex') {
|
|
|
459
459
|
process.stdout.write('\n\x1b[F');
|
|
460
460
|
rl.prompt();
|
|
461
461
|
|
|
462
|
-
// --- MULTI-LINE BUFFER (
|
|
462
|
+
// --- MULTI-LINE BUFFER (ANTI-GLITCH VISUEL) ---
|
|
463
463
|
let inputBuffer = "";
|
|
464
|
-
let isProcessing = false;
|
|
464
|
+
let isProcessing = false;
|
|
465
|
+
let promptTimeout = null; // 🛡️ Le sauveur de l'affichage
|
|
465
466
|
|
|
466
467
|
rl.on('line', async (line) => {
|
|
467
|
-
if (isProcessing) return;
|
|
468
|
+
if (isProcessing) return;
|
|
468
469
|
|
|
469
470
|
const trimmedLine = line.trim();
|
|
470
471
|
|
|
@@ -479,25 +480,32 @@ if (command === 'alex') {
|
|
|
479
480
|
if (trimmedLine !== "") {
|
|
480
481
|
inputBuffer += (inputBuffer ? "\n" : "") + line;
|
|
481
482
|
rl.setPrompt(`\x1b[34m > \x1b[0m`);
|
|
482
|
-
|
|
483
|
+
|
|
484
|
+
// 🛡️ ANTI-GLITCH : On laisse le terminal afficher tout le collage d'un coup.
|
|
485
|
+
// On ne redessine le chevron qu'après 50ms de silence.
|
|
486
|
+
clearTimeout(promptTimeout);
|
|
487
|
+
promptTimeout = setTimeout(() => {
|
|
488
|
+
rl.prompt();
|
|
489
|
+
}, 50);
|
|
483
490
|
}
|
|
484
491
|
// 3. VALIDATION (Touche Entrée sur une ligne vide)
|
|
485
492
|
else {
|
|
486
493
|
if (inputBuffer.trim() !== "") {
|
|
487
494
|
const finalPrompt = inputBuffer.trim();
|
|
488
|
-
inputBuffer = "";
|
|
495
|
+
inputBuffer = "";
|
|
489
496
|
|
|
490
497
|
rl.setPrompt(`\x1b[34m${dynamicUsername} ❯ \x1b[0m`);
|
|
498
|
+
clearTimeout(promptTimeout); // On annule tout dessin en cours
|
|
491
499
|
|
|
492
|
-
// 🛑 COUPE-CIRCUIT STRICT (
|
|
500
|
+
// 🛑 COUPE-CIRCUIT STRICT (1000 caractères)
|
|
493
501
|
if (finalPrompt.length > 1000) {
|
|
494
502
|
console.log(`\n\x1b[31m⛔ [Alex Safety] Mission rejetée : Taille excessive (${finalPrompt.length}/1000 caractères).\x1b[0m`);
|
|
495
503
|
console.log(`\x1b[90m Veuillez être plus concis et vous concentrer sur l'essentiel.\x1b[0m\n`);
|
|
496
|
-
rl.prompt();
|
|
497
|
-
return;
|
|
504
|
+
rl.prompt();
|
|
505
|
+
return;
|
|
498
506
|
}
|
|
499
507
|
|
|
500
|
-
// ✅
|
|
508
|
+
// ✅ ON LANCE LA FORGE
|
|
501
509
|
isProcessing = true;
|
|
502
510
|
await processAlexRequest(finalPrompt);
|
|
503
511
|
isProcessing = false;
|
|
@@ -505,7 +513,8 @@ if (command === 'alex') {
|
|
|
505
513
|
console.log('');
|
|
506
514
|
rl.prompt();
|
|
507
515
|
} else {
|
|
508
|
-
rl.
|
|
516
|
+
rl.setPrompt(`\x1b[34m${dynamicUsername} ❯ \x1b[0m`);
|
|
517
|
+
rl.prompt(); // Entrée dans le vide
|
|
509
518
|
}
|
|
510
519
|
}
|
|
511
520
|
});
|