claude-mpm 4.2.44__py3-none-any.whl → 4.3.0__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.
Files changed (153) hide show
  1. claude_mpm/VERSION +1 -1
  2. claude_mpm/agents/BASE_PM.md +77 -405
  3. claude_mpm/agents/{INSTRUCTIONS.md → INSTRUCTIONS_OLD_DEPRECATED.md} +75 -1
  4. claude_mpm/agents/OUTPUT_STYLE.md +0 -39
  5. claude_mpm/agents/PM_INSTRUCTIONS.md +122 -0
  6. claude_mpm/agents/WORKFLOW.md +74 -323
  7. claude_mpm/agents/frontmatter_validator.py +20 -12
  8. claude_mpm/agents/templates/nextjs_engineer.json +277 -0
  9. claude_mpm/agents/templates/prompt-engineer.json +294 -0
  10. claude_mpm/agents/templates/python_engineer.json +289 -0
  11. claude_mpm/agents/templates/react_engineer.json +11 -3
  12. claude_mpm/agents/templates/security.json +50 -9
  13. claude_mpm/cli/commands/agents.py +2 -2
  14. claude_mpm/cli/commands/uninstall.py +1 -3
  15. claude_mpm/cli/interactive/agent_wizard.py +3 -3
  16. claude_mpm/cli/parsers/agent_manager_parser.py +3 -3
  17. claude_mpm/cli/parsers/agents_parser.py +1 -1
  18. claude_mpm/constants.py +1 -1
  19. claude_mpm/core/error_handler.py +2 -4
  20. claude_mpm/core/file_utils.py +4 -12
  21. claude_mpm/core/framework_loader.py +72 -24
  22. claude_mpm/core/log_manager.py +60 -5
  23. claude_mpm/core/logger.py +1 -1
  24. claude_mpm/core/logging_utils.py +36 -18
  25. claude_mpm/core/unified_agent_registry.py +18 -4
  26. claude_mpm/dashboard/react/components/DataInspector/DataInspector.module.css +188 -0
  27. claude_mpm/dashboard/react/components/EventViewer/EventViewer.module.css +156 -0
  28. claude_mpm/dashboard/react/components/shared/ConnectionStatus.module.css +38 -0
  29. claude_mpm/dashboard/react/components/shared/FilterBar.module.css +92 -0
  30. claude_mpm/dashboard/static/archive/activity_dashboard_fixed.html +248 -0
  31. claude_mpm/dashboard/static/archive/activity_dashboard_test.html +61 -0
  32. claude_mpm/dashboard/static/archive/test_activity_connection.html +179 -0
  33. claude_mpm/dashboard/static/archive/test_claude_tree_tab.html +68 -0
  34. claude_mpm/dashboard/static/archive/test_dashboard.html +409 -0
  35. claude_mpm/dashboard/static/archive/test_dashboard_fixed.html +519 -0
  36. claude_mpm/dashboard/static/archive/test_dashboard_verification.html +181 -0
  37. claude_mpm/dashboard/static/archive/test_file_data.html +315 -0
  38. claude_mpm/dashboard/static/archive/test_file_tree_empty_state.html +243 -0
  39. claude_mpm/dashboard/static/archive/test_file_tree_fix.html +234 -0
  40. claude_mpm/dashboard/static/archive/test_file_tree_rename.html +117 -0
  41. claude_mpm/dashboard/static/archive/test_file_tree_tab.html +115 -0
  42. claude_mpm/dashboard/static/archive/test_file_viewer.html +224 -0
  43. claude_mpm/dashboard/static/archive/test_final_activity.html +220 -0
  44. claude_mpm/dashboard/static/archive/test_tab_fix.html +139 -0
  45. claude_mpm/dashboard/static/built/assets/events.DjpNxWNo.css +1 -0
  46. claude_mpm/dashboard/static/built/components/activity-tree.js +1 -1
  47. claude_mpm/dashboard/static/built/components/agent-hierarchy.js +777 -0
  48. claude_mpm/dashboard/static/built/components/agent-inference.js +1 -1
  49. claude_mpm/dashboard/static/built/components/build-tracker.js +333 -0
  50. claude_mpm/dashboard/static/built/components/code-simple.js +857 -0
  51. claude_mpm/dashboard/static/built/components/code-tree/tree-breadcrumb.js +353 -0
  52. claude_mpm/dashboard/static/built/components/code-tree/tree-constants.js +235 -0
  53. claude_mpm/dashboard/static/built/components/code-tree/tree-search.js +409 -0
  54. claude_mpm/dashboard/static/built/components/code-tree/tree-utils.js +435 -0
  55. claude_mpm/dashboard/static/built/components/code-viewer.js +2 -1076
  56. claude_mpm/dashboard/static/built/components/connection-debug.js +654 -0
  57. claude_mpm/dashboard/static/built/components/diff-viewer.js +891 -0
  58. claude_mpm/dashboard/static/built/components/event-processor.js +1 -1
  59. claude_mpm/dashboard/static/built/components/event-viewer.js +1 -1
  60. claude_mpm/dashboard/static/built/components/export-manager.js +1 -1
  61. claude_mpm/dashboard/static/built/components/file-change-tracker.js +443 -0
  62. claude_mpm/dashboard/static/built/components/file-change-viewer.js +690 -0
  63. claude_mpm/dashboard/static/built/components/file-tool-tracker.js +1 -1
  64. claude_mpm/dashboard/static/built/components/module-viewer.js +1 -1
  65. claude_mpm/dashboard/static/built/components/nav-bar.js +145 -0
  66. claude_mpm/dashboard/static/built/components/page-structure.js +429 -0
  67. claude_mpm/dashboard/static/built/components/session-manager.js +1 -1
  68. claude_mpm/dashboard/static/built/components/ui-state-manager.js +2 -465
  69. claude_mpm/dashboard/static/built/components/working-directory.js +1 -1
  70. claude_mpm/dashboard/static/built/connection-manager.js +536 -0
  71. claude_mpm/dashboard/static/built/dashboard.js +1 -1
  72. claude_mpm/dashboard/static/built/extension-error-handler.js +164 -0
  73. claude_mpm/dashboard/static/built/react/events.js +30 -0
  74. claude_mpm/dashboard/static/built/shared/dom-helpers.js +396 -0
  75. claude_mpm/dashboard/static/built/shared/event-bus.js +330 -0
  76. claude_mpm/dashboard/static/built/shared/event-filter-service.js +540 -0
  77. claude_mpm/dashboard/static/built/shared/logger.js +385 -0
  78. claude_mpm/dashboard/static/built/shared/page-structure.js +251 -0
  79. claude_mpm/dashboard/static/built/shared/tooltip-service.js +253 -0
  80. claude_mpm/dashboard/static/built/socket-client.js +1 -1
  81. claude_mpm/dashboard/static/built/tab-isolation-fix.js +185 -0
  82. claude_mpm/dashboard/static/css/dashboard.css +28 -5
  83. claude_mpm/dashboard/static/dist/assets/events.DjpNxWNo.css +1 -0
  84. claude_mpm/dashboard/static/dist/components/activity-tree.js +1 -1
  85. claude_mpm/dashboard/static/dist/components/agent-inference.js +1 -1
  86. claude_mpm/dashboard/static/dist/components/code-viewer.js +2 -0
  87. claude_mpm/dashboard/static/dist/components/event-processor.js +1 -1
  88. claude_mpm/dashboard/static/dist/components/event-viewer.js +1 -1
  89. claude_mpm/dashboard/static/dist/components/export-manager.js +1 -1
  90. claude_mpm/dashboard/static/dist/components/file-tool-tracker.js +1 -1
  91. claude_mpm/dashboard/static/dist/components/module-viewer.js +1 -1
  92. claude_mpm/dashboard/static/dist/components/session-manager.js +1 -1
  93. claude_mpm/dashboard/static/dist/components/working-directory.js +1 -1
  94. claude_mpm/dashboard/static/dist/dashboard.js +1 -1
  95. claude_mpm/dashboard/static/dist/react/events.js +30 -0
  96. claude_mpm/dashboard/static/dist/socket-client.js +1 -1
  97. claude_mpm/dashboard/static/events.html +607 -0
  98. claude_mpm/dashboard/static/index.html +713 -0
  99. claude_mpm/dashboard/static/js/components/activity-tree.js +3 -17
  100. claude_mpm/dashboard/static/js/components/agent-hierarchy.js +4 -1
  101. claude_mpm/dashboard/static/js/components/agent-inference.js +3 -0
  102. claude_mpm/dashboard/static/js/components/build-tracker.js +8 -0
  103. claude_mpm/dashboard/static/js/components/code-viewer.js +306 -66
  104. claude_mpm/dashboard/static/js/components/event-processor.js +3 -0
  105. claude_mpm/dashboard/static/js/components/event-viewer.js +39 -2
  106. claude_mpm/dashboard/static/js/components/export-manager.js +3 -0
  107. claude_mpm/dashboard/static/js/components/file-tool-tracker.js +30 -10
  108. claude_mpm/dashboard/static/js/components/socket-manager.js +4 -0
  109. claude_mpm/dashboard/static/js/components/ui-state-manager.js +285 -85
  110. claude_mpm/dashboard/static/js/components/working-directory.js +3 -0
  111. claude_mpm/dashboard/static/js/dashboard.js +61 -33
  112. claude_mpm/dashboard/static/js/socket-client.js +12 -8
  113. claude_mpm/dashboard/static/js/stores/dashboard-store.js +562 -0
  114. claude_mpm/dashboard/static/js/tab-isolation-fix.js +185 -0
  115. claude_mpm/dashboard/static/legacy/activity.html +736 -0
  116. claude_mpm/dashboard/static/legacy/agents.html +786 -0
  117. claude_mpm/dashboard/static/legacy/files.html +747 -0
  118. claude_mpm/dashboard/static/legacy/tools.html +831 -0
  119. claude_mpm/dashboard/static/monitors-index.html +218 -0
  120. claude_mpm/dashboard/static/monitors.html +431 -0
  121. claude_mpm/dashboard/static/production/events.html +659 -0
  122. claude_mpm/dashboard/static/production/main.html +715 -0
  123. claude_mpm/dashboard/static/production/monitors.html +483 -0
  124. claude_mpm/dashboard/static/socket.io.min.js +7 -0
  125. claude_mpm/dashboard/static/socket.io.v4.8.1.backup.js +7 -0
  126. claude_mpm/dashboard/static/test-archive/dashboard.html +635 -0
  127. claude_mpm/dashboard/static/test-archive/debug-events.html +147 -0
  128. claude_mpm/dashboard/static/test-archive/test-navigation.html +256 -0
  129. claude_mpm/dashboard/static/test-archive/test-react-exports.html +180 -0
  130. claude_mpm/dashboard/templates/index.html +79 -9
  131. claude_mpm/hooks/claude_hooks/services/connection_manager_http.py +1 -1
  132. claude_mpm/services/agents/deployment/agent_discovery_service.py +3 -0
  133. claude_mpm/services/agents/deployment/agent_template_builder.py +285 -26
  134. claude_mpm/services/agents/deployment/agent_validator.py +3 -0
  135. claude_mpm/services/agents/deployment/validation/template_validator.py +13 -4
  136. claude_mpm/services/agents/local_template_manager.py +2 -7
  137. claude_mpm/services/monitor/daemon.py +1 -2
  138. claude_mpm/services/monitor/daemon_manager.py +2 -7
  139. claude_mpm/services/monitor/event_emitter.py +6 -2
  140. claude_mpm/services/monitor/handlers/code_analysis.py +4 -6
  141. claude_mpm/services/monitor/handlers/hooks.py +2 -6
  142. claude_mpm/services/monitor/server.py +27 -4
  143. claude_mpm/tools/code_tree_analyzer.py +2 -4
  144. claude_mpm/utils/log_cleanup.py +612 -0
  145. {claude_mpm-4.2.44.dist-info → claude_mpm-4.3.0.dist-info}/METADATA +1 -1
  146. {claude_mpm-4.2.44.dist-info → claude_mpm-4.3.0.dist-info}/RECORD +151 -83
  147. claude_mpm/dashboard/static/test-browser-monitor.html +0 -470
  148. claude_mpm/dashboard/static/test-simple.html +0 -97
  149. /claude_mpm/dashboard/static/{test_debug.html → test-archive/test_debug.html} +0 -0
  150. {claude_mpm-4.2.44.dist-info → claude_mpm-4.3.0.dist-info}/WHEEL +0 -0
  151. {claude_mpm-4.2.44.dist-info → claude_mpm-4.3.0.dist-info}/entry_points.txt +0 -0
  152. {claude_mpm-4.2.44.dist-info → claude_mpm-4.3.0.dist-info}/licenses/LICENSE +0 -0
  153. {claude_mpm-4.2.44.dist-info → claude_mpm-4.3.0.dist-info}/top_level.txt +0 -0
@@ -0,0 +1,179 @@
1
+ <!DOCTYPE html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="UTF-8">
5
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
+ <title>Activity Dashboard Connection Test</title>
7
+
8
+ <!-- Load Socket.IO from CDN directly -->
9
+ <script src="https://cdn.socket.io/4.8.1/socket.io.min.js"></script>
10
+
11
+ <style>
12
+ body {
13
+ font-family: monospace;
14
+ background: #1e293b;
15
+ color: #e0e0e0;
16
+ padding: 20px;
17
+ }
18
+ .status {
19
+ padding: 10px;
20
+ border: 1px solid #333;
21
+ margin: 10px 0;
22
+ border-radius: 5px;
23
+ }
24
+ .connected { background: #065f46; }
25
+ .disconnected { background: #7f1d1d; }
26
+ .log {
27
+ background: #0f172a;
28
+ padding: 10px;
29
+ margin: 10px 0;
30
+ border-radius: 5px;
31
+ max-height: 400px;
32
+ overflow-y: auto;
33
+ }
34
+ .log-entry {
35
+ margin: 2px 0;
36
+ padding: 2px;
37
+ }
38
+ .error { color: #f87171; }
39
+ .success { color: #4ade80; }
40
+ .info { color: #60a5fa; }
41
+ </style>
42
+ </head>
43
+ <body>
44
+ <h1>Activity Dashboard Connection Test</h1>
45
+
46
+ <div id="status" class="status disconnected">
47
+ Status: <span id="status-text">Initializing...</span>
48
+ </div>
49
+
50
+ <div class="log" id="log">
51
+ <div class="log-entry info">Starting connection test...</div>
52
+ </div>
53
+
54
+ <button onclick="testConnection()">Test Connection</button>
55
+ <button onclick="clearLog()">Clear Log</button>
56
+
57
+ <script>
58
+ const logEl = document.getElementById('log');
59
+ const statusEl = document.getElementById('status');
60
+ const statusTextEl = document.getElementById('status-text');
61
+
62
+ function log(message, type = 'info') {
63
+ const entry = document.createElement('div');
64
+ entry.className = `log-entry ${type}`;
65
+ entry.textContent = `[${new Date().toLocaleTimeString()}] ${message}`;
66
+ logEl.appendChild(entry);
67
+ logEl.scrollTop = logEl.scrollHeight;
68
+ console.log(`[${type}] ${message}`);
69
+ }
70
+
71
+ function updateStatus(connected, text) {
72
+ statusEl.className = `status ${connected ? 'connected' : 'disconnected'}`;
73
+ statusTextEl.textContent = text;
74
+ }
75
+
76
+ function clearLog() {
77
+ logEl.innerHTML = '';
78
+ log('Log cleared', 'info');
79
+ }
80
+
81
+ function testConnection() {
82
+ log('Testing connection to Socket.IO server...', 'info');
83
+
84
+ // Check if Socket.IO is loaded
85
+ if (typeof io === 'undefined') {
86
+ log('ERROR: Socket.IO library not loaded!', 'error');
87
+ updateStatus(false, 'Socket.IO not loaded');
88
+ return;
89
+ }
90
+
91
+ log(`Socket.IO version: ${io.version || 'unknown'}`, 'info');
92
+
93
+ // Try to connect
94
+ const url = 'http://localhost:8765';
95
+ log(`Attempting to connect to ${url}`, 'info');
96
+ updateStatus(false, 'Connecting...');
97
+
98
+ try {
99
+ const socket = io(url, {
100
+ autoConnect: true,
101
+ reconnection: true,
102
+ reconnectionDelay: 1000,
103
+ reconnectionDelayMax: 10000,
104
+ reconnectionAttempts: 3,
105
+ timeout: 5000,
106
+ forceNew: true,
107
+ transports: ['polling', 'websocket'],
108
+ withCredentials: false,
109
+ path: '/socket.io/'
110
+ });
111
+
112
+ socket.on('connect', () => {
113
+ log(`SUCCESS: Connected! Socket ID: ${socket.id}`, 'success');
114
+ updateStatus(true, `Connected (ID: ${socket.id})`);
115
+
116
+ // Request server status
117
+ socket.emit('request_status');
118
+ });
119
+
120
+ socket.on('disconnect', (reason) => {
121
+ log(`Disconnected: ${reason}`, 'error');
122
+ updateStatus(false, `Disconnected: ${reason}`);
123
+ });
124
+
125
+ socket.on('connect_error', (error) => {
126
+ log(`Connection error: ${error.message}`, 'error');
127
+ updateStatus(false, `Error: ${error.message}`);
128
+ });
129
+
130
+ socket.on('server_status', (status) => {
131
+ log(`Server status received: ${JSON.stringify(status)}`, 'success');
132
+ });
133
+
134
+ socket.on('event', (data) => {
135
+ log(`Event received: ${data.type}`, 'info');
136
+ });
137
+
138
+ // Socket.IO manager events
139
+ socket.io.on('error', (error) => {
140
+ log(`Manager error: ${error}`, 'error');
141
+ });
142
+
143
+ socket.io.on('reconnect', (attempt) => {
144
+ log(`Reconnected after ${attempt} attempts`, 'success');
145
+ updateStatus(true, 'Reconnected');
146
+ });
147
+
148
+ socket.io.on('reconnect_attempt', (attempt) => {
149
+ log(`Reconnection attempt ${attempt}`, 'info');
150
+ updateStatus(false, `Reconnecting... (attempt ${attempt})`);
151
+ });
152
+
153
+ socket.io.on('reconnect_error', (error) => {
154
+ log(`Reconnection error: ${error.message}`, 'error');
155
+ });
156
+
157
+ socket.io.on('reconnect_failed', () => {
158
+ log('Reconnection failed after all attempts', 'error');
159
+ updateStatus(false, 'Reconnection failed');
160
+ });
161
+
162
+ // Store socket for debugging
163
+ window.debugSocket = socket;
164
+ log('Socket stored as window.debugSocket for debugging', 'info');
165
+
166
+ } catch (error) {
167
+ log(`Exception: ${error.message}`, 'error');
168
+ updateStatus(false, 'Connection failed');
169
+ }
170
+ }
171
+
172
+ // Auto-test on load
173
+ setTimeout(() => {
174
+ log('Auto-testing connection...', 'info');
175
+ testConnection();
176
+ }, 500);
177
+ </script>
178
+ </body>
179
+ </html>
@@ -0,0 +1,68 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title>Claude Tree Tab Debug Test</title>
5
+ </head>
6
+ <body>
7
+ <h1>Claude Tree Tab Debug Test</h1>
8
+ <p>This test will help diagnose why the Claude Tree tab is showing events instead of the D3.js tree.</p>
9
+
10
+ <h2>Steps to debug:</h2>
11
+ <ol>
12
+ <li>Open the dashboard at http://localhost:8080</li>
13
+ <li>Open browser developer console</li>
14
+ <li>Run these commands in console:</li>
15
+ </ol>
16
+
17
+ <pre>
18
+ // 1. Check if CodeViewer is initialized
19
+ console.log('CodeViewer exists?', window.CodeViewer);
20
+
21
+ // 2. Check the Claude Tree tab content
22
+ const claudeTreeTab = document.getElementById('claude-tree-tab');
23
+ console.log('Claude Tree Tab HTML:', claudeTreeTab?.innerHTML);
24
+
25
+ // 3. Check the Claude Tree container
26
+ const claudeTreeContainer = document.getElementById('claude-tree-container');
27
+ console.log('Claude Tree Container HTML:', claudeTreeContainer?.innerHTML);
28
+
29
+ // 4. Manually trigger CodeViewer
30
+ if (window.CodeViewer) {
31
+ window.CodeViewer.show();
32
+ console.log('CodeViewer.show() called');
33
+
34
+ // Check container after show()
35
+ setTimeout(() => {
36
+ const container = document.getElementById('claude-tree-container');
37
+ console.log('Container after show():', container?.innerHTML.substring(0, 500));
38
+ }, 1000);
39
+ }
40
+
41
+ // 5. Check for event-item elements in Claude Tree tab
42
+ const eventItems = claudeTreeTab?.querySelectorAll('.event-item');
43
+ console.log('Event items found in Claude Tree tab:', eventItems?.length || 0);
44
+
45
+ // 6. Check what's rendering events
46
+ const allEventLists = document.querySelectorAll('.events-list');
47
+ console.log('All elements with class "events-list":', allEventLists.length);
48
+ allEventLists.forEach((el, i) => {
49
+ console.log(` List ${i}: ID="${el.id}", Parent ID="${el.parentElement?.id}"`);
50
+ });
51
+ </pre>
52
+
53
+ <h2>Expected vs Actual:</h2>
54
+ <ul>
55
+ <li><strong>Expected:</strong> Claude Tree tab should contain a D3.js SVG tree visualization</li>
56
+ <li><strong>Actual:</strong> Claude Tree tab is showing event entries like "[hook] hook.user_prompt"</li>
57
+ </ul>
58
+
59
+ <h2>Hypothesis:</h2>
60
+ <p>The issue might be one of:</p>
61
+ <ul>
62
+ <li>CodeViewer is not being initialized properly</li>
63
+ <li>The container is being overwritten after CodeViewer renders</li>
64
+ <li>There's a CSS issue causing wrong content to be displayed</li>
65
+ <li>Events are being rendered into the wrong container</li>
66
+ </ul>
67
+ </body>
68
+ </html>
@@ -0,0 +1,409 @@
1
+ <!DOCTYPE html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="UTF-8">
5
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
+ <title>Dashboard Test - Claude MPM</title>
7
+ <style>
8
+ body {
9
+ font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
10
+ max-width: 1200px;
11
+ margin: 0 auto;
12
+ padding: 20px;
13
+ background: #f5f5f5;
14
+ }
15
+ .test-section {
16
+ background: white;
17
+ border-radius: 8px;
18
+ padding: 20px;
19
+ margin-bottom: 20px;
20
+ box-shadow: 0 2px 4px rgba(0,0,0,0.1);
21
+ }
22
+ h1 {
23
+ color: #333;
24
+ border-bottom: 2px solid #007bff;
25
+ padding-bottom: 10px;
26
+ }
27
+ h2 {
28
+ color: #555;
29
+ margin-top: 0;
30
+ }
31
+ .test-result {
32
+ padding: 10px;
33
+ margin: 10px 0;
34
+ border-radius: 4px;
35
+ font-family: 'Courier New', monospace;
36
+ }
37
+ .success {
38
+ background: #d4edda;
39
+ border: 1px solid #c3e6cb;
40
+ color: #155724;
41
+ }
42
+ .error {
43
+ background: #f8d7da;
44
+ border: 1px solid #f5c6cb;
45
+ color: #721c24;
46
+ }
47
+ .warning {
48
+ background: #fff3cd;
49
+ border: 1px solid #ffeeba;
50
+ color: #856404;
51
+ }
52
+ .info {
53
+ background: #d1ecf1;
54
+ border: 1px solid #bee5eb;
55
+ color: #0c5460;
56
+ }
57
+ button {
58
+ background: #007bff;
59
+ color: white;
60
+ border: none;
61
+ padding: 10px 20px;
62
+ border-radius: 4px;
63
+ cursor: pointer;
64
+ margin: 5px;
65
+ }
66
+ button:hover {
67
+ background: #0056b3;
68
+ }
69
+ .event-list {
70
+ max-height: 300px;
71
+ overflow-y: auto;
72
+ border: 1px solid #ddd;
73
+ padding: 10px;
74
+ margin-top: 10px;
75
+ background: #f9f9f9;
76
+ }
77
+ .event-item {
78
+ padding: 5px;
79
+ margin: 2px 0;
80
+ background: white;
81
+ border-left: 3px solid #007bff;
82
+ font-size: 12px;
83
+ }
84
+ </style>
85
+ </head>
86
+ <body>
87
+ <h1>Dashboard Component Test Suite</h1>
88
+
89
+ <div class="test-section">
90
+ <h2>🔌 Connection Test</h2>
91
+ <button onclick="testConnection()">Test Socket Connection</button>
92
+ <div id="connection-result"></div>
93
+ </div>
94
+
95
+ <div class="test-section">
96
+ <h2>📊 Event Generation Test</h2>
97
+ <button onclick="generateTestEvents()">Generate Test Events</button>
98
+ <button onclick="clearTestEvents()">Clear Events</button>
99
+ <div id="event-result"></div>
100
+ <div id="event-list" class="event-list" style="display:none;"></div>
101
+ </div>
102
+
103
+ <div class="test-section">
104
+ <h2>🔧 Tool Detection Test</h2>
105
+ <button onclick="testToolDetection()">Test Tool Detection</button>
106
+ <div id="tool-result"></div>
107
+ </div>
108
+
109
+ <div class="test-section">
110
+ <h2>📁 File Detection Test</h2>
111
+ <button onclick="testFileDetection()">Test File Detection</button>
112
+ <div id="file-result"></div>
113
+ </div>
114
+
115
+ <div class="test-section">
116
+ <h2>🤖 Agent Detection Test</h2>
117
+ <button onclick="testAgentDetection()">Test Agent Detection</button>
118
+ <div id="agent-result"></div>
119
+ </div>
120
+
121
+ <div class="test-section">
122
+ <h2>📈 Dashboard Integration Test</h2>
123
+ <button onclick="testDashboardIntegration()">Run Full Integration Test</button>
124
+ <div id="integration-result"></div>
125
+ </div>
126
+
127
+ <script>
128
+ // Test data
129
+ const testEvents = [
130
+ // Tool events
131
+ {
132
+ type: 'hook',
133
+ subtype: 'pre_tool',
134
+ tool_name: 'Read',
135
+ tool_parameters: { file_path: '/test/file1.py' },
136
+ agent_type: 'Engineer',
137
+ timestamp: new Date().toISOString(),
138
+ session_id: 'test-session-1'
139
+ },
140
+ {
141
+ type: 'hook',
142
+ subtype: 'post_tool',
143
+ tool_name: 'Read',
144
+ tool_parameters: { file_path: '/test/file1.py' },
145
+ agent_type: 'Engineer',
146
+ timestamp: new Date().toISOString(),
147
+ session_id: 'test-session-1',
148
+ success: true,
149
+ duration_ms: 100
150
+ },
151
+ {
152
+ type: 'tool_use',
153
+ tool_name: 'Write',
154
+ tool_parameters: { file_path: '/test/file2.js', content: 'test content' },
155
+ agent_type: 'PM',
156
+ timestamp: new Date().toISOString(),
157
+ session_id: 'test-session-1'
158
+ },
159
+ {
160
+ type: 'hook',
161
+ subtype: 'pre_tool',
162
+ tool_name: 'Bash',
163
+ tool_parameters: { command: 'ls -la /test' },
164
+ agent_type: 'DevOps',
165
+ timestamp: new Date().toISOString(),
166
+ session_id: 'test-session-2'
167
+ },
168
+ // Agent events
169
+ {
170
+ type: 'agent',
171
+ subtype: 'subagent_start',
172
+ agent_type: 'Engineer',
173
+ timestamp: new Date().toISOString(),
174
+ session_id: 'test-session-1'
175
+ },
176
+ {
177
+ type: 'agent',
178
+ subtype: 'subagent_stop',
179
+ agent_type: 'Engineer',
180
+ timestamp: new Date().toISOString(),
181
+ session_id: 'test-session-1'
182
+ },
183
+ // File operations in bash
184
+ {
185
+ type: 'hook',
186
+ subtype: 'pre_tool',
187
+ tool_name: 'Bash',
188
+ tool_parameters: { command: 'cat /test/config.json' },
189
+ agent_type: 'QA',
190
+ timestamp: new Date().toISOString(),
191
+ session_id: 'test-session-3'
192
+ },
193
+ {
194
+ type: 'hook',
195
+ subtype: 'pre_tool',
196
+ tool_name: 'Grep',
197
+ tool_parameters: { pattern: 'TODO', path: '/test' },
198
+ agent_type: 'QA',
199
+ timestamp: new Date().toISOString(),
200
+ session_id: 'test-session-3'
201
+ }
202
+ ];
203
+
204
+ function testConnection() {
205
+ const resultDiv = document.getElementById('connection-result');
206
+ resultDiv.innerHTML = '<div class="info">Testing socket connection...</div>';
207
+
208
+ // Check if dashboard components are loaded
209
+ const checks = {
210
+ 'Dashboard': typeof window.Dashboard !== 'undefined',
211
+ 'FileToolTracker': typeof window.FileToolTracker !== 'undefined',
212
+ 'AgentInference': typeof window.AgentInference !== 'undefined',
213
+ 'EventProcessor': typeof window.EventProcessor !== 'undefined'
214
+ };
215
+
216
+ let allLoaded = true;
217
+ let html = '';
218
+
219
+ for (const [component, loaded] of Object.entries(checks)) {
220
+ if (loaded) {
221
+ html += `<div class="success">✅ ${component} loaded</div>`;
222
+ } else {
223
+ html += `<div class="error">❌ ${component} not loaded</div>`;
224
+ allLoaded = false;
225
+ }
226
+ }
227
+
228
+ if (allLoaded) {
229
+ html += '<div class="success"><strong>All dashboard components loaded successfully!</strong></div>';
230
+ } else {
231
+ html += '<div class="warning"><strong>Some components are missing. Check if dashboard is properly loaded.</strong></div>';
232
+ }
233
+
234
+ resultDiv.innerHTML = html;
235
+ }
236
+
237
+ function generateTestEvents() {
238
+ const resultDiv = document.getElementById('event-result');
239
+ const listDiv = document.getElementById('event-list');
240
+
241
+ resultDiv.innerHTML = '<div class="info">Generating test events...</div>';
242
+ listDiv.style.display = 'block';
243
+ listDiv.innerHTML = '';
244
+
245
+ testEvents.forEach((event, index) => {
246
+ const eventDiv = document.createElement('div');
247
+ eventDiv.className = 'event-item';
248
+ eventDiv.innerHTML = `
249
+ <strong>Event ${index + 1}:</strong>
250
+ Type: ${event.type},
251
+ Tool: ${event.tool_name || 'N/A'},
252
+ Agent: ${event.agent_type || 'N/A'}
253
+ `;
254
+ listDiv.appendChild(eventDiv);
255
+ });
256
+
257
+ resultDiv.innerHTML = `<div class="success">Generated ${testEvents.length} test events</div>`;
258
+ }
259
+
260
+ function clearTestEvents() {
261
+ document.getElementById('event-list').style.display = 'none';
262
+ document.getElementById('event-result').innerHTML = '<div class="info">Events cleared</div>';
263
+ }
264
+
265
+ function testToolDetection() {
266
+ const resultDiv = document.getElementById('tool-result');
267
+
268
+ if (typeof window.FileToolTracker === 'undefined') {
269
+ resultDiv.innerHTML = '<div class="error">FileToolTracker not loaded</div>';
270
+ return;
271
+ }
272
+
273
+ // Create a test instance
274
+ const tracker = new window.FileToolTracker();
275
+
276
+ // Test tool detection
277
+ const toolEvents = testEvents.filter(e => tracker.isToolOperation(e));
278
+
279
+ resultDiv.innerHTML = `
280
+ <div class="success">Tool Detection Results:</div>
281
+ <div class="info">Found ${toolEvents.length} tool operations out of ${testEvents.length} events</div>
282
+ ${toolEvents.map(e => `
283
+ <div class="test-result success">
284
+ ✅ Detected: ${e.tool_name} (${e.type}/${e.subtype})
285
+ </div>
286
+ `).join('')}
287
+ `;
288
+
289
+ // Update tool calls
290
+ tracker.updateToolCalls(testEvents);
291
+ const toolCalls = tracker.getToolCalls();
292
+
293
+ resultDiv.innerHTML += `
294
+ <div class="info">Tool calls map size: ${toolCalls.size}</div>
295
+ `;
296
+ }
297
+
298
+ function testFileDetection() {
299
+ const resultDiv = document.getElementById('file-result');
300
+
301
+ if (typeof window.FileToolTracker === 'undefined') {
302
+ resultDiv.innerHTML = '<div class="error">FileToolTracker not loaded</div>';
303
+ return;
304
+ }
305
+
306
+ // Create a test instance
307
+ const tracker = new window.FileToolTracker();
308
+
309
+ // Test file detection
310
+ const fileEvents = testEvents.filter(e => tracker.isFileOperation(e));
311
+
312
+ resultDiv.innerHTML = `
313
+ <div class="success">File Detection Results:</div>
314
+ <div class="info">Found ${fileEvents.length} file operations out of ${testEvents.length} events</div>
315
+ ${fileEvents.map(e => `
316
+ <div class="test-result success">
317
+ ✅ Detected: ${e.tool_name} - ${e.tool_parameters?.file_path || e.tool_parameters?.command || 'N/A'}
318
+ </div>
319
+ `).join('')}
320
+ `;
321
+
322
+ // Update file operations
323
+ tracker.updateFileOperations(testEvents);
324
+ const fileOps = tracker.getFileOperations();
325
+
326
+ resultDiv.innerHTML += `
327
+ <div class="info">File operations map size: ${fileOps.size}</div>
328
+ ${Array.from(fileOps.entries()).map(([path, data]) => `
329
+ <div class="test-result info">
330
+ 📁 ${path}: ${data.operations.length} operations
331
+ </div>
332
+ `).join('')}
333
+ `;
334
+ }
335
+
336
+ function testAgentDetection() {
337
+ const resultDiv = document.getElementById('agent-result');
338
+
339
+ if (typeof window.AgentInference === 'undefined') {
340
+ resultDiv.innerHTML = '<div class="error">AgentInference not loaded</div>';
341
+ return;
342
+ }
343
+
344
+ // Create a test instance with mock event viewer
345
+ const mockEventViewer = { events: testEvents };
346
+ const inference = new window.AgentInference(mockEventViewer);
347
+
348
+ // Test agent inference
349
+ const results = testEvents.map(e => {
350
+ const result = inference.inferAgentFromEvent(e);
351
+ return { event: e, inference: result };
352
+ });
353
+
354
+ resultDiv.innerHTML = `
355
+ <div class="success">Agent Detection Results:</div>
356
+ ${results.map(r => `
357
+ <div class="test-result ${r.inference.type === 'subagent' ? 'success' : 'info'}">
358
+ ${r.inference.type === 'subagent' ? '🤖' : '🎯'}
359
+ ${r.inference.agentName}
360
+ (${r.inference.confidence}) -
361
+ ${r.event.type}/${r.event.subtype || 'N/A'}
362
+ </div>
363
+ `).join('')}
364
+ `;
365
+ }
366
+
367
+ function testDashboardIntegration() {
368
+ const resultDiv = document.getElementById('integration-result');
369
+
370
+ resultDiv.innerHTML = '<div class="info">Running full integration test...</div>';
371
+
372
+ // Run all tests
373
+ const tests = [
374
+ { name: 'Connection', fn: testConnection },
375
+ { name: 'Event Generation', fn: generateTestEvents },
376
+ { name: 'Tool Detection', fn: testToolDetection },
377
+ { name: 'File Detection', fn: testFileDetection },
378
+ { name: 'Agent Detection', fn: testAgentDetection }
379
+ ];
380
+
381
+ let allPassed = true;
382
+ let results = [];
383
+
384
+ tests.forEach(test => {
385
+ try {
386
+ test.fn();
387
+ results.push(`<div class="success">✅ ${test.name} passed</div>`);
388
+ } catch (error) {
389
+ results.push(`<div class="error">❌ ${test.name} failed: ${error.message}</div>`);
390
+ allPassed = false;
391
+ }
392
+ });
393
+
394
+ resultDiv.innerHTML = `
395
+ <h3>Integration Test Results:</h3>
396
+ ${results.join('')}
397
+ <div class="${allPassed ? 'success' : 'warning'}">
398
+ <strong>${allPassed ? '✅ All tests passed!' : '⚠️ Some tests failed'}</strong>
399
+ </div>
400
+ `;
401
+ }
402
+
403
+ // Auto-run connection test on load
404
+ window.addEventListener('DOMContentLoaded', () => {
405
+ setTimeout(testConnection, 500);
406
+ });
407
+ </script>
408
+ </body>
409
+ </html>