fleetbo-cockpit-cli 1.0.143 → 1.0.144
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 +20 -27
- package/package.json +1 -1
package/cli.js
CHANGED
|
@@ -639,7 +639,7 @@ if (command === 'alex') {
|
|
|
639
639
|
process.stdout.write('\n\x1b[F');
|
|
640
640
|
rl.prompt();
|
|
641
641
|
|
|
642
|
-
let inputBuffer = [];
|
|
642
|
+
let inputBuffer = [];
|
|
643
643
|
let isProcessing = false;
|
|
644
644
|
let burstTimer = null;
|
|
645
645
|
let isPastingMode = false;
|
|
@@ -673,51 +673,44 @@ if (command === 'alex') {
|
|
|
673
673
|
rl.on('line', (line) => {
|
|
674
674
|
if (isProcessing) return;
|
|
675
675
|
|
|
676
|
-
// 1.
|
|
677
|
-
if (isPastingMode) {
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
isPastingMode = false;
|
|
683
|
-
executePrompt(finalPrompt);
|
|
684
|
-
} else {
|
|
685
|
-
// Le pilote continue d'écrire en dessous de son collage
|
|
686
|
-
inputBuffer.push(line);
|
|
687
|
-
}
|
|
676
|
+
// 1. VALIDATION DU MODE MULTI-LIGNES (Ligne vide = Envoi)
|
|
677
|
+
if (isPastingMode && line.trim() === "") {
|
|
678
|
+
const finalPrompt = inputBuffer.join('\n').trim();
|
|
679
|
+
inputBuffer = [];
|
|
680
|
+
isPastingMode = false;
|
|
681
|
+
executePrompt(finalPrompt);
|
|
688
682
|
return;
|
|
689
683
|
}
|
|
690
684
|
|
|
691
|
-
// 2. ACCUMULATION
|
|
685
|
+
// 2. ACCUMULATION
|
|
692
686
|
inputBuffer.push(line);
|
|
693
687
|
|
|
694
|
-
// On annule le timer à chaque nouvelle ligne entrante
|
|
695
688
|
if (burstTimer) clearTimeout(burstTimer);
|
|
696
689
|
|
|
697
|
-
// 3. ANALYSE
|
|
690
|
+
// 3. ANALYSE (100ms après la dernière ligne reçue)
|
|
698
691
|
burstTimer = setTimeout(() => {
|
|
699
692
|
burstTimer = null;
|
|
700
693
|
|
|
694
|
+
// Si on a DÉJÀ basculé en mode collage, on reste silencieux !
|
|
695
|
+
if (isPastingMode) return;
|
|
696
|
+
|
|
701
697
|
if (inputBuffer.length === 1) {
|
|
702
|
-
// 👉 CAS A :
|
|
703
|
-
// C'est un humain qui a tapé une phrase et appuyé sur Entrée.
|
|
698
|
+
// 👉 CAS A : Une seule ligne tapée. Envoi immédiat !
|
|
704
699
|
const finalPrompt = inputBuffer[0].trim();
|
|
705
|
-
inputBuffer = [];
|
|
700
|
+
inputBuffer = [];
|
|
706
701
|
|
|
707
702
|
if (finalPrompt === "") {
|
|
708
|
-
rl.prompt();
|
|
703
|
+
rl.prompt();
|
|
709
704
|
} else {
|
|
710
|
-
executePrompt(finalPrompt);
|
|
705
|
+
executePrompt(finalPrompt);
|
|
711
706
|
}
|
|
712
707
|
} else {
|
|
713
|
-
// 👉 CAS B :
|
|
714
|
-
//
|
|
708
|
+
// 👉 CAS B : Plusieurs lignes reçues = Copier-coller.
|
|
709
|
+
// On verrouille le mode multi-lignes TOUT EN SILENCE.
|
|
710
|
+
// Aucun message, aucun 'rl.prompt()', on laisse le terminal respirer.
|
|
715
711
|
isPastingMode = true;
|
|
716
|
-
// On ajoute un petit indicateur visuel ultra-propre pour te prévenir
|
|
717
|
-
console.log('\x1b[90m [Copier-coller détecté. Appuyez sur Entrée (ligne vide) pour valider]\x1b[0m');
|
|
718
|
-
rl.prompt();
|
|
719
712
|
}
|
|
720
|
-
},
|
|
713
|
+
}, 100);
|
|
721
714
|
});
|
|
722
715
|
};
|
|
723
716
|
|