fleetbo-cockpit-cli 1.0.122 → 1.0.124
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 -22
- package/package.json +1 -1
package/cli.js
CHANGED
|
@@ -641,26 +641,16 @@ if (command === 'alex') {
|
|
|
641
641
|
|
|
642
642
|
let inputBuffer = "";
|
|
643
643
|
let isProcessing = false;
|
|
644
|
-
let
|
|
645
|
-
let
|
|
646
|
-
|
|
647
|
-
const showHint = () => {
|
|
648
|
-
if (hintTimer) { clearTimeout(hintTimer); hintTimer = null; }
|
|
649
|
-
hintTimer = setTimeout(() => {
|
|
650
|
-
if (inputBuffer.trim() !== "" && !isProcessing) {
|
|
651
|
-
rl.setPrompt("\x1b[90m ↵ again to send\x1b[0m");
|
|
652
|
-
rl.prompt();
|
|
653
|
-
}
|
|
654
|
-
}, 1500);
|
|
655
|
-
};
|
|
644
|
+
let submitTimer = null;
|
|
645
|
+
let hintShown = false;
|
|
656
646
|
|
|
657
647
|
const doSubmit = async () => {
|
|
658
|
-
if (hintTimer) { clearTimeout(hintTimer); hintTimer = null; }
|
|
659
648
|
if (submitTimer) { clearTimeout(submitTimer); submitTimer = null; }
|
|
660
649
|
if (isProcessing || inputBuffer.trim() === "") return;
|
|
661
650
|
|
|
662
651
|
const finalPrompt = inputBuffer.trim();
|
|
663
652
|
inputBuffer = "";
|
|
653
|
+
hintShown = false;
|
|
664
654
|
|
|
665
655
|
if (finalPrompt.length > 4000) {
|
|
666
656
|
console.log(`\n\x1b[31m⛔ [Alex Safety] Mission rejected: Excessive size (${finalPrompt.length}/4000 characters).\x1b[0m`);
|
|
@@ -691,20 +681,28 @@ if (command === 'alex') {
|
|
|
691
681
|
}
|
|
692
682
|
|
|
693
683
|
if (trimmedLine !== "") {
|
|
694
|
-
//
|
|
684
|
+
// Ligne non-vide : annule timer, réinitialise hintShown, accumule
|
|
695
685
|
if (submitTimer) { clearTimeout(submitTimer); submitTimer = null; }
|
|
686
|
+
hintShown = false;
|
|
696
687
|
inputBuffer += (inputBuffer ? "\n" : "") + line;
|
|
697
|
-
// Hint affiché seulement après 300ms de silence (frappe normale)
|
|
698
|
-
// Si d'autres lignes arrivent avant (paste), le timer se remet à zéro
|
|
699
|
-
showHint();
|
|
700
688
|
} else {
|
|
701
|
-
// Ligne vide : soumet si buffer non vide, sinon prompt
|
|
702
689
|
if (inputBuffer.trim() !== "") {
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
690
|
+
if (hintShown) {
|
|
691
|
+
// Hint déjà visible → 2ème Entrée → soumet
|
|
692
|
+
doSubmit();
|
|
693
|
+
} else {
|
|
694
|
+
// 1ère ligne vide : attend 400ms pour distinguer paste / frappe manuelle
|
|
695
|
+
// Si une ligne non-vide arrive avant → timer annulé (paste en cours)
|
|
696
|
+
// Si rien → frappe manuelle confirmée → affiche le hint
|
|
697
|
+
if (submitTimer) clearTimeout(submitTimer);
|
|
698
|
+
submitTimer = setTimeout(() => {
|
|
699
|
+
submitTimer = null;
|
|
700
|
+
hintShown = true;
|
|
701
|
+
rl.setPrompt("\x1b[90m ↵ again to send\x1b[0m");
|
|
702
|
+
rl.prompt();
|
|
703
|
+
}, 400);
|
|
704
|
+
}
|
|
706
705
|
} else {
|
|
707
|
-
if (hintTimer) { clearTimeout(hintTimer); hintTimer = null; }
|
|
708
706
|
rl.setPrompt(`\x1b[34m${dynamicUsername} ❯ \x1b[0m`);
|
|
709
707
|
rl.prompt();
|
|
710
708
|
}
|