-- Add intent_vector and semantic_examples fields to intent_rules table
-- [v0.8.0] Hybrid routing support for semantic matching

-- Add intent_vector column (JSONB for storing pre-computed embedding vectors)
ALTER TABLE intent_rules 
ADD COLUMN IF NOT EXISTS intent_vector JSONB;

-- Add semantic_examples column (JSONB for storing example sentences for dynamic vector computation)
ALTER TABLE intent_rules 
ADD COLUMN IF NOT EXISTS semantic_examples JSONB;

-- Add comments for documentation
COMMENT ON COLUMN intent_rules.intent_vector IS '[v0.8.0] Pre-computed intent vector for semantic matching';
COMMENT ON COLUMN intent_rules.semantic_examples IS '[v0.8.0] Semantic example sentences for dynamic vector computation';

-- Add route_trace column to chat_messages table if not exists
ALTER TABLE chat_messages 
ADD COLUMN IF NOT EXISTS route_trace JSONB;

COMMENT ON COLUMN chat_messages.route_trace IS '[v0.8.0] Intent routing trace log for hybrid routing observability';
