fleetbo-cockpit-cli 1.0.127 → 1.0.129
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 +30 -49
- package/package.json +1 -1
package/cli.js
CHANGED
|
@@ -250,8 +250,8 @@ if (command === 'alex') {
|
|
|
250
250
|
const initialPrompt = args.slice(1).join(' ');
|
|
251
251
|
|
|
252
252
|
const processAlexRequest = async (prompt) => {
|
|
253
|
-
if (prompt.length >
|
|
254
|
-
console.log('\n\x1b[31m⛔ [Alex Safety] Request too long (' + prompt.length + '/
|
|
253
|
+
if (prompt.length > 1000) {
|
|
254
|
+
console.log('\n\x1b[31m⛔ [Alex Safety] Request too long (' + prompt.length + '/1000 chars).\x1b[0m');
|
|
255
255
|
return;
|
|
256
256
|
}
|
|
257
257
|
|
|
@@ -639,67 +639,48 @@ 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 submitTimer = null;
|
|
645
|
-
let hintShown = false;
|
|
646
|
-
|
|
647
|
-
const doSubmit = async () => {
|
|
648
|
-
if (submitTimer) { clearTimeout(submitTimer); submitTimer = null; }
|
|
649
|
-
if (isProcessing || inputBuffer.trim() === "") return;
|
|
650
|
-
|
|
651
|
-
const finalPrompt = inputBuffer.trim();
|
|
652
|
-
inputBuffer = "";
|
|
653
|
-
hintShown = false;
|
|
654
|
-
|
|
655
|
-
if (finalPrompt.length > 4000) {
|
|
656
|
-
console.log(`\n\x1b[31m⛔ [Alex Safety] Mission rejected: Excessive size (${finalPrompt.length}/4000 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
|
-
};
|
|
642
|
+
let inputBuffer = "";
|
|
643
|
+
let isProcessing = false;
|
|
671
644
|
|
|
672
645
|
rl.on('line', async (line) => {
|
|
673
|
-
if (isProcessing) return;
|
|
646
|
+
if (isProcessing) return;
|
|
674
647
|
|
|
675
648
|
const trimmedLine = line.trim();
|
|
676
649
|
|
|
677
|
-
if (['exit', 'quit'].includes(trimmedLine.toLowerCase())) {
|
|
650
|
+
if (['exit', 'quit'].includes(trimmedLine.toLowerCase())) {
|
|
678
651
|
console.log('\n\x1b[90m Alex session closed.\x1b[0m');
|
|
679
|
-
rl.close();
|
|
680
|
-
return;
|
|
652
|
+
rl.close();
|
|
653
|
+
return;
|
|
681
654
|
}
|
|
682
655
|
|
|
683
656
|
if (trimmedLine !== "") {
|
|
684
|
-
// Ligne non-vide : annule timer, réinitialise hintShown, accumule
|
|
685
|
-
if (submitTimer) { clearTimeout(submitTimer); submitTimer = null; }
|
|
686
|
-
hintShown = false;
|
|
687
657
|
inputBuffer += (inputBuffer ? "\n" : "") + line;
|
|
688
|
-
|
|
658
|
+
rl.setPrompt("\x1b[90m ↵ again to send\x1b[0m");
|
|
659
|
+
rl.prompt();
|
|
660
|
+
}
|
|
661
|
+
else {
|
|
689
662
|
if (inputBuffer.trim() !== "") {
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
process.stdout.write("\x1b[90m ↵ to confirm & send\x1b[0m\n");
|
|
663
|
+
const finalPrompt = inputBuffer.trim();
|
|
664
|
+
inputBuffer = "";
|
|
665
|
+
|
|
666
|
+
if (finalPrompt.length > 1000) {
|
|
667
|
+
console.log(`\n\x1b[31m⛔ [Alex Safety] Mission rejected: Excessive size (${finalPrompt.length}/1000 characters).\x1b[0m`);
|
|
668
|
+
rl.setPrompt(`\x1b[34m${dynamicUsername} ❯ \x1b[0m`);
|
|
669
|
+
rl.prompt();
|
|
670
|
+
return;
|
|
699
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();
|
|
700
681
|
} else {
|
|
701
682
|
rl.setPrompt(`\x1b[34m${dynamicUsername} ❯ \x1b[0m`);
|
|
702
|
-
rl.prompt();
|
|
683
|
+
rl.prompt();
|
|
703
684
|
}
|
|
704
685
|
}
|
|
705
686
|
});
|