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: 833 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/episodic.js +437 -0
static/3d/holographic.html
CHANGED
|
@@ -73,6 +73,7 @@ const SURFACES = [
|
|
| 73 |
{ id: "interpretability", title: "Interpretability", mod: "/static/3d/surfaces/interpretability.js" },
|
| 74 |
{ id: "worldmodel", title: "World Model", mod: "/static/3d/surfaces/worldmodel.js" },
|
| 75 |
{ id: "qec", title: "Topological QEC", mod: "/static/3d/surfaces/qec.js" },
|
|
|
|
| 76 |
{ id: "energy", title: "Energy", mod: "/static/3d/surfaces/energy.js" },
|
| 77 |
{ id: "fabric", title: "Fabric", mod: "/static/3d/surfaces/fabric.js" },
|
| 78 |
{ id: "pnt", title: "PNT", mod: "/static/3d/surfaces/pnt.js" },
|
|
|
|
| 73 |
{ id: "interpretability", title: "Interpretability", mod: "/static/3d/surfaces/interpretability.js" },
|
| 74 |
{ id: "worldmodel", title: "World Model", mod: "/static/3d/surfaces/worldmodel.js" },
|
| 75 |
{ id: "qec", title: "Topological QEC", mod: "/static/3d/surfaces/qec.js" },
|
| 76 |
+
{ id: "episodic", title: "Episodic Memory", mod: "/static/3d/surfaces/episodic.js" },
|
| 77 |
{ id: "energy", title: "Energy", mod: "/static/3d/surfaces/energy.js" },
|
| 78 |
{ id: "fabric", title: "Fabric", mod: "/static/3d/surfaces/fabric.js" },
|
| 79 |
{ id: "pnt", title: "PNT", mod: "/static/3d/surfaces/pnt.js" },
|
static/3d/surfaces/episodic.js
ADDED
|
@@ -0,0 +1,437 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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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/episodic.js — GOVERNED EPISODIC-MEMORY / TEMPORAL KNOWLEDGE-GRAPH organ for
|
| 5 |
+
// the holographic frontier ring, clean-room-inspired by (NOT a reproduction of)
|
| 6 |
+
// MemMachine's episodic/graph memory idea (github.com/MemMachine/MemMachine, Apache-2.0).
|
| 7 |
+
//
|
| 8 |
+
// Renders a small graph of "episodes" (event/fact nodes) positioned along a TIME axis,
|
| 9 |
+
// sized by MODELED salience, linked by temporal-succession (chronological chain) and
|
| 10 |
+
// semantic-relatedness (cosine of a MODELED embedding) edges. On each poll, the top-k
|
| 11 |
+
// RECALL result for the query episode lights up (recency*salience*relatedness score).
|
| 12 |
+
// Honesty label "MODELED" is read VERBATIM from the JSON and displayed as-is; it is
|
| 13 |
+
// never upgraded. Every episode also carries a real content hash + an explicitly
|
| 14 |
+
// labeled HONEST-STUB receipt (never presented as a real Sigstore/DSSE signature).
|
| 15 |
+
//
|
| 16 |
+
// Surface export shape (mirrors interpretability.js / worldmodel.js exactly):
|
| 17 |
+
// export default { id, title, endpoints, mount(ctx), unmount() }
|
| 18 |
+
// ctx = { stage, container, live, label, THREE, szl3d }
|
| 19 |
+
//
|
| 20 |
+
// DATA SHOWN (all from live endpoint):
|
| 21 |
+
// graph.episodes[] — {id, text, t, salience, content_hash, honesty_receipt}
|
| 22 |
+
// graph.edges[] — {src, dst, type: temporal-succession|semantic-relatedness, weight}
|
| 23 |
+
// recall.top_k[] — {id, score, components:{recency,salience,relatedness}, rank}
|
| 24 |
+
// scoring_formula — exact deterministic recall formula (shown in overlay)
|
| 25 |
+
//
|
| 26 |
+
// LEADERS ADOPTED & CITED (clean-room; NOT claimed as SZL's own):
|
| 27 |
+
// MemMachine — episodic/graph memory (Apache-2.0):
|
| 28 |
+
// https://github.com/MemMachine/MemMachine
|
| 29 |
+
// Tulving (1972) "Episodic and Semantic Memory" — classic episodic/semantic distinction:
|
| 30 |
+
// https://alicekim.ca/EpisodicSemantic.pdf
|
| 31 |
+
// Zep / Graphiti — temporal knowledge-graph memory (related open approach):
|
| 32 |
+
// https://github.com/getzep/graphiti
|
| 33 |
+
//
|
| 34 |
+
// HONESTY LABELS: MODELED (deterministic simulation of the episodic-graph PATTERN;
|
| 35 |
+
// PUBLIC/synthetic episode content only; embeddings are a MODELED construction, not a
|
| 36 |
+
// real trained embedding model). Read verbatim from JSON; never upgraded here.
|
| 37 |
+
// COLOURS: lattice-blue 0x5b8dee (episode nodes / temporal edges), violet-blue 0x8a6bff
|
| 38 |
+
// (recalled top-k flash + semantic-relatedness edges — data-viz only), proof-teal
|
| 39 |
+
// 0x3af4c8 (query marker / receipt accent), greys for degraded/no-data. Purple BANNED
|
| 40 |
+
// as UI/background.
|
| 41 |
+
// 0 RUNTIME CDN. Vendored three.js r170 via page importmap.
|
| 42 |
+
// DOCTRINE v11: degrades gracefully (grey) on 404/error; honesty label still shown.
|
| 43 |
+
|
| 44 |
+
const ID = "episodic";
|
| 45 |
+
const TITLE = "Episodic Memory · Temporal Knowledge-Graph (live)";
|
| 46 |
+
|
| 47 |
+
// Endpoint is hosted on the dedicated killinchu Space (isolated compute), reached
|
| 48 |
+
// cross-origin (killinchu returns access-control-allow-origin: https://a-11-oy.com).
|
| 49 |
+
// This keeps the episodic-memory organ's rebuilds/faults isolated from the flagship.
|
| 50 |
+
const EP = "https://szlholdings-killinchu.hf.space/api/killinchu/v1/episodic/recall?seed=42&k=3&query=what%20did%20I%20ask%20about%20earlier%3F&n_episodes=12";
|
| 51 |
+
|
| 52 |
+
// data-viz hues — purple BANNED
|
| 53 |
+
const C_NODE = 0x5b8dee; // lattice-blue (episode node / temporal-succession edge)
|
| 54 |
+
const C_TOP = 0x8a6bff; // violet-blue (recalled top-k flash + relatedness edges — data-viz only)
|
| 55 |
+
const C_DIM = 0x42505d; // grey (degraded / no-live-data / non-recalled node)
|
| 56 |
+
const C_ACCENT = 0x3af4c8; // proof-teal accent (query marker / receipt ring)
|
| 57 |
+
const C_GRID = 0x1b3a44; // floor / link colour
|
| 58 |
+
|
| 59 |
+
const N_SLOTS = 16; // visual episode slots (matches endpoint n_episodes cap)
|
| 60 |
+
const SPAN_X = 16; // world-unit span of the time axis
|
| 61 |
+
|
| 62 |
+
let _stage = null, _THREE = null, _ctx = null, _group = null, _overlay = null;
|
| 63 |
+
let _frameReg = false, _polls = [], _el = {}, _badge = null;
|
| 64 |
+
let _plain = false;
|
| 65 |
+
|
| 66 |
+
// geometry handles
|
| 67 |
+
let _nodes = []; // Array<THREE.Mesh> — one per episode
|
| 68 |
+
let _tempoLinks = null; // THREE.LineSegments — temporal-succession chain
|
| 69 |
+
let _semLinks = null; // THREE.LineSegments — semantic-relatedness edges
|
| 70 |
+
let _queryMarker = null; // THREE.Mesh — the query episode ("now")
|
| 71 |
+
|
| 72 |
+
// per-node flash timers (recall highlight)
|
| 73 |
+
const _flash = new Float32Array(N_SLOTS);
|
| 74 |
+
|
| 75 |
+
// live state
|
| 76 |
+
const S = {
|
| 77 |
+
label: null,
|
| 78 |
+
episodes: null, // Array<{id,text,t,salience,content_hash,honesty_receipt}>
|
| 79 |
+
edges: null, // Array<{src,dst,type,weight}>
|
| 80 |
+
topK: null, // Array<{id,score,components,rank}>
|
| 81 |
+
query: null, // query text
|
| 82 |
+
formula: null, // scoring_formula string
|
| 83 |
+
receiptType: null, // "HONEST-STUB" (verbatim)
|
| 84 |
+
state: "init",
|
| 85 |
+
};
|
| 86 |
+
|
| 87 |
+
// =============================================================================
|
| 88 |
+
// mount(ctx)
|
| 89 |
+
// =============================================================================
|
| 90 |
+
export function mount(ctx) {
|
| 91 |
+
_ctx = ctx; _stage = ctx.stage; _THREE = ctx.THREE;
|
| 92 |
+
_group = new _THREE.Group();
|
| 93 |
+
_stage.scene.add(_group);
|
| 94 |
+
_stage.camera.position.set(0, 8, 22);
|
| 95 |
+
try { if (_stage.controls && _stage.controls.target) { _stage.controls.target.set(0, 1.5, 0); _stage.controls.update(); } } catch (_) {}
|
| 96 |
+
try { _stage.setBloom(true); } catch (_) {}
|
| 97 |
+
|
| 98 |
+
_buildFloor();
|
| 99 |
+
_buildNodes();
|
| 100 |
+
_buildQueryMarker();
|
| 101 |
+
|
| 102 |
+
if (!_frameReg) { _stage.onFrame(_onFrame); _frameReg = true; }
|
| 103 |
+
|
| 104 |
+
_badge = ctx.live.createBadge();
|
| 105 |
+
_polls.push(ctx.live.poll(EP, 5000, _onRecall, { badge: _badge, onState: (m) => { S.state = m.state; _paintOverlay(); } }));
|
| 106 |
+
|
| 107 |
+
_buildOverlay();
|
| 108 |
+
return { id: ID, started: true };
|
| 109 |
+
}
|
| 110 |
+
|
| 111 |
+
// =============================================================================
|
| 112 |
+
// builders
|
| 113 |
+
// =============================================================================
|
| 114 |
+
function _buildFloor() {
|
| 115 |
+
const THREE = _THREE;
|
| 116 |
+
const grid = new THREE.GridHelper(40, 40, C_GRID, 0x0f2027);
|
| 117 |
+
grid.material.opacity = 0.18; grid.material.transparent = true; grid.position.y = -0.01;
|
| 118 |
+
_group.add(grid);
|
| 119 |
+
}
|
| 120 |
+
|
| 121 |
+
function _buildNodes() {
|
| 122 |
+
const THREE = _THREE;
|
| 123 |
+
const geo = new THREE.SphereGeometry(0.22, 14, 10);
|
| 124 |
+
_nodes = [];
|
| 125 |
+
for (let i = 0; i < N_SLOTS; i++) {
|
| 126 |
+
const mat = new THREE.MeshStandardMaterial({
|
| 127 |
+
color: C_DIM, emissive: C_DIM, emissiveIntensity: 0.15,
|
| 128 |
+
metalness: 0.25, roughness: 0.55,
|
| 129 |
+
});
|
| 130 |
+
const mesh = new THREE.Mesh(geo, mat);
|
| 131 |
+
// placeholder position; laid out along time axis once live data arrives
|
| 132 |
+
mesh.position.set((i / N_SLOTS) * SPAN_X - SPAN_X / 2, 1.4, 0);
|
| 133 |
+
_group.add(mesh);
|
| 134 |
+
_nodes.push(mesh);
|
| 135 |
+
}
|
| 136 |
+
}
|
| 137 |
+
|
| 138 |
+
function _buildQueryMarker() {
|
| 139 |
+
const THREE = _THREE;
|
| 140 |
+
// Query episode = "now" — a pulsing teal marker at the far end of the time axis.
|
| 141 |
+
_queryMarker = new THREE.Mesh(
|
| 142 |
+
new THREE.OctahedronGeometry(0.42, 0),
|
| 143 |
+
new THREE.MeshStandardMaterial({ color: C_ACCENT, emissive: C_ACCENT, emissiveIntensity: 0.4, wireframe: true, transparent: true, opacity: 0.6 }),
|
| 144 |
+
);
|
| 145 |
+
_queryMarker.position.set(SPAN_X / 2 + 1.4, 1.4, 0);
|
| 146 |
+
_group.add(_queryMarker);
|
| 147 |
+
}
|
| 148 |
+
|
| 149 |
+
// =============================================================================
|
| 150 |
+
// live data handler
|
| 151 |
+
// =============================================================================
|
| 152 |
+
function _onRecall(j) {
|
| 153 |
+
// read honesty label VERBATIM — never upgrade
|
| 154 |
+
S.label = (j.label || "MODELED").toUpperCase();
|
| 155 |
+
const g = j.graph || {};
|
| 156 |
+
S.episodes = Array.isArray(g.episodes) ? g.episodes : null;
|
| 157 |
+
S.edges = Array.isArray(g.edges) ? g.edges : null;
|
| 158 |
+
const rec = j.recall || {};
|
| 159 |
+
S.topK = Array.isArray(rec.top_k) ? rec.top_k : null;
|
| 160 |
+
S.query = (rec.query_episode && rec.query_episode.text) || j.query || null;
|
| 161 |
+
S.formula = j.scoring_formula || null;
|
| 162 |
+
const firstReceipt = S.episodes && S.episodes[0] && S.episodes[0].honesty_receipt;
|
| 163 |
+
S.receiptType = (firstReceipt && firstReceipt.type) || null;
|
| 164 |
+
|
| 165 |
+
_layoutGraph();
|
| 166 |
+
_paintOverlay();
|
| 167 |
+
}
|
| 168 |
+
|
| 169 |
+
// =============================================================================
|
| 170 |
+
// geometry updater — lays out nodes on the time axis, draws edges, highlights top-k
|
| 171 |
+
// =============================================================================
|
| 172 |
+
function _layoutGraph() {
|
| 173 |
+
const THREE = _THREE;
|
| 174 |
+
const live = S.state === "live";
|
| 175 |
+
const episodes = S.episodes || [];
|
| 176 |
+
const edges = S.edges || [];
|
| 177 |
+
const topK = S.topK || [];
|
| 178 |
+
const topIds = new Set(topK.map((r) => r.id));
|
| 179 |
+
|
| 180 |
+
if (!episodes.length) {
|
| 181 |
+
_nodes.forEach((mesh) => {
|
| 182 |
+
mesh.material.color.setHex(C_DIM);
|
| 183 |
+
mesh.material.emissive.setHex(C_DIM);
|
| 184 |
+
mesh.material.emissiveIntensity = 0.1;
|
| 185 |
+
mesh.scale.setScalar(0.5);
|
| 186 |
+
});
|
| 187 |
+
if (_tempoLinks) { _tempoLinks.material.opacity = 0.1; }
|
| 188 |
+
if (_semLinks) { _semLinks.material.opacity = 0.06; }
|
| 189 |
+
return;
|
| 190 |
+
}
|
| 191 |
+
|
| 192 |
+
const tMin = Math.min(...episodes.map((e) => e.t));
|
| 193 |
+
const tMax = Math.max(...episodes.map((e) => e.t));
|
| 194 |
+
const tSpan = Math.max(tMax - tMin, 1e-6);
|
| 195 |
+
const idToPos = {};
|
| 196 |
+
|
| 197 |
+
episodes.forEach((e, i) => {
|
| 198 |
+
const mesh = _nodes[i % _nodes.length];
|
| 199 |
+
const nx = ((e.t - tMin) / tSpan) * SPAN_X - SPAN_X / 2;
|
| 200 |
+
mesh.position.set(nx, 1.4, 0);
|
| 201 |
+
idToPos[e.id] = mesh.position.clone();
|
| 202 |
+
|
| 203 |
+
const sal = typeof e.salience === "number" ? e.salience : 0.5;
|
| 204 |
+
const recalled = topIds.has(e.id);
|
| 205 |
+
const col = live ? (recalled ? C_TOP : C_NODE) : C_DIM;
|
| 206 |
+
mesh.material.color.setHex(col);
|
| 207 |
+
mesh.material.emissive.setHex(col);
|
| 208 |
+
mesh.material.emissiveIntensity = live ? (recalled ? 0.85 : 0.25) : 0.1;
|
| 209 |
+
// node SIZE = salience (per spec)
|
| 210 |
+
mesh.scale.setScalar(live ? (0.55 + 1.1 * sal) : 0.5);
|
| 211 |
+
if (live && recalled) _flash[i % _flash.length] = 90;
|
| 212 |
+
});
|
| 213 |
+
|
| 214 |
+
// rebuild edge geometry (temporal-succession + semantic-relatedness)
|
| 215 |
+
const tempoPts = [];
|
| 216 |
+
const semPts = [];
|
| 217 |
+
edges.forEach((ed) => {
|
| 218 |
+
const a = idToPos[ed.src], b = idToPos[ed.dst];
|
| 219 |
+
if (!a || !b) return;
|
| 220 |
+
if (ed.type === "temporal-succession") { tempoPts.push(a, b); }
|
| 221 |
+
else { semPts.push(a, b); }
|
| 222 |
+
});
|
| 223 |
+
|
| 224 |
+
if (_tempoLinks) { _group.remove(_tempoLinks); _tempoLinks.geometry.dispose(); _tempoLinks.material.dispose(); _tempoLinks = null; }
|
| 225 |
+
if (_semLinks) { _group.remove(_semLinks); _semLinks.geometry.dispose(); _semLinks.material.dispose(); _semLinks = null; }
|
| 226 |
+
|
| 227 |
+
if (tempoPts.length) {
|
| 228 |
+
const g = new THREE.BufferGeometry().setFromPoints(tempoPts);
|
| 229 |
+
_tempoLinks = new THREE.LineSegments(g, new THREE.LineBasicMaterial({ color: live ? C_NODE : C_DIM, transparent: true, opacity: live ? 0.5 : 0.12 }));
|
| 230 |
+
_group.add(_tempoLinks);
|
| 231 |
+
}
|
| 232 |
+
if (semPts.length) {
|
| 233 |
+
const g = new THREE.BufferGeometry().setFromPoints(semPts);
|
| 234 |
+
_semLinks = new THREE.LineSegments(g, new THREE.LineBasicMaterial({ color: live ? C_TOP : C_DIM, transparent: true, opacity: live ? 0.32 : 0.08 }));
|
| 235 |
+
_group.add(_semLinks);
|
| 236 |
+
}
|
| 237 |
+
|
| 238 |
+
if (_queryMarker) {
|
| 239 |
+
const qcol = live ? C_ACCENT : C_DIM;
|
| 240 |
+
_queryMarker.material.color.setHex(qcol);
|
| 241 |
+
_queryMarker.material.emissive.setHex(qcol);
|
| 242 |
+
_queryMarker.material.emissiveIntensity = live ? 0.5 : 0.15;
|
| 243 |
+
_queryMarker.material.opacity = live ? 0.7 : 0.3;
|
| 244 |
+
}
|
| 245 |
+
}
|
| 246 |
+
|
| 247 |
+
// =============================================================================
|
| 248 |
+
// per-frame animation
|
| 249 |
+
// =============================================================================
|
| 250 |
+
function _onFrame() {
|
| 251 |
+
const t = performance.now();
|
| 252 |
+
if (_group) _group.rotation.y = Math.sin(t * 0.0001) * 0.15;
|
| 253 |
+
if (_queryMarker) { _queryMarker.rotation.y += 0.01; _queryMarker.rotation.x += 0.004; }
|
| 254 |
+
|
| 255 |
+
const live = S.state === "live";
|
| 256 |
+
_nodes.forEach((mesh, i) => {
|
| 257 |
+
if (_flash[i] > 0) {
|
| 258 |
+
_flash[i] -= 1;
|
| 259 |
+
const f = _flash[i] / 90;
|
| 260 |
+
const col = live ? C_TOP : C_DIM;
|
| 261 |
+
mesh.material.emissive.setHex(col);
|
| 262 |
+
mesh.material.emissiveIntensity = Math.max(mesh.material.emissiveIntensity, 0.2 + 0.9 * f);
|
| 263 |
+
}
|
| 264 |
+
});
|
| 265 |
+
}
|
| 266 |
+
|
| 267 |
+
// =============================================================================
|
| 268 |
+
// overlay
|
| 269 |
+
// =============================================================================
|
| 270 |
+
function _buildOverlay() {
|
| 271 |
+
const ctx = _ctx;
|
| 272 |
+
_overlay = document.createElement("div");
|
| 273 |
+
Object.assign(_overlay.style, {
|
| 274 |
+
position: "absolute", left: "14px", top: "14px", zIndex: "6",
|
| 275 |
+
display: "flex", flexDirection: "column", gap: "8px",
|
| 276 |
+
maxWidth: "min(94%,440px)",
|
| 277 |
+
font: "12px ui-sans-serif,system-ui,Segoe UI,Roboto,Arial",
|
| 278 |
+
color: "#eef3f6",
|
| 279 |
+
});
|
| 280 |
+
|
| 281 |
+
const h = document.createElement("div");
|
| 282 |
+
h.style.cssText = "font:600 13px ui-sans-serif,system-ui;letter-spacing:.4px";
|
| 283 |
+
h.textContent = TITLE;
|
| 284 |
+
_overlay.appendChild(h);
|
| 285 |
+
|
| 286 |
+
const sub = document.createElement("div");
|
| 287 |
+
sub.style.cssText = "color:#9fb1bf;font-size:11px;line-height:1.55";
|
| 288 |
+
sub.innerHTML =
|
| 289 |
+
'A small graph of <b>episodes</b> (event/fact nodes) laid out on a time axis, sized by ' +
|
| 290 |
+
'<b>salience</b>, linked by temporal-succession and semantic-relatedness edges. A ' +
|
| 291 |
+
'<b>RECALL</b> query lights up the top-k episodes by recency\u00d7salience\u00d7relatedness. ' +
|
| 292 |
+
'Honesty label <b>MODELED</b> (synthetic/public episodes; clean-room-inspired by ' +
|
| 293 |
+
'MemMachine\u2019s episodic/graph memory idea \u2014 not a reproduction). 0 runtime CDN.';
|
| 294 |
+
_overlay.appendChild(sub);
|
| 295 |
+
|
| 296 |
+
const brow = document.createElement("div");
|
| 297 |
+
brow.style.cssText = "display:flex;gap:8px;align-items:center;flex-wrap:wrap";
|
| 298 |
+
if (_badge && _badge.el) brow.appendChild(_badge.el);
|
| 299 |
+
_overlay.appendChild(brow);
|
| 300 |
+
|
| 301 |
+
const card = document.createElement("div");
|
| 302 |
+
card.style.cssText = "background:#0a1117;border:1px solid #1d2a36;border-radius:9px;padding:9px 10px;display:flex;flex-direction:column;gap:6px";
|
| 303 |
+
|
| 304 |
+
const chead = document.createElement("div");
|
| 305 |
+
chead.style.cssText = "display:flex;align-items:center;gap:8px;flex-wrap:wrap";
|
| 306 |
+
const dot = document.createElement("span");
|
| 307 |
+
dot.style.cssText = "width:9px;height:9px;border-radius:50%;background:#5b8dee;box-shadow:0 0 7px #5b8dee";
|
| 308 |
+
const nm = document.createElement("b");
|
| 309 |
+
nm.style.cssText = "font-size:12px;color:#5b8dee;letter-spacing:.3px";
|
| 310 |
+
nm.textContent = "episodic";
|
| 311 |
+
chead.appendChild(dot); chead.appendChild(nm);
|
| 312 |
+
card.appendChild(chead);
|
| 313 |
+
|
| 314 |
+
const grid = document.createElement("div");
|
| 315 |
+
grid.style.cssText = "display:grid;grid-template-columns:1fr;gap:4px";
|
| 316 |
+
|
| 317 |
+
function kpiRow(id, label) {
|
| 318 |
+
const r = document.createElement("div");
|
| 319 |
+
r.style.cssText = "display:flex;justify-content:space-between;gap:10px;font-size:11px";
|
| 320 |
+
const l = document.createElement("span"); l.style.cssText = "color:#9fb1bf"; l.textContent = label;
|
| 321 |
+
const v = document.createElement("b");
|
| 322 |
+
v.id = id;
|
| 323 |
+
v.style.cssText = "font-variant-numeric:tabular-nums;color:#eef3f6;text-align:right;max-width:58%";
|
| 324 |
+
v.textContent = "\u2014";
|
| 325 |
+
_el[id] = v;
|
| 326 |
+
r.appendChild(l); r.appendChild(v); return r;
|
| 327 |
+
}
|
| 328 |
+
|
| 329 |
+
grid.appendChild(kpiRow("ep-n", "episodes in graph"));
|
| 330 |
+
grid.appendChild(kpiRow("ep-query", "recall query"));
|
| 331 |
+
grid.appendChild(kpiRow("ep-top1", "top recall (id, score)"));
|
| 332 |
+
grid.appendChild(kpiRow("ep-receipt", "receipt type"));
|
| 333 |
+
grid.appendChild(kpiRow("ep-label", "honesty label"));
|
| 334 |
+
card.appendChild(grid);
|
| 335 |
+
|
| 336 |
+
const fn = document.createElement("div");
|
| 337 |
+
fn.style.cssText = "font-size:9.5px;color:#6b7a86;line-height:1.5";
|
| 338 |
+
fn.textContent = "MemMachine github.com/MemMachine/MemMachine (Apache-2.0) \u00b7 Tulving (1972) episodic/semantic memory \u00b7 Zep/Graphiti github.com/getzep/graphiti. MODELED \u00b7 not claimed-as.";
|
| 339 |
+
card.appendChild(fn);
|
| 340 |
+
_overlay.appendChild(card);
|
| 341 |
+
|
| 342 |
+
const pl = document.createElement("button");
|
| 343 |
+
pl.textContent = "\u25d1 what this means";
|
| 344 |
+
pl.title = "Toggle plain-language explanation for investors & consumers.";
|
| 345 |
+
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";
|
| 346 |
+
pl.addEventListener("click", () => {
|
| 347 |
+
_plain = !_plain;
|
| 348 |
+
pl.style.background = _plain ? "#0f2a20" : "#08140f";
|
| 349 |
+
_applyPlain();
|
| 350 |
+
});
|
| 351 |
+
_overlay.appendChild(pl);
|
| 352 |
+
|
| 353 |
+
const pd = document.createElement("div");
|
| 354 |
+
pd.id = "ep-plain";
|
| 355 |
+
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";
|
| 356 |
+
_el["plain"] = pd;
|
| 357 |
+
_overlay.appendChild(pd);
|
| 358 |
+
|
| 359 |
+
(ctx.container || document.body).appendChild(_overlay);
|
| 360 |
+
_paintOverlay();
|
| 361 |
+
}
|
| 362 |
+
|
| 363 |
+
function _applyPlain() {
|
| 364 |
+
const pd = _el["plain"];
|
| 365 |
+
if (!pd) return;
|
| 366 |
+
pd.style.display = _plain ? "block" : "none";
|
| 367 |
+
if (!_plain) return;
|
| 368 |
+
const n = S.episodes ? String(S.episodes.length) : "loading\u2026";
|
| 369 |
+
const top0 = (S.topK && S.topK[0]) ? S.topK[0] : null;
|
| 370 |
+
const topTxt = top0 ? (top0.id + " (score " + fx(top0.score, 3) + ")") : "loading\u2026";
|
| 371 |
+
const rtype = S.receiptType || "loading\u2026";
|
| 372 |
+
pd.innerHTML =
|
| 373 |
+
"<b>What this means:</b> Most AI systems today either forget everything between " +
|
| 374 |
+
"sessions or dump raw transcripts into a vector store. This organ demonstrates a " +
|
| 375 |
+
"<b>third option</b>: memories as a small, auditable <b>graph</b> of discrete " +
|
| 376 |
+
"\u201cepisodes\u201d (here, <b>" + n + "</b> of them) connected by time and meaning. " +
|
| 377 |
+
"Asking a question triggers a <b>recall</b> that ranks episodes by how recent, how " +
|
| 378 |
+
"important (salience), and how related they are \u2014 right now the top match is " +
|
| 379 |
+
"<b>" + topTxt + "</b>. Every episode carries a real content fingerprint plus a " +
|
| 380 |
+
"clearly labeled <b>" + rtype + "</b> receipt \u2014 an honest placeholder for real " +
|
| 381 |
+
"cryptographic signing, never faked as one. " +
|
| 382 |
+
"Plain: this is what \u201cthe AI remembers what happened, and can prove what it " +
|
| 383 |
+
"remembers,\u201d looks like \u2014 but this view is a <b>MODELED</b> demonstration with " +
|
| 384 |
+
"synthetic/public data, not a production memory store.";
|
| 385 |
+
}
|
| 386 |
+
|
| 387 |
+
function _tok(s) {
|
| 388 |
+
if (s === "live") return null;
|
| 389 |
+
if (s === "missing") return "NO-LIVE-DATA";
|
| 390 |
+
if (s === "degraded") return "DEGRADED";
|
| 391 |
+
if (s === "error") return "OFFLINE";
|
| 392 |
+
return "\u2026";
|
| 393 |
+
}
|
| 394 |
+
|
| 395 |
+
function fx(v, d) { return typeof v === "number" ? v.toFixed(d) : "\u2014"; }
|
| 396 |
+
function _set(id, v) { if (_el[id]) _el[id].textContent = v; }
|
| 397 |
+
|
| 398 |
+
function _paintOverlay() {
|
| 399 |
+
const t = _tok(S.state);
|
| 400 |
+
_set("ep-n", t || (S.episodes != null ? String(S.episodes.length) : "\u2014"));
|
| 401 |
+
_set("ep-query", t || (S.query || "\u2014"));
|
| 402 |
+
const top0 = (S.topK && S.topK[0]) ? S.topK[0] : null;
|
| 403 |
+
_set("ep-top1", t || (top0 ? (top0.id + " (score " + fx(top0.score, 4) + ")") : "\u2014"));
|
| 404 |
+
_set("ep-receipt", t || (S.receiptType || "\u2014"));
|
| 405 |
+
// honesty label verbatim — never upgraded
|
| 406 |
+
_set("ep-label", t || (S.label || "MODELED"));
|
| 407 |
+
if (_plain) _applyPlain();
|
| 408 |
+
}
|
| 409 |
+
|
| 410 |
+
// =============================================================================
|
| 411 |
+
// unmount — clean up everything; must not affect other organs
|
| 412 |
+
// =============================================================================
|
| 413 |
+
export function unmount() {
|
| 414 |
+
_polls.forEach((p) => { try { p.stop(); } catch (_) {} }); _polls = [];
|
| 415 |
+
try { if (_overlay && _overlay.parentNode) _overlay.parentNode.removeChild(_overlay); } catch (_) {}
|
| 416 |
+
try {
|
| 417 |
+
if (_group && _stage) {
|
| 418 |
+
_group.traverse((o) => {
|
| 419 |
+
if (o.geometry && o.geometry.dispose) o.geometry.dispose();
|
| 420 |
+
if (o.material) {
|
| 421 |
+
const ms = Array.isArray(o.material) ? o.material : [o.material];
|
| 422 |
+
ms.forEach((m) => { if (m.dispose) m.dispose(); });
|
| 423 |
+
}
|
| 424 |
+
});
|
| 425 |
+
_stage.scene.remove(_group);
|
| 426 |
+
}
|
| 427 |
+
} catch (_) {}
|
| 428 |
+
_group = _overlay = null;
|
| 429 |
+
_nodes = []; _tempoLinks = null; _semLinks = null; _queryMarker = null;
|
| 430 |
+
_el = {}; _badge = null; _plain = false; _frameReg = false;
|
| 431 |
+
_stage = _THREE = _ctx = null;
|
| 432 |
+
S.label = S.episodes = S.edges = S.topK = S.query = S.formula = S.receiptType = null;
|
| 433 |
+
S.state = "init";
|
| 434 |
+
_flash.fill(0);
|
| 435 |
+
}
|
| 436 |
+
|
| 437 |
+
export default { id: ID, title: TITLE, endpoints: [EP], mount, unmount };
|