betterwithage commited on
Commit
25b0b2d
·
verified ·
1 Parent(s): 956ac28

chore(sync): mirror backend .py + Dockerfile to Space (hf-sync-backend)

Browse files

Automated backend sync from szl-holdings/a11oy main via hf-sync-backend.
Updated (differed from the Space): Dockerfile, szl_nemo_verify.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.

Files changed (2) hide show
  1. Dockerfile +3 -37
  2. szl_nemo_verify.py +116 -0
Dockerfile CHANGED
@@ -284,7 +284,7 @@ EXPOSE 7860
284
  # these COPYs the imports fail and the pages/endpoints fall through to the SPA shell.
285
  # Doctrine v11 LOCKED 749/14/163. Lambda = Conjecture 1 (NOT a theorem). NO external CDN.
286
  COPY web/formulas.html ./web/formulas.html
287
- COPY static-vendor/three.min.js ./static-vendor/three.min.js
288
 
289
  # ADDITIVE (Graph/Viz lane + Perplexity Computer Agent, 2026-06-06): AIR-GAP
290
  # VENDORING. The operator console (pages/console.html) loads the 7 viz libs +
@@ -294,31 +294,11 @@ COPY static-vendor/three.min.js ./static-vendor/three.min.js
294
  # text under static-vendor/; the binary globe texture + KaTeX woff2 fonts ship
295
  # as base64 TEXT in _vendor_blobs.py (decoded by the /vendor/* routes in serve.py)
296
  # so NO LFS/Xet blob is committed. Doctrine v11 LOCKED. NO external CDN.
297
- COPY static-vendor/chart.umd.min.js ./static-vendor/chart.umd.min.js
298
- COPY static-vendor/3d-force-graph.min.js ./static-vendor/3d-force-graph.min.js
299
- COPY static-vendor/echarts.min.js ./static-vendor/echarts.min.js
300
- COPY static-vendor/echarts-gl.min.js ./static-vendor/echarts-gl.min.js
301
- COPY static-vendor/globe.gl.min.js ./static-vendor/globe.gl.min.js
302
- COPY static-vendor/cytoscape.min.js ./static-vendor/cytoscape.min.js
303
- COPY static-vendor/d3.min.js ./static-vendor/d3.min.js
304
- COPY static-vendor/katex.min.js ./static-vendor/katex.min.js
305
- COPY static-vendor/katex.min.css ./static-vendor/katex.min.css
306
  # Batch-1 uniqueness rebuild (2026-06-06): additional vendored graph-viz libs
307
  # (MIT/ISC/BSD; NOTICE updated). Per-file COPY (this Dockerfile uses no COPY . .).
308
- COPY static-vendor/dagre.min.js ./static-vendor/dagre.min.js
309
- COPY static-vendor/cytoscape-dagre.js ./static-vendor/cytoscape-dagre.js
310
- COPY static-vendor/d3-sankey.min.js ./static-vendor/d3-sankey.min.js
311
- COPY static-vendor/ngraph.graph.min.js ./static-vendor/ngraph.graph.min.js
312
- COPY static-vendor/ngraph.path.min.js ./static-vendor/ngraph.path.min.js
313
- COPY static-vendor/ngraph.forcelayout.min.js ./static-vendor/ngraph.forcelayout.min.js
314
- COPY static-vendor/panzoom.min.js ./static-vendor/panzoom.min.js
315
  # DEV-WIRE-A (2026-06-09): anvaka graph-stack completion (0-CDN, in-image). BSD-3, anvaka.
316
- COPY static-vendor/vivagraph.min.js ./static-vendor/vivagraph.min.js
317
- COPY static-vendor/ngraph.events.umd.js ./static-vendor/ngraph.events.umd.js
318
  # OPERATOR WIDGET (2026-06-10): a11oy floating governed-operator surface ("Chaski"),
319
  # self-hosted in-image (0 CDN), served at /vendor/a11oy-operator-widget.js by serve.py.
320
- COPY static-vendor/a11oy-operator-widget.js ./static-vendor/a11oy-operator-widget.js
321
- COPY static-vendor/a11oy-operator-widget.css ./static-vendor/a11oy-operator-widget.css
322
 
323
  # ADDITIVE (V4 Fleet Panel + /api/health fix, 2026-06-02, Dev2 Inti):
324
  # explicit per-file COPY (this Dockerfile does not use COPY . .).
@@ -428,16 +408,7 @@ COPY a11oy_react_core.py ./
428
  # Signed-off-by: Yachay <yachay@szlholdings.ai>
429
  # Co-Authored-By: Perplexity Computer Agent <agent@perplexity.ai>
430
  COPY src/a11oy/__init__.py ./src/a11oy/__init__.py
431
- COPY src/a11oy/formulas/__init__.py ./src/a11oy/formulas/__init__.py
432
- COPY src/a11oy/formulas/pac_bayes.py ./src/a11oy/formulas/pac_bayes.py
433
- COPY src/a11oy/formulas/bls_aggregate.py ./src/a11oy/formulas/bls_aggregate.py
434
- COPY src/a11oy/formulas/welford.py ./src/a11oy/formulas/welford.py
435
- COPY src/a11oy/formulas/byzantine_quorum.py ./src/a11oy/formulas/byzantine_quorum.py
436
- COPY src/a11oy/formulas/holevo_bound.py ./src/a11oy/formulas/holevo_bound.py
437
- COPY src/a11oy/formulas/bloom_filter.py ./src/a11oy/formulas/bloom_filter.py
438
- COPY src/a11oy/formulas/kalman.py ./src/a11oy/formulas/kalman.py
439
- COPY src/a11oy/formulas/hnsw_retrieval.py ./src/a11oy/formulas/hnsw_retrieval.py
440
- COPY src/a11oy/formulas/reidemeister.py ./src/a11oy/formulas/reidemeister.py
441
  # FIX (formula/* 404 repair): a11oy_formula_endpoints.py imports a11oy.formulas.{allodial,
442
  # allodial_gate, entanglement} alongside the formulas above, but these three were NEVER
443
  # COPY'd into the image. The package import therefore raised at boot, register() returned
@@ -445,12 +416,7 @@ COPY src/a11oy/formulas/reidemeister.py ./src/a11oy/formulas/reidemeister.py
445
  # bloom, kalman, formulas/index, …) 404'd through the Node proxy. Per-file COPY (this
446
  # Dockerfile never uses `COPY . .`). Mirrored byte-identical to the HF Space (hf-sync
447
  # APP_FILES lockstep). EXPERIMENTAL frontier gates — Λ = Conjecture 1 (never a theorem).
448
- COPY src/a11oy/formulas/allodial.py ./src/a11oy/formulas/allodial.py
449
- COPY src/a11oy/formulas/allodial_gate.py ./src/a11oy/formulas/allodial_gate.py
450
- COPY src/a11oy/formulas/entanglement.py ./src/a11oy/formulas/entanglement.py
451
- COPY src/a11oy/harvest/__init__.py ./src/a11oy/harvest/__init__.py
452
- COPY src/a11oy/harvest/wasted_energy_harvest.py ./src/a11oy/harvest/wasted_energy_harvest.py
453
- COPY src/a11oy/harvest/harvest_budget.py ./src/a11oy/harvest/harvest_budget.py
454
  # ADDITIVE (Formulas SECTION page — closeout): serve.py imports a11oy_formulas_page
455
  # and calls .register(app) BEFORE the SPA catch-all, mounting GET /formulas/wired
456
  # (premium Inca-palette list of every live formula + thesis citation + Lean permalink
 
284
  # these COPYs the imports fail and the pages/endpoints fall through to the SPA shell.
285
  # Doctrine v11 LOCKED 749/14/163. Lambda = Conjecture 1 (NOT a theorem). NO external CDN.
286
  COPY web/formulas.html ./web/formulas.html
287
+ COPY static-vendor/three.min.js static-vendor/chart.umd.min.js static-vendor/3d-force-graph.min.js static-vendor/echarts.min.js static-vendor/echarts-gl.min.js static-vendor/globe.gl.min.js static-vendor/cytoscape.min.js static-vendor/d3.min.js static-vendor/katex.min.js static-vendor/katex.min.css static-vendor/dagre.min.js static-vendor/cytoscape-dagre.js static-vendor/d3-sankey.min.js static-vendor/ngraph.graph.min.js static-vendor/ngraph.path.min.js static-vendor/ngraph.forcelayout.min.js static-vendor/panzoom.min.js static-vendor/vivagraph.min.js static-vendor/ngraph.events.umd.js static-vendor/a11oy-operator-widget.js static-vendor/a11oy-operator-widget.css ./static-vendor/
288
 
289
  # ADDITIVE (Graph/Viz lane + Perplexity Computer Agent, 2026-06-06): AIR-GAP
290
  # VENDORING. The operator console (pages/console.html) loads the 7 viz libs +
 
294
  # text under static-vendor/; the binary globe texture + KaTeX woff2 fonts ship
295
  # as base64 TEXT in _vendor_blobs.py (decoded by the /vendor/* routes in serve.py)
296
  # so NO LFS/Xet blob is committed. Doctrine v11 LOCKED. NO external CDN.
 
 
 
 
 
 
 
 
 
297
  # Batch-1 uniqueness rebuild (2026-06-06): additional vendored graph-viz libs
298
  # (MIT/ISC/BSD; NOTICE updated). Per-file COPY (this Dockerfile uses no COPY . .).
 
 
 
 
 
 
 
299
  # DEV-WIRE-A (2026-06-09): anvaka graph-stack completion (0-CDN, in-image). BSD-3, anvaka.
 
 
300
  # OPERATOR WIDGET (2026-06-10): a11oy floating governed-operator surface ("Chaski"),
301
  # self-hosted in-image (0 CDN), served at /vendor/a11oy-operator-widget.js by serve.py.
 
 
302
 
303
  # ADDITIVE (V4 Fleet Panel + /api/health fix, 2026-06-02, Dev2 Inti):
304
  # explicit per-file COPY (this Dockerfile does not use COPY . .).
 
408
  # Signed-off-by: Yachay <yachay@szlholdings.ai>
409
  # Co-Authored-By: Perplexity Computer Agent <agent@perplexity.ai>
410
  COPY src/a11oy/__init__.py ./src/a11oy/__init__.py
411
+ COPY src/a11oy/formulas/__init__.py src/a11oy/formulas/pac_bayes.py src/a11oy/formulas/bls_aggregate.py src/a11oy/formulas/welford.py src/a11oy/formulas/byzantine_quorum.py src/a11oy/formulas/holevo_bound.py src/a11oy/formulas/bloom_filter.py src/a11oy/formulas/kalman.py src/a11oy/formulas/hnsw_retrieval.py src/a11oy/formulas/reidemeister.py src/a11oy/formulas/allodial.py src/a11oy/formulas/allodial_gate.py src/a11oy/formulas/entanglement.py ./src/a11oy/formulas/
 
 
 
 
 
 
 
 
 
412
  # FIX (formula/* 404 repair): a11oy_formula_endpoints.py imports a11oy.formulas.{allodial,
413
  # allodial_gate, entanglement} alongside the formulas above, but these three were NEVER
414
  # COPY'd into the image. The package import therefore raised at boot, register() returned
 
416
  # bloom, kalman, formulas/index, …) 404'd through the Node proxy. Per-file COPY (this
417
  # Dockerfile never uses `COPY . .`). Mirrored byte-identical to the HF Space (hf-sync
418
  # APP_FILES lockstep). EXPERIMENTAL frontier gates — Λ = Conjecture 1 (never a theorem).
419
+ COPY src/a11oy/harvest/__init__.py src/a11oy/harvest/wasted_energy_harvest.py src/a11oy/harvest/harvest_budget.py ./src/a11oy/harvest/
 
 
 
 
 
420
  # ADDITIVE (Formulas SECTION page — closeout): serve.py imports a11oy_formulas_page
421
  # and calls .register(app) BEFORE the SPA catch-all, mounting GET /formulas/wired
422
  # (premium Inca-palette list of every live formula + thesis citation + Lean permalink
szl_nemo_verify.py ADDED
@@ -0,0 +1,116 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env python3
2
+ # SPDX-License-Identifier: Apache-2.0
3
+ # © 2026 Lutar, Stephen P. — SZL Holdings · ORCID 0009-0001-0110-4173 · Doctrine v11/v12
4
+ # Authored by the NEMOTRON SIGNED-TRAJECTORY build team. Co-Authored-By: Perplexity Computer Agent.
5
+ """
6
+ szl_nemo_verify — standalone verifier for the SZL-Nemo signed-trajectory corpus.
7
+
8
+ Anyone can run this against a downloaded corpus JSONL to independently check:
9
+ 1. CONTENT INTEGRITY — recompute each step's sha256 step_hash and compare.
10
+ 2. SIGNATURE — if a step carries a DSSE signature, verify it against the
11
+ published SZLHOLDINGS cosign public key (cosign.pub).
12
+
13
+ USAGE:
14
+ python szl_nemo_verify.py path/to/corpus.jsonl
15
+ cat corpus.jsonl | python szl_nemo_verify.py -
16
+
17
+ EXIT CODE: 0 if every present signature verifies AND every hash matches; else 1.
18
+
19
+ HONEST: when the corpus was emitted in an environment without the private signing
20
+ key, the receipts are UNSIGNED (signatures: []) — this verifier reports that
21
+ transparently and does NOT treat "unsigned" as a pass of the signature check. The
22
+ hash check still applies and proves content integrity / tamper-evidence.
23
+
24
+ Prefers the shipped szl_trajectory_sign + szl_dsse modules when importable (full
25
+ DSSE verification). Falls back to a self-contained hash-only check if they are not
26
+ on the path, so the script still runs standalone. NO network required.
27
+ """
28
+ from __future__ import annotations
29
+
30
+ import hashlib
31
+ import json
32
+ import sys
33
+
34
+
35
+ def _canon(obj) -> bytes:
36
+ return json.dumps(obj, sort_keys=True, separators=(",", ":"),
37
+ ensure_ascii=False).encode("utf-8")
38
+
39
+
40
+ def _step_hash(action, observation, restraint_verdict: str) -> str:
41
+ body = _canon({"action": action, "observation": observation,
42
+ "restraint_verdict": restraint_verdict})
43
+ return "sha256:" + hashlib.sha256(body).hexdigest()
44
+
45
+
46
+ def _verify_full(text: str):
47
+ """Full verification using the shipped modules (DSSE + hash)."""
48
+ import szl_trajectory_sign as sts # type: ignore
49
+ return sts.verify_jsonl(text)
50
+
51
+
52
+ def _verify_hash_only(text: str):
53
+ """Self-contained hash-only fallback (no DSSE module on path)."""
54
+ results = []
55
+ for ln in text.splitlines():
56
+ ln = ln.strip()
57
+ if not ln:
58
+ continue
59
+ try:
60
+ d = json.loads(ln)
61
+ except Exception as exc:
62
+ results.append({"parse_error": str(exc)})
63
+ continue
64
+ recomputed = _step_hash(d.get("action"), d.get("observation", ""),
65
+ d.get("restraint_verdict", "ALLOW"))
66
+ env = d.get("signature") or {}
67
+ sigs = env.get("signatures") or []
68
+ results.append({
69
+ "trajectory_id": d.get("trajectory_id"),
70
+ "step": d.get("step"),
71
+ "hash_ok": recomputed == d.get("step_hash"),
72
+ "signed": bool(sigs),
73
+ "sig_ok": False, # cannot DSSE-verify without the module
74
+ })
75
+ total = len(results)
76
+ hash_ok = sum(1 for r in results if r.get("hash_ok"))
77
+ signed = sum(1 for r in results if r.get("signed"))
78
+ return {
79
+ "total_steps": total, "hash_ok": hash_ok, "signed": signed, "sig_ok": 0,
80
+ "all_hash_ok": hash_ok == total and total > 0,
81
+ "all_sig_ok": False, "results": results,
82
+ "note": "hash-only fallback (szl_dsse not importable; signatures not checked)",
83
+ }
84
+
85
+
86
+ def main(argv) -> int:
87
+ if len(argv) < 2:
88
+ print(__doc__)
89
+ return 2
90
+ src = argv[1]
91
+ text = sys.stdin.read() if src == "-" else open(src, encoding="utf-8").read()
92
+ try:
93
+ res = _verify_full(text)
94
+ mode = "full (DSSE + hash)"
95
+ except Exception:
96
+ res = _verify_hash_only(text)
97
+ mode = "hash-only fallback"
98
+ summary = {k: res[k] for k in ("total_steps", "hash_ok", "signed", "sig_ok",
99
+ "all_hash_ok", "all_sig_ok") if k in res}
100
+ summary["verify_mode"] = mode
101
+ print(json.dumps(summary, indent=2))
102
+ # PASS iff every hash matches AND (no signatures present OR all verify).
103
+ hashes_ok = res.get("all_hash_ok", False)
104
+ sig_present = res.get("signed", 0) > 0
105
+ sigs_ok = res.get("sig_ok", 0) == res.get("signed", 0)
106
+ ok = hashes_ok and (not sig_present or sigs_ok)
107
+ print("RESULT:", "PASS" if ok else "FAIL")
108
+ if sig_present and not sigs_ok:
109
+ print(" (signatures present but not all verified)")
110
+ if not sig_present:
111
+ print(" (no signatures present — UNSIGNED corpus; hash integrity only)")
112
+ return 0 if ok else 1
113
+
114
+
115
+ if __name__ == "__main__":
116
+ sys.exit(main(sys.argv))