betterwithage Claude Opus 4.7 commited on
Commit
0291a43
·
verified ·
1 Parent(s): 7a541ef

deploy(hf): sync szl-holdings/a11oy@main derived COPY set

Browse files

Reusable Dockerfile-COPY-derived deploy from szl-holdings/a11oy main.
Files: 882 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>

Files changed (1) hide show
  1. static/3d/surfaces/brain.js +306 -0
static/3d/surfaces/brain.js ADDED
@@ -0,0 +1,306 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ // SPDX-License-Identifier: Apache-2.0
2
+ // © 2026 Lutar, Stephen P. — SZL Holdings · ORCID 0009-0001-0110-4173 · Doctrine v11
3
+ //
4
+ // surfaces/brain.js — FORMULA-GRAPH BRAIN (SZL ORIGINAL). Renders the estate's
5
+ // OWN proven-formula library as a self-organizing LIVING GRAPH: each formula is
6
+ // a NODE, each real proof/semantic dependency is an EDGE, and a MODELED
7
+ // spreading-activation ("firing") pulse propagates outward from the locked-8
8
+ // proven core across K rounds. This is the "make it our own" fusion — it reuses
9
+ // three field-leader mechanisms purely as visualization primitives:
10
+ // * DLA (arXiv:2606.10650) — importance-aware activation ROUTING (edge weights)
11
+ // * OPERA (arXiv:2606.25757) — intrinsic firing REWARD = proven-mass reached
12
+ // * Context-Ready (arXiv:2606.27538) — K-UNROLL as K spreading rounds
13
+ //
14
+ // THE GRAPH IS REAL: every node traces to a named Lean declaration in a cited
15
+ // lutar-lean file (kernel c7c0ba17) or a real DOI/arXiv. The FIRING DYNAMIC is
16
+ // MODELED (a deterministic toy on the real topology), read VERBATIM from
17
+ // /api/killinchu/v1/fgbrain/{graph,fire}. The honesty label "MODELED" is shown
18
+ // as-is and never upgraded.
19
+ //
20
+ // HARD INVARIANTS (Doctrine v11):
21
+ // * locked-proven = EXACTLY 8 {F1,F4,F7,F11,F12,F18,F19,F22}.
22
+ // * Λ unconditional uniqueness = Conjecture 1 -> GRAY node, NEVER green/proven.
23
+ // * Khipu BFT (Conj-2/3) -> GRAY, never green.
24
+ // * COLOURS: lattice-blue 0x5b8dee, violet-blue 0x8a6bff, proof-teal 0x3af4c8,
25
+ // greys. Purple BANNED as UI/background.
26
+ // * 0 runtime CDN (three.js via ctx.THREE). Degrades gracefully on 404.
27
+ //
28
+ // Surface export shape: export default { id, title, endpoints, mount(ctx), unmount() }
29
+ // ctx = { stage, container, live, label, THREE, szl3d }
30
+
31
+ const ID = "brain";
32
+ const TITLE = "Formula-Graph Brain";
33
+
34
+ const EP_GRAPH = "https://szlholdings-killinchu.hf.space/api/killinchu/v1/fgbrain/graph";
35
+ const EP_FIRE = "https://szlholdings-killinchu.hf.space/api/killinchu/v1/fgbrain/fire?seed=42&K=10";
36
+
37
+ // tier -> colour. proof-teal for the proven core, lattice-blue for verified/experimental,
38
+ // violet-blue for borrowed fusions, GREY for conjectures (never green).
39
+ const C_LOCKED = 0x3af4c8; // proof-teal (locked-proven core)
40
+ const C_SEMANT = 0x5b8dee; // lattice-blue (semantic-verified)
41
+ const C_EXPER = 0x5b8dee; // lattice-blue (experimental, dimmer)
42
+ const C_BORROW = 0x8a6bff; // violet-blue (borrowed field-leader fusions)
43
+ const C_CONJ = 0x5a6570; // GREY (conjectures — never green)
44
+ const C_EDGE = 0x1b3a44; // dim link
45
+ const C_DIM = 0x42505d; // grey (degraded / no live data)
46
+ const C_FIRE = 0x3af4c8; // firing pulse (proof-teal)
47
+
48
+ const TIER_COLOR = {
49
+ locked: C_LOCKED, semantic: C_SEMANT, experimental: C_EXPER,
50
+ borrowed: C_BORROW, conjecture: C_CONJ,
51
+ };
52
+ const TIER_RADIUS = { locked: 0.34, semantic: 0.24, experimental: 0.2, borrowed: 0.2, conjecture: 0.18 };
53
+
54
+ let _stage = null, _THREE = null, _ctx = null, _group = null, _overlay = null;
55
+ let _frameReg = false, _polls = [], _el = {}, _badge = null, _plain = false;
56
+
57
+ let _nodeMeshes = {}; // id -> mesh
58
+ let _edgeLines = []; // line segments
59
+ let _pos = {}; // id -> THREE.Vector3
60
+ let _t0 = 0;
61
+
62
+ const S = {
63
+ label: null, nodes: [], edges: [], tierCounts: null,
64
+ lockedCount: null, rewardPerK: null, rewardFinal: null,
65
+ nodesFired: null, conjGreen: null, state: "init",
66
+ };
67
+
68
+ // deterministic layout: concentric shells by tier (locked core -> outward),
69
+ // angle from a hash of the id (stable, no RNG needed on the client).
70
+ const SHELL = { locked: 0.0, semantic: 2.2, experimental: 3.6, borrowed: 4.8, conjecture: 6.0 };
71
+ function _hash(str) { let h = 2166136261 >>> 0; for (let i = 0; i < str.length; i++) { h ^= str.charCodeAt(i); h = Math.imul(h, 16777619) >>> 0; } return h; }
72
+
73
+ function _layout(nodes) {
74
+ _pos = {};
75
+ const byTier = {};
76
+ nodes.forEach((n) => { (byTier[n.tier] = byTier[n.tier] || []).push(n); });
77
+ Object.keys(byTier).forEach((tier) => {
78
+ const arr = byTier[tier];
79
+ const r = SHELL[tier] != null ? SHELL[tier] : 5.0;
80
+ arr.forEach((n, i) => {
81
+ const base = (_hash(n.id) % 360) * Math.PI / 180;
82
+ const ang = base + (i / Math.max(1, arr.length)) * 2 * Math.PI * 0.15;
83
+ const tilt = ((_hash(n.id + "y") % 200) / 200 - 0.5) * (tier === "locked" ? 1.1 : 2.2);
84
+ _pos[n.id] = new _THREE.Vector3(Math.cos(ang) * r, tilt, Math.sin(ang) * r);
85
+ });
86
+ });
87
+ }
88
+
89
+ function mount(ctx) {
90
+ _ctx = ctx; _stage = ctx.stage; _THREE = ctx.THREE;
91
+ _group = new _THREE.Group();
92
+ _stage.scene.add(_group);
93
+ _t0 = (typeof performance !== "undefined" ? performance.now() : Date.now());
94
+
95
+ _buildOverlay(ctx);
96
+ _badge = ctx.live.createBadge();
97
+
98
+ // Pull the real graph once, then poll the firing snapshot.
99
+ _polls.push(ctx.live.poll(EP_GRAPH, 0, _onGraph, { badge: _badge, onState: (m) => { S.state = m.state; _paintOverlay(); } }));
100
+ _polls.push(ctx.live.poll(EP_FIRE, 5000, _onFire, { onState: (m) => { S.state = m.state; _paintOverlay(); } }));
101
+
102
+ if (!_frameReg && _stage.onFrame) { _stage.onFrame(_animate); _frameReg = true; }
103
+ }
104
+
105
+ function _readLabel(j) {
106
+ const lbl = (j && j.label != null) ? j.label
107
+ : (j && j.payload && j.payload.label != null) ? j.payload.label : "MODELED";
108
+ return String(lbl).toUpperCase();
109
+ }
110
+
111
+ function _onGraph(j) {
112
+ if (!j || !_group) { S.state = "error"; _paintOverlay(); return; }
113
+ const p = j.payload || j;
114
+ S.label = _readLabel(j);
115
+ S.nodes = Array.isArray(p.nodes) ? p.nodes : [];
116
+ S.edges = Array.isArray(p.edges) ? p.edges : [];
117
+ S.lockedCount = p.locked_count != null ? p.locked_count : null;
118
+ _rebuildGraph();
119
+ _paintOverlay();
120
+ }
121
+
122
+ function _onFire(j) {
123
+ if (!j) return;
124
+ const p = j.payload || j;
125
+ S.label = _readLabel(j);
126
+ S.tierCounts = p.tier_counts || null;
127
+ S.rewardPerK = Array.isArray(p.firing_reward_per_k) ? p.firing_reward_per_k : null;
128
+ S.rewardFinal = p.firing_reward_final != null ? p.firing_reward_final : null;
129
+ S.nodesFired = p.nodes_fired != null ? p.nodes_fired : null;
130
+ S.conjGreen = p.conjecture_rendered_green != null ? p.conjecture_rendered_green : null;
131
+ if (p.locked_count != null) S.lockedCount = p.locked_count;
132
+ _paintOverlay();
133
+ }
134
+
135
+ function _clearGraph() {
136
+ Object.values(_nodeMeshes).forEach((m) => {
137
+ if (m.geometry && m.geometry.dispose) m.geometry.dispose();
138
+ if (m.material && m.material.dispose) m.material.dispose();
139
+ _group.remove(m);
140
+ });
141
+ _edgeLines.forEach((l) => {
142
+ if (l.geometry && l.geometry.dispose) l.geometry.dispose();
143
+ if (l.material && l.material.dispose) l.material.dispose();
144
+ _group.remove(l);
145
+ });
146
+ _nodeMeshes = {}; _edgeLines = [];
147
+ }
148
+
149
+ function _rebuildGraph() {
150
+ if (!_group || !S.nodes.length) return;
151
+ _clearGraph();
152
+ _layout(S.nodes);
153
+
154
+ // edges first (behind nodes)
155
+ S.edges.forEach((e) => {
156
+ const a = _pos[e.src], b = _pos[e.dst];
157
+ if (!a || !b) return;
158
+ const g = new _THREE.BufferGeometry().setFromPoints([a, b]);
159
+ const m = new _THREE.LineBasicMaterial({ color: C_EDGE, transparent: true, opacity: 0.5 });
160
+ const line = new _THREE.Line(g, m);
161
+ _edgeLines.push(line); _group.add(line);
162
+ });
163
+
164
+ // nodes
165
+ S.nodes.forEach((n) => {
166
+ const isConj = n.tier === "conjecture";
167
+ const col = TIER_COLOR[n.tier] != null ? TIER_COLOR[n.tier] : C_DIM;
168
+ const rad = TIER_RADIUS[n.tier] != null ? TIER_RADIUS[n.tier] : 0.2;
169
+ const geo = new _THREE.SphereGeometry(rad, 18, 18);
170
+ // conjecture nodes are flat/emissive-free grey so they can NEVER read as "fired green"
171
+ const mat = new _THREE.MeshStandardMaterial({
172
+ color: col,
173
+ emissive: isConj ? 0x000000 : col,
174
+ emissiveIntensity: isConj ? 0.0 : 0.28,
175
+ metalness: 0.1, roughness: isConj ? 0.95 : 0.5,
176
+ transparent: true, opacity: isConj ? 0.55 : 0.95,
177
+ });
178
+ const mesh = new _THREE.Mesh(geo, mat);
179
+ mesh.position.copy(_pos[n.id]);
180
+ mesh.userData = { id: n.id, tier: n.tier, isConj };
181
+ _nodeMeshes[n.id] = mesh; _group.add(mesh);
182
+ });
183
+ }
184
+
185
+ function _animate() {
186
+ if (!_group) return;
187
+ const now = (typeof performance !== "undefined" ? performance.now() : Date.now());
188
+ const t = (now - _t0) / 1000;
189
+ _group.rotation.y = t * 0.12;
190
+
191
+ // MODELED firing pulse: a wave that expands from the locked core outward each
192
+ // K, brightening proven nodes; conjecture nodes NEVER brighten (stay grey).
193
+ const K = S.rewardPerK ? S.rewardPerK.length : 10;
194
+ const phase = (t * 0.6) % (K + 2);
195
+ Object.values(_nodeMeshes).forEach((m) => {
196
+ if (!m.material) return;
197
+ if (m.userData.isConj) { m.material.emissiveIntensity = 0.0; return; } // gray-only invariant
198
+ const shell = SHELL[m.userData.tier] != null ? SHELL[m.userData.tier] : 5.0;
199
+ const reach = Math.max(0, 1 - Math.abs(phase - shell) * 0.8);
200
+ const base = m.userData.tier === "locked" ? 0.35 : 0.2;
201
+ m.material.emissiveIntensity = base + 0.6 * reach;
202
+ });
203
+ }
204
+
205
+ // =============================================================================
206
+ // overlay HUD
207
+ // =============================================================================
208
+ function _buildOverlay(ctx) {
209
+ _overlay = document.createElement("div");
210
+ _overlay.style.cssText =
211
+ "position:absolute;top:12px;left:12px;max-width:360px;font:12px/1.5 ui-monospace,Menlo,monospace;" +
212
+ "color:#cfe3ea;background:rgba(15,32,39,0.82);border:1px solid #1b3a44;border-radius:10px;padding:12px 14px;" +
213
+ "pointer-events:auto;backdrop-filter:blur(3px);z-index:20;";
214
+ _overlay.innerHTML =
215
+ '<div style="font-weight:700;letter-spacing:.03em;color:#eaf6f9;font-size:13px">Formula-Graph Brain ' +
216
+ '<span id="brain-label" style="float:right;font-size:10px;padding:1px 7px;border-radius:8px;background:#123;color:#3af4c8;border:1px solid #1b3a44">MODELED</span></div>' +
217
+ '<div style="margin-top:2px;color:#8fb3bd;font-size:10.5px">Our 180+ formulas as a living graph — the proven-8 core fires outward.</div>' +
218
+ '<hr style="border:0;border-top:1px solid #1b3a44;margin:8px 0">' +
219
+ _row("Nodes / Edges", "brain-ne") +
220
+ _row("Locked-proven", "brain-locked") +
221
+ _row("Firing reward (final)", "brain-reward") +
222
+ _row("Proven nodes fired", "brain-fired") +
223
+ _row("Conjectures shown green", "brain-conjgreen") +
224
+ '<div id="brain-tiers" style="margin-top:6px;font-size:10.5px;color:#8fb3bd"></div>' +
225
+ '<div style="margin-top:8px;display:flex;gap:10px;flex-wrap:wrap;font-size:10px;color:#9fc">' +
226
+ _leg(C_LOCKED, "proven-8") + _leg(C_SEMANT, "verified") + _leg(C_BORROW, "borrowed") + _leg(C_CONJ, "conjecture (gray)") +
227
+ '</div>' +
228
+ '<div style="margin-top:8px"><button id="brain-plain" style="font:11px ui-monospace;background:#0f2027;color:#9fc;' +
229
+ 'border:1px solid #1b3a44;border-radius:6px;padding:3px 8px;cursor:pointer">Plain language</button></div>' +
230
+ '<div id="brain-plainbox" style="display:none;margin-top:8px;font-size:10.5px;color:#bcd;line-height:1.55"></div>';
231
+ (ctx.container || document.body).appendChild(_overlay);
232
+ const btn = _overlay.querySelector("#brain-plain");
233
+ if (btn) btn.addEventListener("click", () => { _plain = !_plain; _applyPlain(); });
234
+ }
235
+ function _row(k, id) {
236
+ return '<div style="display:flex;justify-content:space-between;gap:12px;margin-top:3px">' +
237
+ '<span style="color:#8fb3bd">' + k + '</span><span id="' + id + '" style="color:#eaf6f9;font-variant-numeric:tabular-nums">—</span></div>';
238
+ }
239
+ function _leg(hex, txt) {
240
+ const c = "#" + hex.toString(16).padStart(6, "0");
241
+ return '<span><span style="display:inline-block;width:9px;height:9px;border-radius:50%;background:' + c + ';margin-right:4px;vertical-align:middle"></span>' + txt + '</span>';
242
+ }
243
+ function _set(id, v) { const e = _overlay && _overlay.querySelector("#" + id); if (e) e.textContent = v; }
244
+
245
+ function _paintOverlay() {
246
+ if (!_overlay) return;
247
+ const deg = (S.state === "error" || S.state === "degraded");
248
+ const d = deg ? "—" : null;
249
+ _set("brain-label", S.label || "MODELED");
250
+ _set("brain-ne", d || ((S.nodes.length || "—") + " / " + (S.edges.length || "—")));
251
+ _set("brain-locked", d || (S.lockedCount != null ? String(S.lockedCount) + " (exactly 8)" : "—"));
252
+ _set("brain-reward", d || (S.rewardFinal != null ? (S.rewardFinal * 100).toFixed(1) + "% mass" : "—"));
253
+ _set("brain-fired", d || (S.nodesFired != null ? String(S.nodesFired) : "—"));
254
+ _set("brain-conjgreen", d || (S.conjGreen != null ? (S.conjGreen + " (must be 0)") : "—"));
255
+ if (S.tierCounts) {
256
+ const t = S.tierCounts;
257
+ _set("brain-tiers", "tiers: locked " + (t.locked || 0) + " · semantic " + (t.semantic || 0) +
258
+ " · experimental " + (t.experimental || 0) + " · borrowed " + (t.borrowed || 0) + " · conjecture " + (t.conjecture || 0));
259
+ }
260
+ if (_plain) _applyPlain();
261
+ }
262
+
263
+ function _applyPlain() {
264
+ const box = _overlay && _overlay.querySelector("#brain-plainbox");
265
+ if (!box) return;
266
+ box.style.display = _plain ? "block" : "none";
267
+ if (_plain) {
268
+ box.innerHTML =
269
+ "Each ball is one of our math formulas. The bright teal balls in the middle are the " +
270
+ "<b>8 that are actually machine-proven</b>. Lines are real proof dependencies. A pulse " +
271
+ "spreads out from the proven core across " + (S.rewardPerK ? S.rewardPerK.length : 10) + " rounds — that's the " +
272
+ "\u201Cfiring.\u201D The grey balls are <b>conjectures we have NOT proven</b> (like \u039B\u2019s " +
273
+ "uniqueness) — they stay grey and never light up green, on purpose. The routing/reward/spread " +
274
+ "borrow ideas from three 2026 papers (DLA, OPERA, Context-Ready) but train nothing. Label is " +
275
+ "<b>" + (S.label || "MODELED") + "</b> — a faithful drawing of our real proof structure, not a computation.";
276
+ }
277
+ }
278
+
279
+ // =============================================================================
280
+ // unmount
281
+ // =============================================================================
282
+ function unmount() {
283
+ _polls.forEach((p) => { try { p.stop(); } catch (_) {} }); _polls = [];
284
+ try { if (_overlay && _overlay.parentNode) _overlay.parentNode.removeChild(_overlay); } catch (_) {}
285
+ try {
286
+ if (_group && _stage) {
287
+ _group.traverse((o) => {
288
+ if (o.geometry && o.geometry.dispose) o.geometry.dispose();
289
+ if (o.material) {
290
+ const ms = Array.isArray(o.material) ? o.material : [o.material];
291
+ ms.forEach((m) => { if (m.dispose) m.dispose(); });
292
+ }
293
+ });
294
+ _stage.scene.remove(_group);
295
+ }
296
+ } catch (_) {}
297
+ _group = _overlay = null;
298
+ _nodeMeshes = {}; _edgeLines = []; _pos = {};
299
+ _el = {}; _badge = null; _plain = false; _frameReg = false;
300
+ _stage = _THREE = _ctx = null;
301
+ S.label = null; S.nodes = []; S.edges = []; S.tierCounts = null;
302
+ S.lockedCount = S.rewardPerK = S.rewardFinal = S.nodesFired = S.conjGreen = null;
303
+ S.state = "init";
304
+ }
305
+
306
+ export default { id: ID, title: TITLE, endpoints: [EP_GRAPH, EP_FIRE], mount, unmount };