Core engine for adaptive learning and optimization in the Sophra system
EngineService
class is the primary export of this module. It encapsulates the core functionality for managing the adaptive learning and optimization processes within the Sophra system.
Key Methods
initialize()
: Sets up the initial engine state and prepares the service for operation.startOperation(type: EngineOperationType)
: Initiates a new engine operation of the specified type.startLearningCycle()
: Begins a new learning cycle, which involves pattern detection and optimization.completeOperation(operationId: string, data: {...})
: Finalizes an operation and records its outcome.detectPatterns(events: LearningEvent[])
: Analyzes learning events to identify significant patterns.optimizeFromPatterns(patterns: LearningPattern[])
: Generates optimization strategies based on detected patterns.executeAutonomousLearningCycle()
: Runs a complete, autonomous learning and optimization cycle.pushLearningEvent(event: LearningEvent)
: Adds a new learning event to the processing queue.Configuration Options
EngineService
constructor accepts a configuration object with the following properties:redis
: An instance of the Redis client for caching and event streaming.logger
: A logger instance compatible with the Winston logging library.Operation Failures
Pattern Detection Errors
Strategy Execution Failures