betterwithage Claude Opus 4.7 commited on
Commit
14ea796
·
verified ·
1 Parent(s): 49931e2

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

Browse files

Reusable Dockerfile-COPY-derived deploy from szl-holdings/a11oy main.
Files: 938 Pruned: 0
Derived from Dockerfile COPY sources (NO hand-maintained allowlist).

Signed-off-by: SZL Holdings <noreply@szlholdings.ai>
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>

static/3d/holographic.html CHANGED
@@ -176,6 +176,7 @@ const SURFACES = [
176
  { id: "hybridssm", title: "HybridSSM · Attention vs State-Space vs Hybrid Frontier (synthesis)", mod: "/static/3d/surfaces/hybridssm.js" },
177
  { id: "governedagent", title: "Governed Agent Loop · plan→act→self-eval→gate→retry", mod: "/static/3d/surfaces/governedagent.js" },
178
  { id: "governedrag", title: "Governed RAG · Retrieval-with-Receipts", mod: "/static/3d/surfaces/governedrag.js" },
 
179
  ];
180
 
181
  const stageEl = document.getElementById("stage");
 
176
  { id: "hybridssm", title: "HybridSSM · Attention vs State-Space vs Hybrid Frontier (synthesis)", mod: "/static/3d/surfaces/hybridssm.js" },
177
  { id: "governedagent", title: "Governed Agent Loop · plan→act→self-eval→gate→retry", mod: "/static/3d/surfaces/governedagent.js" },
178
  { id: "governedrag", title: "Governed RAG · Retrieval-with-Receipts", mod: "/static/3d/surfaces/governedrag.js" },
179
+ { id: "ecosystem", title: "Harness · Ecosystem Status", mod: "/static/3d/surfaces/ecosystem.js" },
180
  ];
181
 
182
  const stageEl = document.getElementById("stage");
static/3d/surfaces/ecosystem.js ADDED
@@ -0,0 +1,506 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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/ecosystem.js — HARNESS · live ecosystem-status dashboard (Wave 30 · Dev 3).
5
+ //
6
+ // One honest control surface for the whole a11oy estate, rendered LIVE from REAL
7
+ // endpoints (never hardcoded, never fabricated). Three concentric rings + a HUD:
8
+ //
9
+ // • MODEL ROSTER — every model in the LLM hub, each with a per-model WIRED/STUB
10
+ // chip read straight from /llm/registry (api_key_wired flag).
11
+ // A model is WIRED only if its api_env_var is present at runtime;
12
+ // otherwise it is an honest STUB. The count is whatever the registry
13
+ // returns THIS request (10 today, 20 once Dev 2's roster lands) —
14
+ // the surface never assumes a number.
15
+ // • FLEET NODES — omen + betterwithage, each LIVE or OFFLINE with MEASURED joules +
16
+ // watts + GPU name, from /energy/mesh. A node is LIVE only when its
17
+ // meter responded live THIS request; otherwise it is shown OFFLINE
18
+ // honestly, joules null, never a guessed number.
19
+ // • ENERGY + SEAL — fleet-total MEASURED joules with provenance (meter URL) from
20
+ // /energy/mesh, and the Allodial sovereignty SEAL score from
21
+ // /allodial/summary + /allodial/score.
22
+ //
23
+ // DOCTRINE (v11, non-negotiable, all honesty read straight from the JSON):
24
+ // * MEASURED only when the meter reported live this request; else UNAVAILABLE/OFFLINE.
25
+ // * WIRED (green) only when api_key_wired is true; else STUB (gray/structural).
26
+ // * Λ is Conjecture 1 — advisory, gray, NEVER green. This surface emits no Λ verdict.
27
+ // * The only purple used is the approved violet-blue accent 0x8a6bff (data-viz only).
28
+ // * No fabricated joule, no fabricated wired=true. Degrades gracefully; never crashes.
29
+ //
30
+ // EVERY value on screen traces to a REAL a11oy endpoint:
31
+ // GET /api/a11oy/v1/llm/registry — model roster + per-model api_key_wired + wired_count
32
+ // GET /api/a11oy/v1/energy/mesh — per-node LIVE/OFFLINE + MEASURED watts/joules + GPU name
33
+ // GET /api/a11oy/v1/allodial/summary — SEAL 0-4 assurance scale + sovereignty dimensions
34
+ // GET /api/a11oy/v1/allodial/score — Allodial 𝒜 sovereignty score (0..100) + posture
35
+ //
36
+ // 0 runtime CDN: three resolves through the page importmap to /static/3d/vendor/.
37
+
38
+ const ID = "ecosystem";
39
+ const TITLE = "Harness · Ecosystem Status";
40
+
41
+ const EP_REGISTRY = "/api/a11oy/v1/llm/registry";
42
+ const EP_MESH = "/api/a11oy/v1/energy/mesh";
43
+ const EP_ALLODIAL = "/api/a11oy/v1/allodial/summary";
44
+ const EP_SEAL = "/api/a11oy/v1/allodial/score";
45
+
46
+ // palette — matches the estate. Green = WIRED/LIVE, gray = STUB/OFFLINE/structural,
47
+ // amber = degraded/MODELED, violet-blue = the approved 0x8a6bff accent (data-viz only).
48
+ const C_WIRED = 0x2fd07a; // WIRED / LIVE — green
49
+ const C_STUB = 0x8a97a3; // STUB / OFFLINE / structural — gray
50
+ const C_AMBER = 0xe8c074; // degraded / MODELED — amber/gold
51
+ const C_TEAL = 0x39d3c4; // structural accent — teal
52
+ const C_ACCENT = 0x8a6bff; // approved violet-blue accent (data-viz only)
53
+ const C_CORE = 0x6fb1ff; // hub core — blue
54
+
55
+ // ring radii (world units)
56
+ const R_MODELS = 8.4;
57
+ const R_NODES = 4.6;
58
+
59
+ let _stage = null, _THREE = null, _ctx = null;
60
+ let _group = null, _overlay = null, _frameReg = false;
61
+ let _core = null, _modelNodes = [], _fleetNodes = [], _sealRing = null;
62
+ let _pollReg = null, _pollMesh = null, _pollAllo = null, _pollSeal = null;
63
+ let _badgeReg = null, _badgeMesh = null, _badgeAllo = null;
64
+
65
+ // live state — every field is populated from a real endpoint or left honestly empty.
66
+ const S = {
67
+ models: [], modelCount: 0, wiredCount: 0, regState: "init", regLabel: null,
68
+ fleet: [], liveCount: 0, totalJoules: null, joulesLabel: null, meterUrl: null,
69
+ meshState: "init",
70
+ sealScale: null, sealScore: null, sealPosture: null, sealState: "init", sealFormula: null,
71
+ };
72
+
73
+ // =========================================================================================
74
+ // mount
75
+ // =========================================================================================
76
+ function mount(ctx) {
77
+ _ctx = ctx; _stage = ctx.stage; _THREE = ctx.THREE;
78
+ const THREE = _THREE;
79
+ _group = new THREE.Group();
80
+ _stage.scene.add(_group);
81
+ if (_stage.camera && _stage.camera.position) _stage.camera.position.set(0, 7, 20);
82
+ try { _stage.setBloom(true); } catch (_) {}
83
+
84
+ _buildCore();
85
+ _buildOverlay();
86
+
87
+ if (!_frameReg) { _stage.onFrame(_onFrame); _frameReg = true; }
88
+
89
+ // ---- LIVE WIRING — every value traces to a real endpoint (doctrine) ----
90
+ // Registry + mesh poll fastest (the two moving surfaces); allodial is near-static.
91
+ _pollReg = ctx.live.poll(EP_REGISTRY, 10000, _onRegistry, {
92
+ badge: _badgeReg,
93
+ onState: (m) => { S.regState = m.state; if (m.state !== "live") _paintOverlay(); },
94
+ });
95
+ _pollMesh = ctx.live.poll(EP_MESH, 8000, _onMesh, {
96
+ badge: _badgeMesh,
97
+ onState: (m) => { S.meshState = m.state; if (m.state !== "live") _paintOverlay(); },
98
+ });
99
+ _pollAllo = ctx.live.poll(EP_ALLODIAL, 30000, _onAllodial, {
100
+ badge: _badgeAllo,
101
+ onState: (m) => { S.sealState = m.state; if (m.state !== "live") _paintOverlay(); },
102
+ });
103
+ // score endpoint has no honesty flag of its own; poll it plainly and read the number.
104
+ _pollSeal = ctx.live.poll(EP_SEAL, 30000, _onSeal, {});
105
+
106
+ return { id: ID, started: true };
107
+ }
108
+
109
+ // =========================================================================================
110
+ // scene builders
111
+ // =========================================================================================
112
+ function _buildCore() {
113
+ const THREE = _THREE;
114
+ _core = new THREE.Group();
115
+ const core = new THREE.Mesh(
116
+ new THREE.IcosahedronGeometry(1.5, 1),
117
+ new THREE.MeshStandardMaterial({ color: C_CORE, emissive: C_CORE, emissiveIntensity: 0.5, metalness: 0.4, roughness: 0.4, transparent: true, opacity: 0.92 }),
118
+ );
119
+ const shell = new THREE.Mesh(
120
+ new THREE.IcosahedronGeometry(1.95, 1),
121
+ new THREE.MeshBasicMaterial({ color: C_CORE, wireframe: true, transparent: true, opacity: 0.26 }),
122
+ );
123
+ _core.add(core, shell);
124
+ _core.core = core;
125
+ _group.add(_core);
126
+ try {
127
+ _core.lbl = _ctx.label.billboard(_THREE, "STRUCTURAL-ONLY", { text: "a11oy hub · harness", scale: 0.5, position: [0, -2.4, 0] });
128
+ _core.add(_core.lbl);
129
+ } catch (_) {}
130
+ }
131
+
132
+ // Model roster ring — one node per model, colored WIRED (green) vs STUB (gray).
133
+ function _renderModelRing() {
134
+ const THREE = _THREE;
135
+ _modelNodes.forEach((n) => { try { _group.remove(n.mesh); } catch (_) {} try { if (n.label) _group.remove(n.label); } catch (_) {} });
136
+ _modelNodes = [];
137
+ const ms = S.models;
138
+ ms.forEach((m, i) => {
139
+ const ang = (i / Math.max(ms.length, 1)) * Math.PI * 2;
140
+ const x = Math.cos(ang) * R_MODELS, z = Math.sin(ang) * R_MODELS;
141
+ const wired = !!m.api_key_wired;
142
+ const col = wired ? C_WIRED : C_STUB;
143
+ const mesh = new THREE.Mesh(
144
+ new THREE.OctahedronGeometry(0.5, 0),
145
+ new THREE.MeshStandardMaterial({ color: col, emissive: col, emissiveIntensity: wired ? 0.85 : 0.32, metalness: 0.35, roughness: 0.5, transparent: true, opacity: wired ? 0.95 : 0.72 }),
146
+ );
147
+ mesh.position.set(x, 1.0 + (i % 2) * 0.5, z);
148
+ mesh.userData = { wired };
149
+ _group.add(mesh);
150
+ let label = null;
151
+ try {
152
+ // A model's WIRED/STUB status is a STRUCTURAL config fact (is the api_env_var
153
+ // present at runtime?) — NOT a physical measurement. Per doctrine the honesty
154
+ // token must therefore stay STRUCTURAL-ONLY (gray chip) for every model; we never
155
+ // emit MEASURED here since no NVML/exporter reading backs a model row. The
156
+ // WIRED-vs-STUB distinction is carried honestly by the node color (green/gray)
157
+ // and by the roster panel chip text below.
158
+ const tag = wired ? " · WIRED" : " · STUB";
159
+ label = _ctx.label.billboard(_THREE, "STRUCTURAL-ONLY", {
160
+ text: (m.model_id || m.display_name || "?") + tag, scale: 0.34, position: [x, 1.9 + (i % 2) * 0.5, z],
161
+ });
162
+ _group.add(label);
163
+ } catch (_) {}
164
+ _modelNodes.push({ mesh, label });
165
+ });
166
+ }
167
+
168
+ // Fleet ring — one node per fleet node, colored LIVE (green) vs OFFLINE (gray).
169
+ function _renderFleetRing() {
170
+ const THREE = _THREE;
171
+ _fleetNodes.forEach((n) => { try { _group.remove(n.mesh); } catch (_) {} try { if (n.label) _group.remove(n.label); } catch (_) {} });
172
+ _fleetNodes = [];
173
+ const fs = S.fleet;
174
+ fs.forEach((n, i) => {
175
+ const ang = (i / Math.max(fs.length, 1)) * Math.PI * 2 + Math.PI / 4;
176
+ const x = Math.cos(ang) * R_NODES, z = Math.sin(ang) * R_NODES;
177
+ const live = !!n.live;
178
+ const col = live ? C_WIRED : C_STUB;
179
+ // node size scales with normalized draw when live+measured; fixed when offline.
180
+ const base = 0.7 + (typeof n.draw === "number" ? 0.5 * n.draw : 0);
181
+ const mesh = new THREE.Mesh(
182
+ new THREE.IcosahedronGeometry(base, 0),
183
+ new THREE.MeshStandardMaterial({ color: col, emissive: col, emissiveIntensity: live ? 0.9 : 0.3, metalness: 0.45, roughness: 0.4, transparent: true, opacity: live ? 0.95 : 0.7 }),
184
+ );
185
+ mesh.position.set(x, 1.4, z);
186
+ mesh.userData = { live };
187
+ _group.add(mesh);
188
+ let label = null;
189
+ try {
190
+ // joules label is MEASURED only when the node reported a live number this tick.
191
+ const measured = live && typeof n.joules === "number";
192
+ label = _ctx.label.billboard(_THREE, measured ? "MEASURED" : "STRUCTURAL-ONLY", {
193
+ text: (n.name || "node") + (live ? " · LIVE" : " · OFFLINE"), scale: 0.4, position: [x, 2.8, z],
194
+ });
195
+ _group.add(label);
196
+ } catch (_) {}
197
+ _fleetNodes.push({ mesh, label });
198
+ });
199
+ }
200
+
201
+ // =========================================================================================
202
+ // live-data handlers — read REAL values; never invent
203
+ // =========================================================================================
204
+ function _onRegistry(json, meta) {
205
+ S.regLabel = meta.label || S.regLabel;
206
+ if (!json || !Array.isArray(json.models)) { _paintOverlay(); return; }
207
+ S.models = json.models;
208
+ S.modelCount = (typeof json.model_count === "number") ? json.model_count : json.models.length;
209
+ S.wiredCount = (typeof json.wired_count === "number") ? json.wired_count
210
+ : json.models.filter((m) => m.api_key_wired).length;
211
+ _renderModelRing();
212
+ _paintOverlay();
213
+ }
214
+
215
+ function _onMesh(json, meta) {
216
+ if (!json) { _paintOverlay(); return; }
217
+ S.fleet = Array.isArray(json.nodes) ? json.nodes : [];
218
+ S.liveCount = (typeof json.live_count === "number") ? json.live_count
219
+ : S.fleet.filter((n) => n.live).length;
220
+ // total_joules is MEASURED only when the mesh label says so — read the label verbatim.
221
+ S.totalJoules = (typeof json.total_joules === "number") ? json.total_joules : null;
222
+ S.joulesLabel = json.joules_label || json.label || null;
223
+ S.meterUrl = json.meter_url || null;
224
+ _renderFleetRing();
225
+ _paintOverlay();
226
+ }
227
+
228
+ function _onAllodial(json, meta) {
229
+ if (!json) { _paintOverlay(); return; }
230
+ S.sealScale = json.seal_scale || null;
231
+ _paintOverlay();
232
+ }
233
+
234
+ function _onSeal(json, meta) {
235
+ if (!json) { _paintOverlay(); return; }
236
+ S.sealScore = (typeof json.score === "number") ? json.score : null;
237
+ S.sealPosture = json.posture || null;
238
+ S.sealFormula = json.formula || null;
239
+ _renderSealRing();
240
+ _paintOverlay();
241
+ }
242
+
243
+ // SEAL ring — an arc whose sweep encodes the sovereignty score (0..100), teal accent.
244
+ function _renderSealRing() {
245
+ const THREE = _THREE;
246
+ if (_sealRing) { try { _group.remove(_sealRing); } catch (_) {} _sealRing = null; }
247
+ if (typeof S.sealScore !== "number") return;
248
+ const frac = Math.max(0, Math.min(1, S.sealScore / 100));
249
+ const R = 11.0;
250
+ _sealRing = new THREE.Group();
251
+ const seg = 96;
252
+ const lit = Math.round(seg * frac);
253
+ for (let i = 0; i < seg; i++) {
254
+ const ang = (i / seg) * Math.PI * 2 - Math.PI / 2;
255
+ const on = i < lit;
256
+ const dot = new THREE.Mesh(
257
+ new THREE.SphereGeometry(0.12, 8, 8),
258
+ new THREE.MeshBasicMaterial({ color: on ? C_ACCENT : C_STUB, transparent: true, opacity: on ? 0.9 : 0.28 }),
259
+ );
260
+ dot.position.set(Math.cos(ang) * R, 0.4, Math.sin(ang) * R);
261
+ _sealRing.add(dot);
262
+ }
263
+ _group.add(_sealRing);
264
+ }
265
+
266
+ // =========================================================================================
267
+ // per-frame animation — gentle, non-decorative (conveys "live")
268
+ // =========================================================================================
269
+ function _onFrame() {
270
+ if (_core && _core.core) {
271
+ _core.rotation.y += 0.003;
272
+ const s = 1 + 0.04 * Math.sin(performance.now() * 0.0025);
273
+ _core.core.scale.setScalar(s);
274
+ }
275
+ _group && (_group.rotation.y += 0.0008);
276
+ _modelNodes.forEach((n, i) => { n.mesh.rotation.y += 0.01 + i * 0.0004; });
277
+ _fleetNodes.forEach((n) => { n.mesh.rotation.y += 0.006; });
278
+ }
279
+
280
+ // =========================================================================================
281
+ // DOM overlay (HUD) — the honest, high-contrast status board (WCAG AA)
282
+ // =========================================================================================
283
+ let _el = {};
284
+ function _buildOverlay() {
285
+ const ctx = _ctx;
286
+ _overlay = document.createElement("div");
287
+ Object.assign(_overlay.style, {
288
+ position: "absolute", left: "14px", top: "14px", zIndex: "6",
289
+ display: "flex", flexDirection: "column", gap: "9px",
290
+ maxWidth: "min(94%,500px)", maxHeight: "calc(100% - 28px)", overflowY: "auto",
291
+ font: "12px ui-sans-serif,system-ui,Segoe UI,Roboto,Arial", color: "#eef3f6",
292
+ });
293
+
294
+ const h = document.createElement("div");
295
+ h.style.cssText = "font:600 14px ui-sans-serif,system-ui;letter-spacing:.4px";
296
+ h.textContent = TITLE;
297
+ _overlay.appendChild(h);
298
+
299
+ const sub = document.createElement("div");
300
+ sub.style.cssText = "color:#9fb1bf;font-size:11px;line-height:1.55";
301
+ sub.innerHTML = 'One honest control surface for the estate, rendered LIVE from real ' +
302
+ 'endpoints — <b>no hardcoded numbers</b>. Chips read straight from the JSON: ' +
303
+ '<span style="color:#2fd07a">green</span> = wired/live, ' +
304
+ '<span style="color:#8a97a3">gray</span> = stub/offline/structural, ' +
305
+ '<span style="color:#e8c074">amber</span> = degraded. Λ is advisory (Conjecture 1), never green.';
306
+ _overlay.appendChild(sub);
307
+
308
+ // live badges row (one per polled endpoint) — state read from szl3d_live.poll.
309
+ _badgeReg = ctx.live.createBadge();
310
+ _badgeMesh = ctx.live.createBadge();
311
+ _badgeAllo = ctx.live.createBadge();
312
+ const badgeRow = document.createElement("div");
313
+ badgeRow.style.cssText = "display:flex;flex-wrap:wrap;gap:6px;align-items:center";
314
+ const tag = (t) => { const s = document.createElement("span"); s.textContent = t; s.style.cssText = "font:10px ui-monospace,monospace;color:#6fb1ff"; return s; };
315
+ badgeRow.appendChild(tag("registry")); badgeRow.appendChild(_badgeReg.el);
316
+ badgeRow.appendChild(tag("fleet")); badgeRow.appendChild(_badgeMesh.el);
317
+ badgeRow.appendChild(tag("allodial")); badgeRow.appendChild(_badgeAllo.el);
318
+ _overlay.appendChild(badgeRow);
319
+
320
+ // ── MODEL ROSTER panel ──────────────────────────────────────────────────
321
+ _el.models = _panel("model roster · /llm/registry");
322
+ _overlay.appendChild(_el.models.wrap);
323
+
324
+ // ── FLEET NODES panel ───────────────────────────────────────────────────
325
+ _el.fleet = _panel("fleet nodes · /energy/mesh");
326
+ _overlay.appendChild(_el.fleet.wrap);
327
+
328
+ // ── ENERGY + SEAL panel ─────────────────────────────────────────────────
329
+ _el.energy = _panel("energy + sovereignty · /energy/mesh · /allodial/*");
330
+ _overlay.appendChild(_el.energy.wrap);
331
+
332
+ // honesty legend (shared doctrine chips) + provenance footnote
333
+ const lg = ctx.label.legend(); lg.style.opacity = "0.9"; _overlay.appendChild(lg);
334
+
335
+ const src = document.createElement("div");
336
+ src.style.cssText = "font-size:9.5px;color:#5b6c78;line-height:1.6;margin-top:2px";
337
+ src.textContent = "Provenance: model roster + per-model api_key_wired from GET /api/a11oy/v1/llm/registry " +
338
+ "(WIRED only if the model's api_env_var is present at runtime). Fleet LIVE/OFFLINE + MEASURED watts/joules " +
339
+ "+ GPU name from GET /api/a11oy/v1/energy/mesh (NVML meter; UNAVAILABLE when unreachable, never fabricated). " +
340
+ "Sovereignty SEAL score 𝒜 from GET /api/a11oy/v1/allodial/{summary,score} (EU Cloud Sovereignty Framework " +
341
+ "SEAL 0-4 + HHI lock-in penalty). Λ = Conjecture 1 (advisory, never green). trust < 100%.";
342
+ _overlay.appendChild(src);
343
+
344
+ (ctx.container || document.body).appendChild(_overlay);
345
+ }
346
+
347
+ // small styled panel factory (title + body container)
348
+ function _panel(titleText) {
349
+ const wrap = document.createElement("div");
350
+ wrap.style.cssText = "background:#0a1117;border:1px solid #1d2a36;border-radius:8px;padding:9px;display:flex;flex-direction:column;gap:6px";
351
+ const t = document.createElement("div");
352
+ t.style.cssText = "font:600 11px ui-monospace,monospace;color:#39d3c4;letter-spacing:.3px";
353
+ t.textContent = titleText;
354
+ const body = document.createElement("div");
355
+ body.style.cssText = "font:11px ui-sans-serif;color:#cdd9e2;line-height:1.5";
356
+ wrap.appendChild(t); wrap.appendChild(body);
357
+ return { wrap, body };
358
+ }
359
+
360
+ // row helper: a status chip + label, high-contrast (WCAG AA on the dark panel).
361
+ function _statusRow(chipText, chipColor, chipFg, text) {
362
+ const row = document.createElement("div");
363
+ row.style.cssText = "display:flex;align-items:center;gap:8px;padding:2px 0;border-top:1px solid #12202b";
364
+ const chip = document.createElement("span");
365
+ chip.textContent = chipText;
366
+ chip.style.cssText = "font:600 9.5px ui-monospace,monospace;letter-spacing:.4px;padding:2px 7px;border-radius:5px;" +
367
+ "flex:0 0 auto;color:" + chipFg + ";background:" + chipColor + ";border:1px solid rgba(255,255,255,.14)";
368
+ const lab = document.createElement("span");
369
+ lab.style.cssText = "font:11px ui-monospace,monospace;color:#cdd9e2;overflow:hidden;text-overflow:ellipsis;white-space:nowrap";
370
+ lab.textContent = text;
371
+ row.appendChild(chip); row.appendChild(lab);
372
+ return row;
373
+ }
374
+
375
+ function _esc(s) {
376
+ return String(s == null ? "" : s).replace(/[&<>"]/g, (c) => ({ "&": "&amp;", "<": "&lt;", ">": "&gt;", '"': "&quot;" }[c]));
377
+ }
378
+
379
+ function _paintOverlay() {
380
+ _paintModels();
381
+ _paintFleet();
382
+ _paintEnergy();
383
+ }
384
+
385
+ function _paintModels() {
386
+ const b = _el.models && _el.models.body;
387
+ if (!b) return;
388
+ b.innerHTML = "";
389
+ if (!S.models.length) {
390
+ b.textContent = (S.regState === "live") ? "registry returned no models"
391
+ : "awaiting live registry (" + S.regState + ")…";
392
+ return;
393
+ }
394
+ const head = document.createElement("div");
395
+ head.style.cssText = "font:11px ui-monospace,monospace;color:#eef3f6;margin-bottom:2px";
396
+ // headline count is read verbatim from wired_count / model_count.
397
+ head.innerHTML = "<b>" + S.wiredCount + "</b> wired · <b>" + (S.modelCount - S.wiredCount) +
398
+ "</b> stub · <b>" + S.modelCount + "</b> total models";
399
+ b.appendChild(head);
400
+ S.models.forEach((m) => {
401
+ const wired = !!m.api_key_wired;
402
+ const chipTxt = wired ? "WIRED" : "STUB";
403
+ const col = wired ? C_hex(C_WIRED) : C_hex(C_STUB);
404
+ const fg = wired ? "#04130b" : "#0a0e12";
405
+ const provider = m.provider_slug ? " (" + m.provider_slug + ")" : "";
406
+ const env = m.api_env_var ? " · " + m.api_env_var : "";
407
+ b.appendChild(_statusRow(chipTxt, col, fg, (m.model_id || m.display_name || "?") + provider + env));
408
+ });
409
+ }
410
+
411
+ function _paintFleet() {
412
+ const b = _el.fleet && _el.fleet.body;
413
+ if (!b) return;
414
+ b.innerHTML = "";
415
+ if (!S.fleet.length) {
416
+ b.textContent = (S.meshState === "live") ? "mesh returned no nodes"
417
+ : "awaiting live fleet mesh (" + S.meshState + ")…";
418
+ return;
419
+ }
420
+ const head = document.createElement("div");
421
+ head.style.cssText = "font:11px ui-monospace,monospace;color:#eef3f6;margin-bottom:2px";
422
+ head.innerHTML = "<b>" + S.liveCount + "</b> / " + S.fleet.length + " nodes live this request";
423
+ b.appendChild(head);
424
+ S.fleet.forEach((n) => {
425
+ const live = !!n.live;
426
+ const chipTxt = live ? "LIVE" : "OFFLINE";
427
+ const col = live ? C_hex(C_WIRED) : C_hex(C_STUB);
428
+ const fg = live ? "#04130b" : "#0a0e12";
429
+ // watts/joules shown ONLY when present (MEASURED); else an honest dash.
430
+ const w = (typeof n.watts === "number") ? n.watts.toFixed(2) + " W" : "— W";
431
+ const j = (typeof n.joules === "number") ? Math.round(n.joules).toLocaleString() + " J" : "— J";
432
+ const gpu = n.name || n.role || "node";
433
+ const jl = n.joules_label ? " [" + n.joules_label + "]" : "";
434
+ b.appendChild(_statusRow(chipTxt, col, fg, gpu + " · " + w + " · " + j + jl));
435
+ });
436
+ }
437
+
438
+ function _paintEnergy() {
439
+ const b = _el.energy && _el.energy.body;
440
+ if (!b) return;
441
+ b.innerHTML = "";
442
+ // fleet-total joules with its honest label + meter provenance.
443
+ const totLabel = S.joulesLabel || (S.meshState === "live" ? "UNAVAILABLE" : "…");
444
+ const totVal = (typeof S.totalJoules === "number")
445
+ ? Math.round(S.totalJoules).toLocaleString() + " J" : "— J (not fabricated)";
446
+ const jr = document.createElement("div");
447
+ jr.style.cssText = "font:11px ui-monospace,monospace;color:#eef3f6;line-height:1.6";
448
+ jr.innerHTML = "fleet-total joules: <b>" + _esc(totVal) + "</b> " +
449
+ "<span style='color:" + (totLabel === "MEASURED" ? "#2fd07a" : "#e8c074") + "'>[" + _esc(totLabel) + "]</span>";
450
+ b.appendChild(jr);
451
+ if (S.meterUrl) {
452
+ const mp = document.createElement("div");
453
+ mp.style.cssText = "font:10px ui-monospace,monospace;color:#5b6c78";
454
+ mp.textContent = "provenance: meter " + S.meterUrl;
455
+ b.appendChild(mp);
456
+ }
457
+ // Allodial SEAL score — sovereignty posture.
458
+ const sr = document.createElement("div");
459
+ sr.style.cssText = "font:11px ui-monospace,monospace;color:#eef3f6;line-height:1.6;margin-top:4px;border-top:1px solid #12202b;padding-top:4px";
460
+ if (typeof S.sealScore === "number") {
461
+ const posture = S.sealPosture || "";
462
+ sr.innerHTML = "Allodial sovereignty score 𝒜: <b style='color:#8a6bff'>" + S.sealScore + "</b> / 100" +
463
+ (posture ? " · <span style='color:#9fb1bf'>" + _esc(posture) + "</span>" : "");
464
+ b.appendChild(sr);
465
+ if (S.sealFormula) {
466
+ const f = document.createElement("div");
467
+ f.style.cssText = "font:10px ui-monospace,monospace;color:#5b6c78";
468
+ f.textContent = S.sealFormula;
469
+ b.appendChild(f);
470
+ }
471
+ } else {
472
+ sr.textContent = "Allodial score: awaiting /allodial/score (" + S.sealState + ")…";
473
+ b.appendChild(sr);
474
+ }
475
+ }
476
+
477
+ // convert a 0xRRGGBB number to a #rrggbb css string.
478
+ function C_hex(n) { return "#" + (n & 0xffffff).toString(16).padStart(6, "0"); }
479
+
480
+ // =========================================================================================
481
+ // unmount — release everything (polls, DOM, GPU resources)
482
+ // =========================================================================================
483
+ function unmount() {
484
+ [_pollReg, _pollMesh, _pollAllo, _pollSeal].forEach((p) => { try { if (p) p.stop(); } catch (_) {} });
485
+ try { if (_overlay && _overlay.parentNode) _overlay.parentNode.removeChild(_overlay); } catch (_) {}
486
+ try {
487
+ if (_group && _stage) {
488
+ _group.traverse((o) => {
489
+ if (o.geometry && o.geometry.dispose) o.geometry.dispose();
490
+ if (o.material) {
491
+ const mats = Array.isArray(o.material) ? o.material : [o.material];
492
+ mats.forEach((m) => { if (m.map && m.map.dispose) m.map.dispose(); if (m.dispose) m.dispose(); });
493
+ }
494
+ });
495
+ _stage.scene.remove(_group);
496
+ }
497
+ } catch (_) {}
498
+ _pollReg = _pollMesh = _pollAllo = _pollSeal = null;
499
+ _overlay = _group = _core = _sealRing = null;
500
+ _modelNodes = []; _fleetNodes = [];
501
+ _badgeReg = _badgeMesh = _badgeAllo = null; _el = {};
502
+ S.models = []; S.fleet = []; S.sealScore = null; S.sealScale = null;
503
+ _stage = _THREE = _ctx = null;
504
+ }
505
+
506
+ export default { id: ID, title: TITLE, endpoints: [EP_REGISTRY, EP_MESH, EP_ALLODIAL, EP_SEAL], mount, unmount };