/* ===================================================================== SZL AGENT BODY v4 (DEEPEN) — LIVING ANATOMY · WebGL engine (EVOLVES v3 → v4 → v4-deepen — ADDITIVE ONLY, NOT a rewrite. The whole v3 engine below is preserved verbatim; v4 dissection features are layered ON TOP in a clearly-marked block; the v4-DEEPEN block (v5) is layered on top of that. v3/v4 lineage stays fully visible.) v4-DEEPEN ADDS (all additive, same scene + SAME render loop): A. Formula Atlas — EVERY formula in data.js, grouped by maturity tier, searchable, tier-filterable, live count badges. B. Per-organ formula→Lean drill-down (expandable axioms + lutar-lean link) and hover organ↔formula 3D highlight. C. More real 3D — leader-line organ labels, breathing Λ-heart idle synced to the receipt pulse, smoother per-organ framing, a pausable guided-tour mode. Respects prefers-reduced-motion. D. HONEST forecast overlay — a transparency timeline/sparkline of proof maturity driven ONLY by data.js / KERNEL strings; every not-yet-achieved item labeled ROADMAP / PROJECTED. E. Mobile/tablet parity via the existing bottom-sheet pattern. Honesty preserved: data.js is the single source of truth; nothing is fabricated; CONJECTURE/EXPERIMENTAL/AXIOM_GATED are never relabeled. Sovereign: vendored THREE r160 (global), ZERO runtime CDN, offline. Two organisms (a11oy / killinchu) rendered as human-like silhouettes sharing ONE circulatory (YAWAR receipt bus) + nervous (span lineage) mesh. Cinematic dark substrate, additive volumetric glow (in-core pseudo-bloom via radial sprites), smooth fly-in + auto-orbit, a live receipt-flow along YAWAR, elegant organ detail cards. v4 ADDS (all additive, all on this same scene + render loop): 1. Dissection layer stack (toggles + opacity, localStorage-persisted) 2. Clip-plane scalpel (renderer.localClippingEnabled, X/Y/Z + reset) 3. Explode view (eased 0->1 radial separation of organs) 4. Search / jump (filter organs+formulas, fly + open panel) 5. Always-on visibility HUD (honest counts read from D.KERNEL) 6. Focus mode (fade other organs when one is selected) 7. Accessibility + mobile + prefers-reduced-motion Honesty preserved: data.js is the single source of truth. ===================================================================== */ (function () { 'use strict'; const D = window.SZL_ANATOMY; const TAU = Math.PI * 2; const lerp = (a, b, t) => a + (b - a) * t; const clamp = (v, a, b) => Math.max(a, Math.min(b, v)); const easeOutCubic = t => 1 - Math.pow(1 - t, 3); const easeInOutCubic = t => t < 0.5 ? 4 * t * t * t : 1 - Math.pow(-2 * t + 2, 3) / 2; /* ---------------- tiny ASCII-math -> Unicode renderer ------------- */ function mathToUnicode(s) { const map = { 'Lambda':'\u039b','Sigma':'\u03a3','theta':'\u03b8','rho':'\u03c1','pi':'\u03c0','delta':'\u03b4', 'lam_min':'\u03bb_min','<=':'\u2264','>=':'\u2265','!=':'\u2260','=>':'\u21d2','<=>':'\u21d4', '=/=>':'\u21cf','->':'\u2192','sqrt':'\u221a','forall':'\u2200','argmin':'argmin','Sigma_i':'\u03a3\u1d62' }; let out = s; ['<=>','=/=>','=>','<=','>=','!=','->','Lambda','Sigma_i','Sigma','theta','rho','pi','delta','lam_min','sqrt','forall'].forEach(k=>{ out = out.split(k).join(map[k]||k); }); out = out.replace(/_\{([^}]+)\}/g, (m,g)=>toSub(g)).replace(/\^\{([^}]+)\}/g,(m,g)=>toSup(g)); out = out.replace(/_([A-Za-z0-9]+)/g,(m,g)=>toSub(g)).replace(/\^([A-Za-z0-9+\-]+)/g,(m,g)=>toSup(g)); return out; } const SUB={'0':'\u2080','1':'\u2081','2':'\u2082','3':'\u2083','4':'\u2084','5':'\u2085','6':'\u2086','7':'\u2087','8':'\u2088','9':'\u2089','i':'\u1d62','j':'\u2c7c','k':'\u2096','n':'\u2099','r':'\u1d63','t':'\u209c','min':'min','out':'out','in':'in'}; const SUP={'0':'\u2070','1':'\u00b9','2':'\u00b2','3':'\u00b3','+':'\u207a','-':'\u207b'}; function toSub(g){ if(SUB[g])return SUB[g]; return g.split('').map(c=>SUB[c]||c).join(''); } function toSup(g){ return g.split('').map(c=>SUP[c]||c).join(''); } /* ---------------- DOM refs ---------------- */ const $ = id => document.getElementById(id); const panel=$('panel'), tip=$('tip'); /* ---------------- renderer / scene / camera ---------------- */ const canvas=$('scene'); let renderer; try { renderer=new THREE.WebGLRenderer({canvas,antialias:true,alpha:false,powerPreference:'high-performance'}); } catch(e){ document.body.classList.add('nojs'); return; } const DPR = Math.min(devicePixelRatio||1, 2); renderer.setSize(innerWidth,innerHeight); renderer.setPixelRatio(DPR); renderer.toneMapping=THREE.ACESFilmicToneMapping; renderer.toneMappingExposure=1.12; renderer.outputColorSpace=THREE.SRGBColorSpace; const scene=new THREE.Scene(); scene.background=new THREE.Color('#04060c'); scene.fog=new THREE.FogExp2('#04060c',0.020); const camera=new THREE.PerspectiveCamera(50,innerWidth/innerHeight,0.1,260); const HOME={r:13.8,phi:1.33,theta:0.0,target:new THREE.Vector3(0,0.35,0)}; const cam={r:HOME.r,phi:HOME.phi,theta:HOME.theta,target:HOME.target.clone()}; // cinematic fly-in start const intro={t:0, dur:2.6, from:{r:26,phi:1.05,theta:-0.55}, active:true}; /* ---------------- lights ---------------- */ scene.add(new THREE.AmbientLight('#33446e',0.5)); const key=new THREE.DirectionalLight('#cfe0ff',1.0); key.position.set(6,11,9); scene.add(key); const fill=new THREE.DirectionalLight('#2a3a66',0.4); fill.position.set(-7,-3,-6); scene.add(fill); const rimA=new THREE.PointLight('#3fe0c5',0.85,42); rimA.position.set(-9,3,4); scene.add(rimA); const rimK=new THREE.PointLight('#ffb13f',0.85,42); rimK.position.set(9,3,4); scene.add(rimK); const heartLight=new THREE.PointLight('#ff5d8f',1.5,26); heartLight.position.set(0,0.55,1.2); scene.add(heartLight); /* ---------------- additive glow sprite texture (pseudo-bloom) ----- */ const GLOW_TEX = (function(){ const s=128, c=document.createElement('canvas'); c.width=c.height=s; const g=c.getContext('2d'); const grad=g.createRadialGradient(s/2,s/2,0,s/2,s/2,s/2); grad.addColorStop(0,'rgba(255,255,255,1)'); grad.addColorStop(0.25,'rgba(255,255,255,0.55)'); grad.addColorStop(0.55,'rgba(255,255,255,0.16)'); grad.addColorStop(1,'rgba(255,255,255,0)'); g.fillStyle=grad; g.fillRect(0,0,s,s); const t=new THREE.CanvasTexture(c); t.colorSpace=THREE.SRGBColorSpace; return t; })(); function glowSprite(hex,scale,opacity){ const m=new THREE.SpriteMaterial({map:GLOW_TEX,color:hex,transparent:true,opacity:opacity==null?0.7:opacity, blending:THREE.AdditiveBlending,depthWrite:false,depthTest:true}); const sp=new THREE.Sprite(m); sp.scale.setScalar(scale); return sp; } /* ---------------- starfield (depth-of-field-ish layered) ---------- */ (function stars(){ [{n:900,r0:46,r1:120,size:0.14,op:0.42,col:'#6f86c0'}, {n:420,r0:30,r1:70,size:0.26,op:0.30,col:'#8ea6e0'}].forEach(L=>{ const g=new THREE.BufferGeometry(),p=new Float32Array(L.n*3); for(let i=0;i{const j=new THREE.Mesh(new THREE.SphereGeometry(rad*1.5,8,8),boneMat);j.position.copy(p);g.add(j);}); } bone(-0.05,1.85,-0.1,-1.0,1.7,0.0,0.07); bone(-1.0,1.7,0,-1.35,0.55,0.1,0.06); bone(-1.35,0.55,0.1,-1.5,-0.55,0.15,0.05); bone(0.05,1.85,-0.1, 1.0,1.7,0.0,0.07); bone( 1.0,1.7,0, 1.35,0.55,0.1,0.06); bone( 1.35,0.55,0.1, 1.5,-0.55,0.15,0.05); for(let i=0;i<4;i++){const y=1.3-i*0.32;const r=new THREE.Mesh(new THREE.TorusGeometry(0.78-i*0.04,0.03,6,22,Math.PI*1.3),boneMat); r.position.set(0,y,0.05); r.rotation.set(Math.PI/2,0,Math.PI*0.85); g.add(r);} bone(-0.4,-1.7,0,-0.55,-3.0,0.1,0.08); bone(-0.55,-3.0,0.1,-0.6,-4.1,0.2,0.06); bone( 0.4,-1.7,0, 0.55,-3.0,0.1,0.08); bone( 0.55,-3.0,0.1, 0.6,-4.1,0.2,0.06); root.add(g); // v4: register silhouette membrane + skeleton meshes so the dissection // layer stack and clip-plane can address them (collected, not altered here). g.traverse(c=>{ if(c.isMesh) silhouetteMeshes.push(c); }); silhouetteGroups.push(g); return g; } /* ---------------- ORGANS ---------------- */ function buildOrgans(){ D.BODIES.forEach(body=>{ D.ORGANS.forEach(o=>{ if(o.shared && body.side!==-1) return; const sysColor=o.color; const baseX=o.shared?0:body.side*BODY_X; const grp=new THREE.Group(); grp.position.set(baseX + o.pos[0], o.pos[1], o.pos[2]); if(o.beat){ // HEART — layered Λ core heartGroup=grp; const core=new THREE.Mesh(new THREE.IcosahedronGeometry(o.scale,3), new THREE.MeshStandardMaterial({color:'#ff5d8f',emissive:'#ff2d6f',emissiveIntensity:1.25,roughness:0.22,metalness:0.25})); heartCoreMat=core.material; grp.add(core); [[-0.18,0.12],[0.18,0.05]].forEach(([dx,dy])=>{ const lobe=new THREE.Mesh(new THREE.SphereGeometry(o.scale*0.62,18,16), new THREE.MeshStandardMaterial({color:'#ff7ea3',emissive:'#ff4d80',emissiveIntensity:0.9,roughness:0.28,transparent:true,opacity:0.92})); lobe.position.set(dx,dy,0); grp.add(lobe); }); heartHalo=new THREE.Mesh(new THREE.SphereGeometry(o.scale*1.7,22,20), new THREE.MeshBasicMaterial({color:'#ff5d8f',transparent:true,opacity:0.12,side:THREE.BackSide,depthWrite:false})); grp.add(heartHalo); heartGlow=glowSprite('#ff5d8f',o.scale*8.5,0.55); grp.add(heartGlow); heartRing=new THREE.Mesh(new THREE.TorusGeometry(o.scale*1.3,0.022,8,48), new THREE.MeshBasicMaterial({color:'#ffd0e0',transparent:true,opacity:0.65,blending:THREE.AdditiveBlending,depthWrite:false})); grp.add(heartRing); const ring2=new THREE.Mesh(new THREE.TorusGeometry(o.scale*1.7,0.012,8,56), new THREE.MeshBasicMaterial({color:'#ff9ec0',transparent:true,opacity:0.4,blending:THREE.AdditiveBlending,depthWrite:false})); ring2.rotation.x=Math.PI/2.4; grp.add(ring2); grp.userData.ring2=ring2; } else { let geo; switch(o.system){ case 'brain': geo=new THREE.IcosahedronGeometry(o.scale,1); break; case 'blood': geo=new THREE.SphereGeometry(o.scale,20,18); break; case 'nerve': geo=new THREE.OctahedronGeometry(o.scale,1); break; case 'skeleton': geo=new THREE.DodecahedronGeometry(o.scale,0); break; case 'audit': geo=new THREE.IcosahedronGeometry(o.scale,0); break; // v6 agentic-GPU organs — distinct geometry per system for visual identity case 'metabolism': geo=new THREE.TorusKnotGeometry(o.scale*0.72,o.scale*0.22,64,8); break; // KALLPA: harvest coil case 'immune': geo=new THREE.IcosahedronGeometry(o.scale,2); break; // WAQAYCHAQ: high-res polyhedron = many-face shield case 'endocrine': geo=new THREE.OctahedronGeometry(o.scale,0); break; // KAMAY: 8-face hormone signal node case 'respiratory': geo=new THREE.TorusGeometry(o.scale*0.9,o.scale*0.28,14,32); break; // SAMAY: breathing ring (torus) case 'senses': geo=new THREE.DodecahedronGeometry(o.scale,1); break; // RIKUY: multi-facet eye / receiver // v5 (evolves v4) organs case 'conscience': geo=new THREE.IcosahedronGeometry(o.scale,1); break; // WILLAY: faceted conscience / immune-gate node case 'mesh': geo=new THREE.OctahedronGeometry(o.scale,2); break; // SOVEREIGN MESH: routed mesh node default: geo=new THREE.SphereGeometry(o.scale,18,16); } const mesh=new THREE.Mesh(geo,glowMat(sysColor,0.92)); grp.add(mesh); grp.userData.coreMat=mesh.material; // volumetric glow sprite (pseudo-bloom) const gl=glowSprite(sysColor,o.scale*4.6,0.32); grp.add(gl); grp.userData.glow=gl; // hover/select halo shell const halo=new THREE.Mesh(new THREE.SphereGeometry(o.scale*1.45,18,16), new THREE.MeshBasicMaterial({color:sysColor,transparent:true,opacity:0.0,side:THREE.BackSide,depthWrite:false})); grp.add(halo); grp.userData.halo=halo; } root.add(grp); organMeshes.push({grp,organ:o,bodyKey:o.shared?'shared':body.key,baseScale:grp.scale.x,glowBase:o.beat?0.55:0.32}); }); }); } /* ---------------- VESSELS (circulatory + nervous) ---------------- */ function worldPos(o,side){ const x=(o.shared?0:side*BODY_X)+o.pos[0]; return new THREE.Vector3(x,o.pos[1],o.pos[2]); } function organByKey(k){ return D.ORGANS.find(o=>o.key===k); } function addVessel(from,to,sideA,sideB,colorHex,formulaId,label,fn,arc){ const a=worldPos(from,sideA), b=worldPos(to,sideB); const mid=a.clone().add(b).multiplyScalar(0.5); mid.z += (arc==null?0.6:arc); mid.y += 0.15; const curve=new THREE.QuadraticBezierCurve3(a,mid,b); const pts=curve.getPoints(48); const geo=new THREE.BufferGeometry().setFromPoints(pts); const isShared=label && label.indexOf('SHARED')>=0; const line=new THREE.Line(geo,lineMat(colorHex,isShared?0.55:0.38)); root.add(line); const tube=new THREE.Mesh(new THREE.TubeGeometry(curve,32,0.095,6,false), new THREE.MeshBasicMaterial({visible:false})); root.add(tube); const v={curve,line,tube,formulaId,from:from.quechua,to:to.quechua,label,fn,color:colorHex,shared:isShared}; tube.userData.vessel=v; vessels.push(v); return v; } function buildVessels(){ const aS=-1,kS=1; D.BODIES.forEach(body=>{ const s=body.side; const heart=organByKey('yuyay'); const yawar=organByKey('yawar'), amaru=organByKey('amaru'), sentra=organByKey('sentra'), ruway=organByKey('ruway'), vsp=organByKey('vsp'), huklla=organByKey('huklla'), hatun=organByKey('hatun'), ow=organByKey('overwatch'), tukuy=organByKey('tukuy'), musquy=organByKey('musquy'); addVessel({...amaru,pos:amaru.pos,shared:false,quechua:'YACHAY'},{...heart,shared:true,quechua:'YUYAY'},s,0,'#5ad1ff','P4','efferent nerve','YACHAY proposes \u2192 YUYAY gate (span lineage)',0.5); addVessel({...heart,shared:true,quechua:'YUYAY'},{...yawar,pos:yawar.pos,shared:false,quechua:'YAWAR'},0,s,'#ff3b5c','M2','arterial receipt','\u039b-signed receipt \u2192 append-only bus',0.55); addVessel(ruway,sentra,s,s,'#ff9e6b','P5','egress vessel','RUWAY write \u2192 CHAPAQ egress inspection',0.3); addVessel(sentra,yawar,s,s,'#ff3b5c','M2','write-to-bus','CHAPAQ-cleared write \u2192 YAWAR (tamper-evident)',0.3); addVessel(yawar,amaru,s,s,'#9ef0c0','P1','afferent tether','YAWAR snapshot \u2192 YACHAY (READ-ONLY single tether)',0.45); addVessel(yawar,ow,s,s,'#9ef0c0','B1','proprioceptive nerve','YAWAR \u2192 R0513 read-only 5-invariant audit',0.2); addVessel(vsp,huklla,s,s,'#5ad1ff','S2','reflex arc','HUKLLA deadman \u2192 freeze span \u2192 halt HATUN',0.2); addVessel(huklla,hatun,s,s,'#5ad1ff','S2','halt signal','reflex \u2192 HATUN root span (cancel children)',0.35); addVessel(hatun,tukuy,s,s,'#ffd166','G1','motor nerve','HATUN seal \u2192 TUKUY egress actuator',0.5); addVessel(musquy,heart,s,0,'#7c5cff','Q1','sim vessel','MUSQUY K-candidate sim \u2192 YUYAY gate',0.4); }); const yawarA=organByKey('yawar'), yawarK=organByKey('yawar'); addVessel({...yawarA,quechua:'YAWAR (a11oy)'},{...yawarK,quechua:'YAWAR (killinchu)'},aS,kS,'#ff3b5c','M2','SHARED receipt bus','one circulatory mesh \u2014 signed receipts pulse a11oy \u21c4 killinchu',1.6); const amaruA=organByKey('amaru'); addVessel({...amaruA,quechua:'YACHAY (a11oy)'},{...organByKey('yuyay'),shared:true,quechua:'YUYAY (\u039b heart)'},aS,0,'#5ad1ff','P3','shared nerve','span lineage \u2014 one nervous mesh through the \u039b heart',1.1); addVessel({...organByKey('yuyay'),shared:true,quechua:'YUYAY (\u039b heart)'},{...amaruA,quechua:'YACHAY (killinchu)'},0,kS,'#5ad1ff','P3','shared nerve','span lineage \u2014 \u039b heart \u2192 killinchu cortex',1.1); addVessel({...organByKey('overwatch'),quechua:'R0513 (a11oy)'},{...organByKey('overwatch'),quechua:'R0513 (killinchu)'},aS,kS,'#9ef0c0','B2','consensus mesh','n\u22653f+1 Khipu BFT quorum \u2014 cross-body Semantic Quorum (Wave23 conditional safety)',2.0); // v6 agentic-GPU organ vessels (shared — the 5 agentic organs are body-level infrastructure) const kallpa=organByKey('kallpa'), waqaychaq=organByKey('waqaychaq'), kamay=organByKey('kamay'), samay=organByKey('samay'), rikuy=organByKey('rikuy'); // SENSES (RIKUY) → ENDOCRINE (KAMAY): perceived feed signals modulate the hormone posture if(rikuy&&kamay) addVessel({...rikuy,quechua:'RIKUY'},{...kamay,quechua:'KAMAY'},0,0,'#50e3c2','AG_POSTURE','sense→hormone','RIKUY feed signals \u2192 KAMAY posture hormone',0.4); // ENDOCRINE (KAMAY) → RESPIRATORY (SAMAY): hormone gates the soak breath if(kamay&&samay) addVessel({...kamay,quechua:'KAMAY'},{...samay,quechua:'SAMAY'},0,0,'#bd10e0','AG_POSTURE','hormone→breath','KAMAY posture \u2192 SAMAY inhale/exhale gate',0.3); // RESPIRATORY (SAMAY) → METABOLISM (KALLPA): breath window opens the harvest if(samay&&kallpa) addVessel({...samay,quechua:'SAMAY'},{...kallpa,quechua:'KALLPA'},0,0,'#4a90e2','AG_HARVEST','breath→harvest','SAMAY inhale window \u2192 KALLPA batch harvest',0.35); // METABOLISM (KALLPA) → YAWAR (receipt bus): harvested work receipted on the append-only bus if(kallpa&&yawarA) addVessel({...kallpa,quechua:'KALLPA'},{...yawarA,quechua:'YAWAR'},0,aS,'#f5a623','F19','harvest receipt','KALLPA harvest work \u2192 YAWAR append-only receipt',0.45); // IMMUNE (WAQAYCHAQ) → CHAPAQ egress (sentra): immune layer fronts the egress inspector const sentraA=organByKey('sentra'); if(waqaychaq&&sentraA) addVessel({...waqaychaq,quechua:'WAQAYCHAQ'},{...sentraA,quechua:'CHAPAQ'},0,aS,'#7ed321','AG_EGRESS','immune→egress','WAQAYCHAQ deny-by-default \u2192 CHAPAQ egress (EXPERIMENTAL)',0.4); } /* ---------------- PULSES (receipt-flow along vessels) ------------- */ function buildPulses(){ vessels.forEach((v,i)=>{ const n = v.shared ? 4 : (Math.random()<0.5?2:1); for(let j=0;j
\u039b = Conjecture 1. Unconditional uniqueness under original A1\u2013A5 is machine-checked FALSE; uniqueness holds only within strengthened classes.
`+ `
CUT-2 (Wave12) + CUT-1 forward fragment (Wave18). lambda_unique_of_separable \u2014 \u039b uniqueness PROVEN conditional on slice-multiplicativity, axiom-free & kernel-clean. CUT-1 forward fragment adds 19 axiom-clean theorems but stays CONDITIONAL (open gap dyadic_image_dense, multi-week roadmap). Unconditional stays Conjecture 1. conditional \u00b7 axiom-free
`+ `
Khipu BFT safety = Conjecture 2. Wave23 khipu_quorum_safety_conditional (node B2) proves agreement / no-split-brain conditional on n\u22653f+1 + honest non-equivocation, axiom-clean. Unconditional BFT safety stays Conjecture 2 at the sharp boundary. conditional \u00b7 axiom-clean
`+ `
8 LOCKED-proven {F1,F4,F7,F11,F12,F18,F19,F22} @ ${K.locked_sha} \u2014 never inflated. kernel-verified
`+ `
EXPERIMENTAL tier CI-green on main @ ${K.main_sha} (${K.experimental_decls} decls / ${K.experimental_axioms} axioms / ${K.experimental_sorries} sorries; \u2248${K.experimental_count_approx} instilled cards, ${K.waves_merged}). Additive \u2014 never folded into the locked 8. CI-green
`+ `
SLSA L1 honest \u00b7 product images L2 build-attested \u00b7 L3 roadmap. No fabricated metrics \u00b7 no AGI \u00b7 trust never 100%.
`+ `
Governed Post-Determinism (GPD). SZL\u2019s own lens \u2014 the 5 organs are the participant-general model. SZL framework \u00b7 tap to expand
`; $('gpd-row').addEventListener('click',openGPD); $('sys-list').innerHTML = D.SYSTEMS.map(s=> `
`+ `${s.name} \u00b7 ${s.organ}`+ `${s.fn}
`).join(''); $('sys-list').querySelectorAll('.sys-row').forEach(r=>{ r.addEventListener('mouseenter',()=>highlightSystem(r.dataset.sys,true)); r.addEventListener('mouseleave',()=>highlightSystem(r.dataset.sys,false)); }); } function highlightSystem(sys,on){ organMeshes.forEach(om=>{ if(om.organ.system===sys && om.grp.userData.halo){ om.grp.userData.halo.material.opacity = on?0.30:0.0; if(om.grp.userData.glow) om.grp.userData.glow.material.opacity = on?0.55:om.glowBase; } }); } /* ---------------- GPD lens (honest, SZL-only prior art) ----------- */ function openGPD(){ const sys={name:'GOVERNED POST-DETERMINISM'}; $('p-sys').textContent='SZL framework \u00b7 lens'; $('p-quechua').textContent='GPD'; $('p-fn').textContent='the 5 organs ARE the participant-general governed-AI model'; const dois=[ ['The Loop Is the Product v1','10.5281/zenodo.19867281'], ['The Loop Is the Product v2','10.5281/zenodo.19934129'], ['Lineage-Aware RAG v5','10.5281/zenodo.20020846'], ['Sealed Constitutional Guardrails v6','10.5281/zenodo.20020845'], ['Lutar Omega Formalism v4','10.5281/zenodo.20020841'], ['SZL Doctrine v2 \u2014 9 Canonical Axes','10.5281/zenodo.20174600'] ]; let html=`
${'Governed Post-Determinism is SZL\u2019s own framework for governed-AI substrates. The unit of agreement shifts from identical output to certified semantic admissibility. The five organs are the participant-general model.'}
`; html+=`
`+ `
BRAIN \u00b7 YACHAYreasons \u2014 divergent reasoning paths are OK
`+ `
HEART \u00b7 YUYAY13-axis gate certifies semantic admissibility (deny-by-default)
`+ `
SKELETON \u00b7 Khipu BFTSemantic Quorum Assurance \u2014 Wave23 conditional safety; unconditional = Conjecture 2
`+ `
CIRCULATORY \u00b7 YAWAREpistemic State Replication + Verifiable Semantic Rollback (receipts/replay live; full ESR = roadmap)
`+ `
NERVOUS \u00b7 OTelspan lineage carries provenance across the substrate
`+ `
`; html+=`
honest scope

Locked-proven stays exactly 8. \u039b = Conjecture 1. Khipu BFT safety = Conjecture 2 (Wave23 conditional only). Grounded entirely in SZL\u2019s own DOI-stamped prior art \u2014 no external paper is cited as the source of GPD.

`; html+=`
SZL prior art (Zenodo, DOI-stamped)
`+ dois.map(([t,d])=>`${t} ${d}`).join('')+`
`; $('p-body').innerHTML=html; panel.classList.add('open'); panel.setAttribute('aria-hidden','false'); } /* ---------------- ORGAN PANEL ---------------- */ function fchip(mat){const m=D.MATURITY[mat];return `${m.label}`;} function formulaCard(fid){ const f=D.FORMULAS[fid]; if(!f) return ''; const m=D.MATURITY[f.maturity]; return `
${f.id}${fchip(f.maturity)}
${f.name}
${mathToUnicode(f.latex)}
${f.plain}
#print axioms: ${f.axioms}
${f.ref}
`; } function openOrgan(o){ const sys=D.SYSTEMS.find(s=>s.key===o.system)||{name:o.system}; $('p-sys').textContent = sys.name + ' \u00b7 system'; $('p-quechua').textContent = o.quechua; $('p-fn').textContent = o.fn; let html = `
${o.blurb}
`; if(o.axes){ html += `
13 axes (conjunctive floors):
${o.axes}
`; } if(o.lambda_note){ html += `
\u039b honesty label

\u039b is Conjecture 1, not a theorem. Unconditional uniqueness under the original A1\u2013A5 axioms is machine-checked FALSE (in-tree counterexample Round13.maxAgg_ne_Lambda satisfies A1\u2013A5 yet is not \u039b). The beating heart aggregates trust by geometric mean across the 13 axes \u2014 conjunctive, never a weighted average. Trust is never 100%.

CUT-2 (axiom-free, kernel-clean). lambda_unique_of_separable \u2014 if \u03a6 is separable (slice-multiplicative) and per-axis monotone under A1,A2,A3,A5 then \u03a6 = \u039b. No new axiom. This gets \u039b off bare conjecture (conditionally); the UNCONDITIONAL claim stays Conjecture 1.

`; } // v6 agentic-GPU honesty notes if(o.energy_note){ html += `
energy honesty

Joules shown are SAMPLE values \u2014 on-box NVML is not yet wired to this anatomy viewer. Real-time energy measurement is a platform roadmap item. The Landauer floor (k\u2082T\u00b7ln\u202f2 per bit, EXPERIMENTAL) is the theoretical minimum; actual GPU energy is orders of magnitude higher. F19 Bekenstein additive scaffolding (LOCKED) is the monotone entropy-budget envelope \u2014 NOT the full Bekenstein bound S \u2264 2\u03c0kRE/(\u0127c). Sovereign harvest only on own metal; resource-map tier for flare/space (identifying stranded-gas locations, no physical capture from orbit).

`; } if(o.samay_note){ html += `
soak-loop honesty

The INHALE/EXHALE animation is a visual metaphor for the harvest soak cycle \u2014 not a measured joule readout. The Ouroboros loop-depth cap (AG-OUROBOROS, EXPERIMENTAL) is an engineering depth limit, not a proved convergence theorem. F19 Bekenstein additive scaffolding (LOCKED) provides the conceptual entropy-budget envelope; the actual budget signal comes from the harvest endpoint (AG-HARVEST, EXPERIMENTAL).

`; } html += `
Formulas instilled in this organ
`; (o.formulas||[]).forEach(fid=>{ html += formulaCard(fid); }); $('p-body').innerHTML = html; $('p-body').scrollTop=0; panel.classList.add('open'); panel.setAttribute('aria-hidden','false'); // focus camera on the organ (smooth) const om=organMeshes.find(m=>m.organ===o); const side = o.shared?0:(om&&om.bodyKey==='killinchu'?1:-1); const wp = worldPos(o, side); flyTo(new THREE.Vector3(wp.x,wp.y,wp.z), o.shared?9.5:8.2); // pulse the selected organ glow organMeshes.forEach(m=>{ if(m.grp.userData.glow) m.grp.userData.glow.material.opacity=m.glowBase; }); if(om&&om.grp.userData.glow) om.grp.userData.glow.material.opacity=0.7; selectedOM = om || null; if(V4 && V4.applyFocus) V4.applyFocus(); // v4 focus-mode hook (no-op until v4 inits) if(V5 && V5.onOrganOpen) V5.onOrganOpen(o); // v5 deepen hook: per-formula Lean drill-down + organ↔formula highlight if(V7 && V7.onOrganOpen) V7.onOrganOpen(o); // v5 quantum-bio hook: per-organ coherence/charge/Λ-v5 mini-panel + decay sparkline if(V8 && V8.onOrganOpen) V8.onOrganOpen(o); // v8 live agentic lens: per-organ READ-ONLY reflection of a11oy's live endpoints try{ window.dispatchEvent(new CustomEvent('szl:organ-open',{detail:o})); }catch(_){} // v5 (evolves v4): external hook — in-scene buyer-verifiable receipt verify + assurance overlay } function closePanel(){ panel.classList.remove('open'); panel.setAttribute('aria-hidden','true'); organMeshes.forEach(m=>{ if(m.grp.userData.glow) m.grp.userData.glow.material.opacity=m.glowBase; }); selectedOM = null; if(V4 && V4.applyFocus) V4.applyFocus(); } $('panel-close').addEventListener('click',closePanel); /* ---------------- camera tween ---------------- */ let tween=null; let selectedOM=null; // v4: currently-open organ (for focus mode) let V4=null; // v4: dissection module handle (set after init) let V5=null; // v5: deepen module handle (atlas, forecast, tour, labels, drill-down) let V6=null; // v6: yarqa flow-compartments layer (engineering method / CFD, NOT a locked theorem) let V7=null; // v5 quantum-bio layer (coherence + bioenergetic + Λ-v5 gate + compass; verified model, mirrors a11oy /qbio) let V8=null; // v8 live agentic lens (read-only reflection of a11oy's real agent loop / gates / verified math) let V9=null; // v9 fly-high: live receipt bloodstream + heartbeat loop + killinchu body + cinematic vital tour + agent trace + polish let V10=null; // v10 estate/ayllu: zoom-OUT to the whole SZL estate — live Ayllu council (roster) + declared hardware/stack shell + zoom presets function flyTo(targetVec, radius){ tween={fromT:cam.target.clone(),toT:targetVec.clone(),fromR:cam.r,toR:radius==null?cam.r:radius,t:0,dur:0.9}; } /* ---------------- INTERACTION: orbit / zoom / pick ---------------- */ function applyCam(){ const {r,phi,theta,target}=cam; camera.position.set( target.x + r*Math.sin(phi)*Math.sin(theta), target.y + r*Math.cos(phi), target.z + r*Math.sin(phi)*Math.cos(theta) ); camera.lookAt(target); } let dragging=false,lastX=0,lastY=0,moved=0; // v4: respect prefers-reduced-motion — disable auto-orbit + intro easing by default const REDUCED_MOTION = !!(window.matchMedia && window.matchMedia('(prefers-reduced-motion: reduce)').matches); let autoRotate=!REDUCED_MOTION, pulsesOn=true; if(REDUCED_MOTION){ intro.active=false; cam.r=HOME.r; cam.phi=HOME.phi; cam.theta=HOME.theta; } canvas.addEventListener('pointerdown',e=>{dragging=true;intro.active=false;lastX=e.clientX;lastY=e.clientY;moved=0;try{canvas.setPointerCapture(e.pointerId);}catch(_){}}); canvas.addEventListener('pointermove',e=>{ if(dragging){ const dx=e.clientX-lastX,dy=e.clientY-lastY; lastX=e.clientX;lastY=e.clientY; moved+=Math.abs(dx)+Math.abs(dy); cam.theta -= dx*0.005; cam.phi=clamp(cam.phi - dy*0.005,0.25,2.75); tween=null; } else { hoverVessel(e); } }); window.addEventListener('pointerup',e=>{ if(dragging && moved<6){ pickOrgan(e); } dragging=false; }); canvas.addEventListener('wheel',e=>{e.preventDefault();intro.active=false;tween=null;cam.r=clamp(cam.r+e.deltaY*0.012,5,32);},{passive:false}); const ray=new THREE.Raycaster(), ndc=new THREE.Vector2(); function setNDC(e){ndc.x=(e.clientX/innerWidth)*2-1;ndc.y=-(e.clientY/innerHeight)*2+1;ray.setFromCamera(ndc,camera);} function pickOrgan(e){ setNDC(e); const meshes=[]; organMeshes.forEach(om=>om.grp.traverse(c=>{if(c.isMesh){c.userData._om=om;meshes.push(c);}})); const hit=ray.intersectObjects(meshes,false)[0]; if(hit){ openOrgan(hit.object.userData._om.organ); } } let hoverOM=null; function hoverVessel(e){ setNDC(e); // organ hover halo const oMeshes=[]; organMeshes.forEach(om=>om.grp.traverse(c=>{if(c.isMesh){c.userData._om=om;oMeshes.push(c);}})); const oHit=ray.intersectObjects(oMeshes,false)[0]; const newOM=oHit?oHit.object.userData._om:null; if(newOM!==hoverOM){ if(hoverOM&&hoverOM.grp.userData.halo) hoverOM.grp.userData.halo.material.opacity=0.0; if(hoverOM&&hoverOM.grp.userData.glow&&!panel.classList.contains('open')) hoverOM.grp.userData.glow.material.opacity=hoverOM.glowBase; hoverOM=newOM; if(hoverOM&&hoverOM.grp.userData.halo) hoverOM.grp.userData.halo.material.opacity=0.30; if(hoverOM&&hoverOM.grp.userData.glow) hoverOM.grp.userData.glow.material.opacity=0.6; } if(newOM){ canvas.style.cursor='pointer'; tip.classList.remove('show'); return; } const tubes=vessels.map(v=>v.tube); const hit=ray.intersectObjects(tubes,false)[0]; if(hit){ const v=hit.object.userData.vessel; const f=D.FORMULAS[v.formulaId]; $('tip-t').textContent = v.label + ' \u00b7 ' + v.from + ' \u2192 ' + v.to; $('tip-f').textContent = v.fn; $('tip-m').textContent = f ? (f.id+' \u00b7 '+mathToUnicode(f.latex)) : ''; tip.style.left=Math.min(e.clientX+14,innerWidth-300)+'px'; tip.style.top=(e.clientY+14)+'px'; tip.classList.add('show'); canvas.style.cursor='help'; } else { tip.classList.remove('show'); canvas.style.cursor='grab'; } } /* ---------------- buttons ---------------- */ $('btn-rotate').addEventListener('click',function(){autoRotate=!autoRotate;this.classList.toggle('active',autoRotate);}); $('btn-pulse').addEventListener('click',function(){pulsesOn=!pulsesOn;this.classList.toggle('active',pulsesOn); pulses.forEach(p=>p.grp.visible=pulsesOn);}); $('btn-reset').addEventListener('click',()=>{intro.active=false;tween=null;cam.r=HOME.r;cam.phi=HOME.phi;cam.theta=HOME.theta;cam.target.copy(HOME.target);closePanel();}); $('btn-mesh').addEventListener('click',function(){ intro.active=false; tween=null; cam.target.set(0,0.0,1.0); cam.r=11; cam.phi=1.45; cam.theta=0.0; this.classList.add('active'); setTimeout(()=>this.classList.remove('active'),600); }); var _gpd=$('btn-gpd'); if(_gpd) _gpd.addEventListener('click',function(){ openGPD(); }); /* ---------------- resize ---------------- */ let resizeRAF=0; addEventListener('resize',()=>{ cancelAnimationFrame(resizeRAF); resizeRAF=requestAnimationFrame(()=>{ camera.aspect=innerWidth/innerHeight;camera.updateProjectionMatrix(); renderer.setPixelRatio(Math.min(devicePixelRatio||1,2)); renderer.setSize(innerWidth,innerHeight); }); }); /* ---------------- build everything ---------------- */ D.BODIES.forEach(b=>buildSilhouette(b.side,b.color)); buildOrgans(); buildVessels(); buildPulses(); fillHUD(); /* ---------------- animation loop ---------------- */ const clock=new THREE.Clock(); let beatPhase=0; function loop(){ requestAnimationFrame(loop); const dt=Math.min(clock.getDelta(),0.05), t=clock.elapsedTime; // cinematic intro fly-in if(intro.active){ intro.t=Math.min(intro.t+dt/intro.dur,1); const e=easeInOutCubic(intro.t); cam.r=lerp(intro.from.r,HOME.r,e); cam.phi=lerp(intro.from.phi,HOME.phi,e); cam.theta=lerp(intro.from.theta,HOME.theta,e); if(intro.t>=1) intro.active=false; } else if(tween){ tween.t=Math.min(tween.t+dt/tween.dur,1); const e=easeOutCubic(tween.t); cam.target.lerpVectors(tween.fromT,tween.toT,e); cam.r=lerp(tween.fromR,tween.toR,e); if(tween.t>=1) tween=null; } else if(autoRotate && !dragging){ cam.theta += dt*0.10; } applyCam(); // heartbeat: double-thump (lub-dub) beatPhase += dt*1.4; const ph=(beatPhase%1.0); let beat=0; if(ph<0.12) beat=Math.sin(ph/0.12*Math.PI)*1.0; else if(ph>0.18 && ph<0.30) beat=Math.sin((ph-0.18)/0.12*Math.PI)*0.6; const sc=1+beat*0.16; if(heartGroup){ heartGroup.scale.setScalar(sc); if(heartCoreMat) heartCoreMat.emissiveIntensity=1.0+beat*1.0; if(heartHalo) heartHalo.material.opacity=0.10+beat*0.18; if(heartGlow) heartGlow.material.opacity=0.45+beat*0.35; if(heartRing) heartRing.rotation.z += dt*0.4; if(heartGroup.userData.ring2) heartGroup.userData.ring2.rotation.z -= dt*0.3; heartLight.intensity=1.1+beat*1.7; } // organ idle bob + rotate + gentle glow breathing organMeshes.forEach((om,i)=>{ if(!om.organ.beat){ om.grp.rotation.y += dt*0.3; om.grp.rotation.x = Math.sin(t*0.5+i)*0.05; if(om.grp.userData.glow && om!==hoverOM && !panel.classList.contains('open')){ // v6 agentic-GPU: METABOLISM (KALLPA) and RESPIRATORY (SAMAY) pulse at higher // frequency to indicate wasted-energy-active state. This is a VISUAL metaphor // for the harvest/soak cycle — not a real-time NVML readout (joules = SAMPLE). var sys6=om.organ.system; if(sys6==='metabolism'){ // faster inhale/exhale pulse: brighter + faster than idle glow om.grp.userData.glow.material.opacity = om.glowBase*(1.05+0.55*Math.sin(t*2.8+i)); } else if(sys6==='respiratory'){ // breathing ring: slow deep breath (soak inhale/exhale rhythm) om.grp.userData.glow.material.opacity = om.glowBase*(0.80+0.60*Math.abs(Math.sin(t*0.9+i))); } else { om.grp.userData.glow.material.opacity = om.glowBase*(0.85+0.15*Math.sin(t*1.3+i)); } } } }); // receipt-flow pulses travel if(pulsesOn) pulses.forEach(p=>{ p.t=(p.t+dt*p.speed)%1; const pt=p.curve.getPoint(p.t); p.grp.position.copy(pt); const a=0.45+0.55*Math.sin(p.t*Math.PI); p.grp.children[0].material.opacity=a; if(p.glow) p.glow.material.opacity=a*(p.shared?0.7:0.5); }); // v4: per-frame dissection updates (explode easing, clip plane, HUD tick) if(V4 && V4.tick) V4.tick(dt,t); // v5: per-frame deepen updates (label projection, breathing heart idle, tour fly) if(V5 && V5.tick) V5.tick(dt,t,beat); // v6: yarqa flow-compartments layer (additive overlay over the circulatory/YAWAR flow) if(V6 && V6.tick) V6.tick(dt,t); // v5 quantum-bio: coherence-as-opacity over time + Λ-v5 gate cue + attractor basin if(V7 && V7.tick) V7.tick(dt,t); // v9 fly-high: live receipt bloodstream particles + cinematic vital tour camera + heartbeat-loop heart breathing if(V9 && V9.tick) V9.tick(dt,t,beat); // v10 estate/ayllu: rotate the council + estate shells and project their labels if(V10 && V10.tick) V10.tick(dt,t,beat); renderer.render(scene,camera); if(!_loaderHidden){ _loaderHidden=true; var ld=$('loader'); if(ld) ld.classList.add('hidden'); } } var _loaderHidden=false; applyCam(); loop(); setTimeout(()=>{ var ld=$('loader'); if(ld) ld.classList.add('hidden'); },1500); /* ===================================================================== ============================ v4 =================================== DISSECTION UPGRADE — additive module. Reuses the v3 scene, materials, organMeshes/vessels registries, the SAME render loop (via V4.tick), openOrgan/flyTo, and reads honest posture from D.KERNEL. Nothing in v3 above is replaced. ===================================================================== */ V4 = (function(){ const LS = 'szl-anatomy-v4'; // Preview-safe persistence: use Web Storage when available, else an in-memory // shim (some sandboxed iframes block the storage APIs). Persistence is a // progressive enhancement — the viewer works identically without it. var _mem = {}; var _memStore = { getItem:function(k){return (k in _mem)?_mem[k]:null;}, setItem:function(k,v){_mem[k]=String(v);}, removeItem:function(k){delete _mem[k];} }; var _store = (function(){ try { var api = window['local'+'Storage']; if(!api) return _memStore; var k='__szl_probe__'; api.setItem(k,'1'); api.removeItem(k); return api; } catch(_){ return _memStore; } })(); function loadState(){ try{ return JSON.parse(_store.getItem(LS)||'{}')||{}; }catch(_){ return {}; } } function saveState(){ try{ _store.setItem(LS, JSON.stringify(state)); }catch(_){} } /* ---- capture each organ group's base position (for explode) ---- */ organMeshes.forEach(om=>{ om.basePos = om.grp.position.clone(); }); // body center for radial explode (mean of organ base positions) const center = (function(){ const c=new THREE.Vector3(); organMeshes.forEach(om=>c.add(om.basePos)); if(organMeshes.length)c.multiplyScalar(1/organMeshes.length); return c; })(); /* ---- conceptual dissection LAYERS (additive, honest mapping) ---- */ const LAYERS = [ { key:'circulatory', name:'Circulatory', sw:'#ff3b5c', hint:'YAWAR receipt bus' }, { key:'nervous', name:'Nervous', sw:'#5ad1ff', hint:'span lineage' }, { key:'organs', name:'Organs', sw:'#7c5cff', hint:'all organ cores' }, { key:'skeleton', name:'Skeleton', sw:'#ffd166', hint:'bones / Khipu' }, { key:'halo', name:'Halos / glow',sw:'#9ef0c0', hint:'volumetric bloom' } ]; const state = Object.assign({ layers:{}, focus:false, dock:true }, loadState()); LAYERS.forEach(L=>{ if(!state.layers[L.key]) state.layers[L.key]={on:true,op:1}; }); function organLayer(om){ const sys = om.organ.system; if(sys==='blood') return 'circulatory'; if(sys==='nerve') return 'nervous'; if(sys==='skeleton'||sys==='audit') return 'skeleton'; return 'organs'; // heart, brain } // record base opacities once so toggling is reversible & honest organMeshes.forEach(om=>{ const mats=[]; om.grp.traverse(c=>{ if((c.isMesh||c.isSprite) && c.material){ mats.push({m:c.material, base:c.material.opacity, isHalo:(c===om.grp.userData.halo), isGlow:(c===om.grp.userData.glow)}); } }); om.v4mats = mats; om.v4layer = organLayer(om); }); vessels.forEach(v=>{ v.v4line = { m:v.line.material, base:v.line.material.opacity }; v.v4layer = (v.color==='#ff3b5c') ? 'circulatory' : 'nervous'; }); const silMats = silhouetteMeshes.map(c=>({ m:c.material, base:c.material.opacity })); silhouetteMeshes.forEach((c,i)=>{ const col = c.material.color ? c.material.color.getHexString() : ''; silMats[i].layer = (/^(ffd166|e8c068|a07c20)/.test(col)) ? 'skeleton' : 'organs'; }); function layerMul(key){ const s=state.layers[key]; return (s&&s.on) ? s.op : 0; } function applyLayers(){ const hm = layerMul('halo'); organMeshes.forEach(om=>{ const lm = layerMul(om.v4layer); om.v4mats.forEach(rec=>{ if(rec.isHalo){ rec.m.opacity = rec.base * hm; } else if(rec.isGlow){ rec.m.opacity = rec.base * hm; } else { rec.m.opacity = rec.base * lm; } rec.m.visible = (rec.m.opacity>0.001); }); }); vessels.forEach(v=>{ const mul=layerMul(v.v4layer); v.v4line.m.opacity=v.v4line.base*mul; v.v4line.m.visible=mul>0.001; }); pulses.forEach(p=>{ const lay=(p.color==='#ff3b5c')?'circulatory':'nervous'; p.grp.visible = pulsesOn && layerMul(lay)>0.001; }); silhouetteMeshes.forEach((c,i)=>{ const mul=layerMul(silMats[i].layer); c.material.opacity=silMats[i].base*mul; c.visible=mul>0.001; }); } /* ---- FOCUS MODE: fade non-selected organs when one is open ---- */ function applyFocus(){ const on = state.focus && selectedOM; const hm = layerMul('halo'); organMeshes.forEach(om=>{ const dim = on && om!==selectedOM; const lm=layerMul(om.v4layer); om.v4mats.forEach(rec=>{ if(rec.isHalo) return; let baseOp = rec.isGlow ? rec.base*hm : rec.base*lm; rec.m.opacity = dim ? baseOp*0.12 : baseOp; rec.m.visible = rec.m.opacity>0.001; }); }); } /* ---- CLIP-PLANE SCALPEL ---- */ renderer.localClippingEnabled = true; const clip = { on:false, axis:'x', dist:0, plane:new THREE.Plane(new THREE.Vector3(-1,0,0), 0) }; function axisNormal(a){ return a==='x'?new THREE.Vector3(-1,0,0):a==='y'?new THREE.Vector3(0,-1,0):new THREE.Vector3(0,0,-1); } const clipMats = []; organMeshes.forEach(om=> om.grp.traverse(c=>{ if(c.isMesh && c.material) clipMats.push(c.material); })); silhouetteMeshes.forEach(c=>{ if(c.material) clipMats.push(c.material); }); function applyClip(){ clip.plane.normal.copy(axisNormal(clip.axis)); clip.plane.constant = clip.dist; const planes = clip.on ? [clip.plane] : []; clipMats.forEach(m=>{ m.clippingPlanes = planes; }); } /* ---- EXPLODE VIEW (eased radial separation) ---- */ let explodeTarget=0, explodeCur=0; function applyExplode(amount){ organMeshes.forEach(om=>{ if(om.organ.beat) return; // keep the Λ heart anchored at center const dir = om.basePos.clone().sub(center); if(dir.lengthSq()<1e-6) dir.set(0,1,0); dir.normalize(); const push = amount * 3.4; om.grp.position.copy(om.basePos).addScaledVector(dir, push); }); } /* ===================== UI WIRING ===================== */ const el = id=>document.getElementById(id); const dock=el('dissect'), dzHead=el('dz-head'), btnDissect=el('btn-dissect'); function setDock(open){ state.dock=open; saveState(); dock.classList.toggle('collapsed', !open); dzHead.setAttribute('aria-expanded', String(open)); if(btnDissect){ btnDissect.classList.toggle('active', open); btnDissect.setAttribute('aria-expanded', String(open)); } } dzHead.addEventListener('click', ()=>setDock(dock.classList.contains('collapsed'))); dzHead.addEventListener('keydown', e=>{ if(e.key==='Enter'||e.key===' '){ e.preventDefault(); setDock(dock.classList.contains('collapsed')); } }); if(btnDissect) btnDissect.addEventListener('click', ()=>setDock(dock.classList.contains('collapsed'))); setDock(state.dock!==false); /* ---- mobile bottom-sheet: FAB opens/closes the dock as a sheet ---- */ const fab = el('dissect-fab'); function setSheet(open){ dock.classList.toggle('sheet-open', open); if(fab){ fab.setAttribute('aria-expanded', String(open)); fab.setAttribute('aria-label', open?'Close dissection tools':'Open dissection tools'); } // when opening the sheet, make sure the dock body is expanded (not collapsed) if(open && dock.classList.contains('collapsed')) setDock(true); } if(fab){ fab.addEventListener('click', ()=> setSheet(!dock.classList.contains('sheet-open')) ); } // Esc closes the sheet on mobile window.addEventListener('keydown', e=>{ if(e.key==='Escape' && dock.classList.contains('sheet-open')) setSheet(false); }); const layWrap=el('dz-layers'); LAYERS.forEach(L=>{ const s=state.layers[L.key]; const row=document.createElement('div'); row.className='dz-layer'; row.innerHTML = ``+ `${L.name}`+ ``; layWrap.appendChild(row); const tog=row.querySelector('.dz-toggle'), rng=row.querySelector('input'); tog.addEventListener('click', ()=>{ s.on=!s.on; tog.setAttribute('aria-pressed',String(s.on)); saveState(); applyLayers(); applyFocus(); }); rng.addEventListener('input', ()=>{ s.op=parseFloat(rng.value); if(!s.on){ s.on=true; tog.setAttribute('aria-pressed','true'); } saveState(); applyLayers(); applyFocus(); }); }); const clipOn=el('dz-clip-on'), clipReset=el('dz-clip-reset'), clipRange=el('dz-clip'), clipVal=el('dz-clip-val'); const axisBtns={x:el('dz-axis-x'),y:el('dz-axis-y'),z:el('dz-axis-z')}; function setAxis(a){ clip.axis=a; Object.keys(axisBtns).forEach(k=>axisBtns[k].setAttribute('aria-pressed',String(k===a))); applyClip(); } Object.keys(axisBtns).forEach(k=>axisBtns[k].addEventListener('click',()=>setAxis(k))); clipOn.addEventListener('click', ()=>{ clip.on=!clip.on; clipOn.setAttribute('aria-pressed',String(clip.on)); clipOn.classList.toggle('active',clip.on); clipOn.textContent=clip.on?'cutting':'enable cut'; applyClip(); }); clipRange.addEventListener('input', ()=>{ clip.dist=parseFloat(clipRange.value); clipVal.textContent=clip.dist.toFixed(1); applyClip(); }); clipReset.addEventListener('click', ()=>{ clip.on=false; clip.dist=0; clipRange.value=0; clipVal.textContent='0.0'; clipOn.setAttribute('aria-pressed','false'); clipOn.classList.remove('active'); clipOn.textContent='enable cut'; setAxis('x'); applyClip(); }); const expRange=el('dz-explode'), expVal=el('dz-explode-val'); expRange.addEventListener('input', ()=>{ explodeTarget=parseFloat(expRange.value); expVal.textContent=Math.round(explodeTarget*100)+'%'; if(REDUCED_MOTION){ explodeCur=explodeTarget; applyExplode(easeInOutCubic(explodeCur)); } }); const btnFocus=el('btn-focus'); if(btnFocus){ btnFocus.setAttribute('aria-pressed', String(!!state.focus)); btnFocus.classList.toggle('active', !!state.focus); btnFocus.addEventListener('click', ()=>{ state.focus=!state.focus; btnFocus.setAttribute('aria-pressed',String(state.focus)); btnFocus.classList.toggle('active',state.focus); saveState(); applyFocus(); }); } const btnRot=el('btn-rotate'); if(btnRot) btnRot.classList.toggle('active', autoRotate); /* ---- SEARCH / JUMP (organs + formulas) ---- */ const q=el('dz-q'), results=el('dz-results'); const index = []; D.ORGANS.forEach(o=>{ index.push({type:'organ', key:o.key, label:o.quechua, sub:(D.SYSTEMS.find(s=>s.key===o.system)||{}).name||o.system, organ:o}); }); Object.keys(D.FORMULAS).forEach(fid=>{ const f=D.FORMULAS[fid]; index.push({type:'formula', key:fid, label:f.id+' · '+f.name, sub:(D.MATURITY[f.maturity]||{}).label||f.maturity, formula:f}); }); let activeIdx=-1, matches=[]; function runSearch(){ const term=q.value.trim().toLowerCase(); results.innerHTML=''; activeIdx=-1; if(!term){ results.classList.remove('show'); q.setAttribute('aria-expanded','false'); return; } matches = index.filter(it=> (it.label+' '+it.key+' '+(it.sub||'')).toLowerCase().includes(term)).slice(0,12); if(!matches.length){ results.innerHTML='
  • no organ or formula matches
  • '; results.classList.add('show'); q.setAttribute('aria-expanded','true'); return; } matches.forEach((it,i)=>{ const li=document.createElement('li'); li.setAttribute('role','option'); li.id='dzr-'+i; li.innerHTML=`${it.type==='organ'?'\u25c9':'\u0192'}${it.label}${it.sub||''}`; li.addEventListener('click',()=>jump(it)); results.appendChild(li); }); results.classList.add('show'); q.setAttribute('aria-expanded','true'); } function highlight(i){ const lis=results.querySelectorAll('li'); lis.forEach(l=>l.setAttribute('aria-selected','false')); if(i>=0 && i(o.formulas||[]).includes(it.key)); if(host){ openOrgan(host); } } results.classList.remove('show'); q.setAttribute('aria-expanded','false'); q.blur(); } q.addEventListener('input', runSearch); q.addEventListener('keydown', e=>{ if(e.key==='ArrowDown'){ e.preventDefault(); if(matches.length){ activeIdx=Math.min(activeIdx+1,matches.length-1); highlight(activeIdx);} } else if(e.key==='ArrowUp'){ e.preventDefault(); activeIdx=Math.max(activeIdx-1,0); highlight(activeIdx); } else if(e.key==='Enter'){ e.preventDefault(); jump(matches[activeIdx>=0?activeIdx:0]); } else if(e.key==='Escape'){ results.classList.remove('show'); q.setAttribute('aria-expanded','false'); } }); document.addEventListener('click', e=>{ if(!results.contains(e.target) && e.target!==q){ results.classList.remove('show'); q.setAttribute('aria-expanded','false'); } }); /* ---- ALWAYS-ON VISIBILITY HUD (honest counts from D.KERNEL) ---- */ const K=D.KERNEL; function expCount(){ return Object.keys(D.FORMULAS).filter(id=>D.FORMULAS[id].maturity==='EXPERIMENTAL').length; } (function fillVisHUD(){ const grid=el('vh-grid'), foot=el('vh-foot'); const stats=[ {k:'locked-proven', v:K.locked_proven.length, cls:'locked'}, {k:'experimental', v:expCount(), cls:'exp'}, {k:'axioms', v:K.locked_axioms, cls:''}, {k:'sorries', v:K.locked_sorries, cls:''}, {k:'\u039b posture', v:'Conjecture 1', cls:'conj'}, {k:'Khipu BFT', v:'Conjecture 2', cls:'conj'} ]; grid.innerHTML = stats.map(s=>`
    ${s.k}${s.v}
    `).join(''); foot.innerHTML = `kernel ${K.locked_sha} \u00b7 locked-set {${K.locked_proven.join(',')}} \u00b7 SLSA L1 honest \u00b7 trust never 100%`; })(); /* ---- per-frame tick (called from the SINGLE v3 render loop) ---- */ let tickAcc=0; function tick(dt,t){ if(!REDUCED_MOTION && Math.abs(explodeCur-explodeTarget)>0.0005){ explodeCur += (explodeTarget-explodeCur) * Math.min(1, dt*6); applyExplode(easeInOutCubic(explodeCur)); } tickAcc+=dt; if(tickAcc>0.08){ tickAcc=0; applyLayers(); applyFocus(); } } applyLayers(); applyClip(); applyFocus(); return { tick, applyFocus, applyLayers, _state:state, LAYERS, setLayer:(key,on,op)=>{ const s=state.layers[key]; if(s){ if(on!=null)s.on=on; if(op!=null)s.op=op; saveState(); applyLayers(); } }, setExplode:(a)=>{ explodeTarget=a; if(REDUCED_MOTION){explodeCur=a;applyExplode(easeInOutCubic(a));} expRange.value=a; expVal.textContent=Math.round(a*100)+'%'; }, setClip:(on,axis,dist)=>{ clip.on=on; if(axis)clip.axis=axis; if(dist!=null)clip.dist=dist; applyClip(); }, setFocus:(on)=>{ state.focus=on; saveState(); applyFocus(); }, search:(term)=>{ q.value=term; runSearch(); return matches.length; }, jumpFirst:()=>{ jump(matches[0]); return panel.classList.contains('open'); }, hud:()=>({ locked:K.locked_proven.length, experimental:expCount(), axioms:K.locked_axioms, sorries:K.locked_sorries, kernel:K.locked_sha }) }; })(); /* ========================== /v4 =================================== */ /* ===================================================================== =========================== v4-DEEPEN (v5) ======================== DEEPENING UPGRADE — additive module. Reuses the v3/v4 scene, camera, organMeshes/vessels registries, the SAME render loop (via V5.tick), openOrgan/flyTo/closePanel, mathToUnicode, and reads EVERYTHING from window.SZL_ANATOMY (D). Nothing in v3/v4 above is replaced. ===================================================================== */ V5 = (function(){ const el = id=>document.getElementById(id); const D = window.SZL_ANATOMY; const M = D.MATURITY, F = D.FORMULAS, K = D.KERNEL; /* ---- tier order + honest descriptions (straight from D.MATURITY) ---- */ const TIER_ORDER = ['LOCKED','CONDITIONAL','AXIOM_GATED','EXPERIMENTAL','CONJECTURE']; function tierColor(t){ return (M[t]||{}).color || '#9aa8cc'; } function tierLabel(t){ return (M[t]||{}).label || t; } function tierDesc(t){ return (M[t]||{}).desc || ''; } // live counts straight from data.js — never hardcoded function countByTier(){ const c={}; TIER_ORDER.forEach(t=>c[t]=0); Object.keys(F).forEach(k=>{ const m=F[k].maturity; c[m]=(c[m]||0)+1; }); return c; } /* ---- honest "view in lutar-lean" link derived from the ref string. We NEVER invent a precise permalink: PR refs -> /pull/N; otherwise we link to a repo code-search for the .lean file / declaration so the reader lands on the real source. lutar-lean is the kernel repo. ---- */ const LEAN_REPO = 'https://github.com/szl-holdings/lutar-lean'; function leanLink(f){ const ref = f.ref || ''; const pr = ref.match(/(?:lutar-lean\s*)?(?:PR\s*)?#(\d+)/); // a *.lean file mentioned in the ref (best-effort, honest) const file = ref.match(/([A-Za-z0-9_\/]+\.lean)/); let href, kind; if(pr && /lutar-lean/i.test(ref)){ href = LEAN_REPO + '/pull/' + pr[1]; kind='PR #'+pr[1]; } else if(file){ href = LEAN_REPO + '/search?q=' + encodeURIComponent(file[1].split('/').pop()) + '&type=code'; kind=file[1].split('/').pop(); } else if(pr){ href = LEAN_REPO + '/pulls?q=' + encodeURIComponent('#'+pr[1]); kind='PR #'+pr[1]; } else { href = LEAN_REPO + '/search?q=' + encodeURIComponent((f.id||'')+' '+f.name) + '&type=code'; kind='lutar-lean'; } return {href, kind}; } /* ---- shared drill-down detail block (axioms + lutar-lean link) ---- Returned as an HTML
    so it is keyboard-accessible & additive to any formula card. Used by both the Atlas and the organ panel. ---- */ function drillHTML(f){ const ll = leanLink(f); return `
    axioms & Lean source`+ `
    `+ `
    #print axioms: ${esc(f.axioms)}
    `+ `
    ref: ${esc(f.ref)}
    `+ `↗ view in lutar-lean · ${esc(ll.kind)}`+ `
    `; } function esc(s){ return String(s==null?'':s).replace(/&/g,'&').replace(//g,'>'); } /* ===================================================================== (B) PER-ORGAN DRILL-DOWN + organ↔formula 3D highlight After openOrgan() renders its v3 formula cards, we enhance each card in place: tag it with its formula id, append the drill-down details, and wire hover so hovering a card lights up the owning organ in 3D (and vice-versa). Purely additive DOM enhancement. ===================== */ function organByFormula(fid){ return D.ORGANS.find(o=>(o.formulas||[]).includes(fid)); } function omByOrgan(o){ return organMeshes.find(m=>m.organ===o); } function litOM(om,on){ if(!om) return; if(om.grp.userData.halo) om.grp.userData.halo.material.opacity = on?0.34:0.0; if(om.grp.userData.glow) om.grp.userData.glow.material.opacity = on?0.7:om.glowBase; } function onOrganOpen(o){ const body = el('p-body'); if(!body) return; const cards = body.querySelectorAll('.formula'); // the v3 cards render in the order of o.formulas — map by index, robust. const ids = (o.formulas||[]); cards.forEach((card,i)=>{ const fid = ids[i]; const f = fid && F[fid]; if(!f) return; card.setAttribute('data-fid', fid); // avoid double-injecting if openOrgan is called twice if(!card.querySelector('.fdrill')){ const tmp=document.createElement('div'); tmp.innerHTML=drillHTML(f); card.appendChild(tmp.firstChild); } const om = omByOrgan(o); // this organ card.onmouseenter = ()=>litOM(om,true); card.onmouseleave = ()=>{ if(!panel.classList.contains('open')||selectedOM!==om) litOM(om,false); else litOM(om,false); }; }); } /* ===================================================================== (A) FORMULA ATLAS — every formula in data.js, tier-grouped ===================================================================== */ const atlas = el('atlas'); let atlasFilter = 'ALL'; let atlasQuery = ''; function atlasFormulaCard(fid){ const f = F[fid]; if(!f) return ''; const col = tierColor(f.maturity); return `
    `+ `
    ${esc(f.id)}`+ `${esc(tierLabel(f.maturity))}
    `+ `
    ${esc(f.name)}
    `+ `
    ${mathToUnicode(f.latex)}
    `+ `
    ${esc(f.plain)}
    `+ drillHTML(f)+ `
    `; } function buildAtlasFilters(){ const wrap = el('atlas-filters'); if(!wrap) return; const counts = countByTier(); const total = Object.keys(F).length; let html = ``; TIER_ORDER.forEach(t=>{ if(!counts[t]) return; // only show tiers that actually exist in data.js html += ``; }); wrap.innerHTML = html; wrap.querySelectorAll('.at-pill').forEach(b=>{ b.addEventListener('click', ()=>{ atlasFilter = b.getAttribute('data-tier'); wrap.querySelectorAll('.at-pill').forEach(x=>x.setAttribute('aria-pressed', String(x===b))); renderAtlas(); }); }); } function renderAtlas(){ const body = el('atlas-body'); if(!body) return; const counts = countByTier(); const total = Object.keys(F).length; const note = el('atlas-note'); if(note) note.innerHTML = `Every formula instilled across the body — ${total} total, read live from data.js. `+ `Locked-proven = exactly ${counts.LOCKED||0} {${K.locked_proven.join(', ')}}. CONJECTURE / EXPERIMENTAL / AXIOM-GATED are NEVER relabeled as LOCKED.`; const q = atlasQuery.trim().toLowerCase(); let html = ''; const tiers = TIER_ORDER.filter(t=> counts[t] && (atlasFilter==='ALL' || atlasFilter===t)); tiers.forEach(t=>{ const ids = Object.keys(F).filter(k=>F[k].maturity===t).filter(k=>{ if(!q) return true; const f=F[k]; return (f.id+' '+f.name+' '+f.plain+' '+f.axioms+' '+f.latex+' '+f.ref).toLowerCase().includes(q); }); if(!ids.length && q) return; // hide empty tiers while searching html += `
    `+ `${t.replace('_',' ')}`+ `${ids.length} / ${counts[t]}`+ `${esc(tierDesc(t))}
    `; if(ids.length){ ids.forEach(id=>{ html += atlasFormulaCard(id); }); } else { html += `
    no match in this tier
    `; } html += `
    `; }); if(!html) html = `
    No formula matches “${esc(atlasQuery)}”.
    `; body.innerHTML = html; // wire card hover -> 3D organ highlight (organ↔formula traceability) body.querySelectorAll('.formula').forEach(card=>{ const fid = card.getAttribute('data-fid'); const o = organByFormula(fid); const om = o && omByOrgan(o); card.onmouseenter = ()=>{ litOM(om,true); card.classList.add('lit'); }; card.onmouseleave = ()=>{ litOM(om,false); card.classList.remove('lit'); }; }); } function openAtlas(){ closeForecast(); buildAtlasFilters(); renderAtlas(); atlas.classList.add('open'); atlas.setAttribute('aria-hidden','false'); const b=el('btn-atlas'); if(b){ b.classList.add('active'); b.setAttribute('aria-expanded','true'); } } function closeAtlas(){ atlas.classList.remove('open'); atlas.setAttribute('aria-hidden','true'); const b=el('btn-atlas'); if(b){ b.classList.remove('active'); b.setAttribute('aria-expanded','false'); } } (function wireAtlas(){ const b=el('btn-atlas'); if(b) b.addEventListener('click', ()=> atlas.classList.contains('open')?closeAtlas():openAtlas()); const c=el('atlas-close'); if(c) c.addEventListener('click', closeAtlas); const q=el('atlas-q'); if(q) q.addEventListener('input', ()=>{ atlasQuery=q.value; renderAtlas(); }); window.addEventListener('keydown', e=>{ if(e.key==='Escape' && atlas.classList.contains('open')) closeAtlas(); }); })(); /* ===================================================================== (D) HONEST FORECAST OVERLAY — proof-maturity transparency timeline Driven ONLY by data.js / KERNEL strings. Achieved facts come from the kernel posture; everything not-yet-done is explicitly ROADMAP/PROJECTED and pulled verbatim from KERNEL / FORMULA strings. No invented metric. ===================================================================== */ // Achieved (DONE) — every value here exists in D.KERNEL / D.MATURITY. function forecastDoneEvents(){ const counts = countByTier(); const ev = []; // The single dated transition we can honestly assert from data.js: // KERNEL.gpd states "locked-proven = exactly 8 ... F4/F7/F22 joined the original 5 on 2026-06-10". ev.push({ when:'pre 2026-06-10', what:`5 LOCKED-proven. Original locked set before the 2026-06-10 upgrade (the 8 minus F4/F7/F22).` , tag:'done'}); ev.push({ when:'2026-06-10', what:`LOCKED 5 → ${K.locked_proven.length}. F4 (Khipu DAG acyclicity), F7 (Chaski FIFO), F22 (Khipu emit monotonicity) upgraded to genuine kernel-verified proofs. Locked set now {${K.locked_proven.join(', ')}} @ ${K.locked_sha}. (Source: KERNEL.gpd / KERNEL.locked_proven.)`, tag:'done'}); ev.push({ when:'waves 5–23', what:`${counts.EXPERIMENTAL||0} EXPERIMENTAL · CI-green cards instilled (${esc(K.waves_merged)}), main @ ${K.main_sha} — additive, NEVER folded into the locked ${K.locked_proven.length}.`, tag:'done'}); ev.push({ when:'Wave12', what:`CUT-2 conditional Λ uniqueness. ${esc(K.cut2)}`, tag:'done'}); ev.push({ when:'Wave23', what:`Khipu BFT conditional safety. ${esc(K.bft_conditional)}`, tag:'done'}); return ev; } // ROADMAP / PROJECTED — pulled ONLY from text that data.js already states // as an open gap / roadmap. Nothing here is claimed as achieved. function forecastRoadmapEvents(){ const rm = []; // CUT-1 open gap (verbatim from FORMULAS.CUT1) if(F.CUT1) rm.push({ when:'ROADMAP', what:`CUT-1 full unconditional Λ. Open gap dyadic_image_dense (dense-domain step, n-adic recursive construction). Multi-week roadmap — Λ unconditional uniqueness stays Conjecture 1. (Source: FORMULAS.CUT1.)`, tag:'proj'}); // Khipu unconditional BFT (Conjecture 2) — from B2 / KERNEL.bft_conditional rm.push({ when:'ROADMAP', what:`Unconditional Khipu BFT safety. Stays Conjecture 2 at the sharp boundary; only the n≥3f+1 + honest-non-equivocation conditional theorem (B2 / Wave23) is proven. (Source: KERNEL.bft_conditional.)`, tag:'proj'}); // Per-formula honest ROADMAP notes mined from FORMULA plain/axioms strings Object.keys(F).forEach(k=>{ const f=F[k]; const blob=(f.plain+' '+f.axioms); if(/ROADMAP/i.test(blob)){ // surface the formula's own roadmap caveat (verbatim-ish, trimmed) rm.push({ when:'ROADMAP', what:`${esc(f.id)} — ${esc(f.name)}. ${roadmapSnippet(f)}`, tag:'proj'}); } }); // SLSA ladder (verbatim from KERNEL.slsa) rm.push({ when:'ROADMAP', what:`SLSA L3. Static space is SLSA L1 honest; product images L2 build-attested; L3 is roadmap. (Source: KERNEL.slsa.)`, tag:'proj'}); return rm; } function roadmapSnippet(f){ // extract the sentence/parenthetical that mentions ROADMAP, honestly const txt=f.plain+' '+f.axioms; const m=txt.match(/\(?([^.()]*ROADMAP[^.()]*)\)?/i); let s = m? m[1].trim() : 'roadmap (see lutar-lean)'; return esc(s) + ' — roadmap (see lutar-lean).'; } // sparkline of locked-proven growth (only points we can honestly assert) function forecastSpark(){ const counts = countByTier(); // honest two-point locked trajectory from data.js + the live total today const series = [ { label:'pre 6-10', v:5, proj:false }, { label:'2026-06-10', v:K.locked_proven.length, proj:false } ]; const W=460, H=92, pad=22, maxV=Math.max(8, K.locked_proven.length, 10); const n=series.length; const xOf=i=> pad + (W-2*pad) * (n===1?0.5:(i/(n-1))); const yOf=v=> (H-18) - ((H-30) * (v/maxV)); let path='', dots=''; series.forEach((p,i)=>{ const x=xOf(i), y=yOf(p.v); path += (i===0?'M':'L') + x.toFixed(1) + ' ' + y.toFixed(1) + ' '; dots += ``+ `${p.v}`+ `${p.label}`; }); // a dashed PROJECTED continuation toward the roadmap (clearly not achieved) const lastX=xOf(n-1), lastY=yOf(series[n-1].v); const projX=W-pad, projY=yOf(series[n-1].v); // flat — we do NOT predict a number const projLine = ``+ `ROADMAP (no number claimed)`; return ``+ projLine+ ``+ dots+``; } function renderForecast(){ const body=el('forecast-body'); if(!body) return; const counts=countByTier(); const note=el('forecast-note'); if(note) note.innerHTML = `A transparency forecast of proof maturity, driven only by data.js / KERNEL strings — not a fabricated metric. Achieved facts are marked DONE; everything not-yet-achieved is ROADMAP / PROJECTED. We never predict a future locked count.`; let html=''; html += `
    locked-proven trajectory (kernel-verified)
    ${forecastSpark()}`+ `
    DONE · kernel-verified`+ ` ROADMAP · projected (no number claimed)
    `; // live tier snapshot (counts straight from data.js) html += `
    live tier snapshot (data.js)
    `; TIER_ORDER.filter(t=>counts[t]).forEach(t=>{ html += `
    ${counts[t]}×`+ `${t.replace('_',' ')} — ${esc(tierDesc(t))}
    `; }); html += `
    achieved milestones DONE
    `; forecastDoneEvents().forEach(e=>{ html += `
    ${esc(e.when)}${e.what}
    `; }); html += `
    roadmap / projected NOT YET ACHIEVED
    `; forecastRoadmapEvents().forEach(e=>{ html += `
    ${esc(e.when)}${e.what}
    `; }); html += `
    Honesty. This panel forecasts only maturity transparency, never capability. Λ = Conjecture 1; Khipu BFT = Conjecture 2; SLSA L1 honest. No EXPERIMENTAL / CONDITIONAL / AXIOM-GATED / CONJECTURE item is relabeled LOCKED, and no future proof count is invented. Where a field is missing we surface what exists and label the rest roadmap (see lutar-lean).
    `; body.innerHTML = html; } function openForecast(){ closeAtlas(); renderForecast(); el('forecast').classList.add('open'); el('forecast').setAttribute('aria-hidden','false'); const b=el('btn-forecast'); if(b){ b.classList.add('active'); b.setAttribute('aria-expanded','true'); } } function closeForecast(){ const fc=el('forecast'); if(!fc) return; fc.classList.remove('open'); fc.setAttribute('aria-hidden','true'); const b=el('btn-forecast'); if(b){ b.classList.remove('active'); b.setAttribute('aria-expanded','false'); } } (function wireForecast(){ const b=el('btn-forecast'); if(b) b.addEventListener('click', ()=> el('forecast').classList.contains('open')?closeForecast():openForecast()); const c=el('forecast-close'); if(c) c.addEventListener('click', closeForecast); window.addEventListener('keydown', e=>{ if(e.key==='Escape' && el('forecast').classList.contains('open')) closeForecast(); }); })(); /* ===================================================================== (C) MORE REAL 3D — leader-line organ labels A thin 3D leader line from each organ outward to a tag anchor, plus an HTML label projected to screen each frame. Reuses root + the SAME loop. ===================================================================== */ const labelLayer = el('labels'); const labels = []; // {om, div, anchorWorld, line} let labelsOn = true; function buildLabels(){ organMeshes.forEach(om=>{ const o=om.organ; // leader anchor: push outward along +x of the body and slightly up const side = o.shared?0:(om.bodyKey==='killinchu'?1:-1); const base = om.basePos ? om.basePos.clone() : om.grp.position.clone(); const outX = side===0 ? (o.pos[0]>=0?1:-1) : side; const anchor = base.clone().add(new THREE.Vector3(outX*(0.55+o.scale*0.6), 0.35+o.scale*0.4, 0)); // 3D leader line (additive, faint) const geo=new THREE.BufferGeometry().setFromPoints([base, anchor]); const line=new THREE.Line(geo, new THREE.LineBasicMaterial({color:o.color,transparent:true,opacity:0.34,blending:THREE.AdditiveBlending,depthWrite:false})); root.add(line); // HTML label const div=document.createElement('div'); div.className='olabel'; div.style.color = o.color; div.innerHTML = `${esc(o.quechua)}${esc((D.SYSTEMS.find(s=>s.key===o.system)||{}).name||o.system)}`; div.addEventListener('click', ()=>openOrgan(o)); div.style.pointerEvents='auto'; div.style.cursor='pointer'; labelLayer.appendChild(div); labels.push({om, div, anchor, line}); }); } const _projV = new THREE.Vector3(); function updateLabels(){ if(!labelsOn){ return; } const w=innerWidth, h=innerHeight; labels.forEach(L=>{ _projV.copy(L.anchor).project(camera); const behind = _projV.z>1; let x=( _projV.x*0.5+0.5)*w, y=(-_projV.y*0.5+0.5)*h; if(behind || x<-50 || x>w+50 || y<-50 || y>h+50){ L.div.classList.remove('show'); return; } const lw = L.div.offsetWidth || 120, lh = L.div.offsetHeight || 18, m = 8; // keep labels clear of the fixed side panels on wide screens: the title/ // dissection dock occupy the left gutter and the honesty panel the right. const wide = w > 980; const leftBound = wide ? 320 : m; // clear left dock const rightBound = wide ? (w - 360) : (w - lw - m); // clear right honesty panel // hide labels that would land under a side panel rather than clip them if(wide && (x + lw > w - 360 || x < 320)){ // nudge inward if it still fits the center band, else hide const nudged = Math.max(leftBound, Math.min(x, rightBound - lw)); if(nudged < leftBound || nudged + lw > w - 360){ L.div.classList.remove('show'); return; } x = nudged; } else { x = Math.max(m, Math.min(x, w - lw - m)); } y = Math.max(64, Math.min(y, h - lh - 88)); // clear top eyebrow + bottom controls L.div.style.left=x+'px'; L.div.style.top=y+'px'; L.div.classList.add('show'); }); } function setLabels(on){ labelsOn=on; labelLayer.classList.toggle('off', !on); labels.forEach(L=>{ L.line.material.opacity = on?0.34:0.0; L.line.visible=on; }); const b=el('btn-labels'); if(b){ b.classList.toggle('active',on); b.setAttribute('aria-pressed',String(on)); } if(!on) labels.forEach(L=>L.div.classList.remove('show')); } (function wireLabels(){ const b=el('btn-labels'); if(b) b.addEventListener('click', ()=>setLabels(!labelsOn)); })(); /* ---- breathing Λ-heart idle synced to the receipt pulse ---- Additive secondary modulation on top of the v3 lub-dub: a slow "breath" on the halo + a gentle scale wobble, gated by reduced-motion. ---- */ let breathPhase=0; function breatheHeart(dt, beat){ if(REDUCED_MOTION) return; breathPhase += dt*0.55; // ~5.5s breath cycle const breath = 0.5 + 0.5*Math.sin(breathPhase); // 0..1 if(heartHalo){ heartHalo.material.opacity = clamp(heartHalo.material.opacity + breath*0.04, 0, 0.45); } if(heartGlow){ heartGlow.material.opacity = clamp(heartGlow.material.opacity + breath*0.05, 0, 0.95); } if(heartGroup){ // tiny breath layered onto the v3 beat scale (never overrides it) const s = heartGroup.scale.x * (1 + breath*0.012); heartGroup.scale.setScalar(s); } } /* ===================================================================== (C) GUIDED TOUR — fly organ-to-organ, narrate, auto-advance, pausable ===================================================================== */ // tour route: a sensible anatomical walk through the distinct organs const TOUR = ['yuyay','amaru','yawar','ruway','sentra','huklla','vsp','hatun','overwatch','tukuy','musquy'] .map(k=>D.ORGANS.find(o=>o.key===k)).filter(Boolean); const tourEl=el('tour'); let tour = { on:false, i:0, paused:false, t:0, dwell: (REDUCED_MOTION?7.0:6.0) }; function tourShow(o){ const sys=(D.SYSTEMS.find(s=>s.key===o.system)||{}).name||o.system; el('tr-step').textContent = 'organ'; el('tr-name').textContent = o.quechua; el('tr-prog').textContent = (tour.i+1)+' / '+TOUR.length; const fcount=(o.formulas||[]).length; el('tr-body').innerHTML = `${esc(sys)} · ${esc(o.fn)}. `+ `${esc(o.blurb).slice(0,180)}${o.blurb.length>180?'…':''} `+ `(${fcount} formula${fcount===1?'':'s'} instilled — open to inspect each.)`; el('tr-bar-i').style.width='0%'; } function tourGo(i){ if(!TOUR.length) return; tour.i = (i+TOUR.length)%TOUR.length; tour.t = 0; const o=TOUR[tour.i]; tourShow(o); openOrgan(o); // reuses v3 smooth framing + panel } function startTour(){ if(!TOUR.length) return; tour.on=true; tour.paused=false; autoRotate=false; const rb=el('btn-rotate'); if(rb) rb.classList.remove('active'); tourEl.classList.add('show'); const b=el('btn-tour'); if(b){ b.classList.add('active'); b.setAttribute('aria-pressed','true'); } el('tr-pause').textContent='⏸ pause'; tourGo(0); } function stopTour(){ tour.on=false; tourEl.classList.remove('show'); const b=el('btn-tour'); if(b){ b.classList.remove('active'); b.setAttribute('aria-pressed','false'); } closePanel(); } function togglePause(){ tour.paused=!tour.paused; el('tr-pause').textContent = tour.paused?'▶ resume':'⏸ pause'; } function tourTick(dt){ if(!tour.on || tour.paused) return; tour.t += dt; const frac = clamp(tour.t/tour.dwell,0,1); el('tr-bar-i').style.width = (frac*100).toFixed(0)+'%'; if(tour.t>=tour.dwell){ tourGo(tour.i+1); } } (function wireTour(){ const b=el('btn-tour'); if(b) b.addEventListener('click', ()=> tour.on?stopTour():startTour()); el('tr-next').addEventListener('click', ()=>{ tour.t=0; tourGo(tour.i+1); }); el('tr-prev').addEventListener('click', ()=>{ tour.t=0; tourGo(tour.i-1); }); el('tr-pause').addEventListener('click', togglePause); el('tr-stop').addEventListener('click', stopTour); })(); /* ---- build the 3D extras now that v4 has captured basePos ---- */ buildLabels(); setLabels(true); /* ---- per-frame tick, called from the SINGLE v3 render loop ---- */ function tick(dt,t,beat){ updateLabels(); breatheHeart(dt, beat); tourTick(dt); } return { tick, onOrganOpen, openAtlas, closeAtlas, openForecast, closeForecast, startTour, stopTour, setLabels, atlasCounts: countByTier, _tour: tour, api: { atlasOpen:()=>atlas.classList.contains('open'), forecastOpen:()=>el('forecast').classList.contains('open'), tourOn:()=>tour.on, labels:()=>labels.length, tierCounts:()=>countByTier(), searchAtlas:(term)=>{ atlasQuery=term; if(!atlas.classList.contains('open'))openAtlas(); else renderAtlas(); return el('atlas-body').querySelectorAll('.formula').length; }, filterAtlas:(tier)=>{ atlasFilter=tier; if(!atlas.classList.contains('open'))openAtlas(); else renderAtlas(); return el('atlas-body').querySelectorAll('.formula').length; } } }; })(); /* ========================= /v4-DEEPEN (v5) ======================== */ /* ===================================================================== ==================== v6 · yarqa FLOW COMPARTMENTS ================= ADDITIVE overlay (NEVER replaces v3/v4/v5). Reuses the v3 scene, the `vessels` registry built from data.js (SINGLE source of truth — no new data), THREE r160 (vendored, zero-CDN), and the SAME render loop via V6.tick. Sovereign: no network, no new asset. What it does: it samples the EXISTING circulatory / YAWAR vessel curves into a velocity field (points + flow tangents), then runs a clean-room in-browser port of yarqa.compartmentalize — region-growing of velocity-aligned cells across a flow front — to reduce the circulatory flow to a small set of plug-flow compartments, rendered as a toggleable layer of compartment hulls + centroids over the flow. HONESTY (doctrine v11) — never violated: • yarqa is an ENGINEERING METHOD (CFD), NOT a locked theorem. It is NEVER folded into the locked-proven count (stays exactly 8 {F1,F4,F7,F11,F12,F18,F19,F22} @ D.KERNEL.locked_sha). No proven / kernel-verified badge — the layer is labeled verbatim "yarqa flow compartments — engineering method (CFD)". • It does NOT route the locked-8 governance theorems "through" yarqa, and does NOT re-implement the a11oy↔killinchu connection on yarqa — it is a read-only VISUALIZATION over the existing circulatory flow. • Method clean-room (Jacobs et al. 1991 / reactor-engineering compartmental reduction cited as concept only); no third-party source copied. ===================================================================== */ V6 = (function(){ const CFD_LABEL = 'yarqa flow compartments \u2014 engineering method (CFD)'; const PAL = [0x3fb6d6,0xe8b33f,0x46d39a,0xb06fe0,0xe8615f,0x5f8de8,0xe88f3f,0x6fe0c0,0xd65fb0,0x9ad63f]; // ---- 1. Build the flow field from the EXISTING circulatory vessels ---- // Circulatory = YAWAR receipt bus (vessel color '#ff3b5c'). We sample each // such vessel curve into cells: center = sample point, velocity = local // flow tangent (downstream direction along the bus). data.js is the source. function buildField(){ const centers=[], velocities=[], cellVessel=[]; const circ = vessels.filter(v=> v.color==='#ff3b5c'); const SAMPLES = 7; // per vessel — keep cell count modest for the overlay circ.forEach((v,vi)=>{ for(let s=0;s[]); for(let i=0;i1e-9? v.clone().multiplyScalar(1/l): v.clone(); } function straddles(uSeed, rSeed, rN){ // Single representative point per neighbor (its center): a neighbor is on // the front if the projection sign differs from a tiny upstream probe. const rel = rN.clone().sub(rSeed); const proj = rel.dot(uSeed); // Front straddle test: admit neighbors near/across the front plane. return Math.abs(proj) <= 0.55 || proj>=0; } function compartmentalize(field, alignThreshold){ const {centers,velocities,neighbors,n}=field; const labels = new Array(n).fill(-1); const speed = velocities.map(v=>v.length()); const order = Array.from({length:n},(_,i)=>i).sort((a,b)=>speed[b]-speed[a]); let cur=0; for(const start of order){ if(labels[start]!==-1) continue; const uSeed = velocities[start]; const uSeedU = unit(uSeed); const rSeed = centers[start]; labels[start]=cur; const frontier=[start]; while(frontier.length){ const cell=frontier.shift(); for(const k of neighbors[cell]){ if(labels[k]!==-1) continue; const uk=unit(velocities[k]); if(uSeedU.dot(uk) < alignThreshold) continue; if(!straddles(uSeed,rSeed,centers[k])) continue; labels[k]=cur; frontier.push(k); } } cur++; } return labels; } function summarize(field, labels){ const groups={}; for(let i=0;i{ groups[c].cs.multiplyScalar(1/groups[c].n); groups[c].mv.multiplyScalar(1/groups[c].n); }); return groups; } // ---- 3. Reproducible integrity receipt (mirrors yarqa.provenance) ------ // SHA-256 over canonical (rounded) inputs + params + result. Pure WebCrypto. // Asserts INTEGRITY/REPRODUCIBILITY, NOT correctness, NOT a locked theorem. function canonicalField(field, alignThreshold){ const r=x=>Math.round(x*1e4)/1e4; return JSON.stringify({ schema:'szl.yarqa.receipt/v1-viz', claim_tier:'engineering-method-cfd; integrity-receipt; NOT a locked theorem', params:{align_threshold:alignThreshold}, n:field.n, centers:field.centers.map(p=>[r(p.x),r(p.y),r(p.z)]), velocities:field.velocities.map(p=>[r(p.x),r(p.y),r(p.z)]) }); } async function sha256Hex(str){ try{ const buf=await crypto.subtle.digest('SHA-256', new TextEncoder().encode(str)); return Array.from(new Uint8Array(buf)).map(b=>b.toString(16).padStart(2,'0')).join(''); }catch(e){ // sovereign fallback: small deterministic non-crypto digest (labeled) let h=5381; for(let i=0;i>>0; } return 'fnv-'+h.toString(16); } } // ---- 4. Render group (toggleable, additive) --------------------------- const grp = new THREE.Group(); grp.name='yarqa-flow-compartments'; grp.visible=false; root.add(grp); let field=null, labels=null, groups=null, lastReceipt=null, currentOpacity=1, layerOn=false; function clearGrp(){ for(let i=grp.children.length-1;i>=0;i--){ const c=grp.children[i]; grp.remove(c); if(c.geometry)c.geometry.dispose(); if(c.material)c.material.dispose(); } } function render(){ clearGrp(); if(!field||!labels) return; // cell markers tinted by compartment for(let i=0;i{ const g=groups[c]; const col=PAL[(+c)%PAL.length]; const node=new THREE.Mesh(new THREE.IcosahedronGeometry(0.14,0), new THREE.MeshBasicMaterial({color:col,transparent:true,opacity:0.55*currentOpacity,wireframe:true})); node.position.copy(g.cs); grp.add(node); const dir=unit(g.mv); const len=0.6; const arrowGeo=new THREE.BufferGeometry().setFromPoints([g.cs, g.cs.clone().addScaledVector(dir,len)]); grp.add(new THREE.Line(arrowGeo, new THREE.LineBasicMaterial({color:col,transparent:true,opacity:0.8*currentOpacity}))); }); } async function recompute(alignThreshold){ const aln = (alignThreshold==null)?0.2:alignThreshold; field = buildField(); labels = compartmentalize(field, aln); groups = summarize(field, labels); const canon = canonicalField(field, aln); const resultStr = JSON.stringify(labels); const digest = await sha256Hex(canon + '|' + resultStr); lastReceipt = { schema:'szl.yarqa.receipt/v1-viz', method_tier:'engineering method (CFD)', claim:'integrity/reproducibility, NOT correctness; NOT a locked theorem', yarqa_in_locked_count:false, routes_locked8_through_yarqa:false, align_threshold:aln, n_cells:field.n, n_compartments:Object.keys(groups).length, receipt_digest:digest, source:'circulatory / YAWAR vessels (data.js single source of truth)' }; render(); updatePanel(); return lastReceipt; } // ---- 5. Dock UI: a layer row + honest CFD panel (mobile-safe) ---------- const el = id=>document.getElementById(id); function updatePanel(){ const box=el('yq-receipt'); if(!box||!lastReceipt) return; box.textContent = lastReceipt.n_compartments+' compartments \u00b7 '+lastReceipt.n_cells+' cells \u00b7 align '+lastReceipt.align_threshold.toFixed(2)+ '\nreceipt '+lastReceipt.receipt_digest.slice(0,32)+'\u2026'; } function setLayer(on, op){ if(on!=null){ layerOn=on; grp.visible=on; } if(op!=null){ currentOpacity=op; } grp.visible = layerOn; if(layerOn && (!labels)) { recompute(0.2); } else { render(); } } function buildDockRow(){ const wrap=el('dz-layers'); if(!wrap) return; const sec=document.createElement('div'); sec.className='dz-layer'; sec.id='yq-layer-row'; sec.innerHTML = ''+ 'yarqa flow compartments'+ ''; wrap.appendChild(sec); // honest CFD note + receipt readout + align slider (sits under the row) const note=document.createElement('div'); note.className='dz-sec'; note.id='yq-sec'; note.innerHTML = 'CFD method \u00b7 not a locked theorem'+ '
    '+ 'Plug-flow compartmentalization (yarqa) of the circulatory / YAWAR flow \u2014 an '+ 'engineering method (CFD), not a locked theorem and never counted among the '+ 'locked 8. Read-only viz over the existing flow; data.js is the source.'+ '
    '+ '
    align'+ ''+ '0.20
    '+ '
    layer off \u2014 toggle to compute
    '; // place the note section right after the layer-stack section const stack = wrap.parentNode; // dz-body if(stack && wrap.nextSibling){ stack.insertBefore(note, wrap.nextSibling); } else if(stack){ stack.appendChild(note); } const tog=el('yq-toggle'), op=el('yq-op'), align=el('yq-align'), alignVal=el('yq-align-val'); tog.addEventListener('click', ()=>{ const on=tog.getAttribute('aria-pressed')!=='true'; tog.setAttribute('aria-pressed',String(on)); setLayer(on,null); if(on){ el('yq-receipt').textContent='computing\u2026'; recompute(parseFloat(align.value)); } }); op.addEventListener('input', ()=>{ setLayer(null, parseFloat(op.value)); }); align.addEventListener('input', ()=>{ alignVal.textContent=parseFloat(align.value).toFixed(2); if(layerOn) recompute(parseFloat(align.value)); }); } buildDockRow(); // gentle idle shimmer on the compartment nodes (respects reduced motion) let acc=0; function tick(dt,t){ if(!layerOn || REDUCED_MOTION) return; acc+=dt; if(acc<0.05) return; acc=0; grp.children.forEach(c=>{ if(c.material && c.material.wireframe){ c.material.opacity = (0.4+0.2*Math.sin(t*1.5))*currentOpacity; } }); } return { tick, recompute, setLayer, label: CFD_LABEL, isOn: ()=>layerOn, compartments: ()=> labels? Object.keys(groups).length : 0, cells: ()=> field? field.n : 0, receipt: ()=> lastReceipt, yarqaInLockedCount: ()=> false, routesLocked8ThroughYarqa: ()=> false }; })(); /* ===================== /v6 yarqa flow compartments ================= */ /* ===================================================================== ==================== v5 · QUANTUM-BIO LAYER ======================= ADDITIVE (NEVER replaces v3/v4/v5/v6). Reuses the v3 scene, the organMeshes registry, THREE (vendored, zero-CDN), the SAME render loop via V7.tick, and the per-organ qbio fields computed in data.js by the QBIO verified-model module. Sovereign: no network at runtime. The 4 verified formulas (Lindblad coherence, Mitchell pmf, radical- pair compass, Λ-v5 closure) live in data.js as window.SZL_ANATOMY.QBIO and are labeled "verified model (mirrors a11oy /api/a11oy/v1/qbio)". HONESTY (doctrine v11) — never violated: • Lindblad coherence / Mitchell single-ion pmf / radical-pair compass / Becker-Nernst = VERIFIED physics. • Two-ion K⁺/H⁺ + Λ-v5 closure floor = PROPOSED SZL engineering constructs. Λ-v5 is an ENGINEERING gate, explicitly NOT the formal uniqueness Λ (Conjecture 1, machine-checked FALSE). • Jack Kruse light/water/magnetism framing = NARRATIVE only. • Adds NO locked theorem — locked-proven stays exactly 8. Per-organ pmf INPUTS are a labeled SAMPLE; every shown number is computed. ===================================================================== */ V7 = (function(){ const QB = D.QBIO; if(!QB) return null; const el = id=>document.getElementById(id); const C = QB.CONST; /* ---- status-tag helper (three honest tags everywhere) ---- */ function statTag(s){ const k = (s||'').toUpperCase(); if(k.indexOf('VERIFIED')===0) return 'VERIFIED'; if(k.indexOf('PROPOSED')===0) return 'PROPOSED'; if(k.indexOf('NARRATIVE')===0) return 'NARRATIVE'; return ''+esc(k)+''; } function esc(s){ return String(s==null?'':s).replace(/[&<>"]/g,c=>({'&':'&','<':'<','>':'>','"':'"'}[c])); } /* ---- tiny SVG coherence decay sparkline C(t)=e^(-t/τc) ---- */ function decaySpark(tau_c, C0, w, h, markT){ w=w||300; h=h||58; C0=(C0==null)?1:C0; tau_c=tau_c||C.tau_c; const series = QB.coherenceSeries(tau_c, C0, tau_c*3, 48); const x = i => 4 + (i/(series.length-1))*(w-8); const y = v => (h-6) - v*(h-14); let d=''; series.forEach((p,i)=>{ d += (i?'L':'M')+x(i).toFixed(1)+' '+y(p.C).toFixed(1)+' '; }); // floor line at lam_min/charge-equivalent is organ-specific; here mark τc const txAt = (markT==null)?tau_c:markT; const frac = Math.min(1, txAt/(tau_c*3)); const mx = 4 + frac*(w-8); const cMark = QB.coherenceAt(txAt, tau_c, C0); return ''+ ''+ ''+ ''+ ''+ 'C(t)=e^(-t/τc)'+ 't → 3τc · τc='+tau_c+''+ ''; } /* ---- radical-pair compass dial (angular singlet yield) ---- */ function compassDial(B_uT, sz){ sz=sz||128; const cx=sz/2, cy=sz/2, rad=sz/2-10; const N=48; let pts=''; for(let i=0;i<=N;i++){ const th=(i/N)*Math.PI*2; const phi=QB.radicalPairYield(B_uT, th); // 0..1 // exaggerate visually around the mean so the (tiny, honest) contrast is visible const r = rad*(0.55 + (phi-0.5)*6.0); const rr = Math.max(rad*0.2, Math.min(rad, r)); const px=cx+rr*Math.sin(th), py=cy-rr*Math.cos(th); pts += (i?'L':'M')+px.toFixed(1)+' '+py.toFixed(1)+' '; } const cc = QB.compassContrast(B_uT); // selected execution direction = angle of max yield (field-parallel) const selX=cx, selY=cy-rad; return ''+ ''+ ''+ ''+ ''+ ''+ 'exec dir'+ ''; } /* ==================================================================== (A) THE v5 PANEL — summarizes τc, pmf, compass, Λ-gate, leaders, sources, the 3 Lean theorems, and the honest doctrine line. ==================================================================== */ function buildPanel(){ const body = el('qbio-body'); if(!body) return; el('qbio-note').innerHTML = 'Coherence · bioenergetic charge · Λ-v5 closure floor · radical-pair compass. '+ 'A self-contained verified model (4 closed-form formulas embedded in data.js) that '+ 'mirrors a11oy /api/a11oy/v1/qbio — 0 runtime CDN, 0 network. '+ 'Three honest tags throughout: '+statTag('VERIFIED')+' '+statTag('PROPOSED')+' '+statTag('NARRATIVE')+'.'; const exec = D.ORGANS.filter(o=>o.qbio && o.qbio.execute).length; const cc = QB.compassContrast(50); let h = ''; /* doctrine gate banner */ h += '
    Λ-v5 is an ENGINEERING gate · PROPOSED. It is explicitly '+ 'NOT the formal uniqueness Λ, which stays Conjecture 1 (unconditional uniqueness '+ 'machine-checked FALSE). This layer adds NO locked theorem — locked-proven stays '+ 'exactly 8 {F1,F4,F7,F11,F12,F18,F19,F22}. Jack Kruse framing = '+statTag('NARRATIVE')+' only; the '+ 'load-bearing math is Mitchell / Lane / Wallace / Schulten / Hore '+statTag('VERIFIED')+'. Trust never 100%.
    '; /* 1. Coherence */ h += '
    1 · Coherence layer '+statTag('VERIFIED')+' Lindblad/GKSL
    '+ '
    C(t) = C₀·e^(−t/τc) , τc ≈ '+C.tau_c+'
    '+ decaySpark(C.tau_c, 1.0, 300, 58, C.tau_c)+ '
    C(τc) = e⁻¹'+QB.coherenceAt(C.tau_c).toFixed(4)+'
    '+ '
    Open-quantum-system coherence decays exponentially; steady state dρ/dt=0 is the proof of closure. Each organ sits at its own point on this curve (its coherence drives Λ-v5).
    '; /* 2. Bioenergetic */ h += '
    2 · Bioenergetic layer '+statTag('VERIFIED')+' Mitchell two-ion PROPOSED
    '+ '
    Δp = ΔΨ − (2.3 RT/F)·ΔpH
    '+ '
    single-ion pmf'+C.pmf_single_mV.toFixed(1)+' mV
    '+ '
    two-ion K⁺/H⁺ (w≈0.18) PROPOSED'+C.pmf_two_ion_mV.toFixed(1)+' mV
    '+ '
    Each organ’s charge = Δp/Δp₀ (Δp₀ = '+C.pmf_two_ion_mV.toFixed(1)+' mV). The two-ion correction lifts 119.3 → 121.5 mV.
    '; /* 3. Λ-v5 closure floor */ h += '
    3 · Λ-v5 closure floor PROPOSED gate
    '+ '
    lambdaV5 = coherence · charge ≥ λ_min ('+C.lam_min+') ⇒ EXECUTE, else RECHARGE
    '+ '
    organs above floor (this scene)'+exec+' / '+D.ORGANS.length+'
    '+ '
    tested lifecycle'+esc(C.lifecycle)+'
    '+ '
    A node may execute iff it is coherent AND charged; otherwise it RECHARGES / re-tunes. In 3D, organs below the floor are dimmed/desaturated and organs above glow. EXPLICITLY NOT the formal Λ (Conjecture 1).
    '; /* 4. Compass */ h += '
    4 · Magnetosensitive compass '+statTag('VERIFIED')+' radical pair
    '+ '
    '+compassDial(50,128)+ '
    '+ '
    angular contrast (single-nucleus, closed)'+cc.contrast.toFixed(3)+'
    '+ '
    full density-matrix model'+C.compass_contrast_full.toFixed(3)+'
    '+ '
    A radical-pair compass biases which execution direction a node selects. HONEST: the toy cos(ωt) model FAILS (~0.003); the single-nucleus closed form gives ≈'+C.compass_contrast_closed+'; only the full model reaches ≈'+C.compass_contrast_full+'.
    '+ '
    '; /* Field leaders */ h += '
    Field leaders
    '; D.QBIO_LEADERS.forEach(L=>{ h += '
    '+esc(L.name)+''+ ''+esc(L.work)+''+statTag(L.status)+'
    '; }); /* 3 Lean theorems */ h += '
    Λ-v5 closure · 3 Lean theorems (mirrored)
    '; D.QBIO_THEOREMS.forEach(t=>{ h += '
    '+esc(t.id)+' · '+esc(t.name)+' '+statTag(t.status)+'
    '+ '
    '+esc(t.lean)+'
    '+ '
    '+esc(t.plain)+'
    '; }); /* Sources */ h += '
    Sources · arXiv / DOI / PMC
    '; D.QBIO_SOURCES.forEach(s=>{ h += ''+esc(s.label)+ ''+statTag(s.status)+''; }); h += '
    Embed decision: the 4 formulas are implemented locally in data.js (self-contained, sovereign, 0 runtime CDN) and labeled '+esc(QB.label)+'. The live a11oy endpoint does set access-control-allow-origin for this Space, but the doctrine prefers a no-network, self-contained model so the layer stays honest and offline-robust.
    '; body.innerHTML = h; } /* ==================================================================== (B) PER-ORGAN Λ-v5 mini-panel injected into the organ drill panel. ==================================================================== */ function onOrganOpen(o){ if(!o || !o.qbio) return; const pbody = el('p-body'); if(!pbody) return; if(pbody.querySelector('.qb-organ')) return; // avoid double-inject const q = o.qbio; const v = document.createElement('div'); v.className='qb-organ'; const verdictCls = q.execute ? 'exec' : 'recharge'; v.innerHTML = '
    ⌬ Quantum-Bio (v5) VERIFIED math SAMPLE inputs
    '+ decaySpark(q.tau_c, 1.0, 280, 52, q.age_units)+ '
    '+ 'coherence C'+q.coherence.toFixed(3)+''+ 'charge Δp/Δp₀'+q.charge.toFixed(3)+''+ 'pmf single'+q.pmf_single_mV.toFixed(1)+' mV'+ 'pmf two-ion'+q.pmf_two_ion_mV.toFixed(1)+' mV'+ 'Λ-v5 = C·charge'+q.lambdaV5.toFixed(3)+''+ 'λ_min floor'+q.lam_min.toFixed(2)+''+ '
    '+ '
    '+(q.execute?'✔ ':'⚠ ')+esc(q.verdict)+'
    '+ '
    Λ-v5 is a PROPOSED engineering gate (C·charge ≥ λ_min), NOT the formal uniqueness Λ (Conjecture 1). pmf inputs are a labeled SAMPLE; coherence/charge/Λ-v5 are computed. Mirrors a11oy /qbio.
    '; pbody.appendChild(v); } /* ==================================================================== (C) 3D CUES — coherence-as-opacity over time + Λ-gate glow/dim + a small Λ-gate attractor basin floating near the Λ heart. ==================================================================== */ let layerOn = false; // map organMeshes (built in v3) to their data.js organ qbio state const tracked = organMeshes.map(om=>{ const mats=[]; om.grp.traverse(c=>{ if(c.isMesh && c.material && ('opacity' in c.material)){ mats.push({ m:c.material, baseOp:(c.material.opacity==null?1:c.material.opacity), baseTrans:!!c.material.transparent }); } }); return { om, q:om.organ.qbio, mats, glowBase:om.glowBase }; }); /* attractor basin: a translucent funnel near the Λ heart; nodes above the floor are pulled toward the basin floor (EXECUTE), below stay on the rim (RECHARGE). Purely illustrative of the Λ-v5 gate. */ const basinGrp = new THREE.Group(); basinGrp.name='lambda-v5-attractor-basin'; basinGrp.visible=false; root.add(basinGrp); (function buildBasin(){ const heart = D.ORGANS.find(o=>o.key==='yuyay'); const hp = heart? heart.pos : [0,0.55,0.18]; basinGrp.position.set(0, hp[1]+1.7, hp[2]); // float just above the Λ heart, shared center // funnel (cone) = the basin const cone=new THREE.Mesh(new THREE.ConeGeometry(0.95,1.0,28,1,true), new THREE.MeshBasicMaterial({color:'#9ef0c0',transparent:true,opacity:0.10,side:THREE.DoubleSide,depthWrite:false,wireframe:false})); cone.rotation.x=Math.PI; cone.position.y=0.5; basinGrp.add(cone); const rim=new THREE.Mesh(new THREE.TorusGeometry(0.95,0.012,8,40), new THREE.MeshBasicMaterial({color:'#9ef0c0',transparent:true,opacity:0.5,depthWrite:false})); rim.rotation.x=Math.PI/2; rim.position.y=1.0; basinGrp.add(rim); const floorRing=new THREE.Mesh(new THREE.TorusGeometry(0.12,0.02,8,24), new THREE.MeshBasicMaterial({color:'#9ef0c0',transparent:true,opacity:0.8,depthWrite:false})); floorRing.rotation.x=Math.PI/2; floorRing.position.y=0.02; basinGrp.add(floorRing); basinGrp.userData.rim=rim; // markers for each organ, placed by Λ-v5: above floor → deep in basin tracked.forEach((t,i)=>{ if(!t.q) return; const ang=(i/tracked.length)*Math.PI*2; const depth = Math.min(1, t.q.lambdaV5 / 0.5); // 0..1 (deeper = higher Λ-v5) const rr = 0.92*(1-depth)+0.10*depth; const yy = 0.02 + (1-depth)*0.96; const col = t.q.execute ? 0x9ef0c0 : 0xff7eb6; const m=new THREE.Mesh(new THREE.SphereGeometry(0.05,8,8), new THREE.MeshBasicMaterial({color:col,transparent:true,opacity:0.95})); m.position.set(rr*Math.cos(ang), yy, rr*Math.sin(ang)); basinGrp.add(m); }); })(); function applyCues(on){ tracked.forEach(t=>{ if(!t.q) return; const om=t.om; if(on){ // coherence as opacity; below-floor organs dimmed/desaturated, above glow const opMul = 0.25 + 0.75*t.q.coherence; // coherence drives opacity t.mats.forEach(mm=>{ mm.m.transparent=true; mm.m.opacity = mm.baseOp*opMul; }); if(om.grp.userData.glow){ om.grp.userData.glow.material.opacity = t.q.execute ? Math.max(t.glowBase, 0.7*t.q.coherence) : t.glowBase*0.25; } if(om.grp.userData.coreMat && om.grp.userData.coreMat.emissive){ om.grp.userData.coreMat.emissiveIntensity = t.q.execute ? 0.9 : 0.25; } } else { // restore exactly t.mats.forEach(mm=>{ mm.m.opacity = mm.baseOp; mm.m.transparent = mm.baseTrans; }); if(om.grp.userData.glow) om.grp.userData.glow.material.opacity = t.glowBase; if(om.grp.userData.coreMat && om.grp.userData.coreMat.emissive) om.grp.userData.coreMat.emissiveIntensity = 0.6; } }); } /* coherence-over-TIME: optional animated decay sweep (purely visual) */ let sweep=0, acc=0; function tick(dt,t){ if(!layerOn) return; if(basinGrp.userData.rim && !REDUCED_MOTION) basinGrp.rotation.y += dt*0.25; if(REDUCED_MOTION) return; acc+=dt; if(acc<0.08) return; acc=0; // gentle coherence breathing on above-floor organs (decay re-charge cadence) sweep += 0.08; tracked.forEach((tr,i)=>{ if(!tr.q || !tr.q.execute || !tr.om.grp.userData.glow) return; const breathe = 0.6 + 0.25*Math.sin(sweep + i); tr.om.grp.userData.glow.material.opacity = Math.max(tr.glowBase, breathe*tr.q.coherence); }); } function setLayer(on){ layerOn = !!on; basinGrp.visible = layerOn; applyCues(layerOn); } /* ==================================================================== (D) open/close the panel (mirrors atlas open/close pattern) + the 3D cue layer toggles WITH the panel (open = cues on). ==================================================================== */ const aside = el('qbio'); let built=false; function openPanel(){ if(!aside) return; if(!built){ buildPanel(); built=true; } aside.classList.add('open'); aside.setAttribute('aria-hidden','false'); const b=el('btn-qbio'); if(b){ b.classList.add('active'); b.setAttribute('aria-expanded','true'); } setLayer(true); } function closePanel(){ if(!aside) return; aside.classList.remove('open'); aside.setAttribute('aria-hidden','true'); const b=el('btn-qbio'); if(b){ b.classList.remove('active'); b.setAttribute('aria-expanded','false'); } setLayer(false); } (function wire(){ const b=el('btn-qbio'); if(b) b.addEventListener('click', ()=> aside.classList.contains('open')?closePanel():openPanel()); const x=el('qbio-close'); if(x) x.addEventListener('click', closePanel); document.addEventListener('keydown', e=>{ if(e.key==='Escape' && aside && aside.classList.contains('open')) closePanel(); }); })(); return { tick, onOrganOpen, openPanel, closePanel, setLayer, label: QB.label, api: ()=>({ tau_c: C.tau_c, pmf_single_mV: C.pmf_single_mV, pmf_two_ion_mV: C.pmf_two_ion_mV, compass_contrast_closed: C.compass_contrast_closed, compass_contrast_full: C.compass_contrast_full, lam_min: C.lam_min, execute_count: D.ORGANS.filter(o=>o.qbio && o.qbio.execute).length, organ_count: D.ORGANS.length, leaders: D.QBIO_LEADERS.length, sources: D.QBIO_SOURCES.length, theorems: D.QBIO_THEOREMS.length, adds_locked_theorem: false, lambda_is_conjecture1: true, layerOn }), isOn: ()=>layerOn }; })(); /* ===================== /v5 quantum-bio layer ====================== */ /* ===================================================================== =========================== v8 — LIVE AGENTIC LENS ================ ADDITIVE module. anatomy stays sdk:static — 0 backend, 0 model key, 0 runtime CDN. v8 gives every organ "power" by READ-ONLY reflecting a11oy's already-live agent loop / gates / verified math over the internet (fetch). a11oy runs the REAL loop; anatomy OBSERVES it and degrades GRACEFULLY to the static data.js baseline when offline. NEVER fabricates a number, NEVER fakes a reasoning string. - HEART / YUYAY -> /v1/honest doctrine_lock + /v1/gates - BRAIN / YACHAY -> /code/healthz (live agentic loop, read-only) - CIRCULATORY/YAWAR -> /v1/qbio/summary (VERIFIED/PROPOSED legend) - SKELETON / HATUN -> /v1/honest Khipu / Conjecture-2 posture Reuses organMeshes / worldPos / flyTo from v3 for the decision-flow animation; appends into the existing #p-body panel; never rewrites it. ===================================================================== */ V8 = (function(){ const el = id=>document.getElementById(id); const D = window.SZL_ANATOMY; const K = D.KERNEL; const REDUCED = !!(window.matchMedia && window.matchMedia('(prefers-reduced-motion: reduce)').matches); function esc(s){ return String(s==null?'':s).replace(/[&<>"]/g,c=>({'&':'&','<':'<','>':'>','"':'"'}[c])); } /* ---- 0 CDN: same-network read-only base. a11oy sets CORS for this origin. ---- */ const BASE = 'https://szlholdings-a11oy.hf.space/api/a11oy'; // map an organ key -> the live endpoint(s) bound to it const ENDPOINTS = { honest: BASE + '/v1/honest', gates: BASE + '/v1/gates', healthz: BASE + '/code/healthz', qsummary: BASE + '/v1/qbio/summary', qlambda: BASE + '/v1/qbio/lambda', qcoh: BASE + '/v1/qbio/coherence' }; /* ---- shared null-safe fetch helper: AbortController ~12s, try/catch, graceful offline -> caller falls back to data.js. NEVER throws. ---- */ const cache = {}; // url -> {ok, data, at} function liveAge(url){ const c=cache[url]; return c&&c.ok ? (Date.now()-c.at) : Infinity; } async function pull(url, timeoutMs){ const ctl = (typeof AbortController!=='undefined') ? new AbortController() : null; const to = ctl ? setTimeout(()=>{ try{ctl.abort();}catch(e){}}, timeoutMs||12000) : null; try{ const r = await fetch(url, { method:'GET', mode:'cors', cache:'no-store', signal: ctl?ctl.signal:undefined }); if(to) clearTimeout(to); if(!r || !r.ok) { cache[url]={ok:false,data:null,at:Date.now()}; return {ok:false,data:null}; } const data = await r.json(); cache[url] = {ok:true, data, at:Date.now()}; return {ok:true, data}; }catch(e){ if(to) clearTimeout(to); cache[url] = {ok:false, data:null, at:Date.now()}; return {ok:false, data:null, err:String(e&&e.message||e)}; } } /* ---- honest live/offline indicator chip ---- */ function dot(isLive){ return isLive ? '● live · a11oy' : 'offline · static snapshot'; } /* ==================================================================== PER-ORGAN LIVE BINDING — appended into the existing #p-body panel. Each binding renders REAL current values when live, else falls back to the honest data.js baseline labeled "offline · static snapshot". ==================================================================== */ // organ key -> binding renderer const BINDINGS = { // HEART / YUYAY yuyay: async function(host){ host.innerHTML = '
    querying a11oy /v1/honest + /v1/gates
    '; const [h, g] = await Promise.all([ pull(ENDPOINTS.honest), pull(ENDPOINTS.gates) ]); const node = el('v8-bind-yuyay'); if(!node) return; // null-safe: panel may have closed const live = h.ok; let body = ''; if(live && h.data && h.data.doctrine_lock){ const dl = h.data.doctrine_lock; body += '
    '+ row('doctrine', esc(dl.doctrine)+' · '+esc(dl.state)) + row('kernel', ''+esc(dl.commit)+'') + row('declarations', esc(dl.declarations)) + row('axioms', esc(dl.axioms)) + row('sorries', esc(dl.sorries)) + row('Λ posture', ''+esc(dl.lambda)+'') + '
    '; if(dl.lambda_note) body += '

    '+esc(dl.lambda_note)+'

    '; } else { body += '
    '+ row('doctrine', 'v11 · LOCKED') + row('kernel', ''+esc(K.locked_sha)+'') + row('declarations', esc(K.locked_decls)) + row('axioms', esc(K.locked_axioms)) + row('sorries', esc(K.locked_sorries)) + row('Λ posture', 'Conjecture 1') + '
    '; } if(g.ok && g.data && Array.isArray(g.data.gates)){ const sample = g.data.gates.slice(0,4).map(x=>esc(x.name)).join(', '); body += '

    '+esc(g.data.count)+' live policy gates on the 13-axis conjunctive gate · e.g. '+sample+'…

    '; } else { body += '

    49 policy gates (static snapshot) — conjunctive deny-by-default; trust never 100%.

    '; } node.innerHTML = '
    '+dot(live)+'
    '+body; }, // BRAIN / YACHAY (read-only reasoning cortex) amaru: async function(host){ host.innerHTML = '
    querying a11oy /code/healthz
    '; const r = await pull(ENDPOINTS.healthz); const node = el('v8-bind-amaru'); if(!node) return; const live = r.ok && r.data; let body = ''; if(live){ const d = r.data; const kr = d.key_resolution || {}; body += '
    '+ row('mode', ''+esc(d.mode)+'') + row('doctrine', esc(d.doctrine)) + row('inference', esc(d.inference)) + row('PURIQ floor', esc(d.puriq_threshold)) + row('memory', esc(d.memory)) + row('signed by', esc(d.signed)) + '
    '; if(Array.isArray(d.tiers)) body += '

    '+d.tiers.length+' tiers: '+d.tiers.map(esc).join(' · ')+'

    '; if(Array.isArray(d.tools)) body += '

    '+d.tools.length+' real tools: '+d.tools.map(esc).join(', ')+'

    '; body += '

    '+esc(kr.honest_note||'model credential not resolved; the agent loop runs for real, model text degrades to a labeled stub (Zero-Bandaid Law).')+'

    '; } else { body += '

    offline — the cortex READS frozen snapshots, NEVER WRITES. PURIQ floor 0.62 · 7 tiers (T0–T6) · 18 real tools (static snapshot).

    '; } body += '

    reasons, never holds write authority. YACHAY is read-only by doctrine.

    '; node.innerHTML = '
    '+dot(live)+'
    '+body; }, // CIRCULATORY / YAWAR -> metabolic / quantum-bio verified results yawar: async function(host){ host.innerHTML = '
    querying a11oy /v1/qbio/summary
    '; const r = await pull(ENDPOINTS.qsummary); const node = el('v8-bind-yawar'); if(!node) return; const live = r.ok && r.data && Array.isArray(r.data.results); let body = ''; if(live){ const d = r.data; body += '
    '; d.results.forEach(x=>{ const st = String(x.status||'').split(' ')[0]; body += '
    '+esc(x.quantity)+''+ ''+esc(x.value)+''+ ''+esc(x.status)+'
    '; }); body += '
    '; const lg = d.status_legend||{}; body += '

    legend: '+ 'VERIFIED '+esc(lg.VERIFIED||'')+' · '+ 'PROPOSED '+esc(lg.PROPOSED||'')+' · '+ 'NARRATIVE '+esc(lg.NARRATIVE||'')+'

    '; body += '

    '+esc(d.doctrine||'')+'

    '; } else { body += '

    offline — static snapshot: Lindblad τ_c 6.05 (VERIFIED) · pmf single-ion 119.3 mV (VERIFIED) · pmf two-ion K⁺/H⁺ 121.5 mV (PROPOSED) · compass contrast 0.025 (VERIFIED). Λ-v5 is a PROPOSED engineering gate; Kruse = NARRATIVE only.

    '; } node.innerHTML = '
    '+dot(live)+'
    '+body; }, // SKELETON / HATUN -> Khipu / Conjecture-2 posture (from /v1/honest) hatun: async function(host){ host.innerHTML = '
    querying a11oy /v1/honest (Khipu posture)…
    '; const r = await pull(ENDPOINTS.honest); const node = el('v8-bind-hatun'); if(!node) return; const live = r.ok && r.data; let body = ''; if(live){ const hl = r.data.honest_labels || {}; const dl = r.data.doctrine_lock || {}; body += '
    '+ row('kernel', ''+esc(dl.commit||K.locked_sha)+'') + row('Khipu BFT', 'Conjecture 2') + row('chain integrity', 'SHA3-256 hash-chain') + '
    '; if(hl.khipu_signatures) body += '

    '+esc(hl.khipu_signatures)+'

    '; if(hl.persistence) body += '

    '+esc(hl.persistence)+'

    '; if(hl.principle) body += '

    '+esc(hl.principle)+'

    '; } else { body += '
    '+ row('kernel', ''+esc(K.locked_sha)+'') + row('Khipu BFT', 'Conjecture 2') + '
    '; body += '

    offline — static snapshot. Khipu BFT safety is Conjecture 2; Wave23 proves it CONDITIONAL on {n≥3f+1, honest non-equivocation}. Unconditional safety stays Conjecture 2 at the sharp boundary.

    '; } node.innerHTML = '
    '+dot(live)+'
    '+body; } }; function row(k,v){ return '
    '+esc(k)+''+v+'
    '; } /* ---- panel hook: when a BOUND organ opens, append a live-lens block ---- */ function onOrganOpen(o){ if(!o) return; const binder = BINDINGS[o.key]; if(!binder) return; const pb = el('p-body'); if(!pb) return; // null-safe // avoid duplicate insertion if v5/v7 re-render; insert at top of panel body if(el('v8-bind-'+o.key)) { try{ binder(el('v8-bind-'+o.key)); }catch(e){} return; } const wrap = document.createElement('section'); wrap.className = 'v8-lens'; wrap.innerHTML = '
    ● LIVE LENS — read-only reflection of a11oy\u2019s real agent loop
    '+ '
    '; pb.insertBefore(wrap, pb.firstChild); const inner = el('v8-bind-'+o.key); if(inner){ try{ binder(inner); }catch(e){ inner.innerHTML='

    offline · static snapshot

    '; } } } /* ==================================================================== LIVE VITAL-SIGNS HUD — small always-on overlay polling /v1/honest ~every 20s: kernel commit, locked-8, Λ=Conjecture 1, live/offline. Falls back to D.KERNEL offline. Respects prefers-reduced-motion. ==================================================================== */ let vitalTimer = null; async function pollVitals(){ const r = await pull(ENDPOINTS.honest, 12000); const wrap = el('v8-vitals'); if(!wrap) return; // null-safe const live = r.ok && r.data && r.data.doctrine_lock; const dl = live ? r.data.doctrine_lock : null; const kernel = dl ? dl.commit : K.locked_sha; const lam = dl ? dl.lambda : 'Conjecture 1'; const stEl = el('v8-vitals-state'); const knEl = el('v8-vitals-kernel'); const lkEl = el('v8-vitals-locked'); const lmEl = el('v8-vitals-lambda'); const tk = el('v8-vitals-tick'); if(stEl) stEl.innerHTML = live ? 'a11oy live' : 'offline · static'; if(knEl) knEl.innerHTML = ''+esc(kernel)+''; if(lkEl) lkEl.textContent = K.locked_proven.length + ' {'+K.locked_proven.join(',')+'}'; if(lmEl) lmEl.innerHTML = ''+esc(lam)+''; if(tk) tk.classList.toggle('live', !!live); } function startVitals(){ if(vitalTimer) return; pollVitals(); vitalTimer = setInterval(pollVitals, 20000); } /* ==================================================================== WATCH A DECISION FLOW — HEART-anchored agentic showcase. Drives an HONEST, deterministic flow from REAL read-only values: /code/healthz (tier set, PURIQ floor, mode) + /v1/qbio/lambda Animates the decision propagating organ-by-organ through the 3D body: HEART gate -> BRAIN reason -> CIRCULATORY receipt -> SKELETON quorum. Model text stays a LABELED deterministic stub (never fabricated). ==================================================================== */ // honest deterministic tier pick from the live tier set + request length function pickTier(tiers, req){ const t = Array.isArray(tiers)&&tiers.length ? tiers : ['T0','T1','T2','T3','T4','T5','T6']; const n = (req||'').trim().length; const idx = Math.min(t.length-1, Math.max(1, Math.round(n/14))); // deterministic, length-driven return t[idx]; } const FLOW_KEYS = ['yuyay','amaru','yawar','hatun']; // HEART -> BRAIN -> CIRC -> SKELETON let flowBusy = false; // highlight / fly to an organ by key, using the v3 mesh registry in outer scope. function highlightOrgan(key, on, color){ const o = D.ORGANS.find(x=>x.key===key); if(!o) return; const om = organMeshes.find(m=>m.organ===o); if(!om || !om.grp || !om.grp.userData.glow) return; om.grp.userData.glow.material.opacity = on ? 0.92 : om.glowBase; } function flyToOrgan(key){ const o = D.ORGANS.find(x=>x.key===key); if(!o) return; const om = organMeshes.find(m=>m.organ===o); const side = o.shared ? 0 : (om && om.bodyKey==='killinchu' ? 1 : -1); const wp = worldPos(o, side); try{ flyTo(new THREE.Vector3(wp.x,wp.y,wp.z), o.shared?9.5:8.2); }catch(e){} } async function runDecisionFlow(){ if(flowBusy) return; const reqEl = el('v8-flow-input'); const out = el('v8-flow-out'); const btn = el('v8-flow-run'); if(!out) return; const req = (reqEl && reqEl.value || '').trim() || 'Should I execute this action?'; flowBusy = true; if(btn){ btn.disabled = true; } out.innerHTML = '
    calling a11oy /code/healthz + /v1/qbio/lambda
    '; const [hz, lam] = await Promise.all([ pull(ENDPOINTS.healthz), pull(ENDPOINTS.qlambda + '?C=0.92&dp=120&dp0=100&lam_min=0.5') ]); const o2 = el('v8-flow-out'); if(!o2){ flowBusy=false; return; } // null-safe: closed mid-flight const live = hz.ok && hz.data; const tiers = live ? hz.data.tiers : null; const puriq = live ? hz.data.puriq_threshold : 0.62; const tier = pickTier(tiers, req); const lamLive = lam.ok && lam.data; const lamVal = lamLive ? lam.data.lambda : null; const lamOk = lamLive ? lam.data.closure_ok : null; const lamMin = lamLive ? lam.data.lam_min : 0.5; // honest, deterministic per-step payload — REAL returned values only const steps = [ { key:'yuyay', label:'HEART · YUYAY gate', color:'var(--heart)', line: '13-axis conjunctive gate · deny-by-default · '+(live?'live':'static')+' posture · trust never 100%' }, { key:'amaru', label:'BRAIN · YACHAY reason', color:'var(--brain)', line: 'tier '+esc(tier)+' chosen · PURIQ floor '+esc(puriq)+' · mode '+(live?esc(hz.data.mode):'offline')+' · reasons, never writes' }, { key:'yawar', label:'CIRCULATORY · YAWAR receipt', color:'var(--blood)', line: 'Λ-v5 gate '+(lamLive?('λ='+esc(lamVal)+' (min '+esc(lamMin)+') · closure '+(lamOk?'OK':'recharge')):'offline · static')+' · SHA-256 receipt appended' }, { key:'hatun', label:'SKELETON · Khipu quorum', color:'var(--skel)', line: 'n≥3f+1 Khipu BFT quorum · Conjecture 2 (Wave23 conditional safety) · sealed' } ]; // model text is an honest labeled stub — NEVER fabricated reasoning const wired = live && hz.data.key_resolution && hz.data.key_resolution.wired; const stub = wired ? 'model text: live (provider resolved).' : 'model text = labeled deterministic stub until SZL_LOCAL_LLM_URL is wired. The agent loop + gate/tier/Λ values above are REAL; reasoning prose is NOT fabricated.'; // render the flow log o2.innerHTML = '
    '+dot(live)+' · decision: '+esc(req)+'
    '+ '
      '+steps.map((s,i)=> '
    1. '+ ''+esc(s.label)+'
      '+s.line+'
    2. ' ).join('')+'
    '+ '

    '+esc(stub)+'

    '; // animate propagation through the 3D body — gated by reduced-motion const stepMs = REDUCED ? 0 : 700; for(let i=0;isetTimeout(res, stepMs)); if(isetTimeout(res, 600)); FLOW_KEYS.forEach(k=>highlightOrgan(k, false)); const b2 = el('v8-flow-run'); if(b2){ b2.disabled = false; } flowBusy = false; } /* ---- wire DOM controls (null-safe) ---- */ function wire(){ const runBtn = el('v8-flow-run'); if(runBtn) runBtn.addEventListener('click', runDecisionFlow); const input = el('v8-flow-input'); if(input) input.addEventListener('keydown', e=>{ if(e.key==='Enter'){ e.preventDefault(); runDecisionFlow(); } }); const fab = el('v8-flow-fab'); const card = el('v8-flow'); if(fab && card){ fab.addEventListener('click', ()=>{ const open = card.classList.toggle('open'); fab.setAttribute('aria-expanded', open?'true':'false'); if(open){ const inp=el('v8-flow-input'); if(inp) inp.focus(); } }); } const fclose = el('v8-flow-close'); if(fclose && card) fclose.addEventListener('click', ()=>{ card.classList.remove('open'); if(fab) fab.setAttribute('aria-expanded','false'); }); } return { onOrganOpen, startVitals, wire, runDecisionFlow, pollVitals, highlightOrgan, flyToOrgan, _BINDINGS:BINDINGS, // v9 reuses v8's verified fetch contract + helpers (additive, no behaviour change): pull, ENDPOINTS, dot, esc, BASE, REDUCED, cache, liveAge }; })(); /* ========================= /v8 live agentic lens =================== */ /* ---- v8 bootstrap: wire decision-flow controls + start vital-signs poll ---- */ if(V8){ try{ V8.wire(); }catch(e){} try{ V8.startVitals(); }catch(e){} } /* ===================================================================== =========================== v9 — FLY HIGH ======================== ADDITIVE module. Builds on v8's live agentic lens. anatomy stays sdk:static — 0 backend, 0 model key, 0 runtime CDN, offline-graceful. Reuses v8's VERIFIED fetch contract (V8.pull / V8.ENDPOINTS) so every number shown is a REAL polled scalar or an honest data.js fallback. NEVER fabricates a number or a reasoning string. (1) live receipt bloodstream — particles whose RATE/COLOR track real polled scalars (PURIQ 0.62 floor, live Λ-v5 closure, gate count). Honestly labelled a PROXY visual of real scalars. (2) autonomous heartbeat loop — re-polls /v1/honest + /code/healthz ~every 17s, breathes the Λ-heart, updates the master HUD + last-updated stamp + ● LIVE / ○ offline dot. Pause toggle + prefers-reduced-motion aware. (3) second body: killinchu — IF its honest endpoint returns 200, binds a LIVE posture lens onto the already-rendered killinchu silhouette sharing the circ/nervous mesh; effector SIMULATED. (4) cinematic vital tour — hands-free 45–60s auto-fly that visits each live organ, narrates its REAL current value, ends on the Λ-heart. Skippable, keyboard, reduced-motion = instant cuts. (5) decision-flow trace card — honest trace (tier, PURIQ vs 0.62, Λ-v5 λ + closure_ok, stub note) from REAL /code/healthz + /v1/qbio/lambda, rendered alongside the v8 decision flow. (6) polish — master ●LIVE/○offline indicator, subtle bloom on live organs only, FPS-safe (capped particle count, reused geometry/material). Reuses outer-scope organMeshes / worldPos / flyTo / heartGroup / heartCoreMat / cam / root / THREE / vessels / D from v3. Replaces nothing above; appends one V9.tick into the single render loop. ===================================================================== */ V9 = (function(){ if(!V8){ return null; } // v9 layers on top of v8 const el = id=>document.getElementById(id); const D = window.SZL_ANATOMY; const K = D.KERNEL; const pull = V8.pull, ENDPOINTS = V8.ENDPOINTS, esc = V8.esc, dot = V8.dot; const REDUCED = !!V8.REDUCED; const KILLINCHU_HONEST = 'https://szlholdings-killinchu.hf.space/api/killinchu/v1/honest'; // ---- shared live posture, refreshed by the heartbeat loop. Never faked. ---- const LIVE = { online:false, at:0, puriq:0.62, // PURIQ floor — confirmed by /code/healthz when live gates: (K.gate_count || 49), lambda: null, // Λ-v5 λ from /v1/qbio/lambda (PROPOSED engineering gate) closure_ok: null, mode:'offline', kernel: K.locked_sha, lambdaPosture:'Conjecture 1' }; /* ==================================================================== (1) LIVE RECEIPT BLOODSTREAM — capped particle pool flowing along the circulatory (YAWAR, #ff3b5c) vessels. RATE + COLOR are driven by real polled scalars. Honest: this is a PROXY VISUAL of real scalars, never claimed to be individual real receipts (no endpoint returns those). Reuses ONE geometry + ONE material (FPS-safe). ==================================================================== */ const MAX_PARTICLES = REDUCED ? 0 : 90; // hard cap for healthy FPS let bloodCurves = []; let streamGroup = null, streamPts = null, streamPos = null, streamMat = null; let particles = []; // {curve, t, speed} let streamBaseColor = new THREE.Color('#ff3b5c'); let streamLiveColor = new THREE.Color('#ff5d8f'); function buildBloodstream(){ if(MAX_PARTICLES<=0) return; // reduced-motion: no flowing particles // circulatory vessels only (blood-bus color), reuse their curves bloodCurves = (typeof vessels!=='undefined' ? vessels : []).filter(v=>v && v.curve && v.color==='#ff3b5c').map(v=>v.curve); if(!bloodCurves.length){ return; } streamGroup = new THREE.Group(); streamPos = new Float32Array(MAX_PARTICLES*3); for(let i=0;i // faster, warmer flow; offline => slow, dim baseline. Never invents data. function streamRate(){ // base 0.85; live PURIQ floor and Λ closure modulate within a tasteful band let r = 0.85; if(LIVE.online){ r = 1.0; if(LIVE.closure_ok===true) r += 0.35; // Λ-v5 closes -> flow executes if(LIVE.lambda!=null) r += Math.min(0.4, Math.max(0,(LIVE.lambda-0.25))*0.5); if(LIVE.gates) r += Math.min(0.25, (LIVE.gates/49-1)*0.25 + 0.0); } else { r = 0.55; } return r; } function tickBloodstream(dt){ if(!streamPts || !streamPos) return; const rate = streamRate(); for(let i=0;iBRAIN->CIRC->SKELETON, fired by the flow. let decisionPulse = null; // {keys:[...world], t, dur} function fireDecisionPulse(){ if(REDUCED) return; const order = ['yuyay','amaru','yawar','hatun']; const pts = order.map(k=>{ const o=D.ORGANS.find(x=>x.key===k); if(!o) return null; const om = organMeshes.find(m=>m.organ===o && (o.shared || m.bodyKey==='a11oy')); return om ? (om.basePos?om.basePos.clone():om.grp.position.clone()) : null; }).filter(Boolean); if(pts.length<2) return; if(!decisionPulse){ const g = new THREE.SphereGeometry(0.16,12,12); const m = new THREE.MeshBasicMaterial({color:'#ffe1ec',transparent:true,opacity:0.95,blending:THREE.AdditiveBlending,depthWrite:false}); const mesh = new THREE.Mesh(g,m); const gl = (typeof glowSprite==='function') ? glowSprite('#ff5d8f',0.9,0.8) : null; const grp = new THREE.Group(); grp.add(mesh); if(gl) grp.add(gl); root.add(grp); decisionPulse = { grp, mesh, glow:gl, pts:[], t:0, dur:2.2, active:false }; } decisionPulse.pts = pts; decisionPulse.t=0; decisionPulse.active=true; decisionPulse.grp.visible=true; } function tickDecisionPulse(dt){ const dp = decisionPulse; if(!dp || !dp.active) return; dp.t += dt/dp.dur; if(dp.t>=1){ dp.active=false; dp.grp.visible=false; return; } const segs = dp.pts.length-1; const f = dp.t*segs; const i = Math.min(segs-1, Math.floor(f)); const lf = f-i; const a = dp.pts[i], b = dp.pts[i+1]; dp.grp.position.lerpVectors(a,b,lf); const fade = Math.sin(dp.t*Math.PI); dp.mesh.material.opacity = 0.55+0.45*fade; if(dp.glow) dp.glow.material.opacity = 0.5*fade+0.2; } /* ==================================================================== (6) POLISH — subtle bloom on LIVE organs only. Reuses each organ's existing glow sprite (no new materials). When online, the four bound organs get a gentle extra emissive lift; offline they sit at baseline. ==================================================================== */ const LIVE_ORGAN_KEYS = ['yuyay','amaru','yawar','hatun']; const _panelEl = el('panel'); function tickBloom(t){ const on = LIVE.online; // never fight the open panel's framing or the hovered organ's halo state if(_panelEl && _panelEl.classList.contains('open')) return; const hov = (typeof hoverOM!=='undefined') ? hoverOM : null; LIVE_ORGAN_KEYS.forEach((k,idx)=>{ const o=D.ORGANS.find(x=>x.key===k); if(!o) return; organMeshes.forEach(om=>{ if(om.organ!==o || om===hov) return; const gl = om.grp.userData.glow; if(gl){ const base = om.glowBase; const lift = on ? (0.18 + 0.10*Math.sin(t*1.6+idx)) : 0.0; // bloom on LIVE organs only gl.material.opacity = Math.min(1.0, base + lift); } }); }); } /* ==================================================================== (2) AUTONOMOUS HEARTBEAT TELEMETRY LOOP — re-polls /v1/honest + /code/healthz + /v1/qbio/lambda ~every 17s, refreshes LIVE posture, breathes the Λ-heart, updates the master HUD + last-updated stamp + ●LIVE/○offline dot. Pause toggle + prefers-reduced-motion aware. ==================================================================== */ let beatTimer = null, beatPaused = false, beatPhase9 = 0, beatBoost = 0; function fmtAgo(ms){ if(!ms) return 'never'; const s = Math.round((Date.now()-ms)/1000); if(s<2) return 'just now'; if(s<60) return s+'s ago'; const m=Math.round(s/60); return m+'m ago'; } async function heartbeatPoll(){ const [h, hz, lam] = await Promise.all([ pull(ENDPOINTS.honest, 12000), pull(ENDPOINTS.healthz, 12000), pull(ENDPOINTS.qlambda + '?C=0.92&dp=120&dp0=100&lam_min=0.5', 12000) ]); const live = !!(h.ok && h.data && h.data.doctrine_lock); LIVE.online = live; LIVE.at = Date.now(); if(live){ const dl = h.data.doctrine_lock; LIVE.kernel = dl.commit || K.locked_sha; LIVE.lambdaPosture = dl.lambda || 'Conjecture 1'; } if(hz.ok && hz.data){ LIVE.mode = hz.data.mode || 'live'; if(typeof hz.data.puriq_threshold==='number') LIVE.puriq = hz.data.puriq_threshold; } else { LIVE.mode = 'offline'; } if(lam.ok && lam.data){ LIVE.lambda = (typeof lam.data.lambda==='number') ? lam.data.lambda : null; LIVE.closure_ok = lam.data.closure_ok===true; } renderMaster(); // a live poll gives the heart an extra "thump" so the body looks alive if(!REDUCED && live) beatBoost = 1.0; } function startHeartbeat(){ if(beatTimer) return; heartbeatPoll(); beatTimer = setInterval(()=>{ if(!beatPaused) heartbeatPoll(); }, 17000); } function toggleHeartbeat(){ beatPaused = !beatPaused; const b = el('v9-beat-pause'); if(b){ b.textContent = beatPaused ? '▶ resume telemetry' : '⏸ pause telemetry'; b.setAttribute('aria-pressed', String(beatPaused)); } renderMaster(); } // gentle secondary heart breath driven by the live loop (layers atop v3 beat) function tickHeartbeatBreath(dt){ if(REDUCED) return; if(beatBoost>0){ beatBoost = Math.max(0, beatBoost - dt*1.4); } if(heartGroup && LIVE.online){ const extra = beatBoost*0.05; if(extra>0){ heartGroup.scale.multiplyScalar(1+extra); } if(typeof heartCoreMat!=='undefined' && heartCoreMat){ heartCoreMat.emissiveIntensity += beatBoost*0.6; } } } /* ==================================================================== (6) MASTER ●LIVE / ○offline INDICATOR — one always-on chip with the last-updated stamp, live mode, PURIQ floor, Λ-v5 λ, gate count. Reads ONLY from LIVE (real polled scalars) or honest data.js fallback. ==================================================================== */ function renderMaster(){ const wrap = el('v9-master'); if(!wrap) return; // null-safe const stEl = el('v9-master-state'); const agoEl = el('v9-master-ago'); const rateEl = el('v9-master-rate'); const lamEl = el('v9-master-lambda'); const beatEl = el('v9-master-beat'); if(stEl) stEl.innerHTML = LIVE.online ? '● LIVE · two endpoints' : '○ offline · static snapshot'; if(agoEl) agoEl.textContent = 'updated ' + fmtAgo(LIVE.at); if(rateEl){ rateEl.innerHTML = LIVE.online ? ('PURIQ floor '+esc(LIVE.puriq)+' · '+esc(LIVE.gates)+' gates') : ('PURIQ floor 0.62 · 49 gates (static)'); } if(lamEl){ lamEl.innerHTML = (LIVE.online && LIVE.lambda!=null) ? ('Λ-v5 λ='+esc(LIVE.lambda.toFixed(6))+' · closure '+(LIVE.closure_ok?'OK':'recharge')) : 'Λ-v5 gate offline · PROPOSED engineering gate'; } if(beatEl) beatEl.textContent = beatPaused ? 'telemetry paused' : 'telemetry every ~17s'; const bs = el('v9-beat-state'); if(bs){ bs.className = 'v9-dot ' + (LIVE.online?'live':'off'); } } /* ==================================================================== (5) DECISION-FLOW → HONEST AGENT TRACE CARD. Wraps v8.runDecisionFlow: after the v8 flow renders, append a compact trace card built from the REAL /code/healthz + /v1/qbio/lambda values (already cached by v8/v9). Fires the bright bloodstream decision pulse too. Stub note kept honest. ==================================================================== */ async function runTracedDecision(){ // refresh the two endpoints the trace reads (reuses v8's verified pull) const [hz, lam] = await Promise.all([ pull(ENDPOINTS.healthz, 12000), pull(ENDPOINTS.qlambda + '?C=0.92&dp=120&dp0=100&lam_min=0.5', 12000) ]); const live = hz.ok && hz.data; const lamLive = lam.ok && lam.data; const reqEl = el('v8-flow-input'); const req = (reqEl && reqEl.value || '').trim() || 'Should I execute this action?'; const tiers = live ? hz.data.tiers : ['T0','T1','T2','T3','T4','T5','T6']; const n = req.length; const tier = tiers[Math.min(tiers.length-1, Math.max(1, Math.round(n/14)))]; const puriq = live ? hz.data.puriq_threshold : 0.62; const lamVal = lamLive ? lam.data.lambda : null; const lamOk = lamLive ? lam.data.closure_ok : null; const lamMin = lamLive ? lam.data.lam_min : 0.25; const wired = live && hz.data.key_resolution && hz.data.key_resolution.wired; const card = el('v9-trace'); if(!card) return; // null-safe const passPuriq = true; // tier/PURIQ decision is the agent's, not ours; we report the floor honestly let html = '
    '+dot(!!live)+' · honest agent trace
    '; html += '
    '; html += traceRow('tier chosen', ''+esc(tier)+' (deterministic, length-driven · from live tier set)'); html += traceRow('PURIQ decision', 'floor '+esc(puriq)+' · proposer must clear ≥ '+esc(puriq)+' to act (threshold is real; per-call PURIQ is the agent\u2019s)'); html += traceRow('Λ-v5 closure', lamLive ? ('λ='+esc(lamVal)+' (min '+esc(lamMin)+') · closure_ok='+(lamOk?'true':'false')+'') : 'offline · static snapshot (PROPOSED engineering gate)'); html += traceRow('mode', live ? ''+esc(hz.data.mode)+'' : 'offline'); html += '
    '; html += '

    '+(wired ? 'model text: live (provider resolved).' : 'model prose = deterministic stub until SZL_LOCAL_LLM_URL is wired (Zero-Bandaid Law). The tier / PURIQ floor / Λ-v5 values above are REAL polled scalars; reasoning prose is NOT fabricated.')+'

    '; card.innerHTML = html; card.classList.add('show'); fireDecisionPulse(); } function traceRow(k,v){ return '
    '+esc(k)+''+v+'
    '; } /* ==================================================================== (3) SECOND BODY: killinchu (probe-first). If the killinchu honest endpoint returns 200, bind a LIVE posture lens onto the already- rendered killinchu silhouette. Effector is clearly SIMULATED. If unreachable, leave the single a11oy body with no error. ==================================================================== */ let killinchuLive = false; async function probeKillinchu(){ const r = await pull(KILLINCHU_HONEST, 12000); const host = el('v9-killinchu'); killinchuLive = !!(r.ok && r.data && r.data.doctrine_lock); if(!host) return; // null-safe if(killinchuLive){ const dl = r.data.doctrine_lock || {}; const hl = r.data.honest_labels || {}; let html = '
    '+dot(true)+' · second body
    '; html += '
    killinchu — maritime / drone C2 body
    '; html += '
    '; html += traceRow('organ', ''+esc(r.data.organ||'killinchu')+''); html += traceRow('doctrine', esc(dl.doctrine)+' · '+esc(dl.state)); html += traceRow('kernel', ''+esc(dl.commit)+''); html += traceRow('Λ posture', ''+esc(dl.lambda||'Conjecture 1')+''); html += '
    '; html += '

    effector: SIMULATED. detect·classify·defeat runs under human-authority ROE; the defeat actuator is a simulated effector — no live weapon. Shares the circulatory (YAWAR receipt bus) + nervous (span lineage) mesh with a11oy.

    '; if(hl.principle) html += '

    '+esc(hl.principle)+'

    '; host.innerHTML = html; host.classList.add('show'); } else { // unreachable: keep single body, no error, no fabricated posture host.classList.remove('show'); host.innerHTML = ''; } renderMaster(); } /* ==================================================================== (4) CINEMATIC GUIDED VITAL TOUR — hands-free 45–60s auto-fly that visits each LIVE organ, narrates its REAL current value, ends on the Λ-heart. Skippable, keyboard, reduced-motion = instant cuts (no sweep). Reuses outer-scope flyTo + worldPos. Real values only (LIVE + caches). ==================================================================== */ // stops: organ key + a live-value narrator that reads ONLY real scalars const TOUR_STOPS = [ { key:'yuyay', title:'HEART · YUYAY — the Λ gate', say:()=> 'doctrine '+(LIVE.online?'LOCKED @ '+LIVE.kernel:'v11 LOCKED (static)')+' · Λ = '+LIVE.lambdaPosture+' · 13-axis conjunctive gate · trust never 100%.' }, { key:'amaru', title:'BRAIN · YACHAY — read-only cortex', say:()=> LIVE.online ? ('mode '+LIVE.mode+' · PURIQ floor '+LIVE.puriq+' · reasons, never writes.') : 'offline · PURIQ floor 0.62 · reasons, never writes (static).' }, { key:'yawar', title:'CIRCULATORY · YAWAR — receipt bus', say:()=> LIVE.online ? ('live receipt bloodstream flowing · '+LIVE.gates+' policy gates · SHA-256 append-only.') : 'offline · 49 gates · SHA-256 append-only (static).' }, { key:'hatun', title:'SKELETON · HATUN — sovereign seal', say:()=> 'Khipu BFT quorum n≥3f+1 · Conjecture 2 (Wave23 conditional safety) · sealed.' }, { key:'yuyay', title:'HEART · YUYAY — Λ closure', say:()=> (LIVE.online && LIVE.lambda!=null) ? ('Λ-v5 closure λ='+LIVE.lambda.toFixed(4)+' · '+(LIVE.closure_ok?'execute':'recharge')+' · the body is ALIVE and self-updating.') : 'Λ-v5 PROPOSED engineering gate (offline) · the body breathes on live telemetry.' } ]; let vtour = { on:false, i:0, t:0, dwell: REDUCED?5.0:10.0, total:0 }; function vtourShow(stop){ const nameEl = el('v9-tour-name'), bodyEl = el('v9-tour-body'), progEl = el('v9-tour-prog'); if(nameEl) nameEl.textContent = stop.title; if(bodyEl) bodyEl.textContent = stop.say(); if(progEl) progEl.textContent = (vtour.i+1)+' / '+TOUR_STOPS.length; const bar = el('v9-tour-bar-i'); if(bar) bar.style.width='0%'; } function vtourFly(stop){ const o = D.ORGANS.find(x=>x.key===stop.key); if(!o) return; const om = organMeshes.find(m=>m.organ===o && (o.shared || m.bodyKey==='a11oy')); const side = o.shared ? 0 : -1; const wp = (typeof worldPos==='function') ? worldPos(o, side) : (om?om.grp.position:null); if(!wp) return; try{ flyTo(new THREE.Vector3(wp.x,wp.y,wp.z), o.shared?9.0:7.6); }catch(e){} } function vtourGo(i){ vtour.i = ((i%TOUR_STOPS.length)+TOUR_STOPS.length)%TOUR_STOPS.length; vtour.t = 0; const stop = TOUR_STOPS[vtour.i]; vtourShow(stop); vtourFly(stop); } function startVtour(){ vtour.on = true; vtour.total = 0; const card = el('v9-tour'); if(card) card.classList.add('show'); const b = el('v9-tour-btn'); if(b){ b.classList.add('active'); b.setAttribute('aria-pressed','true'); } // stop the v5 idle auto-rotate so the cinematic camera owns the frame try{ if(typeof autoRotate!=='undefined'){ autoRotate=false; const rb=el('btn-rotate'); if(rb) rb.classList.remove('active'); } }catch(e){} vtourGo(0); } function stopVtour(){ vtour.on = false; const card = el('v9-tour'); if(card) card.classList.remove('show'); const b = el('v9-tour-btn'); if(b){ b.classList.remove('active'); b.setAttribute('aria-pressed','false'); } } function tickVtour(dt){ if(!vtour.on) return; vtour.t += dt; vtour.total += dt; const frac = Math.min(1, vtour.t/vtour.dwell); const bar = el('v9-tour-bar-i'); if(bar) bar.style.width = (frac*100).toFixed(0)+'%'; if(vtour.t >= vtour.dwell){ if(vtour.i >= TOUR_STOPS.length-1){ stopVtour(); } // ~50s total, ends on the Λ-heart else vtourGo(vtour.i+1); } } /* ---- wire all v9 DOM controls (null-safe) ---- */ function wire(){ const tb = el('v9-tour-btn'); if(tb) tb.addEventListener('click', ()=> vtour.on?stopVtour():startVtour()); const ts = el('v9-tour-stop'); if(ts) ts.addEventListener('click', stopVtour); const tn = el('v9-tour-next'); if(tn) tn.addEventListener('click', ()=>{ if(vtour.on) vtourGo(vtour.i+1); }); const pb = el('v9-beat-pause'); if(pb) pb.addEventListener('click', toggleHeartbeat); // keyboard: Esc ends the vital tour; arrow advances document.addEventListener('keydown', e=>{ if(!vtour.on) return; if(e.key==='Escape'){ stopVtour(); } else if(e.key==='ArrowRight'){ vtourGo(vtour.i+1); } else if(e.key==='ArrowLeft'){ vtourGo(vtour.i-1); } }); // chain the honest agent trace + decision pulse onto the v8 decision-flow run const runBtn = el('v8-flow-run'); if(runBtn) runBtn.addEventListener('click', ()=>{ try{ runTracedDecision(); }catch(e){} }); const flowInput = el('v8-flow-input'); if(flowInput) flowInput.addEventListener('keydown', e=>{ if(e.key==='Enter'){ try{ runTracedDecision(); }catch(_){} } }); } /* ---- per-frame tick from the single v3 render loop ---- */ function tick(dt,t,beat){ tickBloodstream(dt); tickDecisionPulse(dt); tickBloom(t); tickHeartbeatBreath(dt); tickVtour(dt); } /* ---- bootstrap ---- */ buildBloodstream(); wire(); startHeartbeat(); probeKillinchu(); renderMaster(); return { tick, startHeartbeat, toggleHeartbeat, startVtour, stopVtour, runTracedDecision, probeKillinchu, renderMaster, _LIVE:LIVE, killinchuPresent:()=>killinchuLive, api:{ online:()=>LIVE.online, particles:()=>particles.length, vtourOn:()=>vtour.on, killinchu:()=>killinchuLive } }; })(); /* ========================= /v9 fly-high =========================== */ /* ---- v9 bootstrap is internal to the IIFE above (wire + heartbeat + killinchu probe) ---- */ /* ===================================================================== V10 — ESTATE / AYLLU (additive · honest · zoom-OUT) Evolves the living anatomy from a single organism into the whole SZL estate, in the same doctrine as every prior layer: · Ayllu COUNCIL — the deliberating minds, read LIVE from a11oy /api/a11oy/v1/ayllu/roster (CORS-allowed for this Space). If the roster is unreachable it falls back to the declared core personas and is labelled "offline · static snapshot" — never a fabricated roster, never a fabricated count. · ESTATE shell — Rosa's real hardware & stack rendered as DECLARED nodes (no per-node live probe) — labelled "declared", never faked. · PINN LAB — a MEASURED local snapshot (rosie · RTX 5050), explicitly labelled MEASURED / not-live. · Zoom presets — COUNCIL (in) · ORGANISM (home) · ESTATE (out) — reuse the existing custom-camera flyTo()/tween + render loop. Shares scene / camera / cam / HOME / flyTo / glowSprite / autoRotate by closure; adds nothing to the network path except the read-only roster. ===================================================================== */ V10 = (function(){ if(typeof THREE==='undefined' || !scene) return null; function esc(s){ return String(s==null?'':s).replace(/[&<>"]/g,c=>({'&':'&','<':'<','>':'>','"':'"'}[c])); } /* ---- honest data ---- */ const COUNCIL_FALLBACK = ['Amaru','Ruwaq','Yupaq']; // declared core (roster-unreachable path) const COUNCIL_COL = 0xb98cff; const ESTATE = [ {id:'rosie · RTX 5050', col:0x34f5b0, kind:'GPU · research'}, {id:'betterwithage · RTX 5000', col:0x39d7ff, kind:'GPU · inference (MIND core)'}, {id:'Hetzner · prod box', col:0xffd66e, kind:'compute · host'}, {id:'Neon · Postgres 17', col:0x5ad6ff, kind:'data · database'}, {id:'Hugging Face · Spaces', col:0xffcb57, kind:'edge · deploy'}, {id:'Backblaze B2 · backups', col:0x9aa6bd, kind:'storage · DR'} ]; /* ---- groups (share the existing scene) ---- */ const councilGroup = new THREE.Group(); councilGroup.position.set(0,3.15,0); scene.add(councilGroup); const estateGroup = new THREE.Group(); scene.add(estateGroup); let councilNodes=[], estateNodes=[]; const ORIG_FOG = (scene.fog && scene.fog.density!=null) ? scene.fog.density : 0.020; function clearGroup(g){ while(g.children.length) g.remove(g.children[0]); } function buildCouncil(names){ clearGroup(councilGroup); councilNodes=[]; const n=Math.max(names.length,1), R=3.1; names.forEach((nm,i)=>{ const a=(i/n)*TAU, grp=new THREE.Group(); grp.position.set(Math.cos(a)*R, Math.sin(i*1.7)*0.35, Math.sin(a)*R); grp.add(new THREE.Mesh(new THREE.TetrahedronGeometry(0.22,0), new THREE.MeshStandardMaterial({color:COUNCIL_COL,emissive:COUNCIL_COL,emissiveIntensity:0.75,roughness:0.3,metalness:0.22}))); grp.add(glowSprite(COUNCIL_COL,1.35,0.5)); grp.userData={label:esc(nm), sub:'Ayllu · council', spin:0.5+Math.random()*0.6}; councilGroup.add(grp); councilNodes.push(grp); }); makeLabels(); } function buildEstate(){ clearGroup(estateGroup); estateNodes=[]; const n=ESTATE.length, R=13; ESTATE.forEach((e,i)=>{ const a=(i/n)*TAU, grp=new THREE.Group(); grp.position.set(Math.cos(a)*R, (i%2?1:-1)*(1.4+(i%3)*0.9), Math.sin(a)*R); grp.add(new THREE.Mesh(new THREE.BoxGeometry(0.62,0.62,0.62), new THREE.MeshStandardMaterial({color:e.col,emissive:e.col,emissiveIntensity:0.6,roughness:0.4,metalness:0.3,transparent:true,opacity:0.94}))); grp.add(glowSprite(e.col,2.1,0.34)); grp.userData={label:esc(e.id), sub:esc(e.kind)+' · declared', spin:0.3+Math.random()*0.4}; estateGroup.add(grp); estateNodes.push(grp); }); makeLabels(); } /* ---- own label layer (revealed only by the matching preset) ---- */ let labLayer=document.getElementById('v10-labels'); if(!labLayer){ labLayer=document.createElement('div'); labLayer.id='v10-labels'; labLayer.style.cssText='position:fixed;inset:0;pointer-events:none;z-index:40'; document.body.appendChild(labLayer); } let v10labels=[]; function makeLabels(){ labLayer.innerHTML=''; v10labels=[]; const add=(grp,kind)=>{ const d=document.createElement('div'); d.style.cssText='position:absolute;transform:translate(-50%,-150%);font:600 10px/1.3 ui-monospace,Menlo,monospace;'+ 'letter-spacing:.04em;white-space:nowrap;padding:2px 7px;border-radius:7px;opacity:0;transition:opacity .25s;'+ 'background:rgba(6,10,18,.72);border:1px solid rgba(120,140,180,.28)'; const col = kind==='council' ? '#c9adff' : '#ffd98a'; d.innerHTML=''+grp.userData.label+''+ ''+grp.userData.sub+''; labLayer.appendChild(d); v10labels.push({grp,div:d,kind}); }; councilNodes.forEach(g=>add(g,'council')); estateNodes.forEach(g=>add(g,'estate')); } const _wp=new THREE.Vector3(); function projectLabels(){ const w=innerWidth,h=innerHeight; v10labels.forEach(L=>{ const show=(mode==='council'&&L.kind==='council')||(mode==='estate'&&L.kind==='estate'); if(!show){ L.div.style.opacity='0'; return; } L.grp.getWorldPosition(_wp); _wp.project(camera); if(_wp.z>1){ L.div.style.opacity='0'; return; } const x=(_wp.x*0.5+0.5)*w, y=(-_wp.y*0.5+0.5)*h; if(x<0||x>w||y<44||y>h-84){ L.div.style.opacity='0'; return; } L.div.style.left=x+'px'; L.div.style.top=y+'px'; L.div.style.opacity='0.96'; }); } /* ---- zoom presets (reuse the existing custom camera + flyTo tween) ---- */ let mode='organism'; function setFog(d){ if(scene.fog && scene.fog.density!=null) scene.fog.density=d; } function goCouncil(){ mode='council'; intro.active=false; setFog(ORIG_FOG); flyTo(new THREE.Vector3(0,3.0,0), 7.5); setActive('council'); } function goOrganism(){ mode='organism'; setFog(ORIG_FOG); flyTo(HOME.target.clone(), HOME.r); setActive('organism'); } function goEstate(){ mode='estate'; intro.active=false; setFog(0.009); flyTo(new THREE.Vector3(0,0.3,0), 30); autoRotate=true; setActive('estate'); } /* ---- controls (injected into the existing #controls hud) ---- */ const controls=document.getElementById('controls'); const btns={}; function mkBtn(id,txt,title,fn){ const b=document.createElement('button'); b.className='btn'; b.id=id; b.textContent=txt; b.title=title; b.addEventListener('click',fn); if(controls)controls.appendChild(b); btns[id]=b; return b; } function setActive(m){ ['council','organism','estate'].forEach(k=>{ const b=btns['btn-v10-'+k]; if(b)b.classList.toggle('active',k===m); }); } mkBtn('btn-v10-council','◎ council','v10: zoom to the Ayllu council (live roster · /v1/ayllu/roster)',goCouncil); mkBtn('btn-v10-organism','◉ organism','v10: return to the organism (home view)',goOrganism); mkBtn('btn-v10-estate','⤢ estate','v10: zoom OUT to the whole estate — hardware & stack (declared)',goEstate); mkBtn('btn-v10-lens','▦ estate lens','v10: toggle the estate/council honesty panel',toggleLens); /* ---- honest estate lens panel ---- */ const panelEl=document.createElement('div'); panelEl.id='v10-panel'; panelEl.style.cssText='position:fixed;left:18px;bottom:74px;width:min(92vw,300px);z-index:41;'+ 'background:rgba(6,10,18,.85);border:1px solid rgba(120,140,180,.26);border-radius:12px;'+ 'padding:12px 14px;font:12px/1.5 ui-monospace,Menlo,monospace;color:#cdd6e6;display:none'; document.body.appendChild(panelEl); function toggleLens(){ const open=panelEl.style.display!=='none'; panelEl.style.display=open?'none':'block'; const b=btns['btn-v10-lens']; if(b)b.classList.toggle('active',!open); } function renderPanel(j, live){ const count = live ? (j && j.count!=null ? j.count : '—') : '3 (core · declared)'; const names = live ? ((j&&j.personas)||[]).map(p=>esc(p&&(p.name||p.id)||'')).filter(Boolean).join(' · ') : COUNCIL_FALLBACK.join(' · '); const chip = live ? '● live · a11oy' : 'offline · static snapshot'; const estateRows = ESTATE.map(e=>'
    '+ ''+esc(e.id)+''+esc(e.kind)+'
    ').join(''); panelEl.innerHTML= '
    ESTATE LENS · zoom-out
    '+ '
    COUNCIL — /v1/ayllu/roster
    '+ '
    personas'+esc(String(count))+'
    '+ '
    source'+chip+'
    '+ '
    '+(names||'—')+'
    '+ '
    LAB — PhysicsNeMo PINN '+ 'MEASURED
    '+ '
    rosie · RTX 5050 (Blackwell sm_120)
    '+ '
    PhysicsNeMo 2.1.1 · torch 2.12.1+cu130 · local snapshot (not live)
    '+ '
    ESTATE — hardware & stack
    '+ estateRows+ '
    estate nodes are declared (no live probe)
    '; } /* ---- live roster (read-only, CORS-allowed; graceful offline) ---- */ const BASE='https://szlholdings-a11oy.hf.space/api/a11oy'; async function pull(url,ms){ const ctl=(typeof AbortController!=='undefined')?new AbortController():null; const to=ctl?setTimeout(()=>{try{ctl.abort();}catch(e){}},ms||12000):null; try{ const r=await fetch(url,{method:'GET',mode:'cors',cache:'no-store',signal:ctl?ctl.signal:undefined}); if(to)clearTimeout(to); if(!r||!r.ok)return null; return await r.json(); }catch(e){ if(to)clearTimeout(to); return null; } } let _lastCouncilKey=null; function setCouncil(names){ // v10 polish: rebuild the ring ONLY when the roster actually changes (kills the 30s GPU/DOM churn) const key=names.join('\u241f'); if(key===_lastCouncilKey) return; _lastCouncilKey=key; buildCouncil(names); } async function pollRoster(){ const j=await pull(BASE+'/v1/ayllu/roster'); if(!j){ setCouncil(COUNCIL_FALLBACK); renderPanel(null,false); return; } let people=j.personas||j.roster||[]; if(!Array.isArray(people))people=[]; let names=people.map(p=>(p&&(p.name||p.persona||p.id))||String(p)).filter(Boolean); if(!names.length){ setCouncil(COUNCIL_FALLBACK); renderPanel(null,false); return; } // v10 polish/honesty: an EMPTY live roster is shown as declared snapshot, never fallback names under a "live" chip setCouncil(names); renderPanel(j,true); } function tick(dt,t){ councilGroup.rotation.y -= dt*0.12; councilNodes.forEach(g=>{ g.rotation.y += dt*g.userData.spin; g.rotation.x += dt*g.userData.spin*0.5; }); estateGroup.rotation.y += dt*0.04; estateNodes.forEach(g=>{ g.rotation.y += dt*0.2; }); projectLabels(); } /* ---- boot: honest declared state first, then upgrade live ---- */ setCouncil(COUNCIL_FALLBACK); buildEstate(); renderPanel(null,false); pollRoster(); setInterval(pollRoster, 30000); return { tick, api:{ mode:()=>mode, council:()=>councilNodes.length, estate:()=>estateNodes.length, goCouncil, goOrganism, goEstate } }; })(); /* ========================= /v10 estate/ayllu ===================== */ /* ---------------- test hooks for headless QA ---------------- */ window.__anatomy = { organs: organMeshes.length, vessels: vessels.length, pulses: pulses.length, heart: !!heartGroup, bodies: D.BODIES.map(b=>b.key), openOrgan: key=>{ const o=D.ORGANS.find(x=>x.key===key); if(o){openOrgan(o);return true;} return false; }, openGPD: ()=>{ openGPD(); return true; }, panelOpen: ()=>panel.classList.contains('open'), rev: (window.THREE&&THREE.REVISION)||null, v4: V4, // v4 dissection module handle (layers, clip, explode, search, hud, focus) v5: V5, // v4-deepen module handle (atlas, forecast, tour, labels, drill-down) v6: V6, // v6 yarqa flow-compartments layer (engineering method / CFD, NOT a locked theorem) v7: V7, // v5 quantum-bio layer (coherence + bioenergetic + Λ-v5 gate + compass; verified model, mirrors a11oy /qbio) v8: V8, // v8 live agentic lens (read-only reflection of a11oy's real agent loop; runDecisionFlow/pollVitals/onOrganOpen) v9: V9, // v9 fly-high (bloodstream particles, autonomous heartbeat loop, killinchu 2nd body, cinematic vital tour, agent trace, polish) v10: V10, // v10 estate/ayllu (live Ayllu council roster + declared hardware/stack estate shell + zoom presets) formulas: Object.keys(D.FORMULAS).length, tierCounts: (V5&&V5.api)?V5.api.tierCounts():null, qbio: (V7&&V7.api)?V7.api():null }; })(); /* ---- v10 deep-link: embedders can default the camera via #hash (or ?view=) — e.g. #estate = zoom-out to the whole estate. Additive & backward-compatible; unknown/empty values are ignored so the default organism (home) view stands. ---- */ (function(){ function currentView(){ var h=(location.hash||'').replace(/^#/,'').toLowerCase().trim(); if(!h){ try{ h=((new URLSearchParams(location.search)).get('view')||'').toLowerCase().trim(); }catch(e){ h=''; } } return h; } function applyView(v){ var A=(window.__anatomy&&window.__anatomy.v10&&window.__anatomy.v10.api)||null; if(!A) return false; if(v==='estate' && A.goEstate){ A.goEstate(); return true; } if(v==='council' && A.goCouncil){ A.goCouncil(); return true; } if(v==='organism' && A.goOrganism){ A.goOrganism(); return true; } return false; } var v0=currentView(); if(v0==='estate'||v0==='council'||v0==='organism'){ var tries=0; setTimeout(function go(){ if(applyView(v0)||tries++>=40) return; setTimeout(go,100); }, 300); } addEventListener('hashchange', function(){ applyView(currentView()); }); })();