
    i
                     2   d Z ddlmZ ddlmZ ddlmZmZmZ ddl	m
Z
 ddlmZmZmZ ddlmZmZ dd	lmZmZ  ed
       G d d             Z ed      Zdad"dZdddeded   ded   dedz  ddf
dZdedefdZdeeef   fdZdddeddfd Zg d!Zy)#z-Registry helpers for edge payload processors.    )	dataclass)import_module)AnyDictType)register_edge_processor_schema)RegistryRegistryEntryRegistryError)EdgeProcessorConfigEdgeProcessorTypeConfig   )EdgePayloadProcessorProcessorFactoryContextT)slotsc                   L    e Zd ZU eed<   ed   ed<   ed   ed<   dZedz  ed<   y)EdgeProcessorRegistrationnamer   
config_clsEdgePayloadProcessor[Any]processor_clsNsummary)__name__
__module____qualname__str__annotations__r   r        M/Users/bowang/.openclaw/workspace/ChatDev/runtime/edge/processors/registry.pyr   r      s-    
I.//344GS4Zr   r   edge_processor_typeFreturnNc                  ,    t         st        d       da y y )Nz%runtime.edge.processors.builtin_typesT)_BUILTINS_LOADEDr   r   r   r    _ensure_builtins_loadedr%      s    => r   )r   r   r   r   r   r   r   c                    | t         j                         v rt        d|  d      t        | |||      }t         j	                  | |       t        | ||       y )NEdge processor type 'z' already registered)r   r   r   r   )target)r   r   )edge_processor_registrynamesr   r   registerr   )r   r   r   r   entrys        r    register_edge_processorr-       sc     &,,..3D69MNOO%#	E $$T%$8"4JPr   c                     t                t        j                  |       }|j                         }t	        |t
              st        d|  d      |S )NzEntry 'z%' is not an EdgeProcessorRegistration)r%   r)   getload
isinstancer   r   )r   r,   registrations      r    get_edge_processor_registrationr3   3   sI    266t<E::<Ll$=>gdV+PQRRr   c                      t                t        j                         D  ci c]  \  } }| |j                          c}} S c c}} w )N)r%   r)   itemsr0   )r   r,   s     r    !iter_edge_processor_registrationsr6   <   s:    2I2O2O2QR2Q;4D%**,2QRRRs   Aprocessor_configr   contextc                     t        | j                        }|j                  }|st        d| j                   d       || j                  |      S )Nr'   z$' does not provide an implementation)r3   typer   r   config)r7   r8   r2   r   s       r    build_edge_processorr<   A   sU     33C3H3HIL ..M34D4I4I3JJnopp)00'::r   )r-   r3   r6   r<   )r"   N)__doc__dataclassesr   	importlibr   typingr   r   r   schema_registryr   utils.registryr	   r
   r   "entity.configs.edge.edge_processorr   r   baser   r   r   r)   r$   r%   r   r-   r3   r6   r<   __all__r   r   r    <module>rF      s    3 ! # " " : A A [ ?    ##89    Q
Q ./Q 34	Q
 4ZQ 
Q&# 2K S45N0N+O S
;+;$; !;r   