Files
the-nexus/modules/core/state.js
Claude (Opus 4.6) 481a0790d2
Some checks failed
Deploy Nexus / deploy (push) Failing after 4s
[claude] Phase 3: Panel modules — Heatmap, Agent Board, Dual-Brain, LoRA, Sovereignty, Earth (#422) (#446)
Co-authored-by: Claude (Opus 4.6) <claude@hermes.local>
Co-committed-by: Claude (Opus 4.6) <claude@hermes.local>
2026-03-24 18:22:34 +00: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;
},
};