fluxy-bot 0.5.60 → 0.5.62
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/bin/cli.js +55 -26
- package/package.json +1 -1
- package/workspace/.backend.log +1 -0
package/bin/cli.js
CHANGED
|
@@ -139,6 +139,7 @@ function chooseTunnelMode() {
|
|
|
139
139
|
const options = [
|
|
140
140
|
{
|
|
141
141
|
label: 'Quick Tunnel',
|
|
142
|
+
mode: 'quick',
|
|
142
143
|
tag: 'FREE',
|
|
143
144
|
tagColor: c.green,
|
|
144
145
|
desc: [
|
|
@@ -148,6 +149,7 @@ function chooseTunnelMode() {
|
|
|
148
149
|
},
|
|
149
150
|
{
|
|
150
151
|
label: 'Named Tunnel',
|
|
152
|
+
mode: 'named',
|
|
151
153
|
tag: 'Advanced',
|
|
152
154
|
tagColor: c.yellow,
|
|
153
155
|
desc: [
|
|
@@ -155,15 +157,6 @@ function chooseTunnelMode() {
|
|
|
155
157
|
'Requires a CloudFlare account + domain',
|
|
156
158
|
],
|
|
157
159
|
},
|
|
158
|
-
{
|
|
159
|
-
label: 'Offline',
|
|
160
|
-
tag: 'Local only',
|
|
161
|
-
tagColor: c.dim,
|
|
162
|
-
desc: [
|
|
163
|
-
'No internet access — localhost only',
|
|
164
|
-
`Accessible at ${c.reset}${c.white}http://localhost:3000${c.reset}${c.dim}`,
|
|
165
|
-
],
|
|
166
|
-
},
|
|
167
160
|
];
|
|
168
161
|
|
|
169
162
|
let selected = 0;
|
|
@@ -217,8 +210,7 @@ function chooseTunnelMode() {
|
|
|
217
210
|
process.stdin.setRawMode(false);
|
|
218
211
|
process.stdin.pause();
|
|
219
212
|
process.stdin.removeListener('data', onKey);
|
|
220
|
-
|
|
221
|
-
resolve(modes[selected]);
|
|
213
|
+
resolve(options[selected].mode);
|
|
222
214
|
} else if (key === '\x03') { // Ctrl+C
|
|
223
215
|
process.stdout.write('\n');
|
|
224
216
|
process.exit(0);
|
|
@@ -411,6 +403,28 @@ function banner() {
|
|
|
411
403
|
${c.dim}v${pkg.version} · Self-hosted AI agent${c.reset}`);
|
|
412
404
|
}
|
|
413
405
|
|
|
406
|
+
function tunnelFailedMessage(localUrl) {
|
|
407
|
+
console.log(`
|
|
408
|
+
${c.dim}─────────────────────────────────${c.reset}
|
|
409
|
+
|
|
410
|
+
${c.yellow}⚠${c.reset} ${c.bold}${c.white}Tunnel failed to connect${c.reset}
|
|
411
|
+
|
|
412
|
+
${c.dim}CloudFlare quick tunnels are rate-limited.${c.reset}
|
|
413
|
+
${c.dim}This usually resolves itself after a few minutes.${c.reset}
|
|
414
|
+
|
|
415
|
+
${c.bold}${c.white}Your dashboard is available locally:${c.reset}
|
|
416
|
+
|
|
417
|
+
${c.blue}${c.bold}${link(localUrl)}${c.reset}
|
|
418
|
+
${c.dim}(cmd+click or ctrl+click to open)${c.reset}
|
|
419
|
+
|
|
420
|
+
${c.bold}${c.white}To retry the tunnel:${c.reset}
|
|
421
|
+
${c.pink}fluxy start${c.reset}
|
|
422
|
+
|
|
423
|
+
${c.bold}${c.white}For a persistent tunnel, use a named tunnel:${c.reset}
|
|
424
|
+
${c.pink}fluxy tunnel setup${c.reset}
|
|
425
|
+
`);
|
|
426
|
+
}
|
|
427
|
+
|
|
414
428
|
function finalMessage(tunnelUrl, relayUrl) {
|
|
415
429
|
console.log(`
|
|
416
430
|
${c.dim}─────────────────────────────────${c.reset}
|
|
@@ -547,6 +561,7 @@ function bootServer({ onTunnelUp, onReady } = {}) {
|
|
|
547
561
|
let resolved = false;
|
|
548
562
|
let stderrBuf = '';
|
|
549
563
|
let tunnelFired = false;
|
|
564
|
+
let tunnelFailed = false;
|
|
550
565
|
|
|
551
566
|
// Vite warmup tracking
|
|
552
567
|
let viteWarmResolve;
|
|
@@ -562,6 +577,7 @@ function bootServer({ onTunnelUp, onReady } = {}) {
|
|
|
562
577
|
child,
|
|
563
578
|
tunnelUrl: tunnelUrl || `http://localhost:${config.port}`,
|
|
564
579
|
relayUrl: relayUrl || config.relay?.url || null,
|
|
580
|
+
tunnelFailed,
|
|
565
581
|
viteWarm,
|
|
566
582
|
});
|
|
567
583
|
};
|
|
@@ -588,6 +604,7 @@ function bootServer({ onTunnelUp, onReady } = {}) {
|
|
|
588
604
|
}
|
|
589
605
|
|
|
590
606
|
if (text.includes('__TUNNEL_FAILED__')) {
|
|
607
|
+
tunnelFailed = true;
|
|
591
608
|
doResolve();
|
|
592
609
|
}
|
|
593
610
|
};
|
|
@@ -646,13 +663,13 @@ async function init() {
|
|
|
646
663
|
|
|
647
664
|
const isLinux = os.platform() === 'linux';
|
|
648
665
|
const hasSystemd = isLinux && (() => { try { execSync('systemctl --version', { stdio: 'ignore' }); return true; } catch { return false; } })();
|
|
649
|
-
const hasTunnel = tunnelMode !== 'off';
|
|
650
666
|
|
|
651
667
|
const steps = [
|
|
652
668
|
'Creating config',
|
|
653
|
-
|
|
669
|
+
'Installing cloudflared',
|
|
654
670
|
'Starting server',
|
|
655
|
-
|
|
671
|
+
'Connecting tunnel',
|
|
672
|
+
'Verifying connection',
|
|
656
673
|
'Preparing dashboard',
|
|
657
674
|
...(hasSystemd ? ['Setting up auto-start daemon'] : []),
|
|
658
675
|
];
|
|
@@ -664,12 +681,10 @@ async function init() {
|
|
|
664
681
|
stepper.advance();
|
|
665
682
|
|
|
666
683
|
// Cloudflared (skip for named — already installed during setup)
|
|
667
|
-
if (
|
|
684
|
+
if (tunnelMode !== 'named') {
|
|
668
685
|
await installCloudflared();
|
|
669
|
-
stepper.advance();
|
|
670
|
-
} else if (hasTunnel) {
|
|
671
|
-
stepper.advance(); // named: already installed
|
|
672
686
|
}
|
|
687
|
+
stepper.advance();
|
|
673
688
|
|
|
674
689
|
// Server + Tunnel
|
|
675
690
|
stepper.advance();
|
|
@@ -677,7 +692,6 @@ async function init() {
|
|
|
677
692
|
try {
|
|
678
693
|
result = await bootServer({
|
|
679
694
|
onTunnelUp: (url) => {
|
|
680
|
-
if (!hasTunnel) return;
|
|
681
695
|
stepper.advance(); // Connecting tunnel done
|
|
682
696
|
// Show the direct URL while waiting for the custom domain to become reachable
|
|
683
697
|
if (config.relay?.url) {
|
|
@@ -688,7 +702,6 @@ async function init() {
|
|
|
688
702
|
}
|
|
689
703
|
},
|
|
690
704
|
onReady: () => {
|
|
691
|
-
if (!hasTunnel) return;
|
|
692
705
|
stepper.setInfo([]);
|
|
693
706
|
stepper.advance(); // Verifying connection done
|
|
694
707
|
},
|
|
@@ -699,7 +712,7 @@ async function init() {
|
|
|
699
712
|
console.error(` ${c.dim}${err.message}${c.reset}\n`);
|
|
700
713
|
process.exit(1);
|
|
701
714
|
}
|
|
702
|
-
const { child, tunnelUrl, relayUrl, viteWarm } = result;
|
|
715
|
+
const { child, tunnelUrl, relayUrl, tunnelFailed, viteWarm } = result;
|
|
703
716
|
|
|
704
717
|
// Wait for Vite to finish pre-transforming all modules (with timeout)
|
|
705
718
|
await Promise.race([viteWarm, new Promise(r => setTimeout(r, 30_000))]);
|
|
@@ -716,7 +729,11 @@ async function init() {
|
|
|
716
729
|
});
|
|
717
730
|
stepper.advance();
|
|
718
731
|
stepper.finish();
|
|
719
|
-
|
|
732
|
+
if (tunnelFailed) {
|
|
733
|
+
tunnelFailedMessage(tunnelUrl);
|
|
734
|
+
} else {
|
|
735
|
+
finalMessage(tunnelUrl, relayUrl);
|
|
736
|
+
}
|
|
720
737
|
if (res.status === 0) {
|
|
721
738
|
console.log(` ${c.blue}✔${c.reset} Daemon installed — Fluxy will auto-start on boot.`);
|
|
722
739
|
} else {
|
|
@@ -727,7 +744,11 @@ async function init() {
|
|
|
727
744
|
}
|
|
728
745
|
|
|
729
746
|
stepper.finish();
|
|
730
|
-
|
|
747
|
+
if (tunnelFailed) {
|
|
748
|
+
tunnelFailedMessage(tunnelUrl);
|
|
749
|
+
} else {
|
|
750
|
+
finalMessage(tunnelUrl, relayUrl);
|
|
751
|
+
}
|
|
731
752
|
|
|
732
753
|
child.stdout.on('data', (d) => {
|
|
733
754
|
process.stdout.write(` ${c.dim}${d.toString().trim()}${c.reset}\n`);
|
|
@@ -807,7 +828,7 @@ async function start() {
|
|
|
807
828
|
console.error(` ${c.dim}${err.message}${c.reset}\n`);
|
|
808
829
|
process.exit(1);
|
|
809
830
|
}
|
|
810
|
-
const { child, tunnelUrl, relayUrl, viteWarm } = result;
|
|
831
|
+
const { child, tunnelUrl, relayUrl, tunnelFailed, viteWarm } = result;
|
|
811
832
|
|
|
812
833
|
// Wait for Vite to finish pre-transforming all modules (with timeout)
|
|
813
834
|
await Promise.race([viteWarm, new Promise(r => setTimeout(r, 30_000))]);
|
|
@@ -824,7 +845,11 @@ async function start() {
|
|
|
824
845
|
});
|
|
825
846
|
stepper.advance();
|
|
826
847
|
stepper.finish();
|
|
827
|
-
|
|
848
|
+
if (tunnelFailed) {
|
|
849
|
+
tunnelFailedMessage(tunnelUrl);
|
|
850
|
+
} else {
|
|
851
|
+
finalMessage(tunnelUrl, relayUrl);
|
|
852
|
+
}
|
|
828
853
|
if (res.status === 0) {
|
|
829
854
|
console.log(` ${c.blue}✔${c.reset} Daemon installed — Fluxy will auto-start on boot.`);
|
|
830
855
|
} else {
|
|
@@ -835,7 +860,11 @@ async function start() {
|
|
|
835
860
|
}
|
|
836
861
|
|
|
837
862
|
stepper.finish();
|
|
838
|
-
|
|
863
|
+
if (tunnelFailed) {
|
|
864
|
+
tunnelFailedMessage(tunnelUrl);
|
|
865
|
+
} else {
|
|
866
|
+
finalMessage(tunnelUrl, relayUrl);
|
|
867
|
+
}
|
|
839
868
|
|
|
840
869
|
child.stdout.on('data', (d) => {
|
|
841
870
|
process.stdout.write(` ${c.dim}${d.toString().trim()}${c.reset}\n`);
|
package/package.json
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
[backend] Listening on port 3004
|