+
    lHàjG  ã                  óÈ  a € 0 t $ R t^ RIHt ^RIHtHt ]! 4       t]P                  tRRRut	t
t ! R R]4      tR R	 ltR
 R ltR R ltR R ltR R lt]! RRRR 4       ]! RRRR 4       ]! RRRR 4       ]! RRRR 4       ]! R4      R R l4       t]! R 4      R! R" l4       t]! R#4      R$ R% l4       t]! R&4      R' R( l4       t]! R)4      R* R+ l4       t]! R,4      R- R. l4       t]! R/4      R0 R1 l4       tR2 R3 ltR4 R5 ltR6 R7 ltRRR9 R: lltR; R< ltR= R> ltR? R@ ltRAR8RBRRCR/RD RE llt. RSOtRF RG ltRH RI lt/ tRJ] RK&   RL RM lt!RN RO lt"RP RQ lt#R8# )Tz©Projects RPC surface: per-profile multi-folder workspaces, repo discovery, sidebar tree.
Bodies are rebound onto server.py's globals at install (method_ctx.bind_module).)Úannotations)ÚHandlerRegistryÚbind_moduleiÅ  iÆ  iÇ  c                  ó   € ] tR t^tRtRtR# )Ú
_NoProjectzHRaised inside a projects handler when ``params['id']`` resolves to None.© N)Ú__name__Ú
__module__Ú__qualname__Ú__firstlineno__Ú__doc__Ú__static_attributes__r   ó    ÚA/home/ubuntu/.hermes/hermes-agent/tui_gateway/methods_projects.pyr   r      s   † ÝRr   r   c               ó   € V ^8„  d   QhRR/# ©é   ÚreturnÚdictr   )Úformats   "r   Ú__annotate__r      s   € ÷ .ñ .˜tñ .r   c                óž   € ^ RI Hp RVP                  V RR7       Uu. uF  q"P                  4       NK  	  upRVP	                  V 4      /# u upi )é    ©Úprojects_dbÚprojectsT)Úinclude_archivedÚ	active_id)Ú
hermes_clir   Úlist_projectsÚto_dictÚget_active_id)ÚconnÚpdbÚps   &  r   Ú_projects_payloadr%      sM   € Ý-à¨#×*;Ñ*;¸DÐSWÐ*;Ô*XÓYÑ*X Q—Y‘Y–[Ñ*XÑYØ�S×&Ñ& tÓ,ð.ð .ùÚYs   �A
c               ó   € V ^8„  d   QhRR/# )r   ÚnameÚstrr   )r   s   "r   r   r      s   € ÷ ñ ˜3ñ r   c                ó   a € V 3R lpV# )z™Register a projects RPC, injecting (pdb, conn) and unifying error mapping; profile-scoped
so app-global remote mode reads that profile's ``projects.db``.c                ó^   <a € \        S4      \        P                  R  V 3R ll4       4       pV# )c               ó    € V ^8„  d   QhRRRR/# )r   Úparamsr   r   r   )r   s   "r   r   Ú9_projects_method.<locals>.decorator.<locals>.__annotate__!   s   € ÷ 
	6ñ 
	6 ð 
	6¨$ñ 
	6r   c                óŠ  <€  ^ RI Hp VP                  4       ;_uu_ 4       pS! WW#4      uuRRR4       #   + '       g   i     R# ; i  \         d    \	        T \
        R4      u # \         d%   p\	        T \        \        T4      4      u Rp?# Rp?i\         d%   p\	        T \        \        T4      4      u Rp?# Rp?ii ; i)r   r   Nzno such project)r   r   Úconnect_closingr   Ú_errÚ_E_NO_PROJECTÚ
ValueErrorÚ_E_PROJECT_ARGr(   Ú	ExceptionÚ_E_PROJECTS)Úridr,   r#   r"   ÚeÚfns   &&   €r   ÚhandlerÚ4_projects_method.<locals>.decorator.<locals>.handler   sŒ   ø€ ð	6Ý9Ø×(Ñ(×*Ô*¨dÙ˜c¨3Ó5÷ +×*×*Ó*ûäô CÜ˜C¤Ð0AÓBÒBÜô 9Ü˜C¤´°Q³Ó8Õ8ûÜô 6Ü˜C¤¬c°!«fÓ5Õ5ûð6ús[   ƒA	 ¡	5ª
A	 µA	Á A	 ÁA	 Á	CÁ'CÁ0CÁ1BÂ
CÂCÂCÂB=Â7CÂ=C)ÚmethodÚ	_registryÚprofile_scoped)r8   r9   r'   s   f €r   Ú	decoratorÚ#_projects_method.<locals>.decorator   s.   ù€ Ü	�‹Ü	×	!Ñ	!÷
	6ó 
"ó 
ð
	6ð ˆr   r   )r'   r>   s   f r   Ú_projects_methodr@      s   ø€ õð Ðr   c               ó   € V ^8„  d   QhRR/# )r   r,   r   r   )r   s   "r   r   r   0   s   € ÷ ñ ¨ñ r   c                ó‚   € T P                  T\        VP                  R4      ;'       g    R4      4      pVf   \        hV# )z@The project named by ``params['id']`` (or raise ``_NoProject``).ÚidÚ )Úget_projectr(   Úgetr   )r#   r"   r,   Úprojs   &&& r   Ú_require_projectrH   0   s8   € à�?‰?˜4¤ V§Z¡Z°Ó%5×%;Ð%;¸Ó!<Ó=€DØ‚|ÜÐØ€Kr   c               ó$   € V ^8„  d   QhRRRRRR/# )r   r,   r   Úkeysr(   r   r   )r   s   "r   r   r   8   s!   € ÷ ,ñ ,�$ð ,˜sð , tñ ,r   c                óN   € V Uu/ uF  q"V P                  V4      bK  	  up# u upi ©N©rF   )r,   rJ   Úks   &* r   Ú_pickrO   8   s%   € Ù&*Ó+¡d ˆv�z‰z˜!‹}Ò¡dÑ+Ð+ùÒ+s   …"c               ó(   € V ^8„  d   QhRRRRRRRR/# )r   Úsuffixr(   Úfn_nameÚ
takes_pathÚboolr   ÚNoner   )r   s   "r   r   r   <   s/   € ÷ Oñ O cð O°Cð OÀTð OÐY]ñ Or   c                óD   aaa€ \        RV  24      R VVV3R ll4       pR# )z¦``projects.<suffix>``: resolve ``params['id']`` (5062 when missing), call
``pdb.<fn_name>(conn, id[, path], **kwargs_of(params))``, answer with the refreshed project.z	projects.c               ó   € V ^8„  d   QhRR/# r   r   )r   s   "r   r   Ú/_register_project_mutator.<locals>.__annotate__@   s   € ÷ Oñ O Tñ Or   c                ó0  <€ \        W#V4      pS'       d&   \        VP                  R 4      ;'       g    R4      3MRp\        VS4      ! W4P                  .VO5/ S! V4      B  \        V RVP                  W4P                  4      P                  4       /4      # )ÚpathrD   Úprojectr   )rH   r(   rF   ÚgetattrrC   Ú_okrE   r    )	r6   r,   r#   r"   rG   ÚargsrR   Ú	kwargs_ofrS   s	   &&&&  €€€r   Ú_Ú$_register_project_mutator.<locals>._?   s{   ø€ ä ¨6Ó2ˆß3=”�F—J‘J˜vÓ&×,Ð,¨"Ó-Ñ/À2ˆÜ��WÔ˜d§G¡GÐH¨dÒH±iÀÓ6GÒHÜ�3˜ C§O¡O°D¿'¹'Ó$B×$JÑ$JÓ$LÐMÓNÐNr   N)r@   )rQ   rR   rS   r_   r`   s   &fff r   Ú_register_project_mutatorrb   <   s+   ú€ ô ˜	 & Ð*Ó+÷Oñ Oó ,òOr   ÚupdateÚupdate_projectFc                ó"   € \        V R RRRR4      # )r'   ÚdescriptionÚiconÚcolorÚ
board_slug)rO   ©r$   s   &r   Ú<lambda>rk   I   s   € Œe�A�v˜}¨f°g¸|ÔLr   Ú
add_folderTc                ó\   € R V P                  R 4      R\        V P                  R4      4      /# )ÚlabelÚ
is_primary)rF   rT   rj   s   &r   rk   rk   L   s#   € ˆw˜Ÿ™˜g›¨´d¸1¿5¹5ÀÓ;NÓ6OÑPr   Úremove_folderc                ó   € / # rL   r   rj   s   &r   rk   rk   M   s   € ÉBr   Úset_primaryc                ó   € / # rL   r   rj   s   &r   rk   rk   N   s   € Ér   zprojects.listc               ó   € V ^8„  d   QhRR/# r   r   )r   s   "r   r   r   R   s   € ÷ -ñ - ñ -r   c                ó,   € \        V \        V4      4      # rL   )r]   r%   ©r6   r,   r#   r"   s   &&&&r   r`   r`   Q   s   € äˆsÔ% dÓ+Ó,Ð,r   zprojects.getc               ó   € V ^8„  d   QhRR/# r   r   )r   s   "r   r   r   W   s   € ÷ Pñ P ñ Pr   c           	     óN   € \        V R \        W#V4      P                  4       /4      # )r[   )r]   rH   r    rv   s   &&&&r   r`   r`   V   s%   € äˆs�YÔ 0°¸FÓ C× KÑ KÓ MÐNÓOÐOr   zprojects.createc               ó   € V ^8„  d   QhRR/# r   r   )r   s   "r   r   r   \   s   € ÷ 	Cñ 	C ñ 	Cr   c                ó¨  € VP                   ! V3R \        VP                  R 4      ;'       g    R4      RVP                  R4      ;'       g    . /\        VRRRRRR4      B pVP                  R	4      '       d   VP	                  W44       ^ R
IHp V! R4       VP                  W44      p\        T RV'       d   VP                  4       /4      # R/4      # )r'   rD   ÚfoldersÚslugÚprimary_pathrf   rg   rh   ri   Úuse)Úrecord_feature_usedr   r[   N)
Úcreate_projectr(   rF   rO   Ú
set_activeÚ/hermes_cli.observability.shared_metrics_signalsr   rE   r]   r    )r6   r,   r#   r"   Úpidr   rG   s   &&&&   r   r`   r`   [   sÆ   € à
×
Ò
Øñ_Ü�v—z‘z &Ó)×/Ð/¨RÓ0ð_Ø:@¿*¹*ÀYÓ:O×:UÐ:UÐSUð_ä
�˜ °¸vÀwÐP\Ó
]ñ_€Cð ‡z�z�%×ÒØ�‰�tÔ!ÝSÙ˜
Ô#Ø�?‰?˜4Ó%€DÜˆs�Y·$ §¡£ÐAÓBÐB¸DÐAÓBÐBr   zprojects.archivec               ó   € V ^8„  d   QhRR/# r   r   )r   s   "r   r   r   i   s   € ÷ -ñ - ñ -r   c                óÂ   € \        W#V4      pVP                  R 4      '       d   VP                  MVP                  ! W4P                  4       \        V \        V4      4      # )Úrestore)rH   rF   Úrestore_projectÚarchive_projectrC   r]   r%   )r6   r,   r#   r"   rG   s   &&&& r   r`   r`   h   sN   € ä˜C vÓ.€DØ"ŸJ™J y×1Ò1€S×Ò°s×7JÑ7JÐJÈD×RYÑRYÔZÜˆsÔ% dÓ+Ó,Ð,r   zprojects.deletec               ó   € V ^8„  d   QhRR/# r   r   )r   s   "r   r   r   p   s   € ÷ -ñ - ñ -r   c                óx   € VP                  V\        W#V4      P                  4       \        V \	        V4      4      # rL   )Údelete_projectrH   rC   r]   r%   rv   s   &&&&r   r`   r`   o   s3   € à×Ñ�tÔ-¨c¸Ó@×CÑCÔDÜˆsÔ% dÓ+Ó,Ð,r   zprojects.set_activec               ó   € V ^8„  d   QhRR/# r   r   )r   s   "r   r   r   v   s   € ÷ <ñ < ñ <r   c                ó¸   € TP                  Y1P                  R 4      '       d   \        W#V4      P                  MR4       \	        V RVP                  V4      /4      # )rC   Nr   )r�   rF   rH   rC   r]   r!   rv   s   &&&&r   r`   r`   u   sJ   € à‡N�N�4Ç:Á:Èd×CSÒCSÔ)¨#°VÓ<×?Ò?ÐY]Ô^Üˆs�[ #×"3Ñ"3°DÓ"9Ð:Ó;Ð;r   zprojects.for_cwdc               ó   € V ^8„  d   QhRR/# r   r   )r   s   "r   r   r   |   s   € ÷ *ñ * ñ *r   c                óJ  € \        VP                  R 4      '       d5   R \        VP                  R 4      ;'       g    R4      P                  4       /M/ 4      pVP	                  W44      p\        T RV'       d   VP                  4       MRR VR\        P                  V4      /4      # )ÚcwdrD   r[   NÚbranch)	Ú_completion_cwdrF   r(   ÚstripÚproject_for_pathr]   r    Ú	git_prober‘   )r6   r,   r#   r"   r�   rG   s   &&&&  r   r`   r`   {   sŒ   € ä
Ø9?¿¹ÀE×9JÒ9Jˆ”�F—J‘J˜uÓ%×+Ð+¨Ó,×2Ñ2Ó4Ñ5ÐPRóT€Cà×Ñ Ó*€DÜˆsØ§T�4—<‘<”>¨t°U¸CØ”)×"Ñ" 3Ó'ð)ó *ð *r   c               ó   € V ^8„  d   QhRR/# )r   r   zset[str]r   )r   s   "r   r   r   …   s   € ÷ Uñ U˜Xñ Ur   c                 ó’  € \         P                  P                  \         P                  P                  R4      4      p \         P                  V \         P                  P                  V 4      RR3pV Uu0 uFH  q"'       g   K  \         P                  P                  \         P                  P                  V4      4      kKJ  	  up# u upi )z¾Never-a-workspace dirs: ``/``, the user's home, the dir homes live in, plus both POSIX
spellings on every host (remote shells hand back Linux paths; promoting one mints a
catch-all project).Ú~z/homez/Users)ÚosrZ   ÚrealpathÚ
expanduserÚsepÚdirnameÚnormcase)ÚhomeÚ
candidatesrZ   s      r   Ú_non_workspace_dirsr¡   …   sƒ   € ô �7‰7×ÑœBŸG™G×.Ñ.¨sÓ3Ó4€DÜ—&‘&˜$¤§¡§¡°Ó 5°wÀÐI€JÙAKÓTÁ¸ËtÔ4ŒB�G‰G×ÑœRŸW™W×-Ñ-¨dÓ3Ö4ÁÑTÐTùÒTs   Á3	CÂA Cc               ó    € V ^8„  d   QhRRRR/# )r   Úrootr(   r   rT   r   )r   s   "r   r   r   Ž   s   € ÷ 2ñ 2˜ð 2 ñ 2r   c                ó‚  € V '       g   R# ^ RI Hp \        P                  P	                  V 4      p\        P                  P	                  \        V! 4       4      4      p\        P                  P                  V4      \        4       9   ;'       g3    W#8H  ;'       g'    VP                  V\        P                  ,           4      # )z—A git root never auto-surfaced as a project: a non-workspace dir or anything under
HERMES_HOME. User-created projects pointing there are still honored.T©Úget_hermes_home)
Úhermes_constantsr¦   r™   rZ   rš   r(   rž   r¡   Ú
startswithrœ   )r£   r¦   ÚrealÚhermes_homes   &   r   Ú_is_repo_junkr«   Ž   sŒ   € ÷ ÙÝ0Ü�7‰7×Ñ˜DÓ!€DÜ—'‘'×"Ñ"¤3¡Ó'8Ó#9Ó:€Kä
�‰×Ñ˜ÓÔ"5Ó"7Ñ7÷ 	1ð 	1ØÑ÷	1ð 	1à�?‰?˜;¬¯©Õ/Ó0ð2r   c               ó    € V ^8„  d   QhRRRR/# )r   r�   r(   r   rT   r   )r   s   "r   r   r   œ   s   € ÷ @ñ @˜cð @ dñ @r   c                ó`  € V '       g   R# ^ RI Hp \        P                  P	                  \        P                  P                  V 4      4      p\        P                  P	                  \        P                  P                  \        V! 4       4      4      4      pV\        4       9   ;'       g    W#8H  # )zžA non-git cwd that stays in flat Recents. A DESCENDANT of HERMES_HOME may be an
intentional prose/data workspace, so only HERMES_HOME itself is excluded here.Tr¥   )r§   r¦   r™   rZ   rž   rš   r(   r¡   )r�   r¦   r©   rª   s   &   r   Ú_is_session_cwd_junkr®   œ   su   € ÷ ÙÝ0Ü�7‰7×ÑœBŸG™G×,Ñ,¨SÓ1Ó2€DÜ—'‘'×"Ñ"¤2§7¡7×#3Ñ#3´C¹Ó8IÓ4JÓ#KÓL€KØÔ&Ó(Ñ(×?Ð?¨DÑ,?Ð?r   Nc               ó    € V ^8„  d   QhRRRR/# )r   Úrawzdict | Noner   r   r   )r   s   "r   r   r   §   s   € ÷ Mñ M ð M°tñ Mr   c           	     óp  aaa€ ^ RI Hp VR,          o\        V \        4      '       d   T M"\	        4       P                  R4      ;'       g    / o\        S\        4      '       g   / oR VV3R lloR VV3R llpS! RR4      pR\        V\        4      '       d   TMSR,          R	V! R	R
4      RV! RR4      /# )zCReturn the effective, profile-local Desktop repository scan policy.©ÚDEFAULT_CONFIGÚdesktopc               ó    € V ^8„  d   QhRRRR/# )r   Úshortr(   Úlongr   )r   s   "r   r   Ú,_repo_discovery_policy.<locals>.__annotate__¯   s   € ÷ Cñ C�Cð C˜sñ Cr   c                óV   <€ SP                  V SP                  VSV,          4      4      # rL   rM   )r¶   r·   ÚdefaultsÚsources   &&€€r   Ú_getÚ$_repo_discovery_policy.<locals>._get¯   s#   ø€ Ø�z‰z˜% §¡¨D°(¸4µ.Ó!AÓBÐBr   c               ó$   € V ^8„  d   QhRRRRRR/# )r   r¶   r(   r·   r   ú	list[str]r   )r   s   "r   r   r¸   ²   s&   € ÷ Oñ O�cð O ð O¨ñ Or   c                ó  <€ S! W4      p\        V\        4      '       g   \        SV,          4      # V Uu. uFC  p\        V\        4      '       g   K  VP                  4       '       g   K3  VP                  4       NKE  	  up# u upi rL   )Ú
isinstanceÚlistr(   r“   )r¶   r·   ÚvaluesÚvr¼   rº   s   &&  €€r   Ú_pathsÚ&_repo_discovery_policy.<locals>._paths²   s\   ø€ Ù�eÓ"ˆÜ˜&¤$×'Ò'Ü˜ �Ó'Ð'Ù#)ÓN¡6˜a¬Z¸¼3×-?”	ÀAÇGÁGÇI”	�—‘–	¡6ÑNÐNùÒNs   ¶BÁBÁ+BÚenabledÚrepo_scan_enabledÚrootsÚrepo_scan_rootsÚexclude_pathsÚrepo_scan_exclude_paths)Úhermes_cli.configr³   rÁ   r   Ú	_load_cfgrF   rT   )r°   r³   rÅ   rÇ   r¼   rº   r»   s   &   @@@r   Ú_repo_discovery_policyrÏ   §   s®   ú€ å0Ø˜iÕ(€HÜ˜s¤D×)Ò)‰S´	³·±À	Ó0J×0PÐ0PÈb€FÜ�fœd×#Ò#Øˆ÷Cñ C÷Oñ Oñ
 �9Ð1Ó2€Gàœj¨´$×7Ò7‘7¸XÐFYÕ=ZØ‘˜Ð!2Ó3Ø™ Ð1JÓKðMð Mr   c               ó    € V ^8„  d   QhRRRR/# )r   Úpolicyr   r   r(   r   )r   s   "r   r   r   ¾   s   € ÷ 	Hñ 	H tð 	H°ñ 	Hr   c           	     ó¢   € R  R lpR\        V R,          4      RV! V R,          4      RV! V R,          4      /p\        P                  VRRR7      # )c               ó    € V ^8„  d   QhRRRR/# )r   rÃ   r¿   r   r   )r   s   "r   r   Ú0_repo_discovery_policy_key.<locals>.__annotate__¿   s   € ÷ ñ �yð  Yñ r   c                ój  € \         P                  P                  R 4      p\        V  Uu0 uFz  p\         P                  P	                  \         P                  P                  \         P                  P                  V\         P                  P                  V4      4      4      4      kK|  	  up4      # u upi )r˜   )r™   rZ   r›   Úsortedrž   ÚabspathÚjoin)rÃ   rŸ   rÄ   s   &  r   rÅ   Ú*_repo_discovery_policy_key.<locals>._paths¿   s~   € Ü�w‰w×!Ñ! #Ó&ˆÜáóá�ô �G‰G×ÑœRŸW™WŸ_™_¬R¯W©W¯\©\¸$ÄÇÁ×@RÑ@RÐSTÓ@UÓ-VÓWÖXÙñó ð 	ùò s   ©B B0rÇ   rÉ   rË   T)Ú	sort_keysÚ
separators)Ú,Ú:)rT   ÚjsonÚdumps)rÑ   rÅ   Ú	canonicals   &  r   Ú_repo_discovery_policy_keyrá   ¾   sR   € õð 	”4˜˜yÕ)Ó*¨G±V¸FÀ7½OÓ5LØ™  Õ 7Ó8ð:€Iô �:‰:�i¨4¸Jˆ:ÓGÐGr   c               ó    € V ^8„  d   QhRRRR/# ©r   rÑ   r   r   rT   r   )r   s   "r   r   r   Ê   s   € ÷ ;ñ ;¨dð ;°tñ ;r   c                ó\   € ^ RI Hp \        V 4      \        \        VR,          4      4      8H  # )r   r²   r´   )rÍ   r³   rá   rÏ   )rÑ   r³   s   & r   Ú!_repo_discovery_policy_is_defaultrå   Ê   s,   € Ý0Ü% fÓ-Ô1KÜ˜~¨iÕ8Ó9ó2;ñ ;ð ;r   c               ó    € V ^8„  d   QhRRRR/# rã   r   )r   s   "r   r   r   Ð   s   € ÷ 7ñ 7°ð 7¸ñ 7r   c                ó  a€ ^ RI Hp VP                  R4      ;'       g    . pVP                  R4      ;'       g    . o. p\        4       pRpR V3R llpV EF(  p\        P
                  P                  V4      '       g   Rp\        P                  RV4       KC   \        P                  V4       F¶  w  ršpV! V	4      '       d   . V
R	&   MŠR
V
9   dN   W•9  dB   VP                  V	4       VP                  V	\        P
                  P                  V	4      34       . V
R	&   M6V
 Uu. uF&  qÌP                  R4      '       d   K  VR8w  g   K$  VNK(  	  upV
R	&   \        V4      R8¼  g   K¶   M	   \        V4      R8¼  g   EK'  Rp M	  V'       d!    VP!                  WV\#        V4      R7       V# V# u upi   \         d    Rp\        P                  RTRR7        Loi ; i  \         d    \        P                  RRR7       Rp T# i ; i)u¹  Backend-side disk scan of the policy roots into the discovery cache. Best-effort:
failures log and leave the cache untouched. True only when the scan is authoritative
(every root walked to completion, cap not hit) â€” only then is the cache write
``replace=True``; a partial/errored scan must MERGE, or a failed refresh blanks the sidebar.

The desktop's native repo scan only runs on the local filesystem. On a remote gateway connection the
host must scan its own disk so repos with zero Hermes sessions still appear in the sidebar (#81723).
Mirrors the desktop's behavior: walk each root (bounded depth), find `.git` directories, record (root,
label) pairs into the discovery cache.
See #81723.
r   rÉ   rË   Tc               ó    € V ^8„  d   QhRRRR/# ©r   rZ   r(   r   rT   r   )r   s   "r   r   Ú3_scan_discovered_repos_remote.<locals>.__annotate__ã   s   € ÷ _ñ _˜3ð _ 4ñ _r   c                óz   <a € \         ;QJ d    V 3R  lS 4       F  '       g   K   R# 	  R# ! V 3R  lS 4       4      # )c              3  óº   <"  € T FP  q'       g   K  SV8H  ;'       g6    SP                  VP                  R 4      \        P                  ,           4      x € KR  	  R# 5i)ú/\N)r¨   Úrstripr™   rœ   )Ú.0ÚexrZ   s   & €r   Ú	<genexpr>ÚF_scan_discovered_repos_remote.<locals>._is_excluded.<locals>.<genexpr>ä   sE   øé € ð _ÙOWÈÓ[]ÔDˆD�B‰J×DÐD˜$Ÿ/™/¨"¯)©)°EÓ*:¼R¿V¹VÕ*CÓDÔDËxùs   ƒ	A‘A�>ATF)Úany)rZ   Úexcludess   f€r   Ú_is_excludedÚ3_scan_discovered_repos_remote.<locals>._is_excludedã   sF   ù€ ß‹sô _ÙOWó_�sŒsð 	_Šsð 	_ˆsô _ÙOWó_ó _ð 	_r   Fz.discover_repos scan root missing, skipping: %s:NNNz.gitÚ.Únode_modulesiô  z&discover_repos scan failed for root %s©Úexc_info)ÚreplaceÚ
policy_keyz!discover_repos cache write failed)r   r   rF   Úsetr™   rZ   ÚisdirÚloggerÚdebugÚwalkÚaddÚappendÚbasenamer¨   Úlenr4   Úrecord_discovered_reposrá   )r"   rÑ   r#   rÉ   ÚpairsÚseenÚauthoritativerõ   r£   ÚdirpathÚdirnamesÚ
_filenamesÚdrô   s   &&           @r   Ú_scan_discovered_repos_remoter  Ð   sì  ø€ õ .Ø�J‰J�wÓ×%Ð% 2€EØ�z‰z˜/Ó*×0Ð0¨b€HØ*,€EÜ“U€DØ€M÷_ð _ô ˆÜ�w‰w�}‰}˜T×"Ò"à!ˆMÜ�L‰LÐIÈ4ÔPÙð	XÜ13·±¸¶Ñ-� :Ù ×(Ò(Ø"$�H˜Q’KØ˜xÔ'ØÔ*ØŸ™ Ô)ØŸ™ g¬r¯w©w×/?Ñ/?ÀÓ/HÐ%IÔJØ"$�H˜Q’Kñ $,ó#^Ù#+˜a·<±<À×3DœÈÈnÑI\Ÿ˜¡8ñ#^�H˜Q‘Kä�u“: Ö$Ùò 2?ô  ˆu‹:˜×Ø!ˆMÙñ3 ÷4 ð	"Ø×'Ñ'Ø ]Ô?YÐZ`Ó?að (ô cð
 Ðˆ=Ðùò##^øô ô 	XØ!ˆMÜ�L‰LÐAÀ4ÐRVˆLÖWð	Xûô ô 	"Ü�L‰LÐ<ÀtˆLÔLØ!‰MØÐð	"úsO   ÂBF3Ä"F.Ä?F.ÅF.ÅF3Å&F3Å(F3ÆG Æ.F3Æ3%GÇGÇ$HÈHr"   ÚbackfillÚinclude_cachedc               ó$   € V ^8„  d   QhRRRRRR/# )r   r  rT   r  r   z
list[dict]r   )r   s   "r   r   r   
  s$   € ÷ 3ñ 3Ø $ð3Ø=Að3ØMWñ3r   c          	     ó  a€ / oR V3R llpV e   \        V P                  4       4      M. p\        P                  R V 4       4       / pV FÔ  p\	        VP                  R4      ;'       g    R4      p\        P                  V4      p	V	'       g   KF  W–V&   \        V	4      '       d   K]  V! V	4      p
T
R;;,          \        VP                  R4      ;'       g    ^ 4      ,          uu&   \        V
R,          \        VP                  R4      ;'       g    ^ 4      4      V
R&   KÖ  	  V'       d*   V e&   \        V R	R
4      '       g    V P                  V4       V'       dÈ    ^ RIHp Ve   \$        P'                  V4      MVP)                  4       ;_uu_ 4       pVP+                  V4       Fq  p\	        VP                  R4      ;'       g    R4      p	V	'       g   K1  \        V	4      '       d   KD  V! V	4      p
VP                  R4      '       g   Ke  VR,          V
R&   Ks  	  RRR4       \-        SP/                  4       R RR7      pV F]  pVR,          ;'       gG    \0        P2                  P5                  VR,          P7                  R4      4      ;'       g
    VR,          VR&   K_  	  V#   \         d    \        P                  RRR7        ELvi ; i  + '       g   i     L»; i  \         d    \        P                  RRR7        Lâi ; i)uã   Merge cached filesystem-scanned repos with session-derived roots, junk-filtered, with
session totals. ``backfill`` persists resolved roots onto session rows â€” kept OFF the
per-turn tree path and done only on explicit refresh.c               ó    € V ^8„  d   QhRRRR/# )r   r£   r(   r   r   r   )r   s   "r   r   Ú-_discover_repos_payload.<locals>.__annotate__  s   € ÷ Rñ R�3ð R˜4ñ Rr   c                ó8   <€ SP                  V R V RRR^ RR/4      # )r£   rn   rD   ÚsessionsÚlast_activeg        )Ú
setdefault)r£   Úreposs   &€r   Ú_aggÚ%_discover_repos_payload.<locals>._agg  s.   ø€ Ø×ÑØ�6˜4 ¨"¨j¸!¸]ÈCÐPóRð 	Rr   Nc              3  ój   "  € T F)  p\        VP                  R 4      ;'       g    R4      x € K+  	  R# 5i)r�   rD   N)r(   rF   )rï   Úrs   & r   rñ   Ú*_discover_repos_payload.<locals>.<genexpr>  s(   é € ÐC¹(°Qœ˜QŸU™U 5›\×/Ð/¨R×0Ð0»(ùs   ‚!3¤3r�   rD   r  r  Ú	read_onlyFzfailed to backfill repo rootsTrù   r   r£   rn   z$failed to read discovered repo cachec                ó   € V R ,          # )r  r   )r  s   &r   rk   Ú)_discover_repos_payload.<locals>.<lambda>:  s	   € ¨q°Ö/?r   )ÚkeyÚreverserí   )rÂ   Údistinct_session_cwdsr•   Ú
warm_rootsr(   rF   Úcommon_repo_rootr«   ÚintÚmaxÚfloatr\   Úbackfill_repo_rootsr4   rÿ   r   r   r   Ú
contextlibÚnullcontextr/   Úlist_discovered_reposrÖ   rÃ   r™   rZ   r  rî   )Údbr"   r  r  r  Úcwd_rowsÚcwd_to_rootÚrowr�   r£   Úaggr#   ÚcÚentryÚoutr  r  s   &$$$            @r   Ú_discover_repos_payloadr6  
  sw  ø€ ð
  €E÷Rð Rð
 46²>Œt�B×,Ñ,Ó.Ô/Àr€Hä×ÑÑC¹(ÓCÔCØ"$€KÛˆÜ�#—'‘'˜%“.×&Ð& BÓ'ˆÜ×)Ñ)¨#Ó.ˆßÙØ�CÑÜ˜×ÒÙÙ�4‹jˆØˆJ�œ3˜sŸw™w zÓ2×7Ð7°aÓ8Õ8‹Ü   ]Õ!3´U¸3¿7¹7À=Ó;Q×;VÐ;VÐUVÓ5WÓXˆˆMÓñ ÷ �B’N¬7°2°{ÀE×+JÒ+Jð	IØ×"Ñ" ;Ô/÷ ð
	PÝ5Ø26Ò2B”*×(Ñ(¨Ô.È×H[ÑH[ÓH]×]Ð]ÐbcØ ×6Ñ6°qÖ9�EÜ˜uŸy™y¨Ó0×6Ð6°BÓ7�Dß‘t¤M°$×$7Ô$7Ù" 4›j˜Ø Ÿ9™9 W×-Ô-Ø+0°­>˜C ›Lñ :÷ ^ô �—‘“Ñ%?ÈÔ
N€CÛˆØ�w•Z×YÐY¤2§7¡7×#3Ñ#3°A°fµI×4DÑ4DÀUÓ4KÓ#L×YÐYÐPQÐRXÕPYˆˆ'‹
ñ à€Jøô% ô 	IÜ�L‰LÐ8À4ˆL×Hð	Iú÷ ^×]ûô ô 	PÜ�L‰LÐ?È$ˆLÖOð	PúsZ   ÅJ& Å7K" Æ1KÇKÇKÇ+KÈKÈK" Ê&"KËKËK	ËK" ËK" Ë""LÌLc               ó    € V ^8„  d   QhRRRR/# )r   r  r   r   r   )r   s   "r   r   r   D  s   € ÷ ñ ˜ð  $ñ r   c                ó†  € R Uu/ uF  qV P                  V4      bK  	  ppVP                  ! R	RV P                  R4      ;'       g    ^ RV P                  R4      RV P                  R4      ;'       g    V P                  R4      ;'       g    ^ RV P                  R4      R\        V P                  R4      4      /R
 Uu/ uF  qV P                  V4      ;'       g    ^ bK   	  upBR Uu/ uF  qV P                  V4      bK  	  upBRR/BR Uu/ uF  qV P                  V4      bK  	  upB  V# u upi u upi u upi u upi )z�Project a SessionDB row to the minimal shape the sidebar renders (grouping fields +
what ``SidebarSessionRow`` reads), minus the heavy columns.Ú
started_atÚended_atr  r»   ÚarchivedÚ	is_activeF)rC   Ú_lineage_root_idÚ_lineage_idsÚparent_session_idÚ_reset_fromÚ_branched_fromÚtitleÚpreviewr   )Úmessage_countÚtool_call_countÚinput_tokensÚoutput_tokens)Úactual_cost_usdÚestimated_cost_usdÚmodel)r�   Ú
git_branchÚgit_repo_root)rF   rc   rT   )r  rN   r1  s   &  r   Ú_project_tree_rowrM  D  si  € ñ!=ó >ñ !=˜1ˆa�e‰e�A‹hŠ;ñ !=€Cð >ð ‡J‚Jñ ZØ—5‘5˜Ó&×+Ð+¨!ðZØ67·e±e¸JÓ6GðZà—E‘E˜-Ó(×DÐD¨A¯E©E°,Ó,?×DÐDÀ1ðZð �u‰u�X‹ðZô *.¨a¯e©e°JÓ.?Ó)@ðZñ&Qó Rñ &Q ˆa�e‰e�A‹h�mˆm˜!Òñ &Qñ Rð	Zñ !SÓ
SÑ R˜1ˆa�e‰e�A‹hŠ;Ñ RÑ
SñZð ñZñ 2XÓXÑ1W¨A˜qŸu™u Q›xšKÑ1WÑXòZð €Jùò>ùòRùâ
SùÚXs   …D/Â>D4ÃD4Ã)D9ÄD>c               ó$   € V ^8„  d   QhRRRRRR/# )r   Úsession_limitr'  Úinclude_discoveredrT   r   z5tuple[list[dict], list[dict], list[dict], str | None]r   )r   s   "r   r   r   U  s$   € ÷ 5ñ 5Øð5Ø37ð5à:ñ5r   c               óh  € V P                  V^ R^R\        RRR7      pV Uu. uF  p\        V4      NK  	  pp\        P	                  R V 4       4       ^ RIHp \        4       p\        V4      pVP                  4       ;_uu_ 4       p	V'       d   VP                  W˜\        V4      R7       VP                  V	4       U
u. uF  qªP                  4       NK  	  pp
VP                  V	4      p. pV'       d   \        W	RVR,          R7      pR	R	R	4       VXXX3# u upi u up
i   + '       g   i     L ; i)
zÙGather (sessions, projects, discovered_repos, active_id) for build_tree.
``include_discovered`` is the zero-session-repo overview tier; drill-in skips it (and
the distinct-cwd scan + git probes) on that per-turn path.TF)ÚlimitÚoffsetÚorder_by_last_activeÚmin_message_countÚinclude_childrenÚexclude_sourcesr   Úcompact_rowsc              3  ód   "  € T F&  qP                  R 4      '       g   K  VR ,          x € K(  	  R# 5i)r�   NrM   )rï   Úss   & r   rñ   Ú'_project_tree_inputs.<locals>.<genexpr>b  s    é € ÐD©8 a·u±u¸U·|œ˜˜5Ÿš«8ùs   ‚0Ÿ0r   )Úpreserve_unversionedrÇ   )r"   r  r  N)Úlist_sessions_richÚ_PROJECT_TREE_EXCLUDED_SOURCESrM  r•   r%  r   r   rÏ   rá   r/   Ú!reconcile_discovered_repos_policyrå   r   r    r!   r6  )r.  rO  rP  Úrowsr  r  r#   rÑ   rü   r"   r$   r   r   Ú
discovereds   &&$           r   Ú_project_tree_inputsrb  U  s%  € ð × Ñ Ø A¸DÐTUØÔ0NØ¨Tð !ó 3€Dñ /3Ó3©d¨Ô! !Ö$©d€HÐ3ä×ÑÑD©8ÓDÔDÝ-Ü#Ó%€FÜ+¨FÓ3€JØ	×	Ñ	×	Ô	 $ßØ×1Ñ1ØÔ7XÐY_Ó7`ð 2ô bà),×):Ñ):¸4Ô)@ÓAÑ)@ A—I‘I–KÑ)@ˆÐAØ×%Ñ% dÓ+ˆ	àˆ
ßÜ0Ø¨¸fÀYÕ>OôQˆJ÷ 
ð �X˜z¨9Ð4Ð4ùò# 4ùò B÷	 
×	ús#   ¢DÂ8D!Â?DÃ2D!ÄD!Ä!D1	zdict[str, bool]Ú_DIR_EXISTS_CACHEc               ó    € V ^8„  d   QhRRRR/# ré   r   )r   s   "r   r   r   x  s   € ÷ ñ ˜Sð  Tñ r   c                óˆ   € \         P                  V 4      pVf)   \        P                  P	                  V 4      ;p\         V &   V# )uW   ``os.path.isdir`` memoized per build â€” ``build_tree`` asks per SESSION, not per path.)rc  rF   r™   rZ   rþ   )rZ   Úhits   & r   Ú_dir_exists_cachedrg  x  s9   € ä
×
Ñ
 Ó
%€CØ
‚{Ü(*¯©¯©°dÓ(;Ð;ˆÔ Ñ%Ø€Jr   c          
     ó,   € V ^8„  d   QhRRRRRRRRRR/# )	r   Úpreview_limitr'  ÚhydraterT   rO  rP  r   ztuple[dict, str | None]r   )r   s   "r   r   r   €  s4   € ÷ ñ ØðØ(,ðØ=@ðØVZðàñr   c               ó  € ^ RI Hp \        P                  4        \	        WVR7      w  rgr‰\
        P                  V U
Uu. uFH  qªP                  R4      ;'       g    .  F'  p\        VP                  R4      ;'       g    R4      NK)  	  KJ  	  upp
V Uu. uF'  p\        VP                  R4      ;'       g    R4      NK)  	  up,           4       VP                  WvV\
        P                  VV\        \        \        R7	      pWÙ3# u upp
i u upi )zOGather inputs and run the one authoritative builder. Returns (tree, active_id).)Úproject_tree)rP  r{   rZ   rD   r£   )ri  rj  Úis_junk_rootÚis_junk_cwdÚexists)Útui_gatewayrl  rc  Úclearrb  r•   r%  rF   r(   Ú
build_treeÚresolver«   r®   rg  )r.  ri  rj  rO  rP  rl  r  r   ra  r   r$   Úfr  Útrees   &$$$$         r   Ú_build_project_treerv  €  sí   € õ )Ü×ÑÔÜ0DØ
Ð.@ô1BÑ-€H˜
ô ×ÑÙ+3ÔV©8 a¿e¹eÀIÓ>N×>TÐ>TÐRTÒ>T¸ŒˆQ�U‰U�6‹]× Ð ˜bÖ	!Ñ>TÑ	!©8ÒVÙ-7Ó
8©Z¨Œ3ˆq�u‰u�V‹}×"Ð" Ö#©ZÑ
8õ	9ô:ð ×"Ñ"Ø˜J¬	×(9Ñ(9ÈØ¤mÔAUÜ!ð #ó #€Dð ˆ?Ðùó 	WùÚ
8s   ¿D
Á"D
Á>D
Â!D

Â6D

c               ó   € V ^8„  d   QhRR/# )r   r   rU   r   )r   s   "r   r   r   “  s   € ÷ 0ñ 0˜ñ 0r   c                ó2   € \        \        4       V RR7       R# )zQPublish this module's helpers + handlers onto ``server``, rebound to its globals.)ÚskipN)r`   )r   Úglobals)Úservers   &r   Úregisterr|  “  s   € ä”“	˜6¨×/r   rL   )ÚcronÚkanbanÚoneshot)$Ú__conditional_annotations__r   Ú
__future__r   Ú
method_ctxr   r   r<   r;   r5   r1   r3   r4   r   r%   r@   rH   rO   rb   r`   r¡   r«   r®   rÏ   rá   rå   r  r6  r^  rM  rb  rc  Ú__annotations__rg  rv  r|  )r€  s   @r   Ú<module>r„     s×  øðôTõ #ç 4áÓ€	Ø	×	Ñ	€ð .2°4¸Ð *€ˆ]˜NôS�ô Sõ.õõ*õ,õOñ ØÐ ÙLôNñ Ø�, ÙPôRñ ˜/¨?¸DÁ,Ô OÙ ˜-¨¸¹lÔ Kñ �/Ó"ô-ó #ð-ñ �.Ó!ôPó "ðPñ Ð#Ó$ô	Có %ð	Cñ Ð$Ó%ô-ó &ð-ñ Ð#Ó$ô-ó %ð-ñ
 Ð'Ó(ô<ó )ð<ñ
 Ð$Ó%ô*ó &ð*õUõ2õ@÷Mõ.	Hõ;õ7ðt3Øð3Ø'+ð3ØDH÷3òn "?Ð õõ"5ð@ &(Ð �?Ó 'õõ÷&0r   