+
    jHàjª-  ã                   óŠ   € R t ^ RIt^ RIt^ RIt^ RIt^ RIHt ^ RIHt R R lt	R R lt
R tR	 R
 ltR R ltR tR tR tR# )zÃInteractive messaging-platform setup wizards: WhatsApp (bridge + Cloud API), Slack manifest.

Split out of ``hermes_cli/main.py``. Names that still live in main are imported lazily at call time.
N)Ú
line_input)Ú_sayc                ó(   € V ^8„  d   QhR\         RR/# )é   ÚmsgÚreturnN©Ústr)Úformats   "ÚC/home/ubuntu/.hermes/hermes-agent/hermes_cli/main_platform_setup.pyÚ__annotate__r      s   € ÷  ñ  Œcð  �dñ  ó    c                 ó<   € \        V \        P                  R 7       R# ))ÚfileN)ÚprintÚsysÚstderr)r   s   &r   Ú_errr      s   € Ü	ˆ#”C—J‘J×r   c                ó0   € V ^8„  d   QhR\         R\        /# )r   Úpromptr   )r	   Úbool)r
   s   "r   r   r      s   € ÷ ,ñ ,”Cð ,œDñ ,r   c                óŽ   €  \        V 4      P                  4       pVP	                  4       R9   #   \        \        3 d    Rp L(i ; i)z,``[y/N]`` prompt; Ctrl-C/EOF counts as "no".Ún>   ÚyÚyes)ÚinputÚstripÚEOFErrorÚKeyboardInterruptÚlower)r   Úresponses   & r   Ú_yes_nor!      sI   € ðÜ˜“=×&Ñ&Ó(ˆð �>‰>Ó˜|Ñ+Ð+øô Ô'Ð(ô ØŠðús   ‚. ®AÁAc                ó�  € V ! R4      ;'       g    RpV'       d   VR8X  d   RMRp\        RV 24       V# \        RRRRR	R
RRRRR4        \        R4      P                  4       pTR8X  d$   T! RR4       \        RRRRRRRRRRRRRR4       R# T! RR4       \        R4       R#   \        \
        3 d    \        R4        R# i ; i) zSStep 1 of ``hermes whatsapp``: ``"bot"`` / ``"self-chat"``, or None when cancelled.ÚWHATSAPP_MODEÚ Úbotzseparate bot numberzpersonal number (self-chat)u   
âœ“ Mode: z&How will you use WhatsApp with Hermes?z&  1. Separate bot number (recommended)uF        People message the bot's number directly â€” cleanest experience.zH     Requires a second phone number with WhatsApp installed on a device.z   2. Personal number (self-chat)z/     You message yourself to talk to the agent.z3     Quick to set up, but the UX is less intuitive.z  Choose [1/2]: z
Setup cancelled.NÚ1u     âœ“ Mode: separate bot numberu›     â”Œâ”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”�u9     â”‚  Getting a second number for the bot:           â”‚u9     â”‚                                                 â”‚u9     â”‚  Easiest: Install WhatsApp Business (free app)  â”‚u9     â”‚  on your phone with a second number:            â”‚u;     â”‚    â€¢ Dual-SIM: use your 2nd SIM slot            â”‚u<     â”‚    â€¢ Google Voice: free US number (voice.google) â”‚u;     â”‚    â€¢ Prepaid SIM: $3-10, verify once            â”‚u9     â”‚  WhatsApp Business runs alongside your personal â”‚u;     â”‚  WhatsApp â€” no second phone needed.             â”‚u›     â””â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”˜z	self-chatu'     âœ“ Mode: personal number (self-chat))r   r   r   r   r   r   )Úget_env_valueÚsave_env_valueÚcurrent_modeÚ
mode_labelÚchoices   &&   r   Ú_whatsapp_choose_moder,      s  € á  Ó1×7Ð7°R€LßØ.:¸eÔ.CÑ*ÐIfˆ
Ü�˜Z˜LÐ)Ô*ØÐÜˆÐ5°rØ	1Ø	QØ	SÐUWØ	+Ø	:Ø	>ÀôDðÜÐ)Ó*×0Ñ0Ó2ˆð �„}Ù�¨Ô.ÜÐ.°ð kØHØHØHØHØJØKØJØHØHØJð kô	lñ Ù�? KÔ0Ü	Ð
3Ô4Ùøô+ Ô'Ð(ô ÜÐ"Ô#Úðús   ÁB% Â%CÃCc                ó(   € V ^8„  d   QhR\         RR/# )r   Úwa_moder   Nr   )r
   s   "r   r   r   D   s   € ÷ Xñ X¤Sð XÈDñ Xr   c                óh  € V! R4      ;'       g    RpV'       d�   \        RV 24       \        R4      '       g   R# V R8X  d   \        R4      P                  4       pM\        R4      P                  4       pV'       d(   V! RVP	                  R	R4      4       \        R
V 24       R# \        4        V R8X  d&   \        R4       \        R4      P                  4       pM\        R4      P                  4       pV'       d*   V! RVP	                  R	R4      4       \        RV 24       R# \        R4       R# )zAStep 3 of ``hermes whatsapp``: show / set WHATSAPP_ALLOWED_USERS.ÚWHATSAPP_ALLOWED_USERSr$   u   âœ“ Allowed users: z
  Update allowed users? [y/N] Nr%   z<  Phone numbers that can message the bot (comma-separated): z(  Your phone number (e.g. 15551234567): Ú u     âœ“ Updated to: z+  Who should be allowed to message the bot?z4  Phone numbers (comma-separated, or * for anyone): u     âœ“ Allowed users set: uF     âš  No allowlist â€” the agent will respond to ALL incoming messages)r   r!   r   r   Úreplace)r.   r'   r(   Úcurrent_usersÚphones   &&&  r   Ú_whatsapp_allowed_usersr5   D   s  € á!Ð":Ó;×AÐA¸r€MßÜÐ# M ?Ð3Ô4ÜÐ9×:Ò:ÙØ�eÔÜÐ]Ó^×dÑdÓf‰EäÐIÓJ×PÑPÓRˆEßÙÐ3°U·]±]À3ÈÓ5KÔLÜÐ& u gÐ.Ô/ÙÜ	„GØ�%ÔÜÐ;Ô<ÜÐQÓR×XÑXÓZ‰äÐEÓF×LÑLÓNˆßÙÐ/°·±¸sÀBÓ1GÔHÜÐ)¨%¨Ð1Ö2äÐVÖWr   c                ó$   € V ^8„  d   QhR\         /# )r   r   )r   )r
   s   "r   r   r   `   s   € ÷ "ñ "¬Dñ "r   c                óš  € ^ RI HpHp V R,          P                  4       '       d   \	        R4       R# \	        R4       ^ RIpV! R4      p V! 4       pVfh   VP                  RRR7      P                  pVP                  R4      pVe   VP                  f   VP                  RR	4      h\        VP                  4      p\        P                  ! VR
RRR.\        V 4      \        P                  \        P                  RRRVRR7	      pTP$                  ^ 8w  d_   TP&                  ;'       g    RP)                  4       p	T	'       d#   RP+                  T	P-                  4       RR 4      MRp
\/        RT
4       R# \	        R4       R#   TP                  \         3 d   p\	        RT 24        Rp?R# Rp?i\"         d    \	        R4        R# i ; i)zTStep 4 of ``hermes whatsapp``: ``npm install`` the bridge when needed. False = stop.©Úfind_node_executableÚwith_hermes_node_pathÚnode_modulesu)   âœ“ Bridge dependencies already installedTuM   
â†’ Installing WhatsApp bridge dependencies (this can take a few minutes)...NÚnpm©Úexplicitz'npm binary is missing after preparationÚinstallz	--no-fundz
--no-auditz--progress=falsezutf-8r2   F)ÚcwdÚstdoutr   ÚtextÚencodingÚerrorsÚenvÚchecku,     âœ— Bridge dependency preparation failed: u   
  âœ— Install cancelledr$   Ú
z(no output)u     âœ— npm install failed:u     âœ“ Dependencies installediâÿÿÿ)Úhermes_constantsr9   r:   Úexistsr   ÚpmÚensurerE   Úinstalled_packageÚbinaryÚInstallErrorr	   Ú
subprocessÚrunÚDEVNULLÚPIPEÚOSErrorr   Ú
returncoder   r   ÚjoinÚ
splitlinesr   )Ú
bridge_dirr9   r:   rJ   r<   rE   Ú	installedÚresultÚexcÚerrÚpreviews   &          r   Ú_whatsapp_install_bridger]   `   s�  € çLØ�^Õ#×+Ñ+×-Ò-ÜÐ9Ô:ÙÜ	Ð
ZÔ[Ûá
˜uÓ
%€CðÙ#Ó%ˆØŠ;Ø—)‘)˜E¨D�)Ó1×5Ñ5ˆCØ×,Ñ,¨UÓ3ˆIØÒ  I×$4Ñ$4Ò$<Ø—o‘o eÐ-VÓWÐWÜ�i×&Ñ&Ó'ˆCÜ—’Ø�)˜[¨,Ð8JÐKÜ�J“¬
×(:Ñ(:Ä:Ç?Á?ÐY]Ø Y°C¸uôFˆð ×Ñ˜AÔØ�}‰}×"Ð" ×)Ñ)Ó+ˆß7:�$—)‘)˜CŸN™NÓ,¨S¨TÐ2Ô3ÀˆÜÐ(¨'Ô2ÙÜ	Ð
(Ô)Ùøð �O‰OœWÐ%ô ÜÐ<¸S¸EÐBÔCÝûÜô ÜÐ)Ô*Úðús%   ÁB;F ÆG
ÆF-Æ-G
Æ:G
Ç	G
c                óò  € ^ RI HpHp V! R4       ^ RIHpHp ^ RIHpHp \        RRR04       \        W44      pVf   R# \        4        V! R4      ;'       g    RP                  4       R	8X  d   \        R
4       \        WsV4       ^ RIHp V! 4       p	V	R,          p
V
P!                  4       '       g   \        RV
 24       R# \#        V	4      '       g   R# V! 4       R,          R,          pVP%                  RRR7       VR,          P!                  4       '       d�   \        R4       \'        R4      '       d8   \(        P*                  ! VRR7       VP%                  RRR7       \        R4       M<V! R4      ;'       g    RP                  4       R	8w  d
   V! RR	4       \        RR4       R# \        RR14       VR8X  d   \        RR4       M\        R4       \        RRR1R4       ^ RIpV! R4      pVf_    VP/                  RRR7       VP1                  R4      pVe   VP2                  f   VP5                  RR4      h\7        VP2                  4      p\8        P:                  ! \<        4      ;_uu_ 4        \>        P@                  ! V\7        V
4      R!R"\7        V4      .\7        V	4      V! 4       R#R$7       RRR4       \        4        VR,          P!                  4       '       g   \        R%4       R# V! RR	4       \        R&R4       VR8X  d   \        R'R(R)R*RR+4       M\        R'R(R,R-RR+R.4       \        RR/4       R#   TP4                   d   p\        R T 24        Rp?R# Rp?ii ; i  + '       g   i     L½; i)2zESet up WhatsApp: choose mode, configure, install bridge, pair via QR.)Ú_require_ttyÚget_hermes_homeÚwhatsapp)r'   r(   r8   r$   u   â˜¤ WhatsApp SetupNÚWHATSAPP_ENABLEDÚtrueu   âœ“ WhatsApp is already enabled)Úresolve_whatsapp_bridge_dirz	bridge.jsu    
âœ— Bridge script not found at ÚsessionT)ÚparentsÚexist_okz
creds.jsonu#   âœ“ Existing WhatsApp session foundz8
  Re-pair? This will clear the existing session. [y/N] )Úignore_errorsu     âœ“ Session clearedu'   
âœ“ WhatsApp is configured and paired!z(  Start the gateway with: hermes gatewayr%   u0   ðŸ“± Open WhatsApp (or WhatsApp Business) on thez*   phone with the BOT's number, then scan:u,   ðŸ“± Open WhatsApp on your phone, then scan:u0      Settings â†’ Linked Devices â†’ Link a DeviceÚnoder=   z+Node.js binary is missing after preparationu"     âœ— Node.js preparation failed: z--pair-onlyz	--sessionF)r@   rE   rF   uG   âš  Pairing may not have completed. Run 'hermes whatsapp' to try again.u!   âœ“ WhatsApp paired successfully!z  Next steps:z)    1. Start the gateway:  hermes gatewayz2    2. Send a message to the bot's WhatsApp numberz)    3. The agent will reply automaticallyu;     Tip: Agent responses are prefixed with 'â˜¤ Hermes Agent'u)       2. Open WhatsApp â†’ Message Yourselfu.       3. Type a message â€” the agent will replyz4  so you can tell them apart from your own messages.z1  Or install as a service: hermes gateway installz2==================================================u–   â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€)!Úhermes_cli.mainr_   r`   Úhermes_cli.configr'   r(   rH   r9   r:   r   r,   r   r   r5   Ú!gateway.platforms.whatsapp_commonrd   rI   r]   Úmkdirr!   ÚshutilÚrmtreerJ   rK   rL   rM   rN   r	   Ú
contextlibÚsuppressr   rO   rP   )Úargsr_   r`   r'   r(   r9   r:   r.   rd   rW   Úbridge_scriptÚsession_dirrJ   ri   rX   rZ   s   &               r   Úcmd_whatsappru   …   s  € ç=Ù�Ôß?ßLÜˆÐ! 8Ô,ä# MÓB€GØ‚Ùô 
„GÙÐ(Ó)×/Ð/¨R×6Ñ6Ó8¸FÔBÜÐ/Ô0ä˜G°NÔCåMÙ,Ó.€JØ Õ,€MØ×Ñ×!Ò!ÜÐ1°-°ÐAÔBÙÜ# J×/Ò/Ùñ "Ó# jÕ0°9Õ<€KØ×Ñ˜d¨TÐÔ2Ø�lÕ"×*Ñ*×,Ò,ÜÐ3Ô4ÜÐN×OÒOÜ�MŠM˜+°TÕ:Ø×Ñ d°TÐÔ:ÜÐ)Õ*ñ Ð0Ó1×7Ð7°R×>Ñ>Ó@ÀFÔJÙÐ1°6Ô:ÜÐ;Ð=gÔhÙô 	ˆˆZÔØ�%ÔÜÐ?ÐAmÕnäÐ<Ô=ÜˆÐ?ÀÈRÔPÛá Ó'€DØ‚|ð	Ø�I‰I�f tˆIÔ,Ø×,Ñ,¨VÓ4ˆIØÒ  I×$4Ñ$4Ò$<Ø—o‘o fÐ.[Ó\Ð\Ü�y×'Ñ'Ó(ˆDô 
×	Ò	Ô.×	/Õ	/Ü�ŠØ”3�}Ó% }°kÄ3À{ÓCSÐTÜ�J“Ñ%:Ó%<ÀEõ	K÷ 
0ô
 
„GØ˜,Õ&×.Ñ.×0Ò0ÜÐWÔXÙáÐ% vÔ.ÜÐ	,¨bÔ1Ø�%ÔÜˆ_ÐIØAØ8¸"ØJõ	Lô
 	ˆ_ÐIØ8Ø=¸rØJØCô		Eô
 	ˆÐ@ÖAøð5 �‰ô 	ÜÐ6°s°eÐ<Ô=Ýûð	ú÷ 
0×	/ús&   Ç2AL9 É1A M&Ì9M#Í
MÍM#Í&M6	c                ó8   € ^ RI Hp V! R4       ^ RIHp V! 4       # )u¼   Set up WhatsApp Business Cloud API (official Meta integration) â€” complementary to the
``hermes whatsapp`` Baileys bridge wizard. See ``plugins/platforms/whatsapp_cloud/setup_wizard.py``.)r_   zwhatsapp-cloud)Úrun_whatsapp_cloud_setup)rj   r_   Ú-plugins.platforms.whatsapp_cloud.setup_wizardrw   )rr   r_   rw   s   &  r   Úcmd_whatsapp_cloudry   â   s   € õ -ÙÐ!Ô"ÝVÙ#Ó%Ð%r   c                ó¸   € \        V RR4      pVR9   d   \        R4       ^# VR8X  d$   ^ RIHp V! V 4      pV'       d   \	        V4      hV# \        RV 24       ^# )z�``hermes slack <subcommand>``; ``manifest`` prints or writes a Slack app manifest with
every gateway command registered as a first-class slash.Úslack_commandNzËusage: hermes slack <subcommand>

subcommands:
  manifest   Generate a Slack app manifest with every gateway
             command registered as a native slash

Run `hermes slack manifest -h` for details.Úmanifest)Úslack_manifest_commandzUnknown slack subcommand: >   Nr$   )Úgetattrr   Úhermes_cli.slack_clir}   Ú
SystemExit)rr   Úsubr}   Ústatuss   &   r   Ú	cmd_slackrƒ   ë   sg   € ô �$˜¨Ó
.€CØ
ˆjÔÜð ;ô 	<ñ à
ˆjÔÝ?Ù'¨Ó-ˆßÜ˜VÓ$Ð$ØˆäÐ% c UÐ	+Ô,Ùr   )Ú__doc__rp   rn   rO   r   Úhermes_cli.cli_outputr   Ú#hermes_cli.model_setup_flows_commonr   r   r!   r,   r5   r]   ru   ry   rƒ   © r   r   Ú<module>rˆ      sL   ðñó
 Û Û Û 
å ,Ý 4õ õ,ò%õPXõ8"òJZBòz&ôr   