+
    „WÝjm:  ã                  óˆ  € R t ^ RIHt ^ RIt^ RIt^ RIt^ RIHt ^ RIH	t	 ^t
^t^ tR.R R llt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/]! RRRR7      3R0]! RRRR7      3R1]! RRRR7      3R2]! RRRR7      3R3]! RRRRR R!7      3R4]! R"R#R$R%R&7      3R5]! R#R$R'R(7      3R6]! R#R$R)R(7      33tR* R+ ltR,R-.tR# )7u•   CLI subcommand: ``hermes send`` â€” pipe text from shell scripts to any configured messaging platform
(Telegram, Discord, Slack, Signal, SMS, etc.).
)ÚannotationsN)ÚPath)ÚOptionalc               ó$   € V ^8„  d   QhRRRRRR/# )é   ÚmsgÚstrÚ	exit_codez
int | NoneÚreturnÚint© )Úformats   "ÚGC:\Users\johnn\AppData\Local\hermes\hermes-agent\hermes_cli\send_cmd.pyÚ__annotate__r      s!   € ÷ ñ ˆsð ˜zð °Sñ ó    c                óx   € \        V \        P                  R7       Ve   \        P                  ! V4       \        # )z[Print ``msg`` to stderr; exit with ``exit_code`` when given, else return ``_FAILURE_EXIT``.©Úfile)ÚprintÚsysÚstderrÚexitÚ_FAILURE_EXIT)r   r	   s   &&r   Ú_failr      s(   € ä	ˆ#”C—J‘JÕØÒÜ�Š�ÔÜÐr   c               ó$   € V ^8„  d   QhRRRRRR/# )r   Ú
positionalúOptional[str]Ú	file_pathr
   r   )r   s   "r   r   r      s&   € ÷ Jñ J =ð J¸]ð JÈ}ñ Jr   c                óò  € V '       d   V # V'       dB   VR8X  d   \         P                  P                  4       #  \        V4      P	                  RR7      # \         P                  P                  4       '       g)   \         P                  P                  4       ;'       g    R# R#   \
         d!    \        RT RT RT RT R2	\        4        Lx\         d!   p\        R	T R
T 2\        4        Rp?L�Rp?ii ; i)z·Resolve the message body: positional arg, then ``--file PATH`` / ``--file -`` (stdin), then
piped stdin when not attached to a TTY. ``None`` when nothing is available (a usage error).Ú-z	utf-8-sig)Úencodingúhermes send: zæ is not a text file. --file reads the message *body* (logs, reports, markdown).
To send an image/document/audio file as a native attachment, reference it with MEDIA: in the message text instead:
  hermes send --to telegram "MEDIA:z6"
  hermes send --to telegram "optional caption MEDIA:zv"
Add [[as_document]] to deliver an image as an uncompressed file:
  hermes send --to telegram "[[as_document]] MEDIA:Ú"zhermes send: cannot read z: N)
r   ÚstdinÚreadr   Ú	read_textÚUnicodeDecodeErrorr   Ú_USAGE_EXITÚOSErrorÚisatty)r   r   Úexcs   && r   Ú_read_message_bodyr+      sô   € ÷ ØÐßØ˜ÔÜ—9‘9—>‘>Ó#Ð#ð	OÜ˜	“?×,Ñ,°kÐ,ÓBÐBô  .1¯Y©Y×-=Ñ-=×-?Ò-?ŒC�I‰I�N‰NÓ×$Ð$ ÐIÀTÐIøô "ô 
	ÜØ 	˜{ð +6ð 7@°[ð AGØGPÀkð RFàFOÀ[ÐPQðSô ö	ô ô 	OÜÐ-¨i¨[¸¸3¸%Ð@Ä+×NÑNûð	Oús#   ¹B" Â"(C6ÃC6ÃC6ÃC1Ã1C6c               ó    € V ^8„  d   QhRRRR/# )r   Úmentionsz	list[str]r
   r   )r   s   "r   r   r   7   s   € ÷ \ñ \¨ð \°yñ \r   c                óZ   € ^ RI Hp V  Uu. uF  q!! V4      '       d   K  VNK  	  up# u upi )zBReturn mention values that cannot identify a WhatsApp participant.)Únormalize_whatsapp_mention_jid)Úgateway.whatsapp_identityr/   )r-   r/   Úmentions   &  r   Ú_invalid_whatsapp_mentionsr2   7   s(   € åHá#+Ó[¡8˜Ð3QÐRY×3Z�GˆG¡8Ñ[Ð[ùÒ[s   ‹(Ÿ(c               ó(   € V ^8„  d   QhRRRRRRRR/# )r   Úresult_jsonr   Ú	json_modeÚboolÚquietr
   r   r   )r   s   "r   r   r   >   s(   € ÷ ñ ˜cð °ð ¸dð Àsñ r   c               óÂ  €  V '       d   \         P                  ! V 4      M/ pV'       d#   \        \         P                  ! V^R7      4       M¢V'       g›   VP                  R4      '       d'   \        RVR,           2\        P                  R7       M]VP                  R4      '       d&   \        VP                  R4      ;'       g    R	4       M!\        \         P                  ! V^R7      4       VP                  R4      '       g5   VP                  R
4      '       g   VP                  R4      '       d   \        # \        #   \         P                   d    RRRT /p EL;i ; i)z–Print the ``send_message_tool`` JSON result in the requested format; return the exit code.
Unknown / unexpected shapes are failures so scripts notice.Úerrorz#invalid JSON from send_message_toolÚraw)Úindentr!   r   ÚsuccessÚnoteÚsentÚskipped)
ÚjsonÚloadsÚJSONDecodeErrorr   ÚdumpsÚgetr   r   Ú_SUCCESS_EXITr   )r4   r5   r7   Úpayloads   &$$ r   Ú_emit_resultrG   >   sù   € ðWß-8”$—*’*˜[Ô)¸bˆ÷ ÜŒd�jŠj˜¨Ô+Õ,ßØ�;‰;�w×ÒÜ�M '¨'Õ"2Ð!3Ð4¼3¿:¹:ÖFØ�[‰[˜×#Ò#Ü�'—+‘+˜fÓ%×/Ð/¨Õ0ä”$—*’*˜W¨QÔ/Ô0Ø�;‰;�w×Ò W§[¡[°×%;Ò%;¸w¿{¹{È9×?UÒ?UÜÐÜÐøô ×Ñô WàÐAÀ5È+ÐV‹ðWús   ‚D? ŠD? Ä?EÅEc               ó$   € V ^8„  d   QhRRRRRR/# )r   Úplatform_filterr   r5   r6   r
   r   r   )r   s   "r   r   r   T   s!   € ÷ <ñ < =ð <Àð <Èñ <r   c          
     óŽ  €  ^ RI HpHp  T! 4       p\        TP                  R4      ;'       g    / 4      p ^ RIHp T! 4       P                  4        F4  p\        TR\        T4      4      p	T	R!9  g   K"  TP                  T	. 4       K6  	  T '       d–   T P                  4       P                  4       p
TP                  4        UUu/ uF  w  r¼TP                  4       T
8X  g   K  Y¼bK   	  pppT'       g4   \	        RT  R	R
P!                  \#        T4      4      ;'       g    R 24      # TpT'       d/   \%        \&        P(                  ! RT/^\        R7      4       \*        # T'       g—   \%        R4       \%        R4       ^ RIHpHpHp T! 4       T! 4       pp\%        RTR,           R24       T! T4      T! T4      8w  d:   TR,          P5                  4       '       d   \%        RT RTR,           RT R24       \*        # T f   \%        T! T4      4       \*        # \#        T4       F¸  p	\%        T	 R24       Yi,          '       g   \%        R4       K,  Yi,           Fv  pTP                  RR4      pTP                  R4      ;'       g    TP                  R4      ;'       g    Rp\%        RT	 RT 2T'       d   TT8w  d   RT R 2MR,           4       Kx  	  \%        4        Kº  	  \*        #   \         d   p\	        RT 24      u Rp?# Rp?ii ; i  \         d   p\	        RT 24      u Rp?# Rp?ii ; i  \         d     EL³i ; iu uppi )"z¤Print the channel directory (all configured targets across platforms), reusing the
``format_directory_for_display`` rendering the send_message tool shows the model.)Úformat_directory_for_displayÚload_directoryz/hermes send: failed to load channel directory: Nz/hermes send: failed to read channel directory: Ú	platforms)Úload_gateway_configÚvaluez,hermes send: no targets found for platform 'z'. Configured: ú, z(none))r;   Údefaultz@No messaging platforms configured or no channels discovered yet.zBSet one up with `hermes gateway setup`, or run the gateway once so)Úget_default_hermes_rootÚget_hermes_homeÚhermes_home_keyzchannel discovery can populate zchannel_directory.jsonÚ.zA gateway running from z already has z'; this shell is scoped to profile home z, which has none.Ú:z  (no channels discovered yet)ÚnameÚ?ÚidÚchat_idÚ z  z  [Ú])ÚlocalÚ
api_serverÚwebhook)Úgateway.channel_directoryrK   rL   Ú	Exceptionr   ÚdictrD   Úgateway.configrN   Úget_connected_platformsÚgetattrr   Ú
setdefaultÚstripÚlowerÚitemsÚjoinÚsortedr   r@   rC   rE   Úhermes_constantsrR   rS   rT   Úexists)rI   r5   rK   rL   r*   r:   rM   rN   ÚplatÚ	plat_nameÚkeyÚkÚvÚfilteredrR   rS   rT   ÚhomeÚrootÚchrW   rZ   s   &$                    r   Ú_list_targetsrw   T   s  € ðNßZðNÙÓˆô �S—W‘W˜[Ó)×/Ð/¨RÓ0€IðÝ6Ù'Ó)×AÑAÖCˆDÜ  g¬s°4«yÓ9ˆIØÐ BÖBØ×$Ñ$ Y°Ö3ñ D÷ Ø×#Ñ#Ó%×+Ñ+Ó-ˆØ%.§_¡_Ô%6ÔKÑ%6™T˜Q¸!¿'¹'»)ÀsÑ:J”D�A’DÑ%6ˆÑKßÜØ>¸Ð>Oð PØ#Ÿy™y¬°	Ó):Ó;×GÐG¸xÐHðJóKð Kð ˆ	ßÜŒd�jŠj˜+ yÐ1¸!ÄSÔIÔJÜÐßÜÐPÔQÜÐRÔSß^Ñ^Ù$Ó&Ñ(?Ó(AˆdˆÜÐ/°Ð7OÕ0OÐ/PÐPQÐRÔSá˜4Ó ¡O°DÓ$9Ô9¸tÐF^Õ?^×>fÑ>f×>hÒ>hÜÐ+¨D¨6°¸tÐF^Õ?^Ð>_ð `:Ø:>¸Ð?PðRô SäÐð ÒÜÑ*¨9Ó5Ô6ÜÐÜ˜IÖ&ˆ	Ü��˜1ˆoÔØ×#Ô#ÜÐ2Ô3ÙØ×&Ð&ˆBØ—6‘6˜& #Ó&ˆDØ—f‘f˜T“l×=Ð= b§f¡f¨YÓ&7×=Ð=¸2ˆGÜ�B�y�k  4 &Ð)ÇÈWÐX\Ì_¨s°7°)¸1Ñ-=ÐbdÕeÖfñ 'ô 	Žñ 'ô Ðøôo ô NÜÐFÀsÀeÐLÓMÕMûðNûô ô NÜÐFÀsÀeÐLÓMÕMûðNûô ô Úðüó Ls]   ‚K# ‹L	 ·8L/ Á4L/ ÃMÃ!MË#LË.LË;LÌLÌ	L,ÌL'Ì!L,Ì'L,Ì/L>Ì=L>c               ó   € V ^8„  d   QhRR/# )r   r
   ÚNoner   )r   s   "r   r   r   “   s   € ÷ ,#ñ ,#˜$ñ ,#r   c                 ó†  € ^ RI p  ^ RIHp V! 4       p^ RIHpHp T! 4       '       d   T! 4       MRp\        T\        4      '       d   TpM<T P                  pTR,          pTP                  4       '       d    ^ RIHp T! TRR7       TR,          p	T	P                  4       '       g   R#  ^ R	IHp
 T
! T	4      pTP                  4        FB  w  rÍ\        T\         \"        \$        \&        34      '       g   K-  YÆ9  g   K5  \!        T4      Yl&   KD  	  R#   \         d     R# i ; i  \         d     L§i ; i  \         d     R# i ; i)
ue  Populate the credential environment from ``<HERMES_HOME>/.env`` AND bridge top-level ``config.yaml``
keys into it so the gateway config loader sees platform credentials and home channels.

The target is ``os.environ`` for the standalone CLI. Inside a multi-profile host (dashboard console
running ``send`` for profile B under its secret scope) it is the installed scope mapping: writing B's
``.env`` into the shared process env would hand every other profile's later reads B's tokens
(``gateway.config._getenv`` reads the scope first, so the loader sees the same values either way).
The installed scope is already ``build_profile_secret_scope``'s composition â€” user ``.env``, then
the profile's external secret sources over it â€” so it is authoritative as-is; replaying raw
``.env`` over it would let a stale user value beat the secret-manager one for this request.
N©rS   )Úcurrent_secret_scopeÚis_multiplex_activeú.env)Ú_load_dotenv_with_fallbackT)Úoverrideúconfig.yaml)Úload_user_config_effective)ÚosÚhermes_cli.configrS   ra   Úagent.secret_scoper|   r}   Ú
isinstancerb   Úenvironrm   Úhermes_cli.env_loaderr   Úhermes_cli.config_effectiver‚   ri   r   r   Úfloatr6   )rƒ   rS   rt   r|   r}   ÚscopeÚtargetÚenv_pathr   Úconfig_pathr‚   Úcfgrp   Úvals                 r   Ú_load_hermes_envr‘   “   s  € ó ðÝ5ÙÓ ˆ÷ MÙ&9×&;Ò&;Ñ Ô"À€EÜ�%œ×ÒØ‰à—‘ˆØ˜&•=ˆØ�?‰?×ÒðÝLÙ*¨8¸dÕCð ˜Õ&€KØ×Ñ×ÒÙðÝJÙ(¨Ó5ˆð —I‘I–K‰ˆÜ�cœC¤¤e¬TÐ2×3Ô3¸Ö8IÜ˜c›(ˆF‹Kó  øô5 ô Úðûô ô Ùðûô ô Úðús5   †D Á6D  Â(D1 ÄDÄDÄ D.Ä-D.Ä1E Ä?E c               ó    € V ^8„  d   QhRRRR/# )r   Úargszargparse.Namespacer
   ry   r   )r   s   "r   r   r   Â   s   € ÷ .pñ .pÐ%ð .p¨$ñ .pr   c                ó  € \        4        \        V RR4      '       d:   \        \        V RR4      \        V RR4      R7      p\        P                  ! V4       \        V RR4      ;'       g    RP                  4       pV'       g   \        R	\        4       \        \        V R
R4      ;'       g    . 4      pV'       dK   VP                  R^4      ^ ,          P                  4       P                  4       R8w  d   \        R\        4       \        V4      pV'       d$   \        RRP                  V4       R2\        4       \        \        V RR4      \        V RR4      4      pVe   VP                  4       '       g   \        R\        4       \        V RR4      pV'       d   V RVP                  4        2p^ RIHp RRRVRV/pV'       d   W8R
&   V! V4      p	\        P                  ! \#        V	\        V RR4      \        V RR4      R7      4       R# )z9Entry point wired into the top-level argparse dispatcher.Úlist_targetsFÚmessageNr@   )r5   Útor[   zËhermes send: --to PLATFORM[:channel[:thread]] is required
Examples:
  hermes send --to telegram "hello"
  hermes send --to discord:#ops --file report.md
  hermes send --list      # list available targetsr-   rV   Úwhatsappz>hermes send: --mention is only supported for WhatsApp targets.z)hermes send: invalid --mention value(s): rP   z(. Use a phone number or participant JID.r   znhermes send: no message provided. Pass text as a positional argument, use --file PATH, or pipe data via stdin.Úsubjectz

)Úsend_message_toolÚactionÚsendrŒ   r7   )r5   r7   )r‘   re   rw   r   r   rg   r   r'   ÚlistÚsplitrh   r2   rj   r+   ÚlstripÚtools.send_message_toolrš   rG   )
r“   r	   rŒ   r-   Úinvalid_mentionsr–   r™   rš   Ú	tool_argsÚresults
   &         r   Úcmd_sendr¤   Â   sÈ  € äÔÜˆt�^ U×+Ò+ä!¤'¨$°	¸4Ó"@ÌGÐTXÐZ`ÐbgÓLhÔiˆ	Ü�Š�ÔÜ�d˜D $Ó'×-Ð-¨2×4Ñ4Ó6€FßÜðAô
 ô	ô ”G˜D *¨dÓ3×9Ð9°rÓ:€Hß�F—L‘L  aÓ(¨Õ+×1Ñ1Ó3×9Ñ9Ó;¸zÔIÜÐNÔP[Ô\Ü1°(Ó;ÐßÜØ7Ø�y‰yÐ)Ó*Ð+Ð+SðUäô	ô !¤¨¨y¸$Ó!?ÄÈÈvÐW[ÓA\Ó]€GØ‚˜gŸm™mŸošoÜðAäô	ô �d˜I tÓ,€GßØ�I˜T '§.¡.Ó"2Ð!3Ð4ˆõ :ð ˜6 8¨V°YÀÐH€IßØ (�*ÑÙ˜yÓ)€FÜ‡H‚HŒ\˜&¬G°D¸&À%Ó,HÔPWÐX\Ð^eÐglÓPmÔnÖor   ÚTARGETzéDelivery target. Format: 'platform' (home channel), 'platform:chat_id', 'platform:chat_id:thread_id', or 'platform:#channel-name'. Examples: telegram, telegram:-1001234567890:17585, discord:#ops, slack:C0123ABCD, signal:+15551234567.)ÚmetavarrQ   ÚhelprX   z4Message text. If omitted, read from --file or stdin.)ÚnargsrQ   r§   ÚPATHzšRead message body from PATH (text only). Use '-' to force stdin. To send an image/document as an attachment, use MEDIA:<path> in the message text instead.ÚLINEz6Prepend a subject/header line before the message body.r-   ÚappendÚPHONE_OR_JIDz¿WhatsApp only: add a native participant mention. Repeat for multiple recipients; bare phone numbers are normalized to JIDs. Include each matching @<number> near the start of the message text.)Údestr›   rQ   r¦   r§   r•   Ú
store_trueFzRList available targets. Optional positional filter: `hermes send --list telegram`.)r­   r›   rQ   r§   z,Suppress stdout on success (exit code only).)r›   rQ   r§   z6Emit raw JSON result instead of human-readable output.c               ó   € V ^8„  d   QhRR/# )r   r
   zargparse.ArgumentParserr   )r   s   "r   r   r   	  s   € ÷  ñ  Ð+Bñ  r   c           	     ó   € ^ RI Hp V! 4       pV P                  RRRVR,           RVR,           R2R	\        P                  R
7      p\
         F  w  rEVP                  ! V/ VB  K  	  VP                  \        R7       V# )z,Create the ``send`` subparser and return it.r{   rœ   zASend a message to a configured platform (scripts, cron jobs, CI).z‡Pipe text from any shell script to any messaging platform Hermes is already configured for. Reuses the gateway's platform credentials (r~   z + r�   ut   ) â€” no LLM, no agent loop, no running gateway required for bot-token platforms like Telegram/Discord/Slack/Signal.a1  Examples:
  hermes send --to telegram "deploy finished"
  echo "RAM 92%" | hermes send --to telegram:-1001234567890
  hermes send --to discord:#ops --file ./report.md
  hermes send --to slack:#eng --subject "[CI]" --file build.log
  hermes send --to whatsapp:GROUP@g.us --mention 15551234567 "@15551234567 hello"
  hermes send --to telegram "MEDIA:./chart.png"   # send a media attachment
  hermes send --list                  # all platforms
  hermes send --list telegram         # filter by platform

Exit codes: 0 ok, 1 delivery/backend error, 2 usage error.)r§   ÚdescriptionÚepilogÚformatter_class)Úfunc)	rl   rS   Ú
add_parserÚargparseÚRawDescriptionHelpFormatterÚ_SEND_ARGUMENTSÚadd_argumentÚset_defaultsr¤   )Ú
subparsersrS   Úhermes_homeÚparserÚflagsÚkwargss   &     r   Úregister_send_subparserrÀ   	  s—   € å0Ù!Ó#€KØ×"Ñ"ØØPðà'¨&Õ0Ð1°Ø˜]Õ*Ð+ð ,<ð<ð
Iô !×<Ñ<ð1 #ó >€F÷2 )‰ˆØ×Ò˜UÐ- fÔ-ñ )à
×ÑœXÐÔ&Ø€Mr   r¤   rÀ   )N)z-tz--to)r–   )z-fz--file)z-sz	--subject)z	--mention)z-lz--list)z-qz--quiet)z--json)Ú__doc__Ú
__future__r   r¶   r@   r   Úpathlibr   Útypingr   r'   r   rE   r   r+   r2   rG   rw   r‘   r¤   rb   r¸   rÀ   Ú__all__r   r   r   Ú<module>rÆ      s2  ðñõ #ã Û Û 
Ý Ý ð €Ø€Ø€÷õJõ8\õõ,<õ~,#õ^.pðf ‘T (°Dð	]ô_ð `ð
 ‘4˜c¨4Ð6lÔmÐnØ‘t F°Dð	dôfð gð ™$ v°tÐBzÔ{Ð|Ø‘T˜z°(ÀDÐR`ð	yô{ð |ð ‘t ¸ÈeØ!uôwð xà™ L¸%ÐFtÔuÐvØ‘$˜l°EÐ@xÔyÐzð#€õ* ðF Ð0Ð
1‚r   