feat: implement Phase 5 Resource Registry & Heartbeat

This commit is contained in:
Warren
2026-04-25 23:12:15 +08:00
parent 4686c5abc4
commit c15f7cd4af
4 changed files with 196 additions and 4 deletions

View File

@@ -0,0 +1,25 @@
-- ============================================================================
-- 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.';