Files
timmy-tower/the-matrix/js/agent-defs.js
Alexander Whitestone 9972eb59fe
Some checks failed
CI / Typecheck & Lint (pull_request) Failing after 1s
feat: add Kimi & Perplexity as visible Workshop agents (#11)
- agent-defs.js: add Kimi (Long Context Analysis, cyan) and Perplexity
  (Real-time Research, pink) with world positions at (-10,-10) and (10,-10)
- agents.js: add 3D geometric bodies for both agents — Kimi as an
  octahedron with orbital rings, Perplexity as an icosahedron with
  scanning tori; idle/active/dormant animations driven by agent state;
  restrict Timmy mood derivation to workshop agents only
- hud-labels.js: show specialization and last-task summary in inspect
  popup; export setLabelLastTask() for WS updates
- websocket.js: handle agent_task_summary messages; call setLabelLastTask
  on job_completed events
- world-state.ts: add kimi and perplexity to initial agentStates; restrict
  _deriveTimmy() to workshop agents only
- event-bus.ts: add AgentExternalEvent type for external agent state changes
- events.ts: handle agent:external_state bus events, broadcast agent_state
  and agent_task_summary WS messages

Fixes #11

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-23 22:38:09 -04:00

38 lines
1.8 KiB
JavaScript

/**
* agent-defs.js — Single source of truth for all agent definitions.
*
* To add a new agent, append one entry to AGENT_DEFS below and pick an
* unused (x, z) position. No other file needs to be edited.
*
* Fields:
* id — unique string key used in WebSocket messages and state maps
* label — display name shown in the 3D HUD and chat panel
* color — hex integer (0xRRGGBB) used for Three.js materials and lights
* role — human-readable role string shown under the label sprite
* specialization — optional capability description shown in agent inspect card
* direction — cardinal facing direction (for future mesh orientation use)
* x, z — world-space position on the horizontal plane (y is always 0)
*/
export const AGENT_DEFS = [
{ id: 'alpha', label: 'ALPHA', color: 0x00ff88, role: 'orchestrator', direction: 'north', x: 0, z: -6 },
{ id: 'beta', label: 'BETA', color: 0x00aaff, role: 'worker', direction: 'east', x: 6, z: 0 },
{ id: 'gamma', label: 'GAMMA', color: 0xff6600, role: 'validator', direction: 'south', x: 0, z: 6 },
{ id: 'delta', label: 'DELTA', color: 0xaa00ff, role: 'monitor', direction: 'west', x: -6, z: 0 },
{
id: 'kimi', label: 'KIMI', color: 0x00d4ff, role: 'analyst',
specialization: 'Long Context Analysis', direction: 'northwest', x: -10, z: -10,
},
{
id: 'perplexity', label: 'PERPLEXITY', color: 0xff6b9d, role: 'researcher',
specialization: 'Real-time Research', direction: 'northeast', x: 10, z: -10,
},
];
/**
* Convert an integer color (e.g. 0x00ff88) to a CSS hex string ('#00ff88').
* Useful for DOM styling and canvas rendering.
*/
export function colorToCss(intColor) {
return '#' + intColor.toString(16).padStart(6, '0');
}