+
    jHàjÔ�  ã                  óÂ  a € 0 t $ R t^ RIHt ^ RIt^ RIt^ RIHt ^ RIH	t	H
t
HtHtHtHtHtHtHtHt ^ RIHt ^ RIHt RGR R lltRHtR	 R
 ltR R ltRIR R lltR R ltR R lt]! 4       R R l4       tRHt ]!! RR04      t"] 3R R llt#R R lt$R R lt%RHt&R R lt'R RJR!RK/t(R"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/R/ R0 lt0]! 4       R1 R2 l4       t1]! 4       R3 R4 l4       t2]! 4       R5 R6 l4       t3R7 R8 lt4]! R4      R9 R: l4       t5R; R< lt6]! 4       R= R> l4       t7/ t8R?]9R@&   RA RB lt:]! 4       RC RD l4       t;]! R4      RE RF l4       t<R# )La  HERMES_HOME state checks for hermes doctor: directories, memory files, state.db health, skills hub, memory provider, profiles.
Split out of ``hermes_cli/doctor.py``, which re-exports every name so ``hermes_cli.doctor.<name>`` keeps resolving (and monkeypatching).)ÚannotationsN)ÚPath)
ÚFindingÚ_fail_and_issueÚ_sectionÚ
check_boolÚ
check_infoÚcheck_okÚ
check_warnÚdoctor_checkÚ
ensure_dirÚwarn_on_error)Úformat_bytes)Úread_only_db_uric               ó    € V ^8„  d   QhRRRR/# )é   Úhermes_homezPath | NoneÚreturnÚdict© )Úformats   "Ú</home/ubuntu/.hermes/hermes-agent/hermes_cli/doctor_state.pyÚ__annotate__r      s   € ÷ ñ  {ð ¸dñ ó    c                óò   € ^ RI Hp  ^ RIHp V e   T MTR,          pVP	                  4       '       g   / # V! V4      P                  R4      p\        V\        4      '       d   V# / #   \         d    / u # i ; i)z?Return the effective memory section used by doctor diagnostics.©ÚHERMES_HOME)Úload_user_config_effectiveúconfig.yamlÚmemory)	Úhermes_cli.doctorr   Úhermes_cli.config_effectiver   ÚexistsÚgetÚ
isinstancer   Ú	Exception)r   r   r   Úconfig_pathÚsections   &    r   Ú_doctor_memory_configr(      ss   € å-ðÝJØ&1Ò&=‘{À;ÐR_Õ_ˆØ×!Ñ!×#Ò#ØˆIÙ,¨[Ó9×=Ñ=¸hÓGˆÜ$ W¬d×3Ò3ˆwÐ;¸Ð;øÜô ØŠ	ðús!   ˆ*A& ³A& µ.A& Á$A& Á&A6Á5A6c               ó   € V ^8„  d   QhRR/# ©r   r   Úlistr   )r   s   "r   r   r   #   s   € ÷ @ñ @�Tñ @r   c                 óP   € V  UUu. uF  w  rVf   K  V! 4       NK  	  upp# u uppi )uY   ``[fmt() for value, fmt in pairs if value is not None]`` â€” present-only stat fragments.r   )ÚpairsÚvalueÚfmts   *  r   Ú_bitsr0   #   s"   € á$)Ô?¡E‘j�e¨UŒE‰CŽE¡EÒ?Ð?ùÓ?s   †"“"c               ó   € V ^8„  d   QhRR/# )r   r   Ústrr   )r   s   "r   r   r   (   s   € ÷ 
Gñ 
G˜3ñ 
Gr   c                 óv   €  ^ RI Hp  V ! 4       pTe   RTP                  4        R2# R#   \         d     R# i ; i)a,  ``" (the host gateway (PID 42) serving profiles default, coder)"`` when one gateway process
owns this host, else ``""``. Multiplex-only: the state.db holder and WAL lines used to imply a
gateway per profile; the truth is one shared process serving N profiles, and stopping it stops
every one of them.)Úhost_gateway_topologyÚ z (Ú))Úgateway.host_topologyr4   r%   Údescribe)r4   Útopologys     r   Úhost_gateway_noter:   (   sK   € ð
Ý?Ù(Ó*ˆð +3Ò*>ˆR�×!Ñ!Ó#Ð$ AÐ&ÐFÀBÐFøô ô Úðús   ‚) ©8·8r5   c               ó$   € V ^8„  d   QhRRRRRR/# )r   Ústatsr   Ú	host_noter2   r   r+   r   )r   s   "r   r   r   5   s!   € ÷ 4ñ 4 $ð 4Àð 4Èdñ 4r   c           	     óÎ  a aaaaa€ . pS ;'       g    / o V 3R lR- 4       w  ooo\        SV3R l3S P                  R4      V 3R l3SV3R l3SV3R l34      pV'       d+   VP                  RRR	P                  V4      ,           R
34       \        S P                  R4      V 3R l3S P                  R4      V 3R l3S P                  R4      ;'       g    RV 3R l3SVV3R l34      pV'       d$   VP                  RR	P                  V4      R
34       S P                  R4      pV'       db   VP	                  4        UUu. uF  w  rxV'       g   K  VNK  	  p	ppTP                  RRV	'       d   R	P                  V	4      MR,           R
34       S P                  R4      p
\        V
\        4      '       d›   V
P                  R4      ;'       g    RpV
P                  R4      '       d6   TP                  RRT RV
P                  R4      ;'       g    R R2R 34       M3TP                  RR!V
P                  R"4      ;'       g    R R#V 2R$34       SeŒ   S\        8”  d�   R%p\        S P                  R&4      4      pS P                  R'4      '       g    S P                  R(4      '       g	   V'       d
   VR),          pVP                  RR*\        S4       R+2R,V R+234       V# u uppi ).u,  Turn a collect_state_db_stats() dict into ``(kind, text, detail)`` rows, kind 'info' / 'warn'.

Pure formatting â€” no I/O â€” so it is unit-testable without the doctor CLI. Tolerates None in every field.
``host_note`` names the shared host gateway among the holders (see :func:`host_gateway_note`).
c              3  óF   <"  € T F  pSP                  V4      x € K  	  R # 5i©N)r#   )Ú.0Úkr<   s   & €r   Ú	<genexpr>Ú)_render_state_db_stats.<locals>.<genexpr>=   s   øé € ÐoÑ4n¨q˜eŸi™i¨Ÿl˜lÓ4nùs   ƒ!c                 ó    <€ R \        S 4       2# )zlogical size ©Ú_human_bytes)Úlogicals   €r   Ú<lambda>Ú(_render_state_db_stats.<locals>.<lambda>?   s   ø€ ˜M¬,°wÓ*?Ð)@ÑAr   Ú
page_countc                 ó   <€ S R ,          R R2# )rK   Ú,z pagesr   ©r<   s   €r   rI   rJ   @   s   ø€ ¨U°<Õ-@ÀÐ,CÀ6Ñ*Jr   c                 ó   <€ S R  R2# )rM   z freer   )Úfreelists   €r   rI   rJ   A   s   ø€ ˜h q˜\¨Ñ/r   c                 ó    <€ R \        S 4       2# )zWAL rF   )Úwals   €r   rI   rJ   B   s   ø€ ˜œ\¨#Ó.Ð/Ñ0r   Úinfoz	state.db ú, r5   Úmessagesc                 ó   <€ S R ,          R R2# )rU   rM   z	 messagesr   rN   s   €r   rI   rJ   G   ó   ø€ ¨5°Õ+<¸QÐ*?¸yÑ(Ir   Úsessionsc                 ó   <€ S R ,          R R2# )rX   rM   z	 sessionsr   rN   s   €r   rI   rJ   H   rW   r   Újournal_modeNc                 ó   <€ R S R,           2# )zjournal_mode=rZ   r   rN   s   €r   rI   rJ   I   s   ø€ °mÀEÈ.ÕDYÐCZÑ4[r   c                 ó   <€ S  R S 2# )z  process(es) holding the DB openr   ©Úholdersr=   s   €€r   rI   rJ   J   s   ø€ ˜W˜IÐ%EÀiÀ[ÑQr   Ú
fts_tableszFTS tables: ÚnoneÚfts_rebuild_deferralÚholder_pidsÚunknownÚfutileÚwarnz<state.db FTS repair is blocked by the same holder(s) PID(s) z for Úholders_attemptsÚ?z+ consecutive deferral(s); waiting is futileu†   (stop ONLY the listed process(es) â€” the host gateway keeps running and its own retry rebuilds within a minute of the holder leaving)z%state.db FTS repair is blocked after Úattemptsz deferral(s) by PID(s) zŒ(stop the listed processes; the host gateway's own retry then rebuilds, or run 'hermes sessions optimize-storage' with every holder stopped)zDconsider enabling sessions.auto_prune in config.yaml to bound growthÚfts_storage_upgrade_neededÚfts_rebuild_pendingÚfts_teardown_pendingzg; run 'hermes sessions optimize-storage' offline (with the host gateway stopped) to compact FTS storagezstate.db is large (r6   Ú()Úlogical_size_bytesÚwal_size_bytesÚfreelist_count)
r0   r#   ÚappendÚjoinÚitemsr$   r   ÚSTATE_DB_SIZE_WARN_BYTESÚboolrG   )r<   r^   r=   ÚlinesÚ	size_bitsÚrow_bitsÚftsÚtÚokÚpresentÚdeferralÚpidsÚdetailÚstructural_fts_upgraderP   rH   rR   s   fff           @@@r   Ú_render_state_db_statsr€   5   s¯  ý€ ð €EØ�KˆK�R€EÜoÑ4nÓoÑ€GˆS�(ÜØ	ÔAÐBØ	�‰�<Ó	 Ô"JÐKØ	Ô/Ð0Ø	Ô0Ð1ó	€I÷ Ø�‰�f˜k¨D¯I©I°iÓ,@Õ@À"ÐEÔFÜØ	�‰�:Ó	Ô IÐJØ	�‰�:Ó	Ô IÐJØ	�‰�>Ó	"×	*Ð	* dÔ,[Ð\Ø	ÕQÐRó	€H÷ Ø�‰�f˜dŸi™i¨Ó1°2Ð6Ô7Ø
�)‰)�LÓ
!€Cß
Ø"%§)¡)¤+Ô4¡+™˜´—1�1¡+ˆÑ4Ø�‰�f˜nÇg°·	±	¸'Ô0BÐSYÕZÐ\^Ð_Ô`Ø�y‰yÐ/Ó0€HÜ�(œD×!Ò!Ø�|‰|˜MÓ*×7Ð7¨iˆØ�<‰<˜×!Ò!Ø�L‰L˜&Ð$`ÐaeÐ`fÐfkØ%Ÿ\™\Ð*<Ó=×DÐDÀÐEÐEpð#rðRðSõ Tð
 �L‰L˜&Ð$IÈ(Ï,É,ÐWaÓJb×JiÐJiÐfiÐIjð k'Ø'+ fð#.ðZð[ô \ð Ò˜wÔ)AÔAØWˆÜ!% e§i¡iÐ0LÓ&MÓ!NÐØ�9‰9Ð*×+Ò+¨u¯y©yÐ9O×/PÒ/P×TjØÐÕˆFØ�‰�fÐ 3´LÀÓ4IÐ3JÈ!ÐLÐPQÐRXÐQYÐYZÈmÐ\Ô]à€Lùó3 5s   ÅK!ÅK!c               ó    € V ^8„  d   QhRRRR/# )r   r   r   r   Útupler   )r   s   "r   r   r   l   s   € ÷ Zñ Z Tð Z¨eñ Zr   c                ó4   € ^ RI Hp V! R\        V 4      /4      # )é    )Úget_builtin_memory_store_flagsr   )Útools.memory_toolr…   r(   )r   r…   s   & r   Ú_memory_store_flagsr‡   l   s   € Ý@Ù)¨8Ô5JÈ;Ó5WÐ*XÓYÐYr   c               ó   € V ^8„  d   QhRR/# )r   r   ÚNoner   )r   s   "r   r   r   q   s   € ÷ E
ñ E
 tñ E
r   c                 óÌ  a€ ^ RI Hp Hp  ^ RIHp T! \        T4      4      T 8w  d   R# ^ RIHpH	p TR,          oSR,          P                  4       '       g   R# \        R4       R T3R	 llpT! R
R4      pT! RRR4      pT! RR4      pTRJ;'       dÅ    TP                  ^ 8H  ;'       d®    TP                  P                  4       R8H  ;'       d‰    TRJ;'       d}    TP                  ^ 8H  ;'       df    TP                  P                  4       R8H  ;'       dA    TRJ;'       d5    TP                  ^ 8H  ;'       d    TP                  P                  4       R8H  p	Rp
 \        R SP!                  R4       4       4      pRTR,          R R2p
T	'       d    \%        RT RT
 2R4       \'        R4       R# \)        RT R24       R#   \
         d     R# i ; i  \"         d     LWi ; i)u  Report the unused legacy checkout under an embedded desktop install.

Before the embedded runtime existed, the desktop app installed a git
checkout at $HERMES_HOME/hermes-agent. An embedded app never uses it,
so it sits on disk (1-2 GB of tree + venv). Doctor only REPORTS the
checkout and its size â€” it never suggests a deletion command, and
never deletes anything itself: a pristineness probe cannot prove no
other client uses the tree or that every local commit is published,
so the review-and-decide step belongs to the user.
)ÚSTEWARD_DESKTOPÚsealed_steward)ÚPROJECT_ROOTN©r   Ú_DHHzhermes-agentz.gitzLegacy Desktop Checkoutc               ó   € V ^8„  d   QhRR/# )r   Úargsr2   r   )r   s   "r   r   Ú3check_legacy_desktop_checkout.<locals>.__annotate__Ž   s   € ÷ ñ �Cñ r   c            	     óž   <€  \         P                  ! R R\        S4      .V ORRR^
RR7      #   \        \         P                  3 d     R# i ; i)Úgitz-CTúutf-8F)Úcapture_outputÚtextÚencodingÚtimeoutÚcheckN)Ú
subprocessÚrunr2   ÚOSErrorÚSubprocessError)r‘   Úcheckouts   *€r   Ú_gitÚ+check_legacy_desktop_checkout.<locals>._gitŽ   sW   ø€ ð	Ü—>’>Ø˜œc (›mÐ3¨dÐ3Ø#¨$¸È"Øôð øô
 œ×3Ñ3Ð4ô 	Úð	ús   ƒ)- ­AÁAÚstatusz--porcelainz	rev-parsez--abbrev-refÚHEADÚstashr+   r5   Úmainc              3  ó„   "  € T F6  qP                  4       '       g   K  VP                  4       P                  x € K8  	  R # 5ir@   )Úis_fileÚstatÚst_size)rA   Úfs   & r   rC   Ú0check_legacy_desktop_checkout.<locals>.<genexpr>¦   s'   é € ÐQÑ.A¨ÇYÁYÇ[Ô$�A—F‘F“H×$Ö$Ó.Aùs
   ‚A ž"A Ú*z (~i Êš;z.1fz GB)zUnused checkout at z/hermes-agentzF(the desktop app runs embedded and does not use it; the tree is clean)uZ       Review it and decide whether to keep or remove it â€” doctor does not delete anything.zA checkout exists at zŠ/hermes-agent but holds local work (changes, a branch, or stashes). The desktop app does not use it; review it before you remove anything.)Úhermes_cli.stewardr‹   rŒ   Úhermes_cli.mainr�   r%   r   r    r   r�   r"   r   Ú
returncodeÚstdoutÚstripÚsumÚrglobr�   r
   Úprintr   )r‹   rŒ   r�   r   r�   r    r¢   ÚbranchÚstashesÚpristineÚ	size_noteÚtotalrŸ   s               @r   Úcheck_legacy_desktop_checkoutrº   q   s  ø€ ÷ CðÝ0ñ ”d˜<Ó(Ó)¨_Ô<Ùç3à˜^Õ+€HØ�vÕ×%Ñ%×'Ò'ÙäÐ&Ô'÷ð ñ �(˜MÓ*€FÙ�+˜~¨vÓ6€FÙ�7˜FÓ#€Gð
 	�dÐ÷ 	]ð 	]˜v×0Ñ0°AÑ5÷ 	]ð 	]¸&¿-¹-×:MÑ:MÓ:OÐSUÑ:U÷ 	]ð 	]Ø˜$Ð÷	]ð 	]Ø#)×#4Ñ#4¸Ñ#9÷	]ð 	]Ø>D¿m¹m×>QÑ>QÓ>SÐW]Ñ>]÷	]ð 	]à˜4Ð÷	]ð 	]à$+×$6Ñ$6¸!Ñ$;÷	]ð 	]à@GÇÁ×@TÑ@TÓ@VÐZ\Ñ@\ð ð €IðÜÑQ¨h¯n©n¸SÔ.AÓQÓQˆØ˜% -Õ/°Ð4°DÐ9ˆ	÷ ÜØ! $  }°Y°KÐ@ØTô	
ô 	ÐjÖkäØ# D 6ð *8ð 8ö	
øôe ô ÚðûôP ô Ùðús#   ‹G Å/G ÇGÇGÇG#Ç"G#c               ó$   € V ^8„  d   QhRRRRRR/# ©r   Ú
should_fixrt   rª   r   r   r‰   r   )r   s   "r   r   r   º   s&   € ÷ ,jñ ,j¨4ð ,j°Gð ,jÀñ ,jr   c                óf  €  \        4        ^ RIHpHp Tp\        WWC R2RV R2V R24       \        V4      w  rV\        T;'       g    T4      p. R"OV'       d   R.M. ,            F+  p\        WWH,          V RV R2RV RV R2V RV R	24       K-  	  \        WC4       VR
,          p	V	P                  4       '       d‡   V	P                  RR7      P                  4       P                  4       p
\        ;QJ d    R V
 4       F  '       g   K   RM	  RM! R V
 4       4      '       d   \        V R24       M~\        V R24       Mo\!        V R2R4       V '       dY   V	P"                  P%                  RRR7       V	P'                  RRR7       \        RV R24       V;P(                  ^,          un        VR,          pV'       g   \        R4      # VP                  4       p\        WW³ R2RV R2V R24       VR3VR33 UUu. uF  w  rÞV'       g   K  V'       g   K  VNK  	  upp Fm  pW¿,          P                  4       '       dA   \        V R\+        W¿,          P                  RR7      P                  4       4       R24       K_  \        V R 24       Ko  	  R!#   \         d     EL�i ; iu uppi )#zNHERMES_HOME, expected subdirs, SOUL.md, and the enabled built-in memory files.rŽ   z directory existszCreated z
 directoryz
 not foundÚmemoriesÚ/z/ existsz/ not foundzSOUL.mdú	utf-8-sig©r˜   c              3  ó˜   "  € T F@  qP                  4       ;'       d%    VP                  4       P                  R4      '       * x € KB  	  R# 5i)ú<!--N)rÄ   z-->Ú#)r±   Ú
startswith)rA   Úls   & r   rC   Ú-_check_directory_structure.<locals>.<genexpr>Î   s7   é € Ð[ÑUZÐPQ�w‰w‹y×KÐK §¡£×!5Ñ!5Ð6JÓ!KÔKÔKÓUZùs
   ‚A
�-A
TFz$/SOUL.md exists (persona configured)uA   /SOUL.md exists but is empty â€” edit it to customize personalityz/SOUL.md not foundz/(create it to give Hermes a custom personality))ÚparentsÚexist_okz# Hermes Agent Persona

<!-- Edit this file to customize how Hermes communicates. -->

You are Hermes, a helpful AI assistant.
r•   z/SOUL.md with basic templatez(Built-in memory files disabled by configz/memories/ directory existsz
/memories/z/memories/ not foundz	MEMORY.mdzUSER.mdz	 exists (z chars)zG not created yet (will be created when the agent first writes a memory)N)ÚcronrX   ÚlogsÚskills)rº   r%   r    r   r�   r   r‡   rt   Ú_check_scratch_dirr"   Ú	read_textr±   Ú
splitlinesÚanyr	   r   r
   ÚparentÚmkdirÚ
write_textÚfixedÚlen)r½   rª   r   r�   r   Ú_memory_enabledÚ_user_profile_enabledÚ	memory_onÚsubdir_nameÚ	soul_pathru   Úmemories_dirÚexistedÚonÚnÚfnames   &&              r   Ú_check_directory_structurerá   ¹   s¹  € ðÜ%Ô'÷ 4Ø€KÜˆq˜k¨VÐ3DÐ+EÈÐRVÐQWÐWaÐGbÐgkÐflÐlvÐdwÔxÜ-@ÀÓ-MÑ*€OÜ�_×=Ð=Ð(=Ó>€Iâ=×QZÀ*ÁÐ`b×cÐcˆÜ�1 +Õ";À¸vÀQÀ{ÀmÐS[Ð=\Ø˜d˜V 1 [ M°Ð3¸°v¸Q¸{¸mÈ;Ð5Wö	Yñ dô �{Ô)à˜iÕ'€IØ×Ñ×ÒØ×#Ñ#¨[Ð#Ó9×?Ñ?ÓA×LÑLÓNˆß‹3Ñ[ÑUZÓ[�3�3Š3Ñ[ÑUZÓ[×[Ò[Ü˜�vÐAÐBÕCä˜$˜Ð`ÐaÕbä�d�VÐ-Ð.Ð0aÔbßØ×Ñ×"Ñ"¨4¸$Ð"Ô?Ø× Ñ ð "MØW^ð !ô `ä�x ˜vÐ%AÐBÔCØ�GŠG�q�L�Gð  Õ+€LßÜÐDÓEÐEØ×!Ñ!Ó#€GÜˆq˜l¨fÐ4OÐ,PÐT\Ð]aÐ\bÐblÐRmØ�Ð+Ð,ô.à#2°KÐ"@ÐCXÐZcÐBdÑ!eÔxÑ!e™˜Ôik”!Ôpw—!�!Ñ!eÕxˆØÕ ×(Ñ(×*Ò*Ü˜�w˜i¬¨\Õ-A×,LÑ,LÐVaÐ,LÓ,b×,hÑ,hÓ,jÓ(kÐ'lÐlsÐtÖuä˜%˜Ð gÐhÖió	 yøôI ô ÚðüóH ys#   ‚
J ÈJ-ÈJ-ÈJ-ÊJ*Ê)J*ÚscratchÚterminalc               ó$   € V ^8„  d   QhRRRRRR/# )r   r   r   Ú	min_bytesÚintr   zlist[tuple[str, int]]r   )r   s   "r   r   r   î   s"   € ÷ 3ñ 3 Tð 3°cð 3Ð[pñ 3r   c                ó¨  € ^ RI Hp V R,          p. p VP                  4        Uu. uFK  qUP                  4       '       g   K  VP	                  4       '       d   K2  VP
                  \        9  g   KI  VNKM  	  ppT F0  pT! T4      pY�8¼  g   K  TP                  TP
                  T34       K2  	  \        TR R7      # u upi   \         d    Tu # i ; i)a  ``(name, bytes)`` for ``cache/`` entries outside the pruned dirs that exceed *min_bytes*.

Finished campaign trees parked at the cache root sat for weeks (95 GB on one host)
because only ``scratch/`` and ``terminal/`` are reaped; doctor is where that shows.)Úscratch_dir_usage_bytesÚcachec                ó   € V ^,          ) # )é   r   )Úitems   &r   rI   Ú%unpruned_cache_hogs.<locals>.<lambda>ÿ   s
   € ¨$¨q­'©r   )Úkey)
Úhermes_constantsrè   ÚiterdirÚis_dirÚ
is_symlinkÚnameÚ_PRUNED_CACHE_DIRSr�   rp   Úsorted)	r   rå   rè   ré   ÚhogsÚeÚentriesÚentryÚsizes	   &&       r   Úunpruned_cache_hogsrû   î   s³   € õ
 9à˜'Õ!€EØ"$€DðØ#Ÿm™mœoÓx™o˜·±·”1ÀAÇLÁLÇN”1ÐWX×W]ÑW]ÔewÑWw—1�1™oˆÐxó ˆÙ& uÓ-ˆØÖØ�K‰K˜Ÿ™ TÐ*Ö+ñ ô �$Ñ1Ô2Ð2ùò yøÜô ØŠðús4   “C ¥B<ÁB<ÁB<Á0B<Á6C Â<C ÃCÃCc               ó$   € V ^8„  d   QhRRRRRR/# )r   r   r   r�   r2   r   r‰   r   )r   s   "r   r   r     s&   € ÷ Zñ Z Dð Z°ð Z¸ñ Zr   c           
     ó  € ^ RI HpHpHpHp V! V RR7      p\        V! V4      4      p\        V RV RV R24       ^ RIHpH	p	 V	! V4       F&  p
\        V RV
P                   R	V! V
4       24       K(  	  \        V 4       F"  w  r¼\        V R
V R\        V4       R24       K$  	  \        P                  P                  RR4      pV'       d9   V\        P                  P                  VR4      8w  d   \!        RV R24       R# R# R# )zfReport the scratch dir (TMPDIR target) and its size; a user-set TMPDIR elsewhere is shown, not judged.)ÚSCRATCH_DIR_MARKER_ENVÚSCRATCH_MAX_IDLE_HOURSÚget_scratch_dirrè   F)Úprunez,/cache/scratch/ is the scratch dir (TMPDIR; z, entries pruned after zh idle))Úremoval_hintÚstuck_entriesz/cache/scratch/u<   / holds files you may not delete, so the prune skips it â€” z/cache/z/ is u‹    and outside every pruner (only cache/scratch/ and cache/terminal/ are reaped) â€” move task files under cache/scratch/<task>/ or delete itÚTMPDIRr5   zTMPDIR=z3 is set by you or the OS, so Hermes leaves it aloneN)rï   rþ   rÿ   r   rè   rG   r	   Úhermes_constants_scratch_stuckr  r  r
   ró   rû   ÚosÚenvironr#   r   )r   r�   rþ   rÿ   r   rè   râ   rú   r  r  rù   ró   ÚnbytesÚtmpdirs   &&            r   rÎ   rÎ     s  € ÷bó bá˜k°Ô7€GÜÑ/°Ó8Ó9€DÜ�ˆvÐAÀ$ÀÐG^Ð_uÐ^vÐv}Ð~ÔßJÙ˜wÖ'ˆÜ�d�V˜?¨5¯:©:¨,Ð6rÑsð  AFó  tGð  sHð  Iö  	Jñ (ä+¨KÖ8‰ˆÜØˆf�G˜D˜6 ¤|°FÓ';Ð&<ð =1ð 2ö	
ñ 9ô �Z‰Z�^‰^˜H bÓ)€Fß�&œBŸJ™JŸN™NÐ+AÀ2ÓFÔFÜ�W˜V˜HÐ$WÐXÖYñ G�vr   c               ó   € V ^8„  d   QhRR/# )r   Ústate_db_pathr   r   )r   s   "r   r   r     s   € ÷ ñ  $ñ r   c                óÚ   € ^ RI pVP                  \        V 4      RR7      p VP                  R4      P	                  4       ^ ,          VP                  4        #   TP                  4        i ; i)r„   NT)ÚurizSELECT COUNT(*) FROM sessions)Úsqlite3Úconnectr   ÚexecuteÚfetchoneÚclose)r  r  Úconns   &  r   Ú_session_countr    sP   € Ûà�?‰?Ô+¨MÓ:Àˆ?ÓE€DðØ�|‰|Ð;Ó<×EÑEÓGÈÕJà�
‰
�øˆ�
‰
�ús   ¢%A ÁA*c               ó    € V ^8„  d   QhRRRR/# )r   r  r   r½   rt   r   )r   s   "r   r   r   %  s   € ÷ +ñ +¨ð +¸Tñ +r   c               óŠ  € ^ RI HpHp V! V 4      '       g	   V! V 4      # V'       g1   V P                  4       P                  \
        8”  d   \        R4       R# ^ RIp^ RIpVP                  4       ;_uu_ 4       p\        V4      R,          pVP                  \        V 4      RRR7      p VP                  \        V4      4      p	 VP                  V	4       V	P                  4         VP                  4        V! V4      uuRRR4       #   T	P                  4        i ; i  TP                  4        i ; i  + '       g   i     R# ; i)a  FTS/write-health probe (a rolled-back BEGIN IMMEDIATE). Against a store a live writer holds,
that probe is the second-writer class (#103339), so probe a read-only snapshot instead; a quiet
store is probed in place. Returns the failure reason, or None when healthy or skipped.)Ú_db_opens_cleanlyÚ_live_writer_holds_dbz€state.db write-health probe skipped: store is held by a live writer and larger than 1 GB (run 'hermes doctor --fix' to probe it)Nústate.dbTg      ð?)r  r™   )Úhermes_state_repairr  r  r¨   r©   Ú_WRITE_PROBE_SNAPSHOT_MAX_BYTESr   r  ÚtempfileÚTemporaryDirectoryr   r  r   r2   Úbackupr  )
r  r½   r  r  r  r  ÚtmpÚsnapshotÚsrcÚdests
   &$        r   Ú_write_health_reasonr#  %  sõ   € ÷ MÙ  ×/Ò/Ù  Ó/Ð/ß˜-×,Ñ,Ó.×6Ñ6Ô9XÔXÜð =ô 	>áÛÛØ	×	$Ñ	$×	&Ô	&¨#Ü˜“9˜zÕ)ˆØ�o‰oÔ.¨}Ó=À4ÐQTˆoÓUˆð	Ø—?‘?¤3 x£=Ó1ˆDðØ—
‘
˜4Ô à—
‘
•à�I‰IŒKÙ  Ó*÷ 
'Ò	&øð —
‘
•ûà�I‰I�Kú÷ 
'×	&Ð	&ús<   Á70D1Â(DÃDÃDÃ%D1ÄDÄDÄD.Ä.D1Ä1E	rx   Úschemau¸  state.db structural corruption (canonical tables/indexes damaged, not the FTS index) â€” an FTS rebuild cannot repair it. Stop the gateway, then run 'hermes {profile_arg}sessions recover --source {db_path} --inspect-only' and, if it reports recoverable, 'hermes {profile_arg}sessions recover --source {db_path} --output recovered-state.db'. Do NOT restore a .malformed-backup copy beside state.db: it is a snapshot of the same corrupt file.c          
     ó,   € V ^8„  d   QhRRRRRRRRR	R
/# )r   rª   r   r½   rt   r  r   Úkindr2   r   r‰   r   )r   s   "r   r   r   V  s0   € ÷ ñ ˜ð ¨Tð À$ð Ècð ÐVZñ r   c           	     ó>  € VR8X  d<   ^ RI Hp V P                  P                  \        P                  V! 4       VR7      4      # \        V,          w  rVrxV'       g   V P                  P                  V4      # ^ RIH	p	 V	! V4      p
V
P                  R4      '       gM   \        VRV
P                  R4       RV
P                  R	4       R
24       V P                  P                  V4      # RV9   d    VP                  \        V4      R7      pV
P                  R	4      '       d   \        V
R	,          4      P                  MRp\!        VRV
P                  R4       RV R
24       V ;P"                  ^,          un        R#   \         d    TP                  RR7      p L‘i ; i)z\Shared --fix path for both state.db corruption classes (FTS write health, malformed schema).Ú
structural©Úprofile_cli_selector)Úprofile_argÚdb_path)Úrepair_state_db_schemaÚrepairedrl   Úerrorz
; backup: Úbackup_pathr6   z{count})Úcountrg   zn/az(strategy: ÚstrategyN)rï   r*  Úmanual_issuesrp   Ú_STATE_DB_STRUCTURAL_ISSUEr   Ú_STATE_DB_REPAIRSÚissuesr  r-  r#   r
   r  r%   r   ró   r	   rÕ   )rª   r½   r  r&  r*  Úok_labelÚnot_fixed_labelÚfailed_issueÚfix_hintr-  ÚreportÚbackup_names   &&&&        r   Ú_repair_state_dbr=  V  sb  € àˆ|ÔÝ9Ø�‰×%Ñ%Ô&@×&GÑ&GÙ,Ó.¸ð 'Hó 'Gó Hð 	Hä8IÈ$Õ8OÑ5€H˜|ßØ�x‰x�‰˜xÓ(Ð(Ý:Ù# MÓ2€FØ�:‰:�j×!Ò!Ü�? a¨¯
©
°7Ó(;Ð'<¸JÀvÇzÁzÐR_ÓG`ÐFaÐabÐ$cÔdØ�x‰x�‰˜|Ó,Ð,Ø�HÔð	2Ø—‘¬^¸MÓ-J�ÓKˆHð 7=·j±jÀ×6OÒ6O”$�v˜mÕ,Ó-×2Ò2ÐUZ€KÜˆX˜ V§Z¡Z°
Ó%;Ð$<¸JÀ{ÀmÐSTÐUÔVØ‡G‚Gˆq…L‡Gøô	 ô 	2Ø—‘¨S�Ó1ŠHð	2ús   Ã/E< Å<FÆFc          
     ó,   € V ^8„  d   QhRRRRRRRRR	R/# )
r   rª   r   r½   rt   r  r   r�   r2   r   r   )r   s   "r   r   r   n  s1   € ÷ ñ  ð °dð È4ð ÐWZð Ðgkñ r   c                ór   € ^ RI Hp V! V4      '       g   R# \        V R2RV R24       \        WVR4       R# )z[True (and reported/repaired) when the canonical b-tree, not just the FTS index, is damaged.)Ústate_db_has_structural_damageFzY/state.db has structural corruption (canonical tables/indexes damaged, not the FTS index)rl   r6   r(  T)r  r@  r
   r=  )rª   r½   r  r�   Úreasonr@  s   &&&&& r   Ú_report_structural_damagerB  n  sC   € åBÙ)¨-×8Ò8ÙÜ�$�ð $ð $Ø'(¨¨° ]ô4ä�Q M°<Ô@Ùr   c               ó0   € V ^8„  d   QhRRRRRRRRR	R
RR/# )r   rª   r   r½   rt   r  r   r�   r2   Úexcr%   r   r‰   r   )r   s   "r   r   r   y  s9   € ÷ 
=ñ 
= Wð 
=¸$ð 
=Ètð 
=Ð[^ð 
=Ðenð 
=Ðswñ 
=r   c                ó¸   € ^ RI Hp \        WW#V4      '       d   R# V! V4      '       g   \        V RV 24      # \        V R2RV R24       \	        WVR4       R# )z\Structural damage first; only then schema repair. Avoids SessionDB auto-repair side effects.)Úis_malformed_db_errorNz!/state.db exists but has issues: z>/state.db schema is malformed (sessions hidden until repaired)rl   r6   r$  )Úhermes_staterF  rB  r
   r=  )rª   r½   r  r�   rD  rF  s   &&&&& r   Ú_classify_unreadable_state_dbrH  y  sf   € å2Ü  °ÀS×IÒIÙÙ  ×%Ò%Ü˜T˜FÐ"CÀCÀ5ÐIÓJÐJô �$�ÐUÐVÐZ[Ð\_Ð[`Ð`aÐXbÔcÜ�Q M°8Ö<r   c          
     ó,   € V ^8„  d   QhRRRRRRRRR	R
/# )r   rª   r   r½   rt   r  r   r�   r2   r   r‰   r   )r   s   "r   r   r   †  s0   € ÷ >ñ >˜ð >¨Tð >À$ð >Ècð >ÐVZñ >r   c                ó  €  \        V R\        V4       R24       \        W!R7      pTe8   \        YY#T4      '       d   R# \        T R2RT R24       \        YTR4       R# R#   \         d   p\	        YY#T4      u Rp?# Rp?ii ; i)	zWSession count + FTS write-health probe; malformed-schema path when even COUNT(*) fails.z/state.db exists (z
 sessions))r½   Nz?/state.db fails a write-health probe (FTS index may be corrupt)rl   r6   rx   )r	   r  r#  r%   rH  rB  r
   r=  )rª   r½   r  r�   Ú_write_reasonr÷   s   &&&&  r   Ú_state_db_healthrL  †  sœ   € ðTÜ�D�6Ð+¬N¸=Ó,IÐ+JÈ*ÐUÔVä,¨]ÔRˆð Ò Ü$ Q°MÈ×WÒWÙÜ�d�VÐZÐ[Ð_`ÐanÐ`oÐopÐ]qÔrÜ˜¨°uÖ=ñ	 !øô ô TÜ,¨Q¸MÐQRÓSÕSûðTús   ‚&A% Á%BÁ0BÁ<BÂBc               ó$   € V ^8„  d   QhRRRRRR/# )r   r6  r+   r  r   r   r‰   r   )r   s   "r   r   r   •  s&   € ÷ Tñ T˜Dð T°ð T¸$ñ Tr   c                ó’  € \        RRR R7      ;_uu_ 4        ^ RIHpHp \	        V! V4      V! V4      \        4       R7      pV Fb  w  rVpVR8w  d!   \        Yg'       d   RV 2MR,           4       K-  \        Wg4       R	V9   g   KA  T P                  R
RV9   d   RMR,           4       Kd  	  RRR4       R#   + '       g   i     R# ; i)zªHealth/stats snapshot: strictly read-only (mode=ro) so it is safe against a live DB held by
the gateway; any failure degrades to one info line rather than failing doctor.z state.db stats unavailable ({e})r5   c                ó   € \        V 4      # r@   )r   )ry   Ú_ds   &&r   rI   Ú!_state_db_stats.<locals>.<lambda>˜  s   € ÔT^Ð_`ÔTar   )r;  )Úcollect_state_db_statsÚcount_db_holdersr]   re   Ú Ú
auto_pruneu?   state.db is large â€” enable sessions.auto_prune in config.yamlzoptimize-storagezE and run 'hermes sessions optimize-storage' offline (gateway stopped)N)	r   Úhermes_state_dbfilerR  rS  r€   r:   r   r
   rp   )r6  r  rR  rS  ÚrowsÚ_kindÚ_textÚ_details   &&      r   Ú_state_db_statsr[  •  s»   € ô 
Ð9¸2ÑFa×	bÖ	bßPÜ%Ñ&<¸]Ó&KÑUeÐfsÓUtÜ0AÓ0CôEˆã%)Ñ!ˆE˜'Ø˜ŒÜ˜5¶W a¨ y¡MÀ"ÕEÔFÙÜ�uÔ&Ø˜wÖ&Ø—‘Ð_Øl~ð  CJô  mJÑ!hð  PRõSö Tñ &*÷	 
c×	b×	bÒ	bús   ˜A)B5Â%B5Â5C	c               ó(   € V ^8„  d   QhRRRRRRRR/# )	r   rª   r   r½   rt   r  r   r   r‰   r   )r   s   "r   r   r   ¦  s.   € ÷ $]ñ $]�Wð $]¨$ð $]¸tð $]Èñ $]r   c           
     ó’  a€ VP                   R,          oV3R lp\        R4      ;_uu_ 4        V! 4       pVR8”  Ed>   ^ RIHpHp RVR,           R2pRpV! V4      '       d2   \        VR	4       V P                  P                  V4      uuR
R
R
4       # \        VR4       V'       g&   V P                  P                  R4      uuR
R
R
4       # V! V4      ;_uu_ 4       w  ršV	f@   \        RRV
 R24       V P                  P                  V4      uuR
R
R
4       uuR
R
R
4       # V	P                  R4       R
R
R
4       \        RVR,           RV! 4       R,           R24       V ;P                  ^,          un
        MVR8”  d   \        RVR,           R24       R
R
R
4       R
#   + '       g   i     Lv; i  + '       g   i     R
# ; i)z>WAL file size (unbounded growth indicates missed checkpoints).zstate.db-walc                 óh   <€ S P                  4       '       d   S P                  4       P                  # ^ # )r„   )r"   r¨   r©   )Úwal_paths   €r   rI   Ú_state_db_wal.<locals>.<lambda>©  s%   ø€ °(·/±/×2CÒ2C�x—}‘}“×.Ñ.ÐJÈÐJr   r5   i   )Ú_exclusive_repair_db_guardr  zWAL file is large (z MB)u‚   Large WAL file â€” cannot prove state.db is quiet (stop the profile's gateway first, then run 'hermes doctor --fix' to checkpoint)uw   (normal while Desktop or the gateway is running, or state.db cannot be inspected â€” checkpoint only with them stopped)Nz!(may indicate missed checkpoints)u[   Large WAL file â€” stop the profile's gateway, then run 'hermes doctor --fix' to checkpointzFWAL checkpoint skipped: could not take exclusive ownership of state.dbrl   z>; stop the profile's gateway and re-run 'hermes doctor --fix')zPRAGMA wal_checkpoint(PASSIVE)zWAL checkpoint performed (u   K â†’ zK)zWAL file is z  MB (normal for active sessions)i   i   i    )rÒ   r   r  ra  r  r
   r6  rp   r  r	   rÕ   r   )rª   r½   r  Úwal_sizerú   ra  r  ÚtitleÚ_SKIPÚguardÚguard_errorr_  s   &&&        @r   Ú_state_db_walrg  ¦  s‘  ø€ à×#Ñ# nÕ4€HÜJ€HÜ	�r×	Õ	Ù‹zˆØÐ"Õ"÷
 ^Ø)¨$°9Õ*=Ð)>¸dÐCˆEð@ˆEñ % ]×3Ò3ô ˜5ð #Uô Và—x‘x—‘ uÓ-÷% 
Ò	ô& �uÐAÔBßØ—x‘x—‘Øqós÷+ 
Ò	ñ. ,¨M×:Ô:Ñ>R¸uØ’=ÜÐgØ!" ; -Ð/mÐnôpàŸ8™8Ÿ?™?¨5Ó1÷	 ;Ñ:÷/ 
Ò	ð8 —‘Ð>Ô?÷ ;ô Ð1°$¸$µ,°¸vÁhÃjÐTXÕFXÐEYÐY[Ð\Ô]Ø�GŠG�q�LŽGØÐ$Ô$Ü˜ d¨yÕ&9Ð%:Ð:ZÐ[Ô\÷A 
Ñ	÷. ;×:ú÷/ 
×	Ð	ús=   ®AF5Â.F5ÃF5Ã1F"	Ä
F5Ä#F"	Ä4A$F5Æ"F2Æ-F5Æ5G	c               ó(   € V ^8„  d   QhRRRRRRRR/# )	r   rª   r   r  r   r�   r2   r   rt   r   )r   s   "r   r   r   Í  s(   € ÷ ñ ˜Gð °Dð Àð Èñ r   c                ój  a€ ^ RI Hp ^ RIHp ^ RIHo \        \        P                  R V! V4       4       4      4      pV'       g   R# RP                  V3R lV 4       4      p\        V R\        V4       R	V R
2R4       V P                  P                  RV \        4        RV! 4        R24       R# )u  Name the processes holding a retired -wal/-shm generation (#110054). Every SessionDB open is
refused while they live, and the current inode has no holders, so the plain holder count says
"0 holding the DB open" beside a green state.db line â€” the opposite of the truth.r)  )Ú#iter_deleted_sqlite_sidecar_holders)Údescribe_holder_pidc              3  ó*   "  € T F	  w  rVx € K  	  R # 5ir@   r   )rA   ÚpidÚ_s   &  r   rC   Ú'_retired_wal_holders.<locals>.<genexpr>Ô  s   é € ÐcÑ0b¡f c�cÓ0bùs   ‚FrT   c              3  ó4   <"  € T F  pS! V4      x € K  	  R # 5ir@   r   )rA   rm  rk  s   & €r   rC   ro  ×  s   øé € ÐB¹T°cÑ,¨S×1Ð1»Tùs   ƒz/state.db: z2 process(es) still hold a retired WAL generation (r6   zP(every new session refuses to open until they exit; health/stats probes skipped)z(state.db retired WAL generation held by uK    â€” stop the host gateway, dashboard and cron writers among them ('hermes z‘gateway stop' stops the ONE host process serving every profile, quit the Desktop app), do not delete the WAL yourself, then rerun 'hermes doctor'T)rï   r*  rV  rj  Úhermes_state_holdersrk  r+   r   Úfromkeysrq   r
   rÖ   r6  rp   r:   )rª   r  r�   r*  rj  r}   Úrenderedrk  s   &&&    @r   Ú_retired_wal_holdersrt  Í  s´   ø€ õ 6ÝGÝ8Ü”—‘ÑcÑ0SÐTaÔ0bÓcÓcÓd€DßÙØ�y‰yÔB¹TÓBÓB€HÜ�$��{¤3 t£9 +Ð-_Ð`hÐ_iÐijÐkØaôcà‡H�H‡O�OÐ>¸x¸jÔIZÓI\ÐH]ð ^OÙOcÓOeÐNfð gJðJô Kñ r   c               ó$   € V ^8„  d   QhRRRRRR/# r¼   r   )r   s   "r   r   r   â  s!   € ÷ 0ñ 0 ð 0¨ð 0°Tñ 0r   c                óö   € ^ RI HpHp VR,          p\        WV4      '       d   R# VP	                  4       '       d$   \        WWC4       \        VP                  V4       M\        V R24       \        WV4       R# )zRstate.db session count, FTS write health, schema repair, stats snapshot, WAL size.rŽ   r  Nz</state.db not created yet (will be created on first session))
r    r   r�   rt  r"   rL  r[  r6  r   rg  )r½   rª   r   r�   r  s   &&   r   Ú_check_state_dbrw  á  sb   € ÷ 4Ø *Õ,€Mä˜A¨d×3Ò3ÙØ×Ñ×ÒÜ˜¨Ô<Ü˜Ÿ™ -Õ0ä�d�VÐWÐXÔYÜ�! Ö/r   c               ó$   € V ^8„  d   QhRRRRRR/# r¼   r   )r   s   "r   r   r   ò  s!   € ÷ 0ñ 0 $ð 0¨7ð 0°tñ 0r   c                óÂ  € ^ RI HpHp ^ RIHpHpHp VR,          pV! V4      ;peH   \        V RVR,           R24       VP                  P                  RVR	,           R
VR,           24      # VP                  4       '       d	   V! V4      MRp	V	e?   W”8  d9   \        V R\        V	4       R24       VP                  P                  RV 24      # \        V R24       R# )zZThe cron store accepts writes and its filesystem is not nearly full (jobs skip otherwise).rŽ   )ÚLOW_FREE_BYTESÚ
free_bytesÚprobe_reportrË   Nz/cron/ is NOT writable (r/  u+   ) â€” scheduled cron jobs are being skippedzCron store Ústorez is not writable: Úfixz/cron/ filesystem has only u&    free â€” cron jobs stop when it fillsz*Free disk space on the filesystem holding z/cron/ store is writable)r    r   r�   Úcron.store_healthrz  r{  r|  r
   r6  rp   rñ   rG   r	   )
r½   rª   r   r�   rz  r{  r|  Úcron_dirr;  Úfrees
   &&        r   Ú_check_cron_storer‚  ñ  sÛ   € ÷ 4ßJÑJØ˜VÕ#€HÙ˜xÓ(Ð(ˆÒ5Ü�d�VÐ3°F¸7µOÐ3DÐDoÐpÔqØ�x‰x�‰ ¨V°G­_Ð,=Ð=OÐPVÐW\ÕP]ÈÐ_Ó`Ð`Ø#+§?¡?×#4Ò#4‰:�hÔ¸$€DØÒ˜DÔ1Ü�d�VÐ6´|ÀDÓ7IÐ6JÐJpÐqÔrØ�x‰x�‰Ð!KÈHÈ:ÐVÓWÐWÜ�ˆvÐ-Ð.Ö/r   c               ó$   € V ^8„  d   QhRRRRRR/# r¼   r   )r   s   "r   r   r     s!   € ÷ ñ ¨ð °ð ¸Tñ r   c                óJ   € ^ RI Hp V! 4       pV'       d   \        V4       R# R# )zY/rollback store footprint: warn when checkpoints are on and the store sits above its cap.)Úcheckpoint_footprint_noticeN)Útools.checkpoint_maintenancer…  r
   )r½   rª   r…  Únotices   &&  r   Ú_check_checkpoint_storerˆ    s    € õ IÙ(Ó*€FßÜ�6Öñ r   c               ó   € V ^8„  d   QhRR/# r*   r   )r   s   "r   r   r   
  s   € ÷ Bñ B¨Dñ Br   c                óV  € ^ RI HpHp ^ RIHp V e    \        V 4      P                  4       '       g   R.#  V! \        V 4      4      p. pT EF  pT! T4      pTP                  ;'       g    TP                  p	TP                  '       g   TP                  TP                  J d'   TP                  RRTP                    R	T	 2R34       K~  TP                  TP"                  J d%   TP                  RRTP                    R
2T	34       K¼  TP                  TP$                  J d%   TP                  RRTP                    R2T	34       Kú  TP                  RRTP                    R2T	34       EK  	  T;'       g    R.#   \        \        \        3 d   pRR\        T4      3.u Rp?# Rp?ii ; i)zCReport local provenance using the update checker's admission rules.)ÚProvenanceClassÚplugins_provenance)Úcheck_local_provenanceNrS   r5   re   z#Plugin provenance could not be readzPlugin 'z': z' installed manuallyz': self-clonedrz   z': provenance in good standing)rS   z:No plugins directory yet (nothing to check provenance for)r5   )rS   zNo provenanced plugins foundr5   )Úhermes_cli.plugins_provenancer‹  rŒ  Úhermes_cli.plugins_updatesr�  r   rñ   r�   Ú
ValueErrorÚRuntimeErrorr2   Úneeds_fixingrA  ÚklassÚDRIFTrp   ró   ÚMANUALÚSELF_CLONED)
Úplugins_dirr‹  rŒ  r�  ÚprovenancesrD  rW  Ú
provenanceÚresultr~   s
   &         r   Ú_plugin_provenance_rowsr›  
  sˆ  € çQÝAàÒ¤$ {Ó"3×":Ñ":×"<Ò"<ØZÐ[Ð[ðKÙ(¬¨kÓ):Ó;ˆð €DÜ!ˆ
Ù'¨
Ó3ˆØ×$Ñ$×5Ð5¨¯©ˆØ××Ð *×"2Ñ"2°o×6KÑ6KÓ"KØ�K‰K˜ 8¨J¯O©OÐ+<¸CÀ¸xÐ!HÈ"ÐMÖNØ×Ñ ×!7Ñ!7Ó7Ø�K‰K˜ 8¨J¯O©OÐ+<Ð<PÐ!QÐSYÐZÖ[Ø×Ñ ×!<Ñ!<Ó<Ø�K‰K˜ 8¨J¯O©OÐ+<¸NÐ!KÈVÐTÖUà�K‰K˜ ¨*¯/©/Ð):Ð:XÐYÐ[aÐb×cñ "ð ×AÐAÐ@ÐAÐAøô ”Z¤Ð.ô KØÐ>ÄÀCÃÐIÐJÕJûðKús   ¶E9 Å9F(ÆF#ÆF(Æ#F(c               ó$   € V ^8„  d   QhRRRRRR/# r¼   r   )r   s   "r   r   r   %  s!   € ÷ %ñ %¨ð %°'ð %¸dñ %r   c                ó’   € ^ RI Hp R\        R\        RR /p\	        V! 4       R,          4       F  w  rEpW4,          ! WV4       K  	  R# )zAInspect local plugin update provenance without network or writes.)Úget_hermes_homere   rz   rS   c                ó>   € \        V  R V 2P                  4       4      # )rT  )r   Úrstrip)r—   r~   s   &&r   rI   Ú*_check_update_provenance.<locals>.<lambda>)  s#   € ÔQ[Ð_cÐ^dÐdeÐflÐemÐ\n×\uÑ\uÓ\wÔQxr   ÚpluginsN)rï   rž  r
   r	   r›  )r½   rª   rž  Úprintersr&  r—   r~   s   &&     r   Ú_check_update_provenancer¤  $  sA   € õ 1àœ
 D¬(°FÑ<xÐy€HÜ5±oÓ6GÈ)Õ6SÖTÑˆ�FØŽ�tÖ$ó Ur   c               ó   € V ^8„  d   QhRR/# )r   r   rt   r   )r   s   "r   r   r   .  s   € ÷ ñ ˜4ñ r   c                 óÊ   € ^ RI Hp  V ! R4      '       g   R#  \        P                  ! . ROR^
RR7      pVP                  ^ 8H  #   \
        \        P                  3 d     R# i ; i)aÄ  Check if gh CLI is authenticated via token file or device flow.

Plain ``gh auth status`` (exit code only): gh 2.98+ dropped the ``authenticated`` JSON
field, so ``--json authenticated`` exits 1 even when logged in. Availability is resolved
through shutil.which (the same probe every other doctor tool check uses); an OS-level
launch failure (a Store/MSIX shim, a deleted binary) reads as "not authenticated" rather
than crashing the Skills Hub check.
)Ú_safe_whichÚghFT)r–   r™   rš   )r¨  Úauthr¢   )Úhermes_cli.doctor_toolsr§  r›   rœ   r¯   r�   ÚTimeoutExpired)r§  rš  s     r   Ú_gh_authenticatedr¬  .  s_   € õ 4á�t×ÒÙðÜ—’Ò 8ÈÐWYÐafÔgˆØ× Ñ  AÑ%Ð%øÜ”Z×.Ñ.Ð/ô Úðús   ˜*A ÁA"Á!A"c               ó$   € V ^8„  d   QhRRRRRR/# r¼   r   )r   s   "r   r   r   C  s&   € ÷ kñ k $ð k¨7ð k°tñ kr   c           
     óô  € ^ RI HpHp VR,          R,          p\        VP	                  4       RR4      '       dá   VR,          pVP	                  4       '       dk   \        RR4      ;_uu_ 4        ^ RIp\        VP                  VP                  R	R
7      4      P                  R/ 4      4      p\        RV R24       RRR4       VR,          pVP	                  4       '       d!   \        R VP                  4        4       4      M^ p	V	^ 8”  d   \        V	 R2R4       ^ RIHp
 V
! R4      '       g   V
! R4      '       d   \        RR4       R# \        \#        4       RRRV R234       R#   + '       g   i     L´; i)r„   rŽ   rÍ   z.hubzSkills Hub directory existsz	lock.jsonz	Lock filez(corrupted or unreadable)NrÁ   rÂ   Ú	installedzLock file OK (z hub-installed skill(s))Ú
quarantinec              3  óT   "  € T F  qP                  4       '       g   K  ^x € K   	  R# 5i)rë   N)rñ   )rA   Úds   & r   rC   Ú$_check_skills_hub.<locals>.<genexpr>N  s   é € ÐDÑ!5˜A¿¹¿—a’aÓ!5ùs   ‚(ž
(z skill(s) in quarantinez(pending review))Úget_env_valueÚGITHUB_TOKENÚGH_TOKENzGitHub token configuredz)(validity checked under API Connectivity)zNo GITHUB_TOKENu!   (60 req/hr rate limit â€” set in z/.env for better rates))z$Skills Hub directory not initializedz(run: hermes skills list))zGitHub authenticated via gh CLIu,   (full API access â€” no GITHUB_TOKEN needed))r    r   r�   r   r"   r   ÚjsonrÖ   ÚloadsrÏ   r#   r	   r²   rð   r
   Úhermes_cli.configr´  r¬  )r½   rª   r   r�   Úhub_dirÚ	lock_filer·  r1  r°  Úq_countr´  s   &&         r   Ú_check_skills_hubr½  B  sK  € ç3Ø˜HÕ$ vÕ-€GÜ�'—.‘.Ó"Ð$Að  DI÷  Jò  JØ˜kÕ)ˆ	Ø×Ñ×ÒÜ˜{Ð,G×HÕHÛÜ˜DŸJ™J y×':Ñ':ÀKÐ':Ó'PÓQ×UÑUÐVaÐceÓfÓg�Ü˜>¨%¨Ð0HÐIÔJ÷ Ið ˜|Õ+ˆ
ØHR×HYÑHY×H[ÒH[”#ÑD ×!3Ñ!3Ô!5ÓDÔDÐabˆØ�QŒ;Ü˜'˜Ð"9Ð:Ð<NÔOÝ/Ù�^×$Ò$©°j×(AÒ(AÜÐ*Ð,WÖXäÔ$Ó&Ð({Ø%Ð)JÈ4È&ÐPgÐ'hÐiö	k÷ I×Hús   Á-AE'Å'E7	r   Ú_MEMORY_PROVIDER_CHECKSc               ó    € V ^8„  d   QhRRRR/# )r   ró   r2   r   r‰   r   )r   s   "r   r   r   ^  s   € ÷ Xñ X 3ð X¨4ñ Xr   c                ó,  € ^ RI Hp V! V 4      pV'       d'   VP                  4       '       d   \        V  R24       R# V'       d   \	        V  R2R4       R# ^ RI Hp ^ RIHp V! V 4      f   V! V RR	7      MRp\	        V  R
2RT;'       g    R 24       R# )zSGeneric check for every memory provider (honcho, hindsight, mem0, openviking, ...).)Úload_memory_providerz provider activez configured but not availablezrun: hermes memory status)Úfind_provider_dir)Úcatalog_install_hintNr   )Úcategoryz plugin not foundzrun: zhermes memory setup)Úplugins.memoryrÁ  Úis_availabler	   r
   rÂ  Ú$hermes_cli.memory_provider_migrationrÃ  )ró   rÁ  Ú	_providerrÂ  rÃ  Úhints   &     r   Ú_memory_provider_genericrÊ  ^  sŠ   € å3Ù$ TÓ*€Iß�Y×+Ñ+×-Ò-Ü�D�6Ð)Ð*Ö+ß	Ü�d�VÐ8Ð9Ð;VÖWå4ÝMÙ@QÐRVÓ@WÒ@_Ñ# D°8Õ<ÐeiˆÜ�d�VÐ,Ð-°°t×7TÐ7TÐ?TÐ6UÐ/VÖWr   c               ó$   € V ^8„  d   QhRRRRRR/# r¼   r   )r   s   "r   r   r   n  s!   € ÷ 5ñ 5 tð 5°ð 5¸Dñ 5r   c                ó  € ^ RI Hp ^ RIHp \	        V4      P                  RR4      pV! V4      '       d   \        RR4       R# \        P                  VRRRV34      w  rVrx V'       d   V! VP                  4       R# \        V4       R#   \         dH   p	Tf   \        T R2\        T	4      4        Rp	?	R# \        . TOTNTP                  N5!    Rp	?	R# Rp	?	i\         d$   p	\        T R2\        T	4      4        Rp	?	R# Rp	?	ii ; i)	r„   r   )Úis_core_memory_providerÚproviderr5   zBuilt-in memory activeu2   (no external provider configured â€” this is fine)Nz check failed)r    r   Úagent.memory_providerrÍ  r(   r#   r	   r¾  r6  rÊ  ÚImportErrorr
   r2   r   r%   )
r½   rª   r   rÍ  ró   ÚcheckerÚmissing_rowÚmissing_issueÚlabelÚ_es
   &&        r   Ú_check_memory_providerrÖ  m  sä   € å-Ý=Ü  Ó-×1Ñ1°*¸bÓA€DÙ˜t×$Ò$ÜÐ)Ð+_Ô`ÙÜ1H×1LÑ1LÈTÐTXÐZ^Ð`dÐfjÐSkÓ1lÑ.€G˜-ð5ß$‰�—‘ÖÔ*BÀ4Ö*HøÜô CØÒÜ˜%˜ Ð.´°B³×8Ò8äÐB˜[ÐB¨-ÐB¸¿¹×BÒBûÜô 5Ü�e�W˜MÐ*¬C°«G×4Ò4ûð5ús6   Á"B Á>B ÂD	ÂCÂ8CÃD	Ã%D	Ã&DÄD	c               ó$   € V ^8„  d   QhRRRRRR/# r¼   r   )r   s   "r   r   r   ‚  s!   € ÷  %ñ  % ð  %¨ð  %°Tñ  %r   c                óÄ  € ^ RI Hp ^ RIHpHpHpHp ^ RIpV! 4        Uu. uF  qˆP                  '       d   K  VNK  	  p	pV	'       g   R# \        R4       \        \        V	4       R24       V! 4       p
V	 Fè  pVP                  R3VP                  VP                  ;'       g    RR,          3VP                  R	,          P                  4       '       * R
3VP                  R,          P                  4       '       * R3VP                   RJ R33 UUu. uF  w  r¼V'       g   K  VNK  	  ppp\        RVP"                   RV'       d   RP%                  V4      MR 24       Kê  	  V
P'                  4       '       Ed
   V
P)                  4        Fõ  pVP+                  4       '       g   K  \-        R4      ;_uu_ 4        VP/                  RVP1                  RR7      4      pV'       d•   V! VP3                  ^4      4      '       gx   V! VP4                  4      V8X  d   VP4                  MVP"                  pVP7                  V4      '       d   RV R2MRV 2p\9        RV RVP3                  ^4       R2RV R24       RRR4       K÷  	  ^ RIHp V! 4        F.  p\9        RRV R24       VP>                  PA                  V4       K0  	  R# u upi u uppi   + '       g   i     EKW  ; i) r„   )ÚPROFILE_ID_RE)Ú_wrapper_pathÚlist_profilesÚ_get_wrapper_dirÚprofile_existsNÚProfilesz profile(s) foundzgateway runningr5   :Né   Nr   u   âš  missing configz.envzno .envzno aliasz  z: rT   Ú
configuredzhermes -p (\S+)rÁ   rÂ   zhermes profile alias z	 --removezdelete zOrphan alias: u    â†’ profile 'z' no longer existsz(remove with: r6   )Úduplicate_credential_findingsz-Duplicate platform credential across profilesrl   )!rï   rÙ  Úhermes_cli.profilesrÚ  rÛ  rÜ  rÝ  ÚreÚ
is_defaultr   r	   rÖ   Úgateway_runningÚmodelÚpathr"   Ú
alias_pathró   rq   rñ   rð   r§   r   ÚsearchrÏ   ÚgroupÚstemÚmatchr
   Úhermes_cli.gateway_migraterá  r3  rp   )r½   rª   rÙ  rÚ  rÛ  rÜ  rÝ  Ú_reÚpÚnamed_profilesÚwrapper_dirÚcondr—   ÚpartsÚwrapperÚ_mÚaliasr~  rá  Úlines   &&                  r   Ú_check_profilesrø  �  su  € å.ßbÓbÛÙ!.¤ÓE¡˜A¿½—a�a¡€NÐEßÙÜˆZÔÜ”�NÓ#Ð$Ð$5Ð6Ô7Ù"Ó$€KÛˆà×ÑÐ 1Ð2°Q·W±W¸q¿w¹w¿}¸}È"ÈcÕ>RÐ4SØ—&‘&˜=Õ(×0Ñ0Ó2Ô2Ð4HÐIÐQR×QWÑQWÐZ`ÕQ`×PhÑPhÓPjÔLjÐluÐKvØ�\‰\˜TÐ! :Ð.ñ)0ô 9ñ )0™*˜$ô 48÷ �ñ )0ˆñ 9ô 	�2�a—f‘f�X˜R·E §	¡	¨%Ô 0¸|ÐLÐMÖNñ ð ×Ñ×ÓØ"×*Ñ*Ö,ˆGØ—?‘?×$Ò$ÙÜ˜r×"Õ"Ø—Z‘ZÐ 2°G×4EÑ4EÈ{Ð4EÓ4[Ó\�ß™n¨R¯X©X°a«[×9Ò9Ù,9¸'¿,¹,Ó,GÈ7Ô,R˜GŸLšLÐX_×XdÑXd�EØFS×FYÑFYÐZ_×F`ÒF`Ð1°%°¸	ÑBÐhoÐpwÐoxÐfy�CÜ °¨w°nÀRÇXÁXÈaÃ[ÀMÐQcÐdÐhvÐwzÐv{Ð{|Ðf}Ô~÷ #Ñ"ñ -õ IÙ-Ö/ˆÜÐBÀaÈÀvÈQÀKÔPØ	�‰×Ñ˜tÖ$ó 0ùò5 Fùó9÷ #×"Ñ"ús0    K¸KÄKÄ KÆ6AKÇ>AKÉ1KËKr@   i   @)Nr5   )z"Repaired state.db FTS write healthz>state.db FTS write-health repair did not recover automaticallyue   state.db FTS write corruption and auto-repair failed â€” restore from the backup copy beside state.dbur   state.db FTS write corruption â€” run 'hermes doctor --fix' (or 'hermes sessions repair') to rebuild the FTS index)z5Repaired state.db schema ({count} sessions recovered)z4state.db schema repair did not recover automaticallyua   state.db schema malformed and auto-repair failed â€” restore from the backup copy beside state.dbup   state.db schema malformed â€” run 'hermes doctor --fix' (or 'hermes sessions repair') to recover hidden sessions)=Ú__conditional_annotations__Ú__doc__Ú
__future__r   r  r›   Úpathlibr   Úhermes_cli.doctor_reportr   r   r   r   r   r	   r
   r   r   r   Úhermes_cli.sizefmtr   rG   rq  r   r(   rs   r0   r:   r€   r‡   rº   rá   Ú_UNPRUNED_CACHE_WARN_BYTESÚ	frozensetrô   rû   rÎ   r  r  r#  r5  r4  r=  rB  rH  rL  r[  rg  rt  rw  r‚  rˆ  r›  r¤  r¬  r½  r¾  Ú__annotations__rÊ  rÖ  rø  )rù  s   @r   Ú<module>r     s¿  øðôLõ #ã 	Û Ý ÷÷ ÷ õ <Ý 1÷ð 2Ð õ@õ

G÷4õnZõ
E
ñP ƒô,jó ð,jð` %Ð Ù 	¨:Ð6Ó7Ð ð =W÷ 3õ(Zõ*ð #*Ð õ+ð> 
ð Bð ð Cð	Ð ð ð õõ0õ
=õ>õTõ"$]õNñ( ƒô0ó ð0ñ ƒô0ó ð0ñ ƒôó ðõBñ4 ˆbÓô%ó ð%õñ( ƒôkó ðkð0 !#Ð ˜Ó "õXñ ƒô5ó ð5ñ& ˆbÓô %ó ò %r   