+
    iHàjN  ã                  ó  a € 0 t $ R t^ RIHt ^ RIt^ RIt^ RIt^ RIHt ^ RI	H
t
 ]P                  ! R4      tRsR]R&   / tR]R	&   R
s]P"                  ! 4       tR R ltR R ltR R ltR R ltR R ltR R lt. ROtR# )aÉ  Language Server Protocol (LSP) integration for Hermes Agent.

Real language servers (pyright, gopls, ...) run as subprocesses and their
``publishDiagnostics`` feed the post-write lint delta filter of ``write_file`` /
``patch`` (wiring: ``FileOperations._check_lint_delta``).  LSP is **gated on git
workspace detection** so user-home cwd's (e.g. Telegram gateway chats) never
spawn daemons; ``get_service()`` returns the singleton or ``None`` when disabled.
)ÚannotationsN)ÚOptional)Ú
LSPServicez	agent.lspúOptional[LSPService]Ú_serviceÚdictÚ_services_by_homeFc               ó    € V ^8„  d   QhRRRR/# )é   Úsvcr   Úreturn© )Úformats   "Ú7/home/ubuntu/.hermes/hermes-agent/agent/lsp/__init__.pyÚ__annotate__r      s    € ÷ Bñ BÐ%ð BÐ*>ñ Bó    c                ó>   € V e   V P                  4       '       d   V # R # )N)Ú	is_active)r   s   &r   Ú_activer      s   € Ø’? s§}¡}§¢ˆ3ÐA¸TÐAr   c               ó   € V ^8„  d   QhRR/# ©r
   r   ÚNoner   )r   s   "r   r   r   !   s   € ÷ "ñ "˜tñ "r   c                 óZ   € \         '       g   \        P                  ! \        4       R s R# R# )TN)Ú_atexit_registeredÚatexitÚregisterÚ_atexit_shutdownr   r   r   Ú_register_atexit_oncer   !   s    € çÓÜ�ŠÔ(Ô)Ø!Òñ r   c               ó   € V ^8„  d   QhRR/# )r
   r   r   r   )r   s   "r   r   r   (   s   € ÷ ñ Ð)ñ r   c                 óè  € ^ RI Hp Hp V ! 4       eh   V! 4       p\        ;_uu_ 4        V\        9  d'   \
        P                  ! 4       \        V&   \        4        \        \        V,          4      uuRRR4       # \        f?   \        ;_uu_ 4        \        f    \
        P                  ! 4       s	\        4        RRR4       \        \        4      #   + '       g   i     Le; i  + '       g   i     L2; i)u¸  Return the lazily created LSP service for the active profile (process-wide singleton when no
profile override is bound), or None when disabled.

Also registers an :mod:`atexit` hook so a clean exit tears down spawned servers:
without it every ``hermes chat`` exit leaks pyright processes for a few seconds
while their stdout buffers drain.  (SIGKILL/os._exit skip atexit â€” fine, the
kernel reaps the stateless servers with their parent.)
)Úget_hermes_home_overrideÚhermes_home_keyN)
Úhermes_constantsr    r!   Ú_service_lockr   r   Úcreate_from_configr   r   r   )r    r!   Úhome_keys      r   Úget_servicer&   (   sŸ   € ÷ KÙÓ!Ò-Ù"Ó$ˆßŽ]ØÔ0Ô0Ü.8×.KÒ.KÓ.MÔ! (Ñ+Ü%Ô'ÜÔ,¨XÕ6Ó7÷	 Š]ô
 ÒßŽ]ÜÒÜ%×8Ò8Ó:�Ü%Ô'÷ ô ”8ÓÐ÷ �]ú÷ �]ús   §ACÂ(C!ÃC	Ã!C1	c               ó    € V ^8„  d   QhRRRR/# )r
   ÚpathÚstrr   Úintr   )r   s   "r   r   r   B   s   € ÷ ñ ˜Cð  Cñ r   c                óf  € \         ;_uu_ 4        \        .\        P                  4       O Uu. uF
  qf   K  VNK  	  ppRRR4       ^ pX F  p W1P	                  V 4      ,          pK  	  V# u upi   + '       g   i     L:; i  \
         d"   p\        P                  RY4        Rp?K`  Rp?ii ; i)z¿Shut down the LSP clients serving ``path`` (a worktree about to be removed) in every started
service, without shutting down unrelated workspaces.  Never creates a service.  Returns the count.Nz'LSP workspace release failed for %s: %s)r#   r   r   ÚvaluesÚrelease_workspaceÚ	ExceptionÚloggerÚdebug)r(   r   ÚservicesÚreleasedÚes   &    r   r-   r-   B   sš   € ÷ 
ŽÜ$,Ð#JÔ/@×/GÑ/GÓ/IÑ#JÓ^Ñ#J˜C—C�CÑ#JˆÐ^÷ 
à€HÛˆð	MØ×-Ñ-¨dÓ3Õ3ŠHñ ð
 €Oùò _÷ 
�ûô ô 	MÜ�L‰LÐBÀD×LÒLûð	Mús8   �A1­A,·A,½A1ÁBÁ,A1Á1B	ÂB0ÂB+Â+B0c               ó   € V ^8„  d   QhRR/# r   r   )r   s   "r   r   r   P   s   € ÷ :ñ :˜$ñ :r   c                 óZ  € \         ;_uu_ 4        \        .\        P                  4       Op Rs\        P	                  4        RRR4       X  F  pVf   K	   VP                  4        K  	  R#   + '       g   i     L2; i  \         d"   p\        P                  RT4        Rp?KZ  Rp?ii ; i)z:Tear down every LSP service that was started.  Idempotent.NzLSP shutdown error: %s)	r#   r   r   r,   ÚclearÚshutdownr.   r/   r0   )r1   r   r3   s      r   Úshutdown_servicer8   P   s€   € ÷ 
ŽÜÐ:Ô0×7Ñ7Ó9Ð:ˆØˆÜ×ÑÔ!÷ 
ó ˆØŒ?ð:Ø—‘–ó ÷	 
�ûô ô :Ü—‘Ð5°q×9Ò9ûð:ús#   �2A+ÁA>Á+A;	Á>B*Â	B%Â%B*c               ó   € V ^8„  d   QhRR/# r   r   )r   s   "r   r   r   _   s   € ÷ :ñ :˜$ñ :r   c                 óz   €  \        4        R#   \         d"   p \        P                  RT 4        Rp ? R# Rp ? ii ; i)zOatexit wrapper; logs at debug since the user has already seen the final output.zatexit LSP shutdown failed: %sN)r8   r.   r/   r0   )r3   s    r   r   r   _   s/   € ð:ÜÖøÜô :Ü�‰Ð5°q×9Ò9ûð:ús   ‚
 Ž:™5µ:)r   r&   r-   r8   )Ú__conditional_annotations__Ú__doc__Ú
__future__r   r   ÚloggingÚ	threadingÚtypingr   Úagent.lsp.managerr   Ú	getLoggerr/   r   Ú__annotations__r   r   ÚLockr#   r   r   r&   r-   r8   r   Ú__all__)r;   s   @r   Ú<module>rF      s€   øðôõ #ã Û Û Ý å (à	×	Ò	˜;Ó	'€à!%€Ð
Ó %ð Ð �4Ó ØÐ Ø—’Ó €õBõ"õõ4õ:õ:ò Q‚r   