fleetbo-cockpit-cli 1.0.131 → 1.0.133
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 -55
- package/package.json +1 -1
package/cli.js
CHANGED
|
@@ -639,74 +639,53 @@ if (command === 'alex') {
|
|
|
639
639
|
process.stdout.write('\n\x1b[F');
|
|
640
640
|
rl.prompt();
|
|
641
641
|
|
|
642
|
-
let inputBuffer = "";
|
|
643
|
-
let isProcessing = false;
|
|
644
|
-
let hintTimer = null;
|
|
645
|
-
let submitTimer = null;
|
|
646
|
-
|
|
647
|
-
const showHint = () => {
|
|
648
|
-
if (hintTimer) clearTimeout(hintTimer);
|
|
649
|
-
hintTimer = setTimeout(() => {
|
|
650
|
-
hintTimer = null;
|
|
651
|
-
if (inputBuffer.trim() !== "" && !isProcessing) {
|
|
652
|
-
rl.setPrompt("\x1b[90m ↵ again to send\x1b[0m");
|
|
653
|
-
rl.prompt();
|
|
654
|
-
}
|
|
655
|
-
}, 400);
|
|
656
|
-
};
|
|
657
|
-
|
|
658
|
-
const doSubmit = async () => {
|
|
659
|
-
if (hintTimer) { clearTimeout(hintTimer); hintTimer = null; }
|
|
660
|
-
if (submitTimer) { clearTimeout(submitTimer); submitTimer = null; }
|
|
661
|
-
if (isProcessing || inputBuffer.trim() === "") return;
|
|
662
|
-
|
|
663
|
-
const finalPrompt = inputBuffer.trim();
|
|
664
|
-
inputBuffer = "";
|
|
665
|
-
|
|
666
|
-
if (finalPrompt.length > 4000) {
|
|
667
|
-
console.log(`\n\x1b[31m⛔ [Alex Safety] Mission rejected: Excessive size (${finalPrompt.length}/4000 characters).\x1b[0m`);
|
|
668
|
-
rl.setPrompt(`\x1b[34m${dynamicUsername} ❯ \x1b[0m`);
|
|
669
|
-
rl.prompt();
|
|
670
|
-
return;
|
|
671
|
-
}
|
|
672
|
-
|
|
673
|
-
isProcessing = true;
|
|
674
|
-
rl.setPrompt("");
|
|
675
|
-
await processAlexRequest(finalPrompt);
|
|
676
|
-
isProcessing = false;
|
|
677
|
-
|
|
678
|
-
console.log('');
|
|
679
|
-
rl.setPrompt(`\x1b[34m${dynamicUsername} ❯ \x1b[0m`);
|
|
680
|
-
rl.prompt();
|
|
681
|
-
};
|
|
642
|
+
let inputBuffer = "";
|
|
643
|
+
let isProcessing = false;
|
|
682
644
|
|
|
683
645
|
rl.on('line', async (line) => {
|
|
684
|
-
if (isProcessing) return;
|
|
646
|
+
if (isProcessing) return;
|
|
685
647
|
|
|
686
648
|
const trimmedLine = line.trim();
|
|
687
649
|
|
|
688
|
-
if (['exit', 'quit'].includes(trimmedLine.toLowerCase())) {
|
|
650
|
+
if (['exit', 'quit'].includes(trimmedLine.toLowerCase())) {
|
|
689
651
|
console.log('\n\x1b[90m Alex session closed.\x1b[0m');
|
|
690
|
-
rl.close();
|
|
691
|
-
return;
|
|
652
|
+
rl.close();
|
|
653
|
+
return;
|
|
692
654
|
}
|
|
693
655
|
|
|
694
656
|
if (trimmedLine !== "") {
|
|
695
|
-
|
|
696
|
-
if (submitTimer) { clearTimeout(submitTimer); submitTimer = null; }
|
|
657
|
+
const wasEmpty = inputBuffer === "";
|
|
697
658
|
inputBuffer += (inputBuffer ? "\n" : "") + line;
|
|
698
|
-
// Hint
|
|
699
|
-
|
|
700
|
-
|
|
659
|
+
// Hint uniquement si c'était la première ligne (buffer vide avant)
|
|
660
|
+
// Pendant un paste, le buffer n'est jamais vide entre les lignes
|
|
661
|
+
if (wasEmpty) {
|
|
662
|
+
rl.setPrompt("\x1b[90m ↵ again to send\x1b[0m");
|
|
663
|
+
rl.prompt();
|
|
664
|
+
}
|
|
665
|
+
}
|
|
666
|
+
else {
|
|
701
667
|
if (inputBuffer.trim() !== "") {
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
if (
|
|
706
|
-
|
|
668
|
+
const finalPrompt = inputBuffer.trim();
|
|
669
|
+
inputBuffer = "";
|
|
670
|
+
|
|
671
|
+
if (finalPrompt.length > 4000) {
|
|
672
|
+
console.log(`\n\x1b[31m⛔ [Alex Safety] Mission rejected: Excessive size (${finalPrompt.length}/4000 characters).\x1b[0m`);
|
|
673
|
+
rl.setPrompt(`\x1b[34m${dynamicUsername} ❯ \x1b[0m`);
|
|
674
|
+
rl.prompt();
|
|
675
|
+
return;
|
|
676
|
+
}
|
|
677
|
+
|
|
678
|
+
isProcessing = true;
|
|
679
|
+
rl.setPrompt("");
|
|
680
|
+
await processAlexRequest(finalPrompt);
|
|
681
|
+
isProcessing = false;
|
|
682
|
+
|
|
683
|
+
console.log('');
|
|
684
|
+
rl.setPrompt(`\x1b[34m${dynamicUsername} ❯ \x1b[0m`);
|
|
685
|
+
rl.prompt();
|
|
707
686
|
} else {
|
|
708
687
|
rl.setPrompt(`\x1b[34m${dynamicUsername} ❯ \x1b[0m`);
|
|
709
|
-
rl.prompt();
|
|
688
|
+
rl.prompt();
|
|
710
689
|
}
|
|
711
690
|
}
|
|
712
691
|
});
|