fleetbo-cockpit-cli 1.0.201 → 1.0.203
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 +23 -69
- package/package.json +1 -1
package/cli.js
CHANGED
|
@@ -706,6 +706,8 @@ if (command === 'alex') {
|
|
|
706
706
|
const providerLabel = aiProvider === 'anthropic' ? 'Anthropic' : 'Google AI';
|
|
707
707
|
const modelLabel = aiModel && aiModel !== 'auto' ? aiModel : 'auto';
|
|
708
708
|
|
|
709
|
+
process.stdout.write(`[ALEX_ONLINE:${dynamicUsername}]\n`);
|
|
710
|
+
|
|
709
711
|
console.log('');
|
|
710
712
|
console.log('\x1b[90m┌─────────────────────────────────────────────────────────┐\x1b[0m');
|
|
711
713
|
console.log('\x1b[90m│ │\x1b[0m');
|
|
@@ -751,118 +753,70 @@ if (command === 'alex') {
|
|
|
751
753
|
|
|
752
754
|
// READY
|
|
753
755
|
console.log('');
|
|
754
|
-
console.log('\x1b[32mAlex ❯\x1b[0m
|
|
756
|
+
console.log('\x1b[32mAlex ❯\x1b[0m Secure channel established. Awaiting instructions...');
|
|
755
757
|
console.log('');
|
|
756
758
|
|
|
759
|
+
// 1. ON SUPPRIME LE PROMPT VISUEL (Plus de "Pilot ❯")
|
|
757
760
|
const rl = readline.createInterface({
|
|
758
761
|
input: process.stdin,
|
|
759
|
-
output: process.stdout
|
|
760
|
-
prompt: `\x1b[34m${dynamicUsername} ❯ \x1b[0m`
|
|
762
|
+
output: process.stdout
|
|
761
763
|
});
|
|
762
|
-
|
|
763
|
-
process.stdout.write('\n\x1b[F');
|
|
764
|
-
rl.prompt();
|
|
765
764
|
|
|
766
765
|
// LE BOUCLIER ANTI CTRL+C (SIGINT)
|
|
767
766
|
rl.on('SIGINT', () => {
|
|
768
767
|
console.log('\n\x1b[90m Alex session aborted (Ctrl+C).\x1b[0m');
|
|
769
768
|
process.stdout.write('[ALEX_OFFLINE]\n'); // Prévient React !
|
|
770
769
|
rl.close();
|
|
771
|
-
process.exit(0);
|
|
770
|
+
process.exit(0);
|
|
772
771
|
});
|
|
773
772
|
|
|
774
773
|
let standardBuffer = [];
|
|
775
774
|
let isProcessing = false;
|
|
776
|
-
let isPasteMode = false;
|
|
777
|
-
let pasteBlockerTimer = null;
|
|
778
775
|
|
|
779
776
|
const executePrompt = async (text) => {
|
|
780
777
|
if (['exit', 'quit'].includes(text.toLowerCase())) {
|
|
781
778
|
console.log('\n\x1b[90m Alex session closed.\x1b[0m');
|
|
782
|
-
process.stdout.write('[ALEX_OFFLINE]\n');
|
|
779
|
+
process.stdout.write('[ALEX_OFFLINE]\n');
|
|
783
780
|
rl.close();
|
|
784
781
|
return;
|
|
785
782
|
}
|
|
783
|
+
|
|
786
784
|
if (text !== "") {
|
|
787
785
|
if (text.length > 4000) {
|
|
788
786
|
console.log(`\n\x1b[31m⛔ [Alex Safety] Mission rejected: Excessive size (${text.length}/4000 characters).\x1b[0m`);
|
|
789
|
-
rl.setPrompt(`\x1b[34m${dynamicUsername} ❯ \x1b[0m`);
|
|
790
|
-
rl.prompt();
|
|
791
787
|
return;
|
|
792
788
|
}
|
|
793
|
-
isProcessing = true;
|
|
794
|
-
rl.setPrompt("");
|
|
795
789
|
|
|
796
|
-
|
|
797
|
-
//process.stdout.write('[START_LOAD]\n');
|
|
790
|
+
isProcessing = true;
|
|
798
791
|
|
|
792
|
+
// 2. On exécute la requête sans faire de "rl.setPrompt()"
|
|
799
793
|
await processAlexRequest(text);
|
|
800
794
|
|
|
801
|
-
// 🛑 FIN DU PROCESSUS : On éteint l'overlay
|
|
802
|
-
//process.stdout.write('[END_LOAD]\n');
|
|
803
|
-
|
|
804
795
|
isProcessing = false;
|
|
805
|
-
console.log('');
|
|
806
|
-
rl.setPrompt(`\x1b[34m${dynamicUsername} ❯ \x1b[0m`);
|
|
807
|
-
rl.prompt();
|
|
808
|
-
} else {
|
|
809
|
-
rl.setPrompt(`\x1b[34m${dynamicUsername} ❯ \x1b[0m`);
|
|
810
|
-
rl.prompt();
|
|
796
|
+
console.log(''); // Petit saut de ligne esthétique quand Alex a fini
|
|
811
797
|
}
|
|
812
798
|
};
|
|
813
799
|
|
|
814
|
-
//
|
|
800
|
+
// 3. RÉCEPTEUR SILENCIEUX (Plus de "rl.prompt()" qui pollue l'écran)
|
|
801
|
+
let pasteTimer = null;
|
|
802
|
+
|
|
815
803
|
rl.on('line', async (line) => {
|
|
816
804
|
if (isProcessing) return;
|
|
817
805
|
|
|
818
|
-
// 1. SI LE MODE COLLAGE EST ACTIF
|
|
819
|
-
if (isPasteMode) {
|
|
820
|
-
if (['/s', '/send', 'eof'].includes(line.trim().toLowerCase())) {
|
|
821
|
-
const finalPrompt = standardBuffer.join('\n').trim();
|
|
822
|
-
standardBuffer = [];
|
|
823
|
-
isPasteMode = false;
|
|
824
|
-
await executePrompt(finalPrompt);
|
|
825
|
-
} else {
|
|
826
|
-
standardBuffer.push(line);
|
|
827
|
-
}
|
|
828
|
-
return;
|
|
829
|
-
}
|
|
830
|
-
|
|
831
|
-
// 2. ACTIVATION DU MODE COLLAGE (/p)
|
|
832
|
-
if (['/paste', '/p'].includes(line.trim().toLowerCase())) {
|
|
833
|
-
isPasteMode = true;
|
|
834
|
-
standardBuffer = []; // Sécurité : on vide tout
|
|
835
|
-
console.log('\x1b[36m [MULTILINE MODE] Paste your content below. Type /s on a new line to submit.\x1b[0m');
|
|
836
|
-
rl.setPrompt("");
|
|
837
|
-
return;
|
|
838
|
-
}
|
|
839
|
-
|
|
840
|
-
// 3. LE BOUCLIER ANTI-COLLAGE SAUVAGE (Mode Chat Classique)
|
|
841
806
|
standardBuffer.push(line);
|
|
842
807
|
|
|
843
|
-
|
|
844
|
-
if (pasteBlockerTimer) clearTimeout(pasteBlockerTimer);
|
|
808
|
+
if (pasteTimer) clearTimeout(pasteTimer);
|
|
845
809
|
|
|
846
|
-
|
|
847
|
-
|
|
810
|
+
pasteTimer = setTimeout(async () => {
|
|
811
|
+
pasteTimer = null;
|
|
848
812
|
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
} else {
|
|
855
|
-
// ✅ CAS NORMAL : 1 seule touche Entrée humaine
|
|
856
|
-
const finalPrompt = standardBuffer[0].trim();
|
|
857
|
-
standardBuffer = [];
|
|
858
|
-
|
|
859
|
-
if (finalPrompt === "") {
|
|
860
|
-
rl.prompt();
|
|
861
|
-
} else {
|
|
862
|
-
await executePrompt(finalPrompt);
|
|
863
|
-
}
|
|
813
|
+
const finalPrompt = standardBuffer.join('\n').trim();
|
|
814
|
+
standardBuffer = [];
|
|
815
|
+
|
|
816
|
+
if (finalPrompt !== "") {
|
|
817
|
+
await executePrompt(finalPrompt);
|
|
864
818
|
}
|
|
865
|
-
},
|
|
819
|
+
}, 30);
|
|
866
820
|
});
|
|
867
821
|
};
|
|
868
822
|
|