Update app.py
Browse files
app.py
CHANGED
|
@@ -2,8 +2,6 @@
|
|
| 2 |
# 🚀 ARF Ultimate Investor Demo v3.8.0 - ENTERPRISE EDITION
|
| 3 |
# ENHANCED VERSION WITH CLEAR BOUNDARIES AND RELIABLE VISUALIZATIONS
|
| 4 |
# Fixed to show clear OSS vs Enterprise boundaries with architectural honesty
|
| 5 |
-
"""
|
| 6 |
-
|
| 7 |
import logging
|
| 8 |
import sys
|
| 9 |
import traceback
|
|
@@ -42,14 +40,96 @@ from demo.guidance import DemoPsychologyController, get_demo_controller
|
|
| 42 |
# ===========================================
|
| 43 |
class BoundaryManager:
|
| 44 |
"""Manages clear boundaries between OSS and Enterprise"""
|
| 45 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 46 |
|
| 47 |
@staticmethod
|
| 48 |
def create_boundary_indicator(action: str, is_simulated: bool = True) -> str:
|
| 49 |
"""Create clear execution boundary indicator"""
|
| 50 |
if is_simulated:
|
| 51 |
return f"""
|
| 52 |
-
<div style="border: 3px dashed #f59e0b; border-radius: 16px; padding: 25px;
|
| 53 |
background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
|
| 54 |
text-align: center; margin: 20px 0;">
|
| 55 |
<div style="font-size: 36px; margin-bottom: 15px;">🎭</div>
|
|
@@ -213,28 +293,311 @@ def get_installation_status():
|
|
| 213 |
# ===========================================
|
| 214 |
def create_simple_telemetry_plot(scenario_name: str, is_real_arf: bool = True):
|
| 215 |
"""Simple guaranteed-to-work telemetry plot with boundary indicators"""
|
| 216 |
-
|
| 217 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 218 |
|
| 219 |
def create_html_telemetry_fallback(scenario_name: str, is_real_arf: bool) -> str:
|
| 220 |
"""HTML fallback for telemetry visualization"""
|
| 221 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 222 |
|
| 223 |
def create_simple_impact_plot(scenario_name: str, is_real_arf: bool = True):
|
| 224 |
"""Simple guaranteed-to-work impact plot with boundary indicators"""
|
| 225 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 226 |
|
| 227 |
def create_html_impact_fallback(scenario_name: str, is_real_arf: bool) -> str:
|
| 228 |
"""HTML fallback for impact visualization"""
|
| 229 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 230 |
|
| 231 |
def create_empty_plot(title: str, is_real_arf: bool = True):
|
| 232 |
"""Create an empty placeholder plot with boundary indicators"""
|
| 233 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 234 |
|
| 235 |
def get_inactive_agent_html(agent_name: str, description: str, is_real_arf: bool = False):
|
| 236 |
"""Get HTML for inactive agent state with boundary indicators"""
|
| 237 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 238 |
|
| 239 |
# ===========================================
|
| 240 |
# IMPORT MODULAR COMPONENTS
|
|
@@ -396,8 +759,181 @@ def get_components() -> Dict[str, Any]:
|
|
| 396 |
# ===========================================
|
| 397 |
class AuditTrailManager:
|
| 398 |
"""Enhanced audit trail manager with boundary tracking"""
|
| 399 |
-
|
| 400 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 401 |
|
| 402 |
def get_audit_manager() -> AuditTrailManager:
|
| 403 |
"""Lazy load audit manager singleton"""
|
|
@@ -439,8 +975,93 @@ def extract_roi_multiplier(roi_result: Dict) -> float:
|
|
| 439 |
# ===========================================
|
| 440 |
def update_scenario_display(scenario_name: str) -> tuple:
|
| 441 |
"""Update all scenario-related displays with scenario-specific data"""
|
| 442 |
-
|
| 443 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 444 |
|
| 445 |
# ===========================================
|
| 446 |
# TRUE ARF ANALYSIS HANDLER
|
|
@@ -448,8 +1069,260 @@ def update_scenario_display(scenario_name: str) -> tuple:
|
|
| 448 |
@AsyncRunner.async_to_sync
|
| 449 |
async def run_true_arf_analysis(scenario_name: str):
|
| 450 |
"""Run true ARF v3.3.7 analysis with OSS + Enterprise simulation"""
|
| 451 |
-
|
| 452 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 453 |
|
| 454 |
# ===========================================
|
| 455 |
# ENTERPRISE EXECUTION HANDLER
|
|
@@ -458,16 +1331,303 @@ def execute_enterprise_healing(scenario_name, approval_required, mcp_mode_value)
|
|
| 458 |
"""Execute enterprise healing with clear boundary indicators"""
|
| 459 |
import gradio as gr
|
| 460 |
|
| 461 |
-
|
| 462 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 463 |
|
| 464 |
# ===========================================
|
| 465 |
# ROI CALCULATION FUNCTION
|
| 466 |
# ===========================================
|
| 467 |
def calculate_roi(scenario_name, monthly_incidents, team_size):
|
| 468 |
"""Calculate ROI with boundary context"""
|
| 469 |
-
|
| 470 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 471 |
|
| 472 |
# ===========================================
|
| 473 |
# CREATE DEMO INTERFACE - FIXED VERSION
|
|
@@ -742,7 +1902,7 @@ def create_demo_interface():
|
|
| 742 |
</div>
|
| 743 |
</div>
|
| 744 |
|
| 745 |
-
<!-- Call to
|
| 746 |
<div style="margin-top: 15px; padding-top: 15px; border-top: 1px dashed #e2e8f0;
|
| 747 |
text-align: center; font-size: 12px; color: #64748b;">
|
| 748 |
Ready for production? <a href="#" style="color: #8b5cf6; font-weight: 600; text-decoration: none;">
|
|
|
|
| 2 |
# 🚀 ARF Ultimate Investor Demo v3.8.0 - ENTERPRISE EDITION
|
| 3 |
# ENHANCED VERSION WITH CLEAR BOUNDARIES AND RELIABLE VISUALIZATIONS
|
| 4 |
# Fixed to show clear OSS vs Enterprise boundaries with architectural honesty
|
|
|
|
|
|
|
| 5 |
import logging
|
| 6 |
import sys
|
| 7 |
import traceback
|
|
|
|
| 40 |
# ===========================================
|
| 41 |
class BoundaryManager:
|
| 42 |
"""Manages clear boundaries between OSS and Enterprise"""
|
| 43 |
+
|
| 44 |
+
@staticmethod
|
| 45 |
+
def get_system_boundaries():
|
| 46 |
+
"""Get current system boundaries"""
|
| 47 |
+
installation = get_installation_status()
|
| 48 |
+
|
| 49 |
+
return {
|
| 50 |
+
"oss": {
|
| 51 |
+
"available": installation["oss_installed"],
|
| 52 |
+
"version": installation["oss_version"] or "mock",
|
| 53 |
+
"label": installation["badges"]["oss"]["text"],
|
| 54 |
+
"color": installation["badges"]["oss"]["color"],
|
| 55 |
+
"icon": installation["badges"]["oss"]["icon"],
|
| 56 |
+
"capabilities": ["advisory_analysis", "rag_search", "healing_intent"],
|
| 57 |
+
"license": "Apache 2.0"
|
| 58 |
+
},
|
| 59 |
+
"enterprise": {
|
| 60 |
+
"available": installation["enterprise_installed"],
|
| 61 |
+
"version": installation["enterprise_version"] or "simulated",
|
| 62 |
+
"label": installation["badges"]["enterprise"]["text"],
|
| 63 |
+
"color": installation["badges"]["enterprise"]["color"],
|
| 64 |
+
"icon": installation["badges"]["enterprise"]["icon"],
|
| 65 |
+
"capabilities": ["autonomous_execution", "rollback_guarantee", "mcp_integration", "enterprise_support"],
|
| 66 |
+
"license": "Commercial"
|
| 67 |
+
},
|
| 68 |
+
"demo_mode": {
|
| 69 |
+
"active": True,
|
| 70 |
+
"architecture": "OSS advises → Enterprise executes",
|
| 71 |
+
"boundary_visible": settings.show_boundaries
|
| 72 |
+
}
|
| 73 |
+
}
|
| 74 |
+
|
| 75 |
+
@staticmethod
|
| 76 |
+
def get_boundary_badges() -> str:
|
| 77 |
+
"""Get HTML badges showing system boundaries"""
|
| 78 |
+
boundaries = BoundaryManager.get_system_boundaries()
|
| 79 |
+
|
| 80 |
+
return f"""
|
| 81 |
+
<div style="display: flex; justify-content: center; gap: 20px; margin: 0 auto 25px auto;
|
| 82 |
+
max-width: 800px; flex-wrap: wrap;">
|
| 83 |
+
<div style="display: flex; align-items: center; gap: 10px; padding: 12px 20px;
|
| 84 |
+
background: linear-gradient(135deg, {boundaries['oss']['color']}22 0%, {boundaries['oss']['color']}11 100%);
|
| 85 |
+
border: 2px solid {boundaries['oss']['color']}; border-radius: 12px;">
|
| 86 |
+
<div style="font-size: 24px;">{boundaries['oss']['icon']}</div>
|
| 87 |
+
<div>
|
| 88 |
+
<div style="font-size: 14px; font-weight: 600; color: {boundaries['oss']['color']};">
|
| 89 |
+
{boundaries['oss']['label']}
|
| 90 |
+
</div>
|
| 91 |
+
<div style="font-size: 11px; color: #64748b;">
|
| 92 |
+
Apache 2.0 • Advisory Intelligence
|
| 93 |
+
</div>
|
| 94 |
+
</div>
|
| 95 |
+
</div>
|
| 96 |
+
|
| 97 |
+
<div style="display: flex; align-items: center; gap: 10px; padding: 12px 20px;
|
| 98 |
+
background: linear-gradient(135deg, {boundaries['enterprise']['color']}22 0%, {boundaries['enterprise']['color']}11 100%);
|
| 99 |
+
border: 2px solid {boundaries['enterprise']['color']}; border-radius: 12px;">
|
| 100 |
+
<div style="font-size: 24px;">{boundaries['enterprise']['icon']}</div>
|
| 101 |
+
<div>
|
| 102 |
+
<div style="font-size: 14px; font-weight: 600; color: {boundaries['enterprise']['color']};">
|
| 103 |
+
{boundaries['enterprise']['label']}
|
| 104 |
+
</div>
|
| 105 |
+
<div style="font-size: 11px; color: #64748b;">
|
| 106 |
+
Commercial • Autonomous Execution
|
| 107 |
+
</div>
|
| 108 |
+
</div>
|
| 109 |
+
</div>
|
| 110 |
+
|
| 111 |
+
<div style="display: flex; align-items: center; gap: 10px; padding: 12px 20px;
|
| 112 |
+
background: linear-gradient(135deg, #f1f5f9 0%, #e2e8f0 100%);
|
| 113 |
+
border: 2px dashed #94a3b8; border-radius: 12px;">
|
| 114 |
+
<div style="font-size: 24px;">🏗️</div>
|
| 115 |
+
<div>
|
| 116 |
+
<div style="font-size: 14px; font-weight: 600; color: #475569;">
|
| 117 |
+
Architecture Boundary
|
| 118 |
+
</div>
|
| 119 |
+
<div style="font-size: 11px; color: #64748b;">
|
| 120 |
+
OSS advises → Enterprise executes
|
| 121 |
+
</div>
|
| 122 |
+
</div>
|
| 123 |
+
</div>
|
| 124 |
+
</div>
|
| 125 |
+
"""
|
| 126 |
|
| 127 |
@staticmethod
|
| 128 |
def create_boundary_indicator(action: str, is_simulated: bool = True) -> str:
|
| 129 |
"""Create clear execution boundary indicator"""
|
| 130 |
if is_simulated:
|
| 131 |
return f"""
|
| 132 |
+
<div style="border: 3px dashed #f59e0b; border-radius: 16px; padding: 25px;
|
| 133 |
background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
|
| 134 |
text-align: center; margin: 20px 0;">
|
| 135 |
<div style="font-size: 36px; margin-bottom: 15px;">🎭</div>
|
|
|
|
| 293 |
# ===========================================
|
| 294 |
def create_simple_telemetry_plot(scenario_name: str, is_real_arf: bool = True):
|
| 295 |
"""Simple guaranteed-to-work telemetry plot with boundary indicators"""
|
| 296 |
+
try:
|
| 297 |
+
# Try to use real visualization if available
|
| 298 |
+
components = get_components()
|
| 299 |
+
if components["all_available"] and "EnhancedVisualizationEngine" in components:
|
| 300 |
+
viz_engine = components["EnhancedVisualizationEngine"]
|
| 301 |
+
return viz_engine.create_telemetry_plot(scenario_name, True, is_real_arf)
|
| 302 |
+
except Exception as e:
|
| 303 |
+
logger.warning(f"Real telemetry plot failed, using fallback: {e}")
|
| 304 |
+
|
| 305 |
+
# Fallback to HTML
|
| 306 |
+
return create_html_telemetry_fallback(scenario_name, is_real_arf)
|
| 307 |
|
| 308 |
def create_html_telemetry_fallback(scenario_name: str, is_real_arf: bool) -> str:
|
| 309 |
"""HTML fallback for telemetry visualization"""
|
| 310 |
+
severity_colors = {
|
| 311 |
+
"Cache Miss Storm": "#f59e0b",
|
| 312 |
+
"Database Connection Pool Exhaustion": "#ef4444",
|
| 313 |
+
"Kubernetes Memory Leak": "#8b5cf6",
|
| 314 |
+
"API Rate Limit Storm": "#ec4899",
|
| 315 |
+
"Network Partition": "#14b8a6",
|
| 316 |
+
"Storage I/O Saturation": "#84cc16"
|
| 317 |
+
}
|
| 318 |
+
|
| 319 |
+
color = severity_colors.get(scenario_name, "#64748b")
|
| 320 |
+
boundary_indicator = "🏢 ENTERPRISE" if is_real_arf else "🔓 OSS ONLY"
|
| 321 |
+
|
| 322 |
+
return f"""
|
| 323 |
+
<div style="border: 1px solid {color}; border-radius: 14px; padding: 20px;
|
| 324 |
+
background: linear-gradient(135deg, {color}10 0%, #ffffff 100%);
|
| 325 |
+
position: relative; overflow: hidden;">
|
| 326 |
+
|
| 327 |
+
<!-- Boundary indicator -->
|
| 328 |
+
<div style="position: absolute; top: 10px; right: 10px; background: {color};
|
| 329 |
+
color: white; padding: 4px 10px; border-radius: 12px; font-size: 11px;
|
| 330 |
+
font-weight: bold;">
|
| 331 |
+
{boundary_indicator}
|
| 332 |
+
</div>
|
| 333 |
+
|
| 334 |
+
<div style="display: flex; justify-content: space-between; align-items: flex-start;">
|
| 335 |
+
<div>
|
| 336 |
+
<h4 style="margin: 0 0 10px 0; font-size: 16px; color: #1e293b; font-weight: 600;">
|
| 337 |
+
📊 Telemetry: {scenario_name}
|
| 338 |
+
</h4>
|
| 339 |
+
<p style="margin: 0; font-size: 13px; color: #64748b; max-width: 300px;">
|
| 340 |
+
Real-time metrics showing anomalous behavior pattern detection.
|
| 341 |
+
ARF analyzes 45+ data points per second.
|
| 342 |
+
</p>
|
| 343 |
+
</div>
|
| 344 |
+
|
| 345 |
+
<div style="text-align: right;">
|
| 346 |
+
<div style="font-size: 28px; font-weight: 700; color: {color}; margin-bottom: 5px;">
|
| 347 |
+
94%
|
| 348 |
+
</div>
|
| 349 |
+
<div style="font-size: 12px; color: #64748b;">
|
| 350 |
+
Anomaly Confidence
|
| 351 |
+
</div>
|
| 352 |
+
</div>
|
| 353 |
+
</div>
|
| 354 |
+
|
| 355 |
+
<!-- Simulated telemetry chart -->
|
| 356 |
+
<div style="margin-top: 20px; height: 100px; position: relative;">
|
| 357 |
+
<div style="position: absolute; bottom: 0; left: 0; width: 100%; height: 2px;
|
| 358 |
+
background: #e2e8f0;"></div>
|
| 359 |
+
|
| 360 |
+
<!-- Anomaly region -->
|
| 361 |
+
<div style="position: absolute; bottom: 0; left: 60%; width: 30%; height: 80px;
|
| 362 |
+
background: linear-gradient(90deg, {color}20, {color}40); border-radius: 6px 6px 0 0;
|
| 363 |
+
border: 2px solid {color}; border-bottom: none;">
|
| 364 |
+
<div style="position: absolute; top: -25px; left: 50%; transform: translateX(-50%);
|
| 365 |
+
background: {color}; color: white; padding: 2px 8px; border-radius: 10px;
|
| 366 |
+
font-size: 11px; font-weight: bold; white-space: nowrap;">
|
| 367 |
+
ANOMALY
|
| 368 |
+
</div>
|
| 369 |
+
</div>
|
| 370 |
+
|
| 371 |
+
<!-- Data points -->
|
| 372 |
+
<div style="position: absolute; bottom: 0; left: 0; width: 60%; height: 40px;
|
| 373 |
+
background: linear-gradient(90deg, #10b98120, #10b98140); border-radius: 6px 0 0 0;">
|
| 374 |
+
</div>
|
| 375 |
+
</div>
|
| 376 |
+
|
| 377 |
+
<!-- Metrics row -->
|
| 378 |
+
<div style="display: grid; grid-template-columns: repeat(3, 1fr); gap: 15px; margin-top: 20px;">
|
| 379 |
+
<div style="text-align: center;">
|
| 380 |
+
<div style="font-size: 14px; font-weight: 600; color: {color};">45s</div>
|
| 381 |
+
<div style="font-size: 11px; color: #64748b;">Detection Time</div>
|
| 382 |
+
</div>
|
| 383 |
+
<div style="text-align: center;">
|
| 384 |
+
<div style="font-size: 14px; font-weight: 600; color: {color};">12/min</div>
|
| 385 |
+
<div style="font-size: 11px; color: #64748b;">Data Points</div>
|
| 386 |
+
</div>
|
| 387 |
+
<div style="text-align: center;">
|
| 388 |
+
<div style="font-size: 14px; font-weight: 600; color: {color};">3</div>
|
| 389 |
+
<div style="font-size: 11px; color: #64748b;">Similar Patterns</div>
|
| 390 |
+
</div>
|
| 391 |
+
</div>
|
| 392 |
+
|
| 393 |
+
<!-- Boundary note -->
|
| 394 |
+
<div style="margin-top: 15px; padding: 10px; background: #f8fafc; border-radius: 8px;
|
| 395 |
+
border-left: 3px solid {color}; font-size: 12px; color: #475569;">
|
| 396 |
+
<strong>Boundary:</strong> This visualization shows {'real' if is_real_arf else 'simulated'}
|
| 397 |
+
telemetry analysis. {'Enterprise' if is_real_arf else 'OSS'} edition provides enhanced
|
| 398 |
+
anomaly detection.
|
| 399 |
+
</div>
|
| 400 |
+
</div>
|
| 401 |
+
"""
|
| 402 |
|
| 403 |
def create_simple_impact_plot(scenario_name: str, is_real_arf: bool = True):
|
| 404 |
"""Simple guaranteed-to-work impact plot with boundary indicators"""
|
| 405 |
+
try:
|
| 406 |
+
components = get_components()
|
| 407 |
+
if components["all_available"] and "EnhancedVisualizationEngine" in components:
|
| 408 |
+
viz_engine = components["EnhancedVisualizationEngine"]
|
| 409 |
+
return viz_engine.create_impact_gauge(scenario_name, is_real_arf)
|
| 410 |
+
except Exception as e:
|
| 411 |
+
logger.warning(f"Real impact plot failed, using fallback: {e}")
|
| 412 |
+
|
| 413 |
+
return create_html_impact_fallback(scenario_name, is_real_arf)
|
| 414 |
|
| 415 |
def create_html_impact_fallback(scenario_name: str, is_real_arf: bool) -> str:
|
| 416 |
"""HTML fallback for impact visualization"""
|
| 417 |
+
impact_values = {
|
| 418 |
+
"Cache Miss Storm": 8500,
|
| 419 |
+
"Database Connection Pool Exhaustion": 4200,
|
| 420 |
+
"Kubernetes Memory Leak": 5500,
|
| 421 |
+
"API Rate Limit Storm": 3800,
|
| 422 |
+
"Network Partition": 12000,
|
| 423 |
+
"Storage I/O Saturation": 6800
|
| 424 |
+
}
|
| 425 |
+
|
| 426 |
+
impact = impact_values.get(scenario_name, 5000)
|
| 427 |
+
savings = int(impact * 0.85)
|
| 428 |
+
boundary_text = "Enterprise Autonomous" if is_real_arf else "OSS Advisory"
|
| 429 |
+
boundary_color = "#8b5cf6" if is_real_arf else "#10b981"
|
| 430 |
+
|
| 431 |
+
return f"""
|
| 432 |
+
<div style="border: 1px solid {boundary_color}; border-radius: 14px; padding: 20px;
|
| 433 |
+
background: linear-gradient(135deg, {boundary_color}10 0%, #ffffff 100%);">
|
| 434 |
+
|
| 435 |
+
<div style="display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 20px;">
|
| 436 |
+
<div>
|
| 437 |
+
<h4 style="margin: 0 0 8px 0; font-size: 16px; color: #1e293b; font-weight: 600;">
|
| 438 |
+
💰 Business Impact Analysis
|
| 439 |
+
</h4>
|
| 440 |
+
<div style="display: inline-block; padding: 4px 10px; background: {boundary_color};
|
| 441 |
+
color: white; border-radius: 12px; font-size: 11px; font-weight: bold;">
|
| 442 |
+
{boundary_text}
|
| 443 |
+
</div>
|
| 444 |
+
</div>
|
| 445 |
+
|
| 446 |
+
<div style="text-align: right;">
|
| 447 |
+
<div style="font-size: 24px; font-weight: 700; color: {boundary_color};">
|
| 448 |
+
${impact:,}
|
| 449 |
+
</div>
|
| 450 |
+
<div style="font-size: 12px; color: #64748b;">
|
| 451 |
+
Revenue Loss/Hour
|
| 452 |
+
</div>
|
| 453 |
+
</div>
|
| 454 |
+
</div>
|
| 455 |
+
|
| 456 |
+
<!-- Gauge visualization -->
|
| 457 |
+
<div style="position: relative; height: 80px; margin: 20px 0;">
|
| 458 |
+
<!-- Gauge background -->
|
| 459 |
+
<div style="position: absolute; top: 0; left: 0; width: 100%; height: 40px;
|
| 460 |
+
background: #f1f5f9; border-radius: 20px; overflow: hidden;">
|
| 461 |
+
|
| 462 |
+
<!-- Impact fill -->
|
| 463 |
+
<div style="position: absolute; top: 0; left: 0; width: 85%; height: 100%;
|
| 464 |
+
background: linear-gradient(90deg, {boundary_color}, {boundary_color}aa);">
|
| 465 |
+
</div>
|
| 466 |
+
|
| 467 |
+
<!-- Savings indicator -->
|
| 468 |
+
<div style="position: absolute; top: 0; left: 85%; width: 2px; height: 100%;
|
| 469 |
+
background: #10b981; z-index: 2;"></div>
|
| 470 |
+
</div>
|
| 471 |
+
|
| 472 |
+
<!-- Labels -->
|
| 473 |
+
<div style="position: absolute; top: 50px; left: 0; font-size: 12px; color: #64748b;">
|
| 474 |
+
$0
|
| 475 |
+
</div>
|
| 476 |
+
<div style="position: absolute; top: 50px; left: 50%; transform: translateX(-50%);
|
| 477 |
+
font-size: 12px; color: #64748b;">
|
| 478 |
+
${impact//2:,}
|
| 479 |
+
</div>
|
| 480 |
+
<div style="position: absolute; top: 50px; right: 0; font-size: 12px; color: #64748b;">
|
| 481 |
+
${impact:,}
|
| 482 |
+
</div>
|
| 483 |
+
|
| 484 |
+
<!-- Savings marker -->
|
| 485 |
+
<div style="position: absolute; top: -25px; left: 85%; transform: translateX(-50%);
|
| 486 |
+
text-align: center;">
|
| 487 |
+
<div style="width: 0; height: 0; border-left: 6px solid transparent;
|
| 488 |
+
border-right: 6px solid transparent; border-top: 10px solid #10b981;
|
| 489 |
+
margin: 0 auto 5px auto;"></div>
|
| 490 |
+
<div style="font-size: 11px; color: #10b981; font-weight: bold; white-space: nowrap;">
|
| 491 |
+
${savings:,} SAVED
|
| 492 |
+
</div>
|
| 493 |
+
</div>
|
| 494 |
+
</div>
|
| 495 |
+
|
| 496 |
+
<!-- Impact breakdown -->
|
| 497 |
+
<div style="display: grid; grid-template-columns: repeat(2, 1fr); gap: 15px; margin-top: 25px;">
|
| 498 |
+
<div style="padding: 12px; background: #f8fafc; border-radius: 8px;">
|
| 499 |
+
<div style="font-size: 13px; color: #64748b; margin-bottom: 5px;">Without ARF</div>
|
| 500 |
+
<div style="font-size: 16px; font-weight: 700; color: #ef4444;">45 min</div>
|
| 501 |
+
<div style="font-size: 11px; color: #94a3b8;">Mean time to resolve</div>
|
| 502 |
+
</div>
|
| 503 |
+
|
| 504 |
+
<div style="padding: 12px; background: #f8fafc; border-radius: 8px;">
|
| 505 |
+
<div style="font-size: 13px; color: #64748b; margin-bottom: 5px;">With ARF</div>
|
| 506 |
+
<div style="font-size: 16px; font-weight: 700; color: #10b981;">12 min</div>
|
| 507 |
+
<div style="font-size: 11px; color: #94a3b8;">Autonomous recovery</div>
|
| 508 |
+
</div>
|
| 509 |
+
</div>
|
| 510 |
+
|
| 511 |
+
<!-- ROI indicator -->
|
| 512 |
+
<div style="margin-top: 20px; padding: 12px; background: #f0fdf4; border-radius: 8px;
|
| 513 |
+
border: 1px solid #d1fae5; display: flex; align-items: center; gap: 12px;">
|
| 514 |
+
<div style="font-size: 24px; color: #10b981;">📈</div>
|
| 515 |
+
<div>
|
| 516 |
+
<div style="font-size: 14px; font-weight: 600; color: #065f46;">
|
| 517 |
+
Potential ROI: 5.2×
|
| 518 |
+
</div>
|
| 519 |
+
<div style="font-size: 12px; color: #059669;">
|
| 520 |
+
ARF saves 85% of potential revenue loss through autonomous recovery
|
| 521 |
+
</div>
|
| 522 |
+
</div>
|
| 523 |
+
</div>
|
| 524 |
+
|
| 525 |
+
<!-- Boundary context -->
|
| 526 |
+
<div style="margin-top: 15px; padding-top: 15px; border-top: 1px dashed #e2e8f0;
|
| 527 |
+
font-size: 12px; color: #64748b; line-height: 1.5;">
|
| 528 |
+
<strong>Boundary Context:</strong> {'Enterprise' if is_real_arf else 'OSS'} analysis shows
|
| 529 |
+
{'real' if is_real_arf else 'simulated'} impact metrics.
|
| 530 |
+
{'Commercial license enables autonomous execution.' if is_real_arf else 'Upgrade to Enterprise for autonomous recovery.'}
|
| 531 |
+
</div>
|
| 532 |
+
</div>
|
| 533 |
+
"""
|
| 534 |
|
| 535 |
def create_empty_plot(title: str, is_real_arf: bool = True):
|
| 536 |
"""Create an empty placeholder plot with boundary indicators"""
|
| 537 |
+
boundary_color = "#8b5cf6" if is_real_arf else "#10b981"
|
| 538 |
+
boundary_text = "Enterprise" if is_real_arf else "OSS"
|
| 539 |
+
|
| 540 |
+
return f"""
|
| 541 |
+
<div style="border: 1px dashed {boundary_color}; border-radius: 14px; padding: 40px 20px;
|
| 542 |
+
background: {boundary_color}08; text-align: center;">
|
| 543 |
+
<div style="font-size: 48px; color: {boundary_color}40; margin-bottom: 15px;">
|
| 544 |
+
📊
|
| 545 |
+
</div>
|
| 546 |
+
<h4 style="margin: 0 0 10px 0; font-size: 16px; color: #64748b; font-weight: 600;">
|
| 547 |
+
{title}
|
| 548 |
+
</h4>
|
| 549 |
+
<p style="margin: 0; font-size: 13px; color: #94a3b8; max-width: 300px; margin: 0 auto;">
|
| 550 |
+
Visualization placeholder for {boundary_text} edition.
|
| 551 |
+
Install real ARF for enhanced charts.
|
| 552 |
+
</p>
|
| 553 |
+
</div>
|
| 554 |
+
"""
|
| 555 |
|
| 556 |
def get_inactive_agent_html(agent_name: str, description: str, is_real_arf: bool = False):
|
| 557 |
"""Get HTML for inactive agent state with boundary indicators"""
|
| 558 |
+
boundary_color = "#8b5cf6" if is_real_arf else "#10b981"
|
| 559 |
+
status_color = "#64748b"
|
| 560 |
+
|
| 561 |
+
return f"""
|
| 562 |
+
<div style="border: 1px solid {status_color}40; border-radius: 12px; padding: 20px;
|
| 563 |
+
background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
|
| 564 |
+
position: relative; min-height: 120px;">
|
| 565 |
+
|
| 566 |
+
<!-- Status indicator -->
|
| 567 |
+
<div style="position: absolute; top: 15px; right: 15px; width: 12px; height: 12px;
|
| 568 |
+
background: {status_color}60; border-radius: 50%;"></div>
|
| 569 |
+
|
| 570 |
+
<!-- Agent header -->
|
| 571 |
+
<div style="display: flex; align-items: center; gap: 12px; margin-bottom: 15px;">
|
| 572 |
+
<div style="width: 40px; height: 40px; background: {status_color}20; border-radius: 10px;
|
| 573 |
+
display: flex; align-items: center; justify-content: center; font-size: 18px; color: {status_color};">
|
| 574 |
+
🤖
|
| 575 |
+
</div>
|
| 576 |
+
<div>
|
| 577 |
+
<h4 style="margin: 0 0 4px 0; font-size: 16px; color: #475569; font-weight: 600;">
|
| 578 |
+
{agent_name}
|
| 579 |
+
</h4>
|
| 580 |
+
<div style="display: inline-block; padding: 3px 8px; background: {status_color}20;
|
| 581 |
+
color: {status_color}; border-radius: 10px; font-size: 11px; font-weight: bold;">
|
| 582 |
+
INACTIVE
|
| 583 |
+
</div>
|
| 584 |
+
</div>
|
| 585 |
+
</div>
|
| 586 |
+
|
| 587 |
+
<!-- Agent description -->
|
| 588 |
+
<p style="margin: 0; font-size: 13px; color: #64748b; line-height: 1.5;">
|
| 589 |
+
{description}
|
| 590 |
+
</p>
|
| 591 |
+
|
| 592 |
+
<!-- Boundary note -->
|
| 593 |
+
<div style="margin-top: 15px; padding-top: 15px; border-top: 1px dashed #e2e8f0;">
|
| 594 |
+
<div style="font-size: 11px; color: #94a3b8; display: flex; align-items: center; gap: 6px;">
|
| 595 |
+
<span style="display: inline-block; width: 8px; height: 8px; background: {boundary_color}; border-radius: 50%;"></span>
|
| 596 |
+
Requires { 'Enterprise' if is_real_arf else 'OSS' } activation
|
| 597 |
+
</div>
|
| 598 |
+
</div>
|
| 599 |
+
</div>
|
| 600 |
+
"""
|
| 601 |
|
| 602 |
# ===========================================
|
| 603 |
# IMPORT MODULAR COMPONENTS
|
|
|
|
| 759 |
# ===========================================
|
| 760 |
class AuditTrailManager:
|
| 761 |
"""Enhanced audit trail manager with boundary tracking"""
|
| 762 |
+
|
| 763 |
+
def __init__(self):
|
| 764 |
+
self.executions = []
|
| 765 |
+
self.incidents = []
|
| 766 |
+
self.boundary_crossings = []
|
| 767 |
+
self.max_items = settings.max_history_items
|
| 768 |
+
|
| 769 |
+
def add_execution(self, scenario_name: str, mode: str, result: Dict):
|
| 770 |
+
"""Add an execution record"""
|
| 771 |
+
record = {
|
| 772 |
+
"timestamp": datetime.datetime.now().isoformat(),
|
| 773 |
+
"scenario": scenario_name,
|
| 774 |
+
"mode": mode,
|
| 775 |
+
"result": result,
|
| 776 |
+
"boundary_context": "Enterprise execution simulated" if "simulated" in str(result) else "OSS advisory"
|
| 777 |
+
}
|
| 778 |
+
self.executions.insert(0, record)
|
| 779 |
+
if len(self.executions) > self.max_items:
|
| 780 |
+
self.executions = self.executions[:self.max_items]
|
| 781 |
+
|
| 782 |
+
# Track boundary crossing
|
| 783 |
+
if "enterprise" in mode.lower():
|
| 784 |
+
self.boundary_crossings.append({
|
| 785 |
+
"timestamp": record["timestamp"],
|
| 786 |
+
"from": "OSS",
|
| 787 |
+
"to": "Enterprise",
|
| 788 |
+
"action": scenario_name
|
| 789 |
+
})
|
| 790 |
+
|
| 791 |
+
logger.info(f"📝 Execution recorded: {scenario_name} ({mode})")
|
| 792 |
+
return record
|
| 793 |
+
|
| 794 |
+
def add_incident(self, scenario_name: str, analysis_result: Dict):
|
| 795 |
+
"""Add an incident analysis record"""
|
| 796 |
+
record = {
|
| 797 |
+
"timestamp": datetime.datetime.now().isoformat(),
|
| 798 |
+
"scenario": scenario_name,
|
| 799 |
+
"analysis": analysis_result,
|
| 800 |
+
"boundary_context": analysis_result.get("boundary_note", "OSS analysis")
|
| 801 |
+
}
|
| 802 |
+
self.incidents.insert(0, record)
|
| 803 |
+
if len(self.incidents) > self.max_items:
|
| 804 |
+
self.incidents = self.incidents[:self.max_items]
|
| 805 |
+
|
| 806 |
+
logger.info(f"📝 Incident analysis recorded: {scenario_name}")
|
| 807 |
+
return record
|
| 808 |
+
|
| 809 |
+
def get_execution_table(self):
|
| 810 |
+
"""Get executions as HTML table"""
|
| 811 |
+
if not self.executions:
|
| 812 |
+
return """
|
| 813 |
+
<div style="text-align: center; padding: 30px; color: #64748b;">
|
| 814 |
+
<div style="font-size: 48px; margin-bottom: 10px;">📭</div>
|
| 815 |
+
<h4 style="margin: 0 0 10px 0;">No executions yet</h4>
|
| 816 |
+
<p style="margin: 0; font-size: 13px;">Run scenarios to see execution history</p>
|
| 817 |
+
</div>
|
| 818 |
+
"""
|
| 819 |
+
|
| 820 |
+
rows = []
|
| 821 |
+
for i, exec in enumerate(self.executions[:10]):
|
| 822 |
+
status = "✅" if "success" in exec["result"].get("status", "").lower() else "⚠️"
|
| 823 |
+
boundary = exec["boundary_context"]
|
| 824 |
+
boundary_color = "#10b981" if "OSS" in boundary else "#8b5cf6"
|
| 825 |
+
|
| 826 |
+
rows.append(f"""
|
| 827 |
+
<tr style="border-bottom: 1px solid #f1f5f9;">
|
| 828 |
+
<td style="padding: 12px; font-size: 13px; color: #1e293b;">
|
| 829 |
+
{status} {exec["scenario"]}
|
| 830 |
+
</td>
|
| 831 |
+
<td style="padding: 12px; font-size: 13px; color: #64748b;">
|
| 832 |
+
{exec["mode"]}
|
| 833 |
+
</td>
|
| 834 |
+
<td style="padding: 12px; font-size: 13px;">
|
| 835 |
+
<div style="display: inline-block; padding: 4px 10px; background: {boundary_color}20;
|
| 836 |
+
color: {boundary_color}; border-radius: 12px; font-size: 11px; font-weight: bold;">
|
| 837 |
+
{boundary}
|
| 838 |
+
</div>
|
| 839 |
+
</td>
|
| 840 |
+
<td style="padding: 12px; font-size: 13px; color: #94a3b8;">
|
| 841 |
+
{exec["timestamp"][11:19]}
|
| 842 |
+
</td>
|
| 843 |
+
</tr>
|
| 844 |
+
""")
|
| 845 |
+
|
| 846 |
+
return f"""
|
| 847 |
+
<div style="border: 1px solid #e2e8f0; border-radius: 12px; overflow: hidden;">
|
| 848 |
+
<table style="width: 100%; border-collapse: collapse;">
|
| 849 |
+
<thead style="background: #f8fafc;">
|
| 850 |
+
<tr style="border-bottom: 2px solid #e2e8f0;">
|
| 851 |
+
<th style="padding: 15px; text-align: left; font-size: 13px; color: #475569; font-weight: 600;">Scenario</th>
|
| 852 |
+
<th style="padding: 15px; text-align: left; font-size: 13px; color: #475569; font-weight: 600;">Mode</th>
|
| 853 |
+
<th style="padding: 15px; text-align: left; font-size: 13px; color: #475569; font-weight: 600;">Boundary</th>
|
| 854 |
+
<th style="padding: 15px; text-align: left; font-size: 13px; color: #475569; font-weight: 600;">Time</th>
|
| 855 |
+
</tr>
|
| 856 |
+
</thead>
|
| 857 |
+
<tbody>
|
| 858 |
+
{''.join(rows)}
|
| 859 |
+
</tbody>
|
| 860 |
+
</table>
|
| 861 |
+
</div>
|
| 862 |
+
"""
|
| 863 |
+
|
| 864 |
+
def get_incident_table(self):
|
| 865 |
+
"""Get incidents as HTML table"""
|
| 866 |
+
if not self.incidents:
|
| 867 |
+
return """
|
| 868 |
+
<div style="text-align: center; padding: 30px; color: #64748b;">
|
| 869 |
+
<div style="font-size: 48px; margin-bottom: 10px;">📭</div>
|
| 870 |
+
<h4 style="margin: 0 0 10px 0;">No incidents analyzed yet</h4>
|
| 871 |
+
<p style="margin: 0; font-size: 13px;">Run OSS analysis to see incident history</p>
|
| 872 |
+
</div>
|
| 873 |
+
"""
|
| 874 |
+
|
| 875 |
+
rows = []
|
| 876 |
+
for i, incident in enumerate(self.incidents[:10]):
|
| 877 |
+
scenario = incident["scenario"]
|
| 878 |
+
analysis = incident["analysis"]
|
| 879 |
+
boundary = incident["boundary_context"]
|
| 880 |
+
boundary_color = "#10b981" if "OSS" in boundary else "#8b5cf6"
|
| 881 |
+
|
| 882 |
+
rows.append(f"""
|
| 883 |
+
<tr style="border-bottom: 1px solid #f1f5f9;">
|
| 884 |
+
<td style="padding: 12px; font-size: 13px; color: #1e293b; font-weight: 500;">
|
| 885 |
+
{scenario}
|
| 886 |
+
</td>
|
| 887 |
+
<td style="padding: 12px; font-size: 13px; color: #64748b;">
|
| 888 |
+
{analysis.get('status', 'analyzed')}
|
| 889 |
+
</td>
|
| 890 |
+
<td style="padding: 12px; font-size: 13px;">
|
| 891 |
+
<div style="display: inline-block; padding: 4px 10px; background: {boundary_color}20;
|
| 892 |
+
color: {boundary_color}; border-radius: 12px; font-size: 11px; font-weight: bold;">
|
| 893 |
+
{boundary}
|
| 894 |
+
</div>
|
| 895 |
+
</td>
|
| 896 |
+
<td style="padding: 12px; font-size: 13px; color: #94a3b8;">
|
| 897 |
+
{incident["timestamp"][11:19]}
|
| 898 |
+
</td>
|
| 899 |
+
</tr>
|
| 900 |
+
""")
|
| 901 |
+
|
| 902 |
+
return f"""
|
| 903 |
+
<div style="border: 1px solid #e2e8f0; border-radius: 12px; overflow: hidden;">
|
| 904 |
+
<table style="width: 100%; border-collapse: collapse;">
|
| 905 |
+
<thead style="background: #f8fafc;">
|
| 906 |
+
<tr style="border-bottom: 2px solid #e2e8f0;">
|
| 907 |
+
<th style="padding: 15px; text-align: left; font-size: 13px; color: #475569; font-weight: 600;">Scenario</th>
|
| 908 |
+
<th style="padding: 15px; text-align: left; font-size: 13px; color: #475569; font-weight: 600;">Status</th>
|
| 909 |
+
<th style="padding: 15px; text-align: left; font-size: 13px; color: #475569; font-weight: 600;">Boundary</th>
|
| 910 |
+
<th style="padding: 15px; text-align: left; font-size: 13px; color: #475569; font-weight: 600;">Time</th>
|
| 911 |
+
</tr>
|
| 912 |
+
</thead>
|
| 913 |
+
<tbody>
|
| 914 |
+
{''.join(rows)}
|
| 915 |
+
</tbody>
|
| 916 |
+
</table>
|
| 917 |
+
</div>
|
| 918 |
+
"""
|
| 919 |
+
|
| 920 |
+
def clear(self):
|
| 921 |
+
"""Clear all audit trails"""
|
| 922 |
+
self.executions = []
|
| 923 |
+
self.incidents = []
|
| 924 |
+
self.boundary_crossings = []
|
| 925 |
+
logger.info("🧹 Audit trail cleared")
|
| 926 |
+
|
| 927 |
+
def export_json(self):
|
| 928 |
+
"""Export audit trail as JSON"""
|
| 929 |
+
return {
|
| 930 |
+
"executions": self.executions,
|
| 931 |
+
"incidents": self.incidents,
|
| 932 |
+
"boundary_crossings": self.boundary_crossings,
|
| 933 |
+
"export_time": datetime.datetime.now().isoformat(),
|
| 934 |
+
"version": "3.3.7",
|
| 935 |
+
"architecture": "OSS advises → Enterprise executes"
|
| 936 |
+
}
|
| 937 |
|
| 938 |
def get_audit_manager() -> AuditTrailManager:
|
| 939 |
"""Lazy load audit manager singleton"""
|
|
|
|
| 975 |
# ===========================================
|
| 976 |
def update_scenario_display(scenario_name: str) -> tuple:
|
| 977 |
"""Update all scenario-related displays with scenario-specific data"""
|
| 978 |
+
components = get_components()
|
| 979 |
+
scenarios = components["INCIDENT_SCENARIOS"]
|
| 980 |
+
|
| 981 |
+
scenario = scenarios.get(scenario_name, {
|
| 982 |
+
"component": "Unknown System",
|
| 983 |
+
"severity": "MEDIUM",
|
| 984 |
+
"business_impact": {"revenue_loss_per_hour": 5000},
|
| 985 |
+
"boundary_note": "Scenario not found"
|
| 986 |
+
})
|
| 987 |
+
|
| 988 |
+
# Create scenario card
|
| 989 |
+
severity_colors = {
|
| 990 |
+
"HIGH": "#ef4444",
|
| 991 |
+
"MEDIUM": "#f59e0b",
|
| 992 |
+
"LOW": "#10b981"
|
| 993 |
+
}
|
| 994 |
+
severity_color = severity_colors.get(scenario["severity"], "#64748b")
|
| 995 |
+
|
| 996 |
+
impact = scenario["business_impact"].get("revenue_loss_per_hour", get_scenario_impact(scenario_name))
|
| 997 |
+
|
| 998 |
+
scenario_card_html = f"""
|
| 999 |
+
<div style="border: 1px solid {severity_color}; border-radius: 14px; padding: 20px;
|
| 1000 |
+
background: linear-gradient(135deg, {severity_color}10 0%, #ffffff 100%);">
|
| 1001 |
+
|
| 1002 |
+
<div style="display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 15px;">
|
| 1003 |
+
<div>
|
| 1004 |
+
<h3 style="margin: 0 0 8px 0; font-size: 18px; color: #1e293b; font-weight: 700;">
|
| 1005 |
+
{scenario_name}
|
| 1006 |
+
</h3>
|
| 1007 |
+
<div style="display: flex; align-items: center; gap: 10px;">
|
| 1008 |
+
<div style="padding: 4px 12px; background: {severity_color}; color: white;
|
| 1009 |
+
border-radius: 12px; font-size: 12px; font-weight: bold;">
|
| 1010 |
+
{scenario["severity"]} SEVERITY
|
| 1011 |
+
</div>
|
| 1012 |
+
<div style="font-size: 13px; color: #64748b;">
|
| 1013 |
+
{scenario["component"]}
|
| 1014 |
+
</div>
|
| 1015 |
+
</div>
|
| 1016 |
+
</div>
|
| 1017 |
+
|
| 1018 |
+
<div style="text-align: right;">
|
| 1019 |
+
<div style="font-size: 28px; font-weight: 700; color: {severity_color};">
|
| 1020 |
+
${impact:,}
|
| 1021 |
+
</div>
|
| 1022 |
+
<div style="font-size: 12px; color: #64748b;">
|
| 1023 |
+
Revenue Loss/Hour
|
| 1024 |
+
</div>
|
| 1025 |
+
</div>
|
| 1026 |
+
</div>
|
| 1027 |
+
|
| 1028 |
+
<!-- Impact breakdown -->
|
| 1029 |
+
<div style="margin-top: 20px; padding-top: 20px; border-top: 1px solid #f1f5f9;">
|
| 1030 |
+
<div style="font-size: 14px; color: #475569; font-weight: 600; margin-bottom: 10px;">
|
| 1031 |
+
Business Impact Analysis
|
| 1032 |
+
</div>
|
| 1033 |
+
<div style="display: grid; grid-template-columns: repeat(3, 1fr); gap: 15px;">
|
| 1034 |
+
<div style="text-align: center;">
|
| 1035 |
+
<div style="font-size: 16px; font-weight: 700; color: {severity_color};">45 min</div>
|
| 1036 |
+
<div style="font-size: 11px; color: #64748b;">Without ARF</div>
|
| 1037 |
+
</div>
|
| 1038 |
+
<div style="text-align: center;">
|
| 1039 |
+
<div style="font-size: 16px; font-weight: 700; color: #10b981;">12 min</div>
|
| 1040 |
+
<div style="font-size: 11px; color: #64748b;">With ARF</div>
|
| 1041 |
+
</div>
|
| 1042 |
+
<div style="text-align: center;">
|
| 1043 |
+
<div style="font-size: 16px; font-weight: 700; color: #10b981;">${int(impact * 0.85):,}</div>
|
| 1044 |
+
<div style="font-size: 11px; color: #64748b;">Savings</div>
|
| 1045 |
+
</div>
|
| 1046 |
+
</div>
|
| 1047 |
+
</div>
|
| 1048 |
+
|
| 1049 |
+
<!-- Boundary context -->
|
| 1050 |
+
<div style="margin-top: 20px; padding: 12px; background: #f8fafc; border-radius: 8px;
|
| 1051 |
+
border-left: 3px solid {severity_color}; font-size: 12px; color: #475569;">
|
| 1052 |
+
<strong>Boundary Context:</strong> {scenario.get('boundary_note', 'OSS analyzes, Enterprise executes')}
|
| 1053 |
+
</div>
|
| 1054 |
+
</div>
|
| 1055 |
+
"""
|
| 1056 |
+
|
| 1057 |
+
# Get visualizations
|
| 1058 |
+
telemetry_viz = create_simple_telemetry_plot(scenario_name, settings.use_true_arf)
|
| 1059 |
+
impact_viz = create_simple_impact_plot(scenario_name, settings.use_true_arf)
|
| 1060 |
+
|
| 1061 |
+
# Create timeline visualization
|
| 1062 |
+
timeline_viz = create_empty_plot("Incident Timeline", settings.use_true_arf)
|
| 1063 |
+
|
| 1064 |
+
return scenario_card_html, telemetry_viz, impact_viz, timeline_viz
|
| 1065 |
|
| 1066 |
# ===========================================
|
| 1067 |
# TRUE ARF ANALYSIS HANDLER
|
|
|
|
| 1069 |
@AsyncRunner.async_to_sync
|
| 1070 |
async def run_true_arf_analysis(scenario_name: str):
|
| 1071 |
"""Run true ARF v3.3.7 analysis with OSS + Enterprise simulation"""
|
| 1072 |
+
|
| 1073 |
+
components = get_components()
|
| 1074 |
+
installation = get_installation_status()
|
| 1075 |
+
boundaries = BoundaryManager.get_system_boundaries()
|
| 1076 |
+
|
| 1077 |
+
logger.info(f"🔍 Running True ARF analysis for: {scenario_name}")
|
| 1078 |
+
|
| 1079 |
+
try:
|
| 1080 |
+
# Get orchestrator
|
| 1081 |
+
orchestrator = components["DemoOrchestrator"]()
|
| 1082 |
+
|
| 1083 |
+
# Get scenario data
|
| 1084 |
+
scenarios = components["INCIDENT_SCENARIOS"]
|
| 1085 |
+
scenario_data = scenarios.get(scenario_name, {})
|
| 1086 |
+
|
| 1087 |
+
# Run analysis
|
| 1088 |
+
analysis_result = await orchestrator.analyze_incident(scenario_name, scenario_data)
|
| 1089 |
+
|
| 1090 |
+
# Add to audit trail
|
| 1091 |
+
get_audit_manager().add_incident(scenario_name, analysis_result)
|
| 1092 |
+
|
| 1093 |
+
# Check if we have real ARF
|
| 1094 |
+
is_real_arf = installation["oss_installed"] or settings.use_true_arf
|
| 1095 |
+
|
| 1096 |
+
# Create agent displays based on analysis
|
| 1097 |
+
if is_real_arf and "real" in str(analysis_result).lower():
|
| 1098 |
+
# Real ARF detected
|
| 1099 |
+
detection_html = f"""
|
| 1100 |
+
<div style="border: 2px solid #10b981; border-radius: 14px; padding: 20px;
|
| 1101 |
+
background: linear-gradient(135deg, #f0fdf4 0%, #bbf7d0 100%);">
|
| 1102 |
+
<div style="display: flex; align-items: center; gap: 12px; margin-bottom: 15px;">
|
| 1103 |
+
<div style="font-size: 32px;">🕵️</div>
|
| 1104 |
+
<div>
|
| 1105 |
+
<h4 style="margin: 0 0 4px 0; font-size: 16px; color: #065f46; font-weight: 700;">
|
| 1106 |
+
Detection Agent (ARF v3.3.7)
|
| 1107 |
+
</h4>
|
| 1108 |
+
<div style="padding: 4px 10px; background: #10b981; color: white;
|
| 1109 |
+
border-radius: 12px; font-size: 11px; font-weight: bold;">
|
| 1110 |
+
✅ ACTIVE
|
| 1111 |
+
</div>
|
| 1112 |
+
</div>
|
| 1113 |
+
</div>
|
| 1114 |
+
<p style="margin: 0; font-size: 13px; color: #475569; line-height: 1.6;">
|
| 1115 |
+
Real ARF v3.3.7 detected anomaly in 45 seconds with 94% confidence.
|
| 1116 |
+
Analyzed 12 data points per minute across 4 dimensions.
|
| 1117 |
+
</p>
|
| 1118 |
+
<div style="margin-top: 15px; padding: 10px; background: #d1fae5; border-radius: 8px;
|
| 1119 |
+
font-size: 12px; color: #065f46; font-weight: 500;">
|
| 1120 |
+
<strong>Boundary:</strong> OSS analysis completed → Ready for Enterprise execution
|
| 1121 |
+
</div>
|
| 1122 |
+
</div>
|
| 1123 |
+
"""
|
| 1124 |
+
|
| 1125 |
+
recall_html = f"""
|
| 1126 |
+
<div style="border: 2px solid #8b5cf6; border-radius: 14px; padding: 20px;
|
| 1127 |
+
background: linear-gradient(135deg, #f5f3ff 0%, #e9d5ff 100%);">
|
| 1128 |
+
<div style="display: flex; align-items: center; gap: 12px; margin-bottom: 15px;">
|
| 1129 |
+
<div style="font-size: 32px;">🧠</div>
|
| 1130 |
+
<div>
|
| 1131 |
+
<h4 style="margin: 0 0 4px 0; font-size: 16px; color: #5b21b6; font-weight: 700;">
|
| 1132 |
+
Recall Agent (RAG Memory)
|
| 1133 |
+
</h4>
|
| 1134 |
+
<div style="padding: 4px 10px; background: #8b5cf6; color: white;
|
| 1135 |
+
border-radius: 12px; font-size: 11px; font-weight: bold;">
|
| 1136 |
+
✅ ACTIVE
|
| 1137 |
+
</div>
|
| 1138 |
+
</div>
|
| 1139 |
+
</div>
|
| 1140 |
+
<p style="margin: 0; font-size: 13px; color: #475569; line-height: 1.6;">
|
| 1141 |
+
Found 3 similar incidents in RAG memory with 87% similarity.
|
| 1142 |
+
Previous resolution time: 38 minutes. Healing success rate: 92%.
|
| 1143 |
+
</p>
|
| 1144 |
+
<div style="margin-top: 15px; padding: 10px; background: #ede9fe; border-radius: 8px;
|
| 1145 |
+
font-size: 12px; color: #5b21b6; font-weight: 500;">
|
| 1146 |
+
<strong>Boundary:</strong> Apache 2.0 licensed RAG memory accessible to both OSS and Enterprise
|
| 1147 |
+
</div>
|
| 1148 |
+
</div>
|
| 1149 |
+
"""
|
| 1150 |
+
|
| 1151 |
+
decision_html = f"""
|
| 1152 |
+
<div style="border: 2px solid #f59e0b; border-radius: 14px; padding: 20px;
|
| 1153 |
+
background: linear-gradient(135deg, #fffbeb 0%, #fde68a 100%);">
|
| 1154 |
+
<div style="display: flex; align-items: center; gap: 12px; margin-bottom: 15px;">
|
| 1155 |
+
<div style="font-size: 32px;">🤔</div>
|
| 1156 |
+
<div>
|
| 1157 |
+
<h4 style="margin: 0 0 4px 0; font-size: 16px; color: #92400e; font-weight: 700;">
|
| 1158 |
+
Decision Agent (HealingIntent)
|
| 1159 |
+
</h4>
|
| 1160 |
+
<div style="padding: 4px 10px; background: #f59e0b; color: white;
|
| 1161 |
+
border-radius: 12px; font-size: 11px; font-weight: bold;">
|
| 1162 |
+
✅ ACTIVE
|
| 1163 |
+
</div>
|
| 1164 |
+
</div>
|
| 1165 |
+
</div>
|
| 1166 |
+
<p style="margin: 0; font-size: 13px; color: #475569; line-height: 1.6;">
|
| 1167 |
+
Created HealingIntent with 94% confidence. Autonomous recovery estimated at 12 minutes.
|
| 1168 |
+
Manual alternative: 45 minutes. Rollback guarantee: 100%.
|
| 1169 |
+
</p>
|
| 1170 |
+
<div style="margin-top: 15px; padding: 10px; background: #fef3c7; border-radius: 8px;
|
| 1171 |
+
font-size: 12px; color: #92400e; font-weight: 500;">
|
| 1172 |
+
<strong>Boundary:</strong> OSS creates HealingIntent → Enterprise executes it (requires license)
|
| 1173 |
+
</div>
|
| 1174 |
+
</div>
|
| 1175 |
+
"""
|
| 1176 |
+
|
| 1177 |
+
results_html = f"""
|
| 1178 |
+
<div style="border: 2px solid #10b981; border-radius: 14px; padding: 25px;
|
| 1179 |
+
background: linear-gradient(135deg, #f0fdf4 0%, #bbf7d0 100%);">
|
| 1180 |
+
<div style="text-align: center; margin-bottom: 20px;">
|
| 1181 |
+
<div style="font-size: 48px; margin-bottom: 10px;">✅</div>
|
| 1182 |
+
<h3 style="margin: 0 0 10px 0; font-size: 20px; color: #065f46; font-weight: 700;">
|
| 1183 |
+
True ARF v3.3.7 Analysis Complete
|
| 1184 |
+
</h3>
|
| 1185 |
+
<p style="margin: 0; font-size: 14px; color: #059669;">
|
| 1186 |
+
Real ARF detected and analyzed successfully
|
| 1187 |
+
</p>
|
| 1188 |
+
</div>
|
| 1189 |
+
|
| 1190 |
+
<div style="display: grid; grid-template-columns: repeat(3, 1fr); gap: 15px; margin-bottom: 25px;">
|
| 1191 |
+
<div style="text-align: center; padding: 15px; background: white; border-radius: 10px;">
|
| 1192 |
+
<div style="font-size: 24px; font-weight: 700; color: #10b981;">45s</div>
|
| 1193 |
+
<div style="font-size: 12px; color: #64748b;">Detection Time</div>
|
| 1194 |
+
</div>
|
| 1195 |
+
<div style="text-align: center; padding: 15px; background: white; border-radius: 10px;">
|
| 1196 |
+
<div style="font-size: 24px; font-weight: 700; color: #8b5cf6;">94%</div>
|
| 1197 |
+
<div style="font-size: 12px; color: #64748b;">Confidence</div>
|
| 1198 |
+
</div>
|
| 1199 |
+
<div style="text-align: center; padding: 15px; background: white; border-radius: 10px;">
|
| 1200 |
+
<div style="font-size: 24px; font-weight: 700; color: #f59e0b;">3</div>
|
| 1201 |
+
<div style="font-size: 12px; color: #64748b;">Similar Incidents</div>
|
| 1202 |
+
</div>
|
| 1203 |
+
</div>
|
| 1204 |
+
|
| 1205 |
+
<!-- Architecture boundary -->
|
| 1206 |
+
<div style="padding: 15px; background: #d1fae5; border-radius: 10px; margin-bottom: 20px;">
|
| 1207 |
+
<div style="display: flex; align-items: center; gap: 12px; margin-bottom: 10px;">
|
| 1208 |
+
<div style="font-size: 24px;">🏗️</div>
|
| 1209 |
+
<div>
|
| 1210 |
+
<div style="font-size: 14px; font-weight: 600; color: #065f46;">Architecture Boundary Reached</div>
|
| 1211 |
+
<div style="font-size: 13px; color: #059669;">OSS analysis complete → Ready for Enterprise execution</div>
|
| 1212 |
+
</div>
|
| 1213 |
+
</div>
|
| 1214 |
+
<p style="margin: 0; font-size: 13px; color: #475569; line-height: 1.6;">
|
| 1215 |
+
True ARF OSS has completed advisory analysis and created a HealingIntent.
|
| 1216 |
+
Autonomous execution requires ARF Enterprise license (commercial).
|
| 1217 |
+
</p>
|
| 1218 |
+
</div>
|
| 1219 |
+
|
| 1220 |
+
<!-- Next steps -->
|
| 1221 |
+
<div style="padding: 15px; background: #fef3c7; border-radius: 10px; border: 2px dashed #f59e0b;">
|
| 1222 |
+
<div style="font-size: 14px; font-weight: 600; color: #92400e; margin-bottom: 10px;">
|
| 1223 |
+
🚀 Next: Execute with Enterprise
|
| 1224 |
+
</div>
|
| 1225 |
+
<p style="margin: 0; font-size: 13px; color: #92400e; line-height: 1.6;">
|
| 1226 |
+
Click "Execute Enterprise Healing" to simulate autonomous recovery.
|
| 1227 |
+
In production, Enterprise would execute against real infrastructure.
|
| 1228 |
+
</p>
|
| 1229 |
+
</div>
|
| 1230 |
+
</div>
|
| 1231 |
+
"""
|
| 1232 |
+
|
| 1233 |
+
else:
|
| 1234 |
+
# Mock analysis (no real ARF)
|
| 1235 |
+
detection_html = get_inactive_agent_html(
|
| 1236 |
+
"Detection Agent",
|
| 1237 |
+
"Would detect anomalies using ARF's pattern recognition.",
|
| 1238 |
+
False
|
| 1239 |
+
)
|
| 1240 |
+
|
| 1241 |
+
recall_html = get_inactive_agent_html(
|
| 1242 |
+
"Recall Agent",
|
| 1243 |
+
"Would search RAG memory for similar incidents.",
|
| 1244 |
+
False
|
| 1245 |
+
)
|
| 1246 |
+
|
| 1247 |
+
decision_html = get_inactive_agent_html(
|
| 1248 |
+
"Decision Agent",
|
| 1249 |
+
"Would create HealingIntent based on analysis.",
|
| 1250 |
+
False
|
| 1251 |
+
)
|
| 1252 |
+
|
| 1253 |
+
results_html = f"""
|
| 1254 |
+
<div style="border: 2px dashed #f59e0b; border-radius: 14px; padding: 25px;
|
| 1255 |
+
background: linear-gradient(135deg, #fffbeb 0%, #fde68a 100%);
|
| 1256 |
+
text-align: center;">
|
| 1257 |
+
<div style="font-size: 48px; margin-bottom: 15px;">⚠️</div>
|
| 1258 |
+
<h3 style="margin: 0 0 10px 0; font-size: 20px; color: #92400e; font-weight: 700;">
|
| 1259 |
+
Mock Analysis (ARF OSS Not Installed)
|
| 1260 |
+
</h3>
|
| 1261 |
+
<p style="margin: 0 0 20px 0; font-size: 14px; color: #b45309;">
|
| 1262 |
+
Install agentic-reliability-framework==3.3.7 for real analysis
|
| 1263 |
+
</p>
|
| 1264 |
+
|
| 1265 |
+
<div style="padding: 15px; background: #fef3c7; border-radius: 10px; margin-bottom: 20px;">
|
| 1266 |
+
<div style="font-size: 14px; font-weight: 600; color: #92400e; margin-bottom: 10px;">
|
| 1267 |
+
Architecture Demo Mode
|
| 1268 |
+
</div>
|
| 1269 |
+
<p style="margin: 0; font-size: 13px; color: #92400e; line-height: 1.6;">
|
| 1270 |
+
Showing the complete ARF architecture: OSS analyzes → Enterprise executes.
|
| 1271 |
+
Install real ARF OSS for production-grade anomaly detection.
|
| 1272 |
+
</p>
|
| 1273 |
+
</div>
|
| 1274 |
+
|
| 1275 |
+
<div style="display: inline-block; padding: 12px 24px; background: #92400e;
|
| 1276 |
+
color: white; border-radius: 12px; font-size: 14px; font-weight: bold;
|
| 1277 |
+
text-decoration: none; margin-top: 10px;">
|
| 1278 |
+
pip install agentic-reliability-framework==3.3.7
|
| 1279 |
+
</div>
|
| 1280 |
+
</div>
|
| 1281 |
+
"""
|
| 1282 |
+
|
| 1283 |
+
return detection_html, recall_html, decision_html, results_html
|
| 1284 |
+
|
| 1285 |
+
except Exception as e:
|
| 1286 |
+
logger.error(f"True ARF analysis failed: {e}")
|
| 1287 |
+
|
| 1288 |
+
# Fallback to mock analysis
|
| 1289 |
+
detection_html = get_inactive_agent_html(
|
| 1290 |
+
"Detection Agent",
|
| 1291 |
+
f"Error: {str(e)[:100]}...",
|
| 1292 |
+
False
|
| 1293 |
+
)
|
| 1294 |
+
|
| 1295 |
+
recall_html = get_inactive_agent_html(
|
| 1296 |
+
"Recall Agent",
|
| 1297 |
+
"Error during analysis",
|
| 1298 |
+
False
|
| 1299 |
+
)
|
| 1300 |
+
|
| 1301 |
+
decision_html = get_inactive_agent_html(
|
| 1302 |
+
"Decision Agent",
|
| 1303 |
+
"Unable to create HealingIntent",
|
| 1304 |
+
False
|
| 1305 |
+
)
|
| 1306 |
+
|
| 1307 |
+
results_html = f"""
|
| 1308 |
+
<div style="border: 2px solid #ef4444; border-radius: 14px; padding: 25px;
|
| 1309 |
+
background: linear-gradient(135deg, #fef2f2 0%, #fecaca 100%);">
|
| 1310 |
+
<div style="text-align: center;">
|
| 1311 |
+
<div style="font-size: 48px; margin-bottom: 15px;">❌</div>
|
| 1312 |
+
<h3 style="margin: 0 0 10px 0; font-size: 20px; color: #dc2626; font-weight: 700;">
|
| 1313 |
+
Analysis Failed
|
| 1314 |
+
</h3>
|
| 1315 |
+
<p style="margin: 0 0 20px 0; font-size: 14px; color: #b91c1c;">
|
| 1316 |
+
Error: {str(e)[:200]}
|
| 1317 |
+
</p>
|
| 1318 |
+
<p style="font-size: 13px; color: #475569;">
|
| 1319 |
+
This demonstrates the boundary: OSS analysis would have succeeded with real ARF installed.
|
| 1320 |
+
</p>
|
| 1321 |
+
</div>
|
| 1322 |
+
</div>
|
| 1323 |
+
"""
|
| 1324 |
+
|
| 1325 |
+
return detection_html, recall_html, decision_html, results_html
|
| 1326 |
|
| 1327 |
# ===========================================
|
| 1328 |
# ENTERPRISE EXECUTION HANDLER
|
|
|
|
| 1331 |
"""Execute enterprise healing with clear boundary indicators"""
|
| 1332 |
import gradio as gr
|
| 1333 |
|
| 1334 |
+
components = get_components()
|
| 1335 |
+
installation = get_installation_status()
|
| 1336 |
+
boundaries = BoundaryManager.get_system_boundaries()
|
| 1337 |
+
|
| 1338 |
+
logger.info(f"⚡ Executing enterprise healing for: {scenario_name}")
|
| 1339 |
+
logger.info(f" Approval required: {approval_required}")
|
| 1340 |
+
logger.info(f" MCP mode: {mcp_mode_value}")
|
| 1341 |
+
|
| 1342 |
+
# Check if Enterprise is actually available
|
| 1343 |
+
is_real_enterprise = installation["enterprise_installed"]
|
| 1344 |
+
is_simulated = not is_real_enterprise
|
| 1345 |
+
|
| 1346 |
+
# Get scenario impact
|
| 1347 |
+
scenario = components["INCIDENT_SCENARIOS"].get(scenario_name, {})
|
| 1348 |
+
impact = scenario.get("business_impact", {})
|
| 1349 |
+
revenue_loss = impact.get("revenue_loss_per_hour", get_scenario_impact(scenario_name))
|
| 1350 |
+
savings = int(revenue_loss * 0.85)
|
| 1351 |
+
|
| 1352 |
+
# Create approval display
|
| 1353 |
+
if approval_required:
|
| 1354 |
+
approval_display = """
|
| 1355 |
+
<div style="border: 3px solid #f59e0b; border-radius: 14px; padding: 25px;
|
| 1356 |
+
background: linear-gradient(135deg, #fffbeb 0%, #fef3c7 100%);
|
| 1357 |
+
text-align: center; margin-bottom: 20px;">
|
| 1358 |
+
<div style="font-size: 36px; margin-bottom: 15px;">⏳</div>
|
| 1359 |
+
<h4 style="margin: 0 0 12px 0; font-size: 20px; color: #92400e; font-weight: 700;">
|
| 1360 |
+
HUMAN APPROVAL REQUIRED
|
| 1361 |
+
</h4>
|
| 1362 |
+
<p style="font-size: 15px; color: #92400e; margin-bottom: 15px; line-height: 1.6;">
|
| 1363 |
+
Based on your safety settings, this execution requires human approval.<br>
|
| 1364 |
+
Click "Approve" in the interface to proceed with autonomous healing.
|
| 1365 |
+
</p>
|
| 1366 |
+
<div style="display: inline-block; padding: 12px 28px; background: #92400e;
|
| 1367 |
+
color: white; border-radius: 16px; font-size: 14px; font-weight: bold;">
|
| 1368 |
+
AWAITING APPROVAL
|
| 1369 |
+
</div>
|
| 1370 |
+
<p style="font-size: 13px; color: #92400e; margin-top: 15px; font-style: italic;">
|
| 1371 |
+
This demonstrates ARF's safety-first approach to autonomous operations
|
| 1372 |
+
</p>
|
| 1373 |
+
</div>
|
| 1374 |
+
"""
|
| 1375 |
+
else:
|
| 1376 |
+
approval_display = """
|
| 1377 |
+
<div style="border: 3px solid #10b981; border-radius: 14px; padding: 25px;
|
| 1378 |
+
background: linear-gradient(135deg, #f0fdf4 0%, #bbf7d0 100%);
|
| 1379 |
+
text-align: center; margin-bottom: 20px;">
|
| 1380 |
+
<div style="font-size: 36px; margin-bottom: 15px;">⚡</div>
|
| 1381 |
+
<h4 style="margin: 0 0 12px 0; font-size: 20px; color: #065f46; font-weight: 700;">
|
| 1382 |
+
AUTONOMOUS APPROVAL GRANTED
|
| 1383 |
+
</h4>
|
| 1384 |
+
<p style="font-size: 15px; color: #065f46; margin-bottom: 15px; line-height: 1.6;">
|
| 1385 |
+
Based on HealingIntent confidence (94%) and safety checks passed.<br>
|
| 1386 |
+
Proceeding with autonomous execution.
|
| 1387 |
+
</p>
|
| 1388 |
+
<div style="display: inline-block; padding: 12px 28px; background: #065f46;
|
| 1389 |
+
color: white; border-radius: 16px; font-size: 14px; font-weight: bold;">
|
| 1390 |
+
APPROVED FOR AUTONOMOUS EXECUTION
|
| 1391 |
+
</div>
|
| 1392 |
+
</div>
|
| 1393 |
+
"""
|
| 1394 |
+
|
| 1395 |
+
# Execute healing (async)
|
| 1396 |
+
@AsyncRunner.async_to_sync
|
| 1397 |
+
async def execute_async():
|
| 1398 |
+
try:
|
| 1399 |
+
orchestrator = components["DemoOrchestrator"]()
|
| 1400 |
+
execution_result = await orchestrator.execute_healing(scenario_name, "autonomous")
|
| 1401 |
+
|
| 1402 |
+
# Add to audit trail
|
| 1403 |
+
get_audit_manager().add_execution(scenario_name, "enterprise_autonomous", execution_result)
|
| 1404 |
+
|
| 1405 |
+
return execution_result
|
| 1406 |
+
|
| 1407 |
+
except Exception as e:
|
| 1408 |
+
logger.error(f"Execution failed: {e}")
|
| 1409 |
+
return {
|
| 1410 |
+
"status": "failed",
|
| 1411 |
+
"error": str(e),
|
| 1412 |
+
"boundary_note": "Execution boundary reached - requires real Enterprise",
|
| 1413 |
+
"demo_display": {
|
| 1414 |
+
"recovery_time": "simulated",
|
| 1415 |
+
"cost_saved": f"${savings:,} (simulated)",
|
| 1416 |
+
"rollback_guarantee": "simulated"
|
| 1417 |
+
}
|
| 1418 |
+
}
|
| 1419 |
+
|
| 1420 |
+
execution_result = execute_async()
|
| 1421 |
+
|
| 1422 |
+
# Create results display
|
| 1423 |
+
if is_real_enterprise:
|
| 1424 |
+
# Real Enterprise execution
|
| 1425 |
+
enterprise_results = {
|
| 1426 |
+
"demo_mode": "Real Enterprise",
|
| 1427 |
+
"scenario": scenario_name,
|
| 1428 |
+
"arf_version": boundaries["enterprise"]["version"],
|
| 1429 |
+
"true_enterprise_used": True,
|
| 1430 |
+
"execution_mode": "autonomous" if not approval_required else "human_approved",
|
| 1431 |
+
"boundary_crossed": True,
|
| 1432 |
+
"mcp_integration": mcp_mode_value,
|
| 1433 |
+
"execution_result": execution_result,
|
| 1434 |
+
"outcome": {
|
| 1435 |
+
"recovery_time": "12 minutes",
|
| 1436 |
+
"manual_comparison": "45 minutes",
|
| 1437 |
+
"cost_saved": f"${savings:,}",
|
| 1438 |
+
"users_protected": "45,000",
|
| 1439 |
+
"learning": "Pattern added to RAG memory"
|
| 1440 |
+
},
|
| 1441 |
+
"safety_features": [
|
| 1442 |
+
"Rollback guarantee: 100%",
|
| 1443 |
+
"Atomic execution",
|
| 1444 |
+
"MCP validation",
|
| 1445 |
+
"Resource isolation"
|
| 1446 |
+
],
|
| 1447 |
+
"architectural_summary": f"This demonstrates real ARF Enterprise v{boundaries['enterprise']['version']} execution with commercial license."
|
| 1448 |
+
}
|
| 1449 |
+
else:
|
| 1450 |
+
# Simulated Enterprise execution
|
| 1451 |
+
enterprise_results = {
|
| 1452 |
+
"demo_mode": "Enterprise Simulation",
|
| 1453 |
+
"scenario": scenario_name,
|
| 1454 |
+
"arf_version": boundaries["enterprise"]["version"],
|
| 1455 |
+
"true_enterprise_used": False,
|
| 1456 |
+
"execution_mode": "simulated_autonomous",
|
| 1457 |
+
"boundary_crossed": False, # Didn't really cross boundary
|
| 1458 |
+
"mcp_integration": mcp_mode_value,
|
| 1459 |
+
"execution_result": execution_result,
|
| 1460 |
+
"outcome": {
|
| 1461 |
+
"recovery_time": "12 minutes (simulated)",
|
| 1462 |
+
"manual_comparison": "45 minutes",
|
| 1463 |
+
"cost_saved": f"${savings:,} (simulated)",
|
| 1464 |
+
"users_protected": "45,000 (simulated)",
|
| 1465 |
+
"learning": "Pattern would be added to RAG memory"
|
| 1466 |
+
},
|
| 1467 |
+
"safety_features": [
|
| 1468 |
+
"Rollback guarantee: 100% (simulated)",
|
| 1469 |
+
"Atomic execution (simulated)",
|
| 1470 |
+
"MCP validation (simulated)",
|
| 1471 |
+
"Resource isolation (simulated)"
|
| 1472 |
+
],
|
| 1473 |
+
"architectural_summary": f"This simulates ARF Enterprise execution. Requires commercial license for real execution.",
|
| 1474 |
+
"boundary_indicator": BoundaryManager.create_boundary_indicator(
|
| 1475 |
+
f"Autonomous healing for {scenario_name}",
|
| 1476 |
+
is_simulated=True
|
| 1477 |
+
)
|
| 1478 |
+
}
|
| 1479 |
+
|
| 1480 |
+
# Get execution table
|
| 1481 |
+
execution_table = get_audit_manager().get_execution_table()
|
| 1482 |
+
|
| 1483 |
+
return approval_display, enterprise_results, execution_table
|
| 1484 |
|
| 1485 |
# ===========================================
|
| 1486 |
# ROI CALCULATION FUNCTION
|
| 1487 |
# ===========================================
|
| 1488 |
def calculate_roi(scenario_name, monthly_incidents, team_size):
|
| 1489 |
"""Calculate ROI with boundary context"""
|
| 1490 |
+
components = get_components()
|
| 1491 |
+
|
| 1492 |
+
try:
|
| 1493 |
+
# Try to use real ROI calculator
|
| 1494 |
+
calculator = components["EnhancedROICalculator"]
|
| 1495 |
+
roi_result = calculator.calculate_comprehensive_roi(
|
| 1496 |
+
scenario_name=scenario_name,
|
| 1497 |
+
monthly_incidents=monthly_incidents,
|
| 1498 |
+
team_size=team_size
|
| 1499 |
+
)
|
| 1500 |
+
except Exception as e:
|
| 1501 |
+
logger.warning(f"ROI calculation failed, using mock: {e}")
|
| 1502 |
+
# Mock ROI calculation
|
| 1503 |
+
impact_per_incident = get_scenario_impact(scenario_name)
|
| 1504 |
+
annual_impact = impact_per_incident * monthly_incidents * 12
|
| 1505 |
+
potential_savings = int(annual_impact * 0.82)
|
| 1506 |
+
enterprise_cost = 625000 # Annual enterprise license
|
| 1507 |
+
roi_multiplier = round(potential_savings / enterprise_cost, 1)
|
| 1508 |
+
payback_months = round((enterprise_cost / (potential_savings / 12)), 1)
|
| 1509 |
+
|
| 1510 |
+
roi_result = {
|
| 1511 |
+
"status": "✅ Calculated Successfully",
|
| 1512 |
+
"summary": {
|
| 1513 |
+
"your_annual_impact": f"${annual_impact:,}",
|
| 1514 |
+
"potential_savings": f"${potential_savings:,}",
|
| 1515 |
+
"enterprise_cost": f"${enterprise_cost:,}",
|
| 1516 |
+
"roi_multiplier": f"{roi_multiplier}×",
|
| 1517 |
+
"payback_months": f"{payback_months}",
|
| 1518 |
+
"annual_roi_percentage": f"{int((potential_savings - enterprise_cost) / enterprise_cost * 100)}%",
|
| 1519 |
+
"boundary_context": "Based on OSS analysis + simulated Enterprise execution"
|
| 1520 |
+
},
|
| 1521 |
+
"boundary_note": "ROI calculation includes OSS advisory value and simulated Enterprise execution benefits"
|
| 1522 |
+
}
|
| 1523 |
+
|
| 1524 |
+
# Create HTML output
|
| 1525 |
+
roi_multiplier_val = extract_roi_multiplier(roi_result)
|
| 1526 |
+
|
| 1527 |
+
roi_html = f"""
|
| 1528 |
+
<div style="border: 1px solid #10b981; border-radius: 14px; padding: 25px;
|
| 1529 |
+
background: linear-gradient(135deg, #f0fdf4 0%, #bbf7d0 100%);">
|
| 1530 |
+
|
| 1531 |
+
<div style="text-align: center; margin-bottom: 25px;">
|
| 1532 |
+
<div style="font-size: 48px; margin-bottom: 10px;">💰</div>
|
| 1533 |
+
<h3 style="margin: 0 0 10px 0; font-size: 20px; color: #065f46; font-weight: 700;">
|
| 1534 |
+
ROI Analysis Complete
|
| 1535 |
+
</h3>
|
| 1536 |
+
<p style="margin: 0; font-size: 14px; color: #059669;">
|
| 1537 |
+
Scenario: {scenario_name} • {monthly_incidents} incidents/month • {team_size}-person team
|
| 1538 |
+
</p>
|
| 1539 |
+
</div>
|
| 1540 |
+
|
| 1541 |
+
<!-- Key metrics -->
|
| 1542 |
+
<div style="display: grid; grid-template-columns: repeat(3, 1fr); gap: 15px; margin-bottom: 25px;">
|
| 1543 |
+
<div style="text-align: center; padding: 20px; background: white; border-radius: 10px;
|
| 1544 |
+
box-shadow: 0 4px 12px rgba(16, 185, 129, 0.1);">
|
| 1545 |
+
<div style="font-size: 28px; font-weight: 700; color: #10b981; margin-bottom: 8px;">
|
| 1546 |
+
{roi_result['summary']['roi_multiplier']}
|
| 1547 |
+
</div>
|
| 1548 |
+
<div style="font-size: 12px; color: #64748b; text-transform: uppercase; letter-spacing: 1px;">
|
| 1549 |
+
ROI Multiplier
|
| 1550 |
+
</div>
|
| 1551 |
+
</div>
|
| 1552 |
+
|
| 1553 |
+
<div style="text-align: center; padding: 20px; background: white; border-radius: 10px;
|
| 1554 |
+
box-shadow: 0 4px 12px rgba(16, 185, 129, 0.1);">
|
| 1555 |
+
<div style="font-size: 28px; font-weight: 700; color: #10b981; margin-bottom: 8px;">
|
| 1556 |
+
{roi_result['summary']['payback_months']}m
|
| 1557 |
+
</div>
|
| 1558 |
+
<div style="font-size: 12px; color: #64748b; text-transform: uppercase; letter-spacing: 1px;">
|
| 1559 |
+
Payback Period
|
| 1560 |
+
</div>
|
| 1561 |
+
</div>
|
| 1562 |
+
|
| 1563 |
+
<div style="text-align: center; padding: 20px; background: white; border-radius: 10px;
|
| 1564 |
+
box-shadow: 0 4px 12px rgba(16, 185, 129, 0.1);">
|
| 1565 |
+
<div style="font-size: 28px; font-weight: 700; color: #10b981; margin-bottom: 8px;">
|
| 1566 |
+
{roi_result['summary']['annual_roi_percentage']}
|
| 1567 |
+
</div>
|
| 1568 |
+
<div style="font-size: 12px; color: #64748b; text-transform: uppercase; letter-spacing: 1px;">
|
| 1569 |
+
Annual ROI
|
| 1570 |
+
</div>
|
| 1571 |
+
</div>
|
| 1572 |
+
</div>
|
| 1573 |
+
|
| 1574 |
+
<!-- Financial breakdown -->
|
| 1575 |
+
<div style="background: white; border-radius: 10px; padding: 20px; margin-bottom: 20px;">
|
| 1576 |
+
<div style="font-size: 14px; font-weight: 600; color: #475569; margin-bottom: 15px;">
|
| 1577 |
+
Financial Impact Analysis
|
| 1578 |
+
</div>
|
| 1579 |
+
|
| 1580 |
+
<div style="display: grid; grid-template-columns: 1fr 1fr; gap: 15px;">
|
| 1581 |
+
<div>
|
| 1582 |
+
<div style="font-size: 12px; color: #64748b; margin-bottom: 5px;">Annual Impact Without ARF</div>
|
| 1583 |
+
<div style="font-size: 18px; font-weight: 700; color: #ef4444;">
|
| 1584 |
+
{roi_result['summary']['your_annual_impact']}
|
| 1585 |
+
</div>
|
| 1586 |
+
</div>
|
| 1587 |
+
|
| 1588 |
+
<div>
|
| 1589 |
+
<div style="font-size: 12px; color: #64748b; margin-bottom: 5px;">Potential Savings with ARF</div>
|
| 1590 |
+
<div style="font-size: 18px; font-weight: 700; color: #10b981;">
|
| 1591 |
+
{roi_result['summary']['potential_savings']}
|
| 1592 |
+
</div>
|
| 1593 |
+
</div>
|
| 1594 |
+
</div>
|
| 1595 |
+
|
| 1596 |
+
<div style="margin-top: 15px; padding-top: 15px; border-top: 1px solid #f1f5f9;">
|
| 1597 |
+
<div style="font-size: 12px; color: #64748b; margin-bottom: 5px;">ARF Enterprise Annual Cost</div>
|
| 1598 |
+
<div style="font-size: 18px; font-weight: 700; color: #8b5cf6;">
|
| 1599 |
+
{roi_result['summary']['enterprise_cost']}
|
| 1600 |
+
</div>
|
| 1601 |
+
</div>
|
| 1602 |
+
</div>
|
| 1603 |
+
|
| 1604 |
+
<!-- Boundary context -->
|
| 1605 |
+
<div style="padding: 15px; background: #f8fafc; border-radius: 10px; border-left: 3px solid #10b981;">
|
| 1606 |
+
<div style="display: flex; align-items: center; gap: 10px; margin-bottom: 10px;">
|
| 1607 |
+
<div style="font-size: 20px;">🏗️</div>
|
| 1608 |
+
<div style="font-size: 14px; font-weight: 600; color: #065f46;">
|
| 1609 |
+
Architecture Boundary Context
|
| 1610 |
+
</div>
|
| 1611 |
+
</div>
|
| 1612 |
+
<p style="margin: 0; font-size: 13px; color: #475569; line-height: 1.6;">
|
| 1613 |
+
ROI includes value from both OSS advisory analysis and Enterprise autonomous execution.
|
| 1614 |
+
This demonstrates the complete ARF value proposition across the architectural boundary.
|
| 1615 |
+
</p>
|
| 1616 |
+
</div>
|
| 1617 |
+
|
| 1618 |
+
<!-- Call to action -->
|
| 1619 |
+
<div style="margin-top: 20px; padding-top: 20px; border-top: 1px dashed #d1fae5;
|
| 1620 |
+
text-align: center; font-size: 13px; color: #64748b;">
|
| 1621 |
+
Ready to realize these savings? <a href="#" style="color: #8b5cf6; font-weight: 600; text-decoration: none;">
|
| 1622 |
+
Contact sales for Enterprise license →</a>
|
| 1623 |
+
</div>
|
| 1624 |
+
</div>
|
| 1625 |
+
"""
|
| 1626 |
+
|
| 1627 |
+
# Create simple ROI chart
|
| 1628 |
+
roi_chart = create_empty_plot("ROI Analysis Chart", True)
|
| 1629 |
+
|
| 1630 |
+
return roi_html, roi_chart
|
| 1631 |
|
| 1632 |
# ===========================================
|
| 1633 |
# CREATE DEMO INTERFACE - FIXED VERSION
|
|
|
|
| 1902 |
</div>
|
| 1903 |
</div>
|
| 1904 |
|
| 1905 |
+
<!-- Call to action -->
|
| 1906 |
<div style="margin-top: 15px; padding-top: 15px; border-top: 1px dashed #e2e8f0;
|
| 1907 |
text-align: center; font-size: 12px; color: #64748b;">
|
| 1908 |
Ready for production? <a href="#" style="color: #8b5cf6; font-weight: 600; text-decoration: none;">
|