+
    „WÝjw  ã                  óÒ   € R t ^ RIHt ^ RIt^ RIHt ^ RIHt ^ RIH	t	H
t
 ^ RIHt ^ RIHtHt ]	! 4       t]! RR	4      tR
 R ltR R lt]P)                  R4      RR R ll4       tR# )aÿ  Chat workspace picker: which host directories a NEW dashboard chat can start in.

The dashboard's ``/chat`` tab used to spawn every fresh TUI in the dashboard process's own
launch directory, so from a phone or browser there was no way to say "work in ~/code/foo".
This lists the same projects and discovered repositories the Desktop sidebar shows (the
per-profile ``projects.db`` plus session-derived and scanned git roots) so the SPA can offer
a picker, and ``/api/pty?cwd=`` (``chat_ws``) honours the choice.
)ÚannotationsN)ÚPath)ÚOptional)Ú	APIRouterÚHTTPException)Úlate©Úhttp_failureÚscoped_to_threadÚ_open_session_db_for_profilezhermes_cli.web_server_sessionsc               ó    € V ^8„  d   QhRRRR/# )é   ÚrawúOptional[str]Úreturn© )Úformats   "ÚZC:\Users\johnn\AppData\Local\hermes\hermes-agent\hermes_cli\web_routers\chat_workspaces.pyÚ__annotate__r      s   € ÷ ñ ˜-ð ¨Mñ ó    c                ó0  € T ;'       g    RP                  4       pV'       g   R# \        P                  P                  \        P                  P	                  V4      4      p\        P                  P                  V4      '       g   \        RRV 2R7      hV# )u  Validate a ``?cwd=`` for a fresh chat: an existing host directory, or None when unset.

A dead or relative path fails closed (400) instead of silently falling back to the launch
dir â€” the user picked a workspace and would otherwise get a session in the wrong place.
Ú Ni�  z"Working directory does not exist: )Ústatus_codeÚdetail)ÚstripÚosÚpathÚabspathÚ
expanduserÚisdirr   )r   ÚtextÚresolveds   &  r   Úresolve_chat_cwdr"      sn   € ð �IˆI�2×ÑÓ€DßÙÜ�w‰w�‰œrŸw™w×1Ñ1°$Ó7Ó8€HÜ�7‰7�=‰=˜×"Ò"Ü¨Ð6XÐY]ÐX^Ð4_Ô`Ð`Ø€Or   c               ó$   € V ^8„  d   QhRRRRRR/# )r   Úprofiler   ÚscanÚboolr   Údictr   )r   s   "r   r   r   )   s&   € ÷ Kñ K ð K°dð K¸tñ Kr   c                ó
  € ^ RI Hp ^ RIHp  \	        V RR7      p VP                  4       ;_uu_ 4       pVP                  4       pV'       d!   VR,          '       d   VP                  Wg4       VP                  V4       Uu. uF  qˆP                  4       NK  	  p	pVP                  WFRVR,          R7      p
RRR4       Ve   VP                  4        TP                  T '       d   R	T /M/ 4      pR
X	RX
RTR\        \         P"                  ! 4       4      R\%        XR,          4      /#   \
         d    pTP                  R8w  d   h Rp Rp?EL0Rp?ii ; iu upi   + '       g   i     L«; i  Te   TP                  4        i i ; i)é    N)Úprojects_dbT)Ú	read_onlyi÷  ÚenabledF)ÚconnÚbackfillÚinclude_cachedr$   ÚprojectsÚreposÚdefault_cwdÚhomeÚscan_enabled)Útui_gateway.serverÚserverÚ
hermes_clir*   r   r   r   Úconnect_closingÚ_repo_discovery_policyÚ_scan_discovered_repos_remoteÚlist_projectsÚto_dictÚ_discover_repos_payloadÚcloseÚ_completion_cwdÚstrr   r3   r&   )r$   r%   ÚgatewayÚpdbÚdbÚexcr-   ÚpolicyÚpr0   r1   r2   s   &&          r   Ú_collect_workspacesrG   )   sP  € õ )Ý-ðÜ)¨'¸TÔBˆð

Ø× Ñ ×"Ô" dØ×3Ñ3Ó5ˆFß˜˜y×)Ô)Ø×5Ñ5°dÔCØ-0×->Ñ->¸tÔ-DÓEÑ-D¨Ÿ	™	žÑ-DˆHÐEØ×3Ñ3Ø¨¸fÀYÕ>Oð 4ó QˆE÷ #ð Š>Ø�H‰HŒJØ×)Ñ)Ç'¨9°gÑ*>ÈrÓR€Kà�H˜g u¨m¸[Ø””D—I’I“KÓ  .´$°v¸iÕ7HÓ2IðKð Køô! ô Ø�?‰?˜cÔ!ØØŽûðüò F÷	 #×"ûð Š>Ø�H‰H�Jð úsQ   ŽD& œE+ ´'EÁ$EÂ EÂEÂ5E+ Ä&EÄ1EÅEÅEÅE(	Å#E+ Å+Fz/api/chat/workspacesc               ó    € V ^8„  d   QhRRRR/# )r   r$   r   r%   r&   r   )r   s   "r   r   r   I   s   € ÷ [ñ [ }ð [À4ñ [r   c              ƒ  ó¬   a a"  € \        RRR4      ;_uu_ 4        \        S V V3R l4      G Rj  x€L
 uuRRR4       #  L  + '       g   i     R# ; i5i)z¨Projects + discovered repos a fresh chat may start in; ``scan=1`` rescans the
configured discovery roots on the host first (headless installs have no Desktop to do it).zGET /api/chat/workspaces failediô  zFailed to list workspacesc                 ó   <€ \        S S4      # )N)rG   ©r$   r%   s   €€r   Ú<lambda>Ú%get_chat_workspaces.<locals>.<lambda>M   s   ø€ Ô7JÈ7ÐTXÔ7Yr   Nr   rK   s   ffr   Úget_chat_workspacesrN   H   s?   ùé € ô 
Ð7¸Ð>Y×	ZÕ	ZÜ% gÕ/YÓZ×Z÷ 
[Ò	ZÙZ÷ 
[×	ZÐ	Züs)   „AšA ¯>°A ³A¾A Á A	Á	A)NF)Ú__doc__Ú
__future__r   r   Úpathlibr   Útypingr   Úfastapir   r   Úhermes_cli.web_depsr   Úhermes_cli.web_routers._commonr	   r
   Úrouterr   r"   rG   ÚgetrN   r   r   r   Ú<module>rX      sb   ðñõ #ã 	Ý Ý ç ,å $ß Iá	‹€á#Ð$BÐDdÓeÐ õõKð> ‡�Ð"Ó#ö[ó $ò[r   