+
    „WÝj|  ã                  ó†   € R t ^ RIHt ^ RIt^ RItRR.tRsR R ltR R	 ltR
RRR/R R llt	R R lt
R R ltR R ltR# )a   Windows-safe stdio configuration.

Forces UTF-8 on the Python side and also flips the console's code page to UTF-8 (65001). Both
matter: Python-level only helps when Python's stdout is a real TTY; code-page flipping lets
subprocesses and child Python ``print()`` calls agree on encoding.
)ÚannotationsNÚconfigure_windows_stdioÚ
is_windowsFc               ó   € V ^8„  d   QhRR/# ©é   ÚreturnÚbool© )Úformats   "ÚDC:\Users\johnn\AppData\Local\hermes\hermes-agent\hermes_cli\stdio.pyÚ__annotate__r      s   € ÷ #ñ #�Dñ #ó    c                 ó(   € \         P                  R8H  # )z4Return True iff running on native Windows (not WSL).Úwin32)ÚsysÚplatformr
   r   r   r   r      s   € ä�<‰<˜7Ñ"Ð"r   c               ó   € V ^8„  d   QhRR/# ©r   r   ÚNoner
   )r   s   "r   r   r      s   € ÷ 
ñ 
¨ñ 
r   c                 ó¤   €  ^ RI p V P                  P                  pVP                  R4       VP	                  R4       R#   \
         d     R# i ; i)z·``SetConsoleCP``/``SetConsoleOutputCP`` to CP_UTF8 (65001). Silent on failure: without an
attached console (redirected stdout, service, PTY-less CI) the calls return 0 and we move on.Niéý  )ÚctypesÚwindllÚkernel32ÚSetConsoleCPÚSetConsoleOutputCPÚ	Exception)r   r   s     r   Ú_flip_console_code_page_to_utf8r      sG   € ðÛà—=‘=×)Ñ)ˆØ×Ñ˜eÔ$Ø×#Ñ# EÖ*øÜô Úðús   ‚<A  Á AÁAÚencodingúutf-8ÚerrorsÚreplacec               ó$   € V ^8„  d   QhRRRRRR/# )r   r   Ústrr    r   r   r
   )r   s   "r   r   r   $   s"   € ÷ ñ ¨Sð ÀCð ÐX\ñ r   c               ód   €  \        V RR4      pVe   V! WR7       R# R#   \         d     R# i ; i)z†Reconfigure a text stream to UTF-8 in place; skips streams without ``reconfigure`` (e.g. an
``io.StringIO`` substituted during tests).ÚreconfigureN)r   r    )Úgetattrr   )Ústreamr   r    r%   s   &$$ r   Ú_reconfigure_streamr(   $   s:   € ðÜ˜f m°TÓ:ˆØÒ"Ù ×9ñ #øäô Úðús   ‚   /®/c               ó   € V ^8„  d   QhRR/# r   r
   )r   s   "r   r   r   /   s   € ÷ #ñ # ñ #r   c                 óž  € \         '       d   R# \        4       '       d%   \        P                  P	                  R4      R
9   d   Rs R# \        P                  P                  RR4       \        P                  P                  RR4       \        4       p V '       d^   \        P                  P	                  R4      '       g9   \        P                  P	                  R	4      '       g   V \        P                  R&   \        4        \        4        \        P                  \        P                  \        P                  3 F  p\        V4       K  	  Rs R# )a  Force UTF-8 stdio on Windows. No-op elsewhere.

Idempotent; returns ``True`` only when something actually changed. Set
``HERMES_DISABLE_WINDOWS_UTF8=1`` to opt out (forces the old cp1252 path for diagnosing
encoding bugs). Also sets a default ``EDITOR`` on Windows if none is set.
FÚHERMES_DISABLE_WINDOWS_UTF8Ú1TÚPYTHONIOENCODINGr   Ú
PYTHONUTF8ÚEDITORÚVISUAL>   r,   ÚyesÚTrueÚtrue)Ú_CONFIGUREDr   ÚosÚenvironÚgetÚ
setdefaultÚ_default_windows_editorÚ_augment_path_with_known_toolsr   r   ÚstdoutÚstderrÚstdinr(   )Ú_default_editorr'   s     r   r   r   /   sÖ   € ÷ ƒ{ÙÜ�<Š<œ2Ÿ:™:Ÿ>™>Ð*GÓHÐLhÔhØˆÙô ‡J�J×ÑÐ,¨gÔ6Ü‡J�J×Ñ˜,¨Ô,ô
 .Ó/€OßœrŸz™zŸ~™~¨h×7Ò7ÄÇ
Á
ÇÁÈx×@XÒ@XØ.Œ�
‰
�8Ñä"Ô$ä#Ô%ô —:‘:œsŸz™z¬3¯9©9Ó5ˆÜ˜FÖ#ñ 6à€KÙr   c               ó   € V ^8„  d   QhRR/# )r   r   r#   r
   )r   s   "r   r   r   U   s   € ÷ 8ñ 8 ñ 8r   c                 ó@   € ^ RI p V P                  R4      '       d   R# R# )a  Windows default for ``$EDITOR``: ``notepad`` (ships with every install, blocks until the
window closes). The bare name keeps prompt_toolkit's shlex split away from paths with spaces;
"" when even notepad is missing (WinPE, Nano Server) so prompt_toolkit's no-op applies.NÚnotepadÚ )ÚshutilÚwhich)rC   s    r   r9   r9   U   s    € ó ØŸ™ Y×/Ò/ˆ9Ð7°RÐ7r   c               ó   € V ^8„  d   QhRR/# r   r
   )r   s   "r   r   r   ]   s   € ÷ Cñ C¨ñ Cr   c            
     óÈ  € \        4       '       g   R# \        P                  P                  RR4      p V '       g   R# \        P                  P                  V RRR4      \        P                  P                  V RRR4      \        P                  P                  V RRRR4      \        P                  P                  V RR	R
R4      \        P                  P                  V RRR4      .p\        P                  P                  RR4      pVP                  \        P                  4       Uu0 uF  q3'       g   K  VP                  4       kK  	  ppV Uu. uFC  p\        P                  P                  V4      '       g   K*  VP                  4       V9  g   KA  VNKE  	  ppV'       d7   \        P                  P                  . VOVN4      \        P                  R&   R# R# u upi u upi )aŽ  Prepend Hermes-managed tool directories to ``PATH`` (no-op on POSIX / missing dirs).

install.ps1 adds entries like ``%LOCALAPPDATA%\hermes\git\bin`` to the User PATH via
``SetEnvironmentVariable``, but already-running shells never see that broadcast, so a hermes
launched from the install session would not find rg / bash / grep. Prepending the known dirs
at startup closes that first-launch gap.
NÚLOCALAPPDATArB   ÚhermesÚgitÚcmdÚbinÚusrzhermes-agentÚvenvÚScriptsÚ	MicrosoftÚWinGetÚLinksÚPATH)
r   r5   r6   r7   ÚpathÚjoinÚsplitÚpathsepÚlowerÚisdir)Úlocal_appdataÚcandidate_dirsÚexistingÚpÚexisting_lowerÚdÚprepends          r   r:   r:   ]   sS  € ô �<Š<ÙÜ—J‘J—N‘N >°2Ó6€MßÙô 	�‰�‰�] H¨e°UÓ;Ü
�‰�‰�] H¨e°UÓ;Ü
�‰�‰�] H¨e°U¸EÓBÜ
�‰�‰�] H¨n¸fÀiÓPÜ
�‰�‰�] K°¸7ÓCðE€Nô �z‰z�~‰~˜f bÓ)€HØ)1¯©¼¿
¹
Ô)CÓIÑ)C AÃq”i�a—g‘g–iÑ)C€NÐIÙ(Óa™.�Q¬B¯G©G¯M©M¸!×,<ŒqÀÇÁÃÐR`ÑA`�qˆq™.€GÐaßÜŸZ™ZŸ_™_Ð-A¨wÐ-A¸Ð-AÓBŒ�
‰
�6Óñ ùò JùÚas   Ä'	GÄ5GÅ'GÅ;GÆG)Ú__doc__Ú
__future__r   r5   r   Ú__all__r4   r   r   r(   r   r9   r:   r
   r   r   Ú<module>rc      sR   ðñõ #ã 	Û 
à$ lÐ
3€à€õ#õ

ð°7ð È)÷ õ#õL8÷Cr   