+
    lHàjp*  ã            (      óP  € R t ^ RIHt ^ RIt^ RIt^ RIHtHt ^ RIH	t	 ^ RI
Ht ^ RIHtHt ^ RIHt ^ RIHtHt ]P*                  ! ]4      tR	.]P0                  OR
N5tR R ltR R ltR]R]/tR R ltR R ltR R ltR R lt RLR R llt!R R lt"R R lt#R  R! lt$R" R# lt%R$RR%RR&RR'RR(R/R) R* llt&R+R,R-R.R/R0R1R2R3.R4R3R0R5R6]'! ]4      /R7R0R5R-R8/R9R0R5R-R:/R;R0R<R-R=/R>R0R?R@R0R5/R-RA/RBR0R?RC^R-RDR@R0R1R2RERF.R4RER0R5/RFR0R5RG^ ///////t(]PR                  ! R,RH](RI RJRK7       R# )Maà  ``setup_beat``: the one onboarding-only tool. It shows a beat's card through the desktop, waits
for the user (``CARD_TIMEOUT_S``), and returns their answer with a short reminder of the next beat.

The ``onboarding`` toolset carrying it is folded in only for the onboarding chat, at agent build
(``tui_gateway/methods_onboarding.py``). The run record is the session's ``onboarding_run``
(``agent/onboarding_record.py``); the order and the options are ``agent/onboarding_flow.py``.
)ÚannotationsN)ÚCallableÚMapping)ÚAny)Úonboarding_flow)Úfinish_reminderÚreminder)Úquestion)ÚregistryÚ
tool_errorÚnextÚdonec               ó   € V ^8„  d   QhRR/# ©é   ÚreturnÚdict© )Úformats   "Ú:/home/ubuntu/.hermes/hermes-agent/tools/setup_beat_tool.pyÚ__annotate__r      s   € ÷ Eñ E�Dñ Eó    c                 óJ   € ^ RI Hp  ^ RIHp R\	        V ! V! 4       4      4      /# )é    )Úconnected_slugs)ÚConnectorClientÚ	connected)Útools.connectors.displayr   Útools.connectors.gateway.clientr   Úsorted)r   r   s     r   Ú
_connectedr       s    € Ý8Ý?àœ¡±Ó0AÓ BÓCÐDÐDr   c               ó   € V ^8„  d   QhRR/# r   r   )r   s   "r   r   r   !   s   € ÷ lñ l�Dñ lr   c                 ól   € ^ RI Hp  ^ RIHp RV ! 4        Uu. uF  q!! V4      f   K  VNK  	  up/# u upi )r   )Úonboarding_names)Ú_catalog_installed_dirÚ	installed)Ú"hermes_cli.plugin_catalog_presencer#   Úhermes_cli.plugins_cmdr$   )r#   r$   Únames      r   Ú
_installedr)   !   s6   € ÝCÝ=àÑ+;Ô+=ÓjÑ+= 4ÐAWÐX\ÓA]Ÿ$˜$Ñ+=ÑjÐkÐkùÒjs   —1§1Ú
connectorsÚpluginsc               ó    € V ^8„  d   QhRRRR/# )r   ÚbeatÚstrr   zdict | Noner   )r   s   "r   r   r   ,   s   € ÷ ñ �3ð ˜;ñ r   c                óœ   € \         P                  V 4      ;pf   R #  V! 4       #   \         d    \        P	                  RT RR7        R # i ; i)Nz?onboarding: could not read what the %s beat has on this machineT)Úexc_info)Ú_PRESENTÚgetÚ	ExceptionÚloggerÚwarning)r-   Úreads   & r   Ú_presentr7   ,   sL   € Ü—‘˜TÓ"Ð"ˆÒ+ÙðÙ‹vˆøÜô Ü�‰ÐXÐZ^ÐimˆÔnÚðús   �$ ¤#AÁ
Ac               ó$   € V ^8„  d   QhRRRRRR/# )r   r-   r.   ÚargsúMapping[str, Any]r   zflow.Event | Noner   )r   s   "r   r   r   6   s(   € ÷ tñ t˜ð tÐ#4ð tÐ9Jñ tr   c                ó‚  € V R8X  d   \         P                  ! 4       # VP                  R4      '       d!   \         P                  ! V \	        V 4      4      # VP                  R4      p\        V\        4      '       dE   VP                  4       '       d/   \         P                  ! WP                  4       \	        V 4      4      # R# )zÂAn event the call carries in itself (no card): done, a value given in words, or a skip. Only the
Skip setup button (onboarding.skip) ends onboarding early; the model never decides the user quit.r   ÚskipÚvalueN)	ÚflowÚDoner2   ÚSkippedr7   Ú
isinstancer.   ÚstripÚRecorded)r-   r9   r=   s   && r   Ú_direct_eventrD   6   s†   € ð ˆv„~Ü�yŠy‹{ÐØ‡x�x�×ÒÜ�|Š|˜D¤(¨4£.Ó1Ð1Ø�H‰H�WÓ€EÜAKÈEÔSV×AWÒAWÐ\a×\gÑ\g×\iÒ\iŒ4�=Š=˜Ÿ{™{›}¬h°t«nÓ=ÐsÐosÐsr   c               ó$   € V ^8„  d   QhRRRRRR/# )r   r-   r.   ÚreplyzMapping[str, Any] | Noner   z
flow.Eventr   )r   s   "r   r   r   A   s'   € ÷ 
wñ 
w�sð 
wÐ#;ð 
wÀ
ñ 
wr   c                óF  € T;'       g    / pVP                  R 4      pV R8X  dc   \        V\        4      '       dM   VP                  4       '       d7   \        P
                  ! V RVP                  4       /VP                  4       4      # VP                  R4      '       d!   \        P                  ! V \        V 4      4      # VP                  R4      p\        V\        4      '       d   V'       d   \        P
                  ! W4      # \        P                  ! V \        V 4      4      # )Úsaidr(   Úwrote_insteadÚanswer)
r2   rA   r.   rB   r>   ÚAnsweredÚWroter7   r   ÚTimedOut)r-   rF   rH   rJ   s   &&  r   Ú_reply_eventrN   A   sÆ   € Ø�KˆK�R€EØ�9‰9�VÓ€DØˆv„~œ* T¬3×/Ò/°D·J±J·L²Lä�}Š}˜T F¨D¯J©J«LÐ#9¸4¿:¹:»<ÓHÐHØ‡y�y�×!Ò!ä�zŠz˜$¤¨£Ó/Ð/Ø�Y‰Y�xÓ €FÜ*4°V¼T×*BÒ*BÇvŒ4�=Š=˜Ó&ÐvÔSW×S`ÒS`ÐaeÔgoÐptÓguÓSvÐvr   c               ó   € V ^8„  d   QhRR/# )r   r   zCallable[[str], str | None]r   )r   s   "r   r   r   N   s   € ÷ kñ kÐ4ñ kr   c                 óp   aa€ ^ RI Ho ^ RIHp  V ! 4        Uu0 uF  qR,          kK  	  upoVV3R l# u upi )z¾A written first-task skill name -> the name skill_view loads it with here, or None. A plugin skill
(``blender:blender``) resolves through the installed catalog plugin to its registered name.)Úcatalog_plugin_skill)Úfind_all_skillsr(   c                ó8   <€ R V 9   d	   S! V 4      # V S9   d   V # R# )Ú:Nr   )r(   ÚbundledrQ   s   &€€r   Ú<lambda>Ú!_skill_resolver.<locals>.<lambda>U   s(   ø€ °c¸T´kÑ,¨TÓ2ÐjÐPTÐX_ÔP_ÈÐjÐeiÐjr   )Ú"hermes_cli.plugins_activation_liverQ   Útools.skills_toolrR   )rR   ÚskillrU   rQ   s     @@r   Ú_skill_resolverr[   N   s4   ù€ õ HÝ1á*9Ô*;Ó<Ñ*; �V�}ˆ}Ñ*;Ñ<€GÝjÐjùò =s   ˜3Ú c               ó(   € V ^8„  d   QhRRRRRRRR/# )r   Ústepú	flow.Stepr-   ú
str | NoneÚextrar.   r   r   )r   s   "r   r   r   X   s.   € ÷ cñ c�)ð c :ð c¸Sð cÈ#ñ cr   c                ót  € \         P                  P                  V P                  R ,          4      pV P                  P                  R4      '       d   \        4       MR p\	        V P                  V P                  W1V4      V,           p\        P                  ! / V P                  CV'       d   RV/M/ CRR7      # )ÚfactsÚbuild_c                ó   € V # ©Nr   )r(   s   &r   rV   Ú_result.<locals>.<lambda>[   s   € Ñ_cr   r   F©Úensure_ascii)
r>   ÚFactsÚfrom_storedÚrecordr   Ú
startswithr[   ÚjsonÚdumpsÚresult)r^   r-   ra   rc   Úresolve_skillÚtexts   &&&   r   Ú_resultrs   X   s…   € Ü�J‰J×"Ñ" 4§;¡;¨wÕ#7Ó8€Eà)-¯©×)AÑ)AÀ(×)KÒ)K”OÔ%ÑRc€MÜ�D—M‘M 4§;¡;°¸]ÓKÈeÕS€DÜ�:Š:ÐM˜Ÿ™ÐM¿t¨*°dÑ);ÈÐMÐ\aÔbÐbr   c               ó   € V ^8„  d   QhRR/# )r   r   úset[str] | Noner   )r   s   "r   r   r   `   s   € ÷ ñ ˜/ñ r   c                 ó   € ^ RI Hp  V ! 4       # )zcThe connectors this account can connect, as the card lists them; None when the list is unreachable.©Úhosted_names)Útools.connectors.targetsrx   rw   s    r   Ú_connector_slugsrz   `   s   € å5á‹>Ðr   c               ó    € V ^8„  d   QhRRRR/# )r   Úslugsru   r   r.   r   )r   s   "r   r   r   g   s   € ÷ tñ t˜ð t¨Sñ tr   c                óR   € V '       d   R RP                  \        V 4      4       R2# R# )z9 Suggest only connectors from this list, by these slugs: ú, Ú.r\   )Újoinr   )r|   s   &r   Ú_suggest_fromr�   g   s0   € ÷ glÐFÀtÇyÁyÔQWÐX]ÓQ^ÓG_ÐF`Ð`aÐbÐsÐqsÐsr   c               ó    € V ^8„  d   QhRRRR/# )r   r9   r:   r   r`   r   )r   s   "r   r   r   m   s   € ÷ 
9ñ 
9Ð 1ð 
9°jñ 
9r   c                óä  € V P                  R4      ;'       g    R Uu. uFK  p\        V4      P                  4       '       g   K$  \        V4      P                  4       P                  4       NKM  	  ppV'       d   \	        4       MRpV Uu. uF  qf   K  W9  g   K  VNK  	  ppV'       g   R# \
        P                  ! RRRRRP                  V4       R\        V4       R	2/R
R7      # u upi u upi )z]The refusal for connector suggestions the card cannot show, or None when every one is listed.ÚsuggestNÚerrorznot connectors herer   zNo card shown: r~   z> cannot be connected here. Do not mention them as connections.za Then call setup_beat(beat="connectors", suggest=[...]) again, or without suggest when none fits.Frh   r   )	r2   r.   rB   Úlowerrz   rn   ro   r€   r�   )r9   ÚslugÚwantedr|   Úunlisteds   &    r   Ú_unlisted_suggestionsrŠ   m   sÙ   € à48·H±H¸YÓ4G×4MÐ4MÈ2Ð4MÓcÑ4M¨DÔQTÐUYÓQZ×Q`ÑQ`×QbÔ'Œc�$‹i�o‰oÓ×%Ñ%Ö'Ñ4M€FÐcß"(ÔÔ¨d€EÙ!'ÓS¡˜”ÀÑAR—�¡€HÐSßÙÜ�:Š:�wÐ 5°zØ
˜$Ÿ)™) HÓ-Ð.Ð.lÜ˜ÓÐ
 ð !"ð	"ð$ð 38ô9ð 9ùò dùâSs   ž!C(Á+C(Â	C-ÂC-ÂC-c               ó(   € V ^8„  d   QhRRRRRRRR/# )	r   r-   r.   r^   r_   r9   r:   r   r   r   )r   s   "r   r   r   z   s)   € ÷ 
ñ 
�ð 
˜9ð 
Ð,=ð 
À$ñ 
r   c                óÞ  € \         P                  P                  VP                  R ,          4      p\         P                  V ,          P                  W1P                  R,          4      pV R8X  d   ^ RIHp V! 4       ;p'       d   RV/M/ pV R8X  dX   RVP                  R4      ;'       g    R Uu. uF/  p\        V4      P                  4       '       g   K$  \        V4      NK1  	  up/pV# u upi )rc   Úpicksr(   )Úsuggested_nameÚ	suggestedr*   r„   r   )r>   rj   rk   rl   Ú
BEAT_BY_IDÚcardÚagent.onboarding_factsrŽ   r2   r.   rB   )r-   r^   r9   rc   r‘   rŽ   r(   r‡   s   &&&     r   Ú_cardr“   z   sÀ   € Ü�J‰J×"Ñ" 4§;¡;¨wÕ#7Ó8€EÜ�?‰?˜4Õ ×%Ñ% e¯[©[¸Õ-AÓB€DØˆv„~Ý9ñ 0>Ó/?Ð'? tÖ'?�˜TÑ"ÀbˆØˆ|ÔØ°D·H±H¸YÓ4G×4MÐ4MÈ2Ð4MÓcÑ4M¨DÔQTÐUYÓQZ×Q`ÑQ`×Qbœiœc $žiÑ4MÑcÐdˆØ€Kùò ds   Â/!C*ÃC*ÚdbÚ
session_idÚtool_call_idÚcallbackÚend_turnc               ó0   € V ^8„  d   QhRRRRRRRRRR	R
R/# )r   r9   r:   r•   r.   r–   r—   z$Callable[[dict], dict | None] | Noner˜   zCallable[[], object] | Noner   r   )r   s   "r   r   r   ‡   s;   € ÷ )ñ )Ð+ð )ÀSð )Ð]`ð )ØBð)à9ð)àEHñ)r   c               ó  € ^ RI Hp V P                  R4      pV\        9  d#   \	        RRP                  \        4       R24      # VP                  W4      pVf   \	        R4      # VR8w  d+   \        Wp4      ;p	e   \        VP                  WV	4      4      # VR8X  d€   \        P                  ! V4      '       d   \        P                  ! V4      MRpVfH   \        P                  ! \        P                  ! V4      '       d   RR	R
\        V4      /4      # RR/4      # Vf   \	        R4      # VR8X  d   \!        V 4      ;p
'       d   V
# VP                  W\        P"                  ! WsV P                  R4      V P                  R4      4      4      pVP$                  '       d3   VP&                  R8X  d   \)        \+        4       4      MRp\        W¼R7      # \-        V P                  R4      ;'       g    R4      P/                  4       ;'       g4    \1        YxP                  R4      ;'       g    / P                  R4      4      pT! RTRTR\3        W{V 4      RT;'       g    R/4      pVP                  W4      pVe@   VR,          \        P4                  8X  d$   \        \        P6                  ! VRR/R4      4      # \9        W~4      p	\        VP                  WV	4      V4      p\;        V	\        P<                  4      '       d   Ve   V! 4        V# )a+  ``callback(payload) -> {answer?} | {said} | {wrote_instead: true} | None`` asks the desktop to show
``{beat, question, card}`` and blocks until the user answers or the card closes. ``end_turn`` ends the
agent's turn once this result is in: a card the user wrote past, whose message is the next turn.)Úonboarding_recordr-   zbeat must be one of: r~   r   Nz'Onboarding is not running in this chat.r   r   r   r…   z9Onboarding is over in this chat; it is a normal chat now.z5setup_beat cards show only in the Hermes desktop app.r*   Úoptionsr„   Úoffer_firstr\   )ra   r	   rc   Úlocaler‘   r–   ÚphaseÚskipped_allTÚskip_all)Úagentr›   r2   ÚBEATSr   r€   ÚloadrD   rs   Úadvancer>   Ú	is_activeÚ	next_beatrn   ro   r   rŠ   ÚShownrp   r   r�   rz   r.   rB   Úbeat_questionr“   ÚPHASE_SKIPPEDÚSteprN   rA   rL   )r9   r”   r•   r–   r—   r˜   Úrecordsr-   rl   ÚeventÚrefusedÚshownra   r	   rF   Úafterrp   s   &$$$$$           r   Úsetup_beat_toolr±   ‡   s‘  € õ 3à�8‰8�FÓ€DØ”5ÔÜÐ1°$·)±)¼EÓ2BÐ1CÀ1ÐEÓFÐFØ�\‰\˜"Ó)€FØ‚~ÜÐCÓDÐDØˆv„~¤M°$Ó$=Ð=˜5ÒJÜ�w—‘ r°uÓ=Ó>Ð>Øˆv„~Ü)-¯ª¸×)?Ò)?Œt�~Š~˜fÔ%ÀTˆØŠ<Ü—:’:ÔW[×WeÒWeÐfl×WmÒWm˜v v¨z¼?È6Ó;RÐSó kð kØ$+Ð-hÐ#iókð kàÒÜÐQÓRÐRØˆ|ÔÔ,AÀ$Ó,GÐ!G Ö!GØˆØ�O‰O˜B¬D¯JªJ°tÈ4Ï8É8ÐT]ÓK^Ð`d×`hÑ`hÐirÓ`sÓ,tÓu€EØ‡|‡|€|Ø5:·^±^À}Ô5T”Ô.Ó0Ô1ÐZ\ˆÜ�uÔ*Ð*Ü�4—8‘8˜JÓ'×-Ð-¨2Ó.×4Ñ4Ó6×xÐx¼-ÈÏzÉzÐZaÓOb×OhÐOhÐfh×NmÑNmÐnvÓNwÓ:x€HÙ�f˜d J°¸&Ä%ÈÐUYÓBZØ$ l×&:Ð&:°dð<ó =€Eà�L‰L˜Ó(€EØÒ˜U 7�^¬t×/AÑ/AÔAä”t—y’y ¨¸Ð(=¸zÓJÓKÐKÜ˜Ó%€EÜ�W—_‘_ R°UÓ;¸TÓB€FÜ�%œŸ™×$Ò$¨Ò)=áŒ
Ø€Mr   r(   Ú
setup_beatÚdescriptionaó  Run the first-run onboarding in this chat. Shows the card for a beat and waits for the user, then returns their answer and what to do next. beat=next shows the next beat. Pass value to record an answer they gave in words, skip to record that they skipped a beat. The build card needs options: your picks from the list its reminder gives. beat=done ends onboarding after the first build is shown and its close card is answered. Nothing here ends it early: a user who wants to stop presses Skip setup.Ú
parametersÚtypeÚobjectÚrequiredr-   Ú
propertiesÚstringÚenumr	   zYour line above the card.r=   zCRecord an answer given in words (a name, or an option id). No card.r<   Úbooleanz)They skipped this beat in words. No card.r„   ÚarrayÚitemsz+connectors only: slugs pinned as Suggested.rœ   ÚmaxItemsz0build only: up to four picks, ids from the list.ÚidÚlabelÚ	maxLengthÚ
onboardingc                ó   € \        V 4      # rf   )r±   )r9   Úkws   &,r   rV   rV   Ô   s	   € œ¨tÔ4r   u   ðŸŽ›)r(   ÚtoolsetÚschemaÚhandlerÚemoji)Nr\   )*Ú__doc__Ú
__future__r   rn   ÚloggingÚcollections.abcr   r   Útypingr   r¢   r   r>   Úagent.onboarding_textr   r   r	   r©   Útools.registryr
   r   Ú	getLoggerÚ__name__r4   ÚBEAT_IDSr£   r    r)   r1   r7   rD   rN   r[   rs   rz   r�   rŠ   r“   r±   ÚlistÚSETUP_BEAT_SCHEMAÚregisterr   r   r   Ú<module>rÖ      sÃ  ðñõ #ã Û ß -Ý å )ß ;Ý ;ß /à	×	Ò	˜8Ó	$€à	Ð(�$—-‘-Ð( Ñ(€õEõlð ˜* i°Ð<€õõtõ
wõk÷cõõtõ
9õ
ð)°4ð )È2ð )Ðceð )ØEIð)à<@÷)ðZ ˆLØð	ð Ø�Ø�V�HØØ�V˜X v©t°E«{Ð;Ø˜ ¨=Ð:UÐVØ�f˜h¨Ð7|Ð}Ø�V˜Y¨Ð7bÐcØ˜ ¨°6¸8Ð2DØ%Ð'TðVà˜ ¨°Q¸ÐGyØ &¨(°JÀÀwÀØ".°¸ÀÐ7IØ18¸6À8È[ÐZ\Ð:]ð1_ð"`ðað
ððÐ ð: 	× Ò Ø	˜|Ð4Eñ 5Ø
÷r   