Frontend refactored to ES6 modules (no bundler): js/main.js — entry point, wires all modules js/auth.js — OIDC login, token management js/ws.js — /ws, /ws/test, /ws/trace connections + HUD handler js/chat.js — messages, send, streaming js/graph.js — Cytoscape visualization + animation js/trace.js — trace panel js/dashboard.js — workspace controls rendering js/awareness.js — state panel, sensors, meters js/tests.js — test status display js/util.js — shared utilities New 2-row layout: Top: test status | connection status Middle: Workspace | Node Details | Graph Bottom: Chat | Awareness | Trace PA routing: routes ALL tool requests to expert (DB, UI, buttons, machines) Dashboard integration test: 15/15 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
35 lines
1001 B
JavaScript
35 lines
1001 B
JavaScript
/** Main entry point — wires all modules together. */
|
|
|
|
import { initAuth, authToken, startLogin } from './auth.js';
|
|
import { initTrace, addTrace, clearTrace } from './trace.js';
|
|
import { initChat, clearChat } from './chat.js';
|
|
import { clearDashboard } from './dashboard.js';
|
|
import { initGraph } from './graph.js';
|
|
import { connect } from './ws.js';
|
|
|
|
// Init on load
|
|
window.addEventListener('load', async () => {
|
|
initTrace();
|
|
initChat();
|
|
await initGraph();
|
|
await initAuth(() => connect());
|
|
});
|
|
|
|
// Clear session button
|
|
window.clearSession = async () => {
|
|
try {
|
|
const headers = { 'Content-Type': 'application/json' };
|
|
if (authToken) headers['Authorization'] = 'Bearer ' + authToken;
|
|
await fetch('/api/clear', { method: 'POST', headers });
|
|
clearChat();
|
|
clearTrace();
|
|
clearDashboard();
|
|
addTrace('runtime', 'cleared', 'session reset');
|
|
} catch (e) {
|
|
addTrace('runtime', 'error', 'clear failed: ' + e);
|
|
}
|
|
};
|
|
|
|
// Login button
|
|
window.startLogin = startLogin;
|