fluxy-bot 0.1.42 → 0.1.44

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,7 +6,7 @@ interface Props {
6
6
  }
7
7
 
8
8
  export default function BuildOverlay({ ws }: Props) {
9
- const [state, setState] = useState<'idle' | 'building' | 'error'>('idle');
9
+ const [toast, setToast] = useState(false);
10
10
  const [error, setError] = useState('');
11
11
  const [copied, setCopied] = useState(false);
12
12
 
@@ -14,31 +14,18 @@ export default function BuildOverlay({ ws }: Props) {
14
14
  if (!ws) return;
15
15
 
16
16
  const unsubs = [
17
- ws.on('build:start', () => {
18
- setState('building');
19
- setError('');
20
- setCopied(false);
21
- }),
22
- ws.on('build:complete', () => {
23
- // Wait for API to be healthy before reloading (worker may be restarting)
24
- const checkAndReload = () => {
25
- fetch('/api/health')
26
- .then((r) => { if (r.ok) window.location.reload(); else setTimeout(checkAndReload, 500); })
27
- .catch(() => setTimeout(checkAndReload, 500));
28
- };
29
- checkAndReload();
17
+ ws.on('changes:applied', () => {
18
+ setToast(true);
19
+ setTimeout(() => setToast(false), 3000);
30
20
  }),
31
21
  ws.on('build:error', (data: { error: string }) => {
32
- setState('error');
33
- setError(data.error || 'Unknown build error');
22
+ setError(data.error || 'Unknown error');
34
23
  }),
35
24
  ];
36
25
 
37
26
  return () => unsubs.forEach((u) => u());
38
27
  }, [ws]);
39
28
 
40
- if (state === 'idle') return null;
41
-
42
29
  const handleCopy = () => {
43
30
  navigator.clipboard.writeText(error).then(() => {
44
31
  setCopied(true);
@@ -47,18 +34,19 @@ export default function BuildOverlay({ ws }: Props) {
47
34
  };
48
35
 
49
36
  return (
50
- <div className="absolute inset-0 z-50 bg-black/80 backdrop-blur-sm flex items-center justify-center p-6">
51
- {state === 'building' && (
52
- <div className="text-center">
53
- <div className="inline-block h-8 w-8 animate-spin rounded-full border-2 border-white/20 border-t-white mb-4" />
54
- <p className="text-sm text-white/80">Building...</p>
37
+ <>
38
+ {/* Toast notification */}
39
+ {toast && (
40
+ <div className="fixed bottom-4 right-4 z-50 px-4 py-2 bg-zinc-800 border border-zinc-700 rounded-lg shadow-lg text-sm text-zinc-300 animate-in fade-in slide-in-from-bottom-2 duration-200">
41
+ Dashboard updated
55
42
  </div>
56
43
  )}
57
44
 
58
- {state === 'error' && (
59
- <div className="w-full max-w-lg bg-zinc-900 rounded-lg border border-red-500/30 overflow-hidden">
45
+ {/* HMR error non-blocking, dismissible */}
46
+ {error && (
47
+ <div className="fixed bottom-4 right-4 z-50 w-96 max-w-[calc(100vw-2rem)] bg-zinc-900 rounded-lg border border-red-500/30 shadow-lg overflow-hidden">
60
48
  <div className="flex items-center justify-between px-4 py-3 border-b border-red-500/20">
61
- <span className="text-sm font-medium text-red-400">Build Failed</span>
49
+ <span className="text-sm font-medium text-red-400">HMR Error</span>
62
50
  <div className="flex gap-2">
63
51
  <button
64
52
  onClick={handleCopy}
@@ -67,14 +55,14 @@ export default function BuildOverlay({ ws }: Props) {
67
55
  {copied ? 'Copied' : 'Copy'}
68
56
  </button>
69
57
  <button
70
- onClick={() => setState('idle')}
58
+ onClick={() => setError('')}
71
59
  className="px-3 py-1 text-xs rounded bg-white/10 hover:bg-white/20 text-white/80 transition-colors"
72
60
  >
73
61
  Dismiss
74
62
  </button>
75
63
  </div>
76
64
  </div>
77
- <pre className="p-4 text-xs text-red-300/90 overflow-auto max-h-64 whitespace-pre-wrap font-mono">
65
+ <pre className="p-4 text-xs text-red-300/90 overflow-auto max-h-48 whitespace-pre-wrap font-mono">
78
66
  {error}
79
67
  </pre>
80
68
  <p className="px-4 pb-3 text-xs text-white/40">
@@ -82,6 +70,6 @@ export default function BuildOverlay({ ws }: Props) {
82
70
  </p>
83
71
  </div>
84
72
  )}
85
- </div>
73
+ </>
86
74
  );
87
75
  }
@@ -132,7 +132,8 @@ export function useChat(ws: WsClient | null) {
132
132
  if (!ws) return;
133
133
 
134
134
  const unsubs = [
135
- ws.on('bot:typing', () => {
135
+ ws.on('bot:typing', (data: { conversationId?: string }) => {
136
+ if (data.conversationId) setConversationId(data.conversationId);
136
137
  setStreaming(true);
137
138
  setTools([]);
138
139
  }),
@@ -20,7 +20,7 @@ export class WsClient {
20
20
 
21
21
  constructor(url?: string) {
22
22
  const proto = location.protocol === 'https:' ? 'wss:' : 'ws:';
23
- const host = import.meta.env.DEV ? 'localhost:3000' : location.host;
23
+ const host = location.host;
24
24
  this.url = url ?? `${proto}//${host}/ws`;
25
25
  }
26
26