+
    jHàji
  ã                  ó‚   € R t ^ RIHt ^ RIt^ RIt^ RIt^ RIHtHtH	t	 ]P                  ! ]4      tRtR R ltR R ltR# )	aT  ``post_gateway_admission``: let a plugin consume an admitted inbound message (#129958).

``GatewayInboundMixin._handle_message`` fires it once per non-internal message that survived
authorization, bot admission, pause/drain, pending-reply intercepts, the running-session lane and
idle slash-command dispatch, inside the claimed session slot. It runs under the message's ROUTED
profile scope: the receiving bot's handler binds the transport home (auth reads its ``.env``), which
differs from the runtime home when that bot serves a chat for another profile.

Fail-open: a callback that raises, times out or returns anything other than
``{"action": "handled"}`` is logged/ignored and the message proceeds to the agent, so one buggy
plugin can never blackhole a profile's traffic. The payload is a plain snapshot, never live
runner/session-store handles.
)ÚannotationsN)ÚAnyÚOptionalÚTupleÚpost_gateway_admissionc               ó    € V ^8„  d   QhRRRR/# )é   Úrunnerr   Úsource© )Úformats   "ÚA/home/ubuntu/.hermes/hermes-agent/gateway/run_inbound_consumer.pyÚ__annotate__r      s   € ÷ Yñ Y˜#ð Y sñ Yó    c                ó¢   € \        \        V R R4      RR4      '       g   \        P                  ! 4       # ^ RIHp V! V P                  V4      4      # )ÚconfigNÚmultiplex_profilesF)Ú_async_profile_runtime_scope)ÚgetattrÚ
contextlibÚnullcontextÚgateway.runr   Ú _resolve_profile_home_for_source)r	   r
   r   s   && r   Ú_routed_scoper      sD   € Ü”7˜6 8¨TÓ2Ð4HÈ%×PÒPÜ×%Ò%Ó'Ð'Ý8Ù'¨×(OÑ(OÐPVÓ(WÓXÐXr   c          
     ó,   € V ^8„  d   QhRRRRRRRRRR/# )	r   r	   r   Úeventr
   Úsession_keyÚstrÚreturnztuple[bool, Optional[str]]r   )r   s   "r   r   r   "   s4   € ÷ ñ ØðØðØ%(ðØ7:ðàñr   c              ƒ  ó¨  "  €  \        W4      ;_uu_4       GRj  x€L
  ^ RIHpHp V! \        4      '       g   RuuRRR4      GRj  x€L
  # T! \        TVP
                  '       d   VP
                  P                  MRVP                  4       VP                  VP                  ;'       g    RR7      G Rj  x€L
 pRRR4      GRj  x€L
  X F”  p\        T\         4      '       g   K  TP#                  R4      R	8X  g   K3  TP#                  R
4      p\        P%                  R\        T4       R\        T\&        4      '       d   TP)                  4       '       d   T3u # R3u # 	  R#  ELM EL# L¶ L¨  + GRj  x€L 
 '       g   i     L¿; i  \        P                   d    h \         d"    \        P                  R\        RR7       Ru # i ; i5i)zQReturn ``(handled, reply)``; ``handled=False`` means run the ordinary agent turn.N)Úainvoke_hookÚhas_hookÚ )r   Úplatformr
   Ú
message_idÚtextz)%s failed; continuing with the agent turnT)Úexc_infoÚactionÚhandledÚreplyz/%s: a plugin handled the message for session %s)FN)r   Úhermes_cli.lifecycler    r!   ÚPOST_ADMISSION_HOOKr#   ÚvalueÚto_dictr$   r%   ÚasyncioÚCancelledErrorÚ	ExceptionÚloggerÚwarningÚ
isinstanceÚdictÚgetÚinfor   Ústrip)	r	   r   r
   r   r    r!   ÚresultsÚresultr)   s	   &&&&     r   Úrun_post_admission_hookr:   "   s[  é € ðÜ  ×0×0Õ0ßCÙÔ/×0Ò0Ø"÷ 1×0Ò0ñ )Ü#°Ø28·/·/°/˜Ÿ™×.Ò.ÀrØ—~‘~Ó'°E×4DÑ4DÈ5Ï:É:×K[ÐK[ÐY[ô÷ ˆG÷	 1×0ó ˆÜ�fœd×#Ô#¨¯
©
°8Ó(<À	Ö(IØ—J‘J˜wÓ'ˆEÜ�K‰KÐIÔK^Ð`kÔlØ¤*¨U´C×"8Ò"8¸U¿[¹[¿]º]˜ÐTÒTÐPTÐTÒTñ	 ð
 Ðõ' 1ñ÷	 1×0×0Ò0ûô ×!Ñ!ô ØÜô Ü�‰ÐBÔDWÐbfˆÔgØÒðüsÚ   ‚G„F ›E(œF ŸE2»F ÁE+Á	F ÁGÁE2Á(AE2Â,E2Â7E.Â8E2Â<F ÃE0ÃF ÃGÃ)GÄAGÅGÅ(F Å+F Å.E2Å0F Å2F	Å8E;Å9
F	ÆF	ÆF Æ
GÆF ÆGÆ-GÇGÇGÇG)Ú__doc__Ú
__future__r   r.   r   ÚloggingÚtypingr   r   r   Ú	getLoggerÚ__name__r1   r+   r   r:   r   r   r   Ú<module>rA      s?   ðñõ #ã Û Û ß 'Ñ 'à	×	Ò	˜8Ó	$€à.Ð õY÷r   