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: 1045 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 +2 -0
- static/3d/surfaces/open.js +451 -0
- static/3d/surfaces/research.js +433 -0
static/3d/holographic.html
CHANGED
|
@@ -335,6 +335,8 @@ const SURFACES = [
|
|
| 335 |
{ id: "brainconstitution", cat: "brain", title: "Brain Constitution · the honest, machine-checkable ruleset the brain is graded against per query · an explicit ordered set of ARTICLES (grounding sufficiency, calibrated confidence, honest corroboration, contradictions surfaced, traceable to source, freshness honesty, coverage gaps admitted, doctrine invariants) each graded COMPLIANT/VIOLATED/UNAVAILABLE against whatever sibling brain-honesty surfaces are importable (an absent surface is UNAVAILABLE, never a fabricated pass) → CONSTITUTIONAL/IN-VIOLATION/INSUFFICIENT-SIGNAL, never CONSTITUTIONAL while any evaluable Article is VIOLATED, unsigned SHA-256 receipt-on-write (MODELED)", mod: "/static/3d/surfaces/brainconstitution.js" },
|
| 336 |
{ id: "markets", cat: "finance", flag: true, title: "Markets & Finance · live Polymarket prediction book (top markets by 24h volume, pillar height = 24h vol, bead = YES probability) + crypto majors orbiting by market cap · 100% MEASURED same-origin deva finance feeds, no mocked spend/keys, log-scaling is display-only", mod: "/static/3d/surfaces/finance.js" },
|
| 337 |
{ id: "leaders", cat: "more", flag: true, title: "Frontier Models · Live AI Leaders · MEASURED live OpenRouter model catalog — one pillar per lab (height = max context window, bead = open/free share); widest-context models orbit as satellites (teal = free, amber = paid); log-scaling is display-only, no invented benchmark or ranking", mod: "/static/3d/surfaces/leaders.js" },
|
|
|
|
|
|
|
| 338 |
];
|
| 339 |
|
| 340 |
const stageEl = document.getElementById("stage");
|
|
|
|
| 335 |
{ id: "brainconstitution", cat: "brain", title: "Brain Constitution · the honest, machine-checkable ruleset the brain is graded against per query · an explicit ordered set of ARTICLES (grounding sufficiency, calibrated confidence, honest corroboration, contradictions surfaced, traceable to source, freshness honesty, coverage gaps admitted, doctrine invariants) each graded COMPLIANT/VIOLATED/UNAVAILABLE against whatever sibling brain-honesty surfaces are importable (an absent surface is UNAVAILABLE, never a fabricated pass) → CONSTITUTIONAL/IN-VIOLATION/INSUFFICIENT-SIGNAL, never CONSTITUTIONAL while any evaluable Article is VIOLATED, unsigned SHA-256 receipt-on-write (MODELED)", mod: "/static/3d/surfaces/brainconstitution.js" },
|
| 336 |
{ id: "markets", cat: "finance", flag: true, title: "Markets & Finance · live Polymarket prediction book (top markets by 24h volume, pillar height = 24h vol, bead = YES probability) + crypto majors orbiting by market cap · 100% MEASURED same-origin deva finance feeds, no mocked spend/keys, log-scaling is display-only", mod: "/static/3d/surfaces/finance.js" },
|
| 337 |
{ id: "leaders", cat: "more", flag: true, title: "Frontier Models · Live AI Leaders · MEASURED live OpenRouter model catalog — one pillar per lab (height = max context window, bead = open/free share); widest-context models orbit as satellites (teal = free, amber = paid); log-scaling is display-only, no invented benchmark or ranking", mod: "/static/3d/surfaces/leaders.js" },
|
| 338 |
+
{ id: "research", cat: "more", flag: true, title: "Frontier Research · Live arXiv AI · MEASURED live arXiv submission stream (cs.AI/LG/CL/CV/NE) — one pillar per research category (height = fresh-paper count, bead = share of the window); most-recent papers orbit as satellites sized by author count; log-scaling is display-only, no citation count, score, or ranking", mod: "/static/3d/surfaces/research.js" },
|
| 339 |
+
{ id: "open", cat: "more", flag: true, title: "Open Frontier · Live Hugging Face · MEASURED live Hugging Face Hub trending stream — one pillar per org/author (height = summed likes, bead = download reach); most-liked open models orbit as satellites coloured by task; log-scaling is display-only, no invented benchmark, score, or ranking beyond the Hub’s own", mod: "/static/3d/surfaces/open.js" },
|
| 340 |
];
|
| 341 |
|
| 342 |
const stageEl = document.getElementById("stage");
|
static/3d/surfaces/open.js
ADDED
|
@@ -0,0 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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/open.js — OPEN FRONTIER (Hugging Face Hub) organ for the holographic estate.
|
| 5 |
+
//
|
| 6 |
+
// A live "open-model observatory": the real, public Hugging Face Hub trending stream
|
| 7 |
+
// (the open models the Hub is surfacing right now) rendered as a ring of pillars — one
|
| 8 |
+
// per ORG / author — around a pulsing frontier core, with the most-liked individual
|
| 9 |
+
// models orbiting as satellites. 100% LIVE MEASURED data, pulled same-origin from the
|
| 10 |
+
// a11oy deva frontier feed. Nothing here is faked: no invented benchmark, no made-up
|
| 11 |
+
// ranking — only the Hub's own published like counts, downloads, authors and task tags.
|
| 12 |
+
//
|
| 13 |
+
// Surface export shape (mirrors leaders.js / finance.js):
|
| 14 |
+
// export default { id, title, endpoints, mount(ctx), unmount() }
|
| 15 |
+
// ctx = { stage, container, live, label, THREE, szl3d }
|
| 16 |
+
//
|
| 17 |
+
// DATA SHOWN (all live, same-origin):
|
| 18 |
+
// /api/a11oy/v1/deva/frontier/open -> huggingface.value.orgs[] {org, count, likes, downloads}
|
| 19 |
+
// huggingface.value.models[] {id, org, likes, downloads,
|
| 20 |
+
// task, library}
|
| 21 |
+
// huggingface.value.total
|
| 22 |
+
//
|
| 23 |
+
// VISUAL ENCODING (direct read of measured values; the only transform is log-normalization
|
| 24 |
+
// for scale, which is a DISPLAY transform — never a model):
|
| 25 |
+
// * each ORG = a pillar on a ring. pillar HEIGHT = log(summed likes across that org's
|
| 26 |
+
// trending models), normalized; a bead rides up the pillar to that org's download
|
| 27 |
+
// reach (log-normalized total downloads); pillar hue lerps lattice-blue (low reach)
|
| 28 |
+
// -> proof-teal (high reach).
|
| 29 |
+
// * most-liked MODELS = satellites orbiting the core, size = log(likes), colour by task
|
| 30 |
+
// family (teal = text/generation, amber = vision/image, blue = audio/speech, grey =
|
| 31 |
+
// other). hover shows the model id, its like count and downloads.
|
| 32 |
+
// * center = proof-teal wireframe "frontier core" that pulses with the total window size.
|
| 33 |
+
//
|
| 34 |
+
// HONESTY: MEASURED (real live observations from the public Hugging Face Hub API).
|
| 35 |
+
// Degrades to NO-LIVE-DATA (grey) on 404 / offline; never fabricates a model or a count.
|
| 36 |
+
// Like and download counts are as PUBLISHED by the Hub; informational only.
|
| 37 |
+
// COLOURS: proof-teal 0x3af4c8, lattice-blue 0x5b8dee, gold-amber 0xd7b96b, greys.
|
| 38 |
+
// Purple BANNED as UI/background. 0 RUNTIME CDN. Vendored three.js via page importmap.
|
| 39 |
+
// CITATIONS: Hugging Face huggingface.co/api/models — public live model hub.
|
| 40 |
+
|
| 41 |
+
import { createShowcase } from "./_showcase.js";
|
| 42 |
+
|
| 43 |
+
const ID = "open";
|
| 44 |
+
const TITLE = "Open Frontier \u00b7 Live Hugging Face";
|
| 45 |
+
|
| 46 |
+
const OPEN_EP = "/api/a11oy/v1/deva/frontier/open?limit=24";
|
| 47 |
+
|
| 48 |
+
// palette — purple BANNED
|
| 49 |
+
const C_GEN = 0x3af4c8; // proof-teal (text / generation)
|
| 50 |
+
const C_VIS = 0xd7b96b; // gold-amber (vision / image / video)
|
| 51 |
+
const C_AUD = 0x5b8dee; // lattice-blue (audio / speech)
|
| 52 |
+
const C_OTH = 0x7fa8b0; // muted (other task)
|
| 53 |
+
const C_LO = 0x5b8dee; // lattice-blue (low reach)
|
| 54 |
+
const C_HI = 0x3af4c8; // proof-teal (high reach)
|
| 55 |
+
const C_CORE = 0x3af4c8; // proof-teal (frontier core)
|
| 56 |
+
const C_PILLAR = 0x24506a; // dim pillar body
|
| 57 |
+
const C_DIM = 0x42505d; // grey (degraded / no-live-data)
|
| 58 |
+
const C_GRID = 0x1b3a44;
|
| 59 |
+
|
| 60 |
+
const RING_R = 9.5; // org ring radius
|
| 61 |
+
const MAXO = 16; // org pillar slots
|
| 62 |
+
const ORBIT_R = 4.6; // model orbit radius
|
| 63 |
+
const MAXM = 8; // model satellite slots
|
| 64 |
+
const PIL_MAXH = 6.5; // tallest pillar (world units)
|
| 65 |
+
|
| 66 |
+
let _stage = null, _THREE = null, _ctx = null, _group = null, _show = null;
|
| 67 |
+
let _frameReg = false, _polls = [], _el = {}, _badge = null;
|
| 68 |
+
|
| 69 |
+
let _core = null;
|
| 70 |
+
let _pillars = []; // Array<{ grp, body, bead, org }>
|
| 71 |
+
let _sats = []; // Array<{ mesh, model }>
|
| 72 |
+
|
| 73 |
+
// live state
|
| 74 |
+
const S = {
|
| 75 |
+
label: null, orgs: null, models: null, total: null, state: "init",
|
| 76 |
+
};
|
| 77 |
+
|
| 78 |
+
// =============================================================================
|
| 79 |
+
// mount(ctx)
|
| 80 |
+
// =============================================================================
|
| 81 |
+
export function mount(ctx) {
|
| 82 |
+
_ctx = ctx; _stage = ctx.stage; _THREE = ctx.THREE;
|
| 83 |
+
_group = new _THREE.Group();
|
| 84 |
+
_stage.scene.add(_group);
|
| 85 |
+
try { _stage.camera.position.set(0, 10, 27); } catch (_) {}
|
| 86 |
+
try { if (_stage.controls && _stage.controls.target) { _stage.controls.target.set(0, 2.2, 0); _stage.controls.update(); } } catch (_) {}
|
| 87 |
+
try { _stage.setBloom(true); } catch (_) {}
|
| 88 |
+
|
| 89 |
+
_buildFloor();
|
| 90 |
+
_buildCore();
|
| 91 |
+
_buildPillars();
|
| 92 |
+
_buildSats();
|
| 93 |
+
|
| 94 |
+
if (!_frameReg) { _stage.onFrame(_onFrame); _frameReg = true; }
|
| 95 |
+
|
| 96 |
+
_badge = ctx.live.createBadge();
|
| 97 |
+
_polls.push(ctx.live.poll(OPEN_EP, 60000, _onData, {
|
| 98 |
+
badge: _badge, onState: (m) => { S.state = m.state; _layout(); _layoutSats(); _paint(); },
|
| 99 |
+
}));
|
| 100 |
+
|
| 101 |
+
_buildOverlay();
|
| 102 |
+
return { id: ID, started: true };
|
| 103 |
+
}
|
| 104 |
+
|
| 105 |
+
// =============================================================================
|
| 106 |
+
// builders
|
| 107 |
+
// =============================================================================
|
| 108 |
+
function _buildFloor() {
|
| 109 |
+
const THREE = _THREE;
|
| 110 |
+
const grid = new THREE.GridHelper(48, 48, C_GRID, 0x0f2027);
|
| 111 |
+
grid.material.opacity = 0.16; grid.material.transparent = true; grid.position.y = -0.01;
|
| 112 |
+
_group.add(grid);
|
| 113 |
+
}
|
| 114 |
+
|
| 115 |
+
function _buildCore() {
|
| 116 |
+
const THREE = _THREE;
|
| 117 |
+
_core = new THREE.Mesh(
|
| 118 |
+
new THREE.IcosahedronGeometry(1.7, 1),
|
| 119 |
+
new THREE.MeshStandardMaterial({ color: C_CORE, emissive: C_CORE, emissiveIntensity: 0.35, wireframe: true, transparent: true, opacity: 0.55 }),
|
| 120 |
+
);
|
| 121 |
+
_core.position.set(0, 2.2, 0);
|
| 122 |
+
_group.add(_core);
|
| 123 |
+
}
|
| 124 |
+
|
| 125 |
+
function _buildPillars() {
|
| 126 |
+
const THREE = _THREE;
|
| 127 |
+
const bodyGeo = new THREE.CylinderGeometry(0.16, 0.20, 1, 14);
|
| 128 |
+
const beadGeo = new THREE.SphereGeometry(0.26, 16, 12);
|
| 129 |
+
_pillars = [];
|
| 130 |
+
for (let i = 0; i < MAXO; i++) {
|
| 131 |
+
const a = (i / MAXO) * Math.PI * 2;
|
| 132 |
+
const x = Math.cos(a) * RING_R, z = Math.sin(a) * RING_R;
|
| 133 |
+
const grp = new THREE.Group();
|
| 134 |
+
grp.position.set(x, 0, z);
|
| 135 |
+
|
| 136 |
+
const body = new THREE.Mesh(bodyGeo, new THREE.MeshStandardMaterial({
|
| 137 |
+
color: C_PILLAR, emissive: C_PILLAR, emissiveIntensity: 0.12, metalness: 0.3, roughness: 0.5,
|
| 138 |
+
}));
|
| 139 |
+
body.scale.y = 0.4; body.position.y = 0.2;
|
| 140 |
+
body.userData.label = "";
|
| 141 |
+
grp.add(body);
|
| 142 |
+
|
| 143 |
+
const bead = new THREE.Mesh(beadGeo, new THREE.MeshStandardMaterial({
|
| 144 |
+
color: C_DIM, emissive: C_DIM, emissiveIntensity: 0.15, metalness: 0.2, roughness: 0.4,
|
| 145 |
+
}));
|
| 146 |
+
bead.position.y = 0.4; bead.visible = false;
|
| 147 |
+
grp.add(bead);
|
| 148 |
+
|
| 149 |
+
_group.add(grp);
|
| 150 |
+
_pillars.push({ grp, body, bead, org: null });
|
| 151 |
+
}
|
| 152 |
+
}
|
| 153 |
+
|
| 154 |
+
function _buildSats() {
|
| 155 |
+
const THREE = _THREE;
|
| 156 |
+
const geo = new THREE.SphereGeometry(0.34, 18, 14);
|
| 157 |
+
_sats = [];
|
| 158 |
+
for (let i = 0; i < MAXM; i++) {
|
| 159 |
+
const mesh = new THREE.Mesh(geo, new THREE.MeshStandardMaterial({
|
| 160 |
+
color: C_DIM, emissive: C_DIM, emissiveIntensity: 0.15, metalness: 0.35, roughness: 0.35,
|
| 161 |
+
}));
|
| 162 |
+
mesh.position.set(0, 2.2, 0);
|
| 163 |
+
mesh.visible = false;
|
| 164 |
+
mesh.userData.label = "";
|
| 165 |
+
_group.add(mesh);
|
| 166 |
+
_sats.push({ mesh, model: null });
|
| 167 |
+
}
|
| 168 |
+
}
|
| 169 |
+
|
| 170 |
+
// =============================================================================
|
| 171 |
+
// live data handler
|
| 172 |
+
// =============================================================================
|
| 173 |
+
function _onData(j, meta) {
|
| 174 |
+
S.label = (_ctx.live.readHonestyLabel(j) || "MEASURED").toUpperCase();
|
| 175 |
+
const hf = (j && j.huggingface && j.huggingface.value) || null;
|
| 176 |
+
S.orgs = (hf && Array.isArray(hf.orgs)) ? hf.orgs : null;
|
| 177 |
+
S.models = (hf && Array.isArray(hf.models)) ? hf.models : null;
|
| 178 |
+
S.total = (hf && typeof hf.total === "number") ? hf.total : null;
|
| 179 |
+
// An HTTP-200 can still carry a null per-source value (upstream outage). Honestly
|
| 180 |
+
// downgrade to DEGRADED rather than claim "live" while showing dashes.
|
| 181 |
+
S.state = (S.orgs != null && !(meta && meta.degraded)) ? "live" : "degraded";
|
| 182 |
+
_layout(); _layoutSats(); _paint();
|
| 183 |
+
}
|
| 184 |
+
|
| 185 |
+
// =============================================================================
|
| 186 |
+
// geometry updaters
|
| 187 |
+
// =============================================================================
|
| 188 |
+
function _lerpHex(c0, c1, t) {
|
| 189 |
+
const a = new _THREE.Color(c0), b = new _THREE.Color(c1);
|
| 190 |
+
return a.lerp(b, Math.max(0, Math.min(1, t)));
|
| 191 |
+
}
|
| 192 |
+
|
| 193 |
+
function _layout() {
|
| 194 |
+
const live = S.state === "live";
|
| 195 |
+
const orgs = (S.orgs || []).slice(0, MAXO);
|
| 196 |
+
|
| 197 |
+
// log-normalize summed likes across visible orgs for pillar heights
|
| 198 |
+
const lk = orgs.map((o) => Math.log10(Math.max(1, num(o.likes))));
|
| 199 |
+
const lMin = lk.length ? Math.min(...lk) : 0;
|
| 200 |
+
const lMax = lk.length ? Math.max(...lk) : 1;
|
| 201 |
+
const lSpan = Math.max(lMax - lMin, 1e-6);
|
| 202 |
+
// log-normalize downloads across visible orgs for the reach bead + hue
|
| 203 |
+
const dl = orgs.map((o) => Math.log10(Math.max(1, num(o.downloads))));
|
| 204 |
+
const dMin = dl.length ? Math.min(...dl) : 0;
|
| 205 |
+
const dMax = dl.length ? Math.max(...dl) : 1;
|
| 206 |
+
const dSpan = Math.max(dMax - dMin, 1e-6);
|
| 207 |
+
|
| 208 |
+
_pillars.forEach((p, i) => {
|
| 209 |
+
const o = orgs[i] || null;
|
| 210 |
+
p.org = o;
|
| 211 |
+
if (!o || !live) {
|
| 212 |
+
p.body.material.color.setHex(C_PILLAR);
|
| 213 |
+
p.body.material.emissive.setHex(live ? C_PILLAR : C_DIM);
|
| 214 |
+
p.body.material.emissiveIntensity = 0.1;
|
| 215 |
+
p.body.scale.y = 0.4; p.body.position.y = 0.2;
|
| 216 |
+
p.bead.visible = false;
|
| 217 |
+
p.body.userData.label = "";
|
| 218 |
+
return;
|
| 219 |
+
}
|
| 220 |
+
const h = 0.8 + PIL_MAXH * ((Math.log10(Math.max(1, num(o.likes))) - lMin) / lSpan);
|
| 221 |
+
p.body.scale.y = h; p.body.position.y = h / 2;
|
| 222 |
+
|
| 223 |
+
const reach = Math.max(0, Math.min(1, (Math.log10(Math.max(1, num(o.downloads))) - dMin) / dSpan));
|
| 224 |
+
const col = _lerpHex(C_LO, C_HI, reach);
|
| 225 |
+
p.body.material.color.copy(col);
|
| 226 |
+
p.body.material.emissive.copy(col);
|
| 227 |
+
p.body.material.emissiveIntensity = 0.22 + 0.5 * reach;
|
| 228 |
+
|
| 229 |
+
p.bead.visible = true;
|
| 230 |
+
p.bead.position.y = 0.2 + reach * h; // bead rides up to the org's download reach
|
| 231 |
+
p.bead.material.color.copy(col);
|
| 232 |
+
p.bead.material.emissive.copy(col);
|
| 233 |
+
p.bead.material.emissiveIntensity = 0.85;
|
| 234 |
+
|
| 235 |
+
p.body.userData.label = orgShort(o.org) + " \u00b7 " + num(o.count) + " models \u00b7 " + fmtNum(num(o.likes)) + " likes";
|
| 236 |
+
});
|
| 237 |
+
}
|
| 238 |
+
|
| 239 |
+
function _layoutSats() {
|
| 240 |
+
const live = S.state === "live";
|
| 241 |
+
const models = topModels().slice(0, MAXM);
|
| 242 |
+
const lks = models.map((m) => Math.log10(Math.max(1, num(m.likes))));
|
| 243 |
+
const mMin = lks.length ? Math.min(...lks) : 0;
|
| 244 |
+
const mMax = lks.length ? Math.max(...lks) : 1;
|
| 245 |
+
const mSpan = Math.max(mMax - mMin, 1e-6);
|
| 246 |
+
|
| 247 |
+
_sats.forEach((s, i) => {
|
| 248 |
+
const m = models[i] || null;
|
| 249 |
+
s.model = m;
|
| 250 |
+
if (!m || !live) { s.mesh.visible = false; s.mesh.userData.label = ""; return; }
|
| 251 |
+
s.mesh.visible = true;
|
| 252 |
+
const scale = 0.55 + 1.0 * ((Math.log10(Math.max(1, num(m.likes))) - mMin) / mSpan);
|
| 253 |
+
s.mesh.scale.setScalar(scale);
|
| 254 |
+
const col = taskColor(m.task);
|
| 255 |
+
s.mesh.material.color.setHex(col);
|
| 256 |
+
s.mesh.material.emissive.setHex(col);
|
| 257 |
+
s.mesh.material.emissiveIntensity = 0.4;
|
| 258 |
+
s.mesh.userData.label = modShort(m) + " " + fmtNum(num(m.likes)) + " likes \u00b7 " + fmtNum(num(m.downloads)) + " dl";
|
| 259 |
+
});
|
| 260 |
+
}
|
| 261 |
+
|
| 262 |
+
// =============================================================================
|
| 263 |
+
// per-frame animation
|
| 264 |
+
// =============================================================================
|
| 265 |
+
function _onFrame() {
|
| 266 |
+
const t = performance.now();
|
| 267 |
+
if (_group) _group.rotation.y = Math.sin(t * 0.00008) * 0.18;
|
| 268 |
+
if (_core) {
|
| 269 |
+
_core.rotation.y += 0.003; _core.rotation.x += 0.0012;
|
| 270 |
+
const pulse = 1 + 0.06 * Math.sin(t * 0.002);
|
| 271 |
+
_core.scale.setScalar(pulse);
|
| 272 |
+
}
|
| 273 |
+
const live = S.state === "live";
|
| 274 |
+
_sats.forEach((s, i) => {
|
| 275 |
+
if (!s.mesh.visible) return;
|
| 276 |
+
const a = t * 0.00022 * (live ? 1 : 0) + (i / MAXM) * Math.PI * 2;
|
| 277 |
+
s.mesh.position.set(Math.cos(a) * ORBIT_R, 2.2 + Math.sin(a * 1.3) * 0.6, Math.sin(a) * ORBIT_R);
|
| 278 |
+
});
|
| 279 |
+
if (live) _pillars.forEach((p, i) => {
|
| 280 |
+
if (p.bead.visible) p.bead.rotation.y += 0.02 + 0.004 * i;
|
| 281 |
+
});
|
| 282 |
+
}
|
| 283 |
+
|
| 284 |
+
// =============================================================================
|
| 285 |
+
// overlay
|
| 286 |
+
// =============================================================================
|
| 287 |
+
function _buildOverlay() {
|
| 288 |
+
const ctx = _ctx;
|
| 289 |
+
_show = createShowcase(ctx, {
|
| 290 |
+
id: ID, title: TITLE, accent: "#3af4c8",
|
| 291 |
+
badge: _badge,
|
| 292 |
+
chips: [{ label: "MEASURED", text: "live hub", name: "src" }],
|
| 293 |
+
legend: ["MEASURED", "MODELED"],
|
| 294 |
+
description:
|
| 295 |
+
'The live, public <b>Hugging Face</b> hub trending stream as a ring of <b>pillars</b> \u2014 one ' +
|
| 296 |
+
'per <b>org</b> (author) \u2014 around a pulsing frontier core: pillar <b>height</b> = the summed ' +
|
| 297 |
+
'<b>likes</b> of that org\u2019s trending models (log-scaled), a bead rides up each pillar to the ' +
|
| 298 |
+
'org\u2019s <b>download reach</b>, hue lattice-blue \u2192 proof-teal as reach grows. The <b>most-liked ' +
|
| 299 |
+
'models</b> orbit as satellites sized by likes, coloured by task family (teal = text, amber = ' +
|
| 300 |
+
'vision, blue = audio). All values are <b>live & MEASURED</b> from the hub\u2019s own published ' +
|
| 301 |
+
'like and download counts \u2014 no invented benchmark, no ranking. Log-scaling is a display ' +
|
| 302 |
+
'transform, not a model. 0 runtime CDN.',
|
| 303 |
+
citations:
|
| 304 |
+
"Hugging Face huggingface.co/api/models \u2014 public live model hub. Like and download counts " +
|
| 305 |
+
"are as PUBLISHED by the hub; informational only. MEASURED \u2014 real live observations.",
|
| 306 |
+
plain: { html: _plainHtml },
|
| 307 |
+
});
|
| 308 |
+
|
| 309 |
+
_el["o-n"] = _show.addField("orgs on the frontier (live)");
|
| 310 |
+
_el["o-top"] = _show.addField("top org (models \u00b7 likes)");
|
| 311 |
+
_el["o-liked"] = _show.addField("most-liked model");
|
| 312 |
+
_el["o-dl"] = _show.addField("most-downloaded model");
|
| 313 |
+
_el["o-total"] = _show.addField("models in the window");
|
| 314 |
+
_el["o-label"] = _show.addField("honesty label");
|
| 315 |
+
|
| 316 |
+
_show.attachSceneLabels({
|
| 317 |
+
objects: () => {
|
| 318 |
+
const out = [];
|
| 319 |
+
_pillars.forEach((p) => { if (p.body && p.body.userData.label) out.push(p.body); });
|
| 320 |
+
_sats.forEach((s) => { if (s.mesh && s.mesh.visible && s.mesh.userData.label) out.push(s.mesh); });
|
| 321 |
+
return out;
|
| 322 |
+
},
|
| 323 |
+
text: (o) => (o && o.userData && o.userData.label) || "",
|
| 324 |
+
weight: (o) => (o && o.scale ? o.scale.y : 0),
|
| 325 |
+
topN: 4, hover: true, fadeNear: 11, fadeFar: 72,
|
| 326 |
+
});
|
| 327 |
+
|
| 328 |
+
_paint();
|
| 329 |
+
}
|
| 330 |
+
|
| 331 |
+
function _plainHtml() {
|
| 332 |
+
const n = S.orgs ? String(S.orgs.length) : "loading\u2026";
|
| 333 |
+
const top = _topOrg();
|
| 334 |
+
const topTxt = top ? (esc(orgShort(top.org)) + " \u2014 " + num(top.count) + " models") : "loading\u2026";
|
| 335 |
+
return (
|
| 336 |
+
"<b>What this means:</b> The <b>open frontier</b> is the world of AI models anyone can " +
|
| 337 |
+
"download and run for free. <b>Hugging Face</b> is the public hub where those models live, " +
|
| 338 |
+
"and it tracks which ones people are favouriting and downloading right now. This surface " +
|
| 339 |
+
"plots each <b>org</b> (the team that published the models) as a pillar: the taller the " +
|
| 340 |
+
"pillar, the more <b>likes</b> that team\u2019s trending models have gathered; a bead rides up " +
|
| 341 |
+
"to show how widely those models are <b>downloaded</b>. The busiest team at this moment is <b>" +
|
| 342 |
+
topTxt + "</b>, out of <b>" + n + "</b> in view. Orbiting the center are the single <b>most-" +
|
| 343 |
+
"liked open models</b> right now, coloured by what they do \u2014 text, vision, or audio. " +
|
| 344 |
+
"Everything here is <b>real, live hub data</b> \u2014 nothing is ranked, scored, or made up.");
|
| 345 |
+
}
|
| 346 |
+
|
| 347 |
+
// =============================================================================
|
| 348 |
+
// helpers + paint
|
| 349 |
+
// =============================================================================
|
| 350 |
+
function num(v) { return typeof v === "number" && isFinite(v) ? v : (parseFloat(v) || 0); }
|
| 351 |
+
function esc(s) { return String(s == null ? "" : s).replace(/[&<>"']/g, (c) => ({ "&": "&", "<": "<", ">": ">", '"': """, "'": "'" }[c])); }
|
| 352 |
+
function fmtNum(v) {
|
| 353 |
+
v = num(v);
|
| 354 |
+
if (v >= 1e9) return (v / 1e9).toFixed(v >= 1e10 ? 0 : 1) + "B";
|
| 355 |
+
if (v >= 1e6) return (v / 1e6).toFixed(v >= 1e7 ? 0 : 1) + "M";
|
| 356 |
+
if (v >= 1e3) return (v / 1e3).toFixed(v >= 1e4 ? 0 : 1) + "K";
|
| 357 |
+
return String(Math.round(v));
|
| 358 |
+
}
|
| 359 |
+
function taskColor(task) {
|
| 360 |
+
const t = String(task || "").toLowerCase();
|
| 361 |
+
if (!t) return C_OTH;
|
| 362 |
+
if (t.includes("image") || t.includes("vision") || t.includes("video") || t.includes("depth") || t.includes("object") || t.includes("mask")) return C_VIS;
|
| 363 |
+
if (t.includes("audio") || t.includes("speech") || t.includes("voice") || t.includes("music")) return C_AUD;
|
| 364 |
+
if (t.includes("text") || t.includes("generation") || t.includes("translation") || t.includes("summar") || t.includes("question") || t.includes("classification") || t.includes("token") || t.includes("sentence") || t.includes("fill") || t.includes("conversational")) return C_GEN;
|
| 365 |
+
return C_OTH;
|
| 366 |
+
}
|
| 367 |
+
function orgShort(s) {
|
| 368 |
+
s = String(s || "").trim();
|
| 369 |
+
const M = { "meta-llama": "Meta", "mistralai": "Mistral", "google": "Google",
|
| 370 |
+
"microsoft": "Microsoft", "nvidia": "NVIDIA", "deepseek-ai": "DeepSeek",
|
| 371 |
+
"qwen": "Qwen", "openai": "OpenAI", "stabilityai": "Stability",
|
| 372 |
+
"black-forest-labs": "Black Forest", "tencent": "Tencent", "baidu": "Baidu",
|
| 373 |
+
"zai-org": "Z.ai", "bigcode": "BigCode", "facebook": "Meta AI", "apple": "Apple" };
|
| 374 |
+
const key = s.toLowerCase();
|
| 375 |
+
if (M[key]) return M[key];
|
| 376 |
+
const n = 16;
|
| 377 |
+
return s.length > n ? s.slice(0, n - 1) + "\u2026" : s;
|
| 378 |
+
}
|
| 379 |
+
function modShort(m) {
|
| 380 |
+
const id = String((m && m.id) || "").trim();
|
| 381 |
+
const short = id.includes("/") ? id.slice(id.indexOf("/") + 1) : id;
|
| 382 |
+
const n = 26;
|
| 383 |
+
return short.length > n ? short.slice(0, n - 1) + "\u2026" : short;
|
| 384 |
+
}
|
| 385 |
+
function topModels() {
|
| 386 |
+
const ms = (S.models || []).slice();
|
| 387 |
+
return ms.sort((a, b) => num(b.likes) - num(a.likes));
|
| 388 |
+
}
|
| 389 |
+
function _topOrg() {
|
| 390 |
+
const os = S.orgs || [];
|
| 391 |
+
if (!os.length) return null;
|
| 392 |
+
return os.reduce((a, b) => (num(b.likes) > num(a.likes) ? b : a), os[0]);
|
| 393 |
+
}
|
| 394 |
+
function _mostLiked() { const ms = topModels(); return ms.length ? ms[0] : null; }
|
| 395 |
+
function _mostDownloaded() {
|
| 396 |
+
const ms = S.models || [];
|
| 397 |
+
if (!ms.length) return null;
|
| 398 |
+
return ms.reduce((a, b) => (num(b.downloads) > num(a.downloads) ? b : a), ms[0]);
|
| 399 |
+
}
|
| 400 |
+
|
| 401 |
+
function _tok(state) {
|
| 402 |
+
if (state === "live") return null;
|
| 403 |
+
if (state === "missing") return "NO-LIVE-DATA";
|
| 404 |
+
if (state === "degraded") return "DEGRADED";
|
| 405 |
+
if (state === "error") return "OFFLINE";
|
| 406 |
+
return "\u2026";
|
| 407 |
+
}
|
| 408 |
+
function _set(id, v) { if (_el[id]) _el[id].textContent = v; }
|
| 409 |
+
|
| 410 |
+
function _paint() {
|
| 411 |
+
const t = _tok(S.state);
|
| 412 |
+
_set("o-n", t || (S.orgs != null ? String(S.orgs.length) : "\u2014"));
|
| 413 |
+
const top = _topOrg();
|
| 414 |
+
_set("o-top", t || (top ? (orgShort(top.org) + " " + num(top.count) + " \u00b7 " + fmtNum(num(top.likes))) : "\u2014"));
|
| 415 |
+
const liked = _mostLiked();
|
| 416 |
+
_set("o-liked", t || (liked ? (modShort(liked) + " " + fmtNum(num(liked.likes)) + " likes") : "\u2014"));
|
| 417 |
+
const dld = _mostDownloaded();
|
| 418 |
+
_set("o-dl", t || (dld ? (modShort(dld) + " " + fmtNum(num(dld.downloads)) + " dl") : "\u2014"));
|
| 419 |
+
_set("o-total", t || (S.total != null ? String(S.total) : "\u2014"));
|
| 420 |
+
|
| 421 |
+
// honesty label verbatim — never upgraded
|
| 422 |
+
_set("o-label", S.label || "MEASURED");
|
| 423 |
+
if (_show) { _show.setChip("src", S.label || "MEASURED", { text: "live hub" }); _show.refreshPlain(); }
|
| 424 |
+
}
|
| 425 |
+
|
| 426 |
+
// =============================================================================
|
| 427 |
+
// unmount — clean up everything; must not affect other organs
|
| 428 |
+
// =============================================================================
|
| 429 |
+
export function unmount() {
|
| 430 |
+
_polls.forEach((p) => { try { p.stop(); } catch (_) {} }); _polls = [];
|
| 431 |
+
try { if (_show) _show.destroy(); } catch (_) {}
|
| 432 |
+
try {
|
| 433 |
+
if (_group && _stage) {
|
| 434 |
+
_group.traverse((o) => {
|
| 435 |
+
if (o.geometry && o.geometry.dispose) o.geometry.dispose();
|
| 436 |
+
if (o.material) {
|
| 437 |
+
const ms = Array.isArray(o.material) ? o.material : [o.material];
|
| 438 |
+
ms.forEach((m) => { if (m.dispose) m.dispose(); });
|
| 439 |
+
}
|
| 440 |
+
});
|
| 441 |
+
_stage.scene.remove(_group);
|
| 442 |
+
}
|
| 443 |
+
} catch (_) {}
|
| 444 |
+
_group = _show = _core = null;
|
| 445 |
+
_pillars = []; _sats = [];
|
| 446 |
+
_el = {}; _badge = null; _frameReg = false;
|
| 447 |
+
_stage = _THREE = _ctx = null;
|
| 448 |
+
S.label = S.orgs = S.models = S.total = null; S.state = "init";
|
| 449 |
+
}
|
| 450 |
+
|
| 451 |
+
export default { id: ID, title: TITLE, endpoints: [OPEN_EP], mount, unmount };
|
static/3d/surfaces/research.js
ADDED
|
@@ -0,0 +1,433 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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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/research.js — FRONTIER RESEARCH organ for the holographic estate.
|
| 5 |
+
//
|
| 6 |
+
// A live "research frontier observatory": the real, public arXiv submission stream
|
| 7 |
+
// (newest cs.AI / cs.LG / cs.CL / cs.CV / cs.NE papers) rendered as a ring of pillars —
|
| 8 |
+
// one per CATEGORY — around a pulsing frontier core, with the most-recent individual
|
| 9 |
+
// papers orbiting as satellites. 100% LIVE MEASURED data, pulled same-origin from the
|
| 10 |
+
// a11oy deva frontier feed. Nothing here is faked: no invented score, no citation count,
|
| 11 |
+
// no ranking — only arXiv's own published titles, authors, categories and timestamps.
|
| 12 |
+
//
|
| 13 |
+
// Surface export shape (mirrors leaders.js / finance.js):
|
| 14 |
+
// export default { id, title, endpoints, mount(ctx), unmount() }
|
| 15 |
+
// ctx = { stage, container, live, label, THREE, szl3d }
|
| 16 |
+
//
|
| 17 |
+
// DATA SHOWN (all live, same-origin):
|
| 18 |
+
// /api/a11oy/v1/deva/frontier/research -> arxiv.value.cats[] {cat, count, latest}
|
| 19 |
+
// arxiv.value.papers[] {id, title, first_author,
|
| 20 |
+
// authors_n, published, cat}
|
| 21 |
+
// arxiv.value.total
|
| 22 |
+
//
|
| 23 |
+
// VISUAL ENCODING (direct read of measured values; the only transform is log-normalization
|
| 24 |
+
// for scale, which is a DISPLAY transform — never a model):
|
| 25 |
+
// * each CATEGORY = a pillar on a ring. pillar HEIGHT = log(paper count in the live
|
| 26 |
+
// window) normalized; a bead rides up to that category's SHARE of the window; pillar
|
| 27 |
+
// hue lerps lattice-blue (small share) -> proof-teal (large share).
|
| 28 |
+
// * most-recent PAPERS = satellites orbiting the core, size = log(author count) i.e.
|
| 29 |
+
// collaboration breadth. hover shows the paper title, its category, and date.
|
| 30 |
+
// * center = proof-teal wireframe "frontier core" that pulses with the total window size.
|
| 31 |
+
//
|
| 32 |
+
// HONESTY: MEASURED (real live observations from the public arXiv Atom API).
|
| 33 |
+
// Degrades to NO-LIVE-DATA (grey) on 404 / offline; never fabricates a paper.
|
| 34 |
+
// Titles, authors, categories and dates are as PUBLISHED by arXiv; informational only.
|
| 35 |
+
// COLOURS: proof-teal 0x3af4c8, lattice-blue 0x5b8dee, gold-amber 0xd7b96b, greys.
|
| 36 |
+
// Purple BANNED as UI/background. 0 RUNTIME CDN. Vendored three.js via page importmap.
|
| 37 |
+
// CITATIONS: arXiv export.arxiv.org/api/query — public live submission feed.
|
| 38 |
+
|
| 39 |
+
import { createShowcase } from "./_showcase.js";
|
| 40 |
+
|
| 41 |
+
const ID = "research";
|
| 42 |
+
const TITLE = "Frontier Research \u00b7 Live arXiv AI";
|
| 43 |
+
|
| 44 |
+
const RESEARCH_EP = "/api/a11oy/v1/deva/frontier/research?limit=24";
|
| 45 |
+
|
| 46 |
+
// palette — purple BANNED
|
| 47 |
+
const C_HOT = 0xd7b96b; // gold-amber (freshest paper)
|
| 48 |
+
const C_OPEN = 0x3af4c8; // proof-teal (research / open)
|
| 49 |
+
const C_LO = 0x5b8dee; // lattice-blue (low share)
|
| 50 |
+
const C_HI = 0x3af4c8; // proof-teal (high share)
|
| 51 |
+
const C_CORE = 0x3af4c8; // proof-teal (frontier core)
|
| 52 |
+
const C_PILLAR = 0x24506a; // dim pillar body
|
| 53 |
+
const C_DIM = 0x42505d; // grey (degraded / no-live-data)
|
| 54 |
+
const C_GRID = 0x1b3a44;
|
| 55 |
+
|
| 56 |
+
const RING_R = 9.5; // category ring radius
|
| 57 |
+
const MAXL = 16; // category pillar slots
|
| 58 |
+
const ORBIT_R = 4.6; // paper orbit radius
|
| 59 |
+
const MAXM = 8; // paper satellite slots
|
| 60 |
+
const PIL_MAXH = 6.5; // tallest pillar (world units)
|
| 61 |
+
|
| 62 |
+
let _stage = null, _THREE = null, _ctx = null, _group = null, _show = null;
|
| 63 |
+
let _frameReg = false, _polls = [], _el = {}, _badge = null;
|
| 64 |
+
|
| 65 |
+
let _core = null;
|
| 66 |
+
let _pillars = []; // Array<{ grp, body, bead, cat }>
|
| 67 |
+
let _sats = []; // Array<{ mesh, paper }>
|
| 68 |
+
|
| 69 |
+
// live state
|
| 70 |
+
const S = {
|
| 71 |
+
label: null, cats: null, papers: null, total: null, state: "init",
|
| 72 |
+
};
|
| 73 |
+
|
| 74 |
+
// =============================================================================
|
| 75 |
+
// mount(ctx)
|
| 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 |
+
try { _stage.camera.position.set(0, 10, 27); } catch (_) {}
|
| 82 |
+
try { if (_stage.controls && _stage.controls.target) { _stage.controls.target.set(0, 2.2, 0); _stage.controls.update(); } } catch (_) {}
|
| 83 |
+
try { _stage.setBloom(true); } catch (_) {}
|
| 84 |
+
|
| 85 |
+
_buildFloor();
|
| 86 |
+
_buildCore();
|
| 87 |
+
_buildPillars();
|
| 88 |
+
_buildSats();
|
| 89 |
+
|
| 90 |
+
if (!_frameReg) { _stage.onFrame(_onFrame); _frameReg = true; }
|
| 91 |
+
|
| 92 |
+
_badge = ctx.live.createBadge();
|
| 93 |
+
_polls.push(ctx.live.poll(RESEARCH_EP, 60000, _onResearch, {
|
| 94 |
+
badge: _badge, onState: (m) => { S.state = m.state; _layout(); _layoutSats(); _paint(); },
|
| 95 |
+
}));
|
| 96 |
+
|
| 97 |
+
_buildOverlay();
|
| 98 |
+
return { id: ID, started: true };
|
| 99 |
+
}
|
| 100 |
+
|
| 101 |
+
// =============================================================================
|
| 102 |
+
// builders
|
| 103 |
+
// =============================================================================
|
| 104 |
+
function _buildFloor() {
|
| 105 |
+
const THREE = _THREE;
|
| 106 |
+
const grid = new THREE.GridHelper(48, 48, C_GRID, 0x0f2027);
|
| 107 |
+
grid.material.opacity = 0.16; grid.material.transparent = true; grid.position.y = -0.01;
|
| 108 |
+
_group.add(grid);
|
| 109 |
+
}
|
| 110 |
+
|
| 111 |
+
function _buildCore() {
|
| 112 |
+
const THREE = _THREE;
|
| 113 |
+
_core = new THREE.Mesh(
|
| 114 |
+
new THREE.IcosahedronGeometry(1.7, 1),
|
| 115 |
+
new THREE.MeshStandardMaterial({ color: C_CORE, emissive: C_CORE, emissiveIntensity: 0.35, wireframe: true, transparent: true, opacity: 0.55 }),
|
| 116 |
+
);
|
| 117 |
+
_core.position.set(0, 2.2, 0);
|
| 118 |
+
_group.add(_core);
|
| 119 |
+
}
|
| 120 |
+
|
| 121 |
+
function _buildPillars() {
|
| 122 |
+
const THREE = _THREE;
|
| 123 |
+
const bodyGeo = new THREE.CylinderGeometry(0.16, 0.20, 1, 14);
|
| 124 |
+
const beadGeo = new THREE.SphereGeometry(0.26, 16, 12);
|
| 125 |
+
_pillars = [];
|
| 126 |
+
for (let i = 0; i < MAXL; i++) {
|
| 127 |
+
const a = (i / MAXL) * Math.PI * 2;
|
| 128 |
+
const x = Math.cos(a) * RING_R, z = Math.sin(a) * RING_R;
|
| 129 |
+
const grp = new THREE.Group();
|
| 130 |
+
grp.position.set(x, 0, z);
|
| 131 |
+
|
| 132 |
+
const body = new THREE.Mesh(bodyGeo, new THREE.MeshStandardMaterial({
|
| 133 |
+
color: C_PILLAR, emissive: C_PILLAR, emissiveIntensity: 0.12, metalness: 0.3, roughness: 0.5,
|
| 134 |
+
}));
|
| 135 |
+
body.scale.y = 0.4; body.position.y = 0.2;
|
| 136 |
+
body.userData.label = "";
|
| 137 |
+
grp.add(body);
|
| 138 |
+
|
| 139 |
+
const bead = new THREE.Mesh(beadGeo, new THREE.MeshStandardMaterial({
|
| 140 |
+
color: C_DIM, emissive: C_DIM, emissiveIntensity: 0.15, metalness: 0.2, roughness: 0.4,
|
| 141 |
+
}));
|
| 142 |
+
bead.position.y = 0.4; bead.visible = false;
|
| 143 |
+
grp.add(bead);
|
| 144 |
+
|
| 145 |
+
_group.add(grp);
|
| 146 |
+
_pillars.push({ grp, body, bead, cat: null });
|
| 147 |
+
}
|
| 148 |
+
}
|
| 149 |
+
|
| 150 |
+
function _buildSats() {
|
| 151 |
+
const THREE = _THREE;
|
| 152 |
+
const geo = new THREE.SphereGeometry(0.34, 18, 14);
|
| 153 |
+
_sats = [];
|
| 154 |
+
for (let i = 0; i < MAXM; i++) {
|
| 155 |
+
const mesh = new THREE.Mesh(geo, new THREE.MeshStandardMaterial({
|
| 156 |
+
color: C_DIM, emissive: C_DIM, emissiveIntensity: 0.15, metalness: 0.35, roughness: 0.35,
|
| 157 |
+
}));
|
| 158 |
+
mesh.position.set(0, 2.2, 0);
|
| 159 |
+
mesh.visible = false;
|
| 160 |
+
mesh.userData.label = "";
|
| 161 |
+
_group.add(mesh);
|
| 162 |
+
_sats.push({ mesh, paper: null });
|
| 163 |
+
}
|
| 164 |
+
}
|
| 165 |
+
|
| 166 |
+
// =============================================================================
|
| 167 |
+
// live data handler
|
| 168 |
+
// =============================================================================
|
| 169 |
+
function _onResearch(j, meta) {
|
| 170 |
+
S.label = (_ctx.live.readHonestyLabel(j) || "MEASURED").toUpperCase();
|
| 171 |
+
const ax = (j && j.arxiv && j.arxiv.value) || null;
|
| 172 |
+
S.cats = (ax && Array.isArray(ax.cats)) ? ax.cats : null;
|
| 173 |
+
S.papers = (ax && Array.isArray(ax.papers)) ? ax.papers : null;
|
| 174 |
+
S.total = (ax && typeof ax.total === "number") ? ax.total : null;
|
| 175 |
+
// An HTTP-200 can still carry a null per-source value (upstream outage). Honestly
|
| 176 |
+
// downgrade to DEGRADED rather than claim "live" while showing dashes.
|
| 177 |
+
S.state = (S.cats != null && !(meta && meta.degraded)) ? "live" : "degraded";
|
| 178 |
+
_layout(); _layoutSats(); _paint();
|
| 179 |
+
}
|
| 180 |
+
|
| 181 |
+
// =============================================================================
|
| 182 |
+
// geometry updaters
|
| 183 |
+
// =============================================================================
|
| 184 |
+
function _lerpHex(c0, c1, t) {
|
| 185 |
+
const a = new _THREE.Color(c0), b = new _THREE.Color(c1);
|
| 186 |
+
return a.lerp(b, Math.max(0, Math.min(1, t)));
|
| 187 |
+
}
|
| 188 |
+
|
| 189 |
+
function _layout() {
|
| 190 |
+
const live = S.state === "live";
|
| 191 |
+
const cats = (S.cats || []).slice(0, MAXL);
|
| 192 |
+
const totalWin = cats.reduce((s, c) => s + num(c.count), 0) || 1;
|
| 193 |
+
|
| 194 |
+
// log-normalize paper count across the visible categories for pillar heights
|
| 195 |
+
const cx = cats.map((c) => Math.log10(Math.max(1, num(c.count))));
|
| 196 |
+
const cMin = cx.length ? Math.min(...cx) : 0;
|
| 197 |
+
const cMax = cx.length ? Math.max(...cx) : 1;
|
| 198 |
+
const cSpan = Math.max(cMax - cMin, 1e-6);
|
| 199 |
+
|
| 200 |
+
_pillars.forEach((p, i) => {
|
| 201 |
+
const c = cats[i] || null;
|
| 202 |
+
p.cat = c;
|
| 203 |
+
if (!c || !live) {
|
| 204 |
+
p.body.material.color.setHex(C_PILLAR);
|
| 205 |
+
p.body.material.emissive.setHex(live ? C_PILLAR : C_DIM);
|
| 206 |
+
p.body.material.emissiveIntensity = 0.1;
|
| 207 |
+
p.body.scale.y = 0.4; p.body.position.y = 0.2;
|
| 208 |
+
p.bead.visible = false;
|
| 209 |
+
p.body.userData.label = "";
|
| 210 |
+
return;
|
| 211 |
+
}
|
| 212 |
+
const h = 0.8 + PIL_MAXH * ((Math.log10(Math.max(1, num(c.count))) - cMin) / cSpan);
|
| 213 |
+
p.body.scale.y = h; p.body.position.y = h / 2;
|
| 214 |
+
|
| 215 |
+
const share = Math.max(0, Math.min(1, num(c.count) / totalWin));
|
| 216 |
+
const col = _lerpHex(C_LO, C_HI, share);
|
| 217 |
+
p.body.material.color.copy(col);
|
| 218 |
+
p.body.material.emissive.copy(col);
|
| 219 |
+
p.body.material.emissiveIntensity = 0.22 + 0.5 * share;
|
| 220 |
+
|
| 221 |
+
p.bead.visible = true;
|
| 222 |
+
p.bead.position.y = 0.2 + share * h; // bead rides up to the category's share of the window
|
| 223 |
+
p.bead.material.color.copy(col);
|
| 224 |
+
p.bead.material.emissive.copy(col);
|
| 225 |
+
p.bead.material.emissiveIntensity = 0.85;
|
| 226 |
+
|
| 227 |
+
p.body.userData.label = catShort(c.cat) + " \u00b7 " + num(c.count) + " papers \u00b7 " + Math.round(share * 100) + "%";
|
| 228 |
+
});
|
| 229 |
+
}
|
| 230 |
+
|
| 231 |
+
function _layoutSats() {
|
| 232 |
+
const live = S.state === "live";
|
| 233 |
+
const papers = topPapers().slice(0, MAXM);
|
| 234 |
+
const az = papers.map((p) => Math.log10(Math.max(1, num(p.authors_n))));
|
| 235 |
+
const mMin = az.length ? Math.min(...az) : 0;
|
| 236 |
+
const mMax = az.length ? Math.max(...az) : 1;
|
| 237 |
+
const mSpan = Math.max(mMax - mMin, 1e-6);
|
| 238 |
+
|
| 239 |
+
_sats.forEach((s, i) => {
|
| 240 |
+
const p = papers[i] || null;
|
| 241 |
+
s.paper = p;
|
| 242 |
+
if (!p || !live) { s.mesh.visible = false; s.mesh.userData.label = ""; return; }
|
| 243 |
+
s.mesh.visible = true;
|
| 244 |
+
const scale = 0.55 + 1.0 * ((Math.log10(Math.max(1, num(p.authors_n))) - mMin) / mSpan);
|
| 245 |
+
s.mesh.scale.setScalar(scale);
|
| 246 |
+
const col = i === 0 ? C_HOT : C_OPEN; // freshest paper glows amber
|
| 247 |
+
s.mesh.material.color.setHex(col);
|
| 248 |
+
s.mesh.material.emissive.setHex(col);
|
| 249 |
+
s.mesh.material.emissiveIntensity = 0.4;
|
| 250 |
+
s.mesh.userData.label = paperShort(p) + " \u00b7 " + catShort(p.cat) + " \u00b7 " + fmtDate(p.published);
|
| 251 |
+
});
|
| 252 |
+
}
|
| 253 |
+
|
| 254 |
+
// =============================================================================
|
| 255 |
+
// per-frame animation
|
| 256 |
+
// =============================================================================
|
| 257 |
+
function _onFrame() {
|
| 258 |
+
const t = performance.now();
|
| 259 |
+
if (_group) _group.rotation.y = Math.sin(t * 0.00008) * 0.18;
|
| 260 |
+
if (_core) {
|
| 261 |
+
_core.rotation.y += 0.003; _core.rotation.x += 0.0012;
|
| 262 |
+
const pulse = 1 + 0.06 * Math.sin(t * 0.002);
|
| 263 |
+
_core.scale.setScalar(pulse);
|
| 264 |
+
}
|
| 265 |
+
const live = S.state === "live";
|
| 266 |
+
_sats.forEach((s, i) => {
|
| 267 |
+
if (!s.mesh.visible) return;
|
| 268 |
+
const a = t * 0.00022 * (live ? 1 : 0) + (i / MAXM) * Math.PI * 2;
|
| 269 |
+
s.mesh.position.set(Math.cos(a) * ORBIT_R, 2.2 + Math.sin(a * 1.3) * 0.6, Math.sin(a) * ORBIT_R);
|
| 270 |
+
});
|
| 271 |
+
if (live) _pillars.forEach((p, i) => {
|
| 272 |
+
if (p.bead.visible) p.bead.rotation.y += 0.02 + 0.004 * i;
|
| 273 |
+
});
|
| 274 |
+
}
|
| 275 |
+
|
| 276 |
+
// =============================================================================
|
| 277 |
+
// overlay
|
| 278 |
+
// =============================================================================
|
| 279 |
+
function _buildOverlay() {
|
| 280 |
+
const ctx = _ctx;
|
| 281 |
+
_show = createShowcase(ctx, {
|
| 282 |
+
id: ID, title: TITLE, accent: "#3af4c8",
|
| 283 |
+
badge: _badge,
|
| 284 |
+
chips: [{ label: "MEASURED", text: "live feed", name: "src" }],
|
| 285 |
+
legend: ["MEASURED", "MODELED"],
|
| 286 |
+
description:
|
| 287 |
+
'The live, public <b>arXiv</b> submission stream (newest cs.AI / cs.LG / cs.CL / cs.CV / cs.NE ' +
|
| 288 |
+
'papers) as a ring of <b>pillars</b> \u2014 one per <b>category</b> \u2014 around a pulsing ' +
|
| 289 |
+
'frontier core: pillar <b>height</b> = the number of papers that category has in the live ' +
|
| 290 |
+
'window (log-scaled), a bead rides up each pillar to that category\u2019s <b>share</b> of the ' +
|
| 291 |
+
'window, hue lattice-blue \u2192 proof-teal as its share grows. The <b>most-recent papers</b> ' +
|
| 292 |
+
'orbit as satellites sized by <b>author count</b> (collaboration breadth); the freshest glows ' +
|
| 293 |
+
'amber. All values are <b>live & MEASURED</b> from arXiv\u2019s own published titles, ' +
|
| 294 |
+
'authors, categories and timestamps \u2014 no citation count, no score, no ranking. ' +
|
| 295 |
+
'Log-scaling is a display transform, not a model. 0 runtime CDN.',
|
| 296 |
+
citations:
|
| 297 |
+
"arXiv export.arxiv.org/api/query \u2014 public live submission feed. Titles, authors, " +
|
| 298 |
+
"categories and dates are as PUBLISHED by arXiv; informational only. MEASURED \u2014 real live observations.",
|
| 299 |
+
plain: { html: _plainHtml },
|
| 300 |
+
});
|
| 301 |
+
|
| 302 |
+
_el["r-n"] = _show.addField("categories in the window (live)");
|
| 303 |
+
_el["r-top"] = _show.addField("most active category (papers \u00b7 share)");
|
| 304 |
+
_el["r-new"] = _show.addField("newest paper");
|
| 305 |
+
_el["r-date"] = _show.addField("newest submission");
|
| 306 |
+
_el["r-total"] = _show.addField("papers in live window");
|
| 307 |
+
_el["r-label"] = _show.addField("honesty label");
|
| 308 |
+
|
| 309 |
+
_show.attachSceneLabels({
|
| 310 |
+
objects: () => {
|
| 311 |
+
const out = [];
|
| 312 |
+
_pillars.forEach((p) => { if (p.body && p.body.userData.label) out.push(p.body); });
|
| 313 |
+
_sats.forEach((s) => { if (s.mesh && s.mesh.visible && s.mesh.userData.label) out.push(s.mesh); });
|
| 314 |
+
return out;
|
| 315 |
+
},
|
| 316 |
+
text: (o) => (o && o.userData && o.userData.label) || "",
|
| 317 |
+
weight: (o) => (o && o.scale ? o.scale.y : 0),
|
| 318 |
+
topN: 4, hover: true, fadeNear: 11, fadeFar: 72,
|
| 319 |
+
});
|
| 320 |
+
|
| 321 |
+
_paint();
|
| 322 |
+
}
|
| 323 |
+
|
| 324 |
+
function _plainHtml() {
|
| 325 |
+
const n = S.cats ? String(S.cats.length) : "loading\u2026";
|
| 326 |
+
const top = _topCat();
|
| 327 |
+
const topTxt = top ? (esc(catShort(top.cat)) + " \u2014 " + num(top.count) + " papers") : "loading\u2026";
|
| 328 |
+
return (
|
| 329 |
+
"<b>What this means:</b> <b>arXiv</b> is where the world\u2019s AI researchers post new work, " +
|
| 330 |
+
"often the day it\u2019s written \u2014 the true frontier, months ahead of any product. This " +
|
| 331 |
+
"surface reads the newest submissions right now and plots each research <b>category</b> as a " +
|
| 332 |
+
"pillar: the taller the pillar, the more fresh papers that area has in this window; the bead\u2019s " +
|
| 333 |
+
"height is that area\u2019s <b>share</b> of everything posted. The busiest area at this moment is " +
|
| 334 |
+
"<b>" + topTxt + "</b>, across <b>" + n + "</b> categories. Orbiting the center are the <b>most " +
|
| 335 |
+
"recent individual papers</b>, sized by how many authors collaborated. Everything here is " +
|
| 336 |
+
"<b>real, live feed data</b> \u2014 nothing is scored, ranked, or made up \u2014 shown for orientation.");
|
| 337 |
+
}
|
| 338 |
+
|
| 339 |
+
// =============================================================================
|
| 340 |
+
// helpers + paint
|
| 341 |
+
// =============================================================================
|
| 342 |
+
function num(v) { return typeof v === "number" && isFinite(v) ? v : (parseFloat(v) || 0); }
|
| 343 |
+
function esc(s) { return String(s == null ? "" : s).replace(/[&<>"']/g, (c) => ({ "&": "&", "<": "<", ">": ">", '"': """, "'": "'" }[c])); }
|
| 344 |
+
function catShort(s) {
|
| 345 |
+
s = String(s || "").trim();
|
| 346 |
+
const M = { "cs.AI": "AI", "cs.LG": "Machine Learning", "cs.CL": "NLP / Language",
|
| 347 |
+
"cs.CV": "Vision", "cs.NE": "Neural / Evolutionary", "cs.RO": "Robotics",
|
| 348 |
+
"cs.MA": "Multi-Agent", "cs.IR": "Info Retrieval", "cs.CR": "Security",
|
| 349 |
+
"stat.ML": "Stats ML", "cs.HC": "Human-Computer", "cs.SE": "Software Eng",
|
| 350 |
+
"cs.DC": "Distributed", "cs.CY": "Computers & Society", "eess.AS": "Audio/Speech" };
|
| 351 |
+
return M[s] || (s || "other");
|
| 352 |
+
}
|
| 353 |
+
function paperShort(p) {
|
| 354 |
+
const title = String((p && p.title) || "").trim();
|
| 355 |
+
const n = 30;
|
| 356 |
+
return title.length > n ? title.slice(0, n - 1) + "\u2026" : title;
|
| 357 |
+
}
|
| 358 |
+
function fmtDate(s) {
|
| 359 |
+
s = String(s || "");
|
| 360 |
+
const m = s.match(/^(\d{4})-(\d{2})-(\d{2})/);
|
| 361 |
+
if (!m) return "\u2014";
|
| 362 |
+
const MON = ["", "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"];
|
| 363 |
+
return MON[parseInt(m[2], 10)] + " " + parseInt(m[3], 10);
|
| 364 |
+
}
|
| 365 |
+
function topPapers() {
|
| 366 |
+
const ps = (S.papers || []).slice();
|
| 367 |
+
return ps.sort((a, b) => String(b.published || "").localeCompare(String(a.published || "")));
|
| 368 |
+
}
|
| 369 |
+
function _topCat() {
|
| 370 |
+
const cs = S.cats || [];
|
| 371 |
+
if (!cs.length) return null;
|
| 372 |
+
return cs.reduce((a, b) => (num(b.count) > num(a.count) ? b : a), cs[0]);
|
| 373 |
+
}
|
| 374 |
+
function _newest() {
|
| 375 |
+
const ps = topPapers();
|
| 376 |
+
return ps.length ? ps[0] : null;
|
| 377 |
+
}
|
| 378 |
+
function _winShare(c) {
|
| 379 |
+
const cs = S.cats || [];
|
| 380 |
+
const tot = cs.reduce((s, x) => s + num(x.count), 0) || 1;
|
| 381 |
+
return c ? Math.round((num(c.count) / tot) * 100) : 0;
|
| 382 |
+
}
|
| 383 |
+
|
| 384 |
+
function _tok(state) {
|
| 385 |
+
if (state === "live") return null;
|
| 386 |
+
if (state === "missing") return "NO-LIVE-DATA";
|
| 387 |
+
if (state === "degraded") return "DEGRADED";
|
| 388 |
+
if (state === "error") return "OFFLINE";
|
| 389 |
+
return "\u2026";
|
| 390 |
+
}
|
| 391 |
+
function _set(id, v) { if (_el[id]) _el[id].textContent = v; }
|
| 392 |
+
|
| 393 |
+
function _paint() {
|
| 394 |
+
const t = _tok(S.state);
|
| 395 |
+
_set("r-n", t || (S.cats != null ? String(S.cats.length) : "\u2014"));
|
| 396 |
+
const top = _topCat();
|
| 397 |
+
_set("r-top", t || (top ? (catShort(top.cat) + " " + num(top.count) + " \u00b7 " + _winShare(top) + "%") : "\u2014"));
|
| 398 |
+
const w = _newest();
|
| 399 |
+
_set("r-new", t || (w ? paperShort(w) : "\u2014"));
|
| 400 |
+
_set("r-date", t || (w ? fmtDate(w.published) : "\u2014"));
|
| 401 |
+
_set("r-total", t || (S.total != null ? String(S.total) : "\u2014"));
|
| 402 |
+
|
| 403 |
+
// honesty label verbatim — never upgraded
|
| 404 |
+
_set("r-label", S.label || "MEASURED");
|
| 405 |
+
if (_show) { _show.setChip("src", S.label || "MEASURED", { text: "live feed" }); _show.refreshPlain(); }
|
| 406 |
+
}
|
| 407 |
+
|
| 408 |
+
// =============================================================================
|
| 409 |
+
// unmount — clean up everything; must not affect other organs
|
| 410 |
+
// =============================================================================
|
| 411 |
+
export function unmount() {
|
| 412 |
+
_polls.forEach((p) => { try { p.stop(); } catch (_) {} }); _polls = [];
|
| 413 |
+
try { if (_show) _show.destroy(); } catch (_) {}
|
| 414 |
+
try {
|
| 415 |
+
if (_group && _stage) {
|
| 416 |
+
_group.traverse((o) => {
|
| 417 |
+
if (o.geometry && o.geometry.dispose) o.geometry.dispose();
|
| 418 |
+
if (o.material) {
|
| 419 |
+
const ms = Array.isArray(o.material) ? o.material : [o.material];
|
| 420 |
+
ms.forEach((m) => { if (m.dispose) m.dispose(); });
|
| 421 |
+
}
|
| 422 |
+
});
|
| 423 |
+
_stage.scene.remove(_group);
|
| 424 |
+
}
|
| 425 |
+
} catch (_) {}
|
| 426 |
+
_group = _show = _core = null;
|
| 427 |
+
_pillars = []; _sats = [];
|
| 428 |
+
_el = {}; _badge = null; _frameReg = false;
|
| 429 |
+
_stage = _THREE = _ctx = null;
|
| 430 |
+
S.label = S.cats = S.papers = S.total = null; S.state = "init";
|
| 431 |
+
}
|
| 432 |
+
|
| 433 |
+
export default { id: ID, title: TITLE, endpoints: [RESEARCH_EP], mount, unmount };
|