§
     ’jÑ  ã            	      óè   — U d dl mZ d dlZd dlZd dlmZ d dlmZ d dlm	Z	 ddl
mZ ddlmZ dd	lmZ dd
lmZ ddlmZ  ej        d¦  «        Z G d„ deeeee¦  «        Zdaded<   dd„Zddd„ZdS )é    )ÚannotationsN)ÚErpDatabaseClient)Úget_settings)Ú	LLMClienté   )ÚHealDocumentsMixin)ÚHealEquipmentMixin)ÚHealInvoicesMixin)ÚHealProjectsMixin)ÚSweepSchedulerMixinzdscons.autonomous_enginec                  ó    — e Zd ZdZ	 	 d
dd	„ZdS )ÚAutonomousEngineServicezHMaster Autonomous Engine for continuous self-healing across ERP modules.NÚ
erp_clientúErpDatabaseClient | NoneÚ
llm_clientúLLMClient | NoneÚreturnÚNonec                óŒ   — |pt          ¦   «         | _        t          ¦   «         | _        |pt	          | j        ¦  «        | _        d S )N)r   Ú_erp_clientr   Ú	_settingsr   Ú_llm_client)Úselfr   r   s      úNC:\Projects\DSCons\app\modules\agents\application\autonomous_engine\service.pyÚ__init__z AutonomousEngineService.__init__   s@   € ð
 &Ð<Õ):Ñ)<Ô)<ˆÔÝ%™œˆŒØ%ÐB­°4´>Ñ)BÔ)BˆÔÐÐó    )NN)r   r   r   r   r   r   )Ú__name__Ú
__module__Ú__qualname__Ú__doc__r   © r   r   r   r      sE   € € € € € ð SÐRð 04Ø'+ðCð Cð Cð Cð Cð Cð Cr   r   zAutonomousEngineService | NoneÚ_autonomous_service_instancer   c                 ó:   — t           €t          ¦   «         a t           S )z.Singleton factory for AutonomousEngineService.)r"   r   r!   r   r   Úget_autonomous_servicer$   )   s   € õ $Ð+Ý'>Ñ'@Ô'@Ð$Ý'Ð'r   é  Úinterval_secondsÚintr   c              ƒ  ó–  K  — t          ¦   «         }t                               d| ¦  «         	 	 t                               d¦  «         |                     ¦   «         ƒ d{V —†}t                               d|¦  «         n2# t          $ r%}t                               d|¦  «         Y d}~nd}~ww xY wt          j        | ¦  «        ƒ d{V —† Œž)zMBackground infinite loop to execute autonomous sweep at configured intervals.z@Starting Autonomous Engine background sweep loop (interval: %ss)Tz&Executing periodic autonomous sweep...Nz'Periodic autonomous sweep completed: %sz4Error in autonomous engine background sweep loop: %s)r$   ÚloggerÚinfoÚrun_full_autonomous_sweepÚ	ExceptionÚerrorÚasyncioÚsleep)r&   ÚserviceÚsweep_resultsÚes       r   Ústart_autonomous_scheduler_loopr3   1   sö   è è € å$Ñ&Ô&€GÝ
‡K‚KØJØñô ð ð.ð	TÝ�KŠKÐ@ÑAÔAÐAØ")×"CÒ"CÑ"EÔ"EÐEÐEÐEÐEÐEÐEˆMÝ�KŠKÐAÀ=ÑQÔQÐQÐQøÝð 	Tð 	Tð 	TÝ�LŠLÐOÐQRÑSÔSÐSÐSÐSÐSÐSÐSøøøøð	TøøøåŒmÐ,Ñ-Ô-Ð-Ð-Ð-Ð-Ð-Ð-Ð-ð.s   ®AA> Á>
B-ÂB(Â(B-)r   r   )r%   )r&   r'   r   r   )Ú
__future__r   r.   ÚloggingÚapp.core.postgres.erp_clientr   Úapp.core.settingsr   Ú)app.modules.agents.application.llm_clientr   Úheal_documentsr   Úheal_equipmentr	   Úheal_invoicesr
   Úheal_projectsr   Úsweep_schedulerr   Ú	getLoggerr)   r   r"   Ú__annotations__r$   r3   r!   r   r   ú<module>r@      s[  ðØ "Ð "Ð "Ð "Ð "Ð "Ð "à €€€Ø €€€à :Ð :Ð :Ð :Ð :Ð :Ø *Ð *Ð *Ð *Ð *Ð *Ø ?Ð ?Ð ?Ð ?Ð ?Ð ?à .Ð .Ð .Ð .Ð .Ð .Ø .Ð .Ð .Ð .Ð .Ð .Ø ,Ð ,Ð ,Ð ,Ð ,Ð ,Ø ,Ð ,Ð ,Ð ,Ð ,Ð ,Ø 0Ð 0Ð 0Ð 0Ð 0Ð 0à	ˆÔ	Ð5Ñ	6Ô	6€ðCð Cð Cð Cð CØØØØØñCô Cð Cð& @DÐ Ð CÐ CÐ CÑ Cð(ð (ð (ð (ð.ð .ð .ð .ð .ð .ð .r   