import { DatabaseAdapter } from "@elizaos/core"; import { Database } from "better-sqlite3"; /** * Generic module adapter interface * This allows any module to wrap a DatabaseAdapter without recreating connections */ export interface ModuleAdapterInterface { /** * Get the underlying database instance */ getDatabase(): D; /** * Get the database adapter this module is using */ getDatabaseAdapter(): DatabaseAdapter; } /** * Base class for module-specific adapters * Modules can extend this to create specialized database access * without creating multiple database connections */ export declare abstract class ModuleAdapter implements ModuleAdapterInterface { protected databaseAdapter: DatabaseAdapter; constructor(databaseAdapter: DatabaseAdapter); /** * Get the underlying database instance */ getDatabase(): D; /** * Get the database adapter this module is using */ getDatabaseAdapter(): DatabaseAdapter; } /** * Educational content types */ export type ContentType = "explanation" | "tutorial" | "practice_problem" | "quiz" | "reference_material"; /** * Educational levels */ export type EducationalLevel = "beginner" | "elementary" | "middle_school" | "high_school" | "undergraduate" | "graduate" | "professional"; /** * Subject areas */ export type Subject = "mathematics" | "science" | "history" | "language_arts" | "computer_science" | "physics" | "chemistry" | "biology"; /** * Educational content resource interface */ export interface EducationalContentResource { id: string; title: string; content: string; type: ContentType; subject: Subject; level: EducationalLevel; keywords: string[]; agentId?: string; createdAt: Date; updatedAt?: Date; } /** * Types of user interactions within a learning session */ export type InteractionType = "question" | "answer" | "explanation_request" | "practice_request" | "quiz_attempt" | "feedback"; /** * Session message structure */ export interface SessionMessage { role: "user" | "assistant"; content: string; timestamp: Date; interactionType: InteractionType; relatedContentIds?: string[]; } /** * Learning session resource interface */ export interface LearningSessionResource { id: string; agentId: string; subject: Subject; level: string; startTime: Date; endTime?: Date; active: boolean; messages: SessionMessage[]; feedback?: string; } /** * Learning style preferences */ export type LearningStyle = "visual" | "auditory" | "reading_writing" | "kinesthetic" | "social" | "solitary"; /** * Progress level for a subject */ export interface SubjectProgress { level: number; topics: Record; lastActivity?: Date; completedSessions: number; completedContent: string[]; } /** * Recommendation for learning content */ export interface LearningRecommendation { contentId: string; relevanceScore: number; reason: string; timestamp: Date; } /** * User profile resource interface */ export interface UserProfileResource { id: string; name: string; email?: string; createdAt: Date; learningStyles: LearningStyle[]; subjectProgress: Record; recommendations: LearningRecommendation[]; goals: string[]; streak: number; lastActive?: Date; badges: string[]; totalLearningTime: number; } /** * Resource type for learning resources */ export declare enum ResourceType { ARTICLE = "article", VIDEO = "video", EXERCISE = "exercise", BOOK = "book", COURSE = "course" } /** * Resource interface for learning paths */ export interface Resource { title: string; type: ResourceType; url?: string; description: string; } /** * Learning step interface */ export interface LearningStep { title: string; description: string; timeEstimate: string; resources: Resource[]; concepts: string[]; } /** * Learning path resource interface */ export interface LearningPathResource { id: string; agentId: string; subject: string; topic: string; overview: string; difficultyLevel: string; estimatedCompletionTime: string; prerequisites: string[]; steps: LearningStep[]; createdAt: Date; updatedAt: Date; } /** * SQL schema for education module tables */ export declare const educationSqliteTables = "\n-- Educational Content table\nCREATE TABLE IF NOT EXISTS educational_contents (\n id TEXT PRIMARY KEY,\n title TEXT NOT NULL,\n content TEXT NOT NULL,\n type TEXT NOT NULL,\n subject TEXT NOT NULL,\n level TEXT NOT NULL,\n keywords TEXT,\n agentId TEXT REFERENCES accounts(id) ON DELETE CASCADE,\n createdAt INTEGER NOT NULL,\n updatedAt INTEGER\n);\n\n-- Learning Sessions table\nCREATE TABLE IF NOT EXISTS learning_sessions (\n id TEXT PRIMARY KEY,\n agentId TEXT NOT NULL REFERENCES accounts(id) ON DELETE CASCADE,\n subject TEXT NOT NULL,\n level TEXT NOT NULL,\n startTime INTEGER NOT NULL,\n endTime INTEGER,\n active INTEGER NOT NULL DEFAULT 1,\n messages TEXT NOT NULL,\n feedback TEXT\n);\n\n-- User Profiles table\nCREATE TABLE IF NOT EXISTS user_profiles (\n id TEXT PRIMARY KEY,\n name TEXT NOT NULL,\n email TEXT,\n createdAt INTEGER NOT NULL,\n learningStyles TEXT,\n subjectProgress TEXT,\n recommendations TEXT,\n goals TEXT,\n streak INTEGER NOT NULL DEFAULT 0,\n lastActive INTEGER,\n badges TEXT,\n totalLearningTime INTEGER NOT NULL DEFAULT 0\n);\n\n-- Learning Paths table\nCREATE TABLE IF NOT EXISTS learning_paths (\n id TEXT PRIMARY KEY,\n agentId TEXT NOT NULL REFERENCES accounts(id) ON DELETE CASCADE,\n subject TEXT NOT NULL,\n topic TEXT NOT NULL,\n overview TEXT NOT NULL,\n difficultyLevel TEXT NOT NULL,\n estimatedCompletionTime TEXT NOT NULL,\n prerequisites TEXT,\n steps TEXT NOT NULL,\n createdAt INTEGER NOT NULL,\n updatedAt INTEGER NOT NULL\n);\n"; /** * Initialize the education module database * @param databaseAdapter The database adapter from the main application * @returns The education module adapter */ export declare function initEducationDatabase(databaseAdapter: DatabaseAdapter): Promise; /** * Education Module SQLite Database Adapter * Handles database operations for the education module */ export declare class EducationModuleAdapter extends ModuleAdapter { constructor(databaseAdapter: DatabaseAdapter); /** * Initialize the database tables */ init(): void; /** * Get all educational contents */ getEducationalContents(): Promise; /** * Get an educational content by ID */ getEducationalContent(id: string): Promise; /** * Get educational contents by agentId */ getEducationalContentsByAgentId(agentId: string): Promise; /** * Create a new educational content */ createEducationalContent(content: EducationalContentResource): Promise; /** * Update an educational content */ updateEducationalContent(content: EducationalContentResource): Promise; /** * Delete an educational content */ deleteEducationalContent(id: string): Promise; /** * Get learning sessions for a user */ getLearningSessionsForUser(agentId: string): Promise; /** * Get a learning session by ID */ getLearningSession(id: string): Promise; /** * Create a new learning session */ createLearningSession(session: LearningSessionResource): Promise; /** * Update a learning session */ updateLearningSession(session: LearningSessionResource): Promise; /** * Get user profile by ID */ getUserProfile(id: string): Promise; /** * Get all user profiles */ getAllUserProfiles(): Promise; /** * Create or update a user profile */ saveUserProfile(profile: UserProfileResource): Promise; /** * Get all learning paths */ getAllLearningPaths(): Promise; /** * Get learning path by ID */ getLearningPath(id: string): Promise; /** * Get learning paths for a user */ getLearningPathsForUser(agentId: string): Promise; /** * Create a new learning path */ createLearningPath(path: LearningPathResource): Promise; /** * Update a learning path */ updateLearningPath(path: LearningPathResource): Promise; }