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b9
 
 
 
 
 
 
 
bbe2211
 
 
cc6b2b9
 
 
 
bbe2211
cc6b2b9
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
"""
UI components for the 5-tab demo
"""

import gradio as gr
from typing import Dict, List, Any, Optional, Tuple
import plotly.graph_objects as go


def create_header(oss_version: str, oss_available: bool) -> gr.Markdown:
    """Create the demo header"""
    status_badge = "โœ… Connected" if oss_available else "โš ๏ธ Mock Mode"
    
    return gr.Markdown(f"""
    <div style="text-align: center; padding: 30px 20px 20px 20px; background: linear-gradient(135deg, #f8fafc 0%, #ffffff 100%); border-radius: 0 0 20px 20px; margin-bottom: 30px; border-bottom: 3px solid #4ECDC4;">
        <h1 style="margin-bottom: 10px;">๐Ÿš€ Agentic Reliability Framework</h1>
        <h2 style="color: #4a5568; font-weight: 600; margin-bottom: 20px;">Investor Demo v3.8.0</h2>
        
        <div style="display: flex; justify-content: center; gap: 20px; flex-wrap: wrap; margin-bottom: 20px;">
            <div style="background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); color: white; padding: 8px 16px; border-radius: 20px; font-weight: 700; font-size: 0.85rem;">
                ๐Ÿข Enterprise Edition
            </div>
            <div style="background: linear-gradient(135deg, #4299e1 0%, #38b2ac 100%); color: white; padding: 8px 16px; border-radius: 20px; font-weight: 700; font-size: 0.85rem;">
                ๐Ÿ†“ OSS v{oss_version}
            </div>
            <div style="background: #e8f5e8; color: #2d3748; padding: 8px 16px; border-radius: 20px; font-weight: 600; font-size: 0.85rem;">
                ๐Ÿ“ˆ 5.2ร— ROI
            </div>
            <div style="background: #fff3cd; color: #856404; padding: 8px 16px; border-radius: 20px; font-weight: 600; font-size: 0.85rem;">
                โšก 85% MTTR Reduction
            </div>
        </div>
        
        <div style="color: #718096; font-size: 16px; max-width: 800px; margin: 0 auto; line-height: 1.6;">
            From <span style="font-weight: 700; color: #4299e1;">OSS Advisory</span> 
            to <span style="font-weight: 700; color: #764ba2;">Enterprise Autonomous Healing</span>.
            Experience the complete journey in 5 focused tabs.
        </div>
        
        <div style="margin-top: 15px; font-size: 0.9rem; color: #4ECDC4; font-weight: 600;">
            {status_badge}
        </div>
    </div>
    """)


def create_status_bar() -> gr.HTML:
    """Create system status bar"""
    return gr.HTML("""
    <div style="display: grid; grid-template-columns: repeat(3, 1fr); gap: 15px; margin-bottom: 25px;">
        <div style="background: white; padding: 20px; border-radius: 12px; box-shadow: 0 2px 8px rgba(0,0,0,0.06); border-left: 4px solid #4ECDC4;">
            <div style="font-size: 0.9rem; color: #718096; margin-bottom: 5px;">System Status</div>
            <div style="display: flex; align-items: center; gap: 8px;">
                <div style="width: 10px; height: 10px; background: #4ECDC4; border-radius: 50%;"></div>
                <div style="font-weight: 700; color: #2d3748;">Operational</div>
            </div>
        </div>
        
        <div style="background: white; padding: 20px; border-radius: 12px; box-shadow: 0 2px 8px rgba(0,0,0,0.06); border-left: 4px solid #FFA726;">
            <div style="font-size: 0.9rem; color: #718096; margin-bottom: 5px;">Performance</div>
            <div style="font-weight: 700; color: #2d3748; font-size: 1.1rem;">8.2 min avg resolution</div>
        </div>
        
        <div style="background: white; padding: 20px; border-radius: 12px; box-shadow: 0 2px 8px rgba(0,0,0,0.06); border-left: 4px solid #42A5F5;">
            <div style="font-size: 0.9rem; color: #718096; margin-bottom: 5px;">Learning Engine</div>
            <div style="font-weight: 700; color: #2d3748; font-size: 1.1rem;">5 patterns detected</div>
        </div>
    </div>
    """)


def create_tab1_incident_demo(scenarios: Dict, default_scenario: str = "Cache Miss Storm") -> Tuple:
    """Create Tab 1: Live Incident Demo"""
    with gr.Row():
        # Left Panel
        with gr.Column(scale=1):
            gr.Markdown("### ๐ŸŽฌ Select Incident Scenario")
            
            scenario_dropdown = gr.Dropdown(
                choices=list(scenarios.keys()),
                value=default_scenario,
                label="Choose an incident to analyze:",
                interactive=True
            )
            
            scenario_description = gr.Markdown(
                value=scenarios[default_scenario]["description"]
            )
            
            gr.Markdown("### ๐Ÿ“Š Current Metrics")
            metrics_display = gr.JSON(
                value=scenarios[default_scenario].get("metrics", {}),
                label="",
                show_label=False
            )
            
            gr.Markdown("### ๐Ÿ’ฐ Business Impact")
            impact_display = gr.JSON(
                value=scenarios[default_scenario].get("impact", {}),
                label="",
                show_label=False
            )
        
        # Right Panel
        with gr.Column(scale=2):
            gr.Markdown("### ๐Ÿ“ˆ Incident Timeline")
            timeline_output = gr.Plot(label="")
            
            gr.Markdown("### โšก Take Action")
            with gr.Row():
                oss_btn = gr.Button(
                    "๐Ÿ†“ Run OSS Analysis",
                    variant="secondary",
                    size="lg",
                    min_width=150
                )
                enterprise_btn = gr.Button(
                    "๐Ÿš€ Execute Enterprise Healing",
                    variant="primary",
                    size="lg",
                    min_width=150
                )
            
            with gr.Row():
                approval_toggle = gr.Checkbox(
                    label="๐Ÿ” Require Manual Approval",
                    value=True,
                    interactive=True
                )
                demo_btn = gr.Button(
                    "โšก Quick Demo",
                    variant="secondary",
                    size="sm"
                )
            
            approval_display = gr.HTML(
                value="<div style='padding: 15px; background: #f8f9fa; border-radius: 8px; color: #6c757d;'>"
                      "Approval workflow will appear here after execution"
                      "</div>"
            )
            
            gr.Markdown("### โš™๏ธ Configuration")
            config_display = gr.JSON(
                value={"mode": "approval", "safety_guardrails": "active"},
                label=""
            )
            
            gr.Markdown("### ๐ŸŽฏ Results")
            results_display = gr.JSON(
                value={"status": "Ready to analyze incident..."},
                label=""
            )
    
    return (scenario_dropdown, scenario_description, metrics_display, impact_display,
            timeline_output, oss_btn, enterprise_btn, approval_toggle, demo_btn,
            approval_display, config_display, results_display)


def create_tab2_business_roi() -> Tuple:
    """Create Tab 2: Business Impact & ROI"""
    with gr.Column():
        gr.Markdown("### ๐Ÿ“Š Executive Dashboard")
        dashboard_output = gr.Plot(label="")
        
        gr.Markdown("### ๐Ÿงฎ ROI Calculator")
        with gr.Row():
            with gr.Column(scale=1):
                monthly_slider = gr.Slider(
                    1, 100, value=15, step=1,
                    label="Monthly incidents",
                    interactive=True
                )
                impact_slider = gr.Slider(
                    1000, 50000, value=8500, step=500,
                    label="Average cost per incident ($)",
                    interactive=True
                )
                team_slider = gr.Slider(
                    1, 20, value=5, step=1,
                    label="Reliability team size",
                    interactive=True
                )
                calculate_btn = gr.Button(
                    "Calculate My ROI",
                    variant="primary",
                    size="lg"
                )
            
            with gr.Column(scale=2):
                roi_output = gr.JSON(
                    value={},
                    label="Your Analysis"
                )
        
        with gr.Row():
            with gr.Column():
                gr.Markdown("""
                **๐Ÿ“ˆ Industry Benchmarks**
                - **5.2ร—** Average ROI (first year)
                - **2-3 months** Payback period
                - **81.7%** Auto-heal rate
                - **85%** MTTR reduction
                - **$6.2M** Average annual savings
                """)
            
            with gr.Column():
                gr.Markdown("""
                **๐ŸŽฏ Business Outcomes**
                - **325+ hours** Engineer time reclaimed
                - **99.9%** SLA compliance maintained
                - **+40%** Customer satisfaction
                - **60%** Increased innovation capacity
                - **Zero** Audit findings
                """)
    
    return (dashboard_output, monthly_slider, impact_slider, team_slider, 
            calculate_btn, roi_output)


def create_tab3_audit_trail() -> Tuple:
    """Create Tab 3: Audit Trail & History"""
    with gr.Row():
        # Left Column
        with gr.Column(scale=1):
            gr.Markdown("### ๐Ÿ“‹ Execution History")
            
            with gr.Row():
                refresh_btn = gr.Button("๐Ÿ”„ Refresh", variant="secondary", size="sm")
                clear_btn = gr.Button("๐Ÿ—‘๏ธ Clear", variant="stop", size="sm")
                export_btn = gr.Button("๐Ÿ“ฅ Export", variant="secondary", size="sm")
            
            execution_table = gr.Dataframe(
                headers=["Time", "Scenario", "Actions", "Status", "Savings", "Details"],
                value=[],
                label="",
                interactive=False
            )
            
            gr.Markdown("### ๐Ÿ“ˆ Cost Savings")
            savings_chart = gr.Plot(label="")
        
        # Right Column
        with gr.Column(scale=1):
            gr.Markdown("### ๐Ÿ“Š Incident History")
            
            incident_table = gr.Dataframe(
                headers=["Time", "Service", "Type", "Severity", "Description"],
                value=[],
                label="",
                interactive=False
            )
            
            gr.Markdown("### ๐Ÿง  Memory Graph")
            memory_graph = gr.Plot(label="")
            
            gr.Markdown("### ๐Ÿ“ค Export")
            export_text = gr.Textbox(
                label="Audit Trail (JSON)",
                lines=6,
                interactive=False
            )
    
    return (refresh_btn, clear_btn, export_btn, execution_table, savings_chart,
            incident_table, memory_graph, export_text)


def create_tab4_enterprise_features() -> Tuple:
    """Create Tab 4: Enterprise Features"""
    with gr.Row():
        # Left Column
        with gr.Column(scale=1):
            gr.Markdown("### ๐Ÿ” License Management")
            
            license_display = gr.JSON(
                value={},
                label="Current License"
            )
            
            with gr.Row():
                validate_btn = gr.Button("๐Ÿ” Validate", variant="secondary")
                trial_btn = gr.Button("๐Ÿ†“ Start Trial", variant="primary")
                upgrade_btn = gr.Button("๐Ÿš€ Upgrade", variant="secondary")
            
            gr.Markdown("### โšก Feature Comparison")
            
            features_table = gr.Dataframe(
                headers=["Feature", "OSS", "Starter", "Enterprise"],
                value=[
                    ["Autonomous Healing", "โŒ", "โœ… Auto", "โœ… AI-Driven"],
                    ["Compliance Automation", "โŒ", "โœ…", "โœ… SOC2/GDPR"],
                    ["Predictive Analytics", "โŒ", "Basic", "โœ… ML-Powered"],
                    ["Multi-Cloud Support", "โŒ", "โŒ", "โœ… Native"],
                    ["Audit Trail", "Basic", "โœ…", "โœ… Comprehensive"],
                    ["Role-Based Access", "โŒ", "โœ…", "โœ… Granular"],
                ],
                label="",
                interactive=False
            )
        
        # Right Column
        with gr.Column(scale=1):
            gr.Markdown("### ๐Ÿ“‹ Compliance")
            
            compliance_display = gr.JSON(
                value={
                    "SOC2": "โœ… Certified",
                    "GDPR": "โœ… Compliant",
                    "ISO27001": "โœ… Certified",
                    "CCPA": "โœ… Compliant"
                },
                label="Certifications"
            )
            
            gr.Markdown("### ๐Ÿ”— Integrations")
            
            integrations_table = gr.Dataframe(
                headers=["Platform", "Status", "Last Sync"],
                value=[
                    ["AWS", "โœ… Connected", "5 min ago"],
                    ["Azure", "โœ… Connected", "8 min ago"],
                    ["GCP", "โœ… Connected", "3 min ago"],
                    ["Datadog", "โœ… Connected", "Active"],
                    ["PagerDuty", "โœ… Connected", "Active"],
                    ["ServiceNow", "โœ… Connected", "15 min ago"],
                ],
                label="",
                interactive=False
            )
            
            gr.Markdown("### โš™๏ธ MCP Mode")
            mcp_mode = gr.Radio(
                choices=["advisory", "approval", "autonomous"],
                value="approval",
                label="Execution Mode",
                interactive=True
            )
    
    return (license_display, validate_btn, trial_btn, upgrade_btn, features_table,
            compliance_display, integrations_table, mcp_mode)


def create_tab5_learning_engine() -> Tuple:
    """Create Tab 5: Learning Engine"""
    with gr.Row():
        # Left Column
        with gr.Column(scale=2):
            gr.Markdown("### ๐Ÿง  Incident Memory Graph")
            
            learning_graph = gr.Plot(label="")
            
            with gr.Row():
                graph_type = gr.Radio(
                    choices=["Force", "Hierarchical", "Circular"],
                    value="Force",
                    label="Layout",
                    interactive=True
                )
                show_labels = gr.Checkbox(label="Show Labels", value=True, interactive=True)
            
            gr.Markdown("### ๐Ÿ” Similarity Search")
            
            search_query = gr.Textbox(
                label="Describe incident or paste metrics",
                placeholder="e.g., 'Redis cache miss causing database overload'",
                lines=2,
                interactive=True
            )
            
            with gr.Row():
                search_btn = gr.Button("๐Ÿ” Search", variant="primary")
                clear_btn = gr.Button("Clear", variant="secondary")
            
            search_results = gr.Dataframe(
                headers=["Incident", "Similarity", "Resolution", "Actions"],
                value=[],
                label="",
                interactive=False
            )
        
        # Right Column
        with gr.Column(scale=1):
            gr.Markdown("### ๐Ÿ“Š Learning Stats")
            
            stats_display = gr.JSON(
                value={
                    "total_incidents": 0,
                    "patterns_detected": 0,
                    "similarity_searches": 0,
                    "confidence_threshold": 0.85
                },
                label="Statistics"
            )
            
            gr.Markdown("### ๐ŸŽฏ Pattern Detection")
            
            patterns_display = gr.JSON(
                value={},
                label="Detected Patterns"
            )
            
            gr.Markdown("### ๐Ÿ“ˆ Performance")
            
            performance_display = gr.JSON(
                value={
                    "avg_resolution_time": "0 min",
                    "success_rate": "0%",
                    "auto_heal_rate": "0%"
                },
                label="Performance Metrics"
            )
    
    return (learning_graph, graph_type, show_labels, search_query, search_btn,
            clear_btn, search_results, stats_display, patterns_display, performance_display)


def create_footer() -> gr.Markdown:
    """Create the demo footer"""
    return gr.Markdown("""
    <div style="margin-top: 40px; padding: 30px; background: linear-gradient(135deg, #1a365d 0%, #2d3748 100%); border-radius: 20px; color: white;">
        <div style="display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 30px; margin-bottom: 30px;">
            <div>
                <h4 style="color: white; margin-bottom: 15px;">๐Ÿš€ User Journey</h4>
                <ol style="color: #cbd5e0; padding-left: 20px;">
                    <li style="margin-bottom: 8px;">Start with OSS Analysis</li>
                    <li style="margin-bottom: 8px;">Calculate Your ROI</li>
                    <li style="margin-bottom: 8px;">Execute Enterprise Healing</li>
                    <li style="margin-bottom: 8px;">Explore Audit Trail</li>
                    <li>Discover Learning Engine</li>
                </ol>
            </div>
            
            <div>
                <h4 style="color: white; margin-bottom: 15px;">๐Ÿ“ž Get Started</h4>
                <ul style="color: #cbd5e0; list-style: none; padding: 0;">
                    <li style="margin-bottom: 8px;">๐Ÿ“ง sales@arfinvestor.com</li>
                    <li style="margin-bottom: 8px;">๐Ÿ“š docs.arfinvestor.com</li>
                    <li style="margin-bottom: 8px;">๐Ÿ’ฌ Join Slack Community</li>
                    <li>๐Ÿ†“ 30-Day Enterprise Trial</li>
                </ul>
            </div>
            
            <div>
                <h4 style="color: white; margin-bottom: 15px;">๐Ÿ›ก๏ธ Enterprise Grade</h4>
                <ul style="color: #cbd5e0; list-style: none; padding: 0;">
                    <li style="margin-bottom: 8px;">โœ… SOC 2 Type II</li>
                    <li style="margin-bottom: 8px;">โœ… GDPR & CCPA</li>
                    <li style="margin-bottom: 8px;">โœ… ISO 27001</li>
                    <li>โœ… HIPAA Ready</li>
                </ul>
            </div>
        </div>
        
        <div style="border-top: 1px solid #4a5568; padding-top: 20px; text-align: center; color: #a0aec0; font-size: 0.9rem;">
            <p style="margin: 0;">ยฉ 2024 Agentic Reliability Framework. Demo v3.8.0 Enterprise Edition.</p>
            <p style="margin: 10px 0 0 0; font-size: 0.8rem;">This demonstration showcases capabilities. Actual results may vary.</p>
        </div>
    </div>
    """)