const HOST_API = 1; window.observed = {mounts: [], errors: [], evaluations: [], hostApi: HOST_API}; const report = document.getElementById('reports'); const account = document.getElementById('account'); async function load(name, target) { try { const feature = name === 'reports' ? await import('reports') : await import('account'); // Compatibility gate, not a security boundary: module evaluation already happened. if (feature.hostApi !== HOST_API) throw new Error('incompatible host API'); feature.mount(target); window.observed.mounts.push({name, version: feature.version}); return {ok: true, version: feature.version}; } catch (error) { target.textContent = `${name} unavailable`; window.observed.errors.push({name, message: error.message}); return {ok: false, message: error.message}; } } window.loadReports = () => load('reports', report); window.loadAccount = () => load('account', account); try { await import('shared'); for (const button of document.querySelectorAll('button')) button.disabled = false; document.getElementById('status').textContent = 'ready'; } catch { document.getElementById('status').textContent = 'startup failed'; } document.getElementById('reports-nav').onclick = window.loadReports; document.getElementById('account-nav').onclick = window.loadAccount;