+
    jHàj´F  ã                   ó  a € R t0 t R t^ RIt^ RIHt ^ RIt^ RIt^ RIt^ RIt^ RI	H
t
 ]P                  ! ]4      tRs] ^ k ] ! R R4      4       t ! R R4      tRR	R
^ /R R lltR R ltR R ltR R ltR R lt ! R R4      tR# )u‘  The gateway's local HTTP/WS listener: the native session WebSocket plus the dashboard API.

The caller initializes session authority before starting this listener and owns
all runtime services and signals. This module owns only HTTP resources; it does
not bootstrap an agent, scheduler, hosted room, or a second gateway.

The native session WebSocket (ticketed ``/api/ws`` â€” every local CLI/TUI/Desktop session) is served
without the dashboard app: importing ``hermes_cli.web_server`` (about 690 routes, ~0.6 s) before the
listener bound stalled every cold start and the control socket's identify. The dashboard is mounted
on its first request (imported off the event loop) or warmed after READY for a supervised gateway
(``warm_gateway_dashboard``); a gated listener (non-loopback bind or ``dashboard.public_url``) and a
process that already imported it mount it before the listener starts, exactly as before.
N)Ú	dataclass)ÚAnyc                   ó,   a € ] tR t^t o V 3R ltRtV tR# )ÚGatewayAPIHandlec                ó~   <€ V ^8„  d   Qh/ S[ ;R&   S[;R&   S[P                  ;R&   S[;R&   S[P                  ;R&   # )é   Ú
api_originÚserverÚtaskÚappÚsocket)Ústrr   ÚasyncioÚTaskr   )ÚformatÚ__classdict__s   "€Ú4/home/ubuntu/.hermes/hermes-agent/gateway/run_api.pyÚ__annotate__ÚGatewayAPIHandle.__annotate__   sI   ø‡ ‚ á�Oñ ñ �Kñ ñ �,‰,Ññ	 ñ
 
�Hñ ñ �M‰MÑò ó    © N)Ú__name__Ú
__module__Ú__qualname__Ú__firstlineno__Ú__annotate_func__Ú__static_attributes__Ú__classdictcell__©r   s   @r   r   r      s   ø‡ ‡ „ r   r   c                   ó˜   a € ] tR t^&t o RtR t]V 3R lR l4       t]R 4       tV 3R lR lt	V 3R lR	 lt
R
 tV 3R lR ltR tRtV tR# )ÚGatewayDashboardMountug  ASGI app that imports and mounts the dashboard (``hermes_cli.web_server.app``) on first use.

``state`` is the listener's boundary state (``bound_host``, ``bound_port``, ``auth_required``,
``trusted_public_hosts``, ``gateway_runner``, ``session_authority``) â€” what the native WebSocket
path checks, mirrored onto the dashboard app state once it is mounted.
c                óZ   € WuV n         V n        R V n        R V n        R V n        RV n        R # ©NF)ÚrunnerÚ_stateÚwebÚ_lockÚ	_lifespanÚ_closed)Úselfr#   Ústates   &&&r   Ú__init__ÚGatewayDashboardMount.__init__.   s,   € Ø#)Ð ˆŒ�T”[ØˆŒØ*.ˆŒ
ØˆŒØˆŽr   c                ó    <€ V ^8„  d   QhRS[ /# ©r   Úreturn©Úbool)r   r   s   "€r   r   Ú"GatewayDashboardMount.__annotate__6   s   ø€ ÷ $ñ $™ñ $r   c                ó   € V P                   R J# ©N©r%   ©r)   s   &r   ÚloadedÚGatewayDashboardMount.loaded5   s   € à�x‰x˜tÐ#Ð#r   c                óv   € V P                   e!   V P                   P                  P                  # V P                  # )z�Boundary state: the dashboard app's own state once mounted (operators and tests may
change it there), the listener's pre-mount snapshot before.)r%   r   r*   r$   r6   s   &r   r*   ÚGatewayDashboardMount.state9   s*   € ð &*§X¡XÒ%9ˆt�x‰x�|‰|×!Ñ!ÐJ¸t¿{¹{ÐJr   c                ó   <€ V ^8„  d   QhRR/# ©r   r/   Nr   )r   r   s   "€r   r   r2   ?   s   ø€ ÷ 	:ñ 	: $ñ 	:r   c                óò  € R VP                   P                  n        VP                  V P                  P
                  RRR4       V P                  VP                   P                  n        \        V P                  RR4      VP                   P                  n	        V P                  P
                  VP                   P                  n        V P                  P                  VP                   P                  n
        R# )TFNÚsession_authority)r   r*   Úwithhold_session_tokenÚ_configure_auth_gater$   Ú
bound_hostr#   Úgateway_runnerÚgetattrr>   Ú
bound_port)r)   r%   s   &&r   Ú_bind_stateÚ!GatewayDashboardMount._bind_state?   s™   € ð 04ˆ�‰�‰Ô,Ø× Ñ  §¡×!7Ñ!7¸ÀÀdÔKØ'+§{¡{ˆ�‰�‰Ô$Ü*1°$·+±+Ð?RÐTXÓ*Yˆ�‰�‰Ô'Ø#'§;¡;×#9Ñ#9ˆ�‰�‰Ô Ø#'§;¡;×#9Ñ#9ˆ�‰�‰Ö r   c                ó   <€ V ^8„  d   QhRR/# r<   r   )r   r   s   "€r   r   r2   J   s   ø€ ÷ >ñ >˜tñ >r   c                ó  € V P                   er   R V P                   P                  P                  n        R V P                   P                  P                  n        RV P                   P                  P                  n        R # R # r"   )r%   r   r*   rB   r>   r?   r6   s   &r   Ú_unbind_stateÚ#GatewayDashboardMount._unbind_stateJ   sS   € Ø�8‰8ÒØ04ˆD�H‰H�L‰L×ÑÔ-Ø37ˆD�H‰H�L‰L×ÑÔ0Ø8=ˆD�H‰H�L‰L×ÑÖ5ñ  r   c              ƒ  óÐ  "  € V P                   e   V P                   # V P                  f   \        P                  ! 4       V n        V P                  ;_uu_4       GRj  x€L
  V P                   e   V P                   uuRRR4      GRj  x€L
  # V P                  '       d   \        R4      h^ RIp\        P                  P                  R4      ;'       g*    \        P                  ! VP                  R4      G Rj  x€L
 pV P                  '       d   \        R4      h\        VP                  P                  RR4      RV P                  39  d   \        R4      hV P!                  V4       VP                  P"                  P%                  VP                  4      p VP'                  4       G Rj  x€L
  V P                  '       d'   VP)                  RRR4      G Rj  x€L
  \        R4      h Y#uT n         T n        TuuRRR4      GRj  x€L
  #  EL° ELˆ EL Lh L=  \*         d     Y n         T P-                  4        RT n         h i ; i L?  + GRj  x€L 
 '       g   i     R# ; i5i)zUImport (off the loop), bind and start the dashboard app once; returns ``web_server``.Nzgateway API stoppedúhermes_cli.web_serverrB   úgateway API already started)r%   r&   r   ÚLockr(   ÚRuntimeErrorÚ	importlibÚsysÚmodulesÚgetÚ	to_threadÚimport_modulerC   r   r*   r#   rE   ÚrouterÚlifespan_contextÚ
__aenter__Ú	__aexit__ÚBaseExceptionrI   r'   )r)   rP   r%   Úlifespans   &   r   ÚensureÚGatewayDashboardMount.ensureP   sÆ  é € à�8‰8ÒØ—8‘8ˆOØ�:‰:ÒÜ Ÿš›ˆDŒJØ—:—:—:“:Ø�x‰xÒ#Ø—x‘x÷ —:’:ð �|�|ˆ|Ü"Ð#8Ó9Ð9ÛÜ—+‘+—/‘/Ð"9Ó:÷ Bð BÄG×DUÒDUØ×'Ñ'Ð)@óEB÷ ?BˆCà�|�|ˆ|Ü"Ð#8Ó9Ð9Ü�s—w‘w—}‘}Ð&6¸Ó=ÀdÈDÏKÉKÐEXÔXÜ"Ð#@ÓAÐAØ×Ñ˜SÔ!Ø—w‘w—~‘~×6Ñ6°s·w±wÓ?ˆHð	Ø×)Ñ)Ó+×+Ð+Ø—<—<�<Ø"×,Ñ,¨T°4¸Ó>×>Ð>Ü&Ð'<Ó=Ð=ð  ð (+Ð$ˆDŒH�d”nØ÷3 —:—:�:ò?Bñ ,á>øä ô Ø”Ø×"Ñ"Ô$Ø�”Øð	ú÷' —:—:“:üsÓ   ‚AI&ÁHÁI&Á!I	Á;I&ÂHÂ	I&ÂI	Â 4I	Ã%I	Ã:HÃ;I	ÄBI	ÆHÆ-HÆ.HÇHÇHÇHÇ*I	Ç:I&ÈIÈI&ÈI&ÈI	ÈHÈHÈ*IÉI	ÉI&É	I#	ÉIÉ
I#	ÉI#	É	I&c                ó   <€ V ^8„  d   QhRR/# r<   r   )r   r   s   "€r   r   r2   q   s   ø€ ÷ !ñ !˜Tñ !r   c              ƒ  óÐ   "  € R V n         V P                  Ruqn         Ve   VP                  RRR4      G Rj  x€L
  V P                  4        R#  L  T P                  4        i ; i5i)TN)r(   r'   rY   rI   )r)   r[   s   & r   ÚcloseÚGatewayDashboardMount.closeq   s]   é € ØˆŒØ#'§>¡>°4Ð ˆ”.ð	!ØÒ#Ø×(Ñ(¨¨t°TÓ:×:Ð:à×ÑÖ ñ ;øà×ÑÕ üs+   ‚A&žA ¸A¹A ½A&ÁA ÁA#Á#A&c              ƒ  óv  "  € VR ,          R9  d   R#  V P                  4       G Rj  x€L
 pTP                  YT4      G Rj  x€L
  R#  L   \         d`    \        P                  R4       TR ,          R8X  d   T! R RRR/4      G Rj  x€L 
  M"^ RIHp T! RR	/R
R7      ! YT4      G Rj  x€L 
   R# i ; i Lu5i)ÚtypeÚ	websocketNz$Gateway dashboard API failed to loadúwebsocket.closeÚcodeió  ©ÚJSONResponseÚerrorÚdashboard_unavailableiô  ©Ústatus_code>   Úhttprd   )r\   Ú	ExceptionÚloggerÚ	exceptionÚstarlette.responsesrh   r   )r)   ÚscopeÚreceiveÚsendr%   rh   s   &&&&  r   Ú__call__ÚGatewayDashboardMount.__call__z   s°   é € Ø��=Ð 5Ô5Ùð		ØŸ™›×%ˆCð �g‰g�e dÓ+×+Ò+ñ &øÜô 	Ü×ÑÐCÔDØ�V�} Ô+Ù˜FÐ$5°v¸tÐDÓE×EÒEå<Ù" GÐ-DÐ#EÐSVÕWÐX]ÐhlÓm×mÑmÚð	úñ 	,ùs[   ‚B9”A
 §A¨A
 ¬B9ÁB7ÁB9ÁA
 Á
=B4ÂB
Â"B4Â*B-Â+B4Â0B9Â3B4Â4B9)r(   r'   r&   r$   r#   r%   N)r   r   r   r   Ú__doc__r+   Úpropertyr7   r*   rE   rI   r\   r`   ru   r   r   r   s   @r   r    r    &   sg   ø‡ € ñòð ÷$ó ð$ð ñKó ðK÷
	:ð 	:÷>ð >ò÷B!ð !÷,ð ,r   r    Úhostú	127.0.0.1Úportc                ó<   € V ^8„  d   QhR\         R\        R\        /# )r   ry   r{   r/   )r   Úintr   )r   s   "r   r   r   Š   s'   € ÷ Bñ B¬Sð BÄcð BÔRbñ Br   c             ƒ   ó`  aaa"  € ^ RI HpHp ^ RIHp \
        P                  P                  R4      p\        f(   Ve/   \        VP                  P                  RR4      e   \        R4      hV! 4       p\        P                  ! VRV! W4      Wp\        V RR4      R7      p\        W4      oV! SWVP                   ^R	R
7      w  p	o\"        P$                  ! W\"        P&                  R7      ^ ,          w  r«rÍp\"        P"                  ! W«V4      oV s SP)                  V4       SP+                  R4       SP-                  4       ^,          Vn        V	P0                  '       g   V	P3                  4        \5        V	P6                  V S4      V	n        VP                   '       g   Ve   SP9                  4       G Rj  x€L
  V	P;                  V	4      Sn        SP?                  S.R7      G Rj  x€L
  SP@                  '       d   SPB                  '       d   \        R4      h TTT3R lp\H        PJ                  ! T! 4       RR7      pRT9   d   RT R2MTp\M        RT RTP.                   2STSSR7      #  L¹ LŠ  \D         d.    SPG                  4        RsSPG                  4       G Rj  x€L 
  h i ; i5i)é    )Ú_dashboard_public_hostsÚlistener_auth_required)Úbuild_listener_serverrL   NrB   rM   r>   )rA   rD   Úauth_requiredÚtrusted_public_hostsrB   r>   Úoff)rƒ   Útimeout_graceful_shutdownr[   )rc   F©Úsocketsz#gateway API lifespan startup failedc               “   ót  <"  €  SP                  4       G R j  x€L
   SP                  S .R7      G R j  x€L
  S P                  4         SP                  4       G R j  x€L
  R sR #  LM L3 L  R si ; i  S P                  4         SP                  4       G R j  x€L 
  R si   R si ; i; i   SP                  S .R7      G R j  x€L 
  S P                  4         SP                  4       G R j  x€L 
  R si   R si ; i  S P                  4         SP                  4       G R j  x€L 
  R si   R si ; i; i; i5i)Nr‡   )Ú	main_loopÚshutdownr`   Ú_ACTIVE_RUNNER)ÚlistenerÚmountr	   s   €€€r   ÚserveÚ start_gateway_api.<locals>.serve¹   s  øé € ð
	*Ø×"Ñ"Ó$×$Ð$ð*Ø—o‘o¨x¨j�oÓ9×9Ð9à—‘Ô ð*ØŸ+™+›-×'Ð'à%)’Nñ %ñ :ñ (øà%)‘Nûð	 —‘Ô ð*ØŸ+™+›-×'Ñ'à%)‘Nø T‘Nþð*Ø—o‘o¨x¨j�oÓ9×9Ñ9à—‘Ô ð*ØŸ+™+›-×'Ñ'à%)‘Nø T‘Nûð	 —‘Ô ð*ØŸ+™+›-×'Ñ'à%)‘Nø T‘Nÿús  ƒD8…B+ ˜A&™B+ žA3 ´A(µA3 ¹D8Á
A, ÁA*ÁA, Á"D8Á&B+ Á(A3 Á*A, Á,A0Á0D8Á3B(ÂB!ÂBÂB!ÂB(Â!B%Â%B(Â(D8Â+D5Â-C=ÃCÃC=Ã	D5ÃC6Ã-C0Ã.C6Ã3D5Ã6C:Ã:D5Ã=D2ÄD+Ä"D%Ä#D+Ä(D2Ä+D/Ä/D2Ä2D5Ä5D8zgateway-api©ÚnameÚ:Ú[Ú]zhttp://)r   r	   r
   r   r   )'Úhermes_cli.web_server_boundaryr€   r�   Úhermes_cli.web_server_lifecycler‚   rQ   rR   rS   rŒ   rC   r   r*   rO   ÚtypesÚSimpleNamespacer    rƒ   r   ÚgetaddrinfoÚSOCK_STREAMÚbindÚsetblockingÚgetsocknamerD   r7   ÚloadÚGatewayRuntimeAPIÚ
loaded_appr\   Úlifespan_classr[   ÚstartupÚstartedÚshould_exitrZ   r`   r   Úcreate_taskr   )r#   ry   r{   r€   r�   r‚   Ú
loaded_webÚtrustedr*   ÚconfigÚfamilyÚkindÚprotoÚ_Úaddressr�   r
   Úorigin_hostr�   rŽ   r	   s   &$$               @@@r   Ústart_gateway_apir°   Š   sZ  úé € ç^ÝEô —‘—‘Ð!8Ó9€JÜÒ!ØÒ"¤w¨z¯~©~×/CÑ/CÐEUÐW[Ó'\Ò'hÜÐ8Ó9Ð9Ù%Ó'€GÜ×!Ò!Ø DÑ8NÈtÓ8]Ø$Ü! &Ð*=¸tÓDôF€Eô " &Ó0€Eá*¨5°$ÈE×L_ÑL_ØEFÐQVôX�N€FˆFä&,×&8Ò&8Øœ×+Ñ+ô'àõ'	Ñ#€F�%˜Gô �}Š}˜V¨5Ó1€HØ€NðØ�‰�gÔØ×Ñ˜UÔ#Ø#×/Ñ/Ó1°!Õ4ˆÔà�}�}ˆ}Ø�K‰KŒMÜ-¨f×.?Ñ.?ÀÈÓOˆÔð ××Ð *Ò"8Ø—,‘,“.× Ð Ø ×/Ñ/°Ó7ˆŒØ�n‰n h ZˆnÓ0×0Ð0Ø�~�~ˆ~ ×!3×!3Ð!3ÜÐDÓEÐEð "4÷*ô ×Ò™u›w¨]Ô;€DØ!$¨¤�A�d�V˜1‘+°$€KÜØ˜[˜M¨¨5×+;Ñ+;Ð*<Ð=Ø˜D e°Hôð ñ7 !á0øô ô Ø�‰ÔØˆØ�k‰k‹m×ÑØð	üs\   …D
J.ÄB%I3 Æ5I/Æ60I3 Ç&I1Ç'I3 Ç=I3 ÈI3 ÈAJ.É/I3 É1I3 É30J+Ê#J&Ê$J+Ê+J.c                ó   € V ^8„  d   QhRR/# r<   r   )r   s   "r   r   r   Ï   s   € ÷ 2ñ 2 dñ 2r   c                óü   a€ \        V RR4      p\        VRR4      o\        S\        4      '       d   SP                  '       d   R# V3R lp\        P
                  ! 4       P                  V! 4       RR7      V n        R# )u±   Mount the dashboard in the background once the gateway is READY (supervised gateways, whose
clients â€” Desktop, the dashboard SPA â€” call its routes right away). Never raises.Úsession_apiNr   c               “   óÂ   <"  €  S P                  4       G R j  x€L
  R #  L  \         d1    S P                  '       g   \        P	                  RRR7        R #  R # i ; i5i)Nz?Gateway dashboard API warm-up failed; it loads on first requestT©Úexc_info)r\   rn   r(   ro   Úwarning)rŽ   s   €r   Ú_warmÚ%warm_gateway_dashboard.<locals>._warm×   sK   øé € ð	qØ—,‘,“.× Ô øÜô 	qØ—=—=�=Ü—‘Ð`Ðko�×pò !ð	qüs6   ƒA…! ˜™! �AŸ! ¡A¾AÁAÁAÁAzgateway-dashboard-warmupr‘   )rC   Ú
isinstancer    r7   r   Úget_running_loopr¦   Ú_gateway_dashboard_warmup)r#   Úhandler¸   rŽ   s   &  @r   Úwarm_gateway_dashboardr¾   Ï   sl   ø€ ô �V˜]¨DÓ1€FÜ�F˜E 4Ó(€EÜ�eÔ2×3Ò3°u·|·|°|Ùõqô (/×'?Ò'?Ó'A×'MÑ'MÙ‹Ð0ð (Nó (2€FÖ$r   c                ó(   € V ^8„  d   QhR\         RR/# )r   r½   r/   N)r   )r   s   "r   r   r   â   s   € ÷ Nñ NÔ#3ð N¸ñ Nr   c              ƒ  ó°   "  € RV P                   n        \        P                  ! \        P                  ! V P
                  RR7      4      G Rj  x€L
  R#  L5i)zGDrain sockets without stopping the session authority or taking signals.T)Úreturn_exceptionsN)r	   r¥   r   ÚshieldÚgatherr
   )r½   s   &r   Ústop_gateway_apirÄ   â   s4   é € à $€F‡M�MÔô �.Š.œŸš¨¯©ÀtÔLÓ
M×MÔMùs   ‚AAÁAÁAc                ó$   € V ^8„  d   QhR\         /# r.   r0   )r   s   "r   r   r   ê   s   € ÷ añ a¤ñ ar   c                 óx   € \         P                  P                  R4      p V f   R# \        \	        V RR4      4      # )z‡``web_server._DASHBOARD_EMBEDDED_CHAT_ENABLED`` without importing the dashboard (always True
unless a loaded dashboard says otherwise).rL   TÚ _DASHBOARD_EMBEDDED_CHAT_ENABLED)rQ   rR   rS   r1   rC   r5   s    r   Ú_embedded_chat_enabledrÈ   ê   s6   € ô �+‰+�/‰/Ð1Ó
2€CØ’;ˆ4Ð`¤D¬°Ð6XÐZ^Ó)_Ó$`Ð`r   c                ó$   € V ^8„  d   QhR\         /# r.   r0   )r   s   "r   r   r   ñ   s   € ÷ iñ i¬ñ ir   c                 ó„   € ^ RI Hp VR,          R8H  ;'       d(    V! WP                  R4      VP                  R4      4      # )r   )Úrestart_wait_readrc   rm   ÚmethodÚpath)Úgateway.drain_controlrË   rS   )r#   rr   rË   s   && r   Ú_restart_wait_readrÏ   ñ   s:   € Ý7Ø��=˜FÑ"×hÐhÑ'8¸ÇÁÈ8ÓATÐV[×V_ÑV_Ð`fÓVgÓ'hÐhr   c                   ó6   a € ] tR t^öt o RtR tR tR tRtV t	R# )r    at  Redeem private local tickets at the existing WS subprotocol boundary.

Other credentials and HTTP routes retain the complete dashboard gate. Local
bootstrap never grants an exposure/worker ticket interactive permissions.
*web_app* is the dashboard mount (or any object whose ``state`` carries the listener's
``bound_host`` / ``auth_required`` / ``trusted_public_hosts``).
c                ó0   € WVuV n         V n        V n        R # r4   ©r   r#   Úweb_app)r)   r   r#   rÓ   s   &&&&r   r+   ÚGatewayRuntimeAPI.__init__þ   s   € Ø.1¸7Ð+ˆŒ�$”+˜tž|r   c           
   ƒ  óÚ  aaa"  € VR ,          R8w  g   VP                  R4      R8w  d   V P                  WS4      G Rj  x€L
 # R;ooVVV3R lp V P                  WV4      G Rj  x€L
 #  L+ L  \         do   pS'       ga   \        P	                  RTP                  R4      ;'       g    TP                  R	4      S'       d   R
MR\        T4      P                  TRR7       h Rp?ii ; i5i)rc   rd   rÍ   ú/api/wsNFc              “   ót   <"  € R oS;'       g    V P                  R4      R8H  oS! V 4      G Rj  x€L
  R#  L5i)Trc   zwebsocket.acceptN)rS   )ÚmessageÚacceptedrt   r¤   s   &€€€r   Úsend_watchedÚ0GatewayRuntimeAPI.__call__.<locals>.send_watched  s4   øé € àˆGØ×LÐL 7§;¡;¨vÓ#6Ð:LÑ#LˆHÙ�w“-×Ôùs   ƒ,8¯6°8z>Gateway refused a session WebSocket upgrade from %s %s: %s: %súhermes.gateway_socket_peerÚclientz after its handler had refused itzwith HTTP 500Trµ   )rS   Ú_servern   ro   ri   rc   r   )r)   rr   rs   rt   rÚ   ÚexcrÙ   r¤   s   &&&f  @@r   ru   ÚGatewayRuntimeAPI.__call__  sÐ   úé € Ø��=˜KÔ'¨5¯9©9°VÓ+<À	Ô+IØŸ™ U°TÓ:×:Ð:Ø"Ð"ˆ�(÷	 ð	ØŸ™ U°\ÓB×BÐBñ ;ñ CøÜô 
	÷
 Ü—‘Ð]Ø"ŸY™YÐ'CÓD×[Ð[ÈÏ	É	ÐRZÓH[ßCJÑ?ÐP_Ü! #›Y×/Ñ/°¸tð ô Eð ûð
	üsR   …:C+¿A+Á C+ÁA/ Á&A-Á'A/ Á*C+Á-A/ Á/C(Á:/C#Â*C#Ã C#Ã#C(Ã(C+c              ƒ  óÎ
  a aaaaa"  € \        S P                  R R4      oVR,          R49  g   Sf   S P                  WV4      G Rj  x€L
 # SR,          R59   ;'       dS    S P                  P                  ;'       g    SR,          R8H  ;'       d!    VR,          R8H  ;'       d    VR,          R8H  pSR,          R8w  g   S P                  P                  '       du   V'       gm   \	        S P                  V4      '       gQ   VR,          R8X  d   V! RR	R
R/4      G Rj  x€L
  R# ^ RIHp V! RRRSR,          /RR7      ! WV4      G Rj  x€L
  R# TP                  R4      VR&   ^ RIH	pH
p VR,          R8w  g   VR,          R8w  d-   V! S P                  4       S P                  WV4      G Rj  x€L
 # ToRoRo^ RIHo VVVVVV 3R lpTp^ RIHp	 ^ RIHp
HpHp \        S P&                  RR4      pS P&                  VR&   V	! WV4      pV
! V4      w  ppVR8X  g"   VP(                  P                  R4      '       d?   V'       d   VP+                  RR7      G Rj  x€L
  R# S P                  WV4      G Rj  x€L
 # VR8w  gs   \-        4       '       dc   V! Wí4      fY   V! Wí4      fO   VP(                  P                  R4      '       g.   VP.                  '       d   VP.                  P0                  R69  d   VP+                  RR7      G Rj  x€L
  R# Rp S P                  P2                  P5                  VRR R!7      pT'       * oS! S P                  4      oSR,          R8w  g   S P                  P                  '       d-   S'       g%   S'       g   TP+                  RR7      G Rj  x€L
  R# ^ R#IHp T! S P                  TR$,          4      pTf   TP+                  RR7      G Rj  x€L
  R# TTR%&   ^ R&IHp ^ R'I H!p ^ R(IH"p T! T4      ;_uu_ 4        T! S P                  4      ;_uu_ 4        T! TR)TR*,          R+R,R$TR$,          R-TR-,          R.TR.,          R/RR0TP                  R1R24      /TTR37      G Rj  x€L
  RRR4       RRR4       R#  ELH ELu ELL ELé EL? EL& EL–  \6         d…    Rp S P                  P2                  P5                  TRR"R!7      p EL   \6         dH    T'       d    TP+                  RR7      G Rj  x€L 
    R# S P                  YT4      G Rj  x€L 
 u u # i ; ii ; i EL‘ ELT LÃ  + '       g   i     LÉ; i  + '       g   i     R# ; i5i)7Úsession_runtime_descriptorNrc   rd   r*   ÚreadyÚdrainingrÍ   rÖ   re   rf   éõ  rg   ri   Úgateway_not_readyi÷  rk   rÝ   rÜ   )Úattached_clientÚnote_client_activityF)Úrestart_wait_openc               “   óâ   <"  € S! 4       G R j  x€L
 p SR,          R8w  g   SP                   P                  '       d/   S'       g'   S'       d   S! SP                   4      '       g   RRRR/# V #  L^5i)Nr*   rã   rc   zwebsocket.disconnectrf   rå   )r#   Ú	_draining)rØ   Úadmitted_in_waitÚallow_drainingÚ
descriptorÚoriginal_receiveré   r)   s    €€€€€€r   Úreceive_admittedÚ2GatewayRuntimeAPI._serve.<locals>.receive_admitted5  s^   øé € Ù,Ó.×.ˆGð ˜GÕ$¨Ô/°4·;±;×3H×3HÐ3H×R`ß-Ñ2CÀDÇKÁK×2PÒ2PØÐ 6¸ÀÐEÐEØˆNñ /ùs&   ƒA/ŽA-�-A/½A/ÁA/ÁA/Á%	A/)Ú	WebSocket)Ú#_gateway_ws_ticket_from_subprotocolÚws_client_reasonÚws_host_origin_reasonr   ÚnoneÚorigin)rf   Úoki3  TÚinteractive)Ú
profile_idÚpurposezworker-adoption)Úauthority_for_profile_idrú   zhermes.session_authority)ÚCANONICAL_GATEWAY_PROTOCOL)Ú	handle_ws)Úowner_scopeÚuser_idÚsubjectÚproviderÚlocalÚinstance_idÚcapabilitiesÚnative_bootstrapÚprofile_scoperr   Úprofile)Úauth_identityÚsubprotocolÚoperator>   rm   rd   >   rã   rä   >   ú::1rz   )#rC   r#   r   rë   rÏ   rq   rh   rS   Úgateway.run_idle_exitrç   rè   rÎ   ré   Ústarlette.websocketsrò   r–   ró   rô   rõ   rÓ   Úheadersr`   rÈ   rÝ   ry   Úsession_ticket_storeÚredeemÚPermissionErrorÚgateway.session_authoritiesrü   Úgateway.session_contractrý   Útui_gateway.wsrþ   rÿ   )r)   rr   rs   rt   Údraining_socketrh   rç   rè   rð   rò   ró   rô   rõ   r*   ÚwsÚticketÚreasonr  Úgrantrü   Ú	authorityrý   rþ   rÿ   rì   rí   rî   rï   ré   s   f&&&                    @@@@@r   rÞ   ÚGatewayRuntimeAPI._serve  sÉ  ýé € Ü˜TŸ[™[Ð*FÈÓMˆ
Ø��=Ð 5Ô5¸Ò9KØŸ™ %°$Ó7×7Ð7Ø% gÕ.Ð2GÑG÷ Lð LØ—‘×&Ñ&×KÐK¨*°WÕ*=ÀÑ*K÷Lð Là�f• Ñ,÷Lð Là16°vµÀ)Ñ1Kð 	ð ˜Õ  GÔ+¨t¯{©{×/D×/DÐ/DÏoÜ*¨4¯;©;¸×>Ò>Ø�V�} Ô+Ù˜FÐ$5°v¸tÐDÓE×EÐEñ
 õ =Ù" GÐ-@À'È:ÐV]ÕK^Ð#_Ø/2õ4Ø49ÀDóJ÷ Jð Jáà.3¯i©i¸Ó.AˆÐ*Ñ+ßOØ��=˜KÔ'¨5°­=¸IÔ+EÙ  §¡Ô-ØŸ™ %°$Ó7×7Ð7Ø"ÐØˆØ ÐÝ;÷	ò 	ð #ˆÝ2÷	
ñ 	
ô ˜Ÿ™ g¨tÓ4ˆØ—|‘|ˆˆe‰Ù�u tÓ,ˆÙ<¸RÓ@‰ˆ�Ø�VÔ˜rŸz™zŸ~™~¨h×7Ò7ßØ—h‘h D�hÓ)×)Ð)ÙØŸ™ %°$Ó7×7Ð7Ø�dŒNÔ"8×":Ò":Ù(¨Ó3Ò?ÑCSÐTVÓC^ÒCjØ—:‘:—>‘> (×+Ò+Ø—y—y�y B§I¡I§N¡NÐ:NÔ$NØ—(‘( �(Ó%×%Ð%ÙØˆð	<Ø—K‘K×4Ñ4×;Ñ;¸FÈtÐ]jÐ;ÓkˆEð &œˆÙ,¨T¯[©[Ó9Ðð ˜Õ  GÔ+¨t¯{©{×/D×/DÐ/DÏnß(Ø—(‘( �(Ó%×%Ð%ÙÝHÙ,¨T¯[©[¸%ÀÕ:MÓNˆ	ØÒØ—(‘( �(Ó%×%Ð%Ùà,5ˆÐ(Ñ)ÝGÝ,Ý;Ù˜×#Õ#¡_°T·[±[×%AÕ%AÙ˜B¨y¸%À	Õ:JÈJÐX_Ø.:¸EÀ,Õ<OØ.;¸UÀ=Õ=QØ.<¸eÀNÕ>SÐUgÐimØ.=¸u¿y¹yÈÐR[Ó?\ð	/^ð
 )CÈXôW÷ Wð W÷ &B×#Ñ#òk 8ò FòJò 8ò6 *â7ò
 &øô
 ô 		<ØˆHð<ØŸ™×8Ñ8×?Ñ?ÀÐSWÐarÐ?Ós“øÜ"ô <ç"ØŸ(™(¨˜(Ó-×-Ñ-ÛØ!ŸX™X e°dÓ;×;Ð;Ô;ð<úð			<úò  &ò
 &ñW÷ &B×%Aú×#×#Ð#üs¢  ˆ?U%ÁRÁU%ÁU%Á=U%ÂU%Â%6U%ÃU%Ã$9U%ÄRÄ+U%Å	RÅ
A%U%Æ/RÆ0BU%È?U%ÉU%ÉRÉU%É8RÉ9AU%Ë	U%Ë0U%ÌR!ÌU%Ì(R$ Ì=AU%Î U%ÎU%ÎU%Î%T6Î&?U%Ï%T9Ï&-U%ÐUÐ.A
T>	Ñ8T<Ñ9T>	Ñ=UÒU%ÒU%ÒU%ÒU%ÒU%ÒU%Ò!U%Ò$T3Ò2(SÓU%ÓT/Ó0T/ÔTÔT/ÔT3ÔU%ÔT/Ô$T'Ô%T/Ô*T3Ô,U%Ô.T/Ô/T3Ô3U%Ô9U%Ô<T>	Ô>UÕ	UÕU"	Õ	U%rÒ   N)
r   r   r   r   rw   r+   ru   rÞ   r   r   r   s   @r   r    r    ö   s#   ø‡ € ñòCò÷2^Wð ^Wr   r    c                ó@   € V ^8„  d   Qh/ ^ \         9   d
   \        ;R&   # )r   rŒ   )Ú__conditional_annotations__r   )r   s   "r   r   r      s   € ÷ ñ ÷2 Ò ”Ñ ò3r   )r  rw   r   Údataclassesr   Úloggingr   rQ   r˜   Útypingr   Ú	getLoggerr   ro   rŒ   r   r    r°   r¾   rÄ   rÈ   rÏ   r    r   )r  s   @r   Ú<module>r#     sž   øðöó Ý !Û Û Û 
Û Ý à	×	Ò	˜8Ó	$€ð €Ó ð ÷ð ó ð÷a,ñ a,ðHB°;ð BÈA÷ BõJ2õ&Nõaõi÷
BWó BWr   