+
    lHàjé  ã                   ó\  a € R0 t0 t R t^ RIt^ RIt^ RIHtHt ^ RIHt Rs	] ^ k R R lt
R R ltR R	 ltR
 R ltR R ltR R ltR R ltR1R R lltR2R R lltR1R R lltRR RR RR /tR t]P,                  ! RR R!RR"R#R$R%R&R'R(R%R)R*. R3O/R!R%R)R"R+/R,R%R)R"R-//R.R(.//]R/7       R# )4u)  Project tools â€” the agent's INTENTIONAL handle on first-class Projects (per-profile
``projects.db``, the desktop sidebar's named workspaces). Creating/switching is an explicit
tool call, never a side effect of ``cd``. GUI-only: the `project` toolset stays off
``_HERMES_CORE_TOOLS``; the desktop/TUI gateway folds it in and wires
``set_project_workspace_callback`` so the live session's cwd and sidebar follow. A live
session create/switch re-anchors only that session; it must not move the profile-global
Desktop selection shared by concurrent chats.N)ÚCallableÚOptional)Úregistryc                ón   € V ^8„  d   QhR\         \        \        \        \        .R3,          ,          RR/# )é   ÚfnNÚreturn)r   r   Ústr)Úformats   "Ú8/home/ubuntu/.hermes/hermes-agent/tools/project_tools.pyÚ__annotate__r      s0   € ÷ ñ ¤x´¼#¼sÄC¸È$Ð9NÕ0OÕ'Pð ÐUYñ ó    c                 ó
   € V s R # ©N)Ú_workspace_callback)r   s   &r   Úset_project_workspace_callbackr      s   € àÒr   c                ó:   € V ^8„  d   QhR\         \        ,          /# )r   r   ©r   r	   )r
   s   "r   r   r      s   € ÷ :ñ :œ8¤C�=ñ :r   c                 ó  € \        V R R4      '       d   V P                  # V P                   F#  pVP                  '       g   K  VP                  u # 	  V P                  '       d   V P                  ^ ,          P                  # R# )Úprimary_pathN)Úgetattrr   ÚfoldersÚ
is_primaryÚpath)ÚprojÚfolders   & r   Ú_primary_pathr      sd   € Üˆt�^ T×*Ò*Ø× Ñ Ð Ø—,”,ˆØ××ÒØ—;‘;Òñ ð $(§<§< <ˆ4�<‰<˜�?×ÑÐ9°TÐ9r   c                óh   € V ^8„  d   QhR\         \        ,          R\         \        ,          R\        /# )r   Útask_idr   r   )r   r	   Úbool)r
   s   "r   r   r   #   s)   € ÷ :ñ :œH¤S�Mð :´¼#µð :Ä4ñ :r   c                óH   € \        \        ;'       d    T ;'       d    T4      # )ua   True when a live GUI session's workspace will follow the project â€” ``_apply_workspace``'s gate.)r   r   )r   r   s   &&r   Ú_moves_sessionr!   #   s   € äÔ#×8Ð8¨×8Ð8°DÓ9Ð9r   c                ól   € V ^8„  d   QhR\         \        ,          R\         \        ,          R\        RR/# )r   r   r   Únamer   Nr   )r
   s   "r   r   r   (   s1   € ÷ ñ œh¤s�mð ´8¼Cµ=ð Ìð ÐPTñ r   c                 ó†   € \         pV'       d!   V '       d   V'       d    V! WV4       R # R # R # R #   \         d     R # i ; ir   )r   Ú	Exception)r   r   r#   Úcbs   &&& r   Ú_apply_workspacer'   (   s:   € Ü	€Bß	�gŸ$ð	Ùˆw˜dÖ#ñ ‰g�røô ô 	Úð	ús    	1 ±A ¿A c                ó$   € V ^8„  d   QhR\         /# )r   Útoken)r	   )r
   s   "r   r   r   1   s   € ÷ ñ œ#ñ r   c                 óª  € ^ RI Hp T;'       g    RP                  4       pV'       g   R# VP                  V RR7      pV F4  pWP                  VP
                  39   g   VP                  V8X  g   K2  Vu # 	  VP                  4       pV FE  pVP
                  P                  4       V8X  g"   VP                  P                  4       V8X  g   KC  Vu # 	  R# )é    ©Úprojects_dbÚ NT)Úinclude_archived)Ú
hermes_clir-   ÚstripÚlist_projectsÚidÚslugr#   Úlower)Úconnr)   ÚpdbÚprojectsr   Úlows   &&    r   Ú_resolver:   1   s§   € Ý-Ø�[ˆ[�b×ÑÓ!€EßÙØ× Ñ  ¸Ð Ó=€HãˆØ—W‘W˜dŸi™iÐ(Ô(¨D¯I©I¸Ö,>ØŠKñ ð �+‰+‹-€CÛˆØ�9‰9�?‰?Ó Ô# t§y¡y§¡Ó'8¸CÖ'?ØŠKñ ñ r   c                óF   € V ^8„  d   QhR\         \        ,          R\        /# ©r   r   r   r   )r
   s   "r   r   r   B   s   € ÷ "ñ "œh¤s�mð "´ñ "r   c                 óÀ   € \        V 4      p\        WV P                  4       \        P                  ! R RRV P
                  RV P                  RV P                  RV/4      # )ÚsuccessTr3   r4   r#   r   )r   r'   r#   ÚjsonÚdumpsr3   r4   )r   r   Úprimarys   && r   Ú
_activatedrB   B   sR   € Ü˜DÓ!€GÜ�W t§y¡yÔ1Ü�:Š:Ø�4˜˜tŸw™w¨°·	±	¸6À4Ç9Á9Ø˜ð!ó "ð "r   c                ó~   € V ^8„  d   QhR\         \        ,          R\        \        \         \        ,          3,          /# r<   )r   r	   Útupler   )r
   s   "r   r   r   J   s-   € ÷ 1ñ 1¬x¼­}ð 1ÄÄtÌXÔVYÍ]ÐGZÕA[ñ 1r   c                óú   € ^ RI Hp ^ RIHp V'       d	   V! V4      M/ pRV9  d   R# VR,          R8X  d   VP	                  R4      MRpV'       d   VP                  W4      MRpRV'       d   VP                  3# R3# )	zû``(scoped, project_id)`` for the calling session. The GUI gateway registers each session's
workspace (``cwd_source``) in the terminal override table; a caller it never registered (CLI,
scripts) is unscoped and falls back to the profile-global pointer.r,   )Úresolve_task_overridesÚ
cwd_sourceNÚsessionÚcwdT)FN)r0   r-   Útools.terminal_toolrF   ÚgetÚproject_for_pathr3   )r6   r   r7   rF   Ú	overridesrI   Úprojects   &&     r   Ú_calling_session_project_idrO   J   sp   € õ .Ý:ß3:Ñ& wÔ/À€IØ˜9Ô$ØÐØ"+¨LÕ"9¸YÔ"Fˆ)�-‰-˜Ô
ÈD€Cß14ˆc×"Ñ" 4Ô-¸$€GØŸw�—‘Ð0Ð0¨DÐ0Ð0r   c                óF   € V ^8„  d   QhR\         \        ,          R\        /# r<   r   )r
   s   "r   r   r   X   s   € ÷ !ñ !œ(¤3�-ð !´3ñ !r   c                 ó¾  € ^ RI Hp VP                  4       ;_uu_ 4       p\        W 4      w  r4V'       g   VP	                  V4      pVP                  V4      pRRR4       \        P                  ! RXRX Uu. uFC  pRVP                  RVP                  RVP                  R\        V4      R	VP                  V8H  /NKE  	  up/4      #   + '       g   i     Lx; iu upi )
r+   r,   NÚ	active_idr8   r3   r4   r#   r   Úactive)r0   r-   Úconnect_closingrO   Úget_active_idr2   r?   r@   r3   r4   r#   r   )r   r7   r6   ÚscopedrS   r8   Úps   &      r   Úproject_listrX   X   sÊ   € Ý-Ø	×	Ñ	×	Ô	 $ä4°TÓC‰ˆßØ×&Ñ& tÓ,ˆFØ×$Ñ$ TÓ*ˆ÷ 
ô �:Š:Ø�VØñ ó	ñ �ð �a—d‘d˜F A§F¡F¨F°A·F±FØ¤¨aÓ 0°(¸A¿D¹DÀF¹NóLñ ñ	ð ó !ð !÷ 
×	üòs   Ÿ8CÁ6A	CÃC	c                ót   € V ^8„  d   QhR\         R\        \         ,          R\        \         ,          R\         /# )r   r#   r   r   r   ©r	   r   )r
   s   "r   r   r   i   s1   € ÷ %ñ %œð %¤H¬S¥Mð %Ä8ÌCÅ=ð %Ô\_ñ %r   c           	      ó   € T ;'       g    R P                  4       p V '       g   \        P                  ! RRRR/4      # ^ RIHp T;'       g    R P                  4       pV'       d=   \
        P                  P                  \
        P                  P                  V4      4      p VP                  4       ;_uu_ 4       pV'       d   VP                  WT4      MRpVe   TpM:TP                  YPV'       d   V.M. T;'       g    RR7      pVP                  WX4      pVe7   \        V\        V4      4      '       g   VP                  WWP                   4       RRR4       Xf   \        P                  ! RRRR/4      # \'        Yr4      #   + '       g   i     L9; i  \"         d.   p	\        P                  ! RRR\%        T	4      /4      u Rp	?	# Rp	?	ii ; i)	r.   r>   FÚerrorzname is requiredr,   N)r#   r   r   zproject vanished after create)r1   r?   r@   r0   r-   Úosr   ÚabspathÚ
expanduserrT   Úfind_by_primary_pathÚcreate_projectÚget_projectr!   r   Ú
set_activer3   Ú
ValueErrorr	   rB   )
r#   r   r   r7   r   r6   Úexistingr   ÚpidÚexcs
   &&&       r   Úproject_createrh   i   sl  € Ø�JˆJ�B×ÑÓ€DßÜ�zŠz˜9 e¨WÐ6HÐIÓJÐJÝ-Ø�jˆj�b×ÑÓ!€FßÜ—‘—‘¤§¡×!3Ñ!3°FÓ!;Ó<ˆðAØ× Ñ ×"Ô" dßAG�s×/Ñ/°Ô=ÈTˆHØÒ#ð  ‘à×(Ñ(¨ÏfÀ6Á(ÐZ\Ðkq×kyÐkyÐuyÐ(Óz�Ø—‘ tÓ1�ð Ò¬°wÄÈdÓ@S×(TÒ(TØ—‘˜t§W¡WÔ-÷ #ð  ‚|Ü�zŠz˜9 e¨WÐ6UÐVÓWÐWÜ�dÓ$Ð$÷% #×"ûô ô AÜ�zŠz˜9 e¨W´c¸#³hÐ?Ó@Õ@ûðAúsD   Â"F Â:AFÃ>AFÅF ÆF	ÆF ÆF ÆGÆ "GÇGÇGc                óR   € V ^8„  d   QhR\         R\        \         ,          R\         /# )r   rN   r   r   rZ   )r
   s   "r   r   r   ‡   s%   € ÷ 	%ñ 	%œCð 	%¬(´3­-ð 	%Ä3ñ 	%r   c           
      óh  € ^ RI Hp VP                  4       ;_uu_ 4       p\        W04      pVf)   \        P
                  ! RRRRV  R2/4      uuRRR4       # \        V\        V4      4      '       g   VP                  W4P                  4       RRR4       \        XV4      #   + '       g   i     L; i)r+   r,   Nr>   Fr\   zno project matching 'Ú')r0   r-   rT   r:   r?   r@   r!   r   rc   r3   rB   )rN   r   r7   r6   r   s   &&   r   Úproject_switchrl   ‡   s�   € Ý-Ø	×	Ñ	×	Ô	 $Ü˜Ó&ˆØŠ<Ü—:’:˜y¨%°Ð<QÐRYÐQZÐZ[Ð:\Ð]Ó^÷ 
Ò	ô
 ˜g¤}°TÓ':×;Ò;Ø�N‰N˜4§¡Ô)÷ 
ô �d˜GÓ$Ð$÷ 
×	ús   Ÿ-B!Á6B!Â!B1	Úlistc                 ó   € \        VR 7      # ))r   )rX   ©ÚargsÚtids   &&r   Ú<lambda>rr   ”   s	   € œl°3Õ7r   Úcreatec                 ó\   € \        V P                  R R4      V P                  R4      VR7      # )r#   r.   r   )r#   r   r   )rh   rK   ro   s   &&r   rr   rr   •   s%   € ¤Ø�X‰X�f˜bÓ!¨¯©°Ó(8À#õ!Gr   Úswitchc                 ó<   € \        V P                  R R4      VR7      # )r#   r.   )rN   r   )rl   rK   ro   s   &&r   rr   rr   —   s   € ¤°t·x±xÀÈÓ7KÐUXÕ Yr   c                 óä   € \         P                  V P                  R 4      ;'       g    RP                  4       4      pVf   \        P                  ! RRRR/4      # V! WP                  R4      4      # )Úactionr.   r>   Fr\   z,action must be one of: create, switch, list.r   )Ú_ACTIONSrK   r1   r?   r@   )rp   Úkwrx   s   &, r   Ú_handle_projectr{   š   s\   € Ü�\‰\˜4Ÿ8™8 HÓ-×3Ð3°×:Ñ:Ó<Ó=€FØ‚~Ü�zŠz˜9 e¨WÐ6dÐeÓfÐfÙ�$Ÿ™˜yÓ)Ó*Ð*r   Údesktop_projectrN   r#   Údescriptionuj  Create or switch desktop Projects (named workspaces). create: one and switch this chat into it â€” pass path to anchor it to a repo/folder (the chat's workspace moves there, the sidebar follows). switch: move this chat into an existing project by name/slug/id â€” the intentional way to move the session, not `cd`. list: all projects + which one this chat is in.Ú
parametersÚtypeÚobjectÚ
propertiesrx   ÚstringÚenumz.create: human name. switch: name, slug, or id.r   z!create: repo/folder to anchor to.Úrequired)r#   ÚtoolsetÚschemaÚhandlerc                ó†   € V ^8„  d   Qh/ ^ \         9   d-   \        \        \        \        \        .R3,          ,          ;R&   # )r   Nr   )Ú__conditional_annotations__r   r   r	   )r
   s   "r   r   r      s4   € ÷ 1ñ 1÷  FÒ E”Xœh¬¬S´# ¸Ð'<Õ=Õ>Ñ Eò!1r   r   )NN)rs   ru   rm   )r‰   Ú__doc__r?   r]   Útypingr   r   Útools.registryr   r   r   r   r!   r'   r:   rB   rO   rX   rh   rl   ry   r{   Úregisterr   )r‰   s   @r   Ú<module>rŽ      sø   øðö1ó Û 	ß %å #ð BFÐ Ó Eõõ
:õ:õ
õõ""õ1÷!÷"%÷<	%ð Ñ7Øñ GàÑYð	[€ò+ð 	× Ò Ø	ØàÐ!Øðmð 	Ø�HØØ˜6 8¨VÒ5QÐRØ˜ ¨=Ð:jÐkØ˜ ¨=Ð:]Ð^ðð
 ˜˜
ð
ðð& ÷-r   