Spaces:
Sleeping

URR / app.py
ARD-RGL's picture
Update app.py
222baef verified
Raw History Blame
7.63 kB
````python
import gradio as gr
from datetime import datetime
APP_TITLE = "Sourceborn β€” All-in-One Package"
ACCEPTED_CONCEPTS = [
"Point Zero",
"Source Point",
"Halt Point",
"Mystery",
"Invention",
"Point Zero with Product",
"Point Zero + Product",
]
CODEX_FILES = [
"Project: Sourceborn β†’ 00_TALK_AND_CONTROL β†’ 00_SOURCEBORN_LOCK_STATUS.md",
"Project: Sourceborn β†’ CODEX_HANDOFF β†’ 00_CODEX_MASTER_PROMPT.md",
"Project: Sourceborn β†’ CODEX_HANDOFF β†’ 01_PHASEWISE_BUILD_PLAN.md",
"Project: Sourceborn β†’ 01_SOURCEBORN_ENGINE β†’ 03_BACKEND_CONTRACT.md",
"Project: Sourceborn β†’ 01_SOURCEBORN_ENGINE β†’ 05_FILTER_AND_PARAMETER_SPEC.md",
"Project: Sourceborn β†’ 02_URR β†’ 01_URR_REVIEW_GATE_SPEC.md",
]
BACKEND_SUPPORT = [
"raw source lock",
"session and run tracking",
"node definitions",
"high-parameter memory entries",
"filter results",
"halt points",
"loop creation",
"merge proposals",
"URR PASS / HOLD / REJECT reviews",
"human gate decisions",
"master log events",
"archive/source references",
]
DO_NOT_DO = [
"Do not finalize naming.",
"Do not freeze the core.",
"Do not rename Sourceborn folders.",
"Do not treat old ARD/RGL/RH material as active Sourceborn modules.",
"Do not expose private engine details in public UI.",
"Do not force product early.",
"Do not treat Halt Point as failure.",
"Do not remove Mystery or Invention.",
]
PHASES = [
("Phase 0", "Repo safety + Sourceborn lock", "Ready"),
("Phase 1", "Database models", "Pending"),
("Phase 2", "Master Log service", "Pending"),
("Phase 3", "Raw source lock + filter pipeline", "Pending"),
("Phase 4", "Halt Point β†’ Loop/Sub-loop engine", "Pending"),
("Phase 5", "URR PASS / HOLD / REJECT gates", "Pending"),
("Phase 6", "Human gate decisions", "Pending"),
("Phase 7", "Memory search + merge proposal", "Pending"),
("Phase 8", "Archive/source ingestion", "Pending"),
("Phase 9", "Modern control dashboard", "Ready"),
("Phase 10", "Tests + deploy safety", "Pending"),
]
def make_list(items):
return "\n".join([f"- {item}" for item in items])
def make_phase_table():
rows = "| Phase | Task | Status |\n|---|---|---|\n"
for phase, task, status in PHASES:
rows += f"| {phase} | {task} | {status} |\n"
return rows
def generate_review(raw_input, clarity_check, risk_check, improved_output, decision):
now = datetime.now().strftime("%Y-%m-%d %H:%M:%S")
return f"""
# {decision} Review
**Time:** {now}
## Raw Input
{raw_input or "No raw input provided."}
## Clarity Check
{clarity_check or "No clarity check provided."}
## Risk Check
{risk_check or "No risk check provided."}
## Improved Verified Output
{improved_output or "No improved output provided."}
## Sourceborn Lock
- Sourceborn Sequence = v0.1 Review Status
- Concepts = Keep
- Naming = Review
- Core = Not final
- Freeze = Not approved
"""
CSS = """
.gradio-container {
max-width: 1220px !important;
margin: auto !important;
}
.sb-hero {
padding: 28px;
border-radius: 24px;
background:
radial-gradient(circle at top left, rgba(99,102,241,0.35), transparent 34%),
linear-gradient(135deg, rgba(15,23,42,0.98), rgba(30,41,59,0.92));
border: 1px solid rgba(148,163,184,0.22);
box-shadow: 0 24px 70px rgba(2,6,23,0.35);
}
.sb-title {
font-size: 38px;
font-weight: 850;
letter-spacing: -0.04em;
margin-bottom: 8px;
}
.sb-subtitle {
color: #cbd5e1;
font-size: 16px;
line-height: 1.6;
}
.sb-badge {
display: inline-block;
padding: 7px 13px;
margin: 10px 8px 0 0;
border-radius: 999px;
background: rgba(99,102,241,0.18);
border: 1px solid rgba(165,180,252,0.35);
color: #e0e7ff;
font-size: 14px;
font-weight: 650;
}
.sb-warning {
padding: 16px;
border-radius: 16px;
background: rgba(251,191,36,0.10);
border: 1px solid rgba(251,191,36,0.28);
}
"""
with gr.Blocks(css=CSS, title=APP_TITLE) as demo:
gr.HTML(
"""
<div class="sb-hero">
<div class="sb-title">Sourceborn β€” All-in-One Package</div>
<div class="sb-subtitle">
One clean starting point, one locked status, and one phasewise build path.
This dashboard is public-safe and 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>
"""
)
with gr.Tab("Lock Status"):
gr.Markdown(
"""
# Current Lock
| Area | Status |
|---|---|
| Sourceborn Sequence | v0.1 Review Status |
| Concepts | Keep |
| Naming | Review |
| Core | Not final |
| Freeze | Not approved |
| Next | Test with more examples later before freeze |
## Active Structure Only
```text
Sourceborn/
β”œβ”€β”€ 00_TALK_AND_CONTROL
β”œβ”€β”€ 01_SOURCEBORN_ENGINE
β”œβ”€β”€ 02_URR
└── 99_ARCHIVE
````
"""
)
```
with gr.Tab("Accepted Concepts"):
gr.Markdown(
f"""
```
# Accepted Concepts Only
{make_list(ACCEPTED_CONCEPTS)}
"""
)
```
with gr.Tab("Codex Start"):
gr.Markdown(
f"""
```
# First Instruction for Codex
Open this file first, then open:
{make_list(CODEX_FILES)}
## What Codex Must Build First
Codex must build the Sourceborn control shell and backend foundation before any full engine expansion.
The backend must support:
{make_list(BACKEND_SUPPORT)}
"""
)
```
with gr.Tab("Do Not Change"):
gr.Markdown(
f"""
```
# What Codex Must Not Do
{make_list(DO_NOT_DO)}
<div class="sb-warning">
**HOLD rule:** If any change touches core, naming freeze, folder rename, private sequence exposure, or archive activation, stop and mark HOLD.
</div>
"""
)
```
with gr.Tab("Phasewise Build"):
gr.Markdown(
f"""
```
# Phasewise Build Path
{make_phase_table()}
Codex must complete one phase at a time and report:
1. Files changed
2. Issue fixed
3. What was not changed
4. Build/test result
5. Sourceborn safety status: PASS / HOLD / REJECT
"""
)
with gr.Tab("PASS / HOLD / REJECT"):
gr.Markdown(
"""
# Output Rule
For public-safe review output, show only:
**Raw Input β†’ Clarity Check β†’ Risk Check β†’ Improved Verified Output**
"""
)
```
with gr.Row():
raw_input = gr.Textbox(label="Raw Input", lines=6)
clarity_check = gr.Textbox(label="Clarity Check", lines=6)
with gr.Row():
risk_check = gr.Textbox(label="Risk Check", lines=6)
improved_output = gr.Textbox(label="Improved Verified Output", lines=6)
decision = gr.Radio(
choices=["PASS", "HOLD", "REJECT"],
value="HOLD",
label="Decision",
)
button = gr.Button("Generate Review")
result = gr.Markdown()
button.click(
fn=generate_review,
inputs=[raw_input, clarity_check, risk_check, improved_output, decision],
outputs=result,
)
with gr.Tab("Resume Later"):
gr.Markdown(
"""
```
# Resume Point
Resume from:
**Sourceborn Sequence v0.1 β€” Review Status**
Current accepted status:
* Concepts = Keep
* Naming = Review
* Core = Not final
* Freeze = Not approved
* Next = Test with more examples later before freeze
Do not change core unless approved.
"""
)
if **name** == "**main**":
demo.launch()
```
```