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: 1015 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 +1 -0
- static/3d/surfaces/brainground.js +400 -0
static/3d/holographic.html
CHANGED
|
@@ -320,6 +320,7 @@ const SURFACES = [
|
|
| 320 |
{ id: "whatsnew", cat: "brain", title: "What's New · honest auto-derived estate changelog · recently-added surfaces w/ verbatim labels + citations from real git history (drift-proof)", mod: "/static/3d/surfaces/whatsnew.js" },
|
| 321 |
{ id: "honestywall", cat: "governance", title: "Honesty Wall · live integrity aggregation · reads each surface's OWN honest label VERBATIM + estate honesty invariants → INTACT/DEGRADED/VIOLATED verdict, unsigned SHA-256 receipt-on-write (drift-proof)", mod: "/static/3d/surfaces/honestywall.js" },
|
| 322 |
{ id: "agentos", cat: "governance", flag: true, title: "Agent OS Map · live self-honest operator's-eye map of the agent OS · nodes (daily loop←agentops, trust ledger←anatomy+receipts+honestywall, standing goals←doctrine+locked-8, optional loops←governedagent/governedrag/loopforge/mesh) with LIVE per-node verdict from the honestywall aggregate → OPERATING/DEGRADED/HALTED-HONEST, never OPERATING if anything VIOLATED, unsigned SHA-256 receipt-on-write (drift-proof)", mod: "/static/3d/surfaces/agentos.js" },
|
|
|
|
| 323 |
];
|
| 324 |
|
| 325 |
const stageEl = document.getElementById("stage");
|
|
|
|
| 320 |
{ id: "whatsnew", cat: "brain", title: "What's New · honest auto-derived estate changelog · recently-added surfaces w/ verbatim labels + citations from real git history (drift-proof)", mod: "/static/3d/surfaces/whatsnew.js" },
|
| 321 |
{ id: "honestywall", cat: "governance", title: "Honesty Wall · live integrity aggregation · reads each surface's OWN honest label VERBATIM + estate honesty invariants → INTACT/DEGRADED/VIOLATED verdict, unsigned SHA-256 receipt-on-write (drift-proof)", mod: "/static/3d/surfaces/honestywall.js" },
|
| 322 |
{ id: "agentos", cat: "governance", flag: true, title: "Agent OS Map · live self-honest operator's-eye map of the agent OS · nodes (daily loop←agentops, trust ledger←anatomy+receipts+honestywall, standing goals←doctrine+locked-8, optional loops←governedagent/governedrag/loopforge/mesh) with LIVE per-node verdict from the honestywall aggregate → OPERATING/DEGRADED/HALTED-HONEST, never OPERATING if anything VIOLATED, unsigned SHA-256 receipt-on-write (drift-proof)", mod: "/static/3d/surfaces/agentos.js" },
|
| 323 |
+
{ id: "brainground", cat: "brain", title: "Brainground · grounding-confidence + honest abstention over brain retrieval · scores the brain's REAL grounding_subgraph (seed coverage · subgraph cohesion · salience mass · community consistency) → GROUNDED/WEAK-GROUNDING/INSUFFICIENT-GROUNDING, brain abstains when grounding is weak, MODELED (never MEASURED), unsigned SHA-256 receipt-on-write", mod: "/static/3d/surfaces/brainground.js" },
|
| 324 |
];
|
| 325 |
|
| 326 |
const stageEl = document.getElementById("stage");
|
static/3d/surfaces/brainground.js
ADDED
|
@@ -0,0 +1,400 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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|
+
//
|
| 4 |
+
// surfaces/brainground.js — BRAINGROUND · grounding-confidence + honest abstention over brain
|
| 5 |
+
// retrieval.
|
| 6 |
+
//
|
| 7 |
+
// FOUR PILLARS, one per grounding-confidence component (seed coverage · subgraph cohesion ·
|
| 8 |
+
// salience mass · community consistency), each height-scaled by its live value ∈ [0,1]. A
|
| 9 |
+
// KEYSTONE ORB above them carries the honest verdict — GROUNDED / WEAK-GROUNDING /
|
| 10 |
+
// INSUFFICIENT-GROUNDING — read VERBATIM from the same-origin feed. When the grounding is weak
|
| 11 |
+
// the orb dims to grey and the surface states the brain SHOULD ABSTAIN — the point is that the
|
| 12 |
+
// brain can honestly say "I don't have enough grounding" rather than answer anyway.
|
| 13 |
+
//
|
| 14 |
+
// DATA: live snapshot from GET /api/a11oy/v1/brain/ground?q=&k= (PURE READ, mints nothing):
|
| 15 |
+
// ok, label (MODELED), query, grounding_confidence, verdict, should_abstain, verdict_reason,
|
| 16 |
+
// components{ seed_coverage{value}, subgraph_cohesion{value}, salience_mass{value},
|
| 17 |
+
// community_consistency{value} }, weights, thresholds, grounding_stats{node_count,…}.
|
| 18 |
+
//
|
| 19 |
+
// HONESTY LABEL: MODELED — grounding_confidence is a deterministic graph statistic over the
|
| 20 |
+
// brain's REAL grounding_subgraph, NEVER a MEASURED semantic truth. The brain's own honest
|
| 21 |
+
// labels are reused VERBATIM and never upgraded. High confidence is never shown when the
|
| 22 |
+
// components are weak. No green "1.0 / VERIFIED" state. Trust ceiling 0.97, never 100%.
|
| 23 |
+
// COLOURS (approved hues only): proof-teal 0x3af4c8 (GROUNDED / pillars), violet-blue 0x8a6bff
|
| 24 |
+
// (WEAK-GROUNDING), lattice-blue 0x5b8dee (frame), greys (INSUFFICIENT / abstain, floor). No
|
| 25 |
+
// other hue.
|
| 26 |
+
// 0 RUNTIME CDN. Vendored three.js via page importmap (ctx.THREE).
|
| 27 |
+
// DOCTRINE v11: read-only over knowledge-graph retrieval — adds NOTHING to the locked-8
|
| 28 |
+
// {F1,F4,F7,F11,F12,F18,F19,F22}; Λ stays Conjecture 1; introduces no theorem. Degrades grey
|
| 29 |
+
// on 404/error; label shown.
|
| 30 |
+
|
| 31 |
+
import { createShowcase } from "./_showcase.js";
|
| 32 |
+
|
| 33 |
+
const ID = "brainground";
|
| 34 |
+
const TITLE = "Brainground · grounding-confidence + honest abstention (live)";
|
| 35 |
+
|
| 36 |
+
// same-origin, relative — no CDN, no cross-origin fetch. PURE-READ ground endpoint with a
|
| 37 |
+
// representative demo query (values come live from the endpoint; nothing is hand-authored).
|
| 38 |
+
const DEMO_Q = "brain graph knowledge";
|
| 39 |
+
const EP = "/api/a11oy/v1/brain/ground?q=" + encodeURIComponent(DEMO_Q) + "&k=12";
|
| 40 |
+
|
| 41 |
+
// approved hues only — no amber, no crimson, no green
|
| 42 |
+
const C_GROUNDED = 0x3af4c8; // proof-teal — GROUNDED / pillars
|
| 43 |
+
const C_WEAK = 0x8a6bff; // violet-blue — WEAK-GROUNDING
|
| 44 |
+
const C_ABSTAIN = 0x6b7a86; // grey — INSUFFICIENT-GROUNDING / abstain
|
| 45 |
+
const C_FRAME = 0x5b8dee; // lattice-blue — frame
|
| 46 |
+
const C_GRID = 0x1b3a44; // floor colour
|
| 47 |
+
|
| 48 |
+
// the four components, in display order, with human labels
|
| 49 |
+
const COMPONENTS = [
|
| 50 |
+
["seed_coverage", "seed coverage"],
|
| 51 |
+
["subgraph_cohesion", "subgraph cohesion"],
|
| 52 |
+
["salience_mass", "salience mass"],
|
| 53 |
+
["community_consistency", "community consistency"],
|
| 54 |
+
];
|
| 55 |
+
|
| 56 |
+
function _verdictColor(v) {
|
| 57 |
+
const s = String(v || "").toUpperCase();
|
| 58 |
+
if (s === "GROUNDED") return C_GROUNDED;
|
| 59 |
+
if (s === "WEAK-GROUNDING") return C_WEAK;
|
| 60 |
+
return C_ABSTAIN; // INSUFFICIENT-GROUNDING / init
|
| 61 |
+
}
|
| 62 |
+
|
| 63 |
+
let _stage = null, _THREE = null, _ctx = null, _group = null, _show = null;
|
| 64 |
+
let _frameReg = false, _polls = [], _el = {}, _badge = null, _plain = false;
|
| 65 |
+
|
| 66 |
+
let _keystone = null; // THREE.Mesh — the verdict orb
|
| 67 |
+
let _pillars = []; // Array<{ mesh, key, value }>
|
| 68 |
+
|
| 69 |
+
// live state (all read from JSON; nothing invented)
|
| 70 |
+
const S = {
|
| 71 |
+
label: null, // top honesty label VERBATIM (MODELED)
|
| 72 |
+
query: null,
|
| 73 |
+
confidence: null,
|
| 74 |
+
verdict: null,
|
| 75 |
+
abstain: null,
|
| 76 |
+
reason: null,
|
| 77 |
+
comp: {}, // { seed_coverage: v, ... } each ∈ [0,1]
|
| 78 |
+
nodeCount: null,
|
| 79 |
+
linkCount: null,
|
| 80 |
+
trustCeil: null,
|
| 81 |
+
lambda: null,
|
| 82 |
+
locked: null,
|
| 83 |
+
state: "init",
|
| 84 |
+
};
|
| 85 |
+
|
| 86 |
+
// =============================================================================
|
| 87 |
+
export function mount(ctx) {
|
| 88 |
+
_ctx = ctx; _stage = ctx.stage; _THREE = ctx.THREE;
|
| 89 |
+
_group = new _THREE.Group();
|
| 90 |
+
_stage.scene.add(_group);
|
| 91 |
+
_stage.camera.position.set(0, 4.2, 17);
|
| 92 |
+
try { if (_stage.controls && _stage.controls.target) { _stage.controls.target.set(0, 2.4, 0); _stage.controls.update(); } } catch (_) {}
|
| 93 |
+
try { _stage.setBloom(true); } catch (_) {}
|
| 94 |
+
|
| 95 |
+
_buildFloor();
|
| 96 |
+
_buildPillars();
|
| 97 |
+
_buildKeystone();
|
| 98 |
+
|
| 99 |
+
if (!_frameReg) { _stage.onFrame(_onFrame); _frameReg = true; }
|
| 100 |
+
|
| 101 |
+
_badge = ctx.live.createBadge();
|
| 102 |
+
_polls.push(ctx.live.poll(EP, 9000, _onData, {
|
| 103 |
+
badge: _badge, onState: (m) => { S.state = m.state; _paintOverlay(); _paintKeystone(); _paintPillars(); },
|
| 104 |
+
}));
|
| 105 |
+
|
| 106 |
+
_buildOverlay();
|
| 107 |
+
return { id: ID, started: true };
|
| 108 |
+
}
|
| 109 |
+
|
| 110 |
+
// =============================================================================
|
| 111 |
+
function _buildFloor() {
|
| 112 |
+
const THREE = _THREE;
|
| 113 |
+
const grid = new THREE.GridHelper(40, 40, C_GRID, 0x0f2027);
|
| 114 |
+
grid.material.opacity = 0.16; grid.material.transparent = true; grid.position.y = -0.01;
|
| 115 |
+
_group.add(grid);
|
| 116 |
+
}
|
| 117 |
+
|
| 118 |
+
function _buildPillars() {
|
| 119 |
+
const THREE = _THREE;
|
| 120 |
+
const n = COMPONENTS.length;
|
| 121 |
+
const totalW = 10.0;
|
| 122 |
+
const step = totalW / n;
|
| 123 |
+
const startX = -totalW / 2 + step / 2;
|
| 124 |
+
const geo = new THREE.BoxGeometry(1.5, 1.0, 1.5);
|
| 125 |
+
|
| 126 |
+
for (let i = 0; i < n; i++) {
|
| 127 |
+
const [key] = COMPONENTS[i];
|
| 128 |
+
const x = startX + step * i;
|
| 129 |
+
const mesh = new THREE.Mesh(geo, new THREE.MeshStandardMaterial({
|
| 130 |
+
color: C_GROUNDED, emissive: C_GROUNDED, emissiveIntensity: 0.22,
|
| 131 |
+
transparent: true, opacity: 0.9,
|
| 132 |
+
}));
|
| 133 |
+
mesh.scale.y = 0.05;
|
| 134 |
+
mesh.position.set(x, 0.025, 0);
|
| 135 |
+
_group.add(mesh);
|
| 136 |
+
|
| 137 |
+
// lattice base ring for each pillar (frame hue)
|
| 138 |
+
const ring = new THREE.Mesh(
|
| 139 |
+
new THREE.TorusGeometry(1.15, 0.03, 8, 40),
|
| 140 |
+
new THREE.MeshBasicMaterial({ color: C_FRAME, transparent: true, opacity: 0.35 }));
|
| 141 |
+
ring.rotation.x = Math.PI / 2;
|
| 142 |
+
ring.position.set(x, 0.02, 0);
|
| 143 |
+
_group.add(ring);
|
| 144 |
+
|
| 145 |
+
_pillars.push({ mesh, ring, key, value: 0 });
|
| 146 |
+
}
|
| 147 |
+
}
|
| 148 |
+
|
| 149 |
+
function _buildKeystone() {
|
| 150 |
+
const THREE = _THREE;
|
| 151 |
+
_keystone = new THREE.Mesh(
|
| 152 |
+
new THREE.IcosahedronGeometry(1.15, 1),
|
| 153 |
+
new THREE.MeshStandardMaterial({
|
| 154 |
+
color: C_ABSTAIN, emissive: C_ABSTAIN, emissiveIntensity: 0.3,
|
| 155 |
+
transparent: true, opacity: 0.92, flatShading: true,
|
| 156 |
+
}));
|
| 157 |
+
_keystone.position.set(0, 6.4, 0);
|
| 158 |
+
_group.add(_keystone);
|
| 159 |
+
|
| 160 |
+
const rg = new THREE.BufferGeometry().setFromPoints([
|
| 161 |
+
new THREE.Vector3(-5.4, 5.2, 0), new THREE.Vector3(5.4, 5.2, 0),
|
| 162 |
+
]);
|
| 163 |
+
const rail = new THREE.Line(rg, new THREE.LineBasicMaterial({
|
| 164 |
+
color: C_FRAME, transparent: true, opacity: 0.4,
|
| 165 |
+
}));
|
| 166 |
+
_group.add(rail);
|
| 167 |
+
}
|
| 168 |
+
|
| 169 |
+
// =============================================================================
|
| 170 |
+
// live data handler — read VERBATIM, never upgrade
|
| 171 |
+
// =============================================================================
|
| 172 |
+
function _onData(j) {
|
| 173 |
+
S.label = (j && j.label ? String(j.label) : "MODELED").toUpperCase();
|
| 174 |
+
S.query = j && j.query ? String(j.query) : null;
|
| 175 |
+
S.confidence = j && typeof j.grounding_confidence === "number" ? j.grounding_confidence : null;
|
| 176 |
+
S.verdict = j && j.verdict ? String(j.verdict).toUpperCase() : null;
|
| 177 |
+
S.abstain = j && typeof j.should_abstain === "boolean" ? j.should_abstain : null;
|
| 178 |
+
S.reason = j && j.verdict_reason ? String(j.verdict_reason) : null;
|
| 179 |
+
|
| 180 |
+
const c = (j && j.components) || {};
|
| 181 |
+
S.comp = {};
|
| 182 |
+
COMPONENTS.forEach(([key]) => {
|
| 183 |
+
const v = c[key] && typeof c[key].value === "number" ? c[key].value : null;
|
| 184 |
+
S.comp[key] = v;
|
| 185 |
+
});
|
| 186 |
+
|
| 187 |
+
const gs = (j && j.grounding_stats) || {};
|
| 188 |
+
S.nodeCount = typeof gs.node_count === "number" ? gs.node_count : null;
|
| 189 |
+
S.linkCount = typeof gs.link_count === "number" ? gs.link_count : null;
|
| 190 |
+
|
| 191 |
+
const d = (j && j.doctrine) || {};
|
| 192 |
+
S.trustCeil = typeof d.trust_ceiling === "number" ? d.trust_ceiling : null;
|
| 193 |
+
S.lambda = typeof d.lambda === "string" ? d.lambda : null;
|
| 194 |
+
S.locked = typeof d.locked_proven === "number" ? d.locked_proven : null;
|
| 195 |
+
|
| 196 |
+
_paintPillars();
|
| 197 |
+
_paintKeystone();
|
| 198 |
+
_paintOverlay();
|
| 199 |
+
}
|
| 200 |
+
|
| 201 |
+
// =============================================================================
|
| 202 |
+
function _onFrame() {
|
| 203 |
+
const t = performance.now();
|
| 204 |
+
if (_group) _group.rotation.y = Math.sin(t * 0.00005) * 0.08;
|
| 205 |
+
|
| 206 |
+
const live = S.state === "live";
|
| 207 |
+
if (_keystone) {
|
| 208 |
+
const pulse = 0.3 + (live ? 0.25 : 0.08) * (0.5 + 0.5 * Math.sin(t * 0.003));
|
| 209 |
+
_keystone.material.emissiveIntensity = pulse;
|
| 210 |
+
_keystone.rotation.y += 0.004;
|
| 211 |
+
_keystone.rotation.x = Math.sin(t * 0.0007) * 0.15;
|
| 212 |
+
}
|
| 213 |
+
_pillars.forEach((p, i) => {
|
| 214 |
+
const base = live ? 0.26 : 0.1;
|
| 215 |
+
const wob = live ? 0.14 * (0.5 + 0.5 * Math.sin(t * 0.002 + i)) : 0;
|
| 216 |
+
p.mesh.material.emissiveIntensity = base + wob;
|
| 217 |
+
p.mesh.material.opacity = live ? 0.9 : 0.4;
|
| 218 |
+
});
|
| 219 |
+
}
|
| 220 |
+
|
| 221 |
+
// =============================================================================
|
| 222 |
+
function _paintPillars() {
|
| 223 |
+
const live = S.state === "live";
|
| 224 |
+
const col = _verdictColor(live ? S.verdict : null);
|
| 225 |
+
_pillars.forEach((p) => {
|
| 226 |
+
const v = live && typeof S.comp[p.key] === "number" ? S.comp[p.key] : 0;
|
| 227 |
+
p.value = v;
|
| 228 |
+
const h = 0.1 + v * 4.6; // height by component value ∈ [0,1]
|
| 229 |
+
p.mesh.scale.y = h;
|
| 230 |
+
p.mesh.position.y = h / 2;
|
| 231 |
+
// pillars share the verdict hue (teal grounded / violet weak / grey abstain)
|
| 232 |
+
p.mesh.material.color.setHex(col);
|
| 233 |
+
p.mesh.material.emissive.setHex(col);
|
| 234 |
+
});
|
| 235 |
+
}
|
| 236 |
+
|
| 237 |
+
function _paintKeystone() {
|
| 238 |
+
if (!_keystone) return;
|
| 239 |
+
const col = _verdictColor(S.state === "live" ? S.verdict : null);
|
| 240 |
+
_keystone.material.color.setHex(col);
|
| 241 |
+
_keystone.material.emissive.setHex(col);
|
| 242 |
+
}
|
| 243 |
+
|
| 244 |
+
// =============================================================================
|
| 245 |
+
// overlay (HUD)
|
| 246 |
+
// =============================================================================
|
| 247 |
+
function _buildOverlay() {
|
| 248 |
+
const ctx = _ctx;
|
| 249 |
+
_show = createShowcase(ctx, {
|
| 250 |
+
id: ID, title: TITLE, accent: "#5b8dee", badge: _badge,
|
| 251 |
+
chips: [{ label: "MODELED", text: "grounding", name: "lbl" },
|
| 252 |
+
{ label: "—", text: "verdict", name: "vrd" }],
|
| 253 |
+
legend: ["MODELED"],
|
| 254 |
+
});
|
| 255 |
+
const host = _show.body;
|
| 256 |
+
|
| 257 |
+
const sub = document.createElement("div");
|
| 258 |
+
sub.style.cssText = "color:#9fb1bf;font-size:11px;line-height:1.55";
|
| 259 |
+
sub.innerHTML =
|
| 260 |
+
"A grounding-confidence lens over the brain's retrieval. For a query it scores the brain's " +
|
| 261 |
+
"<b>real</b> grounding subgraph across four explainable parts — <b>seed coverage</b>, " +
|
| 262 |
+
"<b>subgraph cohesion</b>, <b>salience mass</b>, <b>community consistency</b> — and combines " +
|
| 263 |
+
"them into one confidence ∈ [0,1]. When the grounding is weak it returns " +
|
| 264 |
+
"<b>INSUFFICIENT-GROUNDING</b> and states the brain <b>should abstain</b> rather than answer. " +
|
| 265 |
+
"grounding_confidence is <b>MODELED</b> (a deterministic graph statistic), never a measured " +
|
| 266 |
+
"semantic truth; high confidence is never shown when the parts are weak. 0 runtime CDN.";
|
| 267 |
+
host.appendChild(sub);
|
| 268 |
+
|
| 269 |
+
const card = document.createElement("div");
|
| 270 |
+
card.style.cssText = "background:#0a1117;border:1px solid #1d2a36;border-radius:9px;padding:9px 10px;display:flex;flex-direction:column;gap:6px";
|
| 271 |
+
|
| 272 |
+
const grid = document.createElement("div");
|
| 273 |
+
grid.style.cssText = "display:grid;grid-template-columns:1fr;gap:4px";
|
| 274 |
+
function kpiRow(id, label) {
|
| 275 |
+
const r = document.createElement("div");
|
| 276 |
+
r.style.cssText = "display:flex;justify-content:space-between;gap:10px;font-size:11px";
|
| 277 |
+
const l = document.createElement("span"); l.style.cssText = "color:#9fb1bf"; l.textContent = label;
|
| 278 |
+
const v = document.createElement("b");
|
| 279 |
+
v.id = id;
|
| 280 |
+
v.style.cssText = "font-variant-numeric:tabular-nums;color:#eef3f6;text-align:right;max-width:62%;overflow-wrap:anywhere";
|
| 281 |
+
v.textContent = "—";
|
| 282 |
+
_el[id] = v;
|
| 283 |
+
r.appendChild(l); r.appendChild(v); return r;
|
| 284 |
+
}
|
| 285 |
+
grid.appendChild(kpiRow("bg-verdict", "verdict"));
|
| 286 |
+
grid.appendChild(kpiRow("bg-conf", "grounding confidence"));
|
| 287 |
+
grid.appendChild(kpiRow("bg-abstain", "should abstain"));
|
| 288 |
+
grid.appendChild(kpiRow("bg-seed", "seed coverage"));
|
| 289 |
+
grid.appendChild(kpiRow("bg-cohesion", "subgraph cohesion"));
|
| 290 |
+
grid.appendChild(kpiRow("bg-salience", "salience mass"));
|
| 291 |
+
grid.appendChild(kpiRow("bg-comm", "community consistency"));
|
| 292 |
+
grid.appendChild(kpiRow("bg-nodes", "grounding nodes"));
|
| 293 |
+
grid.appendChild(kpiRow("bg-locked", "locked proofs"));
|
| 294 |
+
grid.appendChild(kpiRow("bg-trust", "trust ceiling"));
|
| 295 |
+
grid.appendChild(kpiRow("bg-lambda", "Λ"));
|
| 296 |
+
card.appendChild(grid);
|
| 297 |
+
host.appendChild(card);
|
| 298 |
+
|
| 299 |
+
const leg = document.createElement("div");
|
| 300 |
+
leg.style.cssText = "font-size:9.5px;color:#6b7a86;line-height:1.6";
|
| 301 |
+
leg.innerHTML =
|
| 302 |
+
'<span style="color:#3af4c8">■</span> GROUNDED ' +
|
| 303 |
+
'<span style="color:#8a6bff">■</span> WEAK-GROUNDING ' +
|
| 304 |
+
'<span style="color:#6b7a86">■</span> INSUFFICIENT-GROUNDING (abstain). ' +
|
| 305 |
+
'MODELED · confidence is a graph statistic, never measured semantic truth · never upgraded.';
|
| 306 |
+
card.appendChild(leg);
|
| 307 |
+
|
| 308 |
+
const pl = document.createElement("button");
|
| 309 |
+
pl.textContent = "◑ what this means";
|
| 310 |
+
pl.title = "Toggle plain-language explanation for investors & consumers.";
|
| 311 |
+
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";
|
| 312 |
+
pl.addEventListener("click", () => {
|
| 313 |
+
_plain = !_plain;
|
| 314 |
+
pl.style.background = _plain ? "#0f2a20" : "#08140f";
|
| 315 |
+
_applyPlain();
|
| 316 |
+
});
|
| 317 |
+
host.appendChild(pl);
|
| 318 |
+
|
| 319 |
+
const pd = document.createElement("div");
|
| 320 |
+
pd.id = "bg-plain";
|
| 321 |
+
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";
|
| 322 |
+
_el["plain"] = pd;
|
| 323 |
+
host.appendChild(pd);
|
| 324 |
+
|
| 325 |
+
_paintOverlay();
|
| 326 |
+
}
|
| 327 |
+
|
| 328 |
+
function _applyPlain() {
|
| 329 |
+
const pd = _el["plain"];
|
| 330 |
+
if (!pd) return;
|
| 331 |
+
pd.style.display = _plain ? "block" : "none";
|
| 332 |
+
if (!_plain) return;
|
| 333 |
+
pd.innerHTML =
|
| 334 |
+
"<b>What this means:</b> before the brain answers a question, this checks whether it actually " +
|
| 335 |
+
"has enough supporting knowledge to answer honestly. It looks at how much of the question the " +
|
| 336 |
+
"brain found, how tightly the supporting facts connect, how concentrated the strongest facts " +
|
| 337 |
+
"are, and whether they cluster in one topic. If the support is thin it says " +
|
| 338 |
+
"<b>INSUFFICIENT-GROUNDING</b> — the brain should say “I don't have enough grounding” instead " +
|
| 339 |
+
"of guessing. The score is an honest graph measurement, not a claim of truth, and confidence " +
|
| 340 |
+
"is capped at 0.97, never 100%. No “verified / 1.0” state.";
|
| 341 |
+
}
|
| 342 |
+
|
| 343 |
+
function _tok(s) {
|
| 344 |
+
if (s === "live") return null;
|
| 345 |
+
if (s === "missing") return "NO-LIVE-DATA";
|
| 346 |
+
if (s === "degraded") return "DEGRADED";
|
| 347 |
+
if (s === "error") return "OFFLINE";
|
| 348 |
+
return "…";
|
| 349 |
+
}
|
| 350 |
+
function _set(id, v) { if (_el[id]) _el[id].textContent = v; }
|
| 351 |
+
function _pct(v) { return v == null ? "—" : (Math.round(v * 1000) / 10) + "%"; }
|
| 352 |
+
function _n(v) { return v == null ? "—" : String(v); }
|
| 353 |
+
|
| 354 |
+
function _paintOverlay() {
|
| 355 |
+
const t = _tok(S.state);
|
| 356 |
+
const vrd = t || (S.verdict || "—");
|
| 357 |
+
if (_show) {
|
| 358 |
+
_show.setChip("lbl", S.label || "MODELED", { text: "grounding" });
|
| 359 |
+
_show.setChip("vrd", vrd, { text: "verdict" });
|
| 360 |
+
}
|
| 361 |
+
_set("bg-verdict", vrd);
|
| 362 |
+
_set("bg-conf", t || _pct(S.confidence));
|
| 363 |
+
_set("bg-abstain", t || (S.abstain == null ? "—" : (S.abstain ? "YES — abstain" : "no")));
|
| 364 |
+
_set("bg-seed", t || _pct(S.comp["seed_coverage"]));
|
| 365 |
+
_set("bg-cohesion", t || _pct(S.comp["subgraph_cohesion"]));
|
| 366 |
+
_set("bg-salience", t || _pct(S.comp["salience_mass"]));
|
| 367 |
+
_set("bg-comm", t || _pct(S.comp["community_consistency"]));
|
| 368 |
+
_set("bg-nodes", t || _n(S.nodeCount));
|
| 369 |
+
_set("bg-locked", t || (S.locked != null ? String(S.locked) : "—"));
|
| 370 |
+
_set("bg-trust", t || (S.trustCeil != null ? String(S.trustCeil) : "—"));
|
| 371 |
+
_set("bg-lambda", t || (S.lambda || "—"));
|
| 372 |
+
if (_plain) _applyPlain();
|
| 373 |
+
}
|
| 374 |
+
|
| 375 |
+
// =============================================================================
|
| 376 |
+
export function unmount() {
|
| 377 |
+
_polls.forEach((p) => { try { p.stop(); } catch (_) {} }); _polls = [];
|
| 378 |
+
try { if (_show) _show.destroy(); } catch (_) {}
|
| 379 |
+
try {
|
| 380 |
+
if (_group && _stage) {
|
| 381 |
+
_group.traverse((o) => {
|
| 382 |
+
if (o.geometry && o.geometry.dispose) o.geometry.dispose();
|
| 383 |
+
if (o.material) {
|
| 384 |
+
const ms = Array.isArray(o.material) ? o.material : [o.material];
|
| 385 |
+
ms.forEach((mm) => { if (mm.dispose) mm.dispose(); });
|
| 386 |
+
}
|
| 387 |
+
});
|
| 388 |
+
_stage.scene.remove(_group);
|
| 389 |
+
}
|
| 390 |
+
} catch (_) {}
|
| 391 |
+
_group = _show = null;
|
| 392 |
+
_keystone = null; _pillars = [];
|
| 393 |
+
_el = {}; _badge = null; _plain = false; _frameReg = false;
|
| 394 |
+
_stage = _THREE = _ctx = null;
|
| 395 |
+
S.label = S.query = S.confidence = S.verdict = S.abstain = S.reason = null;
|
| 396 |
+
S.comp = {}; S.nodeCount = S.linkCount = null;
|
| 397 |
+
S.trustCeil = S.lambda = S.locked = null; S.state = "init";
|
| 398 |
+
}
|
| 399 |
+
|
| 400 |
+
export default { id: ID, title: TITLE, endpoints: [EP], mount, unmount };
|