- core/theme.js: export NEXUS with full NEXUS.theme.* properties used by all 6 panels - core/ticker.js: add subscribe() convenience export so panels can self-register - data/gitea.js: also write state.agentStatus, activeAgentCount, zoneIntensity, commits, commitHashes - data/loaders.js: also write state.sovereignty - data/bitcoin.js: also write state.blockHeight, lastBlockHeight, newBlockDetected, starPulseIntensity - data/weather.js: also write state.weather - app.js: import + init all 6 panel modules, bootstrap data polling, call globalTicker.tick() Fixes #412 Refs #409 Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
75 lines
2.7 KiB
JavaScript
75 lines
2.7 KiB
JavaScript
// === THE NEXUS — Main Entry Point ===
|
|
import * as THREE from 'three';
|
|
import { S } from './modules/state.js';
|
|
import { scene, camera, renderer, composer } from './modules/scene-setup.js';
|
|
import { clock } from './modules/warp.js';
|
|
import { nostr } from './modules/nostr.js';
|
|
import { createNostrPanelTexture } from './modules/nostr-panel.js';
|
|
import { globalTicker } from './modules/core/ticker.js';
|
|
|
|
// === PANELS ===
|
|
import { init as initHeatmap } from './modules/panels/heatmap.js';
|
|
import { init as initAgentBoard } from './modules/panels/agent-board.js';
|
|
import { init as initDualBrain } from './modules/panels/dual-brain.js';
|
|
import { init as initLoraPanel } from './modules/panels/lora-panel.js';
|
|
import { init as initSovereignty } from './modules/panels/sovereignty.js';
|
|
import { init as initEarth } from './modules/panels/earth.js';
|
|
|
|
// === DATA ===
|
|
import { refreshCommitData, refreshAgentData, AGENT_STATUS_CACHE_MS } from './modules/data/gitea.js';
|
|
import { fetchWeatherData, WEATHER_REFRESH_MS } from './modules/data/weather.js';
|
|
import { fetchBlockHeight, BITCOIN_REFRESH_MS } from './modules/data/bitcoin.js';
|
|
import { fetchSovereigntyStatus } from './modules/data/loaders.js';
|
|
|
|
// === NOSTR INIT ===
|
|
nostr.connect();
|
|
const { canvas: nostrCanvas, update: updateNostrUI } = createNostrPanelTexture();
|
|
const nostrTexture = new THREE.CanvasTexture(nostrCanvas);
|
|
const nostrMat = new THREE.MeshBasicMaterial({ map: nostrTexture, transparent: true, side: THREE.DoubleSide });
|
|
const nostrPanel = new THREE.Mesh(new THREE.PlaneGeometry(3, 3), nostrMat);
|
|
nostrPanel.position.set(-6, 3.5, -7.5);
|
|
nostrPanel.rotation.y = 0.4;
|
|
scene.add(nostrPanel);
|
|
|
|
// === PANEL INIT ===
|
|
initHeatmap(scene);
|
|
initAgentBoard(scene);
|
|
initDualBrain(scene);
|
|
initLoraPanel(scene);
|
|
initSovereignty(scene);
|
|
initEarth(scene);
|
|
|
|
// === DATA BOOTSTRAP ===
|
|
refreshCommitData();
|
|
refreshAgentData();
|
|
fetchWeatherData().catch(() => {});
|
|
fetchBlockHeight();
|
|
fetchSovereigntyStatus().catch(() => {});
|
|
setInterval(refreshCommitData, AGENT_STATUS_CACHE_MS);
|
|
setInterval(refreshAgentData, AGENT_STATUS_CACHE_MS);
|
|
setInterval(() => fetchWeatherData().catch(() => {}), WEATHER_REFRESH_MS);
|
|
setInterval(fetchBlockHeight, BITCOIN_REFRESH_MS);
|
|
|
|
// === MAIN ANIMATION LOOP ===
|
|
function animate() {
|
|
requestAnimationFrame(animate);
|
|
const delta = clock.getDelta();
|
|
const elapsed = clock.elapsedTime;
|
|
|
|
if (Math.random() > 0.95) {
|
|
updateNostrUI();
|
|
nostrTexture.needsUpdate = true;
|
|
}
|
|
|
|
if (S.energyBeamPulse > 0) {
|
|
S.energyBeamPulse -= delta * 2;
|
|
if (S.energyBeamPulse < 0) S.energyBeamPulse = 0;
|
|
}
|
|
|
|
globalTicker.tick(delta, elapsed);
|
|
composer.render();
|
|
}
|
|
|
|
animate();
|
|
console.log('Nexus Sovereign Node: PANELS LIVE.');
|