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: 1033 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/brainlineage.js +419 -0
static/3d/holographic.html
CHANGED
|
@@ -329,6 +329,7 @@ const SURFACES = [
|
|
| 329 |
{ id: "brainwatch", cat: "brain", title: "Brain Watch · knowledge-graph honesty-posture drift monitor · MEASURED label-distribution/orphan/community/salience snapshot vs a caller-supplied PRIOR → STABLE/DRIFTING/DEGRADED/BASELINE-ONLY (no fabricated trend without a real prior), unsigned SHA-256 receipt-on-write", mod: "/static/3d/surfaces/brainwatch.js" },
|
| 330 |
{ id: "brainconsensus", cat: "brain", title: "Brain Consensus · honest corroboration of a brain grounding · measures how MANY distinct nodes support a query and how many distinct communities they span (cross-community agreement is stronger than one clique) → CORROBORATED/WEAK-CORROBORATION/SINGLE-SOURCE, single-source-risk flag when support collapses to one node/community, never CORROBORATED while that flag is set, MODELED corroboration honesty not a truth guarantee, unsigned SHA-256 receipt-on-write", mod: "/static/3d/surfaces/brainconsensus.js" },
|
| 331 |
{ id: "brainqueryaudit", cat: "brain", title: "Brain Query Audit · append-only hash-linked ledger of brain queries + the honest verdict each returned · POST appends {query, verdict, grounding_label} and mints an UNSIGNED SHA-256 receipt chained to the prior entry (tamper-evident); GET recomputes the whole chain → CHAIN-INTACT/CHAIN-BROKEN (never softened), ephemeral in-memory ledger labelled honestly, MODELED, receipt-on-write-not-on-read", mod: "/static/3d/surfaces/brainqueryaudit.js" },
|
|
|
|
| 332 |
];
|
| 333 |
|
| 334 |
const stageEl = document.getElementById("stage");
|
|
|
|
| 329 |
{ id: "brainwatch", cat: "brain", title: "Brain Watch · knowledge-graph honesty-posture drift monitor · MEASURED label-distribution/orphan/community/salience snapshot vs a caller-supplied PRIOR → STABLE/DRIFTING/DEGRADED/BASELINE-ONLY (no fabricated trend without a real prior), unsigned SHA-256 receipt-on-write", mod: "/static/3d/surfaces/brainwatch.js" },
|
| 330 |
{ id: "brainconsensus", cat: "brain", title: "Brain Consensus · honest corroboration of a brain grounding · measures how MANY distinct nodes support a query and how many distinct communities they span (cross-community agreement is stronger than one clique) → CORROBORATED/WEAK-CORROBORATION/SINGLE-SOURCE, single-source-risk flag when support collapses to one node/community, never CORROBORATED while that flag is set, MODELED corroboration honesty not a truth guarantee, unsigned SHA-256 receipt-on-write", mod: "/static/3d/surfaces/brainconsensus.js" },
|
| 331 |
{ id: "brainqueryaudit", cat: "brain", title: "Brain Query Audit · append-only hash-linked ledger of brain queries + the honest verdict each returned · POST appends {query, verdict, grounding_label} and mints an UNSIGNED SHA-256 receipt chained to the prior entry (tamper-evident); GET recomputes the whole chain → CHAIN-INTACT/CHAIN-BROKEN (never softened), ephemeral in-memory ledger labelled honestly, MODELED, receipt-on-write-not-on-read", mod: "/static/3d/surfaces/brainqueryaudit.js" },
|
| 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 |
];
|
| 334 |
|
| 335 |
const stageEl = document.getElementById("stage");
|
static/3d/surfaces/brainlineage.js
ADDED
|
@@ -0,0 +1,419 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
// SPDX-License-Identifier: Apache-2.0
|
| 2 |
+
// © 2026 Lutar, Stephen P. Jr. — SZL Holdings · ORCID 0009-0001-0110-4173 · Doctrine v11
|
| 3 |
+
//
|
| 4 |
+
// surfaces/brainlineage.js — NODE-ORIGIN LINEAGE. For a query's top knowledge-graph nodes
|
| 5 |
+
// this surface renders HOW each node ENTERED the graph: a set of vertical ORIGIN ROOTS, one
|
| 6 |
+
// per node, each COLOURED by its origin verdict read VERBATIM (TRACED / PARTIAL-LINEAGE /
|
| 7 |
+
// UNKNOWN-ORIGIN) and SIZED by how many real origin fields it carries. A KEYSTONE at the top
|
| 8 |
+
// carries the aggregate verdict. A node with no source field is shown grey as UNKNOWN-ORIGIN —
|
| 9 |
+
// never a fabricated source.
|
| 10 |
+
//
|
| 11 |
+
// This is NODE-ORIGIN lineage of a knowledge-graph node (where a fact came from). It is DISTINCT
|
| 12 |
+
// from brainprovenance (which nodes supported an ANSWER). It is NOT cryptographic model/weapon
|
| 13 |
+
// attestation, NOT SLSA/in-toto/Rekor build attestation, and NOT any counter-UAS capability.
|
| 14 |
+
//
|
| 15 |
+
// DATA: live snapshot from GET /api/a11oy/v1/brain/lineage?q=&k= (PURE READ, mints nothing):
|
| 16 |
+
// ok, label (MODELED), verdict, verdict_reason, query, lineages[{id,title,verdict,label,
|
| 17 |
+
// origin,node_label,community,origin_field_count,has_explicit_source}], aggregate{traced,
|
| 18 |
+
// partial_lineage,unknown_origin,fraction_traced,...}, doctrine{lambda,locked_proven,...}.
|
| 19 |
+
//
|
| 20 |
+
// HONESTY LABEL: MODELED — this surface's own top label is MODELED (a derived re-read of the
|
| 21 |
+
// brain's own node fields, not a measurement). Per-node origin verdicts are read VERBATIM and
|
| 22 |
+
// NEVER upgraded (a STRUCTURAL-ONLY node is never shown TRACED; an UNKNOWN-ORIGIN node is never
|
| 23 |
+
// given a source). The aggregate is NEVER TRACED while any node's origin is UNKNOWN.
|
| 24 |
+
// Λ = Conjecture 1 → grey, never green/theorem. locked-proven = exactly 8. No green "1.0".
|
| 25 |
+
// COLOURS: proof-teal 0x3af4c8 (TRACED / explicit source), lattice-blue 0x5b8dee (PARTIAL-LINEAGE
|
| 26 |
+
// / structural + root frame), violet-blue 0x8a6bff (community accents), greys (UNKNOWN-ORIGIN).
|
| 27 |
+
// No green. 0 RUNTIME CDN — three.js via the page importmap (ctx.THREE).
|
| 28 |
+
// DOCTRINE v11: re-reads only — adds NOTHING to the locked-8 {F1,F4,F7,F11,F12,F18,F19,F22};
|
| 29 |
+
// Λ stays Conjecture 1; introduces no theorem. Degrades grey on 404/error; label shown.
|
| 30 |
+
|
| 31 |
+
import { createShowcase } from "./_showcase.js";
|
| 32 |
+
|
| 33 |
+
const ID = "brainlineage";
|
| 34 |
+
const TITLE = "Brain Lineage · node-origin chain (live)";
|
| 35 |
+
|
| 36 |
+
// same-origin, relative — no CDN, no cross-origin fetch. PURE-READ endpoint.
|
| 37 |
+
const DEFAULT_Q = "brain graph harvest";
|
| 38 |
+
const EP = "/api/a11oy/v1/brain/lineage?q=" + encodeURIComponent(DEFAULT_Q) + "&k=12";
|
| 39 |
+
|
| 40 |
+
// verdict / label hues — purple only the approved 0x8a6bff, no green
|
| 41 |
+
const C_TRACED = 0x3af4c8; // proof-teal — TRACED (explicit cited source)
|
| 42 |
+
const C_PARTIAL = 0x5b8dee; // lattice-blue — PARTIAL-LINEAGE (structural only)
|
| 43 |
+
const C_COMM = 0x8a6bff; // violet-blue — community accent
|
| 44 |
+
const C_UNKNOWN = 0x5a6570; // grey — UNKNOWN-ORIGIN (never a source)
|
| 45 |
+
const C_FRAME = 0x5b8dee; // lattice-blue — root frame
|
| 46 |
+
const C_GRID = 0x1b3a44; // floor colour
|
| 47 |
+
|
| 48 |
+
// map a VERBATIM verdict -> a root colour (never upgraded)
|
| 49 |
+
function _verdictColor(v) {
|
| 50 |
+
const s = String(v || "").toUpperCase();
|
| 51 |
+
if (s === "TRACED") return C_TRACED;
|
| 52 |
+
if (s === "PARTIAL-LINEAGE") return C_PARTIAL;
|
| 53 |
+
return C_UNKNOWN; // UNKNOWN-ORIGIN / init
|
| 54 |
+
}
|
| 55 |
+
|
| 56 |
+
let _stage = null, _THREE = null, _ctx = null, _group = null, _show = null;
|
| 57 |
+
let _frameReg = false, _polls = [], _el = {}, _badge = null, _plain = false;
|
| 58 |
+
|
| 59 |
+
let _keystone = null; // THREE.Mesh — the aggregate-verdict keystone
|
| 60 |
+
let _roots = []; // Array<{ mesh, verdict, fields }>
|
| 61 |
+
|
| 62 |
+
// live state (all read from JSON; nothing invented)
|
| 63 |
+
const S = {
|
| 64 |
+
label: null, // top honesty label VERBATIM (MODELED)
|
| 65 |
+
verdict: null, // TRACED | PARTIAL-LINEAGE | UNKNOWN-ORIGIN
|
| 66 |
+
reason: null,
|
| 67 |
+
query: null,
|
| 68 |
+
lineages: [],
|
| 69 |
+
agg: {},
|
| 70 |
+
lambda: null,
|
| 71 |
+
locked: null,
|
| 72 |
+
trustCeil:null,
|
| 73 |
+
state: "init",
|
| 74 |
+
};
|
| 75 |
+
|
| 76 |
+
// =============================================================================
|
| 77 |
+
export function mount(ctx) {
|
| 78 |
+
_ctx = ctx; _stage = ctx.stage; _THREE = ctx.THREE;
|
| 79 |
+
_group = new _THREE.Group();
|
| 80 |
+
_stage.scene.add(_group);
|
| 81 |
+
_stage.camera.position.set(0, 3.5, 20);
|
| 82 |
+
try { if (_stage.controls && _stage.controls.target) { _stage.controls.target.set(0, 2.0, 0); _stage.controls.update(); } } catch (_) {}
|
| 83 |
+
try { _stage.setBloom(true); } catch (_) {}
|
| 84 |
+
|
| 85 |
+
_buildFloor();
|
| 86 |
+
_buildKeystone();
|
| 87 |
+
|
| 88 |
+
if (!_frameReg) { _stage.onFrame(_onFrame); _frameReg = true; }
|
| 89 |
+
|
| 90 |
+
_badge = ctx.live.createBadge();
|
| 91 |
+
_polls.push(ctx.live.poll(EP, 8000, _onData, {
|
| 92 |
+
badge: _badge, onState: (m) => { S.state = m.state; _paintOverlay(); _paintKeystone(); },
|
| 93 |
+
}));
|
| 94 |
+
|
| 95 |
+
_buildOverlay();
|
| 96 |
+
return { id: ID, started: true };
|
| 97 |
+
}
|
| 98 |
+
|
| 99 |
+
// =============================================================================
|
| 100 |
+
function _buildFloor() {
|
| 101 |
+
const THREE = _THREE;
|
| 102 |
+
const grid = new THREE.GridHelper(42, 42, C_GRID, 0x0f2027);
|
| 103 |
+
grid.material.opacity = 0.16; grid.material.transparent = true; grid.position.y = -0.01;
|
| 104 |
+
_group.add(grid);
|
| 105 |
+
}
|
| 106 |
+
|
| 107 |
+
function _buildKeystone() {
|
| 108 |
+
const THREE = _THREE;
|
| 109 |
+
const g = new THREE.BoxGeometry(6.6, 1.2, 0.6);
|
| 110 |
+
_keystone = new THREE.Mesh(g, new THREE.MeshStandardMaterial({
|
| 111 |
+
color: C_UNKNOWN, emissive: C_UNKNOWN, emissiveIntensity: 0.32,
|
| 112 |
+
transparent: true, opacity: 0.9,
|
| 113 |
+
}));
|
| 114 |
+
_keystone.position.set(0, 8.4, 0);
|
| 115 |
+
_group.add(_keystone);
|
| 116 |
+
|
| 117 |
+
// lattice frame beneath the keystone (the top rail the roots hang from)
|
| 118 |
+
const rg = new THREE.BufferGeometry().setFromPoints([
|
| 119 |
+
new THREE.Vector3(-7, 7.7, 0), new THREE.Vector3(7, 7.7, 0),
|
| 120 |
+
]);
|
| 121 |
+
const rail = new THREE.Line(rg, new THREE.LineBasicMaterial({
|
| 122 |
+
color: C_FRAME, transparent: true, opacity: 0.4,
|
| 123 |
+
}));
|
| 124 |
+
_group.add(rail);
|
| 125 |
+
}
|
| 126 |
+
|
| 127 |
+
// Build (or rebuild) the origin roots: one vertical root per node, spread left→right,
|
| 128 |
+
// colour = verbatim origin verdict, height/width = origin_field_count (how deep the origin
|
| 129 |
+
// chain is). Rebuilt on each snapshot so the roots always mirror the CURRENT nodes.
|
| 130 |
+
function _buildRoots() {
|
| 131 |
+
const THREE = _THREE;
|
| 132 |
+
_disposeRoots();
|
| 133 |
+
|
| 134 |
+
const rows = Array.isArray(S.lineages) ? S.lineages : [];
|
| 135 |
+
const n = rows.length;
|
| 136 |
+
if (!n) return;
|
| 137 |
+
|
| 138 |
+
const maxF = rows.reduce((m, e) => Math.max(m, (typeof e.origin_field_count === "number" ? e.origin_field_count : 1)), 1);
|
| 139 |
+
const span = 13.0;
|
| 140 |
+
const step = n > 1 ? span / (n - 1) : 0;
|
| 141 |
+
const x0 = -span / 2;
|
| 142 |
+
|
| 143 |
+
for (let i = 0; i < n; i++) {
|
| 144 |
+
const e = rows[i];
|
| 145 |
+
const color = _verdictColor(e.verdict);
|
| 146 |
+
const fc = typeof e.origin_field_count === "number" ? e.origin_field_count : 1;
|
| 147 |
+
const h = 1.4 + (fc / maxF) * 5.4; // root depth by origin-field count
|
| 148 |
+
const x = x0 + i * step;
|
| 149 |
+
const y = 7.0 - h / 2;
|
| 150 |
+
|
| 151 |
+
const geo = new THREE.BoxGeometry(0.72, h, 0.72);
|
| 152 |
+
const mesh = new THREE.Mesh(geo, new THREE.MeshStandardMaterial({
|
| 153 |
+
color, emissive: color, emissiveIntensity: 0.30, transparent: true, opacity: 0.92,
|
| 154 |
+
}));
|
| 155 |
+
mesh.position.set(x, y, 0);
|
| 156 |
+
_group.add(mesh);
|
| 157 |
+
|
| 158 |
+
// a community accent bead at the root tip (violet-blue), only when a community is set
|
| 159 |
+
if (e.community !== null && e.community !== undefined && e.community !== "") {
|
| 160 |
+
const bg = new THREE.SphereGeometry(0.16, 12, 12);
|
| 161 |
+
const bead = new THREE.Mesh(bg, new THREE.MeshStandardMaterial({
|
| 162 |
+
color: C_COMM, emissive: C_COMM, emissiveIntensity: 0.4, transparent: true, opacity: 0.85,
|
| 163 |
+
}));
|
| 164 |
+
bead.position.set(x, y - h / 2 - 0.3, 0);
|
| 165 |
+
_group.add(bead);
|
| 166 |
+
_roots.push({ mesh: bead, verdict: e.verdict, fields: 0, accent: true });
|
| 167 |
+
}
|
| 168 |
+
|
| 169 |
+
_roots.push({ mesh, verdict: e.verdict, fields: fc });
|
| 170 |
+
}
|
| 171 |
+
}
|
| 172 |
+
|
| 173 |
+
function _disposeRoots() {
|
| 174 |
+
const rm = (o) => {
|
| 175 |
+
if (!o) return;
|
| 176 |
+
try {
|
| 177 |
+
if (o.geometry && o.geometry.dispose) o.geometry.dispose();
|
| 178 |
+
if (o.material) { const ms = Array.isArray(o.material) ? o.material : [o.material]; ms.forEach((m) => m.dispose && m.dispose()); }
|
| 179 |
+
if (_group) _group.remove(o);
|
| 180 |
+
} catch (_) {}
|
| 181 |
+
};
|
| 182 |
+
_roots.forEach((c) => rm(c.mesh));
|
| 183 |
+
_roots = [];
|
| 184 |
+
}
|
| 185 |
+
|
| 186 |
+
// =============================================================================
|
| 187 |
+
// live data handler — read VERBATIM, never upgrade
|
| 188 |
+
// =============================================================================
|
| 189 |
+
function _onData(j) {
|
| 190 |
+
S.label = (j && j.label ? String(j.label) : "MODELED").toUpperCase();
|
| 191 |
+
S.verdict = j && j.verdict ? String(j.verdict).toUpperCase() : null;
|
| 192 |
+
S.reason = j && j.verdict_reason ? String(j.verdict_reason) : null;
|
| 193 |
+
S.query = j && j.query ? String(j.query) : null;
|
| 194 |
+
S.lineages = (j && Array.isArray(j.lineages)) ? j.lineages : [];
|
| 195 |
+
S.agg = (j && j.aggregate && typeof j.aggregate === "object") ? j.aggregate : {};
|
| 196 |
+
|
| 197 |
+
const d = (j && j.doctrine) || {};
|
| 198 |
+
S.lambda = typeof d.lambda === "string" ? d.lambda : null;
|
| 199 |
+
S.locked = typeof d.locked_proven === "number" ? d.locked_proven : null;
|
| 200 |
+
S.trustCeil = typeof d.trust_ceiling === "number" ? d.trust_ceiling : null;
|
| 201 |
+
|
| 202 |
+
_buildRoots();
|
| 203 |
+
_paintKeystone();
|
| 204 |
+
_paintOverlay();
|
| 205 |
+
_paintList();
|
| 206 |
+
}
|
| 207 |
+
|
| 208 |
+
// =============================================================================
|
| 209 |
+
function _onFrame() {
|
| 210 |
+
const t = performance.now();
|
| 211 |
+
if (_group) _group.rotation.y = Math.sin(t * 0.00005) * 0.06;
|
| 212 |
+
|
| 213 |
+
const live = S.state === "live";
|
| 214 |
+
if (_keystone) {
|
| 215 |
+
const pulse = 0.32 + (live ? 0.25 : 0.08) * (0.5 + 0.5 * Math.sin(t * 0.003));
|
| 216 |
+
_keystone.material.emissiveIntensity = pulse;
|
| 217 |
+
}
|
| 218 |
+
if (_roots.length) {
|
| 219 |
+
const phase = (t * 0.0003) % 1;
|
| 220 |
+
const lead = Math.floor(phase * _roots.length);
|
| 221 |
+
for (let i = 0; i < _roots.length; i++) {
|
| 222 |
+
const c = _roots[i];
|
| 223 |
+
const near = Math.abs(i - lead) <= 0;
|
| 224 |
+
const base = c.accent ? 0.4 : (live ? 0.30 : 0.12);
|
| 225 |
+
c.mesh.material.emissiveIntensity = (near && live) ? Math.max(base, 0.8) : base;
|
| 226 |
+
c.mesh.material.opacity = live ? 0.92 : 0.42;
|
| 227 |
+
}
|
| 228 |
+
}
|
| 229 |
+
}
|
| 230 |
+
|
| 231 |
+
// =============================================================================
|
| 232 |
+
function _paintKeystone() {
|
| 233 |
+
if (!_keystone) return;
|
| 234 |
+
const col = _verdictColor(S.state === "live" ? S.verdict : null);
|
| 235 |
+
_keystone.material.color.setHex(col);
|
| 236 |
+
_keystone.material.emissive.setHex(col);
|
| 237 |
+
}
|
| 238 |
+
|
| 239 |
+
// =============================================================================
|
| 240 |
+
// overlay (HUD)
|
| 241 |
+
// =============================================================================
|
| 242 |
+
function _buildOverlay() {
|
| 243 |
+
const ctx = _ctx;
|
| 244 |
+
_show = createShowcase(ctx, {
|
| 245 |
+
id: ID, title: TITLE, accent: "#5b8dee", badge: _badge,
|
| 246 |
+
chips: [{ label: "MODELED", text: "lineage", name: "lbl" },
|
| 247 |
+
{ label: "—", text: "verdict", name: "vrd" }],
|
| 248 |
+
legend: ["MODELED"],
|
| 249 |
+
});
|
| 250 |
+
const host = _show.body;
|
| 251 |
+
|
| 252 |
+
const sub = document.createElement("div");
|
| 253 |
+
sub.style.cssText = "color:#9fb1bf;font-size:11px;line-height:1.55";
|
| 254 |
+
sub.innerHTML =
|
| 255 |
+
'For a query’s top knowledge-graph nodes, <b>how each node ENTERED the graph</b> — its ' +
|
| 256 |
+
'harvest/origin metadata chain, read <b>VERBATIM</b> from the node’s own real fields. Each ' +
|
| 257 |
+
'node gets an honest verdict: <b>TRACED</b> (explicit cited source) / <b>PARTIAL-LINEAGE</b> ' +
|
| 258 |
+
'(structural only) / <b>UNKNOWN-ORIGIN</b> (no source field). A node with no source is shown ' +
|
| 259 |
+
'<b>UNKNOWN — never a fabricated source</b>; the aggregate is <b>never TRACED while any origin ' +
|
| 260 |
+
'is UNKNOWN</b>. This is <b>node-origin lineage</b> — NOT per-answer provenance, NOT ' +
|
| 261 |
+
'build/model attestation, NOT counter-UAS. 0 runtime CDN.';
|
| 262 |
+
host.appendChild(sub);
|
| 263 |
+
|
| 264 |
+
const card = document.createElement("div");
|
| 265 |
+
card.style.cssText = "background:#0a1117;border:1px solid #1d2a36;border-radius:9px;padding:9px 10px;display:flex;flex-direction:column;gap:6px";
|
| 266 |
+
|
| 267 |
+
const grid = document.createElement("div");
|
| 268 |
+
grid.style.cssText = "display:grid;grid-template-columns:1fr;gap:4px";
|
| 269 |
+
function kpiRow(id, label) {
|
| 270 |
+
const r = document.createElement("div");
|
| 271 |
+
r.style.cssText = "display:flex;justify-content:space-between;gap:10px;font-size:11px";
|
| 272 |
+
const l = document.createElement("span"); l.style.cssText = "color:#9fb1bf"; l.textContent = label;
|
| 273 |
+
const v = document.createElement("b");
|
| 274 |
+
v.id = id;
|
| 275 |
+
v.style.cssText = "font-variant-numeric:tabular-nums;color:#eef3f6;text-align:right;max-width:62%;overflow-wrap:anywhere";
|
| 276 |
+
v.textContent = "—";
|
| 277 |
+
_el[id] = v;
|
| 278 |
+
r.appendChild(l); r.appendChild(v); return r;
|
| 279 |
+
}
|
| 280 |
+
grid.appendChild(kpiRow("bl-verdict", "aggregate verdict"));
|
| 281 |
+
grid.appendChild(kpiRow("bl-nodes", "nodes"));
|
| 282 |
+
grid.appendChild(kpiRow("bl-traced", "TRACED nodes"));
|
| 283 |
+
grid.appendChild(kpiRow("bl-partial", "PARTIAL-LINEAGE nodes"));
|
| 284 |
+
grid.appendChild(kpiRow("bl-unknown", "UNKNOWN-ORIGIN nodes"));
|
| 285 |
+
grid.appendChild(kpiRow("bl-fractr", "fraction traced"));
|
| 286 |
+
grid.appendChild(kpiRow("bl-locked", "locked proofs"));
|
| 287 |
+
grid.appendChild(kpiRow("bl-lambda", "Λ"));
|
| 288 |
+
card.appendChild(grid);
|
| 289 |
+
host.appendChild(card);
|
| 290 |
+
|
| 291 |
+
// scrollable node list (text mirror of the roots).
|
| 292 |
+
const listWrap = document.createElement("div");
|
| 293 |
+
listWrap.style.cssText = "display:flex;flex-direction:column;gap:4px;max-height:170px;overflow:auto";
|
| 294 |
+
_el["list"] = listWrap;
|
| 295 |
+
host.appendChild(listWrap);
|
| 296 |
+
|
| 297 |
+
const leg = document.createElement("div");
|
| 298 |
+
leg.style.cssText = "font-size:9.5px;color:#6b7a86;line-height:1.6";
|
| 299 |
+
leg.innerHTML =
|
| 300 |
+
'<span style="color:#3af4c8">■</span> TRACED (explicit source) ' +
|
| 301 |
+
'<span style="color:#5b8dee">■</span> PARTIAL-LINEAGE (structural) ' +
|
| 302 |
+
'<span style="color:#8a6bff">●</span> community ' +
|
| 303 |
+
'<span style="color:#8494a1">■</span> UNKNOWN-ORIGIN. ' +
|
| 304 |
+
'MODELED · origins read verbatim, never upgraded · UNKNOWN never fabricated.';
|
| 305 |
+
card.appendChild(leg);
|
| 306 |
+
|
| 307 |
+
const pl = document.createElement("button");
|
| 308 |
+
pl.textContent = "◑ what this means";
|
| 309 |
+
pl.title = "Toggle plain-language explanation for investors & consumers.";
|
| 310 |
+
pl.style.cssText = "font:11px ui-monospace,monospace;padding:5px 11px;border-radius:7px;border:1px solid #5b8dee;background:#08121f;color:#5b8dee;cursor:pointer;width:fit-content";
|
| 311 |
+
pl.addEventListener("click", () => {
|
| 312 |
+
_plain = !_plain;
|
| 313 |
+
pl.style.background = _plain ? "#0f2233" : "#08121f";
|
| 314 |
+
_applyPlain();
|
| 315 |
+
});
|
| 316 |
+
host.appendChild(pl);
|
| 317 |
+
|
| 318 |
+
const pd = document.createElement("div");
|
| 319 |
+
pd.id = "bl-plain";
|
| 320 |
+
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";
|
| 321 |
+
_el["plain"] = pd;
|
| 322 |
+
host.appendChild(pd);
|
| 323 |
+
|
| 324 |
+
_paintOverlay();
|
| 325 |
+
}
|
| 326 |
+
|
| 327 |
+
function _applyPlain() {
|
| 328 |
+
const pd = _el["plain"];
|
| 329 |
+
if (!pd) return;
|
| 330 |
+
pd.style.display = _plain ? "block" : "none";
|
| 331 |
+
if (!_plain) return;
|
| 332 |
+
pd.innerHTML =
|
| 333 |
+
"<b>What this means:</b> every fact in the brain’s knowledge graph came from somewhere. This " +
|
| 334 |
+
"traces, for each node, <b>how it got in</b> — reading only the real origin fields the node " +
|
| 335 |
+
"actually carries. If a node names a real source it reads <b>TRACED</b>; if only its place in " +
|
| 336 |
+
"the structure is known it reads <b>PARTIAL-LINEAGE</b>; if it records no source at all it " +
|
| 337 |
+
"reads <b>UNKNOWN-ORIGIN</b> — and we say so plainly rather than <b>inventing a source</b>. " +
|
| 338 |
+
"This is about where a fact came from — it is not a security seal on a model or a build, and " +
|
| 339 |
+
"it is separate from tracing which facts backed a given answer. No “verified / 1.0” state.";
|
| 340 |
+
}
|
| 341 |
+
|
| 342 |
+
function _tok(s) {
|
| 343 |
+
if (s === "live") return null;
|
| 344 |
+
if (s === "missing") return "NO-LIVE-DATA";
|
| 345 |
+
if (s === "degraded") return "DEGRADED";
|
| 346 |
+
if (s === "error") return "OFFLINE";
|
| 347 |
+
return "…";
|
| 348 |
+
}
|
| 349 |
+
function _set(id, v) { if (_el[id]) _el[id].textContent = v; }
|
| 350 |
+
function _n(v) { return v == null ? "—" : String(v); }
|
| 351 |
+
|
| 352 |
+
function _paintList() {
|
| 353 |
+
const wrap = _el["list"];
|
| 354 |
+
if (!wrap) return;
|
| 355 |
+
wrap.innerHTML = "";
|
| 356 |
+
const rows = Array.isArray(S.lineages) ? S.lineages : [];
|
| 357 |
+
rows.forEach((e) => {
|
| 358 |
+
const row = document.createElement("div");
|
| 359 |
+
row.style.cssText = "display:flex;justify-content:space-between;gap:8px;font-size:10.5px;border-bottom:1px solid #12202b;padding:2px 0";
|
| 360 |
+
const left = document.createElement("span");
|
| 361 |
+
left.style.cssText = "color:#c9d6df;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;max-width:58%";
|
| 362 |
+
left.textContent = (e.title || e.id || "?");
|
| 363 |
+
const val = document.createElement("b");
|
| 364 |
+
const vrd = e.verdict ? String(e.verdict) : "UNKNOWN-ORIGIN";
|
| 365 |
+
const hex = "#" + _verdictColor(e.verdict).toString(16).padStart(6, "0");
|
| 366 |
+
val.style.cssText = "color:" + hex + ";font-variant-numeric:tabular-nums;text-align:right;max-width:42%;overflow-wrap:anywhere";
|
| 367 |
+
const origin = e.origin ? String(e.origin) : "UNKNOWN";
|
| 368 |
+
val.textContent = vrd + " · " + origin;
|
| 369 |
+
row.appendChild(left); row.appendChild(val);
|
| 370 |
+
wrap.appendChild(row);
|
| 371 |
+
});
|
| 372 |
+
}
|
| 373 |
+
|
| 374 |
+
function _paintOverlay() {
|
| 375 |
+
const t = _tok(S.state);
|
| 376 |
+
const vrd = t || (S.verdict || "—");
|
| 377 |
+
const agg = S.agg || {};
|
| 378 |
+
if (_show) {
|
| 379 |
+
_show.setChip("lbl", S.label || "MODELED", { text: "lineage" });
|
| 380 |
+
_show.setChip("vrd", vrd, { text: "verdict" });
|
| 381 |
+
}
|
| 382 |
+
_set("bl-verdict", vrd);
|
| 383 |
+
_set("bl-nodes", t || _n(agg.total_nodes != null ? agg.total_nodes : (S.lineages ? S.lineages.length : null)));
|
| 384 |
+
_set("bl-traced", t || _n(agg.traced));
|
| 385 |
+
_set("bl-partial", t || _n(agg.partial_lineage));
|
| 386 |
+
_set("bl-unknown", t || _n(agg.unknown_origin));
|
| 387 |
+
_set("bl-fractr", t || (typeof agg.fraction_traced === "number" ? agg.fraction_traced.toFixed(3) : "—"));
|
| 388 |
+
_set("bl-locked", t || (S.locked != null ? String(S.locked) : "—"));
|
| 389 |
+
_set("bl-lambda", t || (S.lambda || "—"));
|
| 390 |
+
if (_plain) _applyPlain();
|
| 391 |
+
}
|
| 392 |
+
|
| 393 |
+
// =============================================================================
|
| 394 |
+
export function unmount() {
|
| 395 |
+
_polls.forEach((p) => { try { p.stop(); } catch (_) {} }); _polls = [];
|
| 396 |
+
try { if (_show) _show.destroy(); } catch (_) {}
|
| 397 |
+
try {
|
| 398 |
+
_disposeRoots();
|
| 399 |
+
if (_group && _stage) {
|
| 400 |
+
_group.traverse((o) => {
|
| 401 |
+
if (o.geometry && o.geometry.dispose) o.geometry.dispose();
|
| 402 |
+
if (o.material) {
|
| 403 |
+
const ms = Array.isArray(o.material) ? o.material : [o.material];
|
| 404 |
+
ms.forEach((mm) => { if (mm.dispose) mm.dispose(); });
|
| 405 |
+
}
|
| 406 |
+
});
|
| 407 |
+
_stage.scene.remove(_group);
|
| 408 |
+
}
|
| 409 |
+
} catch (_) {}
|
| 410 |
+
_group = _show = null;
|
| 411 |
+
_keystone = null; _roots = [];
|
| 412 |
+
_el = {}; _badge = null; _plain = false; _frameReg = false;
|
| 413 |
+
_stage = _THREE = _ctx = null;
|
| 414 |
+
S.label = S.verdict = S.reason = S.query = null;
|
| 415 |
+
S.lineages = []; S.agg = {};
|
| 416 |
+
S.lambda = S.locked = S.trustCeil = null; S.state = "init";
|
| 417 |
+
}
|
| 418 |
+
|
| 419 |
+
export default { id: ID, title: TITLE, endpoints: [EP], mount, unmount };
|