+
    lHàjŸ  ã                  ó  € R t ^ RIHt ^ RIt^ RIt^ RIt^ RIHtHt ^ RI	H
t ]P                  ! R4      tRtRtRt]P"                  ! R	R
4      t]P"                  ! RR4      t]P"                  ! RR4      t]P"                  ! RR4      tRtRtRtRtRtR;t]P"                  ! RR4      t]P"                  ! RR4      t]P"                  ! RR4      t]P"                  ! RR4      t0 R<mt 0 R=mt!R>t"R. R?ORRR.R . R@OR!RR".R#R$R%.R&RR'./t#R&R(/t$]%! ]#R ,          4      t&]%! ]#R,          4      t']%! R)04      t(]%! 0 RAm4      t)]%! ])RR*0,
          4      t*R+ R, lt+ ! R- R.],4      t-R/ R0 lt.R1 R2 lt/R3 R4 lt0R5 R6 lt1R7 R8 lt2]33R9 R: llt4R# )BzOConstants, result envelopes and tiny config readers shared by every STT module.)ÚannotationsN)ÚAnyÚDict)Ú_get_provider_sectionztools.transcription_toolsÚlocalÚbaseÚenÚSTT_OPENAI_MODELú	whisper-1ÚSTT_GROQ_MODELzwhisper-large-v3-turboÚSTT_MISTRAL_MODELzvoxtral-mini-latestÚSTT_ELEVENLABS_MODELÚ	scribe_v2g      N@ÚSTT_XAI_MODELzgrok-sttÚHERMES_LOCAL_STT_COMMANDÚHERMES_LOCAL_STT_LANGUAGEÚGROQ_BASE_URLzhttps://api.groq.com/openai/v1ÚSTT_OPENAI_BASE_URLzhttps://api.openai.com/v1ÚXAI_STT_BASE_URLzhttps://api.x.ai/v1ÚELEVENLABS_STT_BASE_URLzhttps://api.elevenlabs.io/v1Úgroqzwhisper-large-v3ÚopenaiÚmistralzvoxtral-mini-2602Úxaizgrok-voice-transcribe-2.0zgrok-voice-transcribe-1.0Ú
elevenlabsÚ	scribe_v1Úmodel_idzdistil-whisper-large-v3-enÚlocal_commandc               ó$   € V ^8„  d   QhRRRRRR/# )é   ÚerrorÚstrÚextrar   Úreturnúdict[str, Any]© )Úformats   "Ú?/home/ubuntu/.hermes/hermes-agent/tools/transcription_common.pyÚ__annotate__r(   J   s&   € ÷ Iñ I˜ð I sð I¨~ñ Ió    c                ó   € RRRRRV /VC# )zAStandard failure envelope shared by every provider and validator.ÚsuccessFÚ
transcriptÚ r    r%   )r    r"   s   &,r'   Ú_error_resultr.   J   s   € à�u˜l¨B°¸ÐHÀ%ÐHÐHr)   c                  ó   € ] tR t^OtRtRtR# )ÚSTTResponseErrora  A provider answered with a structured object carrying no transcript text.

Raised by ``_extract_transcript_text`` when an SDK object or JSON body reports an
``error`` (or neither ``text`` nor ``error``) instead of a usable transcript. The
message is the provider's own, so the STT failure paths surface it verbatim rather
than stringifying the response object into its repr (#78098).r%   N)Ú__name__Ú
__module__Ú__qualname__Ú__firstlineno__Ú__doc__Ú__static_attributes__r%   r)   r'   r0   r0   O   s   † õEr)   r0   c               ó    € V ^8„  d   QhRRRR/# )r   Úmodelr   r#   r!   r%   )r&   s   "r'   r(   r(   X   s   € ÷ ñ  3ð ¨3ñ r)   c                óü   € \        T ;'       g    R4      P                  4       pV'       d   V\        8X  dF   \        P                  ! \
        R4      P                  4       ;'       g    \        R,          ^ ,          # V# )z¡Return a valid xAI STT model: blank or Hermes' old ``grok-stt`` alias -> ``STT_XAI_MODEL`` (read
per call, so a profile's env applies), else the catalog default.r-   r   )r!   ÚstripÚLEGACY_XAI_STT_MODELÚosÚgetenvÚXAI_STT_MODEL_ENVÚSTT_MODEL_CATALOG)r8   Úvalues   & r'   Únormalize_xai_stt_modelrA   X   s\   € ô �—�˜Ó×"Ñ"Ó$€Eß�EÔ1Ô1Ü�yŠyÔ*¨BÓ/×5Ñ5Ó7×VÐVÔ;LÈUÕ;SÐTUÕ;VÐVØ€Lr)   c               ó$   € V ^8„  d   QhRRRRRR/# )r   r,   r!   Úproviderr#   r$   r%   )r&   s   "r'   r(   r(   a   s&   € ÷ Mñ M˜3ð M¨#ð M°.ñ Mr)   c                ó   € R RRV RV/# )r+   Tr,   rC   r%   )r,   rC   s   &&r'   Ú
_ok_resultrE   a   s   € Ø�t˜\¨:°zÀ8ÐLÐLr)   c               ó    € V ^8„  d   QhRRRR/# )r   r"   r!   r#   ÚNoner%   )r&   s   "r'   r(   r(   e   s   € ÷ ñ  ð ¨ñ r)   c                óV   €  ^ RI pVP                  V 4       R#   \         d     R# i ; i)z‚Best-effort ``pm.ensure_import(extra)``; failures are swallowed.
Installs are gated by ``security.allow_lazy_installs`` inside pm.N)ÚpmÚensure_importÚ	Exception)r"   rI   s   & r'   Ú_lazy_ensure_quietlyrL   e   s*   € ðÛØ
×Ñ˜ÖøÜô Úðús   ‚ ™(§(c               ó    € V ^8„  d   QhRRRR/# )r   Úexczsubprocess.CalledProcessErrorr#   r!   r%   )r&   s   "r'   r(   r(   o   s   € ÷ 	ñ 	Ð<ð 	Àñ 	r)   c                ó$  € V P                   V P                  3 Fj  p\        V\        4      '       d#   VP	                  RRR7      P                  4       pM#\        T;'       g    R4      P                  4       pV'       g   Kh  Vu # 	  \        V 4      # )z6stderr > stdout > str(exc) for a failed helper binary.zutf-8Úreplace)Úerrorsr-   )ÚstderrÚstdoutÚ
isinstanceÚbytesÚdecoder:   r!   )rN   ÚoutputÚdetails   &  r'   Ú_process_error_detailrY   o   so   € à—:‘:˜sŸz™zÓ*ˆÜ�fœe×$Ò$Ø—]‘] 7°9�]Ó=×CÑCÓE‰Fä˜Ÿ˜ 2Ó&×,Ñ,Ó.ˆFß‰6ØŠMñ +ô ˆs‹8€Or)   c               ó    € V ^8„  d   QhRRRR/# )r   Úlabelr!   r#   rG   r%   )r&   s   "r'   r(   r(   {   s   € ÷ hñ h 3ð h¨4ñ hr)   c                ó2   € \         P                  R V 4       R# )uL   %s does not support transcription prompts â€” proceeding without the prompt.N)ÚloggerÚdebug)r[   s   &r'   Ú_log_prompt_unsupportedr_   {   s   € Ü
‡L�LÐ_ÐafÖgr)   c               ó    € V ^8„  d   QhRRRR/# )r   Úcfgr$   Úkeyr!   r%   )r&   s   "r'   r(   r(      s   € ÷ ñ ˜ð ¨Sñ r)   c                ód   €  V! V P                  W4      4      #   \        \        3 d    Tu # i ; i)zJRead ``cfg[key]`` through *cast*, falling back to *default* on bad values.)ÚgetÚ	TypeErrorÚ
ValueError)ra   rb   ÚdefaultÚcasts   &&&&r'   Ú_config_numberri      s4   € ðÙ�C—G‘G˜CÓ)Ó*Ð*øÜ”zÐ"ô ØŠðús   ‚ ™/®/)z/opt/homebrew/binz/usr/local/bin>   ú.aacú.cafú.m4aú.mp3ú.mp4ú.ogaú.oggú.wavú.flacú.mpegú.mpgaú.opusú.webm>   ú.aifrq   ú.aiffi  �)r   ÚtinyÚsmallÚmediumzlarge-v3Úturbo)r
   zgpt-4o-mini-transcribezgpt-4o-transcribezgpt-transcribe>   r   r   r   r   r   Ú	deepinfrar   r   )5r5   Ú
__future__r   Úloggingr<   Ú
subprocessÚtypingr   r   Útools.tts_command_providerr   Ú_get_stt_sectionÚ	getLoggerr]   ÚDEFAULT_PROVIDERÚDEFAULT_LOCAL_MODELÚDEFAULT_LOCAL_STT_LANGUAGEr=   ÚDEFAULT_STT_MODELÚDEFAULT_GROQ_STT_MODELÚDEFAULT_MISTRAL_STT_MODELÚDEFAULT_ELEVENLABS_STT_MODELÚDEFAULT_STT_TIMEOUTr>   r;   ÚLOCAL_STT_COMMAND_ENVÚLOCAL_STT_LANGUAGE_ENVÚCOMMON_LOCAL_BIN_DIRSr   ÚOPENAI_BASE_URLr   r   ÚSUPPORTED_FORMATSÚLOCAL_NATIVE_AUDIO_FORMATSÚMAX_FILE_SIZEr?   ÚSTT_MODEL_CONFIG_KEYÚ	frozensetÚOPENAI_MODELSÚGROQ_MODELSÚRETIRED_GROQ_MODELSÚBUILTIN_STT_PROVIDERSÚCLOUD_STT_PROVIDERSr.   rf   r0   rA   rE   rL   rY   r_   Úfloatri   r%   r)   r'   Ú<module>rœ      sü  ðÙ Uå "ã Û 	Û ß å Pð 
×	Ò	Ð6Ó	7€àÐ ØÐ Ø!Ð Ø—I’IÐ0°+Ó>Ð ØŸšÐ#3Ð5MÓNÐ ØŸIšIÐ&9Ð;PÓQÐ Ø!ŸyšyÐ)?ÀÓMÐ ð Ð ð $Ð Ø!Ð Ø2Ð Ø4Ð Ø?Ð à—	’	˜/Ð+KÓL€Ø—)’)Ð1Ð3NÓO€Ø—9’9Ð/Ð1FÓGÐ ØŸ)š)Ð$=Ð?]Ó^Ð ò BÐ Ú6Ð Ø €ð ÒEØ
Ð%Ð'9Ð:ØÒ\ØÐ%Ð':Ð;Ø	Ð'Ð)DÐEØ�; Ð,ð.Ð ð % jÐ1Ð ñ Ð+¨HÕ5Ó6€ÙÐ)¨&Õ1Ó2€ÙÐ!=Ð >Ó?Ð ñ "ò #]ó ^Ð ñ  Ð 5¸À/Ð8RÕ RÓSÐ õIô
E�zô EõõMõõ	õhð AF÷ ñ r)   