Update app.py
Browse files
app.py
CHANGED
|
@@ -1,76 +1,334 @@
|
|
| 1 |
-
|
|
|
|
|
|
|
| 2 |
|
| 3 |
-
|
| 4 |
-
This package gives one clean starting point, one locked status, and one phasewise build path. It is designed to stop drift, preserve the latest accepted Sourceborn v0.1 Review Status, and build the backend in controlled phases.
|
| 5 |
|
| 6 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 7 |
|
| 8 |
| Area | Status |
|
| 9 |
|---|---|
|
| 10 |
| Sourceborn Sequence | v0.1 Review Status |
|
| 11 |
| Concepts | Keep |
|
| 12 |
| Naming | Review |
|
| 13 |
-
| Core | final |
|
| 14 |
| Freeze | Not approved |
|
| 15 |
| Next | Test with more examples later before freeze |
|
| 16 |
|
| 17 |
-
##
|
| 18 |
|
| 19 |
-
|
| 20 |
-
|
| 21 |
-
|
| 22 |
-
|
| 23 |
-
|
| 24 |
-
|
| 25 |
-
|
| 26 |
|
| 27 |
-
|
|
|
|
| 28 |
|
| 29 |
-
|
| 30 |
-
|
| 31 |
-
|
| 32 |
-
|
| 33 |
-
|
| 34 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 35 |
|
| 36 |
-
## First instruction for Codex
|
| 37 |
Open this file first, then open:
|
| 38 |
|
| 39 |
-
|
| 40 |
-
|
| 41 |
-
|
| 42 |
-
4. Project: Sourceborn β 01_SOURCEBORN_ENGINE β `03_BACKEND_CONTRACT.md`
|
| 43 |
-
5. Project: Sourceborn β 01_SOURCEBORN_ENGINE β `05_FILTER_AND_PARAMETER_SPEC.md`
|
| 44 |
-
6. Project: Sourceborn β 02_URR β `01_URR_REVIEW_GATE_SPEC.md`
|
| 45 |
|
| 46 |
-
## What Codex must build first
|
| 47 |
Codex must build the Sourceborn control shell and backend foundation before any full engine expansion.
|
| 48 |
|
| 49 |
The backend must support:
|
| 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 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
````python
|
| 2 |
+
import gradio as gr
|
| 3 |
+
from datetime import datetime
|
| 4 |
|
| 5 |
+
APP_TITLE = "Sourceborn β All-in-One Package"
|
|
|
|
| 6 |
|
| 7 |
+
ACCEPTED_CONCEPTS = [
|
| 8 |
+
"Point Zero",
|
| 9 |
+
"Source Point",
|
| 10 |
+
"Halt Point",
|
| 11 |
+
"Mystery",
|
| 12 |
+
"Invention",
|
| 13 |
+
"Point Zero with Product",
|
| 14 |
+
"Point Zero + Product",
|
| 15 |
+
]
|
| 16 |
+
|
| 17 |
+
CODEX_FILES = [
|
| 18 |
+
"Project: Sourceborn β 00_TALK_AND_CONTROL β 00_SOURCEBORN_LOCK_STATUS.md",
|
| 19 |
+
"Project: Sourceborn β CODEX_HANDOFF β 00_CODEX_MASTER_PROMPT.md",
|
| 20 |
+
"Project: Sourceborn β CODEX_HANDOFF β 01_PHASEWISE_BUILD_PLAN.md",
|
| 21 |
+
"Project: Sourceborn β 01_SOURCEBORN_ENGINE β 03_BACKEND_CONTRACT.md",
|
| 22 |
+
"Project: Sourceborn β 01_SOURCEBORN_ENGINE β 05_FILTER_AND_PARAMETER_SPEC.md",
|
| 23 |
+
"Project: Sourceborn β 02_URR β 01_URR_REVIEW_GATE_SPEC.md",
|
| 24 |
+
]
|
| 25 |
+
|
| 26 |
+
BACKEND_SUPPORT = [
|
| 27 |
+
"raw source lock",
|
| 28 |
+
"session and run tracking",
|
| 29 |
+
"node definitions",
|
| 30 |
+
"high-parameter memory entries",
|
| 31 |
+
"filter results",
|
| 32 |
+
"halt points",
|
| 33 |
+
"loop creation",
|
| 34 |
+
"merge proposals",
|
| 35 |
+
"URR PASS / HOLD / REJECT reviews",
|
| 36 |
+
"human gate decisions",
|
| 37 |
+
"master log events",
|
| 38 |
+
"archive/source references",
|
| 39 |
+
]
|
| 40 |
+
|
| 41 |
+
DO_NOT_DO = [
|
| 42 |
+
"Do not finalize naming.",
|
| 43 |
+
"Do not freeze the core.",
|
| 44 |
+
"Do not rename Sourceborn folders.",
|
| 45 |
+
"Do not treat old ARD/RGL/RH material as active Sourceborn modules.",
|
| 46 |
+
"Do not expose private engine details in public UI.",
|
| 47 |
+
"Do not force product early.",
|
| 48 |
+
"Do not treat Halt Point as failure.",
|
| 49 |
+
"Do not remove Mystery or Invention.",
|
| 50 |
+
]
|
| 51 |
+
|
| 52 |
+
PHASES = [
|
| 53 |
+
("Phase 0", "Repo safety + Sourceborn lock", "Ready"),
|
| 54 |
+
("Phase 1", "Database models", "Pending"),
|
| 55 |
+
("Phase 2", "Master Log service", "Pending"),
|
| 56 |
+
("Phase 3", "Raw source lock + filter pipeline", "Pending"),
|
| 57 |
+
("Phase 4", "Halt Point β Loop/Sub-loop engine", "Pending"),
|
| 58 |
+
("Phase 5", "URR PASS / HOLD / REJECT gates", "Pending"),
|
| 59 |
+
("Phase 6", "Human gate decisions", "Pending"),
|
| 60 |
+
("Phase 7", "Memory search + merge proposal", "Pending"),
|
| 61 |
+
("Phase 8", "Archive/source ingestion", "Pending"),
|
| 62 |
+
("Phase 9", "Modern control dashboard", "Ready"),
|
| 63 |
+
("Phase 10", "Tests + deploy safety", "Pending"),
|
| 64 |
+
]
|
| 65 |
+
|
| 66 |
+
|
| 67 |
+
def make_list(items):
|
| 68 |
+
return "\n".join([f"- {item}" for item in items])
|
| 69 |
+
|
| 70 |
+
|
| 71 |
+
def make_phase_table():
|
| 72 |
+
rows = "| Phase | Task | Status |\n|---|---|---|\n"
|
| 73 |
+
for phase, task, status in PHASES:
|
| 74 |
+
rows += f"| {phase} | {task} | {status} |\n"
|
| 75 |
+
return rows
|
| 76 |
+
|
| 77 |
+
|
| 78 |
+
def generate_review(raw_input, clarity_check, risk_check, improved_output, decision):
|
| 79 |
+
now = datetime.now().strftime("%Y-%m-%d %H:%M:%S")
|
| 80 |
+
|
| 81 |
+
return f"""
|
| 82 |
+
# {decision} Review
|
| 83 |
+
|
| 84 |
+
**Time:** {now}
|
| 85 |
+
|
| 86 |
+
## Raw Input
|
| 87 |
+
{raw_input or "No raw input provided."}
|
| 88 |
+
|
| 89 |
+
## Clarity Check
|
| 90 |
+
{clarity_check or "No clarity check provided."}
|
| 91 |
+
|
| 92 |
+
## Risk Check
|
| 93 |
+
{risk_check or "No risk check provided."}
|
| 94 |
+
|
| 95 |
+
## Improved Verified Output
|
| 96 |
+
{improved_output or "No improved output provided."}
|
| 97 |
+
|
| 98 |
+
## Sourceborn Lock
|
| 99 |
+
- Sourceborn Sequence = v0.1 Review Status
|
| 100 |
+
- Concepts = Keep
|
| 101 |
+
- Naming = Review
|
| 102 |
+
- Core = Not final
|
| 103 |
+
- Freeze = Not approved
|
| 104 |
+
"""
|
| 105 |
+
|
| 106 |
+
|
| 107 |
+
CSS = """
|
| 108 |
+
.gradio-container {
|
| 109 |
+
max-width: 1220px !important;
|
| 110 |
+
margin: auto !important;
|
| 111 |
+
}
|
| 112 |
+
|
| 113 |
+
.sb-hero {
|
| 114 |
+
padding: 28px;
|
| 115 |
+
border-radius: 24px;
|
| 116 |
+
background:
|
| 117 |
+
radial-gradient(circle at top left, rgba(99,102,241,0.35), transparent 34%),
|
| 118 |
+
linear-gradient(135deg, rgba(15,23,42,0.98), rgba(30,41,59,0.92));
|
| 119 |
+
border: 1px solid rgba(148,163,184,0.22);
|
| 120 |
+
box-shadow: 0 24px 70px rgba(2,6,23,0.35);
|
| 121 |
+
}
|
| 122 |
+
|
| 123 |
+
.sb-title {
|
| 124 |
+
font-size: 38px;
|
| 125 |
+
font-weight: 850;
|
| 126 |
+
letter-spacing: -0.04em;
|
| 127 |
+
margin-bottom: 8px;
|
| 128 |
+
}
|
| 129 |
+
|
| 130 |
+
.sb-subtitle {
|
| 131 |
+
color: #cbd5e1;
|
| 132 |
+
font-size: 16px;
|
| 133 |
+
line-height: 1.6;
|
| 134 |
+
}
|
| 135 |
+
|
| 136 |
+
.sb-badge {
|
| 137 |
+
display: inline-block;
|
| 138 |
+
padding: 7px 13px;
|
| 139 |
+
margin: 10px 8px 0 0;
|
| 140 |
+
border-radius: 999px;
|
| 141 |
+
background: rgba(99,102,241,0.18);
|
| 142 |
+
border: 1px solid rgba(165,180,252,0.35);
|
| 143 |
+
color: #e0e7ff;
|
| 144 |
+
font-size: 14px;
|
| 145 |
+
font-weight: 650;
|
| 146 |
+
}
|
| 147 |
+
|
| 148 |
+
.sb-warning {
|
| 149 |
+
padding: 16px;
|
| 150 |
+
border-radius: 16px;
|
| 151 |
+
background: rgba(251,191,36,0.10);
|
| 152 |
+
border: 1px solid rgba(251,191,36,0.28);
|
| 153 |
+
}
|
| 154 |
+
"""
|
| 155 |
+
|
| 156 |
+
|
| 157 |
+
with gr.Blocks(css=CSS, title=APP_TITLE) as demo:
|
| 158 |
+
gr.HTML(
|
| 159 |
+
"""
|
| 160 |
+
<div class="sb-hero">
|
| 161 |
+
<div class="sb-title">Sourceborn β All-in-One Package</div>
|
| 162 |
+
<div class="sb-subtitle">
|
| 163 |
+
One clean starting point, one locked status, and one phasewise build path.
|
| 164 |
+
This dashboard is public-safe and does not expose private Sourceborn core logic.
|
| 165 |
+
</div>
|
| 166 |
+
<span class="sb-badge">v0.1 Review Status</span>
|
| 167 |
+
<span class="sb-badge">Concepts = Keep</span>
|
| 168 |
+
<span class="sb-badge">Naming = Review</span>
|
| 169 |
+
<span class="sb-badge">Core = Not final</span>
|
| 170 |
+
<span class="sb-badge">Freeze = Not approved</span>
|
| 171 |
+
</div>
|
| 172 |
+
"""
|
| 173 |
+
)
|
| 174 |
+
|
| 175 |
+
with gr.Tab("Lock Status"):
|
| 176 |
+
gr.Markdown(
|
| 177 |
+
"""
|
| 178 |
+
# Current Lock
|
| 179 |
|
| 180 |
| Area | Status |
|
| 181 |
|---|---|
|
| 182 |
| Sourceborn Sequence | v0.1 Review Status |
|
| 183 |
| Concepts | Keep |
|
| 184 |
| Naming | Review |
|
| 185 |
+
| Core | Not final |
|
| 186 |
| Freeze | Not approved |
|
| 187 |
| Next | Test with more examples later before freeze |
|
| 188 |
|
| 189 |
+
## Active Structure Only
|
| 190 |
|
| 191 |
+
```text
|
| 192 |
+
Sourceborn/
|
| 193 |
+
βββ 00_TALK_AND_CONTROL
|
| 194 |
+
βββ 01_SOURCEBORN_ENGINE
|
| 195 |
+
βββ 02_URR
|
| 196 |
+
βββ 99_ARCHIVE
|
| 197 |
+
````
|
| 198 |
|
| 199 |
+
"""
|
| 200 |
+
)
|
| 201 |
|
| 202 |
+
```
|
| 203 |
+
with gr.Tab("Accepted Concepts"):
|
| 204 |
+
gr.Markdown(
|
| 205 |
+
f"""
|
| 206 |
+
```
|
| 207 |
+
|
| 208 |
+
# Accepted Concepts Only
|
| 209 |
+
|
| 210 |
+
{make_list(ACCEPTED_CONCEPTS)}
|
| 211 |
+
"""
|
| 212 |
+
)
|
| 213 |
+
|
| 214 |
+
```
|
| 215 |
+
with gr.Tab("Codex Start"):
|
| 216 |
+
gr.Markdown(
|
| 217 |
+
f"""
|
| 218 |
+
```
|
| 219 |
+
|
| 220 |
+
# First Instruction for Codex
|
| 221 |
|
|
|
|
| 222 |
Open this file first, then open:
|
| 223 |
|
| 224 |
+
{make_list(CODEX_FILES)}
|
| 225 |
+
|
| 226 |
+
## What Codex Must Build First
|
|
|
|
|
|
|
|
|
|
| 227 |
|
|
|
|
| 228 |
Codex must build the Sourceborn control shell and backend foundation before any full engine expansion.
|
| 229 |
|
| 230 |
The backend must support:
|
| 231 |
|
| 232 |
+
{make_list(BACKEND_SUPPORT)}
|
| 233 |
+
"""
|
| 234 |
+
)
|
| 235 |
+
|
| 236 |
+
```
|
| 237 |
+
with gr.Tab("Do Not Change"):
|
| 238 |
+
gr.Markdown(
|
| 239 |
+
f"""
|
| 240 |
+
```
|
| 241 |
+
|
| 242 |
+
# What Codex Must Not Do
|
| 243 |
+
|
| 244 |
+
{make_list(DO_NOT_DO)}
|
| 245 |
+
|
| 246 |
+
<div class="sb-warning">
|
| 247 |
+
|
| 248 |
+
**HOLD rule:** If any change touches core, naming freeze, folder rename, private sequence exposure, or archive activation, stop and mark HOLD.
|
| 249 |
+
|
| 250 |
+
</div>
|
| 251 |
+
"""
|
| 252 |
+
)
|
| 253 |
+
|
| 254 |
+
```
|
| 255 |
+
with gr.Tab("Phasewise Build"):
|
| 256 |
+
gr.Markdown(
|
| 257 |
+
f"""
|
| 258 |
+
```
|
| 259 |
+
|
| 260 |
+
# Phasewise Build Path
|
| 261 |
+
|
| 262 |
+
{make_phase_table()}
|
| 263 |
+
|
| 264 |
+
Codex must complete one phase at a time and report:
|
| 265 |
+
|
| 266 |
+
1. Files changed
|
| 267 |
+
2. Issue fixed
|
| 268 |
+
3. What was not changed
|
| 269 |
+
4. Build/test result
|
| 270 |
+
5. Sourceborn safety status: PASS / HOLD / REJECT
|
| 271 |
+
"""
|
| 272 |
+
)
|
| 273 |
+
|
| 274 |
+
with gr.Tab("PASS / HOLD / REJECT"):
|
| 275 |
+
gr.Markdown(
|
| 276 |
+
"""
|
| 277 |
+
|
| 278 |
+
# Output Rule
|
| 279 |
+
|
| 280 |
+
For public-safe review output, show only:
|
| 281 |
+
|
| 282 |
+
**Raw Input β Clarity Check β Risk Check β Improved Verified Output**
|
| 283 |
+
"""
|
| 284 |
+
)
|
| 285 |
+
|
| 286 |
+
```
|
| 287 |
+
with gr.Row():
|
| 288 |
+
raw_input = gr.Textbox(label="Raw Input", lines=6)
|
| 289 |
+
clarity_check = gr.Textbox(label="Clarity Check", lines=6)
|
| 290 |
+
|
| 291 |
+
with gr.Row():
|
| 292 |
+
risk_check = gr.Textbox(label="Risk Check", lines=6)
|
| 293 |
+
improved_output = gr.Textbox(label="Improved Verified Output", lines=6)
|
| 294 |
+
|
| 295 |
+
decision = gr.Radio(
|
| 296 |
+
choices=["PASS", "HOLD", "REJECT"],
|
| 297 |
+
value="HOLD",
|
| 298 |
+
label="Decision",
|
| 299 |
+
)
|
| 300 |
+
|
| 301 |
+
button = gr.Button("Generate Review")
|
| 302 |
+
result = gr.Markdown()
|
| 303 |
+
|
| 304 |
+
button.click(
|
| 305 |
+
fn=generate_review,
|
| 306 |
+
inputs=[raw_input, clarity_check, risk_check, improved_output, decision],
|
| 307 |
+
outputs=result,
|
| 308 |
+
)
|
| 309 |
+
|
| 310 |
+
with gr.Tab("Resume Later"):
|
| 311 |
+
gr.Markdown(
|
| 312 |
+
"""
|
| 313 |
+
```
|
| 314 |
+
|
| 315 |
+
# Resume Point
|
| 316 |
+
|
| 317 |
+
Resume from:
|
| 318 |
+
|
| 319 |
+
**Sourceborn Sequence v0.1 β Review Status**
|
| 320 |
+
|
| 321 |
+
Current accepted status:
|
| 322 |
+
|
| 323 |
+
* Concepts = Keep
|
| 324 |
+
* Naming = Review
|
| 325 |
+
* Core = Not final
|
| 326 |
+
* Freeze = Not approved
|
| 327 |
+
* Next = Test with more examples later before freeze
|
| 328 |
+
|
| 329 |
+
Do not change core unless approved.
|
| 330 |
+
"""
|
| 331 |
+
)
|
| 332 |
+
|
| 333 |
+
if **name** == "**main**":
|
| 334 |
+
demo.launch()
|