import React, { useState, useEffect, useRef } from 'react'; import { Activity, Clock, Zap, Network, Brain } from 'lucide-react'; import './index.css'; const NUM_OSCILLATORS = 8; const RADIUS = 100; function App() { const [coherence, setCoherence] = useState(0.85); const [entropy, setEntropy] = useState(1.2); const [tokenFreq, setTokenFreq] = useState(15.4); const [phases, setPhases] = useState(Array(NUM_OSCILLATORS).fill(0).map((_, i) => (i * 2 * Math.PI) / NUM_OSCILLATORS)); const [logs, setLogs] = useState([ { time: new Date().toLocaleTimeString(), msg: "KAIROS Temporal Engine Initialized." }, { time: new Date().toLocaleTimeString(), msg: "Kuramoto coupling established at K=2.4" } ]); const frameRef = useRef(null); // Simulate Kuramoto Phase Dynamics useEffect(() => { let lastTime = performance.now(); const animate = (time) => { const dt = (time - lastTime) / 1000; lastTime = time; setPhases(prev => { const newPhases = [...prev]; const K = 2.5; // Coupling constant const N = NUM_OSCILLATORS; const omega = 1.0; // Natural frequency for (let i = 0; i < N; i++) { let sum = 0; for (let j = 0; j < N; j++) { sum += Math.sin(prev[j] - prev[i]); } // Add some stochastic resonance (noise) const noise = (Math.random() - 0.5) * 0.2; newPhases[i] += (omega + (K / N) * sum + noise) * dt; } return newPhases; }); // Fluctuate metrics slightly if (Math.random() > 0.95) { setTokenFreq(prev => +(prev + (Math.random() - 0.5)).toFixed(1)); setCoherence(prev => Math.min(1, Math.max(0, prev + (Math.random() - 0.5) * 0.05))); setEntropy(prev => Math.max(0, prev + (Math.random() - 0.5) * 0.1)); } frameRef.current = requestAnimationFrame(animate); }; frameRef.current = requestAnimationFrame(animate); return () => cancelAnimationFrame(frameRef.current); }, []); // Add random logs to simulate engine activity useEffect(() => { const interval = setInterval(() => { setLogs(prev => { const newLogs = [...prev, { time: new Date().toLocaleTimeString(), msg: `Phase integrated. Coherence: ${(coherence * 100).toFixed(1)}%. Vector hash committed to Ledger.` }]; return newLogs.slice(-10); // Keep last 10 }); }, 4000); return () => clearInterval(interval); }, [coherence]); return (