betterwithage Claude Opus 4.7 commited on
Commit
fd294f1
·
verified ·
1 Parent(s): 1ad25b2

deploy(hf): sync szl-holdings/a11oy@18816dff4b5255e890a2a248a1128c2ff0daa428 derived COPY set

Browse files

Reusable Dockerfile-COPY-derived deploy from szl-holdings/a11oy 18816dff4b5255e890a2a248a1128c2ff0daa428.
Files: 1350 Pruned: 0
Derived from Dockerfile COPY sources (NO hand-maintained allowlist).

Signed-off-by: SZL Holdings <noreply@szlholdings.ai>
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>

Files changed (3) hide show
  1. pages/atelier.html +6 -6
  2. szl_immune.py +156 -1
  3. web/immune.html +32 -0
pages/atelier.html CHANGED
@@ -2251,13 +2251,13 @@ pre {
2251
  },
2252
  {
2253
  "slug": "nexus-space",
2254
- "name": "NEXUS Space",
2255
  "kind": "space",
2256
- "href": "https://huggingface.co/spaces/SZLHOLDINGS/nexus",
2257
- "oneLiner": "The analog desk, running. Not a chatbot.",
2258
- "cut": "A Space that is an instrument, not a demo of a 70B.",
2259
- "when": "live",
2260
- "evidence": "Hub Space"
2261
  },
2262
  {
2263
  "slug": "anatomy-space",
 
2251
  },
2252
  {
2253
  "slug": "nexus-space",
2254
+ "name": "NEXUS plane on IMMUNE",
2255
  "kind": "space",
2256
+ "href": "https://szlholdings-immune.hf.space/nexus.html",
2257
+ "oneLiner": "Lorenz OP is MEASURED software simulation inside IMMUNE. Not a second product Space.",
2258
+ "cut": "The analog desk is a kernel plane, not a chatbot and not SZLHOLDINGS/nexus.",
2259
+ "when": "measured",
2260
+ "evidence": "SZLHOLDINGS/immune /nexus.html · hashes c5fcc502 / 4071a2f2 · energy UNAVAILABLE"
2261
  },
2262
  {
2263
  "slug": "anatomy-space",
szl_immune.py CHANGED
@@ -44,6 +44,9 @@ ENDPOINTS (dual-registered under /api/a11oy/v1/immune/* AND /v1/immune/*):
44
  (SZLHOLDINGS/immune /api/immune/nexus/status).
45
  EXECUTABLE software simulation. Energy UNAVAILABLE.
46
  Lambda = Conjecture 1 OPEN. Never LIVE or PASS.
 
 
 
47
 
48
  INSPECTION LOGIC (byte-identical to serve.py's embedded immune block):
49
  _THREAT_SIGNATURES = ["DROP TABLE","rm -rf","<script","eval(","subprocess","../../etc"]
@@ -119,6 +122,30 @@ _KERNEL_UA = (
119
  _KERNEL_CACHE: dict[str, Any] = {"at": 0.0, "payload": None}
120
  _FIELD_CACHE: dict[str, Any] = {"at": 0.0, "payload": None}
121
  _NEXUS_CACHE: dict[str, Any] = {"at": 0.0, "payload": None}
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
122
 
123
  # ---------------------------------------------------------------------------
124
  # REAL inspection logic — byte-identical to serve.py's embedded immune block.
@@ -442,6 +469,41 @@ def _probe_json(url: str) -> tuple[Optional[int], Any, Optional[str]]:
442
  return None, None, type(exc).__name__
443
 
444
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
445
  def _kernel(now: Optional[float] = None, probe=_probe_json) -> dict:
446
  """Same-origin kernel probe. REACHABLE / UNAVAILABLE only — never LIVE or PASS."""
447
  ts = time.time() if now is None else float(now)
@@ -629,6 +691,94 @@ def _nexus(now: Optional[float] = None, probe=_probe_json) -> dict:
629
  return enveloped
630
 
631
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
632
  def register(app, ns: str = "a11oy") -> dict:
633
  async def _h_healthz(): # noqa: ANN202
634
  return JSONResponse(_healthz())
@@ -672,6 +822,9 @@ def register(app, ns: str = "a11oy") -> dict:
672
  async def _h_nexus(): # noqa: ANN202
673
  return JSONResponse(_nexus())
674
 
 
 
 
675
  prefixes = [f"/api/{ns}/v1/immune", "/v1/immune"]
676
  routes: list[str] = []
677
  for p in prefixes:
@@ -685,8 +838,10 @@ def register(app, ns: str = "a11oy") -> dict:
685
  app.add_api_route(f"{p}/kernel", _h_kernel, methods=["GET", "HEAD"], include_in_schema=True)
686
  app.add_api_route(f"{p}/field", _h_field, methods=["GET", "HEAD"], include_in_schema=True)
687
  app.add_api_route(f"{p}/nexus", _h_nexus, methods=["GET", "HEAD"], include_in_schema=True)
 
688
  routes.extend([f"{p}/healthz", f"{p}/status", f"{p}/gates", f"{p}/threats",
689
- f"{p}/feed", f"{p}/verdict", f"{p}/verify", f"{p}/kernel", f"{p}/field", f"{p}/nexus"])
 
690
 
691
  print(f"[{ns}] szl_immune routes registered "
692
  f"(Immune (Hukulla) fail-closed egress gate, {len(routes)} routes)", flush=True)
 
44
  (SZLHOLDINGS/immune /api/immune/nexus/status).
45
  EXECUTABLE software simulation. Energy UNAVAILABLE.
46
  Lambda = Conjecture 1 OPEN. Never LIVE or PASS.
47
+ GET/POST /nexus/lorenz -> operator-initiated Lorenz OP seal through
48
+ Channel A POST /api/immune/nexus/run. Returns MEASURED
49
+ hashes or UNAVAILABLE. Never LIVE or PASS.
50
 
51
  INSPECTION LOGIC (byte-identical to serve.py's embedded immune block):
52
  _THREAT_SIGNATURES = ["DROP TABLE","rm -rf","<script","eval(","subprocess","../../etc"]
 
122
  _KERNEL_CACHE: dict[str, Any] = {"at": 0.0, "payload": None}
123
  _FIELD_CACHE: dict[str, Any] = {"at": 0.0, "payload": None}
124
  _NEXUS_CACHE: dict[str, Any] = {"at": 0.0, "payload": None}
125
+ _LORENZ_CACHE: dict[str, Any] = {"at": 0.0, "payload": None}
126
+ _LORENZ_CACHE_TTL = float(os.environ.get("IMMUNE_LORENZ_CACHE_TTL", "45"))
127
+ _LORENZ_MEASURED = {
128
+ "program": "lorenz",
129
+ "mode": "OP",
130
+ "steps": 320,
131
+ "dt": 0.01,
132
+ "drive": 0.7,
133
+ "chaos": 0.45,
134
+ "seed": 0.2,
135
+ "coefficients": "σ 10 · ρ 27.9 · β 2.67",
136
+ "initial": {"x": 0.182, "y": -0.046, "z": 23.2, "t": 0},
137
+ "final": {
138
+ "x": -7.707920173353,
139
+ "y": -10.567955419679,
140
+ "z": 21.305498529338,
141
+ "t": 3.2,
142
+ },
143
+ "inputHash": "c5fcc5029392a5e4f7cd65a655d5379cd65d8f915b2ee96a1db5d44e35ea2358",
144
+ "outputHash": "4071a2f2faca744907747cb2cc82a9d841e125fa287240505f9f9a8454a399ac",
145
+ "energy": "UNAVAILABLE",
146
+ "uniqueness": "Conjecture 1 OPEN",
147
+ "truth": "MEASURED_SOFTWARE_SIMULATION",
148
+ }
149
 
150
  # ---------------------------------------------------------------------------
151
  # REAL inspection logic — byte-identical to serve.py's embedded immune block.
 
469
  return None, None, type(exc).__name__
470
 
471
 
472
+ def _post_json(url: str, body: dict) -> tuple[Optional[int], Any, Optional[str]]:
473
+ """Public POST. Fail closed: never invent a JSON body."""
474
+ raw_body = json.dumps(body, separators=(",", ":")).encode("utf-8")
475
+ req = urllib.request.Request(
476
+ url,
477
+ data=raw_body,
478
+ headers={
479
+ "Accept": "application/json",
480
+ "Content-Type": "application/json",
481
+ "User-Agent": _KERNEL_UA,
482
+ },
483
+ method="POST",
484
+ )
485
+ try:
486
+ with urllib.request.urlopen(req, timeout=_KERNEL_TIMEOUT) as resp: # nosec - public kernel
487
+ raw = resp.read(262144)
488
+ status = int(getattr(resp, "status", 200) or 200)
489
+ text = raw.decode("utf-8", "replace").strip()
490
+ if not text:
491
+ return status, None, "empty body"
492
+ try:
493
+ return status, json.loads(text), None
494
+ except json.JSONDecodeError:
495
+ return status, None, "upstream non-JSON"
496
+ except urllib.error.HTTPError as exc:
497
+ detail = None
498
+ try:
499
+ detail = json.loads(exc.read().decode("utf-8", "replace") or "")
500
+ except Exception: # noqa: BLE001
501
+ detail = None
502
+ return int(exc.code), detail, "HTTP " + str(exc.code)
503
+ except Exception as exc: # noqa: BLE001
504
+ return None, None, type(exc).__name__
505
+
506
+
507
  def _kernel(now: Optional[float] = None, probe=_probe_json) -> dict:
508
  """Same-origin kernel probe. REACHABLE / UNAVAILABLE only — never LIVE or PASS."""
509
  ts = time.time() if now is None else float(now)
 
691
  return enveloped
692
 
693
 
694
+ def _extract_nexus_receipt(body: dict) -> dict:
695
+ rec = ((body.get("governed") or {}) if isinstance(body.get("governed"), dict) else {}).get("receipt")
696
+ payload = rec.get("payload") if isinstance(rec, dict) else None
697
+ if not isinstance(payload, dict):
698
+ return {}
699
+ agent = payload.get("agent") if isinstance(payload.get("agent"), dict) else None
700
+ if isinstance(agent, dict) and isinstance(agent.get("nexus"), dict):
701
+ return agent["nexus"]
702
+ raw = payload.get("agentJson")
703
+ if isinstance(raw, str):
704
+ try:
705
+ parsed = json.loads(raw)
706
+ except json.JSONDecodeError:
707
+ return {}
708
+ if isinstance(parsed, dict) and isinstance(parsed.get("nexus"), dict):
709
+ return parsed["nexus"]
710
+ return {}
711
+
712
+
713
+ def _nexus_lorenz(now: Optional[float] = None, post=_post_json) -> dict:
714
+ """Operator-initiated Lorenz OP seal. REACHABLE / UNAVAILABLE only."""
715
+ ts = time.time() if now is None else float(now)
716
+ cached = _LORENZ_CACHE.get("payload")
717
+ cached_at = float(_LORENZ_CACHE.get("at") or 0)
718
+ if cached and (ts - cached_at) < _LORENZ_CACHE_TTL:
719
+ out = dict(cached)
720
+ out["cached"] = True
721
+ return out
722
+
723
+ request_id = "lorenz-op-" + secrets.token_hex(6)
724
+ status, data, err = post(
725
+ _KERNEL_SPACE_URL + "/api/immune/nexus/run",
726
+ {
727
+ "program": "lorenz",
728
+ "mode": "OP",
729
+ "steps": 320,
730
+ "actor": "a11oy-immune-tab",
731
+ "requestId": request_id,
732
+ },
733
+ )
734
+ body = data if isinstance(data, dict) else {}
735
+ governed = body.get("governed") if isinstance(body.get("governed"), dict) else {}
736
+ result = body.get("result") if isinstance(body.get("result"), dict) else {}
737
+ execution = result.get("execution") if isinstance(result.get("execution"), dict) else {}
738
+ nexus = _extract_nexus_receipt(body)
739
+ sealed = bool(status in (200, 201) and governed.get("pass") is True and nexus.get("outputHash"))
740
+ payload = {
741
+ "ok": sealed,
742
+ "reachability": "REACHABLE" if sealed else "UNAVAILABLE",
743
+ "sealed": sealed,
744
+ "requestId": body.get("requestId") or request_id,
745
+ "program": "lorenz",
746
+ "mode": "OP",
747
+ "steps": execution.get("stepsExecuted") if sealed else None,
748
+ "inputHash": nexus.get("inputHash") if sealed else None,
749
+ "outputHash": nexus.get("outputHash") if sealed else None,
750
+ "invariantsHold": nexus.get("invariantsHold") if sealed else None,
751
+ "final": result.get("finalState") if sealed else None,
752
+ "coefficients": (result.get("coefficients") or {}).get("label") if sealed else None,
753
+ "energy": (nexus.get("energy") or execution.get("energy") or "UNAVAILABLE") if sealed else None,
754
+ "uniqueness": (nexus.get("uniqueness") or execution.get("uniqueness")) if sealed else None,
755
+ "truth": execution.get("truth") if sealed else None,
756
+ "reference": _LORENZ_MEASURED,
757
+ "upstream_http": status,
758
+ "error": None if sealed else (err or body.get("error") or "lorenz unsealed"),
759
+ "channel": "A",
760
+ "space": "SZLHOLDINGS/immune",
761
+ "contract": "POST /api/immune/nexus/run",
762
+ "url": _KERNEL_SPACE_URL + "/api/immune/nexus/run",
763
+ "product_tab": "/immune",
764
+ "honesty": {
765
+ "lambda": "Conjecture 1 OPEN (NOT a theorem)",
766
+ "never_fabricate": ["LIVE", "PASS"],
767
+ "first_paint": "CONNECTING",
768
+ "failed_probe": "UNAVAILABLE",
769
+ "energy": "UNAVAILABLE",
770
+ "execution": "MEASURED_SOFTWARE_SIMULATION",
771
+ "reference_is_not_this_run": True,
772
+ },
773
+ "organ": _ORGAN_NAME,
774
+ "cached": False,
775
+ }
776
+ enveloped = _gov(payload, status="REAL" if sealed else "DEGRADED")
777
+ _LORENZ_CACHE["at"] = ts
778
+ _LORENZ_CACHE["payload"] = enveloped
779
+ return enveloped
780
+
781
+
782
  def register(app, ns: str = "a11oy") -> dict:
783
  async def _h_healthz(): # noqa: ANN202
784
  return JSONResponse(_healthz())
 
822
  async def _h_nexus(): # noqa: ANN202
823
  return JSONResponse(_nexus())
824
 
825
+ async def _h_nexus_lorenz(): # noqa: ANN202
826
+ return JSONResponse(_nexus_lorenz())
827
+
828
  prefixes = [f"/api/{ns}/v1/immune", "/v1/immune"]
829
  routes: list[str] = []
830
  for p in prefixes:
 
838
  app.add_api_route(f"{p}/kernel", _h_kernel, methods=["GET", "HEAD"], include_in_schema=True)
839
  app.add_api_route(f"{p}/field", _h_field, methods=["GET", "HEAD"], include_in_schema=True)
840
  app.add_api_route(f"{p}/nexus", _h_nexus, methods=["GET", "HEAD"], include_in_schema=True)
841
+ app.add_api_route(f"{p}/nexus/lorenz", _h_nexus_lorenz, methods=["GET", "POST", "HEAD"], include_in_schema=True)
842
  routes.extend([f"{p}/healthz", f"{p}/status", f"{p}/gates", f"{p}/threats",
843
+ f"{p}/feed", f"{p}/verdict", f"{p}/verify", f"{p}/kernel", f"{p}/field", f"{p}/nexus",
844
+ f"{p}/nexus/lorenz"])
845
 
846
  print(f"[{ns}] szl_immune routes registered "
847
  f"(Immune (Hukulla) fail-closed egress gate, {len(routes)} routes)", flush=True)
web/immune.html CHANGED
@@ -262,9 +262,11 @@ body{
262
  </div>
263
  <div class="kv" id="nexusKv" aria-live="polite"><span class="k">status</span><span class="v">CONNECTING</span></div>
264
  <div class="kernel-actions">
 
265
  <a class="flag" href="https://szlholdings-immune.hf.space/nexus.html" target="_blank" rel="noopener">Open NEXUS plane</a>
266
  <a class="flag" href="https://szlholdings-immune-lattice.hf.space/nexus.html" target="_blank" rel="noopener">Channel B NEXUS</a>
267
  </div>
 
268
  </div>
269
 
270
  <div class="panel" id="fieldPanel">
@@ -563,6 +565,36 @@ async function loadNexus(){
563
  '<div><span class="k">nexus</span><span class="pill '+(reach==="REACHABLE"?"green":"red")+'">'+esc(reach)+'</span></div>';
564
  }
565
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
566
  async function loadField(){
567
  const result = await requestJSON(BASE + "/field");
568
  const kv = document.getElementById("fieldKv");
 
262
  </div>
263
  <div class="kv" id="nexusKv" aria-live="polite"><span class="k">status</span><span class="v">CONNECTING</span></div>
264
  <div class="kernel-actions">
265
+ <button class="run" id="lorenzBtn" type="button">Seal Lorenz OP</button>
266
  <a class="flag" href="https://szlholdings-immune.hf.space/nexus.html" target="_blank" rel="noopener">Open NEXUS plane</a>
267
  <a class="flag" href="https://szlholdings-immune-lattice.hf.space/nexus.html" target="_blank" rel="noopener">Channel B NEXUS</a>
268
  </div>
269
+ <div class="kv" id="lorenzKv" aria-live="polite"><span class="k">lorenz</span><span class="v">CONNECTING</span></div>
270
  </div>
271
 
272
  <div class="panel" id="fieldPanel">
 
565
  '<div><span class="k">nexus</span><span class="pill '+(reach==="REACHABLE"?"green":"red")+'">'+esc(reach)+'</span></div>';
566
  }
567
 
568
+ function paintLorenz(result){
569
+ const kv = document.getElementById("lorenzKv");
570
+ const s = (result && result.data) || {};
571
+ const ref = s.reference || {};
572
+ const sealed = !!(result && result.ok && s.sealed);
573
+ const reach = sealed ? "REACHABLE" : (result && result.ok === false ? "UNAVAILABLE" : "CONNECTING");
574
+ kv.innerHTML =
575
+ row("lorenz", sealed ? "SEALED" : reach)+
576
+ row("mode","OP")+
577
+ row("steps", s.steps || ref.steps || 320)+
578
+ row("coefficients", s.coefficients || ref.coefficients)+
579
+ row("inputHash", s.inputHash || ref.inputHash, "digest")+
580
+ row("outputHash", s.outputHash || ref.outputHash, "digest")+
581
+ row("energy", s.energy || ref.energy || "UNAVAILABLE")+
582
+ row("uniqueness", s.uniqueness || ref.uniqueness || "Conjecture 1 OPEN")+
583
+ row("truth", s.truth || ref.truth || "MEASURED_SOFTWARE_SIMULATION")+
584
+ row("error", s.error || (!result || result.ok ? null : requestFailure(result)))+
585
+ '<div><span class="k">this run</span><span class="pill '+(sealed?"green":"red")+'">'+(sealed?"SEALED":esc(reach))+'</span></div>';
586
+ }
587
+
588
+ document.getElementById("lorenzBtn").addEventListener("click", async function(){
589
+ this.disabled = true;
590
+ const prior = this.textContent;
591
+ this.textContent = "Sealing…";
592
+ const result = await requestJSON(BASE + "/nexus/lorenz", {method:"POST"});
593
+ paintLorenz(result);
594
+ this.textContent = result.ok ? "Lorenz OP sealed" : "Seal Lorenz OP";
595
+ this.disabled = false;
596
+ });
597
+
598
  async function loadField(){
599
  const result = await requestJSON(BASE + "/field");
600
  const kv = document.getElementById("fieldKv");