/** * Framework Activity Timeline * Tractatus Framework - Phase 3: Data Visualization * * Visual timeline showing framework component interactions * Color-coded by service */ class ActivityTimeline { constructor(containerId) { this.container = document.getElementById(containerId); if (!this.container) { console.error(`[ActivityTimeline] Container #${containerId} not found`); return; } this.events = [ { time: '0ms', service: 'instruction', name: 'InstructionPersistence', action: 'Load HIGH persistence instructions', color: '#6366f1' }, { time: '50ms', service: 'validator', name: 'CrossReferenceValidator', action: 'Verify request against instruction history', color: '#8b5cf6' }, { time: '100ms', service: 'boundary', name: 'BoundaryEnforcer', action: 'Check if request requires human approval', color: '#10b981' }, { time: '150ms', service: 'pressure', name: 'ContextPressureMonitor', action: 'Calculate current pressure level', color: '#f59e0b' }, { time: '200ms', service: 'metacognitive', name: 'MetacognitiveVerifier', action: 'Verify operation alignment', color: '#ec4899' }, { time: '250ms', service: 'deliberation', name: 'PluralisticDeliberation', action: 'Coordinate stakeholder perspectives', color: '#14b8a6' } ]; this.init(); } init() { this.render(); console.log('[ActivityTimeline] Initialized'); } render() { const eventsHTML = this.events.map((event, index) => `
${event.time}
${event.name}
${event.action}
`).join(''); this.container.innerHTML = `

Governance Flow

Request Processing
${eventsHTML}
Total processing time: 250ms | All services coordinated
`; // Apply colors via JavaScript (CSP-compliant) this.applyColors(); } applyColors() { document.querySelectorAll('.service-dot').forEach(dot => { const color = dot.getAttribute('data-color'); dot.style.backgroundColor = color; }); document.querySelectorAll('.service-name').forEach(name => { const color = name.getAttribute('data-color'); name.style.color = color; }); } } // Auto-initialize if container exists if (typeof window !== 'undefined') { document.addEventListener('DOMContentLoaded', () => { const container = document.getElementById('activity-timeline'); if (container) { window.activityTimeline = new ActivityTimeline('activity-timeline'); } }); } // Export for module systems if (typeof module !== 'undefined' && module.exports) { module.exports = ActivityTimeline; }