fleetbo-cockpit-cli 1.0.132 → 1.0.134
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 +32 -22
- package/package.json +1 -1
package/cli.js
CHANGED
|
@@ -641,45 +641,55 @@ if (command === 'alex') {
|
|
|
641
641
|
|
|
642
642
|
let inputBuffer = "";
|
|
643
643
|
let isProcessing = false;
|
|
644
|
+
let hintShown = false;
|
|
644
645
|
|
|
645
646
|
rl.on('line', async (line) => {
|
|
646
|
-
if (isProcessing) return;
|
|
647
|
+
if (isProcessing) return;
|
|
647
648
|
|
|
648
649
|
const trimmedLine = line.trim();
|
|
649
650
|
|
|
650
|
-
if (['exit', 'quit'].includes(trimmedLine.toLowerCase())) {
|
|
651
|
+
if (['exit', 'quit'].includes(trimmedLine.toLowerCase())) {
|
|
651
652
|
console.log('\n\x1b[90m Alex session closed.\x1b[0m');
|
|
652
|
-
rl.close();
|
|
653
|
-
return;
|
|
653
|
+
rl.close();
|
|
654
|
+
return;
|
|
654
655
|
}
|
|
655
656
|
|
|
656
657
|
if (trimmedLine !== "") {
|
|
658
|
+
// Accumule silencieusement — pas de hint pendant la frappe/paste
|
|
657
659
|
inputBuffer += (inputBuffer ? "\n" : "") + line;
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
} else {
|
|
660
|
+
}
|
|
661
|
+
else {
|
|
661
662
|
if (inputBuffer.trim() !== "") {
|
|
662
|
-
|
|
663
|
-
|
|
663
|
+
if (!hintShown) {
|
|
664
|
+
// 1ère ligne vide → affiche le hint, attend la 2ème
|
|
665
|
+
hintShown = true;
|
|
666
|
+
rl.setPrompt("\x1b[90m ↵ again to send\x1b[0m");
|
|
667
|
+
rl.prompt();
|
|
668
|
+
} else {
|
|
669
|
+
// 2ème ligne vide → soumet
|
|
670
|
+
hintShown = false;
|
|
671
|
+
const finalPrompt = inputBuffer.trim();
|
|
672
|
+
inputBuffer = "";
|
|
673
|
+
|
|
674
|
+
if (finalPrompt.length > 4000) {
|
|
675
|
+
console.log(`\n\x1b[31m⛔ [Alex Safety] Mission rejected: Excessive size (${finalPrompt.length}/4000 characters).\x1b[0m`);
|
|
676
|
+
rl.setPrompt(`\x1b[34m${dynamicUsername} ❯ \x1b[0m`);
|
|
677
|
+
rl.prompt();
|
|
678
|
+
return;
|
|
679
|
+
}
|
|
664
680
|
|
|
665
|
-
|
|
666
|
-
|
|
681
|
+
isProcessing = true;
|
|
682
|
+
rl.setPrompt("");
|
|
683
|
+
await processAlexRequest(finalPrompt);
|
|
684
|
+
isProcessing = false;
|
|
685
|
+
|
|
686
|
+
console.log('');
|
|
667
687
|
rl.setPrompt(`\x1b[34m${dynamicUsername} ❯ \x1b[0m`);
|
|
668
688
|
rl.prompt();
|
|
669
|
-
return;
|
|
670
689
|
}
|
|
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();
|
|
680
690
|
} else {
|
|
681
691
|
rl.setPrompt(`\x1b[34m${dynamicUsername} ❯ \x1b[0m`);
|
|
682
|
-
rl.prompt();
|
|
692
|
+
rl.prompt();
|
|
683
693
|
}
|
|
684
694
|
}
|
|
685
695
|
});
|