fluxy-bot 0.2.20 → 0.2.21

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/client/index.html CHANGED
@@ -8,6 +8,22 @@
8
8
  </head>
9
9
  <body class="bg-background text-foreground">
10
10
  <div id="root"></div>
11
+ <script>
12
+ // Global error handler — catches errors outside React's Error Boundary
13
+ // (e.g., Vite compilation errors, module loading failures)
14
+ window.addEventListener('error', function (e) {
15
+ // Only show if root is empty (React didn't mount or crashed before mounting)
16
+ var root = document.getElementById('root');
17
+ if (root && root.children.length === 0) {
18
+ root.innerHTML =
19
+ '<div style="background:#222122;color:#fff;display:flex;flex-direction:column;align-items:center;justify-content:center;height:100dvh;width:100vw;position:fixed;inset:0;z-index:50;font-family:system-ui,-apple-system,sans-serif;text-align:center;padding:24px">' +
20
+ '<video src="/fluxy_say_hi.webm" autoplay loop muted playsinline style="height:120px;width:120px;border-radius:50%;object-fit:cover;margin-bottom:32px"></video>' +
21
+ '<h1 style="font-size:20px;font-weight:600;margin-bottom:8px">Your app crashed</h1>' +
22
+ '<p style="font-size:14px;color:rgba(255,255,255,0.5);max-width:320px;line-height:1.5">Ask the agent to fix it using the chat.</p>' +
23
+ '</div>';
24
+ }
25
+ });
26
+ </script>
11
27
  <script type="module" src="/src/main.tsx"></script>
12
28
  <script>if('serviceWorker' in navigator){navigator.serviceWorker.getRegistrations().then(r=>r.forEach(w=>w.unregister()))}</script>
13
29
  <script src="/fluxy/widget.js"></script>
@@ -6,13 +6,19 @@ import OnboardWizard from './components/Onboard/OnboardWizard';
6
6
 
7
7
  function DashboardError() {
8
8
  return (
9
- <div className="flex items-center justify-center h-dvh p-6 text-center">
10
- <div>
11
- <h1 className="text-xl font-semibold mb-2">Something went wrong</h1>
12
- <p className="text-sm text-muted-foreground">
13
- The dashboard encountered an error. Use the Fluxy button to continue chatting.
14
- </p>
15
- </div>
9
+ <div style={{ background: '#222122', color: '#fff', display: 'flex', flexDirection: 'column', alignItems: 'center', justifyContent: 'center', height: '100dvh', width: '100vw', position: 'fixed', inset: 0, zIndex: 50, fontFamily: 'system-ui, -apple-system, sans-serif', textAlign: 'center', padding: '24px' }}>
10
+ <video
11
+ src="/fluxy_say_hi.webm"
12
+ autoPlay
13
+ loop
14
+ muted
15
+ playsInline
16
+ style={{ height: 120, width: 120, borderRadius: '50%', objectFit: 'cover', marginBottom: 32 }}
17
+ />
18
+ <h1 style={{ fontSize: 20, fontWeight: 600, marginBottom: 8 }}>Your app crashed</h1>
19
+ <p style={{ fontSize: 14, color: 'rgba(255,255,255,0.5)', maxWidth: 320, lineHeight: 1.5 }}>
20
+ Ask the agent to fix it using the chat.
21
+ </p>
16
22
  </div>
17
23
  );
18
24
  }
@@ -52,6 +58,11 @@ export default function App() {
52
58
  setTimeout(() => setRebuildState('idle'), 5000);
53
59
  } else if (e.data?.type === 'fluxy:hmr-update') {
54
60
  console.log('[dashboard] File changed — reloading...');
61
+ // Preserve widget open state so chat isn't disrupted
62
+ const panel = document.getElementById('fluxy-widget-panel');
63
+ if (panel?.classList.contains('open')) {
64
+ sessionStorage.setItem('fluxy_widget_open', '1');
65
+ }
55
66
  setTimeout(() => location.reload(), 800);
56
67
  }
57
68
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "fluxy-bot",
3
- "version": "0.2.20",
3
+ "version": "0.2.21",
4
4
  "description": "Self-hosted AI bot — run your own AI assistant from anywhere",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -117,7 +117,7 @@ export async function startFluxyAgentQuery(
117
117
  prompt: sdkPrompt,
118
118
  options: {
119
119
  model,
120
- cwd: PKG_DIR,
120
+ cwd: path.join(PKG_DIR, 'client'),
121
121
  permissionMode: 'bypassPermissions',
122
122
  allowDangerouslySkipPermissions: true,
123
123
  maxTurns: 50,
@@ -72,4 +72,12 @@
72
72
  document.addEventListener('keydown', function (e) {
73
73
  if (e.key === 'Escape' && isOpen) toggle();
74
74
  });
75
+
76
+ // Restore open state after HMR reload (so chat isn't disrupted)
77
+ try {
78
+ if (sessionStorage.getItem('fluxy_widget_open') === '1') {
79
+ sessionStorage.removeItem('fluxy_widget_open');
80
+ toggle();
81
+ }
82
+ } catch (e) {}
75
83
  })();