+
    jHàjj(  ã                   ód   € R t ^ RIHt ^ RItR tR tR tRtR tR t	R t
R	 R
 ltR tR tR tR# )a
  Agent-facing subcommand handlers: memory, acp, tools, insights, monitoring, skills (+trust).

Split out of ``hermes_cli/main.py``. Names that still live in main (``PROJECT_ROOT``, ...)
are imported lazily inside the functions that use them (avoids an import cycle).
)Úinstall_hintNc                  óÌ   € ^ RI Hp Hp V ! 4       p\        VP	                  R4      \
        4      '       g   / VR&   RVR,          R&   V! V4       \        R4       \        R4       R# )é    ©Úload_configÚsave_configÚmemoryÚ Úprovideru%   
  âœ“ Memory provider: built-in onlyz  Saved to config.yaml
N)Úhermes_cli.configr   r   Ú
isinstanceÚgetÚdictÚprint)r   r   Úconfigs      Ú?/home/ubuntu/.hermes/hermes-agent/hermes_cli/main_agent_cmds.pyÚ_cmd_memory_offr      sU   € ß:Ù‹]€FÜ�f—j‘j Ó*¬D×1Ò1ØˆˆxÑØ#%€Fˆ8Õ�ZÑ Ù�ÔÜ	Ð
2Ô3Ü	Ð
$Ö%ó    c           
      ó€  € ^ RI HpHp V! 4       R,          p\        V RR4      p. pVR9   d   VP	                  R4       VR9   d   VP	                  R4       V UUu. uF&  w  rgW6,          P                  4       '       g   K#  Wg3NK(  	  pppV'       g   \        RV! 4        R24       R# \        R4       V F;  w  rgW6,          P                  4       P                  p	\        R	V R
V RV	R R24       K=  	  \        V RR4      '       g=    \        R4      P                  4       P                  4       p
T
R8w  d   \        R4       R# V F-  w  rgW6,          P                  4        \        RV R
V R24       K/  	  \        R4       \        RV! 4        R24       R# u uppi   \        \        3 d    \        R4        R# i ; i)r   )Úget_hermes_homeÚdisplay_hermes_homeÚmemoriesÚtargetÚallu1   
  Nothing to reset â€” no memory files found in z/memories/
Nz:
  This will permanently erase the following memory files:u       â—† z (u   ) â€” Ú,z bytesÚyesFz
  Type 'yes' to confirm: z
  Cancelled.
z  Cancelled.
u     âœ“ Deleted Ú)zE
  Memory reset complete. New sessions will start with a blank slate.z  Files were in: >   r   r   )z	MEMORY.mdzagent notes>   r   Úuser)zUSER.mdzuser profile)Úhermes_constantsr   r   ÚgetattrÚappendÚexistsr   ÚstatÚst_sizeÚinputÚstripÚlowerÚEOFErrorÚKeyboardInterruptÚunlink)Úargsr   r   Úmem_dirr   Úfiles_to_resetÚfÚdescÚexistingÚsizeÚanswers   &          r   Ú_cmd_memory_resetr2      s§  € ßEÙÓ *Õ,€GÜ�T˜8 UÓ+€FØ€NØÐ"Ô"Ø×ÑÐ:Ô;Ø�Ô Ø×ÑÐ9Ô:á)7ÔR©™g˜a¸G½K×;OÑ;O×;Q”	�“	©€HÑRßÜÐBÑCVÓCXÐBYÐYeÐfÔgÙä	Ð
GÔHÛ‰ˆØ•×!Ñ!Ó#×+Ñ+ˆÜ�˜˜˜2˜d˜V 6¨$¨q¨°Ð8Ö9ñ ô �4˜ ×&Ò&ð	ÜÐ8Ó9×?Ñ?ÓA×GÑGÓIˆFð �UŒ?ÜÐ"Ô#Ùã‰ˆØ	�×ÑÔÜ�˜q˜c  D 6¨Ð+Ö,ñ ô 
Ð
RÔSÜ	ÐÑ1Ó3Ð4°LÐ
AÖBùó3 Søô Ô+Ð,ô 	ÜÐ$Ô%Úð	ús   Á FÂ FÄ'F ÆF=Æ<F=c                 óŠ   € \        V R R4      pVR8X  d   \        4        R# VR8X  d   \        V 4       R# ^ RIHp V! V 4       R# )Úmemory_commandNÚoffÚreset)r4   )r   r   r2   Úhermes_cli.memory_setupr4   )r*   Úsubr4   s   &  r   Ú
cmd_memoryr9   <   s8   € Ü
�$Ð(¨$Ó
/€CØ
ˆe„|ÜÖØ	�ŒÜ˜$Öå:Ù�tÖr   c                ó®  € ^ RI pR F(  w  r#\        WR4      '       g   K  RVP                  V&   K*  	  R F1  w  r#\        WR4      '       g   K  \        W4      VP                  V&   K3  	   ^ RIHp T! \
         UUu. uF  w  r%\        WR4      '       g   K  VNK  	  upp4       R# u uppi   \         d�   p\        R\        P                  R7       \        R\        R4       2\        P                  R7       \        R	\        P                  R7       \        R
T 2\        P                  R7       \        P                  ! ^4        Rp?R# Rp?ii ; i)z%Launch Hermes Agent as an ACP server.NFÚ1)ÚmainzPThe ACP server can't start: its protocol packages are missing from this install.©Úfilez"From the Hermes environment, run: ÚacpzThen restart Hermes.z	Details: ))Úaccept_hooksÚHERMES_ACCEPT_HOOKS)Úignore_rulesÚHERMES_IGNORE_RULES))ÚmodelÚHERMES_MODEL)r
   ÚHERMES_INFERENCE_PROVIDER)Úosr   ÚenvironÚacp_adapter.entryr<   Ú
_ACP_FLAGSÚImportErrorr   ÚsysÚstderrr   Úexit)r*   rG   ÚattrÚnameÚacp_mainÚflagÚes   &      r   Úcmd_acprT   P   s  € ãó i‰
ˆÜ�4˜u×%Ô%Ø"ˆB�J‰J�tÓñ ió
 ]‰
ˆÜ�4˜t×$Ô$Ü& tÓ2ˆB�J‰J�tÓñ ]ð	Ý6Ù­ÔR©™:˜4´w¸tÈ5×7Q—$�$©ÒRÖSùÓRøÜô ÜÐ`Ôgj×gqÑgqÕrÜÐ2Ü˜eÓ$Ð%ð'Ü-0¯Z©Zõ	9äÐ$¬3¯:©:Õ6Ü�	˜!˜ˆo¤C§J¡JÕ/Ü�Š��Šûðús1   Á+B- Á<B'
ÂB'
ÂB- Â'B- Â-EÂ8BEÅEc                 óÜ   € ^ RI Hp \        V RR4      pVR	9   d   ^ RIHp V! V 4       R# VR8X  d%   ^ RIHp \        P                  ! V! V 4      4       R# T! R4       ^ RIHp V! V 4       R# )
r   ©Ú_require_ttyÚtools_actionN)Útools_disable_enable_commandz
post-setup)Úrun_post_setup_commandÚtools)Útools_command>   ÚlistÚenableÚdisable)	Úhermes_cli.mainrW   r   Úhermes_cli.tools_configrY   rZ   rL   rN   r\   )r*   rW   ÚactionrY   rZ   r\   s   &     r   Ú	cmd_toolsrc   i   sW   € Ý,Ü�T˜>¨4Ó0€FØÐ.Ô.ÝHÙ$ TÖ*Ø	�<Ô	ÝBÜ�ŠÑ'¨Ó-Ö.á�WÔÝ9Ù�dÖr   c           	      óÈ  € R p ^ RI Hp ^ RIHp ^ RIHp V! 4       R,          pVP                  4       '       g5   ^ RIHp \        RV! R4       24        Ve    VP                  4        R # R # V! VRR	7      pV! V4      pVP                  V P                  V P                  R
7      p\        VP                  V4      4       Ve    VP                  4        R # R #   \         d     R # i ; i  \         d-   p	^ RIHp \        T! R\!        T	4      R7      4        R p	?	L]R p	?	ii ; i  \         d     R # i ; i  Te$    TP                  4        i   \         d     i i ; ii ; i)N)Ú	SessionDB)ÚInsightsEngine)r   zstate.db)Útz  zcli.insights.no_session_dataT)Údb_pathÚ	read_only)ÚdaysÚsourcezgateway.insights.error)Úerror)Úhermes_statere   Úagent.insightsrf   r   r   r!   Ú
agent.i18nrg   r   ÚcloseÚ	ExceptionÚgeneraterj   rk   Úformat_terminalÚstr)
r*   Údbre   rf   r   Úpathrg   ÚengineÚreportrS   s
   &         r   Úcmd_insightsry   x   sA  € Ø	€BðÝ*Ý1Ý5ÙÓ  :Õ-ˆØ�{‰{�}Š}Ý$Ü�B‘qÐ7Ó8Ð9Ð:Ô;Øð Š>ðØ—‘–
ñ ñ ˜t¨tÔ4ˆÙ Ó#ˆØ—‘ d§i¡i¸¿¹�ÓDˆÜˆf×$Ñ$ VÓ,Ô-ð Š>ðØ—‘–
ñ øô ô Úðûô ô 9å Ü‰aÐ(´°A³Ô7×8Ñ8ûð9ûô ô Úðûð Š>ðØ—‘•
øÜô Ùðúð úsy   „AC, ÁC Á.AC, ÃD& ÃC)Ã(C)Ã,D#Ã7"DÄD8 ÄD#Ä#D8 Ä&D5Ä4D5Ä8E!Ä>EÅE!ÅEÅE!ÅEÅE!c                ó$   € V ^8„  d   QhR\         /# )é   Úreturn)r   )Úformats   "r   Ú__annotate__r~   “   s   € ÷ 4ñ 4œTñ 4r   c                 ó6   € \        V \        4      '       d   V # / # ©N)r   r   )Úvalues   &r   Ú_dict_or_emptyr‚   “   s   € Ü˜u¤d×+Ò+ˆ5Ð3°Ð3r   c           	     óª  € ^ RI Hp \        V RR4      ;'       g    Rp\        V! 4       P	                  R4      4      pVR8X  EdÛ   ^ RIHp \        VP	                  R4      4      p\        \        VP	                  R4      4      P	                  R	4      4      p\        R
4       \        RVP	                  R4      '       d   RMR R24       VP	                  R4      '       d¬   \        RVP	                  RR4      '       d   RMR RVP	                  R^<4       R24       \        RVP	                  RR4      '       d   RMR 24       \        RVP	                  RR4      '       d   RMR RVP	                  R^4       R24       \        R4       VP	                  R4      ;'       g    RpVP	                  R4      '       d   V'       d   \        RV 24       M\        R 4       \        R!VP                  4       '       d   R"MR# R$24       \        R%4       \        R&4       R# \        R'V 2\        P                  R(7       \        P                  ! ^4       R# ))z?Gateway monitoring status: health & diagnostics export posture.)r   Úmonitoring_actionNÚstatusÚ
monitoring)Úotlp_exporterÚgateway_health_exportÚexportÚotlpzGateway monitoringz  Health export:  ÚenabledÚdisabledz+ (monitoring.gateway_health_export.enabled)z    Metrics:            Úmetrics_enabledTÚonr5   z (interval Úexport_interval_secondszs)z    Diagnostic events:  Údiagnostic_events_enabledz    Warning/error logs: Úwarning_error_events_enabledÚlogs_export_interval_secondszZ    Content safety:     always on (rendered messages are never exported; not configurable)Úendpointr	   z  OTLP endpoint:  z9  OTLP endpoint:  not configured (monitoring.export.otlp)z  OTel SDK:       Ú	installedznot installedz% (optional extra: hermes-agent[otlp])z=
  Scope: gateway service health + redacted diagnostics only.zF  No prompts, messages, tool args/results, usage analytics, or traces.zUnknown monitoring action: r=   )r   r   r   r‚   r   Úagent.monitoringr‡   r   Úis_availablerL   rM   rN   )r*   r   rb   Úmonr‡   ÚghrŠ   r“   s   &       r   Úcmd_monitoringr™   —   s  € å-Ü�TÐ.°Ó5×AÐA¸€FÜ
™›×*Ñ*¨<Ó8Ó
9€Cà�ÕÝ2Ü˜CŸG™GÐ$;Ó<Ó=ˆÜœn¨S¯W©W°XÓ->Ó?×CÑCÀFÓKÓLˆäÐ"Ô#ÜÐ"°·±°y×0AÒ0A¡9ÀzÐ"Rð S;ð <ô 	=à�6‰6�)×ÒÜÐ,°R·V±VÐ<MÈt×5TÒ5T©TÐZ_Ð,`ð aØ!Ÿv™vÐ&?ÀÓDÐEÀRðIô JäÐ,°R·V±VÐ<WÐY]×5^Ò5^©TÐdiÐ,jÐkÔlÜÐ,°R·V±VÐ<ZÐ\`×5aÒ5a©TÐglÐ,mð nØ!Ÿv™vÐ&DÀaÓHÐIÈðMô Näð Mô Nà—8‘8˜JÓ'×-Ð-¨2ˆØ�8‰8�I×Ò§8ÜÐ& x jÐ1Õ2äÐMÔNÜÐ"°-×2LÑ2L×2NÒ2N¡;ÐTcÐ"dð e5ð 6ô 	7äÐNÔOÜÐVÔWÙä	Ð'¨ xÐ
0´s·z±zÕBÜ‡H‚HˆQ†Kr   c                 óª   € ^ RI Hp \        V RR4      pVR8X  d   T! R4       ^ RIHp V! V 4       R# VR9   d   \        V 4       R# ^ RIHp V! V 4      # )r   rV   Úskills_actionNr   zskills config)Úskills_command)ÚtrustÚuntrust)r`   rW   r   Úhermes_cli.skills_configrœ   Ú_cmd_skills_trustÚhermes_cli.skills_hub)r*   rW   rb   Úskills_config_commandrœ   s   &    r   Ú
cmd_skillsr£   ¼   sM   € Ý,Ü�T˜?¨DÓ1€FØ�ÔÙ�_Ô%ÝTÙ˜dÖ#Ø	Ð'Ô	'Ü˜$Öå8Ù˜dÓ#Ð#r   c                óà  aaaa€ ^ RI Ho ^ RIHpHpHpHo ^ RIHpH	p V P                  p\        V RR4      pV'       dL   S! V4      P                  4       P                  4       pVP                  4       '       g   \        RV 24       R# MV! 4       pVf   \        R4       R# V! 4       p	V	P!                  R/ 4      p
V
P#                  R	4      ;'       g    . p\%        V\&        4      '       g   V.pV Uu. uF  p\)        V4      NK  	  pp\)        V4      oR
 VV3R lloVR8X  dr   V Uu. uF  pS! V4      '       d   K  VNK  	  pp\+        V4      \+        V4      8X  d   \        V R24       R# WÚR	&   V! V	4       \        RV 24       \        R4       R# \,        ;QJ d    V3R lV 4       F  '       g   K   RM	  RM! V3R lV 4       4      '       d   \        RV 24       M+VP/                  S4       WºR	&   V! V	4       \        RV 24       \1        V3R lV! V4       4       4      pV'       d   \        V R24       R# RP3                  V4      p\        RV R24       R# u upi u upi )uÁ   ``hermes skills trust|untrust [path]`` â€” manage ``skills.trusted_project_dirs``.

With no path, operates on the project root enclosing the current directory
(nearest ancestor with ``.git``).
)ÚPath)ÚPROJECT_SKILLS_SUBDIRSÚ_candidate_project_skills_dirsÚfind_project_rootÚiter_skill_index_filesr   rv   NzNot a directory: zaNot inside a git checkout. Run from a project directory or pass the project root path explicitly.ÚskillsÚtrusted_project_dirsc                ó0   € V ^8„  d   QhR\         R\        /# )r{   rg   r|   )rt   Úbool)r}   s   "r   r~   Ú'_cmd_skills_trust.<locals>.__annotate__î   s   € ÷ ?ñ ?”ð ?œñ ?r   c                 ód   <€ \        S! V 4      P                  4       P                  4       4      S8H  # r€   )rt   Ú
expanduserÚresolve)rg   r¥   Úroot_strs   &€€r   Ú_sameÚ _cmd_skills_trust.<locals>._sameî   s)   ø€ Ü‘4˜“7×%Ñ%Ó'×/Ñ/Ó1Ó2°hÑ>Ð>r   rž   z was not trusted.zUntrusted: z2Project skills from this repo will no longer load.c              3   ó4   <"  € T F  pS! V4      x € K  	  R # 5ir€   © )Ú.0rg   r³   s   & €r   Ú	<genexpr>Ú$_cmd_skills_trust.<locals>.<genexpr>ü   s   øé € Ð
%™W˜‰5��8ˆ8›Wùs   ƒTFzAlready trusted: z	Trusted: c              3   óV   <"  € T F  p\        R  S! VR4       4       4      x € K   	  R# 5i)c              3   ó&   "  € T F  p^x € K	  	  R# 5i)é   Nr¶   )r·   Ú_s   & r   r¸   Ú._cmd_skills_trust.<locals>.<genexpr>.<genexpr>  s   é € Ð=Ñ<�!�AÓ<ùs   ‚zSKILL.mdN)Úsum)r·   Údr©   s   & €r   r¸   r¹     s.   øé € ð 7á5ˆAô 	Ñ=Ñ-¨a°Ô<Ó=×=Ð=Û5ùs   ƒ&)zw project skill(s) will load in sessions started inside this repo (they take precedence over same-named profile skills).z or u/   No project skills found yet â€” add them under Ú.)Úpathlibr¥   Úagent.skill_utilsr¦   r§   r¨   r©   r   r   r   r›   r   r°   r±   Úis_dirr   Ú
setdefaultr   r   r]   rt   ÚlenÚanyr    r¿   Újoin)r*   r¦   r§   r¨   r   r   rb   Úraw_pathÚrootr   Ú
skills_cfgÚtrustedrg   ÚkeptÚcountÚsubdirsr¥   r³   r©   r²   s   &               @@@@r   r    r    Ê   s>  û€ õ ÷ ó  ÷
 ;Ø×Ñ€FÜ�t˜V TÓ*€HßÙ�H‹~×(Ñ(Ó*×2Ñ2Ó4ˆØ�{‰{�}Š}ÜÐ% d VÐ,Ô-Ùð ñ !Ó"ˆØŠ<Üð9ô:ñ á‹]€FØ×"Ñ" 8¨RÓ0€JØ�n‰nÐ3Ó4×:Ð:¸€GÜ�gœt×$Ò$Ø�)ˆÙ&Ó'™w˜!Œs�1Žv™w€GÐ'Ü�4‹y€H÷?ñ ?ð �ÔÙ"Ó3™7�a©%°¯(—�™7ˆÐ3Üˆt‹9œ˜G›Ô$Ü�T�FÐ+Ð,Ô-ÙØ-1Ð)Ñ*Ù�FÔÜ�˜D˜6Ð"Ô#ÜÐBÔCÙç
ƒsÔ
%™WÓ
%‡s‡s‚sÔ
%™WÓ
%×%Ò%ÜÐ! $ Ð(Õ)à�‰�xÔ Ø-4Ð)Ñ*Ù�FÔÜ�	˜$˜Ð Ô!ô ô 7á/°Ô5ó7ó 7€E÷ ÜØˆgð Oð Oö	Pð —+‘+Ð4Ó5ˆÜÐ?À¸yÈÐJÖKùòG (ùò 4s   Ã4I&Ä*I+Ä?I+))Úacp_versionz	--version)Úcheckz--check)Úsetupz--setup)Úsetup_browserz--setup-browser)Ú
assume_yesz--yes)Ú__doc__Úpmr   rL   r   r2   r9   rJ   rT   rc   ry   r‚   r™   r£   r    r¶   r   r   Ú<module>r×      sP   ðñõ Û 
ò&ò#CòLð€
òò2òõ64ò"òJ$ôDLr   