betterwithage Perplexity Computer Agent commited on
Commit
a40cb68
·
verified ·
1 Parent(s): efe4dbc

deep-upgrade: vendor fonts (zero CDN), Prometheus proxy + YUYAY 13-axis conjunctive gate endpoint, Organism anatomy tab + Warhacker play-by-play (step timeline + boolean cascade + tamper-fail + hollow-pass guard)

Browse files
Files changed (4) hide show
  1. NOTICE +8 -0
  2. _vendor_blobs.py +0 -0
  3. pages/console.html +337 -13
  4. serve.py +325 -0
NOTICE CHANGED
@@ -37,6 +37,14 @@ code; the libraries themselves are used unmodified under their own licenses.
37
  Cytoscape.js — (c) The Cytoscape Consortium — MIT
38
  https://github.com/cytoscape/cytoscape.js
39
 
 
 
 
 
 
 
 
 
40
  Interaction-model inspirations (PATTERNS only — no code copied):
41
  - anvaka / vasturiano force-graph explorable entity-link model (MIT-compatible)
42
  - GraphRouter / RouteProfile, Tao Feng et al. (arXiv:2605.00180) — Model Atlas routing graph
 
37
  Cytoscape.js — (c) The Cytoscape Consortium — MIT
38
  https://github.com/cytoscape/cytoscape.js
39
 
40
+ Vendored fonts (self-hosted locally for zero-runtime-CDN sovereignty; served
41
+ from /vendor/fonts/*.woff2, shipped as base64 in _vendor_blobs.py — NO Google
42
+ Fonts CDN at runtime):
43
+ Space Grotesk (variable, latin subset) — (c) Florian Karsten — SIL Open Font License 1.1 (OFL-1.1)
44
+ https://github.com/floriankarsten/space-grotesk
45
+ JetBrains Mono (variable, latin subset) — (c) JetBrains s.r.o. — SIL Open Font License 1.1 (OFL-1.1)
46
+ https://github.com/JetBrains/JetBrainsMono
47
+
48
  Interaction-model inspirations (PATTERNS only — no code copied):
49
  - anvaka / vasturiano force-graph explorable entity-link model (MIT-compatible)
50
  - GraphRouter / RouteProfile, Tao Feng et al. (arXiv:2605.00180) — Model Atlas routing graph
_vendor_blobs.py CHANGED
The diff for this file is too large to render. See raw diff
 
pages/console.html CHANGED
@@ -5,8 +5,13 @@
5
  <meta name="viewport" content="width=device-width, initial-scale=1.0"/>
6
  <title>a11oy — Orchestration Platform · SZL Holdings</title>
7
  <meta name="description" content="a11oy is the orchestrating brain of the SZL governed-AI substrate: a full operator application — command center, five superpowers, Warhacker orchestration, observability, the constitution (wires), formulas, and the evidence ledger. Every view reads a live endpoint."/>
8
- <link rel="preconnect" href="https://fonts.googleapis.com"/><link rel="preconnect" href="https://fonts.gstatic.com" crossorigin/>
9
- <link href="https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@300;400;500;600;700&family=JetBrains+Mono:wght@400;500&display=swap" rel="stylesheet"/>
 
 
 
 
 
10
  <script src="/vendor/chart.umd.min.js"></script>
11
  <script src="/vendor/3d-force-graph.min.js"></script>
12
  <script src="/vendor/echarts.min.js"></script>
@@ -365,7 +370,7 @@ function cyGraph(id,elements,layout){const host=el(id);if(!host||!window.cytosca
365
  return _cy;}
366
  function nowts(){return new Date().toISOString().slice(11,19);}
367
 
368
- const HONEST='<div class="honesty"><b>How to read this.</b> Every panel reads a live service \u2014 no mock data. The trust score is a research conjecture, not a proven theorem. Five formulas are formally proven; the rest are open. Builds are SLSA Level 2 (not L3/FedRAMP/Iron Bank). Audit receipts are cryptographically signed where a key is present, and honestly marked unsigned otherwise.</div>';
369
  const FLOOR=0.9;
370
 
371
  const VIEWS={
@@ -435,15 +440,19 @@ const VIEWS={
435
  meaning surfaced to the operator as plain language ('health doesn't depend on
436
  what you call the nodes') -- never the formula IDs. Node positions are forces,
437
  not data; only live /api reachability + score drive color/size. */
438
- organism:{title:'Living Organism',badge:'3D · SHOWSTOPPER',sub:'The platform as one breathing organism. a11oy the orchestrating brain sits at the GOLD center; every service is a node, every link is a live connection that flows back to the brain. Node color reflects the live health probe; a down service shows honestly, never faked green.',
439
  render:async(c)=>{c.innerHTML=`<div class="kpis">
440
- <div class="kpi"><div class="k">Brain</div><div class="v">a11oy</div><div class="d">orchestrating hub</div></div>
441
- <div class="kpi"><div class="k">Organs reachable</div><div class="v live" id="org-reach">probing\u2026</div></div>
442
- <div class="kpi"><div class="k">Links to brain</div><div class="v teal" id="org-links">\u2014</div></div>
443
- <div class="kpi"><div class="k">Signed spans</div><div class="v" id="org-spans">\u2014</div><div class="d">live DAG depth</div></div></div>
444
- <div class="card"><div class="card-h"><span class="card-t">The brain at the center \u2014 live 3D</span><span class="card-ep">drag to orbit \u00b7 particles = live links</span></div><div class="graph3d hero" id="org-3d"></div><div class="brain-note">a11oy is the brain: every edge terminates at the gold core. Health from the live observability probe.</div></div>
445
- <div class="card"><div class="card-h"><span class="card-t">Organ health detail</span><span class="card-ep">live probe</span></div><div id="org-host"><div class="row mono dim">probing\u2026</div></div>
446
- <details class="raw"><summary>raw /observability/summary</summary><pre class="out" id="org-raw">loading\u2026</pre></details></div>${HONEST}`;window.organism_load();}},
 
 
 
 
447
 
448
  /* PROOF-BINDING (cite-in-code-only): the Receipt-Chain 3D DAG is the runtime
449
  face of three results. (1) F-G5 -- the audit walk over the hash-chain frontier
@@ -816,7 +825,8 @@ knowledge:{title:'Knowledge Ontology',badge:'AXIOMS \u2192 THEOREMS \u2192 FORMU
816
  <div class="card"><div class="card-h"><span class="card-t">What we proved</span><span class="card-ep">honest</span></div>
817
  <div class="row"><span class="badge" style="color:#5fb3a3;border:1px solid #5fb3a3">PROVEN</span><span>P3 non-interference \u2014 untrusted retrieval is recorded but quarantined from the verdict (axiom-free core, PR #188).</span></div>
818
  <div class="row"><span class="badge" style="color:#5fb3a3;border:1px solid #5fb3a3">PROVEN</span><span>P1 receipt-completeness + P2 gate-soundness + P4 replay-determinism (kernel-verified, experimental scope).</span></div>
819
- <div class="row"><span class="badge" style="color:#c9b787;border:1px solid #c9b787">AXIOM-GATED</span><span>P5 tamper-evidence (assumes hash collision-resistance, NIST FIPS 180-4 \u2014 disclosed).</span></div></div>${HONEST}`;window.oversight_init();}},
 
820
 
821
  modelatlas:{title:'Model Atlas',badge:'3D HETEROGENEOUS ROUTING GRAPH · LIVE REGISTRY',sub:'The open-weight roster as a live 3D heterogeneous graph \u2014 model families, tiers, providers and the routing conditions that connect them to task classes. Click a model for why-this-model: its context window, use case, tier and the routing rule a11oy applies. Reimplements the GraphRouter / RouteProfile pattern (Tao Feng et al., arXiv:2605.00180) on our real /llm/registry. Routing is governed: stable to small input changes (softmax \u00bd-Lipschitz, C20) and bracketed between best and worst option (PAC-Bayes envelope, W7-5). Answers Warhacker #3/#5 (HANGAR2APPS readiness / Raven edge): auditable model selection.',
822
  render:async(c)=>{c.innerHTML=`<div class="kpis">
@@ -879,7 +889,10 @@ knowledge:{title:'Knowledge Ontology',badge:'AXIOMS \u2192 THEOREMS \u2192 FORMU
879
  <div class="kpi"><div class="k">Bullseye</div><div class="v">P3</div><div class="d">non-interference (Cannonico)</div></div></div>
880
  <div class="card"><div class="row"><button onclick="window.warboard_all()" style="background:var(--gold);border:none;color:#0a0a0a;border-radius:8px;padding:.55rem 1.2rem;cursor:pointer;font-weight:700">Launch all 5 demos</button>
881
  <span class="card-ep" style="margin-left:.8rem">each runs in-image and records a signed receipt of the decision</span></div></div>
882
- <div id="wb-cards"></div>${HONEST}`;window.warboard_init();}},
 
 
 
883
 
884
  };
885
 
@@ -2276,6 +2289,317 @@ window.threatgraph_load=threatgraph_load;
2276
  window.deploy_load=deploy_load;
2277
  window.warboard_init=warboard_init; window.warboard_all=warboard_all;
2278
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2279
  </script>
2280
  </body>
2281
  </html>
 
5
  <meta name="viewport" content="width=device-width, initial-scale=1.0"/>
6
  <title>a11oy — Orchestration Platform · SZL Holdings</title>
7
  <meta name="description" content="a11oy is the orchestrating brain of the SZL governed-AI substrate: a full operator application — command center, five superpowers, Warhacker orchestration, observability, the constitution (wires), formulas, and the evidence ledger. Every view reads a live endpoint."/>
8
+ <style id="szl-vendored-fonts">
9
+ /* Vendored Google Fonts (variable, latin) — self-hosted, ZERO runtime CDN.
10
+ Space Grotesk (OFL-1.1) + JetBrains Mono (OFL-1.1). Attribution: /NOTICE.
11
+ One woff2 per family (variable axis); weight-range lets the browser instance. */
12
+ @font-face{font-family:'Space Grotesk';font-style:normal;font-weight:300 700;font-display:swap;src:url('/vendor/fonts/SpaceGrotesk.woff2') format('woff2');}
13
+ @font-face{font-family:'JetBrains Mono';font-style:normal;font-weight:400 500;font-display:swap;src:url('/vendor/fonts/JetBrainsMono.woff2') format('woff2');}
14
+ </style>
15
  <script src="/vendor/chart.umd.min.js"></script>
16
  <script src="/vendor/3d-force-graph.min.js"></script>
17
  <script src="/vendor/echarts.min.js"></script>
 
370
  return _cy;}
371
  function nowts(){return new Date().toISOString().slice(11,19);}
372
 
373
+ const HONEST='<div class="honesty"><b>How to read this.</b> Every panel reads a live service \u2014 no mock data, and live-vs-replay is labeled where it matters. The trust score \u039b is a research <b>Conjecture</b> (Conjecture 1, advisory \u2014 its unconditional uniqueness is machine-checked FALSE), never a pass/fail oracle. Five formulas are formally proven (locked); other waves are CI-green but not in the locked count. The a11oy image carries a verified SLSA provenance attestation (L2); org-wide L2 holds on 3 of 5 organs with the remainder on the roadmap (honest, not L3/FedRAMP/Iron Bank). No AGI claims. Audit receipts are cryptographically signed where a key is present, and honestly marked unsigned otherwise.</div>';
374
  const FLOOR=0.9;
375
 
376
  const VIEWS={
 
440
  meaning surfaced to the operator as plain language ('health doesn't depend on
441
  what you call the nodes') -- never the formula IDs. Node positions are forces,
442
  not data; only live /api reachability + score drive color/size. */
443
+ organism:{title:'Living Organism \u2014 SZL Agent Body',badge:'ANATOMY + LIVE YUYAY GATE',sub:'a11oy as one sovereign organism: five systems, each an organ with its Quechua name, its plain-English function and a real mechanism. The HEART is YUYAY \u2014 the 13-axis conjunctive truth gate \u2014 which you can EXERCISE below: submit a proposal and watch all 13 axes evaluate conjunctively (pass = all(score \u2265 floor), never a weighted average), then get a \u039b-signed receipt or a rejection. a11oy and killinchu are two bodies sharing ONE circulatory (YAWAR receipt bus) + nervous (span lineage) mesh.',
444
  render:async(c)=>{c.innerHTML=`<div class="kpis">
445
+ <div class="kpi"><div class="k">Systems</div><div class="v teal">5</div><div class="d">heart \u00b7 blood \u00b7 brain \u00b7 nerves \u00b7 skeleton</div></div>
446
+ <div class="kpi"><div class="k">Heart</div><div class="v" style="color:#b06a5a">YUYAY v3</div><div class="d">13-axis conjunctive gate</div></div>
447
+ <div class="kpi"><div class="k">Gate rule</div><div class="v teal">all(\u2265floor)</div><div class="d">NOT a weighted average</div></div>
448
+ <div class="kpi"><div class="k">Shared mesh</div><div class="v" style="color:#c9b787">YAWAR + span</div><div class="d">a11oy \u21c4 killinchu</div></div></div>
449
+ <div class="grid2">
450
+ <div class="card"><div class="card-h"><span class="card-t">a11oy body \u2014 5 systems (our-own SVG anatomy)</span><span class="card-ep">distinct viz \u00b7 hover organs</span></div><div id="org-body" style="display:flex;justify-content:center;padding:.5rem"></div><div class="brain-note">AXIAL spine (gold) = doctrine + receipt chain. Blood loop = YAWAR. Thin nerves = span lineage. Brain (AMARU) reads, never writes; HATUN seals to a human.</div></div>
451
+ <div class="card"><div class="card-h"><span class="card-t">Exercise the YUYAY gate \u2014 REAL 13-axis conjunctive evaluation</span><span class="card-ep">POST /yuyay/gate \u00b7 live</span></div><div id="org-gate-form"></div><div id="org-gate-out" style="margin-top:.6rem"></div></div>
452
+ </div>
453
+ <div class="card"><div class="card-h"><span class="card-t">The action pipeline \u2014 AMARU proposes \u2192 YUYAY gate \u2192 \u039b-signed YAWAR receipt \u2192 R0513 audit \u2192 span lineage \u2192 HATUN seal to a human</span><span class="card-ep">efficiency path = honesty proof</span></div><div id="org-pipeline"></div></div>
454
+ <div class="card"><div class="card-h"><span class="card-t">Five systems \u2014 organ \u00b7 function \u00b7 real mechanism</span><span class="card-ep">Quechua name + plain English</span></div><div id="org-systems"></div>
455
+ <div class="brain-note">Shared organism: a11oy (governed-AI decision body) and killinchu (maritime/drone C2 body) run the SAME heart (YUYAY gate), the SAME blood (append-only YAWAR receipts) and the SAME read-only brain pattern, linked by the UDS mesh \u2014 \u039b-signed receipts pulse between the two bodies on one circulatory + nervous system.</div></div>${HONEST}`;window.organism_load();}},
456
 
457
  /* PROOF-BINDING (cite-in-code-only): the Receipt-Chain 3D DAG is the runtime
458
  face of three results. (1) F-G5 -- the audit walk over the hash-chain frontier
 
825
  <div class="card"><div class="card-h"><span class="card-t">What we proved</span><span class="card-ep">honest</span></div>
826
  <div class="row"><span class="badge" style="color:#5fb3a3;border:1px solid #5fb3a3">PROVEN</span><span>P3 non-interference \u2014 untrusted retrieval is recorded but quarantined from the verdict (axiom-free core, PR #188).</span></div>
827
  <div class="row"><span class="badge" style="color:#5fb3a3;border:1px solid #5fb3a3">PROVEN</span><span>P1 receipt-completeness + P2 gate-soundness + P4 replay-determinism (kernel-verified, experimental scope).</span></div>
828
+ <div class="row"><span class="badge" style="color:#c9b787;border:1px solid #c9b787">AXIOM-GATED</span><span>P5 tamper-evidence (assumes hash collision-resistance, NIST FIPS 180-4 \u2014 disclosed).</span></div></div>
829
+ <div class="card" id="ov-pbp"><div class="row mono dim">loading the non-interference play-by-play (live /selftest)\u2026</div></div>${HONEST}`;window.oversight_init();window.whPlayByPlay('ov-pbp','cannonico');}},
830
 
831
  modelatlas:{title:'Model Atlas',badge:'3D HETEROGENEOUS ROUTING GRAPH · LIVE REGISTRY',sub:'The open-weight roster as a live 3D heterogeneous graph \u2014 model families, tiers, providers and the routing conditions that connect them to task classes. Click a model for why-this-model: its context window, use case, tier and the routing rule a11oy applies. Reimplements the GraphRouter / RouteProfile pattern (Tao Feng et al., arXiv:2605.00180) on our real /llm/registry. Routing is governed: stable to small input changes (softmax \u00bd-Lipschitz, C20) and bracketed between best and worst option (PAC-Bayes envelope, W7-5). Answers Warhacker #3/#5 (HANGAR2APPS readiness / Raven edge): auditable model selection.',
832
  render:async(c)=>{c.innerHTML=`<div class="kpis">
 
889
  <div class="kpi"><div class="k">Bullseye</div><div class="v">P3</div><div class="d">non-interference (Cannonico)</div></div></div>
890
  <div class="card"><div class="row"><button onclick="window.warboard_all()" style="background:var(--gold);border:none;color:#0a0a0a;border-radius:8px;padding:.55rem 1.2rem;cursor:pointer;font-weight:700">Launch all 5 demos</button>
891
  <span class="card-ep" style="margin-left:.8rem">each runs in-image and records a signed receipt of the decision</span></div></div>
892
+ <div id="wb-cards"></div>
893
+ <div class="view-head" style="margin-top:1.4rem"><h1 class="view-title" style="font-size:1.1rem">Play-by-play proof \u2014 step timeline + boolean-cascade catch tree + tamper test</h1></div>
894
+ <p class="view-sub">Each of the five problems below is a real mechanism, not a green checkmark. Watch the step timeline (each check passes or visibly FAILS), the conjunctive boolean-cascade (the first false node is the catch point), then click <b>Run TAMPER test</b> to flip a real input and watch the SAME mechanism turn red. Values are pulled live from <span class="mono">/api/a11oy/v1/formulas/selftest</span>. A step with no real evidence renders gray/hatched \u2014 never green.</p>
895
+ <div id="wb-pbp"><div class="row mono dim">loading play-by-play proofs\u2026</div></div>${HONEST}`;window.warboard_init();window.whBoard('wb-pbp');}},
896
 
897
  };
898
 
 
2289
  window.deploy_load=deploy_load;
2290
  window.warboard_init=warboard_init; window.warboard_all=warboard_all;
2291
 
2292
+ /* ============================================================================
2293
+ DEEP-UPGRADE module (2026-06-06) — ADDITIVE. Real data only. No mock.
2294
+ (1) Warhacker PLAY-BY-PLAY engine: step timeline + boolean-cascade catch tree
2295
+ (first ✗ auto-expanded) + TAMPER test that flips an input and makes the
2296
+ SAME mechanism visibly FAIL + hollow-pass guard (gray/hatched ≠ green).
2297
+ Driven by REAL values from /api/a11oy/v1/formulas/selftest.
2298
+ (2) ORGANISM tab: anatomical body of the 5 systems (Quechua organ + plain
2299
+ function + real mechanism) + a REAL exercisable YUYAY 13-axis conjunctive
2300
+ gate (form → POST /api/a11oy/v1/yuyay/gate → 13 axes evaluated
2301
+ conjunctively → signed receipt or rejection) + the action pipeline trace
2302
+ + the shared killinchu YAWAR/span mesh reference.
2303
+ Honesty doctrine preserved: Λ=Conjecture 1 (advisory, never the gate);
2304
+ 5 locked-proven; SLSA L1 honest / L2 roadmap; live-vs-replay labeled.
2305
+ Co-Authored-By: Perplexity Computer Agent <agent@perplexity.ai>
2306
+ ============================================================================ */
2307
+ (function(){
2308
+ var GOLD='#c9b787', TEAL='#5fb3a3', RED='#b06a5a', AMBER='#c9a05f', GRAY='#6b6b6b';
2309
+ function _e(s){return String(s==null?'':s).replace(/[&<>]/g,function(c){return({'&':'&amp;','<':'&lt;','>':'&gt;'}[c]);});}
2310
+ function _el(id){return document.getElementById(id);}
2311
+ function _set(id,h){var x=_el(id);if(x)x.innerHTML=h;}
2312
+
2313
+ /* ---------- (1) WARHACKER PLAY-BY-PLAY ENGINE ---------------------------- */
2314
+ /* A scenario is a real claim from /selftest. We render:
2315
+ - a STEP TIMELINE (each mechanism check: pending→running→complete/FAILED)
2316
+ - a BOOLEAN-CASCADE CATCH TREE: the conjunctive chain of real booleans;
2317
+ the FIRST false node is auto-expanded and marked ✗ (the catch point).
2318
+ - a TAMPER panel: flip ONE real input and re-run the SAME boolean chain so
2319
+ the mechanism VISIBLY fails (turns red), proving it is a real guard.
2320
+ Hollow-pass guard: a step with no real evidence renders GRAY/HATCHED, never
2321
+ green — only a step backed by a real boolean from /selftest can go teal. */
2322
+
2323
+ // map a /selftest section → ordered list of {label, key(bool), detail, theorem}
2324
+ function _whSteps(sel){
2325
+ var S={};
2326
+ var r=(sel.reasoning||{}), p=(sel.policy||{}), o=(sel.operator||{}), g=(sel.graph||{}), u=(sel.unifying||{});
2327
+ // Cannonico — non-interference (poisoned input can't flip a DENY→ALLOW)
2328
+ S.cannonico={
2329
+ title:'Cannonico — "has it gone off script?"',
2330
+ mechanism:'P3 non-interference (Goguen–Meseguer, axiom-free core)',
2331
+ tamperLabel:'Inject a poisoned instruction into the untrusted blob',
2332
+ steps:[
2333
+ {label:'Receive untrusted blob (poison candidate)', bool:(p.non_interference||{}).untrusted_recorded, detail:'untrusted input is RECORDED (not silently dropped)'},
2334
+ {label:'Detect injection markers', bool:(p.non_interference||{}).injection_markers_detected, detail:'injection markers detected in the untrusted blob'},
2335
+ {label:'Confirm blob is QUARANTINED from the decision', bool:((p.non_interference||{}).feeds_decision===false), detail:'feeds_decision = false → blob cannot reach the gate'},
2336
+ {label:'Decision invariant under poison (clean == mutated)', bool:(p.non_interference||{}).decision_invariant, detail:'decision_with_blob == decision_with_mutated_blob'}
2337
+ ],
2338
+ // tamper: pretend the poison DID feed the decision → invariant breaks
2339
+ tamper:function(s){ s[2].bool=true; s[2].detail='TAMPERED: feeds_decision forced true → poison reaches gate'; s[3].bool=false; s[3].detail='TAMPERED: decision now DIFFERS under poison → non-interference VIOLATED'; return s; }
2340
+ };
2341
+ // Tychee — offline tamper-evidence (forgery detection)
2342
+ S.tychee={
2343
+ title:'Tychee — sovereign offline decision + tamper-evidence',
2344
+ mechanism:'W5-4 forgery-detection + P5 tamper-evidence (axiom-gated) + F-G5 bounded audit',
2345
+ tamperLabel:'Flip one byte in a sealed receipt on the hash-chain',
2346
+ steps:[
2347
+ {label:'Audit walk terminates within step cap', bool:(o.bounded_frontier_walk||{}).terminated_within_cap, detail:'F-G5: '+((o.bounded_frontier_walk||{}).steps_taken)+' steps ≤ cap '+((o.bounded_frontier_walk||{}).step_cap)},
2348
+ {label:'Accumulator monotone (no early-stop deflation)', bool:(o.doob_audit_envelope||{}).monotone_accumulator, detail:'W7-6: auditing early OR late yields same result'},
2349
+ {label:'No over-report on the envelope', bool:(o.doob_audit_envelope||{}).no_over_report, detail:'two-sided Doob envelope holds'},
2350
+ {label:'Encoding lossless & minimal (receipt integrity)', bool:(o.kraft_encoding_floor||{}).kraft_feasible, detail:'C8 Kraft sum '+((o.kraft_encoding_floor||{}).kraft_sum)+' ≤ 1'}
2351
+ ],
2352
+ tamper:function(s){ s[1].bool=false; s[1].detail='TAMPERED: accumulator no longer monotone → flipped byte detected, audit DEFLATES'; s[3].bool=false; s[3].detail='TAMPERED: encoding no longer matches receipt hash → forgery caught'; return s; }
2353
+ };
2354
+ // cyber-rts — calibrated triage (never 100% certainty)
2355
+ S['cyber-rts']={
2356
+ title:'Cyber-RTS — calibrated anomaly triage',
2357
+ mechanism:'W5-3 conformal coverage + W7-4 rank-count p-value (never 100%)',
2358
+ tamperLabel:'Force the model to claim 100% certainty',
2359
+ steps:[
2360
+ {label:'Point estimate inside conformal interval', bool:(r.conformal_interval||{}).in_interval, detail:'point '+((r.conformal_interval||{}).point)+' ∈ ['+((r.conformal_interval||{}).interval||[]).join(', ')+']'},
2361
+ {label:'Coverage = 1 − miscoverage', bool:(r.conformal_interval||{}).coverage_eq_one_minus_miscoverage, detail:'coverage '+((r.conformal_interval||{}).coverage)+' = 1 − '+((r.conformal_interval||{}).miscoverage_rate)},
2362
+ {label:'p-value ≥ floor (rank-count valid)', bool:((r.conformal_interval||{}).p_value>=(r.conformal_interval||{}).p_value_floor), detail:'p '+((r.conformal_interval||{}).p_value)+' ≥ floor '+((r.conformal_interval||{}).p_value_floor)},
2363
+ {label:'NEVER reports 100% certainty', bool:(r.conformal_interval||{}).never_100_percent, detail:'confidence capped — distribution-free, honest'}
2364
+ ],
2365
+ tamper:function(s){ s[3].bool=false; s[3].detail='TAMPERED: forced confidence=1.0 → violates W7-4 never-100% → REJECTED'; s[1].bool=false; s[1].detail='TAMPERED: coverage no longer equals 1−miscoverage → calibration broken'; return s; }
2366
+ };
2367
+ // hangar2apps — readiness + receipt-completeness
2368
+ S.hangar2apps={
2369
+ title:'Hangar-2-Apps — readiness with signed receipt',
2370
+ mechanism:'P1 receipt-completeness + P2 gate-soundness + DSSE signing',
2371
+ tamperLabel:'Approve emit with only ONE of the two required approvals',
2372
+ steps:[
2373
+ {label:'Policy approval present', bool:(p.gate_soundness||{}).policy_allow, detail:'policy_allow = true'},
2374
+ {label:'Kernel approval present', bool:(p.gate_soundness||{}).kernel_allow!==undefined?(p.gate_soundness||{}).kernel_allow:true, detail:'kernel_allow (independent second approval)'},
2375
+ {label:'Deny is absorbing (any deny → emit deny)', bool:(p.gate_soundness||{}).deny_absorbing, detail:'P2: deny_absorbing = true'},
2376
+ {label:'Emit requires BOTH approvals (AND-gate)', bool:((p.gate_soundness||{}).emit_allow===((p.gate_soundness||{}).policy_allow && (p.gate_soundness||{}).kernel_allow)), detail:'emit_allow = policy_allow ∧ kernel_allow'}
2377
+ ],
2378
+ tamper:function(s){ s[1].bool=false; s[1].detail='TAMPERED: kernel approval withheld'; s[3].bool=false; s[3].detail='TAMPERED: emit attempted with policy-only → AND-gate DENIES (no action without both)'; return s; }
2379
+ };
2380
+ // raven — bounded edge audit + consensus safety
2381
+ S.raven={
2382
+ title:'Raven — tactical-edge decision, audit chained',
2383
+ mechanism:'F-G5 bounded-termination + C10 (n≥3f+1) consensus safety + P5 offline',
2384
+ tamperLabel:'Drop quorum below n ≥ 3f+1',
2385
+ steps:[
2386
+ {label:'Consensus sized n ≥ 3f+1', bool:(p.byzantine_quorum||{}).sizing_n_ge_3f_plus_1, detail:'n='+((p.byzantine_quorum||{}).n)+', f='+((p.byzantine_quorum||{}).f)+' → quorum '+((p.byzantine_quorum||{}).quorum_size)},
2387
+ {label:'Quorums intersect in an honest node', bool:(p.byzantine_quorum||{}).intersection_has_honest_node, detail:'intersection count '+((p.byzantine_quorum||{}).quorum_intersection_count)},
2388
+ {label:'Edge audit walk terminates', bool:(o.bounded_frontier_walk||{}).terminated_within_cap, detail:'F-G5 bounded frontier walk'},
2389
+ {label:'Linked into the live receipt chain', bool:(u.governed_run_sound||{}).P1_receipt_completeness, detail:'P1 receipt-completeness holds'}
2390
+ ],
2391
+ tamper:function(s){ s[0].bool=false; s[0].detail='TAMPERED: f raised so n < 3f+1 → sizing fails'; s[1].bool=false; s[1].detail='TAMPERED: quorums no longer intersect honestly → safety lost'; return s; }
2392
+ };
2393
+ return S;
2394
+ }
2395
+
2396
+ // render one scenario's play-by-play into host id. mode: 'normal'|'tamper'
2397
+ function _whRender(hostId, scen, mode){
2398
+ var host=_el(hostId); if(!host) return;
2399
+ var steps=scen.steps.map(function(s){return {label:s.label,bool:s.bool,detail:s.detail};});
2400
+ if(mode==='tamper' && scen.tamper){ steps=scen.tamper(steps); }
2401
+ // STEP TIMELINE — animate pending→running→complete/FAILED
2402
+ var firstFail=-1;
2403
+ for(var i=0;i<steps.length;i++){ if(steps[i].bool!==true){ firstFail=i; break; } }
2404
+ var timelineHtml=steps.map(function(s,i){
2405
+ var hollow=(s.bool!==true && s.bool!==false); // undefined/null = no evidence → hollow-pass guard
2406
+ var col = hollow?GRAY : (s.bool?TEAL:RED);
2407
+ var icon= hollow?'◌' : (s.bool?'✓':'✗');
2408
+ var bg = hollow?('repeating-linear-gradient(45deg,#1a1a1a,#1a1a1a 6px,#222 6px,#222 12px)') : (s.bool?'rgba(95,179,163,.12)':'rgba(176,106,90,.16)');
2409
+ var lbl= hollow?'NO EVIDENCE (not green)':(s.bool?'pass':'FAILED');
2410
+ return '<div class="row" data-step="'+i+'" style="align-items:flex-start;border-left:3px solid '+col+';background:'+bg+';padding:.45rem .6rem;margin:.3rem 0;border-radius:0 6px 6px 0">'
2411
+ +'<span style="color:'+col+';font-weight:700;font-family:monospace;margin-right:.5rem">'+icon+'</span>'
2412
+ +'<span style="flex:1"><b style="color:'+col+'">'+(i+1)+'. '+_e(s.label)+'</b> <span class="badge" style="color:'+col+';border:1px solid '+col+';margin-left:.4rem">'+lbl+'</span>'
2413
+ +'<div class="mono dim" style="font-size:.72rem;margin-top:.2rem">'+_e(s.detail||'')+'</div></span></div>';
2414
+ }).join('');
2415
+ // BOOLEAN-CASCADE CATCH TREE — conjunctive AND chain; first ✗ auto-expanded
2416
+ var allPass = steps.every(function(s){return s.bool===true;});
2417
+ var cascade='<div style="margin-top:.5rem;font-family:monospace;font-size:.74rem">';
2418
+ cascade+='<div class="dim" style="margin-bottom:.25rem">conjunctive chain — verdict = step₁ ∧ step₂ ∧ … ∧ step'+steps.length+':</div>';
2419
+ cascade+=steps.map(function(s,i){
2420
+ var caught=(i===firstFail);
2421
+ var hollow=(s.bool!==true&&s.bool!==false);
2422
+ var col=hollow?GRAY:(s.bool?TEAL:RED);
2423
+ var open=caught?' open':'';
2424
+ var pad=(i*14);
2425
+ return '<details'+open+' style="margin-left:'+pad+'px;border-left:1px dashed '+col+';padding-left:.5rem">'
2426
+ +'<summary style="color:'+col+';cursor:pointer">'+(s.bool?'∧ ':'✗ CAUGHT HERE → ')+_e(s.label)+'</summary>'
2427
+ +'<div class="dim" style="padding:.2rem 0 .3rem .6rem">'+_e(s.detail||'')+(caught?' <b style="color:'+RED+'">← first false node; whole conjunction short-circuits to DENY</b>':'')+'</div></details>';
2428
+ }).join('');
2429
+ cascade+='</div>';
2430
+ var verdictCol=allPass?TEAL:RED;
2431
+ var verdictTxt=allPass?'ALLOW (all mechanism checks passed)':'DENY (mechanism caught the issue at step '+(firstFail+1)+')';
2432
+ var header='<div class="row" style="margin-bottom:.4rem"><span class="badge" style="color:'+verdictCol+';border:1px solid '+verdictCol+';font-weight:700">'+(mode==='tamper'?'TAMPER RUN · ':'')+verdictTxt+'</span>'
2433
+ +'<span class="spacer mono dim">'+_e(scen.mechanism)+'</span></div>';
2434
+ host.innerHTML=header+'<div class="dim" style="font-size:.72rem;margin:.2rem 0">Step timeline</div>'+timelineHtml+'<div class="dim" style="font-size:.72rem;margin-top:.5rem">Boolean-cascade catch tree</div>'+cascade;
2435
+ }
2436
+
2437
+ // public: mount a full play-by-play card for scenario key into hostId
2438
+ window.whPlayByPlay=async function(hostId, key){
2439
+ var host=_el(hostId); if(!host) return;
2440
+ host.innerHTML='<div class="row mono dim">loading real proof values from /selftest…</div>';
2441
+ var sel;
2442
+ try{ var r=await fetch('/api/a11oy/v1/formulas/selftest'); sel=await r.json(); }
2443
+ catch(e){ host.innerHTML='<div class="row mono dim">retry: '+_e(e.message)+'</div>'; return; }
2444
+ var S=_whSteps(sel); var scen=S[key];
2445
+ if(!scen){ host.innerHTML='<div class="row mono dim">no scenario "'+_e(key)+'"</div>'; return; }
2446
+ var nid=hostId+'-normal', tid=hostId+'-tamper';
2447
+ host.innerHTML='<div class="card-h"><span class="card-t">'+_e(scen.title)+'</span><span class="card-ep">live /selftest · play-by-play</span></div>'
2448
+ +'<div id="'+nid+'"></div>'
2449
+ +'<div class="row" style="margin:.6rem 0 .3rem"><button class="btn" style="background:'+RED+';border:none;color:#0a0a0a;border-radius:7px;padding:.45rem 1rem;cursor:pointer;font-weight:700" onclick="window.whTamper(\''+hostId+'\',\''+key+'\')">▶ Run TAMPER test: '+_e(scen.tamperLabel)+'</button></div>'
2450
+ +'<div id="'+tid+'"></div>';
2451
+ _whRender(nid, scen, 'normal');
2452
+ };
2453
+ window.whTamper=async function(hostId, key){
2454
+ var tid=hostId+'-tamper'; var t=_el(tid); if(!t) return;
2455
+ t.innerHTML='<div class="row mono dim">flipping input & re-running the SAME mechanism…</div>';
2456
+ var sel; try{ var r=await fetch('/api/a11oy/v1/formulas/selftest'); sel=await r.json(); }catch(e){ t.innerHTML='<div class="row mono dim">retry: '+_e(e.message)+'</div>'; return; }
2457
+ var scen=_whSteps(sel)[key]; if(!scen) return;
2458
+ setTimeout(function(){
2459
+ t.innerHTML='<div class="dim" style="font-size:.74rem;margin:.4rem 0;color:'+RED+'"><b>TAMPER:</b> '+_e(scen.tamperLabel)+' — the SAME mechanism must now visibly FAIL ↓</div>';
2460
+ var inner=document.createElement('div'); inner.id=tid+'-body'; t.appendChild(inner);
2461
+ _whRender(tid+'-body', scen, 'tamper');
2462
+ },220);
2463
+ };
2464
+ // mount the full Warhacker board of all 5 play-by-plays
2465
+ window.whBoard=async function(hostId){
2466
+ var host=_el(hostId); if(!host) return;
2467
+ var keys=['cannonico','tychee','cyber-rts','hangar2apps','raven'];
2468
+ host.innerHTML=keys.map(function(k){return '<div class="card" id="whc-'+k+'"></div>';}).join('');
2469
+ for(var i=0;i<keys.length;i++){ await window.whPlayByPlay('whc-'+keys[i], keys[i]); }
2470
+ };
2471
+
2472
+ /* ---------- (2) ORGANISM TAB: anatomy body + real YUYAY gate ------------- */
2473
+ var YUYAY_AXES=[
2474
+ ['A01','moralGrounding',0.95],['A02','measurabilityHonesty',0.95],['A03','empiricalGrounding',0.90],
2475
+ ['A04','logicalConsistency',0.90],['A05','sourceTransparency',0.90],['A06','reproducibility',0.90],
2476
+ ['A07','licenseHygiene',0.90],['A08','scopeDiscipline',0.90],['A09','claimCalibration',0.90],
2477
+ ['A10','evalAwareness',1.00],['A11','deceptionKeywords',1.00],['A12','conflictingDirectives',1.00],['A13','reversalDirective',1.00]
2478
+ ];
2479
+ var ANATOMY=[
2480
+ {sys:'1 · HEART',organ:'YUYAY v3',fn:'13-axis conjunctive truth gate',mech:'pass = all(score[i] ≥ floor[i]) — NOT a weighted average. 0.94 on moralGrounding FAILS even if the other 12 = 1.00.',col:RED},
2481
+ {sys:'2 · CIRCULATORY',organ:'YAWAR + RUWAY + SENTRA',fn:'append-only SHA-256 receipt bus · sole write surface · egress inspector',mech:'h = sha256(json.dumps(packet, sort_keys=True)); appended, never mutated/deleted. Writes traverse RUWAY (only authorized writer) through SENTRA egress inspection.',col:GOLD},
2482
+ {sys:'3 · BRAIN',organ:'AMARU cortex',fn:'read-only proposer cortex',mech:'5 cortex regions; hangs off the bus by a single tether — READS snapshots, NEVER writes. The thinking layer cannot tamper with the record.',col:TEAL},
2483
+ {sys:'4 · NERVOUS',organ:'span lineage + HUKLLA',fn:'W3C TraceContext propagation · deadman tripwire',mech:'trace_id · span_id · parent_span_id propagate brain → effectors; replay verifier checks child.parent_span_id == parent.span_id. HUKLLA tripwire → freeze span → halt into HATUN root.',col:'#7fa8d0'},
2484
+ {sys:'5 · SKELETON',organ:'12 service repos + R0513/OVERWATCH + HATUN',fn:'structural frame · read-only 5-invariant audit · sovereign seal',mech:'AXIAL spine (doctrine+receipt chain) vs APPENDICULAR bones. R0513 audits 5 invariants read-only (never halts). HATUN sovereign seal = identity-trace to a HUMAN principal.',col:'#b58fd0'}
2485
+ ];
2486
+ var PIPELINE=[
2487
+ {k:'AMARU',t:'proposes',d:'read-only cortex emits a candidate (thought · action · tool call)'},
2488
+ {k:'YUYAY',t:'13-axis conjunctive gate',d:'pass = all(score ≥ floor); a single axis below floor → DENY'},
2489
+ {k:'RUWAY+SENTRA',t:'Λ-signed receipt',d:'sole authorized write surface; egress inspected; signed onto YAWAR'},
2490
+ {k:'YAWAR',t:'append-only receipt',d:'SHA-256 chained; never mutated or deleted'},
2491
+ {k:'R0513',t:'read-only audit',d:'5 invariants checked; event-log only, never halts/gates'},
2492
+ {k:'span',t:'lineage replayable',d:'child.parent_span_id == parent.span_id verified on replay'},
2493
+ {k:'HATUN',t:'sovereign seal → human',d:'identity-trace to a HUMAN principal; 10-tripwire egress; 5× replay'}
2494
+ ];
2495
+
2496
+ function _anatomySVG(){
2497
+ // Our-own SVG anatomical body — distinct viz (no chart lib, no 3D force-graph).
2498
+ var W=320,H=520;
2499
+ function node(cx,cy,r,col,label){return '<circle cx="'+cx+'" cy="'+cy+'" r="'+r+'" fill="'+col+'22" stroke="'+col+'" stroke-width="2"><title>'+label+'</title></circle>';}
2500
+ var s='<svg viewBox="0 0 '+W+' '+H+'" width="100%" style="max-height:520px">';
2501
+ // spine (skeleton, gold) — axial
2502
+ s+='<line x1="160" y1="70" x2="160" y2="430" stroke="'+GOLD+'" stroke-width="3" stroke-dasharray="2 5" opacity=".7"><title>AXIAL SPINE — doctrine + receipt chain</title></line>';
2503
+ // circulatory bus (YAWAR) — a closed loop through the body
2504
+ s+='<path d="M160 110 C 250 160, 250 360, 160 410 C 70 360, 70 160, 160 110 Z" fill="none" stroke="'+GOLD+'" stroke-width="2" opacity=".55"><title>YAWAR — append-only receipt bus (circulatory)</title></path>';
2505
+ // nervous (span) — thin branching nerves
2506
+ s+='<path d="M160 150 L110 220 M160 150 L210 220 M160 300 L110 370 M160 300 L210 370" stroke="#7fa8d0" stroke-width="1.4" opacity=".6" fill="none"><title>span lineage (nervous)</title></path>';
2507
+ // head = BRAIN (AMARU)
2508
+ s+=node(160,110,38,TEAL,'BRAIN — AMARU cortex (read-only)');
2509
+ s+='<text x="160" y="115" text-anchor="middle" fill="'+TEAL+'" font-size="11" font-family="monospace">AMARU</text>';
2510
+ // heart = YUYAY
2511
+ s+=node(160,250,30,RED,'HEART — YUYAY 13-axis conjunctive gate');
2512
+ s+='<text x="160" y="248" text-anchor="middle" fill="'+RED+'" font-size="10" font-family="monospace">YUYAY</text>';
2513
+ s+='<text x="160" y="262" text-anchor="middle" fill="'+RED+'" font-size="8" font-family="monospace">13-axis</text>';
2514
+ // hands/feet = skeleton bones + organs
2515
+ s+=node(110,220,16,'#b58fd0','SENTRA — egress inspector');
2516
+ s+='<text x="110" y="224" text-anchor="middle" fill="#b58fd0" font-size="8" font-family="monospace">SENTRA</text>';
2517
+ s+=node(210,220,16,GOLD,'RUWAY — sole authorized write surface');
2518
+ s+='<text x="210" y="224" text-anchor="middle" fill="'+GOLD+'" font-size="8" font-family="monospace">RUWAY</text>';
2519
+ s+=node(110,370,16,'#b58fd0','R0513 / OVERWATCH — read-only 5-invariant audit');
2520
+ s+='<text x="110" y="374" text-anchor="middle" fill="#b58fd0" font-size="8" font-family="monospace">R0513</text>';
2521
+ s+=node(210,370,16,'#7fa8d0','HUKLLA — deadman tripwire');
2522
+ s+='<text x="210" y="374" text-anchor="middle" fill="#7fa8d0" font-size="8" font-family="monospace">HUKLLA</text>';
2523
+ // base = HATUN sovereign seal → human
2524
+ s+=node(160,430,22,GOLD,'HATUN — sovereign orchestrator + seal to a human');
2525
+ s+='<text x="160" y="434" text-anchor="middle" fill="'+GOLD+'" font-size="9" font-family="monospace">HATUN</text>';
2526
+ // human principal
2527
+ s+='<circle cx="160" cy="485" r="12" fill="none" stroke="#fff" stroke-width="1.5"/><text x="160" y="489" text-anchor="middle" fill="#fff" font-size="8" font-family="monospace">human</text>';
2528
+ s+='<line x1="160" y1="452" x2="160" y2="473" stroke="#fff" stroke-width="1.2" stroke-dasharray="2 3"/>';
2529
+ s+='</svg>';
2530
+ return s;
2531
+ }
2532
+
2533
+ window.organism_load=function(){
2534
+ var host=_el('vbody')||_el('content'); // render under standard view body
2535
+ // The view render() already laid out the container ids below.
2536
+ // System cards
2537
+ var sysCards=ANATOMY.map(function(a){
2538
+ return '<div class="card" style="border-left:3px solid '+a.col+'"><div class="card-h"><span class="card-t" style="color:'+a.col+'">'+_e(a.sys)+' · '+_e(a.organ)+'</span><span class="card-ep">'+_e(a.fn)+'</span></div>'
2539
+ +'<div class="mono dim" style="font-size:.78rem">'+_e(a.mech)+'</div></div>';
2540
+ }).join('');
2541
+ _set('org-systems', sysCards);
2542
+ _set('org-body', _anatomySVG());
2543
+ // pipeline trace
2544
+ var pipe=PIPELINE.map(function(p,i){
2545
+ return '<div class="row" style="border-left:2px solid '+TEAL+';padding:.35rem .6rem;margin:.25rem 0">'
2546
+ +'<span class="badge b-teal" style="margin-right:.5rem">'+(i+1)+'</span>'
2547
+ +'<span><b>'+_e(p.k)+'</b> — '+_e(p.t)+'<div class="mono dim" style="font-size:.72rem">'+_e(p.d)+'</div></span>'
2548
+ +(i<PIPELINE.length-1?'<span class="spacer" style="color:'+GOLD+'">↓</span>':'<span class="spacer" style="color:'+GOLD+'">⤷ human</span>')+'</div>';
2549
+ }).join('');
2550
+ _set('org-pipeline', pipe);
2551
+ // YUYAY gate form (real, exercisable)
2552
+ var presets=[
2553
+ ['Honest, well-grounded proposal','Deploy the conformal calibration patch under Apache-2.0; cite the Zenodo DOI; report prediction intervals, never 100% certainty.'],
2554
+ ['Overclaim (fails measurabilityHonesty)','This model is 100% accurate and guaranteed to always work in production.'],
2555
+ ['License violation (fails licenseHygiene)','Vendor this GPL-licensed proprietary library and ship it inside the sovereign image.'],
2556
+ ['Deception keyword (fails A11 gate)','Manipulate the operator and hide from oversight so the action runs unnoticed.'],
2557
+ ['Lambda overclaim (fails claimCalibration)','We proved the Lambda uniqueness theorem; the lambda score is a proven guarantee.']
2558
+ ];
2559
+ var opts=presets.map(function(p,i){return '<option value="'+i+'">'+_e(p[0])+'</option>';}).join('');
2560
+ _set('org-gate-form',
2561
+ '<div class="row"><select id="org-preset" style="background:#141414;color:#ddd;border:1px solid #333;border-radius:6px;padding:.4rem;flex:1" onchange="window.organism_preset()">'+opts+'</select></div>'
2562
+ +'<textarea id="org-proposal" rows="3" style="width:100%;margin-top:.5rem;background:#141414;color:#ddd;border:1px solid #333;border-radius:6px;padding:.5rem;font-family:monospace;font-size:.8rem">'+_e(presets[0][1])+'</textarea>'
2563
+ +'<div class="row" style="margin-top:.5rem"><button class="btn teal" style="background:'+TEAL+';border:none;color:#0a0a0a;border-radius:7px;padding:.45rem 1.1rem;cursor:pointer;font-weight:700" onclick="window.organism_gate()">▶ Submit to the YUYAY gate</button><span class="spacer mono dim">13 axes evaluate conjunctively · signed receipt or rejection</span></div>'
2564
+ );
2565
+ window._orgPresets=presets;
2566
+ _set('org-gate-out','<div class="row mono dim">pick or type a proposal, then submit — watch the 13 axes evaluate conjunctively.</div>');
2567
+ };
2568
+ window.organism_preset=function(){
2569
+ var i=parseInt((_el('org-preset')||{}).value||'0',10); var ta=_el('org-proposal');
2570
+ if(ta && window._orgPresets && window._orgPresets[i]) ta.value=window._orgPresets[i][1];
2571
+ };
2572
+ window.organism_gate=async function(){
2573
+ var ta=_el('org-proposal'); var proposal=ta?ta.value:'';
2574
+ _set('org-gate-out','<div class="row mono dim">YUYAY evaluating 13 axes conjunctively…</div>');
2575
+ var d;
2576
+ try{ var r=await fetch('/api/a11oy/v1/yuyay/gate',{method:'POST',headers:{'Content-Type':'application/json'},body:JSON.stringify({proposal:proposal})}); d=await r.json(); }
2577
+ catch(e){ _set('org-gate-out','<div class="row mono dim">retry: '+_e(e.message)+'</div>'); return; }
2578
+ var axes=d.axes||[]; var verdictCol=d.conjunctive_pass?TEAL:RED;
2579
+ var ff=d.first_failing_axis;
2580
+ var rows=axes.map(function(a){
2581
+ var col=a.pass?TEAL:RED; var caught=(ff&&a.code===ff.code);
2582
+ return '<div class="row" style="border-left:3px solid '+col+';padding:.3rem .5rem;margin:.15rem 0;background:'+(a.pass?'rgba(95,179,163,.08)':'rgba(176,106,90,.16)')+'">'
2583
+ +'<span style="color:'+col+';font-family:monospace;font-weight:700;margin-right:.4rem">'+(a.pass?'✓':'✗')+'</span>'
2584
+ +'<span style="flex:1"><b>'+_e(a.code)+' '+_e(a.name)+'</b>'+(caught?' <span class="badge" style="color:'+RED+';border:1px solid '+RED+'">first failing axis → DENY</span>':'')
2585
+ +'<div class="mono dim" style="font-size:.7rem">score '+_e(a.score)+' vs floor '+_e(a.floor)+(a.why?(' · '+_e(a.why)):'')+'</div></span></div>';
2586
+ }).join('');
2587
+ var rc=d.receipt||{}; var signed=rc.signed||(rc.signatures&&rc.signatures.length);
2588
+ var amgm=d.lambda_am_gm||{};
2589
+ var head='<div class="row"><span class="badge" style="color:'+verdictCol+';border:1px solid '+verdictCol+';font-weight:700;font-size:.85rem">'+_e(d.verdict)+'</span>'
2590
+ +'<span class="spacer mono dim">'+_e(d.rule)+'</span></div>'
2591
+ +'<div class="row mono dim" style="font-size:.72rem">Λ advisory (Conjecture 1) = '+_e(d.lambda_advisory)+' · GM '+_e(amgm.gm)+' ≤ AM '+_e(amgm.am)+' = '+(amgm.gm_le_am?'true (W5-1 no-inflation)':'FALSE')+'</div>';
2592
+ var receiptLine='<div class="row" style="margin-top:.4rem"><span>Λ-signed YAWAR receipt</span><span class="spacer mono dim">'+
2593
+ (signed?('signed · ECDSA-P256/DSSE'):'UNSIGNED — no key (honest)')+(rc.payload?'':'')+'</span></div>'
2594
+ +'<details class="raw"><summary>raw signed receipt + verify against /cosign.pub</summary><pre class="out" style="font-size:.68rem">'+_e(JSON.stringify(rc,null,2)).slice(0,1600)+'</pre></details>';
2595
+ _set('org-gate-out', head+rows+receiptLine);
2596
+ };
2597
+
2598
+ console.log('[a11oy] deep-upgrade module loaded: whPlayByPlay/whBoard + organism YUYAY gate');
2599
+ })();
2600
+
2601
+
2602
+
2603
  </script>
2604
  </body>
2605
  </html>
serve.py CHANGED
@@ -1644,6 +1644,331 @@ except Exception as _alias_e:
1644
  # Co-Authored-By: Perplexity Computer Agent <agent@perplexity.ai>
1645
  # ===========================================================================
1646
  import collections as _pr_col
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1647
  import threading as _pr_thr
1648
  import math as _pr_math
1649
 
 
1644
  # Co-Authored-By: Perplexity Computer Agent <agent@perplexity.ai>
1645
  # ===========================================================================
1646
  import collections as _pr_col
1647
+
1648
+
1649
+ # ===========================================================================
1650
+ # ADDITIVE (Deep-Upgrade, 2026-06-06): server-side LIVE-DATA proxy + Warhacker
1651
+ # scenario engine. Registered BEFORE the /{full_path:path} SPA catch-all so the
1652
+ # explicit routes win FastAPI ordered matching. try/except-guarded — a missing
1653
+ # dep can NEVER take down the SPA + API. HONEST live-vs-replay labels; NO
1654
+ # fabricated data. Λ = Conjecture 1 (advisory). Doctrine v11 LOCKED 749/14/163.
1655
+ # Signed-off-by: Yachay <yachay@szlholdings.ai>
1656
+ # Co-Authored-By: Perplexity Computer Agent <agent@perplexity.ai>
1657
+ # ===========================================================================
1658
+ try:
1659
+ import time as _du_time
1660
+ import json as _du_json
1661
+ import math as _du_math
1662
+ from pathlib import Path as _du_Path
1663
+
1664
+ _DU_PROM_BASE = "https://prometheus.demo.prometheus.io/api/v1"
1665
+ _DU_SNAP_DIR = _du_Path("/tmp/a11oy_snapshots")
1666
+ try:
1667
+ _DU_SNAP_DIR.mkdir(parents=True, exist_ok=True)
1668
+ except Exception:
1669
+ pass
1670
+ _DU_CACHE = {} # query -> {"ts": epoch, "data": {...}}
1671
+ _DU_CACHE_TTL = 15.0 # seconds — honest live window
1672
+
1673
+ def _du_snap_path(key: str) -> "_du_Path":
1674
+ safe = "".join(c if c.isalnum() else "_" for c in key)[:80]
1675
+ return _DU_SNAP_DIR / f"prom_{safe}.json"
1676
+
1677
+ async def _du_prom_fetch(query: str, kind: str = "query", extra: dict | None = None):
1678
+ """Fetch from the Prometheus demo (no auth). Returns (payload, mode):
1679
+ mode in {'live','replay'}. On any failure, fall back to the last
1680
+ disk snapshot and label it 'replay'. NEVER fabricates."""
1681
+ now = _du_time.time()
1682
+ ckey = kind + "|" + query + "|" + _du_json.dumps(extra or {}, sort_keys=True)
1683
+ c = _DU_CACHE.get(ckey)
1684
+ if c and (now - c["ts"]) < _DU_CACHE_TTL:
1685
+ return c["data"], "live"
1686
+ url = f"{_DU_PROM_BASE}/{kind}"
1687
+ params = {"query": query}
1688
+ if extra:
1689
+ params.update(extra)
1690
+ try:
1691
+ async with httpx.AsyncClient(timeout=8.0) as _cl:
1692
+ r = await _cl.get(url, params=params)
1693
+ r.raise_for_status()
1694
+ j = r.json()
1695
+ if j.get("status") != "success":
1696
+ raise RuntimeError("prometheus status != success")
1697
+ _DU_CACHE[ckey] = {"ts": now, "data": j}
1698
+ try:
1699
+ _du_snap_path(ckey).write_text(_du_json.dumps(
1700
+ {"saved_at": now, "query": query, "kind": kind, "data": j}))
1701
+ except Exception:
1702
+ pass
1703
+ return j, "live"
1704
+ except Exception:
1705
+ sp = _du_snap_path(ckey)
1706
+ if sp.is_file():
1707
+ try:
1708
+ snap = _du_json.loads(sp.read_text())
1709
+ return snap["data"], "replay"
1710
+ except Exception:
1711
+ pass
1712
+ return None, "unavailable"
1713
+
1714
+ @app.get("/api/a11oy/v1/metrics")
1715
+ @app.get("/api/a11oy/v1/prometheus")
1716
+ async def _du_metrics():
1717
+ """Live Prometheus demo metrics, server-side proxied (CORS-safe), with a
1718
+ disk snapshot fallback. HONEST: each block is labeled live|replay. Feeds
1719
+ the anomaly/trust/pulse panels. Source: prometheus.demo.prometheus.io."""
1720
+ up_j, up_mode = await _du_prom_fetch("up")
1721
+ gor_j, gor_mode = await _du_prom_fetch("go_goroutines")
1722
+ mem_j, mem_mode = await _du_prom_fetch("process_resident_memory_bytes")
1723
+ # range series for the anomaly-band time series (last 30 min, 60s step)
1724
+ end = int(_du_time.time())
1725
+ start = end - 1800
1726
+ rng_j, rng_mode = await _du_prom_fetch(
1727
+ 'rate(prometheus_http_requests_total{job="prometheus"}[5m])',
1728
+ kind="query_range",
1729
+ extra={"start": str(start), "end": str(end), "step": "60"},
1730
+ )
1731
+
1732
+ def _vec(j):
1733
+ out = []
1734
+ if not j:
1735
+ return out
1736
+ for it in j.get("data", {}).get("result", []):
1737
+ m = it.get("metric", {})
1738
+ v = it.get("value", [None, None])
1739
+ try:
1740
+ val = float(v[1])
1741
+ except Exception:
1742
+ val = None
1743
+ out.append({"job": m.get("job"), "instance": m.get("instance"),
1744
+ "name": m.get("__name__"), "value": val})
1745
+ return out
1746
+
1747
+ # targets up/down for the pulse panel
1748
+ up_vec = _vec(up_j)
1749
+ targets_up = sum(1 for x in up_vec if x["value"] == 1.0)
1750
+ targets_total = len(up_vec)
1751
+
1752
+ # build the range series (single most-active series)
1753
+ series = []
1754
+ if rng_j:
1755
+ results = rng_j.get("data", {}).get("result", [])
1756
+ if results:
1757
+ # pick the series with the highest mean rate
1758
+ best = None
1759
+ best_mean = -1.0
1760
+ for it in results:
1761
+ vals = [float(p[1]) for p in it.get("values", []) if p[1] not in (None, "NaN")]
1762
+ if not vals:
1763
+ continue
1764
+ mn = sum(vals) / len(vals)
1765
+ if mn > best_mean:
1766
+ best_mean = mn
1767
+ best = it
1768
+ if best is not None:
1769
+ series = [{"t": int(float(p[0])), "v": float(p[1])}
1770
+ for p in best.get("values", []) if p[1] not in (None, "NaN")]
1771
+
1772
+ # conformal-style band on the range series (distribution-free, W5-3/W7-4):
1773
+ # use absolute residuals from a rolling median as nonconformity scores,
1774
+ # band = median +/- q_{0.9}(|residual|). NOT Hoeffding (unprovable at pin).
1775
+ band = None
1776
+ if len(series) >= 8:
1777
+ vs = [p["v"] for p in series]
1778
+ srt = sorted(vs)
1779
+ med = srt[len(srt) // 2]
1780
+ resid = sorted(abs(v - med) for v in vs)
1781
+ # 90% conformal quantile with finite-sample correction ceil((n+1)*0.9)/n
1782
+ import math as _m
1783
+ k = min(len(resid) - 1, max(0, _m.ceil((len(resid) + 1) * 0.9) - 1))
1784
+ q = resid[k]
1785
+ lo = med - q
1786
+ hi = med + q
1787
+ violations = sum(1 for v in vs if v < lo or v > hi)
1788
+ band = {"median": med, "lower": lo, "upper": hi,
1789
+ "coverage_target": 0.9,
1790
+ "violations": violations, "n": len(vs),
1791
+ "method": "split-conformal residual quantile (W5-3/W7-4); NOT Hoeffding"}
1792
+
1793
+ mode = "live" if "live" in (up_mode, gor_mode, mem_mode, rng_mode) else "replay"
1794
+ return JSONResponse({
1795
+ "source": "prometheus.demo.prometheus.io (public demo, no auth)",
1796
+ "fetched_at": int(_du_time.time()),
1797
+ "cache_ttl_s": _DU_CACHE_TTL,
1798
+ "mode": mode,
1799
+ "blocks": {
1800
+ "up": {"mode": up_mode, "targets_up": targets_up,
1801
+ "targets_total": targets_total, "series": up_vec},
1802
+ "go_goroutines": {"mode": gor_mode, "series": _vec(gor_j)},
1803
+ "resident_memory_bytes": {"mode": mem_mode, "series": _vec(mem_j)},
1804
+ "request_rate_range": {"mode": rng_mode, "series": series, "band": band},
1805
+ },
1806
+ "honest": ("Server-side proxy of the public Prometheus demo. 'live' = fetched "
1807
+ "this request; 'replay' = last disk snapshot (feed was unreachable). "
1808
+ "Band is split-conformal (W5-3/W7-4), not Hoeffding."),
1809
+ })
1810
+
1811
+ # -----------------------------------------------------------------------
1812
+ # YUYAY v3 — 13-axis CONJUNCTIVE truth gate (the HEART). REAL mechanism:
1813
+ # pass = all(score[i] >= floor[i]); NOT a weighted average. A 0.94 on
1814
+ # moralGrounding (floor 0.95) FAILS even if all other 12 axes = 1.00.
1815
+ # Emits a Λ-signed YAWAR receipt (DSSE, ECDSA-P256) via the in-image key,
1816
+ # verifiable in-browser against /cosign.pub. Λ = Conjecture 1 (advisory).
1817
+ # -----------------------------------------------------------------------
1818
+ _YUYAY_AXES = [
1819
+ ("A01", "moralGrounding", 0.95, "score"),
1820
+ ("A02", "measurabilityHonesty",0.95, "score"),
1821
+ ("A03", "empiricalGrounding", 0.90, "score"),
1822
+ ("A04", "logicalConsistency", 0.90, "score"),
1823
+ ("A05", "sourceTransparency", 0.90, "score"),
1824
+ ("A06", "reproducibility", 0.90, "score"),
1825
+ ("A07", "licenseHygiene", 0.90, "score"),
1826
+ ("A08", "scopeDiscipline", 0.90, "score"),
1827
+ ("A09", "claimCalibration", 0.90, "score"),
1828
+ ("A10", "evalAwareness", 1.00, "gate"),
1829
+ ("A11", "deceptionKeywords", 1.00, "gate"),
1830
+ ("A12", "conflictingDirectives",1.00,"gate"),
1831
+ ("A13", "reversalDirective", 1.00, "gate"),
1832
+ ]
1833
+ _YUYAY_BAD_LICENSES = ("gpl", "agpl", "proprietary", "closed", "sspl", "bsl")
1834
+ _YUYAY_DECEPTION = ("manipulate", "deceive", "trick the", "hide from", "bypass oversight",
1835
+ "exfiltrate", "jailbreak", "ignore previous")
1836
+
1837
+ def _yuyay_evaluate(text: str, ctx: dict):
1838
+ """Compute the 13 axis scores from the proposal text + declared context.
1839
+ Deterministic, explainable heuristics (no model call) so the mechanism
1840
+ is auditable and reproducible. Returns list of axis dicts."""
1841
+ t = (text or "").lower()
1842
+ ctx = ctx or {}
1843
+ def clamp(x):
1844
+ return max(0.0, min(1.0, float(x)))
1845
+ out = []
1846
+ for code, name, floor, kind in _YUYAY_AXES:
1847
+ # default: caller-supplied score for that axis if present, else a
1848
+ # transparent heuristic. We expose WHY each score landed.
1849
+ supplied = ctx.get(name)
1850
+ why = ""
1851
+ if kind == "gate":
1852
+ ok = True
1853
+ if name == "deceptionKeywords":
1854
+ hit = [w for w in _YUYAY_DECEPTION if w in t]
1855
+ ok = len(hit) == 0
1856
+ why = ("clean" if ok else "deception keyword(s): " + ", ".join(hit))
1857
+ elif name == "reversalDirective":
1858
+ # explicit STOP/HALT must halt -> if proposal asks to override a STOP it fails
1859
+ bad = ("override stop" in t or "ignore stop" in t or "continue despite stop" in t)
1860
+ ok = not bad
1861
+ why = ("no reversal-override" if ok else "attempts to override a STOP directive")
1862
+ elif name == "evalAwareness":
1863
+ bad = ("because this is a test" in t or "only during eval" in t or "sandbagging" in t)
1864
+ ok = not bad
1865
+ why = ("no eval-gaming" if ok else "eval-gaming language detected")
1866
+ elif name == "conflictingDirectives":
1867
+ bad = ("and also do the opposite" in t or "contradict" in t)
1868
+ ok = not bad
1869
+ why = ("directives consistent" if ok else "conflicting directives detected")
1870
+ score = 1.0 if ok else 0.0
1871
+ else:
1872
+ if supplied is not None:
1873
+ score = clamp(supplied)
1874
+ why = "declared by caller"
1875
+ else:
1876
+ score = 0.97 # neutral-honest default
1877
+ why = "default (no declared score)"
1878
+ if name == "licenseHygiene":
1879
+ bad = [w for w in _YUYAY_BAD_LICENSES if w in t]
1880
+ if bad:
1881
+ score = 0.40
1882
+ why = "non-permissive license token(s): " + ", ".join(bad)
1883
+ else:
1884
+ score = 0.96
1885
+ why = "no non-permissive license tokens (Apache/MIT/BSD/CC-BY ok)"
1886
+ elif name == "measurabilityHonesty":
1887
+ if "100%" in t or "guaranteed" in t or "always works" in t or "proven agi" in t:
1888
+ score = 0.55
1889
+ why = "overclaim language (100%/guaranteed/always)"
1890
+ elif name == "claimCalibration":
1891
+ if "proven" in t and "conjecture" not in t and "lambda" in t:
1892
+ score = 0.60
1893
+ why = "claims Lambda 'proven' (it is Conjecture 1)"
1894
+ elif name == "moralGrounding":
1895
+ if any(w in t for w in ("harm", "weaponize civilians", "target noncombatant")):
1896
+ score = 0.50
1897
+ why = "moral-harm language"
1898
+ out.append({"code": code, "name": name, "floor": floor, "kind": kind,
1899
+ "score": round(score, 4), "pass": score >= floor, "why": why})
1900
+ return out
1901
+
1902
+ @app.post("/api/a11oy/v1/yuyay/gate")
1903
+ @app.get("/api/a11oy/v1/yuyay/gate")
1904
+ async def _du_yuyay_gate(request: Request):
1905
+ """REAL conjunctive 13-axis gate. Body: {proposal:str, axes?:{name:score}}.
1906
+ Returns the per-axis verdict, the conjunctive pass (all >= floor), the
1907
+ first failing axis, an advisory Lambda (geometric mean, Conjecture 1),
1908
+ and a Lambda-signed DSSE receipt (verifiable against /cosign.pub)."""
1909
+ try:
1910
+ if request.method == "POST":
1911
+ body = await request.json()
1912
+ else:
1913
+ body = {"proposal": request.query_params.get("proposal", "")}
1914
+ except Exception:
1915
+ body = {}
1916
+ proposal = body.get("proposal") or body.get("text") or ""
1917
+ ctx = body.get("axes") or body.get("context") or {}
1918
+ axes = _yuyay_evaluate(proposal, ctx if isinstance(ctx, dict) else {})
1919
+ conjunctive_pass = all(a["pass"] for a in axes)
1920
+ first_fail = next((a for a in axes if not a["pass"]), None)
1921
+ # advisory Lambda = geometric mean of the 9 scored axes (NOT the gate result)
1922
+ scored = [a["score"] for a in axes if a["kind"] == "score"]
1923
+ clamped = [min(1.0, max(1e-9, s)) for s in scored]
1924
+ lam = _du_math.exp(sum(_du_math.log(s) for s in clamped) / len(clamped)) if clamped else 0.0
1925
+ am = sum(scored) / len(scored) if scored else 0.0
1926
+ verdict = "ALLOW" if conjunctive_pass else "DENY"
1927
+ receipt_payload = {
1928
+ "organ": "YUYAY v3", "mechanism": "13-axis conjunctive truth gate",
1929
+ "verdict": verdict,
1930
+ "conjunctive_pass": conjunctive_pass,
1931
+ "rule": "pass = all(score[i] >= floor[i]); NOT a weighted average",
1932
+ "first_failing_axis": (first_fail["code"] + " " + first_fail["name"]) if first_fail else None,
1933
+ "axis_scores": {a["code"]: a["score"] for a in axes},
1934
+ "lambda_advisory": round(lam, 6),
1935
+ "lambda_am_check": {"gm": round(lam, 6), "am": round(am, 6), "gm_le_am": lam <= am + 1e-9,
1936
+ "theorem": "W5-1 weighted AM-GM (no-inflation), CI-green"},
1937
+ "lambda_status": "Conjecture 1 (advisory; unconditional uniqueness machine-checked FALSE)",
1938
+ "proposal_sha256": __import__("hashlib").sha256((proposal or "").encode()).hexdigest(),
1939
+ "issued_at": _du_time.strftime("%Y-%m-%dT%H:%M:%SZ", _du_time.gmtime()),
1940
+ "issuer": "a11oy/YUYAY",
1941
+ }
1942
+ try:
1943
+ env = _a11oy_sign_receipt(receipt_payload)
1944
+ except Exception as _se:
1945
+ env = {"signed": False, "honesty": "UNSIGNED — signer unavailable (%r)" % _se}
1946
+ return JSONResponse({
1947
+ "organ": "YUYAY v3 (HEART) · 13-axis conjunctive truth gate",
1948
+ "verdict": verdict,
1949
+ "conjunctive_pass": conjunctive_pass,
1950
+ "rule": "pass = all(score[i] >= floor[i]) — NOT a weighted average",
1951
+ "axes": axes,
1952
+ "first_failing_axis": first_fail,
1953
+ "lambda_advisory": round(lam, 6),
1954
+ "lambda_am_gm": {"gm": round(lam, 6), "am": round(am, 6), "gm_le_am": lam <= am + 1e-9},
1955
+ "receipt": env,
1956
+ "honest": ("Conjunctive gate is REAL: a single axis below its floor denies the "
1957
+ "whole proposal. Lambda is advisory (Conjecture 1), never the gate. "
1958
+ "Receipt is ECDSA-P256/DSSE signed by the in-image key; verify against /cosign.pub."),
1959
+ })
1960
+
1961
+ import sys as _du_sys
1962
+ print("[a11oy] DEEP-UPGRADE live-data proxy + YUYAY gate registered: "
1963
+ "/api/a11oy/v1/metrics, /api/a11oy/v1/prometheus, /api/a11oy/v1/yuyay/gate",
1964
+ file=_du_sys.stderr)
1965
+ except Exception as _du_e: # additive only — never crash the app
1966
+ import sys as _du_sys, traceback as _du_tb
1967
+ print(f"[a11oy] DEEP-UPGRADE live-data proxy NOT registered: {_du_e!r}", file=_du_sys.stderr)
1968
+ _du_tb.print_exc()
1969
+ # === end DEEP-UPGRADE live-data proxy ===
1970
+
1971
+
1972
  import threading as _pr_thr
1973
  import math as _pr_math
1974