Spaces:
Running
Running
chore(sync): mirror backend .py + Dockerfile to Space (hf-sync-backend)
Browse filesAutomated backend sync from szl-holdings/a11oy main via hf-sync-backend.
Updated (differed from the Space): Dockerfile, szl_quant_qbio_holo.py
Deleted (gone from the repo + Dockerfile COPY set): (none)
Keeps the Space-built backend (serve.py + the Dockerfile-COPY'd .py
modules) identical to GitHub main so the Space never rebuilds from a
stale backend, new endpoints don't 404 there, and orphaned modules
removed from the repo don't linger in the Space tree.
- Dockerfile +6 -0
- szl_quant_qbio_holo.py +429 -0
Dockerfile
CHANGED
|
@@ -174,6 +174,12 @@ COPY szl_kverify.py ./
|
|
| 174 |
# served page) is per-file COPY'd below and declared image_only in
|
| 175 |
# .github/copy-sync-lockstep.json (same baked-only pattern as web/energy.html).
|
| 176 |
COPY szl_immune.py ./
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 177 |
# Materials (Q'allariy) HONEST verifiable crystal-discovery surface — imported by
|
| 178 |
# serve.py (guarded). MUST be per-file COPY'd (no `COPY . .`) or the import falls
|
| 179 |
# back and /api/a11oy/v1/materials/* 404s AND hf-sync-backend.yml (it parses this
|
|
|
|
| 174 |
# served page) is per-file COPY'd below and declared image_only in
|
| 175 |
# .github/copy-sync-lockstep.json (same baked-only pattern as web/energy.html).
|
| 176 |
COPY szl_immune.py ./
|
| 177 |
+
# SWEEP DEV 3 status module — imported by serve.py (guarded). MUST be per-file
|
| 178 |
+
# COPY'd (this Dockerfile uses no `COPY . .`) or the import falls back to a STUB
|
| 179 |
+
# and /api/a11oy/v1/{quant,qbio,holographic}/status 404 live. Reuses szl_quantum_bio,
|
| 180 |
+
# szl_formulas, szl_pnt_mesh, szl_backend_hardening, szl3d_holographic + szl_khipu
|
| 181 |
+
# (all already COPY'd above). hf-sync-backend.yml parses this COPY set to mirror it.
|
| 182 |
+
COPY szl_quant_qbio_holo.py ./
|
| 183 |
# Materials (Q'allariy) HONEST verifiable crystal-discovery surface — imported by
|
| 184 |
# serve.py (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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# SPDX-License-Identifier: Apache-2.0
|
| 2 |
+
# © 2026 Lutar, Stephen P. — SZL Holdings · ORCID 0009-0001-0110-4173
|
| 3 |
+
# Doctrine v13 — SWEEP DEV 3: honest /status surfaces for quant, qbio, holographic.
|
| 4 |
+
"""
|
| 5 |
+
szl_quant_qbio_holo.py — SWEEP DEV 3 status-wiring module.
|
| 6 |
+
|
| 7 |
+
Three a11oy surfaces serve a 200 PAGE but had NO backing `/<surface>/status` API
|
| 8 |
+
(404). This module wires the missing HONEST `/status` endpoints, each summarizing
|
| 9 |
+
REAL substance that already exists in the estate — never fabricated data. Every
|
| 10 |
+
status signs a Khipu receipt into the SHARED szl_khipu hash chain.
|
| 11 |
+
|
| 12 |
+
GET /api/a11oy/v1/qbio/status — summary of the REAL Quantum-Bio Λ-v5 state
|
| 13 |
+
(szl_quantum_bio: Mitchell pmf, Lindblad
|
| 14 |
+
coherence, radical-pair compass, Λ-v5 gate).
|
| 15 |
+
WHY it 404'd: szl_quantum_bio.register mounts
|
| 16 |
+
/qbio/{pmf,coherence,compass,lambda,summary}
|
| 17 |
+
but NO /qbio/status. This adds the missing one.
|
| 18 |
+
GET /api/a11oy/v1/quant/status — honest summary of the quant substance: the
|
| 19 |
+
quantum-axis canonical formulas in szl_formulas
|
| 20 |
+
(PROVEN vs CONJECTURE/AXIOM/SORRY per the
|
| 21 |
+
PROOF_STATUS index) + a link to the LIVE PNT /
|
| 22 |
+
quantum-sensing mesh (/api/a11oy/v1/pnt/limits).
|
| 23 |
+
GET /api/a11oy/v1/holographic/status — honest summary of the 3D estate hologram: it
|
| 24 |
+
is a VISUALIZATION over real mesh state. Reports
|
| 25 |
+
the live compute-pool reachability (szl_backend_
|
| 26 |
+
hardening.probe_fabric_pool) + the szl3d toolkit
|
| 27 |
+
FOUNDATION info. Labeled MODELED/LIVE honestly.
|
| 28 |
+
|
| 29 |
+
DOCTRINE HARD GATES carried on every payload:
|
| 30 |
+
* Λ = Conjecture 1 (NOT a theorem). The Λ-v5 gate is a PROPOSED engineering
|
| 31 |
+
predicate, NOT the formal uniqueness Λ, and is NOT folded into the locked-8.
|
| 32 |
+
* Khipu = Conjecture 2 (the chain verifies INTEGRITY, signature is DSSE PLACEHOLDER).
|
| 33 |
+
* locked-8 proven set @ c7c0ba17 is UNCHANGED — this module adds NOTHING to it.
|
| 34 |
+
* trust never 100%.
|
| 35 |
+
* NO user-visible codenames.
|
| 36 |
+
* NEVER fabricate quantum/bio data — if a backing source is unreachable the status
|
| 37 |
+
says so honestly (degraded / source_unavailable), never a faked-LIVE number.
|
| 38 |
+
* Every datum labeled LIVE / MODELED / PROVEN / CONJECTURE / ROADMAP.
|
| 39 |
+
|
| 40 |
+
Additive · pure stdlib (+ reuses in-image szl_* modules) · try/except-guarded so it
|
| 41 |
+
can never take down the SPA. Registered BEFORE the SPA catch-all.
|
| 42 |
+
"""
|
| 43 |
+
from __future__ import annotations
|
| 44 |
+
|
| 45 |
+
import time
|
| 46 |
+
from typing import Any, Dict
|
| 47 |
+
|
| 48 |
+
from starlette.requests import Request
|
| 49 |
+
from starlette.responses import JSONResponse
|
| 50 |
+
|
| 51 |
+
LOCKED_8 = ["F1", "F4", "F7", "F11", "F12", "F18", "F19", "F22"]
|
| 52 |
+
LOCKED_COMMIT = "c7c0ba17"
|
| 53 |
+
|
| 54 |
+
|
| 55 |
+
def _now() -> str:
|
| 56 |
+
return time.strftime("%Y-%m-%dT%H:%M:%SZ", time.gmtime())
|
| 57 |
+
|
| 58 |
+
|
| 59 |
+
def _khipu_emit(organ: str, action: str, payload: Dict[str, Any]) -> Dict[str, Any]:
|
| 60 |
+
"""Sign a receipt into the SHARED szl_khipu chain; honest fallback if absent.
|
| 61 |
+
|
| 62 |
+
Khipu = Conjecture 2: this verifies the HASH CHAIN integrity only; the receipt
|
| 63 |
+
SIGNATURE is DSSE PLACEHOLDER (Sigstore not wired in CI). Never raises.
|
| 64 |
+
"""
|
| 65 |
+
try:
|
| 66 |
+
import szl_khipu
|
| 67 |
+
dag = szl_khipu.get_dag(organ, ns="a11oy")
|
| 68 |
+
receipt = dag.emit(action, payload)
|
| 69 |
+
chain = dag.verify_chain()
|
| 70 |
+
return {
|
| 71 |
+
"organ": organ,
|
| 72 |
+
"receipt_type": f"SZL.{organ.capitalize()}.Status.v1",
|
| 73 |
+
"seq": receipt.get("seq"),
|
| 74 |
+
"digest": receipt.get("digest"),
|
| 75 |
+
"prev": receipt.get("prev"),
|
| 76 |
+
"signature": receipt.get("signature"), # DSSE_PLACEHOLDER (honest)
|
| 77 |
+
"chain_verified": chain.get("ok"),
|
| 78 |
+
"chain_depth": dag.depth(),
|
| 79 |
+
"head_digest": dag.head(),
|
| 80 |
+
"khipu_kind": "Conjecture 2",
|
| 81 |
+
}
|
| 82 |
+
except Exception as exc: # noqa: BLE001
|
| 83 |
+
return {"organ": organ, "khipu_kind": "Conjecture 2",
|
| 84 |
+
"chain_verified": None, "note": f"khipu unavailable: {exc!r}"}
|
| 85 |
+
|
| 86 |
+
|
| 87 |
+
# ---------------------------------------------------------------------------
|
| 88 |
+
# qbio/status — summarize the REAL Quantum-Bio Λ-v5 state (szl_quantum_bio).
|
| 89 |
+
# ---------------------------------------------------------------------------
|
| 90 |
+
def _qbio_status() -> Dict[str, Any]:
|
| 91 |
+
base = "/api/a11oy/v1/qbio"
|
| 92 |
+
live_paths = [f"{base}/pmf", f"{base}/coherence", f"{base}/compass",
|
| 93 |
+
f"{base}/lambda", f"{base}/summary", f"{base}/status"]
|
| 94 |
+
models: list[Dict[str, Any]] = []
|
| 95 |
+
summary_src = None
|
| 96 |
+
sources: Dict[str, str] = {}
|
| 97 |
+
try:
|
| 98 |
+
import szl_quantum_bio as qb
|
| 99 |
+
# Recompute the REAL verified headline numbers on-call (reproduces every call).
|
| 100 |
+
pmf_single = round(qb.pmf(150.0, 0.5), 1)
|
| 101 |
+
pmf_two = round(qb.pmf_two_ion(150.0, 0.5, 0.30), 1)
|
| 102 |
+
coh = qb.lindblad_coherence_series()
|
| 103 |
+
comp = qb.compass(50.0)
|
| 104 |
+
lam = qb.lambda_v5(0.9, 121.5, 130.0)
|
| 105 |
+
sources = dict(getattr(qb, "SOURCES", {}))
|
| 106 |
+
models = [
|
| 107 |
+
{"model": "Mitchell proton-motive force",
|
| 108 |
+
"equation": "Δp = ΔΨ − (2.3 RT / F)·ΔpH (mV)",
|
| 109 |
+
"value_mV": pmf_single, "status": "VERIFIED",
|
| 110 |
+
"source": sources.get("Mitchell pmf (Nobel)"),
|
| 111 |
+
"endpoint": f"{base}/pmf"},
|
| 112 |
+
{"model": "Two-ion K+/H+ pmf correction",
|
| 113 |
+
"value_mV": pmf_two, "status": "PROPOSED",
|
| 114 |
+
"endpoint": f"{base}/pmf"},
|
| 115 |
+
{"model": "Lindblad / GKSL coherence decay",
|
| 116 |
+
"equation": "dρ/dt = −(i/ħ)[H,ρ] + Σ γ_k (L_k ρ L_k† − ½{L_k†L_k, ρ})",
|
| 117 |
+
"fitted_tau_c": coh.get("tau_c"), "status": "VERIFIED",
|
| 118 |
+
"endpoint": f"{base}/coherence"},
|
| 119 |
+
{"model": "Radical-pair magnetoreception (singlet yield)",
|
| 120 |
+
"angular_contrast": comp.get("angular_contrast"),
|
| 121 |
+
"compass_works": comp.get("works"), "status": "VERIFIED",
|
| 122 |
+
"fidelity": "reduced single-nucleus closed-form (full model contrast ~0.378)",
|
| 123 |
+
"endpoint": f"{base}/compass"},
|
| 124 |
+
{"model": "SZL Λ-v5 closure gate",
|
| 125 |
+
"lambda": lam.get("lambda"), "closure_ok": lam.get("closure_ok"),
|
| 126 |
+
"rule": lam.get("rule"), "status": "PROPOSED",
|
| 127 |
+
"doctrine": ("Engineering gate only. NOT the formal uniqueness Λ "
|
| 128 |
+
"(that is Conjecture 1, machine-checked FALSE). NOT in the locked-8."),
|
| 129 |
+
"endpoint": f"{base}/lambda"},
|
| 130 |
+
]
|
| 131 |
+
summary_src = f"{base}/summary"
|
| 132 |
+
backing = "LIVE"
|
| 133 |
+
note = ("szl_quantum_bio is imported in-process; the VERIFIED numbers above are "
|
| 134 |
+
"recomputed on this call (they reproduce every time). The /qbio/status "
|
| 135 |
+
"route was missing (the module registers /pmf,/coherence,/compass,/lambda,"
|
| 136 |
+
"/summary but no /status); this endpoint adds the honest summary.")
|
| 137 |
+
except Exception as exc: # noqa: BLE001
|
| 138 |
+
backing = "DEGRADED"
|
| 139 |
+
note = (f"szl_quantum_bio import failed: {exc!r}. No quantum/bio numbers are "
|
| 140 |
+
"fabricated — status reports the contract only.")
|
| 141 |
+
verified = sum(1 for m in models if m.get("status") == "VERIFIED")
|
| 142 |
+
proposed = sum(1 for m in models if m.get("status") == "PROPOSED")
|
| 143 |
+
payload = {
|
| 144 |
+
"surface": "qbio",
|
| 145 |
+
"title": "Quantum-Bio Λ-v5 — surface status",
|
| 146 |
+
"backing": backing,
|
| 147 |
+
"models_total": len(models),
|
| 148 |
+
"verified_models": verified,
|
| 149 |
+
"proposed_models": proposed,
|
| 150 |
+
"live_paths": live_paths,
|
| 151 |
+
"summary_endpoint": summary_src,
|
| 152 |
+
"models": models,
|
| 153 |
+
"status_legend": {
|
| 154 |
+
"VERIFIED": "executed model, reproduces on every call",
|
| 155 |
+
"PROPOSED": "SZL-proposed construct (two-ion pmf, Λ-v5 gate)",
|
| 156 |
+
"NARRATIVE": "Jack Kruse framing only — NOT load-bearing math",
|
| 157 |
+
},
|
| 158 |
+
"lean_closure_theorems": ["decohered_never_closes", "uncharged_never_closes",
|
| 159 |
+
"lambda_mono_in_coherence"],
|
| 160 |
+
"doctrine": {
|
| 161 |
+
"lambda": "Conjecture 1 (NOT a theorem); Λ-v5 gate is PROPOSED, not the formal Λ",
|
| 162 |
+
"khipu": "Conjecture 2 (chain integrity only; signature DSSE PLACEHOLDER)",
|
| 163 |
+
"locked_8": {"set": LOCKED_8, "commit": LOCKED_COMMIT, "qbio_in_locked_8": False},
|
| 164 |
+
"trust": "never 100%",
|
| 165 |
+
},
|
| 166 |
+
"sources": sources,
|
| 167 |
+
"note": note,
|
| 168 |
+
"ts": _now(),
|
| 169 |
+
}
|
| 170 |
+
payload["khipu_receipt"] = _khipu_emit(
|
| 171 |
+
"qbio", "qbio.status",
|
| 172 |
+
{"verified": verified, "proposed": proposed, "backing": backing})
|
| 173 |
+
return payload
|
| 174 |
+
|
| 175 |
+
|
| 176 |
+
# ---------------------------------------------------------------------------
|
| 177 |
+
# quant/status — honest summary of quant formulas + LIVE PNT/quantum-sensing mesh.
|
| 178 |
+
# ---------------------------------------------------------------------------
|
| 179 |
+
def _quant_status() -> Dict[str, Any]:
|
| 180 |
+
quant_formulas = [
|
| 181 |
+
"gleason_quantum_lambda", "bohr_complementarity_floor",
|
| 182 |
+
"kochen_specker_18vector_witness", "two_witness_ks18_soundness",
|
| 183 |
+
"shor_codeword_distance", "css_ingress_verify", "kitaev_surface_correct",
|
| 184 |
+
"reed_solomon_singleton", "fisher_rao_distance", "pinsker_kl_bound",
|
| 185 |
+
"hoeffding_tail", "madhava_series",
|
| 186 |
+
]
|
| 187 |
+
proven: list[Dict[str, str]] = []
|
| 188 |
+
conjecture: list[Dict[str, str]] = []
|
| 189 |
+
formulas_backing = "MODELED"
|
| 190 |
+
try:
|
| 191 |
+
import szl_formulas as sf
|
| 192 |
+
proof_index = dict(getattr(sf, "PROOF_STATUS", {}))
|
| 193 |
+
registry_count = sf.registry_count() if hasattr(sf, "registry_count") else None
|
| 194 |
+
for name in quant_formulas:
|
| 195 |
+
label = proof_index.get(name, "UNLISTED")
|
| 196 |
+
entry = {"formula": name, "proof_status": label}
|
| 197 |
+
up = label.upper()
|
| 198 |
+
# PROVEN only if the label begins with PROVEN and carries no open caveat.
|
| 199 |
+
if up.startswith("PROVEN"):
|
| 200 |
+
proven.append(entry)
|
| 201 |
+
else: # AXIOM / SORRY / CONJECTURE / UNLISTED -> NOT proven (honest)
|
| 202 |
+
conjecture.append(entry)
|
| 203 |
+
formulas_backing = "LIVE"
|
| 204 |
+
formulas_note = ("szl_formulas.PROOF_STATUS read in-process. PROVEN = discharged "
|
| 205 |
+
"sorry-free in Lean (or trivially exact); everything else "
|
| 206 |
+
"(AXIOM / SORRY / open) is NOT proven and is reported honestly.")
|
| 207 |
+
except Exception as exc: # noqa: BLE001
|
| 208 |
+
registry_count = None
|
| 209 |
+
formulas_note = (f"szl_formulas import failed: {exc!r}; no proof status fabricated.")
|
| 210 |
+
|
| 211 |
+
# LIVE PNT / quantum-sensing mesh — link, and probe its in-process backing.
|
| 212 |
+
pnt = {"endpoint": "/api/a11oy/v1/pnt/limits", "backing": "ROADMAP"}
|
| 213 |
+
try:
|
| 214 |
+
import szl_pnt_mesh as pm # noqa: F401
|
| 215 |
+
pnt["backing"] = "LIVE"
|
| 216 |
+
pnt["pillars"] = ["compute_bounds (szl_pinn_bounds)",
|
| 217 |
+
"quantum_sensor (quantum_sensing_limits)",
|
| 218 |
+
"pnt_resilience", "nav_coasting"]
|
| 219 |
+
pnt["note"] = ("PNT/quantum-sensing mesh module imports in-process; the live "
|
| 220 |
+
"index is served at /api/a11oy/v1/pnt/limits with MEASURED/"
|
| 221 |
+
"MODELED/SAMPLE labels. Pillar B = cold-atom interferometer SQL "
|
| 222 |
+
"+ fused spoof detector + GPS-denied coasting FoM.")
|
| 223 |
+
except Exception as exc: # noqa: BLE001
|
| 224 |
+
pnt["note"] = f"szl_pnt_mesh not importable here: {exc!r} (page still links the live route)."
|
| 225 |
+
|
| 226 |
+
payload = {
|
| 227 |
+
"surface": "quant",
|
| 228 |
+
"title": "Quant — surface status (quantum-axis formulas + PNT/quantum-sensing mesh)",
|
| 229 |
+
"substance": ("Real quant substance is two-fold: (1) the quantum-axis CANONICAL "
|
| 230 |
+
"formulas in szl_formulas with honest PROVEN/AXIOM/SORRY labels, and "
|
| 231 |
+
"(2) the LIVE PNT / quantum-sensing fundamental-limits mesh."),
|
| 232 |
+
"formulas_backing": formulas_backing,
|
| 233 |
+
"registry_count": registry_count,
|
| 234 |
+
"quant_formulas_examined": len(quant_formulas),
|
| 235 |
+
"proven": proven,
|
| 236 |
+
"proven_count": len(proven),
|
| 237 |
+
"conjecture_or_axiom": conjecture,
|
| 238 |
+
"conjecture_or_axiom_count": len(conjecture),
|
| 239 |
+
"formulas_note": formulas_note,
|
| 240 |
+
"pnt_mesh": pnt,
|
| 241 |
+
"doctrine": {
|
| 242 |
+
"lambda": "Conjecture 1 (NOT a theorem)",
|
| 243 |
+
"khipu": "Conjecture 2 (chain integrity only; signature DSSE PLACEHOLDER)",
|
| 244 |
+
"locked_8": {"set": LOCKED_8, "commit": LOCKED_COMMIT,
|
| 245 |
+
"note": "exactly 8 proven; quant-axis AXIOM/SORRY items are NOT in it"},
|
| 246 |
+
"trust": "never 100%",
|
| 247 |
+
"honest_label": ("PROVEN means sorry-free in Lean. AXIOM/SORRY/CONJECTURE are "
|
| 248 |
+
"NOT proven and are not folded into the locked-8."),
|
| 249 |
+
},
|
| 250 |
+
"ts": _now(),
|
| 251 |
+
}
|
| 252 |
+
payload["khipu_receipt"] = _khipu_emit(
|
| 253 |
+
"quant", "quant.status",
|
| 254 |
+
{"proven": len(proven), "conjecture_or_axiom": len(conjecture),
|
| 255 |
+
"pnt_backing": pnt["backing"]})
|
| 256 |
+
return payload
|
| 257 |
+
|
| 258 |
+
|
| 259 |
+
# ---------------------------------------------------------------------------
|
| 260 |
+
# holographic/status — honest summary of the 3D estate hologram (visualization
|
| 261 |
+
# over REAL mesh state). Reports live compute-pool reachability + szl3d toolkit.
|
| 262 |
+
# ---------------------------------------------------------------------------
|
| 263 |
+
def _holographic_status() -> Dict[str, Any]:
|
| 264 |
+
# Live compute-pool reachability (the hologram renders node health/quorum).
|
| 265 |
+
pool = {"backing": "ROADMAP"}
|
| 266 |
+
try:
|
| 267 |
+
import szl_backend_hardening as bh
|
| 268 |
+
probe = bh.probe_fabric_pool() # concurrent, cached, NEVER fabricates reachable
|
| 269 |
+
counts = probe.get("counts", {}) if isinstance(probe, dict) else {}
|
| 270 |
+
nodes = probe.get("nodes", []) if isinstance(probe, dict) else []
|
| 271 |
+
pool = {
|
| 272 |
+
"backing": "LIVE",
|
| 273 |
+
"source_endpoint": "/api/a11oy/v1/compute-pool-hardened",
|
| 274 |
+
"nodes_total": counts.get("nodes_total", len(nodes)),
|
| 275 |
+
"nodes_reachable": counts.get("nodes_reachable"),
|
| 276 |
+
"gpu_nodes_reachable": counts.get("gpu_nodes_reachable"),
|
| 277 |
+
"cached_at": probe.get("cached_at") if isinstance(probe, dict) else None,
|
| 278 |
+
"nodes": [
|
| 279 |
+
{"name": n.get("name"), "kind": n.get("kind"),
|
| 280 |
+
"reachable": n.get("reachable"), "sovereign": n.get("sovereign")}
|
| 281 |
+
for n in nodes if isinstance(n, dict)
|
| 282 |
+
],
|
| 283 |
+
"label": "MEASURED (real TCP probe; down nodes never faked reachable)",
|
| 284 |
+
}
|
| 285 |
+
except Exception as exc: # noqa: BLE001
|
| 286 |
+
pool["note"] = f"compute-pool probe unavailable: {exc!r} (no node fabricated up)."
|
| 287 |
+
|
| 288 |
+
# szl3d holographic toolkit / shell (the renderer + the BFT-quorum mesh graph).
|
| 289 |
+
toolkit = {"backing": "ROADMAP"}
|
| 290 |
+
try:
|
| 291 |
+
import szl3d_holographic as h3
|
| 292 |
+
info = h3.info(ns="a11oy") if hasattr(h3, "info") else {}
|
| 293 |
+
toolkit = {
|
| 294 |
+
"backing": "LIVE",
|
| 295 |
+
"capability": info.get("capability"),
|
| 296 |
+
"shell_page": (info.get("shell") or {}).get("page", "/holographic"),
|
| 297 |
+
"toolkit_status": info.get("status"),
|
| 298 |
+
"cdn": "0 runtime CDN (vendored three.js r170, on-disk static/3d tree)",
|
| 299 |
+
"surfaces": "9 surface modules (energy, fabric, pnt, counter-uas, governance, pinn, router, ...)",
|
| 300 |
+
"label": "MODELED (3D visualization layer over real mesh/compute state)",
|
| 301 |
+
}
|
| 302 |
+
except Exception as exc: # noqa: BLE001
|
| 303 |
+
toolkit["note"] = f"szl3d_holographic not importable here: {exc!r}"
|
| 304 |
+
|
| 305 |
+
payload = {
|
| 306 |
+
"surface": "holographic",
|
| 307 |
+
"title": "Holographic — surface status (3D estate hologram)",
|
| 308 |
+
"honest_framing": ("The /holographic page is a VISUALIZATION over REAL mesh state. "
|
| 309 |
+
"It is NOT a holographic-principle physics claim and NOT a "
|
| 310 |
+
"quantum device — it renders the live compute-pool reachability "
|
| 311 |
+
"and the BFT-quorum mesh graph in 3D. The geometry is MODELED; "
|
| 312 |
+
"the underlying node/quorum data is the LIVE mesh."),
|
| 313 |
+
"visualizes": [
|
| 314 |
+
{"layer": "compute-pool node health", "source": "/api/a11oy/v1/compute-pool-hardened",
|
| 315 |
+
"label": "LIVE"},
|
| 316 |
+
{"layer": "BFT-quorum mesh graph", "source": "/api/a11oy/v1/mesh/3d", "label": "LIVE"},
|
| 317 |
+
{"layer": "3D geometry / trust sphere", "renderer": "szl3d toolkit (three.js r170)",
|
| 318 |
+
"label": "MODELED"},
|
| 319 |
+
],
|
| 320 |
+
"compute_pool": pool,
|
| 321 |
+
"toolkit": toolkit,
|
| 322 |
+
"mesh_graph_endpoint": "/api/a11oy/v1/mesh/3d",
|
| 323 |
+
"doctrine": {
|
| 324 |
+
"lambda": "Conjecture 1 (NOT a theorem)",
|
| 325 |
+
"khipu": "Conjecture 2 (chain integrity only; signature DSSE PLACEHOLDER)",
|
| 326 |
+
"locked_8": {"set": LOCKED_8, "commit": LOCKED_COMMIT},
|
| 327 |
+
"trust": "never 100%",
|
| 328 |
+
"cdn": "0 runtime CDN",
|
| 329 |
+
"effectors": "SIMULATED",
|
| 330 |
+
},
|
| 331 |
+
"ts": _now(),
|
| 332 |
+
}
|
| 333 |
+
payload["khipu_receipt"] = _khipu_emit(
|
| 334 |
+
"holographic", "holographic.status",
|
| 335 |
+
{"pool_backing": pool.get("backing"),
|
| 336 |
+
"nodes_reachable": pool.get("nodes_reachable"),
|
| 337 |
+
"toolkit_backing": toolkit.get("backing")})
|
| 338 |
+
return payload
|
| 339 |
+
|
| 340 |
+
|
| 341 |
+
# ---------------------------------------------------------------------------
|
| 342 |
+
# Registration — dual-register under /api/{ns}/v1/<s>/status AND /v1/<s>/status.
|
| 343 |
+
# Mirrors szl_immune / szl_kverify add_api_route pattern. Registered BEFORE the
|
| 344 |
+
# SPA catch-all so these JSON routes resolve locally and win ordering. Each handler
|
| 345 |
+
# is fully try/except-guarded so it can never take down the SPA.
|
| 346 |
+
# ---------------------------------------------------------------------------
|
| 347 |
+
def register(app, ns: str = "a11oy") -> Dict[str, Any]:
|
| 348 |
+
async def _h_qbio_status(request: Request = None): # noqa: ANN001,ANN202,ARG001
|
| 349 |
+
try:
|
| 350 |
+
return JSONResponse(_qbio_status())
|
| 351 |
+
except Exception as exc: # noqa: BLE001
|
| 352 |
+
return JSONResponse({"surface": "qbio", "backing": "ERROR",
|
| 353 |
+
"error": repr(exc)[:200], "ts": _now()}, status_code=200)
|
| 354 |
+
|
| 355 |
+
async def _h_quant_status(request: Request = None): # noqa: ANN001,ANN202,ARG001
|
| 356 |
+
try:
|
| 357 |
+
return JSONResponse(_quant_status())
|
| 358 |
+
except Exception as exc: # noqa: BLE001
|
| 359 |
+
return JSONResponse({"surface": "quant", "backing": "ERROR",
|
| 360 |
+
"error": repr(exc)[:200], "ts": _now()}, status_code=200)
|
| 361 |
+
|
| 362 |
+
async def _h_holographic_status(request: Request = None): # noqa: ANN001,ANN202,ARG001
|
| 363 |
+
try:
|
| 364 |
+
return JSONResponse(_holographic_status())
|
| 365 |
+
except Exception as exc: # noqa: BLE001
|
| 366 |
+
return JSONResponse({"surface": "holographic", "backing": "ERROR",
|
| 367 |
+
"error": repr(exc)[:200], "ts": _now()}, status_code=200)
|
| 368 |
+
|
| 369 |
+
groups = [
|
| 370 |
+
("qbio", _h_qbio_status),
|
| 371 |
+
("quant", _h_quant_status),
|
| 372 |
+
("holographic", _h_holographic_status),
|
| 373 |
+
]
|
| 374 |
+
routes: list[str] = []
|
| 375 |
+
add_api_route = getattr(app, "add_api_route", None)
|
| 376 |
+
for surface, handler in groups:
|
| 377 |
+
for prefix in (f"/api/{ns}/v1/{surface}", f"/v1/{surface}"):
|
| 378 |
+
path = f"{prefix}/status"
|
| 379 |
+
if callable(add_api_route):
|
| 380 |
+
app.add_api_route(path, handler, methods=["GET"], include_in_schema=True)
|
| 381 |
+
else:
|
| 382 |
+
from starlette.routing import Route
|
| 383 |
+
app.router.routes.append(Route(path, handler))
|
| 384 |
+
routes.append(path)
|
| 385 |
+
print(f"[{ns}] szl_quant_qbio_holo registered {len(routes)} status routes "
|
| 386 |
+
f"(quant + qbio + holographic; honest LIVE/MODELED/PROVEN/CONJECTURE labels)",
|
| 387 |
+
flush=True)
|
| 388 |
+
return {"ok": True, "ns": ns, "routes": routes}
|
| 389 |
+
|
| 390 |
+
|
| 391 |
+
# ---------------------------------------------------------------------------
|
| 392 |
+
# No-server self-test — proves the REAL summaries + honesty without HTTP.
|
| 393 |
+
# ---------------------------------------------------------------------------
|
| 394 |
+
def _selftest() -> Dict[str, Any]:
|
| 395 |
+
import json
|
| 396 |
+
out: Dict[str, Any] = {}
|
| 397 |
+
q = _qbio_status()
|
| 398 |
+
assert q["surface"] == "qbio"
|
| 399 |
+
assert q["doctrine"]["lambda"].startswith("Conjecture 1")
|
| 400 |
+
out["qbio_models"] = q["models_total"]
|
| 401 |
+
out["qbio_backing"] = q["backing"]
|
| 402 |
+
|
| 403 |
+
qt = _quant_status()
|
| 404 |
+
assert qt["surface"] == "quant"
|
| 405 |
+
assert qt["proven_count"] + qt["conjecture_or_axiom_count"] == qt["quant_formulas_examined"]
|
| 406 |
+
out["quant_proven"] = qt["proven_count"]
|
| 407 |
+
out["quant_conjecture_or_axiom"] = qt["conjecture_or_axiom_count"]
|
| 408 |
+
out["pnt_backing"] = qt["pnt_mesh"]["backing"]
|
| 409 |
+
|
| 410 |
+
h = _holographic_status()
|
| 411 |
+
assert h["surface"] == "holographic"
|
| 412 |
+
out["holo_pool_backing"] = h["compute_pool"]["backing"]
|
| 413 |
+
out["holo_toolkit_backing"] = h["toolkit"]["backing"]
|
| 414 |
+
|
| 415 |
+
# No codename leaks in any served string.
|
| 416 |
+
served = json.dumps([q, qt, h]).lower()
|
| 417 |
+
for bad in ("sentra", "amaru", "rosie", "jarvis"):
|
| 418 |
+
assert bad not in served, f"codename leak: {bad}"
|
| 419 |
+
out["no_codename_leak"] = True
|
| 420 |
+
|
| 421 |
+
# Locked-8 unchanged, exactly 8.
|
| 422 |
+
assert q["doctrine"]["locked_8"]["set"] == LOCKED_8 and len(LOCKED_8) == 8
|
| 423 |
+
out["locked_8_intact"] = True
|
| 424 |
+
return out
|
| 425 |
+
|
| 426 |
+
|
| 427 |
+
if __name__ == "__main__":
|
| 428 |
+
import json
|
| 429 |
+
print(json.dumps(_selftest(), indent=2))
|