Files
the-nexus/modules/core/state.js
Alexander Whitestone f0fe9d76b6
All checks were successful
CI / validate (pull_request) Successful in 6s
CI / auto-merge (pull_request) Successful in 2s
feat: Phase 3 — extract panel modules from app.js (Refs #422)
Create 6 panel modules under modules/panels/ plus supporting core
infrastructure (state.js, theme.js, ticker.js). Each panel:
  - Exports init(scene, state, theme) and update(elapsed, delta)
  - Uses NEXUS.theme for all colors/fonts (no inline hex codes)
  - Reads from state.js (no direct API calls)
  - Subscribes to ticker for animation

Panel modules:
  panels/heatmap.js       — Commit heatmap floor overlay (DATA-TETHERED)
  panels/agent-board.js   — Agent status holographic board (REAL)
  panels/dual-brain.js    — Dual-brain panel (HONEST-OFFLINE)
  panels/lora-panel.js    — LoRA adapter panel (HONEST-OFFLINE)
  panels/sovereignty.js   — Sovereignty meter arc gauge (REAL manual)
  panels/earth.js         — Holographic Earth, activity-tethered (DATA-TETHERED)

Core infrastructure (consumed by panels):
  core/state.js   — shared reactive data bus
  core/theme.js   — NEXUS.theme design system
  core/ticker.js  — single RAF loop + subscribe/unsubscribe API

All files pass `node --check`. app.js unchanged.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-24 14:21:33 -04:00

36 lines
1.3 KiB
JavaScript

// modules/core/state.js — Shared reactive data bus
// Data modules write here; visual modules read from here.
// No module may call fetch() except those under modules/data/.
export const state = {
// Commit heatmap (written by data/gitea.js)
zoneIntensity: {}, // { zoneName: [0..1], ... }
commits: [], // raw commit objects (last N)
commitHashes: [], // short hashes for matrix rain
// Agent status (written by data/gitea.js)
agentStatus: null, // { agents: Array<AgentRecord> } | null
activeAgentCount: 0, // count of agents with status === 'working'
// Weather (written by data/weather.js)
weather: null, // { cloud_cover, precipitation, ... } | null
// Bitcoin (written by data/bitcoin.js)
blockHeight: 0,
lastBlockHeight: 0,
newBlockDetected: false,
starPulseIntensity: 0,
// Portal / sovereignty / SOUL (written by data/loaders.js)
portals: [], // portal descriptor objects
sovereignty: null, // { score, label, assessment_type } | null
soulMd: '', // raw SOUL.md text
// Computed helpers
totalActivity() {
const vals = Object.values(this.zoneIntensity);
if (vals.length === 0) return 0;
return vals.reduce((s, v) => s + v, 0) / vals.length;
},
};