fluxy-bot 0.1.39 → 0.1.41

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.
@@ -6,6 +6,7 @@ import DashboardLayout from './components/Layout/DashboardLayout';
6
6
  import DashboardPage from './components/Dashboard/DashboardPage';
7
7
  import ChatView from './components/Chat/ChatView';
8
8
  import FluxyFab from './components/FluxyFab';
9
+ import BuildOverlay from './components/BuildOverlay';
9
10
  import OnboardWizard from './components/Onboard/OnboardWizard';
10
11
  import {
11
12
  Sheet,
@@ -116,6 +117,7 @@ export default function App() {
116
117
  </SheetContent>
117
118
  </Sheet>
118
119
 
120
+ <BuildOverlay ws={ws} />
119
121
  <FluxyFab onClick={() => setChatOpen((o) => !o)} />
120
122
 
121
123
  {/* Onboarding wizard overlay */}
@@ -0,0 +1,83 @@
1
+ import { useState, useEffect } from 'react';
2
+ import type { WsClient } from '../lib/ws-client';
3
+
4
+ interface Props {
5
+ ws: WsClient | null;
6
+ }
7
+
8
+ export default function BuildOverlay({ ws }: Props) {
9
+ const [state, setState] = useState<'idle' | 'building' | 'error'>('idle');
10
+ const [error, setError] = useState('');
11
+ const [copied, setCopied] = useState(false);
12
+
13
+ useEffect(() => {
14
+ if (!ws) return;
15
+
16
+ const unsubs = [
17
+ ws.on('build:start', () => {
18
+ setState('building');
19
+ setError('');
20
+ setCopied(false);
21
+ }),
22
+ ws.on('build:complete', () => {
23
+ setState('idle');
24
+ // Auto-refresh after a brief delay so the user sees the transition
25
+ setTimeout(() => window.location.reload(), 500);
26
+ }),
27
+ ws.on('build:error', (data: { error: string }) => {
28
+ setState('error');
29
+ setError(data.error || 'Unknown build error');
30
+ }),
31
+ ];
32
+
33
+ return () => unsubs.forEach((u) => u());
34
+ }, [ws]);
35
+
36
+ if (state === 'idle') return null;
37
+
38
+ const handleCopy = () => {
39
+ navigator.clipboard.writeText(error).then(() => {
40
+ setCopied(true);
41
+ setTimeout(() => setCopied(false), 2000);
42
+ });
43
+ };
44
+
45
+ return (
46
+ <div className="fixed inset-0 z-[100] bg-black/80 backdrop-blur-sm flex items-center justify-center p-6">
47
+ {state === 'building' && (
48
+ <div className="text-center">
49
+ <div className="inline-block h-8 w-8 animate-spin rounded-full border-2 border-white/20 border-t-white mb-4" />
50
+ <p className="text-sm text-white/80">Building...</p>
51
+ </div>
52
+ )}
53
+
54
+ {state === 'error' && (
55
+ <div className="w-full max-w-lg bg-zinc-900 rounded-lg border border-red-500/30 overflow-hidden">
56
+ <div className="flex items-center justify-between px-4 py-3 border-b border-red-500/20">
57
+ <span className="text-sm font-medium text-red-400">Build Failed</span>
58
+ <div className="flex gap-2">
59
+ <button
60
+ onClick={handleCopy}
61
+ className="px-3 py-1 text-xs rounded bg-white/10 hover:bg-white/20 text-white/80 transition-colors"
62
+ >
63
+ {copied ? 'Copied' : 'Copy'}
64
+ </button>
65
+ <button
66
+ onClick={() => setState('idle')}
67
+ className="px-3 py-1 text-xs rounded bg-white/10 hover:bg-white/20 text-white/80 transition-colors"
68
+ >
69
+ Dismiss
70
+ </button>
71
+ </div>
72
+ </div>
73
+ <pre className="p-4 text-xs text-red-300/90 overflow-auto max-h-64 whitespace-pre-wrap font-mono">
74
+ {error}
75
+ </pre>
76
+ <p className="px-4 pb-3 text-xs text-white/40">
77
+ Copy this error and paste it in the chat to fix
78
+ </p>
79
+ </div>
80
+ )}
81
+ </div>
82
+ );
83
+ }
@@ -100,9 +100,7 @@ export function useChat(ws: WsClient | null) {
100
100
  }
101
101
  })
102
102
  .catch(() => {
103
- // Conversation gone — clear
104
- setConversationId(null);
105
- fetch('/api/context/clear', { method: 'POST' }).catch(() => {});
103
+ // Network error (worker may be restarting) don't clear, just ignore
106
104
  });
107
105
  }, [conversationId]);
108
106
 
@@ -223,13 +221,14 @@ export function useChat(ws: WsClient | null) {
223
221
  }, [ws, conversationId]);
224
222
 
225
223
  const clearContext = useCallback(() => {
224
+ // Clear UI state only — starts a fresh conversation on next message.
225
+ // Old messages stay in DB (used as context for the agent).
226
226
  setMessages([]);
227
227
  setConversationId(null);
228
228
  setStreamBuffer('');
229
229
  setStreaming(false);
230
230
  setTools([]);
231
231
  prevConvId.current = null;
232
- loaded.current = false;
233
232
  fetch('/api/context/clear', { method: 'POST' }).catch(() => {});
234
233
  }, []);
235
234