fleetbo-cockpit-cli 1.0.142 → 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 +34 -47
- package/package.json +1 -1
package/cli.js
CHANGED
|
@@ -639,11 +639,10 @@ 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
|
-
let
|
|
645
|
-
let
|
|
646
|
-
let lastLineTime = Date.now(); // ⏱️ LE CHRONOMÈTRE MAGIQUE
|
|
644
|
+
let burstTimer = null;
|
|
645
|
+
let isPastingMode = false;
|
|
647
646
|
|
|
648
647
|
const executePrompt = async (text) => {
|
|
649
648
|
if (['exit', 'quit'].includes(text.toLowerCase())) {
|
|
@@ -671,59 +670,47 @@ if (command === 'alex') {
|
|
|
671
670
|
}
|
|
672
671
|
};
|
|
673
672
|
|
|
674
|
-
rl.on('line',
|
|
673
|
+
rl.on('line', (line) => {
|
|
675
674
|
if (isProcessing) return;
|
|
676
675
|
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
const finalPrompt = inputBuffer.trim();
|
|
685
|
-
inputBuffer = "";
|
|
686
|
-
isPasting = false;
|
|
687
|
-
await executePrompt(finalPrompt);
|
|
688
|
-
return;
|
|
689
|
-
}
|
|
690
|
-
// Si c'est < 150ms, c'est juste un paragraphe vide dans le texte copié ! On l'ignore et on accumule.
|
|
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);
|
|
682
|
+
return;
|
|
691
683
|
}
|
|
692
684
|
|
|
693
|
-
// 2.
|
|
694
|
-
inputBuffer
|
|
685
|
+
// 2. ACCUMULATION
|
|
686
|
+
inputBuffer.push(line);
|
|
695
687
|
|
|
696
|
-
|
|
697
|
-
if (isPasting) return;
|
|
688
|
+
if (burstTimer) clearTimeout(burstTimer);
|
|
698
689
|
|
|
699
|
-
//
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
clearTimeout(submitTimeout);
|
|
703
|
-
submitTimeout = null;
|
|
704
|
-
}
|
|
705
|
-
isPasting = true; // 🚨 Passage en mode manuel !
|
|
706
|
-
return;
|
|
707
|
-
}
|
|
690
|
+
// 3. ANALYSE (100ms après la dernière ligne reçue)
|
|
691
|
+
burstTimer = setTimeout(() => {
|
|
692
|
+
burstTimer = null;
|
|
708
693
|
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
submitTimeout = setTimeout(async () => {
|
|
713
|
-
submitTimeout = null;
|
|
714
|
-
|
|
715
|
-
// Si on a basculé en mode paste entre temps (suite d'un collage), on annule l'envoi auto
|
|
716
|
-
if (isPasting) return;
|
|
694
|
+
// Si on a DÉJÀ basculé en mode collage, on reste silencieux !
|
|
695
|
+
if (isPastingMode) return;
|
|
717
696
|
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
697
|
+
if (inputBuffer.length === 1) {
|
|
698
|
+
// 👉 CAS A : Une seule ligne tapée. Envoi immédiat !
|
|
699
|
+
const finalPrompt = inputBuffer[0].trim();
|
|
700
|
+
inputBuffer = [];
|
|
701
|
+
|
|
702
|
+
if (finalPrompt === "") {
|
|
703
|
+
rl.prompt();
|
|
704
|
+
} else {
|
|
705
|
+
executePrompt(finalPrompt);
|
|
706
|
+
}
|
|
723
707
|
} else {
|
|
724
|
-
|
|
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.
|
|
711
|
+
isPastingMode = true;
|
|
725
712
|
}
|
|
726
|
-
},
|
|
713
|
+
}, 100);
|
|
727
714
|
});
|
|
728
715
|
};
|
|
729
716
|
|