betterwithage commited on
Commit
8c7e670
·
verified ·
1 Parent(s): 16cb5e0

release: ecosystem atlas, Anatomy v5, and canonical Spaces

Browse files

Audited runtime-only CAS release from https://github.com/szl-holdings/a11oy/pull/950 at e0a398595f507c9a161736b361bd182e34ccdd1c. Preserves the newer HF README card; no delete operations.

.gitattributes CHANGED
@@ -35,3 +35,4 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
35
  *tfevents* filter=lfs diff=lfs merge=lfs -text
36
  console/og-card.png filter=lfs diff=lfs merge=lfs -text
37
  model_release/m1/brain-ingest-ledger.jsonl filter=lfs diff=lfs merge=lfs -text
 
 
35
  *tfevents* filter=lfs diff=lfs merge=lfs -text
36
  console/og-card.png filter=lfs diff=lfs merge=lfs -text
37
  model_release/m1/brain-ingest-ledger.jsonl filter=lfs diff=lfs merge=lfs -text
38
+ console/social-preview-v5.png filter=lfs diff=lfs merge=lfs -text
.well-known/security.txt CHANGED
@@ -1,8 +1,7 @@
1
  Contact: mailto:security@szlholdings.ai
2
  Expires: 2027-06-01T00:00:00.000Z
3
- Encryption: https://github.com/szl-holdings/a11oy/blob/main/docs/pgp-key.asc
4
  Preferred-Languages: en
5
- Canonical: https://szlholdings-a11oy.hf.space/.well-known/security.txt
6
  Policy: https://github.com/szl-holdings/a11oy/blob/main/SECURITY.md
7
  Acknowledgments: https://github.com/szl-holdings/a11oy/blob/main/SECURITY.md#acknowledgments
8
  Hiring: https://szlholdings.ai/careers
 
1
  Contact: mailto:security@szlholdings.ai
2
  Expires: 2027-06-01T00:00:00.000Z
 
3
  Preferred-Languages: en
4
+ Canonical: https://a-11-oy.com/.well-known/security.txt
5
  Policy: https://github.com/szl-holdings/a11oy/blob/main/SECURITY.md
6
  Acknowledgments: https://github.com/szl-holdings/a11oy/blob/main/SECURITY.md#acknowledgments
7
  Hiring: https://szlholdings.ai/careers
Dockerfile CHANGED
@@ -115,6 +115,9 @@ COPY packages/policy/src/gates /app/a11oy-src/packages/policy/src/gates
115
  # Copy the pre-built SPA (Brand Orchestration Layer) to the static root.
116
  # index.html + assets/* are served directly at / and /assets/*; unknown GET -> index.html.
117
  COPY console/ ./static/
 
 
 
118
 
119
  # Build cache-bust 2026-06-08T23:30Z (Wave23 instillation): knowledge.json was
120
  # … (full rationale: docs/DOCKERFILE_NOTES.md §4)
@@ -599,6 +602,11 @@ COPY a11oy_khipu_demo_nav.py ./a11oy_khipu_demo_nav.py
599
  COPY a11oy_quant_signals.py ./a11oy_quant_signals.py
600
  COPY a11oy_quant_signals_nav.py ./a11oy_quant_signals_nav.py
601
 
 
 
 
 
 
602
  # git_sha wireup (FORGE-INSTRUCTION-gitsha-quiet-window): surface the deployed commit
603
  # … (full rationale: docs/DOCKERFILE_NOTES.md §96)
604
  ARG SZL_GIT_SHA=unknown
 
115
  # Copy the pre-built SPA (Brand Orchestration Layer) to the static root.
116
  # index.html + assets/* are served directly at / and /assets/*; unknown GET -> index.html.
117
  COPY console/ ./static/
118
+ # Security discovery is maintained at repository root; copy it into the static
119
+ # tree so /.well-known/security.txt resolves before the SPA fallback.
120
+ COPY .well-known/security.txt ./static/.well-known/security.txt
121
 
122
  # Build cache-bust 2026-06-08T23:30Z (Wave23 instillation): knowledge.json was
123
  # … (full rationale: docs/DOCKERFILE_NOTES.md §4)
 
602
  COPY a11oy_quant_signals.py ./a11oy_quant_signals.py
603
  COPY a11oy_quant_signals_nav.py ./a11oy_quant_signals_nav.py
604
 
605
+ # ECOSYSTEM ATLAS + ANATOMY V5 (2026-07-16): versioned public inventory API,
606
+ # real deep-link pages, and the read-only live digital twin. pages/ is copied
607
+ # wholesale above; this per-file image copies only the new Python registrar.
608
+ COPY a11oy_ecosystem_atlas.py ./a11oy_ecosystem_atlas.py
609
+
610
  # git_sha wireup (FORGE-INSTRUCTION-gitsha-quiet-window): surface the deployed commit
611
  # … (full rationale: docs/DOCKERFILE_NOTES.md §96)
612
  ARG SZL_GIT_SHA=unknown
a11oy_ecosystem_atlas.py ADDED
@@ -0,0 +1,320 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env python3
2
+ # SPDX-License-Identifier: Apache-2.0
3
+ """Public SZL ecosystem atlas for a-11-oy.com.
4
+
5
+ The atlas reads the versioned public inventory published by
6
+ ``SZLHOLDINGS/szl-estate-live`` instead of repeatedly walking the Hugging Face
7
+ listing APIs. That keeps the browser same-origin, removes the live 429 failure
8
+ mode, and makes every count explicitly LIVE, CACHED, SNAPSHOT, or UNAVAILABLE.
9
+
10
+ This module never copies model weights or datasets into the application. It
11
+ publishes immutable Hub links, repository revisions, and bounded producer
12
+ metadata so the web surface remains a control plane rather than an artifact
13
+ store.
14
+ """
15
+ from __future__ import annotations
16
+
17
+ import asyncio
18
+ import json
19
+ import threading
20
+ import time
21
+ import urllib.request
22
+ from pathlib import Path
23
+ from typing import Any
24
+
25
+ INVENTORY_URL = (
26
+ "https://huggingface.co/spaces/SZLHOLDINGS/szl-estate-live/"
27
+ "resolve/main/public-inventory.json"
28
+ )
29
+ SNAPSHOT_OBSERVED_AT = "2026-07-16T15:27:32Z"
30
+ SNAPSHOT_COUNTS = {
31
+ "models": 15,
32
+ "datasets": 24,
33
+ "spaces": 26,
34
+ "collections": 22,
35
+ "buckets": 1,
36
+ "public_resources_total": 88,
37
+ }
38
+
39
+ # Kernels are Hub model repositories with a governed-kernel contract, not
40
+ # runnable foundation models. Owners were validated in the 2026-07-16 source
41
+ # alignment audit; archived owners remain labelled instead of being hidden.
42
+ KERNEL_OWNERS: dict[str, dict[str, Any]] = {
43
+ "SZLHOLDINGS/governed-inference-meter": {"owner": "szl-holdings/szl-energy-attest"},
44
+ "SZLHOLDINGS/szl-blocked": {"owner": "szl-holdings/szl-formula-ledger"},
45
+ "SZLHOLDINGS/szl-formulas": {"owner": "szl-holdings/szl-formula-ledger"},
46
+ "SZLHOLDINGS/szl-governed-norm": {
47
+ "owner": "szl-holdings/szl-governed-norm",
48
+ "owner_state": "ARCHIVED_PRODUCER_NEEDS_ADOPTION",
49
+ },
50
+ "SZLHOLDINGS/szl-govsign": {"owner": "szl-holdings/szl-receipt"},
51
+ "SZLHOLDINGS/szl-invariants": {"owner": "szl-holdings/lutar-lean"},
52
+ "SZLHOLDINGS/szl-kernels": {"owner": "szl-holdings/szl-kernels-live"},
53
+ "SZLHOLDINGS/szl-lambda-gate": {"owner": "szl-holdings/szl-lambda-gate"},
54
+ "SZLHOLDINGS/szl-ouroboros": {"owner": "szl-holdings/ouroboros"},
55
+ "SZLHOLDINGS/szl-provctl": {"owner": "szl-holdings/governed-receipt-spec"},
56
+ }
57
+
58
+ CURATED_SURFACES: dict[str, list[dict[str, str]]] = {
59
+ "brain": [
60
+ {
61
+ "id": "SZLHOLDINGS/SZL-Khipu-1.5B-BrainNavigator",
62
+ "kind": "model",
63
+ "href": "https://huggingface.co/SZLHOLDINGS/SZL-Khipu-1.5B-BrainNavigator",
64
+ "owner": "szl-holdings/szl-forge",
65
+ },
66
+ {
67
+ "id": "SZLHOLDINGS/szl-second-brain-inrepo",
68
+ "kind": "dataset",
69
+ "href": "https://huggingface.co/datasets/SZLHOLDINGS/szl-second-brain-inrepo",
70
+ "owner": "szl-holdings/a11oy",
71
+ },
72
+ {
73
+ "id": "A11oy Brain pulse",
74
+ "kind": "runtime",
75
+ "href": "/api/a11oy/v1/brain/pulse",
76
+ "owner": "szl-holdings/a11oy",
77
+ },
78
+ ],
79
+ "anatomy": [
80
+ {
81
+ "id": "SZLHOLDINGS/anatomy",
82
+ "kind": "space",
83
+ "href": "https://huggingface.co/spaces/SZLHOLDINGS/anatomy",
84
+ "owner": "szl-holdings/anatomy",
85
+ },
86
+ {
87
+ "id": "Living anatomy",
88
+ "kind": "runtime",
89
+ "href": "/living-anatomy",
90
+ "owner": "szl-holdings/a11oy",
91
+ },
92
+ ],
93
+ "holographic": [
94
+ {
95
+ "id": f"SZLHOLDINGS/{name}",
96
+ "kind": "space",
97
+ "href": f"https://huggingface.co/spaces/SZLHOLDINGS/{name}",
98
+ "owner": "HF_NATIVE_ADOPTION_PENDING",
99
+ }
100
+ for name in (
101
+ "holographic",
102
+ "cosmos",
103
+ "cathedral",
104
+ "governed-norm-holo",
105
+ "lambda-gate-holo",
106
+ "energy-attest-holo",
107
+ "receipt-chain-live",
108
+ "szl-kernels-live",
109
+ )
110
+ ],
111
+ "killinchu": [
112
+ {
113
+ "id": "SZLHOLDINGS/killinchu",
114
+ "kind": "space",
115
+ "href": "https://huggingface.co/spaces/SZLHOLDINGS/killinchu",
116
+ "owner": "szl-holdings/killinchu",
117
+ },
118
+ {
119
+ "id": "SZLHOLDINGS/killinchu-osint-corpus",
120
+ "kind": "dataset",
121
+ "href": "https://huggingface.co/datasets/SZLHOLDINGS/killinchu-osint-corpus",
122
+ "owner": "szl-holdings/killinchu",
123
+ },
124
+ {
125
+ "id": "Killinchu command surface",
126
+ "kind": "runtime",
127
+ "href": "/elite",
128
+ "owner": "szl-holdings/killinchu",
129
+ },
130
+ ],
131
+ }
132
+
133
+ _CACHE_TTL_SECONDS = 300.0
134
+ _CACHE: dict[str, Any] = {"at": 0.0, "payload": None}
135
+ _LOCK = threading.Lock()
136
+ _REFRESH_LOCK = threading.Lock()
137
+ _PAGES_DIR = Path(__file__).resolve().parent / "pages"
138
+
139
+
140
+ def _hub_href(kind: str, item_id: str) -> str:
141
+ if kind == "datasets":
142
+ return f"https://huggingface.co/datasets/{item_id}"
143
+ if kind == "spaces":
144
+ return f"https://huggingface.co/spaces/{item_id}"
145
+ if kind == "collections":
146
+ return f"https://huggingface.co/collections/{item_id}"
147
+ if kind == "buckets":
148
+ return f"https://huggingface.co/buckets/{item_id}"
149
+ return f"https://huggingface.co/{item_id}"
150
+
151
+
152
+ def _resource_id(kind: str, item: dict[str, Any]) -> str:
153
+ if kind == "collections":
154
+ return str(item.get("slug") or item.get("id") or "")
155
+ return str(item.get("id") or "")
156
+
157
+
158
+ def _project_resource(kind: str, item: dict[str, Any]) -> dict[str, Any]:
159
+ item_id = _resource_id(kind, item)
160
+ runtime = item.get("runtime") if isinstance(item.get("runtime"), dict) else {}
161
+ source = item.get("source_observation")
162
+ source_state = source.get("state") if isinstance(source, dict) else source
163
+ out: dict[str, Any] = {
164
+ "id": item_id,
165
+ "kind": kind[:-1] if kind.endswith("s") else kind,
166
+ "href": _hub_href(kind, item_id),
167
+ "revision": item.get("repository_sha") or item.get("head"),
168
+ "last_modified": item.get("last_modified") or item.get("last_updated"),
169
+ "license": item.get("license"),
170
+ "runtime_stage": runtime.get("stage"),
171
+ "source_state": source_state,
172
+ }
173
+ if item_id in KERNEL_OWNERS:
174
+ out.update(KERNEL_OWNERS[item_id])
175
+ return {key: value for key, value in out.items() if value is not None}
176
+
177
+
178
+ def project_inventory(raw: dict[str, Any], state: str = "LIVE") -> dict[str, Any]:
179
+ resources = raw.get("resources") if isinstance(raw.get("resources"), dict) else {}
180
+ projected: dict[str, list[dict[str, Any]]] = {}
181
+ for kind in ("models", "datasets", "spaces", "collections", "buckets"):
182
+ rows = resources.get(kind) if isinstance(resources.get(kind), list) else []
183
+ projected[kind] = [_project_resource(kind, row) for row in rows if isinstance(row, dict)]
184
+
185
+ model_by_id = {row.get("id"): row for row in projected["models"]}
186
+ kernels = []
187
+ for item_id, ownership in KERNEL_OWNERS.items():
188
+ row = dict(model_by_id.get(item_id) or {
189
+ "id": item_id,
190
+ "kind": "kernel",
191
+ "href": _hub_href("models", item_id),
192
+ })
193
+ row["kind"] = "kernel"
194
+ row.update(ownership)
195
+ kernels.append(row)
196
+
197
+ counts = dict(SNAPSHOT_COUNTS)
198
+ raw_counts = raw.get("counts")
199
+ if isinstance(raw_counts, dict):
200
+ for key in counts:
201
+ value = raw_counts.get(key)
202
+ if isinstance(value, int):
203
+ counts[key] = value
204
+ counts["kernels"] = len(kernels)
205
+
206
+ observed_at = str(raw.get("observed_at") or SNAPSHOT_OBSERVED_AT)
207
+ return {
208
+ "schema": "szl.ecosystem-atlas/v1",
209
+ "state": state,
210
+ "observed_at": observed_at,
211
+ "inventory_source": INVENTORY_URL,
212
+ "counts": counts,
213
+ "resources": {**projected, "kernels": kernels},
214
+ "curated": CURATED_SURFACES,
215
+ "limits": {
216
+ "runtime_stage": "provider-reported reachability, not quality or freshness",
217
+ "source_mapping": "validated ownership where present; pending adoption remains labelled",
218
+ "models": "links immutable artifacts; no weights are copied into this application",
219
+ },
220
+ }
221
+
222
+
223
+ def _fetch_inventory() -> dict[str, Any]:
224
+ request = urllib.request.Request(
225
+ INVENTORY_URL,
226
+ headers={"User-Agent": "a11oy-ecosystem-atlas/1.0", "Accept": "application/json"},
227
+ )
228
+ with urllib.request.urlopen(request, timeout=12) as response:
229
+ body = response.read(4 * 1024 * 1024)
230
+ parsed = json.loads(body.decode("utf-8"))
231
+ if not isinstance(parsed, dict) or not isinstance(parsed.get("resources"), dict):
232
+ raise ValueError("inventory payload is missing resources")
233
+ return parsed
234
+
235
+
236
+ def atlas_payload() -> dict[str, Any]:
237
+ now = time.time()
238
+ with _LOCK:
239
+ cached = _CACHE.get("payload")
240
+ cached_at = float(_CACHE.get("at") or 0.0)
241
+ if isinstance(cached, dict) and now - cached_at < _CACHE_TTL_SECONDS:
242
+ return project_inventory(cached, state="CACHED")
243
+ # Coalesce cold/expired refreshes. The API executes this function in a worker
244
+ # thread, so a slow provider never blocks the ASGI event loop and only one
245
+ # outbound refresh is in flight for a process at a time.
246
+ with _REFRESH_LOCK:
247
+ now = time.time()
248
+ with _LOCK:
249
+ cached = _CACHE.get("payload")
250
+ cached_at = float(_CACHE.get("at") or 0.0)
251
+ if isinstance(cached, dict) and now - cached_at < _CACHE_TTL_SECONDS:
252
+ return project_inventory(cached, state="CACHED")
253
+ try:
254
+ live = _fetch_inventory()
255
+ with _LOCK:
256
+ _CACHE["payload"] = live
257
+ _CACHE["at"] = now
258
+ return project_inventory(live, state="LIVE")
259
+ except Exception as exc:
260
+ with _LOCK:
261
+ cached = _CACHE.get("payload")
262
+ if isinstance(cached, dict):
263
+ payload = project_inventory(cached, state="STALE_CACHE")
264
+ payload["degraded_reason"] = type(exc).__name__
265
+ return payload
266
+ return {
267
+ "schema": "szl.ecosystem-atlas/v1",
268
+ "state": "SNAPSHOT",
269
+ "observed_at": SNAPSHOT_OBSERVED_AT,
270
+ "inventory_source": INVENTORY_URL,
271
+ "counts": {**SNAPSHOT_COUNTS, "kernels": len(KERNEL_OWNERS)},
272
+ "resources": {key: [] for key in (
273
+ "models", "datasets", "spaces", "collections", "buckets", "kernels"
274
+ )},
275
+ "curated": CURATED_SURFACES,
276
+ "degraded_reason": type(exc).__name__,
277
+ "limits": {
278
+ "snapshot": "counts only; rows stay empty rather than fabricating stale listings",
279
+ },
280
+ }
281
+
282
+
283
+ def register(app: Any, ns: str = "a11oy") -> str:
284
+ """Mount the atlas API and real deep-link pages ahead of SPA fallbacks."""
285
+ from fastapi.responses import FileResponse, JSONResponse
286
+ from starlette.routing import Route
287
+
288
+ atlas_page = _PAGES_DIR / "ecosystem.html"
289
+ anatomy_page = _PAGES_DIR / "anatomy-v5.html"
290
+
291
+ async def _api(request: Any = None) -> JSONResponse:
292
+ return JSONResponse(await asyncio.to_thread(atlas_payload))
293
+
294
+ async def _atlas_page(request: Any = None) -> Any:
295
+ if atlas_page.is_file():
296
+ return FileResponse(atlas_page, media_type="text/html")
297
+ return JSONResponse({"error": "ecosystem page unavailable"}, status_code=503)
298
+
299
+ async def _anatomy_page(request: Any = None) -> Any:
300
+ if anatomy_page.is_file():
301
+ return FileResponse(anatomy_page, media_type="text/html")
302
+ return JSONResponse({"error": "anatomy v5 page unavailable"}, status_code=503)
303
+
304
+ page_paths = (
305
+ "/ecosystem",
306
+ "/models",
307
+ "/kernels",
308
+ "/ecosystem/brain",
309
+ "/ecosystem/anatomy",
310
+ "/ecosystem/holographic",
311
+ )
312
+ routes = [Route(f"/api/{ns}/v1/ecosystem/atlas", _api, methods=["GET"])]
313
+ routes.extend(Route(path, _atlas_page, methods=["GET", "HEAD"]) for path in page_paths)
314
+ routes.append(Route("/anatomy-v5", _anatomy_page, methods=["GET", "HEAD"]))
315
+ app.router.routes[0:0] = routes
316
+ return f"ok: atlas API + {len(page_paths)} deep-link pages + Anatomy v5"
317
+
318
+
319
+ if __name__ == "__main__":
320
+ print(json.dumps(atlas_payload(), indent=2))
a11oy_formula_endpoints.py CHANGED
@@ -120,7 +120,13 @@ def register(app, ns: str = "a11oy") -> str:
120
 
121
  @app.get(f"/api/{ns}/v1/formulas/index")
122
  async def _formulas_index():
123
- return JSONResponse({"wired": _INDEX, "count": len(_INDEX), "doctrine": "v11"})
 
 
 
 
 
 
124
 
125
  @app.get(f"/api/{ns}/v1/formulas/verify")
126
  async def _formulas_verify():
 
120
 
121
  @app.get(f"/api/{ns}/v1/formulas/index")
122
  async def _formulas_index():
123
+ return JSONResponse({
124
+ "state": "AVAILABLE",
125
+ "wired": _INDEX,
126
+ "count": len(_INDEX),
127
+ "doctrine": "v11",
128
+ "honesty": "Static runtime registry availability; not a live execution signal.",
129
+ })
130
 
131
  @app.get(f"/api/{ns}/v1/formulas/verify")
132
  async def _formulas_verify():
a11oy_grc.py CHANGED
@@ -3,6 +3,7 @@
3
  """a11oy_grc.py — in-product GRC ALIGNMENT surface (Lane I5).
4
 
5
  Mounts a11oy's Governance / Compliance surface:
 
6
  * GET /api/a11oy/v1/grc/matrix — honest ISO 42001 / NIST AI RMF / 800-53 / EU AI Act
7
  coverage matrix (COVERED / PARTIAL / ROADMAP / NA).
8
  * GET /api/a11oy/v1/grc/mapping — 13 Λ axes → NIST AI RMF MEASURE 2 (+ Credo AI labels),
@@ -480,11 +481,16 @@ def register(app, ns: str = "a11oy") -> Dict[str, Any]:
480
  def _oscal():
481
  return JSONResponse(_merged_oscal()) # R5: base + Restraint OSCAL reqs
482
 
 
 
 
483
  for prefix in (f"/api/{ns}/v1/grc", "/v1/grc"):
 
484
  app.add_api_route(f"{prefix}/matrix", _matrix, methods=["GET"])
485
  app.add_api_route(f"{prefix}/mapping", _mapping, methods=["GET"])
486
  app.add_api_route(f"{prefix}/oscal", _oscal, methods=["GET"])
487
- app.add_api_route(f"{prefix}/info", lambda: JSONResponse(info(ns)), methods=["GET"])
 
488
  registered.append(f"GET {prefix}/matrix")
489
 
490
  _html = _page_html(ns)
@@ -522,9 +528,9 @@ def _selftest() -> None:
522
  '</body></html>')
523
 
524
  c = TestClient(app)
525
- for ep in ["/api/a11oy/v1/grc/matrix", "/api/a11oy/v1/grc/mapping",
526
  "/api/a11oy/v1/grc/oscal", "/api/a11oy/v1/grc/info",
527
- "/v1/grc/matrix", "/grc", "/compliance"]:
528
  r = c.get(ep)
529
  assert r.status_code == 200, (ep, r.status_code)
530
  # honesty checks on the page
 
3
  """a11oy_grc.py — in-product GRC ALIGNMENT surface (Lane I5).
4
 
5
  Mounts a11oy's Governance / Compliance surface:
6
+ * GET /api/a11oy/v1/grc — capability index + canonical endpoint links.
7
  * GET /api/a11oy/v1/grc/matrix — honest ISO 42001 / NIST AI RMF / 800-53 / EU AI Act
8
  coverage matrix (COVERED / PARTIAL / ROADMAP / NA).
9
  * GET /api/a11oy/v1/grc/mapping — 13 Λ axes → NIST AI RMF MEASURE 2 (+ Credo AI labels),
 
481
  def _oscal():
482
  return JSONResponse(_merged_oscal()) # R5: base + Restraint OSCAL reqs
483
 
484
+ def _info():
485
+ return JSONResponse(info(ns))
486
+
487
  for prefix in (f"/api/{ns}/v1/grc", "/v1/grc"):
488
+ app.add_api_route(prefix, _info, methods=["GET"])
489
  app.add_api_route(f"{prefix}/matrix", _matrix, methods=["GET"])
490
  app.add_api_route(f"{prefix}/mapping", _mapping, methods=["GET"])
491
  app.add_api_route(f"{prefix}/oscal", _oscal, methods=["GET"])
492
+ app.add_api_route(f"{prefix}/info", _info, methods=["GET"])
493
+ registered.append(f"GET {prefix}")
494
  registered.append(f"GET {prefix}/matrix")
495
 
496
  _html = _page_html(ns)
 
528
  '</body></html>')
529
 
530
  c = TestClient(app)
531
+ for ep in ["/api/a11oy/v1/grc", "/api/a11oy/v1/grc/matrix", "/api/a11oy/v1/grc/mapping",
532
  "/api/a11oy/v1/grc/oscal", "/api/a11oy/v1/grc/info",
533
+ "/v1/grc", "/v1/grc/matrix", "/grc", "/compliance"]:
534
  r = c.get(ep)
535
  assert r.status_code == 200, (ep, r.status_code)
536
  # honesty checks on the page
a11oy_landing.html CHANGED
@@ -11,7 +11,8 @@
11
  The genome registry (144 entries) is grouped into 4 honesty tiers — a different, larger set.
12
  Receipts are signed on write, never on GET. Every claim deep-links a live surface to check.
13
  DOM/sections owned by Dev 1; the #hero-canvas + /landing/app.js boot is owned by Dev 2 —
14
- preserved verbatim below. KANCHAY palette. No purple. No a11oy.net (sunset domain).
 
15
  © Stephen P. Lutar Jr. (ORCID 0009-0001-0110-4173) · Apache-2.0
16
  -->
17
  <html lang="en">
@@ -20,7 +21,38 @@
20
  <meta name="viewport" content="width=device-width, initial-scale=1, viewport-fit=cover" />
21
  <title>a11oy — Governed Inference · AI that signs its work and refuses to lie</title>
22
  <meta name="description" content="Governed Inference: AI that signs its work and refuses to lie. Every answer arrives with a signed receipt you can verify yourself — offline, in your own browser. When the model is not sure, it refuses rather than guesses. 8 Lean-proven theorems back the kernel; a 144-entry genome is graded across 4 honest tiers." />
23
- <link rel="icon" href="/social-preview.svg" />
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
24
  <style>
25
  /* ---- vendored fonts (0 CDN; served from /vendor/fonts/*.woff2 by serve.py) ---- */
26
  @font-face{font-family:'Space Grotesk';font-style:normal;font-weight:300 700;
@@ -279,6 +311,16 @@
279
  .muted{color:var(--ghost)}
280
  .skel{color:var(--ghost);font-family:var(--mono)}
281
 
 
 
 
 
 
 
 
 
 
 
282
  /* ---- honesty strip (MEASURED/REPORTED/UNKNOWN/CONJECTURE) ---- */
283
  .honesty{border-top:1px solid var(--border);border-bottom:1px solid var(--border);
284
  background:linear-gradient(180deg,rgba(10,16,30,0.6),rgba(10,16,30,0.22))}
@@ -310,6 +352,7 @@
310
  .data-state{display:inline-flex;align-items:center;border-radius:999px;padding:3px 8px;border:1px solid var(--border);
311
  color:var(--ghost);font:10px var(--mono);letter-spacing:.06em;white-space:nowrap}
312
  .data-state.live{color:var(--proof);border-color:rgba(58,244,200,.35);background:var(--proof-dim)}
 
313
  .data-state.down{color:var(--down);border-color:rgba(232,116,110,.38);background:rgba(232,116,110,.07)}
314
  .pulse-time{margin-top:14px;color:var(--ghost);font:11px var(--mono)}
315
  @media(max-width:900px){.pulse-grid{grid-template-columns:repeat(2,1fr)}}
@@ -334,6 +377,8 @@
334
  </a>
335
  <nav>
336
  <a class="hide-sm" href="#surfaces">Surfaces</a>
 
 
337
  <a class="hide-sm" href="#proof">The proof</a>
338
  <a class="hide-sm" href="#honesty">Honesty</a>
339
  <a class="hide-sm" href="/console#arena">Eval arena</a>
@@ -359,6 +404,7 @@
359
  sure, it returns an honest <b>BLOCKED</b> instead of a confident guess.</p>
360
  <div class="cta-row">
361
  <a class="btn btn-primary" href="/console">Open the command center →</a>
 
362
  <a class="btn btn-ghost" href="/verify">Verify a receipt offline</a>
363
  </div>
364
  <div class="hero-stats">
@@ -575,7 +621,7 @@
575
  <div class="body-embed" id="body-embed">
576
  <div class="poster" id="body-poster">
577
  <div class="pulse-ring" aria-hidden="true"></div>
578
- <h3>The Living Brain &amp; Body</h3>
579
  <p>Two live 3D views of the same governed organism: a <b>moldable brain</b> whose eight lobes
580
  are wired to live public reads (Hub assets, GitHub repos, proved theorems, organ vitals,
581
  the harnessed open-weights frontier) &mdash; sculpt its cortex with your pointer &mdash;
@@ -583,12 +629,39 @@
583
  <div class="cta-row" style="justify-content:center">
584
  <button class="btn btn-lattice" id="brain-load" type="button">🧠 Mold the brain in-frame</button>
585
  <button class="btn btn-ghost" id="body-load" type="button">Load the living body</button>
 
586
  <a class="btn btn-ghost" href="/living-anatomy" target="_blank" rel="noopener">Open full-screen →</a>
587
  </div>
588
  </div>
589
  </div>
590
  </section>
591
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
592
  <!-- ====================== (6) ONE CHAIN — live receipts/ledger ====================== -->
593
  <section class="band" id="chain" style="background:linear-gradient(180deg,rgba(10,16,30,0),rgba(10,16,30,0.55))">
594
  <div class="wrap">
@@ -645,6 +718,8 @@
645
  </div>
646
  <div class="lk"><strong style="color:var(--ink)">Product</strong>
647
  <a href="/console">Command center</a>
 
 
648
  <a href="/console#genome">Genome registry</a>
649
  <a href="/verify">Verify a receipt</a>
650
  <a href="/living-anatomy">Living anatomy · 3D</a>
@@ -829,7 +904,8 @@
829
  function pulseState(key, state, detail){
830
  const chip = $("pulse-"+key+"-state");
831
  const body = $("pulse-"+key+"-detail");
832
- if(chip){ chip.textContent = state; chip.className = "data-state "+((state === "LIVE" || state === "REACHABLE") ? "live" : "down"); }
 
833
  if(body) body.textContent = detail;
834
  }
835
  async function pulseJSON(url){
@@ -847,8 +923,9 @@
847
  .catch(() => pulseState("health", "UNAVAILABLE", "Runtime health did not answer this session.")),
848
  pulseJSON("/api/a11oy/v1/readiness/tab-matrix?view=summary").then(d => {
849
  const s = d.summary && d.summary.summary || {};
850
- if(!d.available) throw new Error("matrix unavailable");
851
- pulseState("contract", "REACHABLE", (s.tabs || "Published")+" tabs · "+(s.endpoints || "declared")+" endpoint contracts · SNAPSHOT.");
 
852
  }).catch(() => pulseState("contract", "UNAVAILABLE", "Tab contract is not bundled with this deployment.")),
853
  pulseJSON("/api/a11oy/v1/ledger").then(d => pulseState("ledger", "REACHABLE", (typeof d.count === "number" ? d.count : "Current")+" receipts returned by the read; verify timestamp and chain state in the source."))
854
  .catch(() => pulseState("ledger", "UNAVAILABLE", "Receipt ledger did not answer this session.")),
 
11
  The genome registry (144 entries) is grouped into 4 honesty tiers — a different, larger set.
12
  Receipts are signed on write, never on GET. Every claim deep-links a live surface to check.
13
  DOM/sections owned by Dev 1; the #hero-canvas + /landing/app.js boot is owned by Dev 2 —
14
+ preserved verbatim below. KANCHAY palette. No purple. a-11-oy.com remains the
15
+ canonical governed-inference product; a11oy.net is a separately attested estate cockpit.
16
  © Stephen P. Lutar Jr. (ORCID 0009-0001-0110-4173) · Apache-2.0
17
  -->
18
  <html lang="en">
 
21
  <meta name="viewport" content="width=device-width, initial-scale=1, viewport-fit=cover" />
22
  <title>a11oy — Governed Inference · AI that signs its work and refuses to lie</title>
23
  <meta name="description" content="Governed Inference: AI that signs its work and refuses to lie. Every answer arrives with a signed receipt you can verify yourself — offline, in your own browser. When the model is not sure, it refuses rather than guesses. 8 Lean-proven theorems back the kernel; a 144-entry genome is graded across 4 honest tiers." />
24
+ <link rel="canonical" href="https://a-11-oy.com/" />
25
+ <meta property="og:type" content="website" />
26
+ <meta property="og:url" content="https://a-11-oy.com/" />
27
+ <meta property="og:title" content="a11oy — Governed Inference" />
28
+ <meta property="og:description" content="AI that signs its work, exposes its evidence, and refuses when it cannot support an answer." />
29
+ <meta property="og:image" content="https://a-11-oy.com/social-preview-v5.png" />
30
+ <meta property="og:image:type" content="image/png" />
31
+ <meta property="og:image:width" content="1280" />
32
+ <meta property="og:image:height" content="640" />
33
+ <meta property="og:image:alt" content="a11oy Governed Inference — evidence-labelled ecosystem and Anatomy v5" />
34
+ <meta name="twitter:card" content="summary_large_image" />
35
+ <meta name="twitter:image" content="https://a-11-oy.com/social-preview-v5.png" />
36
+ <meta name="twitter:image:alt" content="a11oy Governed Inference — evidence-labelled ecosystem and Anatomy v5" />
37
+ <link rel="icon" type="image/svg+xml" href="/social-preview-v5.svg" />
38
+ <script type="application/ld+json">
39
+ {
40
+ "@context": "https://schema.org",
41
+ "@type": "SoftwareApplication",
42
+ "name": "a11oy Governed Inference",
43
+ "url": "https://a-11-oy.com/",
44
+ "applicationCategory": "DeveloperApplication",
45
+ "operatingSystem": "Web",
46
+ "creator": {
47
+ "@type": "Organization",
48
+ "name": "SZL Holdings",
49
+ "sameAs": [
50
+ "https://github.com/szl-holdings",
51
+ "https://huggingface.co/SZLHOLDINGS"
52
+ ]
53
+ }
54
+ }
55
+ </script>
56
  <style>
57
  /* ---- vendored fonts (0 CDN; served from /vendor/fonts/*.woff2 by serve.py) ---- */
58
  @font-face{font-family:'Space Grotesk';font-style:normal;font-weight:300 700;
 
311
  .muted{color:var(--ghost)}
312
  .skel{color:var(--ghost);font-family:var(--mono)}
313
 
314
+ /* ecosystem atlas — public estate snapshot, never implied live until API reads */
315
+ .estate-grid{display:grid;grid-template-columns:repeat(6,1fr);gap:10px;margin:24px 0}
316
+ .estate-cell{border:1px solid var(--border);border-radius:13px;padding:15px;
317
+ background:linear-gradient(155deg,rgba(17,30,50,.72),rgba(8,16,29,.88))}
318
+ .estate-cell b{display:block;color:var(--proof);font:600 1.45rem var(--mono);margin-bottom:4px}
319
+ .estate-cell span{color:var(--ghost);font:10px var(--mono);letter-spacing:.08em;text-transform:uppercase}
320
+ .estate-links{display:flex;gap:9px;flex-wrap:wrap;margin-top:18px}
321
+ @media(max-width:900px){.estate-grid{grid-template-columns:repeat(3,1fr)}}
322
+ @media(max-width:520px){.estate-grid{grid-template-columns:repeat(2,1fr)}}
323
+
324
  /* ---- honesty strip (MEASURED/REPORTED/UNKNOWN/CONJECTURE) ---- */
325
  .honesty{border-top:1px solid var(--border);border-bottom:1px solid var(--border);
326
  background:linear-gradient(180deg,rgba(10,16,30,0.6),rgba(10,16,30,0.22))}
 
352
  .data-state{display:inline-flex;align-items:center;border-radius:999px;padding:3px 8px;border:1px solid var(--border);
353
  color:var(--ghost);font:10px var(--mono);letter-spacing:.06em;white-space:nowrap}
354
  .data-state.live{color:var(--proof);border-color:rgba(58,244,200,.35);background:var(--proof-dim)}
355
+ .data-state.amber{color:var(--gold);border-color:rgba(215,185,107,.4);background:rgba(215,185,107,.08)}
356
  .data-state.down{color:var(--down);border-color:rgba(232,116,110,.38);background:rgba(232,116,110,.07)}
357
  .pulse-time{margin-top:14px;color:var(--ghost);font:11px var(--mono)}
358
  @media(max-width:900px){.pulse-grid{grid-template-columns:repeat(2,1fr)}}
 
377
  </a>
378
  <nav>
379
  <a class="hide-sm" href="#surfaces">Surfaces</a>
380
+ <a class="hide-sm" href="/ecosystem">Ecosystem</a>
381
+ <a class="hide-sm" href="/anatomy-v5">Anatomy v5</a>
382
  <a class="hide-sm" href="#proof">The proof</a>
383
  <a class="hide-sm" href="#honesty">Honesty</a>
384
  <a class="hide-sm" href="/console#arena">Eval arena</a>
 
404
  sure, it returns an honest <b>BLOCKED</b> instead of a confident guess.</p>
405
  <div class="cta-row">
406
  <a class="btn btn-primary" href="/console">Open the command center →</a>
407
+ <a class="btn btn-lattice" href="/ecosystem">Explore the ecosystem</a>
408
  <a class="btn btn-ghost" href="/verify">Verify a receipt offline</a>
409
  </div>
410
  <div class="hero-stats">
 
621
  <div class="body-embed" id="body-embed">
622
  <div class="poster" id="body-poster">
623
  <div class="pulse-ring" aria-hidden="true"></div>
624
+ <h3>The Living Brain &amp; Body · Anatomy v5</h3>
625
  <p>Two live 3D views of the same governed organism: a <b>moldable brain</b> whose eight lobes
626
  are wired to live public reads (Hub assets, GitHub repos, proved theorems, organ vitals,
627
  the harnessed open-weights frontier) &mdash; sculpt its cortex with your pointer &mdash;
 
629
  <div class="cta-row" style="justify-content:center">
630
  <button class="btn btn-lattice" id="brain-load" type="button">🧠 Mold the brain in-frame</button>
631
  <button class="btn btn-ghost" id="body-load" type="button">Load the living body</button>
632
+ <a class="btn btn-primary" href="/anatomy-v5">Open the live digital twin →</a>
633
  <a class="btn btn-ghost" href="/living-anatomy" target="_blank" rel="noopener">Open full-screen →</a>
634
  </div>
635
  </div>
636
  </div>
637
  </section>
638
 
639
+ <!-- ====================== PUBLIC ECOSYSTEM ATLAS ====================== -->
640
+ <section class="band" id="ecosystem">
641
+ <div class="wrap">
642
+ <p class="kick">Public estate · snapshot observed 2026-07-16</p>
643
+ <h2>Models, kernels, data, and Spaces — one evidence-labelled map.</h2>
644
+ <p class="sub" style="max-width:790px">The atlas joins Hugging Face artifacts to their GitHub producers without pretending that a reachable URL proves alignment. Counts below are the dated public inventory snapshot; the atlas API upgrades them to LIVE or CACHED when its versioned source answers.</p>
645
+ <div class="estate-grid" aria-label="Public ecosystem snapshot counts">
646
+ <div class="estate-cell"><b>15</b><span>Models</span></div>
647
+ <div class="estate-cell"><b>10</b><span>Governed kernels</span></div>
648
+ <div class="estate-cell"><b>24</b><span>Datasets</span></div>
649
+ <div class="estate-cell"><b>26</b><span>Spaces</span></div>
650
+ <div class="estate-cell"><b>22</b><span>Collections</span></div>
651
+ <div class="estate-cell"><b>1</b><span>Public bucket</span></div>
652
+ </div>
653
+ <div class="estate-links">
654
+ <a class="btn btn-primary" href="/ecosystem">Open ecosystem atlas →</a>
655
+ <a class="btn btn-lattice" href="/anatomy-v5">Open Anatomy v5</a>
656
+ <a class="btn btn-ghost" href="/models">Models</a>
657
+ <a class="btn btn-ghost" href="/kernels">Kernels</a>
658
+ <a class="btn btn-ghost" href="/ecosystem/brain">Brain</a>
659
+ <a class="btn btn-ghost" href="/ecosystem/holographic">Holographic</a>
660
+ <a class="btn btn-ghost" href="/spaces">All Spaces</a>
661
+ </div>
662
+ </div>
663
+ </section>
664
+
665
  <!-- ====================== (6) ONE CHAIN — live receipts/ledger ====================== -->
666
  <section class="band" id="chain" style="background:linear-gradient(180deg,rgba(10,16,30,0),rgba(10,16,30,0.55))">
667
  <div class="wrap">
 
718
  </div>
719
  <div class="lk"><strong style="color:var(--ink)">Product</strong>
720
  <a href="/console">Command center</a>
721
+ <a href="/ecosystem">Ecosystem atlas</a>
722
+ <a href="/anatomy-v5">Anatomy v5 · digital twin</a>
723
  <a href="/console#genome">Genome registry</a>
724
  <a href="/verify">Verify a receipt</a>
725
  <a href="/living-anatomy">Living anatomy · 3D</a>
 
904
  function pulseState(key, state, detail){
905
  const chip = $("pulse-"+key+"-state");
906
  const body = $("pulse-"+key+"-detail");
907
+ const amberStates = new Set(["CACHED","STALE_CACHE","SNAPSHOT","MODELED","OBSERVED","AVAILABLE","DEGRADED"]);
908
+ if(chip){ chip.textContent = state; chip.className = "data-state "+((state === "LIVE" || state === "REACHABLE") ? "live" : (amberStates.has(state) ? "amber" : "down")); }
909
  if(body) body.textContent = detail;
910
  }
911
  async function pulseJSON(url){
 
923
  .catch(() => pulseState("health", "UNAVAILABLE", "Runtime health did not answer this session.")),
924
  pulseJSON("/api/a11oy/v1/readiness/tab-matrix?view=summary").then(d => {
925
  const s = d.summary && d.summary.summary || {};
926
+ if(!d.matrix_available) throw new Error("matrix unavailable");
927
+ const checked = Boolean(d.probe_verdict_available);
928
+ pulseState("contract", checked ? "REACHABLE" : "SNAPSHOT", (s.tabs || "Published")+" tabs · "+(s.endpoints || "declared")+" endpoint contracts · "+(checked ? "deployment probe attached." : "static contract; deployment probe pending."));
929
  }).catch(() => pulseState("contract", "UNAVAILABLE", "Tab contract is not bundled with this deployment.")),
930
  pulseJSON("/api/a11oy/v1/ledger").then(d => pulseState("ledger", "REACHABLE", (typeof d.count === "number" ? d.count : "Current")+" receipts returned by the read; verify timestamp and chain state in the source."))
931
  .catch(() => pulseState("ledger", "UNAVAILABLE", "Receipt ledger did not answer this session.")),
console/robots.txt ADDED
@@ -0,0 +1,4 @@
 
 
 
 
 
1
+ User-agent: *
2
+ Allow: /
3
+
4
+ Sitemap: https://a-11-oy.com/sitemap.xml
console/sitemap.xml ADDED
@@ -0,0 +1,19 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
3
+ <url><loc>https://a-11-oy.com/</loc></url>
4
+ <url><loc>https://a-11-oy.com/ecosystem</loc></url>
5
+ <url><loc>https://a-11-oy.com/anatomy-v5</loc></url>
6
+ <url><loc>https://a-11-oy.com/models</loc></url>
7
+ <url><loc>https://a-11-oy.com/kernels</loc></url>
8
+ <url><loc>https://a-11-oy.com/ecosystem/brain</loc></url>
9
+ <url><loc>https://a-11-oy.com/ecosystem/anatomy</loc></url>
10
+ <url><loc>https://a-11-oy.com/ecosystem/holographic</loc></url>
11
+ <url><loc>https://a-11-oy.com/spaces</loc></url>
12
+ <url><loc>https://a-11-oy.com/formulas</loc></url>
13
+ <url><loc>https://a-11-oy.com/console</loc></url>
14
+ <url><loc>https://a-11-oy.com/trust</loc></url>
15
+ <url><loc>https://a-11-oy.com/verify</loc></url>
16
+ <url><loc>https://a-11-oy.com/observability</loc></url>
17
+ <url><loc>https://a-11-oy.com/living-anatomy</loc></url>
18
+ <url><loc>https://a-11-oy.com/elite</loc></url>
19
+ </urlset>
console/social-preview-v5.png ADDED

Git LFS Details

  • SHA256: 14b49098045fa05689d0562d5cb9a325cf0edee41008d0b040e468aa8974dbdd
  • Pointer size: 131 Bytes
  • Size of remote file: 196 kB
console/social-preview-v5.svg ADDED
console/static/viz/router/app.js CHANGED
@@ -205,8 +205,10 @@ function graphStats(){
205
  }
206
 
207
  function normalizeStats(payload){
208
- if(!payload || typeof payload !== 'object' || payload.mode !== 'live' || !Array.isArray(payload.routes)){
209
- throw new Error('router stats envelope is not a live route array');
 
 
210
  }
211
  const routes = payload.routes.map(route=>({
212
  organ:String(route?.organ ?? ''), tier:String(route?.tier ?? ''), model:String(route?.model ?? ''),
@@ -221,7 +223,8 @@ function normalizeStats(payload){
221
  const routeTotal = routes.reduce((sum,route)=>sum+route.throughput,0);
222
  if(Math.abs(routeTotal-Number(payload.servedThisWindow)) > 0.001) throw new Error('router stats signal does not equal route total');
223
  return {
224
- mode:'endpoint', source:String(payload.source || 'unlabelled endpoint source'), routes,
 
225
  servedThisWindow:Number(payload.servedThisWindow), honesty:String(payload.honesty || '')
226
  };
227
  }
@@ -237,7 +240,7 @@ function renderRouteFeed(stats,state){
237
  title.textContent = `${route.tier} · ${route.organ} → ${route.model}`;
238
  const detail = document.createElement('span');
239
  detail.textContent = state === 'responding'
240
- ? `${Math.round(route.throughput)} catalog pulse · ${route.license}`
241
  : `${Math.round(route.throughput)} modeled load · ${route.license}${route.task ? ` · ${route.task}` : ''}`;
242
  item.append(title,detail); feed.append(item);
243
  }
@@ -252,9 +255,9 @@ function setOperationalState(stats,state,detail){
252
  const signalLabel = document.getElementById('signalLabel');
253
  document.getElementById('signalValue').textContent = String(Math.round(stats.servedThisWindow));
254
  if(state === 'responding'){
255
- pill.textContent = 'CATALOG ENDPOINT · RESPONDING'; pill.className = 'pill responding';
256
- signalLabel.textContent = 'catalog pulse · not QPS';
257
- source.textContent = `Validated response · ${stats.source}`;
258
  routeMode.textContent = stats.honesty || 'Endpoint-derived catalog signal; not production traffic.';
259
  }else if(state === 'degraded'){
260
  pill.textContent = 'DEGRADED · MODELED FALLBACK'; pill.className = 'pill degraded';
 
205
  }
206
 
207
  function normalizeStats(payload){
208
+ if(!payload || typeof payload !== 'object' || payload.state !== 'MODELED' ||
209
+ payload.mode !== 'modeled' || payload.throughput_state !== 'MODELED' ||
210
+ !Array.isArray(payload.routes)){
211
+ throw new Error('router stats envelope is not an explicitly modeled route array');
212
  }
213
  const routes = payload.routes.map(route=>({
214
  organ:String(route?.organ ?? ''), tier:String(route?.tier ?? ''), model:String(route?.model ?? ''),
 
223
  const routeTotal = routes.reduce((sum,route)=>sum+route.throughput,0);
224
  if(Math.abs(routeTotal-Number(payload.servedThisWindow)) > 0.001) throw new Error('router stats signal does not equal route total');
225
  return {
226
+ mode:'endpoint', state:'MODELED', source:String(payload.source || 'unlabelled endpoint source'),
227
+ catalogState:String(payload.catalog_state || 'UNKNOWN'), throughputState:'MODELED', routes,
228
  servedThisWindow:Number(payload.servedThisWindow), honesty:String(payload.honesty || '')
229
  };
230
  }
 
240
  title.textContent = `${route.tier} · ${route.organ} → ${route.model}`;
241
  const detail = document.createElement('span');
242
  detail.textContent = state === 'responding'
243
+ ? `${Math.round(route.throughput)} modeled load · ${route.license}`
244
  : `${Math.round(route.throughput)} modeled load · ${route.license}${route.task ? ` · ${route.task}` : ''}`;
245
  item.append(title,detail); feed.append(item);
246
  }
 
255
  const signalLabel = document.getElementById('signalLabel');
256
  document.getElementById('signalValue').textContent = String(Math.round(stats.servedThisWindow));
257
  if(state === 'responding'){
258
+ pill.textContent = 'MODELED ENDPOINT · RESPONDING'; pill.className = 'pill modeled';
259
+ signalLabel.textContent = 'modeled load · not QPS';
260
+ source.textContent = `Validated response · catalog ${stats.catalogState} · ${stats.source}`;
261
  routeMode.textContent = stats.honesty || 'Endpoint-derived catalog signal; not production traffic.';
262
  }else if(state === 'degraded'){
263
  pill.textContent = 'DEGRADED · MODELED FALLBACK'; pill.className = 'pill degraded';
console/static/viz/router/index.html CHANGED
@@ -37,6 +37,7 @@
37
  <div id="hud">
38
  <header>
39
  <span class="brand">LLM&nbsp;GRAPH-ROUTER</span>
 
40
  <span id="livePill" class="pill pending">CHECKING ENDPOINT</span>
41
  <span id="renderPill" class="pill">RENDER INIT</span>
42
  <label class="sov"><input type="checkbox" id="sov"/> Sovereign mode <small>(GREEN-only)</small></label>
 
37
  <div id="hud">
38
  <header>
39
  <span class="brand">LLM&nbsp;GRAPH-ROUTER</span>
40
+ <nav class="global-links" aria-label="a11oy navigation"><a href="/">Home</a><a href="/ecosystem">Ecosystem</a><a href="/anatomy-v5">Anatomy v5</a><a href="/console">Console</a></nav>
41
  <span id="livePill" class="pill pending">CHECKING ENDPOINT</span>
42
  <span id="renderPill" class="pill">RENDER INIT</span>
43
  <label class="sov"><input type="checkbox" id="sov"/> Sovereign mode <small>(GREEN-only)</small></label>
console/static/viz/router/style.css CHANGED
@@ -44,6 +44,9 @@ body.scene-unavailable .fallback-kicker{color:var(--hatun-400)}
44
  #hud header{grid-column:1/-1;display:flex;gap:10px;align-items:center;flex-wrap:wrap;pointer-events:auto}
45
  .brand{font:750 13px var(--mono);letter-spacing:.16em;padding:7px 13px;border-left:3px solid var(--yuyay-400);border-radius:3px;
46
  background:linear-gradient(90deg,rgba(24,48,71,.96),rgba(13,31,49,.38));text-shadow:0 0 18px rgba(58,244,200,.45)}
 
 
 
47
  .pill{font:700 10px var(--mono);letter-spacing:.04em;padding:5px 9px;border-radius:999px;border:1px solid var(--border);background:rgba(16,32,50,.93);color:var(--text-sub)}
48
  .pill.responding{color:#03150d;background:var(--green);border-color:#6affab;box-shadow:0 0 24px rgba(56,223,130,.25)}
49
  .pill.modeled{color:#241900;background:var(--hatun-400);border-color:#ffe5a4;box-shadow:0 0 24px rgba(255,211,106,.18)}
@@ -113,6 +116,7 @@ body.scene-ready .label-layer{opacity:1}
113
  @media(max-width:680px){
114
  #hud{padding:9px;gap:7px;grid-template-columns:1fr 1fr;grid-template-rows:auto 1fr auto auto}
115
  #hud header{gap:6px}.brand{font-size:10px;padding:6px 8px}.pill{font-size:8px;padding:4px 6px}.sov{font-size:9px}.sov small{display:none}
 
116
  .telemetry{width:min(190px,48vw);padding:10px;align-self:start;margin-top:8px}.panel .row b{font-size:16px}.panel .row small{font-size:8px}
117
  .source-state,.freshness-state{font-size:8px}.panel .legend{gap:6px;font-size:8px}
118
  .route-panel{width:min(210px,49vw);padding:10px;align-self:start;margin-top:8px;max-height:42vh}.route-feed{max-height:31vh}.route-feed li{padding:6px 6px 6px 10px}.route-feed strong{font-size:9px}.route-feed span{font-size:8px}
 
44
  #hud header{grid-column:1/-1;display:flex;gap:10px;align-items:center;flex-wrap:wrap;pointer-events:auto}
45
  .brand{font:750 13px var(--mono);letter-spacing:.16em;padding:7px 13px;border-left:3px solid var(--yuyay-400);border-radius:3px;
46
  background:linear-gradient(90deg,rgba(24,48,71,.96),rgba(13,31,49,.38));text-shadow:0 0 18px rgba(58,244,200,.45)}
47
+ .global-links{display:flex;gap:4px;align-items:center;flex-wrap:wrap}
48
+ .global-links a{padding:6px 8px;border:1px solid rgba(102,149,181,.38);border-radius:7px;background:rgba(7,20,34,.78);color:var(--text-sub);font:700 9px var(--mono);text-decoration:none}
49
+ .global-links a:hover,.global-links a:focus-visible{color:var(--yuyay-300);border-color:var(--yuyay-400)}
50
  .pill{font:700 10px var(--mono);letter-spacing:.04em;padding:5px 9px;border-radius:999px;border:1px solid var(--border);background:rgba(16,32,50,.93);color:var(--text-sub)}
51
  .pill.responding{color:#03150d;background:var(--green);border-color:#6affab;box-shadow:0 0 24px rgba(56,223,130,.25)}
52
  .pill.modeled{color:#241900;background:var(--hatun-400);border-color:#ffe5a4;box-shadow:0 0 24px rgba(255,211,106,.18)}
 
116
  @media(max-width:680px){
117
  #hud{padding:9px;gap:7px;grid-template-columns:1fr 1fr;grid-template-rows:auto 1fr auto auto}
118
  #hud header{gap:6px}.brand{font-size:10px;padding:6px 8px}.pill{font-size:8px;padding:4px 6px}.sov{font-size:9px}.sov small{display:none}
119
+ .global-links a{font-size:8px;padding:4px 5px}.global-links a:nth-child(3){display:none}
120
  .telemetry{width:min(190px,48vw);padding:10px;align-self:start;margin-top:8px}.panel .row b{font-size:16px}.panel .row small{font-size:8px}
121
  .source-state,.freshness-state{font-size:8px}.panel .legend{gap:6px;font-size:8px}
122
  .route-panel{width:min(210px,49vw);padding:10px;align-self:start;margin-top:8px;max-height:42vh}.route-feed{max-height:31vh}.route-feed li{padding:6px 6px 6px 10px}.route-feed strong{font-size:9px}.route-feed span{font-size:8px}
pages/anatomy-v5.html ADDED
@@ -0,0 +1,195 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <!doctype html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="utf-8">
5
+ <meta name="viewport" content="width=device-width,initial-scale=1">
6
+ <title>Anatomy v5 | a11oy evidence-labelled digital twin</title>
7
+ <meta name="description" content="An evidence-labelled digital twin of the SZL estate: organism health, inference routing, Brain pulse, formula genome, and Space reachability.">
8
+ <link rel="canonical" href="https://a-11-oy.com/anatomy-v5">
9
+ <meta property="og:title" content="Anatomy v5 | a11oy">
10
+ <meta property="og:description" content="See the estate as one governed organism without hiding unavailable signals.">
11
+ <style>
12
+ :root{--bg:#050b0a;--panel:#091512;--panel2:#0d1d19;--line:rgba(58,244,200,.16);--ink:#edf9f5;--muted:#89a39c;--teal:#3af4c8;--blue:#6c9cff;--amber:#d9bc75;--red:#ec827e;--mono:ui-monospace,SFMono-Regular,Consolas,monospace;--sans:Inter,ui-sans-serif,system-ui,sans-serif}
13
+ *{box-sizing:border-box}html{scroll-behavior:smooth}body{margin:0;background:radial-gradient(circle at 50% -20%,rgba(45,137,115,.2),transparent 38%),linear-gradient(180deg,#06100e,var(--bg));color:var(--ink);font-family:var(--sans)}a{color:inherit;text-decoration:none}a,button{touch-action:manipulation}a:focus-visible,button:focus-visible,input:focus-visible{outline:2px solid var(--teal);outline-offset:3px}.skip{position:fixed;left:12px;top:8px;z-index:100;transform:translateY(-160%);border-radius:8px;background:var(--teal);color:#03100c;padding:10px 13px;font:12px var(--mono)}.skip:focus{transform:none}.wrap{width:min(1220px,calc(100% - 32px));margin:auto}.mono{font-family:var(--mono)}
14
+ header{position:sticky;top:0;z-index:30;border-bottom:1px solid var(--line);background:rgba(5,11,10,.88);backdrop-filter:blur(18px)}header .wrap{min-height:66px;display:flex;align-items:center;gap:18px}.brand{display:flex;align-items:center;gap:10px;font-weight:750}.mark{width:30px;height:30px;display:grid;place-items:center;border:1px solid var(--teal);border-radius:50%;color:var(--teal);box-shadow:0 0 24px rgba(58,244,200,.2)}nav{display:flex;gap:7px;align-items:center;margin-left:auto;flex-wrap:wrap}nav a{min-height:44px;display:inline-flex;align-items:center;font:11px var(--mono);color:var(--muted);padding:9px 11px;border-radius:9px}nav a:hover{background:rgba(58,244,200,.07);color:var(--ink)}nav .primary{border:1px solid rgba(58,244,200,.35);color:var(--teal)}
15
+ .hero{padding:64px 0 30px}.eyebrow{font:11px var(--mono);letter-spacing:.16em;color:var(--teal);text-transform:uppercase}.hero h1{font-size:clamp(2.7rem,7vw,6.4rem);line-height:.9;letter-spacing:-.06em;margin:18px 0}.hero h1 span{color:transparent;background:linear-gradient(90deg,var(--teal),var(--blue));background-clip:text}.hero p{max-width:820px;margin:0;color:var(--muted);font-size:1.08rem;line-height:1.7}.badges{display:flex;gap:8px;flex-wrap:wrap;margin-top:23px}.badge{border:1px solid var(--line);border-radius:999px;padding:7px 10px;color:var(--muted);font:10px var(--mono);overflow-wrap:anywhere}.badges a.badge{min-height:44px;display:inline-flex;align-items:center}.badge.live{border-color:rgba(58,244,200,.42);color:var(--teal)}.badge.cached,.badge.stalecache,.badge.snapshot,.badge.modeled,.badge.observed,.badge.available,.badge.degraded{border-color:rgba(217,188,117,.4);color:var(--amber)}.badge.unavailable,.badge.error{border-color:rgba(236,130,126,.4);color:var(--red)}
16
+ .vitals{display:grid;grid-template-columns:repeat(6,1fr);gap:10px;margin:20px 0 34px}.vital{min-height:104px;border:1px solid var(--line);border-radius:14px;padding:15px;background:linear-gradient(150deg,rgba(13,29,25,.94),rgba(7,15,13,.96))}.vital b{display:block;margin-bottom:7px;color:var(--teal);font:650 1.45rem var(--mono);overflow-wrap:anywhere}.vital span{color:var(--muted);font:10px var(--mono);text-transform:uppercase;letter-spacing:.08em}.vital small{display:block;margin-top:8px;color:#667e77;font:9px var(--mono)}
17
+ .tabs{position:sticky;top:67px;z-index:20;display:flex;gap:7px;overflow:auto;overscroll-behavior-inline:contain;scrollbar-width:thin;padding:12px 0;background:linear-gradient(180deg,rgba(5,11,10,.97),rgba(5,11,10,.83),transparent)}.tab{min-height:44px;border:1px solid var(--line);border-radius:999px;background:var(--panel);color:var(--muted);padding:9px 13px;white-space:nowrap;cursor:pointer;font:11px var(--mono)}.tab.active,.tab:hover{color:#03100c;background:var(--teal);border-color:var(--teal)}
18
+ .view{display:none;padding:15px 0 72px}.view.active{display:block}.section-head{display:flex;justify-content:space-between;align-items:end;gap:18px;margin:16px 0 20px}.section-head h2{font-size:clamp(1.7rem,4vw,3rem);letter-spacing:-.04em;margin:0}.section-head p{max-width:610px;color:var(--muted);line-height:1.6;margin:0}.panel{border:1px solid var(--line);border-radius:16px;background:linear-gradient(150deg,rgba(13,29,25,.93),rgba(6,13,11,.98));padding:20px}
19
+ .organism{display:grid;grid-template-columns:minmax(0,1.15fr) minmax(300px,.85fr);gap:14px}.organism>*,.nervous-grid>*,.formula>*{min-width:0}.body{position:relative;min-height:570px;overflow:hidden}.body:before{content:"";position:absolute;inset:7% 15%;border:1px solid rgba(58,244,200,.12);border-radius:45% 45% 32% 32%;box-shadow:inset 0 0 90px rgba(58,244,200,.035)}.spine{position:absolute;top:16%;bottom:14%;left:50%;width:1px;background:linear-gradient(transparent,var(--teal),transparent);opacity:.45}.nerve{position:absolute;height:1px;background:linear-gradient(90deg,transparent,rgba(108,156,255,.48),transparent);transform-origin:left center}.organ{position:absolute;width:142px;min-height:82px;padding:12px;border:1px solid var(--line);border-radius:13px;background:rgba(8,19,16,.94);box-shadow:0 0 30px rgba(58,244,200,.035)}.organ b{display:block;font-size:13px}.organ small{display:block;margin-top:5px;color:var(--muted);font:9px var(--mono);line-height:1.4}.organ .dot{position:absolute;right:10px;top:10px;width:7px;height:7px;border-radius:50%;background:var(--red)}.organ.live .dot{background:var(--teal);box-shadow:0 0 10px var(--teal)}.organ.cached .dot,.organ.stalecache .dot,.organ.snapshot .dot,.organ.modeled .dot,.organ.observed .dot,.organ.available .dot,.organ.degraded .dot{background:var(--amber)}.brain{left:calc(50% - 71px);top:5%}.router{left:calc(50% - 71px);top:26%}.models{left:5%;top:26%}.kernels{right:5%;top:26%}.data{left:5%;top:53%}.spaces{right:5%;top:53%}.formulas{left:calc(50% - 71px);top:73%}.receipts{left:calc(50% - 71px);top:48%}.readout{display:grid;gap:10px}.readout article{min-width:0;border:1px solid var(--line);border-radius:13px;padding:15px;background:rgba(8,18,15,.7)}.readout h3{font-size:13px;margin:0 0 9px}.readout pre{margin:0;white-space:pre-wrap;overflow-wrap:anywhere;color:var(--muted);font:10px/1.55 var(--mono);max-height:165px;overflow:auto}.source{display:flex;justify-content:space-between;flex-wrap:wrap;gap:6px 12px;margin-top:10px;color:#668078;font:9px var(--mono)}.source span{min-width:0;overflow-wrap:anywhere}
20
+ .nervous-grid{display:grid;grid-template-columns:1.15fr .85fr;gap:14px}.route-list,.formula-list{display:grid;gap:8px}.route{display:grid;grid-template-columns:minmax(130px,1fr) repeat(3,minmax(78px,.45fr));gap:10px;align-items:center;border:1px solid var(--line);border-radius:11px;padding:12px;background:rgba(6,14,12,.72);font:10px var(--mono)}.route strong{font:600 12px var(--sans);overflow-wrap:anywhere}.route span{color:var(--muted);overflow-wrap:anywhere}.route .signal.live{color:var(--teal)}.route .signal.cached,.route .signal.stalecache,.route .signal.snapshot,.route .signal.modeled,.route .signal.observed,.route .signal.available,.route .signal.degraded{color:var(--amber)}.route .signal.unavailable,.route .signal.error{color:var(--red)}.json{margin:0;max-height:570px;overflow:auto;white-space:pre-wrap;overflow-wrap:anywhere;color:#9bb3ad;font:10px/1.55 var(--mono)}
21
+ .formula-tools{display:flex;gap:10px;align-items:center;flex-wrap:wrap;margin-bottom:14px}.formula-tools input{flex:1;min-width:180px;border:1px solid var(--line);border-radius:10px;background:#07110f;color:var(--ink);padding:11px 13px;font:11px var(--mono)}.formula-tools .badge{max-width:100%}.formula{display:grid;grid-template-columns:minmax(130px,.7fr) minmax(160px,1fr) 2fr;gap:12px;border:1px solid var(--line);border-radius:12px;padding:14px;background:rgba(7,16,14,.75)}.formula b{font-size:13px}.formula .tier{color:var(--blue);font:10px var(--mono);text-transform:uppercase}.formula p{margin:0;color:var(--muted);font:10px/1.55 var(--mono);overflow-wrap:anywhere}.empty{border:1px dashed var(--line);border-radius:13px;padding:26px;text-align:center;color:var(--muted)}
22
+ footer{border-top:1px solid var(--line);padding:34px 0 48px;color:var(--muted);font-size:12px;line-height:1.65}footer .wrap{display:flex;justify-content:space-between;gap:30px;flex-wrap:wrap}footer a{color:var(--teal)}
23
+ @media(max-width:960px){.vitals{grid-template-columns:repeat(3,minmax(0,1fr))}.organism,.nervous-grid{grid-template-columns:1fr}.body{min-height:540px}.route{grid-template-columns:1fr 1fr}.formula{grid-template-columns:1fr}}
24
+ @media(max-width:800px){.brand small{display:none}}
25
+ @media(max-width:680px){header{position:static}header .wrap{flex-wrap:wrap;padding:11px 0 8px}nav{width:100%;margin-left:0;flex-wrap:nowrap;overflow-x:auto;overscroll-behavior-inline:contain;scrollbar-width:thin}nav a{flex:0 0 auto}.tabs{top:0}}
26
+ @media(max-width:620px){.hero{padding-top:44px}.vitals{grid-template-columns:repeat(2,minmax(0,1fr))}.panel{padding:16px}.body{min-height:690px}.body:before{inset:5% 4%}.organ{width:126px}.brain{left:calc(50% - 63px)}.router{left:calc(50% - 63px);top:22%}.models{left:2%;top:39%}.kernels{right:2%;top:39%}.receipts{left:calc(50% - 63px);top:54%}.data{left:2%;top:69%}.spaces{right:2%;top:69%}.formulas{left:calc(50% - 63px);top:84%}.route{grid-template-columns:1fr}.section-head{align-items:start;flex-direction:column}.formula-tools{align-items:stretch;flex-direction:column}.formula-tools input{min-width:0;width:100%}}
27
+ </style>
28
+ </head>
29
+ <body>
30
+ <a class="skip" href="#main">Skip to content</a>
31
+ <header><div class="wrap">
32
+ <a class="brand" href="/"><span class="mark">A</span><span>a11oy <small class="mono" style="color:var(--muted);font-weight:400">/ Anatomy v5</small></span></a>
33
+ <nav aria-label="Primary"><a href="/ecosystem">Ecosystem</a><a href="/spaces">All Spaces</a><a href="/formulas">Formulas</a><a href="/living-anatomy">3D Anatomy</a><a class="primary" href="/console">Command center</a></nav>
34
+ </div></header>
35
+ <main id="main">
36
+ <section class="hero"><div class="wrap">
37
+ <div class="eyebrow">Real signals | one governed organism</div>
38
+ <h1>The estate is<br><span>alive and inspectable.</span></h1>
39
+ <p>Anatomy v5 joins the public inventory, Brain pulse, inference router, mesh, Space health, and full wired formula index. Each organ keeps its source and state; a failed probe stays visibly unavailable.</p>
40
+ <div class="badges" id="probe-badges" aria-live="polite"><span class="badge">CONNECTING TO SEVEN EVIDENCE SURFACES</span></div>
41
+ </div></section>
42
+ <div class="wrap">
43
+ <section class="vitals" id="vitals" aria-live="polite"><div class="vital"><b>--</b><span>Loading evidence</span><small>No placeholder is a claim.</small></div></section>
44
+ <div class="tabs" role="tablist" aria-label="Anatomy views">
45
+ <button class="tab active" id="tab-organism" data-view="organism" role="tab" aria-selected="true" aria-controls="view-organism" tabindex="0">Organism</button>
46
+ <button class="tab" id="tab-nervous" data-view="nervous" role="tab" aria-selected="false" aria-controls="view-nervous" tabindex="-1">Router nervous system</button>
47
+ <button class="tab" id="tab-genome" data-view="genome" role="tab" aria-selected="false" aria-controls="view-genome" tabindex="-1">Formula genome</button>
48
+ <button class="tab" id="tab-evidence" data-view="evidence" role="tab" aria-selected="false" aria-controls="view-evidence" tabindex="-1">Raw evidence</button>
49
+ </div>
50
+ <section class="view active" id="view-organism" role="tabpanel" aria-labelledby="tab-organism">
51
+ <div class="section-head"><div><div class="eyebrow">Digital twin</div><h2>One body, no hidden organs.</h2></div><p>Green means an endpoint explicitly reported LIVE for the relevant signal. Amber means available, observed, cached, modeled, degraded, or snapshot evidence. Red means unavailable; a successful HTTP response is not silently converted into a healthy state.</p></div>
52
+ <div class="organism">
53
+ <div class="panel body" aria-label="SZL ecosystem organism map">
54
+ <div class="spine"></div>
55
+ <article class="organ brain" data-probe="brain"><span class="dot"></span><b>Brain</b><small id="organ-brain">Pulse pending</small></article>
56
+ <article class="organ router" data-probe="router"><span class="dot"></span><b>Router</b><small id="organ-router">Routes pending</small></article>
57
+ <article class="organ models" data-probe="atlas"><span class="dot"></span><b>Models</b><small id="organ-models">Inventory pending</small></article>
58
+ <article class="organ kernels" data-probe="atlas"><span class="dot"></span><b>Kernels</b><small id="organ-kernels">Registry pending</small></article>
59
+ <article class="organ receipts" data-probe="mesh"><span class="dot"></span><b>Evidence mesh</b><small id="organ-receipts">Mesh pending</small></article>
60
+ <article class="organ data" data-probe="atlas"><span class="dot"></span><b>Data + memory</b><small id="organ-data">Inventory pending</small></article>
61
+ <article class="organ spaces" data-probe="spaces"><span class="dot"></span><b>Spaces</b><small id="organ-spaces">Health pending</small></article>
62
+ <article class="organ formulas" data-probe="genome"><span class="dot"></span><b>Formula genome</b><small id="organ-formulas">Genome pending</small></article>
63
+ </div>
64
+ <aside class="readout" id="readout"></aside>
65
+ </div>
66
+ </section>
67
+ <section class="view" id="view-nervous" role="tabpanel" aria-labelledby="tab-nervous" hidden>
68
+ <div class="section-head"><div><div class="eyebrow">Inference fabric</div><h2>The nervous system routes; policy decides.</h2></div><p>Routes are rendered from the current router catalog response. Load values remain MODELED, not traffic or QPS. Runtime reachability is not model quality, and a route listing is not a guarantee of inference capacity.</p></div>
69
+ <div class="nervous-grid"><div class="panel"><div class="route-list" id="routes"><div class="empty">Router evidence pending.</div></div></div><div class="panel"><div class="eyebrow" style="margin-bottom:12px">Mesh state</div><pre class="json" id="mesh-json">Waiting for mesh evidence...</pre></div></div>
70
+ </section>
71
+ <section class="view" id="view-genome" role="tabpanel" aria-labelledby="tab-genome" hidden>
72
+ <div class="section-head"><div><div class="eyebrow">Wired formulas</div><h2>Every served formula, one honest index.</h2></div><p>This view joins the genome snapshot with the runtime formula registry, deduplicating by formula name or identifier and labelling each row's wiring source. A citation or theorem name is provenance metadata; experimental entries remain labelled experimental.</p></div>
73
+ <div class="panel"><div class="formula-tools"><input id="formula-search" type="search" placeholder="Search formula, tier, citation, theorem..." aria-label="Search formula genome"><span class="badge" id="formula-count" aria-live="polite">PENDING</span></div><div class="formula-list" id="formula-list"><div class="empty">Formula evidence pending.</div></div></div>
74
+ </section>
75
+ <section class="view" id="view-evidence" role="tabpanel" aria-labelledby="tab-evidence" hidden>
76
+ <div class="section-head"><div><div class="eyebrow">Unmodified responses</div><h2>Inspect what the twin actually read.</h2></div><p>Payloads are capped for display but not reinterpreted as stronger evidence. Open each endpoint directly for the complete machine-readable response.</p></div>
77
+ <div class="panel"><pre class="json" id="raw-json">Waiting for evidence...</pre></div>
78
+ </section>
79
+ </div>
80
+ </main>
81
+ <footer><div class="wrap"><span>Anatomy v5 is a read-only digital twin. It does not train models, mutate datasets, or mint receipts on GET.</span><span><a href="/api/a11oy/v1/ecosystem/atlas">Atlas JSON</a> | <a href="/api/a11oy/v1/genome">Genome JSON</a> | <a href="/api/a11oy/v1/formulas/index">Wired formula JSON</a> | <a href="/.well-known/szl-source.json">Source attestation</a></span></div></footer>
82
+ <script>
83
+ (()=>{
84
+ 'use strict';
85
+ const endpoints={
86
+ atlas:['/api/a11oy/v1/ecosystem/atlas'],
87
+ brain:['/api/a11oy/v1/brain/pulse'],
88
+ router:['/api/a11oy/v1/router/stats','/v1/router/stats'],
89
+ mesh:['/api/a11oy/v1/mesh/state'],
90
+ spaces:['/api/a11oy/v1/spaces/health'],
91
+ genome:['/api/a11oy/v1/genome'],
92
+ formulas:['/api/a11oy/v1/formulas/index']
93
+ };
94
+ const probes={};
95
+ const esc=v=>String(v??'').replace(/[&<>"']/g,c=>({'&':'&amp;','<':'&lt;','>':'&gt;','"':'&quot;',"'":'&#39;'}[c]));
96
+ const simple=v=>v===null||['string','number','boolean'].includes(typeof v)?String(v??'--'):'--';
97
+ const EVIDENCE_STATES=Object.freeze(['LIVE','CACHED','STALE_CACHE','SNAPSHOT','MODELED','OBSERVED','AVAILABLE','DEGRADED','UNAVAILABLE','ERROR']);
98
+ const stateClass=s=>String(s||'').toLowerCase().replace(/[^a-z]/g,'');
99
+ const normalizedState=s=>String(s||'').trim().toUpperCase().replace(/[ -]+/g,'_');
100
+ const evidenceState=s=>{const normalized=normalizedState(s);return EVIDENCE_STATES.includes(normalized)?normalized:''};
101
+ const bounded=(v,n=2800)=>{const s=JSON.stringify(v,null,2);return s.length>n?s.slice(0,n)+'\n... display capped; open source endpoint for complete payload':s};
102
+ function classifyProbe(name,data){
103
+ const declared=evidenceState(data?.state||data?.status);
104
+ if(name==='brain'){
105
+ const pulse=evidenceState(data?.labels?.pulse);
106
+ return pulse||declared||'OBSERVED';
107
+ }
108
+ if(name==='router'){
109
+ const source=normalizedState(data?.source);const catalog=normalizedState(data?.catalog_state);const throughput=evidenceState(data?.throughput_state);
110
+ if(source==='HONEST_STUB_CATALOG'||catalog==='FALLBACK')return 'MODELED';
111
+ return declared||throughput||'OBSERVED';
112
+ }
113
+ if(name==='mesh'){
114
+ const wires=Object.values(data?.wires||{});const statuses=wires.map(w=>normalizedState(typeof w==='object'?w?.status:w));
115
+ const partial=statuses.some(s=>/(NOT_SERV|IN_PROCESS|PARTIAL|FALLBACK|STUB|UNAVAILABLE)/.test(s))||/stub|not wired|not served/i.test(String(data?.honesty||''));
116
+ if(partial)return 'DEGRADED';
117
+ if(declared&&declared!=='LIVE')return declared;
118
+ if(declared==='LIVE'&&statuses.length&&statuses.every(s=>s==='LIVE'))return 'LIVE';
119
+ return 'OBSERVED';
120
+ }
121
+ if(name==='spaces'){
122
+ if(declared)return declared;
123
+ const rows=Array.isArray(data?.spaces)?data.spaces:[];
124
+ if(rows.length&&rows.every(r=>!r?.app_reachable&&normalizedState(r?.stage)==='UNKNOWN'))return 'UNAVAILABLE';
125
+ if(rows.some(r=>!r?.app_reachable||normalizedState(r?.stage)!=='RUNNING'))return 'DEGRADED';
126
+ return 'OBSERVED';
127
+ }
128
+ if(name==='formulas'||name==='genome'){
129
+ return ['UNAVAILABLE','ERROR','DEGRADED'].includes(declared)?declared:'AVAILABLE';
130
+ }
131
+ return declared||'OBSERVED';
132
+ }
133
+ async function fetchPath(path){
134
+ const control=new AbortController();const timer=setTimeout(()=>control.abort(),9000);
135
+ try{const response=await fetch(path,{headers:{accept:'application/json'},signal:control.signal,cache:'no-store'});if(!response.ok)throw Error('HTTP '+response.status);return {data:await response.json(),endpoint:path};}
136
+ finally{clearTimeout(timer)}
137
+ }
138
+ async function probe(name,paths){
139
+ let last='unavailable';
140
+ for(const path of paths){try{const hit=await fetchPath(path);return {state:classifyProbe(name,hit.data),data:hit.data,endpoint:hit.endpoint,read_at:new Date().toISOString()};}catch(error){last=error?.name==='AbortError'?'timeout':String(error?.message||error)}}
141
+ return {state:'UNAVAILABLE',data:null,endpoint:paths[0],error:last,read_at:new Date().toISOString()};
142
+ }
143
+ function valueAt(obj,keys){for(const key of keys){const value=key.split('.').reduce((a,k)=>a&&a[k],obj);if(value!==undefined&&value!==null)return value}return null}
144
+ function arrayAt(obj,keys){const value=valueAt(obj,keys);return Array.isArray(value)?value:[]}
145
+ function paint(){
146
+ document.getElementById('probe-badges').innerHTML=Object.entries(probes).map(([name,p])=>`<a class="badge ${stateClass(p.state)}" href="${esc(p.endpoint)}">${esc(name.toUpperCase())}: ${esc(p.state)}</a>`).join('');
147
+ document.querySelectorAll('.organ').forEach(el=>{const p=probes[el.dataset.probe];el.className=el.className.replace(/\s(live|cached|stalecache|modeled|snapshot|observed|available|degraded|unavailable|error)\b/g,'')+' '+stateClass(p?.state||'UNAVAILABLE')});
148
+ const atlas=probes.atlas?.data||{};const counts=atlas.counts||{};const formulas=probes.formulas?.data||{};const genome=probes.genome?.data||{};const router=probes.router?.data||{};const brain=probes.brain?.data||{};const spaces=probes.spaces?.data||{};
149
+ const routes=arrayAt(router,['routes','tiers','data.routes']);const wiredRows=arrayAt(formulas,['wired','formulas','entries']);const genomeRows=arrayAt(genome,['entries','genome']);const spaceRows=arrayAt(spaces,['spaces','resources','results']);
150
+ const surfacesLit=valueAt(brain,['lit.surfaces_lit','surfaces_lit.count','surfaces_lit','surface_count']);
151
+ const organsLit=valueAt(brain,['lit.organs_lit','organs_lit.count','organs_lit']);
152
+ const vitals=[
153
+ [simple(counts.models),'Models',probes.atlas?.state],[simple(counts.kernels),'Governed kernels',probes.atlas?.state],[simple(genomeRows.length||genome.count),'Formula genome',probes.genome?.state],
154
+ [simple(routes.length),'Router routes',probes.router?.state],[simple(surfacesLit),'Brain-lit surfaces',probes.brain?.state],[simple(spaceRows.length||counts.spaces),'Spaces observed',probes.spaces?.state]
155
+ ];
156
+ document.getElementById('vitals').innerHTML=vitals.map(([v,l,s])=>`<div class="vital"><b>${esc(v)}</b><span>${esc(l)}</span><small>${esc(s||'UNAVAILABLE')} | source-derived</small></div>`).join('');
157
+ const brainLit=[surfacesLit!==null?surfacesLit+' surfaces':null,organsLit!==null?organsLit+' organs':null].filter(Boolean).join(' | ');
158
+ document.getElementById('organ-brain').textContent=brainLit||probes.brain?.state||'UNAVAILABLE';
159
+ document.getElementById('organ-router').textContent=routes.length?routes.length+' routes observed':(probes.router?.state||'UNAVAILABLE');
160
+ document.getElementById('organ-models').textContent=counts.models!==undefined?counts.models+' public models':(probes.atlas?.state||'UNAVAILABLE');
161
+ document.getElementById('organ-kernels').textContent=counts.kernels!==undefined?counts.kernels+' governed kernels':(probes.atlas?.state||'UNAVAILABLE');
162
+ document.getElementById('organ-data').textContent=counts.datasets!==undefined?counts.datasets+' datasets':(probes.atlas?.state||'UNAVAILABLE');
163
+ document.getElementById('organ-spaces').textContent=counts.spaces!==undefined?counts.spaces+' inventory entries':(probes.spaces?.state||'UNAVAILABLE');
164
+ document.getElementById('organ-formulas').textContent=genomeRows.length?genomeRows.length+' genome | '+wiredRows.length+' wired':(probes.genome?.state||'UNAVAILABLE');
165
+ document.getElementById('organ-receipts').textContent=probes.mesh?.state||'UNAVAILABLE';
166
+ const readoutKeys=['brain','router','atlas','spaces'];
167
+ document.getElementById('readout').innerHTML=readoutKeys.map(key=>{const p=probes[key];return `<article><h3>${esc(key[0].toUpperCase()+key.slice(1))} <span class="badge ${stateClass(p?.state)}">${esc(p?.state||'UNAVAILABLE')}</span></h3><pre>${esc(p?.data?bounded(p.data,620):(p?.error||'No response'))}</pre><div class="source"><span>${esc(p?.endpoint)}</span><span>${esc(p?.read_at||'')}</span></div></article>`}).join('');
168
+ renderRoutes(routes,router);renderFormulas(genomeRows,wiredRows);document.getElementById('mesh-json').textContent=probes.mesh?.data?bounded(probes.mesh.data,12000):(probes.mesh?.error||'UNAVAILABLE');
169
+ document.getElementById('raw-json').textContent=bounded(probes,32000);
170
+ }
171
+ function renderRoutes(rows,router={}){
172
+ const host=document.getElementById('routes');if(!rows.length){host.innerHTML='<div class="empty">Router did not expose a route array. Open the raw evidence view for its exact payload.</div>';return}
173
+ const throughputState=evidenceState(router?.throughput_state)||'MODELED';const throughputLabel=throughputState==='MODELED'?'modeled load':'throughput';
174
+ host.innerHTML=rows.map((r,i)=>{const name=r.model||r.organ||r.id||r.name||('route '+(i+1));const tier=r.tier||r.rank||r.provider||'--';const license=r.license||'not reported';const throughput=r.throughput??r.tokens_per_second??'not reported';return `<article class="route"><strong>${esc(name)}</strong><span>tier ${esc(tier)}</span><span>${esc(license)}</span><span class="signal ${stateClass(throughputState)}">${esc(throughputLabel)} ${esc(throughput)}</span></article>`}).join('');
175
+ }
176
+ let allGenome=[];let allWired=[];let allFormulas=[];
177
+ const formulaKey=(row,fallback)=>String(row?.name||row?.id||fallback).trim().toLowerCase();
178
+ function mergeFormulaRows(genome,wired){
179
+ const wiredMap=new Map();wired.forEach((row,i)=>wiredMap.set(formulaKey(row,'wired:'+i),row));
180
+ const seen=new Set();const merged=[];
181
+ genome.forEach((row,i)=>{const key=formulaKey(row,'genome:'+i);if(seen.has(key))return;seen.add(key);const runtime=wiredMap.get(key);merged.push({...row,runtime_wiring:runtime?'WIRED':'GENOME_ONLY',evidence_source:runtime?'genome + runtime registry':'genome',runtime_tier:runtime?.tier,runtime_citation:runtime?.citation,runtime_lean_theorem:runtime?.lean_theorem})});
182
+ wired.forEach((row,i)=>{const key=formulaKey(row,'wired:'+i);if(seen.has(key))return;seen.add(key);merged.push({...row,runtime_wiring:'WIRED_ONLY',evidence_source:'runtime registry; absent from genome snapshot'})});
183
+ return merged;
184
+ }
185
+ function renderFormulas(genome=allGenome,wired=allWired){allGenome=genome;allWired=wired;allFormulas=mergeFormulaRows(genome,wired);const q=(document.getElementById('formula-search').value||'').trim().toLowerCase();const shown=allFormulas.filter(r=>JSON.stringify(r).toLowerCase().includes(q));document.getElementById('formula-count').textContent=(probes.genome?.state||'UNAVAILABLE')+' | '+shown.length+' OF '+allFormulas.length+' UNION | '+genome.length+' GENOME | '+wired.length+' WIRED';const host=document.getElementById('formula-list');if(!shown.length){host.innerHTML='<div class="empty">No formula rows are available for this filter. No entries were invented.</div>';return}host.innerHTML=shown.map(r=>{const locations=Array.isArray(r.locations)?r.locations.map(x=>[x.repo,x.file,x.line].filter(Boolean).join(':')).join(' | '):'';const tier=r.tag||r.tier||r.runtime_tier||'tier not reported';const citation=r.citation||locations||r.runtime_citation||r.meaning||'citation not reported';const theorem=r.lean_theorem||r.theorem||r.lean_ref||r.runtime_lean_theorem||r.powers||'theorem metadata not reported';return `<article class="formula"><div><b>${esc(r.name||r.id||'unnamed')}</b><div class="tier">${esc(tier)} | ${esc(r.runtime_wiring)}</div></div><p>${esc(citation)}</p><p>${esc(theorem)} | source: ${esc(r.evidence_source)}</p></article>`}).join('')}
186
+ document.getElementById('formula-search').addEventListener('input',()=>renderFormulas(allGenome,allWired));
187
+ const tabButtons=[...document.querySelectorAll('.tab')];
188
+ function activateTab(button,{focus=false,updateHash=true}={}){tabButtons.forEach(tab=>{const selected=tab===button;tab.classList.toggle('active',selected);tab.setAttribute('aria-selected',String(selected));tab.tabIndex=selected?0:-1;const panel=document.getElementById(tab.getAttribute('aria-controls'));if(panel){panel.classList.toggle('active',selected);panel.hidden=!selected}});if(focus)button.focus();if(updateHash)history.replaceState(null,'','#'+button.dataset.view)}
189
+ tabButtons.forEach((button,index)=>{button.addEventListener('click',()=>activateTab(button,{updateHash:true}));button.addEventListener('keydown',event=>{let next;if(event.key==='ArrowRight')next=(index+1)%tabButtons.length;else if(event.key==='ArrowLeft')next=(index-1+tabButtons.length)%tabButtons.length;else if(event.key==='Home')next=0;else if(event.key==='End')next=tabButtons.length-1;else return;event.preventDefault();activateTab(tabButtons[next],{focus:true,updateHash:true})})});
190
+ const initial=location.hash.slice(1);const initialTab=tabButtons.find(tab=>tab.dataset.view===initial)||tabButtons[0];activateTab(initialTab,{focus:false,updateHash:false});
191
+ Promise.all(Object.entries(endpoints).map(async([name,paths])=>{probes[name]=await probe(name,paths);paint()})).then(paint);
192
+ })();
193
+ </script>
194
+ </body>
195
+ </html>
pages/ecosystem.html ADDED
@@ -0,0 +1,98 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <!doctype html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="utf-8">
5
+ <meta name="viewport" content="width=device-width,initial-scale=1">
6
+ <title>SZL Ecosystem Atlas · a11oy</title>
7
+ <meta name="description" content="Evidence-labelled map of SZL models, governed kernels, datasets, Spaces, Brain, Anatomy, Holographic surfaces, and source ownership.">
8
+ <link rel="canonical" href="https://a-11-oy.com/ecosystem">
9
+ <meta property="og:title" content="SZL Ecosystem Atlas · a11oy">
10
+ <meta property="og:description" content="Every public model, kernel, dataset, Space, collection, and governed surface in one evidence-labelled control plane.">
11
+ <style>
12
+ :root{--bg:#07100f;--panel:#0b1715;--panel2:#0e1d1a;--line:rgba(79,242,196,.17);--ink:#edf9f5;--muted:#8eaaa2;--teal:#3af4c8;--blue:#6c9cff;--gold:#d9bc75;--red:#ec827e;--mono:ui-monospace,SFMono-Regular,Consolas,monospace;--sans:Inter,ui-sans-serif,system-ui,sans-serif}
13
+ *{box-sizing:border-box}html{scroll-behavior:smooth}body{margin:0;background:radial-gradient(circle at 80% -10%,rgba(62,144,130,.2),transparent 36%),linear-gradient(180deg,#06100e,#081210 55%,#050b0a);color:var(--ink);font-family:var(--sans)}
14
+ a{color:inherit;text-decoration:none}a,button{touch-action:manipulation}a:focus-visible,button:focus-visible,input:focus-visible{outline:2px solid var(--teal);outline-offset:3px}.skip{position:fixed;left:12px;top:8px;z-index:100;transform:translateY(-160%);border-radius:8px;background:var(--teal);color:#03100c;padding:10px 13px;font:12px var(--mono)}.skip:focus{transform:none}.wrap{width:min(1180px,calc(100% - 32px));margin:auto}.mono{font-family:var(--mono)}
15
+ header{position:sticky;top:0;z-index:20;border-bottom:1px solid var(--line);background:rgba(6,16,14,.9);backdrop-filter:blur(18px)}
16
+ header .wrap{height:66px;display:flex;align-items:center;gap:18px}.brand{display:flex;align-items:center;gap:11px;font-weight:760}.mark{width:28px;height:28px;border:1px solid var(--teal);border-radius:50%;display:grid;place-items:center;color:var(--teal);box-shadow:0 0 28px rgba(58,244,200,.22)}
17
+ nav{margin-left:auto;display:flex;align-items:center;gap:8px;flex-wrap:wrap}nav a{min-height:44px;display:inline-flex;align-items:center;font-size:13px;color:var(--muted);padding:9px 11px;border-radius:9px}nav a:hover{background:rgba(58,244,200,.07);color:var(--ink)}.primary{border:1px solid rgba(58,244,200,.38);color:var(--teal)!important}
18
+ .hero{padding:72px 0 42px}.eyebrow{font:11px var(--mono);letter-spacing:.16em;color:var(--teal);text-transform:uppercase}.hero h1{font-size:clamp(2.6rem,6vw,5.6rem);line-height:.93;letter-spacing:-.055em;margin:18px 0}.hero h1 span{color:transparent;background:linear-gradient(90deg,var(--teal),var(--blue));background-clip:text}.hero p{max-width:760px;color:var(--muted);font-size:1.08rem;line-height:1.7}.statebar{display:flex;gap:12px;align-items:center;flex-wrap:wrap;margin-top:24px}.state{font:11px var(--mono);border:1px solid var(--line);border-radius:999px;padding:7px 10px;color:var(--muted)}.state[href]{min-height:44px;display:inline-flex;align-items:center}.state.live{color:var(--teal);border-color:rgba(58,244,200,.4)}.state.cached{color:var(--gold);border-color:rgba(217,188,117,.42)}.state.bad{color:var(--red);border-color:rgba(236,130,126,.4)}
19
+ .counts{display:grid;grid-template-columns:repeat(7,minmax(100px,1fr));gap:10px;margin:20px 0 46px}.count{background:linear-gradient(160deg,rgba(14,29,26,.96),rgba(8,17,15,.96));border:1px solid var(--line);border-radius:14px;padding:16px}.count b{display:block;font:650 1.55rem var(--mono);color:var(--teal)}.count span{font:10px var(--mono);letter-spacing:.09em;color:var(--muted);text-transform:uppercase}
20
+ .toolbar{display:flex;gap:12px;align-items:center;flex-wrap:wrap;margin-bottom:16px}.search{flex:1;min-width:230px;background:var(--panel);border:1px solid var(--line);color:var(--ink);border-radius:12px;padding:12px 14px;font:13px var(--mono)}.search:focus{outline:1px solid var(--teal)}
21
+ .tabs{display:flex;gap:7px;overflow:auto;overscroll-behavior-inline:contain;scrollbar-width:thin;padding-bottom:10px;margin-bottom:16px}.tab{min-height:44px;border:1px solid var(--line);background:rgba(11,23,21,.75);color:var(--muted);padding:9px 12px;border-radius:999px;font:11px var(--mono);white-space:nowrap;cursor:pointer}.tab.active,.tab:hover{color:#04100c;background:var(--teal);border-color:var(--teal)}
22
+ .brief{display:grid;grid-template-columns:1.5fr 1fr;gap:14px;margin:20px 0 26px}.brief>div{min-width:0;border:1px solid var(--line);border-radius:16px;background:linear-gradient(150deg,rgba(14,29,26,.9),rgba(7,15,13,.95));padding:22px}.brief h2{margin:0 0 9px;font-size:1.25rem}.brief p{margin:0;color:var(--muted);line-height:1.65}.links{display:flex;gap:9px;flex-wrap:wrap;margin-top:16px}.chip{min-height:44px;display:inline-flex;align-items:center;border:1px solid var(--line);border-radius:9px;padding:8px 10px;color:var(--teal);font:11px var(--mono)}
23
+ .grid{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:12px;padding-bottom:70px}.grid>*{min-width:0}.card{display:flex;flex-direction:column;min-height:178px;border:1px solid var(--line);border-radius:15px;background:linear-gradient(150deg,rgba(14,29,26,.9),rgba(7,15,13,.96));padding:18px;transition:.18s}.card:hover{border-color:rgba(58,244,200,.46);transform:translateY(-2px)}.kind{font:10px var(--mono);letter-spacing:.1em;color:var(--blue);text-transform:uppercase}.card h3{font-size:1rem;line-height:1.35;margin:10px 0;overflow-wrap:anywhere}.meta{display:grid;gap:6px;margin-top:auto;font:10.5px var(--mono);color:var(--muted)}.meta span{display:flex;justify-content:space-between;gap:12px;min-width:0}.meta b{min-width:0;font-weight:500;color:#c9dad5;text-align:right;overflow-wrap:anywhere}.open{margin-top:14px;color:var(--teal);font:11px var(--mono)}
24
+ .empty{grid-column:1/-1;border:1px dashed var(--line);border-radius:15px;padding:28px;color:var(--muted);text-align:center}.foot{border-top:1px solid var(--line);padding:35px 0 50px;color:var(--muted);font-size:12px;line-height:1.6}.foot .wrap{display:flex;justify-content:space-between;gap:30px;flex-wrap:wrap}.foot a{color:var(--teal)}
25
+ @media(max-width:900px){.counts{grid-template-columns:repeat(4,minmax(0,1fr))}.grid{grid-template-columns:repeat(2,minmax(0,1fr))}.brief{grid-template-columns:1fr}}
26
+ @media(max-width:800px){.brand small{display:none}}
27
+ @media(max-width:680px){header{position:static}header .wrap{height:auto;flex-wrap:wrap;padding:11px 0 8px}nav{width:100%;margin-left:0;flex-wrap:nowrap;overflow-x:auto;overscroll-behavior-inline:contain;scrollbar-width:thin}nav a{flex:0 0 auto}}
28
+ @media(max-width:620px){.hero{padding-top:45px}.counts{grid-template-columns:repeat(2,minmax(0,1fr))}.grid{grid-template-columns:1fr}.search{min-width:0;width:100%}.meta span{align-items:flex-start;flex-direction:column;gap:3px}.meta b{text-align:left}}
29
+ </style>
30
+ </head>
31
+ <body>
32
+ <a class="skip" href="#main">Skip to content</a>
33
+ <header><div class="wrap">
34
+ <a class="brand" href="/"><span class="mark">A</span><span>a11oy <small class="mono" style="color:var(--muted);font-weight:400">/ ecosystem atlas</small></span></a>
35
+ <nav aria-label="Primary"><a href="https://a11oy.net">Alloy cockpit</a><a href="/spaces">All Spaces</a><a href="/anatomy-v5">Anatomy v5</a><a href="/console">Command center</a><a class="primary" href="https://huggingface.co/SZLHOLDINGS">Hugging Face ↗</a></nav>
36
+ </div></header>
37
+ <main id="main">
38
+ <section class="hero"><div class="wrap">
39
+ <div class="eyebrow">SZL Holdings · public control plane</div>
40
+ <h1>One estate.<br><span>Every artifact visible.</span></h1>
41
+ <p>Models stay immutable. Kernels stay attributable. The Brain, Anatomy, Holographic surfaces, datasets, collections, Spaces, and GitHub producers meet here through one evidence-labelled registry.</p>
42
+ <div class="statebar"><span class="state" id="atlas-state" role="status" aria-live="polite">LOADING</span><span class="state" id="atlas-time">waiting for inventory</span><a class="state" href="/api/a11oy/v1/ecosystem/atlas">JSON evidence ↗</a></div>
43
+ </div></section>
44
+ <div class="wrap">
45
+ <section class="counts" id="counts"></section>
46
+ <section class="brief">
47
+ <div><h2>Control plane, not an artifact warehouse.</h2><p>The sites link signed or revision-pinned Hub artifacts. Training, conversion, and evaluation remain with their producer repositories; the router chooses eligible runtimes and the Brain supplies grounded context.</p><div class="links"><a class="chip" href="https://github.com/szl-holdings/szl-router">Router source ↗</a><a class="chip" href="https://github.com/szl-holdings/szl-forge">Forge source ↗</a><a class="chip" href="https://github.com/szl-holdings/lutar-lean">Proof kernel ↗</a></div></div>
48
+ <div><h2>Anatomy v5</h2><p>An evidence-labelled digital twin of the estate: organism health, inference nervous system, and the complete formula genome. Unavailable sources remain visibly unavailable.</p><div class="links"><a class="chip" href="/anatomy-v5">Open Anatomy v5 →</a><a class="chip" href="/living-anatomy">Current 3D anatomy →</a></div></div>
49
+ </section>
50
+ <section class="toolbar"><input class="search" id="search" type="search" placeholder="Search models, kernels, Spaces, owners, revisions…" aria-label="Search ecosystem"></section>
51
+ <section class="tabs" id="tabs" role="tablist" aria-label="Ecosystem categories"></section>
52
+ <section class="grid" id="grid" role="tabpanel" aria-label="Ecosystem resources" aria-live="polite" tabindex="0"><div class="empty">Loading the public estate inventory…</div></section>
53
+ </div>
54
+ </main>
55
+ <footer class="foot"><div class="wrap"><span>Counts and rows are labelled LIVE, CACHED, STALE_CACHE, SNAPSHOT, or UNAVAILABLE. Runtime stage proves reachability only.</span><span><a href="https://github.com/szl-holdings">GitHub</a> · <a href="https://huggingface.co/SZLHOLDINGS">Hugging Face</a> · <a href="/trust">Trust center</a></span></div></footer>
56
+ <script>
57
+ const API='/api/a11oy/v1/ecosystem/atlas';
58
+ const labels={models:'Models',kernels:'Kernels',brain:'Brain',anatomy:'Anatomy',holographic:'Holographic',datasets:'Datasets',spaces:'Spaces',collections:'Collections',buckets:'Buckets',killinchu:'Killinchu'};
59
+ const order=['models','kernels','brain','anatomy','holographic','datasets','spaces','collections','buckets','killinchu'];
60
+ let atlas=null, active='models', query='';
61
+ const pathKey=location.pathname.split('/').filter(Boolean).at(-1)||'models';
62
+ const hashKey=location.hash.slice(1);
63
+ if(order.includes(hashKey)) active=hashKey; else if(order.includes(pathKey)) active=pathKey;
64
+ function esc(v){return String(v??'').replace(/[&<>"']/g,c=>({'&':'&amp;','<':'&lt;','>':'&gt;','"':'&quot;',"'":'&#39;'}[c]));}
65
+ function cardsFor(key){
66
+ if(!atlas)return[];
67
+ if(['brain','anatomy','holographic','killinchu'].includes(key))return atlas.curated?.[key]||[];
68
+ return atlas.resources?.[key]||[];
69
+ }
70
+ function renderCounts(){
71
+ const keys=['models','kernels','datasets','spaces','collections','buckets','public_resources_total'];
72
+ document.getElementById('counts').innerHTML=keys.map(k=>`<div class="count"><b>${esc(atlas?.counts?.[k]??'—')}</b><span>${esc(k.replaceAll('_',' '))}</span></div>`).join('');
73
+ }
74
+ function selectTab(key,{focus=false}={}){
75
+ active=key;history.replaceState(null,'','/ecosystem#'+active);renderTabs();renderGrid();if(focus)document.getElementById('tab-'+active)?.focus();
76
+ }
77
+ function renderTabs(){
78
+ document.getElementById('tabs').innerHTML=order.map(k=>`<button type="button" class="tab ${k===active?'active':''}" id="tab-${k}" data-tab="${k}" role="tab" aria-selected="${k===active}" aria-controls="grid" tabindex="${k===active?'0':'-1'}">${labels[k]} <span>${cardsFor(k).length||''}</span></button>`).join('');
79
+ document.getElementById('grid').setAttribute('aria-labelledby','tab-'+active);
80
+ const buttons=[...document.querySelectorAll('.tab')];buttons.forEach((button,index)=>{button.addEventListener('click',()=>selectTab(button.dataset.tab));button.addEventListener('keydown',event=>{let next;if(event.key==='ArrowRight')next=(index+1)%buttons.length;else if(event.key==='ArrowLeft')next=(index-1+buttons.length)%buttons.length;else if(event.key==='Home')next=0;else if(event.key==='End')next=buttons.length-1;else return;event.preventDefault();selectTab(buttons[next].dataset.tab,{focus:true})})});
81
+ }
82
+ function renderGrid(){
83
+ const rows=cardsFor(active).filter(r=>JSON.stringify(r).toLowerCase().includes(query));
84
+ const grid=document.getElementById('grid');
85
+ if(!rows.length){grid.innerHTML=`<div class="empty">${atlas?.state==='SNAPSHOT'?'The live inventory is unavailable; snapshot counts remain visible without fabricating rows.':'No matching resources.'}</div>`;return;}
86
+ grid.innerHTML=rows.map(r=>{
87
+ const id=r.id||r.title||'Untitled'; const rev=r.revision?String(r.revision).slice(0,12):null;
88
+ const owner=r.owner||r.source_state||'source mapping pending'; const stage=r.runtime_stage||r.owner_state||null;
89
+ return `<a class="card" href="${esc(r.href||'#')}" ${String(r.href||'').startsWith('http')?'target="_blank" rel="noopener"':''}><div class="kind">${esc(r.kind||active)}</div><h3>${esc(id)}</h3><div class="meta">${rev?`<span>revision<b>${esc(rev)}</b></span>`:''}<span>owner/source<b>${esc(owner)}</b></span>${stage?`<span>state<b>${esc(stage)}</b></span>`:''}${r.license?`<span>license<b>${esc(r.license)}</b></span>`:''}</div><span class="open">Open evidence →</span></a>`;
90
+ }).join('');
91
+ }
92
+ document.getElementById('search').addEventListener('input',e=>{query=e.target.value.trim().toLowerCase();renderGrid();});
93
+ fetch(API,{headers:{accept:'application/json'}}).then(r=>{if(!r.ok)throw Error('HTTP '+r.status);return r.json()}).then(d=>{
94
+ atlas=d;const state=document.getElementById('atlas-state');const normalized=String(d.state||'UNAVAILABLE').trim().toUpperCase().replace(/[ -]+/g,'_');const evidenceStates=['LIVE','CACHED','STALE_CACHE','SNAPSHOT','DEGRADED','MODELED','OBSERVED','AVAILABLE','UNAVAILABLE'];const displayState=evidenceStates.includes(normalized)?normalized:'UNAVAILABLE';const amberStates=['CACHED','STALE_CACHE','SNAPSHOT','DEGRADED','MODELED','OBSERVED','AVAILABLE'];state.textContent=displayState;state.classList.add(displayState==='LIVE'?'live':(amberStates.includes(displayState)?'cached':'bad'));document.getElementById('atlas-time').textContent='observed '+(d.observed_at||'unknown');renderCounts();renderTabs();renderGrid();
95
+ }).catch(e=>{document.getElementById('atlas-state').textContent='UNAVAILABLE';document.getElementById('atlas-state').classList.add('bad');document.getElementById('atlas-time').textContent='inventory request failed';document.getElementById('grid').innerHTML='<div class="empty">Atlas endpoint unavailable. No rows were fabricated.</div>';});
96
+ </script>
97
+ </body>
98
+ </html>
pages/observability.html CHANGED
@@ -38,8 +38,9 @@
38
  .ribbon .sep{color:var(--dim);}
39
  .ribbon .teal{color:var(--teal);}
40
  .ribbon .live{display:inline-flex;align-items:center;gap:0.4rem;color:var(--cream);}
41
- .ribbon a{margin-left:auto;color:var(--muted);text-decoration:none;}
42
- .ribbon a:hover{color:var(--gold);}
 
43
  .live-dot{width:6px;height:6px;border-radius:50%;background:var(--live);
44
  box-shadow:0 0 6px var(--live);animation:pulseDot 2.2s ease-in-out infinite;}
45
  @keyframes pulseDot{0%,100%{opacity:1;}50%{opacity:.35;}}
@@ -163,7 +164,7 @@
163
  <span>AI OBSERVABILITY</span><span class="sep">/</span>
164
  <span>MELT · SIGNED TRACES</span><span class="sep">/</span>
165
  <span class="live"><span class="live-dot"></span>LIVE · RT</span>
166
- <a href="/warhacker">Warhacker &rarr;</a>
167
  </div>
168
 
169
  <section class="hero">
 
38
  .ribbon .sep{color:var(--dim);}
39
  .ribbon .teal{color:var(--teal);}
40
  .ribbon .live{display:inline-flex;align-items:center;gap:0.4rem;color:var(--cream);}
41
+ .ribbon .navlinks{margin-left:auto;display:flex;gap:.8rem;align-items:center;}
42
+ .ribbon .navlinks a{color:var(--muted);text-decoration:none;}
43
+ .ribbon .navlinks a:hover{color:var(--gold);}
44
  .live-dot{width:6px;height:6px;border-radius:50%;background:var(--live);
45
  box-shadow:0 0 6px var(--live);animation:pulseDot 2.2s ease-in-out infinite;}
46
  @keyframes pulseDot{0%,100%{opacity:1;}50%{opacity:.35;}}
 
164
  <span>AI OBSERVABILITY</span><span class="sep">/</span>
165
  <span>MELT · SIGNED TRACES</span><span class="sep">/</span>
166
  <span class="live"><span class="live-dot"></span>LIVE · RT</span>
167
+ <nav class="navlinks" aria-label="a11oy navigation"><a href="/">Home</a><a href="/ecosystem">Ecosystem</a><a href="/anatomy-v5">Anatomy v5</a><a href="/console">Console</a></nav>
168
  </div>
169
 
170
  <section class="hero">
pages/superpowers.html CHANGED
@@ -40,6 +40,9 @@
40
  .ribbon .sep{color:var(--dim);}
41
  .ribbon .teal{color:var(--teal);}
42
  .ribbon .live{display:inline-flex;align-items:center;gap:0.4rem;color:var(--cream);}
 
 
 
43
  .live-dot{width:6px;height:6px;border-radius:50%;background:var(--live);
44
  box-shadow:0 0 6px var(--live);animation:pulseDot 2.2s ease-in-out infinite;}
45
  @keyframes pulseDot{0%,100%{opacity:1;}50%{opacity:.35;}}
@@ -138,6 +141,7 @@
138
  <span>DOCTRINE V11 · LOCKED</span><span class="sep">/</span>
139
  <span>REPLAY c7c0ba17</span><span class="sep">/</span>
140
  <span class="live"><span class="live-dot"></span>LIVE · RT</span>
 
141
  </div>
142
 
143
  <!-- ===== HERO ===== -->
 
40
  .ribbon .sep{color:var(--dim);}
41
  .ribbon .teal{color:var(--teal);}
42
  .ribbon .live{display:inline-flex;align-items:center;gap:0.4rem;color:var(--cream);}
43
+ .ribbon .navlinks{margin-left:auto;display:flex;gap:.8rem;align-items:center;}
44
+ .ribbon .navlinks a{color:var(--muted);text-decoration:none;}
45
+ .ribbon .navlinks a:hover{color:var(--gold);}
46
  .live-dot{width:6px;height:6px;border-radius:50%;background:var(--live);
47
  box-shadow:0 0 6px var(--live);animation:pulseDot 2.2s ease-in-out infinite;}
48
  @keyframes pulseDot{0%,100%{opacity:1;}50%{opacity:.35;}}
 
141
  <span>DOCTRINE V11 · LOCKED</span><span class="sep">/</span>
142
  <span>REPLAY c7c0ba17</span><span class="sep">/</span>
143
  <span class="live"><span class="live-dot"></span>LIVE · RT</span>
144
+ <nav class="navlinks" aria-label="a11oy navigation"><a href="/">Home</a><a href="/ecosystem">Ecosystem</a><a href="/anatomy-v5">Anatomy v5</a><a href="/console">Console</a></nav>
145
  </div>
146
 
147
  <!-- ===== HERO ===== -->
serve.py CHANGED
@@ -2894,17 +2894,25 @@ try:
2894
  "layer": "a11oy readiness tab-matrix",
2895
  "honest": True,
2896
  "available": False,
 
 
2897
  "note": ("tabs.json not bundled with this deploy; generate it with "
2898
  "tools/readiness-harness/gen_tabs_matrix.py"),
2899
  "checked_at": _now,
2900
  }, status_code=200)
2901
- if verdict is not None:
 
2902
  verdict = dict(verdict)
2903
  verdict["available"] = True
2904
  return _RDJSON({
2905
  "layer": "a11oy readiness tab-matrix",
2906
  "honest": True,
2907
- "available": True,
 
 
 
 
 
2908
  "matrix": matrix,
2909
  "verdict": verdict or {
2910
  "available": False,
@@ -6414,13 +6422,13 @@ print("[a11oy] PARITY BLOCK v2 registered BEFORE proxy: /api/a11oy/v1/{lambda,ho
6414
  # ===========================================================================
6415
 
6416
  # ===========================================================================
6417
- # ADDITIVE (FUNCTIONAL-PROOF squad, 2026-06-04): live /v1/router/stats.
6418
  # The landing-page "LLM-Router Live" 3D scene (/static/viz/router/) polls
6419
  # /v1/router/stats every 1s and otherwise renders "DEMO MODE". The endpoint
6420
  # did not exist (404 -> the scene fell back to demo), so the advertised "live
6421
- # data binding · sovereign mode" claim was unproven. This serves REAL router
6422
- # state derived from the in-process szl_brain.TIERS catalog (no fabrication):
6423
- # one route per tier, throughput = live token-bucket counter incremented per
6424
  # poll, in the {routes:[{organ,tier,model,throughput,license}], servedThisWindow}
6425
  # shape the scene's normalizeStats() consumes. Registered at BOTH the root path
6426
  # (HF proxy strips /api/a11oy) and the /api/a11oy/v1 path, BEFORE the catch-all
@@ -6433,9 +6441,10 @@ print("[a11oy] PARITY BLOCK v2 registered BEFORE proxy: /api/a11oy/v1/{lambda,ho
6433
  import time as _rtr_time
6434
 
6435
  def _a11oy_router_stats_payload() -> dict:
6436
- """Live per-tier router stats from the real szl_brain catalog. Deterministic
6437
- throughput from a time-seeded counter (honest: in-memory, resets on rebuild)."""
6438
- tiers = _a11oy_pr_brain.TIERS if _A11OY_BRAIN_OK else [
 
6439
  {"id": "claude_sonnet_4_6", "rank": 0},
6440
  {"id": "gemini_3_1_pro", "rank": 1},
6441
  {"id": "gpt_5_4", "rank": 2},
@@ -6464,21 +6473,24 @@ def _a11oy_router_stats_payload() -> dict:
6464
  })
6465
  served += tp
6466
  return {
6467
- "mode": "live",
 
 
 
6468
  "routes": routes,
6469
  "servedThisWindow": served,
6470
  "tiers": [f"T{int(t.get('rank', i))}" for i, t in enumerate(tiers)],
6471
- "source": "szl_brain.TIERS" if _A11OY_BRAIN_OK else "honest_stub_catalog",
6472
  "doctrine": "v11",
6473
- "honesty": ("Throughput is a live in-memory counter (resets on Space rebuild). "
6474
- "Tier catalog + license classes are real; per-poll throughput is "
6475
- "deterministic, not a production traffic meter."),
6476
  }
6477
 
6478
  @app.get("/api/a11oy/v1/router/stats")
6479
  @app.get("/v1/router/stats")
6480
  async def _a11oy_router_stats() -> JSONResponse:
6481
- """Live LLM-router per-tier stats (feeds the /static/viz/router/ 3D scene)."""
6482
  return JSONResponse(_a11oy_router_stats_payload())
6483
 
6484
  print("[a11oy] router/stats registered BEFORE proxy: /api/a11oy/v1/router/stats + /v1/router/stats", file=sys.stderr)
@@ -8556,19 +8568,21 @@ def _r3d_loop_meta(r: dict):
8556
  def _r3d_router_metrics_payload() -> dict:
8557
  rs = _a11oy_router_stats_payload()
8558
  routes = rs.get("routes", [])
8559
- live = rs.get("source") == "szl_brain.TIERS"
8560
  return {
8561
- "data_kind": "live" if live else "sample",
8562
- "mode": rs.get("mode", "live"),
 
 
 
8563
  "routes": routes,
8564
  "tiers": routes,
8565
  "servedThisWindow": rs.get("servedThisWindow", 0),
8566
  "width_depth_available": False,
8567
  "source": rs.get("source", ""),
8568
  "doctrine": "v11",
8569
- "honesty": ("Per-tier throughput / model / license from the router catalog -- LIVE "
8570
- "when the brain catalog (szl_brain.TIERS) is up, else honest_stub_catalog fallback "
8571
- "with data_kind DOWNGRADED to sample. Model width/depth shape is NOT measured, so any "
8572
  "width/depth scaling point stays a clearly-labelled SAMPLE. "
8573
  "Lambda = Conjecture 1; locked-proven stays exactly 8 " + _R3D_LOCKED8 + "."),
8574
  }
@@ -8582,10 +8596,12 @@ def _r3d_routing_graph_payload() -> dict:
8582
  edges = [{"source": routes[i].get("tier"), "target": routes[i + 1].get("tier")}
8583
  for i in range(len(routes) - 1)]
8584
  ch = _r3d_chain(50)
8585
- live = rs.get("source") == "szl_brain.TIERS"
8586
  return {
8587
- "data_kind": "live" if live else "sample",
8588
- "mode": rs.get("mode", "live"),
 
 
 
8589
  "nodes": nodes,
8590
  "edges": edges,
8591
  "routes": routes,
@@ -8594,10 +8610,9 @@ def _r3d_routing_graph_payload() -> dict:
8594
  "surface": ("GraphRouter routing-envelope score s = lambda*e_hat - (1-lambda)*c_hat "
8595
  "is a DERIVED heuristic, never a measured loss"),
8596
  "doctrine": "v11",
8597
- "honesty": ("Routing nodes/edges are the /router/stats per-tier catalog -- LIVE when the "
8598
- "brain catalog (szl_brain.TIERS) is up, else honest_stub_catalog fallback with "
8599
- "data_kind DOWNGRADED to sample (real "
8600
- "organ -> tier -> model escalation path); receipts are the real in-image "
8601
  "chain. The manifold surface is a derived heuristic, never a measured loss. "
8602
  "Lambda = Conjecture 1; locked-proven stays exactly 8 " + _R3D_LOCKED8 + "."),
8603
  }
@@ -13761,11 +13776,11 @@ try:
13761
 
13762
  _a11oy_source_observation = {
13763
  "repository": "szl-holdings/a11oy",
13764
- "commit": "2ca22d0b337805a2d4e7e65af3f6738c401431a4",
13765
  "path": "",
13766
  "relation": "declared-source-with-hf-overlay",
13767
  "state": "VERIFIED_REFERENCE",
13768
- "evidence_url": "https://github.com/szl-holdings/a11oy/commit/2ca22d0b337805a2d4e7e65af3f6738c401431a4",
13769
  }
13770
  _szl_source_result = _szl_source_attestation.register(
13771
  app,
@@ -13843,6 +13858,26 @@ except Exception as _quant_signals_error: # additive: never take down the SPA
13843
  )
13844
 
13845
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
13846
  if __name__ == "__main__":
13847
  import uvicorn
13848
  port = int(os.environ.get("PORT", "7860"))
 
2894
  "layer": "a11oy readiness tab-matrix",
2895
  "honest": True,
2896
  "available": False,
2897
+ "matrix_available": False,
2898
+ "probe_verdict_available": False,
2899
  "note": ("tabs.json not bundled with this deploy; generate it with "
2900
  "tools/readiness-harness/gen_tabs_matrix.py"),
2901
  "checked_at": _now,
2902
  }, status_code=200)
2903
+ _verdict_available = verdict is not None
2904
+ if _verdict_available:
2905
  verdict = dict(verdict)
2906
  verdict["available"] = True
2907
  return _RDJSON({
2908
  "layer": "a11oy readiness tab-matrix",
2909
  "honest": True,
2910
+ # ``available`` now means a deployment probe verdict is available,
2911
+ # not merely that the static tab inventory was bundled. Keep the
2912
+ # two facts separate so a matrix can never become a green deploy.
2913
+ "available": _verdict_available,
2914
+ "matrix_available": True,
2915
+ "probe_verdict_available": _verdict_available,
2916
  "matrix": matrix,
2917
  "verdict": verdict or {
2918
  "available": False,
 
6422
  # ===========================================================================
6423
 
6424
  # ===========================================================================
6425
+ # ADDITIVE (FUNCTIONAL-PROOF squad, 2026-06-04): modeled /v1/router/stats.
6426
  # The landing-page "LLM-Router Live" 3D scene (/static/viz/router/) polls
6427
  # /v1/router/stats every 1s and otherwise renders "DEMO MODE". The endpoint
6428
  # did not exist (404 -> the scene fell back to demo), so the advertised "live
6429
+ # data binding · sovereign mode" claim was unproven. This serves a REAL catalog
6430
+ # observation plus explicitly MODELED load derived from szl_brain.TIERS:
6431
+ # one route per tier, throughput = deterministic time-derived display signal per
6432
  # poll, in the {routes:[{organ,tier,model,throughput,license}], servedThisWindow}
6433
  # shape the scene's normalizeStats() consumes. Registered at BOTH the root path
6434
  # (HF proxy strips /api/a11oy) and the /api/a11oy/v1 path, BEFORE the catch-all
 
6441
  import time as _rtr_time
6442
 
6443
  def _a11oy_router_stats_payload() -> dict:
6444
+ """Catalog-derived routes with explicitly MODELED, non-traffic throughput."""
6445
+ _real_tiers = getattr(_a11oy_pr_brain, "TIERS", None) if _A11OY_BRAIN_OK else None
6446
+ _catalog_live = isinstance(_real_tiers, list) and bool(_real_tiers)
6447
+ tiers = _real_tiers if _catalog_live else [
6448
  {"id": "claude_sonnet_4_6", "rank": 0},
6449
  {"id": "gemini_3_1_pro", "rank": 1},
6450
  {"id": "gpt_5_4", "rank": 2},
 
6473
  })
6474
  served += tp
6475
  return {
6476
+ "state": "MODELED",
6477
+ "mode": "modeled",
6478
+ "catalog_state": "LIVE" if _catalog_live else "FALLBACK",
6479
+ "throughput_state": "MODELED",
6480
  "routes": routes,
6481
  "servedThisWindow": served,
6482
  "tiers": [f"T{int(t.get('rank', i))}" for i, t in enumerate(tiers)],
6483
+ "source": "szl_brain.TIERS" if _catalog_live else "honest_stub_catalog",
6484
  "doctrine": "v11",
6485
+ "honesty": ("Tier catalog state is reported separately. Throughput and "
6486
+ "servedThisWindow are deterministic MODELED display signals, not "
6487
+ "production traffic, measured QPS, or completed inference."),
6488
  }
6489
 
6490
  @app.get("/api/a11oy/v1/router/stats")
6491
  @app.get("/v1/router/stats")
6492
  async def _a11oy_router_stats() -> JSONResponse:
6493
+ """Catalog routes plus modeled load (feeds the /static/viz/router/ 3D scene)."""
6494
  return JSONResponse(_a11oy_router_stats_payload())
6495
 
6496
  print("[a11oy] router/stats registered BEFORE proxy: /api/a11oy/v1/router/stats + /v1/router/stats", file=sys.stderr)
 
8568
  def _r3d_router_metrics_payload() -> dict:
8569
  rs = _a11oy_router_stats_payload()
8570
  routes = rs.get("routes", [])
 
8571
  return {
8572
+ "state": "MODELED",
8573
+ "data_kind": "modeled",
8574
+ "mode": "modeled",
8575
+ "catalog_state": rs.get("catalog_state", "FALLBACK"),
8576
+ "throughput_state": "MODELED",
8577
  "routes": routes,
8578
  "tiers": routes,
8579
  "servedThisWindow": rs.get("servedThisWindow", 0),
8580
  "width_depth_available": False,
8581
  "source": rs.get("source", ""),
8582
  "doctrine": "v11",
8583
+ "honesty": ("Per-tier model and license come from the router catalog; catalog_state says whether "
8584
+ "that catalog is live or fallback. Throughput and display load remain MODELED, never "
8585
+ "measured traffic or QPS. Model width/depth shape is NOT measured, so any "
8586
  "width/depth scaling point stays a clearly-labelled SAMPLE. "
8587
  "Lambda = Conjecture 1; locked-proven stays exactly 8 " + _R3D_LOCKED8 + "."),
8588
  }
 
8596
  edges = [{"source": routes[i].get("tier"), "target": routes[i + 1].get("tier")}
8597
  for i in range(len(routes) - 1)]
8598
  ch = _r3d_chain(50)
 
8599
  return {
8600
+ "state": "MODELED",
8601
+ "data_kind": "modeled",
8602
+ "mode": "modeled",
8603
+ "catalog_state": rs.get("catalog_state", "FALLBACK"),
8604
+ "throughput_state": "MODELED",
8605
  "nodes": nodes,
8606
  "edges": edges,
8607
  "routes": routes,
 
8610
  "surface": ("GraphRouter routing-envelope score s = lambda*e_hat - (1-lambda)*c_hat "
8611
  "is a DERIVED heuristic, never a measured loss"),
8612
  "doctrine": "v11",
8613
+ "honesty": ("Routing nodes/edges use the /router/stats catalog; catalog_state distinguishes "
8614
+ "the live brain catalog from the honest fallback. Throughput remains MODELED, never "
8615
+ "traffic or QPS. The organ -> tier -> model escalation path is catalog data; receipts are the real in-image "
 
8616
  "chain. The manifold surface is a derived heuristic, never a measured loss. "
8617
  "Lambda = Conjecture 1; locked-proven stays exactly 8 " + _R3D_LOCKED8 + "."),
8618
  }
 
13776
 
13777
  _a11oy_source_observation = {
13778
  "repository": "szl-holdings/a11oy",
13779
+ "commit": "a077208dfa8b8be54b271a277b8c27092422c7e7",
13780
  "path": "",
13781
  "relation": "declared-source-with-hf-overlay",
13782
  "state": "VERIFIED_REFERENCE",
13783
+ "evidence_url": "https://github.com/szl-holdings/a11oy/commit/a077208dfa8b8be54b271a277b8c27092422c7e7",
13784
  }
13785
  _szl_source_result = _szl_source_attestation.register(
13786
  app,
 
13858
  )
13859
 
13860
 
13861
+ # ============================================================================
13862
+ # ECOSYSTEM ATLAS + ANATOMY V5 (2026-07-16): one versioned public inventory
13863
+ # projection for models, governed kernels, datasets, Spaces, collections, and
13864
+ # buckets, plus real /ecosystem category deep links and the read-only Anatomy v5
13865
+ # digital twin. The API labels LIVE/CACHED/SNAPSHOT/UNAVAILABLE and leaves rows
13866
+ # empty when only snapshot counts exist. Front-inserted so these exact routes win
13867
+ # over the SPA fallback; additive and non-fatal.
13868
+ # ============================================================================
13869
+ try:
13870
+ import a11oy_ecosystem_atlas as _a11oy_ecosystem_atlas
13871
+
13872
+ _ecosystem_atlas_result = _a11oy_ecosystem_atlas.register(app, ns="a11oy")
13873
+ print(f"[a11oy] ecosystem atlas registered (front-moved): {_ecosystem_atlas_result}", file=sys.stderr)
13874
+ except Exception as _ecosystem_atlas_error:
13875
+ print(
13876
+ f"[a11oy] ecosystem atlas NOT registered (non-fatal): {_ecosystem_atlas_error!r}",
13877
+ file=sys.stderr,
13878
+ )
13879
+
13880
+
13881
  if __name__ == "__main__":
13882
  import uvicorn
13883
  port = int(os.environ.get("PORT", "7860"))
szl_dark_surfaces_register.py CHANGED
@@ -118,8 +118,17 @@ def register(app: Any, ns: str = "a11oy") -> List[str]:
118
  if callable(include_router):
119
  # Documented path: /api/<ns>/v1/ayni (+ /replay, /tinkuy). Resolves LOCALLY.
120
  app.include_router(_ayni_router, prefix=f"/api/{ns}")
121
- # Legacy path: bare /v1/ayni additive back-compat, breaks no caller.
122
- app.include_router(_ayni_router)
 
 
 
 
 
 
 
 
 
123
  included = True
124
  else:
125
  # Bare Starlette fallback: splice the router's routes onto app.router at
 
118
  if callable(include_router):
119
  # Documented path: /api/<ns>/v1/ayni (+ /replay, /tinkuy). Resolves LOCALLY.
120
  app.include_router(_ayni_router, prefix=f"/api/{ns}")
121
+ # Legacy paths: current FastAPI versions de-duplicate a second inclusion
122
+ # of the same APIRouter object, even when its prefix differs. Append the
123
+ # original APIRoute objects instead so the claimed bare /v1/* contract is
124
+ # actually present while the prefixed clones remain untouched.
125
+ existing_paths = {
126
+ getattr(route, "path", None) for route in app.router.routes
127
+ }
128
+ for route in getattr(_ayni_router, "routes", []):
129
+ if getattr(route, "path", None) not in existing_paths:
130
+ app.router.routes.append(route)
131
+ existing_paths.add(getattr(route, "path", None))
132
  included = True
133
  else:
134
  # Bare Starlette fallback: splice the router's routes onto app.router at
szl_spaces_proxy.py CHANGED
@@ -1,444 +1,314 @@
1
  #!/usr/bin/env python3
2
  # SPDX-License-Identifier: Apache-2.0
3
  # © 2026 Lutar, Stephen P. — SZL Holdings · ORCID 0009-0001-0110-4173
4
- """szl_spaces_proxy.py surface the live HF Spaces estate under a-11-oy.com/spaces/*.
5
 
6
- ADDITIVE, self-contained, SHARED (byte-identical in a11oy + killinchu). Founder rule:
7
- "all the huggingface on my a-11-oy.com" with NO new subdomains. This module reverse-
8
- proxies each live Hugging Face Space to a same-origin path:
9
 
10
- GET/HEAD /spaces -> index (delegates to szl_spaces_surface tiles if
11
- present; else a minimal honest index of the 11)
12
- GET/HEAD /spaces/{name} -> reverse-proxy of https://szlholdings-{name}.hf.space/
13
- GET/HEAD /spaces/{name}/{path} -> reverse-proxy of that Space's sub-paths/assets
 
 
14
 
15
- The proxy is a SERVER-SIDE fetch over the app's shared httpx.AsyncClient (resolved
16
- lazily from serve.py's module global, like szl_engine_status), NOT a browser CDN load —
17
- so it satisfies the 0-runtime-CDN doctrine for the same reason a11oy_hf_assets.py states
18
- (server-side fetch, not a browser CDN). HTML responses get a <base href="/spaces/{name}/">
19
- injected so the Space's root-relative assets resolve back through this proxy.
20
 
21
- HONEST DEGRADE: upstream timeout / connect error / unreachable -> a clean 502 page
22
- ("Space <name> is starting / unreachable open directly: <hf.space url>"). NEVER a fake
23
- 200. Hop-by-hop headers are stripped. The proxy is an ALLOWLIST of the known Space names
24
- only (no open proxy); unknown names -> 404. a11oy is NOT self-proxied (would loop) and
25
- killinchu is served on its own host — both are listed as TILES (by szl_spaces_surface)
26
- linking to their canonical hosts, but are NOT in the reverse-proxy allowlist here.
27
-
28
- No auth token is forwarded to HF — these are PUBLIC Spaces.
29
-
30
- Routes are inserted at the FRONT of app.router.routes (app.router.routes[0:0] = new)
31
- so they win over the /api/<ns>/{path:path} Node proxy + the /{full_path:path} SPA
32
- catch-all (the same route-to-front idiom a11oy_hf_assets.py uses).
33
-
34
- Doctrine v11: locked-proven = EXACTLY 8 {F1,F4,F7,F11,F12,F18,F19,F22} @ c7c0ba17;
35
- Λ = Conjecture 1; Khipu = Conjecture 2; trust never 100%; 0 runtime CDN (server-side
36
- fetch); no user-visible codenames (Space names are their own honest titles); never
37
- commits a key; additive-only; never weakens a gate; honest 502 beats a fake 200.
38
 
39
  Signed-off-by: Stephen Lutar <stephenlutar2@gmail.com>
40
- Co-Authored-By: Perplexity Computer Agent <agent@perplexity.ai>
41
  """
42
  from __future__ import annotations
43
 
 
44
  import sys
45
  from typing import Any
 
46
 
47
  _ORG_PREFIX = "szlholdings-"
48
-
49
- # The 11 live Spaces (all RUNNING). app URL pattern: https://szlholdings-<name>.hf.space
50
- # PROXY allowlist = the names we reverse-proxy under /spaces/<name>. We SKIP:
51
- # - "a11oy" : self-proxy would loop (a-11-oy.com IS the a11oy Space).
52
- # - "killinchu": served on its own host; we link the tile to its host, never proxy it.
53
- # Both skipped names are still listed as TILES by szl_spaces_surface.
54
- ALL_SPACES = [
55
- "immune", "sda", "anatomy", "cathedral", "energy", "yarqa",
56
- "khipu-constellation", "llm-router-live", "hatun-mcp", "a11oy", "killinchu",
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
57
  ]
58
- # Names we DO reverse-proxy (allowlist). Order preserved for the fallback index.
59
- PROXY_SPACES = [n for n in ALL_SPACES if n not in ("a11oy", "killinchu")]
 
 
 
 
 
 
 
 
 
 
 
60
 
61
 
62
- def hf_url(name: str) -> str:
63
- """Canonical HF app URL for a Space name (lowercase, org-prefixed)."""
64
- return f"https://{_ORG_PREFIX}{name}.hf.space"
65
 
 
 
 
 
66
 
67
- # Hop-by-hop headers (RFC 7230 §6.1) — never forwarded across the proxy boundary.
68
- _HOP_BY_HOP = {
69
- "connection", "keep-alive", "proxy-authenticate", "proxy-authorization",
70
- "te", "trailers", "transfer-encoding", "upgrade",
71
- # content-encoding/length are recomputed by our Response; strip to avoid mismatch.
72
- "content-encoding", "content-length",
73
- }
74
 
75
- _PROXY_TIMEOUT = 20.0 # the box egress to *.hf.space flaps; give a full page GET room
76
- # to ride through a flap (the health HEAD probe needs less).
77
- _PROXY_RETRIES = 3 # retry a transient flap several times before honest-degrading.
78
- _MAX_BYTES = 25 * 1024 * 1024 # 25MB cap per proxied response (Spaces are light pages).
79
 
 
 
 
80
 
81
- def _honest_502(name: str) -> bytes:
82
- """Clean 502 page NEVER a fake 200. Tells the user to open the Space directly."""
83
- url = hf_url(name)
84
- return (
85
- "<!doctype html><html lang=\"en\"><head><meta charset=\"utf-8\">"
86
- "<meta name=\"viewport\" content=\"width=device-width,initial-scale=1\">"
87
- "<title>Space %s — starting / unreachable</title></head>"
88
- "<body style=\"margin:0;background:#0b0f14;color:#cdd6e0;"
89
- "font:15px/1.6 system-ui,-apple-system,Segoe UI,Roboto,sans-serif;"
90
- "display:flex;min-height:100vh;align-items:center;justify-content:center\">"
91
- "<main style=\"max-width:560px;padding:2rem;text-align:center\">"
92
- "<div style=\"font-size:2.2rem;margin-bottom:.4rem\">&#9889;</div>"
93
- "<h1 style=\"font-size:1.25rem;margin:0 0 .6rem;color:#e7eef6\">"
94
- "Space &ldquo;%s&rdquo; is starting or unreachable</h1>"
95
- "<p style=\"color:#8a96a3;margin:0 0 1.2rem\">The upstream Hugging Face Space did "
96
- "not respond in time. This is an honest 502 &mdash; not a faked page. "
97
- "It usually means the Space is waking from sleep; try again shortly.</p>"
98
- "<p><a href=\"%s\" style=\"color:#d4a444;text-decoration:none;font-weight:600\">"
99
- "Open %s directly on Hugging Face &rarr;</a></p>"
100
- "<p style=\"margin-top:1.4rem\"><a href=\"/spaces\" "
101
- "style=\"color:#7c8794;text-decoration:none\">&larr; All Spaces</a></p>"
102
- "</main></body></html>" % (name, name, url, name)
103
- ).encode("utf-8")
104
 
105
 
106
  def _fallback_index() -> bytes:
107
- """Minimal honest /spaces index used ONLY if szl_spaces_surface (the rich tiles
108
- page) is not registered. Lists every Space name with both links. 0 CDN."""
109
  rows = []
110
- for name in ALL_SPACES:
111
- if name in ("a11oy", "killinchu"):
112
- local = hf_url(name) # own canonical host (not self-proxied here)
113
- local_label = "Open on HF"
114
- else:
115
- local = "/spaces/%s" % name
116
- local_label = "Open in a-11-oy.com"
117
  rows.append(
118
- "<li style=\"margin:.4rem 0\"><strong style=\"color:#e7eef6\">%s</strong> "
119
- "&middot; <a href=\"%s\" style=\"color:#d4a444;text-decoration:none\">%s</a> "
120
- "&middot; <a href=\"%s\" style=\"color:#7c8794;text-decoration:none\">Open on HF</a>"
121
- "</li>" % (name, local, local_label, hf_url(name))
 
 
 
122
  )
123
  return (
124
- "<!doctype html><html lang=\"en\"><head><meta charset=\"utf-8\">"
125
- "<meta name=\"viewport\" content=\"width=device-width,initial-scale=1\">"
126
- "<title>Spaces</title></head>"
127
- "<body style=\"margin:0;background:#0b0f14;color:#cdd6e0;"
128
- "font:15px/1.6 system-ui,-apple-system,Segoe UI,Roboto,sans-serif;padding:2rem\">"
129
- "<main style=\"max-width:760px;margin:0 auto\">"
130
- "<h1 style=\"color:#e7eef6\">Hugging Face Spaces</h1>"
131
- "<p style=\"color:#8a96a3\">All live Spaces, surfaced under a-11-oy.com. "
132
- "Server-side reverse proxy &mdash; 0 browser CDN.</p>"
133
- "<ul style=\"list-style:none;padding:0\">" + "".join(rows) + "</ul>"
 
 
 
 
134
  "</main></body></html>"
135
  ).encode("utf-8")
136
 
137
 
138
- def _resolve_client() -> Any:
139
- """Resolve the app's shared httpx.AsyncClient lazily from serve.py's module global
140
- (same idiom as szl_engine_status) so registration order doesn't matter."""
141
  try:
142
- import serve as _serve # type: ignore
143
- return getattr(_serve, "_http_client", None)
144
- except Exception:
145
  return None
 
 
 
146
 
147
 
148
- def _urllib_fetch(method: str, url: str, headers: dict, timeout: float):
149
- """Blocking stdlib fetch the PROVEN-working outbound path on the live box
150
- (a11oy_hf_assets.py reaches HF via urllib server-side). Used as a fallback when the
151
- shared httpx.AsyncClient is None or fails. Returns (status, body_bytes, headers_dict).
152
- Raises on failure (caller degrades to an honest 502). 0 browser CDN; no auth token."""
153
- import http.client
154
- import urllib.error
155
- import urllib.request
156
- req = urllib.request.Request(url, method=method.upper(), headers=headers)
157
- try:
158
- with urllib.request.urlopen(req, timeout=timeout) as r:
159
- status = getattr(r, "status", None) or r.getcode()
160
- hdrs = {k: v for k, v in r.headers.items()}
161
- # Read the body TOLERANTLY: a flapping upstream often drops the connection
162
- # mid-stream (http.client.IncompleteRead). The status line + headers already
163
- # arrived fine, so return whatever body bytes we got rather than 502-ing a
164
- # response that was really a 200. This is honest: status reflects the REAL
165
- # upstream status; we just don't discard a near-complete page over a late EOF.
166
- try:
167
- body = r.read(_MAX_BYTES)
168
- except http.client.IncompleteRead as ire:
169
- body = ire.partial or b""
170
- except Exception:
171
- body = b""
172
- return status, body, hdrs
173
- except urllib.error.HTTPError as he: # a real upstream non-2xx is NOT a flap
174
- body = b""
175
- try:
176
- body = he.read(_MAX_BYTES)
177
- except Exception:
178
- pass
179
- return he.code, body, {k: v for k, v in (he.headers or {}).items()}
180
-
181
-
182
- async def _to_thread(fn, *a, **kw):
183
- import asyncio as _asyncio
184
- return await _asyncio.get_event_loop().run_in_executor(None, lambda: fn(*a, **kw))
185
-
186
-
187
- def _rewrite_html(body: bytes, name: str) -> bytes:
188
- """Inject <base href="/spaces/<name>/"> so the Space's root-relative asset URLs
189
- (e.g. /assets/app.js, href="/"...) resolve back through this proxy. Idempotent:
190
- if a base href for this proxy is already present, leave the body untouched."""
191
- base_tag = ('<base href="/spaces/%s/">' % name).encode("utf-8")
192
- if base_tag in body:
193
- return body
194
- low = body.lower()
195
- # Prefer to place the <base> right after <head ...> so it applies to all assets.
196
- h = low.find(b"<head")
197
- if h != -1:
198
- gt = body.find(b">", h)
199
- if gt != -1:
200
- return body[: gt + 1] + base_tag + body[gt + 1:]
201
- # No <head> — try right after <html ...>.
202
- h = low.find(b"<html")
203
- if h != -1:
204
- gt = body.find(b">", h)
205
- if gt != -1:
206
- return body[: gt + 1] + base_tag + body[gt + 1:]
207
- # No usable anchor — prepend (still better than broken relative assets).
208
- return base_tag + body
209
-
210
-
211
- async def _proxy(name: str, subpath: str, request) -> Any:
212
- """Reverse-proxy one request to the named Space. Honest 502 on any upstream flap."""
213
- from starlette.responses import Response
214
-
215
- if name not in PROXY_SPACES:
216
- # Not in the allowlist — either unknown, or a deliberately-skipped self/own-host
217
- # Space. 404 (no open proxy). The skipped ones are reachable as tiles only.
218
- return Response(content=b"Unknown or non-proxied Space.\n",
219
- status_code=404, media_type="text/plain")
220
-
221
- # Resolve the shared async httpx client if it's wired. On the LIVE box serve.py runs
222
- # as __main__ (Dockerfile CMD ["python","serve.py"]), so `import serve` inside
223
- # _resolve_client() binds a SECOND module object whose startup() never fired and whose
224
- # _http_client is therefore None — even though the real __main__ app has a live client.
225
- # We must NOT 502 on a None client: the stdlib urllib path below is the PROVEN outbound
226
- # path on this box (it is exactly what szl_spaces_surface's health probe uses to report
227
- # app_reachable=true). So client==None simply means "skip httpx, use urllib" — never an
228
- # automatic honest-502. An honest 502 is reserved for a GENUINE upstream flap (both the
229
- # httpx attempt AND the urllib fallback exhausted their retries).
230
- client = _resolve_client()
231
-
232
- target = hf_url(name) + "/" + subpath
233
- # Send a CLEAN, minimal header set rather than forwarding the raw browser headers.
234
- # Forwarding the incoming Host (a-11-oy.com) makes HF route to the wrong vhost -> 404,
235
- # and forwarding the full browser header set (incl. Accept-Encoding: br, X-Forwarded-*)
236
- # was tripping the upstream fetch on the live box. We mirror the proven-working probe:
237
- # identity encoding, a simple UA, and only the few request headers that are safe to
238
- # pass through. No Host, no cookies, no auth token (public Spaces).
239
- _SAFE_PASS = {"accept", "accept-language", "range", "content-type"}
240
- fwd_headers = {
241
- "User-Agent": "szl-spaces-proxy/1.0",
242
- "Accept-Encoding": "identity",
243
- }
244
- for k, v in request.headers.items():
245
- if k.lower() in _SAFE_PASS:
246
- fwd_headers[k] = v
247
- fwd_headers.setdefault("Accept", "*/*")
248
- method = request.method.upper()
249
-
250
- status = None
251
- body = b""
252
- up_headers: dict = {}
253
- last_exc = None
254
-
255
- # Try the shared async httpx client first (streaming-capable, preferred).
256
- if client is not None:
257
- for _attempt in range(_PROXY_RETRIES + 1):
258
- try:
259
- upstream = await client.request(
260
- method, target, headers=fwd_headers,
261
- timeout=_PROXY_TIMEOUT, follow_redirects=True,
262
- )
263
- status = upstream.status_code
264
- body = upstream.content or b""
265
- up_headers = {k: v for k, v in upstream.headers.items()}
266
- break
267
- except Exception as e: # connect/timeout/read error -> try fallback below
268
- last_exc = e
269
- status = None
270
- import asyncio as _a
271
- await _a.sleep(0.4 * (_attempt + 1)) # brief backoff across a flap
272
-
273
- # Fallback to the PROVEN stdlib urllib path if httpx was None or failed.
274
- if status is None:
275
- import asyncio as _a
276
- for _attempt in range(_PROXY_RETRIES + 1):
277
- try:
278
- status, body, up_headers = await _to_thread(
279
- _urllib_fetch, method, target, fwd_headers, _PROXY_TIMEOUT)
280
- break
281
- except Exception as e: # genuine upstream flap -> honest 502
282
- last_exc = e
283
- status = None
284
- await _a.sleep(0.5 * (_attempt + 1)) # brief backoff across a flap
285
-
286
- if status is None:
287
- print("[spaces-proxy] upstream flap for %s: %r" % (name, last_exc),
288
- file=sys.stderr)
289
- # Surface the real upstream error class in an honest diagnostic header (the body
290
- # stays the clean honest-502 page). Never fabricates a 200.
291
- return Response(content=_honest_502(name), status_code=502,
292
- media_type="text/html",
293
- headers={"x-szl-proxy-error": type(last_exc).__name__ if last_exc else "none",
294
- "x-szl-proxy-target": target})
295
-
296
- if len(body) > _MAX_BYTES:
297
- body = body[:_MAX_BYTES]
298
- ct = (up_headers.get("content-type") or up_headers.get("Content-Type") or "").lower()
299
-
300
- # HTML: inject <base href> so assets resolve under /spaces/<name>/.
301
- if "text/html" in ct:
302
- body = _rewrite_html(body, name)
303
-
304
- out_headers = {
305
- k: v for k, v in up_headers.items()
306
- if k.lower() not in _HOP_BY_HOP
307
- }
308
- # HEAD must carry no body.
309
- if method == "HEAD":
310
- body = b""
311
-
312
- return Response(content=body, status_code=status,
313
- headers=out_headers,
314
- media_type=ct or None)
315
-
316
-
317
- def register(app, ns: str = "a11oy") -> str:
318
- """ADDITIVE: mount the /spaces reverse-proxy routes at the FRONT of the router so
319
- they beat the SPA + Node-proxy catch-alls. try/except-guarded by the caller."""
320
  try:
321
  from starlette.responses import Response
322
- except Exception as e: # pragma: no cover
323
- return "unavailable: %r" % (e,)
 
324
 
325
  n_before = len(app.router.routes)
326
 
327
- async def _spaces_index(request):
328
- # Delegate the rich tiles page to szl_spaces_surface if it owns /spaces; this
329
- # fallback index only renders if that module isn't present. Idempotent: this
330
- # route is inserted only once per register() and register() is guarded upstream.
331
  if request.method.upper() == "HEAD":
332
- return Response(content=b"", status_code=200, media_type="text/html")
333
- return Response(content=_fallback_index(), status_code=200,
334
- media_type="text/html")
 
 
 
 
335
 
336
- async def _spaces_name(request):
337
- name = request.path_params.get("name", "")
338
- return await _proxy(name, "", request)
339
 
340
- async def _spaces_path(request):
341
- name = request.path_params.get("name", "")
342
- subpath = request.path_params.get("path", "")
343
- return await _proxy(name, subpath, request)
 
 
344
 
345
- from starlette.routing import Route
346
- # NOTE: szl_spaces_surface registers its OWN richer /spaces tiles page and inserts
347
- # it at the front AFTER this module (it's registered second in serve.py), so the
348
- # tiles page wins over this fallback index — by design. Both are idempotent.
349
  routes = [
350
- Route("/spaces", _spaces_index, methods=["GET", "HEAD"]),
351
- Route("/spaces/{name}", _spaces_name, methods=["GET", "HEAD"]),
352
- Route("/spaces/{name}/{path:path}", _spaces_path, methods=["GET", "HEAD"]),
 
 
 
 
 
353
  ]
354
- for r in routes:
355
- app.router.routes.append(r)
356
-
357
  new = app.router.routes[n_before:]
358
  del app.router.routes[n_before:]
359
  app.router.routes[0:0] = new
360
- print("[%s] Spaces reverse-proxy registered: /spaces + /spaces/{name} + "
361
- "/spaces/{name}/{path} (%d proxied: %s) [moved %d routes to front]"
362
- % (ns, len(PROXY_SPACES), ",".join(PROXY_SPACES), len(new)), file=sys.stderr)
363
- return "ok: %d proxied spaces, %d routes" % (len(PROXY_SPACES), len(new))
364
 
 
 
 
 
 
 
 
365
 
366
- # ---------------------------------------------------------------------------
367
- # Self-test — pure stdlib + starlette TestClient; no real network. Stubs the shared
368
- # client to assert: allowlist enforced (unknown -> 404), honest 502 on a dead client,
369
- # <base href> injection, HEAD carries no body, and the fallback index lists all 11.
370
- # ---------------------------------------------------------------------------
371
- if __name__ == "__main__":
372
- import ast as _ast
373
- # parse-self guard
374
- with open(__file__, "r", encoding="utf-8") as _fh:
375
- _ast.parse(_fh.read())
376
-
377
- # base-href injection
378
- out = _rewrite_html(b"<html><head><title>x</title></head><body>hi</body></html>", "immune")
379
- assert b'<base href="/spaces/immune/">' in out, "must inject base href"
380
- assert _rewrite_html(out, "immune") == out, "base href injection must be idempotent"
381
-
382
- # honest 502 content
383
- p = _honest_502("sda")
384
- assert b"honest 502" in p and b"szlholdings-sda.hf.space" in p, "502 must be honest + direct link"
385
 
386
- # allowlist
387
- assert "a11oy" not in PROXY_SPACES and "killinchu" not in PROXY_SPACES, "self/own-host skipped"
388
- assert len(ALL_SPACES) == 11 and len(PROXY_SPACES) == 9, (len(ALL_SPACES), len(PROXY_SPACES))
389
-
390
- # fallback index lists all 11 names
391
- idx = _fallback_index()
392
- for nm in ALL_SPACES:
393
- assert nm.encode() in idx, "index missing %s" % nm
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
394
 
395
  from starlette.applications import Starlette
396
  from starlette.responses import PlainTextResponse
397
- from starlette.routing import Route as _R
398
  from starlette.testclient import TestClient
399
 
400
- a = Starlette(routes=[_R("/{full_path:path}", lambda req: PlainTextResponse("SPA"))])
401
- st = register(a, ns="a11oy")
402
- assert st.startswith("ok:"), st
403
- c = TestClient(a)
404
- # /spaces fallback index resolves before the SPA catch-all and lists all names
405
- r = c.get("/spaces")
406
- assert r.status_code == 200 and "immune" in r.text and "killinchu" in r.text, r.status_code
407
- # unknown / non-proxied name -> 404 (no open proxy); a11oy is deliberately skipped
408
- assert c.get("/spaces/a11oy").status_code == 404, "a11oy must not be self-proxied"
409
- assert c.get("/spaces/notreal").status_code == 404, "unknown -> 404"
410
- # known name, no shared client wired AND the (urllib) upstream fetch fails -> honest 502
411
- # (never a fake 200). We stub _urllib_fetch so the test is hermetic (no real network):
412
- # client==None must NOT short-circuit to 502 by itself; it must fall through to urllib,
413
- # and only a GENUINE fetch failure degrades honestly. This is the regression guard for
414
- # the live __main__/import-serve dual-module bug (client==None on the box) that was
415
- # making EVERY proxied Space 502 even though the urllib probe reached the upstream fine.
416
- # NB: stub the global in THIS running module (serve runs us as __main__, and _proxy
417
- # resolves _urllib_fetch via the module global at call time), so monkeypatch globals().
418
- _self_mod = sys.modules[__name__]
419
- _orig_fetch = _self_mod._urllib_fetch
420
- def _boom(*_a, **_k):
421
- raise OSError("simulated upstream flap")
422
- _self_mod._urllib_fetch = _boom
423
- try:
424
- r502 = c.get("/spaces/immune")
425
- assert r502.status_code == 502 and "honest 502" in r502.text, (r502.status_code, r502.text[:80])
426
- assert r502.headers.get("x-szl-proxy-error") == "OSError", r502.headers.get("x-szl-proxy-error")
427
- rh = c.head("/spaces/immune")
428
- assert rh.status_code == 502, rh.status_code
429
- finally:
430
- _self_mod._urllib_fetch = _orig_fetch
431
- # client==None + urllib SUCCESS -> 200 proxied (proves None no longer auto-502s).
432
- def _ok(method, url, headers, timeout):
433
- return 200, b"<html><head></head><body>live immune</body></html>", {"content-type": "text/html"}
434
- _self_mod._urllib_fetch = _ok
435
- try:
436
- r200 = c.get("/spaces/immune")
437
- assert r200.status_code == 200, r200.status_code
438
- assert b'<base href="/spaces/immune/">' in r200.content, "must inject base href on proxied HTML"
439
- finally:
440
- _self_mod._urllib_fetch = _orig_fetch
441
-
442
- print("szl_spaces_proxy: ALL OK (allowlist; honest 502 on genuine flap; client==None "
443
- "falls through to urllib not auto-502; base-href idempotent; "
444
- "%d proxied of %d; 0 CDN server-side fetch)" % (len(PROXY_SPACES), len(ALL_SPACES)))
 
1
  #!/usr/bin/env python3
2
  # SPDX-License-Identifier: Apache-2.0
3
  # © 2026 Lutar, Stephen P. — SZL Holdings · ORCID 0009-0001-0110-4173
4
+ """Canonical-origin handoffs for the audited Hugging Face Spaces estate.
5
 
6
+ This shared module keeps the historical ``/spaces/<slug>`` links working without
7
+ executing another Space inside the a11oy or Killinchu origin:
 
8
 
9
+ * ``GET/HEAD /spaces`` renders a minimal fallback index when the richer tiles
10
+ surface is not registered.
11
+ * ``GET/HEAD /spaces/{name}`` returns a no-store 307 to the audited Space's
12
+ canonical Hugging Face application origin.
13
+ * ``GET/HEAD /spaces/{name}/{path}`` preserves the suffix and raw query string
14
+ in the same no-store 307 handoff.
15
 
16
+ There is no upstream fetch path in this module. It never copies upstream HTML,
17
+ JavaScript, response bytes, authentication state, or ``Set-Cookie`` into the
18
+ host application. Interactive apps, streaming, cookies, and authentication stay
19
+ isolated on Hugging Face. Unknown identifiers fail closed with 404, so these
20
+ routes cannot become an open redirect.
21
 
22
+ Routes are front-inserted so exact compatibility links beat the application's
23
+ SPA catch-all. The audited 26-Space identity list is static; runtime reachability
24
+ continues to be measured honestly by ``szl_spaces_surface``.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
25
 
26
  Signed-off-by: Stephen Lutar <stephenlutar2@gmail.com>
 
27
  """
28
  from __future__ import annotations
29
 
30
+ import html
31
  import sys
32
  from typing import Any
33
+ from urllib.parse import quote
34
 
35
  _ORG_PREFIX = "szlholdings-"
36
+ _ORG = "SZLHOLDINGS"
37
+ SPACE_HANDOFF_MODE = "canonical-redirect-only/v1"
38
+
39
+ # Audited 26-Space public estate. Runtime state is deliberately absent here.
40
+ # ``slug`` is the lowercase legacy route key; SDK selects the canonical app host.
41
+ SPACE_INVENTORY: list[dict[str, str]] = [
42
+ {"name": "a11oy", "slug": "a11oy", "title": "a11oy — Command Center", "sdk": "docker"},
43
+ {"name": "anatomy", "slug": "anatomy", "title": "SZL Living Anatomy", "sdk": "docker"},
44
+ {"name": "cosmos", "slug": "cosmos", "title": "SZL Cosmos", "sdk": "docker"},
45
+ {"name": "david-leads", "slug": "david-leads", "title": "David Leads — Sovereign Insurance Intelligence", "sdk": "docker"},
46
+ {"name": "energy-attest-holo", "slug": "energy-attest-holo", "title": "Energy Attestation Holo", "sdk": "static"},
47
+ {"name": "energy-attested-runs", "slug": "energy-attested-runs", "title": "Energy-Attested Inference Runs", "sdk": "gradio"},
48
+ {"name": "governed-norm-holo", "slug": "governed-norm-holo", "title": "Governed Norms — WILLAY classifiers", "sdk": "static"},
49
+ {"name": "governed-receipt-verifier", "slug": "governed-receipt-verifier", "title": "Governed Receipt Verifier", "sdk": "static"},
50
+ {"name": "guardrail-receipt", "slug": "guardrail-receipt", "title": "Guardrail Decision-Receipt", "sdk": "gradio"},
51
+ {"name": "hatun-mcp", "slug": "hatun-mcp", "title": "hatun — MCP Server", "sdk": "docker"},
52
+ {"name": "holographic", "slug": "holographic", "title": "Holographic Estate", "sdk": "docker"},
53
+ {"name": "immune", "slug": "immune", "title": "IMMUNE — Verifiable AI Defense Matrix", "sdk": "docker"},
54
+ {"name": "killinchu", "slug": "killinchu", "title": "killinchu — Andean Drone Intelligence", "sdk": "docker"},
55
+ {"name": "lambda-gate-holo", "slug": "lambda-gate-holo", "title": "Λ Gate — Conjecture 1, never green", "sdk": "static"},
56
+ {"name": "llm-router-live", "slug": "llm-router-live", "title": "SZL LLM Router", "sdk": "docker"},
57
+ {"name": "README", "slug": "readme", "title": "SZL Holdings — Governed-AI Command Platform", "sdk": "static"},
58
+ {"name": "receipt-chain-live", "slug": "receipt-chain-live", "title": "Receipt Chain Live", "sdk": "static"},
59
+ {"name": "sda", "slug": "sda", "title": "SZL SDA", "sdk": "docker"},
60
+ {"name": "szl-blocked-live", "slug": "szl-blocked-live", "title": "szl-blocked-live", "sdk": "static"},
61
+ {"name": "szl-estate-live", "slug": "szl-estate-live", "title": "Khipu Loom — Governed AI Estate", "sdk": "static"},
62
+ {"name": "szl-forge-lab", "slug": "szl-forge-lab", "title": "SZL Forge Lab", "sdk": "gradio"},
63
+ {"name": "szl-govsign-live", "slug": "szl-govsign-live", "title": "szl-govsign-live", "sdk": "static"},
64
+ {"name": "szl-kernels-live", "slug": "szl-kernels-live", "title": "SZL Kernel Operations Hub", "sdk": "static"},
65
+ {"name": "szl-model-inference-lab", "slug": "szl-model-inference-lab", "title": "SZL Model Inference Lab", "sdk": "docker"},
66
+ {"name": "szl-provctl-live", "slug": "szl-provctl-live", "title": "szl-provctl-live", "sdk": "static"},
67
+ {"name": "yarqa", "slug": "yarqa", "title": "yarqa — Plug-Flow Compartments (live or sample, always honest)", "sdk": "docker"},
68
  ]
69
+ _SPACE_BY_NAME = {sp["name"]: sp for sp in SPACE_INVENTORY}
70
+ _SPACE_BY_SLUG = {sp["slug"]: sp for sp in SPACE_INVENTORY}
71
+
72
+ ALL_SPACES = [sp["slug"] for sp in SPACE_INVENTORY]
73
+ HANDOFF_SPACES = list(ALL_SPACES)
74
+ # Backwards-compatible public name retained for downstream inventory checks.
75
+ PROXY_SPACES = HANDOFF_SPACES
76
+
77
+ _NO_STORE_HEADERS = {
78
+ "Cache-Control": "no-store",
79
+ "Referrer-Policy": "no-referrer",
80
+ "X-SZL-Space-Handoff": "canonical-origin",
81
+ }
82
 
83
 
84
+ def _space_record(identifier: str) -> dict[str, str]:
85
+ """Resolve only audited inventory identifiers; fail closed otherwise."""
 
86
 
87
+ record = _SPACE_BY_NAME.get(identifier) or _SPACE_BY_SLUG.get(identifier)
88
+ if record is None:
89
+ raise ValueError("unknown Space identifier: %s" % identifier)
90
+ return record
91
 
 
 
 
 
 
 
 
92
 
93
+ def hf_url(name: str) -> str:
94
+ """Return the canonical isolated application origin for an audited Space."""
 
 
95
 
96
+ record = _space_record(name)
97
+ suffix = ".static.hf.space" if record["sdk"] == "static" else ".hf.space"
98
+ return f"https://{_ORG_PREFIX}{record['slug']}{suffix}"
99
 
100
+
101
+ def hf_repo_url(name: str) -> str:
102
+ """Return the canonical Hugging Face repository page for an audited Space."""
103
+
104
+ record = _space_record(name)
105
+ return f"https://huggingface.co/spaces/{_ORG}/{record['name']}"
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
106
 
107
 
108
  def _fallback_index() -> bytes:
109
+ """Render the dependency-free fallback registry with canonical links only."""
110
+
111
  rows = []
112
+ for record in SPACE_INVENTORY:
113
+ title = html.escape(record["title"])
114
+ name = html.escape(record["name"])
115
+ sdk = html.escape(record["sdk"])
116
+ canonical = html.escape(hf_url(record["slug"]), quote=True)
117
+ repository = html.escape(hf_repo_url(record["slug"]), quote=True)
 
118
  rows.append(
119
+ '<li style="margin:.4rem 0"><strong style="color:#e7eef6">%s</strong> '
120
+ '<small style="color:#697787">%s &middot; %s</small> '
121
+ '&middot; <a href="%s" rel="noopener" target="_blank" '
122
+ 'style="color:#d4a444;text-decoration:none">Open isolated app &#8599;</a> '
123
+ '&middot; <a href="%s" rel="noopener" target="_blank" '
124
+ 'style="color:#7c8794;text-decoration:none">View repository &#8599;</a></li>'
125
+ % (title, name, sdk, canonical, repository)
126
  )
127
  return (
128
+ '<!doctype html><html lang="en"><head><meta charset="utf-8">'
129
+ '<meta name="viewport" content="width=device-width,initial-scale=1">'
130
+ '<title>Hugging Face Spaces</title>'
131
+ '<style>*{box-sizing:border-box}li{overflow-wrap:anywhere}'
132
+ 'li a{display:inline-flex;align-items:center;min-height:44px;padding:.3rem .15rem}'
133
+ '@media(max-width:375px){body{padding:1rem!important}}</style></head>'
134
+ '<body style="margin:0;background:#0b0f14;color:#cdd6e0;'
135
+ 'font:15px/1.6 system-ui,-apple-system,Segoe UI,Roboto,sans-serif;padding:2rem">'
136
+ '<main style="max-width:760px;margin:0 auto">'
137
+ '<h1 style="color:#e7eef6">Hugging Face Spaces</h1>'
138
+ '<p style="color:#8a96a3">All 26 audited Spaces open on their canonical isolated '
139
+ 'Hugging Face origins. Legacy <code>/spaces/&lt;slug&gt;</code> links are no-store '
140
+ '307 handoffs; no upstream response bytes or cookies cross this application.</p>'
141
+ '<ul style="list-style:none;padding:0">' + "".join(rows) + "</ul>"
142
  "</main></body></html>"
143
  ).encode("utf-8")
144
 
145
 
146
+ def _raw_query(request: Any) -> str | None:
147
+ raw = request.scope.get("query_string", b"")
 
148
  try:
149
+ query = bytes(raw).decode("ascii")
150
+ except (UnicodeDecodeError, TypeError, ValueError):
 
151
  return None
152
+ if "\r" in query or "\n" in query:
153
+ return None
154
+ return query
155
 
156
 
157
+ async def _proxy(name: str, subpath: str, request: Any) -> Any:
158
+ """Legacy function name; perform a redirect-only canonical-origin handoff."""
159
+
160
+ from starlette.responses import RedirectResponse, Response
161
+
162
+ if name not in HANDOFF_SPACES:
163
+ return Response(
164
+ content=b"Unknown or non-handoff Space.\n",
165
+ status_code=404,
166
+ media_type="text/plain",
167
+ headers={"Cache-Control": "no-store"},
168
+ )
169
+
170
+ query = _raw_query(request)
171
+ if query is None:
172
+ return Response(
173
+ content=b"Invalid query string.\n",
174
+ status_code=400,
175
+ media_type="text/plain",
176
+ headers={"Cache-Control": "no-store"},
177
+ )
178
+
179
+ target = hf_url(name)
180
+ clean_path = subpath.lstrip("/")
181
+ if clean_path:
182
+ encoded_path = quote(clean_path, safe="/%:@!$&'()*+,;=-._~")
183
+ target += "/" + encoded_path
184
+ if query:
185
+ target += "?" + query
186
+
187
+ return RedirectResponse(target, status_code=307, headers=_NO_STORE_HEADERS)
188
+
189
+
190
+ def register(app: Any, ns: str = "a11oy") -> str:
191
+ """Front-insert the fallback index and redirect-only compatibility routes."""
192
+
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
193
  try:
194
  from starlette.responses import Response
195
+ from starlette.routing import Route
196
+ except Exception as exc: # pragma: no cover
197
+ return "unavailable: %r" % (exc,)
198
 
199
  n_before = len(app.router.routes)
200
 
201
+ async def _spaces_index(request: Any) -> Any:
202
+ headers = {"Cache-Control": "no-store"}
 
 
203
  if request.method.upper() == "HEAD":
204
+ return Response(content=b"", status_code=200, media_type="text/html", headers=headers)
205
+ return Response(
206
+ content=_fallback_index(),
207
+ status_code=200,
208
+ media_type="text/html",
209
+ headers=headers,
210
+ )
211
 
212
+ async def _spaces_name(request: Any) -> Any:
213
+ return await _proxy(request.path_params.get("name", ""), "", request)
 
214
 
215
+ async def _spaces_path(request: Any) -> Any:
216
+ return await _proxy(
217
+ request.path_params.get("name", ""),
218
+ request.path_params.get("path", ""),
219
+ request,
220
+ )
221
 
 
 
 
 
222
  routes = [
223
+ Route("/spaces", _spaces_index, methods=["GET", "HEAD"], name="spaces-fallback-index"),
224
+ Route("/spaces/{name}", _spaces_name, methods=["GET", "HEAD"], name="spaces-handoff-root"),
225
+ Route(
226
+ "/spaces/{name}/{path:path}",
227
+ _spaces_path,
228
+ methods=["GET", "HEAD"],
229
+ name="spaces-handoff-path",
230
+ ),
231
  ]
232
+ app.router.routes.extend(routes)
 
 
233
  new = app.router.routes[n_before:]
234
  del app.router.routes[n_before:]
235
  app.router.routes[0:0] = new
 
 
 
 
236
 
237
+ print(
238
+ "[%s] Spaces canonical-origin handoffs registered: /spaces + "
239
+ "/spaces/{name} + /spaces/{name}/{path} (%d audited handoffs; %d routes)"
240
+ % (ns, len(HANDOFF_SPACES), len(new)),
241
+ file=sys.stderr,
242
+ )
243
+ return "ok: %d canonical handoff spaces, %d routes" % (len(HANDOFF_SPACES), len(new))
244
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
245
 
246
+ if __name__ == "__main__":
247
+ import ast
248
+ from pathlib import Path
249
+
250
+ source = Path(__file__).read_text(encoding="utf-8")
251
+ ast.parse(source)
252
+ assert "urllib" + ".request" not in source
253
+ assert "client." + "request(" not in source
254
+ assert "upstream." + "content" not in source
255
+
256
+ assert len(ALL_SPACES) == len(HANDOFF_SPACES) == 26
257
+ assert hf_url("README") == "https://szlholdings-readme.static.hf.space"
258
+ assert hf_url("immune") == "https://szlholdings-immune.hf.space"
259
+ try:
260
+ hf_url("notreal")
261
+ raise AssertionError("unknown Space identifier must fail closed")
262
+ except ValueError:
263
+ pass
264
+
265
+ fallback = _fallback_index()
266
+ for space in SPACE_INVENTORY:
267
+ assert space["name"].encode() in fallback
268
+ assert space["title"].encode() in fallback
269
+ assert hf_url(space["slug"]).encode() in fallback
270
+ assert hf_repo_url(space["slug"]).encode() in fallback
271
+ assert b'href="/spaces/' not in fallback
272
+ assert b"reverse proxy" not in fallback.lower()
273
 
274
  from starlette.applications import Starlette
275
  from starlette.responses import PlainTextResponse
276
+ from starlette.routing import Route
277
  from starlette.testclient import TestClient
278
 
279
+ app = Starlette(routes=[Route("/{full_path:path}", lambda req: PlainTextResponse("SPA"))])
280
+ status = register(app, ns="killinchu")
281
+ assert status.startswith("ok:")
282
+ client = TestClient(app)
283
+
284
+ root = client.get(
285
+ "/spaces/immune",
286
+ headers={"Cookie": "private=session", "Authorization": "Bearer private"},
287
+ follow_redirects=False,
288
+ )
289
+ assert root.status_code == 307
290
+ assert root.headers["location"] == "https://szlholdings-immune.hf.space"
291
+ assert root.headers["cache-control"] == "no-store"
292
+ assert root.headers["x-szl-space-handoff"] == "canonical-origin"
293
+ assert "set-cookie" not in root.headers and root.content == b""
294
+
295
+ nested = client.get(
296
+ "/spaces/immune/api/events?cursor=a%2Fb&cursor=two+words",
297
+ follow_redirects=False,
298
+ )
299
+ assert nested.status_code == 307
300
+ assert nested.headers["location"] == (
301
+ "https://szlholdings-immune.hf.space/api/events?cursor=a%2Fb&cursor=two+words"
302
+ )
303
+ head = client.head("/spaces/immune/assets/app.js?build=7", follow_redirects=False)
304
+ assert head.status_code == 307 and head.content == b""
305
+ assert head.headers["location"].endswith("/assets/app.js?build=7")
306
+ assert client.get("/spaces/notreal", follow_redirects=False).status_code == 404
307
+ own = client.get("/spaces/a11oy", follow_redirects=False)
308
+ assert own.status_code == 307
309
+ assert own.headers["location"] == "https://szlholdings-a11oy.hf.space"
310
+
311
+ print(
312
+ "szl_spaces_proxy: ALL OK (26 audited redirect-only handoffs; "
313
+ "path/query preserved; no-store; no upstream bytes/Set-Cookie)"
314
+ )
 
 
 
 
 
 
 
 
 
szl_spaces_surface.py CHANGED
@@ -3,8 +3,8 @@
3
  # © 2026 Lutar, Stephen P. — SZL Holdings · ORCID 0009-0001-0110-4173
4
  """szl_spaces_surface.py — console "Spaces" surface (health API + tiles + nav).
5
 
6
- ADDITIVE, self-contained, SHARED (byte-identical in a11oy + killinchu). The console
7
- companion to szl_spaces_proxy: a LIVE health view of the whole HF Spaces estate plus a
8
  clean tiles page and ONE idempotent nav item, following the additive-injector pattern
9
  (a11oy_nav_wireup.py / killinchu_nav_wireup.py).
10
 
@@ -12,20 +12,21 @@ ROUTES (additive, inserted at the FRONT of the router so they beat the SPA + Nod
12
  catch-alls — same route-to-front idiom as a11oy_hf_assets.py):
13
 
14
  GET /api/<ns>/v1/spaces/health -> for each Space, an HONEST status:
15
- {name, title, stage, app_reachable, url, proxy_url}
16
  - stage : runtime.stage from the HF API
17
  (https://huggingface.co/api/spaces/SZLHOLDINGS/<name>),
18
  or "unknown" if that API call degrades. LABELLED as HF-API.
19
- - app_reachable : a REAL same-origin server-side probe of
20
  https://szlholdings-<name>.hf.space/ (HEAD, short timeout).
21
  true ONLY when the probe really succeeded. Never fabricated.
22
  Degrade -> stage:"unknown", app_reachable:false. NEVER a faked stage/200.
23
 
24
  GET/HEAD /spaces -> a clean tiles page (one card per Space: honest
25
- title, live status dot fed by /health, "Open in a-11-oy.com" -> /spaces/<name>,
26
- "Open on HF" -> hf.space url). Pure inline markup, 0 browser CDN. The status
27
- dots are filled by a tiny inline fetch of the SAME-ORIGIN /health JSON (not a
28
- CDN; the data is our own server-side-probed endpoint).
 
29
 
30
  NAV: a BaseHTTPMiddleware injector adds ONE nav item "Spaces" -> /spaces into the
31
  console left-nav (before <div class="side-foot">, with nav-group / nav-item fallbacks).
@@ -54,25 +55,46 @@ from typing import Any
54
 
55
  _ORG = "SZLHOLDINGS"
56
  _ORG_PREFIX = "szlholdings-"
57
-
58
- # The 11 live Spaces + their honest, public titles (NOT codenames — each Space's own
59
- # name). a11oy + killinchu are listed as tiles linking to their own canonical hosts;
60
- # they are NOT reverse-proxied by szl_spaces_proxy (self / own-host).
 
 
 
 
 
61
  SPACES: list[dict[str, str]] = [
62
- {"name": "immune", "title": "ImmuneVerifiable Screening"},
63
- {"name": "sda", "title": "SDA Space Domain Awareness"},
64
- {"name": "anatomy", "title": "Anatomy Canonical Formula Registry"},
65
- {"name": "cathedral", "title": "CathedralEstate Cathedral"},
66
- {"name": "energy", "title": "Energy Sovereign Compute"},
67
- {"name": "yarqa", "title": "Yarqa Data Channel"},
68
- {"name": "khipu-constellation", "title": "Khipu ConstellationReceipt Mesh"},
69
- {"name": "llm-router-live", "title": "LLM Router (Live)"},
70
- {"name": "hatun-mcp", "title": "Hatun MCP Server"},
71
- {"name": "a11oy", "title": "a11oyBrand Orchestration Layer"},
72
- {"name": "killinchu", "title": "Killinchu Edge Console"},
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
73
  ]
74
- # Spaces served on their OWN canonical host (not reverse-proxied here): the tile's
75
- # primary "open" link points at HF rather than /spaces/<name>.
 
76
  _OWN_HOST = {"a11oy", "killinchu"}
77
 
78
  _DOCTRINE = {
@@ -85,22 +107,47 @@ _DOCTRINE = {
85
 
86
  _PROBE_TIMEOUT = 6.0
87
  _HF_API_TIMEOUT = 6.0
88
- _HEALTH_CACHE_TTL = 20.0 # seconds — keep the tiles page snappy without re-probing 11x.
89
  _HEALTH_CACHE: dict[str, Any] = {"ts": 0.0, "payload": None}
 
 
 
 
 
 
 
 
 
90
 
91
 
92
  def hf_url(name: str) -> str:
93
- return f"https://{_ORG_PREFIX}{name}.hf.space"
 
 
94
 
95
 
96
  def hf_api_url(name: str) -> str:
97
- return f"https://huggingface.co/api/spaces/{_ORG}/{name}"
 
 
 
 
 
 
 
 
 
 
 
98
 
99
 
100
  def proxy_url(name: str) -> str:
101
- """Where the tile's primary "open" link points. Own-host Spaces -> their HF host;
102
- everyone else -> the same-origin reverse proxy at /spaces/<name>."""
103
- return hf_url(name) if name in _OWN_HOST else f"/spaces/{name}"
 
 
 
104
 
105
 
106
  def _resolve_client() -> Any:
@@ -143,17 +190,21 @@ async def _probe_one(client: Any, sp: dict[str, str]) -> dict[str, Any]:
143
  """HONEST per-Space status. app_reachable is a REAL HEAD probe; stage is from the
144
  HF API. Any failure degrades to honest false/'unknown' — never fabricated."""
145
  name = sp["name"]
 
146
  result: dict[str, Any] = {
147
  "name": name,
 
148
  "title": sp["title"],
 
149
  "url": hf_url(name),
 
150
  "proxy_url": proxy_url(name),
151
- "own_host": name in _OWN_HOST,
152
  "stage": "unknown", # from HF API; HF-API-labelled below
153
  "stage_source": "hf-api",
154
  "app_reachable": False, # REAL probe; only true when the probe truly succeeds
155
  }
156
- # (1) REAL same-origin liveness probe of the Space app. Try the shared async httpx
157
  # client first; on None/failure fall back to the PROVEN stdlib urllib path.
158
  probed = False
159
  if client is not None:
@@ -214,14 +265,45 @@ async def _probe_one(client: Any, sp: dict[str, str]) -> dict[str, Any]:
214
  except Exception as e:
215
  result["stage_error"] = type(e).__name__
216
 
 
217
  return result
218
 
219
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
220
  async def spaces_health() -> dict[str, Any]:
221
- """Aggregate honest health for all 11 Spaces (short TTL cache)."""
222
  now = time.monotonic()
223
  if _HEALTH_CACHE["payload"] is not None and (now - _HEALTH_CACHE["ts"]) < _HEALTH_CACHE_TTL:
224
- return _HEALTH_CACHE["payload"]
 
 
 
 
 
 
 
225
 
226
  client = _resolve_client()
227
  # Probe every Space concurrently. _probe_one handles client=None internally by
@@ -231,14 +313,17 @@ async def spaces_health() -> dict[str, Any]:
231
  spaces = list(await _asyncio.gather(*[_probe_one(client, sp) for sp in SPACES]))
232
 
233
  payload = {
 
234
  "count": len(spaces),
235
  "spaces": spaces,
236
  "labels": {
 
 
237
  "stage": "HF API runtime.stage (https://huggingface.co/api/spaces/SZLHOLDINGS/<name>)",
238
- "app_reachable": "REAL same-origin server-side HEAD/GET probe of the Space app",
239
  "degrade": "stage:'unknown' + app_reachable:false; never fabricated",
240
  },
241
- "note": "Server-side probed; 0 browser CDN. Honest live/unknown only.",
242
  "doctrine": _DOCTRINE,
243
  "fetchedAt": time.strftime("%Y-%m-%dT%H:%M:%SZ", time.gmtime()),
244
  }
@@ -256,52 +341,71 @@ def _tiles_page(ns: str) -> bytes:
256
  cards = []
257
  for sp in SPACES:
258
  name = sp["name"]
 
259
  title = sp["title"]
260
- primary = proxy_url(name)
261
- primary_label = "Open on HF" if name in _OWN_HOST else "Open in a-11-oy.com"
262
  cards.append(
263
  '<article class="sp-card" data-space="%s">'
264
  '<header class="sp-head">'
265
  '<span class="sp-dot" data-dot="%s" title="status">&#9679;</span>'
266
  '<h2 class="sp-title">%s</h2></header>'
 
267
  '<div class="sp-stage" data-stage="%s">stage: <span>checking&hellip;</span></div>'
268
  '<div class="sp-links">'
269
- '<a class="sp-open" href="%s">%s</a>'
270
- '<a class="sp-hf" href="%s" rel="noopener" target="_blank">Open on HF &#8599;</a>'
271
  '</div></article>'
272
- % (name, name, title, name, primary, primary_label, hf_url(name))
 
273
  )
274
  html = (
275
  '<!doctype html><html lang="en"><head><meta charset="utf-8">'
276
  '<meta name="viewport" content="width=device-width,initial-scale=1">'
277
- '<title>Spaces &middot; a11oy</title>'
278
  '<style>'
279
  ':root{color-scheme:dark}'
280
  '*{box-sizing:border-box}'
281
  'body{margin:0;background:#0b0f14;color:#cdd6e0;'
282
  'font:15px/1.6 system-ui,-apple-system,Segoe UI,Roboto,sans-serif}'
283
- '.sp-wrap{max-width:1100px;margin:0 auto;padding:2rem 1.25rem}'
284
  '.sp-h1{color:#e7eef6;font-size:1.6rem;margin:0 0 .25rem}'
285
- '.sp-sub{color:#8a96a3;margin:0 0 1.6rem}'
286
- '.sp-grid{display:grid;gap:1rem;'
 
 
 
 
 
 
 
 
287
  'grid-template-columns:repeat(auto-fill,minmax(260px,1fr))}'
288
  '.sp-card{background:#121821;border:1px solid #1d2632;border-radius:12px;'
289
- 'padding:1rem 1.1rem;display:flex;flex-direction:column;gap:.5rem}'
290
- '.sp-head{display:flex;align-items:center;gap:.55rem}'
291
  '.sp-dot{color:#5b6675;font-size:.7rem;line-height:1}'
292
  '.sp-dot.up{color:#3ad07a}.sp-dot.down{color:#e0593a}.sp-dot.unknown{color:#c9a23a}'
293
- '.sp-title{font-size:1rem;margin:0;color:#e7eef6;font-weight:600}'
294
- '.sp-stage{color:#7c8794;font-size:.82rem}'
 
295
  '.sp-stage span{color:#9fb0c0}'
296
  '.sp-links{margin-top:auto;display:flex;gap:.9rem;flex-wrap:wrap;padding-top:.4rem}'
 
297
  '.sp-open{color:#d4a444;text-decoration:none;font-weight:600}'
298
  '.sp-hf{color:#7c8794;text-decoration:none}'
299
- '.sp-foot{color:#5b6675;font-size:.8rem;margin-top:1.6rem}'
 
 
 
300
  '</style></head>'
301
  '<body><main class="sp-wrap">'
302
  '<h1 class="sp-h1">Hugging Face Spaces</h1>'
303
- '<p class="sp-sub">All live Spaces, surfaced on a-11-oy.com &mdash; server-side '
304
- 'reverse proxy + honest live health. 0 browser CDN.</p>'
 
 
 
305
  '<div class="sp-grid">' + "".join(cards) + '</div>'
306
  '<p class="sp-foot">Status dot &amp; stage are filled from the same-origin '
307
  '<code>/api/' + ns + '/v1/spaces/health</code> endpoint (real server-side probe '
@@ -309,16 +413,33 @@ def _tiles_page(ns: str) -> bytes:
309
  '</main>'
310
  '<script>'
311
  '(function(){'
312
- 'fetch("/api/' + ns + '/v1/spaces/health").then(function(r){return r.json();})'
313
- '.then(function(d){(d.spaces||[]).forEach(function(s){'
314
- 'var card=document.querySelector(\'[data-space="\'+s.name+\'"]\');if(!card)return;'
 
 
 
 
 
 
 
 
 
 
 
 
315
  'var dot=card.querySelector(".sp-dot");'
 
 
 
 
316
  'if(dot){dot.classList.remove("up","down","unknown");'
317
- 'dot.classList.add(s.app_reachable?"up":(s.stage&&s.stage!=="unknown"?"unknown":"down"));'
318
- 'dot.title=(s.app_reachable?"reachable":"unreachable")+" / stage:"+(s.stage||"unknown");}'
319
  'var st=card.querySelector(".sp-stage span");'
320
- 'if(st){st.textContent=(s.stage||"unknown")+(s.app_reachable?" \\u00b7 reachable":" \\u00b7 unreachable");}'
321
- '});}).catch(function(){});'
 
322
  '})();'
323
  '</script>'
324
  '</body></html>'
@@ -340,9 +461,9 @@ def _nav_item() -> bytes:
340
  """ONE 'Spaces' nav item, mirroring the console's own nav-item markup so it inherits
341
  the console styling (0 CDN, 0 codename). Globe glyph; honest label."""
342
  return (
343
- '<div class="nav-item" data-nav-spaces="hf1" data-wireup-path="/spaces" '
344
- 'onclick="location.href=\'/spaces\'" style="cursor:pointer">'
345
- '<span class="ico">\U0001F310</span>Spaces</div>'
346
  ).encode("utf-8")
347
 
348
 
@@ -404,7 +525,6 @@ def register(app, ns: str = "a11oy") -> str:
404
  at the FRONT of the router (beat the SPA + Node-proxy catch-alls), and attach the
405
  idempotent 'Spaces' nav injector. try/except-guarded by the caller."""
406
  try:
407
- from fastapi.responses import JSONResponse # noqa: F401
408
  from starlette.responses import Response, JSONResponse as _JSON
409
  except Exception as e: # pragma: no cover
410
  return "unavailable: %r" % (e,)
@@ -414,12 +534,13 @@ def register(app, ns: str = "a11oy") -> str:
414
 
415
  async def _health(request):
416
  payload = await spaces_health()
417
- return _JSON(payload)
418
 
419
  async def _tiles(request):
 
420
  if request.method.upper() == "HEAD":
421
- return Response(content=b"", status_code=200, media_type="text/html")
422
- return Response(content=tiles, status_code=200, media_type="text/html")
423
 
424
  from starlette.routing import Route
425
  routes = [
@@ -446,7 +567,7 @@ def register(app, ns: str = "a11oy") -> str:
446
  # ---------------------------------------------------------------------------
447
  # Self-test — pure stdlib + starlette TestClient; no real network. Stubs the shared
448
  # client to assert: health degrades honestly (no client -> stage unknown + reachable
449
- # false), tiles page lists ALL 11 names + has the health-fetch JS, nav injects exactly
450
  # once + is idempotent + removes nothing, /spaces is NOT nav-injected.
451
  # ---------------------------------------------------------------------------
452
  if __name__ == "__main__":
@@ -454,15 +575,33 @@ if __name__ == "__main__":
454
  with open(__file__, "r", encoding="utf-8") as _fh:
455
  _ast.parse(_fh.read())
456
 
457
- assert len(SPACES) == 11, len(SPACES)
458
  tp = _tiles_page("a11oy")
459
  for sp in SPACES:
460
  assert sp["name"].encode() in tp, "tiles missing %s" % sp["name"]
461
  assert sp["title"].encode() in tp, "tiles missing title %s" % sp["title"]
 
 
 
462
  assert b"/api/a11oy/v1/spaces/health" in tp, "tiles must fetch the health endpoint"
463
  assert b"http://" not in tp, "tiles must be 0 CDN (no http://)"
464
- # the only https in the page should be the hf.space open links (server-named, fine)
465
- assert tp.count(b"https://huggingface.co") == 0, "tiles must not pull from HF CDN"
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
466
 
467
  from starlette.applications import Starlette
468
  from starlette.responses import HTMLResponse, PlainTextResponse
@@ -489,23 +628,36 @@ if __name__ == "__main__":
489
  assert st.startswith("ok:"), st
490
  c = TestClient(app)
491
 
492
- # health: no httpx client wired -> falls back to the stdlib urllib probe (the proven
493
- # outbound path on the box). Assert SHAPE + honesty: every space has a boolean
494
- # app_reachable and a string stage; values are REAL (network) or honest unknown/false
495
- # (no network) -- never fabricated. We do NOT require network in CI: both outcomes ok.
496
- h = c.get("/api/a11oy/v1/spaces/health").json()
497
- assert h["count"] == 11, h["count"]
 
 
 
 
 
 
 
 
 
 
 
 
 
 
498
  for s in h["spaces"]:
499
- assert isinstance(s["app_reachable"], bool), "app_reachable must be a real bool"
500
- assert isinstance(s["stage"], str), "stage must be a string (HF-API or 'unknown')"
501
- # honest contract: if not reachable AND no stage, it must be the honest unknown/false
502
- if not s["app_reachable"] and s["stage"] == "unknown":
503
- pass # honest degrade -- allowed
504
  assert h["doctrine"]["locked_proven"] == ["F1", "F4", "F7", "F11", "F12", "F18", "F19", "F22"]
505
 
506
  # tiles page resolves + lists all names
507
  t = c.get("/spaces")
508
  assert t.status_code == 200 and "text/html" in t.headers["content-type"], t.status_code
 
509
  for sp in SPACES:
510
  assert sp["name"] in t.text, "tiles page missing %s" % sp["name"]
511
 
@@ -514,12 +666,12 @@ if __name__ == "__main__":
514
  p2 = c.get("/console").text
515
  assert p1.count('data-nav-spaces="hf1"') == 1, "nav must inject exactly once"
516
  assert p2.count('data-nav-spaces="hf1"') == 1, "nav must be idempotent"
517
- assert "location.href='/spaces'" in p1, "nav must link /spaces"
518
  assert "Operate</div>" in p1 and "Existing</div>" in p1 and "footer</div>" in p1, \
519
  "must remove nothing from the SPA source"
520
  assert p1 == p2, "second console render must be byte-identical (idempotent)"
521
  # the tiles page itself must NOT be nav-injected (it has no console sidebar)
522
  assert 'data-nav-spaces="hf1"' not in c.get("/spaces").text, "/spaces must not be nav-injected"
523
 
524
- print("szl_spaces_surface: ALL OK (11 spaces; honest degrade; tiles 0-CDN; nav "
525
- "idempotent + additive; /spaces not self-injected)")
 
3
  # © 2026 Lutar, Stephen P. — SZL Holdings · ORCID 0009-0001-0110-4173
4
  """szl_spaces_surface.py — console "Spaces" surface (health API + tiles + nav).
5
 
6
+ ADDITIVE, self-contained, SHARED across a11oy + killinchu. The console companion to
7
+ the canonical handoff module: a LIVE health view of the whole HF Spaces estate plus a
8
  clean tiles page and ONE idempotent nav item, following the additive-injector pattern
9
  (a11oy_nav_wireup.py / killinchu_nav_wireup.py).
10
 
 
12
  catch-alls — same route-to-front idiom as a11oy_hf_assets.py):
13
 
14
  GET /api/<ns>/v1/spaces/health -> for each Space, an HONEST status:
15
+ {name, slug, title, sdk, stage, app_reachable, url, canonical_url, proxy_url}
16
  - stage : runtime.stage from the HF API
17
  (https://huggingface.co/api/spaces/SZLHOLDINGS/<name>),
18
  or "unknown" if that API call degrades. LABELLED as HF-API.
19
+ - app_reachable : a REAL server-side probe of
20
  https://szlholdings-<name>.hf.space/ (HEAD, short timeout).
21
  true ONLY when the probe really succeeded. Never fabricated.
22
  Degrade -> stage:"unknown", app_reachable:false. NEVER a faked stage/200.
23
 
24
  GET/HEAD /spaces -> a clean tiles page (one card per Space: honest
25
+ title, live status dot fed by /health, canonical isolated hf.space app link,
26
+ and a separate huggingface.co repository link).
27
+ No upstream app executes inside the a11oy or Killinchu origin. Pure inline
28
+ markup, 0 browser CDN. Status dots are filled by a tiny inline fetch of the
29
+ SAME-ORIGIN /health JSON (our own server-side-probed endpoint).
30
 
31
  NAV: a BaseHTTPMiddleware injector adds ONE nav item "Spaces" -> /spaces into the
32
  console left-nav (before <div class="side-foot">, with nav-group / nav-item fallbacks).
 
55
 
56
  _ORG = "SZLHOLDINGS"
57
  _ORG_PREFIX = "szlholdings-"
58
+ SPACE_TILE_ORIGIN_MODE = "canonical-isolated-hf/v1"
59
+
60
+ # Audited 26-Space public estate. Names are exact Hub repository names and titles are
61
+ # the current public card titles observed during the 2026-07-16 alignment audit. Runtime
62
+ # state is deliberately NOT frozen here: /health measures it on every cache refresh and
63
+ # degrades to unknown/false when evidence is unavailable. ``slug`` is the lowercase,
64
+ # same-origin route key; it differs from ``name`` only for the Hub repository ``README``.
65
+ # a11oy + killinchu retain the historical own-host classification in the health payload,
66
+ # but every tile now opens its canonical isolated Hugging Face application origin.
67
  SPACES: list[dict[str, str]] = [
68
+ {"name": "a11oy", "slug": "a11oy", "title": "a11oyCommand Center", "sdk": "docker"},
69
+ {"name": "anatomy", "slug": "anatomy", "title": "SZL Living Anatomy", "sdk": "docker"},
70
+ {"name": "cosmos", "slug": "cosmos", "title": "SZL Cosmos", "sdk": "docker"},
71
+ {"name": "david-leads", "slug": "david-leads", "title": "David Leads Sovereign Insurance Intelligence", "sdk": "docker"},
72
+ {"name": "energy-attest-holo", "slug": "energy-attest-holo", "title": "Energy Attestation Holo", "sdk": "static"},
73
+ {"name": "energy-attested-runs", "slug": "energy-attested-runs", "title": "Energy-Attested Inference Runs", "sdk": "gradio"},
74
+ {"name": "governed-norm-holo", "slug": "governed-norm-holo", "title": "Governed NormsWILLAY classifiers", "sdk": "static"},
75
+ {"name": "governed-receipt-verifier", "slug": "governed-receipt-verifier", "title": "Governed Receipt Verifier", "sdk": "static"},
76
+ {"name": "guardrail-receipt", "slug": "guardrail-receipt", "title": "Guardrail Decision-Receipt", "sdk": "gradio"},
77
+ {"name": "hatun-mcp", "slug": "hatun-mcp", "title": "hatunMCP Server", "sdk": "docker"},
78
+ {"name": "holographic", "slug": "holographic", "title": "Holographic Estate", "sdk": "docker"},
79
+ {"name": "immune", "slug": "immune", "title": "IMMUNE — Verifiable AI Defense Matrix", "sdk": "docker"},
80
+ {"name": "killinchu", "slug": "killinchu", "title": "killinchu — Andean Drone Intelligence", "sdk": "docker"},
81
+ {"name": "lambda-gate-holo", "slug": "lambda-gate-holo", "title": "Λ Gate — Conjecture 1, never green", "sdk": "static"},
82
+ {"name": "llm-router-live", "slug": "llm-router-live", "title": "SZL LLM Router", "sdk": "docker"},
83
+ {"name": "README", "slug": "readme", "title": "SZL Holdings — Governed-AI Command Platform", "sdk": "static"},
84
+ {"name": "receipt-chain-live", "slug": "receipt-chain-live", "title": "Receipt Chain Live", "sdk": "static"},
85
+ {"name": "sda", "slug": "sda", "title": "SZL SDA", "sdk": "docker"},
86
+ {"name": "szl-blocked-live", "slug": "szl-blocked-live", "title": "szl-blocked-live", "sdk": "static"},
87
+ {"name": "szl-estate-live", "slug": "szl-estate-live", "title": "Khipu Loom — Governed AI Estate", "sdk": "static"},
88
+ {"name": "szl-forge-lab", "slug": "szl-forge-lab", "title": "SZL Forge Lab", "sdk": "gradio"},
89
+ {"name": "szl-govsign-live", "slug": "szl-govsign-live", "title": "szl-govsign-live", "sdk": "static"},
90
+ {"name": "szl-kernels-live", "slug": "szl-kernels-live", "title": "SZL Kernel Operations Hub", "sdk": "static"},
91
+ {"name": "szl-model-inference-lab", "slug": "szl-model-inference-lab", "title": "SZL Model Inference Lab", "sdk": "docker"},
92
+ {"name": "szl-provctl-live", "slug": "szl-provctl-live", "title": "szl-provctl-live", "sdk": "static"},
93
+ {"name": "yarqa", "slug": "yarqa", "title": "yarqa — Plug-Flow Compartments (live or sample, always honest)", "sdk": "docker"},
94
  ]
95
+ _SPACE_BY_NAME = {sp["name"]: sp for sp in SPACES}
96
+ _SPACE_BY_SLUG = {sp["slug"]: sp for sp in SPACES}
97
+ # Product Spaces retained as metadata for consumers that distinguish flagship hosts.
98
  _OWN_HOST = {"a11oy", "killinchu"}
99
 
100
  _DOCTRINE = {
 
107
 
108
  _PROBE_TIMEOUT = 6.0
109
  _HF_API_TIMEOUT = 6.0
110
+ _HEALTH_CACHE_TTL = 20.0 # seconds — keep the tiles page snappy without re-probing 26x.
111
  _HEALTH_CACHE: dict[str, Any] = {"ts": 0.0, "payload": None}
112
+ _RUNNING_STAGES = {"RUNNING"}
113
+
114
+
115
+ def _space_record(identifier: str) -> dict[str, str]:
116
+ """Resolve only audited inventory identifiers; fail closed for unknown names."""
117
+ record = _SPACE_BY_NAME.get(identifier) or _SPACE_BY_SLUG.get(identifier)
118
+ if record is None:
119
+ raise ValueError("unknown Space identifier: %s" % identifier)
120
+ return record
121
 
122
 
123
  def hf_url(name: str) -> str:
124
+ record = _space_record(name)
125
+ host_suffix = ".static.hf.space" if record["sdk"] == "static" else ".hf.space"
126
+ return f"https://{_ORG_PREFIX}{record['slug']}{host_suffix}"
127
 
128
 
129
  def hf_api_url(name: str) -> str:
130
+ record = _space_record(name)
131
+ return f"https://huggingface.co/api/spaces/{_ORG}/{record['name']}"
132
+
133
+
134
+ def hf_repo_url(name: str) -> str:
135
+ record = _space_record(name)
136
+ return f"https://huggingface.co/spaces/{_ORG}/{record['name']}"
137
+
138
+
139
+ def canonical_url(name: str) -> str:
140
+ """Canonical isolated application origin for an audited Space."""
141
+ return hf_url(name)
142
 
143
 
144
  def proxy_url(name: str) -> str:
145
+ """Deprecated compatibility alias for ``canonical_url``.
146
+
147
+ No upstream Space executes under the host application's origin; interactive
148
+ apps, streaming, cookies, and authentication stay isolated on Hugging Face.
149
+ """
150
+ return canonical_url(name)
151
 
152
 
153
  def _resolve_client() -> Any:
 
190
  """HONEST per-Space status. app_reachable is a REAL HEAD probe; stage is from the
191
  HF API. Any failure degrades to honest false/'unknown' — never fabricated."""
192
  name = sp["name"]
193
+ slug = sp["slug"]
194
  result: dict[str, Any] = {
195
  "name": name,
196
+ "slug": slug,
197
  "title": sp["title"],
198
+ "sdk": sp["sdk"],
199
  "url": hf_url(name),
200
+ "canonical_url": canonical_url(name),
201
  "proxy_url": proxy_url(name),
202
+ "own_host": slug in _OWN_HOST,
203
  "stage": "unknown", # from HF API; HF-API-labelled below
204
  "stage_source": "hf-api",
205
  "app_reachable": False, # REAL probe; only true when the probe truly succeeds
206
  }
207
+ # (1) REAL liveness probe of the canonical Space app. Try the shared async httpx
208
  # client first; on None/failure fall back to the PROVEN stdlib urllib path.
209
  probed = False
210
  if client is not None:
 
265
  except Exception as e:
266
  result["stage_error"] = type(e).__name__
267
 
268
+ result["state"] = _space_health_state(result)
269
  return result
270
 
271
 
272
+ def _space_health_state(space: dict[str, Any]) -> str:
273
+ """Derive one conservative, user-facing state from observed row evidence."""
274
+ reachable = bool(space.get("app_reachable"))
275
+ stage = str(space.get("stage") or "unknown").upper()
276
+ if reachable and stage in _RUNNING_STAGES:
277
+ return "LIVE"
278
+ if not reachable and stage == "UNKNOWN":
279
+ return "UNAVAILABLE"
280
+ return "DEGRADED"
281
+
282
+
283
+ def _aggregate_health_state(spaces: list[dict[str, Any]]) -> str:
284
+ """Derive a conservative top-level state from the observed Space rows."""
285
+ if not spaces:
286
+ return "UNAVAILABLE"
287
+ states = [_space_health_state(row) for row in spaces]
288
+ if all(state == "LIVE" for state in states):
289
+ return "LIVE"
290
+ if all(state == "UNAVAILABLE" for state in states):
291
+ return "UNAVAILABLE"
292
+ return "DEGRADED"
293
+
294
+
295
  async def spaces_health() -> dict[str, Any]:
296
+ """Aggregate honest health for the audited 26-Space estate (short TTL cache)."""
297
  now = time.monotonic()
298
  if _HEALTH_CACHE["payload"] is not None and (now - _HEALTH_CACHE["ts"]) < _HEALTH_CACHE_TTL:
299
+ cached = _HEALTH_CACHE["payload"]
300
+ # Return a new top-level mapping: label the transport as CACHED while
301
+ # preserving the original aggregate verdict for auditability.
302
+ return {
303
+ **cached,
304
+ "state": "CACHED",
305
+ "cached_state": cached.get("state", "UNAVAILABLE"),
306
+ }
307
 
308
  client = _resolve_client()
309
  # Probe every Space concurrently. _probe_one handles client=None internally by
 
313
  spaces = list(await _asyncio.gather(*[_probe_one(client, sp) for sp in SPACES]))
314
 
315
  payload = {
316
+ "state": _aggregate_health_state(spaces),
317
  "count": len(spaces),
318
  "spaces": spaces,
319
  "labels": {
320
+ "state": "Fresh: LIVE only when every app is reachable and HF reports RUNNING; otherwise DEGRADED or UNAVAILABLE. TTL reuse is CACHED with cached_state.",
321
+ "space_state": "LIVE requires app_reachable:true plus HF stage RUNNING; partial evidence is DEGRADED",
322
  "stage": "HF API runtime.stage (https://huggingface.co/api/spaces/SZLHOLDINGS/<name>)",
323
+ "app_reachable": "REAL server-side HEAD/GET probe of the canonical Space app",
324
  "degrade": "stage:'unknown' + app_reachable:false; never fabricated",
325
  },
326
+ "note": "Server-side probed; 0 browser CDN. Honest LIVE/DEGRADED/UNAVAILABLE; cache reuse is explicitly CACHED.",
327
  "doctrine": _DOCTRINE,
328
  "fetchedAt": time.strftime("%Y-%m-%dT%H:%M:%SZ", time.gmtime()),
329
  }
 
341
  cards = []
342
  for sp in SPACES:
343
  name = sp["name"]
344
+ slug = sp["slug"]
345
  title = sp["title"]
346
+ primary = canonical_url(name)
347
+ primary_label = "Open isolated app"
348
  cards.append(
349
  '<article class="sp-card" data-space="%s">'
350
  '<header class="sp-head">'
351
  '<span class="sp-dot" data-dot="%s" title="status">&#9679;</span>'
352
  '<h2 class="sp-title">%s</h2></header>'
353
+ '<div class="sp-kind">%s &middot; %s</div>'
354
  '<div class="sp-stage" data-stage="%s">stage: <span>checking&hellip;</span></div>'
355
  '<div class="sp-links">'
356
+ '<a class="sp-open" href="%s" rel="noopener" target="_blank">%s &#8599;</a>'
357
+ '<a class="sp-hf" href="%s" rel="noopener" target="_blank">View repository &#8599;</a>'
358
  '</div></article>'
359
+ % (slug, slug, title, name, sp["sdk"], slug,
360
+ primary, primary_label, hf_repo_url(name))
361
  )
362
  html = (
363
  '<!doctype html><html lang="en"><head><meta charset="utf-8">'
364
  '<meta name="viewport" content="width=device-width,initial-scale=1">'
365
+ '<title>Spaces &middot; ' + ns + '</title>'
366
  '<style>'
367
  ':root{color-scheme:dark}'
368
  '*{box-sizing:border-box}'
369
  'body{margin:0;background:#0b0f14;color:#cdd6e0;'
370
  'font:15px/1.6 system-ui,-apple-system,Segoe UI,Roboto,sans-serif}'
371
+ '.sp-wrap{max-width:1100px;margin:0 auto;padding:2rem 1.25rem;min-width:0}'
372
  '.sp-h1{color:#e7eef6;font-size:1.6rem;margin:0 0 .25rem}'
373
+ '.sp-sub{color:#8a96a3;margin:0 0 .75rem;overflow-wrap:anywhere}'
374
+ '.sp-health{display:flex;align-items:center;gap:.45rem;min-height:44px;'
375
+ 'color:#8a96a3;margin:0 0 1rem}'
376
+ '.sp-health strong{border:1px solid #3b4654;border-radius:999px;padding:.22rem .55rem;'
377
+ 'color:#9fb0c0;font-size:.76rem;letter-spacing:.04em}'
378
+ '.sp-health strong.live{border-color:#3ad07a;color:#3ad07a}'
379
+ '.sp-health strong.degraded{border-color:#c9a23a;color:#c9a23a}'
380
+ '.sp-health strong.unavailable{border-color:#e0593a;color:#e0593a}'
381
+ '.sp-health strong.cached,.sp-health strong.checking{border-color:#697787;color:#9fb0c0}'
382
+ '.sp-grid{display:grid;gap:1rem;min-width:0;'
383
  'grid-template-columns:repeat(auto-fill,minmax(260px,1fr))}'
384
  '.sp-card{background:#121821;border:1px solid #1d2632;border-radius:12px;'
385
+ 'padding:1rem 1.1rem;display:flex;flex-direction:column;gap:.5rem;min-width:0}'
386
+ '.sp-head{display:flex;align-items:center;gap:.55rem;min-width:0}'
387
  '.sp-dot{color:#5b6675;font-size:.7rem;line-height:1}'
388
  '.sp-dot.up{color:#3ad07a}.sp-dot.down{color:#e0593a}.sp-dot.unknown{color:#c9a23a}'
389
+ '.sp-title{font-size:1rem;margin:0;color:#e7eef6;font-weight:600;min-width:0;overflow-wrap:anywhere}'
390
+ '.sp-kind{color:#697787;font-size:.76rem;overflow-wrap:anywhere}'
391
+ '.sp-stage{color:#7c8794;font-size:.82rem;overflow-wrap:anywhere}'
392
  '.sp-stage span{color:#9fb0c0}'
393
  '.sp-links{margin-top:auto;display:flex;gap:.9rem;flex-wrap:wrap;padding-top:.4rem}'
394
+ '.sp-links a{display:inline-flex;align-items:center;min-height:44px;padding:.4rem .15rem}'
395
  '.sp-open{color:#d4a444;text-decoration:none;font-weight:600}'
396
  '.sp-hf{color:#7c8794;text-decoration:none}'
397
+ '.sp-foot{color:#5b6675;font-size:.8rem;margin-top:1.6rem;overflow-wrap:anywhere}'
398
+ '@media(max-width:375px){'
399
+ '.sp-wrap{padding:1.25rem .75rem}.sp-grid{grid-template-columns:minmax(0,1fr)}'
400
+ '.sp-links{gap:.15rem}.sp-links a{flex:1 1 100%}}'
401
  '</style></head>'
402
  '<body><main class="sp-wrap">'
403
  '<h1 class="sp-h1">Hugging Face Spaces</h1>'
404
+ '<p class="sp-sub">All 26 audited Spaces in one evidence-labelled registry. '
405
+ 'Apps open on their canonical isolated Hugging Face origin; health is probed '
406
+ 'server-side. Legacy <code>/spaces/&lt;slug&gt;</code> links are no-store 307 handoffs.</p>'
407
+ '<p class="sp-health">Estate health: '
408
+ '<strong id="sp-estate-health" class="checking" aria-live="polite">CHECKING</strong></p>'
409
  '<div class="sp-grid">' + "".join(cards) + '</div>'
410
  '<p class="sp-foot">Status dot &amp; stage are filled from the same-origin '
411
  '<code>/api/' + ns + '/v1/spaces/health</code> endpoint (real server-side probe '
 
413
  '</main>'
414
  '<script>'
415
  '(function(){'
416
+ 'var estate=document.getElementById("sp-estate-health");'
417
+ 'function estateState(raw,cached){'
418
+ 'var allowed={LIVE:1,DEGRADED:1,UNAVAILABLE:1,CACHED:1};'
419
+ 'raw=String(raw||"UNAVAILABLE").toUpperCase();if(!allowed[raw])raw="UNAVAILABLE";'
420
+ 'var label=raw;if(raw==="CACHED")label="CACHED \\u00b7 "+String(cached||"UNAVAILABLE").toUpperCase()+" snapshot";'
421
+ 'if(estate){estate.className=raw.toLowerCase();estate.textContent=label;}}'
422
+ 'function healthUnavailable(){estateState("UNAVAILABLE");'
423
+ 'var cards=document.querySelectorAll(".sp-card");for(var i=0;i<cards.length;i++){'
424
+ 'var dot=cards[i].querySelector(".sp-dot");if(dot){dot.classList.remove("up","unknown");'
425
+ 'dot.classList.add("down");dot.title="UNAVAILABLE / health fetch failed";}'
426
+ 'var st=cards[i].querySelector(".sp-stage span");if(st)st.textContent="UNAVAILABLE \\u00b7 health fetch failed";}}'
427
+ 'fetch("/api/' + ns + '/v1/spaces/health").then(function(r){'
428
+ 'if(!r.ok)throw new Error("health "+r.status);return r.json();})'
429
+ '.then(function(d){estateState(d.state,d.cached_state);(d.spaces||[]).forEach(function(s){'
430
+ 'var card=document.querySelector(\'[data-space="\'+(s.slug||s.name)+\'"]\');if(!card)return;'
431
  'var dot=card.querySelector(".sp-dot");'
432
+ 'var stage=String(s.stage||"unknown").toUpperCase();'
433
+ 'var state=String(s.state||((s.app_reachable&&stage==="RUNNING")?"LIVE":'
434
+ '((s.app_reachable||stage!=="UNKNOWN")?"DEGRADED":"UNAVAILABLE"))).toUpperCase();'
435
+ 'if(state!=="LIVE"&&state!=="DEGRADED"&&state!=="UNAVAILABLE")state="UNAVAILABLE";'
436
  'if(dot){dot.classList.remove("up","down","unknown");'
437
+ 'dot.classList.add(state==="LIVE"?"up":(state==="DEGRADED"?"unknown":"down"));'
438
+ 'dot.title=state+" / "+(s.app_reachable?"reachable":"unreachable")+" / stage:"+(s.stage||"unknown");}'
439
  'var st=card.querySelector(".sp-stage span");'
440
+ 'if(st){st.textContent=state+" \\u00b7 "+(s.stage||"unknown")+'
441
+ '(s.app_reachable?" \\u00b7 reachable":" \\u00b7 unreachable");}'
442
+ '});}).catch(healthUnavailable);'
443
  '})();'
444
  '</script>'
445
  '</body></html>'
 
461
  """ONE 'Spaces' nav item, mirroring the console's own nav-item markup so it inherits
462
  the console styling (0 CDN, 0 codename). Globe glyph; honest label."""
463
  return (
464
+ '<a class="nav-item" data-nav-spaces="hf1" data-wireup-path="/spaces" '
465
+ 'href="/spaces" style="cursor:pointer;text-decoration:none">'
466
+ '<span class="ico">\U0001F310</span>Spaces</a>'
467
  ).encode("utf-8")
468
 
469
 
 
525
  at the FRONT of the router (beat the SPA + Node-proxy catch-alls), and attach the
526
  idempotent 'Spaces' nav injector. try/except-guarded by the caller."""
527
  try:
 
528
  from starlette.responses import Response, JSONResponse as _JSON
529
  except Exception as e: # pragma: no cover
530
  return "unavailable: %r" % (e,)
 
534
 
535
  async def _health(request):
536
  payload = await spaces_health()
537
+ return _JSON(payload, headers={"Cache-Control": "no-store"})
538
 
539
  async def _tiles(request):
540
+ headers = {"Cache-Control": "no-store"}
541
  if request.method.upper() == "HEAD":
542
+ return Response(content=b"", status_code=200, media_type="text/html", headers=headers)
543
+ return Response(content=tiles, status_code=200, media_type="text/html", headers=headers)
544
 
545
  from starlette.routing import Route
546
  routes = [
 
567
  # ---------------------------------------------------------------------------
568
  # Self-test — pure stdlib + starlette TestClient; no real network. Stubs the shared
569
  # client to assert: health degrades honestly (no client -> stage unknown + reachable
570
+ # false), tiles page lists ALL 26 names + has the health-fetch JS, nav injects exactly
571
  # once + is idempotent + removes nothing, /spaces is NOT nav-injected.
572
  # ---------------------------------------------------------------------------
573
  if __name__ == "__main__":
 
575
  with open(__file__, "r", encoding="utf-8") as _fh:
576
  _ast.parse(_fh.read())
577
 
578
+ assert len(SPACES) == 26, len(SPACES)
579
  tp = _tiles_page("a11oy")
580
  for sp in SPACES:
581
  assert sp["name"].encode() in tp, "tiles missing %s" % sp["name"]
582
  assert sp["title"].encode() in tp, "tiles missing title %s" % sp["title"]
583
+ assert canonical_url(sp["name"]).encode() in tp, "tiles missing canonical app origin"
584
+ assert hf_repo_url(sp["name"]).encode() in tp, "tiles missing repository link"
585
+ assert proxy_url(sp["name"]) == canonical_url(sp["name"]), "primary link must stay isolated"
586
  assert b"/api/a11oy/v1/spaces/health" in tp, "tiles must fetch the health endpoint"
587
  assert b"http://" not in tp, "tiles must be 0 CDN (no http://)"
588
+ assert b'href="/spaces/' not in tp, "tiles must not execute an app under this origin"
589
+ assert b"canonical isolated Hugging Face origin" in tp
590
+ # Repository anchors are navigation only; no browser asset is loaded from HF.
591
+ assert tp.count(b"https://huggingface.co/spaces/") == len(SPACES)
592
+ assert b'<script src="https://' not in tp and b'<link href="https://' not in tp
593
+
594
+ running = {"app_reachable": True, "app_status": 200, "stage": "RUNNING"}
595
+ unknown = {"app_reachable": False, "stage": "unknown"}
596
+ http_200_unknown = {"app_reachable": True, "app_status": 200, "stage": "unknown"}
597
+ assert _aggregate_health_state([running, dict(running)]) == "LIVE"
598
+ assert _aggregate_health_state([unknown, dict(unknown)]) == "UNAVAILABLE"
599
+ assert _aggregate_health_state([running, unknown]) == "DEGRADED"
600
+ assert _aggregate_health_state([http_200_unknown]) == "DEGRADED", \
601
+ "HTTP 200 alone must never upgrade aggregate state to LIVE"
602
+ assert _space_health_state(running) == "LIVE"
603
+ assert _space_health_state(unknown) == "UNAVAILABLE"
604
+ assert _space_health_state(http_200_unknown) == "DEGRADED"
605
 
606
  from starlette.applications import Starlette
607
  from starlette.responses import HTMLResponse, PlainTextResponse
 
628
  assert st.startswith("ok:"), st
629
  c = TestClient(app)
630
 
631
+ # health: no httpx client wired -> falls back to the stdlib urllib probe. Stub that
632
+ # final outbound path so this self-test is hermetic and verifies the exact honest
633
+ # degrade contract for every audited Space (no network, no fabricated green state).
634
+ _self_mod = sys.modules[__name__]
635
+ _orig_probe = _self_mod._urllib_probe
636
+ def _offline(*_a, **_k):
637
+ raise OSError("simulated offline audit")
638
+ _self_mod._urllib_probe = _offline
639
+ _HEALTH_CACHE["ts"] = 0.0
640
+ _HEALTH_CACHE["payload"] = None
641
+ try:
642
+ health_response = c.get("/api/a11oy/v1/spaces/health")
643
+ h = health_response.json()
644
+ finally:
645
+ _self_mod._urllib_probe = _orig_probe
646
+ _HEALTH_CACHE["ts"] = 0.0
647
+ _HEALTH_CACHE["payload"] = None
648
+ assert h["count"] == 26, h["count"]
649
+ assert h["state"] == "UNAVAILABLE", h["state"]
650
+ assert health_response.headers["cache-control"] == "no-store"
651
  for s in h["spaces"]:
652
+ assert s["app_reachable"] is False, "offline probe must honestly degrade false"
653
+ assert s["stage"] == "unknown", "offline HF API must honestly degrade unknown"
654
+ assert s["state"] == "UNAVAILABLE", "offline row must fail closed"
 
 
655
  assert h["doctrine"]["locked_proven"] == ["F1", "F4", "F7", "F11", "F12", "F18", "F19", "F22"]
656
 
657
  # tiles page resolves + lists all names
658
  t = c.get("/spaces")
659
  assert t.status_code == 200 and "text/html" in t.headers["content-type"], t.status_code
660
+ assert t.headers["cache-control"] == "no-store"
661
  for sp in SPACES:
662
  assert sp["name"] in t.text, "tiles page missing %s" % sp["name"]
663
 
 
666
  p2 = c.get("/console").text
667
  assert p1.count('data-nav-spaces="hf1"') == 1, "nav must inject exactly once"
668
  assert p2.count('data-nav-spaces="hf1"') == 1, "nav must be idempotent"
669
+ assert 'href="/spaces"' in p1, "nav must link /spaces with a real anchor"
670
  assert "Operate</div>" in p1 and "Existing</div>" in p1 and "footer</div>" in p1, \
671
  "must remove nothing from the SPA source"
672
  assert p1 == p2, "second console render must be byte-identical (idempotent)"
673
  # the tiles page itself must NOT be nav-injected (it has no console sidebar)
674
  assert 'data-nav-spaces="hf1"' not in c.get("/spaces").text, "/spaces must not be nav-injected"
675
 
676
+ print("szl_spaces_surface: ALL OK (26 canonical isolated links; honest degrade; "
677
+ "tiles 0-CDN + no-store; nav idempotent + additive; /spaces not self-injected)")