Ë
    âß²jb  ã                   óž   — d Z ddlmZmZ ddlmZ ddlmZ ddlmZm	Z	m
Z
mZ ddlmZ  G d„ de«      Z G d	„ d
e«      Ze G d„ d«      «       Zy)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.*.
é    )Ú	dataclassÚfield)Údatetime)ÚEnum)ÚAnyÚDictÚListÚOptional)ÚSessionSourcec                   ó4   — e Zd ZdZdZdZdZdZdZdZ	dZ
d	Zd
Zy)ÚMessageTypezTypes of incoming messages.ÚtextÚlocationÚphotoÚvideoÚaudioÚvoiceÚdocumentÚstickerÚcommandN)Ú__name__Ú
__module__Ú__qualname__Ú__doc__ÚTEXTÚLOCATIONÚPHOTOÚVIDEOÚAUDIOÚVOICEÚDOCUMENTÚSTICKERÚCOMMAND© ó    ú</home/ubuntu/.hermes/hermes-agent/gateway/platforms/event.pyr   r      s2   „ Ù%Ø€DØ€HØ€EØ€EØ€EØ€EØ€HØ€GØ�Gr%   r   c                   ó   — e Zd ZdZdZdZdZy)ÚProcessingOutcomez=Result classification for message-processing lifecycle hooks.ÚsuccessÚfailureÚ	cancelledN)r   r   r   r   ÚSUCCESSÚFAILUREÚ	CANCELLEDr$   r%   r&   r(   r(      s   „ ÙGØ€GØ€GØ�Ir%   r(   c                   óè  — e Zd ZU dZeed<   ej                  Zeed<   dZ	e
e   ed<   dZe
e   ed<   dZeed<   dZeed<   dZe
e   ed	<   dZe
e   ed
<   dZe
e   ed<   dZe
e   ed<    ee¬«      Zee   ed<    ee¬«      Zee   ed<    ee¬«      Zee
e      ed<   dZe
e   ed<   dZe
e   ed<   dZe
e   ed<   dZe
e   ed<   dZ eed<   dZ!e
e"eef      ed<   dZ#e
eee   z     ed<   dZ$e
e   ed<   dZ%e
e   ed<   dZ&eed<    ee'¬«      Z(e"eef   ed<    ee)jT                  ¬«      Z+e)ed<   dZ,eed<    edddd¬ «      Z-eed!<    edddd¬ «      Z.e
e   ed"<   d#efd$„Z/d#e
e   fd%„Z0d#efd&„Z1y)'ÚMessageEventuO   Incoming message from a platform â€” the normalized shape all adapters produce.r   Úmessage_typeNÚuser_idÚ	user_nameÚsourceÚraw_messageÚ
message_idÚledger_message_idÚreply_anchor_overrideÚplatform_update_id)Údefault_factoryÚ
media_urlsÚmedia_typesÚmedia_text_inlinedÚreply_to_message_idÚreply_to_textÚreply_to_author_idÚreply_to_author_nameFÚreply_to_is_own_messageÚprompt_responseÚ
auto_skillÚchannel_promptÚchannel_contextÚinternalÚmetadataÚ	timestampTÚallow_gateway_control)ÚdefaultÚinitÚreprÚcompareÚ_gateway_acceptedÚ_notification_reply_mutedÚreturnc                 óx   — | j                   xr- | j                  xs dj                  «       j                  d«      S )z8Check if this is a command message (e.g., /new, /reset).Ú ú/)rJ   r   ÚlstripÚ
startswith)Úselfs    r&   Ú
is_commandzMessageEvent.is_commanda   s0   € à×)Ñ)ÒX¨t¯y©yª¸B×.FÑ.FÓ.H×.SÑ.SÐTWÓ.XÐXr%   c                 óÞ   — | j                  «       sy| j                  xs dj                  «       j                  d¬«      d   dd j	                  «       j                  dd«      d   }d|v rdS |S )z2Extract command name if this is a command message.NrS   é   ©Úmaxsplitr   ú@rT   )rX   r   rU   ÚsplitÚlower)rW   Úraws     r&   Úget_commandzMessageEvent.get_commande   sn   € à�‰Ô ØØ�y‰yŠ˜B×&Ñ&Ó(×.Ñ.¸Ð.Ó:¸1Ñ=¸a¸bÐA×GÑGÓI×OÑOÐPSÐUVÓWÐXYÑZˆà˜c‘zˆtÐ* sÐ*r%   c                 ó$  — | j                  «       s| j                  S | j                  xs dj                  «       j                  d¬«      }t	        |«      dkD  r|d   nd}|j                  dd«      j                  dd«      j                  dd«      S )	z"Get the arguments after a command.rS   rZ   r[   u   â€”â€”z--u   â€”u   â€“Ú-)rX   r   rU   r^   ÚlenÚreplace)rW   ÚpartsÚargss      r&   Úget_command_argszMessageEvent.get_command_argsm   s|   € à�‰Ô Ø—9‘9ÐØ—‘’˜b×(Ñ(Ó*×0Ñ0¸!Ð0Ó<ˆÜ˜u›:¨š>ˆu�QŠx¨rˆà�|‰|˜N¨DÓ1×9Ñ9¸(ÀDÓI×QÑQÐRZÐ\_Ó`Ð`r%   )2r   r   r   r   ÚstrÚ__annotations__r   r   r1   r2   r
   r3   r4   r   r5   r   r6   r7   r8   r9   Úintr   Úlistr;   r	   r<   r=   Úboolr>   r?   r@   rA   rB   rC   r   rD   rE   rF   rG   ÚdictrH   r   ÚnowrI   rJ   rO   rP   rX   ra   rh   r$   r%   r&   r0   r0   #   s  … áYØ
ƒIØ +× 0Ñ 0€L�+Ó0à!€GˆX�c‰]Ó!Ø#€Iˆx˜‰}Ó#ð !€FˆMÓ Ø€K�ÓØ $€J�˜‘Ó$ð (,Ð�x ‘}Ó+ð
 ,0Ð˜8 C™=Ó/ð )-Ð˜ ™Ó,á!°$Ô7€J��S‘	Ó7Ù"°4Ô8€K��c‘Ó8á/4ÀTÔ/JÐ˜˜X d™^Ñ,ÓJØ)-Ð˜ #™Ó-Ø#'€M�8˜C‘=Ó'Ø(,Ð˜ ™Ó,Ø*.Ð˜( 3™-Ó.Ø$)Ð˜TÓ)ð 15€O�X˜d 3¨ 8™nÑ-Ó4à,0€J�˜˜t C™y™Ñ)Ó0à$(€N�H˜S‘MÓ(ð &*€O�X˜c‘]Ó)à€HˆdÓá$°TÔ:€Hˆd�3˜�8‰nÓ:Ù°·±Ô=€IˆxÓ=ð #'Ð˜4Ó&ñ $¨E¸ÀEÐSXÔYÐ�tÓYá05¸dÈÐUZÐdiÔ0jÐ˜x¨™~ÓjðY˜Dó Yð+˜X c™]ó +ða #ô ar%   r0   N)r   Údataclassesr   r   r   Úenumr   Útypingr   r   r	   r
   Úgateway.sessionr   r   r(   r0   r$   r%   r&   ú<module>rt      sU   ðñ÷ )Ý Ý ß ,Ó ,å )ô
�$ô 
ô˜ô ð ÷Pað Paó ñPar%   