fleetbo-cockpit-cli 1.0.200 → 1.0.202
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 -43
- package/package.json +1 -1
package/cli.js
CHANGED
|
@@ -640,6 +640,11 @@ if (command === 'alex') {
|
|
|
640
640
|
let hasAiKey = false;
|
|
641
641
|
let aiProvider = null;
|
|
642
642
|
let aiModel = null;
|
|
643
|
+
|
|
644
|
+
// ASTUCE : On demande gentiment à l'IDE de noter qu'Alex est en cours de démarrage
|
|
645
|
+
if (process.env.VITE_FLEETBO_DEV === 'true' || true) { // Force l'exécution en dev
|
|
646
|
+
process.stdout.write('[ALEX_BOOTING]\n');
|
|
647
|
+
}
|
|
643
648
|
|
|
644
649
|
while (attempts < maxAttempts && !isReady) {
|
|
645
650
|
try {
|
|
@@ -649,6 +654,8 @@ if (command === 'alex') {
|
|
|
649
654
|
|
|
650
655
|
if (validation.data?.isRunning) {
|
|
651
656
|
isReady = true;
|
|
657
|
+
// 🟢 ASTUCE : On confirme que le moteur est allumé
|
|
658
|
+
process.stdout.write('[ALEX_ONLINE]\n');
|
|
652
659
|
dynamicUsername = validation.data.username || 'Pilot';
|
|
653
660
|
hasAiKey = validation.data.hasAiKey || false;
|
|
654
661
|
aiProvider = validation.data.aiProvider || null;
|
|
@@ -699,6 +706,8 @@ if (command === 'alex') {
|
|
|
699
706
|
const providerLabel = aiProvider === 'anthropic' ? 'Anthropic' : 'Google AI';
|
|
700
707
|
const modelLabel = aiModel && aiModel !== 'auto' ? aiModel : 'auto';
|
|
701
708
|
|
|
709
|
+
process.stdout.write(`[ALEX_ONLINE:${dynamicUsername}]\n`);
|
|
710
|
+
|
|
702
711
|
console.log('');
|
|
703
712
|
console.log('\x1b[90m┌─────────────────────────────────────────────────────────┐\x1b[0m');
|
|
704
713
|
console.log('\x1b[90m│ │\x1b[0m');
|
|
@@ -756,6 +765,14 @@ if (command === 'alex') {
|
|
|
756
765
|
process.stdout.write('\n\x1b[F');
|
|
757
766
|
rl.prompt();
|
|
758
767
|
|
|
768
|
+
// LE BOUCLIER ANTI CTRL+C (SIGINT)
|
|
769
|
+
rl.on('SIGINT', () => {
|
|
770
|
+
console.log('\n\x1b[90m Alex session aborted (Ctrl+C).\x1b[0m');
|
|
771
|
+
process.stdout.write('[ALEX_OFFLINE]\n'); // Prévient React !
|
|
772
|
+
rl.close();
|
|
773
|
+
process.exit(0); // Coupe proprement le processus
|
|
774
|
+
});
|
|
775
|
+
|
|
759
776
|
let standardBuffer = [];
|
|
760
777
|
let isProcessing = false;
|
|
761
778
|
let isPasteMode = false;
|
|
@@ -764,6 +781,7 @@ if (command === 'alex') {
|
|
|
764
781
|
const executePrompt = async (text) => {
|
|
765
782
|
if (['exit', 'quit'].includes(text.toLowerCase())) {
|
|
766
783
|
console.log('\n\x1b[90m Alex session closed.\x1b[0m');
|
|
784
|
+
process.stdout.write('[ALEX_OFFLINE]\n'); // ASTUCE : Moteur coupé
|
|
767
785
|
rl.close();
|
|
768
786
|
return;
|
|
769
787
|
}
|
|
@@ -795,58 +813,31 @@ if (command === 'alex') {
|
|
|
795
813
|
}
|
|
796
814
|
};
|
|
797
815
|
|
|
798
|
-
//
|
|
816
|
+
// LE NOUVEAU RÉCEPTEUR INTELLIGENT (Sans commandes /p ni /s)
|
|
817
|
+
let pasteTimer = null;
|
|
818
|
+
|
|
799
819
|
rl.on('line', async (line) => {
|
|
800
820
|
if (isProcessing) return;
|
|
801
821
|
|
|
802
|
-
//
|
|
803
|
-
if (isPasteMode) {
|
|
804
|
-
if (['/s', '/send', 'eof'].includes(line.trim().toLowerCase())) {
|
|
805
|
-
const finalPrompt = standardBuffer.join('\n').trim();
|
|
806
|
-
standardBuffer = [];
|
|
807
|
-
isPasteMode = false;
|
|
808
|
-
await executePrompt(finalPrompt);
|
|
809
|
-
} else {
|
|
810
|
-
standardBuffer.push(line);
|
|
811
|
-
}
|
|
812
|
-
return;
|
|
813
|
-
}
|
|
814
|
-
|
|
815
|
-
// 2. ACTIVATION DU MODE COLLAGE (/p)
|
|
816
|
-
if (['/paste', '/p'].includes(line.trim().toLowerCase())) {
|
|
817
|
-
isPasteMode = true;
|
|
818
|
-
standardBuffer = []; // Sécurité : on vide tout
|
|
819
|
-
console.log('\x1b[36m [MULTILINE MODE] Paste your content below. Type /s on a new line to submit.\x1b[0m');
|
|
820
|
-
rl.setPrompt("");
|
|
821
|
-
return;
|
|
822
|
-
}
|
|
823
|
-
|
|
824
|
-
// 3. LE BOUCLIER ANTI-COLLAGE SAUVAGE (Mode Chat Classique)
|
|
822
|
+
// On empile toutes les lignes reçues (qu'elles viennent du clavier ou de React)
|
|
825
823
|
standardBuffer.push(line);
|
|
826
824
|
|
|
827
|
-
|
|
828
|
-
if (pasteBlockerTimer) clearTimeout(pasteBlockerTimer);
|
|
825
|
+
if (pasteTimer) clearTimeout(pasteTimer);
|
|
829
826
|
|
|
830
|
-
|
|
831
|
-
|
|
827
|
+
// Si plusieurs lignes arrivent en moins de 30ms (vitesse d'envoi de React),
|
|
828
|
+
// on les fusionne silencieusement en un seul gros prompt !
|
|
829
|
+
pasteTimer = setTimeout(async () => {
|
|
830
|
+
pasteTimer = null;
|
|
832
831
|
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
rl.prompt();
|
|
832
|
+
const finalPrompt = standardBuffer.join('\n').trim();
|
|
833
|
+
standardBuffer = [];
|
|
834
|
+
|
|
835
|
+
if (finalPrompt === "") {
|
|
836
|
+
rl.prompt();
|
|
838
837
|
} else {
|
|
839
|
-
|
|
840
|
-
const finalPrompt = standardBuffer[0].trim();
|
|
841
|
-
standardBuffer = [];
|
|
842
|
-
|
|
843
|
-
if (finalPrompt === "") {
|
|
844
|
-
rl.prompt();
|
|
845
|
-
} else {
|
|
846
|
-
await executePrompt(finalPrompt);
|
|
847
|
-
}
|
|
838
|
+
await executePrompt(finalPrompt);
|
|
848
839
|
}
|
|
849
|
-
},
|
|
840
|
+
}, 30);
|
|
850
841
|
});
|
|
851
842
|
};
|
|
852
843
|
|