
    i                    `    d Z ddlmZ ddlmZ ddlmZ ddlmZ dhZ	ddhZ
ddZddZddZdS )z$Agent configuration loading helpers.    )annotations)Path)AgentConfig)	load_dataresponseanalysisnext_actionconfigr   returnNonec                   | j                             di           }t          | j                             dg                     }| j        dk    rTt                              |          st          d          t                              |          st          d          d S t                              |          st          d          t                              |          st          d          d S )N
propertiesrequiredpmz3pm output_schema must define PMDecision core fieldsz4pm output_schema must require PMDecision core fieldsz;agent output_schema must define the required runtime fieldsz;agent output_schema must require the runtime response field)output_schemagetsetnamePM_REQUIRED_OUTPUT_FIELDSissubset
ValueErrorREQUIRED_OUTPUT_FIELDS)r
   r   r   s      8/root/projects/multi-agents-meeting/core/agent_loader.py+_validate_agent_output_schema_compatibilityr      s    %)),;;J6'++J;;<<H{d(11*== 	TRSSS(11(;; 	USTTT!**:66 XVWWW!**844 XVWWWX X    pathr   c                   |                                  st          |           | j                                        dvrt	          d| j                   t          j        t          |                     }t          |           |S )z(Load and validate one agent config file.>   .yml.json.yamlz!unsupported agent config format: )	existsFileNotFoundErrorsuffixlowerr   r   model_validater   r   )r   r
   s     r   load_agent_configr&       s~     ;;== &%%%{"<<<JT[JJKKK'	$88F/777Mr   agent_names	list[str]
agents_dirdict[str, AgentConfig]c                    i }| D ]\}|| dz  || dz  || dz  g}t          d |D             d          }|t          d| d|           t          |          ||<   ]|S )z,Load agent configs by name from a directory.r    r   r   c              3  B   K   | ]}|                                 |V  d S )N)r!   ).0r   s     r   	<genexpr>z$load_named_agents.<locals>.<genexpr>7   s/      HHt$++--HdHHHHHHr   Nzagent config not found for 'z' in )nextr"   r&   )r'   r)   loadedr   candidate_pathsmatchs         r   load_named_agentsr3   -   s     &(F 	0 	0D'D&D'

 HHHHH$OO=#$Z4$Z$Zj$Z$Z[[[(//tMr   N)r
   r   r   r   )r   r   r   r   )r'   r(   r)   r   r   r*   )__doc__
__future__r   pathlibr   core.modelsr   core.serializationr   r   r   r   r&   r3    r   r   <module>r:      s    * * " " " " " "       # # # # # # ( ( ( ( ( ( % '7 X X X X"
 
 
 
     r   