flock-core 0.5.0b71__py3-none-any.whl → 0.5.1__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 (65) 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/__init__.py +1 -0
  10. flock/dashboard/models/graph.py +156 -0
  11. flock/dashboard/service.py +175 -14
  12. flock/dashboard/static_v2/assets/index-DFRnI_mt.js +111 -0
  13. flock/dashboard/static_v2/assets/index-fPLNdmp1.css +1 -0
  14. flock/dashboard/static_v2/index.html +13 -0
  15. flock/dashboard/websocket.py +2 -2
  16. flock/engines/dspy_engine.py +294 -20
  17. flock/frontend/README.md +6 -6
  18. flock/frontend/src/App.tsx +23 -31
  19. flock/frontend/src/__tests__/integration/graph-snapshot.test.tsx +647 -0
  20. flock/frontend/src/components/details/DetailWindowContainer.tsx +13 -17
  21. flock/frontend/src/components/details/MessageDetailWindow.tsx +439 -0
  22. flock/frontend/src/components/details/MessageHistoryTab.tsx +128 -53
  23. flock/frontend/src/components/details/RunStatusTab.tsx +79 -38
  24. flock/frontend/src/components/graph/AgentNode.test.tsx +3 -1
  25. flock/frontend/src/components/graph/AgentNode.tsx +8 -6
  26. flock/frontend/src/components/graph/GraphCanvas.tsx +13 -8
  27. flock/frontend/src/components/graph/MessageNode.test.tsx +3 -1
  28. flock/frontend/src/components/graph/MessageNode.tsx +16 -3
  29. flock/frontend/src/components/layout/DashboardLayout.tsx +12 -9
  30. flock/frontend/src/components/modules/HistoricalArtifactsModule.tsx +4 -14
  31. flock/frontend/src/components/modules/ModuleRegistry.ts +5 -3
  32. flock/frontend/src/hooks/useModules.ts +12 -4
  33. flock/frontend/src/hooks/usePersistence.ts +5 -3
  34. flock/frontend/src/services/api.ts +3 -19
  35. flock/frontend/src/services/graphService.test.ts +330 -0
  36. flock/frontend/src/services/graphService.ts +75 -0
  37. flock/frontend/src/services/websocket.ts +104 -268
  38. flock/frontend/src/store/filterStore.test.ts +89 -1
  39. flock/frontend/src/store/filterStore.ts +38 -16
  40. flock/frontend/src/store/graphStore.test.ts +538 -173
  41. flock/frontend/src/store/graphStore.ts +374 -465
  42. flock/frontend/src/store/moduleStore.ts +51 -33
  43. flock/frontend/src/store/uiStore.ts +23 -11
  44. flock/frontend/src/types/graph.ts +77 -44
  45. flock/frontend/src/utils/mockData.ts +16 -3
  46. flock/frontend/vite.config.ts +2 -2
  47. flock/orchestrator.py +27 -7
  48. flock/patches/__init__.py +5 -0
  49. flock/patches/dspy_streaming_patch.py +82 -0
  50. flock/service.py +2 -2
  51. flock/store.py +169 -4
  52. flock/themes/darkmatrix.toml +2 -2
  53. flock/themes/deep.toml +2 -2
  54. flock/themes/neopolitan.toml +4 -4
  55. {flock_core-0.5.0b71.dist-info → flock_core-0.5.1.dist-info}/METADATA +20 -13
  56. {flock_core-0.5.0b71.dist-info → flock_core-0.5.1.dist-info}/RECORD +59 -53
  57. flock/frontend/src/__tests__/e2e/critical-scenarios.test.tsx +0 -586
  58. flock/frontend/src/__tests__/integration/filtering-e2e.test.tsx +0 -391
  59. flock/frontend/src/__tests__/integration/graph-rendering.test.tsx +0 -640
  60. flock/frontend/src/services/websocket.test.ts +0 -595
  61. flock/frontend/src/utils/transforms.test.ts +0 -860
  62. flock/frontend/src/utils/transforms.ts +0 -323
  63. {flock_core-0.5.0b71.dist-info → flock_core-0.5.1.dist-info}/WHEEL +0 -0
  64. {flock_core-0.5.0b71.dist-info → flock_core-0.5.1.dist-info}/entry_points.txt +0 -0
  65. {flock_core-0.5.0b71.dist-info → flock_core-0.5.1.dist-info}/licenses/LICENSE +0 -0
@@ -5,11 +5,10 @@ import { measureRenderTime } from './utils/performance';
5
5
  import { initializeWebSocket } from './services/websocket';
6
6
  import { registerModules } from './components/modules/registerModules';
7
7
  import { useKeyboardShortcuts } from './hooks/useKeyboardShortcuts';
8
- import { fetchRegisteredAgents, fetchArtifactSummary, fetchArtifacts } from './services/api';
8
+ import { fetchArtifactSummary, fetchArtifacts } from './services/api';
9
9
  import { useGraphStore } from './store/graphStore';
10
10
  import { useUIStore } from './store/uiStore';
11
11
  import { useFilterStore } from './store/filterStore';
12
- import { mapArtifactToMessage } from './utils/artifacts';
13
12
  import { indexedDBService } from './services/indexeddb';
14
13
 
15
14
  // Register modules once at module load time
@@ -38,9 +37,10 @@ const App: React.FC = () => {
38
37
  await indexedDBService.initialize();
39
38
 
40
39
  const filterStore = useFilterStore.getState();
41
- const graphStore = useGraphStore.getState();
42
- const uiStore = useUIStore.getState();
43
40
 
41
+ // UI Optimization Migration (Phase 2/4 - Spec 002): Backend-driven architecture
42
+ // Fetch artifact summary to populate filter facets
43
+ // Note: Node positions are now loaded automatically in generateAgentViewGraph/generateBlackboardViewGraph
44
44
  const summary = await fetchArtifactSummary();
45
45
  filterStore.setSummary(summary);
46
46
  filterStore.updateAvailableFacets({
@@ -50,17 +50,9 @@ const App: React.FC = () => {
50
50
  visibilities: Object.keys(summary.by_visibility),
51
51
  });
52
52
 
53
+ // Fetch correlation IDs for filter dropdown
53
54
  const artifactResponse = await fetchArtifacts({ limit: 200, embedMeta: true });
54
- const messages = artifactResponse.items.map(mapArtifactToMessage);
55
- if (messages.length > 0) {
56
- graphStore.batchUpdate({ messages });
57
- if (uiStore.mode === 'blackboard') {
58
- graphStore.generateBlackboardViewGraph();
59
- } else {
60
- graphStore.generateAgentViewGraph();
61
- }
62
- graphStore.applyFilters();
63
-
55
+ if (artifactResponse.items.length > 0) {
64
56
  const correlationMetadata = new Map<string, { correlation_id: string; first_seen: number; artifact_count: number; run_count: number }>();
65
57
  artifactResponse.items.forEach((item) => {
66
58
  if (!item.correlation_id) return;
@@ -82,44 +74,44 @@ const App: React.FC = () => {
82
74
  filterStore.updateAvailableCorrelationIds(Array.from(correlationMetadata.values()));
83
75
  }
84
76
  }
77
+
78
+ // Generate initial graph view from backend snapshot
79
+ // (GraphCanvas useEffect will handle initial render based on mode)
80
+ // No need to manually trigger here - happens in GraphCanvas mount
85
81
  } catch (error) {
86
82
  console.error('[App] Failed to load historical artifacts:', error);
87
83
  }
88
84
  };
89
85
 
90
- // Load registered agents from orchestrator
91
- // This pre-populates the graph with all agent nodes before any events occur
92
- const loadInitialAgents = async () => {
86
+ // UI Optimization Migration (Phase 2/4 - Spec 002): Simplified initial graph load
87
+ // Backend snapshot includes all agents + artifacts + edges in a single call
88
+ const loadInitialGraph = async () => {
93
89
  try {
94
- console.log('[App] Fetching registered agents...');
95
- const agents = await fetchRegisteredAgents();
96
- console.log(`[App] Loaded ${agents.length} registered agents`);
97
-
90
+ console.log('[App] Loading initial graph from backend snapshot...');
98
91
  const graphStore = useGraphStore.getState();
99
92
  const uiStore = useUIStore.getState();
100
93
 
101
- // Add all agents to the store
102
- agents.forEach(agent => graphStore.addAgent(agent));
103
-
104
- // Generate initial graph layout based on current view mode
94
+ // Fetch complete graph snapshot from backend (includes agents + artifacts + edges)
105
95
  if (uiStore.mode === 'agent') {
106
- graphStore.generateAgentViewGraph();
96
+ await graphStore.generateAgentViewGraph();
107
97
  } else {
108
- graphStore.generateBlackboardViewGraph();
98
+ await graphStore.generateBlackboardViewGraph();
109
99
  }
100
+
101
+ console.log('[App] Initial graph loaded from backend');
110
102
  } catch (error) {
111
- console.error('[App] Failed to load registered agents:', error);
112
- // Graceful degradation: agents will appear when they activate via WebSocket
103
+ console.error('[App] Failed to load initial graph:', error);
104
+ // Graceful degradation: graph will populate as WebSocket events arrive
113
105
  }
114
106
  };
115
107
 
116
- const wsUrl = import.meta.env.VITE_WS_URL || 'ws://localhost:8000/ws';
108
+ const wsUrl = import.meta.env.VITE_WS_URL || 'ws://localhost:8344/ws';
117
109
  const wsClient = initializeWebSocket(wsUrl);
118
110
  let cancelled = false;
119
111
 
120
112
  const bootstrap = async () => {
121
113
  await loadHistoricalData();
122
- await loadInitialAgents();
114
+ await loadInitialGraph();
123
115
 
124
116
  if (!cancelled) {
125
117
  wsClient.connect();