from urllib.parse import quote
import re
import gradio as gr
import requests
GITHUB_REPO = "wuzbak/Unitary-Manifold-"
custom_css = """
:root { --az-bg: #0B0F13; --az-panel: #111820; --az-amber: #FF9F00; --az-teal: #4DD0E1; --az-text: #E0E0E0; --az-muted: #8B949E; --az-border: #1F2933; }
.gradio-container { background: var(--az-bg) !important; color: var(--az-text) !important; font-family: 'Inter', system-ui, sans-serif !important; }
.gradio-container h1, .gradio-container h2 { font-family: 'JetBrains Mono', monospace !important; color: var(--az-amber) !important; }
.gradio-container .gr-block { background: var(--az-panel) !important; border: 1px solid var(--az-border) !important; border-radius: 0 !important; }
.gradio-container .gr-button-primary { background: var(--az-amber) !important; color: var(--az-bg) !important; border: none !important; border-radius: 0 !important; font-family: 'JetBrains Mono', monospace !important; text-transform: uppercase !important; }
"""
def get_repo_status():
try:
s = requests.get(f"https://raw.githubusercontent.com/{GITHUB_REPO}/main/9-INFRASTRUCTURE/um_live_status.json", headers={"User-Agent":"AZ"}, timeout=10).json()
v = s.get("meta",{}).get("version","?")
sp = s.get("meta",{}).get("sprint","?")
t = s.get("tests",{}).get("passed",0)
l = s.get("lean4",{}).get("theorem_count",0)
p = s.get("pillars",{}).get("total_slots",0)
hg = s.get("pillars",{}).get("hardgate_count",0)
return f'
{v} {sp} | TESTS: {t:,} | LEAN4: {l:,} | PILLARS: {p} | HARDGATES: {hg}
'
except: return 'Status unavailable
'
_SAFE_REPO_PATH = re.compile(r"[A-Za-z0-9_\-. /]{1,300}") # one character class: linear time
def fetch_file(path):
path = str(path or "").strip()
# Repository-relative file paths only: no scheme, query, fragment, absolute path or '..'.
parts = path.split("/")
if not _SAFE_REPO_PATH.fullmatch(path) or any(p in ("", ".", "..") for p in parts):
return f"Not a repository file path: {path!r}"
try:
r = requests.get(f"https://raw.githubusercontent.com/{GITHUB_REPO}/main/{quote(path)}", headers={"User-Agent":"AZ"}, timeout=10)
if not r.ok: return f"File not found: {path}"
text = r.text[:10000]
if len(r.text) > 10000: text += "\n\n[... truncated ...]"
return text
except Exception as e: return f"Error: {e}"
with gr.Blocks(css=custom_css, title="Knowledge Hub — AxiomZero") as app:
gr.HTML('KNOWLEDGE HUB
FRAMEWORK DOCUMENTATION · AXIOMZERO
')
status = gr.HTML()
app.load(get_repo_status, [], [status])
with gr.Tabs():
with gr.Tab("OVERVIEW"):
gr.HTML('Unitary Manifold Framework
5D Kaluza-Klein metric. (5,7) sector: k_CS = 5\u00b2 + 7\u00b2 = 74.
Key Invariants
- k_CS = 74 \u2014 Chern-Simons level
- n_w = 5 \u2014 Winding resonance (Pillar 789)
- w_a = 0 \u2014 Cosmological constant (Pillar 301)
- r = 0.0315 \u2014 Tensor-to-scalar ratio (Pillar 396)
- n_s = 0.9635 \u2014 Scalar spectral index
Epistemic Status
Repository-level internal mathematical self-consistency established. External empirical confirmation pending.
')
with gr.Tab("REPO BROWSER"):
path_input = gr.Textbox(label="File Path", value="README.md", placeholder="e.g. STATUS.md, FALLIBILITY.md")
btn = gr.Button("FETCH FILE", variant="primary")
file_out = gr.Textbox(label="Content", lines=20, interactive=False)
btn.click(fetch_file, [path_input], [file_out])
with gr.Tab("PILLARS"):
gr.HTML('Hardgate Pillars
| Pillar | Claim | Gate |
|---|
| 301 | w_a = 0 | HARDGATE |
| 396 | r = 0.0315 | HARDGATE |
| 789 | n_w = 5 | HARDGATE |
| 787 | Falsification oracle | HARDGATE |
| 793 | KK graviton mass | HARDGATE |
')
with gr.Tab("LITERATURE"):
gr.HTML('PsiCat Literature
49 books and 352 articles.
- Book 25 \u2014 Honest Machine
- Book 29 \u2014 First Address
- Book 38 \u2014 Theory of Everything and Everyone
- Book 46 \u2014 Moral Injury
- Book 48 \u2014 Corporations Rule the World
Full library: github.com/wuzbak/Unitary-Manifold-/7-OUTREACH
')
if __name__ == "__main__":
app.launch(server_name="0.0.0.0", server_port=7860, share=False, show_error=True)