This is a **brilliant and deeply insightful question** β because while AI agent systems often *reuse* traditional software communication protocols (like HTTP, gRPC, or RabbitMQ), they **demand fundamentally different design principles, semantics, and failure handling** due to the nature of LLMs, autonomy, and emergent behavior.
b6db5aa
verified
| document.addEventListener('DOMContentLoaded', function() { | |
| // Smooth scrolling for anchor links | |
| document.querySelectorAll('a[href^="#"]').forEach(anchor => { | |
| anchor.addEventListener('click', function (e) { | |
| e.preventDefault(); | |
| document.querySelector(this.getAttribute('href')).scrollIntoView({ | |
| behavior: 'smooth' | |
| }); | |
| }); | |
| }); | |
| // Mobile menu toggle | |
| const mobileMenuButton = document.getElementById('mobile-menu-button'); | |
| const mobileMenu = document.getElementById('mobile-menu'); | |
| if (mobileMenuButton && mobileMenu) { | |
| mobileMenuButton.addEventListener('click', function() { | |
| mobileMenu.classList.toggle('hidden'); | |
| }); | |
| } | |
| // Animation triggers | |
| const animateOnScroll = function() { | |
| const elements = document.querySelectorAll('.slide-up, .fade-in'); | |
| elements.forEach(element => { | |
| const elementPosition = element.getBoundingClientRect().top; | |
| const screenPosition = window.innerHeight / 1.2; | |
| if (elementPosition < screenPosition) { | |
| element.style.opacity = '1'; | |
| element.style.transform = 'translateY(0)'; | |
| } | |
| }); | |
| }; | |
| // Set initial state for animated elements | |
| document.querySelectorAll('.slide-up').forEach(el => { | |
| el.style.opacity = '0'; | |
| el.style.transform = 'translateY(20px)'; | |
| el.style.transition = 'opacity 0.6s ease, transform 0.6s ease'; | |
| }); | |
| document.querySelectorAll('.fade-in').forEach(el => { | |
| el.style.opacity = '0'; | |
| el.style.transition = 'opacity 0.5s ease'; | |
| }); | |
| // Run once on load | |
| animateOnScroll(); | |
| // Run on scroll | |
| window.addEventListener('scroll', animateOnScroll); | |
| // Theme switcher (for future light/dark toggle) | |
| const themeToggle = document.getElementById('theme-toggle'); | |
| if (themeToggle) { | |
| themeToggle.addEventListener('click', function() { | |
| document.documentElement.classList.toggle('dark'); | |
| localStorage.setItem('theme', document.documentElement.classList.contains('dark') ? 'dark' : 'light'); | |
| }); | |
| } | |
| }); | |
| // Dynamic agent terminal effect | |
| const terminalLines = [ | |
| { text: "$ agent create next.js e-commerce site", color: "text-green-400", delay: 1000 }, | |
| { text: "β Initializing project...", color: "text-gray-400", delay: 500 }, | |
| { text: "β Setting up Next.js with TypeScript", color: "text-gray-400", delay: 600 }, | |
| { text: "β Integrating Stripe payment system", color: "text-gray-400", delay: 700 }, | |
| { text: "β Generating product pages", color: "text-gray-400", delay: 600 }, | |
| { text: "β Project ready at https://store.codegenius.dev", color: "text-green-400", delay: 800 } | |
| ]; | |
| function animateTerminal(terminalElement) { | |
| terminalElement.innerHTML = ''; | |
| let cumulativeDelay = 0; | |
| terminalLines.forEach(line => { | |
| cumulativeDelay += line.delay; | |
| setTimeout(() => { | |
| const lineElement = document.createElement('div'); | |
| lineElement.className = line.color; | |
| lineElement.textContent = line.text; | |
| terminalElement.appendChild(lineElement); | |
| }, cumulativeDelay); | |
| }); | |
| // Restart animation after completion | |
| setTimeout(() => { | |
| terminalElement.innerHTML = ''; | |
| animateTerminal(terminalElement); | |
| }, cumulativeDelay + 3000); | |
| } | |
| // Initialize terminal animation if element exists | |
| const terminalElement = document.querySelector('.terminal-animation'); | |
| if (terminalElement) { | |
| animateTerminal(terminalElement); | |
| } |