/**
* Phoenix Ops 4.5 - Cognitive Architecture Controller
* Main JavaScript - Core Functionality
*/
// Phoenix Core State Management
const PhoenixCore = {
state: {
version: '4.5.2026',
status: 'ACTIVE',
mode: 'SILENT_ZEN',
architecture: 'HYBRIDE_COGNITIVE',
collaborators: ['Llama v4', 'Qwen3-TTS', 'GPT-4.5', 'Bloom-IC'],
guard: 'Mistral',
memory: {
type: 'MEM0',
total: 1200000,
latency: '500μs',
tokenReduction: '-90%'
},
security: {
firewall: 'ZEN_MODE',
blockedEntities: ['Shodan', 'Pegasur', '*.onion'],
protectionLevel: 100
}
},
// Enhanced security metrics
securityMetrics: {
threatLevel: 'LOW',
packetsInspected: 2847392,
blockedCount: 1247,
securityScore: 98.7
},
// Initialize Phoenix Core
init() {
console.log('🔥 Phoenix Ops 4.5 - Initialisation');
this.updateTime();
this.startTimeSync();
this.initAnimations();
this.initEventListeners();
this.initWebComponents();
this.initSecuritySubsystems();
},
// Initialize security subsystems
initSecuritySubsystems() {
// Initialize threat feed
if (typeof ThreatFeed !== 'undefined') {
ThreatFeed.init();
}
// Initialize vulnerability scanner
if (typeof VulnScanner !== 'undefined') {
VulnScanner.init();
}
// Initialize BLE scanner
if (typeof BLEScanner !== 'undefined') {
BLEScanner.init();
}
// Initialize audit log
if (typeof AuditLog !== 'undefined') {
AuditLog.init();
}
// Initialize crypto manager
if (typeof CryptoManager !== 'undefined') {
CryptoManager.init();
}
},
// Update system time
updateTime() {
const now = new Date();
const timeStr = now.toLocaleTimeString('fr-FR', {
hour12: false,
hour: '2-digit',
minute: '2-digit',
second: '2-digit'
});
const timeElement = document.getElementById('system-time');
if (timeElement) {
timeElement.textContent = timeStr;
}
},
// Start time synchronization
startTimeSync() {
setInterval(() => this.updateTime(), 1000);
},
// Initialize animations
initAnimations() {
// Add stagger effect to cards
const cards = document.querySelectorAll('.phoenix-card');
cards.forEach((card, index) => {
card.style.animationDelay = `${index * 0.1}s`;
card.classList.add('fade-in-up');
});
// Initialize activity chart
this.initActivityChart();
// Initialize memory visualization
this.initMemoryVisualization();
// Initialize network graph
this.initNetworkGraph();
},
// Initialize event listeners
initEventListeners() {
// Sync button
const syncBtn = document.querySelector('button');
if (syncBtn) {
syncBtn.addEventListener('click', () => this.syncSystems());
}
// BLE Scan button
const bleScanBtn = document.querySelector('button:has(.bluetooth)');
if (bleScanBtn) {
bleScanBtn.addEventListener('click', () => this.scanBLE());
}
// Memory buttons
const memoryBtns = document.querySelectorAll('button');
memoryBtns.forEach(btn => {
if (btn.textContent.includes('Memory') || btn.textContent.includes('mémoire')) {
btn.addEventListener('click', () => this.showMemoryPanel());
}
});
// Keyboard shortcuts
document.addEventListener('keydown', (e) => {
this.handleKeyboardShortcuts(e);
});
},
// Initialize web components
initWebComponents() {
console.log('🔧 Initializing Web Components...');
// Components are loaded via script tags
},
// Sync all systems
syncSystems() {
console.log('🔄 Synchronisation des systèmes Phoenix...');
// Show sync indicator
const syncBtn = document.querySelector('button');
if (syncBtn) {
const originalContent = syncBtn.innerHTML;
syncBtn.innerHTML = ' Syncing...';
syncBtn.disabled = true;
setTimeout(() => {
syncBtn.innerHTML = originalContent;
syncBtn.disabled = false;
this.showNotification('Sync Complete', 'success');
}, 2000);
}
},
// BLE Scan
scanBLE() {
console.log('📡 Scanning BLE devices...');
this.showNotification('BLE Scan Started', 'info');
// Simulate BLE devices
setTimeout(() => {
this.showNotification('3 Devices Found', 'success');
}, 1500);
},
// Show memory panel
showMemoryPanel() {
console.log('🧠 Opening Memory Panel...');
this.showNotification('Memory Panel Opened', 'info');
},
// Initialize activity chart
initActivityChart() {
const chartContainer = document.querySelector('.h-24');
if (!chartContainer) return;
// Add animated bars
const bars = chartContainer.querySelectorAll('.bg-gradient-to-t');
bars.forEach(bar => {
const randomHeight = Math.floor(Math.random() * 40) + 50;
bar.style.height = `${randomHeight}%`;
});
},
// Initialize memory visualization
initMemoryVisualization() {
// Add pulse effect to memory indicators
const memoryCards = document.querySelectorAll('[class*="purple"]');
memoryCards.forEach(card => {
card.classList.add('memory-pulse');
});
},
// Initialize network graph
initNetworkGraph() {
// Add connection animations
const connectionLines = document.querySelectorAll('.connection-line');
connectionLines.forEach(line => {
line.classList.add('dash-offset');
});
},
// Handle keyboard shortcuts
handleKeyboardShortcuts(e) {
// Ctrl/Cmd + K: Open command palette
if ((e.ctrlKey || e.metaKey) && e.key === 'k') {
e.preventDefault();
this.openCommandPalette();
}
// Ctrl/Cmd + S: Sync systems
if ((e.ctrlKey || e.metaKey) && e.key === 's') {
e.preventDefault();
this.syncSystems();
}
// Escape: Close any open panels
if (e.key === 'Escape') {
this.closeAllPanels();
}
},
// Open command palette
openCommandPalette() {
console.log('🎯 Opening Command Palette');
this.showNotification('Command Palette: Press Enter to search', 'info');
},
// Close all panels
closeAllPanels() {
console.log('❌ Closing all panels');
// Implementation for closing panels
},
// Show notification
showNotification(message, type = 'info') {
// Create notification element
const notification = document.createElement('div');
notification.className = `fixed bottom-4 right-4 px-6 py-3 rounded-lg shadow-lg z-50 flex items-center gap-3 transition-all duration-300 transform translate-y-20 opacity-0`;
// Add type-specific styling
const colors = {
success: 'bg-green-500/20 border-green-500/30 text-green-400',
error: 'bg-red-500/20 border-red-500/30 text-red-400',
warning: 'bg-yellow-500/20 border-yellow-500/30 text-yellow-400',
info: 'bg-cyan-500/20 border-cyan-500/30 text-cyan-400'
};
notification.classList.add(...colors[type].split(' '));
notification.innerHTML = `
${message}
`;
document.body.appendChild(notification);
// Animate in
requestAnimationFrame(() => {
notification.classList.remove('translate-y-20', 'opacity-0');
});
// Remove after delay
setTimeout(() => {
notification.classList.add('translate-y-20', 'opacity-0');
setTimeout(() => notification.remove(), 300);
}, 3000);
// Re-initialize feather icons
if (typeof feather !== 'undefined') {
feather.replace();
}
},
// Get system status
getStatus() {
return this.state;
},
// Update system status
updateStatus(newStatus) {
this.state = { ...this.state, ...newStatus };
console.log('📊 Status Updated:', this.state);
}
};
// Phoenix Memory System
const PhoenixMemory = {
memories: [],
maxMemories: 1200000,
async storeMemory(data) {
const memory = {
id: Date.now(),
data,
timestamp: new Date().toISOString(),
type: this.getMemoryType(data)
};
this.memories.push(memory);
return memory;
},
async retrieveMemory(query) {
return this.memories.filter(m =>
JSON.stringify(m.data).toLowerCase().includes(query.toLowerCase())
);
},
getMemoryType(data) {
if (data.type === 'cognitive') return 'COGNITIVE';
if (data.type === 'security') return 'SECURITY';
if (data.type === 'collaboration') return 'COLLABORATION';
return 'GENERAL';
},
getStats() {
return {
total: this.memories.length,
percentage: (this.memories.length / this.maxMemories * 100).toFixed(2)
};
}
};
// Phoenix Guard System - Enhanced
const PhoenixGuard = {
status: 'ACTIVE',
rules: [],
threatDetectionRules: [
{ id: 'SQL_INJECTION', severity: 'CRITICAL', pattern: /(\b(SELECT|INSERT|UPDATE|DELETE|DROP)\b.*\bFROM\b)/i },
{ id: 'XSS_ATTACK', severity: 'HIGH', pattern: /