fleetbo-cockpit-cli 1.0.107 → 1.0.108
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 +41 -28
- package/package.json +1 -1
package/cli.js
CHANGED
|
@@ -636,50 +636,63 @@ if (command === 'alex') {
|
|
|
636
636
|
prompt: `\x1b[34m${dynamicUsername} ❯ \x1b[0m`
|
|
637
637
|
});
|
|
638
638
|
|
|
639
|
+
// Active le curseur clignotant (séquence ANSI standard)
|
|
640
|
+
process.stdout.write('\x1b[?12h');
|
|
639
641
|
process.stdout.write('\n\x1b[F');
|
|
640
642
|
rl.prompt();
|
|
641
643
|
|
|
642
|
-
let inputBuffer = "";
|
|
643
|
-
let isProcessing = false;
|
|
644
|
+
let inputBuffer = "";
|
|
645
|
+
let isProcessing = false;
|
|
646
|
+
let submitTimer = null;
|
|
647
|
+
|
|
648
|
+
const submitBuffer = async () => {
|
|
649
|
+
if (submitTimer) { clearTimeout(submitTimer); submitTimer = null; }
|
|
650
|
+
if (isProcessing || inputBuffer.trim() === "") return;
|
|
651
|
+
|
|
652
|
+
const finalPrompt = inputBuffer.trim();
|
|
653
|
+
inputBuffer = "";
|
|
654
|
+
|
|
655
|
+
if (finalPrompt.length > 1000) {
|
|
656
|
+
console.log(`\n\x1b[31m⛔ [Alex Safety] Mission rejected: Excessive size (${finalPrompt.length}/1000 characters).\x1b[0m`);
|
|
657
|
+
rl.setPrompt(`\x1b[34m${dynamicUsername} ❯ \x1b[0m`);
|
|
658
|
+
rl.prompt();
|
|
659
|
+
return;
|
|
660
|
+
}
|
|
661
|
+
|
|
662
|
+
isProcessing = true;
|
|
663
|
+
rl.setPrompt("");
|
|
664
|
+
await processAlexRequest(finalPrompt);
|
|
665
|
+
isProcessing = false;
|
|
666
|
+
|
|
667
|
+
console.log('');
|
|
668
|
+
rl.setPrompt(`\x1b[34m${dynamicUsername} ❯ \x1b[0m`);
|
|
669
|
+
rl.prompt();
|
|
670
|
+
};
|
|
644
671
|
|
|
645
672
|
rl.on('line', async (line) => {
|
|
646
|
-
if (isProcessing) return;
|
|
673
|
+
if (isProcessing) return;
|
|
647
674
|
|
|
648
675
|
const trimmedLine = line.trim();
|
|
649
676
|
|
|
650
|
-
if (['exit', 'quit'].includes(trimmedLine.toLowerCase())) {
|
|
677
|
+
if (['exit', 'quit'].includes(trimmedLine.toLowerCase())) {
|
|
651
678
|
console.log('\n\x1b[90m Alex session closed.\x1b[0m');
|
|
652
|
-
rl.close();
|
|
653
|
-
return;
|
|
679
|
+
rl.close();
|
|
680
|
+
return;
|
|
654
681
|
}
|
|
655
682
|
|
|
656
683
|
if (trimmedLine !== "") {
|
|
684
|
+
// Ligne avec contenu → accumule et arme un timer de 600ms
|
|
685
|
+
if (submitTimer) { clearTimeout(submitTimer); submitTimer = null; }
|
|
657
686
|
inputBuffer += (inputBuffer ? "\n" : "") + line;
|
|
658
|
-
rl.setPrompt("");
|
|
659
|
-
|
|
660
|
-
else {
|
|
687
|
+
rl.setPrompt("");
|
|
688
|
+
submitTimer = setTimeout(() => submitBuffer(), 600);
|
|
689
|
+
} else {
|
|
690
|
+
// Ligne vide → soumet immédiatement si buffer non vide, sinon prompt
|
|
661
691
|
if (inputBuffer.trim() !== "") {
|
|
662
|
-
|
|
663
|
-
inputBuffer = "";
|
|
664
|
-
|
|
665
|
-
if (finalPrompt.length > 1000) {
|
|
666
|
-
console.log(`\n\x1b[31m⛔ [Alex Safety] Mission rejected: Excessive size (${finalPrompt.length}/1000 characters).\x1b[0m`);
|
|
667
|
-
rl.setPrompt(`\x1b[34m${dynamicUsername} ❯ \x1b[0m`);
|
|
668
|
-
rl.prompt();
|
|
669
|
-
return;
|
|
670
|
-
}
|
|
671
|
-
|
|
672
|
-
isProcessing = true;
|
|
673
|
-
rl.setPrompt("");
|
|
674
|
-
await processAlexRequest(finalPrompt);
|
|
675
|
-
isProcessing = false;
|
|
676
|
-
|
|
677
|
-
console.log('');
|
|
678
|
-
rl.setPrompt(`\x1b[34m${dynamicUsername} ❯ \x1b[0m`);
|
|
679
|
-
rl.prompt();
|
|
692
|
+
submitBuffer();
|
|
680
693
|
} else {
|
|
681
694
|
rl.setPrompt(`\x1b[34m${dynamicUsername} ❯ \x1b[0m`);
|
|
682
|
-
rl.prompt();
|
|
695
|
+
rl.prompt();
|
|
683
696
|
}
|
|
684
697
|
}
|
|
685
698
|
});
|