flock-core 0.5.0b71__py3-none-any.whl → 0.5.0b75__py3-none-any.whl

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.

Potentially problematic release.


This version of flock-core might be problematic. Click here for more details.

Files changed (62) hide show
  1. flock/agent.py +39 -1
  2. flock/artifacts.py +17 -10
  3. flock/cli.py +1 -1
  4. flock/dashboard/__init__.py +2 -0
  5. flock/dashboard/collector.py +282 -6
  6. flock/dashboard/events.py +6 -0
  7. flock/dashboard/graph_builder.py +563 -0
  8. flock/dashboard/launcher.py +11 -6
  9. flock/dashboard/models/graph.py +156 -0
  10. flock/dashboard/service.py +175 -14
  11. flock/dashboard/static_v2/assets/index-DFRnI_mt.js +111 -0
  12. flock/dashboard/static_v2/assets/index-fPLNdmp1.css +1 -0
  13. flock/dashboard/static_v2/index.html +13 -0
  14. flock/dashboard/websocket.py +2 -2
  15. flock/engines/dspy_engine.py +27 -8
  16. flock/frontend/README.md +6 -6
  17. flock/frontend/src/App.tsx +23 -31
  18. flock/frontend/src/__tests__/integration/graph-snapshot.test.tsx +647 -0
  19. flock/frontend/src/components/details/DetailWindowContainer.tsx +13 -17
  20. flock/frontend/src/components/details/MessageDetailWindow.tsx +439 -0
  21. flock/frontend/src/components/details/MessageHistoryTab.tsx +128 -53
  22. flock/frontend/src/components/details/RunStatusTab.tsx +79 -38
  23. flock/frontend/src/components/graph/AgentNode.test.tsx +3 -1
  24. flock/frontend/src/components/graph/AgentNode.tsx +8 -6
  25. flock/frontend/src/components/graph/GraphCanvas.tsx +13 -8
  26. flock/frontend/src/components/graph/MessageNode.test.tsx +3 -1
  27. flock/frontend/src/components/graph/MessageNode.tsx +16 -3
  28. flock/frontend/src/components/layout/DashboardLayout.tsx +12 -9
  29. flock/frontend/src/components/modules/HistoricalArtifactsModule.tsx +4 -14
  30. flock/frontend/src/components/modules/ModuleRegistry.ts +5 -3
  31. flock/frontend/src/hooks/useModules.ts +12 -4
  32. flock/frontend/src/hooks/usePersistence.ts +5 -3
  33. flock/frontend/src/services/api.ts +3 -19
  34. flock/frontend/src/services/graphService.test.ts +330 -0
  35. flock/frontend/src/services/graphService.ts +75 -0
  36. flock/frontend/src/services/websocket.ts +104 -268
  37. flock/frontend/src/store/filterStore.test.ts +89 -1
  38. flock/frontend/src/store/filterStore.ts +38 -16
  39. flock/frontend/src/store/graphStore.test.ts +538 -173
  40. flock/frontend/src/store/graphStore.ts +374 -465
  41. flock/frontend/src/store/moduleStore.ts +51 -33
  42. flock/frontend/src/store/uiStore.ts +23 -11
  43. flock/frontend/src/types/graph.ts +77 -44
  44. flock/frontend/src/utils/mockData.ts +16 -3
  45. flock/frontend/vite.config.ts +2 -2
  46. flock/orchestrator.py +24 -6
  47. flock/service.py +2 -2
  48. flock/store.py +169 -4
  49. flock/themes/darkmatrix.toml +2 -2
  50. flock/themes/deep.toml +2 -2
  51. flock/themes/neopolitan.toml +4 -4
  52. {flock_core-0.5.0b71.dist-info → flock_core-0.5.0b75.dist-info}/METADATA +1 -1
  53. {flock_core-0.5.0b71.dist-info → flock_core-0.5.0b75.dist-info}/RECORD +56 -53
  54. flock/frontend/src/__tests__/e2e/critical-scenarios.test.tsx +0 -586
  55. flock/frontend/src/__tests__/integration/filtering-e2e.test.tsx +0 -391
  56. flock/frontend/src/__tests__/integration/graph-rendering.test.tsx +0 -640
  57. flock/frontend/src/services/websocket.test.ts +0 -595
  58. flock/frontend/src/utils/transforms.test.ts +0 -860
  59. flock/frontend/src/utils/transforms.ts +0 -323
  60. {flock_core-0.5.0b71.dist-info → flock_core-0.5.0b75.dist-info}/WHEEL +0 -0
  61. {flock_core-0.5.0b71.dist-info → flock_core-0.5.0b75.dist-info}/entry_points.txt +0 -0
  62. {flock_core-0.5.0b71.dist-info → flock_core-0.5.0b75.dist-info}/licenses/LICENSE +0 -0
@@ -1,391 +0,0 @@
1
- import { describe, it, expect, beforeEach } from 'vitest';
2
- import { useFilterStore } from '../../store/filterStore';
3
- import { useGraphStore } from '../../store/graphStore';
4
- import { Message, Agent } from '../../types/graph';
5
-
6
- describe('Filtering Integration E2E', () => {
7
- beforeEach(() => {
8
- // Clear all stores
9
- const filterStore = useFilterStore.getState();
10
- filterStore.clearFilters();
11
- filterStore.updateAvailableCorrelationIds([]);
12
-
13
- const graphStore = useGraphStore.getState();
14
- // Clear all data
15
- graphStore.agents.clear();
16
- graphStore.messages.clear();
17
- graphStore.events.length = 0;
18
- graphStore.runs.clear();
19
- });
20
-
21
- describe('Correlation ID filtering', () => {
22
- it('should filter messages by correlation ID', () => {
23
- const graphStore = useGraphStore.getState();
24
- const filterStore = useFilterStore.getState();
25
-
26
- // Add test agents
27
- const agent1: Agent = {
28
- id: 'agent-1',
29
- name: 'Agent 1',
30
- status: 'running',
31
- subscriptions: ['test'],
32
- lastActive: Date.now(),
33
- sentCount: 0,
34
- recvCount: 0,
35
- };
36
- graphStore.addAgent(agent1);
37
-
38
- // Add messages with different correlation IDs
39
- const message1: Message = {
40
- id: 'msg-1',
41
- type: 'test',
42
- payload: {},
43
- timestamp: Date.now(),
44
- correlationId: 'corr-123',
45
- producedBy: 'agent-1',
46
- };
47
- const message2: Message = {
48
- id: 'msg-2',
49
- type: 'test',
50
- payload: {},
51
- timestamp: Date.now(),
52
- correlationId: 'corr-456',
53
- producedBy: 'agent-1',
54
- };
55
- graphStore.addMessage(message1);
56
- graphStore.addMessage(message2);
57
-
58
- // Generate graph
59
- graphStore.generateBlackboardViewGraph();
60
-
61
- // Initially all nodes should be visible
62
- let state = useGraphStore.getState();
63
- expect(state.nodes.filter((n) => !n.hidden)).toHaveLength(2);
64
-
65
- // Set correlation ID filter
66
- filterStore.setCorrelationId('corr-123');
67
- graphStore.applyFilters();
68
-
69
- // Should only show message with corr-123
70
- state = useGraphStore.getState();
71
- const visibleNodes = state.nodes.filter((n) => !n.hidden);
72
- expect(visibleNodes).toHaveLength(1);
73
- expect(visibleNodes[0]?.id).toBe('msg-1');
74
- });
75
-
76
- it('should show all messages when correlation ID filter is cleared', () => {
77
- const graphStore = useGraphStore.getState();
78
- const filterStore = useFilterStore.getState();
79
-
80
- const agent1: Agent = {
81
- id: 'agent-1',
82
- name: 'Agent 1',
83
- status: 'running',
84
- subscriptions: ['test'],
85
- lastActive: Date.now(),
86
- sentCount: 0,
87
- recvCount: 0,
88
- };
89
- graphStore.addAgent(agent1);
90
-
91
- const message1: Message = {
92
- id: 'msg-1',
93
- type: 'test',
94
- payload: {},
95
- timestamp: Date.now(),
96
- correlationId: 'corr-123',
97
- producedBy: 'agent-1',
98
- };
99
- const message2: Message = {
100
- id: 'msg-2',
101
- type: 'test',
102
- payload: {},
103
- timestamp: Date.now(),
104
- correlationId: 'corr-456',
105
- producedBy: 'agent-1',
106
- };
107
- graphStore.addMessage(message1);
108
- graphStore.addMessage(message2);
109
- graphStore.generateBlackboardViewGraph();
110
-
111
- // Apply and then clear filter
112
- filterStore.setCorrelationId('corr-123');
113
- graphStore.applyFilters();
114
-
115
- filterStore.setCorrelationId(null);
116
- graphStore.applyFilters();
117
-
118
- const state = useGraphStore.getState();
119
- expect(state.nodes.filter((n) => !n.hidden)).toHaveLength(2);
120
- });
121
- });
122
-
123
- describe('Time range filtering', () => {
124
- it('should filter messages by time range (last 5 minutes)', () => {
125
- const graphStore = useGraphStore.getState();
126
- const filterStore = useFilterStore.getState();
127
-
128
- const agent1: Agent = {
129
- id: 'agent-1',
130
- name: 'Agent 1',
131
- status: 'running',
132
- subscriptions: ['test'],
133
- lastActive: Date.now(),
134
- sentCount: 0,
135
- recvCount: 0,
136
- };
137
- graphStore.addAgent(agent1);
138
-
139
- const now = Date.now();
140
- const message1: Message = {
141
- id: 'msg-1',
142
- type: 'test',
143
- payload: {},
144
- timestamp: now - 2 * 60 * 1000, // 2 minutes ago
145
- correlationId: 'corr-123',
146
- producedBy: 'agent-1',
147
- };
148
- const message2: Message = {
149
- id: 'msg-2',
150
- type: 'test',
151
- payload: {},
152
- timestamp: now - 10 * 60 * 1000, // 10 minutes ago
153
- correlationId: 'corr-123',
154
- producedBy: 'agent-1',
155
- };
156
- graphStore.addMessage(message1);
157
- graphStore.addMessage(message2);
158
- graphStore.generateBlackboardViewGraph();
159
-
160
- // Set time range to last 5 minutes
161
- filterStore.setTimeRange({ preset: 'last5min' });
162
- graphStore.applyFilters();
163
-
164
- const state = useGraphStore.getState();
165
- const visibleNodes = state.nodes.filter((n) => !n.hidden);
166
- expect(visibleNodes).toHaveLength(1);
167
- expect(visibleNodes[0]?.id).toBe('msg-1');
168
- });
169
-
170
- it('should filter messages by custom time range', () => {
171
- const graphStore = useGraphStore.getState();
172
- const filterStore = useFilterStore.getState();
173
-
174
- const agent1: Agent = {
175
- id: 'agent-1',
176
- name: 'Agent 1',
177
- status: 'running',
178
- subscriptions: ['test'],
179
- lastActive: Date.now(),
180
- sentCount: 0,
181
- recvCount: 0,
182
- };
183
- graphStore.addAgent(agent1);
184
-
185
- const now = Date.now();
186
- const message1: Message = {
187
- id: 'msg-1',
188
- type: 'test',
189
- payload: {},
190
- timestamp: now - 30 * 60 * 1000, // 30 minutes ago
191
- correlationId: 'corr-123',
192
- producedBy: 'agent-1',
193
- };
194
- const message2: Message = {
195
- id: 'msg-2',
196
- type: 'test',
197
- payload: {},
198
- timestamp: now - 90 * 60 * 1000, // 90 minutes ago
199
- correlationId: 'corr-123',
200
- producedBy: 'agent-1',
201
- };
202
- graphStore.addMessage(message1);
203
- graphStore.addMessage(message2);
204
- graphStore.generateBlackboardViewGraph();
205
-
206
- // Set custom time range: last 60 minutes
207
- filterStore.setTimeRange({
208
- preset: 'custom',
209
- start: now - 60 * 60 * 1000,
210
- end: now,
211
- });
212
- graphStore.applyFilters();
213
-
214
- const state = useGraphStore.getState();
215
- const visibleNodes = state.nodes.filter((n) => !n.hidden);
216
- expect(visibleNodes).toHaveLength(1);
217
- expect(visibleNodes[0]?.id).toBe('msg-1');
218
- });
219
- });
220
-
221
- describe('Combined filtering', () => {
222
- it('should apply both correlation ID and time range filters', () => {
223
- const graphStore = useGraphStore.getState();
224
- const filterStore = useFilterStore.getState();
225
-
226
- const agent1: Agent = {
227
- id: 'agent-1',
228
- name: 'Agent 1',
229
- status: 'running',
230
- subscriptions: ['test'],
231
- lastActive: Date.now(),
232
- sentCount: 0,
233
- recvCount: 0,
234
- };
235
- graphStore.addAgent(agent1);
236
-
237
- const now = Date.now();
238
- const messages: Message[] = [
239
- {
240
- id: 'msg-1',
241
- type: 'test',
242
- payload: {},
243
- timestamp: now - 2 * 60 * 1000, // 2 min ago, corr-123
244
- correlationId: 'corr-123',
245
- producedBy: 'agent-1',
246
- },
247
- {
248
- id: 'msg-2',
249
- type: 'test',
250
- payload: {},
251
- timestamp: now - 2 * 60 * 1000, // 2 min ago, corr-456
252
- correlationId: 'corr-456',
253
- producedBy: 'agent-1',
254
- },
255
- {
256
- id: 'msg-3',
257
- type: 'test',
258
- payload: {},
259
- timestamp: now - 10 * 60 * 1000, // 10 min ago, corr-123
260
- correlationId: 'corr-123',
261
- producedBy: 'agent-1',
262
- },
263
- ];
264
- messages.forEach((m) => graphStore.addMessage(m));
265
- graphStore.generateBlackboardViewGraph();
266
-
267
- // Apply both filters
268
- filterStore.setCorrelationId('corr-123');
269
- filterStore.setTimeRange({ preset: 'last5min' });
270
- graphStore.applyFilters();
271
-
272
- // Should only show msg-1 (corr-123 AND within 5 min)
273
- const state = useGraphStore.getState();
274
- const visibleNodes = state.nodes.filter((n) => !n.hidden);
275
- expect(visibleNodes).toHaveLength(1);
276
- expect(visibleNodes[0]?.id).toBe('msg-1');
277
- });
278
- });
279
-
280
- describe('Agent view filtering', () => {
281
- it('should hide agents with no visible messages', () => {
282
- const graphStore = useGraphStore.getState();
283
- const filterStore = useFilterStore.getState();
284
-
285
- const agent1: Agent = {
286
- id: 'agent-1',
287
- name: 'Agent 1',
288
- status: 'running',
289
- subscriptions: ['test'],
290
- lastActive: Date.now(),
291
- sentCount: 0,
292
- recvCount: 0,
293
- };
294
- const agent2: Agent = {
295
- id: 'agent-2',
296
- name: 'Agent 2',
297
- status: 'running',
298
- subscriptions: ['test'],
299
- lastActive: Date.now(),
300
- sentCount: 0,
301
- recvCount: 0,
302
- };
303
- graphStore.addAgent(agent1);
304
- graphStore.addAgent(agent2);
305
-
306
- const message1: Message = {
307
- id: 'msg-1',
308
- type: 'test',
309
- payload: {},
310
- timestamp: Date.now(),
311
- correlationId: 'corr-123',
312
- producedBy: 'agent-1',
313
- };
314
- const message2: Message = {
315
- id: 'msg-2',
316
- type: 'test',
317
- payload: {},
318
- timestamp: Date.now(),
319
- correlationId: 'corr-456',
320
- producedBy: 'agent-2',
321
- };
322
- graphStore.addMessage(message1);
323
- graphStore.addMessage(message2);
324
- graphStore.generateAgentViewGraph();
325
-
326
- // Filter to only show corr-123
327
- filterStore.setCorrelationId('corr-123');
328
- graphStore.applyFilters();
329
-
330
- const state = useGraphStore.getState();
331
- const visibleNodes = state.nodes.filter((n) => !n.hidden);
332
-
333
- // Agent nodes remain visible but metrics reflect filtered artifacts
334
- expect(visibleNodes).toHaveLength(2);
335
- const agent1Node = visibleNodes.find((n) => n.id === 'agent-1');
336
- const agent2Node = visibleNodes.find((n) => n.id === 'agent-2');
337
- expect(agent1Node).toBeDefined();
338
- expect(agent2Node).toBeDefined();
339
- });
340
- });
341
-
342
- describe('Edge visibility', () => {
343
- it('should hide edges when connected nodes are hidden', () => {
344
- const graphStore = useGraphStore.getState();
345
- const filterStore = useFilterStore.getState();
346
-
347
- const agent1: Agent = {
348
- id: 'agent-1',
349
- name: 'Agent 1',
350
- status: 'running',
351
- subscriptions: ['test'],
352
- lastActive: Date.now(),
353
- sentCount: 0,
354
- recvCount: 0,
355
- };
356
- graphStore.addAgent(agent1);
357
-
358
- const message1: Message = {
359
- id: 'msg-1',
360
- type: 'test',
361
- payload: {},
362
- timestamp: Date.now(),
363
- correlationId: 'corr-123',
364
- producedBy: 'agent-1',
365
- };
366
- const message2: Message = {
367
- id: 'msg-2',
368
- type: 'test',
369
- payload: {},
370
- timestamp: Date.now(),
371
- correlationId: 'corr-456',
372
- producedBy: 'agent-1',
373
- };
374
- graphStore.addMessage(message1);
375
- graphStore.addMessage(message2);
376
- graphStore.generateBlackboardViewGraph();
377
-
378
- // Apply filter
379
- filterStore.setCorrelationId('corr-123');
380
- graphStore.applyFilters();
381
-
382
- const state = useGraphStore.getState();
383
- const hiddenNodes = state.nodes.filter((n) => n.hidden);
384
- const hiddenEdges = state.edges.filter((e) => e.hidden);
385
-
386
- // Should have some hidden nodes and edges
387
- expect(hiddenNodes.length).toBeGreaterThan(0);
388
- expect(hiddenEdges.length).toBeGreaterThanOrEqual(0);
389
- });
390
- });
391
- });