+
    jHàj=8  ã                   óè   a € R t0 t R t^ RIt^ RIt^ RIHt ^ RIHt ]P                  ! R4      t	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R
RR
RR/R R llt/ t] ^ k RR ltR# )zßPost-``hermes update`` config-schema migration for the active profile and every sibling.
Names are re-imported by ``update_cmd`` (``hermes_cli.update_cmd.<name>`` resolves/monkeypatches);
origin helpers are imported lazily.N)ÚPath)Ú_best_effortzhermes_cli.update_cmdc                ó   € V ^8„  d   QhRR/# ©é   ÚreturnN© )Úformats   "ÚA/home/ubuntu/.hermes/hermes-agent/hermes_cli/update_cmd_config.pyÚ__annotate__r      s   € ÷ 'ñ ' ñ 'ó    c                 ó$   € ^ RI Hp  V ! RR7       R# )zJHistorical updater hook; migration now belongs to fresh completion Python.©Ústop_for_relaunchT©Ú
incompleteN©Úhermes_cli._old_updaterr   r   s    r
   Ú_reload_config_modulesr      s   € å9Ù ×&r   c                ó$   € V ^8„  d   QhR\         /# ©r   r   )Útuple)r	   s   "r
   r   r      s   € ÷ 'ñ '¤ñ 'r   c                  ó$   € ^ RI Hp  V ! RR7       R# ©é    r   Tr   Nr   r   s    r
   Ú_run_config_check_freshr      ó   € Ý9Ù ×&r   ÚinteractiveFÚquietc                ó<   € V ^8„  d   QhR\         R\         R\        /# )r   r   r   r   )ÚboolÚdict)r	   s   "r
   r   r      s"   € ÷ 'ñ '¬dð 'Ä4ð 'ÔTXñ 'r   c                 ó$   € ^ RI Hp V! RR7       R# r   r   )r   r   r   s   $$ r
   Ú_run_migrate_config_freshr#      r   r   c                óf   € V ^8„  d   QhR\         \        \        \        \        3,          ,          /# r   )Úlistr   ÚstrÚint)r	   s   "r
   r   r      s#   € ÷ %ñ %¬$¬u´S¼#¼s°]Õ/CÕ*Dñ %r   c            	     óF  € ^ RI Hp Hp . p\        R4      ;_uu_ 4        ^ RIHpHpHp ^ RIH	p \        V! 4       4      pV! V4       F  w  r‰V	R,          P                  4       '       g   K$  V! V	4      p
 V ! RR7      w  r¼W¼8¼  d    V! V
4       KI  V! RRR	7       V ! RR7      w  rÞWÛ8”  d   VP                  W‹V34       T! T
4       K�  	  RRR4       V#   \         d!   p\        P                  R
Y�4        Rp?L<Rp?ii ; i  T! T
4       i ; i  + '       g   i     T# ; i)u;  Migrate every SIBLING profile's config.yaml (the shared checkout serves all profiles). Per
sibling (active skipped): scope via the context-local HERMES_HOME override (never ``os.environ``)
and run the NON-INTERACTIVE quiet migration â€” prompt-requiring settings wait for that profile's
own session. Returns ``[(name, from_version, to_version), ...]``; never raises.

91277 Phase 2 (fleet-wide config migration; #20438/#54926/#79048): the shared checkout serves every
profile, but ``hermes update`` historically migrated only the active profile's config â€” siblings drifted
versions until their gateway hit a config the new code couldn't read.

Enumeration matches pre-update snapshots (#66140): default lives at
``_get_default_hermes_home()``, not under ``profiles/``, so a named-profile
``hermes update`` still migrates it.
©Úcheck_config_versionÚmigrate_configz&Sibling profile enumeration failed: %s)Úget_process_hermes_homeÚreset_hermes_home_overrideÚset_hermes_home_override)Ú_sibling_profile_homeszconfig.yamlT©Úraise_on_parse_errorF©r   r   z*Config migration for profile %s failed: %sN)Úhermes_cli.configr*   r+   r   Úhermes_constantsr,   r-   r.   Úhermes_cli.backupr/   r   Úis_fileÚappendÚ	ExceptionÚloggerÚdebug)r*   r+   Úmigratedr,   r-   r.   r/   Úactive_homeÚnameÚprofile_homeÚtokenÚcurrent_verÚ
latest_verÚ	after_verÚ_Úexcs                   r
   Ú _migrate_sibling_profile_configsrE      s  € ÷ GØ+-€HÜ	Ð>×	?Õ	?÷	[ñ 	[å<ÜÑ2Ó4Ó5ˆÙ"8¸Ö"EÑˆDØ  =Õ0×9Ñ9×;Ò;ÙÙ,¨\Ó:ˆEð2Ù*>ÐTXÔ*YÑ'�ØÔ,Øñ +¨5Ö1ñ ¨5¸Õ=Ù3ÈÔN‘�	ØÔ*Ø—O‘O T¸	Ð$BÔCñ +¨5Ö1ñ #F÷ 
@ð* €Oøô	 ô VÜ—‘ÐIÈ4×UÑUûðVûñ +¨5Õ1ú÷) 
@Ö	?ð* €OúsN   žADÁ4CÂ
DÂ.CÂ>DÃC?	ÃC:	Ã5DÃ:C?	Ã?DÄ
D	ÄDÄD 	c                ó   € V ^8„  d   QhRR/# r   r   )r	   s   "r
   r   r   G   s   € ÷ <añ <a¸Tñ <ar   c                ó  € R pR pR p\        R4      ;_uu_ 4        ^ RIHp V! V 4      pV'       d   \        4        \        RV! V4       24       RRR4       \        R4      ;_uu_ 4        ^ R	IHp V! V 4      pV'       d   \        4        \        RV! V4       24       RRR4       \        R
4      ;_uu_ 4        ^ RIHp V! V 4      p	V	'       d   \        4        \        RV! V	4       24       RRR4       \        R4      ;_uu_ 4        ^ RIHp
 V
! \        4       F+  p\        4        \        RVR,           RV! V4       24       K-  	  RRR4       \        R4      ;_uu_ 4        ^ RIH	p V! \        4       F+  p\        4        \        RVR,           RV! V4       24       K-  	  RRR4       \        R4      ;_uu_ 4        ^ RIH
p V! \        4       F+  p\        4        \        RVR,           RV! V4       24       K-  	  RRR4       R#   + '       g   i     ELÊ; i  + '       g   i     ELŽ; i  + '       g   i     ELR; i  + '       g   i     EL	; i  + '       g   i     L¿; i  + '       g   i     R# ; i)uY  Post-migration safety nets (never break an otherwise-good update): restore cron jobs
emptied by migrations/the desktop scheduler and protected model settings (model.provider /
model.default / moa:) rewritten by Desktop repair cycles â€” for the active profile (from
*pre_update_snapshot_id*) and every sibling profile (against ITS OWN snapshot).c                 ó0   € R V R,           RV R,           R2# )u9   cron/jobs.json lost jobs during this update â€” restored Ú	job_countz! job(s) from pre-update snapshot Úsnapshot_idÚ.r   ©Úrs   &r
   Ú
_cron_lineÚ1_restore_snapshot_safety_nets.<locals>._cron_lineL   s+   € àGÈÈ+ÍÐGWð X(Ø()¨-Õ(8Ð'9¸ð<ð	=r   c                 ó0   € R V R,           RV R,           R2# )u`   cron/jobs.json had agent-job prompt(s) replaced by the job name during this update â€” restored Úpromptsz$ prompt(s) from pre-update snapshot rJ   rK   r   rL   s   &r
   Ú_prompt_lineÚ3_restore_snapshot_safety_nets.<locals>._prompt_lineQ   s*   € ð#Ø#$ Y¥< .Ð0TØ�ÕÐ  ð#ð	$r   c                 óN   € R RP                  V R,          4       RV R,           R2# )uO   config.yaml user model settings were rewritten during this update â€” restored z, Úkeysz from pre-update snapshot rJ   rK   )ÚjoinrL   s   &r
   Ú	_cfg_lineÚ0_restore_snapshot_safety_nets.<locals>._cfg_lineW   s4   € à]Ø�y‰y˜˜6�Ó#Ð$Ð$>¸qÀÕ?OÐ>PÐPQðSð	Tr   z'Cron jobs auto-restore check failed: %s)Úrestore_cron_jobs_if_emptiedõ
     âš ï¸�  Nz/Cron prompt-field auto-restore check failed: %s)Ú&restore_cron_prompt_fields_if_degradedz3Config model-settings auto-restore check failed: %s)Ú*restore_config_model_settings_if_rewrittenz*Sibling cron auto-restore check failed: %s)Úrestore_cron_jobs_all_profilesu     âš ï¸�  Profile 'Úprofilez': z7Sibling cron prompt-field auto-restore check failed: %s)Ú'restore_cron_prompt_fields_all_profilesz,Sibling config auto-restore check failed: %s)Ú*restore_config_model_settings_all_profiles)r   r5   rY   ÚprintÚhermes_cli.backup_cron_promptsr[   r\   r]   Ú_LAST_SIBLING_SNAPSHOTSr_   r`   )Úpre_update_snapshot_idrN   rR   rW   rY   Úcron_restorer[   Úprompt_restorer\   Úcfg_restorer]   Ú	_restoredr_   Ú_prompt_restoredr`   Ú_cfg_restoreds   &               r
   Ú_restore_snapshot_safety_netsrk   G   s  € ò
=ò
$òTô
 
Ð?×	@Õ	@õ
 	CÙ3Ð4JÓKˆßÜŒGÜ�J™z¨,Ó7Ð8Ð9Ô:÷ 
Aô 
ÐG×	HÕ	Hõ 	ZÙ?Ð@VÓWˆßÜŒGÜ�J™|¨NÓ;Ð<Ð=Ô>÷ 
Iô 
ÐK×	LÕ	LÝPÙ@ÐAWÓXˆßÜŒGÜ�J™y¨Ó5Ð6Ð7Ô8÷ 
Mô 
ÐB×	CÕ	CÝDÙ7Ô8OÖPˆIÜŒGÜÐ'¨	°)Õ(<Ð'=¸SÁÈIÓAVÐ@WÐXÖYñ Q÷ 
Dô
 
ÐO×	PÕ	PÝZÙ GÔH_Ö `ÐÜŒGÜÐ'Ð(8¸Õ(CÐ'DÀCÉÐUeÓHfÐGgÐhÖiñ !a÷ 
Qô
 
ÐD×	EÕ	EÝPÙGÔH_Ö`ˆMÜŒGÜÐ'¨°iÕ(@Ð'AÀÁYÈ}ÓE]ÐD^Ð_Ö`ñ a÷ 
FÑ	E÷G 
A×	@Ð	@ú÷ 
I×	HÐ	Hú÷ 
M×	LÐ	Lú÷ 
D×	CÐ	Cú÷
 
Q×	Pú÷
 
F×	EÐ	EúsJ   �5HÁ-5H'Â=5H;ÄAIÅ*AI#ÇAI6ÈH$	È'H8	È;I	ÉI 	É#I3	É6J	c                ó<   € V ^8„  d   QhR\         R\         R\        /# )r   Ú
assume_yesÚgateway_moder   ©r    r&   )r	   s   "r
   r   r   †   s!   € ÷ ñ ¬dð Ä$ð Ì3ñ r   c                óà  € ^ RI Hp V '       d   \        R4       R# V'       d&   V! RR4      P                  4       P	                  4       # \
        P                  P                  4       '       d%   \
        P                  P                  4       '       g   \        R4       R#  \        R4      P                  4       P	                  4       #   \         d     R# \         d    \        R	4        R# i ; i)
z±The yes/no answer for "configure new options now?": "y" under --yes, the messenger's reply in
gateway mode, "auto" (safe migrations only) when non-interactive, else ``input()``.)Ú_gateway_promptuG     â„¹ --yes: auto-applying config migration (skipping API-key prompts).Úyz2Would you like to configure new options now? [Y/n]ÚnuB     â„¹ Non-interactive session â€” applying safe config migrations.Úautoz-Would you like to configure them now? [Y/n]: ui     âš  Could not read input (encoding issue). Skipping. Run 'hermes config migrate' manually to configure.)Úhermes_cli.update_cmdrq   ra   ÚstripÚlowerÚsysÚstdinÚisattyÚstdoutÚinputÚEOFErrorÚUnicodeDecodeError)rm   rn   rq   s   $$ r
   Ú_ask_configure_new_optionsr   †   s¼   € õ 6ßÜÐWÔXÙßÙÐSÐUXÓY×_Ñ_Óa×gÑgÓiÐiÜ�I‰I×Ñ×Ò¤3§:¡:×#4Ñ#4×#6Ò#6ÜÐRÔSÙð	ÜÐDÓE×KÑKÓM×SÑSÓUÐUøÜô ÚÜô äðAô	Bò ðús   Â&C ÃC-ÃC-ÃC-Ã,C-rm   rn   rd   c                óN   € V ^8„  d   QhR\         R\         R\        R,          RR/# )r   rm   rn   rd   Nr   ro   )r	   s   "r
   r   r   ž   s8   € ÷ ]ñ ]Üð]Ü/3ð]ÜUXÐ[_ÕU_ð]à	ñ]r   c                ó”  € ^ RI Hp ^ RIHpHp \        4        \        R4       ^ RIHpHp  ^ RIHpHp V! RR7      pV! 4       p	V! RR7      w  r«Rp\        T;'       g    T	4      pT'       * ;'       d    Y«8  pT;'       g    Y«8  pT'       d•   \        4        \        RT
 RT R24        T! RRR7      p\        R4       TP                  R4      ;'       g    .  F  p\        RT 24       K  	  TP                  R4      ;'       g    .  F  p\        RT 24       K  	  EM,T'       Ed   \        4        T'       d&   \        R\        T4       R24       \!        TRR4       T	'       d&   \        R\        T	4       R24       \!        T	RR 4       \        4        \#        YR!7      pTR,9   d‚   \        4        T;'       g    T ;'       g    TR"8H  pT! T'       * RR7      pTR#,          '       g   TR,          '       d   \        4        \        R$4       T'       d   T'       d   \        R%4       M!\        4        \        R&4       M\        R'4       \%        R(4      ;_uu_ 4        T! 4        F  w  ppp\        R)T R*T RT R+24       K  	  RRR4       \'        T4       Te   ThR#   \         d8   p\        P                  RT4       \        R	4       \        R
4        Rp?R# Rp?ii ; i  \         d?   p\        RT 24       \        R4       \        RT
 RT RT 24      pTTn         Rp?LßRp?ii ; i  + '       g   i     L´; i)-zæCheck/apply config migrations. Runs on EVERY completion path
(post-pull, venv-repair, Node-deps repair on ``commit_count == 0``) so an interrupted update
that already pulled code doesn't strand an old config version.

See #91360.
)rE   r)   u-   â†’ Checking configuration for new options...)Úget_missing_env_varsÚget_missing_config_fieldsT)Úrequired_onlyr0   z%Config check during update failed: %su)     âš ï¸�  Could not check config version.z3     Run 'hermes config migrate' to check manually.Nu     â„¹ Updating config format (vu    â†’ vu   )â€¦Fr2   u:     âœ“ Config format updated (no new settings to configure)Úconfig_addedu     â„¹ ÚwarningsrZ   u'     âš ï¸�  Config format update failed: z*     Run 'hermes config migrate' to retry.zconfig format vz was not written: z+ new required setting(s) need configurationzNew settingsr=   u
     â„¹ï¸�  z new config option(s) availablezNew optionsÚkey)rm   rn   rt   Ú	env_addedu   âœ“ Configuration updated!u:     â„¹ API keys require manual entry: hermes config migratez8Skipped. Run 'hermes config migrate' later to configure.u!     âœ“ Configuration is up to datez#Sibling config migration failed: %su     âœ“ Profile 'z': config format updated (vÚ)>   Ú rr   Úyesrt   )ru   rE   r3   r*   r+   ra   r‚   rƒ   r8   r9   r:   r    ÚgetÚRuntimeErrorÚ	__cause__ÚlenÚ_print_itemsr   r   rk   )rm   rn   rd   rE   r*   r+   r‚   rƒ   Úmissing_envÚmissing_configr@   rA   rD   Ú
owed_errorÚhas_new_optionsÚversion_bump_onlyÚneeds_migrationÚ_mig_resultsÚ_noteÚ_warnÚ_mig_errÚresponseÚ
unattendedÚresultsÚ_nameÚ	_from_verÚ_to_vers   $$$                        r
   Ú!_check_and_apply_config_migrationr¡   ž   s  € õ GßFÜ	„GÜ	Ð
9Ô:ßQð
ßUá*¸Ô>ˆÙ2Ó4ˆÙ"6ÈDÔ"QÑˆð €JÜ˜;×8Ð8¨.Ó9€OØ+Ô+×HÐH°Ñ0HÐØ%×AÐA¨Ñ)A€Oçô 	ŒÜÐ/°¨}¸FÀ:À,ÈdÐSÔTð	,Ù)°eÀ4ÔHˆLÜÐNÔOð
 &×)Ñ)¨.Ó9×?Ð?¸RÒ?�Ü˜˜u˜gÐ&Ö'ñ @à%×)Ñ)¨*Ó5×;Ð;¸Ò;�Ü˜
 5 'Ð*Ö+ó <÷ 
ˆÜŒçÜ�Jœs ;Ó/Ð0Ð0[Ð\Ô]Ü˜ n°fÔ=ßÜ�Jœs >Ó2Ð3Ð3RÐSÔTÜ˜¨¸Ô>äŒÜ-¸Ô_ˆØÐ/Ô/ÜŒGð &×IÐI¨×IÐI°xÀ6Ñ7IˆJÙ$°Z´ÀuÔMˆGØ�{×#Ô# w¨~×'>Ô'>Ü”ÜÐ2Ô3ßŸkÜÐRÔSøäŒGÜÐLÕMäÐ1Ô2ô 
Ð;×	<Õ	<Ù)IÖ)KÑ%ˆE�9˜gÜ�O E 7Ð*EÀiÀ[ÐPVÐW^ÐV_Ð_`ÐaÖbñ *L÷ 
=ô "Ð"8Ô9ØÒØÐñ øôO ô Ü�‰Ð<¸cÔBÜÐ9Ô:ÜÐCÔDÝûð	ûô6 ô 	,ÜÐ;¸H¸:ÐFÔGÜÐ>Ô?ô &¨¸°}ÀFÈ:È,ÐVhÐiqÐhrÐ&sÓtˆJØ#+ˆJ× Ñ ûð	,ú÷N 
=×	<úsB   ­#J& Â-AK+ Ä
K+ É#(L7Ê&K(Ê1,K#Ë#K(Ë+L4Ë64L/Ì/L4Ì7M	c                 ó2  € V '       g   R # \        RV R24       V R,          pV F«  p\        V\        4      '       di   VP                  V4      ;'       g&    T;'       d    VP                  V4      ;'       g    RpVP                  R4      ;'       g    RP	                  4       pM\        V4      Rrv\        V'       d	   RV RV 2MRV 24       K­  	  \        V 4      \        V4      8”  d+   \        R	\        V 4      \        V4      ,
           R
24       R # R # )Nz  Ú::Né   NÚ?ÚdescriptionrŠ   u
         â€¢ u    â€” u         â€¦ and z more)ra   Ú
isinstancer!   rŒ   rv   r&   r�   )ÚitemsÚlabelr‡   Úfallback_keyÚshownÚitr=   Údescs   &&&&    r
   r�   r�     sæ   € ßÙÜ	ˆBˆuˆg�Qˆ-ÔØ�"�I€EÛˆä�bœ$×ÒØ—6‘6˜#“;×PÐP <×#HÐ#H°B·F±F¸<Ó4H×PÐPÈSˆDØ—F‘F˜=Ó)×/Ð/¨R×6Ñ6Ó8‰Dä˜R› "�$Ü·�
˜4˜&  d VÑ,¸JÀtÀfÐ:MÖNñ ô ˆ5ƒz”C˜“JÔÜ�œs 5›z¬C°«JÕ6Ð7°uÐ=Ö>ñ r   c                ó@   € V ^8„  d   Qh/ ^ \         9   d
   \        ;R&   # )r   rc   )Ú__conditional_annotations__r!   )r	   s   "r
   r   r      s    € ÷ 'ñ '÷~ #Ò "œÑ "ò'r   )N)r¯   Ú__doc__Úloggingrx   Úpathlibr   Úhermes_cli.update_cmd_commonr   Ú	getLoggerr9   r   r   r#   rE   rk   r   r¡   rc   r�   r   )r¯   s   @r
   Ú<module>rµ      s�   øðö'ó Û 
Ý å 5ð 
×	Ò	Ð2Ó	3€õ'õ'ð
'°Uð 'È%÷ 'õ
%õP<aõ~ð0]Øð]Ø6;ð]Øbf÷]ðD !#Ð Ó "ö?r   