+
    jHàj).  ã                   ó  a € R t0 t R t^ RIHt ^ RIHt ^ RIHt ^ RIHt ^ RI	t	^ RI
t
^ RIt^ RIt^ RIHt ]! RRR7      t] ^ k ]! R	RR7      t] ^k ]R
 4       t]R 4       tR tR tR t]RR l4       tR tRtR tR tR tR tR tR# )zQProcess-local callback provenance; private snapshots are revalidated, not grants.)Úcontextmanager)Úcopy)Ú
ContextVar)ÚPathN)ÚRuntimeStoreErrorÚnative_ingress_callback)ÚdefaultÚrelay_ingress_callbackc              #   ó¢   "  € \         P                  W34      p R x € \         P                  V4       R #   \         P                  T4       i ; i5i©N)Ú_relay_callbackÚsetÚreset)Ú	transportÚeventÚtokens   && ÚD/home/ubuntu/.hermes/hermes-agent/gateway/session_ingress_context.pyÚrelay_callbackr      s>   é € ô ×Ñ Ð 2Ó3€Eð%Ûä×Ñ˜eÖ$øŒ×Ñ˜eÕ$üs   ‚Aš5 žAµAÁAc              #   óæ   "  € \         P                  4       pVe   V^ ,          V Jg   V^,          VJd   R x € R # \        W4      ;_uu_ 4        R x € R R R 4       R #   + '       g   i     R # ; i5ir   )r   Úgetr   )r   Úforwardr   Úbounds   &&& r   Úrelay_passthrough_eventr      sR   é € ô ×ÑÓ!€EØ‚}˜˜a�¨	Ó1°U¸1µXÀWÓ5LÛÙÜ	˜	×	)Õ	)Û÷ 
*×	)×	)Ò	)üs   ‚AA1ÁAÁ
A1ÁA.	Á(	A1c                 óÖ  € ^ RI Hp \        V RR4      p\        W24      '       d¥   VP                  '       d“   VP
                  '       d�   VP                  '       go   VP                  '       g]   VP                  eO   VP                  VP                  P                  4      e(   VP                  VP                  P                  4      f   \        R4      h\        P                  ! VP                   VP                  VP"                  .RRR7      p\$        P&                  ! VP
                  P)                  4       VP)                  4       \*        P,                  4      P/                  4       pW53# )é    )ÚWebSocketRelayTransportÚ
_transportNÚpermission_deniedT©Ú	sort_keysÚ
separators©Ú,Ú:)Úgateway.relay.ws_transportr   ÚgetattrÚ
isinstanceÚ_gateway_idÚ_upgrade_secretÚauth_revokedÚ_closingÚ_wsÚdescriptor_for_platformÚplatformÚvalueÚ_bot_id_forr   ÚjsonÚdumpsÚ_urlÚ_identitiesÚhmacÚnewÚencodeÚhashlibÚsha256Ú	hexdigest)ÚadapterÚsourcer   r   ÚidentityÚ	connectors   &&    r   Ú_relay_connectorr>   '   s  € ÝBÜ˜ ¨tÓ4€IÜ�y×:Ò:Ø×(×(Ð(°	×0I×0IÐ0IØ×%×%Ð%¨×);×);Ð);¸y¿}¹}Ò?TØ×0Ñ0°·±×1FÑ1FÓGÒOØ×$Ñ$ V§_¡_×%:Ñ%:Ó;ÒCÜÐ 3Ó4Ð4Ü�zŠz˜9Ÿ>™>¨9×+@Ñ+@À)×BWÑBWÐXØ$(°ZôA€Hä—’˜×2Ñ2×9Ñ9Ó;¸X¿_¹_Ó=NÔPW×P^ÑP^Ó_×iÑiÓk€IØÐÐó    c           	      ó  € W!P                  4       VP                  .p\        P                  ! V P                  P                  4       \        P                  ! VR RR7      P                  4       \        P                  4      P                  4       # )Tr   r!   )Úto_dictÚis_botr4   r5   r(   r6   r0   r1   r7   r8   r9   )r   r;   Ú
provenanceÚbindings   &&& r   Ú_relay_sealrE   6   s`   € ØŸ>™>Ó+¨V¯]©]Ð;€GÜ�8Š8�I×-Ñ-×4Ñ4Ó6Ü—J’J˜w°$À:ÔN×UÑUÓWÜ—N‘Nó$ç$-¡I£Kð0r?   c                óz   € \        V RR4      pVf	   / ;q0n        Ve   \        V4      P                  4       MRW1&   R# )zHCalled when the server creates a callback, never from event home fields.Ú_native_transport_homesN)r%   rG   r   Úresolve)ÚrunnerÚprofileÚhomeÚhomess   &&& r   Úregister_transport_homerM   =   s<   € ä�FÐ5°tÓ<€EØ‚}Ø13Ð3ˆÔ.Ø-1Ò-=”T˜$“Z×'Ñ'Ô)À4€EƒNr?   c              #   ó  "  € Vf!   \        V RR 4      e   \        R4      hR x € R # \        P                  W\	        V4      P                  4       V34      p R x € \        P                  V4       R #   \        P                  T4       i ; i5i)NÚsession_authorityÚprofile_mismatch)r%   r   Ú	_callbackr   r   rH   r   )rI   r   Útransport_homerJ   r   s   &&&& r   Únative_callbackrS   E   sp   é € àÒÜ�6Ð.°Ó5ÒAÜ#Ð$6Ó7Ð7ÛÙÜ�M‰M˜6¬$¨~Ó*>×*FÑ*FÓ*HÈ'ÐRÓS€EðÛä�‰˜ÖøŒ	�‰˜Õüs   ‚ABÁA2 ÁBÁ2B	Â	Bc                óö   € \         \        3 Fh  pVP                  4       pVf   K  V^,          V J g   K(  VP                  V P                  J g   KD  VP	                  V^ ,          V.VR,          O54       Kj  	  R# )a  Gateway code that rebuilds a callback's event (a ``pre_gateway_dispatch`` rewrite, the
``/retry`` re-send) keeps the callback's provenance, but only on the source object the callback
authenticated: a new event with a swapped source carries nothing (#139045, #139040).N:é   NN)rQ   r   r   r;   r   )r   Ú	rewrittenÚ	bound_varr   s   &&  r   Úcarry_callbackrX   S   s^   € ô  ¤Ó1ˆ	Ø—‘“ˆØÔ  q¥¨UÕ!2°y×7GÑ7GÈ5Ï<É<Õ7WØ�M‰M˜5 �8 YÐ;°°rµÑ;Ö<ó 2r?   c                 óx	  aaa € R V P                   3.\        V R/ 4      P                  4       Op^ RIHp VP
                  RJ pV'       d   VP                  MVP                  pV UUu. uF  w  rxWxP                  V4      3NK  	  p	pp\        V3R lV	 4       R 4      oSe   \        V3R lV	 4       4      ^8w  d   \        R4      h\        V R/ 4      P                  S4      p
V
e   V
P                  4       '       g   \        R4      hT
p\        V P                  R	R
4      pV'       g   VP                  '       d   \        R4      hV'       Ed‚   \        V P                  RR 4      pVf   \        R4      h/ pV FI  w  pp\        V4      P!                  4       pWþ9   g   VVP#                  4       9   d   \        R4      hVWï&   KK  	  ^ RIHp V! 4       P!                  4       o \        V 3R lVP                  4        4       R 4      pVf   \        R4      hS;'       g    TpVP                  V4      V
8w  d   \        R4      hV P                  P(                   Uu. uFk  pVP+                  VP                  P,                  VP.                  VP0                  VP2                  VP4                  SVP6                  R7      '       g   Ki  VNKm  	  ppVP                  '       d-   VP                  P,                  \8        9   d   VP                  pMoV'       df   \;        R V 4       4      pV Uu. uF  pVP<                  V8X  g   K  VNK  	  pp\?        V4      ^8w  d   \        R4      hV^ ,          P                  pMTpVP                  ;'       g    TV8w  g   VV9  d   \        R4      hVV,          pVP                  4       '       g   \        R4      h^ RI H!p V! W4      pVf   \        R4      hV'       d   \E        SV4      w  ppM?V PG                  S4      ;'       g'    RVP                  P,                   RS;'       g    R 2pVf   \        R4      hR\I        V
4      R\I        V4      RVP                  P,                  RV/pV'       d   SVR&   V'       d   \K        XVV4      VR&   SW«V3# u uppi u upi u upi )NÚ_profile_adapters)ÚPlatformTc              3   ó>   <"  € T F  w  rVS8X  g   K  Vx € K  	  R # 5ir   © )Ú.0Úownerr:   rJ   s   &  €r   Ú	<genexpr>Ú_binding.<locals>.<genexpr>f   s   øé € ÐQ±*¡ ÀÈÑ@P—G’G³*ùó   ƒ“
c              3   ó0   <"  € T F  w  rVSJ x € K  	  R # 5ir   r]   )r^   Ú_Úitemr:   s   &  €r   r`   ra   g   s   øé € ÐH¹Z±'°!˜d g�o»Zùs   ƒÚ	not_foundrG   rP   Úmultiplex_profilesFÚ_runtime_profile_homes)Úget_process_hermes_homec              3   ó>   <"  € T F  w  rVS8X  g   K  Vx € K  	  R # 5ir   r]   )r^   ÚnameÚpathÚlaunchs   &  €r   r`   ra   €   s   øé € ÐO©}¡ ÀÈÁŸš«}ùrb   )Úguild_idÚchat_idÚ	thread_idÚparent_chat_idÚadapter_profileÚuser_idc              3   ó8   "  € T F  qP                   x € K  	  R # 5ir   )Úspecificity)r^   Úroutes   & r   r`   ra   “   s   é € Ð>±g¨U×(Ö(³gùs   ‚Úadmission_conflict)Úauthority_for_homezadapter:r#   Ú rR   Úruntime_homer-   r=   Útransport_profileÚrelay)&Úadaptersr%   ÚitemsÚgateway.configr[   Údelivered_via_upstream_relayÚRELAYr-   r   ÚnextÚsumr   Úis_dirÚconfigrJ   r   rH   ÚvaluesÚhermes_constantsri   Úprofile_routesÚmatchesr.   Úscope_idro   rp   rq   rs   Ú_PREFIX_PRODUCERSÚmaxru   ÚlenÚgateway.session_authoritiesrx   r>   Ú_adapter_credential_fingerprintÚstrrE   )!rI   r;   rJ   Ú
registriesr[   r|   r-   r_   ÚmappingÚ
candidatesrK   rz   Ú	multiplexÚreservedrL   rk   rl   Ú	canonicalri   ÚprimaryÚ
owner_namerv   r‰   Úruntime_profileÚrankÚbestrx   Ú	authorityr   r=   rC   r:   rm   s!   &&f                            @@r   Ú_bindingr�   `   s'  ú€ Ø˜Ÿ™Ð)Ð]¬G°FÐ<OÐQSÓ,T×,ZÑ,ZÓ,\Ð]€JÝ'Ø×/Ñ/°4Ð7€Eß!&ˆx�~Š~¨F¯O©O€HÙGQÔRÁz±^°U�5Ÿ+™+ hÓ/Ó0Áz€JÑRÜÔQ±*ÓQÐSWÓX€GØ‚œ#ÔH¹ZÓHÓHÈAÔMÜ Ó,Ð,Ü�6Ð4°bÓ9×=Ñ=¸gÓF€DØ‚|˜4Ÿ;™;Ÿ=š=ÜÐ 2Ó3Ð3Ø€LÜ˜Ÿ™Ð';¸UÓC€Iß˜ŸŸ˜ÜÐ 2Ó3Ð3ß€yô ˜6Ÿ=™=Ð*BÀDÓIˆØÒÜ#Ð$6Ó7Ð7ØˆÛ"‰JˆD�$Ü˜T›
×*Ñ*Ó,ˆIØŒ} 	¨U¯\©\«^Ô ;Ü'Ð(:Ó;Ð;Ø#ˆE‹Kñ	 #õ 	=Ù(Ó*×2Ñ2Ó4ˆÜÔO¨u¯{©{¬}ÓOÐQUÓVˆØŠ?Ü#Ð$6Ó7Ð7Ø×'Ð' ˆ
Ø�9‰9�ZÓ  DÔ(Ü#Ð$6Ó7Ð7ð '-§m¡m×&BÒ&Bó >Ñ&B˜UÀeÇmÁmØ�O‰O×!Ñ!¨F¯O©OÀVÇ^Á^Ø×&Ñ&°v×7LÑ7LØ#¨V¯^©^ð GT÷ G=—5�5Ñ&Bˆð >ð �>�>ˆ>˜fŸo™o×3Ñ3Ô7HÔHð %Ÿn™n‰OßÜÑ>±gÓ>Ó>ˆDÙ'.ÓL¡w˜e°%×2CÑ2CÀtÑ2K—E�E¡wˆDÐLÜ�4‹y˜AŒ~Ü'Ð(<Ó=Ð=Ø" 1�gŸo™o‰Oà(ˆOØ�N‰N×%Ð%˜g¨/Ô9¸_ÐTYÔ=YÜ#Ð$6Ó7Ð7Ø˜_Õ-ˆà×"Ñ"×$Ò$Ü#Ð$6Ó7Ð7õ ?Ù" 6Ó8€IØÒÜÐ 2Ó3Ð3ßÜ/°¸Ó@Ñˆ	‘9ð ×;Ñ;¸GÓD÷ Kð KØ" 6§?¡?×#8Ñ#8Ð"9¸¸7¿=¸=Àb¸/ÐJð 	àÒÜ Ó,Ð,Ø"¤C¨£I¨~¼sÀ<Ó?PØ˜fŸo™o×3Ñ3°[À)ðM€JçØ*1ˆ
Ð&Ñ'ßÜ)¨)°V¸ZÓHˆ
�7ÑØ�D¨
Ð2Ð2ùóe SùòH>ùò Ms   Á'R,ÉA&R2ËR2Ì'R7Ì?R7c                 ó  € \         P                  4       pVe   V^ ,          V Jg   V^,          VJd   R # \        WP                  V^,          4      w  r4rVVP                  P                  '       dS   \
        P                  4       pVe%   V^ ,          VP                  Jg   V^,          VJd   \        R4      hW2^,          3pMV P                  VP                  4      pVe   V^ ,          VJg   WB^,          8w  d   \        R4      hV# )Nr   rf   )	rQ   r   r�   r;   r€   r   r   r   Ú_transport_owner)	rI   r   Úcontextr:   rK   rd   rC   Údeliveryr_   s	   &&       r   Úcapture_provenancer¢   º   sÜ   € Ü�m‰m‹o€GØ‚˜' !�*¨FÓ2°g¸aµjÈÓ6MÙÜ#+¨F·L±LÀ'È!Å*Ó#MÑ €G�1Ø‡|�|×0×0Ð0Ü"×&Ñ&Ó(ˆØÒ˜x¨�{°'×2DÑ2DÓDÈÐQRÍÐ[`ÓH`Ü#Ð$7Ó8Ð8Ø !�*Ð%‰à×'Ñ'¨¯©Ó5ˆØ‚}˜˜a�¨Ó/°4À1½:Ô3EÜ Ó,Ð,ØÐr?   c                ó4  € \        V\        4      '       g   \        R4      h\        V4      pRV9   Vn        \        WVP                  R4      4      w  rErgW'8w  d   \        R4      hVP                  Vn        \        P                  ! V4      Vn	        WQn
        V# )zOResolve current owned connector/home before installing in-process auth context.Úinvalid_paramsr|   r{   rP   )r&   Údictr   r   r€   r�   r   ÚweakrefÚrefÚ_transport_adapter_refÚ_authorization_profile_home)rI   r;   rC   Ú	candidater:   rK   rz   Úexpecteds   &&&     r   Úrestore_provenancer¬   Ë   s‰   € ä�j¤$×'Ò'ÜÐ 0Ó1Ð1Ü�V“€IØ-4¸
Ñ-B€IÔ*Ü,4°VÈ
ÏÉÐWjÓHkÓ,lÑ)€G�<ØÔÜÐ 2Ó3Ð3Ø*3×*PÑ*P€FÔ'Ü$+§K¢K°Ó$8€FÔ!Ø)-Ô&ØÐr?   c              ƒ  óT  "  € VP                   '       g   R# Ve   VP                  '       d   \        R4      h\        WV4       V P	                  V4      pV P                  VRR7      '       d   R# \        \        V4      RR4      pVf   \        R4      h^ RIH	p V! \        VR	,          4      4      ;_uu_ 4        V! W14      G Rj  x€L
 pRRR4       \        WV4       V P	                  V4      VJd   \        R
4      hXRJd   \        R4      hR#  LK  + '       g   i     LQ; i5i)zEA role flag requests a connector check; it never supplies permission.FNr¤   )Úallow_adapter_delegationTÚreauthorize_native_rolesr   )Ú_profile_runtime_scoperR   rf   )Úrole_authorizedr€   r   r¬   Ú_adapter_for_sourceÚ_is_user_authorized_for_sourcer%   ÚtypeÚgateway.runr°   r   )rI   r;   rC   r:   Úcheckr°   Úalloweds   &&&    r   Úreauthorize_rolesr¸   Ú   s  é € à×!×!Ð!ÙØÒ˜V×@×@Ð@ÜÐ 0Ó1Ð1Ü�v zÔ2Ø×(Ñ(¨Ó0€GØ×,Ñ,¨VÈeÐ,×TÒTÙÜ”D˜“MÐ#=¸tÓD€EØ‚}ÜÐ 3Ó4Ð4Ý2Ù	¤ ZÐ0@Õ%AÓ B×	CÕ	CÙ˜gÓ.×.ˆ÷ 
Dô �v zÔ2Ø×!Ñ! &Ó)°Ó8Ü Ó,Ð,Ø�dÓÜÐ 3Ó4Ð4Ùñ /÷ 
D×	Cüs6   ‚*D(­BD(Â;DÃDÃDÃAD(ÄDÄD%	Ä D(c                  óP   € \         P                  4       p V '       d
   V ^ ,          # R# )r   N)rQ   r   )r    s    r   Úcallback_runnerrº   ó   s   € Ü�m‰m‹o€Gß ˆ7�1�:Ð* dÐ*r?   c                ó°   € V ^8„  d   Qh/ ^ \         9   d   \        \        R,          ,          ;R&   ^\         9   d   \        \        R,          ,          ;R&   # )rU   NrQ   r   )Ú__conditional_annotations__r   Útuple)Úformats   "r   Ú__annotate__r¿      sB   € × WÑ W÷ ZÒ YŒ:”e˜d•lÕ#Ñ Yñ X÷ _Ò ^”œE D�LÕ)Ñ ^ò Xr?   r   )ÚwebhookÚ
api_serverÚmsgraph_webhook)r¼   Ú__doc__Ú
contextlibr   r   Úcontextvarsr   Úpathlibr   r¦   r7   r4   r0   Úhermes_state_runtimer   rQ   r   r   r   r>   rE   rM   rS   rX   r‹   r�   r¢   r¬   r¸   rº   r¿   )r¼   s   @r   Ú<module>rÈ      s»   øðÞ WÝ %Ý Ý "Ý Û Û Û Û å 2á&0Ð1JÐTXÔ&Y€	Ó YÙ,6Ð7OÐY]Ô,^€Ó ^ð ñ%ó ð%ð ñó ðò ò0òHð ó
ó ð
ò=ð AÐ òW3òtò"òô2+r?   