Spaces:
Sleeping

ARD-RGL commited on
Commit
de25031
·
verified ·
1 Parent(s): af77a6a

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +159 -145
app.py CHANGED
@@ -1,64 +1,81 @@
1
  import gradio as gr
2
  from datetime import datetime
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3
 
4
  APP_TITLE = "Sourceborn URR Control Shell"
5
 
6
  ACCEPTED_CONCEPTS = [
7
- "Point Zero",
8
- "Source Point",
9
- "Halt Point",
10
- "Mystery",
11
- "Invention",
12
- "Point Zero with Product",
13
- "Point Zero + Product",
14
  ]
15
 
16
  BACKEND_SUPPORT = [
17
- "raw source lock",
18
- "session and run tracking",
19
- "node definitions",
20
- "high-parameter memory entries",
21
- "filter results",
22
- "halt points",
23
- "loop creation",
24
- "merge proposals",
25
- "URR PASS / HOLD / REJECT reviews",
26
- "human gate decisions",
27
- "master log events",
28
- "archive/source references",
29
  ]
30
 
31
  PHASES = [
32
- ("Phase 0", "Repo safety + Sourceborn lock", "Ready"),
33
- ("Phase 1", "Database models", "Pending"),
34
- ("Phase 2", "Master Log service", "Pending"),
35
- ("Phase 3", "Raw source lock + filter pipeline", "Pending"),
36
- ("Phase 4", "Halt Point → Loop/Sub-loop engine", "Pending"),
37
- ("Phase 5", "URR PASS / HOLD / REJECT gates", "Pending"),
38
- ("Phase 6", "Human gate decisions", "Pending"),
39
- ("Phase 7", "Memory search + merge proposal", "Pending"),
40
- ("Phase 8", "Archive/source ingestion", "Pending"),
41
- ("Phase 9", "Modern control dashboard", "Ready"),
42
- ("Phase 10", "Tests + deploy safety", "Pending"),
43
  ]
44
 
 
45
  def format_items(items):
46
  return "\n".join([f"- {item}" for item in items])
47
 
 
48
  def make_phase_table():
49
  rows = "| Phase | Task | Status |\n|---|---|---|\n"
50
- for phase, task, status in PHASES:
51
- rows += f"| {phase} | {task} | {status} |\n"
52
- return rows
 
53
 
54
  def generate_review(raw_input, clarity_check, risk_check, improved_output, decision):
55
  now = datetime.now().strftime("%Y-%m-%d %H:%M:%S")
56
-
57
- ```
58
- return f"""
59
- ```
60
-
61
- # {decision} Review
62
 
63
  **Time:** {now}
64
 
@@ -85,64 +102,73 @@ return f"""
85
  * Naming = Review
86
  * Core = Not final
87
  * Freeze = Not approved
88
- """
 
89
 
90
  CSS = """
91
  .gradio-container {
92
- max-width: 1220px !important;
93
- margin: auto !important;
94
  }
95
 
96
  .sb-hero {
97
- padding: 28px;
98
- border-radius: 24px;
99
- background:
100
- radial-gradient(circle at top left, rgba(99,102,241,0.35), transparent 34%),
101
- linear-gradient(135deg, rgba(15,23,42,0.98), rgba(30,41,59,0.92));
102
- border: 1px solid rgba(148,163,184,0.22);
103
- box-shadow: 0 24px 70px rgba(2,6,23,0.35);
104
  }
105
 
106
  .sb-title {
107
- font-size: 38px;
108
- font-weight: 850;
109
- letter-spacing: -0.04em;
110
- margin-bottom: 8px;
111
  }
112
 
113
  .sb-subtitle {
114
- color: #cbd5e1;
115
- font-size: 16px;
116
- line-height: 1.6;
117
  }
118
 
119
  .sb-badge {
120
- display: inline-block;
121
- padding: 7px 13px;
122
- margin: 10px 8px 0 0;
123
- border-radius: 999px;
124
- background: rgba(99,102,241,0.18);
125
- border: 1px solid rgba(165,180,252,0.35);
126
- color: #e0e7ff;
127
- font-size: 14px;
128
- font-weight: 650;
129
  }
130
  """
131
 
132
- with gr.Blocks(css=CSS, title=APP_TITLE) as demo:
133
- gr.HTML(
134
- """ <div class="sb-hero"> <div class="sb-title">Sourceborn URR Control Shell</div> <div class="sb-subtitle">
135
- Public-safe dashboard for Sourceborn v0.1 Review Status.
136
- This shell does not expose private Sourceborn core logic. </div> <span class="sb-badge">v0.1 Review Status</span> <span class="sb-badge">Concepts = Keep</span> <span class="sb-badge">Naming = Review</span> <span class="sb-badge">Core = Not final</span> <span class="sb-badge">Freeze = Not approved</span> </div>
137
- """
138
- )
139
 
140
- ```
141
- with gr.Tab("Lock Status"):
142
- gr.Markdown(
143
  """
144
- ```
 
 
 
 
 
 
 
 
 
 
 
 
 
145
 
 
 
 
146
  # Current Lock
147
 
148
  | Area | Status |
@@ -162,37 +188,30 @@ Sourceborn/
162
  * 01_SOURCEBORN_ENGINE
163
  * 02_URR
164
  * 99_ARCHIVE
165
- """
166
- )
167
-
168
- with gr.Tab("Accepted Concepts"):
169
- gr.Markdown(
170
- f"""
171
 
 
 
 
172
  # Accepted Concepts Only
173
 
174
- {make_list(ACCEPTED_CONCEPTS)}
175
  """
176
- )
177
-
178
- ```
179
- with gr.Tab("Backend Foundation"):
180
- gr.Markdown(
181
- f"""
182
- ```
183
 
 
 
 
184
  # Backend Must Support
185
 
186
- {make_list(BACKEND_SUPPORT)}
187
  """
188
- )
189
-
190
- ```
191
- with gr.Tab("Phasewise Build"):
192
- gr.Markdown(
193
- f"""
194
- ```
195
 
 
 
 
196
  # Phasewise Build Path
197
 
198
  {make_phase_table()}
@@ -204,50 +223,46 @@ Codex must complete one phase at a time and report:
204
  3. What was not changed
205
  4. Build/test result
206
  5. Sourceborn safety status: PASS / HOLD / REJECT
207
- """
208
- )
209
-
210
- with gr.Tab("PASS / HOLD / REJECT"):
211
- gr.Markdown(
212
- """
213
 
 
 
 
214
  # Output Rule
215
 
216
  For public/external output, show only:
217
 
218
  Raw Input → Clarity Check → Risk Check → Improved Verified Output
219
  """
220
- )
221
-
222
- ```
223
- with gr.Row():
224
- raw_input = gr.Textbox(label="Raw Input", lines=6)
225
- clarity_check = gr.Textbox(label="Clarity Check", lines=6)
226
-
227
- with gr.Row():
228
- risk_check = gr.Textbox(label="Risk Check", lines=6)
229
- improved_output = gr.Textbox(label="Improved Verified Output", lines=6)
230
-
231
- decision = gr.Radio(
232
- choices=["PASS", "HOLD", "REJECT"],
233
- value="HOLD",
234
- label="Decision",
235
- )
236
-
237
- button = gr.Button("Generate Review")
238
- result = gr.Markdown()
239
-
240
- button.click(
241
- fn=generate_review,
242
- inputs=[raw_input, clarity_check, risk_check, improved_output, decision],
243
- outputs=result,
244
- )
245
-
246
- with gr.Tab("Do Not Change"):
247
- gr.Markdown(
248
- """
249
- ```
250
-
251
  # What Codex Must Not Do
252
 
253
  * Do not finalize naming.
@@ -258,13 +273,12 @@ with gr.Tab("Do Not Change"):
258
  * Do not force product early.
259
  * Do not treat Halt Point as failure.
260
  * Do not remove Mystery or Invention.
261
- """
262
- )
263
-
264
- with gr.Tab("Resume Later"):
265
- gr.Markdown(
266
- """
267
 
 
 
 
268
  # Resume Point
269
 
270
  Resume from:
@@ -278,8 +292,8 @@ Current accepted status:
278
  * Core = Not final
279
  * Freeze = Not approved
280
  * Next = Test with more examples later before freeze
281
- """
282
- )
283
 
284
- if **name** == "**main**":
285
- demo.launch()
 
1
  import gradio as gr
2
  from datetime import datetime
3
+ import subprocess
4
+ import sys
5
+
6
+ # --- SELF-FIX HELPER ---
7
+ # If this file ever breaks again with IndentationError:
8
+ # 1. Add 'autopep8' to requirements.txt
9
+ # 2. Run in the terminal: python -m autopep8 -i app.py --select=E101,E111,E121
10
+ # 3. Factory reboot the Space
11
+ def self_fix():
12
+ """Attempt to auto-fix indentation using autopep8."""
13
+ try:
14
+ subprocess.run(
15
+ [sys.executable, "-m", "autopep8", "-i", __file__, "--select=E101,E111,E121"],
16
+ check=True,
17
+ )
18
+ print("✅ Auto-fix applied. Factory-reboot the Space now.")
19
+ except Exception as e:
20
+ print(f"❌ Auto-fix failed: {e}")
21
+
22
 
23
  APP_TITLE = "Sourceborn URR Control Shell"
24
 
25
  ACCEPTED_CONCEPTS = [
26
+ "Point Zero",
27
+ "Source Point",
28
+ "Halt Point",
29
+ "Mystery",
30
+ "Invention",
31
+ "Point Zero with Product",
32
+ "Point Zero + Product",
33
  ]
34
 
35
  BACKEND_SUPPORT = [
36
+ "raw source lock",
37
+ "session and run tracking",
38
+ "node definitions",
39
+ "high-parameter memory entries",
40
+ "filter results",
41
+ "halt points",
42
+ "loop creation",
43
+ "merge proposals",
44
+ "URR PASS / HOLD / REJECT reviews",
45
+ "human gate decisions",
46
+ "master log events",
47
+ "archive/source references",
48
  ]
49
 
50
  PHASES = [
51
+ ("Phase 0", "Repo safety + Sourceborn lock", "Ready"),
52
+ ("Phase 1", "Database models", "Pending"),
53
+ ("Phase 2", "Master Log service", "Pending"),
54
+ ("Phase 3", "Raw source lock + filter pipeline", "Pending"),
55
+ ("Phase 4", "Halt Point → Loop/Sub-loop engine", "Pending"),
56
+ ("Phase 5", "URR PASS / HOLD / REJECT gates", "Pending"),
57
+ ("Phase 6", "Human gate decisions", "Pending"),
58
+ ("Phase 7", "Memory search + merge proposal", "Pending"),
59
+ ("Phase 8", "Archive/source ingestion", "Pending"),
60
+ ("Phase 9", "Modern control dashboard", "Ready"),
61
+ ("Phase 10", "Tests + deploy safety", "Pending"),
62
  ]
63
 
64
+
65
  def format_items(items):
66
  return "\n".join([f"- {item}" for item in items])
67
 
68
+
69
  def make_phase_table():
70
  rows = "| Phase | Task | Status |\n|---|---|---|\n"
71
+ for phase, task, status in PHASES:
72
+ rows += f"| {phase} | {task} | {status} |\n"
73
+ return rows
74
+
75
 
76
  def generate_review(raw_input, clarity_check, risk_check, improved_output, decision):
77
  now = datetime.now().strftime("%Y-%m-%d %H:%M:%S")
78
+ return f"""# {decision} Review
 
 
 
 
 
79
 
80
  **Time:** {now}
81
 
 
102
  * Naming = Review
103
  * Core = Not final
104
  * Freeze = Not approved
105
+ """
106
+
107
 
108
  CSS = """
109
  .gradio-container {
110
+ max-width: 1220px !important;
111
+ margin: auto !important;
112
  }
113
 
114
  .sb-hero {
115
+ padding: 28px;
116
+ border-radius: 24px;
117
+ background:
118
+ radial-gradient(circle at top left, rgba(99,102,241,0.35), transparent 34%),
119
+ linear-gradient(135deg, rgba(15,23,42,0.98), rgba(30,41,59,0.92));
120
+ border: 1px solid rgba(148,163,184,0.22);
121
+ box-shadow: 0 24px 70px rgba(2,6,23,0.35);
122
  }
123
 
124
  .sb-title {
125
+ font-size: 38px;
126
+ font-weight: 850;
127
+ letter-spacing: -0.04em;
128
+ margin-bottom: 8px;
129
  }
130
 
131
  .sb-subtitle {
132
+ color: #cbd5e1;
133
+ font-size: 16px;
134
+ line-height: 1.6;
135
  }
136
 
137
  .sb-badge {
138
+ display: inline-block;
139
+ padding: 7px 13px;
140
+ margin: 10px 8px 0 0;
141
+ border-radius: 999px;
142
+ background: rgba(99,102,241,0.18);
143
+ border: 1px solid rgba(165,180,252,0.35);
144
+ color: #e0e7ff;
145
+ font-size: 14px;
146
+ font-weight: 650;
147
  }
148
  """
149
 
 
 
 
 
 
 
 
150
 
151
+ with gr.Blocks(css=CSS, title=APP_TITLE) as demo:
152
+ gr.HTML(
 
153
  """
154
+ <div class="sb-hero">
155
+ <div class="sb-title">Sourceborn URR Control Shell</div>
156
+ <div class="sb-subtitle">
157
+ Public-safe dashboard for Sourceborn v0.1 Review Status.
158
+ This shell does not expose private Sourceborn core logic.
159
+ </div>
160
+ <span class="sb-badge">v0.1 Review Status</span>
161
+ <span class="sb-badge">Concepts = Keep</span>
162
+ <span class="sb-badge">Naming = Review</span>
163
+ <span class="sb-badge">Core = Not final</span>
164
+ <span class="sb-badge">Freeze = Not approved</span>
165
+ </div>
166
+ """
167
+ )
168
 
169
+ with gr.Tab("Lock Status"):
170
+ gr.Markdown(
171
+ """
172
  # Current Lock
173
 
174
  | Area | Status |
 
188
  * 01_SOURCEBORN_ENGINE
189
  * 02_URR
190
  * 99_ARCHIVE
191
+ """
192
+ )
 
 
 
 
193
 
194
+ with gr.Tab("Accepted Concepts"):
195
+ gr.Markdown(
196
+ f"""
197
  # Accepted Concepts Only
198
 
199
+ {format_items(ACCEPTED_CONCEPTS)}
200
  """
201
+ )
 
 
 
 
 
 
202
 
203
+ with gr.Tab("Backend Foundation"):
204
+ gr.Markdown(
205
+ f"""
206
  # Backend Must Support
207
 
208
+ {format_items(BACKEND_SUPPORT)}
209
  """
210
+ )
 
 
 
 
 
 
211
 
212
+ with gr.Tab("Phasewise Build"):
213
+ gr.Markdown(
214
+ f"""
215
  # Phasewise Build Path
216
 
217
  {make_phase_table()}
 
223
  3. What was not changed
224
  4. Build/test result
225
  5. Sourceborn safety status: PASS / HOLD / REJECT
226
+ """
227
+ )
 
 
 
 
228
 
229
+ with gr.Tab("PASS / HOLD / REJECT"):
230
+ gr.Markdown(
231
+ """
232
  # Output Rule
233
 
234
  For public/external output, show only:
235
 
236
  Raw Input → Clarity Check → Risk Check → Improved Verified Output
237
  """
238
+ )
239
+
240
+ with gr.Row():
241
+ raw_input = gr.Textbox(label="Raw Input", lines=6)
242
+ clarity_check = gr.Textbox(label="Clarity Check", lines=6)
243
+
244
+ with gr.Row():
245
+ risk_check = gr.Textbox(label="Risk Check", lines=6)
246
+ improved_output = gr.Textbox(label="Improved Verified Output", lines=6)
247
+
248
+ decision = gr.Radio(
249
+ choices=["PASS", "HOLD", "REJECT"],
250
+ value="HOLD",
251
+ label="Decision",
252
+ )
253
+
254
+ button = gr.Button("Generate Review")
255
+ result = gr.Markdown()
256
+
257
+ button.click(
258
+ fn=generate_review,
259
+ inputs=[raw_input, clarity_check, risk_check, improved_output, decision],
260
+ outputs=result,
261
+ )
262
+
263
+ with gr.Tab("Do Not Change"):
264
+ gr.Markdown(
265
+ """
 
 
 
266
  # What Codex Must Not Do
267
 
268
  * Do not finalize naming.
 
273
  * Do not force product early.
274
  * Do not treat Halt Point as failure.
275
  * Do not remove Mystery or Invention.
276
+ """
277
+ )
 
 
 
 
278
 
279
+ with gr.Tab("Resume Later"):
280
+ gr.Markdown(
281
+ """
282
  # Resume Point
283
 
284
  Resume from:
 
292
  * Core = Not final
293
  * Freeze = Not approved
294
  * Next = Test with more examples later before freeze
295
+ """
296
+ )
297
 
298
+ if __name__ == "__main__":
299
+ demo.launch()