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, serve.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 +4 -0
- serve.py +43 -0
Dockerfile
CHANGED
|
@@ -156,6 +156,10 @@ COPY console/ ./static/
|
|
| 156 |
# (research-corpus endpoint reads /app/knowledge.json). Wave23 = conditional Khipu
|
| 157 |
# BFT safety (Conjecture 2 conditional); locked-8 + Lambda Conjecture 1 UNCHANGED.
|
| 158 |
COPY knowledge.json ./static/knowledge.json
|
|
|
|
|
|
|
|
|
|
|
|
|
| 159 |
# ---------------------------------------------------------------------------
|
| 160 |
# CONSOLIDATED ROOT-FILE COPY LAYERS (segment A: pre-LLM-gate) — Docker max-depth fix, Opus 4.8.
|
| 161 |
# One image layer per COPY; collapsed root-file->same-name COPYs into grouped
|
|
|
|
| 156 |
# (research-corpus endpoint reads /app/knowledge.json). Wave23 = conditional Khipu
|
| 157 |
# BFT safety (Conjecture 2 conditional); locked-8 + Lambda Conjecture 1 UNCHANGED.
|
| 158 |
COPY knowledge.json ./static/knowledge.json
|
| 159 |
+
# Genome registry served to the console Genome panel + /api/a11oy/v1/genome.
|
| 160 |
+
# Per-file COPY (this Dockerfile uses no `COPY . .`); a missing line -> the endpoint
|
| 161 |
+
# degrades to an honest labeled 503 (never a faked payload), the panel shows it.
|
| 162 |
+
COPY data/genome.json ./data/genome.json
|
| 163 |
# ---------------------------------------------------------------------------
|
| 164 |
# CONSOLIDATED ROOT-FILE COPY LAYERS (segment A: pre-LLM-gate) — Docker max-depth fix, Opus 4.8.
|
| 165 |
# One image layer per COPY; collapsed root-file->same-name COPYs into grouped
|
serve.py
CHANGED
|
@@ -8407,6 +8407,49 @@ async def _intoto_verify_guide(request: Request) -> Response:
|
|
| 8407 |
print("[a11oy] in-toto verify guide registered: /api/a11oy/v1/verify/intoto (DEV2)", file=__import__("sys").stderr)
|
| 8408 |
|
| 8409 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 8410 |
@app.api_route("/api/a11oy/{path:path}", methods=["GET", "POST", "PUT", "DELETE", "PATCH", "HEAD", "OPTIONS"])
|
| 8411 |
async def api_proxy(request: Request, path: str) -> Response:
|
| 8412 |
# DEV2: in-toto verify guide + inclusion proof — served in-process, NOT proxied
|
|
|
|
| 8407 |
print("[a11oy] in-toto verify guide registered: /api/a11oy/v1/verify/intoto (DEV2)", file=__import__("sys").stderr)
|
| 8408 |
|
| 8409 |
|
| 8410 |
+
# /api/a11oy/v1/genome — the formula-registry genome served to the console Genome
|
| 8411 |
+
# panel (the Palantir-ontology / Backstage-catalog single-pane pattern, beaten by
|
| 8412 |
+
# carrying a real machine-checkable Lean ref OR an explicit honest tier on every
|
| 8413 |
+
# row). Reads the static genome.json (per-file COPY'd to /app/data/genome.json by
|
| 8414 |
+
# the Dockerfile). READ path only — NO signing side effect (provenance rule: never
|
| 8415 |
+
# sign on a GET). Honest by design: a missing/unparseable file degrades to an
|
| 8416 |
+
# explicit labeled 503, never a faked payload. Defined BEFORE the generic
|
| 8417 |
+
# /api/a11oy/{path:path} Node proxy below so it resolves IN-PROCESS (not proxied).
|
| 8418 |
+
_GENOME_PATH = Path("/app/data/genome.json")
|
| 8419 |
+
|
| 8420 |
+
|
| 8421 |
+
@app.get("/api/a11oy/v1/genome")
|
| 8422 |
+
async def a11oy_genome() -> JSONResponse:
|
| 8423 |
+
if not _GENOME_PATH.is_file():
|
| 8424 |
+
return JSONResponse(
|
| 8425 |
+
{"status": "UNAVAILABLE", "error": "genome.json not present in image",
|
| 8426 |
+
"entries": [], "tier_counts": {}},
|
| 8427 |
+
status_code=503,
|
| 8428 |
+
)
|
| 8429 |
+
try:
|
| 8430 |
+
entries = json.loads(_GENOME_PATH.read_text(encoding="utf-8"))
|
| 8431 |
+
except Exception as exc: # noqa: BLE001
|
| 8432 |
+
return JSONResponse(
|
| 8433 |
+
{"status": "UNAVAILABLE", "error": f"genome.json unparseable: {exc!s}",
|
| 8434 |
+
"entries": [], "tier_counts": {}},
|
| 8435 |
+
status_code=503,
|
| 8436 |
+
)
|
| 8437 |
+
tier_counts: dict[str, int] = {}
|
| 8438 |
+
for e in entries:
|
| 8439 |
+
t = (e or {}).get("tag", "untagged")
|
| 8440 |
+
tier_counts[t] = tier_counts.get(t, 0) + 1
|
| 8441 |
+
return JSONResponse({
|
| 8442 |
+
"status": "OK",
|
| 8443 |
+
"count": len(entries),
|
| 8444 |
+
# Honest tier model — CONJECTURE is NEVER green; SEMANTIC-VERIFIED is the real
|
| 8445 |
+
# trust math (Λ bounds, Theorem U, DSSE verifiability). Order = render order.
|
| 8446 |
+
"tier_order": ["LOCKED-PROVEN", "SEMANTIC-VERIFIED", "evidence-backed",
|
| 8447 |
+
"honest-N/A", "CONJECTURE"],
|
| 8448 |
+
"tier_counts": tier_counts,
|
| 8449 |
+
"entries": entries,
|
| 8450 |
+
})
|
| 8451 |
+
|
| 8452 |
+
|
| 8453 |
@app.api_route("/api/a11oy/{path:path}", methods=["GET", "POST", "PUT", "DELETE", "PATCH", "HEAD", "OPTIONS"])
|
| 8454 |
async def api_proxy(request: Request, path: str) -> Response:
|
| 8455 |
# DEV2: in-toto verify guide + inclusion proof — served in-process, NOT proxied
|