+
    „WÝjë  ã                   óä  € 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t^ RIt^ RIt^ RIHt ^ RIHtHt ^ RIHtHt ^ RIHt ^ RIHt ]P4                  ! R4      tR R	 ltRwR
 R lltRwR R lltRxR R lltR R lt R R lt!R R lt"R R lt#R R lt$^t%Rt&Ryt'Rt(R R lt)R R lt*R  R! lt+RzR" R# llt,R$ R% lt-R& R' lt.R( R) lt/R* R+ lt0R{R, R- llt1R|t2R}t3R~R. R/ llt4R~R0 R1 llt5RwR2 R3 llt6R4 R5 lt7RwR6 R7 llt8R~R8 R9 llt9RR: R; llt:R<t;R= R> lt<R? R@ lt=RA RB lt>R€RC RD llt?RE RF lt@R�RG RH lltAR‚RI RJ lltBRwRK RL lltC]Pˆ                  ! RM]PŠ                  4      tFRN RO ltGRP RQ ltHRRtIRS RT ltJRU RV ltKRWRX/RY RZ lltLR[ R\ ltMRwR] R^ lltNRƒtOR_ R` ltPRa Rb ltQRc Rd ltRReRfRgRh/tSRi Rj ltTRk Rl ltUR„Rm Rn lltVRo Rp ltWRq Rr ltXRs Rt ltYR…Ru Rv lltZR# )†aI  Git worktree isolation for ``hermes -w`` sessions: create, classify, prune.

Every git call goes through ``_git``/``_git_out``/``_git_quiet`` (UTF-8 text, captured,
bounded timeout). Classification helpers fail SAFE toward "preserve". ``cli`` re-exports
these names; ``_cprint`` is imported lazily from ``cli`` to avoid a cycle.
N©ÚPath)ÚDictÚOptional)Úkill_process_treeÚnoninteractive_git_env©Úget_hermes_home)Úatomic_json_writeÚclic                ó(   € V ^8„  d   QhR\         RR/# )é   ÚtextÚreturnN©Ústr)Úformats   "ÚKC:\Users\johnn\AppData\Local\hermes\hermes-agent\hermes_cli\worktree_ops.pyÚ__annotate__r      s   € ÷ ñ ”#ð ˜$ñ ó    c                 ó"   € ^ RI Hp V! V 4       R# )é    )Ú_cprintN)r   r   )r   Ú_impls   & r   r   r      s   € Ý$Ù	ˆ$†Kr   c                ó$   € V ^8„  d   QhR\         /# ©r   Útimeout©Úfloat)r   s   "r   r   r   "   s   € ÷ Pñ PœUñ Pr   c                óN   € \         P                  ! R.V O3RRRRRRRRR	VR
V/VB # )zPRun ``git *args`` in *cwd* capturing UTF-8 text; raises like ``subprocess.run``.ÚgitÚcapture_outputTr   Úencodingúutf-8ÚerrorsÚreplacer   Úcwd)Ú
subprocessÚrun)Úargsr&   r   Úkwargss   &&&,r   Ú_gitr+   "   sZ   € ä�>Š>˜5˜. 4˜.ñ P¸ð PÀDð PÐSZð PØ!*ðPØ4;ðPØADðPØHNñPð Pr   c                óF   € V ^8„  d   QhR\         R\        \        ,          /# )r   r   r   )r   r   r   )r   s   "r   r   r   (   s"   € ÷ Eñ E¤ð E¼(Ä3½-ñ Er   c                óx   € \        W3RV/VB pVP                  ^ 8X  d   VP                  P                  4       # R# )zU``_git`` returning stripped stdout, or None on a non-zero exit. Raises like ``_git``.r   N)r+   Ú
returncodeÚstdoutÚstrip)r)   r&   r   r*   Úresults   &&&, r   Ú_git_outr2   (   s;   € ä�$Ñ7 WÐ7°Ñ7€FØ$*×$5Ñ$5¸Ô$:ˆ6�=‰=×ÑÓ ÐDÀÐDr   c                óB   € V ^8„  d   QhR\         R\        R,          RR/# )r   r   ÚlogNr   )r   r   )r   s   "r   r   r   .   s&   € ÷ +ñ +¤5ð +´C¸$µJð +ÐTXñ +r   c                óž   €  \        W3RV/VB  R#   \         d0   pT'       d   \        P                  RY54        Rp?R#  Rp?R# Rp?ii ; i)z]Fail-soft ``_git``: swallow every error, optionally logging it at DEBUG with *log* as prefix.r   z%s: %sN)r+   Ú	ExceptionÚloggerÚdebug)r)   r&   r   r4   r*   Úes   &&&&, r   Ú
_git_quietr:   .   sB   € ð+ÜˆTÑ2 Ð2¨6Ô2øÜô +ßÜ�L‰L˜ 3×*Ò*õ ûð+ús   ‚ ’A�AÁAc                ó\   € V ^8„  d   QhR\         \        ,          R\         \        ,          /# )r   Úpr   ©r   r   )r   s   "r   r   r   7   s"   € ÷ ñ ¤¬¥ð ´(¼3µ-ñ r   c                ó  € V '       d   \         P                  R8w  d   V # \        P                  ! RV 4      pV'       dM   VP	                  ^4      P                  4        RVP	                  ^4      P                  R\        ^\4      4       2# V # )zaTranslate a Git Bash path (``/c/..``, ``/cygdrive/c/..``, ``/mnt/c/..``) to ``C:\..`` on Windows.Úwin32z(^/(?:(?:cygdrive|mnt)/)?([a-zA-Z])/(.*)$z:\Ú/)ÚsysÚplatformÚreÚmatchÚgroupÚupperr%   Úchr)r<   Úms   & r   Ú_normalize_git_bash_pathrI   7   sk   € ç”—‘ Ô'ØˆÜ
�ŠÐ<¸aÓ@€AßØ—'‘'˜!“*×"Ñ"Ó$Ð% S¨¯©°«×);Ñ);¸CÄÀRÃÓ)IÐ(JÐKÐKØ€Hr   c                ó:   € V ^8„  d   QhR\         \        ,          /# ©r   r   r=   )r   s   "r   r   r   A   s   € ÷ ñ œ¤�ñ r   c                 óZ   €  \        \        RR.R^R7      4      #   \         d     R# i ; i)zQReturn the git repo root for CWD (Git-Bash-normalized), or None if not in a repo.ú	rev-parsez--show-toplevelN©r   )rI   r2   r6   © r   r   Ú_git_repo_rootrP   A   s5   € ðÜ'¬°+Ð?PÐ1QÐSWÐabÔ(cÓdÐdøÜô Úðús   ‚ ›*©*c                ó<   € V ^8„  d   QhR\         R\         R\        /# )r   ÚpathÚrootr   ©r   Úbool)r   s   "r   r   r   I   s!   € ÷ ñ œtð ¬4ð ´Dñ r   c                óN   €  V P                  V4       R#   \         d     R# i ; i)z@Return True when a resolved path stays within the expected root.TF)Úrelative_toÚ
ValueError)rR   rS   s   &&r   Ú_path_is_within_rootrY   I   s*   € ðØ×Ñ˜ÔÙøÜô Úðús   ‚ •$£$c                ó(   € V ^8„  d   QhR\         RR/# )r   Úwt_pathr   Nr   )r   s   "r   r   r   R   s   € ÷ Kñ K¤ð K¨ñ Kr   c                ó‚   €  ^ RI Hp V! V 4       R#   \         d"   p\        P	                  RY4        Rp?R# Rp?ii ; i)aS  Shut down this process's language servers for ``wt_path`` before ``git worktree remove``.

A gateway outlives the sessions it runs, so without this the ``(server, root)`` client for the
removed tree stays registered (tsserver heaps of several GiB pointed at a deleted worktree).
Best-effort: LSP trouble must never block worktree removal.
)Úrelease_workspacez&LSP release for worktree %s failed: %sN)Ú	agent.lspr]   r6   r7   r8   )r[   r]   r9   s   &  r   Úrelease_lsp_clientsr_   R   s7   € ðKÝ/Ù˜'Ö"øÜô KÜ�‰Ð=¸w×JÒJûðKús   ‚ ’>�9¹>c                ó@   € V ^8„  d   QhR\         R\        R\         RR/# )r   Ú	repo_rootr[   Úbranch_namer   N©r   r   )r   s   "r   r   r   `   s/   € ÷ Añ A¬Cð A¼$ð AÌSð AÐUYñ Ar   c                óÎ  €  \        RR\        V4      .V ^R7       \        RRR\        V4      .V ^R7       VP                  4       '       d   \        P                  ! VRR7       \        RR.V ^\
        P                  \        4       R	7       \        R
RV.V ^\
        P                  \        4       R	7       R#   \         d"   p\        P                  RT4        Rp?R# Rp?ii ; i)a6  Sweep the leftovers of a failed/timed-out ``git worktree add`` (fail-soft).

``worktree add`` is not transactional: killed mid-checkout it leaves the partial dir, a
LOCKED admin entry naming the *live* pid (immune to the pruner's dead-pid unlock) and
sometimes the branch, so any retry of the same name fails.
ÚworktreeÚunlockrN   Úremoveú--forceT)Úignore_errorsÚprune©r   ÚstdinÚenvÚbranchú-Dz%cleanup after failed worktree add: %sN)r:   r   ÚexistsÚshutilÚrmtreer'   ÚDEVNULLr   r6   r7   r8   )ra   r[   rb   r9   s   &&& r   Ú_cleanup_failed_worktree_addrt   `   sÂ   € ðAä�J ¬#¨g«,Ð7¸ÈBÕOÜ�J ¨)´S¸³\ÐBÀIÐWYÕZØ�>‰>×ÒÜ�MŠM˜'°Õ6ä�J Ð(¨)¸RÜ#×+Ñ+Ô1GÓ1Iõ	Kô 	�H˜d KÐ0°)ÀRÜ#×+Ñ+Ô1GÓ1I÷	Køäô AÜ�‰Ð<¸a×@Ò@ûðAús   ‚B4B8 Â8C$ÃCÃC$i  zhermes-repack.lockc                ó0   € V ^8„  d   QhR\         R\        /# )r   Úgit_dirr   rT   )r   s   "r   r   r   €   s   € ÷ ñ ¤ð ¬ñ r   c                óú  € V \         ,          p VP                  4       p\        P                  ! 4       VP                  ,
          \        8  d   R#  VP                  VP                  R4      4        \        P                  ! T\        P                  \        P                  ,          \        P                  ,          4      p\        P                  ! TRRR7      ;_uu_ 4       pTP!                  \        P"                  ! 4        R24       RRR4       TP                  R4      P%                  RR	7       R#   \         d     R# i ; i  \         d     Lãi ; i  \         d     R# i ; i  + '       g   i     Lh; i)
u|  Exactly one process per clone gets to repack per ``_REPACK_MIN_INTERVAL``.

The lock file's mtime is the stamp: younger than the interval means another launch is
repacking (or just tried and timed out) â€” skip. A stale lock is taken over by ``replace``,
which only one of N racing processes can win; the O_EXCL create then serializes against a
process that found no lock at all.
Fz.staleÚwr#   ©r"   Ú
NT)Ú
missing_ok)Ú_REPACK_LOCKÚstatÚtimeÚst_mtimeÚ_REPACK_MIN_INTERVALr%   Úwith_suffixÚOSErrorÚFileNotFoundErrorÚosÚopenÚO_CREATÚO_EXCLÚO_WRONLYÚFileExistsErrorÚfdopenÚwriteÚgetpidÚunlink)rv   ÚlockÚstÚfdÚfhs   &    r   Ú_claim_repack_slotr’   €   s  € ð ”\Õ!€Dð
Ø�Y‰Y‹[ˆô �9Š9‹;˜Ÿ™Õ$Ô';Ô;Ùð	Ø�L‰L˜×)Ñ)¨(Ó3Ô4ðÜ�WŠW�Tœ2Ÿ:™:¬¯	©	Õ1´B·K±KÕ?Ó@ˆô 
�Š�2�s W×	-Õ	-°Ø
�‰”B—I’I“K�= Ð#Ô$÷ 
.à×Ñ�XÓ×%Ñ%°Ð%Ô6Ùøô ô 	Úð	ûô ô Ùðûô ô Úðúç	-×	-úsB   �E Á D5 Á2AE Ã"(E*Ä5EÅEÅEÅEÅE'Å&E'Å*E:	c                ó(   € V ^8„  d   QhR\         RR/# ©r   ra   r   Nr   )r   s   "r   r   r   ž   s   € ÷ |ñ |¤3ð |¨4ñ |r   c                ó  a€ . ROp\         P                  R8X  d   . ROVOpR^ /pMR\        \        R^ 4      /p\        P                  ! V3RV R\        P
                  R\        P
                  R\        P
                  /VB oR	 V3R
 llp\        P                  ! V4        SP                  \        R7       R#   \        P                   d2    T! 4        \        P                  R\        \        R,          4        R# i ; i)aP  Incremental geometric repack whose whole process tree dies with the timeout or with us.

``repack`` forks ``pack-objects``; ``subprocess.run(timeout=)`` killed only the parent and
left the grandchild packing for days, and a daemon thread's child outlived the CLI the same
way. A new session/process group + ``atexit`` reaps both cases.
ÚposixÚprocess_groupÚcreationflagsÚCREATE_NEW_PROCESS_GROUPr&   rl   r/   Ústderrc                ó   € V ^8„  d   QhRR/# ©r   r   NrO   )r   s   "r   r   Ú)_run_bounded_repack.<locals>.__annotate__®   s   € ÷ $ñ $�4ñ $r   c                  óF   <€ S P                  4       f   \        S 4       R # R # ©N)Úpollr   )Úprocs   €r   Ú_reapÚ"_run_bounded_repack.<locals>._reap®   s   ø€ Ø�9‰9‹;ÒÜ˜dÖ#ñ r   rN   z5git repack exceeded %ds; killed (next attempt in %dh)é  N)r    Úrepackz-dz--geometric=2z--write-midxú--quiet)Únicez-nÚ19)r„   ÚnameÚgetattrr'   ÚPopenrs   ÚatexitÚregisterÚwaitÚ_REPACK_TIMEOUTÚTimeoutExpiredr7   Úinfor€   )ra   ÚcmdÚgroup_kwr¢   r¡   s   &   @r   Ú_run_bounded_repackr´   ž   sð   ø€ ò N€CÜ	‡w�w�'ÔÚ( CÐ(ˆØ)¨1Ð-‰à#¤W¬ZÐ9SÐUVÓ%WÐXˆÜ×Ò˜Cñ C Yð C´j×6HÑ6Hð CÔQ[×QcÑQcð CÜ#-×#5Ñ#5ðCØ9AñC€D÷$ð $ô ‡O‚O�EÔð|Ø�	‰	œ/ˆ	Ö*øÜ×$Ñ$ô |ÙŒÜ�‰ÐKÌ_Ô^rÐvzÕ^z×{ð|ús   Â"B: Â:AD Ã?D c                ó(   € V ^8„  d   QhR\         RR/# r”   r   )r   s   "r   r   r   º   s   € ÷ 8ñ 8¤Sð 8¨Tñ 8r   c           	     óF  €  \        V 4      R,          R,          R,          pVP                  4       '       g   R# \        \        VP	                  R4      4      4      pV\
        8  d   R# \        VP                  P                  4      '       g   R# ^ RIH	p V! \        V 4      4       \        P                  RV4       \        V 4       \        RR	.V ^<R
\        P                  \!        4       R7       R#   \"         d"   p\        P%                  RT4        Rp?R# Rp?ii ; i)zõRepack the object store when pack files sprawl (background thread, fail-soft).

``gc --auto`` only fires at 50 packs; past a few dozen, every object lookup scans every
pack index and worktree creation can blow its timeout under concurrent load.
ú.gitÚobjectsÚpackNz*.pack)Úclear_stale_tmp_packsu6   git pack sprawl (%d packs) â€” repacking in backgroundre   rj   F)r   Úcheckrl   rm   zpack maintenance skipped: %s)r   Úis_dirÚlenÚlistÚglobÚ_PACK_SPRAWL_THRESHOLDr’   ÚparentÚhermes_cli.gitlockrº   r7   r±   r´   r+   r'   rs   r   r6   r8   )ra   Úpack_dirÚpacksrº   r9   s   &    r   Ú_maintain_pack_healthrÅ   º   sØ   € ð8Ü˜	“? VÕ+¨iÕ7¸&Õ@ˆØ�‰× Ò ÙÜ”D˜Ÿ™ xÓ0Ó1Ó2ˆØÔ)Ô)ÙÜ! (§/¡/×"8Ñ"8×9Ò9ÙÝ<Ùœd 9›oÔ.Ü�‰ÐLÈeÔTÜ˜IÔ&äˆj˜'Ð" I°rÀÜ×%Ñ%Ô+AÓ+C÷	Eøäô 8Ü�‰Ð3°Q×7Ò7ûð8ús)   ‚6C4 º.C4 Á*%C4 ÂA!C4 Ã4D Ã?DÄD c                óH   € V ^8„  d   QhR\         R\        R\        R\        /# )r   ra   Úfetch_timeoutÚfreshness_windowr   )r   r   Útuple)r   s   "r   r   r   Ô   s0   € ÷ V=ñ V=¤cð V=¼%ð V=Ü-2ðV=Ü=BñV=r   c                ó@  a aaaaaaa€ ^ RI Ho ^ RIHo RR VV 3R llloR V3R lloR VV 3R lloR	 VVVVVV3R
 llp S! . RO4      pVP                  ^ 8X  dG   VP
                  P                  4       pV'       d%   RV9   d   VP                  R^4      w  rgV! WgV4      #  S! . RO4      p	T	P                  ^ 8X  d,   T	P
                  P                  4       P                  RR^4      MRp
T
'       g    S! . RO\        S^4      R7      pTP
                  P                  4        Fk  pTP                  4       pTP                  R4      '       g   K,  TP                  R^4      ^,          P                  4       pT'       d   TR8w  d
   RT,           p
 M	  T
'       d%   RT
9   d   T
P                  R^4      w  rgT! YgT
4      # R#   \         d"   p\        P                  RT4        Rp?ELERp?ii ; i  \         d"   p\        P                  RT4        Rp?R# Rp?ii ; i)a  Resolve the freshest base ref to branch a new worktree from -> ``(base_ref, banner_label)``.

Local ``HEAD`` can lag the remote by hundreds of commits, so try in order: (1) the current
branch's upstream, refreshed; (2) the remote default branch (``origin/HEAD``), refreshed;
(3) local ``HEAD``. The fetch is skipped when ``FETCH_HEAD`` is younger than
*freshness_window* s, capped at *fetch_timeout*, and never retried: on failure the cached
remote-tracking ref is used (the pre-push stale-base gate backstops genuine staleness).
)r   )Útracking_refspecc                ó$   € V ^8„  d   QhR\         /# r   r   )r   s   "r   r   Ú,_resolve_worktree_base.<locals>.__annotate__á   s   € ÷ nñ nœEñ nr   c                 óJ   <€ \        V SV\        P                  S! 4       R 7      # )rk   )r+   r'   rs   )r)   r   r   ra   s   &&€€r   Ú_runÚ$_resolve_worktree_base.<locals>._runá   s    ø€ Ü�D˜)¨W¼J×<NÑ<NÑTjÓTlÔmÐmr   c                ó0   € V ^8„  d   QhR\         R\        /# )r   Úrefr   ©r   rU   )r   s   "r   r   rÍ   ä   s   € ÷ ñ œð ¤ñ r   c                 ój   <€  S! R RRV R,           .4      P                   ^ 8H  #   \         d     R# i ; i)rM   ú--verifyr¦   ú	^{commit}F)r.   r6   )rÒ   rÏ   s   &€r   Ú_ref_existsÚ+_resolve_worktree_base.<locals>._ref_existsä   s?   ø€ ð	Ù˜ j°)¸SÀ;Õ=NÐOÓP×[Ñ[Ð_`Ñ`Ð`øÜô 	Úð	ús   ƒ# £2±2c                ó:   € V ^8„  d   QhR\         \        ,          /# rK   )r   r   )r   s   "r   r   rÍ   ê   s   € ÷ 
ñ 
œX¤e�_ñ 
r   c                  ór  <€  S! R R.4      p V P                   ^ 8w  d   R# \        S4      V P                  P                  4       ,          R,          pVP	                  4       '       g   R# \        R\        P                  ! 4       VP                  4       P                  ,
          4      #   \         d     R# i ; i)rM   z	--git-dirNÚ
FETCH_HEADg        )
r.   r   r/   r0   rp   Úmaxr~   r}   r   r6   )ÚgdÚ
fetch_headrÏ   ra   s     €€r   Ú_fetch_head_ageÚ/_resolve_worktree_base.<locals>._fetch_head_ageê   s�   ø€ ð		Ù�{ KÐ0Ó1ˆBØ�}‰} Ô!ÙÜ˜i›¨2¯9©9¯?©?Ó+<Õ<¸|ÕKˆJØ×$Ñ$×&Ò&ÙÜ�sœDŸIšI›K¨*¯/©/Ó*;×*DÑ*DÕDÓEÐEøÜô 	Úð	ús   ƒB'  AB' Á)=B' Â'B6Â5B6c                óH   € V ^8„  d   QhR\         R\         R\         R\        /# )r   Úremotern   rÒ   r   )r   rÉ   )r   s   "r   r   rÍ   ö   s.   € ÷ Eñ Eœð E¤cð E´ð E¼ñ Er   c                ó¦  <€ S! 4       pVe(   VS8  d!   S! V4      '       d   W" R\        V4       R23#  S	! RV S! W4      .S
R7      pVP                  ^ 8X  d   W" R23# RpS! V4      '       d    \
        P                  RWR4       W" RV R23# RRV RV R23#   \        P                   d    RS
R	 R
2p LV\         d   pRT 2p Rp?LjRp?ii ; i)z7(ref, label) after one best-effort fetch; never raises.Nz
 (fetched zs ago)ÚfetchrN   z
 (fetched)zfetch failedzfetch timed out after ÚgÚszfetch error: u%   worktree base: %s â€” using cached %su    (cached â€” Ú)ÚHEADu   HEAD (local â€” z, no cached )Úintr.   r'   r°   r6   r7   r8   )râ   rn   rÒ   ÚageÚfetchedÚreasonr9   rß   r×   rÏ   rÇ   rÈ   rË   s   &&&    €€€€€€r   Ú_refreshÚ(_resolve_worktree_base.<locals>._refreshö   s	  ø€ áÓˆØŠ?˜sÐ%5Ô5¹+Àc×:JÒ:JØ˜%˜z¬#¨c«(¨°6Ð:Ð:Ð:ð	)Ù˜G VÑ-=¸fÓ-MÐNÐXeÔfˆGØ×!Ñ! QÔ&Ø˜e :Ð.Ð.Ð.Ø#ˆFñ
 �s×ÒÜ�L‰LÐ@À&ÔNØ˜%˜}¨V¨H°AÐ6Ð6Ð6ØÐ)¨&¨°¸c¸UÀ!ÐDÐDÐDøô ×(Ñ(ô 	AØ-¨m¸AÐ->¸aÐ@ŠFÜô 	)Ø$ Q CÐ(�Fûð	)ús)   µ)B ÁB ÂCÂ7CÃ CÃCÃCr@   z-worktree base: upstream resolution failed: %sNzrefs/remotes/Ú rN   zHEAD branch:Ú:z	(unknown)zorigin/z3worktree base: default-branch resolution failed: %s©é   )rM   ú--abbrev-refz--symbolic-full-namez@{upstream})zsymbolic-refr¦   zrefs/remotes/origin/HEAD)râ   ÚshowÚorigin)rè   u'   HEAD (local â€” could not reach remote))Úhermes_cli._subprocess_compatr   Úhermes_cli.update_cmd_checkrË   r.   r/   r0   Úsplitr6   r7   r8   r%   rÜ   Ú
splitlinesÚ
startswith)ra   rÇ   rÈ   rí   ÚupÚupstreamrâ   rn   r9   Úhead_refÚdefault_refrô   ÚlineÚ_branchrß   r×   rÏ   r   rË   s   fff           @@@@@r   Ú_resolve_worktree_baser  Ô   sÛ  ÿ€ õ EÝ<÷nó n÷ð ÷
ñ 
÷Eõ Eð(IÙÒVÓWˆØ�=‰=˜AÔØ—y‘y—‘Ó(ˆHß˜C 8œOØ!)§¡°°QÓ!7‘�Ù °Ó9Ð9ð
OÙÒOÓPˆà"×-Ñ-°Ô2ð  —‘×,Ñ,Ó.×6Ñ6°ÈÈAÔNØ8:ð 	çáÒ4¼cÀ-ÐQRÓ>SÔTˆDØŸ™×.Ñ.Ö0�Ø—z‘z“|�Ø—?‘? >×2Ô2Ø"Ÿj™j¨¨aÓ0°Õ3×9Ñ9Ó;�Gß 7¨kÔ#9Ø&/°'Õ&9˜Ùñ 1÷ ˜3 +Ô-Ø(×.Ñ.¨s°AÓ6‰NˆFÙ˜F¨KÓ8Ð8ð
 =Ð<øô3 ô IÜ�‰ÐDÀa×HÒHûðIûô* ô OÜ�‰ÐJÈA×NÐNð =Ð<ûð	OúsV   ÁG Á!G Â #G Â%AG1 Ã5AG1 Å.G1 Æ G1 Æ#G1 ÇG.ÇG)Ç)G.Ç1HÇ<HÈHc                ó(   € V ^8„  d   QhR\         RR/# r”   r   )r   s   "r   r   r   -  s   € ÷ ;ñ ;¬Cð ;°Dñ ;r   c                óö  € \        V 4      R,          p VP                  4       '       d   VP                  RRR7      MRpRVP                  4       9  dc   \	        VRRR	7      ;_uu_ 4       pV'       d)   VP                  R
4      '       g   VP                  R
4       VP                  R4       RRR4       R# R#   + '       g   i     R# ; i  \         d"   p\        P                  RT4        Rp?R# Rp?ii ; i)zIAppend ``.worktrees/`` to the repo's .gitignore when missing (fail-soft).z
.gitignoreú	utf-8-sigr%   ©r"   r$   rï   z.worktrees/Úar#   ry   rz   z.worktrees/
NzCould not update .gitignore: %s)
r   rp   Ú	read_textrù   r…   Úendswithr‹   r6   r7   r8   )ra   Ú	gitignoreÚexistingÚfr9   s   &    r   Ú_ensure_worktrees_gitignoredr  -  sÁ   € ä�Y“ ,Õ.€Ið	;àR[×RbÑRb×RdÒRd�9×&Ñ&°ÀIÐ&ÔNÐjlˆØ × 3Ñ 3Ó 5Ô5Ü�i ¨w×7Õ7¸1ß H×$5Ñ$5°d×$;Ò$;Ø—G‘G˜D”MØ—‘˜Ô(÷ 8Ñ7ñ 6ß7×7Ð7ûô ô ;Ü�‰Ð6¸×:Ò:ûð;ús<   ”AC Á*B8Â
"B8Â,C Â8C		ÃC Ã	C ÃC8ÃC3Ã3C8c                ó$   € V ^8„  d   QhR\         /# rK   )r¾   )r   s   "r   r   r   <  s   € ÷ ñ ¬4ñ r   c                ó6  € \        V 4      R,          pVP                  4       '       g   . # . pVP                  RRR7      P                  4        FG  pVP	                  4       pV'       g   K  VP                  R4      '       d   K6  VP                  V4       KI  	  V# )zëNon-blank, non-comment entries of *repo_root*/``.worktreeinclude`` (``[]`` when absent).

utf-8-sig, not the locale default: a cp1251/GBK locale would mojibake or raise on a UTF-8
list, and a Notepad BOM would glue to the first entry.
z.worktreeincluder  r%   r  Ú#)r   Úis_filer  rù   r0   rú   Úappend)ra   Úinclude_fileÚentriesrÿ   Úentrys   &    r   Ú_worktreeinclude_entriesr  <  sƒ   € ô ˜	“?Ð%7Õ7€LØ×Ñ×!Ò!Øˆ	Ø€GØ×&Ñ&°ÀIÐ&ÓN×YÑYÖ[ˆØ—
‘
“ˆß‰5˜×)Ñ)¨#×.Ô.Ø�N‰N˜5Ö!ñ \ð €Nr   c                ó4   € V ^8„  d   QhR\         R\        RR/# )r   ra   r[   r   Nrc   )r   s   "r   r   r   M  s&   € ÷ *Fñ *F¤sð *F´Tð *F¸dñ *Fr   c           	     ó€  €  \        V 4      pV'       g   R# \        V 4      P                  4       pVP                  4       pV EFk  p\        V 4      V,          W,          rv VP                  RR7      pVP                  RR7      p	\        Yƒ4      '       g   \
        P                  RT4       Kk  \        Y”4      '       g   \
        P                  RT4       K”  TP                  4       '       dI   TP                  P                  RRR7       \        P                  ! \        T4      \        T4      4       Kò  TP                  4       '       g   EK  TP!                  4       '       d   EK$  TP                  P                  RRR7        \"        P$                  ! \        T4      \        T4      4       EKn  	  R#   \        \        3 d    \
        P                  RT4        EK�  i ; i  \        \&        3 d›   p
\(        P*                  R	8w  d   h \
        P-                  R
T
4        \        P.                  ! \        T4      \        T4      RRR7        Rp
?
EK    \0         d(   p\
        P                  RYgT4        Rp? Rp
?
EK?  Rp?ii ; iRp
?
ii ; i  \0         d"   p\
        P                  RT4        Rp?R# Rp?ii ; i)z[Copy/symlink the entries listed in ``.worktreeinclude`` (gitignored files the agent needs).NF)Ústrictz+Skipping invalid .worktreeinclude entry: %sz5Skipping .worktreeinclude entry outside repo root: %sz9Skipping .worktreeinclude entry that escapes worktree: %sT©ÚparentsÚexist_okr?   uN   .worktreeinclude: symlink failed (%s) â€” falling back to copytree on Windows.)ÚsymlinksÚdirs_exist_okz<.worktreeinclude: copy fallback also failed for %s -> %s: %sz*Error copying .worktreeinclude entries: %s)r  r   Úresolver‚   rX   r7   r8   rY   Úwarningr  rÁ   Úmkdirrq   Úcopy2r   r¼   rp   r„   ÚsymlinkÚNotImplementedErrorrA   rB   r±   Úcopytreer6   )ra   r[   r  Úrepo_root_resolvedÚwt_path_resolvedr  ÚsrcÚdstÚsrc_resolvedÚdst_resolvedÚ_sym_errÚ	_copy_errr9   s   &&           r   Ú_copy_worktree_includesr-  M  s  € ð(FÜ*¨9Ó5ˆßÙÜ! )›_×4Ñ4Ó6ÐØ"Ÿ?™?Ó,ÐÜˆEÜ˜I“¨Õ.°µ�ðØ"Ÿ{™{°%˜{Ó8�Ø"Ÿ{™{°%˜{Ó8�ô (¨×IÒIÜ—‘ÐVÐX]Ô^ÙÜ'¨×GÒGÜ—‘ÐZÐ\aÔbÙØ�{‰{�}Š}Ø—
‘
× Ñ ¨¸Ð Ô=Ü—’œS ›X¤s¨3£xÖ0Ø—‘—• c§j¡j§l¥là—
‘
× Ñ ¨¸Ð Ô=ð<Ü—J’Jœs <Ó0´#°c³(×;ó- øô œZÐ(ô Ü—‘ÐJÈEÔRÛðûô"  Ô!4Ð5ô 	<Ü—|‘| wÔ.ØÜ—K‘KÐ pØ (ô*ð<ÜŸš¬¨LÓ(9¼3¸s»8ÈdÐbg×hÔhøÜ$ô <ÜŸ™Ð'eØ'*°÷<÷ <ûð<þð	<ûô ô FÜ�‰ÐAÀ1×EÒEûðFús©   ‚J —AJ Á $F4ÂA'J Ã,AJ ÅJ Å&J Æ)G#Æ-J Æ4'G ÇJ ÇG Ç J Ç#JÇ4,J	È!,IÉJ ÉJÉJÉ6J	É:J ÊJÊJ	Ê	JÊJ ÊJ=ÊJ8Ê8J=c          
      óT   € V ^8„  d   QhR\         R\        R\         R\         R\         /# )r   ra   r[   rb   Úbase_refÚ
base_labelrc   )r   s   "r   r   r   z  s0   € ÷ % ñ % œSð % ¬4ð % ¼cð % ÌSð % Ô^añ % r   c                ó6  a aaaa	€ ^ RI Hp V! S 4      o	S	f   \        R4       R# VVV	V V3R lp V! . R
O4      pVP                  ^ 8w  d˜   SR8w  dJ   \        P                  RSVP                  P                  4       4       \        S SS4       RRuopV! . 4      pVP                  ^ 8w  d7   \        S SS4       \        RVP                  P                  4        R	24       R# SV3#   \         d(   p\        S SS4       \        RT R	24        Rp?R# Rp?ii ; i)zÃ``git worktree add`` with a local-HEAD retry -> ``(base_ref, base_label)``, or None on failure.

Every failed attempt is swept with ``_cleanup_failed_worktree_add`` so the retry is not poisoned.
©Únoninteractive_repo_git_envNuU   [31mâœ— Failed to create worktree: could not read the repository's filter config[0mc                 ón   <€ \        . V OR NRN\        S4      NRNSNSNS^x\        P                  SR7      # )re   Úaddz-brk   )r+   r   r'   rs   )Úcfgr/  rb   rm   ra   r[   s   &€€€€€r   Ú_addÚ_worktree_add.<locals>._add‡  sL   ø€ äÐX�cÐX˜:ÐX uÐX¬c°'«lÐX¸DÐXÀ+ÐXÈxÐXÐZcØ¤z×'9Ñ'9¸sôDð 	Dr   rè   z:worktree add from %s failed (%s); retrying from local HEADu&   HEAD (fallback â€” remote base failed)u$   [31mâœ— Failed to create worktree: ú[0m)ú-czcheckout.workers=8r:  z$checkout.thresholdForParallelism=100)
rö   r3  r   r.   r7   r  rš   r0   rt   r6   )
ra   r[   rb   r/  r0  r3  r7  r1   r9   rm   s
   ffff&    @r   Ú_worktree_addr;  z  s  ü€ õ
 Jñ & iÓ
0€CØ
‚{ÜÐmÔnÙ÷Dñ DðÙÒ`ÓaˆØ×Ñ Ô!Ø˜6Ô!ä—‘Ð[Ø'¨¯©×)<Ñ)<Ó)>ô@ä,¨Y¸ÀÔMØ'-Ð/WÐ$�˜*Ù˜b›�Ø× Ñ  AÔ%Ü,¨Y¸ÀÔMÜÐAÀ&Ç-Á-×BUÑBUÓBWÐAXÐX_Ð`ÔaÙð
 �ZÐÐøô	 ô Ü$ Y°¸ÔEÜÐ9¸!¸¸GÐDÔEÝûðús   °B0C& Ã&DÃ1DÄDc                ó¤   € V ^8„  d   QhR\         R,          R\        R\        \         ,          R\        \        \         \         3,          ,          /# )r   ra   NÚ	sync_baser©   r   )r   rU   r   Údict)r   s   "r   r   r   ¢  sH   € ÷ =cñ =cœs T�zð =c¼Tð =cÜ"¤3�-ð=cÜCKÌDÔQTÔVYÐQYÍNÕC[ñ=cr   c           	     ó°  € T ;'       g    \        4       p V '       g   \        R4       \        R4       R# T;'       d7    \        P                  ! RRV4      P                  R4      R,          ;'       g*    R\        P                  ! 4       P                  R	,           2pR
V 2p\        V 4      R,          pVP                  RRR7       Wd,          pV'       d6   VP                  4       '       d    \        RV R24       \        RV 24       R# \        V 4       V'       d   \        V 4      MR"w  r‰\        WWXV	4      p
V
f   R# V
w  r‰\        W4        R\         P"                  ! 4        2Ve   RV 2MR,           p\%        RRRV\'        V4      .V 4       \(        P+                  RV\         P"                  ! 4       4       ^ RIHp V! V 4       Ve   ^ RIHp V! R\'        V4      RVRV /4       \        RV 24       \        RV 24       \        R V	 24       R\'        V4      RVRV R!V/#   \,         d!   p\(        P+                  RT4        Rp?L’Rp?ii ; i)#aË  Create an isolated git worktree -> ``{path, branch, repo_root, base}``, or None on failure.

*sync_base* branches from the fetched remote tip (``_resolve_worktree_base``), else local
HEAD. *name* replaces the random ``hermes-<id>``; named trees lack the ``hermes-`` prefix so
the pruner ages them on its slower schedule. *retain_db* (``-w``, ``--tui -w``) records the tree
for resume and names the profile store in the lock. A ``--tui -w`` tree outlives its launcher
while a session there can resume in it; a classic ``-w`` row's cwd is the repo root, so its
reaped clean tree is recreated on resume instead.

Set ``worktree_sync: false`` in config to branch from local ``HEAD`` (the pre-#10760-followup behavior).
u?   [31mâœ— --worktree requires being inside a git repository.[0mz5  cd into your project repo first, then run hermes -wNz[^A-Za-z0-9._-]+Ú-z-._:Né(   Núhermes-:Né   Nzhermes/ú
.worktreesTr  u"   [31mâœ— Worktree already exists: r9  z@  Pick a different name, or remove it with: git worktree remove zhermes pid=ú db=rï   re   rŽ   ú--reasonzWorktree locked: %s (pid=%s)z(git worktree lock failed (non-fatal): %s)Úrecord_worktree_repo)Úrecord_tui_worktreerR   rn   ra   u   [32mâœ“ Worktree created:[0m z
  Branch: z
  Base:   Úbase)rè   u'   HEAD (local â€” worktree_sync disabled))rP   r   ÚprintrC   Úsubr0   ÚuuidÚuuid4Úhexr   r   rp   r  r  r;  r-  r„   rŒ   r+   r   r7   r8   r6   Úhermes_cli.worktree_registryrG  Úhermes_cli.tui_worktree_resumerH  )ra   r=  r©   Ú	retain_dbÚwt_namerb   Úworktrees_dirr[   r/  r0  Úaddedrì   r9   rG  rH  s   &&&&           r   Ú_setup_worktreerU  ¢  s2  € ð ×-Ð-œ^Ó-€IßÜÐWÔXÜÐEÔFÙà×QÐQœŸšÐ 3°S¸$Ó?×EÑEÀeÓLÈSÕQ÷ 3ð 3ØœDŸJšJ›L×,Ñ,¨RÕ0Ð1Ð2ð à˜G˜9Ð%€Kä˜“O lÕ2€MØ×Ñ ¨tÐÔ4ØÕ%€Gß�—‘× Ò ÜÐ7¸°yÀÐHÔIÜÐPÐQXÐPYÐZÔ[Ùä  Ô+÷
 BKÔ2°9Ô=Ø!Tñ €Hô ˜)¨kÀZÓP€EØ‚}ÙØ Ñ€HÜ˜IÔ/ðDØœrŸyšy›{˜mÐ,ÀiÒF[°$°y°kÑ0BÐacÕdˆÜˆj˜& *¨f´c¸'³lÐCÀYÔOÜ�‰Ð3°W¼b¿iºi»kÔJõ BÙ˜Ô#ØÒÝFÙ˜V¤S¨£\°8¸[È+ÐW`ÐaÔbÜÐ3°G°9Ð=Ô>Ü	ˆJ�{�mÐ
$Ô%Ü	ˆJ�z�lÐ
#Ô$Ø”C˜“L (¨K¸ÀiÐQWÐYaÐbÐbøô ô DÜ�‰Ð?À×CÑCûðDús   ÅA,H* È*IÈ5IÉIc                óR   € V ^8„  d   QhR\         R\        R\        \         ,          /# ©r   rR   r   r   ©r   r   r   )r   s   "r   r   r   æ  s%   € ÷ ñ ¤ð ¬eð ¼HÄS½Mñ r   c                óh  € \          F!  p\        RRRRV 2.WR7      '       g   K  Vu # 	  \        . R
OWR7      ;'       g    RpVP                  R^4      ^ ,          P                  4        FB  pVP	                  R4      '       g   K  V\        R4      R	 P                  4       ;'       g    R	u # 	  R	# )a[  Local trunk of a repo with NO remote-tracking refs: ``main``/``master``, else the branch
checked out in the main worktree. None = no baseline at all; callers must preserve.

Nothing in such a repo was ever pushed, so "merged into the local trunk" is the only fact
that can tell redundant scratch work from unique commits. May raise like ``_git``.
rM   rÕ   r¦   úrefs/heads/rN   rï   z

úbranch refs/heads/N©re   r¾   ú--porcelain)Ú_LOCAL_TRUNK_CANDIDATESr2   rø   rù   rú   r½   r0   )rR   r   r©   Ú	porcelainrÿ   s   &&   r   Ú_worktree_local_trunkr`  æ  s¦   € ÷ (ˆÜ�[ *¨i¸;ÀtÀfÐ9MÐNÐPT×fÕfØŠKñ (ô Ò<¸dÔT×ZÐZÐXZ€IØ—‘ ¨Ó*¨1Õ-×8Ñ8Ö:ˆØ�?‰?Ð/×0Ô0ØœÐ0Ó1Ð2Ð3×9Ñ9Ó;×CÐC¸tÒCñ ;ñ r   c                óR   € V ^8„  d   QhR\         R\        R\        \         ,          /# rW  rX  )r   s   "r   r   r   ÷  s%   € ÷ 
ñ 
¤3ð 
´ð 
¼xÌ½}ñ 
r   c                ó–   € \          F  p\        RRRV.WR7      '       g   K  Vu # 	  \        . ROWR7      R8X  d   \        WR7      # R# )z÷Ref merged work is judged against: ``origin/HEAD``/``origin/main``/``origin/master``, or the
local trunk when the repo has no remote-tracking refs at all. None = nothing to compare
against -> every consumer must preserve. May raise like ``_git``.
rM   rÕ   r¦   rN   rï   N©zfor-each-refz--format=%(refname)zrefs/remotes)Ú_REMOTE_TRUNK_CANDIDATESr2   r`  )rR   r   Úcands   && r   Ú_worktree_merge_base_refrf  ÷  sJ   € ÷
 )ˆÜ�[ *¨i¸Ð>À×VÕVØŠKñ )ô ÒGÈÔ_ÐceÔeÜ$ TÔ;Ð;Ùr   c                ó<   € V ^8„  d   QhR\         R\        R\        /# ©r   Úworktree_pathr   r   ©r   ré   rU   )r   s   "r   r   r     s!   € ÷ ñ ´#ð Äð ÌTñ r   c                óæ   €  \        . ROV VR7      pVf   R# R.pV'       g   \        WR7      pVf   R# V.p\        . ROVOV VR7      pVRJ ;'       g    \        V4      #   \         d     R# i ; i)aŠ  Whether a worktree has commits unreachable from any remote branch. Fails SAFE toward True.

No remote-tracking refs = nothing was ever pushed, so the tree is compared against the local
trunk instead (``_worktree_local_trunk``); no trunk either -> True. A shallow boundary can
disconnect an older HEAD from origin/* so public commits look unpushed;
``_deepen_shallow_repo`` first if affordable.
rN   NTz	--remotesrc  )r4   z	--onelinerè   z--not)r2   r`  rU   r6   )ri  r   Úremote_refsÚbaselineÚtrunkÚunpusheds   &&    r   Ú_worktree_has_unpushed_commitsrp    s†   € ðÜÒVÐXeØ'.ô0ˆàÒÙØ�=ˆßÜ)¨-ÔIˆEØŠ}ÙØ�wˆHÜÒLÀ8ÐLÈmØ$+ô-ˆà˜4Ð×1Ð1¤4¨£>Ð1øÜô Úðús    ‚A! ˜
A! £A! µ+A! Á!A0Á/A0c                ó0   € V ^8„  d   QhR\         R\        /# )r   ri  r   )r   Úset)r   s   "r   r   r     s   € ÷ ñ ¬#ð ¼Sñ r   c                ón  € \        V4      p\        V 4      p\        4       p\        V4       F…  pW5,          pVP                  4       '       g   K#  VP	                  4       W%,          P	                  4       8X  g   KN  VP                  \        V4      P                  4       P                  R4      4       K‡  	  V# )u±  Relative paths in *worktree_path* that are ``.worktreeinclude`` directory symlinks.

``_copy_worktree_includes`` symlinks included directories back to the main checkout
(*repo_root*). A trailing-slash gitignore pattern
(``node_modules/``) never matches a symlink, so git reports each one as untracked. Only a
symlink at a listed entry that resolves to that same entry in the main repo qualifies â€”
anything else is real user state.
r@   )r   rr  r  Ú
is_symlinkr  r5  Úas_posixÚrstrip)ri  ra   rS   ÚwtÚpathsr  r(  s   &&     r   Ú_include_symlink_pathsry    s„   € ô �	‹?€DÜ	ˆmÓ	€BÜ‹E€EÜ)¨$Ö/ˆØ�jˆØ�>‰>×Ô §¡£°$µ,×1GÑ1GÓ1IÖ IØ�I‰I”d˜5“k×*Ñ*Ó,×3Ñ3°CÓ8Ö9ñ 0ð €Lr   c                ó<   € V ^8„  d   QhR\         R\        R\        /# rh  rj  )r   s   "r   r   r   1  s!   € ÷ ñ ¤cð ¼sð ÌDñ r   c                óh  a	€ ^ RI Hp  V! V 4      pVf   R# \        . R	OV V\        P                  VR7      pVP
                  ^ 8w  d   R# VP                  P                  R4       Uu. uF  qf'       g   K  VNK  	  ppV'       g   ^ RIH	p \        V! V 4      4      # \        ;QJ d    R V 4       F  '       g   K   RM	  RM! R V 4       4      '       d   R# \        W4      o	\        ;QJ d    V	3R lV 4       F  '       g   K   R# 	  R# ! V	3R lV 4       4      # u upi   \         d     R# i ; i)
aæ  Whether a worktree has staged/unstaged/untracked changes. Fails SAFE toward True.

Untracked ``.worktreeinclude`` directory symlinks back to the main checkout *repo_root* are
ignored: they are our own scaffolding, and counting them would keep every worktree of such a
repo forever. ``status.showUntrackedFiles=no`` is overridden (it would hide new files), and
skip-worktree / assume-unchanged files whose bytes differ from the index count as changes
(``git status`` trusts both flags).
r2  Trk   Ú )Úhidden_index_editsc              3   óL   "  € T F  qP                  R 4      '       * x € K  	  R# 5i)z?? N©rú   )Ú.0r9   s   & r   Ú	<genexpr>Ú%_worktree_is_dirty.<locals>.<genexpr>H  s   é € Ð8±¨1—<‘< Ó&×&Ñ&³ùs   ‚"$Fc              3   óX   <"  € T F  qR ,          P                  R4      S9  x € K!  	  R# 5i):é   NNr@   N)rv  )r€  r9   Úinclude_linkss   & €r   r�  r‚  K  s!   øé € ÐKÁ7¸a�R•5—<‘< Ó$¨MÖ9Ã7ùs   ƒ'*)Ústatusr]  z-zz--untracked-files=normal)rö   r3  r+   r'   rs   r.   r/   rø   Úhermes_cli.worktree_retentionr}  rU   Úanyry  r6   )
ri  ra   r   r3  rm   r1   r9   r  r}  r…  s
   &&&      @r   Ú_worktree_is_dirtyr‰  1  sÿ   ø€ õ Jðá)¨-Ó8ˆØŠ;ÙÜÒQÐS`Ø%¬Z×-?Ñ-?ÀSôJˆà×Ñ Ô!ÙØ$Ÿm™m×1Ñ1°$Ô7Ó=Ñ7˜»1—1�1Ñ7ˆÐ=ßÝHÜÑ*¨=Ó9Ó:Ð:ß‹3Ñ8±Ó8�3�3Š3Ñ8±Ó8×8Ò8ÙÜ.¨}ÓHˆß‹sÔKÁ7ÓK�sŒsÐKŠsÐKˆsÔKÁ7ÓKÓKÐKùò >øô ô Úðús^   ‰D" —1D" Á
D" Á'	DÁ5DÁ; D" Â
D" Â'D" Â;D" Ã*D" ÄD" ÄD" ÄD" ÄD" Ä"D1Ä0D1c                ó<   € V ^8„  d   QhR\         R\        R\        /# )r   Ú	repo_pathr   r   rj  )r   s   "r   r   r   P  s!   € ÷ ñ ¤ð ¬cð ¼$ñ r   c                óL   €  \        RR.WR7      R8H  #   \         d     R# i ; i)zÂWhether *repo_path* is a shallow clone (installer default). Fails toward False on unknown state.

Shallowness poisons connectivity verdicts: an old worktree HEAD misreports as unpushed forever.
rM   z--is-shallow-repositoryrN   ÚtrueF)r2   r6   )r‹  r   s   &&r   Ú_repo_is_shallowrŽ  P  s2   € ð
Ü˜Ð&?Ð@À)Ô]ÐagÑgÐgøÜô Úðús   ‚ ”#¢#c                ó<   € V ^8„  d   QhR\         R\        R\        /# ©r   ra   r   r   rj  )r   s   "r   r   r   [  s!   € ÷ 'ñ '¤Cð '´#ð 'Äñ 'r   c           	     óÔ  € \        V 4      '       g   R#  \        R.V 4      pV'       g   R# VP                  4        Uu. uF*  q3P                  4       '       g   K  VP                  4       NK,  	  ppRV9   d   RMV^ ,          p R.. 3 F“  p \	        RVR.VOW\
        P                  \        4       R7      pTP                  ^ 8X  d    MV\        P                  R
T'       d   RRP                  T4      ,           MRTP                   P                  4       RR 4       K•  	  ^ R	I	H
p V! \        V 4      4       \        T 4      '       * p
T
'       d   \        P%                  RT 4       T
# u upi   \
        P                   d      ^ R	I	H
p T! \        T 4      4       R# i ; i  ^ R	I	H
p T! \        T 4      4       i ; i  \"         d"   p	\        P                  RT	4        Rp	?	R# Rp	?	ii ; i)z¿Blobless unshallow so history verdicts are correct -> whether the repo is non-shallow afterwards.

Falls back to a plain ``--unshallow`` if the server rejects filters. Background paths only.
Trâ   Frõ   z--filter=blob:nonerä   z--unshallowrk   )Úmark_unmarked_packs_promisorz"git fetch --unshallow%s failed: %sÚ rï   Nz-Deepening shallow repo failed (non-fatal): %szFDeepened shallow clone at %s so worktree cleanup can verify push stateiþÿÿ)rŽ  r2   rù   r0   r+   r'   rs   r   r°   rÂ   r’  r   r.   r7   r8   Újoinrš   r6   r±   )ra   r   ÚremotesÚrÚnamesrâ   Úextrar1   r’  r9   Údeepeneds   &&         r   Ú_deepen_shallow_reporš  [  sž  € ô
 ˜I×&Ò&ÙðÜ˜H˜: yÓ1ˆßÙØ$+×$6Ñ$6Ô$8ÓFÑ$8˜q¿G¹G¿I”�—‘–Ñ$8ˆÐFØ%¨Ô.‘°E¸!µHˆð	:Ø/Ð0°"Ó5�ð!ä! 7¨F°MÐ"JÀEÐ"JÈIÜ(2×(:Ñ(:Ô@VÓ@XôZ�Fð ×$Ñ$¨Ô)ÙÜ—‘ÐA×\aÀ3ÈÏÉÐRWËÖCXÐgiØ#Ÿ]™]×0Ñ0Ó2°4°5Ð9ö;ñ 6õ HÙ(¬¨i«Ô9ô
 $ IÓ.Ô.€HßÜ�‰Ð\Ð^gÔhØ€Oùò9 Gøô "×0Ñ0ô !Ù õ HÙ(¬¨i«Ö9ð!ûõ HÙ(¬¨i«Õ9ûÜô Ü�‰ÐDÀaÔHÝûðús{   •F; ¬F; ¾E&ÁE&Á.F; ÂF Â*E+Â6*F Ã!>F ÄF; Å&F; Å+FÆ F ÆF; ÆFÆF ÆF8Æ8F; Æ;G'ÇG"Ç"G'iè  c                ó$   € V ^8„  d   QhR\         /# rK   r   )r   s   "r   r   r   ‰  s   € ÷ Hñ H¤Dñ Hr   c                 ó2   € \        4       R,          R,          # )z<Path of the patch-equivalence verdict cache (profile-aware).Úcachezworktree_merge_verdicts.jsonr   rO   r   r   Ú_worktree_merge_cache_pathrž  ‰  s   € äÓ˜wÕ&Ð)GÕGÐGr   c                óF   € V ^8„  d   QhR\         \        \        3,          /# rK   ©r>  r   rU   )r   s   "r   r   r   Ž  s   € ÷ jñ j¤D¬¬d¨¥Oñ jr   c                 óX  €  \         P                  ! \        4       P                  RR7      4      P	                  R4      p \        T \        4      '       d=   T P                  4        UUu/ uF  w  r\        T\        4      '       g   K  YbK!  	  upp# / #   \
         d    / u # i ; iu uppi )zELoad the ``git cherry`` verdict cache. Missing/corrupt cache = empty.r  ry   Úverdicts)
ÚjsonÚloadsrž  r  Úgetr6   Ú
isinstancer>  ÚitemsrU   )r  ÚkÚvs      r   Ú_load_worktree_merge_cacherª  Ž  s�   € ðÜ—*’*Ô7Ó9×CÑCÈ[ÐCÓYÓZ×^Ñ^Ð_iÓjˆô ISÐSZÔ\`×HaÒHa˜WŸ]™]œ_ÔD™_‘T�Q´
¸1¼d×0CŒDˆAŠD™_ÒDÐiÐgiÐiøô ô ØŠ	ðüó Es   ‚=B Á(B&ÂB&ÂB#Â"B#c                óJ   € V ^8„  d   QhR\         \        \        3,          RR/# )r   r¢  r   Nr   )r   s   "r   r   r   ˜  s&   € ÷ Fñ F¬¬c´4¨i­ð F¸Tñ Fr   c           	     óî   €  \        V P                  4       4      \        ) R p\        \	        4       R^R\        V4      /RR7       R#   \         d"   p\        P                  RT4        Rp?R# Rp?ii ; i)zSAtomically persist the newest ``_WORKTREE_MERGE_CACHE_MAX`` verdicts. Never raises.NÚversionr¢  )Úindentz*Could not persist worktree merge cache: %s)	r¾   r§  Ú_WORKTREE_MERGE_CACHE_MAXr
   rž  r>  r6   r7   r8   )r¢  r§  r9   s   &  r   Ú_save_worktree_merge_cacher°  ˜  sj   € ðFÜ�X—^‘^Ó%Ó&Ô(AÐ'AÐ'BÐCˆÜÔ4Ó6¸ÀAÀzÔSWÐX]ÓS^Ð8_Ðhl×møÜô FÜ�‰ÐAÀ1×EÒEûðFús   ‚AA ÁA4ÁA/Á/A4c                óŒ   € V ^8„  d   QhR\         R\        R\        R\        \        \         \        3,          ,          R\        /# )r   ri  r   Ú	max_aheadr�  r   ©r   ré   r   r>  rU   )r   s   "r   r   r   ¡  sF   € ÷ .ñ .Üð.Ü!$ð.Ü69ð.ÜGOÔPTÔUXÔZ^ÐU^ÕP_ÕG`ð.ä	ñ.r   c                óL  aa€  \        WR7      pVf   R# RoSeg   \        RV R2R.V VR7      pT;'       g    RP                  4       p\        V4      ^8X  d)   V^ ,           RV^,           R	V 2oSS9   d
   SS,          # R
 VV3R llp\        RRV R2.WR7      pVf   R# \	        T;'       g    R4      p	V	^ 8X  d	   V! R4      # W’8”  d	   V! R4      # \        RVR.WR7      p
V
P                  ^ 8w  d   R# V
P                  P                  4        Uu. uF  q»P                  4       '       g   K  VNK  	  ppT! \        V4      ;'       d=    \        ;QJ d$    R V 4       F  '       d   K   R4      # 	  R4      # ! R V 4       4      4      # u upi   \         d     R# i ; i)aÔ  Whether every local-only commit is patch-equivalent (``git cherry``) to upstream. Fails SAFE -> False.

Catches squash-merged/cherry-picked PRs whose remote branch was deleted (commits unreachable
from ``refs/remotes/*`` forever). Upstream is ``_worktree_merge_base_ref`` (the local trunk in
a repo without remotes). More than *max_ahead* ahead = stale-base tree -> False.
*cache* memoizes on ``(base_sha, head_sha, max_ahead)``, exactly what ``git cherry`` consumes.
rN   NFrM   rÖ   zHEAD^{commit}rï   z..rð   c                ó0   € V ^8„  d   QhR\         R\         /# )r   Úverdictr   )rU   )r   s   "r   r   Ú;_worktree_commits_all_merged_upstream.<locals>.__annotate__º  s   € ÷ 	ñ 	œ4ð 	¤Dñ 	r   c                 ó"   <€ Se
   Se   V SS&   V # rŸ   rO   )r¶  r�  Ú	cache_keys   &€€r   Ú_memoÚ4_worktree_commits_all_merged_upstream.<locals>._memoº  s   ø€ ØÒ  YÒ%:Ø#*��iÑ ØˆNr   zrev-listz--countz..HEADÚ0TÚcherryrè   c              3   óB   "  € T F  qP                  R 4      x € K  	  R# 5i)r@  Nr  )r€  Úlns   & r   r�  Ú8_worktree_commits_all_merged_upstream.<locals>.<genexpr>Í  s   é € Ð(LÁeÀ¯©°s×);Ð);Ãeùs   ‚)rf  r2   rø   r½   ré   r+   r.   r/   rù   r0   rU   Úallr6   )ri  r   r²  r�  rI  ÚrevsÚshasrº  ÚaheadÚcountr½  r¿  Úlinesr¹  s   &&&f         @r   Ú%_worktree_commits_all_merged_upstreamrÇ  ¡  sœ  ù€ ð$Ü'¨ÔGˆØŠ<Ùàˆ	ØÒÜ˜[¨T¨F°+Ð*>ÀÐPÐR_Ø$+ô-ˆDà—J�J˜B×%Ñ%Ó'ˆDÜ�4‹y˜AŒ~Ø# A�w˜i r¨$¨q­'¨°!°I°;Ð?�	Ø Ô%Ø  Õ+Ð+÷	ñ 	ô
 ˜* i°D°6¸°ÐAÀ=ÔbˆØŠ=ÙÜ�E—L�L˜SÓ!ˆØ�AŒ:Ù˜“;ÐØÔÙ˜“<Ðä�x  vÐ.°ÔOˆØ×Ñ Ô!ÙØ$Ÿm™m×6Ñ6Ô8ÓGÑ8˜¿H¹H¿J—�Ñ8ˆÐGá”T˜%“[×LÐL§S£SÑ(LÁeÓ(L§S¤SÓMÐM¢SÓMÐM SÑ(LÁeÓ(LÓ%LÓMÐMùò Høô ô Úðúsv   „F –"F ¹AF Â!F Â%F Â3F Ã	F Ã!F Ã:F ÄFÄ2FÄ8F ÅF ÅF Å.F Å5F Å=F ÆF ÆF#Æ"F#c                óR   € V ^8„  d   QhR\         R\        R\        \         ,          /# rh  )r   ré   r   )r   s   "r   r   r   Ò  s%   € ÷ ;ñ ;¬Cð ;¼#ð ;Ä(Ì3Å-ñ ;r   c                óF   € \        . ROWR7      pV'       d
   VR8w  d   V# R# )zYChecked-out branch name, or None when detached/git fails. May raise on subprocess errors.rè   rN   N)rM   ró   rè   )r2   )ri  r   rn   s   && r   Ú_worktree_current_branchrÊ  Ò  s#   € äÒ;¸]Ô\€Fß ¨&Ô 0ˆ6Ð:°dÐ:r   c          	      ó€   € V ^8„  d   QhR\         R\        R\        \        \         \        3,          ,          R\        /# )r   ri  r   r�  r   r³  )r   s   "r   r   r   Ø  s9   € ÷ "ñ "Üð"Ü!$ð"Ü2:¼4ÄÄTÀ	½?Õ2Kð"ä	ñ"r   c                óþ  €  \        W4      pVf   R# RpVe7   \        RR.WR7      pV'       d    RV RV 2pVP                  V4      RJ d   R# \        P                  ! R	R
RRVRRRRRR.RRRRWRR7      pVP
                  ^ 8w  d   R# \        P                  ! VP                  ;'       g    R4      p\        V\        4      ;'       d    \        V4      pV'       d   Ve	   Ve   RW$&   V#   \         d     R# i ; i)a  Whether the branch's PR is MERGED on GitHub (``gh pr list``). Fails SAFE toward False.

Catches rebase-merges whose altered diff defeats ``git cherry``. Memoized on
``(branch, head_sha)``; only True is cached since the PR may merge later without new commits.
NFrM   rè   rN   z
pr-merged:rð   TÚghÚprr¾   z--headz--stateÚmergedz--jsonÚnumberz--limitÚ1r#   r%   )r!   r   r"   r$   r   r&   r»   z[])rÊ  r2   r¥  r'   r(   r.   r£  r¤  r/   r¦  r¾   rU   r6   )	ri  r   r�  rn   r¹  Úshar1   ÚprsrÏ  s	   &&&      r   Ú_worktree_branch_pr_mergedrÔ  Ø  s	  € ðÜ)¨-ÓAˆØŠ>Ùàˆ	ØÒÜ˜K¨Ð0°-ÔQˆCßØ(¨¨°°#°Ð7�	Ø—9‘9˜YÓ'¨4Ó/Ùä—’Ø�4˜ ¨6°9¸hÈÐRZÐ\eÐgjÐkØ d°WÀYÐX_Øô
ˆð
 ×Ñ Ô!ÙÜ�jŠj˜Ÿ™×.Ð.¨$Ó/ˆÜ˜C¤Ó&×4Ð4¬4°«9ˆß�eÒ'¨IÒ,AØ#ˆEÑØˆøÜô Úðús4   ‚C- “:C- Á9C- Â
"C- Â-C- ÃC- ÃC- Ã-C<Ã;C<c          	      ót   € V ^8„  d   QhR\         R\        R\        \        \         \         3,          ,          /# r�  )r   ré   r   r>  )r   s   "r   r   r   ý  s1   € ÷ ñ ¬#ð ¼ð ÄXÌdÔSVÔX[ÐS[ÍnÕE]ñ r   c                óÞ  €  \        . ROW\        P                  \        4       R7      pVP                  ^ 8w  d   R# R VP
                  P                  4        4       pV Uu/ uFn  p\        V4      ^8X  g   K  V^,          P                  R4      '       g   K5  V^,          \        R4      R P                  4       V^ ,          P                  4       bKp  	  up# u upi   \         d     R# i ; i)zì``{branch: sha}`` for every branch on origin (one ``ls-remote``), or None = cannot verify, preserve.

Managed installs fetch a single-branch refspec, so pushed PR branches have no
remote-tracking ref and would read as unpushed forever.
rk   Nc              3   óD   "  € T F  qP                  R ^4      x € K  	  R# 5i)Ú	N)rø   )r€  rÿ   s   & r   r�  Ú-_fetch_remote_branch_heads.<locals>.<genexpr>	  s   é € ÐLÑ1K¨—‘˜D !×$Ð$Ó1Kùs   ‚ rZ  )z	ls-remotez--headsrõ   )r+   r'   rs   r   r.   r/   rù   r½   rú   r0   r6   )ra   r   r1   Úpairsr<   s   &&   r   Ú_fetch_remote_branch_headsrÛ  ý  sÕ   € ð
äÒ8¸)Ü&×.Ñ.Ô4JÓ4LôNˆà×Ñ Ô!ÙÙL°·±×1IÑ1IÔ1KÓLˆáóRÙ�A¤# a£&¨A¡+ô @Ø23°Aµ$·/±/À-×2Pô @��!•”S˜Ó'Ð(Ð)×/Ñ/Ó1°1°Qµ4·:±:³<Ò?ÙñRð 	Rùò Røäô Úðús4   ‚8C ¼%C Á!CÁ8CÂ=CÃC ÃC ÃC,Ã+C,c                ó€   € V ^8„  d   QhR\         R\        \        \         \         3,          ,          R\        R\        /# )r   ri  Úremote_headsr   r   )r   r   r>  ré   rU   )r   s   "r   r   r     s9   € ÷ ñ ÜðÜ&.¬t´C¼°H­~Õ&>ðÜILðä	ñr   c                óÊ   € V'       g   R#  \        W4      pVe   VP                  V4      MRp\        V4      ;'       d    \        RR.WR7      V8H  #   \         d     R# i ; i)a  Whether the branch head is EXACTLY what origin holds (tree redundant; reap it, keep the branch).

Equality is deliberately the only True case: ahead/diverged heads have commits origin lacks
and ancestry can't be proven cheaply without remote-tracking refs -> fail SAFE toward preserve.
FNrM   rè   rN   )rÊ  r¥  rU   r2   r6   )ri  rÝ  r   rn   Ú
remote_shas   &&&  r   Ú_worktree_branch_pushed_exactrà    sp   € ÷ ÙðÜ)¨-ÓAˆØ17Ò1C�\×%Ñ% fÔ-Èˆ
Ü�JÓ÷ [ð [Ü�k 6Ð*¨MÔKÈzÑYð	[øäô Úðús   Œ3A Á A ÁA"Á!A"z-hermes (?:pid=(\d+)|session=\S+)(?: db=(.+))?c                óH   € V ^8„  d   QhR\         R\         R\         R\        /# )r   ra   ri  Ú
session_idr   rÓ   )r   s   "r   r   r   *  s*   € ÷ "ñ "¬Cð "Äð "ÔQTð "Ôbfñ "r   c           	     óð   € \        RRV.V RR7        \        RRRRV RV 2V.V 4      pTP                  ^ 8H  #   \        \        P                  3 d"   p\
        P                  R	Y4        R
p?R# R
p?ii ; i)a"  Re-lock a ``--tui -w`` tree its exiting launcher retains, naming the session that uses it.

The tree stays live while any resumable session of that store works inside it
(``_retained_tree_is_live``), not only the named one: ``/new`` leaves the older session's
history in the same checkout.
re   rf   z$worktree unlock before retain failed©r4   rŽ   rF  zhermes session=rE  z&worktree retain lock failed for %s: %sNF)r:   r+   r‚   r'   ÚSubprocessErrorr7   r8   r.   )ra   ri  râ  Údb_pathr1   Úexcs   &&&&  r   Ú_retain_worktree_for_sessionrè  *  sŒ   € ô �
˜H mÐ4°iÐEkÕlðÜ�z 6¨:¸ÈÈÐTXÐY`ÐXaÐ7bØ$ð&Ø'0ó2ˆð
 ×Ñ Ñ!Ð!øô ”Z×/Ñ/Ð0ô Ü�‰Ð=¸}ÔRÝûðús   “9 ¹A5ÁA0Á0A5c                ó$   € V ^8„  d   QhR\         /# )r   ri  r   )r   s   "r   r   r   ;  s   € ÷ 
ñ 
¤ñ 
r   c                óŠ   aa€ R R loS! \        V 4      4      S! \        V 4      P                  4       4      0oR VV3R llpV# )z¬``inside(path) -> 0/1``: *path* is the tree or under it (native path identity: Windows is
case-insensitive, either separator; the tree's own spelling and its resolved one).c                ó$   € V ^8„  d   QhR\         /# rK   r   )r   s   "r   r   Ú"_inside_tree.<locals>.__annotate__>  s   € ÷ Kñ K”cñ Kr   c                 ó�   € \         P                  P                  \        V 4      4      P	                  R R4      P                  R4      # )Ú\r@   )r„   rR   Únormcaser   r%   rv  )Úvalues   &r   ÚkeyÚ_inside_tree.<locals>.key>  s3   € Ü�w‰w×Ñ¤ E£
Ó+×3Ñ3°D¸#Ó>×EÑEÀcÓJÐJr   c                ó$   € V ^8„  d   QhR\         /# rK   )ré   )r   s   "r   r   rì  C  s   € ÷ dñ d”sñ dr   c                 óÆ   <a € \        \        S 4      ;'       dE    \        ;QJ d(    V V3R  lS 4       F  '       g   K   R4      # 	  R4      # ! V V3R  lS 4       4      4      # )c              3   ó†   <"  € T F6  pS! S4      V8H  ;'       g    S! S4      P                  VR ,           4      x € K8  	  R# 5i)r@   Nr  )r€  r–  r&   rñ  s   & €€r   r�  Ú/_inside_tree.<locals>.inside.<locals>.<genexpr>D  s:   øé € Ð$bÑ\aÐWX¡S¨£X°¡]×%RÐ%R±c¸#³h×6IÑ6IÈ!ÈcÍ'Ó6RÔ%RÓ\aùs
   ƒAš'ATF)ré   rU   rˆ  )r&   rñ  Úrootss   f€€r   ÚinsideÚ_inside_tree.<locals>.insideC  sE   ù€ Ü”4˜“9×bÐb§£Õ$bÑ\aÓ$b§¤ÓcÐc¢ÓcÐc Õ$bÑ\aÓ$bÓ!bÓcÐcr   )r   r  )ri  rø  rñ  r÷  s   & @@r   Ú_inside_treerú  ;  sC   ù€ õKñ ”�mÓ$Ó%¡s¬4°Ó+>×+FÑ+FÓ+HÓ'IÐJ€E÷dñ dà€Mr   a  SELECT 1 FROM sessions s WHERE hermes_inside_tree(s.cwd) AND (s.ended_at IS NULL OR EXISTS (SELECT 1 FROM state_meta m WHERE m.key IN ('loop:'||s.id, 'heartbeat:'||s.id, 'goal:'||s.id) AND (json_valid(m.value)=0 OR COALESCE(json_extract(m.value,'$.status'),'active')='active'))) LIMIT 1c                óR   € V ^8„  d   QhR\         R\         R\        \         ,          /# )r   ræ  ri  r   )r   r   )r   s   "r   r   r   S  s*   € ÷ Iñ I¤ð I´Cð I¼HÄS½Mñ Ir   c                ó¦  € ^ RI p^ RIHp \        V 4      p\	        4       pVP                  4       '       dº    VP                  RV! \        V4      4       R2R^R7      p VP                  R^\        V4      RR7       VP                  \        4      P                  4       '       d    VP                  4        R	# VP                  R
4       Uu0 uF  qw^ ,          kK  	  ppVP                  4        \#        W4      '       d   R# R# u upi   TP                  4        i ; i  TP                   d"   p\        P!                  RT4        Rp?R# Rp?ii ; i)aÙ  Why the gateway still needs a ``--tui -w`` tree the launcher is about to remove, or None.

Beyond pending admissions (``_retained_tree_is_live(pending_only=True)``): scheduled work for a
session inside it (an active loop, heartbeat or goal continuation), another viewer still holding
such a session (its row was not ended by the quit), or an enabled cron job that runs in the tree
(``workdir``) or is bound to such a session's local chat. Reads only; unreadable fails SAFE.N©Úquoteúfile:ú?mode=roT©Úurir   Úhermes_inside_tree©ÚdeterministicÚsessionzRSELECT chat_id FROM sessions WHERE hermes_inside_tree(cwd) AND chat_id IS NOT NULLz7retained worktree serve check failed (%s); keeping treeÚ
unreadableÚcron)Úsqlite3Úurllib.parserþ  r   rr  r  Úconnectr   Úcreate_functionrú  ÚexecuteÚ_SERVED_TREE_SQLÚfetchoneÚcloseÚErrorr7   r8   Ú_cron_bound_to_tree)	ræ  ri  r	  rþ  rR   ÚchatsÚconnÚrowrç  s	   &&       r   Ú_tree_still_servedr  S  s,  € ó Ý"ä�‹=€DÜ“€EØ‡|�|‡~‚~ð	 Ø—?‘? U©5´°T³Ó+;Ð*<¸HÐ#EÈ4ÐYZ�?Ó[ˆDðØ×$Ñ$Ð%9¸1¼lÈ=Ó>YÐimÐ$ÔnØ—<‘<Ô 0Ó1×:Ñ:×<Ò<Ø$ð —
‘
–ð ,0¯<©<Øhô,jó kñ ,j C˜QŸ˜ñ ,j�ð kð —
‘
”ô )¨×>Ò>ˆ6ÐHÀDÐHùòkøð —
‘
•ûØ�}‰}ô 	 Ü�L‰LÐRÐTWÔXÝûð	 úsN   ·'D ÁAD	 Â'D Â9D	 ÃDÃD	 ÃD ÄD	 Ä	DÄD ÄEÄ/EÅEc                ó<   € V ^8„  d   QhR\         R\        R\        /# )r   ri  r  r   )r   rr  rU   )r   s   "r   r   r   p  s!   € ÷ ñ ¤sð ´3ð ¼4ñ r   c                ój  €  ^ RI HpHpHpHp V! 4       P
                  pVP                  4       '       g   R# V! V4      w  rx\        T\        4      '       d   TP                  R4      MTp
\        T 4      p\        T
\        4      '       d   T
MR Fñ  p\        T\        4      '       d   T! T4      '       d   T! T4      '       d   K7  \        TP                  R4      \        4      '       d   TP                  R4      M/ pT! TP                  R4      4      '       ge   \        TP                  R	4      ;'       g    R
4      P!                  4       R8X  g   KÅ  \        TP                  R4      ;'       g    R
4      T9   g   Kð   R# 	  R#   \         d"   p	\        P                  RT	4        Rp	?	R# Rp	?	ii ; i)zÜAn enabled, non-terminal cron job whose ``workdir`` is inside the tree, or whose origin is
the local chat of a session there. Reads ``jobs.json`` directly (``load_jobs`` may repair-write);
an unreadable store fails SAFE.)Ú_current_cron_storeÚ_parse_jobs_fileÚis_job_runnableÚis_terminal_jobFz(cron store unreadable (%s); keeping treeNTÚjobsrõ   ÚworkdirrB   rï   ÚlocalÚchat_idrO   )Ú	cron.jobsr  r  r  r  Ú	jobs_filerp   r6   r7   r8   r¦  r>  r¥  rú  r¾   r   Úlower)ri  r  r  r  r  r  r"  ÚdataÚ_rç  r  rø  Újobrõ   s   &&            r   r  r  p  sM  € ðßeÓeÙ'Ó)×3Ñ3ˆ	Ø×Ñ×!Ò!ÙÙ" 9Ó-‰ˆô  *¨$´×5Ò5ˆ4�8‰8�FÔ¸4€DÜ˜-Ó(€FÜ! $¬×-Ò-‰t°2Ò5ˆÜ˜#œt×$Ò$©O¸C×,@Ò,@ÁOÐTW×DXÒDXÙÜ&0°·±¸Ó1BÄD×&IÒ&I�—‘˜Ô"ÈrˆÙ�#—'‘'˜)Ó$×%Ò%Ü�F—J‘J˜zÓ*×0Ð0¨bÓ1×7Ñ7Ó9¸WÖDÌÈVÏZÉZÐXaÓMb×MhÐMhÐfhÓIiÐmrÖIrÚñ 6ñ øô ô Ü�‰Ð?ÀÔEÝûðús   ‚2F ·
F ÆF2ÆF-Æ-F2Úpending_onlyFc                óH   € V ^8„  d   QhR\         R\         R\        R\        /# )r   ræ  ri  r'  r   rÓ   )r   s   "r   r   r   ‰  s)   € ÷ ñ ¤Cð ¼ð Ìdð Ô_cñ r   c               ó  € ^ RI p^ RIHp \        V 4      pVP	                  4       '       g   R# \        V4      p VP                  RV! \        V4      4       R2R^R7      p VP                  R^VRR	7       TP                  R
V'       d   RMR,           R,           4      P                  4       pVP                  4        VRJ#   TP                  4        i ; i  TP                   d"   p	\        P                  RT	4        Rp	?	R# Rp	?	ii ; i)a=  Whether a session that can still be resumed has its frozen cwd inside the retained tree:
a row with history or pending gateway work (*pending_only*: pending work alone, the exiting
``--tui -w`` launcher's "is the gateway still using it" check). A missing store means the
profile is gone; unreadable fails SAFE (live).Nrý  Frÿ  r   Tr  r  r  z>SELECT 1 FROM sessions s WHERE hermes_inside_tree(s.cwd) AND (rï   zs.message_count>0 OR zlEXISTS (SELECT 1 FROM session_admissions a WHERE a.target_session_id=s.id AND a.status!='terminal')) LIMIT 1z9retained worktree session check failed (%s); keeping tree)r	  r
  rþ  r   r  rú  r  r   r  r  r  r  r  r7   r8   )
ræ  ri  r'  r	  rþ  rR   rø  r  r  rç  s
   &&$       r   Ú_retained_tree_is_liver*  ‰  sõ   € ó
 Ý"ä�‹=€DØ�<‰<�>Š>ÙÜ˜-Ó(€FðØ�‰ ¡u¬S°«YÓ'7Ð&8¸ÐAÀtÐUVˆÓWˆð	Ø× Ñ Ð!5°q¸&ÐPTÐ ÔUØ—,‘,ØPß%‘2Ð+BõDð5õ5ó6÷ 7?±h³jð	 ð �J‰JŒLð �dˆ?Ðøð	 �J‰J�LûØ�=‰=ô Ü�‰ÐPÐRUÔVÝûðús0   º'C Á"AC Â.C ÃCÃC ÃD	Ã(DÄD	c                ó<   € V ^8„  d   QhR\         R\         R\        /# ©r   ra   ri  r   ©r   ré   )r   s   "r   r   r   ¦  s!   € ÷ ñ ¤Sð ¼ð Äsñ r   c                ód  € \        RR.WR7      pV'       g   \        R4      h\        V4      pVR,          P                  4       '       g   R# VR,          P	                  RR7      pVP                  R	4      '       g   \        R
V 24      hWE\        R	4      R P                  4       ,          P                  4       pVP                  \        V 4      V,          R,          P                  4       8w  d   R#  RVR,          P	                  RRR7      P                  R4      3#   \         d    Ru # i ; i)a-  ``(found, reason)`` from the tree's admin dir (``gitdir:`` of its ``.git`` file, under
``<common-dir>/worktrees/``); reason is ``None`` when unlocked and ``""`` for a bare lock.
Read raw and trimmed, as git does: ``list --porcelain -z`` needs git 2.36. Raises when git
or the admin dir cannot be read.rM   z--git-common-dirrN   znot a git repositoryr·   Nr  ry   zgitdir:zunreadable .git file in Ú	worktreesTÚlockedr%   r  z 	
)FN)TN)r2   ÚRuntimeErrorr   r  r  rú   r½   r0   r  rÁ   rƒ   )ra   ri  r   ÚcommonÚtreeÚlinkÚadmins   &&&    r   Ú_worktree_lock_reasonr6  ¦  s  € ô
 �{Ð$6Ð7¸ÔT€FßÜÐ1Ó2Ð2Ü�Ó€DØ�6�M×"Ñ"×$Ò$ØÐØ�6�M×$Ñ$¨kÐ$Ó:€DØ�?‰?˜9×%Ò%ÜÐ5°d°VÐ<Ó=Ð=Øœ˜Y›˜Ð)×/Ñ/Ó1Õ1×:Ñ:Ó<€EØ‡|�|œ˜Y›¨&Õ0°;Õ>×GÑGÓIÔIØÐðØ�e˜hÕ&×1Ñ1¸;ÈyÐ1ÓY×_Ñ_Ð`mÓnÐnÐnøÜô ØÒðús   Ã4*D ÄD/Ä.D/c                ó<   € V ^8„  d   QhR\         R\         R\        /# r,  r-  )r   s   "r   r   r   ½  s!   € ÷ $1ñ $1¤cð $1¼#ð $1Ìñ $1r   c                óæ  €  \        WV4      w  r4T'       d   Tf   R# TP                  R4      '       g   R# \        P	                  T4      pTf   R# TP                  4       w  rgTeG   \        T4      \        P                  ! 4       8X  d   R#  ^ RI	H
p T! \        T4      4      '       d   R#  Te   \        Yq4      '       d   R# R# Te   R# R#   \         d     R# i ; i  \         d     R# i ; i)aå  Lock state: ``"live"`` (owning pid runs / a resumable session works in the tree),
``"dead"`` (pid and sessions gone / non-hermes reason), None (unlocked).

A Hermes tree locks with reason ``hermes pid=<pid>``; ``worktree remove --force`` refuses
locked trees, so a crashed session's lock would keep its tree forever. A ``-w`` tree
also names its profile's ``state.db`` from creation, so a ``--tui -w`` launcher killed with
its terminal (SIGHUP skips the exit re-lock) still keeps the tree while a resumable session's
row cwd is inside it. A classic ``-w`` row's cwd is the repo root: its tree is only recorded,
and a reaped clean one is recreated on resume. Fails SAFE toward "live", including a
``hermes`` reason this version cannot parse.
ÚliveNzhermes Údead)Ú_pid_exists)r6  r6   rú   Ú_HERMES_LOCK_REÚ	fullmatchÚgroupsré   r„   rŒ   Úgateway.statusr;  r*  )	ra   ri  r   Úfoundrì   rŽ   Úpidræ  r;  s	   &&&      r   Ú_worktree_lock_is_liverB  ½  sæ   € ðÜ-¨iÈÓP‰ˆ÷ �F’NÙØ×Ñ˜Y×'Ò'áÜ×$Ñ$ VÓ,€DØ‚|ÙØ—;‘;“=�L€CØ
‚Üˆs‹8”r—y’y“{Ô"Ùð	Ý2Ùœ3˜s›8×$Ò$Ùð %ð ÒÜ/°×GÒGˆvÐSÈVÐSØ’_ˆ6Ð0¨&Ð0øô- ô Úðûô$ ô 	Úð	ús#   ‚C ÂC! ÃCÃCÃ!C0Ã/C0c                ó<   € V ^8„  d   QhR\         R\        R\        /# )r   r©   Úmax_age_hoursr   )r   r   )r   s   "r   r   r   è  s&   € ÷ Xñ Xœ3ð X¬uð X¼ñ Xr   c                óN   € V P                  \        4      '       d   V# V^,          # )z�Idle hours before a tree may be reclaimed: *max_age_hours* for Hermes-made trees
(``hermes-*``, ``subagent-*``), 3x for deliberately named ones.)rú   Ú_AUTO_TREE_PREFIXES)r©   rD  s   &&r   Úprune_tier_hoursrG  è  s$   € ð !ŸO™OÔ,?×@Ò@ˆ=ÐWÀmÐVWÕFWÐWr   c                óH   € V ^8„  d   QhR\         R\        R\        R\        /# )r   rS  rD  Únowr   )r   ré   r   r¾   )r   s   "r   r   r   î  s(   € ÷ ñ ¤Tð ¼#ð ÄEð Ìdñ r   c           	     óð  € \         P                  ! R4      p. p\        V P                  4       4       F®  pVP	                  4       '       d"   VP                  VP                  4      '       d   K<  \        VP                  V4      p VP                  4       P                  pWrVR,          ,
          8”  d   Kƒ   TP                  YWYrT^,          R,          ,
          8*  34       K°  	  V#   \         d     KÂ  i ; i)a  Phase 1, stat-only age filter -> ``[(entry, mtime, force)]`` for trees past their soft cutoff.

Kanban trees (``t_<hex>``) belong to the kanban gc. Hermes-made trees age on *max_age_hours*,
deliberately named trees at 3x (``prune_tier_hours``); *force* marks the hard (3x) tier.
z^t_[0-9a-f]+$r¤   )rC   ÚcompileÚsortedÚiterdirr¼   rD   r©   rG  r}   r   r6   r  )rS  rD  rI  Ú	kanban_reÚ
candidatesr  Ú
tier_hoursÚmtimes   &&&     r   Ú_prune_candidatesrR  î  sÐ   € ô —
’
Ð+Ó,€IØ€JÜ˜×-Ñ-Ó/Ö0ˆØ�|‰|�~Š~ §¡°·±×!<Ò!<ÙÜ% e§j¡j°-Ó@ˆ
ð	Ø—J‘J“L×)Ñ)ˆEØ˜j¨4Õ/Õ0Ô0Ùð 1ð 	×Ñ˜5¨¸Àa½È$Õ9NÕ2OÑ)OÐPÖQñ 1ð Ðøô ô 	Úð	ús   Â.C&Ã&C5Ã4C5c                ó<   € V ^8„  d   QhR\         R\        R\        /# )r   ra   rO  r   )r   r¾   )r   s   "r   r   r     s&   € ÷ Añ A¬#ð A¼4ð AÄDñ Ar   c           
     ó  a a	a
aaa€ \        4       o\        S4      p\        P                  ! 4       o/ o\        P                  ! 4       o
V
VV 3R lo	V	VVV 3R lp\	        ^\        ^\        P                  ! 4       ;'       g    ^\        V4      4      4      p V^8”  dN   \        P                  P                  VRR7      ;_uu_ 4       p\        VP                  W14      4      pRRR4       MV Uu. uF
  qs! V4      NK  	  pp \        S4      V8w  d   \!        S4       X#   + '       g   i     L-; iu upi   \         d=   p\        P                  RT4       T Uu. uF
  qs! T4      NK  	  Mu upi pp Rp?LwRp?ii ; i)af  Phase 2, parallel read-only classification -> ``[(entry, mtime, force, verdict, lock_state)]``.

verdict in ``dirty`` / ``unpushed`` / ``locked-live`` / ``reap`` / ``reap-keep-branch``. Each
check is a read-only query on a distinct worktree (no repo-wide lock), so a bounded pool is
safe; mutation stays serial. ``git cherry`` verdicts are memoized on disk.
c                  ó–   <€ S ;_uu_ 4        R S9  d   \        S^
R7      SR &   SR ,          uuRRR4       #   + '       g   i     R# ; i)ÚheadsrN   N)rÛ  )Ú_remote_heads_lockÚ_remote_heads_memora   s   €€€r   Ú_get_remote_headsÚ5_classify_prune_candidates.<locals>._get_remote_heads  s<   ø€ ßÒØÐ0Ô0Ü.HÈÐ\^Ô._Ð" 7Ñ+Ø% gÕ.÷  ××Óús	   Œ 7·A	c                 ó¤  <€ V w  rp\        \        V4      S^R7      '       d   WVRR3# Rp\        \        V4      ^R7      '       d°   S	;_uu_ 4        \        S
4      pRRR4       \	        \        V4      ^XR7      pV'       g   \        \        V4      ^VR7      pS	;_uu_ 4        S
P                  V4       RRR4       V'       g)   \        \        V4      S! 4       ^
R7      '       g   WVRR3# V'       * p\        S\        V4      ^R7      pVR8X  d   WVRR3# YY4'       d   R	V3# R
V3#   + '       g   i     LÖ; i  + '       g   i     L�; i)é   rN   ÚdirtyNF)r   r�  ro  r9  úlocked-liveúreap-keep-branchÚreap)	r‰  r   rp  r>  rÇ  rÔ  Úupdaterà  rB  )Úitemr  rQ  ÚforceÚkeep_branchÚsnapshotrÏ  Ú
lock_staterY  Ú
cache_lockÚmerge_cachera   s   &       €€€€r   Ú	_classifyÚ-_classify_prune_candidates.<locals>._classify  s,  ø€ Ø"Ñˆ�eäœc %›j¨)¸Q×?Ó?Ø %¨°$Ð7Ð7ØˆÜ)¬#¨e«*¸a×@Ó@ç’Ü Ó,�÷ ä:¼3¸u»:ÈrÐYaÔbˆFßä3´C¸³JÈÐRZÔ[�ß’Ø×"Ñ" 8Ô,÷ ÷ Ô"?ÄÀEÃ
ÑL]ÓL_ØIK÷#Mó #Mà e¨Z¸Ð>Ð>Ø$œ*ˆKô ,¨I´s¸5³zÈ1ÔMˆ
Ø˜ÔØ %¨¸Ð=Ð=Ø˜e¾;Ð%7ÐT^Ð_Ð_ÈFÐT^Ð_Ð_÷% —ú÷ —ús   ÁD,Â&D?Ä,D<	Ä?E	zhermes-wt-prune)Úmax_workersÚthread_name_prefixNz4Parallel worktree classification failed (%s); serial)rª  r½   Ú	threadingÚLockrÜ   Úminr„   Ú	cpu_countÚ
concurrentÚfuturesÚThreadPoolExecutorr¾   Úmapr6   r7   r8   r°  )ra   rO  Úcache_size_beforeri  ÚworkersÚpoolr¢  Úcr9   rY  rW  rX  rg  rh  s   f&       @@@@@r   Ú_classify_prune_candidatesry    sG  ý€ ô -Ó.€KÜ˜KÓ(ÐÜ—’Ó!€Jð  "ÐÜ"ŸšÓ)Ð÷/÷`ð `ô: �!”S˜œRŸ\š\›^×0Ð0¨q´3°z³?ÓCÓD€Gð
6Ø�QŒ;Ü×#Ñ#×6Ñ6Ø#Ð8Ið 7÷ ô àÜ §¡¨Ó ?Ó@�÷ð ñ
 /9Ó9©j¨˜	 !ž©jˆHÐ9ˆHô
 ˆ;ÓÐ,Ô,Ü" ;Ô/Ø€O÷÷ üò
 :øÜô 6Ü�‰ÐKÈQÔOÙ*4Ó5©* Q�I˜a–Lª*ùÒ5ˆÐ5Œûð6úsT   Â0D7 ÃDÃ"D7 Ã+D7 Ã/D2Ã?D7 ÄD/	Ä*D7 Ä/D7 Ä7E>ÅE9ÅE-Å,E9Å9E>r]  zuncommitted changesro  zunpushed commitsc                óh   € V ^8„  d   QhR\         R\        \        \         \         3,          ,          /# )r   rR   r   )r   r   rÉ   )r   s   "r   r   r   L  s'   € ÷ !ñ !œ#ð !¤(¬5´´c°­?Õ";ñ !r   c                ó   € ^ RI Hp V! V 4      # )zô``(keep-action, reason)`` when deleting the clean tree at *path* would lose something no
branch holds (``worktree_retention.removal_blocker``: a checked-out submodule, an embedded
repository, a per-worktree ref); unverifiable counts as blocked.)Úremoval_blocker)r‡  r|  )rR   r|  s   & r   Úremoval_blockedr}  L  s   € õ >Ù˜4Ó Ð r   c          
      ój   € V ^8„  d   QhR\         R\        R\        R\        \        \        3,          /# )r   ra   r¢  Ústale_work_cutoffr   )r   r¾   r   rÉ   rr  )r   s   "r   r   r   T  s5   € ÷ )*ñ )*¤Cð )*´4ð )*ÌEð )*ÔV[Ô\`ÔbeÐ\eÕVfñ )*r   c                ó’  € . p\        4       pV EF÷  w  rVrxp	\        P                  V4      p
V
'       d*   Wb8:  d"   VP                  VP                   RV
 R24       KN  VR8X  d#   \
        P                  RVP                  4       Kw  \        \        V4      4      pV'       d+   VP                  VP                   RV^,           R24       K½  V	R8X  d(   \        RR\        V4      .V RVP                   2R	7        \        R
R.\        V4      ^R7      P                  P                  4       p\        RR\        V4      R.V ^R7      pVP                  ^ 8w  d=   \
        P                  RVP                  VP                  P                  4       4       EK…  V'       d   VR8X  d   VP                  V4       M0V'       d)   \        R
RV.V \         P"                  \%        4       R7       \
        P                  RVP                  V4       EKú  	  W43#   \&         d.   p\
        P                  RTP                  T4        Rp?EK2  Rp?ii ; i)zýPhase 3, serial unlock / remove / branch -D -> ``(preserved_stale, kept_branches)``.

*kept_branches* must survive the orphaned-branch pass. Branch deletion is gated on
``worktree remove`` succeeding so a failed removal never orphans reachable commits.
z (rç   r^  z!Skipping live-locked worktree: %sr:  re   rf   zFailed to unlock dead worktree rä  rn   ú--show-currentrN   rg   rh   z Failed to remove worktree %s: %sr_  ro   )rl   rm   z$Pruned stale worktree: %s (force=%s)zFailed to prune worktree %s: %sN)rr  Ú_PRESERVE_REASONSr¥  r  r©   r7   r8   r}  r   r:   r+   r/   r0   r.   rš   r5  r'   rs   r   r6   )ra   r¢  r  Úpreserved_staleÚkept_branchesr  rQ  rc  r¶  rf  rì   Úblockedrn   Úremove_resultr9   s   &&&            r   Ú_reap_prune_verdictsr‡  T  sê  € ð €OÜ›€MÜ4<Ñ0ˆ�e jÜ"×&Ñ& wÓ/ˆßØÔ)Ø×&Ñ&¨%¯*©*¨°R¸°x¸qÐ'AÔBÙØ�mÔ#Ü�L‰LÐ<¸e¿j¹jÔIÙÜ!¤# e£*Ó-ˆßØ×"Ñ" e§j¡j \°°G¸AµJ°<¸qÐ#AÔBÙà˜ÔÜ˜
 H¬c°%«jÐ9¸9Ø<¸U¿Z¹Z¸LÐIõKð	KÜ˜8Ð%5Ð6¼¸E»
ÈAÔN×UÑU×[Ñ[Ó]ˆFÜ  *¨h¼¸E»
ÀIÐ!NÐPYÐceÔfˆMØ×'Ñ'¨1Ô,Ü—‘Ð?ÀÇÁÈ]×MaÑMa×MgÑMgÓMiÔjÚß˜'Ð%7Ô7Ø×!Ñ! &Õ)ßä�h  fÐ-¨yÜ%×-Ñ-Ô3IÓ3KõMä�L‰LÐ?ÀÇÁÈU×Sñ= 5=ðB Ð)Ð)øô ô 	KÜ�L‰LÐ:¸E¿J¹JÈ×JÓJûð	Kús,   Ã;BHÆHÆ HÆ=A	HÈIÈ!IÉIc                ó4   € V ^8„  d   QhR\         R\        RR/# ©r   ra   rD  r   Nr-  )r   s   "r   r   r   €  s!   € ÷ )ñ )¤cð )¼#ð )Àtñ )r   c                óP   €  \        W4       \        4        R#   \        4        i ; i)u  Remove stale worktrees and orphaned branches on startup.

Default (``worktrees.archive_dirty: true``): ``worktree_sweep.run_sweep`` â€” an idle dirty or
unpushed tree past its tier is archived to ``refs/hermes/archive/<tree>`` and then removed;
live trees (lock owner or any process inside) and Kanban trees are never touched.
``archive_dirty: false`` (no size budget) runs the classic pass below: dirty trees are never
removed; unpushed commits are never removed UNLESS patch-equivalent to upstream, the PR is
MERGED on GitHub, or the head EXACTLY matches origin (tree reaped, branch kept). Live-locked
trees are skipped; dead locks are unlocked first. Phases: ``_prune_candidates`` ->
``_classify_prune_candidates`` -> ``_reap_prune_verdicts`` -> ``_prune_orphaned_branches``.
N)Ú_prune_stale_worktree_treesÚ_reclaim_orphan_install_states)ra   rD  s   &&r   Ú_prune_stale_worktreesr�  €  s   € ð)Ü# IÔ=ä&Ö(øÔ&Õ(ús   ‚ ™%c                ó   € V ^8„  d   QhRR/# rœ   rO   )r   s   "r   r   r   ’  s   € ÷ Kñ K¨ñ Kr   c                 óÞ   €  ^ RI Hp  ^ RIHp V! V ! 4       4      pV'       d"   \        P                  R\        V4      4       R# R#   \         d    \        P                  RRR7        R# i ; i)aS  Trees removed by any path (the prune pass, `git worktree remove` by hand, `rm -rf` of a
scratch clone) leave their ~200 MB dependency state under <home>/installs/; reclaim it on
every pass, including the early returns where no tree is old enough to prune. Startup
maintenance must never block a launch; the traceback goes to the debug log.)Úinstalls_root)Úcollect_orphan_install_statesz9Reclaimed %d dependency state dir(s) of deleted checkoutsz#Orphan install-state reclaim failedT©Úexc_infoN)	Úpm.environmentsr�  Úpm.install_statesr‘  r7   r±   r½   r6   r8   )r�  r‘  Ú	reclaimeds      r   rŒ  rŒ  ’  sZ   € ð
KÝ1ÝCá1±-³/ÓBˆ	ßÜ�K‰KÐSÔUXÐYbÓUcÖdñ øäô KÜ�‰Ð:ÀTˆ×JðKús   ‚ A £A Á"A,Á+A,c                ó4   € V ^8„  d   QhR\         R\        RR/# r‰  r-  )r   s   "r   r   r   ¢  s!   € ÷  (ñ  (¬3ð  (¼sð  (Àtñ  (r   c           	      óš  € \        V 4      R ,          pVP                  4       '       g   \        V 4       R# \        V 4      '       d   \	        V 4       ^ RIHp VP                  4       pVP                  V4      '       g    VP                  WV4       \        V 4       R# \        P                  ! 4       p\        W!V4      pV'       g   \        V 4       R# \        W4      p\        WVR,
          4      w  r‰V'       d9   \        P!                  R\#        V4      RP%                  \'        V4      4      4       \        W	R7       \        V 4       R# )rD  N)Úworktree_sweepzvPreserving %d worktree(s) older than 7 days with unmerged work (run `hermes worktree prune` to review and reclaim): %sz, )Úprotecti€:	 )r   rp   Ú_prune_orphaned_branchesrŽ  rš  Ú
hermes_clir™  Úsweep_settingsÚclassic_modeÚ	run_sweepÚ_warn_worktree_footprintr~   rR  ry  r‡  r7   r  r½   r”  rL  )
ra   rD  rS  r™  ÚsettingsrI  rO  r¢  rƒ  r„  s
   &&        r   r‹  r‹  ¢  s   € Ü˜“O lÕ2€MØ×Ñ×!Ò!Ü  Ô+Ùô ˜	×"Ò"Ü˜YÔ'å)Ø×,Ñ,Ó.€HØ×&Ñ& x×0Ò0Ø× Ñ  ¸8ÔDÜ  Ô+Ùä
�)Š)‹+€CÜ" =ÀÓE€JßÜ  Ô+Ùä)¨)Ó@€HÜ%9¸)ÈsÐVcÕOdÓ%eÑ"€OçÜ�‰ð Qä˜?Ó+¨T¯Y©Y´v¸oÓ7NÓ-Oô	Qô ˜YÕ>Ü˜YÖ'r   c                ó(   € V ^8„  d   QhR\         RR/# r”   r   )r   s   "r   r   r   Å  s   € ÷ ?ñ ?¬ð ?°ñ ?r   c                ó  €  ^ RI Hp V! V 4      w  r#V^
8¼  g   T;'       g    ^ R8¼  d0   V'       d   VR,          R R2MRp\        P                  RW$4       R# R#   \         d    \        P                  RR	R
7        R# i ; i)zLThe startup pass can leave trees it may not reclaim; say so once per launch.)Úworktrees_summaryi   i   z.1fÚGBzunknown sizeux   .worktrees/ holds %d tree(s) (%s) â€” run `hermes worktree list` to audit and `hermes worktree prune` to reclaim safely.zworktree summary failedTr’  N)Úhermes_cli.worktree_gcr¤  r7   r  r6   r8   )ra   r¤  rÅ  Úsize_mbÚsize_txts   &    r   r   r   Å  s~   € ð	?Ý<á*¨9Ó5‰ˆØ�BŒ;˜7Ÿ<˜< a¨DÔ0ß4;˜' D�.¨Ð-¨RÑ0ÀˆHÜ�N‰Nð UØV[ögñ 1øô ô ?Ü�‰Ð.¸ˆ×>ð?ús   ‚A ¢A ²%A Á"BÂ Bc                óJ   € V ^8„  d   QhR\         R\        \        ,          RR/# )r   ra   rš  r   N)r   r   rr  )r   s   "r   r   r   Ó  s%   € ÷ %?ñ %?¬ð %?´h¼sµmð %?Ètñ %?r   c           
     ó¨  €  \        RR.V 4      pVf   R# VP                  R4       Uu. uF*  q3P                  4       '       g   K  VP                  4       NK,  	  pp\	        4       p \        . ROT 4      pTP                  P                  R4       FR  pTP                  R4      '       g   K  TP                  TP                  R^4      R,          P                  4       4       KT  	   \        RR.T ^R7      P                  P                  4       pT'       d   TP                  T4       TP                  R4       T Uu. uFO  q3T9  g   K  Y1;'       g    R9  g   K  TP                  R	4      '       g   TP                  R
4      '       g   KM  TNKQ  	  p	pT	'       g   R# \        ^ \        T	4      ^24       F<  p
\        RR.YšT
^2,            ,           T ^R\        P                  \        4       R7       K>  	  \        P!                  R\        T	4      4       R# u upi   \         d     R# i ; i  \         d     R# i ; i  \         d     EL$i ; iu upi )zZDelete local ``hermes/hermes-*`` and ``pr-*`` branches with no worktree, except *protect*.rn   z--format=%(refname:short)Nrz   r[  r�  rN   Úmainzhermes/hermes-zpr-ro   z!Failed to prune orphaned branches)r   r4   rl   rm   zPruned %d orphaned branchesr\  éÿÿÿÿrO   )r2   rø   r0   r6   rr  r+   r/   rú   r5  Úranger½   r:   r'   rs   r   r7   r8   )ra   rš  ÚlistingÚbÚall_branchesÚactive_branchesÚ	wt_resultrÿ   ÚcurrentÚorphanedÚis   &&         r   r›  r›  Ó  s  € ðÜ˜HÐ&AÐBÀIÓNˆØŠ?ÙØ+2¯=©=¸Ô+>ÓLÑ+> aÇ'Á'Ç)œ	˜Ÿ™ž	Ñ+>ˆÐLô ›5€OðÜÒ<¸iÓHˆ	Ø×$Ñ$×*Ñ*¨4Ö0ˆDØ�‰Ð3×4Ô4Ø×#Ñ# D§J¡JÐ/CÀQÓ$GÈÕ$K×$QÑ$QÓ$SÖTñ 1ðÜ˜Ð"2Ð3°YÈÔJ×QÑQ×WÑWÓYˆßØ×Ñ Ô(ð ×Ñ˜Ôá'ó M™<�a°OÑ+C”È×R_ÐR_Ð]_ÑH`”Ø—\‘\Ð"2×3Ò3°q·|±|ÀE×7J÷ �™<€Hð M÷ ÙÜ�1”c˜(“m RÖ(ˆÜ�H˜dÐ# h°°RµÐ&8Õ8¸)ÈRØ:Ü#×+Ñ+Ô1GÓ1I÷	Kñ )ô ‡L�LÐ.´°H³Ö>ùò? MøÜô Úðûô ô Úðûô ô ÚðüòMs}   ‚H –H ©HÁHÁH Á&A H+ Â+:H+ Ã&AH= Ä<IÅ	IÅIÅIÅ2IÆIÈH ÈH(È'H(È+H:È9H:È=IÉI)é
   )r¶  Ni`T  )r\  i,  )NTNN)zorigin/HEADzorigin/mainzorigin/master)r«  Úmaster)r\  )iX  )é   rò   N)é   Nrñ   )rB  z	subagent-)é   rŸ   )[Ú__doc__r¬   Úconcurrent.futuresrq  r£  Úloggingr„   rC   rq   r'   rA   rm  r~   rL  Úpathlibr   Útypingr   r   rö   r   r   Úhermes_constantsr	   Úutilsr
   Ú	getLoggerr7   r   r+   r2   r:   rI   rP   rY   r_   rt   rÀ   r¯   r€   r|   r’   r´   rÅ   r  r  r  r-  r;  rU  rd  r^  r`  rf  rp  ry  r‰  rŽ  rš  r¯  rž  rª  r°  rÇ  rÊ  rÔ  rÛ  rà  rK  ÚDOTALLr<  rè  rú  r  r  r  r*  r6  rB  rF  rG  rR  ry  r‚  r}  r‡  r�  rŒ  r‹  r   r›  rO   r   r   Ú<module>rÄ     sÞ  ðñó Û Û Û Û 	Û 	Û Û Û 
Û Û Û Ý ß !ç SÝ ,Ý #à	×	Ò	˜5Ó	!€õ÷
P÷E÷+õõõõKõAð. Ð Ø€ð  Ð Ø#€õõ<|õ88÷4V=õr;õõ"*FõZ% ÷P=cð@ KÐ Ø,Ð ÷÷"
÷õ4÷&÷>÷'ðV !Ð õHõ
jõF÷.õb;÷"÷J÷&ð. —*’*ÐMÈrÏyÉyÓY€õ"õ"
ð&lð õIõ:ð2ÐUZ÷ õ:÷.$1ðP /Ð õXõõ,AðJ Ð3°ZÐASÐTÐ õ!õ)*÷X)õ$Kõ  (õF?÷%?ñ %?r   