petter2025 commited on
Commit
4b2c586
Β·
verified Β·
1 Parent(s): fff2fa8

Update demo/guidance.py

Browse files
Files changed (1) hide show
  1. demo/guidance.py +523 -28
demo/guidance.py CHANGED
@@ -1,54 +1,549 @@
1
  """
2
- User journey guidance for the demo
 
3
  """
4
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
5
  USER_JOURNEY_STEPS = [
6
  {
7
  "step": 1,
8
- "title": "πŸ”₯ Experience OSS Analysis",
9
- "description": "Select an incident and run OSS analysis to see ARF's recommendations",
10
- "tab": "Live Incident Demo",
11
- "action": "Click 'Run OSS Analysis'",
12
- "learning": "See how ARF analyzes incidents and creates HealingIntents"
 
 
13
  },
14
  {
15
  "step": 2,
16
- "title": "πŸ’° Calculate Your ROI",
17
- "description": "Adjust the sliders to see potential savings for your organization",
18
- "tab": "Business Impact & ROI",
19
- "action": "Use sliders then click 'Calculate My ROI'",
20
- "learning": "Understand the business case for ARF Enterprise"
 
 
21
  },
22
  {
23
  "step": 3,
24
- "title": "πŸš€ Execute Enterprise Healing",
25
- "description": "Experience autonomous healing with approval workflows",
26
  "tab": "Live Incident Demo",
27
- "action": "Click 'Execute Enterprise Healing'",
28
- "learning": "See the difference between OSS advisory and Enterprise execution"
 
 
29
  },
30
  {
31
  "step": 4,
32
- "title": "πŸ“œ Explore Audit Trail",
33
- "description": "View comprehensive logging of all actions taken",
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
34
  "tab": "Audit Trail & History",
35
  "action": "Check execution and incident history",
36
- "learning": "See enterprise-grade compliance and audit capabilities"
 
 
37
  },
38
  {
39
- "step": 5,
40
- "title": "🧠 Discover Learning Engine",
41
  "description": "Explore pattern detection and similarity search",
42
  "tab": "Learning Engine",
43
- "action": "Search for similar incidents",
44
- "learning": "See how ARF learns from past incidents"
 
 
45
  }
46
  ]
47
 
 
48
  DEMO_TIPS = [
49
- "πŸ’‘ **Pro Tip**: Use the 'Quick Demo' button for a complete guided experience",
50
- "πŸ’‘ **Pro Tip**: Toggle the approval checkbox to see different execution modes",
51
- "πŸ’‘ **Pro Tip**: Export the audit trail to see comprehensive JSON data",
52
- "πŸ’‘ **Pro Tip**: Try different incident scenarios to see varied responses",
53
- "πŸ’‘ **Pro Tip**: Use the ROI calculator with your organization's numbers"
54
- ]
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  """
2
+ Enhanced Demo Guidance System - Manages the psychology and flow of the ARF demo
3
+ Adds clear narrative phases and boundary awareness
4
  """
5
 
6
+ from enum import Enum
7
+ from typing import Dict, List, Any, Optional
8
+ from dataclasses import dataclass
9
+ import time
10
+
11
+ class DemoPhase(Enum):
12
+ """Phases of the demo narrative with clear boundaries"""
13
+ INTRODUCTION = "introduction"
14
+ FAILURE_INJECTION = "failure_injection"
15
+ REAL_OSS_ANALYSIS = "real_oss_analysis"
16
+ DECISION_BOUNDARY = "decision_boundary"
17
+ SIMULATED_ENTERPRISE = "simulated_enterprise"
18
+ RESOLUTION = "resolution"
19
+ ARCHITECTURE_REVIEW = "architecture_review"
20
+
21
+ @dataclass
22
+ class PhaseContent:
23
+ """Enhanced content for each demo phase with boundary indicators"""
24
+ phase: DemoPhase
25
+ title: str
26
+ narrative: str
27
+ key_message: str
28
+ visual_cue: str
29
+ duration_seconds: int
30
+ show_boundary: bool = False
31
+ boundary_text: Optional[str] = None
32
+ is_real_arf: bool = False
33
+
34
+ def get_html(self, show_progress: bool = True, current_step: int = 1, total_steps: int = 7) -> str:
35
+ """Get HTML for this phase with progress indicator"""
36
+ # Progress indicator
37
+ progress_html = ""
38
+ if show_progress:
39
+ progress_percentage = int((current_step / total_steps) * 100)
40
+ progress_html = f"""
41
+ <div style="margin-bottom: 20px;">
42
+ <div style="display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px;">
43
+ <div style="font-size: 13px; color: #64748b; font-weight: 500;">
44
+ Demo Progress: Step {current_step} of {total_steps}
45
+ </div>
46
+ <div style="font-size: 13px; color: #3b82f6; font-weight: 600;">
47
+ {progress_percentage}%
48
+ </div>
49
+ </div>
50
+ <div style="height: 6px; background: #e2e8f0; border-radius: 3px; overflow: hidden;">
51
+ <div style="width: {progress_percentage}%; height: 100%;
52
+ background: linear-gradient(90deg, #3b82f6, #8b5cf6);
53
+ border-radius: 3px; transition: width 0.3s ease;">
54
+ </div>
55
+ </div>
56
+ </div>
57
+ """
58
+
59
+ # Real ARF indicator
60
+ real_arf_html = ""
61
+ if self.is_real_arf:
62
+ real_arf_html = f"""
63
+ <div style="margin: 15px 0; padding: 10px; background: #f0fdf4;
64
+ border-radius: 8px; border: 2px solid #10b981;">
65
+ <div style="display: flex; align-items: center; gap: 8px;">
66
+ <div style="font-size: 20px;">βœ…</div>
67
+ <div style="font-weight: 600; color: #065f46;">REAL ARF OSS v3.3.7</div>
68
+ </div>
69
+ <div style="font-size: 13px; color: #047857; margin-top: 5px;">
70
+ Running actual agentic-reliability-framework==3.3.7 package
71
+ </div>
72
+ </div>
73
+ """
74
+
75
+ # Boundary indicator
76
+ boundary_html = ""
77
+ if self.show_boundary and self.boundary_text:
78
+ boundary_html = f"""
79
+ <div style="margin: 15px 0; padding: 12px; background: #fef3c7;
80
+ border-radius: 10px; border-left: 4px solid #f59e0b;">
81
+ <div style="display: flex; align-items: center; gap: 8px; margin-bottom: 5px;">
82
+ <div style="font-size: 20px;">🎭</div>
83
+ <div style="font-weight: 600; color: #92400e;">Demo Boundary</div>
84
+ </div>
85
+ <div style="font-size: 13px; color: #b45309; line-height: 1.5;">
86
+ {self.boundary_text}
87
+ </div>
88
+ </div>
89
+ """
90
+
91
+ return f"""
92
+ <div style="border: 2px solid #3b82f6; border-radius: 16px; padding: 25px;
93
+ background: linear-gradient(135deg, #f8fafc 0%, #ffffff 100%);
94
+ box-shadow: 0 8px 32px rgba(59, 130, 246, 0.1); margin: 20px 0;">
95
+ <div style="display: flex; align-items: center; gap: 15px; margin-bottom: 20px;">
96
+ <div style="font-size: 36px;">{self.visual_cue}</div>
97
+ <div>
98
+ <h3 style="margin: 0 0 5px 0; color: #1e293b; font-size: 20px; font-weight: 700;">
99
+ {self.title}
100
+ </h3>
101
+ <div style="font-size: 14px; color: #64748b;">
102
+ Phase: {self.phase.value.replace('_', ' ').title()}
103
+ </div>
104
+ </div>
105
+ </div>
106
+
107
+ {progress_html}
108
+
109
+ <div style="margin-bottom: 20px;">
110
+ <div style="font-size: 16px; color: #475569; line-height: 1.6; margin-bottom: 15px;">
111
+ {self.narrative}
112
+ </div>
113
+
114
+ {real_arf_html}
115
+ {boundary_html}
116
+
117
+ <div style="padding: 15px; background: #f1f5f9; border-radius: 10px;
118
+ border-left: 4px solid #3b82f6;">
119
+ <div style="font-weight: 600; color: #1e293b; margin-bottom: 5px;">
120
+ 🎯 Key Message
121
+ </div>
122
+ <div style="font-size: 15px; color: #475569; line-height: 1.5;">
123
+ {self.key_message}
124
+ </div>
125
+ </div>
126
+ </div>
127
+
128
+ <div style="display: flex; justify-content: space-between; align-items: center;
129
+ margin-top: 20px; padding-top: 15px; border-top: 1px solid #e2e8f0;">
130
+ <div style="font-size: 12px; color: #94a3b8;">
131
+ ⏱️ Duration: {self.duration_seconds}s β€’
132
+ 🎯 Focus: {self.phase.value.replace('_', ' ').title()}
133
+ </div>
134
+ <div style="display: flex; gap: 10px;">
135
+ <div style="padding: 4px 10px; background: #e2e8f0;
136
+ color: #64748b; border-radius: 12px; font-size: 11px; font-weight: 500;">
137
+ Phase {current_step}
138
+ </div>
139
+ </div>
140
+ </div>
141
+ </div>
142
+ """
143
+
144
+ # Complete demo flow with psychological pacing
145
+ DEMO_FLOW = {
146
+ DemoPhase.INTRODUCTION: PhaseContent(
147
+ phase=DemoPhase.INTRODUCTION,
148
+ title="πŸš€ Welcome to ARF v3.3.7 - The Architecture Demo",
149
+ narrative="""
150
+ Most AI systems fail silently in production. This one doesn't. We're about to demonstrate
151
+ a production-grade agentic reliability system with <strong>clear architectural boundaries</strong>.
152
+
153
+ This demo shows:
154
+ 1. <strong>Real ARF OSS v3.3.7</strong> - Actual advisory intelligence
155
+ 2. <strong>Simulated Enterprise</strong> - Value proposition without infrastructure access
156
+ 3. <strong>Clear separation</strong> - Honest boundaries between OSS and Enterprise
157
+ """,
158
+ key_message="This isn't AI theater. It's a production-ready system with architectural honesty.",
159
+ visual_cue="🎭",
160
+ duration_seconds=30,
161
+ show_boundary=True,
162
+ boundary_text="We're simulating Enterprise execution for the demo. Real execution requires production infrastructure.",
163
+ is_real_arf=False
164
+ ),
165
+
166
+ DemoPhase.FAILURE_INJECTION: PhaseContent(
167
+ phase=DemoPhase.FAILURE_INJECTION,
168
+ title="🚨 Phase 1: Inject Production Failure",
169
+ narrative="""
170
+ We're simulating a <strong>Cache Miss Storm</strong> affecting 45,000 users with $8,500/hour revenue risk.
171
+
172
+ This is how most systems look right before they fail silently. The metrics show:
173
+ β€’ Cache hit rate dropped from 85% to 18%
174
+ β€’ Database load increased to 92%
175
+ β€’ Response time spiked to 1,850ms
176
+
177
+ Notice: No remediation is running yet. We're letting you feel the tension.
178
+ """,
179
+ key_message="Failure happens. The question is how quickly and intelligently you respond.",
180
+ visual_cue="πŸ“‰",
181
+ duration_seconds=20,
182
+ show_boundary=False,
183
+ is_real_arf=False
184
+ ),
185
+
186
+ DemoPhase.REAL_OSS_ANALYSIS: PhaseContent(
187
+ phase=DemoPhase.REAL_OSS_ANALYSIS,
188
+ title="🧠 Phase 2: Real ARF OSS Intelligence Activates",
189
+ narrative="""
190
+ ARF OSS v3.3.7 is now <strong>analyzing the incident in real-time</strong>. This is not a mock:
191
+
192
+ 1. <strong>Detection Agent</strong> - Finds anomalies with 98.7% confidence
193
+ 2. <strong>Recall Agent</strong> - Searches RAG memory for similar incidents
194
+ 3. <strong>Decision Agent</strong> - Generates healing intent with reasoning
195
+
196
+ Watch the confidence scores increase as evidence accumulates. This is <strong>real inference</strong>,
197
+ not pre-programmed responses. The system is reasoning, not reacting.
198
+ """,
199
+ key_message="ARF OSS provides production-grade intelligence. It reasons before it recommends.",
200
+ visual_cue="πŸ€–",
201
+ duration_seconds=45,
202
+ show_boundary=True,
203
+ boundary_text="This is REAL ARF OSS v3.3.7 (Apache 2.0). It can analyze but not execute.",
204
+ is_real_arf=True
205
+ ),
206
+
207
+ DemoPhase.DECISION_BOUNDARY: PhaseContent(
208
+ phase=DemoPhase.DECISION_BOUNDARY,
209
+ title="🎯 Phase 3: The Execution Boundary",
210
+ narrative="""
211
+ ARF OSS has created a <strong>HealingIntent with 94% confidence</strong>:
212
+ β€’ Action: Scale Redis cluster from 3 to 5 nodes
213
+ β€’ Pattern match: 87% success rate from similar incidents
214
+ β€’ Safety check: βœ… Passed (blast radius: 2 services)
215
+
216
+ Now we pause intentionally. This is the <strong>architectural boundary</strong>:
217
+ β€’ <strong>OSS can reason</strong> (Apache 2.0, advisory only)
218
+ β€’ <strong>Enterprise can execute</strong> (Commercial, with safety guarantees)
219
+
220
+ The system knows what to do, but requires authority to act.
221
+ """,
222
+ key_message="Reasoning and authority are not the same thing. This boundary is intentional.",
223
+ visual_cue="βš–οΈ",
224
+ duration_seconds=25,
225
+ show_boundary=True,
226
+ boundary_text="OSS boundary reached. Execution requires Enterprise edition and infrastructure authority.",
227
+ is_real_arf=True
228
+ ),
229
+
230
+ DemoPhase.SIMULATED_ENTERPRISE: PhaseContent(
231
+ phase=DemoPhase.SIMULATED_ENTERPRISE,
232
+ title="🏒 Phase 4: Simulated Enterprise Execution",
233
+ narrative="""
234
+ We're now simulating what <strong>ARF Enterprise</strong> would do:
235
+
236
+ 1. <strong>Validate safety constraints</strong> - Business hours, blast radius, rollback plans
237
+ 2. <strong>Apply novel execution protocols</strong> - Deterministic confidence, not just ML probabilities
238
+ 3. <strong>Execute with guarantees</strong> - Rollback prepared, circuit breakers set
239
+
240
+ In production, this would execute against real infrastructure (Kubernetes, cloud APIs, etc.).
241
+ For the demo, we're showing the value proposition without real side effects.
242
+ """,
243
+ key_message="Enterprise adds execution authority, not just better intelligence.",
244
+ visual_cue="⚑",
245
+ duration_seconds=35,
246
+ show_boundary=True,
247
+ boundary_text="SIMULATED EXECUTION - Real Enterprise would execute against production infrastructure.",
248
+ is_real_arf=False
249
+ ),
250
+
251
+ DemoPhase.RESOLUTION: PhaseContent(
252
+ phase=DemoPhase.RESOLUTION,
253
+ title="βœ… Phase 5: Incident Resolution",
254
+ narrative="""
255
+ The simulated execution completes:
256
+ β€’ <strong>Recovery time:</strong> 12 minutes (vs 45 minutes manual)
257
+ β€’ <strong>Cost saved:</strong> $6,375
258
+ β€’ <strong>Users protected:</strong> 45,000 β†’ 0 impacted
259
+ β€’ <strong>Learning:</strong> Pattern added to RAG memory
260
+
261
+ System health normalizes. Confidence scores stabilize. The incident is marked as
262
+ <strong>resolved autonomously</strong>.
263
+
264
+ Key metrics show the impact:
265
+ β€’ Detection time: 45s (89% faster than average)
266
+ β€’ Auto-heal rate: 81.7% (5.4Γ— industry average)
267
+ """,
268
+ key_message="Autonomous reliability creates measurable business impact.",
269
+ visual_cue="πŸ“Š",
270
+ duration_seconds=30,
271
+ show_boundary=False,
272
+ is_real_arf=False
273
+ ),
274
+
275
+ DemoPhase.ARCHITECTURE_REVIEW: PhaseContent(
276
+ phase=DemoPhase.ARCHITECTURE_REVIEW,
277
+ title="πŸ—οΈ Phase 6: Architecture Validated",
278
+ narrative="""
279
+ Let's review what we demonstrated:
280
+
281
+ <strong>βœ… Real Components (Production-Ready):</strong>
282
+ β€’ ARF OSS v3.3.7 intelligence engine
283
+ β€’ Three-agent pattern (Detection, Recall, Decision)
284
+ β€’ RAG-based similarity search
285
+ β€’ Confidence scoring and reasoning chains
286
+
287
+ <strong>🎭 Simulated Components (Demo Value):</strong>
288
+ β€’ Enterprise execution authority
289
+ β€’ Infrastructure orchestration
290
+ β€’ Rollback guarantees
291
+ β€’ Novel execution protocols
292
+
293
+ <strong>🎯 Clear Boundaries (Architectural Honesty):</strong>
294
+ β€’ OSS advises, Enterprise executes
295
+ β€’ No hidden automation or deception
296
+ β€’ Production-ready separation
297
+ """,
298
+ key_message="This demo shows production architecture, not just AI capabilities.",
299
+ visual_cue="πŸ’Ž",
300
+ duration_seconds=40,
301
+ show_boundary=True,
302
+ boundary_text="Architecture validated: OSS for intelligence, Enterprise for execution.",
303
+ is_real_arf=False
304
+ )
305
+ }
306
+
307
+ # Original user journey steps (enhanced with phase alignment)
308
  USER_JOURNEY_STEPS = [
309
  {
310
  "step": 1,
311
+ "title": "🎭 Understand the Architecture",
312
+ "description": "Review the demo flow to understand clear boundaries between OSS and Enterprise",
313
+ "tab": "All Tabs",
314
+ "action": "Read the phase guidance",
315
+ "learning": "See how ARF separates intelligence (OSS) from execution (Enterprise)",
316
+ "phase": DemoPhase.INTRODUCTION.value,
317
+ "duration": "30s"
318
  },
319
  {
320
  "step": 2,
321
+ "title": "οΏ½οΏ½οΏ½οΏ½ Experience REAL ARF OSS Analysis",
322
+ "description": "Select an incident and run OSS analysis to see actual ARF v3.3.7 intelligence",
323
+ "tab": "Live Incident Demo",
324
+ "action": "Click 'Run OSS Analysis'",
325
+ "learning": "See real ARF OSS package analyzing incidents with confidence scores",
326
+ "phase": DemoPhase.REAL_OSS_ANALYSIS.value,
327
+ "duration": "45s"
328
  },
329
  {
330
  "step": 3,
331
+ "title": "🎯 Observe the Execution Boundary",
332
+ "description": "Notice where OSS stops and Enterprise would begin",
333
  "tab": "Live Incident Demo",
334
+ "action": "Review HealingIntent and boundary indicators",
335
+ "learning": "Understand the architectural separation between advisory and execution",
336
+ "phase": DemoPhase.DECISION_BOUNDARY.value,
337
+ "duration": "25s"
338
  },
339
  {
340
  "step": 4,
341
+ "title": "⚑ Simulate Enterprise Healing",
342
+ "description": "Experience autonomous healing with simulated execution",
343
+ "tab": "Live Incident Demo",
344
+ "action": "Click 'Execute Enterprise Healing'",
345
+ "learning": "See the Enterprise value proposition without real infrastructure",
346
+ "phase": DemoPhase.SIMULATED_ENTERPRISE.value,
347
+ "duration": "35s"
348
+ },
349
+ {
350
+ "step": 5,
351
+ "title": "πŸ’° Calculate Your Business ROI",
352
+ "description": "Adjust the sliders to see potential savings for your organization",
353
+ "tab": "Business Impact & ROI",
354
+ "action": "Use sliders then click 'Calculate My ROI'",
355
+ "learning": "Understand the business case with your specific numbers",
356
+ "phase": "business_roi",
357
+ "duration": "60s"
358
+ },
359
+ {
360
+ "step": 6,
361
+ "title": "πŸ“œ Explore Enterprise-Grade Compliance",
362
+ "description": "View comprehensive audit trail and compliance features",
363
  "tab": "Audit Trail & History",
364
  "action": "Check execution and incident history",
365
+ "learning": "See enterprise-level logging, compliance, and audit capabilities",
366
+ "phase": "compliance",
367
+ "duration": "45s"
368
  },
369
  {
370
+ "step": 7,
371
+ "title": "🧠 Discover the Learning Engine",
372
  "description": "Explore pattern detection and similarity search",
373
  "tab": "Learning Engine",
374
+ "action": "Search for similar incidents and view patterns",
375
+ "learning": "See how ARF learns from past incidents to improve future responses",
376
+ "phase": "learning",
377
+ "duration": "50s"
378
  }
379
  ]
380
 
381
+ # Enhanced demo tips with boundary awareness
382
  DEMO_TIPS = [
383
+ "πŸ’Ž **Architecture Tip**: Look for the 'REAL ARF' vs 'SIMULATED' indicators to understand boundaries",
384
+ "🎭 **Demo Tip**: The 'Run Complete Demo' button follows our psychological pacing guide",
385
+ "⚑ **Enterprise Tip**: Toggle approval mode to see different execution workflows",
386
+ "πŸ“Š **ROI Tip**: Use realistic numbers for your organization in the ROI calculator",
387
+ "πŸ” **Analysis Tip**: Try different incident scenarios to see varied ARF responses",
388
+ "πŸ“œ **Compliance Tip**: Export the audit trail to see comprehensive JSON structure",
389
+ "🧠 **Learning Tip**: Search for patterns to see how ARF improves over time",
390
+ "🎯 **Boundary Tip**: Notice where OSS analysis ends and Enterprise execution would begin"
391
+ ]
392
+
393
+ # Psychology-driven quick start guide
394
+ QUICK_START_GUIDE = {
395
+ "for_executives": {
396
+ "focus": "Business Impact & ROI",
397
+ "steps": [
398
+ "1. Go to 'Business Impact & ROI' tab",
399
+ "2. Adjust sliders to match your organization",
400
+ "3. Click 'Calculate My ROI'",
401
+ "4. Review the 5.2Γ— ROI multiplier",
402
+ "5. Ask: 'What would 73% faster MTTR mean for us?'"
403
+ ],
404
+ "time": "2 minutes",
405
+ "key_question": "What's the cost of NOT having autonomous reliability?"
406
+ },
407
+ "for_engineers": {
408
+ "focus": "Real ARF OSS Analysis",
409
+ "steps": [
410
+ "1. Select 'Cache Miss Storm' scenario",
411
+ "2. Click 'Run OSS Analysis'",
412
+ "3. Watch the three agents work in real-time",
413
+ "4. Review the HealingIntent with 94% confidence",
414
+ "5. Notice the reasoning chain and evidence"
415
+ ],
416
+ "time": "3 minutes",
417
+ "key_question": "How would this intelligence change your on-call experience?"
418
+ },
419
+ "for_architects": {
420
+ "focus": "Architecture Boundaries",
421
+ "steps": [
422
+ "1. Run the complete demo walkthrough",
423
+ "2. Look for 'REAL ARF' vs 'SIMULATED' indicators",
424
+ "3. Notice the execution boundary",
425
+ "4. Review the architecture validation phase",
426
+ "5. Ask: 'How would this integrate with our stack?'"
427
+ ],
428
+ "time": "4 minutes",
429
+ "key_question": "Is our current approach proactive or reactive?"
430
+ }
431
+ }
432
+
433
+ def get_phase_content(phase: DemoPhase) -> PhaseContent:
434
+ """Get content for a specific demo phase"""
435
+ return DEMO_FLOW.get(phase, DEMO_FLOW[DemoPhase.INTRODUCTION])
436
+
437
+ def get_phase_html(phase: DemoPhase, current_step: int = 1) -> str:
438
+ """Get HTML for a demo phase with progress indicator"""
439
+ content = get_phase_content(phase)
440
+ total_steps = len(DEMO_FLOW)
441
+
442
+ # Calculate step number based on phase
443
+ phase_order = list(DEMO_FLOW.keys())
444
+ step_number = phase_order.index(phase) + 1 if phase in phase_order else current_step
445
+
446
+ return content.get_html(
447
+ show_progress=True,
448
+ current_step=step_number,
449
+ total_steps=total_steps
450
+ )
451
+
452
+ def get_demo_progress(current_phase: DemoPhase) -> Dict[str, Any]:
453
+ """Get current demo progress information"""
454
+ phase_order = list(DEMO_FLOW.keys())
455
+ current_index = phase_order.index(current_phase) if current_phase in phase_order else 0
456
+
457
+ return {
458
+ "current_phase": current_phase.value,
459
+ "current_step": current_index + 1,
460
+ "total_steps": len(phase_order),
461
+ "progress_percentage": int(((current_index + 1) / len(phase_order)) * 100),
462
+ "next_phase": phase_order[current_index + 1].value if current_index + 1 < len(phase_order) else None,
463
+ "estimated_time_remaining": sum(
464
+ DEMO_FLOW[phase].duration_seconds
465
+ for i, phase in enumerate(phase_order)
466
+ if i > current_index
467
+ )
468
+ }
469
+
470
+ def get_quick_start_guide(role: str = "executives") -> Dict[str, Any]:
471
+ """Get quick start guide for specific role"""
472
+ return QUICK_START_GUIDE.get(role, QUICK_START_GUIDE["for_executives"])
473
+
474
+ # Psychology-focused demo controller
475
+ class DemoPsychologyController:
476
+ """Manages the psychological flow of the demo"""
477
+
478
+ def __init__(self):
479
+ self.current_phase = DemoPhase.INTRODUCTION
480
+ self.phase_start_time = time.time()
481
+ self.completed_phases = []
482
+ self.user_attention_score = 100 # Start with full attention
483
+
484
+ def transition_to_phase(self, phase: DemoPhase) -> Dict[str, Any]:
485
+ """Transition to a new demo phase with psychological timing"""
486
+ current_time = time.time()
487
+ phase_duration = current_time - self.phase_start_time
488
+
489
+ # Calculate attention score (decays over time, refreshes on phase change)
490
+ self.user_attention_score = max(60, self.user_attention_score - (phase_duration / 10))
491
+
492
+ # If phase was too short, user might have missed it
493
+ if phase_duration < 10 and self.current_phase != DemoPhase.INTRODUCTION:
494
+ self.user_attention_score -= 10
495
+
496
+ # Update state
497
+ self.completed_phases.append(self.current_phase)
498
+ self.current_phase = phase
499
+ self.phase_start_time = time.time()
500
+
501
+ # Refresh attention on phase change
502
+ self.user_attention_score = min(100, self.user_attention_score + 20)
503
+
504
+ return {
505
+ "new_phase": phase.value,
506
+ "previous_phase_duration": int(phase_duration),
507
+ "user_attention_score": int(self.user_attention_score),
508
+ "recommended_pause": self._get_recommended_pause(phase),
509
+ "key_message": DEMO_FLOW[phase].key_message
510
+ }
511
+
512
+ def _get_recommended_pause(self, phase: DemoPhase) -> str:
513
+ """Get recommended pause based on phase psychology"""
514
+ pauses = {
515
+ DemoPhase.INTRODUCTION: "Pause to set context",
516
+ DemoPhase.FAILURE_INJECTION: "Let the tension build",
517
+ DemoPhase.REAL_OSS_ANALYSIS: "Watch the reasoning unfold",
518
+ DemoPhase.DECISION_BOUNDARY: "Pause intentionally here",
519
+ DemoPhase.SIMULATED_ENTERPRISE: "Explain the simulation",
520
+ DemoPhase.RESOLUTION: "Show the impact",
521
+ DemoPhase.ARCHITECTURE_REVIEW: "Summarize the architecture"
522
+ }
523
+ return pauses.get(phase, "Continue")
524
+
525
+ def get_current_guidance(self) -> str:
526
+ """Get current guidance HTML"""
527
+ return get_phase_html(self.current_phase, len(self.completed_phases) + 1)
528
+
529
+ def should_speed_up(self) -> bool:
530
+ """Determine if we should speed up based on attention score"""
531
+ return self.user_attention_score < 70
532
+
533
+ def should_slow_down(self) -> bool:
534
+ """Determine if we should slow down for emphasis"""
535
+ important_phases = [
536
+ DemoPhase.DECISION_BOUNDARY,
537
+ DemoPhase.ARCHITECTURE_REVIEW
538
+ ]
539
+ return self.current_phase in important_phases
540
+
541
+ # Global demo controller instance
542
+ _demo_controller = None
543
+
544
+ def get_demo_controller() -> DemoPsychologyController:
545
+ """Get singleton demo controller instance"""
546
+ global _demo_controller
547
+ if _demo_controller is None:
548
+ _demo_controller = DemoPsychologyController()
549
+ return _demo_controller