// Planu — Agent Spec Generator: Schema Builder
// SPEC-016a: Generates knowledge base schema based on agent description.
/**
 * Generate agent knowledge base schema.
 * Criteria 2: knowledge base structure, conversation state, memory persistence schema.
 */
export function generateAgentKnowledgeSchema(agentDescription) {
    const lower = agentDescription.toLowerCase();
    const hasRag = lower.includes('document') || lower.includes('knowledge') || lower.includes('rag');
    const schema = {
        conversationState: {
            session_id: { type: 'string', description: 'Unique session identifier' },
            messages: {
                type: 'array',
                items: {
                    role: { type: 'string', enum: ['user', 'assistant', 'tool'] },
                    content: { type: 'string' },
                    tool_calls: { type: 'array', optional: true },
                    created_at: { type: 'timestamp' },
                },
            },
            active_tool_calls: { type: 'array', description: 'Currently executing tools' },
            iteration_count: { type: 'number', description: 'Current tool call iteration' },
            user_id: { type: 'string', description: 'User or session owner' },
        },
        memoryPersistence: {
            user_preferences: { type: 'object', description: 'Learned user-specific settings' },
            interaction_history: { type: 'array', description: 'Summary of past interactions' },
            learned_facts: { type: 'array', description: 'Facts extracted from conversations' },
            ttl_seconds: { type: 'number', default: 86400 },
        },
    };
    if (hasRag) {
        schema.knowledgeBase = {
            document_id: { type: 'string' },
            content: { type: 'string', description: 'Document chunk content' },
            embedding: { type: 'vector', dimensions: 1536 },
            source: { type: 'string', description: 'Document origin URL or file path' },
            metadata: { type: 'object' },
            created_at: { type: 'timestamp' },
            chunk_index: { type: 'number' },
        };
    }
    return schema;
}
//# sourceMappingURL=schema-builder.js.map