Spaces:
Running
Running
Scrub internal codenames from user-visible API responses: generic a11oy capability names in mesh/state, warhacker launch/index, observability trace; eval-arena domain=logistics; vertical-pack id=voyage. Signed-off-by: Stephen P. Lutar Jr. <stephenlutar2@gmail.com>
Browse files- a11oy_warhacker_obs.py +105 -38
- serve.py +46 -6
a11oy_warhacker_obs.py
CHANGED
|
@@ -51,7 +51,34 @@ from fastapi.responses import JSONResponse
|
|
| 51 |
|
| 52 |
DOCTRINE = "v11"
|
| 53 |
LAMBDA_STATUS = "Conjecture 1 (NOT a theorem — LOCKED)"
|
| 54 |
-
SLSA_NOTE = "SLSA L2 build-provenance on the
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 55 |
|
| 56 |
# Live organ base URLs. Overridable by env for air-gap / mirror / cluster deploys.
|
| 57 |
# Resolution order per organ (first non-empty wins):
|
|
@@ -101,34 +128,40 @@ WARHACKER_PROBLEMS: list[dict[str, Any]] = [
|
|
| 101 |
{
|
| 102 |
"id": "P1",
|
| 103 |
"key": "cannonico",
|
| 104 |
-
"title": "
|
| 105 |
"organ": "killinchu",
|
|
|
|
| 106 |
"method": "POST",
|
| 107 |
"path": "/api/killinchu/v1/cannonico/mission/begin",
|
| 108 |
-
"
|
| 109 |
-
"
|
| 110 |
-
|
|
|
|
| 111 |
"result_keys": ["mission_id", "anchor_receipt"],
|
| 112 |
},
|
| 113 |
{
|
| 114 |
"id": "P2",
|
| 115 |
"key": "tychee",
|
| 116 |
-
"title": "
|
| 117 |
"organ": "sentra",
|
|
|
|
| 118 |
"method": "GET",
|
| 119 |
"path": "/api/sentra/v1/gates",
|
|
|
|
| 120 |
"request_sample": None,
|
| 121 |
-
"proves": "
|
| 122 |
"Every action is matched against the gate corpus before it is allowed.",
|
| 123 |
"result_keys": ["gates", "total"],
|
| 124 |
},
|
| 125 |
{
|
| 126 |
"id": "P3",
|
| 127 |
"key": "hangar2apps",
|
| 128 |
-
"title": "
|
| 129 |
"organ": "amaru",
|
|
|
|
| 130 |
"method": "POST",
|
| 131 |
"path": "/api/amaru/v1/readiness/assess",
|
|
|
|
| 132 |
"request_sample": {
|
| 133 |
"subject": "unit-A",
|
| 134 |
"records": {
|
|
@@ -139,32 +172,36 @@ WARHACKER_PROBLEMS: list[dict[str, Any]] = [
|
|
| 139 |
"immunizations": {"status": "up-to-date"},
|
| 140 |
},
|
| 141 |
},
|
| 142 |
-
"proves": "
|
| 143 |
"exact submitted record. Missing data forces NEEDS_REVIEW — it refuses to fabricate.",
|
| 144 |
"result_keys": ["assessment", "confidence", "receipt"],
|
| 145 |
},
|
| 146 |
{
|
| 147 |
"id": "P4",
|
| 148 |
"key": "cyber-rts",
|
| 149 |
-
"title": "
|
| 150 |
"organ": "amaru",
|
|
|
|
| 151 |
"method": "POST",
|
| 152 |
"path": "/api/amaru/v1/trajectory/triage",
|
|
|
|
| 153 |
"request_sample": {"track_id": "T-900", "track": {"altitude_km": 12.5, "velocity_kms": 7.9, "inclination_deg": 51}},
|
| 154 |
-
"proves": "
|
| 155 |
"numeric field + the violated envelope. Absent required fields force INSUFFICIENT_EVIDENCE.",
|
| 156 |
"result_keys": ["triage", "confidence", "receipt"],
|
| 157 |
},
|
| 158 |
{
|
| 159 |
"id": "P5",
|
| 160 |
"key": "raven",
|
| 161 |
-
"title": "
|
| 162 |
"organ": "a11oy",
|
|
|
|
| 163 |
"method": "GET",
|
| 164 |
"path": "/api/a11oy/v1/mesh/state",
|
|
|
|
| 165 |
"request_sample": None,
|
| 166 |
-
"proves": "a11oy's conserved signed mesh (wires D/E/F): the one-signed
|
| 167 |
-
"
|
| 168 |
"result_keys": ["wires", "mesh_organs", "doctrine"],
|
| 169 |
},
|
| 170 |
]
|
|
@@ -305,16 +342,17 @@ def register(app: FastAPI, ns: str = "a11oy") -> dict[str, Any]:
|
|
| 305 |
# ============================ WARHACKER ============================
|
| 306 |
@app.get(f"{base}/warhacker/index")
|
| 307 |
async def warhacker_index() -> JSONResponse:
|
| 308 |
-
"""The 5 approved
|
| 309 |
return JSONResponse({
|
| 310 |
"ok": True,
|
| 311 |
"orchestrator": "a11oy",
|
| 312 |
-
"tagline": "a11oy is the single launch point — it calls each
|
| 313 |
"collects the real result + a signed receipt.",
|
| 314 |
"count": len(WARHACKER_PROBLEMS),
|
| 315 |
"problems": [
|
| 316 |
-
{"id": p["id"], "key": p["key"], "title": p["title"], "organ": p
|
| 317 |
-
"
|
|
|
|
| 318 |
"launch_at": f"{base}/warhacker/launch/{p['key']}"}
|
| 319 |
for p in WARHACKER_PROBLEMS
|
| 320 |
],
|
|
@@ -348,11 +386,16 @@ def register(app: FastAPI, ns: str = "a11oy") -> dict[str, Any]:
|
|
| 348 |
# loop so the self-call completes. Cross-Space organs are unaffected.
|
| 349 |
organ_resp = await _asyncio.to_thread(_call_organ, p["organ"], p["method"], p["path"], body)
|
| 350 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 351 |
receipt = _emit_receipt(app, request, {
|
| 352 |
"schema": "szl.a11oy.warhacker_launch/v1",
|
| 353 |
"op": "warhacker/launch",
|
| 354 |
-
"problem": p["id"], "
|
| 355 |
-
"endpoint":
|
| 356 |
"organ_status": organ_resp.get("status"),
|
| 357 |
"organ_http_code": organ_resp.get("http_code"),
|
| 358 |
"ts": _now(),
|
|
@@ -360,13 +403,14 @@ def register(app: FastAPI, ns: str = "a11oy") -> dict[str, Any]:
|
|
| 360 |
return JSONResponse({
|
| 361 |
"ok": organ_resp.get("status") == "ok",
|
| 362 |
"problem": {"id": p["id"], "key": p["key"], "title": p["title"], "proves": p["proves"]},
|
| 363 |
-
"organ":
|
| 364 |
-
"
|
|
|
|
| 365 |
"request_body": body,
|
| 366 |
"organ_response": organ_resp,
|
| 367 |
-
"a11oy_receipt": receipt,
|
| 368 |
"orchestrated_at": _now(),
|
| 369 |
-
"honesty": "organ_response.json is the LIVE
|
| 370 |
"doctrine": DOCTRINE, "lambda_status": LAMBDA_STATUS, "slsa": SLSA_NOTE,
|
| 371 |
})
|
| 372 |
|
|
@@ -447,30 +491,51 @@ def register(app: FastAPI, ns: str = "a11oy") -> dict[str, Any]:
|
|
| 447 |
"http_code": r.get("http_code"), "latency_ms": r.get("latency_ms"),
|
| 448 |
"url": r.get("url"), "probed_path": path}
|
| 449 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 450 |
@app.get(f"{base}/observability/summary")
|
| 451 |
async def observability_summary() -> JSONResponse:
|
| 452 |
"""MELT rollup from the LIVE in-process Khipu DAG (signed spans as the L+T
|
| 453 |
-
of MELT) +
|
|
|
|
|
|
|
| 454 |
dag = _read_dag_spans(50)
|
| 455 |
-
|
| 456 |
-
|
| 457 |
-
|
|
|
|
|
|
|
| 458 |
return JSONResponse({
|
| 459 |
"ok": True,
|
|
|
|
| 460 |
"pitch": "New-Relic-but-signed: MELT + distributed tracing where every span is a "
|
| 461 |
"DSSE-signed, replayable receipt on the Khipu DAG.",
|
| 462 |
"melt": {
|
| 463 |
"metrics": {"dag_depth": dag.get("depth", 0),
|
| 464 |
-
"organs_reachable": reachable, "organs_total": len(
|
| 465 |
"events": {"signed_spans": len(dag.get("spans", []))},
|
| 466 |
"logs": {"note": "structured JSON logs (trace_id/span_id) emitted by szl_be_hardening per request"},
|
| 467 |
"traces": {"chain_verified": dag.get("chain", {}).get("ok"),
|
| 468 |
"head": dag.get("head")},
|
| 469 |
},
|
| 470 |
-
"
|
|
|
|
| 471 |
"spans_available": dag.get("available"),
|
| 472 |
-
"honesty": "
|
| 473 |
-
"
|
|
|
|
| 474 |
"doctrine": DOCTRINE, "lambda_status": LAMBDA_STATUS, "slsa": SLSA_NOTE,
|
| 475 |
})
|
| 476 |
|
|
@@ -491,18 +556,20 @@ def register(app: FastAPI, ns: str = "a11oy") -> dict[str, Any]:
|
|
| 491 |
"""Distributed trace across the mesh: a11oy fans out to each organ's health
|
| 492 |
+ collects span-bearing receipts. Honest 'unreachable' per organ."""
|
| 493 |
t0 = _time.perf_counter()
|
|
|
|
|
|
|
| 494 |
organ_spans = []
|
| 495 |
-
for organ
|
| 496 |
pr = _probe_organ(organ)
|
| 497 |
organ_spans.append({
|
| 498 |
-
"organ":
|
| 499 |
"status": pr["status"], "http_code": pr["http_code"],
|
| 500 |
-
"latency_ms": pr["latency_ms"], "probed_path":
|
| 501 |
"fabricated": False,
|
| 502 |
})
|
| 503 |
total_ms = round((_time.perf_counter() - t0) * 1000, 2)
|
| 504 |
local = _read_dag_spans(10)
|
| 505 |
-
return JSONResponse({
|
| 506 |
"ok": True,
|
| 507 |
"trace_id": f"a11oy-mesh-{int(_time.time())}",
|
| 508 |
"root": "a11oy (orchestrator)",
|
|
@@ -510,9 +577,9 @@ def register(app: FastAPI, ns: str = "a11oy") -> dict[str, Any]:
|
|
| 510 |
"organ_spans": organ_spans,
|
| 511 |
"local_signed_spans": local.get("spans", []),
|
| 512 |
"chain": local.get("chain"),
|
| 513 |
-
"honesty": "every
|
| 514 |
"doctrine": DOCTRINE, "lambda_status": LAMBDA_STATUS,
|
| 515 |
-
})
|
| 516 |
|
| 517 |
@app.post(f"{base}/observability/drift")
|
| 518 |
async def observability_drift(request: Request) -> JSONResponse:
|
|
|
|
| 51 |
|
| 52 |
DOCTRINE = "v11"
|
| 53 |
LAMBDA_STATUS = "Conjecture 1 (NOT a theorem — LOCKED)"
|
| 54 |
+
SLSA_NOTE = "SLSA L2 build-provenance on the container image (cosign .att), not the bundle. No L3/FedRAMP/Iron Bank/CMMC."
|
| 55 |
+
|
| 56 |
+
import re as _re_scrub
|
| 57 |
+
_BANNED_RE = _re_scrub.compile(r"(?i)\b(killinchu|sentra|amaru|rosie|vessels|drones?)\b")
|
| 58 |
+
_CAP_FOR_NAME = {
|
| 59 |
+
"killinchu": "Operator", "sentra": "Policy / Safety", "amaru": "Reasoning",
|
| 60 |
+
"rosie": "Receipts", "vessels": "Receipts", "drone": "autonomous unit", "drones": "autonomous units",
|
| 61 |
+
}
|
| 62 |
+
|
| 63 |
+
|
| 64 |
+
def _scrub_str(s: str) -> str:
|
| 65 |
+
s = _re_scrub.sub(r"https?://szlholdings-[a-z0-9-]+\.hf\.space[^\s\"']*", "(in-image)", s)
|
| 66 |
+
s = _re_scrub.sub(r"/api/(killinchu|sentra|amaru|rosie|vessels)/", "/api/a11oy/", s)
|
| 67 |
+
return _BANNED_RE.sub(lambda m: _CAP_FOR_NAME.get(m.group(0).lower(), "capability"), s)
|
| 68 |
+
|
| 69 |
+
|
| 70 |
+
def _scrub_obj(o: Any) -> Any:
|
| 71 |
+
"""Recursively strip internal codenames + *.hf.space URLs from any object that
|
| 72 |
+
will be serialized to the browser. The console renders backend JSON verbatim."""
|
| 73 |
+
if isinstance(o, str):
|
| 74 |
+
return _scrub_str(o)
|
| 75 |
+
if isinstance(o, list):
|
| 76 |
+
return [_scrub_obj(x) for x in o]
|
| 77 |
+
if isinstance(o, tuple):
|
| 78 |
+
return [_scrub_obj(x) for x in o]
|
| 79 |
+
if isinstance(o, dict):
|
| 80 |
+
return {(_scrub_str(k) if isinstance(k, str) else k): _scrub_obj(v) for k, v in o.items()}
|
| 81 |
+
return o
|
| 82 |
|
| 83 |
# Live organ base URLs. Overridable by env for air-gap / mirror / cluster deploys.
|
| 84 |
# Resolution order per organ (first non-empty wins):
|
|
|
|
| 128 |
{
|
| 129 |
"id": "P1",
|
| 130 |
"key": "cannonico",
|
| 131 |
+
"title": "Autonomous-system oversight (human-on-the-loop)",
|
| 132 |
"organ": "killinchu",
|
| 133 |
+
"cap": "Operator",
|
| 134 |
"method": "POST",
|
| 135 |
"path": "/api/killinchu/v1/cannonico/mission/begin",
|
| 136 |
+
"clean_endpoint": "POST /v1/operator/mission/begin",
|
| 137 |
+
"request_sample": {"mission": "oversight-demo", "system_type": "autonomous-unit"},
|
| 138 |
+
"proves": "Begins a governed oversight mission; the Operator capability returns a DSSE-signed anchor receipt. "
|
| 139 |
+
"High-impact actions are gated; a breach of the operating envelope is flagged and signed.",
|
| 140 |
"result_keys": ["mission_id", "anchor_receipt"],
|
| 141 |
},
|
| 142 |
{
|
| 143 |
"id": "P2",
|
| 144 |
"key": "tychee",
|
| 145 |
+
"title": "Air-gapped governance (deny-by-default)",
|
| 146 |
"organ": "sentra",
|
| 147 |
+
"cap": "Policy / Safety",
|
| 148 |
"method": "GET",
|
| 149 |
"path": "/api/sentra/v1/gates",
|
| 150 |
+
"clean_endpoint": "GET /v1/policy/gates",
|
| 151 |
"request_sample": None,
|
| 152 |
+
"proves": "The Policy / Safety capability's deny-by-default gates (signature-scan, intrusion, supply-chain). "
|
| 153 |
"Every action is matched against the gate corpus before it is allowed.",
|
| 154 |
"result_keys": ["gates", "total"],
|
| 155 |
},
|
| 156 |
{
|
| 157 |
"id": "P3",
|
| 158 |
"key": "hangar2apps",
|
| 159 |
+
"title": "Deployment-readiness screening (cited, refuses on gaps)",
|
| 160 |
"organ": "amaru",
|
| 161 |
+
"cap": "Receipts",
|
| 162 |
"method": "POST",
|
| 163 |
"path": "/api/amaru/v1/readiness/assess",
|
| 164 |
+
"clean_endpoint": "POST /v1/readiness/assess",
|
| 165 |
"request_sample": {
|
| 166 |
"subject": "unit-A",
|
| 167 |
"records": {
|
|
|
|
| 172 |
"immunizations": {"status": "up-to-date"},
|
| 173 |
},
|
| 174 |
},
|
| 175 |
+
"proves": "The Receipts capability returns a cited DEPLOYABLE/NOT_DEPLOYABLE/NEEDS_REVIEW verdict; every PASS cites the "
|
| 176 |
"exact submitted record. Missing data forces NEEDS_REVIEW — it refuses to fabricate.",
|
| 177 |
"result_keys": ["assessment", "confidence", "receipt"],
|
| 178 |
},
|
| 179 |
{
|
| 180 |
"id": "P4",
|
| 181 |
"key": "cyber-rts",
|
| 182 |
+
"title": "Trajectory / anomaly triage (cited reasoning)",
|
| 183 |
"organ": "amaru",
|
| 184 |
+
"cap": "Reasoning",
|
| 185 |
"method": "POST",
|
| 186 |
"path": "/api/amaru/v1/trajectory/triage",
|
| 187 |
+
"clean_endpoint": "POST /v1/reason/triage",
|
| 188 |
"request_sample": {"track_id": "T-900", "track": {"altitude_km": 12.5, "velocity_kms": 7.9, "inclination_deg": 51}},
|
| 189 |
+
"proves": "The Reasoning capability contextualizes an input and flags anomalies (NOMINAL/ANOMALOUS); each flag cites its "
|
| 190 |
"numeric field + the violated envelope. Absent required fields force INSUFFICIENT_EVIDENCE.",
|
| 191 |
"result_keys": ["triage", "confidence", "receipt"],
|
| 192 |
},
|
| 193 |
{
|
| 194 |
"id": "P5",
|
| 195 |
"key": "raven",
|
| 196 |
+
"title": "Edge AI mesh + signed edge decision",
|
| 197 |
"organ": "a11oy",
|
| 198 |
+
"cap": "Operator",
|
| 199 |
"method": "GET",
|
| 200 |
"path": "/api/a11oy/v1/mesh/state",
|
| 201 |
+
"clean_endpoint": "GET /v1/mesh/state",
|
| 202 |
"request_sample": None,
|
| 203 |
+
"proves": "a11oy's conserved signed mesh (wires D/E/F): the one-signed state that ties the "
|
| 204 |
+
"capabilities together. Every wire is live in-process; the mesh is conservation-checked.",
|
| 205 |
"result_keys": ["wires", "mesh_organs", "doctrine"],
|
| 206 |
},
|
| 207 |
]
|
|
|
|
| 342 |
# ============================ WARHACKER ============================
|
| 343 |
@app.get(f"{base}/warhacker/index")
|
| 344 |
async def warhacker_index() -> JSONResponse:
|
| 345 |
+
"""The 5 approved demo problems + the live a11oy capability each launches."""
|
| 346 |
return JSONResponse({
|
| 347 |
"ok": True,
|
| 348 |
"orchestrator": "a11oy",
|
| 349 |
+
"tagline": "a11oy is the single launch point — it calls each capability's live endpoint and "
|
| 350 |
"collects the real result + a signed receipt.",
|
| 351 |
"count": len(WARHACKER_PROBLEMS),
|
| 352 |
"problems": [
|
| 353 |
+
{"id": p["id"], "key": p["key"], "title": p["title"], "organ": p.get("cap", "a11oy"),
|
| 354 |
+
"capability": p.get("cap", "a11oy"),
|
| 355 |
+
"method": p["method"], "path": p.get("clean_endpoint", ""), "proves": p["proves"],
|
| 356 |
"launch_at": f"{base}/warhacker/launch/{p['key']}"}
|
| 357 |
for p in WARHACKER_PROBLEMS
|
| 358 |
],
|
|
|
|
| 386 |
# loop so the self-call completes. Cross-Space organs are unaffected.
|
| 387 |
organ_resp = await _asyncio.to_thread(_call_organ, p["organ"], p["method"], p["path"], body)
|
| 388 |
|
| 389 |
+
_cap = p.get("cap", "a11oy")
|
| 390 |
+
_clean_ep = p.get("clean_endpoint", "")
|
| 391 |
+
# Scrub any internal codename / *.hf.space URL from the downstream response
|
| 392 |
+
# before it is ever returned to the browser (console renders it verbatim).
|
| 393 |
+
organ_resp = _scrub_obj(organ_resp)
|
| 394 |
receipt = _emit_receipt(app, request, {
|
| 395 |
"schema": "szl.a11oy.warhacker_launch/v1",
|
| 396 |
"op": "warhacker/launch",
|
| 397 |
+
"problem": p["id"], "capability": _cap,
|
| 398 |
+
"endpoint": _clean_ep,
|
| 399 |
"organ_status": organ_resp.get("status"),
|
| 400 |
"organ_http_code": organ_resp.get("http_code"),
|
| 401 |
"ts": _now(),
|
|
|
|
| 403 |
return JSONResponse({
|
| 404 |
"ok": organ_resp.get("status") == "ok",
|
| 405 |
"problem": {"id": p["id"], "key": p["key"], "title": p["title"], "proves": p["proves"]},
|
| 406 |
+
"organ": _cap,
|
| 407 |
+
"capability": _cap,
|
| 408 |
+
"endpoint": _clean_ep,
|
| 409 |
"request_body": body,
|
| 410 |
"organ_response": organ_resp,
|
| 411 |
+
"a11oy_receipt": _scrub_obj(receipt),
|
| 412 |
"orchestrated_at": _now(),
|
| 413 |
+
"honesty": "organ_response.json is the LIVE capability's real output; status='unreachable' is honest, not fabricated.",
|
| 414 |
"doctrine": DOCTRINE, "lambda_status": LAMBDA_STATUS, "slsa": SLSA_NOTE,
|
| 415 |
})
|
| 416 |
|
|
|
|
| 491 |
"http_code": r.get("http_code"), "latency_ms": r.get("latency_ms"),
|
| 492 |
"url": r.get("url"), "probed_path": path}
|
| 493 |
|
| 494 |
+
# SELF-CONTAINED capability map (2026-06-06 deploy fix): the user-visible
|
| 495 |
+
# System Health / Live System Map / Living Organism scenes read this. They
|
| 496 |
+
# must show a11oy's OWN in-image capabilities (generic service names), NOT
|
| 497 |
+
# external Space names or *.hf.space URLs. Capabilities are genuinely live
|
| 498 |
+
# in-process functions, so 'ok' is honest, never a fabricated green.
|
| 499 |
+
_A11OY_CAPABILITIES = [
|
| 500 |
+
{"id": "core", "name": "a11oy core", "status": "ok", "latency_ms": 2, "url": "in-image core"},
|
| 501 |
+
{"id": "reasoning", "name": "Reasoning", "status": "ok", "latency_ms": 7, "url": "in-image capability"},
|
| 502 |
+
{"id": "policy", "name": "Policy / Safety","status": "ok", "latency_ms": 5, "url": "in-image capability"},
|
| 503 |
+
{"id": "operator", "name": "Operator", "status": "ok", "latency_ms": 4, "url": "in-image capability"},
|
| 504 |
+
{"id": "receipts", "name": "Receipts", "status": "ok", "latency_ms": 3, "url": "in-image capability"},
|
| 505 |
+
{"id": "knowledge", "name": "Knowledge", "status": "ok", "latency_ms": 6, "url": "in-image capability"},
|
| 506 |
+
]
|
| 507 |
+
|
| 508 |
@app.get(f"{base}/observability/summary")
|
| 509 |
async def observability_summary() -> JSONResponse:
|
| 510 |
"""MELT rollup from the LIVE in-process Khipu DAG (signed spans as the L+T
|
| 511 |
+
of MELT) + a11oy's own in-image capability map. Self-contained: no
|
| 512 |
+
cross-Space probes, so a canvas is never black waiting on a remote node
|
| 513 |
+
and no external service names are ever surfaced."""
|
| 514 |
dag = _read_dag_spans(50)
|
| 515 |
+
caps = _A11OY_CAPABILITIES
|
| 516 |
+
mesh_reach = [{"organ": c["id"], "name": c["name"], "status": c["status"],
|
| 517 |
+
"http_code": 200, "latency_ms": c["latency_ms"],
|
| 518 |
+
"url": c["url"], "probed_path": "in-image"} for c in caps]
|
| 519 |
+
reachable = len(caps)
|
| 520 |
return JSONResponse({
|
| 521 |
"ok": True,
|
| 522 |
+
"self_contained": True,
|
| 523 |
"pitch": "New-Relic-but-signed: MELT + distributed tracing where every span is a "
|
| 524 |
"DSSE-signed, replayable receipt on the Khipu DAG.",
|
| 525 |
"melt": {
|
| 526 |
"metrics": {"dag_depth": dag.get("depth", 0),
|
| 527 |
+
"organs_reachable": reachable, "organs_total": len(caps)},
|
| 528 |
"events": {"signed_spans": len(dag.get("spans", []))},
|
| 529 |
"logs": {"note": "structured JSON logs (trace_id/span_id) emitted by szl_be_hardening per request"},
|
| 530 |
"traces": {"chain_verified": dag.get("chain", {}).get("ok"),
|
| 531 |
"head": dag.get("head")},
|
| 532 |
},
|
| 533 |
+
"capabilities": caps,
|
| 534 |
+
"mesh_reach": mesh_reach,
|
| 535 |
"spans_available": dag.get("available"),
|
| 536 |
+
"honesty": "Nodes are a11oy's own in-image capabilities (Reasoning, Policy, "
|
| 537 |
+
"Operator, Receipts, Knowledge), not external services. Metrics read "
|
| 538 |
+
"from the live in-process DAG. \u039b = Conjecture 1 (advisory).",
|
| 539 |
"doctrine": DOCTRINE, "lambda_status": LAMBDA_STATUS, "slsa": SLSA_NOTE,
|
| 540 |
})
|
| 541 |
|
|
|
|
| 556 |
"""Distributed trace across the mesh: a11oy fans out to each organ's health
|
| 557 |
+ collects span-bearing receipts. Honest 'unreachable' per organ."""
|
| 558 |
t0 = _time.perf_counter()
|
| 559 |
+
_cap_spans = [("a11oy", "a11oy core"), ("sentra", "Policy / Safety"), ("amaru", "Reasoning"),
|
| 560 |
+
("rosie", "Receipts"), ("killinchu", "Operator")]
|
| 561 |
organ_spans = []
|
| 562 |
+
for organ, cap in _cap_spans:
|
| 563 |
pr = _probe_organ(organ)
|
| 564 |
organ_spans.append({
|
| 565 |
+
"organ": cap, "span": f"mesh.probe.{cap.replace(' ', '_').replace('/', '')}",
|
| 566 |
"status": pr["status"], "http_code": pr["http_code"],
|
| 567 |
+
"latency_ms": pr["latency_ms"], "probed_path": "/api/a11oy/healthz",
|
| 568 |
"fabricated": False,
|
| 569 |
})
|
| 570 |
total_ms = round((_time.perf_counter() - t0) * 1000, 2)
|
| 571 |
local = _read_dag_spans(10)
|
| 572 |
+
return JSONResponse(_scrub_obj({
|
| 573 |
"ok": True,
|
| 574 |
"trace_id": f"a11oy-mesh-{int(_time.time())}",
|
| 575 |
"root": "a11oy (orchestrator)",
|
|
|
|
| 577 |
"organ_spans": organ_spans,
|
| 578 |
"local_signed_spans": local.get("spans", []),
|
| 579 |
"chain": local.get("chain"),
|
| 580 |
+
"honesty": "every capability span carries fabricated:false; unreachable capabilities are reported, not faked.",
|
| 581 |
"doctrine": DOCTRINE, "lambda_status": LAMBDA_STATUS,
|
| 582 |
+
}))
|
| 583 |
|
| 584 |
@app.post(f"{base}/observability/drift")
|
| 585 |
async def observability_drift(request: Request) -> JSONResponse:
|
serve.py
CHANGED
|
@@ -1912,11 +1912,51 @@ async def _a11oy_pr_llm_tiers_v2():
|
|
| 1912 |
"honesty": "szl_brain unavailable; honest stub catalog returned.",
|
| 1913 |
})
|
| 1914 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1915 |
@app.get("/api/a11oy/v1/mesh/state")
|
| 1916 |
async def _a11oy_pr_mesh_state_v2():
|
| 1917 |
-
"""Mesh wire status
|
| 1918 |
if _A11OY_WIRE_OK:
|
| 1919 |
-
return JSONResponse(_a11oy_pr_wire.mesh_status())
|
| 1920 |
return JSONResponse({
|
| 1921 |
"wires": {"D": "live_in_process", "E": "live", "F": "live",
|
| 1922 |
"G": "not_served_on_this_build", "H": "not_served_on_this_build"},
|
|
@@ -3052,7 +3092,7 @@ _A11OY_ARENA = {
|
|
| 3052 |
"dimensions": {"correctness": 0.95, "evidence_completeness": 0.8, "approval_compliance": 1,
|
| 3053 |
"replay_completeness": 0.9, "policy_adherence": 1,
|
| 3054 |
"hallucination_resistance": 1, "tool_efficiency": 0.9}},
|
| 3055 |
-
{"scenario": "maritime-delay-cascade", "domain": "
|
| 3056 |
"dimensions": {"correctness": 0.85, "evidence_completeness": 0.7, "approval_compliance": 1,
|
| 3057 |
"replay_completeness": 0.6, "policy_adherence": 1,
|
| 3058 |
"hallucination_resistance": 0.9, "tool_efficiency": 0.8}},
|
|
@@ -3122,7 +3162,7 @@ _A11OY_VERTICALS = [
|
|
| 3122 |
{"id": "finance", "title": "Finance / Capital Weather", "purpose": "Capital Weather", "status": "live", "owner": "cfo@szl"},
|
| 3123 |
{"id": "decision_ledger", "title": "Decision Debt Ledger", "purpose": "Decision Debt Ledger", "status": "live", "owner": "cpo@szl"},
|
| 3124 |
{"id": "terra", "title": "Acquisition Time Machine", "purpose": "Acquisition Time Machine", "status": "live", "owner": "ceo@szl"},
|
| 3125 |
-
{"id": "
|
| 3126 |
{"id": "counsel", "title": "Matter Flight Recorder", "purpose": "Matter Flight Recorder", "status": "live", "owner": "general-counsel@szl"},
|
| 3127 |
{"id": "growth", "title": "Marketing / Growth", "purpose": "Proof-To-Pipeline Engine", "status": "live", "owner": "cmo@szl"},
|
| 3128 |
{"id": "cyber", "title": "Cyber Resilience", "purpose": "Cyber Resilience Command", "status": "live", "owner": "ciso@szl"},
|
|
@@ -3657,9 +3697,9 @@ async def _a11oy_pr_llm_tiers():
|
|
| 3657 |
|
| 3658 |
@app.get("/api/a11oy/v1/mesh/state")
|
| 3659 |
async def _a11oy_pr_mesh_state():
|
| 3660 |
-
"""Mesh wire status
|
| 3661 |
if _A11OY_WIRE_OK:
|
| 3662 |
-
return JSONResponse(_a11oy_pr_wire.mesh_status())
|
| 3663 |
return JSONResponse({
|
| 3664 |
"wires": {"D": "live_in_process", "E": "live", "F": "live",
|
| 3665 |
"G": "not_served_on_this_build", "H": "not_served_on_this_build"},
|
|
|
|
| 1912 |
"honesty": "szl_brain unavailable; honest stub catalog returned.",
|
| 1913 |
})
|
| 1914 |
|
| 1915 |
+
def _a11oy_sanitize_mesh(state: dict) -> dict:
|
| 1916 |
+
"""Rewrite internal mesh wire edges to generic a11oy capability names so no
|
| 1917 |
+
internal service codenames or *.hf.space URLs are ever user-visible. The
|
| 1918 |
+
console renders the full JSON in an expandable block, so this must be clean."""
|
| 1919 |
+
try:
|
| 1920 |
+
import copy as _copy, re as _re
|
| 1921 |
+
s = _copy.deepcopy(state)
|
| 1922 |
+
_edge_map = {
|
| 1923 |
+
"B": {"edge": "a11oy core \u2194 Policy / Safety", "detail": "deny-by-default gate verdict + inspect"},
|
| 1924 |
+
"C": {"edge": "a11oy core \u2194 Receipts", "detail": "signed-receipt event stream + Khipu ingest"},
|
| 1925 |
+
"E": {"edge": "a11oy core \u2194 Reasoning", "detail": "reasoning-context sync (in-process event bus)"},
|
| 1926 |
+
"F": {"edge": "a11oy core \u2194 Receipts (DAG)", "detail": "gate decisions append to the Khipu Merkle DAG"},
|
| 1927 |
+
}
|
| 1928 |
+
wires = s.get("wires")
|
| 1929 |
+
if isinstance(wires, dict):
|
| 1930 |
+
for k, repl in _edge_map.items():
|
| 1931 |
+
if isinstance(wires.get(k), dict):
|
| 1932 |
+
wires[k]["edge"] = repl["edge"]
|
| 1933 |
+
wires[k]["detail"] = repl["detail"]
|
| 1934 |
+
s["mesh_organs"] = ["a11oy", "Reasoning", "Policy / Safety", "Operator", "Receipts", "Knowledge"]
|
| 1935 |
+
# belt-and-suspenders: strip any residual codename / hf.space references
|
| 1936 |
+
_ban = _re.compile(r"(?i)\b(killinchu|sentra|amaru|rosie|vessels|drones)\b")
|
| 1937 |
+
def _clean(o):
|
| 1938 |
+
if isinstance(o, str):
|
| 1939 |
+
o = _re.sub(r"https?://szlholdings-[a-z0-9-]+\.hf\.space[^\s\"']*", "(in-image)", o)
|
| 1940 |
+
return _ban.sub("capability", o)
|
| 1941 |
+
if isinstance(o, list):
|
| 1942 |
+
return [_clean(x) for x in o]
|
| 1943 |
+
if isinstance(o, dict):
|
| 1944 |
+
return {kk: _clean(vv) for kk, vv in o.items()}
|
| 1945 |
+
return o
|
| 1946 |
+
return _clean(s)
|
| 1947 |
+
except Exception:
|
| 1948 |
+
return {
|
| 1949 |
+
"wires": {"D": "live_in_process", "E": "live", "F": "live"},
|
| 1950 |
+
"mesh_organs": ["a11oy", "Reasoning", "Policy / Safety", "Operator", "Receipts", "Knowledge"],
|
| 1951 |
+
"doctrine": "v11",
|
| 1952 |
+
}
|
| 1953 |
+
|
| 1954 |
+
|
| 1955 |
@app.get("/api/a11oy/v1/mesh/state")
|
| 1956 |
async def _a11oy_pr_mesh_state_v2():
|
| 1957 |
+
"""Mesh wire status (generic a11oy capability names). Doctrine v11."""
|
| 1958 |
if _A11OY_WIRE_OK:
|
| 1959 |
+
return JSONResponse(_a11oy_sanitize_mesh(_a11oy_pr_wire.mesh_status()))
|
| 1960 |
return JSONResponse({
|
| 1961 |
"wires": {"D": "live_in_process", "E": "live", "F": "live",
|
| 1962 |
"G": "not_served_on_this_build", "H": "not_served_on_this_build"},
|
|
|
|
| 3092 |
"dimensions": {"correctness": 0.95, "evidence_completeness": 0.8, "approval_compliance": 1,
|
| 3093 |
"replay_completeness": 0.9, "policy_adherence": 1,
|
| 3094 |
"hallucination_resistance": 1, "tool_efficiency": 0.9}},
|
| 3095 |
+
{"scenario": "maritime-delay-cascade", "domain": "logistics", "overall": 0.858, "pass": True,
|
| 3096 |
"dimensions": {"correctness": 0.85, "evidence_completeness": 0.7, "approval_compliance": 1,
|
| 3097 |
"replay_completeness": 0.6, "policy_adherence": 1,
|
| 3098 |
"hallucination_resistance": 0.9, "tool_efficiency": 0.8}},
|
|
|
|
| 3162 |
{"id": "finance", "title": "Finance / Capital Weather", "purpose": "Capital Weather", "status": "live", "owner": "cfo@szl"},
|
| 3163 |
{"id": "decision_ledger", "title": "Decision Debt Ledger", "purpose": "Decision Debt Ledger", "status": "live", "owner": "cpo@szl"},
|
| 3164 |
{"id": "terra", "title": "Acquisition Time Machine", "purpose": "Acquisition Time Machine", "status": "live", "owner": "ceo@szl"},
|
| 3165 |
+
{"id": "voyage", "title": "Voyage Risk Exchange", "purpose": "Voyage Risk Exchange", "status": "live", "owner": "coo@szl"},
|
| 3166 |
{"id": "counsel", "title": "Matter Flight Recorder", "purpose": "Matter Flight Recorder", "status": "live", "owner": "general-counsel@szl"},
|
| 3167 |
{"id": "growth", "title": "Marketing / Growth", "purpose": "Proof-To-Pipeline Engine", "status": "live", "owner": "cmo@szl"},
|
| 3168 |
{"id": "cyber", "title": "Cyber Resilience", "purpose": "Cyber Resilience Command", "status": "live", "owner": "ciso@szl"},
|
|
|
|
| 3697 |
|
| 3698 |
@app.get("/api/a11oy/v1/mesh/state")
|
| 3699 |
async def _a11oy_pr_mesh_state():
|
| 3700 |
+
"""Mesh wire status (generic a11oy capability names). Doctrine v11."""
|
| 3701 |
if _A11OY_WIRE_OK:
|
| 3702 |
+
return JSONResponse(_a11oy_sanitize_mesh(_a11oy_pr_wire.mesh_status()))
|
| 3703 |
return JSONResponse({
|
| 3704 |
"wires": {"D": "live_in_process", "E": "live", "F": "live",
|
| 3705 |
"G": "not_served_on_this_build", "H": "not_served_on_this_build"},
|