§
    ’Rj—  ã                  óN   — U d Z ddlmZ ddlZdadaded<   d
d	„Z e¦   «          dS )aÿ  Best-effort early import for the OpenAI SDK's native streaming parser.

The OpenAI SDK imports ``jiter`` while constructing streaming chat-completion
responses.  On some Windows installs the native extension can be imported
directly from the Hermes venv, but the first import fails when it happens later
inside the threaded streaming request path.  Loading it once during agent
package import avoids that import-order failure while preserving the normal
SDK error path for genuinely missing or broken installs.
é    )ÚannotationsNFzException | NoneÚ_JITER_PRELOAD_ERRORÚreturnÚboolc                 óŒ   — t           rdS 	 t          j        d¦  «         ddlm}  n# t
          $ r}|aY d}~dS d}~ww xY wda dadS )z9Import jiter's native extension early if it is available.Tzjiter.jiterr   )Ú	from_jsonNF)Ú_JITER_PRELOADEDÚ	importlibÚimport_moduleÚjiterr   Ú	Exceptionr   )Ú
_from_jsonÚexcs     ú8/home/ubuntu/.hermes/hermes-agent/agent/jiter_preload.pyÚpreload_jiter_native_extensionr      s   € õ
 ð ØˆtðÝÔ Ñ.Ô.Ð.Ø1Ð1Ð1Ð1Ð1Ð1Ð1øÝð ð ð Ø"ÐØˆuˆuˆuˆuˆuøøøøðøøøð ÐØÐØˆ4s   ‹& ¦
=°8¸=)r   r   )Ú__doc__Ú
__future__r   r
   r	   r   Ú__annotations__r   © ó    r   ú<module>r      sw   ððð ð ð #Ð "Ð "Ð "Ð "Ð "à Ð Ð Ð àÐ Ø)-Ð Ð -Ð -Ð -Ñ -ðð ð ð ð( Ð Ñ  Ô  Ð  Ð  Ð  r   