+
    jHàj%  ã                   ó–   € R t ^ RIt^ RIt]P                  ! ]4      tRtRR R lltRRRR/R R	 lltRR
RRRRR/R R lllt	R R lt
R# )zAGateway service setup orchestration; runtime startup is separate.NzuInstall the gateway service so Hermes starts automatically at login and keeps scheduled jobs and messaging available?c                óB   € V ^8„  d   QhR\         R\        R,          RR/# )é   ÚchoiceÚconfigNÚreturn)ÚstrÚdict)Úformats   "ÚE/home/ubuntu/.hermes/hermes-agent/hermes_cli/gateway_setup_service.pyÚ__annotate__r      s*   € ÷ 
Lñ 
L¤#ð 
L¬t°d­{ð 
LÀdñ 
Ló    c                 ó´   € ^ RI HpHp V R9  d   \        R4      hV! 4       pWP	                  R/ 4      R&   V! V4       Ve   WP	                  R/ 4      R&   R# R# )é    )Úload_configÚsave_configz1service_install_choice must be install or declineÚgatewayÚservice_install_choiceN>   ÚdeclineÚinstall)Úhermes_cli.configr   r   Ú
ValueErrorÚ
setdefault)r   r   r   r   Úcurrents   &&   r
   Úrecord_service_choicer      s`   € ß:àÐ+Ô+ÜÐLÓMÐMÙ‹m€GØBH×Ñ�y "Ó%Ð&>Ñ?Ù�ÔàÒØEK×Ñ˜) RÓ(Ð)AÓBñ r   r   Fr   c                óV   € V ^8„  d   QhR\         R\         R\        R,          R\         /# )r   Úinteractiver   r   Nr   )Úboolr   )r	   s   "r
   r   r      s.   € ÷ ñ ¬$ð ¼ð Ü"&¨¥+ðÜ9=ñr   c                 ó6  € ^ RI Hp ^ RIHp V'       d   R# V '       d%   \        P
                  P                  4       '       g   R# Ve   TMV! 4       P                  R/ 4      P                  R4      pVf"   V! \        R4      '       d   R# \        RV4       VR8H  # )	r   )r   )Úprompt_yes_noTFr   r   r   r   )
r   r   Úhermes_cli.gatewayr   ÚsysÚstdinÚisattyÚgetÚSERVICE_INSTALL_QUESTIONr   )r   r   r   r   r   r   s   $$$   r
   Úwants_service_installr%      sx   € å-Ý0çÙßœcŸi™i×.Ñ.×0Ò0ÙØÒ*‰f±³×BÑBÀ9ÈbÓQ×UÑUÐVnÓo€FØ‚~ÙÔ1°5×9Ò9ÙÜ˜i¨Ô0Ø�YÑÐr   r   c          
      ób   € V ^8„  d   QhR\         R\        R\        R\        R,          R\        /# )r   Úcontextr   r   r   Nr   )r   r   r   )r	   s   "r
   r   r   ,   s=   € ÷ Añ A¤Cð AÄ4ð AÜ$(ðAÜ:>À½+ðAÜQUñAr   c               ó’  € ^ RI Hp ^ RIHp V! 4       '       d   VP	                  R4       R# VP                  4       pV'       g@   VP                  4       '       g*   VP                  4       '       g   VP	                  R4       R#  VP                  4       '       d   R# VP                  4       '       d   R# VP                  4       '       Eg   V R8X  g   \        WVR7      '       g%   VP	                  R	4       VP	                  R
4       R# V'       d)   VP                  4       '       d   VP                  4        R# V'       d   VP                  RRR7       MKVP                  4       '       d   VP                  RR7       M"VP!                  4       P#                  RRRR7       VP                  4       '       g   VP%                  R4       R# \'        RV4       V'       d   VP)                  4        MEVP                  4       '       d   VP+                  4        MVP!                  4       P-                  4        VP/                  R4       R#   TP0                   dB   pTP%                  R4       TP3                  \5        T4      TP                  4        Rp?R# Rp?iTP6                   d1   pTP%                  RT 24       TP9                  R4        Rp?R# Rp?i\:         d    TP%                  R4        R# \<         dH   p\>        PA                  RRR7       TP%                  RT 24       TP	                  R4        Rp?R# Rp?ii ; i)zÞStart existing services; install only with explicit setup consent.

Import and ordinary noninteractive callers cannot install, even with a saved
install preference. False leaves foreground/unmanaged startup to the caller.
©r   )Úis_containerzbRun hermes gateway run as the container main process; use a Docker restart policy for persistence.Fz;No supported service manager found. Run: hermes gateway runTÚimport)r   r   r   z-No service installed. Run: hermes gateway runzmWithout a service, scheduled jobs and messaging stop at logout/reboot; jobs cannot run while the host is off.)ÚforceÚnon_interactive©r,   ©r,   Ú	start_nowÚstart_on_loginúGGateway service install did not complete. Retry: hermes gateway installr   z:Gateway service running (cron jobs + messaging platforms).z:Could not reach user systemd to start the gateway service:Nz+Gateway service needs root for this scope: Ústartzgateway service setup failed)Úexc_infozGateway service setup failed: z.You can retry manually: hermes gateway install)!Ú
hermes_clir   Úhermes_constantsr*   Ú
print_infoÚsupports_systemd_servicesÚis_macosÚ
is_windowsÚ_is_service_runningÚ _served_profile_needs_no_serviceÚ_is_service_installedr%   Úhas_conflicting_systemd_unitsÚ$print_systemd_scope_conflict_warningÚsystemd_installÚlaunchd_installÚ_gw_windowsr   Úprint_warningr   Úsystemd_startÚlaunchd_startr3   Úprint_successÚUserSystemdUnavailableErrorÚ_print_indentedr   ÚSystemScopeRequiresRootErrorÚ_print_system_scope_remediationÚ
SystemExitÚ	ExceptionÚloggerÚdebug)r'   r   r   r   Úgwr*   Úsupports_systemdÚexcs   &$$$    r
   Úensure_gateway_servicerR   ,   sž  € õ )Ý-á‡~‚~Ø
�‰ÐzÔ{ÙØ×3Ñ3Ó5Ðß §¡§¢°·±·²Ø
�‰ÐSÔTÙð/HØ×!Ñ!×#Ò#ÙØ×.Ñ.×0Ò0ÙØ×'Ñ'×)Ó)Ø˜(Ô"Ô*?Ø'À÷+ó +ð —‘ÐMÔNØ—‘ð  Nô  OÙß B×$DÑ$D×$FÒ$FØ×7Ñ7Ô9ÙßØ×"Ñ"¨ÀÐ"ÕEØ—‘—’Ø×"Ñ"¨Ð"Õ/à—‘Ó ×(Ñ(¨uÀÐUYÐ(ÔZà×+Ñ+×-Ò-Ø× Ñ Ð!jÔkÙÜ! )¨VÔ4ßØ×ÑÕØ�[‰[�]Š]Ø×ÑÕà�N‰NÓ×"Ñ"Ô$Ø
×ÑÐUÔVÙøØ×)Ñ)ô 4Ø
×ÑÐUÔVØ
×Ñœ3˜s›8 R§]¡]×3Ð3ñ ûð ×*Ñ*ô 4Ø
×ÑÐFÀsÀeÐLÔMØ
×*Ñ*¨7×3Ð3ñ ûô ô dØ
×ÑÐbÕcñ ô ô Hô 	�‰Ð3¸dˆÔCØ
×ÑÐ9¸#¸Ð?Ô@Ø
�‰ÐF×GÐGÙûðHús˜   ÂI ÂI Â5I Ã<I Ä
I ÄI Ä(I Ä:I Å)I Å,A
I Æ7I Ç
I Ç&I ÈA I ÉMÉ6JÊMÊ'MÊ(%KËMË MË5MË>MË?<MÍMc                ó(   € V ^8„  d   QhR\         RR/# )r   Úbackendr   N)r   )r	   s   "r
   r   r   p   s   € ÷ $Fñ $F¤Sð $F¨Tñ $Fr   c                ó  € ^ RI p^ RIHp ^ RIHp \
        P                  P                  4       '       g   R# VP                  RR4      p\        RR7      '       g¢   VP                  R4       V'       dv   V! VP                  4       RR	7      pVP                  R
8X  d   VP                  R4       R# TP                  RVP                   RVP                  ;'       g    R R24        R# VP                  R4       R#  RRrvV R8X  d   VP                  RRR7      w  rgM<V R8X  d   VP!                  RR7       M"VP#                  4       P%                  RVRR7       V'       d   VP'                  4       '       g   VP)                  R4       R# \+        R4       V'       d#   V R8w  d   VP-                  RRVR8H  R7       R# R# R#   TP.                  \0        3 d1   pTP3                  RT 24       TP                  R4        Rp?R# Rp?ii ; i) zGChoose persistence once; start-now without persistence stays unmanaged.Nr)   )Úensure_gateway_runtimez  Start the gateway now?T)r   zmWithout a service, messaging and scheduled jobs stop at logout/reboot; jobs cannot run while the host is off.g      @)ÚtimeoutÚreadyz0Gateway runtime ready; no service was installed.zGateway runtime: z (Úpendingz). Check: hermes gateway statuszDRun later: hermes gateway run. Install later: hermes gateway installÚsystemdF)r,   Úenable_on_startupÚlaunchdr.   r/   r2   r   Úwindowsr3   zStart failedÚsystem)Úfailed_labelr^   zInstall failed: z,You can try manually: hermes gateway install)Ú
subprocessr5   r   Úhermes_cli.gateway_runtimerV   r    r!   r"   r   r%   r7   Úget_hermes_homeÚstaterF   Úreason_codeÚ install_linux_gateway_from_setuprA   rB   r   r=   rC   r   Ú_setup_service_actionÚCalledProcessErrorrK   Úprint_error)	rT   r`   rO   rV   r0   ÚresultÚscopeÚdid_installrQ   s	   &        r
   Ú_wizard_install_servicerl   p   sÝ  € ãÝ(ÝAä�9‰9×Ñ×ÒÙØ× Ñ Ð!;¸TÓB€IÜ ¨T×2Ó2Ø
�‰ð  Fô  	GßÙ+¨B×,>Ñ,>Ó,@È#ÔNˆFØ�|‰|˜wÔ&Ø× Ñ Ð!SÔTñ
 	ð —‘Ð 1°&·,±,°¸rÀ&×BTÑBT×BaÐBaÐXaÐAbð  cBð  Cõ  Dñ 	ð �M‰MÐ`ÔaÙðFØ! 4ˆ{Ø�iÔØ!#×!DÑ!DÈ5ÐdhÐ!DÓ!iÑˆE�;Ø˜	Ô!Ø×Ñ UÐÕ+à�N‰NÓ×$Ñ$¨5¸IÐVZÐ$Ô[ß "×":Ñ":×"<Ò"<Ø×ÑÐfÔgÙÜ˜iÔ(ß˜ IÔ-Ø×$Ñ$ W¸>ÐRWÐ[cÑRcÐ$Ödñ .‰9øà×)Ñ)¬:Ð6ô FØ
�‰Ð)¨#¨Ð/Ô0Ø
�‰ÐD×EÒEûðFús+   Ã=A#G Å!G Å7G Æ
1G ÇHÇ%HÈH)N)Úsetup)Ú__doc__Úloggingr    Ú	getLoggerÚ__name__rM   r$   r   r%   rR   rl   © r   r
   Ú<module>rs      so   ðÙ Gã Û 
à	×	Ò	˜8Ó	$€ð8ð ÷
LðÀð Ø04÷ñ"AÈ%ð AØ+0ðAØHL÷Að A÷H$Fr   