+
    iHàj�$  ã                  ó$  a € 0 t $ R t^ RIHt ^ RIt^ RIt^ RIt^ RIHtH	t	H
t
 ]P                  ! R4      t]P                  ! 4       tRt]! 4       tR]R&   ]! 4       tR]R&   ]! 4       tR]R	&   ]! 4       tR]R
&   ]! 4       tR]R&   ]! 4       tR]R&   ]]]]]]3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 R ltR R lt R R lt!R3R R  llt"R! R" lt#R# R$ lt$R4R% R& llt%R'R(/R) R* llt&R+ R, lt'R- R. lt(R/ R0 lt)R1 R2 lt*. R5Ot+R# )6a4  Structured logging with steady-state silence for the LSP layer.

LSP fires on every write_file/patch, so the level model keeps ``agent.log`` greppable
(``rg 'lsp\['``) without noise: DEBUG for steady-state events with no novel signal (clean,
skipped, repeat "no project root" / "server unavailable"); INFO for once-per-session
transitions (first ``active for <root>``, first ``no project root`` per file) and every
diagnostic event; WARNING for action-required failures (first ``server unavailable`` per
(server_id, binary), every timeout / unexpected error).  Dedup uses module-level sets bounded
by the distinct pairs touched in one process, each capped at ``_ANNOUNCE_CAP`` keys: past it the
bucket resets and the first-seen line re-fires once, so per-file keys can't grow for the life of
a gateway process (#62950).
)ÚannotationsN)ÚListÚOptionalÚTuplezhermes.lint.lspi   ÚsetÚ_announced_activeÚ_announced_unavailableÚ_announced_no_rootÚ_announced_skippedÚ_announced_excludedÚ_announced_untrustedc               ó    € V ^8„  d   QhRRRR/# )é   Ú	file_pathÚstrÚreturn© )Úformats   "Ú7/home/ubuntu/.hermes/hermes-agent/agent/lsp/eventlog.pyÚ__annotate__r   $   s   € ÷ 
Nñ 
N˜3ð 
N 3ñ 
Nó    c                óö   € V '       g   V #  \         P                  P                  V 4      pTP                  R\         P                  ,           4      '       g   TR8X  d   T # T#   \        \        3 d    T u # i ; i)z\Render *file_path* relative to cwd when it's inside it, else absolute (no ``../..`` chains).z..)ÚosÚpathÚrelpathÚ
ValueErrorÚOSErrorÚ
startswithÚsep)r   Úrels   & r   Ú_short_pathr    $   si   € çØÐðÜ�g‰g�o‰o˜iÓ(ˆð
 Ÿ™ t¬b¯f©f¥}×5Ò5¸À¼ˆ9ÐMÈ#ÐMøô	 œÐ ô ð Òðús   ŒA" Á"A8Á7A8c               ó(   € V ^8„  d   QhRRRRRRRR/# )r   Ú	server_idr   ÚlevelÚintÚmessager   ÚNoner   )r   s   "r   r   r   1   s(   € ÷ ;ñ ;�Sð ; ð ;¨sð ;°tñ ;r   c                ó4   € \         P                  VR W4       R# )z
lsp[%s] %sN)Ú	event_logÚlog)r"   r#   r%   s   &&&r   Ú_emitr*   1   s   € Ü‡M�M�%˜ yÖ:r   c               ó4   € V ^8„  d   QhRRRRRRRRR	RR
RRR/# )r   Úbucketr   ÚkeyÚtupler"   r   r#   r$   ÚfirstÚrepeatr   r&   r   )r   s   "r   r   r   5   sH   € ÷ Zñ Z�sð Z ð Z°3ð Z¸sð ZÈ3ð ZÐX[ð ZÐ`dñ Zr   c                óF  € \         ;_uu_ 4        W9  pV'       d%   \        V 4      \        8¼  d   V P                  4        V P	                  V4       RRR4       \        TX'       d   TM\        P                  V'       d	   V4       R# T4       R#   + '       g   i     LG; i)zRLog *first* at *level* the first time *key* is seen, *repeat* at DEBUG thereafter.N)Ú_announce_lockÚlenÚ_ANNOUNCE_CAPÚclearÚaddr*   ÚloggingÚDEBUG)r,   r-   r"   r#   r/   r0   Úis_firsts   &&&&&& r   Ú
_emit_oncer:   5   s\   € ç	ŽØÑ$ˆßœ˜F›¤}Ô4Ø�L‰LŒNØ�
‰
�3Œ÷	 
ô
 
ˆ)Ÿh‘U¬G¯M©MÇH¸5ÖYÐRXÖY÷ 
�ús   �ABÂB 	c               ó$   € V ^8„  d   QhRRRRRR/# ©r   r"   r   r   r   r&   r   )r   s   "r   r   r   B   s&   € ÷ Iñ I˜ð I¨ð I°ñ Ir   c                óV   € \        V \        P                  R\        V4       R24       R# )z/No diagnostics emitted for *file_path*.  DEBUG.zclean (Ú)N©r*   r7   r8   r    )r"   r   s   &&r   Ú	log_cleanr@   B   s!   € ä	ˆ)”W—]‘] g¬k¸)Ó.DÐ-EÀQÐ$GÖHr   c               ó(   € V ^8„  d   QhRRRRRRRR/# )r   r"   r   r   Úreasonr   r&   r   )r   s   "r   r   r   G   s.   € ÷ Uñ U˜Cð U¨Cð U¸ð UÀñ Ur   c           
     ó\   € \        V \        P                  RV R\        V4       R24       R# )zQLSP intentionally skipped for this file (feature off, ext unmapped, ...).  DEBUG.z	skipped: ú (r>   Nr?   )r"   r   rB   s   &&&r   Úlog_disabledrE   G   s(   € ä	ˆ)”W—]‘] i°¨x°r¼+ÀiÓ:PÐ9QÐQRÐ$SÖTr   c               ó$   € V ^8„  d   QhRRRRRR/# )r   r"   r   Úworkspace_rootr   r&   r   )r   s   "r   r   r   L   s&   € ÷ Vñ V˜#ð V¨sð V°tñ Vr   c           	     óX   € \        \        W3V \        P                  RV 2RV 24       R# )zXA client started for (server_id, workspace_root).  INFO once per pair, DEBUG thereafter.zactive for zreused client for N)r:   r   r7   ÚINFO)r"   rG   s   &&r   Ú
log_activerJ   L   s1   € äÔ  9Ð"=¸yÌ'Ï,É,Ø˜^Ð,Ð-Ð1CÀNÐCSÐ/TöVr   c               ó(   € V ^8„  d   QhRRRRRRRR/# )r   r"   r   r   Úcountr$   r   r&   r   )r   s   "r   r   r   R   s.   € ÷ Pñ P˜sð P¨sð P¸3ð PÀ4ñ Pr   c           	     óZ   € \        V \        P                  V R\        V4       R24       R# )u[   Diagnostics arrived for a file.  INFO every time â€” rare per edit and what users grep for.z diags (r>   N)r*   r7   rI   r    )r"   r   rL   s   &&&r   Úlog_diagnosticsrN   R   s%   € ä	ˆ)”W—\‘\ e W¨H´[ÀÓ5KÐ4LÈAÐ#NÖOr   c               ó$   € V ^8„  d   QhRRRRRR/# r<   r   )r   s   "r   r   r   W   s&   € ÷ ^ñ ^ 3ð ^°3ð ^¸4ñ ^r   c                óf   € R\        V4       2p\        \        W3V \        P                  W"4       R# )zMFile had no recognised project marker.  INFO once per file, DEBUG thereafter.zno project root for N)r    r:   r	   r7   rI   )r"   r   Úmsgs   && r   Úlog_no_project_rootrR   W   s-   € à ¤¨YÓ!7Ð 8Ð
9€CÜÔ! IÐ#9¸9ÄgÇlÁlÐTWÖ]r   c               ó$   € V ^8„  d   QhRRRRRR/# )r   r"   r   Úbinary_or_pkgr   r&   r   )r   s   "r   r   r   ]   s!   € ÷ ñ  cð ¸#ð À$ñ r   c           	     óZ   € \        \        W3V \        P                  RV R2RV 24       R# )zRServer binary unresolved.  WARNING once per (server_id, binary), DEBUG thereafter.zserver unavailable: zR not found (install via `hermes lsp install <id>` or set lsp.servers.<id>.command)zserver still unavailable: N)r:   r   r7   ÚWARNING)r"   rT   s   &&r   Úlog_server_unavailablerW   ]   s7   € äÜ Ð :¸IÄwÇÁØ
˜}˜oð .Rð 	Rà
$ ] OÐ4ö	r   c               ó(   € V ^8„  d   QhRRRRRRRR/# )r   r"   r   r   Úkindr   r&   r   )r   s   "r   r   r   g   s.   € ÷ Xñ X˜3ð X¨3ð X°cð XÈdñ Xr   c           	     óX   € \        V \        P                  V R\        V4       24       R# )z7A request to the server timed out.  WARNING every time.z timed out for N)r*   r7   rV   r    )r"   r   rY   s   &&&r   Úlog_timeoutr[   g   s#   € ä	ˆ)”W—_‘_¨¨¨o¼kÈ)Ó>TÐ=UÐ&VÖWr   c               ó(   € V ^8„  d   QhRRRRRRRR/# )r   r"   r   r   ÚexcÚBaseExceptionr   r&   r   )r   s   "r   r   r   l   s.   € ÷ uñ u ð u°ð u¸-ð uÈDñ ur   c           
     ó†   € \        V \        P                  R\        V4       R\	        V4      P
                   RV 24       R# )z?An unexpected exception bubbled out of the LSP layer.  WARNING.zunexpected error for ú: N)r*   r7   rV   r    ÚtypeÚ__name__)r"   r   r]   s   &&&r   Úlog_server_errorrc   l   s>   € ä	ˆ)”W—_‘_Ð(=¼kÈ)Ó>TÐ=UÐUWÔX\Ð]`ÓXa×XjÑXjÐWkÐkmÐnqÐmrÐ&sÖtr   c               ó(   € V ^8„  d   QhRRRRRRRR/# )r   r"   r   rG   r]   r^   r   r&   r   )r   s   "r   r   r   q   s/   € ÷ tñ t ð t°Sð t¸}ð tÐQUñ tr   c           
     ót   € \        V \        P                  RV R\        V4      P                   RV 24       R# )z7The LSP server failed to spawn or initialize.  WARNING.zspawn/initialize failed for r`   N)r*   r7   rV   ra   rb   )r"   rG   r]   s   &&&r   Úlog_spawn_failedrf   q   s9   € ä	ˆ)”W—_‘_Ð(DÀ^ÐDTÐTVÔW[Ð\_ÓW`×WiÑWiÐVjÐjlÐmpÐlqÐ&rÖsr   c          
     ó,   € V ^8„  d   QhRRRRRRRRRR/# )	r   r"   r   rG   r   Úretry_inzOptional[float]r   r&   r   )r   s   "r   r   r   v   s8   € ÷ Uñ U #ð U°sð UÀsð UÐVeð UÐquñ Ur   c                ó¬   € Ve   RVR R2MRp\        \        W3V \        P                  R\	        V4       RV RV R	2R\	        V4       RV R
24       R# )a/  A request was skipped because ``(server_id, root)`` is marked broken.  INFO once per root, then DEBUG:
at default log levels a skipped file and a clean file otherwise look identical (``log_clean`` is DEBUG).
``retry_in`` (seconds, from ``lsp.broken_retry_seconds``) names when the pair gets another try.Nz	retry in ú.0fÚsz*no diagnostics for this root until restartú	skipping r`   z) marked broken after an earlier failure (r>   z marked broken)r:   r
   r7   rI   r    )r"   rG   r   rh   Úuntils   &&&& r   Úlog_skipped_brokenrn   v   sq   € ð ,4Ò+?ˆi˜ �~ QÑ'ÐEq€EÜÔ! IÐ#>À	Ì7Ï<É<Øœ; yÓ1Ð2°"°^Ð4DÐDmÐnsÐmtÐtuÐvØœ; yÓ1Ð2°"°^Ð4DÀNÐSöUr   ÚinvalidFc          
     ó,   € V ^8„  d   QhRRRRRRRRRR/# )	r   r"   r   rG   r   ro   Úboolr   r&   r   )r   s   "r   r   r   €   s8   € ÷ Pñ P ð P°cð PÀcð PÐW[ð PÐhlñ Pr   c               ó¨   € V'       d   RMRp\        \        W3V \        P                  R\	        V4       RV RV 2R\	        V4       RV R24       R# )uæ   ``workspace_root`` matches ``lsp.exclude_roots`` (or the key is malformed and every root is skipped).
INFO once per root â€” a deliberate gate must still be visible, or an excluded file looks like a clean one â€”
DEBUG thereafter.z-lsp.exclude_roots is not a list (fix the key)zmatches lsp.exclude_rootsrl   r`   Ú z	 excludedN)r:   r   r7   rI   r    )r"   rG   r   ro   Úwhys   &&&$ r   Úlog_root_excludedru   €   s_   € ÷ >EÑ
9ÐJe€CÜÔ" YÐ$?ÀÌGÏLÉLØœ; yÓ1Ð2°"°^Ð4DÀAÀcÀUÐKØœ; yÓ1Ð2°"°^Ð4DÀIÐNöPr   c               ó(   € V ^8„  d   QhRRRRRRRR/# )r   r"   r   rG   r   r   r&   r   )r   s   "r   r   r   Š   s/   € ÷ Añ A Sð A¸#ð AÈ#ð AÐRVñ Ar   c                ór   € \        \        W3V \        P                  RV R\	        V4       R2RV 24       R# )z´``server_id`` is not safe in an untrusted workspace and ``workspace_root`` is not trusted.
INFO once per root (a deliberate gate must not look like a clean file), DEBUG thereafter.zskipped: untrusted workspace rD   z<); add it to lsp.trusted_workspaces to run this server thereN)r:   r   r7   rI   r    )r"   rG   r   s   &&&r   Úlog_untrusted_skippedrx   Š   sI   € ô Ô# iÐ%@À)ÌWÏ\É\Ø.¨~Ð.>¸bÄÈYÓAWÐ@Xð YKð Kà.¨~Ð.>Ð?öAr   c               ó$   € V ^8„  d   QhRRRRRR/# )r   Úkeysúlist[tuple[str, str]]Úidle_timeoutÚfloatr   r&   r   )r   s   "r   r   r   “   s'   € ÷ 	mñ 	mÐ*ð 	m¸%ð 	mÀDñ 	mr   c           
     ó  € \         ;_uu_ 4        \        P                  V 4       RRR4       RP                  R V  4       4      p\	        R\
        P                  R\        V 4       RVR RV 24       R#   + '       g   i     LX; i)	zÃIdle clients were reaped.  INFO, one line per sweep.

Also forgets the ``log_active`` announcement for those keys so a respawn
re-announces at INFO instead of a misleading DEBUG "reused client".
Nú, c              3  ó6   "  € T F  w  rV R V R2x € K  	  R# 5i©rD   r>   Nr   ©Ú.0ÚsidÚroots   &  r   Ú	<genexpr>Úlog_reaped.<locals>.<genexpr>›   ó   é € Ð@¹4©i¨c˜3˜%˜r $  qÕ)»4ùó   ‚Úreaperzreaped z idle client(s) after rj   zs: ©r2   r   Údifference_updateÚjoinr*   r7   rI   r3   )rz   r|   Úsummarys   && r   Ú
log_reapedr�   “   sg   € ÷ 
ŽÜ×+Ñ+¨DÔ1÷ 
à�i‰iÑ@¹4Ó@Ó@€GÜ	ˆ(”G—L‘L G¬C°«I¨;Ð6LÈ\ÐZ]ÐL^Ð^aÐbiÐajÐ"kÖl÷ 
�ús   �A5Á5B	c               ó$   € V ^8„  d   QhRRRRRR/# )r   rz   r{   rB   r   r   r&   r   )r   s   "r   r   r   Ÿ   s'   € ÷ [ñ [Ð,ð [°cð [¸dñ [r   c           
     ó  € \         ;_uu_ 4        \        P                  V 4       RRR4       RP                  R V  4       4      p\	        R\
        P                  R\        V 4       RV RV 24       R#   + '       g   i     LW; i)z¸Clients were shut down because their workspace went away (worktree released or root deleted).
INFO, one line per event; forgets the ``log_active`` announcement like :func:`log_reaped`.Nr   c              3  ó6   "  € T F  w  rV R V R2x € K  	  R# 5ir�   r   r‚   s   &  r   r†   Úlog_released.<locals>.<genexpr>¤   rˆ   r‰   rŠ   z	released z client(s) (z): r‹   )rz   rB   rŽ   s   && r   Úlog_releasedr”   Ÿ   s`   € ÷ 
ŽÜ×+Ñ+¨DÔ1÷ 
à�i‰iÑ@¹4Ó@Ó@€GÜ	ˆ(”G—L‘L I¬c°$«i¨[¸ÀVÀHÈCÐPWÈyÐ"YÖZ÷ 
�ús   �A4Á4B	c               ó   € V ^8„  d   QhRR/# )r   r   r&   r   )r   s   "r   r   r   ¨   s   € ÷ ñ ˜tñ r   c                 ó–   € \         ;_uu_ 4        \         F  p V P                  4        K  	  RRR4       R#   + '       g   i     R# ; i)zETest-only: clear the dedup caches.  Production code never calls this.N)r2   Ú_ALL_BUCKETSr5   )r,   s    r   Úreset_announce_cachesr˜   ¨   s&   € ç	Žß"ˆFØ�L‰LŽNñ #÷ 
��Šús	   �7·A	)Údiagnostics)N)r(   rJ   r@   rN   rE   rR   r�   ru   rc   rW   rn   rf   r[   rx   r˜   ),Ú__conditional_annotations__Ú__doc__Ú
__future__r   r7   r   Ú	threadingÚtypingr   r   r   Ú	getLoggerr(   ÚLockr2   r4   r   r   Ú__annotations__r   r	   r
   r   r   r—   r    r*   r:   r@   rE   rJ   rN   rR   rW   r[   rc   rf   rn   ru   rx   r�   r”   r˜   Ú__all__)rš   s   @r   Ú<module>r£      s#  øðôõ #ã Û 	Û ß (Ñ (ð ×ÒÐ/Ó0€	à—’Ó!€Ø€Ù›Ð �3Ó Ù!›eÐ ˜Ó #Ù›%Ð �CÓ Ù›%Ð �CÓ Ù›5Ð �SÓ  Ù›EÐ �cÓ !Ø!Ð#9Ð;MÐOaÐcvØ$ð&€õ
Nõ;õZõIõ
Uõ
VõPõ
^õ÷Xõ
uõ
t÷
UðPÐ^c÷ PõAõ	mõ[õò‚r   