petter2025 commited on
Commit
1d377e2
·
verified ·
1 Parent(s): ebdbbf6

Update ui/components.py

Browse files
Files changed (1) hide show
  1. ui/components.py +49 -90
ui/components.py CHANGED
@@ -1,27 +1,29 @@
1
  """
2
  Minimalist, Math-First UI Components for ARF OSS
3
- Designed for engineers, not marketers.
4
 
5
  Principles:
6
  - Deterministic layout
7
- - Low visual entropy
8
- - Computational semantics
9
- - OSS-first credibility
10
  """
11
 
12
  import gradio as gr
13
- from typing import List, Dict, Any
14
 
15
 
16
  # ============================================================
17
- # HEADER
18
  # ============================================================
19
- def create_header() -> gr.HTML:
 
 
20
  return gr.HTML(
21
- """
22
- <div style="font-family: monospace; padding-bottom: 8px;">
23
- <strong>ARF v3.3.6 (OSS)</strong> · Agentic Reliability Engine<br/>
24
- Status: <span style="color: #2ecc71;">READY</span>
25
  </div>
26
  <hr/>
27
  """
@@ -29,87 +31,84 @@ def create_header() -> gr.HTML:
29
 
30
 
31
  # ============================================================
32
- # STATUS BAR
33
  # ============================================================
34
- def create_status_bar() -> gr.HTML:
 
 
35
  return gr.HTML(
36
- """
37
  <div style="font-family: monospace; font-size: 13px;">
38
- core=active | mode=oss | audit=enabled
39
  </div>
40
  """
41
  )
42
 
43
 
44
  # ============================================================
45
- # TAB 1 — INCIDENT INPUT & EXECUTION
46
  # ============================================================
47
- def create_tab1_incident_demo():
 
 
48
  with gr.Column():
49
- gr.Markdown("### 1. Incident Input", elem_classes=["mono"])
50
-
51
- scenario = gr.Dropdown(
52
- label="Incident Scenario",
53
- choices=[
54
- "cache_miss_storm",
55
- "database_connection_leak",
56
- "api_rate_limit_spike",
57
- "memory_pressure_event",
58
- ],
59
- value="cache_miss_storm",
60
  )
61
 
62
- mode = gr.Radio(
63
  label="Execution Mode",
64
  choices=["advisory", "approval", "autonomous"],
65
  value="advisory",
66
  )
67
 
68
- gr.Markdown("### 2. Execute Analysis")
69
 
70
- run_btn = gr.Button("Run Analysis", variant="primary")
 
 
 
71
 
72
- return {
73
- "scenario": scenario,
74
- "mode": mode,
75
- "run_btn": run_btn,
76
- }
77
 
78
 
79
  # ============================================================
80
- # TAB 2 — BUSINESS IMPACT (OSS SAFE)
81
  # ============================================================
82
  def create_tab2_business_roi():
83
  with gr.Column():
84
- gr.Markdown("### Estimated Impact (Model-Derived)")
85
 
86
- output = gr.Markdown(
87
  """
88
- Loss Rate: $0 / hour
89
- Recovery Time: N/A
90
- Confidence Interval: N/A
91
  """,
92
  elem_classes=["mono"],
93
  )
94
 
95
- return {"roi_output": output}
96
 
97
 
98
  # ============================================================
99
- # TAB 3 — ENTERPRISE FEATURES (LOCKED)
100
  # ============================================================
101
  def create_tab3_enterprise_features():
102
  with gr.Column():
103
- gr.Markdown("### Enterprise Capabilities (Unavailable in OSS)")
104
 
105
  gr.Markdown(
106
  """
107
- - Autonomous execution
108
- - Multi-agent arbitration
109
- - Policy enforcement
110
- - SLA-backed recovery
111
 
112
- _This OSS build exposes intent only._
113
  """,
114
  elem_classes=["mono"],
115
  )
@@ -120,43 +119,3 @@ def create_tab3_enterprise_features():
120
  # ============================================================
121
  def create_tab4_audit_trail():
122
  with gr.Column():
123
- gr.Markdown("### Execution Trace")
124
-
125
- audit_log = gr.Dataframe(
126
- headers=["phase", "status", "Δt (ms)"],
127
- datatype=["str", "str", "number"],
128
- row_count=5,
129
- )
130
-
131
- return {"audit_log": audit_log}
132
-
133
-
134
- # ============================================================
135
- # TAB 5 — LEARNING ENGINE
136
- # ============================================================
137
- def create_tab5_learning_engine():
138
- with gr.Column():
139
- gr.Markdown("### Learning Engine State")
140
-
141
- gr.Markdown(
142
- """
143
- memory_vectors: enabled
144
- outcome_feedback: passive
145
- model_updates: disabled (OSS)
146
- """,
147
- elem_classes=["mono"],
148
- )
149
-
150
-
151
- # ============================================================
152
- # FOOTER
153
- # ============================================================
154
- def create_footer() -> gr.HTML:
155
- return gr.HTML(
156
- """
157
- <hr/>
158
- <div style="font-family: monospace; font-size: 12px;">
159
- ARF OSS · Apache-2.0 · 2025
160
- </div>
161
- """
162
- )
 
1
  """
2
  Minimalist, Math-First UI Components for ARF OSS
3
+ Contract-compatible with app.py
4
 
5
  Principles:
6
  - Deterministic layout
7
+ - Low entropy
8
+ - Systems-first semantics
9
+ - OSS honesty
10
  """
11
 
12
  import gradio as gr
13
+ from typing import Dict, Any
14
 
15
 
16
  # ============================================================
17
+ # HEADER (SIGNATURE FIXED)
18
  # ============================================================
19
+ def create_header(version: str, mock_mode: bool) -> gr.HTML:
20
+ mode = "mock" if mock_mode else "live"
21
+
22
  return gr.HTML(
23
+ f"""
24
+ <div style="font-family: monospace; line-height: 1.4;">
25
+ <strong>Agentic Reliability Framework</strong><br/>
26
+ version={version} · mode={mode} · build=oss
27
  </div>
28
  <hr/>
29
  """
 
31
 
32
 
33
  # ============================================================
34
+ # STATUS BAR (SIGNATURE FIXED)
35
  # ============================================================
36
+ def create_status_bar(system_online: bool = True) -> gr.HTML:
37
+ status = "ONLINE" if system_online else "OFFLINE"
38
+
39
  return gr.HTML(
40
+ f"""
41
  <div style="font-family: monospace; font-size: 13px;">
42
+ system={status} | agent_core=active | audit=enabled
43
  </div>
44
  """
45
  )
46
 
47
 
48
  # ============================================================
49
+ # TAB 1 — INCIDENT DEMO
50
  # ============================================================
51
+ def create_tab1_incident_demo(
52
+ scenarios: Dict[str, Any]
53
+ ):
54
  with gr.Column():
55
+ gr.Markdown("### Incident Input", elem_classes=["mono"])
56
+
57
+ scenario_dropdown = gr.Dropdown(
58
+ label="Scenario",
59
+ choices=list(scenarios.keys()),
60
+ value=list(scenarios.keys())[0],
 
 
 
 
 
61
  )
62
 
63
+ execution_mode = gr.Radio(
64
  label="Execution Mode",
65
  choices=["advisory", "approval", "autonomous"],
66
  value="advisory",
67
  )
68
 
69
+ run_button = gr.Button("Run Analysis", variant="primary")
70
 
71
+ metrics = gr.Markdown(
72
+ "No execution yet.",
73
+ elem_classes=["mono"],
74
+ )
75
 
76
+ return scenario_dropdown, execution_mode, run_button, metrics
 
 
 
 
77
 
78
 
79
  # ============================================================
80
+ # TAB 2 — BUSINESS ROI
81
  # ============================================================
82
  def create_tab2_business_roi():
83
  with gr.Column():
84
+ gr.Markdown("### Impact Estimation (Model Output)")
85
 
86
+ roi_output = gr.Markdown(
87
  """
88
+ loss_rate_usd_per_hour = 0
89
+ recovery_time_minutes =
90
+ confidence_interval =
91
  """,
92
  elem_classes=["mono"],
93
  )
94
 
95
+ return roi_output
96
 
97
 
98
  # ============================================================
99
+ # TAB 3 — ENTERPRISE FEATURES
100
  # ============================================================
101
  def create_tab3_enterprise_features():
102
  with gr.Column():
103
+ gr.Markdown("### Enterprise Capabilities")
104
 
105
  gr.Markdown(
106
  """
107
+ autonomous_execution = false
108
+ policy_engine = locked
109
+ sla_enforcement = locked
 
110
 
111
+ status = OSS_LIMITED
112
  """,
113
  elem_classes=["mono"],
114
  )
 
119
  # ============================================================
120
  def create_tab4_audit_trail():
121
  with gr.Column():