+
    lHàjÖ  ã                  óÚ   € R t ^ RIHt ^ RIt^ RIt^ RIt^ RIHt ^ RIH	t	 ^ RI
Ht Rt^tRtR R	 ltR
 R lt ! R R4      t]! 4       tR R ltR R ltR R ltR R lt]3R R lltR# )uç  Git working-tree probing for the gateway: run git, resolve repo roots, fold linked worktrees.
Probing runs where the gateway runs (covers remote backends). Roots go through a thread-safe
single-flight cache so concurrent identical probes share one ``git`` spawn: positives live for the
process, negatives (not a repo / deleted dir) for ``_NEG_TTL`` â€” hundreds of non-git session cwds
would otherwise re-spawn ``git`` on every sidebar open, while the TTL keeps ``git init`` re-probable.)ÚannotationsN)ÚIterable)ÚThreadPoolExecutor)Úbounded_git_probeg      ø?g      >@c               ó$   € V ^8„  d   QhRRRRRR/# )é   ÚcwdÚstrÚargsÚreturn© )Úformats   "Ú:/home/ubuntu/.hermes/hermes-agent/tui_gateway/git_probe.pyÚ__annotate__r      s&   € ÷ Nñ N�ð N˜Sð N Sñ Nó    c                óŒ   € V '       d&   \         P                  P                  V 4      '       g   R# \        RRV .VO\        R7      # )u¾  ``git -C <cwd> <args>`` â†’ stripped stdout, or ``""`` on any failure. ``bounded_git_probe``
bounds post-kill cleanup on Windows (a killed git's suspended descendant held the pipes).

Uses the shared :func:`bounded_git_probe` so the post-kill cleanup is bounded on Windows â€” a plain
``subprocess.run(timeout=...)`` here deadlocked Desktop session readiness when a killed git left a
suspended descendant holding the pipe handles (issue #68609).
Ú Úgitz-C©Útimeout)ÚosÚpathÚisdirr   Ú_GIT_TIMEOUT)r   r
   s   &*r   Úrun_gitr      s5   € ÷ ”b—g‘g—m‘m C×(Ò(ÙÜ˜e T¨3Ð6°Ð6ÄÔMÐMr   c               ó    € V ^8„  d   QhRRRR/# ©r   r   r	   r   r   )r   s   "r   r   r   %   s   € ÷ dñ d�ð d˜ñ dr   c                óH   € \        V R R4      ;'       g    \        V RRR4      # )Úbranchz--show-currentú	rev-parsez--shortÚHEAD©r   ©r   s   &r   r   r   %   s'   € Ü�3˜Ð"2Ó3×cÐc´w¸sÀKÐQZÐ\bÓ7cÐcr   c                  ó>   € ] tR t^)tRtR R ltR R ltR R ltRtR	# )
Ú
_RootCachezŽThread-safe, single-flight cache of git-root probes: positives live for
the process, negatives for ``_NEG_TTL``; followers wait on the leader.c               ó   € V ^8„  d   QhRR/# ©r   r   ÚNoner   )r   s   "r   r   Ú_RootCache.__annotate__-   s   € ÷ 8ñ 8˜$ñ 8r   c                	ód   € \         P                  ! 4       V n        / V n        / V n        / V n        R # ©N)Ú	threadingÚLockÚ_lockÚ_rootsÚ_negÚ	_inflight©Úselfs   &r   Ú__init__Ú_RootCache.__init__-   s%   € Ü—^’^Ó%ˆŒ
Ø&(ˆŒØ&(ˆŒ	Ø57ˆŽr   c               ó   € V ^8„  d   QhRR/# r&   r   )r   s   "r   r   r(   3   s   € ÷ #ñ #˜Dñ #r   c                	ó  € V P                   ;_uu_ 4        V P                  P                  4        V P                  P                  4        V P                  P                  4        R R R 4       R #   + '       g   i     R # ; ir*   )r-   r.   Úclearr/   r0   r1   s   &r   Ú
invalidateÚ_RootCache.invalidate3   sE   € Ø�Z�Z‹ZØ�K‰K×ÑÔØ�I‰I�O‰OÔØ�N‰N× Ñ Ô"÷ �Z�ZŠZús   •AA.Á.A?	c               ó    € V ^8„  d   QhRRRR/# )r   Úkeyr	   r   r   )r   s   "r   r   r(   9   s   € ÷ ñ ˜3ð ¨#ñ r   c           	     	óì  €  V P                   ;_uu_ 4        V P                  P                  V4      ;p'       d   VuuRRR4       # V P                  P                  V4      pVe3   V\        P
                  ! 4       8”  d    RRR4       R# V P                  V V P                  P                  V4      pVRJ pV'       d$   \        P                  ! 4       ;qPP                  V&   RRR4       X'       g!   XP                  \        R,           R7       EK  Rp V! 4       pV P                   ;_uu_ 4        V'       d   WpP                  V&   M-\        P
                  ! 4       \        ,           V P                  V&   V P                  P                  VR4       RRR4       XP                  4        V#   + '       g   i     LÑ; i  + '       g   i     L5; i  T P                   ;_uu_ 4        T'       d   YpP                  T&   M-\        P
                  ! 4       \        ,           T P                  T&   T P                  P                  TR4       RRR4       M  + '       g   i     M; iXP                  4        i ; i)TNr   g      à?r   )r-   r.   Úgetr/   ÚtimeÚ	monotonicr0   r+   ÚEventÚwaitr   Ú_NEG_TTLÚpopÚset)r2   r;   ÚprobeÚhitÚexpiryÚgateÚleaderÚvalues   &&&     r   ÚresolveÚ_RootCache.resolve9   sŸ  € ØØ——“ØŸ+™+Ÿ/™/¨#Ó.Ð.�3Ö.Ø÷ ’ð Ÿ™Ÿ™ sÓ+�ØÒ%Ø¤§¢Ó 0Ô0Ø!÷ ‘ð Ÿ	™	 #˜Ø—~‘~×)Ñ)¨#Ó.�Ø ˜�ßÜ1:·²Ó1BÐB�DŸ>™>¨#Ñ.÷ ÷ Ø—	‘	¤,°Õ"4�	Ô5ÚØˆEð	Ù›�à—Z—Z“ZßØ+0Ÿ™ CÒ(ä)-¯ªÓ)9¼HÕ)D˜Ÿ	™	 #™Ø—N‘N×&Ñ& s¨DÔ1÷  ð —‘”
ØˆL÷5 —ú÷&  —Zû�T—Z—Z“ZßØ+0Ÿ™ CÒ(ä)-¯ªÓ)9¼HÕ)D˜Ÿ	™	 #™Ø—N‘N×&Ñ& s¨DÔ1÷  —Z—Z�Zúð —‘•
úsO   –%F*Á:F*Â
3F*Â>#F*ÄG Ä/A!F=Æ*F:	Æ=G	ÇI3Ç%A!I	É	I3ÉIÉI3)r0   r-   r/   r.   N)	Ú__name__Ú
__module__Ú__qualname__Ú__firstlineno__Ú__doc__r3   r8   rK   Ú__static_attributes__r   r   r   r$   r$   )   s   † ñNõ8õ#÷ñ r   r$   c               ó   € V ^8„  d   QhRR/# r&   r   )r   s   "r   r   r   [   s   € ÷ ñ �Dñ r   c                 ó.   € \         P                  4        R# )zEDrop cached roots after a known mutation (e.g. a worktree was added).N)Ú_cacher8   r   r   r   r8   r8   [   s   € ä
×ÑÖr   c               ó    € V ^8„  d   QhRRRR/# r   r   )r   s   "r   r   r   `   s   € ÷ dñ d�3ð d˜3ñ dr   c                óL   a € S '       d   \         P                  S V 3R l4      # R# )z=Top-level git repo root for ``cwd`` (``""`` when not a repo).c                 ó   <€ \        S R R4      # )r   z--show-toplevelr!   r"   s   €r   Ú<lambda>Úrepo_root.<locals>.<lambda>b   s   ø€ ¤w¨s°KÐARÔ'Sr   r   )rU   rK   r"   s   fr   Ú	repo_rootr[   `   s   ø€ çX[Œ6�>‰>˜#ÔSÓTÐcÐacÐcr   c               ó    € V ^8„  d   QhRRRR/# r   r   )r   s   "r   r   r   e   s   € ÷ 3ñ 3˜#ð 3 #ñ 3r   c                ó~   a € S '       d   \        S 4      '       g   R# R V 3R llp\        P                  RS  2V4      # )al  The MAIN (common) repo root for ``cwd``, folding linked worktrees: ``--show-toplevel`` is a
linked worktree's OWN root; the parent of the shared ``--git-common-dir`` is the one true root
(fallback: toplevel). Normalized to git's forward-slash spelling so it compares equal to
:func:`repo_root` (native ``\`` on Windows made the main checkout look like a worktree).r   c               ó   € V ^8„  d   QhRR/# )r   r   r	   r   )r   s   "r   r   Ú&common_repo_root.<locals>.__annotate__o   s   € ÷ ñ �Cñ r   c                 óF  <€ \        SR RR4      p V '       d�   \        P                  P                  V 4      p \        P                  P	                  V 4      R8X  d>   \        P                  P                  V 4      P                  \        P                  R4      # \        S4      # )r   z--path-format=absolutez--git-common-dirz.gitÚ/)	r   r   r   ÚrealpathÚbasenameÚdirnameÚreplaceÚsepr[   )Úgitdirr   s    €r   Ú_probeÚ common_repo_root.<locals>._probeo   sq   ø€ Ü˜˜kÐ+CÐEWÓXˆßÜ—W‘W×%Ñ% fÓ-ˆFÜ�w‰w×Ñ Ó'¨6Ô1Ü—w‘w—‘ vÓ.×6Ñ6´r·v±v¸sÓCÐCÜ˜‹~Ðr   zcommon:)r[   rU   rK   )r   rh   s   f r   Úcommon_repo_rootrj   e   s6   ø€ ÷ ”i —n’nÙ÷ð ô �>‰>˜G C 5˜/¨6Ó2Ð2r   c               ó    € V ^8„  d   QhRRRR/# )r   r   r	   r   zdict | Noner   )r   s   "r   r   r   z   s   € ÷ añ a�ð a˜ñ ar   c                ó^   € \        V 4      pV'       g   R# R\        V 4      ;'       g    TRV/# )zªInject-able resolver for ``project_tree.build_tree``: ``{repo_root: <common root>,
worktree_root: <this checkout>}`` or None outside a repo (equal roots = main checkout).Nr[   Úworktree_root)r[   rj   )r   rm   s   & r   rK   rK   z   s1   € ô ˜c“N€MßÙØÔ)¨#Ó.×?Ð?°-ÀÐR_Ð`Ð`r   c               ó$   € V ^8„  d   QhRRRRRR/# )r   ÚcwdszIterable[str]Úmax_workersÚintr   r'   r   )r   s   "r   r   r   ƒ   s!   € ÷ -ñ -�]ð -°ð -Èñ -r   c                ó¦  € \        V  Uu0 uF  q";'       g    RP                  4       kK  	  upR0,
          4      p\        V4      ^8X  d   \        V^ ,          4       R# V'       dR   \	        \        V\        V4      4      R7      ;_uu_ 4       p\        VP                  \        V4      4       RRR4       R# R# u upi   + '       g   i     R# ; i)z”Pre-resolve many cwds' roots in parallel (bounded) so a cold first paint
doesn't serialize one git spawn per session cwd; results land in the cache.r   )rp   N)ÚsortedÚstripÚlenrK   r   ÚminÚlistÚmap)ro   rp   r   ÚpendingÚpools   &&   r   Ú
warm_rootsr{   ƒ   s—   € ô ±TÓ:±T¨c—y�y˜b×'Ñ'Ö)±TÑ:¸b¸TÕAÓB€GÜ
ˆ7ƒ|�qÔÜ�˜•
Öß	Ü¬C°¼SÀ»\Ó,J×KÕKÈtÜ�—‘œ' 7Ó+Ô,÷ LÑKñ 
ùò ;÷ L×KÐKús   ŠB:—B:Â B?Â?C	)rQ   Ú
__future__r   r   r+   r>   Úcollections.abcr   Úconcurrent.futuresr   Úhermes_cli._subprocess_compatr   r   Ú_WARM_WORKERSrB   r   r   r$   rU   r8   r[   rj   rK   r{   r   r   r   Ú<module>r�      sw   ðñiõ #ã 	Û Û Ý $Ý 1å ;à€Ø€Ø€õNõd÷,ñ ,ñ^ 
‹€õõ
dõ
3õ*að 8E÷ -ñ -r   