
    yjU                     .   d Z ddlZddlZddlmZmZmZmZ ddlm	Z	 ddl
Z
ddlmZmZmZmZmZmZmZmZ ddlmZmZ ddlmZmZmZmZmZ dZd	Zd
ZdedefdZ ddde!e"ef         de#ddfdZ$dedefdZ%ee!e"ef          ee%          f         Z& G d de          Z' G d de'          Z( G d de'          Z) G d de'          Z* G d de'          Z+ G d de          Z, G d  d!e,          Z- G d" d#e,          Z. G d$ d%e,          Z/ G d& d'e,          Z0 G d( d)e          Z1 G d* d+e          Z2 G d, d-e          Z3 G d. d/e          Z4 G d0 d1e          Z5 G d2 d3e5          Z6 G d4 d5e5          Z7 G d6 d7e5          Z8 G d8 d9e5          Z9 G d: d;e          Z: G d< d=e          Z; G d> d?e          Z< G d@ dAe<          Z= G dB dCe<          Z> G dD dEe<          Z? G dF dGe<          Z@ G dH dIe          ZA G dJ dKe<          ZB G dL dMe          ZC G dN dOe<          ZD G dP dQe          ZE G dR dSe          ZF G dT dUe          ZG G dV dWe          ZH G dX dYe          ZI G dZ d[e          ZJ G d\ d]e          ZK G d^ d_e          ZL G d` dae          ZM G db dce          ZN G dd dee          ZO G df dge          ZP G dh die          ZQ G dj dke          ZR G dl dmeR          ZS G dn doeR          ZTdS )pzPydantic schemas for API request/response validation.

These schemas are consumed by the FastAPI routers and define the public
API contract.
    N)	AnnotatedAnySelfcast)urlparse)AliasChoices	BaseModelBeforeValidator
ConfigDictFieldPrivateAttrfield_validatormodel_validator)ReasoningLevelsettings)	DreamTypeMessageConfigurationSessionConfigurationSessionPeerConfigWorkspaceConfigurationz^[a-zA-Z0-9_-]+$d      vreturnc                    t          | t                    r|                     dd          S t          | t                    rEt	          t          t          t
          f         |           }d |                                D             S t          | t                    r,t	          t          t
                   |           }d |D             S | S )zCRecursively strip NUL bytes from strings in nested data structures.  c                 N    i | ]"\  }}t          |          t          |          #S  _sanitize_value).0kvals      7/DATA/AppData/hermes/projects/honcho/src/schemas/api.py
<dictcomp>z#_sanitize_value.<locals>.<dictcomp>1   s.    QQQVQ""OC$8$8QQQ    c                 ,    g | ]}t          |          S r   r    r"   items     r%   
<listcomp>z#_sanitize_value.<locals>.<listcomp>4   s     666$%%666r'   )
isinstancestrreplacedictr   r   itemslist)r   dlsts      r%   r!   r!   +   s    !S %yy$$$!T Rc3h##QQqwwyyQQQQ!T 749a  66#6666Hr'      _current_depthdatar6   c                   |t           k    rt          dt                      |dk    r0t          |           t          k    rt          dt           d          |                                 D ]P}t          |t                    r9t          t          t          t          t          f         |          |dz              QdS )zHValidate metadata dict doesn't exceed key count or nesting depth limits.z*Metadata nesting exceeds maximum depth of r4   zMetadata exceeds maximum of z top-level keysr5   N)_METADATA_MAX_DEPTH
ValueErrorlen_METADATA_MAX_KEYSvaluesr,   r/   _check_metadata_limitsr   r-   r   )r7   r6   r   s      r%   r>   r>   8   s     +++N9LNN
 
 	
 s4yy+===N+=NNN
 
 	
 [[]]  a 	"T#s(^Q''8J    r'   c                     t          | t                    s| S t          t          t          t          f         |           }t          |           t          |          S )zJValidate and sanitize a metadata dict: enforce limits and strip NUL bytes.)r,   r/   r   r-   r   r>   r!   )r   r7   s     r%   _validate_metadatar@   M   sL    a S#X""D4   4   r'   c                       e Zd ZdS )WorkspaceBaseN__name__
__module____qualname__r   r'   r%   rB   rB   ]           Dr'   rB   c                       e Zd ZU ee eddde          f         ed<   i Ze	ed<    ee
          Ze
ed<    ed	
          ZdS )WorkspaceCreateidr4      alias
min_length
max_lengthpatternnamemetadatadefault_factoryconfigurationTpopulate_by_nameN)rD   rE   rF   r   r-   r   RESOURCE_NAME_PATTERN__annotations__rR   _SanitizedMetadatar   rU   r   model_configr   r'   r%   rI   rI   a   s         
DQ3@UVVV	X    $&H %%%,1E.- - -M)    :t444LLLr'   rI   c                   4    e Zd ZU dZeeef         dz  ed<   dS )WorkspaceGetNfiltersrD   rE   rF   r^   r/   r-   r   rY   r   r'   r%   r]   r]   n   /         %)GT#s(^d")))))r'   r]   c                   8    e Zd ZU dZedz  ed<   dZedz  ed<   dS )WorkspaceUpdateNrR   rU   )rD   rE   rF   rR   rZ   rY   rU   r   r   r'   r%   rb   rb   r   s>         *.H 4'...37M)D077777r'   rb   c                       e Zd ZU  ed          Zeed<    eed          Zeee	f         ed<    ee          Z
eee	f         ed<   ej        ed	<    ed
d
          ZdS )	WorkspacerJ   serialization_aliasrQ   rR   rT   rf   
h_metadatarS   rU   
created_atTfrom_attributesrW   N)rD   rE   rF   r   rQ   r-   rY   r/   rh   r   rU   datetimer   r[   r   r'   r%   rd   rd   w   s         $///D#///!&*" " "JS#X    %*E$$?$?$?M4S>???!!!!:t  LLLr'   rd   c                       e Zd ZdS )PeerBaseNrC   r   r'   r%   rn   rn      rG   r'   rn   c                       e Zd ZU ee eddde          f         ed<   dZe	dz  ed<   dZ
eeef         dz  ed<    ed	
          ZdS )
PeerCreaterJ   r4   rK   rL   rQ   NrR   rU   TrV   )rD   rE   rF   r   r-   r   rX   rY   rR   rZ   rU   r/   r   r   r[   r   r'   r%   rp   rp      s         
DQ3@UVVV	X    +/H 4'...+/M4S>D(///:t444LLLr'   rp   c                   4    e Zd ZU dZeeef         dz  ed<   dS )PeerGetNr^   r_   r   r'   r%   rr   rr      r`   r'   rr   c                   H    e Zd ZU dZedz  ed<   dZeee	f         dz  ed<   dS )
PeerUpdateNrR   rU   )
rD   rE   rF   rR   rZ   rY   rU   r/   r-   r   r   r'   r%   rt   rt      sE         *.H 4'...+/M4S>D(/////r'   rt   c                       e Zd ZU  ed          Zeed<    ed          Zeed<   ej        ed<    ee	d          Z
e	eef         ed	<    ee	
          Ze	eef         ed<    edd          ZdS )PeerrJ   re   rQ   workspace_idworkspace_nameri   rR   rg   rh   rS   rU   Trj   N)rD   rE   rF   r   rQ   r-   rY   rx   rl   r/   rh   r   rU   r   r[   r   r'   r%   rv   rv      s         $///D#///%NCCCNCCCC!!!!!&*" " "JS#X    %*E$$?$?$?M4S>???:t  LLLr'   rv   c                   B   e Zd ZU  edd          Zedz  ed<    edd          Zedz  ed<    edd          Zedz  ed<    edd	d
d          Z	e
dz  ed<    edddd          Zedz  ed<    edd          Zedz  ed<    edd	d
d          Ze
dz  ed<   dS )PeerRepresentationGetNz<Optional session ID within which to scope the representationdescription
session_idzQOptional peer ID to get the representation for, from the perspective of this peertargetzJOptional input to curate the representation around semantic search resultssearch_queryr4   r   zyOnly used if `search_query` is provided. Number of semantic-search-retrieved conclusions to include in the representation)geler|   search_top_k              ?ziOnly used if `search_query` is provided. Maximum distance to search for semantically relevant conclusionssearch_max_distancezoOnly used if `search_query` is provided. Whether to include the most frequent conclusions in the representationdefaultr|   include_most_frequent   zgOnly used if `search_query` is provided. Maximum number of conclusions to include in the representationr   r   r   r|   max_conclusions)rD   rE   rF   r   r}   r-   rY   r~   r   r   intr   floatr   boolr   r   r'   r%   rz   rz      s        "UX  Jd
    g  FC$J     %u`     L#*     %u P	     L#*    ).	) ) )    */ F* * *4$;    #(%}	# # #OS4Z     r'   rz   c                       e Zd ZU eed<   dS )RepresentationResponserepresentationNrD   rE   rF   r-   rY   r   r'   r%   r   r      s         r'   r   c                   F    e Zd ZU  edd          Zee         dz  ed<   dS )PeerCardResponseNz+The peer card content, or None if not foundr{   	peer_card)rD   rE   rF   r   r   r1   r-   rY   r   r'   r%   r   r      sL         "'%G# # #ItCy4     r'   r   c                       e Zd ZU  edd          Zee         ed<    edd          e	de
de
fd	                        Zd
S )PeerCardSet.zThe peer card content to setr{   r   beforemoder   r   c                     t          |t                    r*d t          t          t                   |          D             S |S )Nc                 h    g | ]/}t          |t                    r|                    d d          n|0S )r   r   )r,   r-   r.   r)   s     r%   r+   z2PeerCardSet.sanitize_peer_card.<locals>.<listcomp>   sJ        -7tS,A,AKVR(((t  r'   )r,   r1   r   r   clsr   s     r%   sanitize_peer_cardzPeerCardSet.sanitize_peer_card   sL     a 	  cA..    r'   N)rD   rE   rF   r   r   r1   r-   rY   r   classmethodr   r   r   r'   r%   r   r      s          52PQQQItCyQQQ_[x0003 3    [ 10  r'   r   c                       e Zd ZdS )MessageBaseNrC   r   r'   r%   r   r      rG   r'   r   c                   ~   e Zd ZU ee edej                  f         ed<    ed          Z	eed<   dZ
edz  ed<   dZedz  ed	<   dZej        dz  ed
<    eg           Zee         ed<    edd          ededefd                        Zedee         fd            Z ed          defd            ZdS )MessageCreater   rN   rO   contentpeer_id)rM   	peer_nameNrR   rU   ri   r   _encoded_messageafterr   r   r   c                 .    |                     dd          S Nr   r   r.   r   s     r%   sanitize_contentzMessageCreate.sanitize_content        yy$$$r'   c                     | j         S )N)r   )selfs    r%   encoded_messagezMessageCreate.encoded_message  s    $$r'   c                 p    t          j        d          }|                    | j                  }|| _        | S )N
o200k_base)tiktokenget_encodingencoder   r   )r   encodingr   s      r%   validate_and_set_token_countz*MessageCreate.validate_and_set_token_count  s2    (66"//$,77 /r'   )rD   rE   rF   r   r-   r   r   MAX_MESSAGE_SIZErY   r   rR   rZ   rU   r   ri   rl   r   r   r1   r   r   r   r   propertyr   r   r   r   r   r'   r%   r   r      sg        sEEQ8;TUUUUVVVVU+++Is+++*.H 4'...15M'$.555+/J!D(///"-+b"9"9"9d3i999_YW---% % % % % [ .-% %c % % % X% _'"""d    #"  r'   r   c                   4    e Zd ZU dZeeef         dz  ed<   dS )
MessageGetNr^   r_   r   r'   r%   r   r     r`   r'   r   c                   $    e Zd ZU dZedz  ed<   dS )MessageUpdateNrR   )rD   rE   rF   rR   rZ   rY   r   r'   r%   r   r     s(         *.H 4'.....r'   r   c                      e Zd ZU  ed          Zeed<   eed<    ed          Zeed<    ed          Zeed<    ee	d	
          Z
e	eef         ed<   ej        ed<    ed          Zeed<   eed<    edd          ZdS )MessagerJ   re   	public_idr   r   r   r}   session_namerR   rg   rh   ri   rw   rx   token_countTrj   N)rD   rE   rF   r   r   r-   rY   r   r   r/   rh   r   rl   rx   r   r   r[   r   r'   r%   r   r     s         Ut444Is444LLLUy999Is999,???L#???!&*" " "JS#X    !!!!%NCCCNCCCC:t  LLLr'   r   c                   F    e Zd ZU dZ eddd          Zee         ed<   dS )MessageBatchCreatez<Schema for batch message creation with a max of 100 messages.r4   r   r   messagesN)	rD   rE   rF   __doc__r   r   r1   r   rY   r   r'   r%   r   r   (  s>         FF$)E#!$L$L$LHd=!LLLLLr'   r   c                       e Zd ZU dZ edd          Zeed<   dZe	dz  ed<   dZ
edz  ed<   dZej        dz  ed	<    ed
          ZdS )MessageUploadCreatez-Schema for message creation from file uploads.z#ID of the peer creating the messager{   r   NrR   rU   ri   TrV   )rD   rE   rF   r   r   r   r-   rY   rR   rZ   rU   r   ri   rl   r   r[   r   r'   r%   r   r   .  s         775*OPPPGSPPP*.H 4'...15M'$.555+/J!D(///:t444LLLr'   r   c                       e Zd ZdS )SessionBaseNrC   r   r'   r%   r   r   >  rG   r'   r   c                       e Zd ZU ee eddde          f         ed<   dZe	dz  ed<    edd	          Z
eeef         dz  ed
<   dZedz  ed<    ed          ZdS )SessionCreaterJ   r4   rK   rL   rQ   NrR   peers)r   rM   
peer_namesrU   TrV   )rD   rE   rF   r   r-   r   rX   rY   rR   rZ   r   r/   r   rU   r   r   r[   r   r'   r%   r   r   B  s         
DQ3@UVVV	X    +/H 4'...6;eDPW6X6X6XJS++,t3XXX15M'$.555:t444LLLr'   r   c                   4    e Zd ZU dZeeef         dz  ed<   dS )
SessionGetNr^   r_   r   r'   r%   r   r   N  r`   r'   r   c                   8    e Zd ZU dZedz  ed<   dZedz  ed<   dS )SessionUpdateNrR   rU   )rD   rE   rF   rR   rZ   rY   rU   r   r   r'   r%   r   r   R  s>         *.H 4'...15M'$.55555r'   r   c                       e Zd ZU  ed          Zeed<   eed<    ed          Zeed<    ee	d          Z
e	eef         ed	<    ee	
          Ze	eef         ed<   ej        ed<    edd          ZdS )SessionrJ   re   rQ   	is_activerw   rx   rR   rg   rh   rS   rU   ri   Trj   N)rD   rE   rF   r   rQ   r-   rY   r   rx   r/   rh   r   rU   rl   r   r[   r   r'   r%   r   r   W  s         $///D#///OOO%NCCCNCCCC!&*" " "JS#X    %*E$$?$?$?M4S>???!!!!:t  LLLr'   r   c                       e Zd ZU  ed          Zeed<    edd          Zeed<    edd	          Z	eed
<    ed          Z
eed<    ed          Zeed<    ed          Zeed<   dS )SummaryzThe summary textr{   r   z=The internal ID of the message that this summary covers up toT)r|   exclude
message_idz;The public ID of the message that this summary covers up tor|   rf   message_public_idz#The type of summary (short or long)summary_typez:The timestamp of when the summary was created (ISO format)ri   z(The number of tokens in the summary textr   N)rD   rE   rF   r   r   r-   rY   r   r   r   r   ri   r   r   r'   r%   r   r   f  s         5%7888GS888eS  J    #UQ(  s    *OPPPL#PPPeP  J    u)STTTKTTTTTr'   r   c                       e Zd ZU  ed          Zeed<   ee         ed<    edd          Z	e
dz  ed<    edd	          Zedz  ed
<    edd          Zee         dz  ed<    edd          ZdS )SessionContextrJ   re   rQ   r   NzThe summary if availabler   summaryz^A curated subset of a peer representation, if context is requested from a specific perspectivepeer_representationzBThe peer card, if context is requested from a specific perspectiver   Trj   )rD   rE   rF   r   rQ   r-   rY   r1   r   r   r   r   r   r   r[   r   r'   r%   r   r   w  s         $///D#///7m#e"<  GWt^    ',et' ' 't    #(%X# # #ItCy4   
 :t  LLLr'   r   c                       e Zd ZU dZ ed          Zeed<    ed          Zeed<    edd	          Z	edz  ed
<    edd	          Z
ee         dz  ed<   dS )PeerContextz;Context for a peer, including representation and peer card.zThe ID of the peerr{   r   z(The ID of the target peer being observed	target_idNzYA curated subset of the representation of the target peer from the observer's perspectiver   r   zAThe peer card for the target peer from the observer's perspectiver   )rD   rE   rF   r   r   r   r-   rY   r   r   r   r1   r   r'   r%   r   r     s         EE5%9:::GS:::U'QRRRIsRRR!&o" " "NC$J    #(%W# # #ItCy4     r'   r   c                       e Zd ZU  ed          Zeed<    edd          Zedz  ed<    edd          Z	edz  ed	<    e
d
d
          ZdS )SessionSummariesrJ   re   rQ   NzThe short summary if availabler   short_summaryzThe long summary if availablelong_summaryTrj   )rD   rE   rF   r   rQ   r-   rY   r   r   r   r   r[   r   r'   r%   r   r     s         $///D#///$)E"B% % %M7T>    $)5"A$ $ $L'D.    :t  LLLr'   r   c                   8    e Zd ZU dZdZeeef         dz  ed<   dS )ConclusionGetz5Schema for listing conclusions with optional filters.Nr^   )	rD   rE   rF   r   r^   r/   r-   r   rY   r   r'   r%   r   r     s5         ??%)GT#s(^d")))))r'   r   c                       e Zd ZU dZeed<   eed<    edd          Zeed<    edd	          Zeed
<    edd          Z	edz  ed<   e
j
        ed<    edd          ZdS )
Conclusionz2Conclusion response - external view of a document.rJ   r   z The peer who made the conclusionobserver_idr   observer The peer the conclusion is aboutobserved_idobservedNr}   )r   rf   r   ri   Trj   )rD   rE   rF   r   r-   rY   r   r   r   r   rl   r   r[   r   r'   r%   r   r     s         <<GGGLLLE6)  Hc    E6)  Hc     %uT|TTTL#*TTT!!!!:  LLLr'   r   c                       e Zd ZU dZ edd          Zeed<    edddd	
          Ze	ed<    edddd
          Z
edz  ed<    edd          Zeeef         dz  ed<   dS )ConclusionQueryz4Query parameters for semantic search of conclusions..zSemantic search queryr{   query
   r4   r   Number of results to returnr   top_kNr   r   z-Maximum cosine distance threshold for resultsdistancezAdditional filters to applyr   r^   )rD   rE   rF   r   r   r   r-   rY   r   r   r   r   r^   r/   r   r   r'   r%   r   r     s         >>s(?@@@E3@@@1	  E3    #UC	  Hedl    &+U1& & &GT#s(^d"     r'   r   c                   N   e Zd ZU dZee edd          f         ed<    edd          Zeed	<    edd
          Z	eed<    edd          Z
edz  ed<    ed          Zeed<    edd          ededefd                        Z ed          defd            ZdS )ConclusionCreatez(Schema for creating a single conclusion.r4   i  r   r   .zThe peer making the conclusionr{   r   r   r   Nz5A session ID to store the conclusion in, if specifiedr   r}   r   r   _token_countr   r   r   r   c                 .    |                     dd          S r   r   r   s     r%   r   z!ConclusionCreate.sanitize_content  r   r'   c                    t          j        d          }|                    | j                  }t	          |          | _        | j        t          j        j        k    r0t          dt          j        j         dz   d| j         dz             | S )z;Validate that content doesn't exceed embedding token limit.r   z1Content exceeds maximum embedding token limit of  z(got z tokens))
r   r   r   r   r;   r   r   	EMBEDDINGMAX_INPUT_TOKENSr:   )r   r   tokenss      r%   validate_token_countz%ConclusionCreate.validate_token_count  s     (66..KKx1BBBC'8;;;<5$+5556  
 r'   )rD   rE   rF   r   r   r-   r   rY   r   r   r}   r   r   r   r   r   r   r   r   r  r   r'   r%   r   r     sL        22sEEQ5AAAABBBBuS.NOOOKOOOuS.PQQQKQQQ"UK  Jd
   
 $A...L#..._YW---% % % % % [ .-% _'"""d    #"  r'   r   c            	       \    e Zd ZU dZ eddd edd                    Zee         e	d<   dS )	ConclusionBatchCreatezCSchema for batch conclusion creation with a max of 100 conclusions..r4   r   conclusionsobservations)rN   rO   validation_aliasN)
rD   rE   rF   r   r   r   r  r1   r   rY   r   r'   r%   r  r    sa         MM*/%%m^DD	+ + +K&'     r'   r  c                       e Zd ZU ee edd          f         ed<    edd          Zeee	f         dz  ed<    ed	d
dd          Z
eed<    edd          ededefd                        ZdS )MessageSearchOptions.zSearch queryr{   r   NzFilters to scope the searchr   r^   r   r4   r   r   r   limitr   r   r   r   c                 .    |                     dd          S r   r   r   s     r%   sanitize_queryz#MessageSearchOptions.sanitize_query  r   r'   )rD   rE   rF   r   r-   r   rY   r^   r/   r   r  r   r   r   r  r   r'   r%   r  r    s         S%%@@@@AAAA%*U"?& & &GT#s(^d"    1	  E3    _W7+++%s %s % % % [ ,+% % %r'   r  c                      e Zd ZU  edd          Zedz  ed<    edd          Zedz  ed<   ee eddd	
          f         ed<   dZ	e
ed<    edd          Zeed<    edd          ededefd                        ZdS )DialecticOptionsNz0ID of the session to scope the representation tor{   r}   zNOptional peer to get the representation for, from the perspective of this peerr~   r4   i'  zDialectic API Prompt)rN   rO   r|   r   Fstreamlowz?Level of reasoning to apply: minimal, low, medium, high, or maxr   reasoning_levelr   r   r   r   c                 .    |                     dd          S r   r   r   s     r%   r  zDialecticOptions.sanitize_query9  r   r'   )rD   rE   rF   r   r}   r-   rY   r~   r   r  r   r  r   r   r   r  r   r'   r%   r  r  (  s4        "UL  Jd
    d  FC$J    UUaE?UVVVV    FD&+eU' ' 'O^   
 _W7+++%s %s % % % [ ,+% % %r'   r  c                        e Zd ZU edz  ed<   dS )DialecticResponseNr   r   r   r'   r%   r  r  ?  s"         4Zr'   r  c                   (    e Zd ZU dZdZedz  ed<   dS )DialecticStreamDeltaz/Delta object for streaming dialectic responses.Nr   )rD   rE   rF   r   r   r-   rY   r   r'   r%   r  r  C  s,         99GS4Zr'   r  c                   ,    e Zd ZU dZeed<   dZeed<   dS )DialecticStreamChunkz(Chunk in a streaming dialectic response.deltaFdoneN)rD   rE   rF   r   r  rY   r  r   r   r'   r%   r  r  M  s4         22D$r'   r  c                       e Zd ZU dZ edd          Zedz  ed<    ed          Ze	ed<    ed	          Z
e	ed
<    ed          Ze	ed<    ed          Ze	ed<   dS )SessionQueueStatusz:Status for a specific session within the processing queue.Nz!Session ID if filtered by sessionr   r}   Total work unitsr{   total_work_unitszCompleted work unitscompleted_work_units$Work units currently being processedin_progress_work_units"Work units waiting to be processedpending_work_units)rD   rE   rF   r   r   r}   r-   rY   r   r   r!  r#  r%  r   r'   r%   r  r  Y  s         DD"U7  Jd
    "E.@AAAcAAA %2H I I I#III"'%:# # #C    $e0TUUUUUUUUr'   r  c                       e Zd ZU dZ ed          Zeed<    ed          Zeed<    ed          Z	eed<    ed	          Z
eed
<    edd          Zeeef         dz  ed<   dS )QueueStatusa4  Aggregated processing queue status.

    Tracks user-facing task types only: representation, summary, and dream.
    Internal infrastructure tasks (reconciler, webhook, deletion) are excluded.

    Note: completed_work_units reflects items since the last periodic queue
    cleanup, not lifetime totals.
    r  r{   r   z2Completed work units (since last periodic cleanup)r!  r"  r#  r$  r%  Nz/Per-session status when not filtered by sessionr   sessions)rD   rE   rF   r   r   r   r   rY   r!  r#  r%  r(  r/   r-   r  r   r'   r%   r'  r'  h  s           "E.@AAAcAAA %H! ! !#    #(%:# # #C    $e0TUUUUUU5:UE6 6 6Hd3**+d2     r'   r'  c                       e Zd ZU  edd          Zeed<    edd          Zedz  ed<    edd          Ze	ed	<    edd
          Z
edz  ed<   dS )ScheduleDreamRequest.zObserver peer namer{   r   Nz:Observed peer name (defaults to observer if not specified)r   zType of dream to schedule
dream_typez-Session ID to scope the dream to if specifiedr}   )rD   rE   rF   r   r   r-   rY   r   r+  r   r}   r   r'   r%   r*  r*    s         E#+?@@@Hc@@@ 5V  HcDj    "E#3NOOOJ	OOO"UI  Jd
     r'   r*  c                       e Zd ZdS )WebhookEndpointBaseNrC   r   r'   r%   r-  r-    rG   r'   r-  c                   \    e Zd ZU eed<    ed          ededefd                        ZdS )WebhookEndpointCreateurlr   r   c                 8   t          |          }t          |j        |j        g          st	          d          |j        dvrt	          d          |j        rA	 t          j        |j                  }|j        rt	          d          n# t          $ r Y nw xY w|S )NzInvalid URL format)httphttpsz$Only HTTP and HTTPS URLs are allowedz$Private IP addresses are not allowed)	r   allschemenetlocr:   hostname	ipaddress
ip_address
is_private)r   r   parsedr9  s       r%   validate_webhook_urlz*WebhookEndpointCreate.validate_webhook_url  s     !FM6=122 	31222 = 111CDDD ? 	&1&/BB
( M$%KLLLM    s   /B
 

BBN)rD   rE   rF   r-   rY   r   r   r<  r   r'   r%   r/  r/    s`         	HHH_US S    [   r'   r/  c                   z    e Zd ZU eed<    ed          Zedz  ed<   eed<   ej        ed<    edd	          Z	dS )
WebhookEndpointrJ   rw   re   Nrx   r0  ri   Trj   )
rD   rE   rF   r-   rY   r   rx   rl   r   r[   r   r'   r%   r>  r>    sf         GGG!&>!J!J!JNC$JJJJ	HHH!!!!:dTJJJLLLr'   r>  )Ur   rl   r8  typingr   r   r   r   urllib.parser   r   pydanticr   r	   r
   r   r   r   r   r   
src.configr   r   src.schemas.configurationr   r   r   r   r   rX   r<   r9   r!   r/   r-   r   r>   r@   rZ   rB   rI   r]   rb   rd   rn   rp   rr   rt   rv   rz   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r  r  r  r  r  r  r  r'  r*  r-  r/  r>  r   r'   r%   <module>rD     s	         - - - - - - - - - - - - ! ! ! ! ! ! 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 0 / / / / / / /              ,   
s 
s 
 
 
 
    
sCx.  
	   *!# !# ! ! ! ! tCH~?Q/R/RRS 	 	 	 	 	I 	 	 	
5 
5 
5 
5 
5m 
5 
5 
5* * * * *= * * *8 8 8 8 8m 8 8 8

 
 
 
 
 
 
 
$	 	 	 	 	y 	 	 	5 5 5 5 5 5 5 5* * * * *h * * *0 0 0 0 0 0 0 0
    8   ! ! ! ! !I ! ! !H    Y       y       )   &	 	 	 	 	) 	 	 	    K   6* * * * * * * */ / / / /K / / /    k   "M M M M M M M M5 5 5 5 5) 5 5 5 	 	 	 	 	) 	 	 		5 	5 	5 	5 	5K 	5 	5 	5* * * * * * * *6 6 6 6 6K 6 6 6
    k   U U U U Ui U U U"    [   (    )       {   &* * * * *I * * *       ,    i   ,    y   D    I    % % % % %9 % % %.% % % % %y % % %.    	       9       9   V V V V V V V V    )   :    9    	 	 	 	 	) 	 	 	    /   6K K K K K) K K K K Kr'   