betterwithage commited on
Commit
951f61c
·
verified ·
1 Parent(s): 57de950

fix(readiness): add energy+SCI endpoints to tabs matrix + stress targets

Browse files

Register /api/a11oy/v1/energy/{live,mesh,harvest,sci} in harness; wire 4 energy console views.

Signed-off-by: Stephen Lutar <stephenlutar2@gmail.com>

tools/readiness-harness/gen_tabs_matrix.py ADDED
@@ -0,0 +1,697 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env python3
2
+ """Generate tabs.json — the Tab Contract Matrix for the a11oy console.
3
+
4
+ This is the single source of truth that proves "every tab is real". It maps every
5
+ console tab -> route -> backing endpoints -> response schema -> freshness SLA ->
6
+ citations-required -> degraded rules. The harness (Playwright sweeper, API probe
7
+ runner, link-check, stress suite) all consume this file.
8
+
9
+ Design:
10
+ - The TAB list is extracted from the live console source (pages/console.html) so it
11
+ can never silently drift away from what actually ships.
12
+ - The ENDPOINT contract registry (schemas, freshness SLAs, citation + degraded
13
+ rules) is curated here and grounded in the real /api/a11oy/v1/* surface. This is
14
+ the part a human reviews; it encodes the doctrine-v11 honesty contract.
15
+ - Tabs are attached to endpoints by an explicit per-tab map (preferred) falling back
16
+ to a family-prefix heuristic, so a new tab is never left un-contracted.
17
+
18
+ Run: python3 tools/readiness-harness/gen_tabs_matrix.py
19
+ python3 tools/readiness-harness/gen_tabs_matrix.py --check # CI: fail on drift
20
+ """
21
+ from __future__ import annotations
22
+
23
+ import json
24
+ import os
25
+ import re
26
+ import sys
27
+ from datetime import datetime, timezone
28
+
29
+ HERE = os.path.dirname(os.path.abspath(__file__))
30
+ REPO = os.path.abspath(os.path.join(HERE, "..", ".."))
31
+ CONSOLE = os.path.join(REPO, "pages", "console.html")
32
+ OUT = os.path.join(HERE, "tabs.json")
33
+
34
+ ORGAN = "a11oy"
35
+ CONSOLE_ROUTE = "/console"
36
+
37
+ # ── Endpoint contract registry ─────────────────────────────────────────────
38
+ # freshnessSLA: max acceptable age (seconds) of the data the endpoint returns;
39
+ # null -> static/derived, no freshness obligation.
40
+ # citationsRequired: the response MUST carry at least one citation/source when it
41
+ # claims live external data (doctrine v11: "no mock theater").
42
+ # degraded: which honest states the harness tolerates without failing the build.
43
+ # allowStatuses are the only HTTP codes that count as "up"; anything else
44
+ # (4xx/5xx) is an undeclared breakage and fails. allowLabels are the honest
45
+ # data_kind/status labels a tab may carry (live, cached, degraded, sample…).
46
+ # liesIf: response shapes that count as a "lie" (stale/mock/uncited) -> fail.
47
+ def ep(method="GET", schema=None, sla=None, citations=False,
48
+ allow_statuses=(200,), allow_labels=("live", "cached"),
49
+ lies_if=("mock", "fabricated", "placeholder"), note=""):
50
+ return {
51
+ "method": method,
52
+ "schema": schema,
53
+ "freshnessSLA": sla,
54
+ "citationsRequired": citations,
55
+ "degradedRules": {
56
+ "allowStatuses": list(allow_statuses),
57
+ "allowLabels": list(allow_labels),
58
+ "liesIf": list(lies_if),
59
+ },
60
+ "note": note,
61
+ }
62
+
63
+
64
+ DAY = 86400
65
+ HOUR = 3600
66
+ MIN = 60
67
+
68
+ ENDPOINTS = {
69
+ # ── Core honesty / governance spine ──
70
+ "/api/a11oy/v1/lambda": ep(schema="lambda", sla=None,
71
+ note="Λ governance score — derived/deterministic, Conjecture-1 honest."),
72
+ "/api/a11oy/v1/gates": ep(schema="gates", sla=None),
73
+ "/api/a11oy/v1/formulas/selftest": ep(schema="selftest", sla=None,
74
+ note="Kernel-gated proven-formula self-test."),
75
+ "/api/a11oy/v1/mcp/tools": ep(schema="mcp_tools", sla=None,
76
+ note="Returns the 4 real flagship tools; never the fabricated 12."),
77
+ "/api/a11oy/v1/llm/registry": ep(schema="llm_registry", sla=None),
78
+ "/api/a11oy/v1/reason/tiers": ep(schema="generic_obj", sla=None),
79
+ "/api/a11oy/v1/reason/readiness": ep(schema="generic_obj", sla=None),
80
+
81
+ # ── Governed decision endpoints (POST; empty body legitimately 400/422) ──
82
+ "/api/a11oy/v1/policy/decide": ep(method="POST", schema="generic_obj", sla=None,
83
+ allow_statuses=(200, 400, 422), note="Governed decision; empty body validates."),
84
+ "/api/a11oy/v1/operator/ask": ep(method="POST", schema="generic_obj", sla=None,
85
+ allow_statuses=(200, 400, 422), note="Operator ask; empty body validates."),
86
+
87
+ # ── Provenance / receipts ──
88
+ # NOTE: the console calls /api/a11oy/provenance (NO /v1/). /v1/provenance is 404.
89
+ "/api/a11oy/provenance": ep(schema="provenance", sla=DAY, citations=True,
90
+ note="Combined provenance board (note: /provenance, NOT /v1/provenance)."),
91
+ "/api/a11oy/v1/ledger": ep(schema="ledger", sla=DAY),
92
+ "/api/a11oy/v1/receipt/export": ep(schema="generic_obj", sla=None),
93
+ "/api/a11oy/cosign.pub": ep(schema="text", sla=None,
94
+ note="Public signing key for offline receipt verification."),
95
+
96
+ # ── Eval arena ──
97
+ "/api/a11oy/v1/eval-arena/history": ep(schema="arena_history", sla=DAY),
98
+
99
+ # ── Energy / GSF SCI ──
100
+ "/api/a11oy/v1/energy/live": ep(schema="generic_obj", sla=30,
101
+ allow_labels=("MEASURED", "UNAVAILABLE", "live", "cached"),
102
+ note="Live NVML power+energy snapshot. UNAVAILABLE when meter offline — honest null, never fabricated."),
103
+ "/api/a11oy/v1/energy/mesh": ep(schema="generic_obj", sla=30,
104
+ allow_labels=("MEASURED", "UNAVAILABLE", "live", "cached"),
105
+ note="Per-node energy + governance posture for 3D view."),
106
+ "/api/a11oy/v1/energy/harvest": ep(schema="generic_obj", sla=HOUR,
107
+ allow_labels=("MEASURED", "UNAVAILABLE", "SAMPLE", "MODELED", "live", "cached"),
108
+ note="Bekenstein budget series + heuristic tariff window. Tariff = client-side heuristic, NOT live feed."),
109
+ "/api/a11oy/v1/energy/sci": ep(schema="generic_obj", sla=60,
110
+ allow_labels=("MEASURED", "UNAVAILABLE", "MODELED", "live", "cached"),
111
+ note="GSF SCI ISO 21031:2024 energy+carbon. sci_score=null when meter offline. Grid intensity MODELED (436 gCO2eq/kWh EPA eGRID 2023) or MEASURED via Electricity Maps."),
112
+
113
+ # ── Observability ──
114
+ "/api/a11oy/v1/observability/summary": ep(schema="generic_obj", sla=HOUR),
115
+ "/api/a11oy/v1/observability/business": ep(schema="generic_obj", sla=HOUR),
116
+
117
+ # ── Mosaic governance (szl_mosaic_governance.py — DETERMINISTIC governed view;
118
+ # a11oy governs killinchu's anomaly/SDA detections). Like /v1/lambda this is a
119
+ # derived/deterministic governance surface, NOT a live no-mock-theater external
120
+ # feed: same inputs -> same governed view, so there is no freshness obligation
121
+ # (sla=None) and no external-citation obligation. Λ is Conjecture-1 ADVISORY
122
+ # (allow<0.35 / advisory / deny>=0.65), Khipu BFT 3-of-4 is Conjecture 2, receipts
123
+ # are DSSE-shaped + UNSIGNED on snapshot, verified=false. The honest fallback label
124
+ # is "snapshot" (source="snapshot") — explicitly allowed so the honest degraded
125
+ # state is never branded a lie; the live a11oy fabric upgrades it when deployed. ──
126
+ "/api/a11oy/v1/mosaic/governed": ep(schema="mosaic_governed", sla=None,
127
+ allow_labels=("live", "cached", "snapshot", "sample"),
128
+ note="Governed-anomaly COP oversight: per-track Λ advisory verdict (Conjecture 1), DSSE-shaped provenance receipt, Khipu BFT 3-of-4 (Conjecture 2), conformal CI, human-approval gate. Deterministic; source=snapshot/verified=false until Forge deploys the live fabric route."),
129
+
130
+ # ── Mesh / capabilities ──
131
+ "/api/a11oy/v1/mesh/state": ep(schema="mesh", sla=5 * MIN),
132
+ "/api/a11oy/v1/capabilities/mesh": ep(schema="mesh", sla=5 * MIN),
133
+
134
+ # ── Operator (rosie) ──
135
+ "/api/a11oy/v1/operator/ledger": ep(schema="generic_obj", sla=HOUR),
136
+ "/api/a11oy/v1/operator/recommend": ep(method="POST", schema="generic_obj", sla=None),
137
+ "/api/a11oy/v2/operator/command-log": ep(schema="generic_obj", sla=None,
138
+ note="Append-only command log; quiet != stale, so no freshness SLA."),
139
+
140
+ # ── Policy (sentra) ──
141
+ "/api/a11oy/v1/policy/compliance": ep(schema="generic_obj", sla=HOUR),
142
+ "/api/a11oy/v1/policy/gates": ep(schema="generic_obj", sla=None),
143
+ "/api/a11oy/v1/policy/threats": ep(schema="generic_obj", sla=None, citations=True,
144
+ note="Curated, citation-gated policy threat catalog (not a live feed); judged on citations, not freshness."),
145
+ "/api/a11oy/v1/policy/decisions/feed": ep(schema="generic_obj", sla=HOUR),
146
+
147
+ # ── Security feeds (live external OSINT) ──
148
+ "/api/a11oy/v1/sec/cve": ep(schema="generic_list", sla=DAY, citations=True,
149
+ note="Live CVE feed (NVD)."),
150
+ "/api/a11oy/v1/sec/kev": ep(schema="generic_list", sla=DAY, citations=True,
151
+ note="Live CISA KEV catalog."),
152
+ "/api/a11oy/v1/sec/attack": ep(schema="generic_obj", sla=DAY, citations=True),
153
+ "/api/a11oy/v1/sec/threats": ep(schema="generic_obj", sla=HOUR, citations=True),
154
+ "/api/a11oy/v1/sec/threatgraph": ep(schema="generic_obj", sla=HOUR, citations=True),
155
+
156
+ # ── Vertical packs / deva (finance, live external) ──
157
+ "/api/a11oy/v1/vertical-packs": ep(schema="generic_obj", sla=None),
158
+ "/api/a11oy/v1/vert/finance/feed": ep(schema="generic_obj", sla=HOUR, citations=True,
159
+ note="Live Yahoo/macro finance feed; cold-burst 404 tolerated, re-probe."),
160
+ "/api/a11oy/v1/deva/healthz": ep(schema="deva_health", sla=5 * MIN,
161
+ note="deva feed health — lists the live tabs[]; warm before judging deep tabs."),
162
+
163
+ # ── devb (legal + enterprise, live external) ──
164
+ "/api/a11oy/v1/devb/healthz": ep(schema="generic_obj", sla=5 * MIN),
165
+
166
+ # ── seismic ──
167
+ "/api/a11oy/v1/seismic/forecast": ep(schema="generic_obj", sla=HOUR, citations=True),
168
+
169
+ # ── warhacker ──
170
+ "/api/a11oy/v1/warhacker/index": ep(schema="generic_obj", sla=None),
171
+
172
+ # ── New live tabs (2026-06-10 agent/Chaski/router build) ──
173
+ # feedpulse: real-time server-side liveness probe of every upstream evidence
174
+ # feed (kev/osv/rekor/iss/celestrak/prometheus/fhir). Each item carries a
175
+ # source + source_url, so citations are required; data must be fresh.
176
+ "/api/a11oy/v1/feeds/pulse": ep(schema="feeds_pulse", sla=5 * MIN, citations=True,
177
+ note="Live data-feed liveness/provenance heartbeat; each item cites source_url."),
178
+ # kevgate: live CISA KEV CVEs mapped through the REAL governed policy engine.
179
+ "/api/a11oy/v1/sec/kevgate": ep(schema="kevgate", sla=DAY, citations=True,
180
+ note="Live CISA KEV -> deny-by-default gate impact; gates_fired is the real engine result."),
181
+ # router/stats: live per-tier router stats derived from the real szl_brain.TIERS
182
+ # catalog. Throughput is an honest in-memory counter (resets on rebuild), so
183
+ # it is deterministic/derived -> no freshness SLA and no external citation.
184
+ "/api/a11oy/v1/router/stats": ep(schema="router_stats", sla=None,
185
+ note="Live LLM-router per-tier stats from szl_brain.TIERS; throughput is an honest in-memory counter."),
186
+
187
+ # ── Metabolic scaling (szl_scaling.py — DETERMINISTIC, reproduces documented numerics) ──
188
+ # These are pure closed-form computations of published allometric/scaling laws,
189
+ # NOT a live external feed: same inputs -> same output every call, so there is no
190
+ # freshness obligation (sla=None/static). Each response already carries the author
191
+ # attributions (Kleiber 1932, West-Brown-Enquist 1997, Banavar-Maritan-Rinaldo 1999,
192
+ # Brown et al. 2004 MTE, Demetrius-Tuszynski 2010, Kaplan et al. 2020) in its body —
193
+ # see /scaling/summary.sources. Honest labels: the reproduced classical numerics are
194
+ # VERIFIED-deterministic; the SZL unified Φ (and compute-allometry analogy) are
195
+ # explicitly PROPOSED — Φ is an engineering construct, NOT in the locked 8 and NOT
196
+ # the formal Λ (Λ stays Conjecture 1). citationsRequired stays False because these
197
+ # are derived computations (like /v1/lambda), not a live-data "no-mock-theater" feed;
198
+ # the citations ride along as documentation, not as a freshness/liveness obligation.
199
+ #
200
+ # 200-on-bare-GET family: summary/exponents/compute take no required params.
201
+ "/api/a11oy/v1/scaling/summary": ep(schema="scaling", sla=None,
202
+ note="Deterministic scaling overview: status legend + author sources (Kleiber 1932 / WBE 1997 / Banavar 1999 / Brown 2004 / Demetrius-Tuszynski 2010 / Kaplan 2020) + worked examples. VERIFIED reproductions; SZL-Φ PROPOSED, NOT formal Λ."),
203
+ "/api/a11oy/v1/scaling/exponents": ep(schema="scaling", sla=None,
204
+ note="Deterministic catalog of universal scaling exponents, each row attributed (cite=). VERIFIED documented values."),
205
+ "/api/a11oy/v1/scaling/compute": ep(schema="scaling", sla=None,
206
+ note="Compute-capability-as-allometry mapping (Kaplan et al. 2020 neural scaling); status=PROPOSED analogy, NOT formal Λ."),
207
+ # M-required family: kleiber/mte/heart/unified require ?M=<mass_kg>; calling without
208
+ # the required query param legitimately validates (400/422) — that is honest input
209
+ # validation (same pattern as the governed POST endpoints), NOT an undeclared break.
210
+ # schema=generic_obj (not the strict scaling schema) because the probe runner hits
211
+ # these bare (no ?M=) and validates the body of whatever status it allows; the
212
+ # 200 result AND the honest 400/422 validation body are both JSON objects (same
213
+ # pattern as the governed POST endpoints), so generic_obj passes both without
214
+ # branding legitimate input-validation a schema lie.
215
+ "/api/a11oy/v1/scaling/kleiber": ep(schema="generic_obj", sla=None,
216
+ allow_statuses=(200, 400, 422),
217
+ note="Kleiber 1932 B=B0·M^(3/4) basal metabolic rate; requires ?M=<kg>. Empty M validates (400/422). VERIFIED deterministic (70kg -> 1694.03 kcal/day)."),
218
+ "/api/a11oy/v1/scaling/mte": ep(schema="generic_obj", sla=None,
219
+ allow_statuses=(200, 400, 422),
220
+ note="Brown et al. 2004 MTE Boltzmann-factor metabolic rate; requires ?M=<kg>. Empty M validates (400/422). VERIFIED deterministic."),
221
+ "/api/a11oy/v1/scaling/heart": ep(schema="generic_obj", sla=None,
222
+ allow_statuses=(200, 400, 422),
223
+ note="MTE-derived heart-rate/lifespan allometry; requires ?M=<kg>. Empty M validates (400/422). VERIFIED deterministic (70kg -> 83.32 bpm)."),
224
+ "/api/a11oy/v1/scaling/unified": ep(schema="generic_obj", sla=None,
225
+ allow_statuses=(200, 400, 422),
226
+ note="SZL unified Φ (WBE network × MTE/PMF activation × coherence); requires ?M=<kg>. status=PROPOSED, note carries 'Λ=Conjecture 1'. PROPOSED engineering construct, NOT the formal Λ, NOT in the locked 8."),
227
+
228
+ # ── Allodial AI sovereignty (szl_allodial.py — DETERMINISTIC; PROPOSED engineering
229
+ # gate, NOT the formal Λ; Λ stays Conjecture 1; adds NOTHING to the locked 8). Every
230
+ # formula derived from cited prior art (Denning 1976 lattice / Goguen-Meseguer 1982
231
+ # non-interference / EU-CSF SEAL+SovScore / HHI). SZL claims none as its own. ──
232
+ "/api/a11oy/v1/allodial/summary": ep(schema="generic_obj", sla=None,
233
+ note="Allodial doctrine summary: thesis, 3 layers (land/deed/allodium), SEAL scale, doctrine gates (tier=EXPERIMENTAL/PROPOSED, lambda=Conjecture 1, allodial_is_formal_lambda=False, trust_never_100=True), cites. PROPOSED, NOT the formal Λ."),
234
+ "/api/a11oy/v1/allodial/score": ep(schema="generic_obj", sla=None,
235
+ allow_statuses=(200, 400, 422),
236
+ note="Allodial Sovereignty Score A=[Σ w_k·SEAL_k/4]×(1−DCI)×100 from ?seals=&weights=&dep=. EU-CSF weighted SEAL + HHI lock-in penalty (both cited). tier=PROPOSED (weights need calibration), NOT the formal Λ."),
237
+ "/api/a11oy/v1/allodial/lattice": ep(schema="generic_obj", sla=None,
238
+ allow_statuses=(200, 400, 422),
239
+ note="Denning-1976 access-control lattice (DOI:10.1145/360051.360056) rendered as a 3D DAG: ⊤=SEAL-4 allodial top, feudal chains strictly lower. Deterministic; PROPOSED engineering view, NOT the formal Λ."),
240
+ "/api/a11oy/v1/allodial/noninterference": ep(schema="generic_obj", sla=None,
241
+ allow_statuses=(200, 400, 422),
242
+ note="Goguen-Meseguer 1982 non-interference witness (IEEE S&P): purged-op equivalence over the lattice. Deterministic; cited prior art; PROPOSED, NOT the formal Λ."),
243
+
244
+ # ── szl_entanglement.py: 2-qubit entanglement measures + the PROPOSED coherence→
245
+ # entanglement-capacity bridge E_max(t) ≤ C0·exp(−γt). PURE STDLIB, deterministic,
246
+ # byte-identical a11oy↔killinchu. EXPERIMENTAL tier; adds NOTHING to the locked 8;
247
+ # Λ stays Conjecture 1; the capacity bound is a PROPOSED engineering gate, NOT the
248
+ # formal Λ; trust never 100%. Every borrowed formula cited to its real author. ──
249
+ "/api/a11oy/v1/entangle/summary": ep(schema="generic_obj", sla=None,
250
+ note="Entanglement module summary: honest verdict + tiers (RIGOROUS bridge / monogamy STRUCTURAL / QBA NARRATIVE / avian ACTIVE / FMO CONTESTED / Orch-OR SPECULATIVE), measures, doctrine (locked_count_unchanged, lambda=Conjecture 1, trust_never_100, tier=EXPERIMENTAL/PROPOSED), cites. PROPOSED, NOT the formal Λ."),
251
+ "/api/a11oy/v1/entangle/capacity_bound": ep(schema="generic_obj", sla=None,
252
+ allow_statuses=(200, 400, 422),
253
+ note="HERO bridge: E_max(t) ≤ C0·exp(−γt) tying SZL Λ-v5 coherence decay to entanglement-generating CAPACITY (Streltsov 2015, RMP 89:041003) composed with the merged-Lean coherence curve. Deterministic; PROPOSED engineering gate, NOT the formal Λ; Λ stays Conjecture 1."),
254
+ "/api/a11oy/v1/entangle/entropy": ep(schema="generic_obj", sla=None,
255
+ allow_statuses=(200, 400, 422),
256
+ note="von Neumann entanglement entropy (bits) for state=bell|product. Bell=1 bit, product=0. Cited (von Neumann). Deterministic."),
257
+ "/api/a11oy/v1/entangle/concurrence": ep(schema="generic_obj", sla=None,
258
+ allow_statuses=(200, 400, 422),
259
+ note="Wootters 1998 concurrence + entanglement of formation for state=bell|product. Bell concurrence=1, product=0. Cited (Wootters, PRL 80:2245). Deterministic."),
260
+ "/api/a11oy/v1/entangle/negativity": ep(schema="generic_obj", sla=None,
261
+ allow_statuses=(200, 400, 422),
262
+ note="Vidal-Werner 2002 negativity + logarithmic negativity for state=bell|product. Bell negativity=0.5, product=0. Cited (Vidal-Werner, PRA 65:032314). Deterministic."),
263
+ "/api/a11oy/v1/entangle/chsh": ep(schema="generic_obj", sla=None,
264
+ allow_statuses=(200, 400, 422),
265
+ note="CHSH 1969 S value vs classical bound 2 vs Tsirelson 1980 bound 2√2 from ?corr=c1,c2,c3,c4; flags local-realism violation. Cited (CHSH PRL 23:880 / Tsirelson). Deterministic."),
266
+ "/api/a11oy/v1/entangle/monogamy": ep(schema="generic_obj", sla=None,
267
+ allow_statuses=(200, 400, 422),
268
+ note="CKW 2000 monogamy Σ τ_pairwise ≤ τ_global from ?pairwise=&total= — the STRUCTURAL no-leak / trust<100% primitive tying to Khipu. Cited (Coffman-Kundu-Wootters, PRA 61:052306). Deterministic."),
269
+
270
+ # ── szl_neuroplasticity.py: cited learning-rule math grounding the agent loop.
271
+ # PURE STDLIB, deterministic, byte-identical a11oy↔killinchu. EXPERIMENTAL tier; adds
272
+ # NOTHING to the locked 8; Λ stays Conjecture 1; trust never 100%. RIGOROUS (cited):
273
+ # Hebb 1949 / Oja 1982 / BCM 1982 / Bi-Poo 1998 / Hubel-Wiesel 1981 / Dohare-Sutton
274
+ # Nature 2024 / Sokar ReDo 2023 / Kirkpatrick EWC 2017. The predictive-coding↔Hebbian
275
+ # unifier (Millidge 2022) is a PROPOSED lens, NOT a theorem (Λ = Conjecture 1). Every rule cited. ──
276
+ "/api/a11oy/v1/neuro/summary": ep(schema="generic_obj", sla=None,
277
+ note="Neuroplasticity module summary: honest_frame + tiers (Hebb/Oja/BCM/STDP/scaling=RIGOROUS; loss-of-plasticity/ReDo/EWC=RIGOROUS recent; predictive-coding↔Hebbian unifier=PROPOSED lens), doctrine (locked_count_unchanged, lambda=Conjecture 1, trust_never_100, tier=EXPERIMENTAL/PROPOSED), cites. PROPOSED, NOT the formal Λ."),
278
+ "/api/a11oy/v1/neuro/hebb": ep(schema="generic_obj", sla=None,
279
+ allow_statuses=(200, 400, 422),
280
+ note="Hebb 1949 update Δw=η·x·y (unstable alone, grows unbounded). Cited (Hebb, The Organization of Behavior 1949). Deterministic."),
281
+ "/api/a11oy/v1/neuro/oja": ep(schema="generic_obj", sla=None,
282
+ allow_statuses=(200, 400, 422),
283
+ note="Oja 1982 rule fitted over ?data= — returns the learned principal_direction + eigenvalue_estimate (provably converges to the top principal eigenvector). Cited (Oja, J. Math. Biol. 15:267-273). Deterministic."),
284
+ "/api/a11oy/v1/neuro/bcm": ep(schema="generic_obj", sla=None,
285
+ allow_statuses=(200, 400, 422),
286
+ note="BCM 1982 sliding modification threshold θ_M=E[y²] from ?y=history; reports potentiate/depress sign. Cited (Bienenstock-Cooper-Munro, J. Neurosci. 2(1):32-48). Deterministic."),
287
+ "/api/a11oy/v1/neuro/stdp": ep(schema="generic_obj", sla=None,
288
+ allow_statuses=(200, 400, 422),
289
+ note="Bi-Poo 1998 STDP window Δw(Δt) from ?dt= ms: Δt>0 LTP, Δt<0 LTD (asymmetric exponential). Cited (Bi & Poo, J. Neurosci. 18(24):10464). Deterministic."),
290
+ "/api/a11oy/v1/neuro/plasticity": ep(schema="generic_obj", sla=None,
291
+ allow_statuses=(200, 400, 422),
292
+ note="HERO loss-of-plasticity diagnostic from ?act=activations: dormant-unit fraction + plasticity score + re-init recommendation (continual backprop / ReDo) — the honest frontier tie-in for long-running agents. Cited (Dohare-Sutton Nature 2024 DOI:10.1038/s41586-024-07711-7; Sokar ReDo 2023 arXiv:2302.12902). Deterministic."),
293
+ "/api/a11oy/v1/neuro/ewc": ep(schema="generic_obj", sla=None,
294
+ allow_statuses=(200, 400, 422),
295
+ note="Kirkpatrick 2017 EWC penalty L=(λ/2)Σ Fᵢ(θᵢ−θ*ᵢ)² from ?theta=&star=&fisher= — mitigates catastrophic forgetting in continual learning. Cited (Kirkpatrick et al. PNAS DOI:10.1073/pnas.1611835114). Deterministic."),
296
+
297
+ # ── szl_chain_of_title.py: the L6 chain-of-title receipt assembler. PURE STDLIB,
298
+ # deterministic, byte-identical a11oy↔killinchu. EXPERIMENTAL/PROPOSED tier; adds
299
+ # NOTHING to the locked 8; Λ stays Conjecture 1 (never a theorem); trust never 100%.
300
+ # Assembles software (cosign+Rekor+in-toto/SLSA — target SLSA L2/L3 is roadmap)
301
+ # ∧ science (Zenodo DOI) ∧ math (lake-verified Lean) into one offline-verifiable
302
+ # receipt; signing is founder-gated so unsigned strands are labeled PROXY/UNSIGNED.
303
+ # Cites in-toto (CNCF), SLSA v1.1, Sigstore/cosign/Rekor, SCITT (IETF), Zenodo,
304
+ # lutar-lean. The bound math refs are the 3 merged EXPERIMENTAL theorems #229/#230/#231. ──
305
+ "/api/a11oy/v1/chain/summary": ep(schema="generic_obj", sla=None,
306
+ note="L6 chain-of-title summary: differentiator (industry L1-L5 vs SZL L6), levels ladder, honest_limit (signing founder-gated), doctrine (locked_unchanged, lambda=Conjecture 1, trust_never_100, tier=EXPERIMENTAL/PROPOSED), cites. PROPOSED, NOT the formal Λ."),
307
+ "/api/a11oy/v1/chain/levels": ep(schema="generic_obj", sla=None,
308
+ note="The six sovereignty maturity levels: L1-L5 = industry (residency → governed ops), L6 = SZL differentiator (verifiable software∧science∧math receipt). Deterministic."),
309
+ "/api/a11oy/v1/chain/assemble": ep(schema="generic_obj", sla=None,
310
+ allow_statuses=(200, 400, 422),
311
+ note="Assembles an L6 receipt from ?artifact=&image=&rekor=&doi=&lean= — software shown PROXY/UNSIGNED (cosign/Rekor signing founder-gated), DOI shown pending (founder-gated) when unminted (never faked), math = real lake-verified Lean refs. Content-addressed SHA-256; fully_signed always false (gated). Cited (Sigstore/in-toto/SLSA/Zenodo/lutar-lean). Deterministic."),
312
+ "/api/a11oy/v1/chain/verify": ep(schema="generic_obj", sla=None,
313
+ allow_statuses=(200, 400, 422),
314
+ note="Offline STRUCTURE verification of an assembled receipt: schema_ok + content_address_intact (SHA-256 recompute) + is_signed=false. Honest caveat: STRUCTURE verify ≠ cryptographic verify — cosign/Rekor verify is the founder-gated step. Cited (SCITT receipt model, IETF). Deterministic."),
315
+
316
+ # ── szl_unified_formulas.py + szl_cuas_formulas.py module-level /summary cards.
317
+ # These two module summaries back the Formula Atlas index tab. Bare-GET 200,
318
+ # deterministic, each carries its own author citations + doctrine block in-body
319
+ # (sources cited to origin; locked_proven=8; lambda=Conjecture 1; trust never 100%;
320
+ # cuas effector=SIMULATED). PROPOSED/ANALOGY engineering constructs, NOT the formal
321
+ # Λ; Λ stays Conjecture 1. No live-feed freshness obligation (sla=None). ──
322
+ "/api/a11oy/v1/unified/summary": ep(schema="generic_obj", sla=None,
323
+ note="Unified-formulas (thesis v6) summary: borrowed structure cited to origin (Sherman-Morgan/NASA/Tsiolkovsky, LS12/Cuk-Stewart/Lock-Stewart, Lindblad 1976, Baumgratz-Cramer-Plenio 2014), status_legend VERIFIED/PROPOSED/ANALOGY, doctrine (locked_proven=8, lambda=Conjecture 1, lambda_v5=PROPOSED engineering gate, trust never 100%). PROPOSED/ANALOGY, NOT the formal Λ."),
324
+ "/api/a11oy/v1/cuas/summary": ep(schema="generic_obj", sla=None,
325
+ note="Counter-UAS C2 summary: SZL constructs with classical inspirations cited (Zarchan/Palumbo PN, Joerger GNSS χ², Julier-Uhlmann CI, Bar-Shalom, Olfati-Saber/Zelazo consensus, Manne WTA, NIST PQC FIPS 203/204/205), status_legend SIMULATED/VERIFIED/EXPERIMENTAL, doctrine (locked_proven=8, lambda=Conjecture 1, effector=SIMULATED, trust never 100%). EXPERIMENTAL; effector SIMULATED, never actuates."),
326
+
327
+ # ── readiness (self) ──
328
+ "/api/a11oy/v1/readiness": ep(schema="readiness", sla=5 * MIN),
329
+ "/api/a11oy/v1/readiness/tab-matrix": ep(schema="tab_matrix", sla=None,
330
+ note="This contract, served live — the harness verifies served == repo."),
331
+ }
332
+
333
+ # JSON-schema-lite shapes the probe runner validates against. Intentionally
334
+ # permissive on extra keys, strict on the keys that prove the response is real.
335
+ SCHEMAS = {
336
+ "text": {"type": "string"},
337
+ "generic_obj": {"type": "object"},
338
+ "generic_list": {"anyOf": [{"type": "array"}, {"type": "object"}]},
339
+ "lambda": {"type": "object", "anyKey": ["lambda", "value", "score", "Λ", "conjecture", "floor"]},
340
+ "gates": {"type": "object", "anyKey": ["gates", "manifest", "passed", "results"]},
341
+ "selftest": {"type": "object",
342
+ "anyKey": ["invariants", "invariants_all_hold", "reasoning",
343
+ "policy", "operator", "unifying", "passed", "results"]},
344
+ "mcp_tools": {"type": "object", "anyKey": ["tools", "count", "items"]},
345
+ "llm_registry": {"type": "object", "anyKey": ["models", "registry", "tiers", "providers"]},
346
+ "provenance": {"type": "object",
347
+ "anyKey": ["receipts", "chain", "anchor", "entries", "items",
348
+ "slsa", "doctrine", "khipu_dsse", "self_attesting", "space"]},
349
+ "ledger": {"type": "object", "anyKey": ["entries", "ledger", "items", "rows", "receipts", "count"]},
350
+ "arena_history": {"type": "object", "anyKey": ["runs", "history", "items"]},
351
+ "mesh": {"type": "object",
352
+ "anyKey": ["nodes", "state", "quorum", "health", "mesh_organs", "wires", "khipu_nodes"]},
353
+ "deva_health": {"type": "object", "required": ["tabs"]},
354
+ "feeds_pulse": {"type": "object", "anyKey": ["items", "feed_count", "live_count"]},
355
+ "kevgate": {"type": "object", "anyKey": ["items", "gate_catalog", "count"]},
356
+ "router_stats": {"type": "object", "anyKey": ["routes", "servedThisWindow", "tiers"]},
357
+ "mosaic_governed": {"type": "object",
358
+ "anyKey": ["cop", "receipts", "lambda_axes", "thresholds",
359
+ "doctrine", "status", "source"]},
360
+ # scaling: deterministic metabolic/allometric/compute-scaling computations. Strict
361
+ # on at least one distinctive real key across the family, permissive on extras.
362
+ "scaling": {"type": "object",
363
+ "anyKey": ["sources", "examples", "universal_exponents", "exponents",
364
+ "B_kcal_day", "bpm", "phi", "predicted_loss", "status_legend"]},
365
+ "readiness": {"type": "object", "required": ["sections"]},
366
+ "tab_matrix": {"type": "object", "required": ["tabs", "endpoints"]},
367
+ }
368
+
369
+ # Explicit per-tab endpoint attachment (authoritative where present). Keys missing
370
+ # here fall back to the family heuristic below.
371
+ TAB_ENDPOINTS = {
372
+ "warboard": ["/api/a11oy/v1/lambda", "/api/a11oy/v1/gates", "/api/a11oy/provenance"],
373
+ "lambda": ["/api/a11oy/v1/lambda"],
374
+ "gates": ["/api/a11oy/v1/gates"],
375
+ "mcp": ["/api/a11oy/v1/mcp/tools"],
376
+ "llm": ["/api/a11oy/v1/llm/registry"],
377
+ "modelatlas": ["/api/a11oy/v1/llm/registry"],
378
+ "arena": ["/api/a11oy/v1/eval-arena/history"],
379
+ "replay": ["/api/a11oy/v1/eval-arena/history"],
380
+ "mesh": ["/api/a11oy/v1/mesh/state", "/api/a11oy/v1/capabilities/mesh"],
381
+ "trustspace": ["/api/a11oy/v1/mesh/state"],
382
+ "ledger3d": ["/api/a11oy/v1/ledger"],
383
+ "receipts": ["/api/a11oy/provenance", "/api/a11oy/v1/receipt/export", "/api/a11oy/cosign.pub"],
384
+ "chain": ["/api/a11oy/provenance"],
385
+ "lineage": ["/api/a11oy/provenance"],
386
+ "reciprocity": ["/api/a11oy/v1/ledger"],
387
+ "govern": ["/api/a11oy/v1/policy/decide", "/api/a11oy/v1/gates"],
388
+ "mzgov": ["/api/a11oy/v1/mosaic/governed"],
389
+ "govatlas": ["/api/a11oy/v1/policy/gates"],
390
+ "policies": ["/api/a11oy/v1/policy/compliance", "/api/a11oy/v1/policy/gates"],
391
+ "decision": ["/api/a11oy/v1/policy/decisions/feed"],
392
+ "threats": ["/api/a11oy/v1/sec/threats"],
393
+ "threatgraph": ["/api/a11oy/v1/sec/threatgraph"],
394
+ "attack": ["/api/a11oy/v1/sec/attack"],
395
+ "cve": ["/api/a11oy/v1/sec/cve"],
396
+ "kev": ["/api/a11oy/v1/sec/kev"],
397
+ "fleet": ["/api/a11oy/v1/mesh/state", "/api/a11oy/v1/operator/ledger"],
398
+ "ask": ["/api/a11oy/v1/operator/ask"],
399
+ "command": ["/api/a11oy/v2/operator/command-log"],
400
+ "mission": ["/api/a11oy/v1/operator/ledger"],
401
+ # Energy / GSF SCI views
402
+ "energy": ["/api/a11oy/v1/energy/live", "/api/a11oy/v1/energy/mesh"],
403
+ "energySci": ["/api/a11oy/v1/energy/sci"],
404
+ "energyReceipts": ["/api/a11oy/v1/energy/harvest", "/api/a11oy/provenance"],
405
+ "energyGrid": ["/api/a11oy/v1/energy/harvest"],
406
+ "pulse": ["/api/a11oy/v1/observability/summary"],
407
+ "business": ["/api/a11oy/v1/observability/business"],
408
+ "forecast": ["/api/a11oy/v1/seismic/forecast"],
409
+ "feed": ["/api/a11oy/v1/policy/decisions/feed"],
410
+ "verticals": ["/api/a11oy/v1/vertical-packs"],
411
+ "knowledge": ["/api/a11oy/v1/formulas/selftest"],
412
+ "readiness": ["/api/a11oy/v1/readiness", "/api/a11oy/v1/readiness/tab-matrix"],
413
+ # Vertical command + deep tabs
414
+ "vfinance": ["/api/a11oy/v1/vert/finance/feed", "/api/a11oy/v1/deva/healthz"],
415
+ "finq": ["/api/a11oy/v1/vert/finance/feed", "/api/a11oy/v1/deva/healthz"],
416
+ "finc": ["/api/a11oy/v1/deva/healthz"],
417
+ "finm": ["/api/a11oy/v1/deva/healthz"],
418
+ "finp": ["/api/a11oy/v1/deva/healthz"],
419
+ "finr": ["/api/a11oy/v1/deva/healthz"],
420
+ "vrealestate": ["/api/a11oy/v1/deva/healthz"],
421
+ "rem": ["/api/a11oy/v1/deva/healthz"],
422
+ "red": ["/api/a11oy/v1/deva/healthz"],
423
+ "reo": ["/api/a11oy/v1/deva/healthz"],
424
+ "redeal": ["/api/a11oy/v1/deva/healthz"],
425
+ "rebe": ["/api/a11oy/v1/deva/healthz"],
426
+ "vlegal": ["/api/a11oy/v1/devb/healthz"],
427
+ "legMatter": ["/api/a11oy/v1/devb/healthz"],
428
+ "legDefense": ["/api/a11oy/v1/devb/healthz"],
429
+ "legReg": ["/api/a11oy/v1/devb/healthz"],
430
+ "legInsure": ["/api/a11oy/v1/devb/healthz"],
431
+ "legExposure": ["/api/a11oy/v1/devb/healthz"],
432
+ "entCockpit": ["/api/a11oy/v1/devb/healthz", "/api/a11oy/v1/observability/summary"],
433
+ "entComms": ["/api/a11oy/v1/devb/healthz"],
434
+ "entRevenue": ["/api/a11oy/v1/devb/healthz"],
435
+ "entIncident": ["/api/a11oy/v1/devb/healthz"],
436
+ "entForecast": ["/api/a11oy/v1/devb/healthz"],
437
+ "vcyber": ["/api/a11oy/v1/sec/threats", "/api/a11oy/v1/sec/threatgraph"],
438
+ "cybThreat": ["/api/a11oy/v1/sec/threats", "/api/a11oy/v1/sec/cve"],
439
+ "cybSurface": ["/api/a11oy/v1/sec/threatgraph", "/api/a11oy/v1/sec/attack"],
440
+ "cybZero": ["/api/a11oy/v1/mesh/state"],
441
+ "cybPosture": ["/api/a11oy/v1/policy/compliance"],
442
+ "cybIncident": ["/api/a11oy/provenance"],
443
+ "vdefense": ["/api/a11oy/v1/mesh/state"],
444
+ "fltTopo": ["/api/a11oy/v1/mesh/state"],
445
+ "fltObs": ["/api/a11oy/v1/observability/summary"],
446
+ "fltOrch": ["/api/a11oy/v1/llm/registry"],
447
+ "fltReceipts": ["/api/a11oy/provenance"],
448
+ "fltGov": ["/api/a11oy/v1/policy/gates"],
449
+ "pvaAnchor": ["/api/a11oy/provenance"],
450
+ "pvaGraph": ["/api/a11oy/provenance"],
451
+ "pvaHealth": ["/api/a11oy/provenance"],
452
+ "pvaPqc": ["/api/a11oy/cosign.pub"],
453
+ "pvaVerify": ["/api/a11oy/v1/receipt/export", "/api/a11oy/cosign.pub"],
454
+ "whHero": ["/api/a11oy/v1/warhacker/index"],
455
+ # New live tabs (2026-06-10): contract them to their real backing endpoints so
456
+ # the probe judges them honestly instead of treating live tabs as static.
457
+ "feedpulse": ["/api/a11oy/v1/feeds/pulse"],
458
+ "kevgate": ["/api/a11oy/v1/sec/kevgate"],
459
+ "routerarena": ["/api/a11oy/v1/router/stats", "/api/a11oy/v1/llm/registry"],
460
+ "udsMesh": ["/api/a11oy/v1/mesh/state"],
461
+ # New living-3D tab (Metabolic Scaling): explicitly contract it to the real
462
+ # deterministic szl_scaling.py family so it is judged as a genuine declared tab
463
+ # (NOT silently bucketed static). VERIFIED reproductions + PROPOSED SZL-Φ.
464
+ "scaling": ["/api/a11oy/v1/scaling/summary", "/api/a11oy/v1/scaling/exponents",
465
+ "/api/a11oy/v1/scaling/compute", "/api/a11oy/v1/scaling/kleiber",
466
+ "/api/a11oy/v1/scaling/mte", "/api/a11oy/v1/scaling/heart",
467
+ "/api/a11oy/v1/scaling/unified"],
468
+ # Allodial AI doctrine + interactive sovereignty-score tab: contract it to the real
469
+ # szl_allodial.py endpoints so it is judged as a genuine declared (non-static) tab.
470
+ # PROPOSED engineering gate; Λ stays Conjecture 1; deterministic, prior-art-cited.
471
+ "allodialai": ["/api/a11oy/v1/allodial/summary", "/api/a11oy/v1/allodial/score"],
472
+ # Living-3D sovereignty/allodial-lattice visualization tab (Dev 2). Distinct from
473
+ # allodialai; same szl_allodial.py endpoints — lattice + non-interference witness +
474
+ # summary + interactive score. PROPOSED engineering view; Λ stays Conjecture 1.
475
+ "sovereignty": ["/api/a11oy/v1/allodial/summary", "/api/a11oy/v1/allodial/score",
476
+ "/api/a11oy/v1/allodial/lattice", "/api/a11oy/v1/allodial/noninterference"],
477
+ # Living-3D "Entanglement" tab (EXPERIMENTAL): contract it to the real deterministic
478
+ # szl_entanglement.py family so the probe judges it as a genuine declared tab (NOT
479
+ # silently bucketed static). HERO = the PROPOSED capacity bound E_max(t) ≤ C0·exp(−γt)
480
+ # (Streltsov 2015 ∘ SZL Λ-v5); Bell-vs-product comparator; CHSH meter; CKW monogamy →
481
+ # Khipu; honest-tiering panel. PROPOSED engineering gate; Λ stays Conjecture 1.
482
+ "entangle": ["/api/a11oy/v1/entangle/summary", "/api/a11oy/v1/entangle/capacity_bound",
483
+ "/api/a11oy/v1/entangle/concurrence", "/api/a11oy/v1/entangle/negativity",
484
+ "/api/a11oy/v1/entangle/entropy", "/api/a11oy/v1/entangle/chsh",
485
+ "/api/a11oy/v1/entangle/monogamy"],
486
+ # Living "Neuroplasticity" tab (EXPERIMENTAL): contract it to the real deterministic
487
+ # szl_neuroplasticity.py family so the probe judges it as a genuine declared tab (NOT
488
+ # silently bucketed static). HERO = the loss-of-plasticity diagnostic (Dohare-Sutton
489
+ # Nature 2024 / Sokar ReDo 2023) grounding the agent loop; Hubel-Wiesel critical period;
490
+ # Hebb vs Oja; BCM sliding threshold; STDP window; honest-tiering panel. RIGOROUS (cited)
491
+ # for the rules; predictive-coding↔Hebbian unifier is a PROPOSED lens; Λ stays Conjecture 1.
492
+ "neuro": ["/api/a11oy/v1/neuro/summary", "/api/a11oy/v1/neuro/hebb",
493
+ "/api/a11oy/v1/neuro/oja", "/api/a11oy/v1/neuro/bcm",
494
+ "/api/a11oy/v1/neuro/stdp", "/api/a11oy/v1/neuro/plasticity",
495
+ "/api/a11oy/v1/neuro/ewc"],
496
+ # Living "Chain of Title" tab (EXPERIMENTAL, view key 'l6chain' — DISTINCT from the
497
+ # legacy provenance 'chain' tab): contract it to the real deterministic
498
+ # szl_chain_of_title.py family so the probe judges it as a genuine declared tab (NOT
499
+ # silently bucketed static). HERO = the live /assemble binding software (PROXY/UNSIGNED,
500
+ # signing founder-gated) ∧ science (Zenodo DOI pending, founder-gated) ∧ math (3 real
501
+ # lake-verified Lean refs); L6 ladder; /verify offline STRUCTURE check; the 3 merged
502
+ # EXPERIMENTAL theorems #229/#230/#231 (NOT locked-8, NOT about Λ — Λ stays Conjecture 1).
503
+ "l6chain": ["/api/a11oy/v1/chain/summary", "/api/a11oy/v1/chain/levels",
504
+ "/api/a11oy/v1/chain/assemble", "/api/a11oy/v1/chain/verify"],
505
+ # Formula Atlas — the unified investor-readable INDEX of all 5 live formula
506
+ # modules. Contract it to each module's live /summary so it is judged as a
507
+ # genuine declared (non-static) tab, NOT silently bucketed static. Pure index
508
+ # view: reads every /summary live for tier + citations (never upgraded), with
509
+ # clickable live routes. Additive; Λ stays Conjecture 1; locked-proven stays 8.
510
+ "atlas": ["/api/a11oy/v1/scaling/summary", "/api/a11oy/v1/allodial/summary",
511
+ "/api/a11oy/v1/entangle/summary", "/api/a11oy/v1/unified/summary",
512
+ "/api/a11oy/v1/cuas/summary"],
513
+ "whTamper": ["/api/a11oy/v1/warhacker/index"],
514
+ "whCannonico": ["/api/a11oy/v1/warhacker/index"],
515
+ }
516
+
517
+ # Tabs that present clearly-labelled SAMPLE/MODELED/CONNECT-READY content by design
518
+ # (doctrine-compliant when labelled). The sweeper still requires the explicit label.
519
+ SAMPLE_OK_TABS = {
520
+ "entComms", "entRevenue", "entForecast", "replay", "demo", "wowdrop",
521
+ "wowledger", "wowroi", "wowtoggle", "melt", "brain2",
522
+ }
523
+
524
+ # Tabs that legitimately render without a network call (pure explainer / static UI).
525
+ STATIC_TABS = {
526
+ "demo", "knowledge", "ontology", "honest", "kbformulas", "codetab",
527
+ "docs", "sdk", "deploy", "organism", "organheart", "organnervous",
528
+ "organskeleton", "organyawar", "wowtoggle", "oversight",
529
+ }
530
+
531
+
532
+ def _decode(s: str) -> str:
533
+ """Decode \\uXXXX escapes that appear in the JS source string literals."""
534
+ try:
535
+ return s.encode("utf-8").decode("unicode_escape")
536
+ except Exception:
537
+ return s
538
+
539
+
540
+ def extract_tabs(html: str):
541
+ """Extract ONLY genuine console tabs. A tab is real iff it is one of:
542
+ (a) a top-level nav target data-view="key"
543
+ (b) a registered view reg('key','Title', ...)
544
+ (c) a direct view override V.key = ... (legacy/core tabs)
545
+ (d) a deep vertical def ['key','Title','badge','desc', R.renderXxx]
546
+ (e) a vertical-command def ['key','\\uXXXX','Label'] (icon = unicode glyph)
547
+ The narrow patterns avoid pulling in proof/formula/ticker data arrays
548
+ (F1, P1, SPY, …) that merely look like ['x','y',...] elsewhere in the page.
549
+ """
550
+ tabs = {} # key -> {title, group}
551
+
552
+ def put(k, title=None, override=False):
553
+ if k not in tabs:
554
+ tabs[k] = {"title": title or k, "group": "Console"}
555
+ elif override and title:
556
+ tabs[k]["title"] = title
557
+
558
+ # (a) data-view nav targets
559
+ for k in sorted(set(re.findall(r'data-view="([a-zA-Z0-9_]+)"', html))):
560
+ put(k)
561
+
562
+ # (b) reg('key','Title', ...)
563
+ for k, t in re.findall(r"reg\('([a-zA-Z0-9_-]+)','([^']*)'", html):
564
+ put(k, _decode(t), override=True)
565
+
566
+ # (c) V.key = ... (then V.key = mk('Title' for the title)
567
+ for k in sorted(set(re.findall(r"\bV\.([a-zA-Z0-9_]+)\s*=", html))):
568
+ put(k)
569
+ for k, t in re.findall(r"\bV\.([a-zA-Z0-9_]+)\s*=\s*mk\('([^']*)'", html):
570
+ put(k, _decode(t), override=True)
571
+
572
+ # (d) deep vertical defs: 5-element entry terminating in R.renderXxx
573
+ for k, t in re.findall(
574
+ r"\['([a-zA-Z0-9_-]+)',\s*'([^']*)',\s*'[^']*',\s*'[^']*',\s*R\.render",
575
+ html,
576
+ ):
577
+ put(k, _decode(t), override=True)
578
+
579
+ # (e) vertical-command defs: ['key','\uXXXX','Label']
580
+ for k, t in re.findall(r"\['([a-zA-Z0-9_-]+)',\s*'\\u[0-9a-fA-F]{4}',\s*'([^']*)'\]", html):
581
+ put(k, _decode(t), override=True)
582
+
583
+ return tabs
584
+
585
+
586
+ FAMILY_PREFIX = [
587
+ ("fin", ["/api/a11oy/v1/deva/healthz"]),
588
+ ("re", ["/api/a11oy/v1/deva/healthz"]),
589
+ ("leg", ["/api/a11oy/v1/devb/healthz"]),
590
+ ("ent", ["/api/a11oy/v1/devb/healthz"]),
591
+ ("cyb", ["/api/a11oy/v1/sec/threats"]),
592
+ ("flt", ["/api/a11oy/v1/mesh/state"]),
593
+ ("pva", ["/api/a11oy/provenance"]),
594
+ ("wh", ["/api/a11oy/v1/warhacker/index"]),
595
+ ("uds", ["/api/a11oy/v1/mesh/state"]),
596
+ ("org", []),
597
+ ("wow", []),
598
+ ]
599
+
600
+
601
+ def endpoints_for(key: str):
602
+ if key in TAB_ENDPOINTS:
603
+ return TAB_ENDPOINTS[key]
604
+ for pref, eps in FAMILY_PREFIX:
605
+ if key.startswith(pref):
606
+ return eps
607
+ return []
608
+
609
+
610
+ def build():
611
+ if not os.path.exists(CONSOLE):
612
+ print("FATAL: console.html not found at %s" % CONSOLE, file=sys.stderr)
613
+ sys.exit(2)
614
+ with open(CONSOLE, "r", encoding="utf-8", errors="replace") as f:
615
+ html = f.read()
616
+
617
+ raw = extract_tabs(html)
618
+ tabs = []
619
+ for key in sorted(raw):
620
+ info = raw[key]
621
+ eps = endpoints_for(key)
622
+ is_static = key in STATIC_TABS or (not eps)
623
+ sample_ok = key in SAMPLE_OK_TABS
624
+ # citationsRequired for the tab = any backing endpoint requires citations
625
+ cit = any(ENDPOINTS.get(e, {}).get("citationsRequired") for e in eps)
626
+ tabs.append({
627
+ "key": key,
628
+ "title": info["title"],
629
+ "group": info["group"],
630
+ "route": "%s#%s" % (CONSOLE_ROUTE, key),
631
+ "endpoints": eps,
632
+ "citationsRequired": bool(cit),
633
+ "sampleLabelAllowed": sample_ok,
634
+ "static": is_static,
635
+ # degradedRules at tab level: tolerate honest cached/degraded but never
636
+ # unlabeled placeholder data or undeclared 5xx.
637
+ "degradedRules": {
638
+ "allowSampleLabel": sample_ok,
639
+ "failOnUnlabeledPlaceholder": True,
640
+ "failOnMissingCitation": bool(cit),
641
+ },
642
+ })
643
+
644
+ matrix = {
645
+ "version": "1",
646
+ "doctrine": "v11",
647
+ "organ": ORGAN,
648
+ "consoleRoute": CONSOLE_ROUTE,
649
+ "generatedAt": os.environ.get("SOURCE_DATE_EPOCH_ISO")
650
+ or datetime.now(timezone.utc).strftime("%Y-%m-%dT00:00:00Z"),
651
+ "generator": "tools/readiness-harness/gen_tabs_matrix.py",
652
+ "summary": {
653
+ "tabs": len(tabs),
654
+ "endpoints": len(ENDPOINTS),
655
+ "tabsWithCitations": sum(1 for t in tabs if t["citationsRequired"]),
656
+ "staticTabs": sum(1 for t in tabs if t["static"]),
657
+ },
658
+ "endpoints": ENDPOINTS,
659
+ "schemas": SCHEMAS,
660
+ "tabs": tabs,
661
+ }
662
+ return matrix
663
+
664
+
665
+ def main():
666
+ matrix = build()
667
+ text = json.dumps(matrix, indent=2, ensure_ascii=False, sort_keys=False) + "\n"
668
+ if "--check" in sys.argv:
669
+ if not os.path.exists(OUT):
670
+ print("DRIFT: tabs.json missing — run the generator.", file=sys.stderr)
671
+ sys.exit(1)
672
+ with open(OUT, "r", encoding="utf-8") as f:
673
+ cur = f.read()
674
+ # compare modulo the generatedAt line (date is informational, not drift)
675
+ def strip_date(s):
676
+ return re.sub(r'"generatedAt":\s*"[^"]*"', '"generatedAt":""', s)
677
+ if strip_date(cur) != strip_date(text):
678
+ print("DRIFT: tabs.json is stale vs the console — regenerate.", file=sys.stderr)
679
+ sys.exit(1)
680
+ print("OK: tabs.json matches the console (%d tabs)." % matrix["summary"]["tabs"])
681
+ return
682
+ with open(OUT, "w", encoding="utf-8") as f:
683
+ f.write(text)
684
+ # Emit a GET-only target list for the k6 stress suite (warhacker.js reads it).
685
+ stress_targets = sorted(
686
+ p for p, spec in ENDPOINTS.items() if (spec.get("method") or "GET") == "GET"
687
+ )
688
+ stress_path = os.path.join(os.path.dirname(OUT), "stress", "stress-targets.json")
689
+ os.makedirs(os.path.dirname(stress_path), exist_ok=True)
690
+ with open(stress_path, "w", encoding="utf-8") as f:
691
+ f.write(json.dumps(stress_targets, indent=2) + "\n")
692
+ print("wrote %s (%d tabs, %d endpoints, %d stress targets)" %
693
+ (OUT, matrix["summary"]["tabs"], matrix["summary"]["endpoints"], len(stress_targets)))
694
+
695
+
696
+ if __name__ == "__main__":
697
+ main()
tools/readiness-harness/stress/stress-targets.json ADDED
@@ -0,0 +1,76 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ [
2
+ "/api/a11oy/cosign.pub",
3
+ "/api/a11oy/provenance",
4
+ "/api/a11oy/v1/allodial/lattice",
5
+ "/api/a11oy/v1/allodial/noninterference",
6
+ "/api/a11oy/v1/allodial/score",
7
+ "/api/a11oy/v1/allodial/summary",
8
+ "/api/a11oy/v1/capabilities/mesh",
9
+ "/api/a11oy/v1/chain/assemble",
10
+ "/api/a11oy/v1/chain/levels",
11
+ "/api/a11oy/v1/chain/summary",
12
+ "/api/a11oy/v1/chain/verify",
13
+ "/api/a11oy/v1/cuas/summary",
14
+ "/api/a11oy/v1/deva/healthz",
15
+ "/api/a11oy/v1/devb/healthz",
16
+ "/api/a11oy/v1/energy/harvest",
17
+ "/api/a11oy/v1/energy/live",
18
+ "/api/a11oy/v1/energy/mesh",
19
+ "/api/a11oy/v1/energy/sci",
20
+ "/api/a11oy/v1/entangle/capacity_bound",
21
+ "/api/a11oy/v1/entangle/chsh",
22
+ "/api/a11oy/v1/entangle/concurrence",
23
+ "/api/a11oy/v1/entangle/entropy",
24
+ "/api/a11oy/v1/entangle/monogamy",
25
+ "/api/a11oy/v1/entangle/negativity",
26
+ "/api/a11oy/v1/entangle/summary",
27
+ "/api/a11oy/v1/eval-arena/history",
28
+ "/api/a11oy/v1/feeds/pulse",
29
+ "/api/a11oy/v1/formulas/selftest",
30
+ "/api/a11oy/v1/gates",
31
+ "/api/a11oy/v1/lambda",
32
+ "/api/a11oy/v1/ledger",
33
+ "/api/a11oy/v1/llm/registry",
34
+ "/api/a11oy/v1/mcp/tools",
35
+ "/api/a11oy/v1/mesh/state",
36
+ "/api/a11oy/v1/mosaic/governed",
37
+ "/api/a11oy/v1/neuro/bcm",
38
+ "/api/a11oy/v1/neuro/ewc",
39
+ "/api/a11oy/v1/neuro/hebb",
40
+ "/api/a11oy/v1/neuro/oja",
41
+ "/api/a11oy/v1/neuro/plasticity",
42
+ "/api/a11oy/v1/neuro/stdp",
43
+ "/api/a11oy/v1/neuro/summary",
44
+ "/api/a11oy/v1/observability/business",
45
+ "/api/a11oy/v1/observability/summary",
46
+ "/api/a11oy/v1/operator/ledger",
47
+ "/api/a11oy/v1/policy/compliance",
48
+ "/api/a11oy/v1/policy/decisions/feed",
49
+ "/api/a11oy/v1/policy/gates",
50
+ "/api/a11oy/v1/policy/threats",
51
+ "/api/a11oy/v1/readiness",
52
+ "/api/a11oy/v1/readiness/tab-matrix",
53
+ "/api/a11oy/v1/reason/readiness",
54
+ "/api/a11oy/v1/reason/tiers",
55
+ "/api/a11oy/v1/receipt/export",
56
+ "/api/a11oy/v1/router/stats",
57
+ "/api/a11oy/v1/scaling/compute",
58
+ "/api/a11oy/v1/scaling/exponents",
59
+ "/api/a11oy/v1/scaling/heart",
60
+ "/api/a11oy/v1/scaling/kleiber",
61
+ "/api/a11oy/v1/scaling/mte",
62
+ "/api/a11oy/v1/scaling/summary",
63
+ "/api/a11oy/v1/scaling/unified",
64
+ "/api/a11oy/v1/sec/attack",
65
+ "/api/a11oy/v1/sec/cve",
66
+ "/api/a11oy/v1/sec/kev",
67
+ "/api/a11oy/v1/sec/kevgate",
68
+ "/api/a11oy/v1/sec/threatgraph",
69
+ "/api/a11oy/v1/sec/threats",
70
+ "/api/a11oy/v1/seismic/forecast",
71
+ "/api/a11oy/v1/unified/summary",
72
+ "/api/a11oy/v1/vert/finance/feed",
73
+ "/api/a11oy/v1/vertical-packs",
74
+ "/api/a11oy/v1/warhacker/index",
75
+ "/api/a11oy/v2/operator/command-log"
76
+ ]
tools/readiness-harness/tabs.json ADDED
The diff for this file is too large to render. See raw diff