petter2025 commited on
Commit
b17bed0
Β·
verified Β·
1 Parent(s): b987839

Update utils/installation.py

Browse files
Files changed (1) hide show
  1. utils/installation.py +89 -39
utils/installation.py CHANGED
@@ -1,5 +1,5 @@
1
  """
2
- Installation helper utilities for ARF Demo
3
  """
4
  import subprocess
5
  import sys
@@ -10,7 +10,7 @@ logger = logging.getLogger(__name__)
10
 
11
 
12
  class InstallationHelper:
13
- """Helper class for ARF package installation"""
14
 
15
  @staticmethod
16
  def install_arf_oss() -> Dict[str, Any]:
@@ -45,96 +45,146 @@ class InstallationHelper:
45
 
46
  @staticmethod
47
  def check_installation() -> Dict[str, Any]:
48
- """Check ARF package installation"""
 
 
 
49
  try:
50
  import agentic_reliability_framework as arf_oss
51
  oss_version = getattr(arf_oss, '__version__', 'unknown')
52
  oss_installed = True
 
53
  except ImportError:
54
  oss_installed = False
55
  oss_version = None
 
56
 
57
- try:
58
- import arf_enterprise
59
- enterprise_version = getattr(arf_enterprise, '__version__', 'unknown')
60
- enterprise_installed = True
61
- except ImportError:
62
- enterprise_installed = False
63
- enterprise_version = None
64
 
65
  return {
66
  "oss_installed": oss_installed,
67
  "oss_version": oss_version,
68
- "enterprise_installed": enterprise_installed,
69
- "enterprise_version": enterprise_version,
70
- "recommendations": InstallationHelper.get_recommendations(oss_installed, enterprise_installed)
 
 
 
 
 
 
 
71
  }
72
 
73
  @staticmethod
74
  def get_recommendations(oss_installed: bool, enterprise_installed: bool) -> List[str]:
75
- """Get installation recommendations"""
 
 
 
76
  recommendations = []
77
 
78
  if not oss_installed:
79
  recommendations.append(
80
  "Install ARF OSS: `pip install agentic-reliability-framework==3.3.7`"
81
  )
82
-
83
- if not enterprise_installed:
84
  recommendations.append(
85
- "Install ARF Enterprise: `pip install agentic-reliability-enterprise` (requires license)"
86
  )
87
 
 
 
 
 
 
 
 
 
88
  return recommendations
89
 
90
  @staticmethod
91
  def get_installation_html() -> str:
92
- """Get HTML for installation status display"""
93
  status = InstallationHelper.check_installation()
94
 
95
  if status["oss_installed"]:
96
  oss_html = f"""
97
- <div style="padding: 10px; background: #10b981; color: white; border-radius: 8px; margin: 5px 0;">
98
- βœ… ARF OSS v{status['oss_version']} installed
 
 
 
 
 
 
 
99
  </div>
100
  """
101
  else:
102
  oss_html = """
103
- <div style="padding: 10px; background: #f59e0b; color: white; border-radius: 8px; margin: 5px 0;">
104
- ⚠️ ARF OSS not installed
 
 
 
 
 
 
 
105
  </div>
106
  """
107
 
108
- if status["enterprise_installed"]:
109
- enterprise_html = f"""
110
- <div style="padding: 10px; background: #8b5cf6; color: white; border-radius: 8px; margin: 5px 0;">
111
- πŸš€ ARF Enterprise v{status['enterprise_version']} installed
 
 
 
 
 
 
112
  </div>
113
- """
114
- else:
115
- enterprise_html = """
116
- <div style="padding: 10px; background: #64748b; color: white; border-radius: 8px; margin: 5px 0;">
117
- πŸ”’ ARF Enterprise not installed
118
- </div>
119
- """
120
 
 
121
  recommendations_html = ""
122
  if status["recommendations"]:
123
- rec_list = "\n".join([f"<li>{rec}</li>" for rec in status["recommendations"]])
124
  recommendations_html = f"""
125
- <div style="margin-top: 15px; padding: 10px; background: #f1f5f9; border-radius: 8px;">
126
- <strong>πŸ’‘ Recommendations:</strong>
127
- <ul style="margin: 5px 0 0 0; padding-left: 20px;">
 
 
128
  {rec_list}
129
  </ul>
130
  </div>
131
  """
132
 
 
 
 
 
 
 
 
 
 
 
133
  return f"""
134
- <div style="border: 1px solid #e2e8f0; border-radius: 12px; padding: 15px; background: white;">
135
- <h4 style="margin: 0 0 10px 0; color: #1e293b;">πŸ“¦ ARF Installation Status</h4>
 
 
 
136
  {oss_html}
137
  {enterprise_html}
 
138
  {recommendations_html}
139
  </div>
140
  """
 
1
  """
2
+ Installation helper utilities for ARF Demo - FIXED VERSION
3
  """
4
  import subprocess
5
  import sys
 
10
 
11
 
12
  class InstallationHelper:
13
+ """Helper class for ARF package installation - FIXED: No attempt to import non-existent packages"""
14
 
15
  @staticmethod
16
  def install_arf_oss() -> Dict[str, Any]:
 
45
 
46
  @staticmethod
47
  def check_installation() -> Dict[str, Any]:
48
+ """
49
+ FIXED: Check ARF package installation - no attempt to import non-existent arf_enterprise
50
+ Enterprise is always simulated in this demo
51
+ """
52
  try:
53
  import agentic_reliability_framework as arf_oss
54
  oss_version = getattr(arf_oss, '__version__', 'unknown')
55
  oss_installed = True
56
+ logger.info(f"βœ… ARF OSS v{oss_version} detected")
57
  except ImportError:
58
  oss_installed = False
59
  oss_version = None
60
+ logger.info("⚠️ ARF OSS not installed - using mock mode")
61
 
62
+ # FIXED: Enterprise is ALWAYS simulated - package doesn't exist
63
+ enterprise_installed = False
64
+ enterprise_version = "simulated"
65
+ logger.info("⚠️ ARF Enterprise not installed - using simulation")
 
 
 
66
 
67
  return {
68
  "oss_installed": oss_installed,
69
  "oss_version": oss_version,
70
+ "enterprise_installed": enterprise_installed, # Always false
71
+ "enterprise_version": enterprise_version, # Always "simulated"
72
+ "recommendations": InstallationHelper.get_recommendations(oss_installed, enterprise_installed),
73
+ "boundaries": {
74
+ "oss_can": ["advisory_analysis", "rag_search", "healing_intent"],
75
+ "oss_cannot": ["execute", "modify_infra", "autonomous_healing"],
76
+ "enterprise_simulated": True,
77
+ "enterprise_requires_license": True,
78
+ "architecture": "OSS advises β†’ Enterprise simulates"
79
+ }
80
  }
81
 
82
  @staticmethod
83
  def get_recommendations(oss_installed: bool, enterprise_installed: bool) -> List[str]:
84
+ """
85
+ FIXED: Get realistic installation recommendations
86
+ Enterprise package doesn't exist publicly
87
+ """
88
  recommendations = []
89
 
90
  if not oss_installed:
91
  recommendations.append(
92
  "Install ARF OSS: `pip install agentic-reliability-framework==3.3.7`"
93
  )
 
 
94
  recommendations.append(
95
+ "πŸ’‘ Without OSS, demo runs in mock mode with simulated analysis"
96
  )
97
 
98
+ # FIXED: Enterprise is simulated, not installable
99
+ recommendations.append(
100
+ "πŸ”’ ARF Enterprise requires commercial license - simulated in this demo"
101
+ )
102
+ recommendations.append(
103
+ "🏒 Contact sales@arf.dev for Enterprise trial access"
104
+ )
105
+
106
  return recommendations
107
 
108
  @staticmethod
109
  def get_installation_html() -> str:
110
+ """Get HTML for installation status display - FIXED to show clear boundaries"""
111
  status = InstallationHelper.check_installation()
112
 
113
  if status["oss_installed"]:
114
  oss_html = f"""
115
+ <div style="padding: 10px; background: linear-gradient(135deg, #10b981 0%, #0ca678 100%);
116
+ color: white; border-radius: 8px; margin: 5px 0; border: 1px solid #0da271;">
117
+ <div style="display: flex; align-items: center; gap: 8px;">
118
+ <span style="font-size: 16px;">βœ…</span>
119
+ <div>
120
+ <div style="font-weight: 600;">ARF OSS v{status['oss_version']}</div>
121
+ <div style="font-size: 12px; opacity: 0.9;">Apache 2.0 β€’ Advisory Intelligence</div>
122
+ </div>
123
+ </div>
124
  </div>
125
  """
126
  else:
127
  oss_html = """
128
+ <div style="padding: 10px; background: linear-gradient(135deg, #f59e0b 0%, #e0950a 100%);
129
+ color: white; border-radius: 8px; margin: 5px 0; border: 1px solid #d98a09;">
130
+ <div style="display: flex; align-items: center; gap: 8px;">
131
+ <span style="font-size: 16px;">⚠️</span>
132
+ <div>
133
+ <div style="font-weight: 600;">Mock ARF</div>
134
+ <div style="font-size: 12px; opacity: 0.9;">Simulated analysis only</div>
135
+ </div>
136
+ </div>
137
  </div>
138
  """
139
 
140
+ # FIXED: Enterprise is always simulated
141
+ enterprise_html = f"""
142
+ <div style="padding: 10px; background: linear-gradient(135deg, #64748b 0%, #4b5563 100%);
143
+ color: white; border-radius: 8px; margin: 5px 0; border: 1px dashed #9ca3af;">
144
+ <div style="display: flex; align-items: center; gap: 8px;">
145
+ <span style="font-size: 16px;">πŸ”’</span>
146
+ <div>
147
+ <div style="font-weight: 600;">Enterprise Simulation</div>
148
+ <div style="font-size: 12px; opacity: 0.9;">v{status['enterprise_version']} β€’ Commercial License Required</div>
149
+ </div>
150
  </div>
151
+ </div>
152
+ """
 
 
 
 
 
153
 
154
+ # FIXED: Realistic recommendations
155
  recommendations_html = ""
156
  if status["recommendations"]:
157
+ rec_list = "\n".join([f"<li style='margin-bottom: 5px;'>{rec}</li>" for rec in status["recommendations"][:3]])
158
  recommendations_html = f"""
159
+ <div style="margin-top: 15px; padding: 12px; background: #f8fafc; border-radius: 8px; border: 1px solid #e2e8f0;">
160
+ <div style="font-weight: 600; color: #475569; margin-bottom: 8px; display: flex; align-items: center; gap: 6px;">
161
+ <span>πŸ’‘</span> <span>Architecture & Recommendations</span>
162
+ </div>
163
+ <ul style="margin: 5px 0 0 0; padding-left: 20px; color: #64748b; font-size: 13px;">
164
  {rec_list}
165
  </ul>
166
  </div>
167
  """
168
 
169
+ # FIXED: Add boundary context
170
+ boundary_html = """
171
+ <div style="margin-top: 10px; padding: 8px; background: #f0fdf4; border-radius: 6px; border: 1px solid #d1fae5;">
172
+ <div style="font-size: 12px; color: #059669; display: flex; align-items: center; gap: 6px;">
173
+ <span style="display: inline-block; width: 8px; height: 8px; background: #10b981; border-radius: 50%;"></span>
174
+ <span>Boundary: OSS advises β†’ Enterprise simulates</span>
175
+ </div>
176
+ </div>
177
+ """
178
+
179
  return f"""
180
+ <div style="border: 2px solid #e2e8f0; border-radius: 12px; padding: 15px; background: white;
181
+ box-shadow: 0 1px 3px rgba(0,0,0,0.05);">
182
+ <h4 style="margin: 0 0 12px 0; color: #1e293b; font-size: 16px; font-weight: 600;">
183
+ πŸ“¦ ARF Installation & Boundaries
184
+ </h4>
185
  {oss_html}
186
  {enterprise_html}
187
+ {boundary_html}
188
  {recommendations_html}
189
  </div>
190
  """