Spaces:
Running
Running
deploy(hf): sync szl-holdings/a11oy@main derived COPY set
Browse filesReusable Dockerfile-COPY-derived deploy from szl-holdings/a11oy main.
Files: 1041 Pruned: 0
Derived from Dockerfile COPY sources (NO hand-maintained allowlist).
Signed-off-by: SZL Holdings <noreply@szlholdings.ai>
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
static/3d/holographic.html
CHANGED
|
@@ -332,6 +332,7 @@ const SURFACES = [
|
|
| 332 |
{ id: "brainlineage", cat: "brain", title: "Brain Lineage · node-origin chain · how each knowledge-graph node ENTERED the graph, read VERBATIM from its OWN real origin fields (source/url → structural derivation → none) → TRACED/PARTIAL-LINEAGE/UNKNOWN-ORIGIN, a node with no source is UNKNOWN-ORIGIN never a fabricated source, aggregate never TRACED while any origin UNKNOWN, unsigned SHA-256 receipt-on-write (node-origin lineage, NOT per-answer provenance, NOT build/model attestation)", mod: "/static/3d/surfaces/brainlineage.js" },
|
| 333 |
{ id: "brainexplain", cat: "brain", title: "Brain Explain · transparent explanation of WHY the brain retrieved what it did · MODELED descriptive trace over the REAL retrieval subgraph (which query terms matched which seed nodes, per-node ppr-vs-salience rationale, communities traversed, each node's OWN label VERBATIM) → EXPLAINABLE/PARTIALLY-EXPLAINABLE/OPAQUE (never invents a rationale; honest OPAQUE beats a fake one), unsigned SHA-256 receipt-on-write", mod: "/static/3d/surfaces/brainexplain.js" },
|
| 334 |
{ id: "braingaps", cat: "brain", title: "Brain Gaps · an honest map of what the brain does NOT know · MEASURED thin (sparse) communities + weakly-connected island nodes (degree≤1) + weak-label share over the live graph, and per-query COVERED/THIN/GAP grounding → estate verdict WELL-COVERED/PATCHY/SPARSE (a GAP is never fabricated into coverage), unsigned SHA-256 receipt-on-write (MODELED)", mod: "/static/3d/surfaces/braingaps.js" },
|
|
|
|
| 335 |
];
|
| 336 |
|
| 337 |
const stageEl = document.getElementById("stage");
|
|
|
|
| 332 |
{ id: "brainlineage", cat: "brain", title: "Brain Lineage · node-origin chain · how each knowledge-graph node ENTERED the graph, read VERBATIM from its OWN real origin fields (source/url → structural derivation → none) → TRACED/PARTIAL-LINEAGE/UNKNOWN-ORIGIN, a node with no source is UNKNOWN-ORIGIN never a fabricated source, aggregate never TRACED while any origin UNKNOWN, unsigned SHA-256 receipt-on-write (node-origin lineage, NOT per-answer provenance, NOT build/model attestation)", mod: "/static/3d/surfaces/brainlineage.js" },
|
| 333 |
{ id: "brainexplain", cat: "brain", title: "Brain Explain · transparent explanation of WHY the brain retrieved what it did · MODELED descriptive trace over the REAL retrieval subgraph (which query terms matched which seed nodes, per-node ppr-vs-salience rationale, communities traversed, each node's OWN label VERBATIM) → EXPLAINABLE/PARTIALLY-EXPLAINABLE/OPAQUE (never invents a rationale; honest OPAQUE beats a fake one), unsigned SHA-256 receipt-on-write", mod: "/static/3d/surfaces/brainexplain.js" },
|
| 334 |
{ id: "braingaps", cat: "brain", title: "Brain Gaps · an honest map of what the brain does NOT know · MEASURED thin (sparse) communities + weakly-connected island nodes (degree≤1) + weak-label share over the live graph, and per-query COVERED/THIN/GAP grounding → estate verdict WELL-COVERED/PATCHY/SPARSE (a GAP is never fabricated into coverage), unsigned SHA-256 receipt-on-write (MODELED)", mod: "/static/3d/surfaces/braingaps.js" },
|
| 335 |
+
{ id: "brainconstitution", cat: "brain", title: "Brain Constitution · the honest, machine-checkable ruleset the brain is graded against per query · an explicit ordered set of ARTICLES (grounding sufficiency, calibrated confidence, honest corroboration, contradictions surfaced, traceable to source, freshness honesty, coverage gaps admitted, doctrine invariants) each graded COMPLIANT/VIOLATED/UNAVAILABLE against whatever sibling brain-honesty surfaces are importable (an absent surface is UNAVAILABLE, never a fabricated pass) → CONSTITUTIONAL/IN-VIOLATION/INSUFFICIENT-SIGNAL, never CONSTITUTIONAL while any evaluable Article is VIOLATED, unsigned SHA-256 receipt-on-write (MODELED)", mod: "/static/3d/surfaces/brainconstitution.js" },
|
| 336 |
];
|
| 337 |
|
| 338 |
const stageEl = document.getElementById("stage");
|
static/3d/surf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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
// SPDX-License-Identifier: Apache-2.0
|
| 2 |
+
// © 2026 Lutar, Stephen P. — SZL Holdings · ORCID 0009-0001-0110-4173 · Doctrine v11
|
| 3 |
+
//
|
| 4 |
+
// surfaces/brainconstitution.js — BRAIN CONSTITUTION · the honest ruleset the brain is graded
|
| 5 |
+
// against on every query. The capstone over the brain-honesty surfaces: it renders an explicit
|
| 6 |
+
// ARTICLE ring — one PILLAR per Article the brain must honour (grounding sufficiency, calibrated
|
| 7 |
+
// confidence, honest corroboration, contradictions surfaced, traceable to source, freshness
|
| 8 |
+
// honesty, coverage gaps admitted, doctrine invariants) — and grades each COMPLIANT / VIOLATED /
|
| 9 |
+
// UNAVAILABLE. A CORE orb carries the overall verdict CONSTITUTIONAL / IN-VIOLATION /
|
| 10 |
+
// INSUFFICIENT-SIGNAL. Pure knowledge-graph honesty/governance; it advances NO detection / fusion
|
| 11 |
+
// / effector / targeting / cueing capability.
|
| 12 |
+
//
|
| 13 |
+
// A VIOLATED Article is drawn plainly (violet), never dressed up as compliance; an UNAVAILABLE
|
| 14 |
+
// Article (its sibling surface not importable this request) reads grey, never a fabricated pass.
|
| 15 |
+
// The core is NEVER teal ("CONSTITUTIONAL") while any pillar is violet ("VIOLATED").
|
| 16 |
+
//
|
| 17 |
+
// DATA: live snapshot from GET /api/a11oy/v1/brain/constitution (PURE READ, mints nothing):
|
| 18 |
+
// ok, label (MODELED), verdict, modeled_compliance,
|
| 19 |
+
// articles[]{ article, title, result (COMPLIANT|VIOLATED|UNAVAILABLE), evaluable },
|
| 20 |
+
// summary{ articles_total, articles_evaluable, compliant, violated, unavailable,
|
| 21 |
+
// violated_articles, min_articles_required },
|
| 22 |
+
// doctrine{ locked_proven, lambda, trust_ceiling }.
|
| 23 |
+
//
|
| 24 |
+
// HONESTY LABEL: MODELED — this surface's own top label is MODELED (a derived compliance verdict,
|
| 25 |
+
// not a measurement). The per-Article results it renders are read VERBATIM; no compliance is
|
| 26 |
+
// fabricated — a VIOLATED Article is drawn as a violation, an UNAVAILABLE one as grey. No green
|
| 27 |
+
// "1.0 / VERIFIED" state. Trust ceiling 0.97, never 100%.
|
| 28 |
+
// COLOURS (approved palette only, no green): proof-teal 0x3af4c8 (CONSTITUTIONAL / COMPLIANT),
|
| 29 |
+
// lattice-blue 0x5b8dee (INSUFFICIENT-SIGNAL / frame), violet-blue 0x8a6bff (IN-VIOLATION /
|
| 30 |
+
// VIOLATED), grey 0x42505d (UNAVAILABLE / init). No amber, no crimson, no other purple.
|
| 31 |
+
// 0 RUNTIME CDN. Vendored three.js via page importmap (ctx.THREE).
|
| 32 |
+
// DOCTRINE v11: OBSERVES only — adds NOTHING to the locked-8 {F1,F4,F7,F11,F12,F18,F19,F22} @
|
| 33 |
+
// c7c0ba17; Λ stays Conjecture 1; introduces no theorem. Degrades grey on 404/error.
|
| 34 |
+
|
| 35 |
+
import { createShowcase } from "./_showcase.js";
|
| 36 |
+
|
| 37 |
+
const ID = "brainconstitution";
|
| 38 |
+
const TITLE = "Brain Constitution · the honest ruleset the brain is graded against (live)";
|
| 39 |
+
|
| 40 |
+
// same-origin, relative — no CDN, no cross-origin fetch. PURE-READ compliance endpoint.
|
| 41 |
+
const EP = "/api/a11oy/v1/brain/constitution";
|
| 42 |
+
|
| 43 |
+
// verdict / result hues — approved palette only, no green
|
| 44 |
+
const C_OK = 0x3af4c8; // proof-teal — CONSTITUTIONAL / COMPLIANT
|
| 45 |
+
const C_MID = 0x5b8dee; // lattice-blue — INSUFFICIENT-SIGNAL / frame
|
| 46 |
+
const C_VIOL = 0x8a6bff; // violet-blue — IN-VIOLATION / VIOLATED
|
| 47 |
+
const C_NEUTRAL = 0x42505d; // grey — UNAVAILABLE / init
|
| 48 |
+
const C_GRID = 0x1b3a44; // floor colour
|
| 49 |
+
|
| 50 |
+
// overall verdict -> core colour
|
| 51 |
+
function _verdictColor(v) {
|
| 52 |
+
const s = String(v || "").toUpperCase();
|
| 53 |
+
if (s === "CONSTITUTIONAL") return C_OK;
|
| 54 |
+
if (s === "IN-VIOLATION") return C_VIOL;
|
| 55 |
+
if (s === "INSUFFICIENT-SIGNAL") return C_MID;
|
| 56 |
+
return C_NEUTRAL; // init / unknown
|
| 57 |
+
}
|
| 58 |
+
// per-Article result -> pillar colour (VERBATIM; a violation is never softened to compliance)
|
| 59 |
+
function _resultColor(r) {
|
| 60 |
+
const s = String(r || "").toUpperCase();
|
| 61 |
+
if (s === "COMPLIANT") return C_OK;
|
| 62 |
+
if (s === "VIOLATED") return C_VIOL;
|
| 63 |
+
if (s === "UNAVAILABLE") return C_NEUTRAL;
|
| 64 |
+
return C_NEUTRAL;
|
| 65 |
+
}
|
| 66 |
+
|
| 67 |
+
let _stage = null, _THREE = null, _ctx = null, _group = null, _show = null;
|
| 68 |
+
let _frameReg = false, _polls = [], _el = {}, _badge = null, _plain = false;
|
| 69 |
+
|
| 70 |
+
let _core = null; // THREE.Mesh — the verdict core orb
|
| 71 |
+
let _pillars = []; // Array<{ mesh, n, result }>
|
| 72 |
+
let _spin = 0;
|
| 73 |
+
|
| 74 |
+
// live state (all read from JSON; nothing invented)
|
| 75 |
+
const S = {
|
| 76 |
+
label: null, // top honesty label VERBATIM (MODELED)
|
| 77 |
+
verdict: null, // CONSTITUTIONAL | IN-VIOLATION | INSUFFICIENT-SIGNAL
|
| 78 |
+
compliance: null, // MODELED ratio in [0,0.97], never MEASURED, never 1.0
|
| 79 |
+
total: null,
|
| 80 |
+
evaluable: null,
|
| 81 |
+
compliant: null,
|
| 82 |
+
violated: null,
|
| 83 |
+
unavailable: null,
|
| 84 |
+
violatedArts: [],
|
| 85 |
+
minReq: null,
|
| 86 |
+
articles: [], // [{ n, result }]
|
| 87 |
+
trustCeil: null,
|
| 88 |
+
lambda: null,
|
| 89 |
+
locked: null,
|
| 90 |
+
state: "init",
|
| 91 |
+
};
|
| 92 |
+
|
| 93 |
+
// =============================================================================
|
| 94 |
+
export function mount(ctx) {
|
| 95 |
+
_ctx = ctx; _stage = ctx.stage; _THREE = ctx.THREE;
|
| 96 |
+
_group = new _THREE.Group();
|
| 97 |
+
_stage.scene.add(_group);
|
| 98 |
+
_stage.camera.position.set(0, 5.0, 18);
|
| 99 |
+
try { if (_stage.controls && _stage.controls.target) { _stage.controls.target.set(0, 2.2, 0); _stage.controls.update(); } } catch (_) {}
|
| 100 |
+
try { _stage.setBloom(true); } catch (_) {}
|
| 101 |
+
|
| 102 |
+
_buildFloor();
|
| 103 |
+
_buildCore();
|
| 104 |
+
|
| 105 |
+
if (!_frameReg) { _stage.onFrame(_onFrame); _frameReg = true; }
|
| 106 |
+
|
| 107 |
+
_badge = ctx.live.createBadge();
|
| 108 |
+
_polls.push(ctx.live.poll(EP, 8000, _onData, {
|
| 109 |
+
badge: _badge, onState: (m) => { S.state = m.state; _paintOverlay(); _paintCore(); },
|
| 110 |
+
}));
|
| 111 |
+
|
| 112 |
+
_buildOverlay();
|
| 113 |
+
return { id: ID, started: true };
|
| 114 |
+
}
|
| 115 |
+
|
| 116 |
+
// =============================================================================
|
| 117 |
+
function _buildFloor() {
|
| 118 |
+
const THREE = _THREE;
|
| 119 |
+
const grid = new THREE.GridHelper(40, 40, C_GRID, 0x0f2027);
|
| 120 |
+
grid.material.opacity = 0.16; grid.material.transparent = true; grid.position.y = -0.01;
|
| 121 |
+
_group.add(grid);
|
| 122 |
+
}
|
| 123 |
+
|
| 124 |
+
function _buildCore() {
|
| 125 |
+
const THREE = _THREE;
|
| 126 |
+
const g = new THREE.IcosahedronGeometry(1.5, 1);
|
| 127 |
+
_core = new THREE.Mesh(g, new THREE.MeshStandardMaterial({
|
| 128 |
+
color: C_NEUTRAL, emissive: C_NEUTRAL, emissiveIntensity: 0.35,
|
| 129 |
+
transparent: true, opacity: 0.9, flatShading: true,
|
| 130 |
+
}));
|
| 131 |
+
_core.position.set(0, 4.6, 0);
|
| 132 |
+
_group.add(_core);
|
| 133 |
+
|
| 134 |
+
// lattice ring beneath the core (the constitution base rail)
|
| 135 |
+
const pts = [];
|
| 136 |
+
const R = 5.6;
|
| 137 |
+
for (let i = 0; i <= 64; i++) {
|
| 138 |
+
const a = (i / 64) * Math.PI * 2;
|
| 139 |
+
pts.push(new THREE.Vector3(Math.cos(a) * R, 0.02, Math.sin(a) * R));
|
| 140 |
+
}
|
| 141 |
+
const rg = new THREE.BufferGeometry().setFromPoints(pts);
|
| 142 |
+
const ring = new THREE.Line(rg, new THREE.LineBasicMaterial({
|
| 143 |
+
color: C_MID, transparent: true, opacity: 0.4,
|
| 144 |
+
}));
|
| 145 |
+
_group.add(ring);
|
| 146 |
+
}
|
| 147 |
+
|
| 148 |
+
// Build (or rebuild) one PILLAR per Article, in a ring; colour by the VERBATIM per-Article result,
|
| 149 |
+
// height a fixed governance column (an Article is a rule, not a magnitude). Called on each live
|
| 150 |
+
// snapshot so the ring always mirrors the CURRENT feed (never a hard-coded Article set).
|
| 151 |
+
function _buildPillars() {
|
| 152 |
+
const THREE = _THREE;
|
| 153 |
+
_disposePillars();
|
| 154 |
+
|
| 155 |
+
const arts = Array.isArray(S.articles) ? S.articles : [];
|
| 156 |
+
const n = arts.length;
|
| 157 |
+
if (!n) return;
|
| 158 |
+
const R = 5.0;
|
| 159 |
+
const geo = new THREE.BoxGeometry(0.8, 1.0, 0.8);
|
| 160 |
+
|
| 161 |
+
for (let i = 0; i < n; i++) {
|
| 162 |
+
const art = arts[i];
|
| 163 |
+
const result = String(art.result || "").toUpperCase();
|
| 164 |
+
const color = _resultColor(result);
|
| 165 |
+
// VIOLATED pillars stand tallest (they must not hide); UNAVAILABLE are short stubs (honest).
|
| 166 |
+
const h = result === "VIOLATED" ? 4.6 : (result === "COMPLIANT" ? 3.4 : 1.2);
|
| 167 |
+
const a = (i / n) * Math.PI * 2;
|
| 168 |
+
const x = Math.cos(a) * R, z = Math.sin(a) * R;
|
| 169 |
+
|
| 170 |
+
const mesh = new THREE.Mesh(geo, new THREE.MeshStandardMaterial({
|
| 171 |
+
color, emissive: color, emissiveIntensity: 0.26,
|
| 172 |
+
transparent: true, opacity: result === "UNAVAILABLE" ? 0.42 : 0.92,
|
| 173 |
+
}));
|
| 174 |
+
mesh.scale.y = h;
|
| 175 |
+
mesh.position.set(x, h / 2, z);
|
| 176 |
+
_group.add(mesh);
|
| 177 |
+
|
| 178 |
+
_pillars.push({ mesh, n: art.n, result });
|
| 179 |
+
}
|
| 180 |
+
}
|
| 181 |
+
|
| 182 |
+
function _disposePillars() {
|
| 183 |
+
const rm = (o) => {
|
| 184 |
+
if (!o) return;
|
| 185 |
+
try {
|
| 186 |
+
if (o.geometry && o.geometry.dispose) o.geometry.dispose();
|
| 187 |
+
if (o.material) { const ms = Array.isArray(o.material) ? o.material : [o.material]; ms.forEach((m) => m.dispose && m.dispose()); }
|
| 188 |
+
if (_group) _group.remove(o);
|
| 189 |
+
} catch (_) {}
|
| 190 |
+
};
|
| 191 |
+
_pillars.forEach((p) => rm(p.mesh));
|
| 192 |
+
_pillars = [];
|
| 193 |
+
}
|
| 194 |
+
|
| 195 |
+
// =============================================================================
|
| 196 |
+
// live data handler — read VERBATIM, never upgrade, never fabricate compliance
|
| 197 |
+
// =============================================================================
|
| 198 |
+
function _onData(j) {
|
| 199 |
+
// Top honesty label VERBATIM; absent live data this surface is MODELED (a derived verdict).
|
| 200 |
+
S.label = (j && j.label ? String(j.label) : "MODELED").toUpperCase();
|
| 201 |
+
S.verdict = j && j.verdict ? String(j.verdict).toUpperCase() : null;
|
| 202 |
+
S.compliance = (j && typeof j.modeled_compliance === "number") ? j.modeled_compliance : null;
|
| 203 |
+
|
| 204 |
+
const sm = (j && j.summary) || {};
|
| 205 |
+
S.total = typeof sm.articles_total === "number" ? sm.articles_total : null;
|
| 206 |
+
S.evaluable = typeof sm.articles_evaluable === "number" ? sm.articles_evaluable : null;
|
| 207 |
+
S.compliant = typeof sm.compliant === "number" ? sm.compliant : null;
|
| 208 |
+
S.violated = typeof sm.violated === "number" ? sm.violated : null;
|
| 209 |
+
S.unavailable = typeof sm.unavailable === "number" ? sm.unavailable : null;
|
| 210 |
+
S.violatedArts = Array.isArray(sm.violated_articles) ? sm.violated_articles : [];
|
| 211 |
+
S.minReq = typeof sm.min_articles_required === "number" ? sm.min_articles_required : null;
|
| 212 |
+
|
| 213 |
+
const arts = Array.isArray(j && j.articles) ? j.articles : [];
|
| 214 |
+
S.articles = arts.map((a) => ({
|
| 215 |
+
n: typeof a.article === "number" ? a.article : null,
|
| 216 |
+
result: a && a.result ? String(a.result).toUpperCase() : "UNAVAILABLE",
|
| 217 |
+
}));
|
| 218 |
+
|
| 219 |
+
const d = (j && j.doctrine) || {};
|
| 220 |
+
S.trustCeil = typeof d.trust_ceiling === "number" ? d.trust_ceiling : null;
|
| 221 |
+
S.lambda = typeof d.lambda === "string" ? d.lambda : null;
|
| 222 |
+
S.locked = typeof d.locked_proven === "number" ? d.locked_proven : null;
|
| 223 |
+
|
| 224 |
+
_buildPillars();
|
| 225 |
+
_paintCore();
|
| 226 |
+
_paintOverlay();
|
| 227 |
+
}
|
| 228 |
+
|
| 229 |
+
// =============================================================================
|
| 230 |
+
function _onFrame() {
|
| 231 |
+
const t = performance.now();
|
| 232 |
+
if (_group) _group.rotation.y = Math.sin(t * 0.00005) * 0.08;
|
| 233 |
+
|
| 234 |
+
const live = S.state === "live";
|
| 235 |
+
if (_core) {
|
| 236 |
+
_core.rotation.y += 0.004; _core.rotation.x += 0.0015;
|
| 237 |
+
const pulse = 0.35 + (live ? 0.25 : 0.08) * (0.5 + 0.5 * Math.sin(t * 0.003));
|
| 238 |
+
_core.material.emissiveIntensity = pulse;
|
| 239 |
+
}
|
| 240 |
+
if (_pillars.length) {
|
| 241 |
+
_spin = (t * 0.0002) % 1;
|
| 242 |
+
const lead = Math.floor(_spin * _pillars.length);
|
| 243 |
+
for (let i = 0; i < _pillars.length; i++) {
|
| 244 |
+
const p = _pillars[i];
|
| 245 |
+
const near = i === lead;
|
| 246 |
+
// a VIOLATED pillar always glows hot (a violation must never hide); others follow the sweep.
|
| 247 |
+
const viol = p.result === "VIOLATED";
|
| 248 |
+
const base = viol ? 0.6 : (p.result === "COMPLIANT" && live ? 0.26 : 0.12);
|
| 249 |
+
p.mesh.material.emissiveIntensity = (near && live) ? Math.max(base, 0.85) : base;
|
| 250 |
+
}
|
| 251 |
+
}
|
| 252 |
+
}
|
| 253 |
+
|
| 254 |
+
// =============================================================================
|
| 255 |
+
function _paintCore() {
|
| 256 |
+
if (!_core) return;
|
| 257 |
+
const col = (S.state === "live") ? _verdictColor(S.verdict) : C_NEUTRAL;
|
| 258 |
+
_core.material.color.setHex(col);
|
| 259 |
+
_core.material.emissive.setHex(col);
|
| 260 |
+
}
|
| 261 |
+
|
| 262 |
+
// =============================================================================
|
| 263 |
+
// overlay (HUD)
|
| 264 |
+
// =============================================================================
|
| 265 |
+
function _buildOverlay() {
|
| 266 |
+
const ctx = _ctx;
|
| 267 |
+
_show = createShowcase(ctx, {
|
| 268 |
+
id: ID, title: TITLE, accent: "#5b8dee", badge: _badge,
|
| 269 |
+
chips: [{ label: "MODELED", text: "compliance", name: "lbl" },
|
| 270 |
+
{ label: "—", text: "verdict", name: "vrd" }],
|
| 271 |
+
legend: ["MODELED"],
|
| 272 |
+
});
|
| 273 |
+
const host = _show.body;
|
| 274 |
+
|
| 275 |
+
const sub = document.createElement("div");
|
| 276 |
+
sub.style.cssText = "color:#9fb1bf;font-size:11px;line-height:1.55";
|
| 277 |
+
sub.innerHTML =
|
| 278 |
+
'The brain’s explicit, machine-checkable <b>constitution</b>: an ordered set of ' +
|
| 279 |
+
'<b>ARTICLES</b> it must honour on every query — never answer when grounding is ' +
|
| 280 |
+
'insufficient, never claim confident when uncertainty is high, disclose single-source claims, ' +
|
| 281 |
+
'surface contradictions, keep every answer traceable, flag stale knowledge, admit coverage ' +
|
| 282 |
+
'gaps, and keep the doctrine invariants (Λ stays Conjecture 1, locked-8, trust 0.97). ' +
|
| 283 |
+
'Each Article is graded <b>COMPLIANT / VIOLATED / UNAVAILABLE</b> against whatever sibling ' +
|
| 284 |
+
'honesty surfaces are importable; an absent surface reads <b>UNAVAILABLE</b>, never a ' +
|
| 285 |
+
'fabricated pass. The estate is <b>never CONSTITUTIONAL while any evaluable Article is ' +
|
| 286 |
+
'VIOLATED</b>. Strictly knowledge-graph honesty/governance. 0 runtime CDN.';
|
| 287 |
+
host.appendChild(sub);
|
| 288 |
+
|
| 289 |
+
const card = document.createElement("div");
|
| 290 |
+
card.style.cssText = "background:#0a1117;border:1px solid #1d2a36;border-radius:9px;padding:9px 10px;display:flex;flex-direction:column;gap:6px";
|
| 291 |
+
|
| 292 |
+
const grid = document.createElement("div");
|
| 293 |
+
grid.style.cssText = "display:grid;grid-template-columns:1fr;gap:4px";
|
| 294 |
+
function kpiRow(id, label) {
|
| 295 |
+
const r = document.createElement("div");
|
| 296 |
+
r.style.cssText = "display:flex;justify-content:space-between;gap:10px;font-size:11px";
|
| 297 |
+
const l = document.createElement("span"); l.style.cssText = "color:#9fb1bf"; l.textContent = label;
|
| 298 |
+
const v = document.createElement("b");
|
| 299 |
+
v.id = id;
|
| 300 |
+
v.style.cssText = "font-variant-numeric:tabular-nums;color:#eef3f6;text-align:right;max-width:62%;overflow-wrap:anywhere";
|
| 301 |
+
v.textContent = "—";
|
| 302 |
+
_el[id] = v;
|
| 303 |
+
r.appendChild(l); r.appendChild(v); return r;
|
| 304 |
+
}
|
| 305 |
+
grid.appendChild(kpiRow("bc-verdict", "verdict"));
|
| 306 |
+
grid.appendChild(kpiRow("bc-compl", "modeled compliance"));
|
| 307 |
+
grid.appendChild(kpiRow("bc-articles", "articles (evaluable/total)"));
|
| 308 |
+
grid.appendChild(kpiRow("bc-ok", "compliant"));
|
| 309 |
+
grid.appendChild(kpiRow("bc-viol", "violated"));
|
| 310 |
+
grid.appendChild(kpiRow("bc-unavail", "unavailable"));
|
| 311 |
+
grid.appendChild(kpiRow("bc-violarts", "violated articles"));
|
| 312 |
+
grid.appendChild(kpiRow("bc-locked", "locked proofs"));
|
| 313 |
+
grid.appendChild(kpiRow("bc-ceil", "trust ceiling"));
|
| 314 |
+
grid.appendChild(kpiRow("bc-lambda", "Λ"));
|
| 315 |
+
card.appendChild(grid);
|
| 316 |
+
host.appendChild(card);
|
| 317 |
+
|
| 318 |
+
const leg = document.createElement("div");
|
| 319 |
+
leg.style.cssText = "font-size:9.5px;color:#6b7a86;line-height:1.6";
|
| 320 |
+
leg.innerHTML =
|
| 321 |
+
'<span style="color:#3af4c8">■</span> CONSTITUTIONAL / COMPLIANT ' +
|
| 322 |
+
'<span style="color:#5b8dee">■</span> INSUFFICIENT-SIGNAL ' +
|
| 323 |
+
'<span style="color:#8a6bff">■</span> IN-VIOLATION / VIOLATED ' +
|
| 324 |
+
'<span style="color:#8494a1">■</span> UNAVAILABLE. ' +
|
| 325 |
+
'MODELED · per-Article results read verbatim · compliance is never fabricated (a VIOLATION is a VIOLATION).';
|
| 326 |
+
card.appendChild(leg);
|
| 327 |
+
|
| 328 |
+
const pl = document.createElement("button");
|
| 329 |
+
pl.textContent = "◑ what this means";
|
| 330 |
+
pl.title = "Toggle plain-language explanation for investors & consumers.";
|
| 331 |
+
pl.style.cssText = "font:11px ui-monospace,monospace;padding:5px 11px;border-radius:7px;border:1px solid #3af4c8;background:#08140f;color:#3af4c8;cursor:pointer;width:fit-content";
|
| 332 |
+
pl.addEventListener("click", () => {
|
| 333 |
+
_plain = !_plain;
|
| 334 |
+
pl.style.background = _plain ? "#0f2a20" : "#08140f";
|
| 335 |
+
_applyPlain();
|
| 336 |
+
});
|
| 337 |
+
host.appendChild(pl);
|
| 338 |
+
|
| 339 |
+
const pd = document.createElement("div");
|
| 340 |
+
pd.id = "bc-plain";
|
| 341 |
+
pd.style.cssText = "font-size:10.5px;color:#c9d6df;line-height:1.55;border:1px dashed #26333f;border-radius:7px;padding:7px 9px;display:none";
|
| 342 |
+
_el["plain"] = pd;
|
| 343 |
+
host.appendChild(pd);
|
| 344 |
+
|
| 345 |
+
_paintOverlay();
|
| 346 |
+
}
|
| 347 |
+
|
| 348 |
+
function _applyPlain() {
|
| 349 |
+
const pd = _el["plain"];
|
| 350 |
+
if (!pd) return;
|
| 351 |
+
pd.style.display = _plain ? "block" : "none";
|
| 352 |
+
if (!_plain) return;
|
| 353 |
+
pd.innerHTML =
|
| 354 |
+
"<b>What this means:</b> the brain has a written <b>rulebook</b> — a constitution — " +
|
| 355 |
+
"and this surface grades it against that rulebook on every question. The rules are common " +
|
| 356 |
+
"sense: don’t answer if you don’t really know, don’t sound sure when you " +
|
| 357 |
+
"aren’t, say when a claim rests on a single source, surface disagreements instead of " +
|
| 358 |
+
"quietly picking a side, keep every answer traceable to where it came from, flag stale facts, " +
|
| 359 |
+
"and admit what it doesn’t cover. Each rule comes back <b>COMPLIANT</b>, <b>VIOLATED</b>, " +
|
| 360 |
+
"or <b>UNAVAILABLE</b> (the checker for that rule isn’t wired in this build — shown " +
|
| 361 |
+
"honestly, never faked as a pass). If <b>any</b> rule is broken, the whole thing reads " +
|
| 362 |
+
"<b>IN-VIOLATION</b> — it will never call itself compliant while a rule is broken. No " +
|
| 363 |
+
"“verified / 1.0” state; confidence is capped at 0.97, never 100%.";
|
| 364 |
+
}
|
| 365 |
+
|
| 366 |
+
function _tok(s) {
|
| 367 |
+
if (s === "live") return null;
|
| 368 |
+
if (s === "missing") return "NO-LIVE-DATA";
|
| 369 |
+
if (s === "degraded") return "DEGRADED";
|
| 370 |
+
if (s === "error") return "OFFLINE";
|
| 371 |
+
return "…";
|
| 372 |
+
}
|
| 373 |
+
function _set(id, v) { if (_el[id]) _el[id].textContent = v; }
|
| 374 |
+
function _n(v) { return v == null ? "—" : String(v); }
|
| 375 |
+
|
| 376 |
+
function _paintOverlay() {
|
| 377 |
+
const t = _tok(S.state);
|
| 378 |
+
const headline = t || (S.verdict || "—");
|
| 379 |
+
if (_show) {
|
| 380 |
+
_show.setChip("lbl", S.label || "MODELED", { text: "compliance" });
|
| 381 |
+
_show.setChip("vrd", headline, { text: "verdict" });
|
| 382 |
+
}
|
| 383 |
+
_set("bc-verdict", t || (S.verdict || "—"));
|
| 384 |
+
_set("bc-compl", t || (S.compliance != null ? String(S.compliance) : "—"));
|
| 385 |
+
_set("bc-articles", t || (S.evaluable != null && S.total != null
|
| 386 |
+
? S.evaluable + " / " + S.total : _n(S.total)));
|
| 387 |
+
_set("bc-ok", t || _n(S.compliant));
|
| 388 |
+
_set("bc-viol", t || _n(S.violated));
|
| 389 |
+
_set("bc-unavail", t || _n(S.unavailable));
|
| 390 |
+
_set("bc-violarts", t || (S.violatedArts && S.violatedArts.length
|
| 391 |
+
? S.violatedArts.map((n) => "Art" + n).join(", ") : "none"));
|
| 392 |
+
_set("bc-locked", t || (S.locked != null ? String(S.locked) : "—"));
|
| 393 |
+
_set("bc-ceil", t || (S.trustCeil != null ? String(S.trustCeil) : "—"));
|
| 394 |
+
_set("bc-lambda", t || (S.lambda || "—"));
|
| 395 |
+
if (_plain) _applyPlain();
|
| 396 |
+
}
|
| 397 |
+
|
| 398 |
+
// =============================================================================
|
| 399 |
+
export function unmount() {
|
| 400 |
+
_polls.forEach((p) => { try { p.stop(); } catch (_) {} }); _polls = [];
|
| 401 |
+
try { if (_show) _show.destroy(); } catch (_) {}
|
| 402 |
+
try {
|
| 403 |
+
_disposePillars();
|
| 404 |
+
if (_group && _stage) {
|
| 405 |
+
_group.traverse((o) => {
|
| 406 |
+
if (o.geometry && o.geometry.dispose) o.geometry.dispose();
|
| 407 |
+
if (o.material) {
|
| 408 |
+
const ms = Array.isArray(o.material) ? o.material : [o.material];
|
| 409 |
+
ms.forEach((mm) => { if (mm.dispose) mm.dispose(); });
|
| 410 |
+
}
|
| 411 |
+
});
|
| 412 |
+
_stage.scene.remove(_group);
|
| 413 |
+
}
|
| 414 |
+
} catch (_) {}
|
| 415 |
+
_group = _show = null;
|
| 416 |
+
_core = null; _pillars = [];
|
| 417 |
+
_el = {}; _badge = null; _plain = false; _frameReg = false; _spin = 0;
|
| 418 |
+
_stage = _THREE = _ctx = null;
|
| 419 |
+
S.label = S.verdict = S.compliance = null;
|
| 420 |
+
S.total = S.evaluable = S.compliant = S.violated = S.unavailable = null;
|
| 421 |
+
S.violatedArts = []; S.minReq = null; S.articles = [];
|
| 422 |
+
S.trustCeil = S.lambda = S.locked = null; S.state = "init";
|
| 423 |
+
}
|
| 424 |
+
|
| 425 |
+
export default { id: ID, title: TITLE, endpoints: [EP], mount, unmount };
|