+
    jHàj  ã                  óf   € R t ^ RIHt ^ RIHtHt ^ RIHt R R ltRR/R R	 llt	RR/R
 R llt
R# )aR  The config schema-version stamp: raw reads of ``_config_version`` from config.yaml.

Split out of :mod:`hermes_cli.config` (code-health size ratchet); ``hermes_cli.config``
late-imports these and re-exports them, and :mod:`scripts.docker_config_migrate` reads the
raw stamp directly. ``_coerce_config_version`` stays module-private here.
)Úannotations)ÚOptionalÚTuple)ÚDEFAULT_CONFIGc               ó   € V ^8„  d   QhRR/# )é   ÚreturnÚint© )Úformats   "ÚD/home/ubuntu/.hermes/hermes-agent/hermes_cli/config_version_stamp.pyÚ__annotate__r      s   € ÷ ñ  Sñ ó    c                ó’   € \        V \        4      '       d   ^ #  \        V 4      p\        T^ 4      #   \        \        3 d     ^ # i ; i)zHReturn a safe integer config version, treating invalid values as legacy.)Ú
isinstanceÚboolr	   Ú	TypeErrorÚ
ValueErrorÚmax)ÚvalueÚversions   & r   Ú_coerce_config_versionr      sG   € ä�%œ×ÒÙðÜ�e“*ˆô ˆw˜‹?Ðøô ”zÐ"ô Úðús   š1 ±AÁAÚraise_on_parse_errorFc               ó    € V ^8„  d   QhRRRR/# )r   r   r   r   ztuple[Optional[int], int]r
   )r   s   "r   r   r      s   € ÷ %Iñ %I°tð %IÐHañ %Ir   c                ót  € ^ RI HpHpHpHp \        \        P                  ! R^4      4      ;'       g    ^pV! 4       pVP                  4       '       g   WU3#  \        VRR7      ;_uu_ 4       pV! V4      pRRR4       Xf   / p\        T\        4      '       g,   T '       d"   T! RT R	\        T4      P                   24      h/ pRT9  d   RT3# \        TP                  R4      4      T3#   + '       g   i     L~; i  \         d.   p	T! Yi4       T '       d   T! RT RT	 R24      T	hYU3u Rp	?	# Rp	?	ii ; i)
u«  Single raw read behind ``check_config_version()``: ``(stamp, latest_version)`` where
*stamp* is ``None`` when config.yaml parsed but carries no ``_config_version`` key (a
never-stamped current-schema file, not an ancient install â€” ``migrate_config()`` gives it only
the legacy-key steps). A missing file, or malformed YAML under a tolerant caller, reads as
``latest`` exactly as ``check_config_version()`` always reported it.)ÚInvalidUserConfigErrorÚ_warn_config_parse_failureÚfast_safe_loadÚget_config_pathÚ_config_versionz	utf-8-sig)ÚencodingNzCannot inspect z!: config.yaml is not valid YAML (Ú)z5: config.yaml top-level value must be a mapping, got )Úhermes_cli.configr   r   r   r   r   r   ÚgetÚexistsÚopenÚ	Exceptionr   ÚdictÚtypeÚ__name__)
r   r   r   r   r   ÚlatestÚconfig_pathÚfÚconfigÚes
   $         r   Úread_config_version_stampr/      s?  € ÷ vÓuä#¤N×$6Ò$6Ð7HÈ!Ó$LÓM×RÐRÐQR€FÙ!Ó#€KØ×Ñ×ÒØˆ~Ðð	Ü�+¨×4Õ4¸Ù# AÓ&ˆF÷ 5ð ‚~ØˆÜ�fœd×#Ò#÷  Ù(Ø! + ð /"Ü"& v£,×"7Ñ"7Ð!8ð:óð ð ˆØ Ô&Ø�Vˆ|ÐÜ! &§*¡*Ð->Ó"?Ó@À&ÐHÐH÷/ 5×4ûäô Ù" ;Ô2ßÙ(Ø! + Ð.OÐPQÈsÐRSÐTóàðð ˆ~Õûðús<   ÁC? Á-	C,Á6C? Ã,C<	Ã7C? Ã<C? Ã?D7Ä
"D2Ä,D7Ä2D7c               ó    € V ^8„  d   QhRRRR/# )r   r   r   r   ztuple[int, int]r
   )r   s   "r   r   r   B   s   € ÷ 	3ñ 	3°$ð 	3À?ñ 	3r   c                ó6   € \        V R7      w  rVf   ^ V3# TV3# )ac  Return ``(current_version, latest_version)`` from the raw on-disk config.
Reads the raw file rather than ``load_config()``: the deep-merge would make a file lacking
``_config_version`` inherit the latest version, hiding that the schema was never migrated.
Invalid YAML gets a parse warning, not an automatic schema rewrite. Tolerant runtime status
callers keep the historical latest/latest fallback for malformed YAML; mutation and explicit
validation paths set ``raise_on_parse_error`` so a parse failure or a non-mapping root cannot
be mistaken for an up-to-date config. A file with no version key reads as 0.)r   )r/   )r   Ústampr*   s   $  r   Úcheck_config_versionr3   B   s*   € ô .ÐCWÔX�M€EØ’ˆA¨FÐ2Ð2 E¨FÐ2Ð2r   N)Ú__doc__Ú
__future__r   Útypingr   r   Úhermes_cli.config_defaultsr   r   r/   r3   r
   r   r   Ú<module>r8      s:   ðñõ #ç "å 5õð%I¸e÷ %IðP	3¸÷ 	3ñ 	3r   