-- ============================================================================ -- Migration 018: Create resources table (Resource Registry) -- ============================================================================ -- Purpose: -- 1. Allow Processors and Agents to register themselves. -- 2. Track status and last heartbeat for monitoring. -- 3. Support capabilities metadata for discovery. -- ============================================================================ CREATE TABLE IF NOT EXISTS resources ( resource_id VARCHAR(64) PRIMARY KEY, resource_type VARCHAR(20) NOT NULL, -- 'processor', 'agent', 'service' category VARCHAR(50), -- 'visual', 'speech', 'logic' capabilities JSONB DEFAULT '{}', config JSONB DEFAULT '{}', metadata JSONB DEFAULT '{}', status VARCHAR(20) DEFAULT 'offline', -- 'idle', 'busy', 'offline', 'error' last_heartbeat TIMESTAMPTZ, created_at TIMESTAMPTZ DEFAULT NOW() ); CREATE INDEX idx_resources_type ON resources(resource_type); CREATE INDEX idx_resources_status ON resources(status); COMMENT ON TABLE resources IS 'Registry for Processors, Agents, and Services. Used for monitoring and discovery.';