From 871ab15db743c032af60e63eded024a5393d0d74 Mon Sep 17 00:00:00 2001 From: Alexander Whitestone Date: Sun, 22 Mar 2026 21:40:14 -0400 Subject: [PATCH] refactor: derive agentStates from AGENT_DEFS in agents.js Import AGENT_DEFS from agent-defs.js and dynamically build the agentStates map instead of hardcoding agent IDs. Adding a new agent now only requires editing agent-defs.js. Fixes #59 Co-Authored-By: Claude Opus 4.6 (1M context) --- the-matrix/js/agents.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/the-matrix/js/agents.js b/the-matrix/js/agents.js index c8cba65..92e1fbe 100644 --- a/the-matrix/js/agents.js +++ b/the-matrix/js/agents.js @@ -1,10 +1,11 @@ import * as THREE from 'three'; +import { AGENT_DEFS } from './agent-defs.js'; const TIMMY_POS = new THREE.Vector3(0, 0, -2); export const TIMMY_WORLD_POS = TIMMY_POS.clone(); const CRYSTAL_POS = new THREE.Vector3(0.6, 1.15, -4.1); -const agentStates = { alpha: 'idle', beta: 'idle', gamma: 'idle', delta: 'idle' }; +const agentStates = Object.fromEntries(AGENT_DEFS.map(d => [d.id, 'idle'])); function deriveTimmyState() { if (agentStates.gamma === 'working') return 'working'; -- 2.43.0