+
    lHàjÂ‰  ã                   óä  a € R¨ t€0 t R t^ RIHt ^ RIt^ RIt^ RIt^ RIt^ RI	t	^ RI
t
^ RIt^ RIt^ RIt^ RIt^ RIHt ^ RIHtHtHtHtHt ^ RIt^ RIHt ]
P4                  ! ]4      tR R lt^ RIHtH t H!t!H"t"H#t#H$t$ ^ R	I%H&t& ^ R
I'H(t(H)t)H*t*H+t+H,t,H-t-H.t. ^ RI/H0t0H1t1H2t2H3t3H4t4H5t5H6t6 ^ RI7H8t8H9t9H:t: ^ RI;H<t<H=t=H>t> ^ RI?H@t@HAtAHBtB RRRRRR/tCR©R R lltD]D! RRR7      tE]D! RRRR7      tF]D! RR4      tG]D! RRRR7      tH]D! R4      tI]D! R R!4      tJ]D! R"R#4      tKR$ R% ltLR& R' ltMR( R) ltNR* R+ ltOR, R- ltPR.tQR/ R0 ltR]R! 4       ;tStTR1 R2 ltUR3 R4 ltVR5 R6 ltW]X! 0 Rªm4      tY]P´                  ! R7]P¶                  4      t\]X! 0 R«m4      t]]X! 0 R¬m4      t^R8R= RR>R?]! R4       23RR@ RARBRC3RDRE RFRGRH3R;R­R<R®RRI RJRKRL3R9R¯R:RM RNRORP3R RQ RRRSRT3R"RU RVRWRX3/
t_] ^ k RY RZ lt`R[ R\ ltaR] R^ ltbR_ R` ltcRa Rb ltd]e! 4       tf] ^k Rc Rd ltgRe Rf lthRg Rh ltiRi Rj ltjRk Rl ltkRm Rn ltlRo Rp ltm ! Rq Rr]n4      toRs Rt ltpR°Ru Rv lltqRw Rx ltrRy Rz ltsR.R{ R8R| RR} RDR~ R;]rR<]sR9R RR€ R:R� R R‚ R"Rƒ /tt] ^k R„ R… ltuR.RR8R†RR‡/tv] ^k Rˆ R‰ ltwRŠ R‹ ltx^ RŒIyHztzH{t{ R� RŽ lt|R� R� lt}R‘R’R“R”R•R–R—R˜R™R–RšR“R›/RœR–RšR“]|! R�4      /RžR–RŸR“R /R¡R–RšR“R¢//R£R™.//t~]zPþ                  ! R’R¤]~R¥ ]xR¦]}R§7       R# )±a6  Text-to-speech tool: config resolution, built-in provider dispatch, output policy, registration.

Built-ins: Edge (free default), ElevenLabs, OpenAI, DeepInfra, MiniMax, Mistral, Gemini, xAI,
local NeuTTS / KittenTTS / Piper; plus ``type: command`` providers under ``tts.providers.<name>``
and plugin-registered ones. Output is Opus (.ogg) on voice-bubble platforms, MP3 elsewhere.
Sibling ``tts_tool_*`` modules hold backends/delivery/lifecycle; they read the seams defined
here (config, provider resolution, lazy SDK importers) through ``_origin()`` at call time.
)Úinstall_hintN)ÚPath)ÚCallableÚDictÚAnyÚListÚOptional)Údisplay_hermes_homec                ó<   € V ^8„  d   QhR\         R\         R\         /# )é   Úenv_varÚprovider_idÚreturn©Ústr)Úformats   "Ú3/home/ubuntu/.hermes/hermes-agent/tools/tts_tool.pyÚ__annotate__r       s!   € ÷ 9ñ 9¤3ð 9´Sð 9¼Sñ 9ó    c                ó   € ^ RI Hp V! W4      # )z\Resolve a TTS provider API key via the shared voice-key resolver (config > env/.env > pool).)Úresolve_provider_secret)Útools.tool_backend_helpersr   )r   r   r   s   && r   Ú_resolve_provider_keyr       s   € åBÙ" 7Ó8Ð8r   )ÚBUILTIN_TTS_PROVIDERSÚ#_configured_command_tts_output_pathÚ_generate_command_ttsÚ_get_command_tts_output_formatÚ _is_command_tts_voice_compatibleÚ _resolve_command_provider_config)ÚNOUS_MANAGED_PROVIDER)Ú_resolve_max_text_lengthÚ_build_audio_delivery_filesÚ_convert_to_opusÚ_remove_quietlyÚ_repair_ogg_containerÚ_resolve_audio_delivery_profileÚ_split_text_for_tts)Ú_generate_edge_ttsÚ_generate_elevenlabsÚ_generate_gemini_ttsÚ_generate_minimax_ttsÚ_generate_mistral_ttsÚ_generate_xai_ttsÚ_resolve_minimax_tts_runtime)Ú_generate_kittenttsÚ_generate_neuttsÚ_generate_piper_tts)Ú_dispatch_to_plugin_providerÚ_plugin_provider_is_availableÚ$_plugin_provider_is_voice_compatible)Ú_generate_deepinfra_ttsÚ_generate_openai_ttsÚ_has_openai_audio_backendztts.edgeúedge-ttsztts.elevenlabsútts-premiumztts.mistralÚmistralc          
      óŽ   € V ^8„  d   QhR\         R\        \         ,          R\        \         ,          R\        . \        3,          /# )r   ÚmoduleÚattrÚfeaturer   )r   r   r   r   )r   s   "r   r   r   :   s=   € ÷ ñ œ#ð ¤X¬c¥]ð ÄHÌSÅMð Ô]eÐfhÔjmÐfmÕ]nñ r   c                ó\   a aa€ VVV 3R lpRS P                  R4      ^ ,           2Vn        V# )aq  Lazy SDK importer: returns ``module`` (or ``module.attr``), raising ImportError when absent.

``feature`` names a ``pm.ensure_import`` extra to best-effort install first (users who enabled
a provider in config.yaml never ran the post-setup hook); any failure there falls through so
the raw import still raises cleanly. sounddevice also raises OSError without PortAudio.c                  ó,  <€ S'       dN   \         P                  ! \        4      ;_uu_ 4        ^ RIHp  V ! \
        P                  SS4      4       RRR4       \        P                  ! S4      pS'       d   \        VS4      # T#   + '       g   i     L<; i)é    )Úensure_importN)
Ú
contextlibÚsuppressÚ	ExceptionÚpmrA   Ú_PM_FEATURE_ALIASESÚgetÚ	importlibÚimport_moduleÚgetattr)Ú
_pm_ensureÚmodr<   r=   r;   s     €€€r   Ú_importÚ_sdk_importer.<locals>._import@   sd   ø€ ßÜ×$Ò$¤Y×/Õ/Ý:ÙÔ.×2Ñ2°7¸GÓDÔE÷ 0ô ×%Ò% fÓ-ˆß%)Œw�s˜DÓ!Ð2¨sÐ2÷	 0×/ús   ¬#BÂB	Ú_import_Ú.)ÚsplitÚ__name__)r;   r<   r=   rM   s   fff r   Ú_sdk_importerrS   :   s-   ú€ ÷3ð " &§,¡,¨sÓ"3°AÕ"6Ð!7Ð8€GÔØ€Nr   Úedge_tts)r=   zelevenlabs.clientÚ
ElevenLabsÚopenaiÚOpenAIzmistralai.clientÚMistralÚsounddeviceÚ	kittenttsÚ	KittenTTSÚpiperÚ
PiperVoicec                óJ   € V ^8„  d   QhR\         . \        3,          R\        /# )r   Úimporterr   )r   r   Úbool)r   s   "r   r   r   T   s#   € ÷ ñ œ( 2¤s 7Õ+ð ´ñ r   c                 ó:   €  V ! 4        R #   \          d     R# i ; i©TF)ÚImportError)r_   s   &r   Ú_importablerd   T   s!   € ðÙŒ
ÙøÜô Úðús   ‚ ‹™c                ó0   € V ^8„  d   QhR\         R\        /# )r   Únamer   ©r   r`   )r   s   "r   r   r   \   s   € ÷ ñ œSð ¤Tñ r   c                 ój   €  \         P                  P                  V 4      R J#   \         d     R# i ; i)NF)rH   ÚutilÚ	find_specrD   )rf   s   &r   Ú_package_installedrk   \   s3   € ðÜ�~‰~×'Ñ'¨Ó-°TÐ9Ð9øÜô Úðús   ‚ # £2±2c                ó$   € V ^8„  d   QhR\         /# ©r   r   ©r`   )r   s   "r   r   r   c   s   € × JÑ J¤Ñ Jr   c                  ó   € \        R 4      # )Úneutts©rk   © r   r   Ú_check_neutts_availablers   c   s   € Ô.@ÀÓ.JÐ'Jr   c                ó$   € V ^8„  d   QhR\         /# rm   rn   )r   s   "r   r   r   d   s   € × PÑ P¤DÑ Pr   c                  ó   € \        R 4      # )rZ   rq   rr   r   r   Ú_check_kittentts_availablerv   d   s   € Ô1CÀKÓ1PÐ*Pr   c                ó$   € V ^8„  d   QhR\         /# rm   rn   )r   s   "r   r   r   e   s   € × HÑ H¤Ñ Hr   c                  ó   € \        R 4      # )r\   rq   rr   r   r   Ú_check_piper_availablery   e   s   € Ô-?ÀÓ-HÐ&Hr   Úedgec                ó$   € V ^8„  d   QhR\         /# rm   r   )r   s   "r   r   r   l   s   € ÷ =ñ =¤ñ =r   c                  ó2   € ^ RI Hp  \        V ! RR4      4      # )r@   ©Úget_hermes_dirzcache/audioÚaudio_cache)Úhermes_constantsr~   r   r}   s    r   Ú_get_default_output_dirr�   l   s   € Ý/Ü‰~˜m¨]Ó;Ó<Ð<r   c                ó$   € V ^8„  d   QhR\         /# rm   r   )r   s   "r   r   r   t   s   € ÷ %ñ %œSñ %r   c                 ó@   € \         \        8w  d   \         # \        4       # )u  The active profile's audio output dir at call time (long-lived runtimes switch profiles
after import); a monkeypatched ``DEFAULT_OUTPUT_DIR`` wins.

Same bug class as skills_tool (f8723c478) and skills_sync (#65828): long-lived multi-profile runtimes
(dashboard console, TUI/Desktop backend, cron, kanban workers) import this module once under the launch
HERMES_HOME and later scope requests to a different profile via
``hermes_constants.set_hermes_home_override()`` â€” a frozen module constant keeps writing synthesized
audio into the launch profile's cache instead of the active profile's (#98749). Keep the legacy
``DEFAULT_OUTPUT_DIR`` module attribute for tests and external patchers; when it has not been patched,
re-resolve from the live profile-scoped HERMES_HOME on every call.
)ÚDEFAULT_OUTPUT_DIRÚ_DEFAULT_OUTPUT_DIR_AT_IMPORTr�   rr   r   r   Ú_default_output_dirr†   t   s   € ô Ô:Ô:Ü!Ð!Ü"Ó$Ð$r   c                óF   € V ^8„  d   QhR\         \        \        3,          /# rm   ©Údictr   r   )r   s   "r   r   r   …   s   € ÷ 	ñ 	œ$œs¤C˜x�.ñ 	r   c                 óö   €  ^ RI Hp  V ! 4       P                  R4      ;'       g    / #   \         d    \        P                  R4        / # \         d$   p\        P                  RTRR7        Rp?/ # Rp?ii ; i)z8Return the ``tts`` config section ({} when unavailable).)Úload_configÚttsz9hermes_cli.config not available, using default TTS configzFailed to load TTS config: %sT©Úexc_infoN)Úhermes_cli.configr‹   rG   rc   ÚloggerÚdebugrD   Úwarning)r‹   Úes     r   Ú_load_tts_configr”   …   sr   € ðJÝ1Ù‹}× Ñ  Ó'×-Ð-¨2Ð-øÜô RÜ�‰ÐPÕQð €Iô ô JÜ�‰Ð6¸ÀDˆ×IÐIØ€IûðJús%   ‚"( ¥( ¨ A8ÁA8ÁA8ÁA3Á3A8c                óR   € V ^8„  d   QhR\         \        \        3,          R\        /# )r   Ú
tts_configr   rˆ   )r   s   "r   r   r   ‘   s&   € ÷ Gñ Gœd¤3¬ 8�nð G´ñ Gr   c                ó–   € V P                  R4      ;'       g    \        P                  4       P                  4       pV\        8X  d   R# T# )zµConfigured provider or the free default (inference credentials never imply consent to paid
speech); ``nous`` is serviced by the OpenAI path through the managed openai-audio gateway.ÚproviderrV   )rG   ÚDEFAULT_PROVIDERÚlowerÚstripr   )r–   r˜   s   & r   Ú_get_providerrœ   ‘   s@   € ð —‘˜zÓ*×>Ð>Ô.>×EÑEÓG×MÑMÓO€HØÔ#8Ô8ˆ8ÐF¸hÐFr   z,media:\s*[`'\"*_]*(?:[`'\"]|[a-z]:[/\\]|~?/)Ú
elevenlabsÚgeminirp   ÚminimaxÚxaic                  ó    € \        \        4      # ©N)rd   Ú_import_elevenlabsrr   r   r   Ú<lambda>r¤   ¬   s
   € œ;Ô'9Ô:r   r(   zJElevenLabs provider selected but 'elevenlabs' package not installed. Run: c                  ó    € \        \        4      # r¢   ©rd   Ú_import_openai_clientrr   r   r   r¤   r¤   ¯   s
   € ”{Ô#8Ô9r   z
OpenAI TTSr5   z<OpenAI provider selected but 'openai' package not installed.Ú	deepinfrac                  ó    € \        \        4      # r¢   r¦   rr   r   r   r¤   r¤   ±   s
   € œ+Ô&;Ô<r   zDeepInfra TTSr4   z;DeepInfra TTS uses the 'openai' SDK but it isn't installed.c                  ó    € \        \        4      # r¢   )rd   Ú_import_mistral_clientrr   r   r   r¤   r¤   µ   s
   € œÔ$:Ô;r   zMistral Voxtral TTSr+   zoMistral provider selected but 'mistralai' package not installed. Run `hermes setup` to install Mistral support.c                  ó   € \        4       # r¢   ©rs   rr   r   r   r¤   r¤   ¹   s   € Ô.Ô0r   zNeuTTS (local)r/   zyNeuTTS provider selected but neutts is not installed. Run hermes setup tts and choose NeuTTS; espeak-ng is also required.c                  ó    € \        \        4      # r¢   )rd   Ú_import_kittenttsrr   r   r   r¤   r¤   ¼   s
   € œ+Ô&7Ô8r   zKittenTTS (local, ~25MB)r.   zoKittenTTS provider selected but 'kittentts' package not installed. Run 'hermes setup tts' and choose KittenTTS.c                  ó    € \        \        4      # r¢   )rd   Ú_import_piperrr   r   r   r¤   r¤   ¿   s	   € ”k¤-Ô0r   zPiper (local)r0   zmPiper provider selected but 'piper-tts' package not installed. Run 'hermes tools' and select Piper under TTS.c                ó0   € V ^8„  d   QhR\         R\         /# )r   Úmessager   r   )r   s   "r   r   r   Ä   s   € ÷ Pñ Pœð P¤ñ Pr   c                 ó:   € \         P                  ! R RRV /RR7      # )ÚsuccessFÚerror©Úensure_ascii)ÚjsonÚdumps)r³   s   &r   Ú_error_jsonr»   Ä   s   € Ü�:Š:�y %¨°'Ð:ÈÔOÐOr   c                ób   € V ^8„  d   QhR\         R\         R\        \         \        3,          RR/# )r   ÚtextÚfile_strr–   r   N)r   r‰   r   )r   s   "r   r   r   È   s0   € ÷ ñ œð ¤sð ¼¼SÄ#¸X½ð È4ñ r   c                óú   a aa€ VV V3R lp ^ RI Hp V! ^R7      ;_uu_ 4       pVP                  V4      P                  ^<R7       RRR4       R#   + '       g   i     R# ; i  \         d    T! 4         R# i ; i)zVRun the async Edge generator from sync code (worker thread; direct run if that fails).c                  óF   <€ \         P                  ! \        SS S4      4      # r¢   )ÚasyncioÚrunr'   )r¾   r½   r–   s   €€€r   r¤   Ú_run_edge_tts.<locals>.<lambda>Ê   s   ø€ ”'—+’+Ô0°°xÀÓLÔMr   )ÚThreadPoolExecutor)Úmax_workers)ÚtimeoutN)Úconcurrent.futuresrÄ   ÚsubmitÚresultÚRuntimeError)r½   r¾   r–   rÂ   rÄ   Úpools   fff   r   Ú_run_edge_ttsrÌ   È   sY   ú€ æ
M€CðÝ9Ù¨A×.Õ.°$Ø�K‰K˜Ó×#Ñ#¨BÐ#Ô/÷ /×.×.Ò.ûäô Ù�ðús.   �A$ ¤"AÁA$ ÁA!	ÁA$ Á!A$ Á$A:Á9A:c                ó0   € V ^8„  d   QhR\         R\        /# ©r   r˜   r   )r   Útuple)r   s   "r   r   r   Ó   s   € ÷ Lñ L¤Sð L¬Uñ Lr   c                ó2  € \         P                  V 4      pVe&   Vw  r#rEYe   V! 4       '       g   \        V4      3# R3# \        \        4      '       d   V R3# \        4       '       d   \        P                  R4       R# V \        R\        R4       R24      3# )z¡SDK check -> ``(engine, None)`` or ``(provider, error_json)``. Unknown names take the Edge
default; without edge-tts NeuTTS is the fallback (engine != provider).Nz9Edge TTS not available, falling back to NeuTTS (local)...z1No TTS provider available. Enable Edge TTS with: r7   zA or run 'hermes setup tts' and choose NeuTTS for local synthesis.)rp   N)	Ú_BUILTIN_DISPATCHrG   r»   rd   Ú_import_edge_ttsrs   r�   Úinfor   )r˜   ÚentryÚ	availableÚ_labelÚ
_generatorÚmissing_errors   &     r   Ú_select_builtin_enginerÙ   Ó   s¬   € ô ×!Ñ! (Ó+€EØÒØ7<Ñ4ˆ	˜:ØÒ8MÑV_×VaÒVaœ+ mÓ4ÐlÐlÐgkÐlÐlÜÔ#×$Ò$Ø˜ˆ~ÐÜ× Ò Ü�‰ÐOÔPØÐØ”[Ø;Ü˜
Ó#Ð
$ð %Kð	KóLð Lð Lr   c                ó�   € V ^8„  d   QhR\         R\         R\         R\        \         \        3,          R\        \         ,          RR/# )r   Úenginer½   r¾   r–   Úinstructionsr   N)r   r‰   r   r   )r   s   "r   r   r   å   sI   € ÷ 	8ñ 	8¤ð 	8¬3ð 	8¼#ð 	8Ì4ÔPSÔUXÐPXÍ>ð 	8ÔiqÔruÕivð 	8Ð{ñ 	8r   c                ó  € \         P                  V 4      p\        P                  RV'       d
   V^,          MR4       Vf   \	        WV4       R# V R8X  d   \        WW4R7       R# \        4       V^,          ,          ! WV4       R# )z+Run the already-selected built-in *engine*.zGenerating speech with %s...zEdge TTSNrV   )rÜ   )rÑ   rG   r�   rÓ   rÌ   r5   Úglobals)rÛ   r½   r¾   r–   rÜ   rÔ   s   &&&&& r   Ú_synthesize_builtinrß   å   s_   € ä×!Ñ! &Ó)€EÜ
‡K�KÐ.¿E°°a¶ÀzÔRØ‚}Ü�d jÖ1Ø	�8Ô	Ü˜T¨Z×Sä‹	�%˜•(Ö˜D¨JÖ7r   c          
      óŒ   € V ^8„  d   QhR\         R\         R\        \        \         \        3,          ,          R\        R\
        /# )r   r¾   r˜   Úcommand_provider_configÚ	want_opusr   )r   r   r‰   r   r`   rÏ   )r   s   "r   r   r   ñ   sA   € ÷ /ñ /Üð/Ü ð/Ü;CÄDÌÌcÈÅNÕ;Sð/Ü`dð/ä
ñ/r   c                óÌ  € Ve   \        V4      pM‹V\        9  d   \        V4      pMtV'       d>   V\        9   d3   V P	                  R4      '       g   \        V 4      pV'       d   VR3# V R3# V\        9   pY;'       d    T;'       d    V P	                  R4      3# V'       g   V R3# V P	                  R4      '       g   \        V 4      ;'       g    T p W P	                  R4      3# )aF  Voice-bubble eligibility (Opus-converting when needed) -> ``(path, voice_compatible)``.

Command/plugin providers are documents unless they opt in via ``voice_compatible``; native-Opus
built-ins qualify when the platform wants Opus and they wrote .ogg; MP3/WAV built-ins are
ffmpeg-converted only when the platform needs Opus.z.oggTF)r   r   r3   Ú_FFMPEG_OPUS_PROVIDERSÚendswithr"   Ú_NATIVE_OPUS_PROVIDERS)r¾   r˜   rá   râ   Úopted_inÚ	opus_pathÚnatives   &&&&   r   Ú_finalize_voice_deliveryrê   ñ   sÚ   € ð Ò*Ü3Ð4KÓL‰Ø	Ô.Ô	.Ü7¸ÓA‰ß	�xÔ#9Ô9À(×BSÑBSÐTZ×B[ÒB[Ü$ XÓ.ˆ	ß$-�	˜4Ð ÐD°H¸eÐ3DÐDàÔ3Ñ3ˆØ×KÐK I×KÐK°(×2CÑ2CÀFÓ2KÐKÐKßØ˜ˆÐð ×Ñ˜V×$Ò$Ü# HÓ-×9Ð9°ˆØ×&Ñ& vÓ.Ð.Ð.r   c                ó4   € V ^8„  d   QhR\         R\         RR/# )r   Ú	requestedÚ
configuredr   Nr   )r   s   "r   r   r     s!   € ÷ ñ ´3ð ÄCð ÈDñ r   c                ó”   € V'       g   R# RV 3pV\         9   d   R# \         P                  V4       \        P                  RV V4       R# )uG  Once-per-process (per distinct requested value) warning for ignored per-call provider
overrides â€” a stale session whose cached tool schema still advertises the param would
otherwise repeat it every call; and callers with no tts config at all are silent (nothing
to disagree WITH â€” default resolution just runs). See #90109.NÚtts_provider_overridez>Ignoring per-call TTS provider override %r; tts.provider is %r)Ú_once_warningsÚaddr�   r’   )rì   rí   Úkeys   && r   Ú#_warn_ignored_tts_provider_overrideró     sB   € ÷
 ÙØ" IÐ
.€CØ
ŒnÔÙÜ×Ñ�sÔÜ
‡N�NØHØØör   c                óŠ   € V ^8„  d   QhR\         \        \        3,          R\        \        ,          R\        \        ,          /# )r   r–   Úspeedr˜   )r‰   r   r   r   Úfloat)r   s   "r   r   r   #  s4   € ÷ +ñ +¤d¬3´¨8¥nð +¼XÄe½_ð +ÔX`ÔadÕXeñ +r   c                óî   € Ve&   / V CR\        R\        R\        V4      4      4      /Cp \        V 4      pV'       d8   VP	                  4       P                  4       pV'       d   WC8w  d   \        WC4       W3# )uô  Apply per-call ``speed`` (clamped, on a shallow copy so the cached config isn't mutated) and
resolve the provider name. ``tts.provider`` in config.yaml is the authoritative backend
selector (#90109): the per-call argument stays for internal/test callers, but a value that
disagrees with the configured provider is ignored â€” the model-facing schema no longer
advertises the override, and a leaked platform hint passing one anyway must not reroute
speech to another vendor behind the operator's back.rõ   g      Ð?g      @)ÚmaxÚminrö   rœ   rš   r›   ró   )r–   rõ   r˜   Úconfigured_providerrì   s   &&&  r   Ú_apply_call_overridesrû   #  si   € ð ÒØO˜
ÐO G¬S°´s¸3ÄÀeÃÓ7MÓ-NÑOˆ
Ü'¨
Ó3ÐßØ—N‘NÓ$×*Ñ*Ó,ˆ	ß˜Ô9Ü/°	ÔOØÐ*Ð*r   c                ó$   € V ^8„  d   QhR\         /# rm   )rÏ   )r   s   "r   r   r   4  s   € ÷ 6ñ 6œ5ñ 6r   c                 óP   € ^ RI Hp  V ! RR4      P                  4       pW\        9   3# )u]   ``(platform, wants_opus)`` â€” platforms delivering voice bubbles only as Ogg/Opus want Opus.)Úget_session_envÚHERMES_SESSION_PLATFORMÚ )Úgateway.session_contextrþ   rš   ÚOPUS_VOICE_PLATFORMS)rþ   Úplatforms     r   Ú_session_platformr  4  s*   € å7ÙÐ8¸"Ó=×CÑCÓE€HØÔ!5Ñ5Ð5Ð5r   c          
      ó¢   € V ^8„  d   QhR\         \        ,          R\        R\         \        \        \        3,          ,          R\        R\
        /# )r   Úoutput_pathr˜   rá   râ   r   )r   r   r‰   r   r`   rÏ   )r   s   "r   r   r   ;  sJ   € ÷ 'ñ 'Üœ#•ð'Ü*-ð'ÜHPÔQUÔVYÔ[^ÐV^ÕQ_ÕH`ð'Ümqð'ä
ñ'r   c                óð  € V '       dÛ   ^ RI HpHp V! V 4      '       d   R\        R4      3# \        P                  V 4      '       d   R\        R4      3# V! V 4      '       d   R\        RV  R24      3# \        V 4      P                  4       pVe   \        Wb4      p^ RI	H
pHp V! \        V4      4      '       g   V! \        V4      4      '       d   R\        RV R	24      3# MtVe   \        V4      p	MV'       d   V\        9   d   R
MRp	\        P                  P!                  4       P#                  R4      p
\        \%        4       4      RV
 RV	 2,          pVP&                  P)                  RRR7       VR3# )aV  Pick the output file -> ``(Path, None)`` or ``(None, error_json)``.

A caller path is rejected on ``..`` traversal (bug or prompt-injection; absolute is fine) and
on protected credential/system locations. Default ``<audio cache>/tts_<timestamp>.<ext>``: the
command format, ``.ogg`` for native-Opus providers on Opus platforms, else ``.mp3``.)Úhas_traversal_componentÚhas_unsafe_path_charsNzWoutput_path contains control characters or line separators; use a plain filesystem pathz=output_path must not contain a media directive (MEDIA:<path>)z/output_path contains '..' traversal component: zM. Use an absolute path or one relative to the current directory without '..'.)Úis_write_approval_requiredÚis_write_deniedz;output_path targets a protected credential or system path: z(. Choose a normal audio output location.ÚoggÚmp3z%Y%m%d_%H%M%S_%fÚtts_rP   T)ÚparentsÚexist_ok)Útools.path_securityr  r	  r»   Ú_MEDIA_DIRECTIVE_REÚsearchr   Ú
expanduserr   Úagent.file_safetyr
  r  r   r   ræ   ÚdatetimeÚnowÚstrftimer†   ÚparentÚmkdir)r  r˜   rá   râ   r  r	  Ú	file_pathr
  r  ÚextÚ	timestamps   &&&&       r   Ú_resolve_output_baser  ;  s�  € ÷ ßVÙ  ×-Ò-Øœð.ó/ð /ð /ô
 ×%Ñ% k×2Ò2ØœØOóQð Qð Qá" ;×/Ò/ØœØAÀ+Àð O^ð ^ó_ð _ð _ô ˜Ó%×0Ñ0Ó2ˆ	Ø"Ò.Ü;¸IÓ_ˆIßQÙœ3˜y›>×*Ò*Ñ.HÌÈYË×.XÒ.XØœØMØ�+ÐEðGóHð Hð Hð /Yð
 #Ò.Ü0Ð1HÓI‰Cç$¨Ô5KÔ)K‘%ÐQVˆCÜ×%Ñ%×)Ñ)Ó+×4Ñ4Ð5GÓHˆ	ÜÔ,Ó.Ó/°D¸¸À1ÀSÀEÐ2JÕJˆ	Ø×Ñ×Ñ 4°$ÐÔ7Ø�dˆ?Ðr   c                óR   € V ^8„  d   QhR\         \        ,          R\        R\        /# )r   ÚpathsÚvoice_compatibler   )Úlistr   r`   )r   s   "r   r   r   e  s*   € ÷ Qñ Q”dœ3•ið Q´4ð Q¼Cñ Qr   c                óP   € RP                  R V  4       4      pV'       d   RV 2# T# )z_``MEDIA:<path>`` lines; the ``[[audio_as_voice]]`` marker asks the platform for a voice bubble.Ú
c              3   ó,   "  € T F
  pR V 2x € K  	  R# 5i)zMEDIA:Nrr   )Ú.0Úpaths   & r   Ú	<genexpr>Ú_media_tag.<locals>.<genexpr>g  s   é € Ð<±e¨d˜F 4 &�/³eùs   ‚z[[audio_as_voice]]
)Újoin)r   r!  Ú	media_tags   && r   Ú
_media_tagr,  e  s+   € à—	‘	Ñ<±eÓ<Ó<€Iß1AÐ! ) Ð-ÐPÀyÐPr   c                óH   € V ^8„  d   QhR\         R\         R\        R\         /# )r   Úprefixr˜   Úexcr   )r   ÚBaseException)r   s   "r   r   r   k  s(   € ÷ 0ñ 0œ#ð 0¬ð 0´=ð 0ÄSñ 0r   c                ó†   € V  RV RV 2p\         P                  RV\        V\        4      '       * R7       \	        VRR7      # )zeLog and wrap a synthesis failure as the standard error envelope (traceback except for config errors).z (ú): z%sr�   F©rµ   )r�   r¶   Ú
isinstanceÚ
ValueErrorÚ
tool_error)r.  r˜   r/  Ú	error_msgs   &&& r   Ú_tool_failurer8  k  sA   € à�(˜"˜X˜J c¨#¨Ð/€IÜ
‡L�L��y¬z¸#¼zÓ/JÔ+J€LÔKÜ�i¨Ô/Ð/r   c                óè   € V ^8„  d   QhR\         R\         R\         R\        \         \        3,          R\        \        \         \        3,          ,          R\        R\        \         ,          R\         /# )	r   r½   r¾   r˜   r–   rá   râ   rÜ   r   )r   r‰   r   r   r`   )r   s   "r   r   r   r  ss   € ÷ .Cñ .CÜ
ð.CÜð.CÜ+.ð.CÜ<@ÄÄcÀ½Nð.Cä%¤d¬3´¨8¥nÕ5ð.CäBFð.CäV^Ô_bÕVcð.Cô 	ñ.Cr   c               óH  €  Ve%   \         P                  RV4       \        WW$V4      pMCV\        9  d   \	        WW#4      ;p e   TpM$\        V4      w  r(V'       d   V# \        W WV4       \        P                  P                  V4      '       d%   \        P                  P                  V4      ^ 8X  d   \        RV R24      # \        V4      p\        WWE4      w  r\         P                  RV\        P                  P                  V4      R V4       \        P                  ! RRR	VR
\!        V.V	4      RVRV	/RR7      #   \"         d   p
\%        RY*4      u Rp
?
# Rp
?
i\&         d   p
\%        RY*4      u Rp
?
# Rp
?
i\(         d   p
\%        RY*4      u Rp
?
# Rp
?
ii ; i)aY  Synthesize one provider-safe chunk into *file_str*; returns the result envelope.

Command providers resolve BEFORE built-in dispatch, but built-in names short-circuit so
``tts.providers.openai.command`` can't shadow OpenAI. Plugins fire only for names that are
neither; a None return falls through to built-in dispatch (unknown -> Edge default).Nz3Generating speech with command TTS provider '%s'...z-TTS generation produced no output (provider: Ú)ú,TTS audio saved: %s (%s bytes, provider: %s)Ú,rµ   Tr  r+  r˜   r!  Fr·   zTTS configuration errorzTTS dependency missingzTTS generation failed)r�   rÓ   r   r   r1   rÙ   rß   Úosr'  ÚexistsÚgetsizer»   r$   rê   r¹   rº   r,  r5  r8  ÚFileNotFoundErrorrD   )r½   r¾   r˜   r–   rá   râ   rÜ   Ú_plugin_pathr¶   r!  r“   s   &&$$$$$    r   Ú_text_to_speech_singlerC  r  s‘  € ð%CØ"Ò.Ü�K‰KÐMÈxÔXÜ,Ø À:óO‰Hð Ô2Ô2Ü8¸ÈÓ^Ð^ˆLØò8ð $‰Hä4°XÓ>‰OˆHßØ�Ü °ÀlÔSÜ�w‰w�~‰~˜h×'Ò'¬2¯7©7¯?©?¸8Ó+DÈÔ+IÜÐ!NÈxÈjÐXYÐZÓ[Ð[ô )¨Ó2ˆÜ%=ØÐ 7ó&DÑ"ˆä�‰ÐBÀHÔQS×QXÑQX×Q`ÑQ`ÐaiÓQjÐklÐPmÐpxÔyÜ�zŠzØ�t˜[¨(°KÄÈXÈJÐXhÓAiØ˜Ð"4Ð6Fð
ð ôð 	øô ô EÜÐ6¸ÓDÕDûÜô DÜÐ5°xÓCÕCûÜô CÜÐ4°hÓBÕBûðCúsa   ‚AE Á 1E Â2E ÃA<E ÅF!ÅEÅF!ÅF!Å+F!Å,E=Å7F!Å=F!Æ
F!ÆFÆF!ÆF!c                   ó   € ] tR tRtRtRtR# )Ú_ChunkFailedi£  zWOne chunk's synthesis returned an error envelope; message is the final tool error text.rr   N)rR   Ú
__module__Ú__qualname__Ú__firstlineno__Ú__doc__Ú__static_attributes__rr   r   r   rE  rE  £  s   † Ýar   rE  c                ó^   € V ^8„  d   QhR\         \        ,          R\        R\        R\        /# )r   ÚchunksÚ	base_pathÚgenerated_artifactsr   )r"  r   r   ÚsetrÏ   )r   s   "r   r   r   §  s.   € ÷ (ñ (œt¤C�yð (´Tð (ÔPSð (Ôinñ (r   c           
     ó˜  € VR,          p. p. p\        V ^R7       EFé  w  rxTp	\        V 4      ^8”  d.   VP                  VP                   RVR VP                   24      p	\
        P                  P                  V	4      '       dK   V	P                  RV	P                   R\        P                  ! 4       P                   V	P                   24      p	VP                  \        V	4      4       \        V\        V	4      3/ VB p
 \        P                  ! V
4      pTP'                  R	4      '       g'   TP'                  R
R4      p\)        RT RT RT 24      h\        TP'                  R4      ;'       g    T	4      p\
        P                  P+                  T4      '       d%   \
        P                  P-                  T4      ^ 8:  d   \%        RT RT 24      hTP                  T4       TP/                  T4       TP/                  T4       EKì  	  WV3#   \        P                   \"        3 d#    \%        RT R\        T
4      R,           24      hi ; i)a  Synthesize chunks into ``<base>.chunkNNN<ext>`` (or ``base`` alone) -> ``(encoded_paths, results)``.

Every touched path lands in *generated_artifacts* for the caller's sweep. Raises
:class:`_ChunkFailed` on a reported failure, ``RuntimeError`` on garbage or missing audio.r˜   )Ústartz.chunkÚ03drP   z
TTS chunk z returned invalid JSON: :NéÈ   Nrµ   r¶   zunknown errorz	 failed (r2  r  z produced no final audio: )Ú	enumerateÚlenÚ	with_nameÚstemÚsuffixr>  r'  ÚlexistsÚuuidÚuuid4Úhexrñ   r   rC  r¹   ÚloadsÚJSONDecodeErrorÚ	TypeErrorrÊ   rG   rE  Úisfiler@  Úappend)rL  rM  rN  Úsingle_kwargsr˜   Úencoded_pathsÚchunk_resultsÚindexÚchunkÚ
chunk_pathÚ
raw_resultÚchunk_resultr7  Úactual_paths   &&&,          r   Ú_synthesize_chunksrk  §  s  € ð
 ˜ZÕ(€HØ!€MØ*,€MÜ! &°×2Ð2‰ˆØˆ
Üˆv‹;˜Œ?Ø"×,Ñ,°	·±Ð/?¸vÀeÈCÀ[ÐQZ×QaÑQaÐPbÐ-cÓdˆJÜ�7‰7�?‰?˜:×&Ò&ð $×-Ñ-°°*·/±/Ð1BÀ!ÄDÇJÂJÃL×DTÑDTÐCUÐV`×VgÑVgÐUhÐ.iÓjˆJØ×Ñ¤ J£Ô0Ü+¨E´3°z³?ÑTÀmÑTˆ
ð	dÜŸ:š: jÓ1ˆLð ×Ñ 	×*Ò*Ø$×(Ñ(¨°/ÓBˆIÜ ¨E¨7°)¸H¸:ÀSÈÈÐTÓUÐUÜ˜,×*Ñ*¨;Ó7×EÐE¸:ÓFˆÜ�w‰w�~‰~˜k×*Ò*¬b¯g©g¯o©o¸kÓ.JÈaÔ.OÜ ¨E¨7Ð2LÈ[ÈMÐZÓ[Ð[Ø×Ñ Ô,Ø×Ñ˜[Ô)Ø×Ñ˜\×*ñ- 3ð. Ð'Ð'øô ×$Ñ$¤iÐ0ô 	dÜ ¨E¨7Ð2JÌ3ÈzË?Ð[_ÕK`ÐJaÐbÓcÐcð	dús   Ä HÈ=I	c                ó¸   € V ^8„  d   QhR\         R\        \         ,          R\        \        ,          R\        \         ,          R\        \         ,          R\         /# )r   r½   r  rõ   rÜ   r˜   r   )r   r   rö   )r   s   "r   r   r   É  sT   € ÷ A*ñ A*Ü
ðA*Ü$¤S�MðA*Ü9AÄ%½ðA*äœ3•-ðA*ä2:¼3µ-ðA*äKNñA*r   c                ó„
  € V '       d   V P                  4       '       g   \        RRR7      #  ^ RIHp V! V RR7      p V '       g   \        RRR7      # \        \        4       W$4      w  rd\        WF4      p\        WF4      p\        W4      p	V	'       g   \        RRR7      # \        V	4      ^8”  d,   \        P                  RV\        V	4      \        V 4      V4       \        4       w  r«\        W¦4      p\        WW{4      w  rÞV'       d   V# \!        4       p. p \#        W�WôVW{VR	7      w  pp\%        V4      ;'       d5    \&        ;QJ d    R
 V 4       F  '       d   K   RM	  RM! R
 V 4       4      pVP)                  \+        V^ ,          4      P,                  4      p\/        V\1        V4      VVR7      w  ppV F:  p\        P                  RV\2        P4                  P7                  V4      R V4       K<  	  \8        P:                  ! RRRV^ ,          RVR\=        VV4      RV^ ,          P?                  RV4      RVR\        V	4      R\        V4      R\%        V4      RRVP@                  RVPB                  RVPD                  //
RR7      V Uu0 uF"  p\2        P4                  PG                  V4      kK$  	  ppV F4  p\2        P4                  PG                  V4      V9  g   K)  \I        V4       K6  	  #   \         d    T P                  4       p  ELÑi ; iu upi   \J         d�   p\        \1        T4      RR7      u Rp?T Uu0 uF"  p\2        P4                  PG                  T4      kK$  	  Mu upi ppT F4  p\2        P4                  PG                  T4      T9  g   K)  \I        T4       K6  	  # Rp?i\L         d†   p\O        RTT4      u Rp?T Uu0 uF"  p\2        P4                  PG                  T4      kK$  	  Mu upi ppT F4  p\2        P4                  PG                  T4      T9  g   K)  \I        T4       K6  	  # Rp?i\         d†   p\O        RTT4      u Rp?T Uu0 uF"  p\2        P4                  PG                  T4      kK$  	  Mu upi ppT F4  p\2        P4                  PG                  T4      T9  g   K)  \I        T4       K6  	  # Rp?ii ; i  T Uu0 uF"  p\2        P4                  PG                  T4      kK$  	  Mu upi ppT F4  p\2        P4                  PG                  T4      T9  g   K)  \I        T4       K6  	  i ; i)aJ  Convert text to speech with long-form chunking; returns the JSON result envelope.

Text is normalized, split into provider-safe chunks (never silently truncated), synthesized
sequentially, then packed against the platform's upload limit: a failed combine keeps the
separate valid files and no over-limit artifact is ever returned.zText is requiredFr3  )Úprepare_spoken_textN)Ú	max_charszText is empty after TTS cleanupzFTTS text for provider %s split into %d chunks (input=%d chars, cap=%d))r˜   r–   rá   râ   rÜ   c              3   óV   "  € T F  p\        VP                  R 4      4      x € K!  	  R# 5i)r!  N)r`   rG   )r&  Úrs   & r   r(  Ú&text_to_speech_tool.<locals>.<genexpr>ð  s%   é € Ð6nÑ`mÐ[\´t¸A¿E¹EÐBTÓ<U×7VÐ7VÓ`mùs   ‚')T)r!  r<  r=  rµ   r  Ú
file_pathsr+  r˜   r!  Úchunk_countÚdelivery_file_countÚcombined_chunksÚdelivery_profiler  Úmax_file_bytesÚtarget_file_bytesr·   zTTS delivery errorzTTS long-form generation failed)(r›   r6  Útools.tts_text_normalizern  rD   rû   r”   r   r    r&   rU  r�   rÓ   r  r%   r  rO  rk  r`   ÚallÚwith_suffixr   rX  r!   r   r>  r'  r@  r¹   rº   r,  rG   r  rx  ry  Úabspathr#   rE  r5  r8  )r½   r  rõ   rÜ   r˜   rn  r–   rá   Úmax_lenrL  r  râ   rw  rM  r¶   rN  Úfinal_pathsrc  rd  r!  Údelivery_baserv  r'  Úfinal_absoluteÚartifactr/  s   &&&&&                     r   Útext_to_speech_toolrƒ  É  sZ  € ÷ �t—z‘z—|’|ÜÐ,°eÔ<Ð<ðÝ@Ù" 4°4Ô8ˆ÷ ÜÐ;ÀUÔKÐKÜ0Ô1AÓ1CÀUÓUÑ€JÜ>¸xÓTÐÜ& xÓ<€GÜ  Ó/€FßÜÐ,°eÔ<Ð<Ü
ˆ6ƒ{�Q„Ü�‰Ð\Øœc &›k¬3¨t«9°gô	?ä+Ó-Ñ€HÜ6°xÓLÐÜ+ØÐ6óCÑ€IçØˆÜ$'£EÐØ€Kð*Ü'9ØÐ2ÐR\Ø$;Ø%ô('Ñ$ˆ�}ô   Ó.×nÐn·3³3Ñ6nÑ`mÓ6n·3·3²3Ñ6nÑ`mÓ6nÓ3nÐØ!×-Ñ-¬d°=ÀÕ3CÓ.D×.KÑ.KÓLˆÜ'BØœ3˜}Ó-Ð/?ÐRbô(dÑ$ˆ�_ãˆDÜ�K‰KÐFÈÔQS×QXÑQX×Q`ÑQ`ÐaeÓQfÐghÐPiÐltÖuñ  ä�zŠzØ�t˜[¨+°a­.¸,ÈØœ KÐ1AÓBØ˜ aÕ(×,Ñ,¨Z¸ÓBÐDVÐXhØœ3˜v›;Ð(=¼sÀ;Ó?OØœt OÓ4ØØÐ,×5Ñ5Ð7GÐIY×IhÑIhØ#Ð%5×%GÑ%Gð!Ið	
ð ô	ñ" =HÓH¹K°Dœ"Ÿ'™'Ÿ/™/¨$Ö/¹KˆÐHÛ+ˆHÜ�w‰w�‰˜xÓ(°Ö>Ü Ö)ò ,øôe ô Ø�z‰z‹|‹ðüòb Iøô ô 3Üœ#˜c›(¨EÔ2Ô2ñ =HÓH¹K°Dœ"Ÿ'™'Ÿ/™/¨$Ö/ºKùÒHˆÐHÛ+ˆHÜ�w‰w�‰˜xÓ(°Ö>Ü Ö)ò ,ûô ô BÜÐ1°8¸SÓAÔAñ =HÓH¹K°Dœ"Ÿ'™'Ÿ/™/¨$Ö/ºKùÒHˆÐHÛ+ˆHÜ�w‰w�‰˜xÓ(°Ö>Ü Ö)ò ,ûô	 ô OÜÐ>ÀÈ#ÓNÔNá<GÓH¹K°Dœ"Ÿ'™'Ÿ/™/¨$Ö/ºKùÒHˆÐHÛ+ˆHÜ�w‰w�‰˜xÓ(°Ö>Ü Ö)ò ,ûð	Oûñ =HÓH¹K°Dœ"Ÿ'™'Ÿ/™/¨$Ö/ºKùÒHˆÐHÛ+ˆHÜ�w‰w�‰˜xÓ(°Ö>Ü Ö)ò ,ús´   ­K0 Ä0L ÅL ÅD-L Ê(LË0LÌLÌSÌ"N+Ì7SÌ8S Í (M)Î+SÎ8SÎ9P9ÏSÏS Ï(O7Ð9SÑSÑSÑSÑS Ñ(RÓSÓS ÓT?Ó(S=Ó<.T?Ô/T?c                ó$   € V ^8„  d   QhR\         /# rm   rn   )r   s   "r   r   r     s   € ÷ ñ œtñ r   c                  óR   €  \        \        4       4       R #   \         d     R# i ; irb   )r-   r”   r5  rr   r   r   Ú_minimax_requirementsr†    s(   € ðÜ$Ô%5Ó%7Ô8ÙøÜô Úðús   ‚ —&¥&c                ó$   € V ^8„  d   QhR\         /# rm   rn   )r   s   "r   r   r     s   € ÷ ñ œ4ñ r   c                  óv   €  ^ RI Hp  \        V ! RR7      P                  R4      4      #   \         d     R# i ; i)r@   ©Úresolve_xai_http_credentialsT)Úprefer_api_keyÚapi_keyF)Útools.xai_httprŠ  r`   rG   rD   r‰  s    r   Ú_xai_requirementsrŽ    s:   € ðÝ?ô Ñ0ÀÔE×IÑIÈ)ÓTÓUÐUøÜô Úðús   ‚&) ©8·8c                  ó<   € \        R 4      ;'       g    \        4       # )r7   )Ú_pm_extra_availablers   rr   r   r   r¤   r¤   *  s   € Ô'¨
Ó3×PÐPÔ7NÓ7PÐPr   c                  óR   € \        R 4      ;'       d    \        \        RR4      4      # )r8   ÚELEVENLABS_API_KEYr�   ©r�  r`   r   rr   r   r   r¤   r¤   +  s1   € Ô-¨mÓ<÷  Að  AÄÔF[Ð\pÐr~ÓFó  BAð  Ar   c                  ó<   € \        R 4      ;'       d    \        4       # )rV   )rk   r6   rr   r   r   r¤   r¤   ,  s   € Ô(¨Ó2×RÐRÔ7PÓ7RÐRr   c                  óR   € \        R 4      ;'       d    \        \        RR4      4      # )rV   ÚDEEPINFRA_API_KEYr¨   )rk   r`   r   rr   r   r   r¤   r¤   -  s$   € Ô+¨HÓ5×wÐw¼$Ô?TÐUhÐjuÓ?vÓ:wÐwr   c                  óT   € \        \        R R4      ;'       g    \        RR4      4      # )ÚGEMINI_API_KEYrž   ÚGOOGLE_API_KEY)r`   r   rr   r   r   r¤   r¤   0  s5   € ”dÔ0Ð1AÀ8ÓL÷  Bð  BÔPeÐfvð  yAó  QBô  Cr   c                  óR   € \        R 4      ;'       d    \        \        RR 4      4      # )r9   ÚMISTRAL_API_KEYr“  rr   r   r   r¤   r¤   1  s$   € Ô*¨9Ó5×sÐs¼$Ô?TÐUfÐhqÓ?rÓ:sÐsr   c                  ó   € \        4       # r¢   r­   rr   r   r   r¤   r¤   2  s   € Ô-Ô/r   c                  ó   € \        4       # r¢   )rv   rr   r   r   r¤   r¤   3  s   € Ô3Ô5r   c                  ó   € \        4       # r¢   )ry   rr   r   r   r¤   r¤   4  s   € Ô+Ô-r   c                ó0   € V ^8„  d   QhR\         R\        /# )r   Úextrar   rg   )r   s   "r   r   r   7  s   € ÷ "ñ "œsð "¤tñ "r   c                óV   €  ^ RI Hp \        T! T 4      4      #   \         d     R# i ; i)u#  Whether the extra's anchor is importable, by pm's own answer for it.

Not ``find_spec`` on a hand-written module name: ``pm.extras`` owns the extraâ†’anchor table and
counts a module already in ``sys.modules`` as installed, which is how every other feature in
the tree reports availability.
)rÕ   F)Ú	pm.extrasrÕ   rD   r`   )r   rÕ   s   & r   r�  r�  7  s0   € ðÝ'ô ‘	˜%Ó Ó!Ð!øô ô Úðús   ‚ ™(§(r’  r›  c                ó0   € V ^8„  d   QhR\         R\        /# rÎ   rg   )r   s   "r   r   r   O  s   € ÷ Fñ F¬Sð F´Tñ Fr   c                ó&  € V \         9  d   R# \        P                  RV  24      pVf   R# \         V ,          pV'       d   \        W 4      '       g   R#  ^ RIHp ^ RIHp T! T4      ;'       d    \        T! 4       4      #   \         d     R# i ; i)zÇTrue when the SDK is absent but pm may install it at first synthesis AND this machine
could actually get it (platform gate open) AND the provider's own credential is present.
Installs nothing itself.Fztts.)Úlazy_installs_allowed)Úextra_supported)
Ú_SDK_ON_DEMANDrF   rG   r   Ú
pm.installr¥  r¢  r¦  rD   r`   )r˜   r=   Úkey_envr¥  r¦  s   &    r   Ú_ready_after_first_use_installrª  O  s†   € ð ”~Ô%ÙÜ!×%Ñ%¨¨X¨JÐ&7Ó8€GØ‚ÙÜ˜XÕ&€GßÔ,¨W×?Ò?ÙðÝ4Ý-ñ ˜7Ó#×EÐE¬Ñ-BÓ-DÓ(EÐEøô ô Úðús   ÁB ÂBÂBc                ó$   € V ^8„  d   QhR\         /# rm   rn   )r   s   "r   r   r   c  s   € ÷ 3ñ 3¤ñ 3r   c                 óØ   € \        4       p \        V 4      p\        W4      e   R# \        P	                  V4      pVe$   \        V! 4       4      ;'       g    \        V4      # \        V4      # )uí   Return whether the explicitly resolved TTS provider can run â€” now, or after the
first-use SDK install that synthesis performs. This is the ``text_to_speech`` tool's
``check_fn``, so it runs on every tool listing and must never install.T)r”   rœ   r   Ú_BUILTIN_REQUIREMENTSrG   r`   rª  r2   )r–   r˜   Úchecks      r   Úcheck_tts_requirementsr¯  c  s_   € ô "Ó#€JÜ˜ZÓ(€HÜ'¨Ó=ÒIÙÜ!×%Ñ% hÓ/€EØÒÜ‘E“G‹}×HÐHÔ >¸xÓ HÐHÜ(¨Ó2Ð2r   )Úregistryr6  c                ó0   € V ^8„  d   QhR\         R\         /# )r   Úhomer   r   )r   s   "r   r   r   t  s   € ÷ jñ j¤3ð j¬3ñ jr   c                 ó   € R V  R2# )z9Optional custom file path to save the audio. Defaults to z/audio_cache/<timestamp>.mp3rr   )r²  s   &r   Ú_output_path_descriptionr´  t  s   € ØFÀtÀfÐLhÐiÐir   c                ó$   € V ^8„  d   QhR\         /# rm   )r‰   )r   s   "r   r   r   x  s   € ÷ "ñ "œtñ "r   c                 ó”   € \         P                  ! \        R,          4      p \        \	        4       4      V R,          R,          R&   RV /# )zùRebuild the ``output_path`` default hint from the ACTIVE profile at every get_definitions():
the multiplexed gateway serves every profile from one process, so a path baked in at import
would name the launch profile's home for everyone else (#95685).Ú
parametersÚ
propertiesr  Údescription)ÚcopyÚdeepcopyÚ
TTS_SCHEMAr´  r	   )Úparamss    r   Ú_tts_schema_overridesr¾  x  s?   € ô �]Š]œ: lÕ3Ó4€FÜ9QÔReÓRgÓ9h€Fˆ<Õ˜Õ'¨Ñ6Ø˜&Ð!Ð!r   rf   Útext_to_speechr¹  aŠ  Convert text to speech audio. Returns a MEDIA: path that the platform delivers as native audio. Compatible providers render as a voice bubble on Telegram; otherwise audio is sent as a regular attachment. In CLI mode, saves to ~/voice-memos/. Voice and provider are user-configured (built-in providers like edge/openai or custom command providers under tts.providers.<name>), not model-selected.r·  ÚtypeÚobjectr¸  r½   ÚstringzóThe text to convert to speech. Provider-specific per-request character caps apply automatically (OpenAI 4096, xAI 15000, MiniMax 10000, ElevenLabs 5k-40k depending on model); longer input is split into ordered chunks without silent truncation.r  zthe profile HERMES_HOMErõ   Únumberz™Playback speed multiplier. 1.0 = normal, 0.5 = very slow (language learning), 2.0 = fast. Range: 0.25-4.0. Overrides the speed configured in config.yaml.rÜ   a  Optional voice-design guidance: tone, emotion, pacing, accent, whispering, impressions (e.g. 'Speak in a cheerful, excited whisper'). Forwarded to the OpenAI backend (gpt-4o-mini-tts and OpenAI-compatible voice-design servers). Silently ignored by backends that don't support it.ÚrequiredrŒ   c                 ó„   € \        RR V P                  R R4      /R Uu/ uF  q"V P                  V4      bK  	  upB # u upi )r½   r   rr   )r  rõ   rÜ   )rƒ  rG   )ÚargsÚkwÚks   &, r   r¤   r¤   ¥  sF   € Ô2ñ  NØ�X‰X�f˜bÓ!ð Ná#KÓ
LÑ#K˜aˆd�h‰h�q‹kŠ>Ñ#KÑ
Lò Nùâ
Ls   ž=u   ðŸ”Š)rf   ÚtoolsetÚschemaÚhandlerÚcheck_fnÚemojiÚdynamic_schema_overridesc                óN  € V ^8„  d   Qh/ ^ \         9   d   \        \        \        3,          ;R&   ^\         9   d
   \        ;R&   ^\         9   d(   \        \        \
        . \        3,          3,          ;R&   ^\         9   d&   \        \        \        \        ,          3,          ;R&   # )r   rÑ   rð   r­  r§  )Ú__conditional_annotations__r‰   r   rÏ   rO  r   r`   r   )r   s   "r   r   r      s•   € ÷ ñ ÷RAò A”4œœU˜
Õ#ñ AñS÷X Ò ”Ñ ñY÷N/ò /”tœC¤¨"¬d¨(Õ!3Ð3Õ4ñ /ñO÷N"ò "””Sœ(¤3�-Ð'Õ(ñ "òOr   )NN>   ÚfeishuÚmatrixÚsignalÚtelegramÚwhatsapp>   rž   rV   r9   r�   >   r    rz   r\   rp   rŸ   rZ   )NzMiniMax TTSr*   N)NzxAI TTSr,   N)NzGoogle Gemini TTSr)   N)NNNN)�rÐ  rI  rE   r   rÁ   rB   r  Úimportlib.utilrH   r¹   Úloggingr>  ÚreÚtempfilerZ  Úpathlibr   Útypingr   r   r   r   r   rº  r€   r	   Ú	getLoggerrR   r�   r   Útools.tts_command_providerr   r   r   r   r   r   r   r   Útools.tts_tool_deliveryr    r!   r"   r#   r$   r%   r&   Útools.tts_tool_providersr'   r(   r)   r*   r+   r,   r-   Útools.tts_tool_localr.   r/   r0   Útools.tts_tool_pluginsr1   r2   r3   Útools.tts_tool_openair4   r5   r6   rF   rS   rÒ   r£   r§   r«   Ú_import_sounddevicer¯   r±   rd   rk   rs   rv   ry   r™   r�   r„   r…   r†   r”   rœ   Ú	frozensetr  ÚcompileÚ
IGNORECASEr  ræ   rä   rÑ   r»   rÌ   rÙ   rß   rê   rO  rð   ró   rû   r  r  r,  r8  rC  rD   rE  rk  rƒ  r†  rŽ  r­  r�  r§  rª  r¯  Útools.registryr°  r6  r´  r¾  r¼  Úregisterr   )rÐ  s   @r   Ú<module>ré     sH  øðöõ Û Û Û Û Û Û Û 	Û 	Û Û Ý ß 6Õ 6ã å 0à	×	Ò	˜8Ó	$€õ9÷h÷ hõ =÷Q÷ Qñ Q÷L÷ Lñ L÷ \Ñ [÷*ñ *÷ kÑ jð " :Ð/?ÀÐP]Ð_hÐiÐ ÷ñ" ! °ZÔ@Ð Ù"Ð#6¸ÐN^Ô_Ð Ù% h°Ó9Ð Ù&Ð'9¸9ÈmÔ\Ð Ù# MÓ2Ð Ù! +¨{Ó;Ð Ù˜g |Ó4€õõõ KÝ PÝ Hð Ð õ=ñ
 6MÓ5NÐ NÐ Ð2õ%õ"	õGñ !Ò!WÓXÐ ð —j’jÐ!PÐRT×R_ÑR_Ó`Ð ñ #Ò#PÓQÐ Ù"Ò#]Ó^Ð ð Ñ:¸LÐJ`Ø_Ù" =Ó1Ð2ð4ð5ð Ñ9¸<ÐI_ØMðOàÑ<¸oÐOhØOðQàÐCØ	Ð7ØÑ;Ð=RÐTkðAðBð ÐGØÑ0Ð2BÐDVðUðVð Ñ8Ð:TÐVkðAðBð Ñ0°/ÐCXð?ð@ð)'AÐ ó Aõ2PõõLõ$	8õ/ñ: “e€Ó õõ$+õ"6õ'õTQõ0õ.Côbb�9ô bõ(÷DA*õJõð( ÑPØñ  AØÑRØÑwØÐ$Ø	ÐØñ  CØÑsØÑ/ØÑ5ØÑ-ð8/Ð ó /õ"ð& ˆDØÐ&ØÐ ð,"€ó "õFõ(3÷ 0õjõ"ð ÐØð  `ØØ�ØØØ˜Øð   Uðð Ø˜ØÑ7Ð8QÓRðð Ø˜Øð   {ðð Ø˜Øðaðð
ð. 	�V�Hð3ð€
ð@ 	× Ò Ø	ØØñNð $Ø
Ø2÷	4r   