+
    „WÝj«  ã                  ó  a € 0 t $ R t^ RIHt ^ RIt^ RIt^ RIt^ RIt^ RIH	t	 ^ RI
HtHt Rt ! R R]4      t]! RR	RR4      ]! R
RR 4      ]! RRR!4      ]! RRR"4      3tR]R&   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# )#a+  First-time ``hermes setup``'s "Coming from another agent?" step (it replaces core's old OpenClaw
migration offer).

Detection is a few ``is_dir`` checks and needs nothing installed. Importing lives in the
``agent-importers`` catalog plugin (``hermes import-agent <source>``): only after the user says yes
does this step install it through the normal catalog install and run its import in a child process,
which owns the preview, the confirmation and what gets imported. Setup helpers are imported lazily
from hermes_cli.setup so test patches there apply.
)ÚannotationsN)ÚPath)Ú
NamedTupleÚOptionalzagent-importersc                  óD   € ] tR t^t$ R]R&   R]R&   R]R&   RtR]R&   RtR# )	ÚImportSourceÚstrÚnameÚlabelztuple[str, ...]ÚdirsÚ
extra_args© N)Ú__name__Ú
__module__Ú__qualname__Ú__firstlineno__Ú__annotations__r   Ú__static_attributes__r   ó    ÚQC:\Users\johnn\AppData\Local\hermes\hermes-agent\hermes_cli\setup_agent_import.pyr   r      s   ‡ Ø
ƒIØƒJØ
ÓØ"$€J�×$r   r   ÚopenclawÚOpenClawzclaude-codezClaude CodeÚcodexz	Codex CLIÚcursorÚCursorztuple[ImportSource, ...]ÚIMPORT_SOURCESc               ó   € V ^8„  d   QhRR/# )é   Úreturnúlist[tuple[ImportSource, Path]]r   )Úformats   "r   Ú__annotate__r!   )   s   € ÷ ñ Ð>ñ r   c                 óœ   € . p \          F?  p\        R R VP                   4        4       R4      pVf   K-  V P                  W34       KA  	  V # )zCThe sources with a setup on this computer, each with the dir found.c              3  óT   "  € T F  qP                  4       '       g   K  Vx € K   	  R # 5i©N)Úis_dir©Ú.0Úps   & r   Ú	<genexpr>Ú(detect_import_sources.<locals>.<genexpr>-   s   é € ÐUÑ F˜1Ï(É(Ï*—Q’QÓ Fùs   ‚(ž
(c              3  óZ   "  € T F!  p\         P                  ! 4       V,          x € K#  	  R # 5ir$   )r   Úhome)r'   Úds   & r   r)   r*   -   s   é € Ð F¹+°Q¤§¢£¨q§¢»+ùs   ‚)+N)r   Únextr   Úappend)ÚfoundÚsourcer,   s      r   Údetect_import_sourcesr2   )   sI   € à€Eß ˆÜÑUÑ F¸&¿+º+Ô FÓUÐW[Ó\ˆØÔØ�L‰L˜&˜Ö(ñ !ð €Lr   c               ó    € V ^8„  d   QhRRRR/# )r   Úhermes_homer   r   r   r   )r    s   "r   r!   r!   3   s   € ÷ Mñ M Dð M¨Sñ Mr   c                ól  a a
€ ^ RI HpHpHpHpHp V! 4       '       d   . M	\        4       pV'       g   R# \        \        P                  ! 4       4      o
V! RRR7       RRP                  V
3R lV 4       4      ,           R	,           R
R3pV! V!   \        V4      ^8:  d   RP                  R V 4       4      MRpV! RV R2RRP                  R V 4       4      R7      '       g   V! R\         R24       R# \        V4      p	V	'       d   \        S 4      '       g   R# RP                  V 3R lV	 4       4      # )aj  When another agent's setup is on this computer, offer to import it: pick which (when several),
install the plugin if it is missing and run its import for each pick. Returns the labels whose
import changed this home's config.yaml or .env (``""`` when none did). Asks nothing, and so never
installs anything, when nothing is found or no one can answer the prompts.)Ú_infoÚis_noninteractiveÚprint_headerÚ
print_infoÚprompt_yes_noÚ zComing from another agent?T©ÚgapzFound on this computer: z, c              3  ó€   <"  € T F3  w  rVP                    R \        V4      P                  SR^4       R2x € K5  	  R# 5i)z (Ú~Ú)N)r
   r   Úreplace)r'   Úsr(   Ú	user_homes   &  €r   r)   Ú%offer_agent_import.<locals>.<genexpr>>   s:   øé € ð 6NÙGL¹t¸qˆ1�7‰7ˆ)�2”c˜!“f—n‘n Y°°QÓ7Ð8¸Õ:Ãuùs   ƒ;>Ú.zEHermes can bring over its settings, memories, skills and MCP servers.z9You'll see a preview and confirm before anything changes.z or c              3  ó>   "  € T F  w  rVP                   x € K  	  R # 5ir$   )r
   )r'   rB   Ú_s   &  r   r)   rD   C   s   é € Ð2©E¡D A˜Ÿž«Eùs   ‚zany of themzImport your setup from Ú?Ú
c              3  óh   "  € T F(  p\         P                  ! V^L4       F
  pRV 2x € K  	  K*  	  R# 5i)éL   z  N)ÚtextwrapÚwrap)r'   ÚlineÚws   &  r   r)   rD   F   s0   é € Ð.mÁG¸DÔU]×UbÒUbÐcgÐikÖUlÐPQ°°A°3­xÑUl©xÃGùs   ‚02)ÚdefaultÚdescriptionz3Skipped. Import later with: hermes plugins install z, then hermes import-agentc              3  ód   <"  € T F%  p\        VS4      '       g   K  VP                  x € K'  	  R # 5ir$   )Ú_run_importr
   )r'   rB   r4   s   & €r   r)   rD   L   s    øé € ÐL¡f ´¸A¸{×0K”W�Q—W–W£fùs   ƒ0œ0)Úhermes_cli.setupr6   r7   r8   r9   r:   r2   r   r   r,   ÚjoinÚlenÚPLUGINÚ_pick_sourcesÚ_ensure_plugin)r4   r6   r7   r8   r9   r:   r0   ÚcontextÚnamesÚpickedrC   s   f         @r   Úoffer_agent_importr]   3   s  ù€ ÷
 cÕbÙ#×%Ò%‰BÔ+@Ó+B€EßÙÜ”D—I’I“KÓ €IÙÐ-°4Õ8Ø)¨D¯I©Iô 6NÙGLó6Nó -Nõ NØPSõTàOØCðE€Gñ 
ˆ7‚OÜ69¸%³jÀA´oˆF�K‰KÑ2©EÓ2Ô2È=€EáÐ2°5°'¸Ð;ÀTØ%)§Y¡YÑ.mÁGÓ.mÓ%m÷oó oáÐHÌÈÐPjÐkÔlÙÜ˜5Ó!€Fßœ¨×4Ò4ÙØ�9‰9ÔL¡fÓLÓLÐLr   c               ó    € V ^8„  d   QhRRRR/# )r   r0   r   r   zlist[ImportSource]r   )r    s   "r   r!   r!   O   s   € ÷ 	)ñ 	)Ð8ð 	)Ð=Oñ 	)r   c                óN  € ^ RI HpHp \        V 4      ^8X  d   V ^ ,          ^ ,          .# T! RV  UUu. uF  w  r4VP                  NK  	  upp\        \        \        V 4      4      4      4      pV'       g	   V! R4       V Uu. uF  q`V,          ^ ,          NK  	  up# u uppi u upi )zTOnly one found: that one (the question named it). Several: a checklist, all checked.)r9   Úprompt_checklistz'Which agents should Hermes import from?z*Nothing selected, so nothing was imported.)rT   r9   r`   rV   r
   ÚlistÚrange)r0   r9   r`   rB   rG   r\   Úis   &      r   rX   rX   O   s�   € ç=Ü
ˆ5ƒz�Q„Ø�a•˜•ˆ}ÐÙÐGÑ^cÔIdÑ^cÑVZÐVWÈ!Ï'Ì'Ñ^cÒIdÜ"¤5¬¨U«Ó#4Ó5ó7€FçÙÐ?Ô@Ù!'Ó(¡˜A�!�H�Q�KˆK¡Ñ(Ð(ùó	 Jeùò )s   ²BÂB"c               ó    € V ^8„  d   QhRRRR/# )r   r4   r   r   Úboolr   )r    s   "r   r!   r!   [   s   € ÷ ñ  ð ¨ñ r   c           
     ó’  € ^ RI Hp ^ RIHp ^ RIHp ^ RIHp ^ RIH	pH
p V! \        V 4      pV'       g   V! RR\         R24        V'       d   V! \        4       MV! \        R	R	R
7       V! \        V 4      '       d   R	#  V'       d   RMRpT! R\         RT RV'       d   RMR R\         24       R#   \        T3 d     LCi ; i)z˜The plugin installed and enabled in *hermes_home*: the catalog install (reviewed pin, the
usual install checks) when it is missing, else just an enable.)Úplugin_present)ÚAdmissionRefused)Ú
cmd_enable)Úcmd_install)r6   Úprint_warningNzImporting is done by the 'z=' plugin from the Hermes plugin catalog. Installing it now...T)ÚenableÚbriefÚenabledÚ	installedzThe 'z' plugin could not be z@, so nothing was imported. Try again later with: hermes plugins rl   ÚinstallÚ F)Úhermes_cli.left_core_migrationrg   Úhermes_cli.plugins_admissionrh   Úhermes_cli.plugins_cmdri   Úhermes_cli.plugins_cmd_installrj   rT   r6   rk   rW   Ú
SystemExit)	r4   rg   rh   ri   rj   r6   rk   ÚpresentÚverbs	   &        r   rY   rY   [   sË   € õ >Ý=Ý1Ý:ß5ÙœV [Ó1€GßÙˆdÐ0´°ð 9+ð +ô 	,ðßÙ”vÕáœ t°4Õ8ñ œ& +×.Ò.Ùð /ç‰9 [€DÙ�Eœ&˜Ð!7¸°vð >:ßFM¹(ÐS\Ð9]Ð]^Ô_eÐ^fðhô iáøô Ð(Ð)ô Ùðús   ÁB6 ÁB6 Â6CÃCc               ó    € V ^8„  d   QhRRRR/# )r   r4   r   r   ztuple[Optional[bytes], ...]r   )r    s   "r   r!   r!   y   s   € ÷ Oñ O˜4ð OÐ$?ñ Or   c                óš   € \         ;QJ d$    . R  V R,          V R,          3 4       F  NK  	  5# ! R  V R,          V R,          3 4       4      # )c              3  ór   "  € T F-  pVP                  4       '       d   VP                  4       MR x € K/  	  R # 5ir$   )Úis_fileÚ
read_bytesr&   s   & r   r)   Ú_snapshot.<locals>.<genexpr>z   s-   é € ð OÙM�Qð $%§9¡9§;¢;�—‘”°DÔ8ÛMùs   ‚7�7zconfig.yamlz.env)Útuple)r4   s   &r   Ú	_snapshotr€   y   sY   € ßŒ5ñ OØ&¨Õ6¸ÀfÕ8LÑMóO�5ð Oˆ5ñ OØ&¨Õ6¸ÀfÕ8LÑMóOó Oð Or   c               ó$   € V ^8„  d   QhRRRRRR/# )r   r1   r   r4   r   r   re   r   )r    s   "r   r!   r!   ~   s!   € ÷ ,ñ ,˜ð ,°4ð ,¸Dñ ,r   c                óV  € ^ RI HpHp ^ RIHp V! RV P
                   2RR7       \        V4      pVP                  4       P                  P                  R8X  d   . MRR.p\        P                  R	R
.VORNV P                  NV P                  ORNpV! VR7      p\        P                  P                  R4      '       d   \        P                  R,          VR&   \         P"                  ! WxRR7      P$                  '       d   V! RV P
                   R\&         24       \        V4      V8g  # )a  ``hermes import-agent <source>`` in a child process, so the freshly installed plugin's command
is wired; it previews and asks before changing anything (and exits 0 on a no too). True when the
run changed config.yaml or .env, which the setup sections after it read.)r8   rk   )Úserved_profile_child_envzImporting from Tr<   Úprofilesz	--profilerP   z-mzhermes_cli.mainzimport-agentz--from-setup)Útarget_homeÚ
PYTHONPATHF)ÚenvÚcheckzThe z„ import did not run. If the error names an invalid choice or unrecognized arguments, update the plugin first: hermes plugins update )rT   r8   rk   Útools.environments.localrƒ   r
   r€   ÚresolveÚparentr	   ÚsysÚ
executabler   ÚosÚenvironÚgetÚ
subprocessÚrunÚ
returncoderW   )	r1   r4   r8   rk   rƒ   ÚbeforeÚselectorÚargvr‡   s	   &&       r   rS   rS   ~   s  € ÷ =ÝAÙ�? 6§<¡< .Ð1°tÕ<Ü�{Ó#€Fð !×(Ñ(Ó*×1Ñ1×6Ñ6¸*ÔD‰rÈ;ÐXaÐJb€Hô �N‰N˜DÐ"3ð °hð Àð ÐPV×P[ÑP[ð Ð^d×^oÑ^oð Øð€Dá
"¨{Ô
;€CÜ	‡z�z‡~�~�l×#Ò#ÜŸJ™J |Õ4ˆˆLÑä‡~‚~�d¨5Ô1×<×<Ð<á˜˜VŸ\™\˜Nð +`Ü`fÐ_gðiô 	jä�[Ó! VÑ+Ð+r   )z	.openclawz	.clawdbotz.moltbot)z--migrate-secrets)z.claude)z.codex)z.cursor)Ú__conditional_annotations__Ú__doc__Ú
__future__r   rŽ   r‘   rŒ   rL   Úpathlibr   Útypingr   r   rW   r   r   r   r2   r]   rX   rY   r€   rS   )r—   s   @r   Ú<module>rœ      s˜   øðôõ #ã 	Û Û 
Û Ý ß 'à	€ô%�:ô %ñ �˜ZÐ)OÐQgÓhÙ� ¨|Ó<Ù�˜+ {Ó3Ù�˜8 \Ó2ð,€Ð(ó õõMõ8	)õõ<O÷
,r   