
    i                         d Z ddlmZmZ ddlmZmZmZ ddlm	Z	m
Z
mZmZmZmZ ddlmZ ddlmZ ddlmZ e G d	 d
e	             Zy)zEdge configuration dataclasses.    )	dataclassfield)AnyDictMapping)
BaseConfigConfigFieldSpecrequire_mappingrequire_stroptional_boolextend_path   )EdgeConditionConfig)EdgeProcessorConfig)DynamicEdgeConfigc                      e Zd ZU eed<   eed<   dZeed<   dZedz  ed<   dZ	eed<   dZ
eed	<   dZeed
<   dZeed<   dZedz  ed<   dZedz  ed<   edeeef   dedd fd       Z eddddd       eddddd       eddddddd       eddddd de!       eddddd"d#d       ed	dddd$d%d       ed
dddd&d'd       eddddd(d)d       edd*dd+d,de!       edd-dd.d/de!      d0
Zy)1
EdgeConfigsourcetargetTtriggerN	condition
carry_dataFkeep_messageclear_contextclear_kept_contextprocessdynamicdatapathreturnc                   t        ||      }t        |d|      }t        |d|      }t        |d|d      }t        |d|d      }t        |d|d      }t        |d	|d      }	t        |d
|d      }
|j                  dd      }t	        j
                  |t        |d            }d }d|v r)|d   $t        j
                  |d   t        |d            }d }d|v r)|d   $t        j
                  |d   t        |d            } | |||t        |      nd||t        |      nd|t        |      nd|	t        |	      nd|
t        |
      nd|||      S )Nfromtor   T)defaultr   r   Fr   r   r   true)r   r   r   )r   r   r   r   r   r   r   r   r   r   r   )
r
   r   r   getr   	from_dictr   r   r   bool)clsr   r   mappingr   r   trigger_valuecarry_data_valuekeep_message_valueclear_context_valueclear_kept_context_valuecondition_valuecondition_cfgprocess_cfgdynamic_cfgs                  E/Users/bowang/.openclaw/workspace/ChatDev/entity/configs/edge/edge.pyr'   zEdgeConfig.from_dict    s   !$-Wfd3WdD1%gy$M(,dS*7NDRWX+G_dTYZ#0:NPT^c#d !++k6:+55oKX\^iLjkGI$6$B-77	8JQ\]aclQmnKGI$6$B+55gi6H{[_ajOklK+8+DD'$#1A1Mt,-SW5G5S01Y^7J7V$23\aAYAet$<=kp
 	
    r"   zSource Node IDstrzSource node ID of the edge)namedisplay_name	type_hintrequireddescriptionr#   zTarget Node IDzTarget node ID of the edger(   zCan Trigger Successorz-Whether this edge can trigger successor nodes)r7   r9   r:   r$   r8   r;   advancer   zEdge Conditionu/   Edge condition configuration（type + config）)r7   r9   r:   r8   r;   r<   childzPass Data to Targetz'Whether to pass data to the target nodezKeep Message InputzRWhether to always keep this message input in the target node without being clearedzClear ContextzPClear all incoming context messages without keep=True before passing new payloadzClear Kept Contextz?Clear messages marked with keep=True before passing new payloadr   zPayload ProcessorzhOptional payload processor applied after the condition is met (regex extraction, custom functions, etc.)r   zDynamic ExpansionzDynamic expansion configuration for edge-level Map (fan-out) or Tree (fan-out + reduce) modes. When set, the target node is dynamically expanded based on split results.)
r"   r#   r   r   r   r   r   r   r   r   )__name__
__module____qualname__r6   __annotations__r   r(   r   r   r   r   r   r   r   r   r   r   classmethodr   r   r'   r	   FIELD_SPECS r5   r4   r   r      s   KKGT,0I"T)0JL$M4$$*.G 4'.(,G%,
WS#X. 
 
 
 
@  )4
 )4
 #0G
 %+)I%
 &.A
 (-l
 ) (j
 .%-Y
 #+, C%
 #), C#
]WKr5   r   N)__doc__dataclassesr   r   typingr   r   r   entity.configs.baser   r	   r
   r   r   r   edge_conditionr   edge_processorr   dynamic_edge_configr   r   rD   r5   r4   <module>rL      sD    % ( % %  0 / 2 C C Cr5   