""" Installation helper utilities for ARF Demo - FIXED VERSION """ import subprocess import sys import logging from typing import Dict, Any, List, Optional logger = logging.getLogger(__name__) class InstallationHelper: """Helper class for ARF package installation - FIXED: No attempt to import non-existent packages""" @staticmethod def install_arf_oss() -> Dict[str, Any]: """Install ARF OSS package""" try: logger.info("Installing ARF OSS v3.3.7...") result = subprocess.run( [sys.executable, "-m", "pip", "install", "agentic-reliability-framework==3.3.7"], capture_output=True, text=True, check=True ) return { "success": True, "message": "✅ ARF OSS v3.3.7 installed successfully", "output": result.stdout } except subprocess.CalledProcessError as e: return { "success": False, "message": "❌ Failed to install ARF OSS", "error": e.stderr } except Exception as e: return { "success": False, "message": f"❌ Installation error: {str(e)}", "error": str(e) } @staticmethod def check_installation() -> Dict[str, Any]: """ FIXED: Check ARF package installation - no attempt to import non-existent arf_enterprise Enterprise is always simulated in this demo """ try: import agentic_reliability_framework as arf_oss oss_version = getattr(arf_oss, '__version__', 'unknown') oss_installed = True logger.info(f"✅ ARF OSS v{oss_version} detected") except ImportError: oss_installed = False oss_version = None logger.info("⚠️ ARF OSS not installed - using mock mode") # FIXED: Enterprise is ALWAYS simulated - package doesn't exist enterprise_installed = False enterprise_version = "simulated" logger.info("⚠️ ARF Enterprise not installed - using simulation") return { "oss_installed": oss_installed, "oss_version": oss_version, "enterprise_installed": enterprise_installed, # Always false "enterprise_version": enterprise_version, # Always "simulated" "recommendations": InstallationHelper.get_recommendations(oss_installed, enterprise_installed), "boundaries": { "oss_can": ["advisory_analysis", "rag_search", "healing_intent"], "oss_cannot": ["execute", "modify_infra", "autonomous_healing"], "enterprise_simulated": True, "enterprise_requires_license": True, "architecture": "OSS advises → Enterprise simulates" } } @staticmethod def get_recommendations(oss_installed: bool, enterprise_installed: bool) -> List[str]: """ FIXED: Get realistic installation recommendations Enterprise package doesn't exist publicly """ recommendations = [] if not oss_installed: recommendations.append( "Install ARF OSS: `pip install agentic-reliability-framework==3.3.7`" ) recommendations.append( "💡 Without OSS, demo runs in mock mode with simulated analysis" ) # FIXED: Enterprise is simulated, not installable recommendations.append( "🔒 ARF Enterprise requires commercial license - simulated in this demo" ) recommendations.append( "🏢 Contact sales@arf.dev for Enterprise trial access" ) return recommendations @staticmethod def get_installation_html() -> str: """Get HTML for installation status display - FIXED to show clear boundaries""" status = InstallationHelper.check_installation() if status["oss_installed"]: oss_html = f"""
ARF OSS v{status['oss_version']}
Apache 2.0 • Advisory Intelligence
""" else: oss_html = """
⚠️
Mock ARF
Simulated analysis only
""" # FIXED: Enterprise is always simulated enterprise_html = f"""
🔒
Enterprise Simulation
v{status['enterprise_version']} • Commercial License Required
""" # FIXED: Realistic recommendations recommendations_html = "" if status["recommendations"]: rec_list = "\n".join([f"
  • {rec}
  • " for rec in status["recommendations"][:3]]) recommendations_html = f"""
    💡 Architecture & Recommendations
    """ # FIXED: Add boundary context boundary_html = """
    Boundary: OSS advises → Enterprise simulates
    """ return f"""

    📦 ARF Installation & Boundaries

    {oss_html} {enterprise_html} {boundary_html} {recommendations_html}
    """ # Export singleton installation_helper = InstallationHelper()