Spaces:
Sleeping

File size: 6,683 Bytes
510d6fb
 
de25031
 
 
c82d070
de25031
 
 
 
 
 
 
 
 
 
 
5d35e64
572e20a
5d35e64
510d6fb
de25031
 
 
 
 
 
510d6fb
 
 
de25031
 
 
 
 
 
 
 
 
 
 
 
510d6fb
 
 
de25031
 
 
 
 
 
 
 
 
 
 
510d6fb
 
c82d070
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
de25031
0e88d52
 
510d6fb
c82d070
 
 
 
 
de25031
510d6fb
af77a6a
de25031
 
 
 
2eee1a8
af77a6a
de25031
510d6fb
 
 
2eee1a8
 
510d6fb
 
572e20a
 
 
 
 
de25031
 
510d6fb
 
de25031
 
510d6fb
 
 
de25031
 
 
 
 
 
 
510d6fb
 
 
de25031
c82d070
de25031
 
510d6fb
 
 
de25031
 
 
510d6fb
 
 
de25031
 
 
 
 
 
 
 
c82d070
510d6fb
 
 
de25031
 
510d6fb
de25031
 
 
 
 
 
 
 
 
 
 
 
 
 
510d6fb
de25031
 
c82d070
510d6fb
5d35e64
c82d070
5d35e64
510d6fb
5d35e64
c82d070
de25031
 
510d6fb
de25031
 
 
510d6fb
 
de25031
510d6fb
de25031
510d6fb
de25031
 
 
572e20a
5d35e64
de25031
510d6fb
de25031
510d6fb
de25031
 
 
510d6fb
 
 
 
 
 
 
 
 
 
 
de25031
 
510d6fb
de25031
 
 
510d6fb
 
572e20a
510d6fb
572e20a
510d6fb
de25031
 
2eee1a8
 
 
 
 
de25031
 
 
 
 
 
 
 
 
 
 
 
2eee1a8
de25031
 
 
 
 
 
572e20a
 
 
 
 
 
 
 
 
 
de25031
 
572e20a
de25031
 
c82d070
510d6fb
 
 
 
572e20a
510d6fb
 
 
c82d070
de25031
 
510d6fb
de25031
2879d2c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
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
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
import gradio as gr
from datetime import datetime
import subprocess
import sys

# --- SELF-FIX HELPER (stdlib only) ---
def self_fix():
    """Attempt to auto-fix indentation using autopep8."""
    try:
        subprocess.run(
            [sys.executable, "-m", "autopep8", "-i", __file__, "--select=E101,E111,E121"],
            check=True,
        )
        print("βœ… Auto-fix applied. Factory-reboot the Space now.")
    except Exception as e:
        print(f"❌ Auto-fix failed: {e}")


APP_TITLE = "Sourceborn URR Control Shell"

ACCEPTED_CONCEPTS = [
    "Point Zero",
    "Source Point",
    "Halt Point",
    "Mystery",
    "Invention",
    "Point Zero with Product",
]

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",
]

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"),
]

LOCK_STATUS_LINES = [
    ("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 = [
    "Sourceborn/",
    "00_TALK_AND_CONTROL",
    "01_SOURCEBORN_ENGINE",
    "02_URR",
    "99_ARCHIVE",
]

def format_items(items):
    return "\n".join([f"- {item}" for item in items])

def make_lock_table():
    rows = "| Area | Status |\n|---|---|\n"
    for area, status in LOCK_STATUS_LINES:
        rows += f"| {area} | {status} |\n"
    return rows

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(review_input, decision):
    now = datetime.now().strftime("%Y-%m-%d %H:%M:%S")
    return f"""# {decision} Review

**Time:** {now}

## Review Input
{review_input or "No review input 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: 800;
    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: 600;
}
"""

with gr.Blocks(css=CSS, title=APP_TITLE) as demo:
    gr.HTML(
        """
<div class="sb-hero">
    <div class="sb-title">Sourceborn URR Control Shell</div>
    <div class="sb-subtitle">
        Public-safe dashboard for Sourceborn v0.1 Review Status.
        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>
"""
    )

    with gr.Tab("Lock Status"):
        gr.Markdown(
            f"""
# Current Lock

{make_lock_table()}

## Active Structure Only

{format_items(ACTIVE_STRUCTURE)}
"""
        )

    with gr.Tab("Accepted Concepts"):
        gr.Markdown(
            f"""
# Accepted Concepts Only

{format_items(ACCEPTED_CONCEPTS)}
"""
        )

    with gr.Tab("Backend Foundation"):
        gr.Markdown(
            f"""
# Backend Must Support

{format_items(BACKEND_SUPPORT)}
"""
        )

    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/external output, show only:

Raw Input β†’ Clarity Check β†’ Risk Check β†’ Improved Verified Output
"""
        )

        review_input = gr.Textbox(
            label="Review Input",
            placeholder="Paste your complete review, raw input, clarity checks, risk assessment, and verified output here...",
            lines=12,
        )

        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=[review_input, decision],
            outputs=result,
        )

    with gr.Tab("Do Not Change"):
        gr.Markdown(
            """
# What Codex Must 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.
"""
        )

    with gr.Tab("Resume Later"):
        gr.Markdown(
            f"""
# Resume Point

Resume from:

Sourceborn Sequence v0.1 β€” Review Status

Current accepted status:

{format_items([f"{area} = {status}" for area, status in LOCK_STATUS_LINES])}
"""
        )

if __name__ == "__main__":
    demo.launch()