+
    jHàj�  ã                   óZ  a€ RY tF0 t R t^ RIt^ RIt^ RIt^ RIt^ RIt^ RIt^ RIt^ RI	t	^ RI
t^ RIHt ^ RIHtHtHtHtHt ^ RIHtHt ^ RIHt ]P2                  ! R4      tRZtR R ltR	 R
 ltRR[RR\RR]RR^RR_RR`RRaRRbRR]RRc/
t] ^ k ]! 0 Rdm4      t R R lt!R R lt"R R lt#R R lt$RRRRR R/t%] ^k ]PL                  ! 4       t'R!t(R" R# lt)R$ R% lt*R& R' lt+R(t,R) R* lt-R+ R, lt.]! 4       R-,          t/] ^k R.R/R0R1R2R3R4R5R6R7/Re U u/ uF	  q R8V  R92bK  	  up Ct0] ^k / t1] ^k / t2] ^k / t3] ^k / t4] ^k R: R; lt5R< R= lt6R> R? lt7RfR@ RA llt8]! 0 Rgm4      t9RB RC lt:RDR/RE RF llt;RG RH lt<RI RJ lt=RK RL lt>RM RN lt?RO RP lt@RQ RR ltARS RT ltBRU RV ltCRhtDRW RX ltER# u up i )iz¡Gateway/process helpers for the dashboard: per-profile gateway topology (+cache), action
subprocess spawning, gateway restart plumbing, system platform display.
N)ÚPath)ÚAnyÚDictÚListÚOptionalÚTuple)Úwindows_detach_flagsÚ&windows_detach_flags_without_breakaway)Úget_hermes_homezhermes_cli.web_serverc                ó$   € V ^8„  d   QhR\         /# ©é   Úreturn)r   )Úformats   "ÚB/home/ubuntu/.hermes/hermes-agent/hermes_cli/web_server_gateway.pyÚ__annotate__r      s   € ÷ +ñ +¬sñ +ó    c                óÒ   € V P                  \        ^,           4      p\        V4      \        8”  d   \        R\         R24      h\        P
                  ! VP                  R4      4      # )zCRead a JSON HTTP response body with a hard size cap (issue #54808).z&dashboard HTTP JSON response exceeded z byteszutf-8)ÚreadÚ'_DASHBOARD_JSON_RESPONSE_BODY_MAX_BYTESÚlenÚ
ValueErrorÚjsonÚloadsÚdecode)ÚresponseÚraws   & r   Ú_read_dashboard_json_responser      sZ   € à
�-‰-Ô?À!ÕCÓ
D€CÜ
ˆ3ƒxÔ9Ô9ÜØ4Ü6Ð7°vð?ó
ð 	
ô �:Š:�c—j‘j Ó)Ó*Ð*r   c                óT   € V ^8„  d   QhR\         \        \        R,          3,          /# ©r   r   N)ÚtupleÚboolÚdict)r   s   "r   r   r   '   s!   € ÷ ñ œu¤T¬4°$­;Ð%6Õ7ñ r   c                 ó¦  € ^ RI Hp Hp V'       g   R# \        P                  ! RRVP                  R4      4      p\        P                  P                  RR4      P                  4       pV R2V R23 Fµ  p \        P                  P                  VR	R
7      pV'       d-   VP                  R4      '       d   VP                  RRV 24       \        P                  P                  WPR7      ;_uu_ 4       pVP                   ^È8X  d   R\#        V4      3uuRRR4       u #  RRR4       K·  	  R#   + '       g   i     KÌ  ; i  \$         d     KÝ  i ; i)ua  Probe the gateway's HTTP health endpoint (cross-container). Blocking â€” run in an executor.

DEPRECATED: driven by the ``GATEWAY_HEALTH_URL`` / ``GATEWAY_HEALTH_TIMEOUT`` env vars,
to be replaced by a dashboard config key; do not add callers. Accepts a base URL or an
explicit ``/health`` / ``/health/detailed`` path; tries ``/health/detailed`` first.
)Ú_GATEWAY_HEALTH_TIMEOUTÚ_GATEWAY_HEALTH_URLNz/health(/detailed)?$Ú Ú/ÚAPI_SERVER_KEYz/health/detailedz/healthÚGET)ÚmethodÚAuthorizationzBearer )ÚtimeoutT)FN)Úhermes_cli.web_serverr$   r%   ÚreÚsubÚrstripÚosÚenvironÚgetÚstripÚurllibÚrequestÚRequestÚendswithÚ
add_headerÚurlopenÚstatusr   Ú	Exception)r$   r%   ÚbaseÚapi_keyÚpathÚreqÚresps          r   Ú_probe_gateway_healthrB   '   s%  € ÷ SßØÐÜ�6Š6Ð)¨2Ð/B×/IÑ/IÈ#Ó/NÓO€Dô �j‰j�n‰nÐ-¨rÓ2×8Ñ8Ó:€GØ�6Ð)Ð*¨t¨f°GÐ,<Ó=ˆð	Ü—.‘.×(Ñ(¨°eÐ(Ó<ˆCß˜4Ÿ=™=Ð);×<Ò<Ø—‘˜°'¸'¸Ð0CÔDÜ—‘×'Ñ'¨Ð'×MÔMÐQUØ—;‘; #Ô%ØÔ!>¸tÓ!DÐD÷ NÔMØ%÷ NÑMñ >ð Ð÷ N×MÐMûô ô 	Úð	ús<   Á6?EÂ6=EÃ3D-Ä
EÄEÄ-D>Ä8EÄ>EÅEÅEÚwebhookÚ
api_serverÚmsgraph_webhookÚfeishuÚwecom_callbackÚbluebubblesÚsmsÚwhatsapp_cloudÚlineÚteamsc                ót   € V ^8„  d   QhR\         R\        \        ,          R\        \        \        3,          /# ©r   Úprofile_homeÚruntimer   )r   r   r"   ÚstrÚint)r   s   "r   r   r   Q   s0   € ÷ )ñ )¬$ð )¼Ä$½ð )ÌDÔQTÔVYÐQYÍNñ )r   c                ó¼  € T;'       g    / P                  R4      ;'       g    / pVP                  4        UUu. uFH  w  r4V\        9   g   K  \        V\        4      '       g   K*  VP                  R4      \
        9  g   KF  VNKJ  	  pppV'       g   / # / p ^ RIHp V! V R,          4      p\        VP                  R4      \        4      '       d   VP                  R4      M/ p	T	;'       g    / P                  R4      VP                  R4      3 Fm  p
\        V
\        4      '       g   K  V
P                  4        F>  w  r¼\        V\        4      '       g   K  VP                  V/ 4      P                  V4       K@  	  Ko  	  / pV Fž  p\        V,          w  rïVP                  V4      ;'       g    / p\        VP                  R4      \        4      '       d   VP                  R4      M/ pTP                  TT;'       g    / P                  Wï4      4      p \        V4      WÓ&   K   	  V# u uppi   \         d    / p L½i ; i  \        \        3 d	    YýT&    KÕ  i ; i)u[  Best-effort ``platform -> host TCP port`` for one profile's live gateway.

Ports come from the profile's own config.yaml (``gateway.platforms`` then top-level
``platforms`` â€” later wins, matching load_gateway_config precedence), falling back to the
adapter default. Env-var overrides (e.g. WEBHOOK_PORT in that profile's .env) are not resolved.
Ú	platformsÚstate)Úread_user_config_rawzconfig.yamlÚgatewayÚextra)r3   ÚitemsÚ_PORT_BINDING_PLATFORM_PORTSÚ
isinstancer"   Ú_PLATFORM_DEAD_STATESÚhermes_cli.configrV   Ú
setdefaultÚupdater<   rR   Ú	TypeErrorr   )rO   rP   rT   ÚnamerU   ÚactiveÚblocksrV   ÚcfgÚgateway_cfgÚsrcÚ	plat_nameÚ
plat_blockÚportsÚport_keyÚdefault_portÚblockrX   r   s   &&                 r   Ú_profile_platform_portsrm   Q   s  € ð —�˜B×#Ñ# KÓ0×6Ð6°B€Ià )§¡Ô 1ô=Ù 1‘�ØÔ/Ñ/ô 	ä�uœd×#ô 	ð �I‰I�gÓÔ&;Ñ;÷ 	ˆÑ 1ð ñ =÷
 Øˆ	à €Fðå:Ù" <°-Õ#?Ó@ˆÜ,6°s·w±w¸yÓ7IÌ4×,PÒ,P�c—g‘g˜iÔ(ÐVXˆØ ×&Ð& B×+Ñ+¨KÓ8¸#¿'¹'À+Ó:NÓOˆCÜ˜c¤4×(Ò(ÙØ),¯©®Ñ%�	Ü˜j¬$×/Ô/Ø×%Ñ% i°Ó4×;Ñ;¸JÖGó *5ñ Pð €EÛˆÜ!=¸dÕ!CÑˆØ—
‘
˜4Ó ×&Ð& BˆÜ&0°·±¸7Ó1CÄT×&JÒ&J�—	‘	˜'Ô"ÐPRˆØ�i‰i˜ 5§; ;¨B×"3Ñ"3°HÓ"KÓLˆð	'Ü˜c›(ˆE‹Kñ ð €LùóC=øô( ô ØŠðûô œ:Ð&ô 	'Ø&�$ŒKð	'úsI   ¹H)ÁH)Á%H)ÂH)ÂAH/ Ã-A&H/ Å)H/ ÈIÈ/H?È>H?ÉIÉIc                óh   € V ^8„  d   QhR\         R\        \        ,          R\        \        ,          /# rN   )r   r   r"   r    )r   s   "r   r   r   }   s,   € ÷ ñ ´4ð Ä(Ì4Å.ð ÔU]Ô^cÕUdñ r   c                óx   €  ^ RI HpHp V! WR7      pVf   R# V! V4      pVf   R# WE3#   \         d     R# i ; i)zß``(pid, start_time)`` of the profile's LIVE gateway, or None.

Uses the same validated-liveness helper and the same ``_get_process_start_time`` that stamped
the record, so equality is exact (no unit/clock-source mismatch).
)Ú_get_process_start_timeÚget_runtime_status_running_pid)Úexpected_homeN)Úgateway.statusrp   rq   r<   )rO   rP   rp   rq   ÚpidÚ
start_times   &&    r   Ú _profile_gateway_writer_identityrv   }   sK   € ðßZÙ,¨WÔQˆØŠ;ÙÙ,¨SÓ1ˆ
Ø!Ò)ˆtÐ@°Ð/@Ð@øÜô Úðús   ‚* ™* §* ª9¸9c                óR   € V ^8„  d   QhR\         \        ,          R\        R\        /# )r   Úwriter_identityrT   r   )r   r    r"   )r   s   "r   r   r   Ž   s&   € ÷ :ñ :¬h´u­oð :Ì$ð :ÔSWñ :r   c                óú   € V f   / # V w  r#VP                  4        UUu/ uFO  w  rE\        V\        4      '       g   K  VP                  R4      V8X  g   K5  VP                  R4      V8X  g   KM  WEbKQ  	  upp# u uppi )uü  Keep only platform entries stamped by the profile's CURRENT gateway process.

Gateway startup preserves plain platform entries in gateway_state.json across restarts, so the
raw map can carry fatal state for platforms since disabled/removed. Cross-profile aggregation
has no config context to filter against, so it demands exact ``(pid, start_time)`` writer
identity instead. Fail closed: legacy entries without identity, or no live process, yield {} â€”
a false "degraded forever" is the worse failure mode.
Ú
writer_pidÚwriter_start_time)rY   r[   r"   r3   )rx   rT   Úlive_pidÚ
live_startÚkeyÚvalues   &&    r   Ú_owned_profile_platformsr€   Ž   s‚   € ð ÒØˆ	Ø*Ñ€Hà%.§_¡_Ô%6ô:Ù%6‘z�sÜ�eœT×"ô 	à�I‰I�lÓ# xÑ/ô 	ð �I‰IÐ)Ó*¨jÑ8ô 	ˆŠ
Ñ%6ò:ð :ùó :s   žA7½A7ÁA7Á-A7c                óF   € V ^8„  d   QhR\         \        \        3,          /# r   ©r"   rQ   r   )r   s   "r   r   r   ¡   s   € ÷ B0ñ B0¬4´´S°­>ñ B0r   c                 ó  €  ^ RI Hp HpHp ^ RIHp V! RRRR7      p. p/ pRpRpT EFU  w  rš T	R8X  d   T ! T
4      '       g   M\        T
4      '       g   K0   T! T
R,          4      pT;'       g    / P                  R4      ;'       g    .  Uu. uF  p\        T4      NK  	  ppT	R8X  d   \        T4      ^8”  d   RpT;'       g    / P                  R4      '       d   \        TR,          4      pT;'       g    / P                  R4      p/ p\        T\        4      '       d*   T'       d"   \        \!        Y«4      T4      pT'       d   YöT	&   RT	R\#        T
RT/4      /pT'       d   TTR&   TP%                  T4       EKX  	  T'       d   RpM^ R^R/P                  \        T4      R4      p^ RIHp TT8X  g   \        T4      ^8  d   RpRT U	Uu. uF  w  p	pT	NK
  	  upp	RT U	U
u. uF   w  ršT	R8w  g   K  T! T
4      '       g   K  T	NK"  	  up
p	RTRTR
TRT/#   \         d%    \        P                  RRR7       R. RR	R
. R/ /u # i ; i  \         d     EK4  i ; i  \         d    Rp ELi ; iu upi u upp	i u up
p	i )u  Enumerate profiles and the gateways serving them for ``/api/status``.

Returns ``profiles`` (all profile names via the cheap ``profiles_to_serve(True)`` chokepoint),
``gateways`` (one ``{"profile", "ports", "served_profiles"?}`` per LIVE gateway; liveness via
``_check_gateway_running`` so it agrees with the sidebar), ``gateway_mode``
(multiplex / single / multiple / none) and ``profile_platforms`` â€” ownership-filtered runtime
platform maps per live gateway, an internal aggregation input never exposed directly.
)Ú_check_gateway_runningÚprofiles_to_serveÚprofile_is_parked)Úread_runtime_statusT)Úinclude_standaloneÚinclude_parkedz+profile/gateway topology enumeration failed)Úexc_infoÚprofilesÚgateway_modeÚunknownÚgatewaysÚprofile_platformsFNÚdefaultzgateway_state.jsonÚserved_profilesÚmultiplex_standalone_reasonrT   Úprofileri   Ú	multiplexÚnoneÚsingleÚmultiple)ÚSINGLE_PROFILE_REASONÚparked_profiles)Úhermes_cli.profilesr„   r…   r†   rs   r‡   r<   Ú_logÚdebugÚ_has_own_gatewayr3   rQ   r   r[   r"   r€   rv   rm   ÚappendÚ!hermes_cli.gateway_multiplex_moder˜   )r„   r…   r†   r‡   ÚhomesrŽ   r�   r”   Ústandalone_reasonra   ÚhomerP   ÚpÚservedÚplatsÚownedÚentryÚmoder˜   Ú_homes                       r   Ú!_collect_profile_gateway_topologyrª   ¡   s—  € ðdßdÑdÝ6Ù! $¸4ÐPTÔUˆð
 &(€HØ)+ÐØ€IØ'+ÐÜ‰
ˆð	ð 59¸IÔ4EÑ*¨4×0Ó0ÔK[Ð\`×KaÒKaÙð	Ù)¨$Ð1EÕ*EÓFˆGð %,§M M¨r×#6Ñ#6Ð7HÓ#I×#OÐ#OÈRÐ#OÓQÑ#O˜Q”#�a–&Ñ#OˆÐQØ�9Ô¤ V£¨q¤ØˆIØ�MˆM�r×ÑÐ<×=Ò=Ü # GÐ,IÕ$JÓ KÐØ—�˜B×#Ñ# KÓ0ˆØˆÜ�eœT×"Ò"§uÜ,Ô-MÈdÓ-\Ð^cÓdˆEßØ*/ $Ñ'ð "+¨D°'Ô;RÐSWÐZeÐglÐYmÓ;nÐ oˆßØ'-ˆEÐ#Ñ$Ø�‰˜×ñ9 ÷< Ø‰à�6˜1˜hÐ'×+Ñ+¬C°«M¸:ÓFˆõ HØÐ1Ô1´S¸³ZÀ!´^Ø Ðà©UÔ3©U™k˜d E“T©UÒ3Ø±5Ôj±5¡Z T¸DÀIÑ<MœDÑRcÐdh×RiŸD˜D±5ÒjØ˜Ø%Ð'8Ø�HØÐ.ð0ð 0øô_ ô dÜ�
‰
Ð@È4ˆ
ÔPØ˜B °	¸:ÀrÐK^Ð`bÐcÒcðdûô ô 	Ûð	ûô ô 	Ø‹Gð	üâQùó8 4ùÛjsX   ‚H ®IÁIÁIÂI3ÇI8Ç'I>Ç7I>ÈI>È,I	ÉI	ÉIÉIÉI0É/I0Útsg        ÚdataÚfng      $@c                óh   € V ^8„  d   QhR\         R\        \        \        \         3,          ,          /# )r   r­   r   )r   r   r"   rQ   )r   s   "r   r   r   ñ   s+   € ÷ Bñ BœCð B¤H¬T´#´s°(­^Õ$<ñ Br   c                 óÄ   € \         pVR ,          V J ;'       d+    \        P                  ! 4       VR,          ,
          \        8  pV'       d   VR,          e
   VR,          # R# )r­   r«   r¬   N)Ú_TOPOLOGY_CACHEÚtimeÚ	monotonicÚ_TOPOLOGY_CACHE_TTL)r­   ÚcÚfreshs   &  r   Ú_topology_cache_getr¶   ñ   sL   € Ü€AØˆd�G�rˆM×NÐNœdŸnšnÓ.°°4µÕ8Ô;NÑN€Eß ! F¥)Ò"7ˆ1ˆV�9ÐA¸TÐAr   c                óF   € V ^8„  d   QhR\         \        \        3,          /# r   r‚   )r   s   "r   r   r   ÷   s   € ÷ ñ ´$´s¼C°xµ.ñ r   c                  ó&  € \         p \        V 4      pVe   V# \        ;_uu_ 4        \        V 4      pVe   VuuR R R 4       # V ! 4       p\        P	                  W \
        P                  ! 4       R7       VuuR R R 4       #   + '       g   i     R # ; i)N)r¬   r­   r«   )rª   r¶   Ú_TOPOLOGY_CACHE_LOCKr°   r_   r±   r²   )r­   Úcachedr¬   s      r   Ú(_collect_profile_gateway_topology_cachedr»   ÷   sr   € Ü	*€BÜ  Ó$€FØÒØˆß	Ö	Ü$ RÓ(ˆØÒØ÷ 
Ò	ñ ‹tˆÜ×Ñ D´D·N²NÓ4DÐÔEØ÷ 
×	×	Ó	ús   ¦A?Á2A?Á?B	c                ó:   € V ^8„  d   QhR\         \        ,          /# r   )ÚsetrQ   )r   s   "r   r   r     s   € ÷ \ñ \¬C´­Hñ \r   c                 ót   € ^ RI Hp  V ! 4       P                  4        Uu0 uF  qP                  kK  	  up# u upi )uà   Connected platform names; synchronous by design â€” the first ``load_gateway_config()`` does
platform discovery and can outlast Desktop's WS connect timeout on Windows, so ``get_status``
runs this in Starlette's worker pool.)Úload_gateway_config)Úgateway.configr¿   Úget_connected_platformsr   )r¿   Úplatforms     r   Ú"_load_configured_gateway_platformsrÃ     s/   € õ 3Ù+>Ó+@×+XÑ+XÔ+ZÓ[Ñ+Z˜x�NŒNÑ+ZÑ[Ð[ùÒ[s   ž5iðU  c                óR   € V ^8„  d   QhR\         R\         R\        \        ,          /# )r   ÚversionÚplatform_labelr   )rQ   r   rR   )r   s   "r   r   r     s%   € ÷ ñ ¤3ð ¼ð ÄÌÅñ r   c                óº   € T ;'       g    RT;'       g    R3 F>  p\         P                  ! RV4      pV'       g   K$  \        VP                  ^4      4      u # 	  R# )zAExtract the Windows NT build number from stdlib platform strings.r&   z%(?:^|[^\d])10\.0\.(\d{5,})(?:[^\d]|$)N)r.   ÚsearchrR   Úgroup)rÅ   rÆ   r   Úmatchs   &&  r   Ú_windows_build_numberrË     sM   € à—-�-˜R ×!5Ð!5°2Ó6ˆÜ—	’	ÐBÀEÓJˆß‰5Ü�u—{‘{ 1“~Ó&Ò&ñ 7ñ r   c                óv   € V ^8„  d   QhR\         R\         R\         R\         R\        \         \         3,          /# )r   ÚsystemÚreleaserÅ   rÆ   r   )rQ   r"   )r   s   "r   r   r     sD   € ÷ dñ d¬ð d´cð dÄCð dÔY\ð dÔaeÔfiÔknÐfnÕaoñ dr   c                óž   € V R8X  d>   VR8X  d7   \        W#4      pVe(   V\        8¼  d   \        P                  ! RRV^R7      pRpRV RVR	VR
V/# )zQHost OS fields for display; Windows 10 builds >= 22000 are relabelled Windows 11.ÚWindowsÚ10z^Windows-10(?=-)z
Windows-11)ÚcountÚ11r1   Ú
os_releaseÚ
os_versionrÂ   )rË   Ú_WINDOWS_11_MIN_BUILDr.   r/   )rÍ   rÎ   rÅ   rÆ   Úbuilds   $$$$ r   Ú_display_system_platformrØ     s[   € à�Ô˜w¨$œÜ% gÓ>ˆØÒ Ô*?Ô!?ÜŸVšVÐ$7¸À~Ð]^Ô_ˆNØˆGØ�&˜,¨°¸wÈ
ÐTbÐcÐcr   Úlogsúgateway-restartzgateway-restart.logzgateway-startzgateway-start.logzgateway-stopzgateway-stop.logzgateway-migratezgateway-migrate.logzhermes-updatezhermes-update.logzaction-z.logc                ó   € V ^8„  d   QhRR/# r   © )r   s   "r   r   r   ?  s   € ÷ 	ñ 	¨Dñ 	r   c                 óª   € \         P                  R4      p V f   R#  V P                  4       f   V P                  4        R# R#   \         d     R# i ; i)zFStop a live gateway restart child when its Desktop backend shuts down.rÚ   N)Ú_ACTION_PROCSr3   ÚpollÚ	terminateÚOSError)Úprocs    r   Ú"_terminate_desktop_managed_gatewayrã   ?  sM   € ä×ÑÐ.Ó/€DØ‚|ÙðØ�9‰9‹;ÒØ�N‰NÖñ øäô Úðús   �"A ÁAÁAc                ó\   € V ^8„  d   QhR\         \        ,          R\        \        ,          /# ©r   Ú
subcommandr   )ÚlistrQ   r   )r   s   "r   r   r   K  s"   € ÷ 
ñ 
¬4´­9ð 
¼Ä#½ñ 
r   c                óv  € \        V 4      ^8¼  d9   V ^ ,          R9   d+   \        V ^,          4      P                  4       ;'       g    R# V '       di   \        V ^ ,          4      P                  R4      '       dB   \        V ^ ,          4      P	                  R^4      ^,          P                  4       ;'       g    R# R# )a  Return the named-profile selector that :func:`_profile_cli_args` puts in front of an action.

Deliberately inspects only the leading selector: values after the real subcommand may
legitimately contain ``-p`` / ``--profile`` for a nested process (``mcp add --args ...``).
Nú
--profile=Ú=¾   ú-pú	--profile)r   rQ   r4   Ú
startswithÚsplit)ræ   s   &r   Ú_named_profile_from_actionrð   K  s�   € ô ˆ:ƒ˜!Ô 
¨1¥Ð1DÔ DÜ�:˜a•=Ó!×'Ñ'Ó)×1Ð1¨TÐ1ß”c˜* Q�-Ó(×3Ñ3°L×AÒAÜ�:˜a•=Ó!×'Ñ'¨¨QÓ/°Õ2×8Ñ8Ó:×BÐB¸dÐBÙr   c                óF   € V ^8„  d   QhR\         \        ,          R\        /# rå   ©rç   rQ   r!   )r   s   "r   r   r   X  s   € ÷ /ñ /¤t¬C¥yð /´Tñ /r   c                ó6  € \        V 4      pVR9  d   R# \        V 4      pVeY   V'       d   V^ ,          R9   d   VR,          pM8V'       d1   \        V^ ,          4      P                  R4      '       d
   VR,          p\	        V4      ;'       d    V^ ,          R8H  # )zÔTrue when *subcommand* starts the host multiplexer, not a named profile's own gateway.

``hermes gateway restart`` and ``hermes -p default gateway restart`` are the host.
``hermes -p coder gateway stop`` is not.
F:r   NNré   :é   NNrW   )Nr�   rë   )rð   rç   rQ   rî   r!   )ræ   r“   Úargss   &  r   Ú_is_host_gateway_spawnrö   X  s�   € ô )¨Ó4€GØÐ'Ô'ÙÜ�
Ó€DØÒß�D˜•GÐ2Ô2Ø˜•8‰Dß”c˜$˜q�'“l×-Ñ-¨l×;Ò;Ø˜•8ˆDÜ�‹:×.Ð.˜$˜q�' YÑ.Ð.r   c                ó¬   € V ^8„  d   QhR\         \        ,          R\        \        \        \        3,          ,          R\        \        \        3,          /# )r   ræ   Úenv_overridesr   )rç   rQ   r   r"   )r   s   "r   r   r   j  sB   € ÷ Eñ EÜ”S•	ðEÜ*2´4¼¼S¸µ>Õ*BðEä	Œ#Œsˆ(…^ñEr   c                óD  € \        V 4      p\        V 4      '       d   ^ RIHp V! 4       pEMVf   \	        \
        P                  4      pMý^ RIHpH	pH
p ^ RIHp ^ RIHp	Hp
 ^ RIHpHp V! V4      pV! \
        P                  RR7      p\%        V4      p \'        V
! 4       4      \'        \)        4       4      0pV FO  pVP-                  V! \/        V4      R	,          4      4       VP-                  V! V4      P1                  4       4       KQ  	  V F  pVP3                  VR4       K  	  V! WM4       \'        V4      VR
&   V	! V4       RVR&   ^ RIHp V! V4       VP3                  RR4       V'       d   VP-                  V4       V#   \*         d    \%        4       p Låi ; i)aD  Environment for a detached ``hermes <subcommand>`` action.

The dashboard loads its own profile's ``.env`` into process-global ``os.environ``. Copying
that mapping verbatim into ``hermes -p <other> ...`` lets the named child see the dashboard
profile's platform credentials and ports *before* its own dotenv loads (``load_hermes_dotenv``
does not override keys already present): a supposedly A2A-only profile then claims the default
Discord token and binds the default API/BlueBubbles ports.

Named-profile actions therefore start from Hermes' standard scrubbed subprocess env, then drop
the profile-managed keys plus every key declared by the dashboard/default profile dotenv files
and their hydrated secret sources, and pin ``HERMES_HOME`` to the target profile. The child's
normal startup then loads that profile's own ``.env``. A host-gateway verb (bare ``gateway``
or ``-p default gateway``) starts from ``host_gateway_child_env`` so a named-profile dashboard
cannot donate its dotenv to the multiplexer. Other actions without a profile selector keep
the historical environment exactly.
)Úhost_gateway_child_envN)Ú_PROFILE_MANAGED_ENV_KEYSÚ_env_keys_defined_in_dotenvÚget_secret_source_values©Ú_resolve_profile_dir)Úapply_subprocess_home_envÚget_default_hermes_root)Úbuild_subprocess_envÚstrip_launch_profile_envT)r=   Úscrub_secretsz.envÚHERMES_HOMEÚ1ÚHERMES_NONINTERACTIVE)Údrop_bridged_envÚ_HERMES_GATEWAY)rð   rö   Útools.environments.localrú   r"   r1   r2   Úhermes_cli.env_loaderrû   rü   rý   Úhermes_cli.web_server_profilesrÿ   Úhermes_constantsr   r  r  r  r½   rQ   r
   r<   r_   r   ÚkeysÚpopÚgateway.config_loaderr  )ræ   rø   r“   rú   Ú
action_envrû   rü   rý   rÿ   r   r  r  r  Útarget_homeÚprofile_keysÚsource_homesÚsource_homer~   r  s   &&                 r   Ú_profile_action_environmentr  j  sq  € ô& )¨Ó4€GÜ˜j×)Ò)ÝCÙ+Ó-Š
Ø	ŠÜœ"Ÿ*™*Ó%‰
÷	
ñ 	
õ 	HßWß[á*¨7Ó3ˆÙ)¬r¯z©zÈÔNˆ
äÐ4Ó5ˆð	!ÜÑ 7Ó 9Ó:¼CÄÓ@QÓ<RÐSˆLó (ˆKØ×ÑÑ ;¼DÀÓ<MÐPVÕ<VÓ WÔXð ×ÑÑ 8¸Ó E× JÑ JÓ LÖMñ	 (ó
  ˆCØ�N‰N˜3 Ö%ñ  ñ
 	! Ô9ô %(¨Ó$4ˆ
�=Ñ!Ù! *Ô-à*-€JÐ&Ñ'õ 7Ù�ZÔ ð ‡N�NÐ$ dÔ+ßØ×Ñ˜-Ô(ØÐøô= ô 	!Ü›5ŠLð	!ús   Â#F ÆFÆFc                óF   € V ^8„  d   QhR\         \        ,          R\        /# rå   rò   )r   s   "r   r   r   ·  s   € ÷ !*ñ !*¬t´C­yð !*¼Tñ !*r   c                ód  € ^ RI Hp V! R4      '       g   R#  W P                  R4      ^,           ,          pT\
        9  d   R# ^ RIHp ^ RIH	pH
p \        T 4      pTf	   T! R4      # ^ RIHp T! T! T4      4      p T! R4      T! T4       #   \        \        3 d     R# i ; i  T! T4       i ; i)aÎ  True when *subcommand* is a gateway lifecycle verb that resolves to the SYSTEM unit.

Scope is decided by the CLI's own picker (``_select_systemd_scope``) evaluated for the profile
the action addresses, not by "a system unit exists": a host carrying both units resolves to the
user unit, which the dashboard user operates unelevated. Same root/sudo posture as the
``hermes update`` fleet restart (``update_cmd_fleet._needs_sudo`` / ``_sudo_noninteractive_ok``).
)Ú_needs_sudorÍ   FrW   )Ú_select_systemd_scope)Úreset_hermes_home_overrideÚset_hermes_home_overriderþ   )Úhermes_cli.update_cmd_fleetr  Úindexr   Ú
IndexErrorÚ_ROOT_REQUIRING_GATEWAY_VERBSÚhermes_cli.gatewayr  r  r  r  rð   r  rÿ   )	ræ   r  Úverbr  r  r  r“   rÿ   Útokens	   &        r   Ú_action_targets_system_gatewayr$  ·  s¯   € õ 8á�x× Ò ÙðØ×*Ñ*¨9Ó5¸Õ9Õ:ˆð Ô0Ô0Ùå8ßUä(¨Ó4€GØ‚Ù$ UÓ+Ð+õ DÙ$Ñ%9¸'Ó%BÓC€Eð*Ù$ UÓ+á" 5Õ)øô' œ
Ð#ô Úðûñ& 	# 5Õ)ús   ˜B Á=B% ÂB"Â!B"Â%
B/rø   c          	      óª   € V ^8„  d   QhR\         \        ,          R\        R\        \        \        \        3,          ,          R\        P
                  /# )r   ræ   ra   rø   r   )rç   rQ   r   r"   Ú
subprocessÚPopen)r   s   "r   r   r   Û  sI   € ÷ Rñ RÜ”S•	ðRÜ!$ðRÜ8@ÄÄcÌ3ÀhÅÕ8PðRä×ÑñRr   c               ó®  aaaa€ ^ RI Ho \        P                  RRR7       \	        \        \
        V,          ,          R^ R7      oT;'       g    / P                  R4      p\        P                  ! R4      V'       d   RV 2MR	,           pSP                  R
V RV R2P                  4       4       V'       d-   ^ RIHp V! \        V R2,          VP                  R4      4       ^ RIHp V! SV 4      o\        V 4      '       ds   ^ RIHp V! RR.SO4      '       gU   V RRP%                  V 4       R2pSP                  V R2P                  4       4       SP'                  4        \)        V4      hRR.SOo\+        W4      oR VVVV3R llp	 \,        P.                  R8X  d    V	! \1        4       R7      p
M
V	! RR!7      p
 SP'                  4        \8        P;                  VR4       \=        V 4      \>        V&   V
\@        V&   V'       d   V\B        V&   V
# \B        P;                  VR4       V
#   \2         dT   p\5        TRR4      ^8w  d   h SP                  T RT R 2P                  4       4       T	! \7        4       R7      p
 Rp?LÅRp?ii ; i  \2         d<   pSP                  T R"T R2P                  4       4       SP'                  4        h Rp?ii ; i)#zWSpawn ``hermes <subcommand>`` detached (via ``hermes_cli.main``) and record the handle.)ÚPROJECT_ROOTT)ÚparentsÚexist_okÚab)Ú	bufferingÚHERMES_ACTION_IDz%Y-%m-%d %H:%M:%SÚ r&   z
=== z	 started z ===
)Ú_atomic_bytesz
.action_idÚascii)Úruntime_command)Ú_sudo_noninteractive_okz-lz--zŽ targets the system-scope gateway service, which requires root, and passwordless sudo is unavailable for the dashboard user. Run 'sudo hermes z0' on the host, or grant that user NOPASSWD sudo.Ú
Úsudoz-nc                óD   € V ^8„  d   QhR\         R\        P                  /# )r   Údetachr   )r   r&  r'  )r   s   "r   r   Ú*_spawn_hermes_action.<locals>.__annotate__  s    € ÷ 
ñ 
œð 
¤×!1Ñ!1ñ 
r   c                  ó�   <€ \         P                  ! S3R \        S4      R\         P                  RSR\         P                  RS/V B # )ÚcwdÚstdinÚstdoutÚstderrÚenv)r&  r'  rQ   ÚDEVNULLÚSTDOUT)r7  r)  r  ÚcmdÚlog_files   ,€€€€r   Ú_popenÚ$_spawn_hermes_action.<locals>._popen  sZ   ø€ Ü×ÒØñ
Ü˜Ó&ð
Ü.8×.@Ñ.@ð
ØIQð
ÜZd×ZkÑZkð
àð
à$ñ
ð 	
r   Úwin32)ÚcreationflagsÚwinerrorNz: breakaway spawn refused (z.); retrying without CREATE_BREAKAWAY_FROM_JOB
)Ústart_new_sessionz: spawn failed: )"r-   r)  Ú_ACTION_LOG_DIRÚmkdirÚopenÚ_ACTION_LOG_FILESr3   r±   ÚstrftimeÚwriteÚencodeÚhermes_cli.runtime_stater0  Úhermes_cli._launchersr2  r$  r  r3  ÚjoinÚcloseÚRuntimeErrorr  ÚsysrÂ   r   rá   Úgetattrr	   Ú_ACTION_RESULTSr  r    Ú_ACTION_COMMANDSrÞ   Ú_ACTION_IDS)ræ   ra   rø   Ú	action_idÚstampr0  r2  r3  ÚmessagerC  râ   Úexcr)  r  rA  rB  s   &&$         @@@@r   Ú_spawn_hermes_actionr^  Û  s¢  û€ õ 3Ü×Ñ $°ÐÔ6Ü”OÔ&7¸Õ&=Õ=¸tÈqÔQ€Hð ×$Ð$ "×)Ñ)Ð*<Ó=€IÜ�MŠMÐ-Ó.ÇY°A°i°[±/ÐTVÕW€EØ‡N�N�V˜D˜6 ¨5¨'°Ð8×?Ñ?ÓAÔBßõ 	;Ù”o¨4¨&°
Ð(;Õ;¸Y×=MÑ=MÈgÓ=VÔWå5Ù
˜,¨
Ó
3€CÜ% j×1Ò1õ 	Há&¨¨dÐ'9°SÐ'9×:Ò:à�&ð  à #§¡¨Ó 4Ð5Ð5eðgð ð
 �N‰N˜g˜Y b˜>×0Ñ0Ó2Ô3Ø�N‰NÔÜ˜wÓ'Ð'Ø�tÐ"˜cÐ"ˆô -¨ZÓG€J÷
ó 
ðÜ�<‰<˜7Ô"ðVÙÔ,@Ó,BÔC‘ñ ¨DÔ1‰Dð ‡N�NÔÜ×Ñ˜˜dÔ#Ü" :Ó.Ô�TÑØ„M�$ÑßØ%Œ�DÑð €Kô 	�‰˜˜dÔ#Ø€Køô7 ô 
Vô
 ˜3 
¨DÓ1°QÔ6ØØ—‘Ø�fÐ7¸°uÐ<kÐl×sÑsÓuôñ Ô,RÓ,TÔU•ûð
Vûô ô ð 	�‰˜$˜Ð/°¨u°BÐ7×>Ñ>Ó@ÔAØ�‰ÔØûðúsC   ÆJ Æ%H- Æ7	J È-JÈ8A	JÊJ ÊJÊJ ÊKÊ6KËKc                ó\   € V ^8„  d   QhR\         \        ,          R\         \        ,          /# ©r   r“   r   ©r   rQ   )r   s   "r   r   r   0  s&   € ÷ Dñ D¤8¬C¥=ð D´X¼cµ]ñ Dr   c                óˆ   € T ;'       g    RP                  4       pV'       d   V# ^ RIHpHp V! V! 4       4      ;'       g    R# )a  The profile a lifecycle verb addresses: the explicit selector, else the process's own
profile (a pooled Desktop ``hermes --profile X serve`` answers ``/api/gateway/*`` without
``?profile=``; an unscoped verb there is about X). The default home resolves to the literal
``"default"`` selector, never to a bare argv: a selector-less child re-reads the sticky
``active_profile`` and would act on another profile's gateway (and skips the named-target
env scrub). ``None`` is reserved for a home that is not a profile home at all.r&   )Úget_process_hermes_homeÚprofile_name_for_homeN)r4   r  rc  rd  )r“   Ú	requestedrc  rd  s   &   r   Ú_own_profile_selectorrf  0  s;   € ð —�˜B×%Ñ%Ó'€IßØÐßOÙ Ñ!8Ó!:Ó;×CÐC¸tÐCr   c                óh   € V ^8„  d   QhR\         \        ,          R\        R\        \        ,          /# ©r   r“   r"  r   )r   rQ   rç   )r   s   "r   r   r   >  s)   € ÷ $ñ $¤¬#¥ð $´cð $¼dÄ3½iñ $r   c                óŠ   € ^ RI Hp \        V 4      p V! V 4      pV '       d   VR8X  d   \        W4      e   RR.pVRV.,           # )uï  ``hermes [-p X] gateway <verb>`` argv for a dashboard lifecycle action. A profile served by the
live default multiplexer has no gateway of its own: ``restart`` targets the multiplexer (the process
that actually serves X â€” a ``-p X gateway restart`` child only exits 78 into the action log while the
UI reports "restarted"); ``start``/``stop`` are refused by the caller (``multiplexed_profile_refusal``).
The multiplexer is addressed as ``-p default`` explicitly: a bare ``gateway restart`` spawned from a
pooled ``--profile X serve`` would inherit X's ``HERMES_HOME`` and hit the same exit-78 refusal. The
selector is explicit for the default home too: a bare child re-reads the sticky ``active_profile``
and would restart another profile's gateway.)Ú_profile_cli_argsÚrestartrì   r�   rW   )r  rj  rf  Úmultiplexed_profile_refusal)r“   r"  rj  rõ   s   &&  r   Ú_gateway_subcommandrm  >  sK   € õ AÜ# GÓ,€GÙ˜WÓ%€Dß�4˜9Ô$Ô)DÀWÓ)SÒ)_à�iÐ ˆØ�9˜dÐ#Õ#Ð#r   c                ó0   € V ^8„  d   QhR\         R\        /# r`  )rQ   r!   )r   s   "r   r   r   P  s   € ÷ @ñ @¤Sð @¬Tñ @r   c                 ó   € ^ RI Hp V! V 4      # )é    )Ú+named_profile_served_by_running_multiplexer)r!  rq  )r“   rq  s   & r   Ú_profile_is_multiplexedrr  P  s   € ÝNÙ6°wÓ?Ð?r   c                ó0   € V ^8„  d   QhR\         R\        /# )r   Úprofile_dirr   )r   r!   )r   s   "r   r   r   U  s   € ÷ :ñ :¤$ð :¬4ñ :r   c                óÒ   a€ ^ RI HoHpHp ^ RIHp V! V 4      '       g   R# V! V 4      pVf   R# V! V RV3R lR7      pVP                  ;'       d    VP                  V^ ,          8g  # )ao  A live gateway of the profile's OWN (a ``--force``-started separate one), not the multiplexer that
serves it. Gateway liveness reports a served profile as running on the multiplexer's PID (#97120),
so reading liveness alone made every served profile look self-hosted and the refusal below never
fired while a multiplexer was live, which is the only time it is needed.)Úget_running_pidÚ multiplexer_liveness_for_profileÚresolve_gateway_liveness)r„   FTc                 ó   <€ S! V R R7      # )F)Úcleanup_stalerÜ   )r?   rv  s   &€r   Ú<lambda>Ú"_has_own_gateway.<locals>.<lambda>c  s   ø€ ™¨tÀ5ÕIr   )rt  Ú	use_cacheÚ	pid_probe)rs   rv  rw  rx  rš   r„   Úrunningrt   )rt  rw  rx  r„   r¤   Úlivenessrv  s   &     @r   r�   r�   U  se   ø€ ÷
 kÑjÝ:Ù! +×.Ò.ÙÙ-¨kÓ:€FØ‚~ÙÙ'Ø¨5ÜIôK€Hð ×Ñ×9Ð9 §¡°°qµ	Ñ 9Ð9r   c                óh   € V ^8„  d   QhR\         \        ,          R\        R\         \        ,          /# rh  ra  )r   s   "r   r   r   g  s.   € ÷ *^ñ *^¬´#­ð *^¼cð *^ÄhÌsÅmñ *^r   c                ó  € \        V 4      ;'       g    RpV'       d   VP                  4       R9   d   R# \        V4      p^ RIHpHp ^ RIHp V! V4      pV! V4      pV'       d   V'       g   R# ^ RIH	p	 V	! V4      # VR8X  d    V! V4      '       d   ^ RIH
p
 V
! 4       e   R# V'       g
   VR8w  d   R# \        V4      '       d   R# V'       d   VR8X  d   R# R	V R
V R2# ^ RIHp V! V4      '       d   R# RV RV R2# )u�  Refusal text for ``gateway start``/``stop`` on a named profile with no gateway of its own (a
``--force``-started separate one is managed normally), else None. A profile the live host
multiplexer serves is parked by ``stop`` and a parked one is unparked by ``start`` (the spawned
``hermes -p X gateway <verb>`` runs ``gateway_profile_lifecycle``), so neither is refused;
``start`` on an unparked named profile is â€” one host gateway serves every profile, so a new
per-profile gateway is never the answer (the CLI twin ``_named_profile_refused_under_multiplexer``
exits 78 into an action log nobody reads while the UI shows the verb as done).r&   N)r†   Úprofile_is_standalonerþ   )Ústandalone_rescan_messageÚstart©Úhost_gatewayÚstopz,The default gateway already serves profile 'z' as a multiplexer; zL it from the default profile instead of a separate gateway for this profile.)Ú_installed_servicesz	Profile 'zï' does not get a gateway of its own: one host gateway serves every profile. Install or start it from the default profile (hermes gateway install), or fold an existing per-profile fleet with `hermes gateway migrate --multiplex`; `hermes -p z7 gateway install --force` starts a separate one anyway.>   Úcurrentr�   )rf  Úlowerrr  rš   r†   rƒ  r  rÿ   Úgateway.host_attachr„  r‡  r�   Úhermes_cli.gateway_migrater‰  )r“   r"  re  r¤   r†   rƒ  rÿ   rt  Ú
standaloner„  r‡  r‰  s   &&          r   rl  rl  g  s   € ô & gÓ.×4Ð4°"€Iß˜	Ÿ™Ó)Ð-CÔCÙÜ$ YÓ/€FßLÝCÙ& yÓ1€KÙ& {Ó3€Jß÷ ÙÝAÙ(¨Ó3Ð3Øˆw„Ñ,¨[×9Ò9Ý4Ù‹>Ò%Ùß�d˜g”oÙÜ˜×$Ò$ÙßØ�6Œ>ÙØ>¸y¸kÐI]Ø�&Ðdðfð 	gå>Ù˜;×'Ò'ÙØ˜	�{ð #ð $˜Ð$[ð]ð ^r   c                óh   € V ^8„  d   QhR\         \        ,          R\        R\         \        ,          /# rh  ra  )r   s   "r   r   r   ”  s)   € ÷ $ñ $¤(¬3¥-ð $´sð $¼xÌ½}ñ $r   c                ó  € ^ RI Hp ^ RIHp T! \	        V 4      ;'       g    R4      .p^ RIHp V! 4       pVe%   VP                  \        VP                  4      4       V! WRV R2R7      pR	P                  V4      ;'       g    R# )
z³Refusal text when the gateway ``verb`` would act on has live sessions, else None. Asked before
spawning: the child refuses the same way, but into an action log the UI never reads.)Úrefusal_linesrþ   r�   r†  NzPOST /api/gateway/z?interrupt=true)Ú	flag_hintr4  )Ú#hermes_cli.gateway_lifecycle_guardsr‘  r  rÿ   rf  rŒ  r‡  rž   r   r¢   rR  )r“   r"  r‘  rÿ   r    r‡  ÚownerÚliness   &&      r   Úlive_session_refusalr–  ”  sx   € õ BÝCÙ!Ô"7¸Ó"@×"MÐ"MÀIÓNÐO€EÝ0Ù‹N€EØÒØ�‰”T˜%Ÿ*™*Ó%Ô&Ù˜$Ð3EÀdÀVÈ?Ð1[Ô\€EØ�9‰9�UÓ×#Ð#˜tÐ#r   c          
      ó€   € V ^8„  d   QhR\         \        ,          R\        R\        R\        \        \        3,          /# )r   r“   ÚwhatÚlabelr   )r   rQ   r"   r   )r   s   "r   r   r   ¢  s?   € ÷ cñ c¤H¬S¥Mð c¼Cð cÌð cÔPTÔUXÔZ]ÐU]ÕP^ñ cr   c               óF  € ^ RI Hp \        V R4      pV'       d   RRRV/#  V! V 4      w  rVT'       d!   \        P                  RY%P                  4       RR	R
RRTP                  /#   \         d0   p\        P                  RT4       RRR\        T4      /u Rp?# Rp?ii ; i)a  Best-effort gateway restart after a config change. The save stays authoritative: a failed
spawn is reported (``restart_started: False`` + ``restart_error``) so the UI can fall back to
its manual restart banner instead of failing the request. Live sessions refuse it the same way.)Ú_spawn_gateway_restartrk  Úrestart_startedFÚrestart_errorz'Failed to auto-restart gateway after %sNz.%s: reusing in-flight gateway restart (pid %s)TÚrestart_actionrÚ   Úrestart_pid)	r-   r›  r–  r<   r›   Ú	exceptionrQ   Úinfort   )r“   r˜  r™  r›  Úrefusalrâ   Úreusedr]  s   &$$     r   Ú_restart_gateway_afterr¤  ¢  s¡   € õ =Ü" 7¨IÓ6€GßØ! 5¨/¸7ÐCÐCðEÙ-¨gÓ6‰ˆ÷ Ü�	‰	ÐBÀEÏ8É8ÔTØ˜tÐ%5Ð7HÈ-ÐY]×YaÑYaÐbÐbøô ô EÜ�‰Ð@À$ÔGØ! 5¨/¼3¸s»8ÐDÕDûðEús   ¢
A& Á&B Á1$BÂB ÂB c                ó<   € V ^8„  d   QhR\         R\        R\        /# )r   ÚtextÚcapr   )rQ   rR   rç   )r   s   "r   r   r   ´  s!   € ÷ ñ ¤sð ´ð ¼ñ r   c                óÎ  € ^ RI Hp V'       d
   V^ 8”  d   TMRp. RrC\        \        P                  VP                  V 4      4       F‚  p\        V4      V8”  d   VP                  VRV 4       WQR pK*  V'       d=   \        V4      \        V4      ,           ^,           V8”  d   VP                  V4       TpKq  V'       d   V RV 2MTpK„  	  V'       d   VP                  V4       V# )zóSplit *text* into provider-cap-sized pieces on sentence boundaries.

Deliberately NOT unified with gateway.platforms.helpers' split_text_fence_aware: this
reflows whitespace (sentences re-joined with single spaces) and has no fence semantics.
)ÚSENTENCE_BOUNDARY_REi   r&   Nr/  )Útools.tts_streamingr©  ÚfilterrQ   r4   rï   r   rž   )r¦  r§  Ú_SENTENCE_BOUNDARY_REÚpiecesÚbufÚsentences   &&    r   Ú_split_text_for_speak_streamr°  ´  s¾   € õ Rß˜˜qœ‰# d€CØ�bˆCÜœ3Ÿ9™9Ð&;×&AÑ&AÀ$Ó&GÖHˆÜ�(‹m˜cÔ!Ø�M‰M˜( 4 C˜.Ô)Ø �~ŠHß”3�s“8œc (›mÕ+¨aÕ/°#Ô5Ø�M‰M˜#ÔØŠCç),�S�E˜˜8˜*Ñ%°(ŠCñ I÷ Ø�‰�cÔØ€Mr   c                ó    € V ^8„  d   QhR\         \        \        \        3,          ,          R\         \        \        \        3,          ,          /# )r   Úsessionsr   )rç   r"   rQ   r   )r   s   "r   r   r   Ñ  s4   € ÷ ñ ¤t¬D´´c°­NÕ';ð ÄÄTÌ#ÌsÈ(Å^Õ@Tñ r   c                 óV   € V  F"  p\          F  pVP                  VR 4       K  	  K$  	  V # ©N)Ú_SESSION_LIST_HEAVY_FIELDSr  )r²  Úsr~   s   &  r   Ú_strip_session_list_rowsr·  Ñ  s+   € Ûˆß-ˆCØ�E‰E�#�tÖó .ñ ð €Or   c                ó¸  € V ^8„  d   Qh/ ^ \         9   d,   \        \        \        \        \        3,          3,          ;R&   ^\         9   d   \        \        \
        3,          ;R&   ^\         9   d
   \        ;R&   ^\         9   d   \        \        \        3,          ;R&   ^\         9   d%   \        \        \        P                  3,          ;R&   ^\         9   d(   \        \        \        \        R3,          3,          ;R&   ^\         9   d   \        \        \        3,          ;R&   ^\         9   d,   \        \        \        \        \
        3,          3,          ;R	&   # )
r   rZ   r°   rI  rL  rÞ   .rX  rY  rW  )	Ú__conditional_annotations__r"   rQ   r    rR   r   r   r&  r'  )r   s   "r   r   r      s  € ÷ ñ ÷Jò œd¤3¬¬c´3¨h­Ð#7Õ8ñ ñK÷V HÒ G””cœ3�h•Ñ GñW÷L	 3Ò 2”Ñ 2ñM	÷R	ò ”4œœS˜•>ñ ñS	÷n	 0Ò /Œt”Cœ×)Ñ)Ð)Õ*Ñ /ño	÷p	 2Ò 1”$”sœE¤# s (�OÐ+Õ,Ñ 1ñq	÷r	 !Ò  ŒT”#”s�(�^Ñ  ñs	÷v	 0Ò /””cœ4¤¤S �>Ð)Õ*Ñ /òw	r   i   )ÚportiÄ!  )rº  iÂ!  )rº  iÆ!  )Úwebhook_porti="  )rº  éÅ!  )r»  r¼  )r»  i�  )r»  iš  )rº  iŠ  >   ÚfatalÚstoppedÚdisconnected)Údoctorzsecurity-auditÚbackupÚimportzcheckpoints-prunezskills-installzskills-uninstallzskills-updatezcurator-runzprompt-sizeÚdumpzconfig-migrateztools-post-setupr´  >   rˆ  r…  rk  )Úsystem_promptÚmodel_config)Gr¹  Ú__doc__Úloggingr   r1   r.   r&  rU  Ú	threadingr±   Úurllib.requestr5   Úpathlibr   Útypingr   r   r   r   r   Úhermes_cli._subprocess_compatr   r	   r]   r
   Ú	getLoggerr›   r   r   rB   rZ   Ú	frozensetr\   rm   rv   r€   rª   r°   ÚLockr¹   r³   r¶   r»   rÃ   rÖ   rË   rØ   rI  rL  rÞ   rX  rY  rW  rã   rð   rö   r  r   r$  r^  rf  rm  rr  r�   rl  r–  r¤  r°  rµ  r·  r   )ra   r¹  s   0@r   Ú<module>rÐ     s  øðöó Û Û 	Û 	Û Û 
Û Û Û Ý ß 3Õ 3ß fÝ -ð ×ÒÐ0Ó1€ð
 +6Ð 'õ+õð@ ˆ~˜|¨^Ð=NÐP^ØÐ$Ð&6¸ÈÐWmØ	Ð!Ð#3Ð5KÈVÐUcØˆ^ð	<Ð ó ñ "Ò"FÓGÐ õ)õXõ":õ&B0ðV $(¨¨f°d¸DÀ$Ð"G€Ó GØ —~’~Ó'Ð ØÐ õBõõ\ð Ð õõdñ (Ó)¨FÕ2€Ó 2ð Ð,ØÐ(ØÐ&ØÐ,ØÐ(ð%ñ/ó ñ / dˆw�t�f˜DÐ!Ò!ñ /ñ ð%Ð ó ð .0€Ó /Ø/1Ð Ó 1Ø €Ó  à-/€Ó /õ	õ
õ/÷$EñT !*Ò*FÓ GÐ õ!*ðHRØSW÷RõjDõ$õ$@õ
:õ$*^õZ$õcõ$ð4 ?Ð ÷ùòCs   ÄF(