+
    jHàjß   ã                   óâ   € R t ^ RIt^ RIHtHt ^ RIHt ^ RIHt ^ RIH	t	H
t
HtHt ^ RIHt ]P                  ! R]P                   4      t ! R R	]4      t ! R
 R]4      t] ! R R4      4       tR# )z²Inbound message event types shared by every gateway platform adapter.

A leaf module: adapters, helpers and the runner import it, so it must not import from
gateway.platforms.*.
N)Ú	dataclassÚfield)Údatetime)ÚEnum)ÚAnyÚDictÚListÚOptional)ÚSessionSourcez#^(?:@(?:image|file|url):[^\n]+\n?)+c                   ó>   € ] tR t^tRtRtRtRtRtRt	Rt
RtR	tR
tRtR# )ÚMessageTypezTypes of incoming messages.ÚtextÚlocationÚphotoÚvideoÚaudioÚvoiceÚdocumentÚstickerÚcommand© N)Ú__name__Ú
__module__Ú__qualname__Ú__firstlineno__Ú__doc__ÚTEXTÚLOCATIONÚPHOTOÚVIDEOÚAUDIOÚVOICEÚDOCUMENTÚSTICKERÚCOMMANDÚ__static_attributes__r   ó    Ú</home/ubuntu/.hermes/hermes-agent/gateway/platforms/event.pyr   r      s2   † Ù%Ø€DØ€HØ€EØ€EØ€EØ€EØ€HØ€GØ„Gr&   r   c                   ó&   € ] tR t^%tRtRtRtRtRtR# )ÚProcessingOutcomez=Result classification for message-processing lifecycle hooks.ÚsuccessÚfailureÚ	cancelledr   N)	r   r   r   r   r   ÚSUCCESSÚFAILUREÚ	CANCELLEDr%   r   r&   r'   r)   r)   %   s   † ÙGØ€GØ€GØ„Ir&   r)   c                   ó˜  a € ] tR t^,t o Rt]P                  tRtRt	Rt
RtRtRtRtRt]! ]R7      t]! ]R7      t]! ]R7      tRtRtRtRtRtRtRtRtRtRt]! ]R7      t ]! ]!PD                  R7      t#Rt$Rt%Rt&Rt']! RRRRR7      t(]! RRRRR7      t)V 3R lR lt*V 3R	 lR
 lt+V 3R lR lt,V 3R lR lt-V 3R lR lt.V 3R lt/Rt0V t1R# )ÚMessageEventuO   Incoming message from a platform â€” the normalized shape all adapters produce.N)Údefault_factoryFT)ÚdefaultÚinitÚreprÚcomparec                ó"   <€ V ^8„  d   QhRRRR/# )é   Úotherr1   ÚreturnNr   )ÚformatÚ__classdict__s   "€r'   Ú__annotate__ÚMessageEvent.__annotate__x   s   ø€ ÷ 7ñ 7¨>ð 7¸dñ 7r&   c                óp   € V P                   RJd&   VP                   RJd   VP                   V n         R# R# R# )zQOne turn now answers *other* too: an addressed message wins, then an unknown one.TFN©Úreply_expected)Úselfr9   s   &&r'   Úabsorb_reply_expectedÚ"MessageEvent.absorb_reply_expectedx   s4   € à×Ñ dÓ*¨u×/CÑ/CÈ5Ó/PØ"'×"6Ñ"6ˆDÖñ 0QÑ*r&   c                ó    <€ V ^8„  d   QhRS[ /# ©r8   r:   ©Ústr)r;   r<   s   "€r'   r=   r>   }   s   ø€ ÷ Oñ O™sñ Or&   c                óŽ   € \         P                  RV P                  ;'       g    RP                  4       4      P                  4       # )aX  Return the message text with leading Desktop attachment refs stripped.

Desktop's buildContextText prepends ``@image:<path>``, ``@file:<path>``,
or ``@url:<url>`` tags before the user's visible text.  Stripping these
lets is_command / get_command / get_command_args work correctly even
when the payload is prefixed with one or more media refs.
Ú )Ú_ATTACHMENT_REF_REÚsubr   Úlstrip©rB   s   &r'   Ú_command_textÚMessageEvent._command_text}   s3   € ô "×%Ñ% b¨4¯9©9¯?¨?¸×*BÑ*BÓ*DÓE×LÑLÓNÐNr&   c                ó    <€ V ^8„  d   QhRS[ /# rF   )Úbool)r;   r<   s   "€r'   r=   r>   ‡   s   ø€ ÷ Sñ S™Dñ Sr&   c                óh   € V P                   ;'       d     V P                  4       P                  R4      # )z8Check if this is a command message (e.g., /new, /reset).Ú/)Úallow_gateway_controlrO   Ú
startswithrN   s   &r'   Ú
is_commandÚMessageEvent.is_command‡   s*   € à×)Ñ)×RÐR¨d×.@Ñ.@Ó.B×.MÑ.MÈcÓ.RÐRr&   c                ó0   <€ V ^8„  d   QhRS[ S[,          /# rF   )r	   rH   )r;   r<   s   "€r'   r=   r>   ‹   s   ø€ ÷ +ñ +™X¡c�]ñ +r&   c                óî   € V P                  4       '       g   R# V P                  4       P                  ^R7      ^ ,          R,          P                  4       P                  R^4      ^ ,          pRV9   d   R# T# )z2Extract command name if this is a command message.N©Úmaxsplit:é   NNÚ@rT   )rW   rO   ÚsplitÚlower)rB   Úraws   & r'   Úget_commandÚMessageEvent.get_command‹   se   € à�‰× Ò ÙØ× Ñ Ó"×(Ñ(°!Ð(Ó4°QÕ7¸Õ;×AÑAÓC×IÑIÈ#ÈqÓQÐRSÕTˆà˜c”zˆtÐ* sÐ*r&   c                ó    <€ V ^8„  d   QhRS[ /# rF   rG   )r;   r<   s   "€r'   r=   r>   “   s   ø€ ÷ añ a¡#ñ ar&   c                ó<  € V P                  4       '       g   V P                  # V P                  4       P                  4       P	                  ^R7      p\        V4      ^8”  d
   V^,          MRpVP                  RR4      P                  RR4      P                  RR4      # )z"Get the arguments after a command.r[   rJ   u   â€”â€”z--u   â€”u   â€“Ú-)rW   r   rO   rM   r_   ÚlenÚreplace)rB   ÚpartsÚargss   &  r'   Úget_command_argsÚMessageEvent.get_command_args“   s€   € à�‰× Ò Ø—9‘9ÐØ×"Ñ"Ó$×+Ñ+Ó-×3Ñ3¸QÐ3Ó?ˆÜ˜u›:¨œ>ˆu�QŽx¨rˆà�|‰|˜N¨DÓ1×9Ñ9¸(ÀDÓI×QÑQÐRZÐ\_Ó`Ð`r&   c                ó*  <€ V ^8„  d   Qh/ S[ ;R&   S[;R&   S[S[ ,          ;R&   S[S[ ,          ;R&   S[;R&   S[;R&   S[S[ ,          ;R&   S[S[ ,          ;R&   S[S[ ,          ;R	&   S[S[,          ;R
&   S[S[ ,          ;R&   S[S[ ,          ;R&   S[S[S[,          ,          ;R&   S[S[ ,          ;R&   S[S[ ,          ;R&   S[S[ ,          ;R&   S[S[ ,          ;R&   S[;R&   S[S[S[ S[3,          ,          ;R&   S[S[ S[S[ ,          ,          ,          ;R&   S[S[ ,          ;R&   S[S[ ,          ;R&   S[;R&   S[S[ S[3,          ;R&   S[	;R&   S[;R&   S[S[,          ;R&   S[;R&   S[S[ ,          ;R&   S[;R&   S[S[,          ;R&   # ) r8   r   Úmessage_typeÚuser_idÚ	user_nameÚsourceÚraw_messageÚ
message_idÚledger_message_idÚreply_anchor_overrideÚplatform_update_idÚ
media_urlsÚmedia_typesÚmedia_text_inlinedÚreply_to_message_idÚreply_to_textÚreply_to_author_idÚreply_to_author_nameÚreply_to_is_own_messageÚprompt_responseÚ
auto_skillÚchannel_promptÚchannel_contextÚinternalÚmetadataÚ	timestamprU   rA   Úinherit_channel_pinÚedit_revisionÚ_gateway_acceptedÚ_notification_reply_muted)
rH   r   r	   r
   r   ÚintÚlistrR   Údictr   )r;   r<   s   "€r'   r=   r>   ,   s,  ø‡ ‚ ñ �Iñ ñ Ñ0ñ	 ñ ‘c�]Ñ!ñ ñ ™�}Ñ#ñ ñ Ñ ñ ñ Ññ ñ ™•Ñ$ñ ñ&  ¡•}Ñ+ñ' ñ0 $¡C�=Ñ/ñ1 ñ6 !¡�Ñ,ñ7 ñ: ‘S•	Ñ7ñ; ñ< ‘c•Ñ8ñ= ñ@ ™X¡d�^Õ,ÑJñA ñB "¡#�Ñ-ñC ñD ™C•=Ñ'ñE ñF !¡�Ñ,ñG ñH #¡3�-Ñ.ñI ñJ "Ñ)ñK ñP ™d¡3© 8�nÕ-Ñ4ñQ ñT ™™t¡C�y�Õ)Ñ0ñU ñX ™S•MÑ(ñY ñ^ ™c•]Ñ)ñ_ ñb Ññc ñf ‘3™�8�nÑ:ñg ñh Ñ=ñi ñn  Ñ&ño ñv ™T•NÑ)ñw ñB Ñ%ñC ñJ ™C•=Ñ'ñK ñP ÑYñQ ñT  (©�~ÑjòU r&   r@   )2r   r   r   r   r   r   r   rn   ro   rp   rq   rr   rs   rt   ru   rv   r   r‹   rw   rx   ry   rz   r{   r|   r}   r~   r   r€   r�   r‚   rƒ   rŒ   r„   r   Únowr…   rU   rA   r†   r‡   rˆ   r‰   rC   rO   rW   rb   rk   Ú__annotate_func__r%   Ú__classdictcell__)r<   s   @r'   r1   r1   ,   s<  ø‡ € áYà +× 0Ñ 0€Là!€GØ#€Ið !€FØ€KØ $€Jð (,Ðð
 ,0Ðð )-Ðá!°$Ô7€JÙ"°4Ô8€Ká/4ÀTÔ/JÐØ)-ÐØ#'€MØ(,ÐØ*.ÐØ$)Ðð 15€Oà,0€Jà$(€Nð &*€Oà€Há$°TÔ:€HÙ°·±Ô=€Ið #'Ðð &*€Nð !&Ðð $(€Mñ $¨E¸ÀEÐSXÔYÐá05¸dÈÐUZÐdiÔ0jÐ÷7ð 7÷
Oð O÷Sð S÷+ð +÷að a÷O ƒ r&   r1   )r   ÚreÚdataclassesr   r   r   Úenumr   Útypingr   r   r   r	   Úgateway.sessionr
   ÚcompileÚ
IGNORECASErK   r   r)   r1   r   r&   r'   Ú<module>r—      sp   ðñó 
ß (Ý Ý ß ,Ó ,å )ð —Z’ZÐ FÈÏÉÓVÐ ô
�$ô 
ô˜ô ð ÷mað maó òmar&   