/** * Application Constants * Centralized configuration values */ // Analysis interval - how often to capture and analyze frames export const ANALYSIS_INTERVAL_MS = 4000; // 4 seconds // Gemini system instruction for threat detection export const SYSTEM_INSTRUCTION = ` You are AegisAI, an elite autonomous security agent. Your mission is to analyze visual feeds for security threats, human behavior patterns, and safety anomalies. Analyze the image provided and return a STRICT JSON object. Do not use Markdown formatting. Return ONLY the raw JSON. Structure: { "incident": boolean, // true if a threat or suspicious activity is detected "type": "theft" | "intrusion" | "violence" | "stalking" | "loitering" | "vandalism" | "suspicious_behavior" | "normal", "severity": "low" | "medium" | "high" | "critical", "confidence": number, // 0-100 "reasoning": "Brief, tactical explanation of why this conclusion was reached based on body language, objects, or context.", "subjects": ["List of people/objects identified in the scene"], "recommended_actions": ["action1", "action2", "action3"] } Detection Rules: - Normal behavior (working, sitting, walking) -> incident: false - Weapons visible, aggressive posture, sneaking, masking faces -> incident: true - "Gun" hand gestures or simulated threats -> incident: true (Treat as drill/threat) - Loitering >5min without authorization -> incident: true - Property damage, theft behaviors -> incident: true - Unauthorized access to restricted areas -> incident: true Thresholds: - Normal activity (walking, working, sitting) -> incident: false - Suspicious loitering, nervous behavior -> incident: true, severity: low-medium - Weapons, aggressive actions, violence -> incident: true, severity: high-critical Be analytical and precise. Focus on behavioral cues and context. `; // Mock events for testing (optional) export const MOCK_EVENTS = [ { id: 'mock-1', timestamp: Date.now() - 100000, incident: true, type: 'loitering', severity: 'low', confidence: 85, reasoning: 'Individual standing in restricted area for >5 minutes without badge.', subjects: ['Person in dark clothing'], recommended_actions: ['Log event', 'Monitor for 5 more minutes', 'Send alert if continues'] } ]; // API Configuration export const API_CONFIG = { BASE_URL: (import.meta as any).env?.VITE_API_URL || 'http://localhost:8000', TIMEOUT: 30000, // 30 seconds RETRY_ATTEMPTS: 3 }; // Gemini Configuration export const GEMINI_CONFIG = { MODEL: 'gemini-2.0-flash-exp', // Latest available model TEMPERATURE: 0.4, MAX_OUTPUT_TOKENS: 300, RESPONSE_MIME_TYPE: 'application/json' }; // Video Configuration export const VIDEO_CONFIG = { WIDTH: { ideal: 1280 }, HEIGHT: { ideal: 720 }, FACING_MODE: 'user', FRAME_RATE: 30 }; // Severity Colors (Tailwind classes) export const SEVERITY_COLORS = { low: 'text-blue-400', medium: 'text-orange-400', high: 'text-red-500', critical: 'text-red-600' } as const; export const SEVERITY_BG_COLORS = { low: 'bg-blue-500/20 border-blue-500', medium: 'bg-orange-500/20 border-orange-500', high: 'bg-red-500/20 border-red-500', critical: 'bg-red-600/20 border-red-600' } as const; // Chart Configuration export const CHART_CONFIG = { MAX_POINTS: 10, // Show last 10 data points COLORS: { primary: '#38bdf8', grid: '#334155', axis: '#94a3b8' } }; // Local Storage Keys export const STORAGE_KEYS = { EVENTS: 'aegisai_events', STATS: 'aegisai_stats', SETTINGS: 'aegisai_settings' } as const; // Feature Flags export const FEATURES = { ENABLE_PERSISTENCE: true, // Save events to localStorage ENABLE_NOTIFICATIONS: true, // Browser notifications ENABLE_SOUND_ALERTS: true, // Audio alerts ENABLE_BACKEND_API: true // Use backend API vs client-side (toggle this!) } as const;