+
    iHàj™  ã                  óh   € R t ^ RIHt ^ RIt^ RIHt RtRtRtR R lt	]3RR/R	 R
 lllt
R R ltR# )u  Route bulk request payloads around the OpenAI SDK's request transform (#93650).

``responses.create`` and ``chat.completions.create`` both re-walk the whole request
body against their TypedDict/union param graph client-side, with the GIL held,
before any byte leaves the process. #93650 documents that walk wedging for 12+
hours on a ~1.4 MB conversation â€” starving the TTFB/stale watchdogs whose job is
to rescue this exact call; the hang is pre-network, so no socket kill helps.

Hermes assembles these payloads from JSON round-trips, so they are already wire
format and the walk has nothing to convert. The SDK merges ``extra_body`` into
the JSON body *after* the transform (``_base_client._build_request``), so moving
the bulk fields there skips the walk and yields the same request bytes.
)ÚannotationsN)ÚAnyÚHERMES_CODEX_SDK_TRANSFORMc               ó    € V ^8„  d   QhRRRR/# )é   Úvaluer   ÚreturnÚbool© )Úformats   "Ú?/home/ubuntu/.hermes/hermes-agent/agent/sdk_transform_bypass.pyÚ__annotate__r      s   € ÷ ñ ˜sð  tñ ó    c                ó¾  € V e'   \        V \        \        \        \        34      '       d   R# \        V \
        4      '       dQ   \        ;QJ d*    R V P                  4        4       F  '       d   K   R# 	  R# ! R V P                  4        4       4      # \        V \        4      '       d5   \        ;QJ d    R V  4       F  '       d   K   R# 	  R# ! R V  4       4      # R# )ziTrue when ``value`` is purely JSON wire types; pydantic models / generators must keep the typed SDK path.Tc              3  ól   "  € T F*  w  r\        V\        4      ;'       d    \        V4      x € K,  	  R # 5i©N)Ú
isinstanceÚstrÚ_is_plain_json_data)Ú.0ÚkeyÚitems   &  r   Ú	<genexpr>Ú&_is_plain_json_data.<locals>.<genexpr>"   s,   é € ÐeÑWdÉ)È#”:˜c¤3Ó'×EÐEÔ,?ÀÓ,EÔEÓWdùs   ‚4 4Fc              3  ó8   "  € T F  p\        V4      x € K  	  R # 5ir   )r   )r   r   s   & r   r   r   $   s   é € Ð?¹°Ô& t×,Ð,»ùs   ‚)	r   r   ÚintÚfloatr	   ÚdictÚallÚitemsÚlist)r   s   &r   r   r      s¢   € à‚}œ
 5¬3´´U¼DÐ*A×BÒBÙÜ�%œ×Òß‹sÑeÐW\×WbÑWbÔWdÓe�sŒsÐeŠsÐeˆsÑeÐW\×WbÑWbÔWdÓeÓeÐeÜ�%œ×Òß‹sÑ?¹Ó?�sŒsÐ?ŠsÐ?ˆsÑ?¹Ó?Ó?Ð?Ùr   Ú
keep_slotsFc               ó(   € V ^8„  d   QhRRRRRRRR/# )r   Úrequest_kwargsr   Úfieldsztuple[str, ...]r!   r	   r   r
   )r   s   "r   r   r   (   s0   € ÷ ñ Øðàðð ð	ð
 
ñr   c               óà  € \         P                  P                  \        R4      P	                  4       P                  4       R9   d   V # V Uu/ uFR  p\        V P                  V4      \        \        34      '       g   K0  \        W,          4      '       g   KI  W0V,          bKT  	  ppV'       g   V # V P                  4        UUu/ uF*  w  rVV'       g	   WT9  g   K  YUV9   d   V'       d   . MTMTbK,  	  pppVP                  R4      p\        V\        4      '       d   \        V4      M/ p	/ V	CVP                  4        UU
u/ uF  w  r:W99  g   K  W:bK  	  up
pCVR&   V# u upi u uppi u up
pi )u¾  Move wire-format bulk ``fields`` into ``extra_body``.

Returns ``request_kwargs`` itself when nothing is safe to move, so callers use
the result unconditionally. ``keep_slots`` leaves an empty-list placeholder in
the typed kwargs for each moved field: it satisfies ``@required_args``
(``messages`` on chat.completions) and keeps the field's position in the JSON
body, so the bytes â€” and therefore any byte-keyed prompt cache â€” are unchanged.
Ú Ú
extra_body>   Ú1ÚonÚyesÚtrue)ÚosÚenvironÚgetÚESCAPE_HATCH_ENVÚstripÚlowerr   r   r    r   r   )r#   r$   r!   ÚfÚmovedr   r   Úbypassedr'   ÚmergedÚvs   &&$        r   Úbypass_sdk_request_transformr7   (   sE  € ô 
‡z�z‡~�~Ô&¨Ó+×1Ñ1Ó3×9Ñ9Ó;Ð?YÔYØÐÙ+1ó l©6 aÜ˜>×-Ñ-¨aÓ0´4¼°,×?ô "ÜDWÐXfÕXi×Djô "ˆQ˜qÕ!Ò!©6€Eð lçØÐà"0×"6Ñ"6Ô"8ô\Ù"8‘J�C¿JÈ#ÑJZô N�¸U´lŸJ‘b©EÈÒMÙ"8ð ñ \à—‘˜lÓ+€JÜ!+¨J¼×!=Ò!=ŒT�*ÔÀ2€Fà^ Ð^¸E¿K¹K¼MÔ*]¹M±D°AÈQÉ_¬4¨1ª4¹MÒ*]Ð^€Hˆ\ÑØ€Oùòlùó\ùó
 +^s0   Á-EÁ>EÂEÃE$ÃE$Ã)
E$Å 
E*ÅE*c               ó$   € V ^8„  d   QhRRRRRR/# )r   r#   r   Úclientr   r   r
   )r   s   "r   r   r   E   s&   € ÷ iñ i°dð iÀCð iÈDñ ir   c                ó¶   € \        \        VRR4      RR4      pVe+   \        V4      P                  P                  R4      '       g   V # \	        V \
        RR7      # )aX  Chat-completions bypass, gated on the real OpenAI SDK.

Only the SDK performs the transform and only the SDK merges ``extra_body``
afterwards. Hermes also drives chat-shaped facades that are NOT the SDK (the
in-process MoA aggregator, test stand-ins); handing those an ``extra_body`` they
never merge would silently send an empty conversation.
ÚchatNÚcompletionszopenai.T)r!   )ÚgetattrÚtypeÚ
__module__Ú
startswithr7   ÚCHAT_COMPLETIONS_BYPASS_FIELDS)r#   r9   r<   s   && r   Ú!bypass_chat_sdk_request_transformrB   E   sS   € ô œ' &¨&°$Ó7¸ÈÓM€KØÒ¤$ {Ó"3×">Ñ">×"IÑ"IÈ)×"TÒ"TØÐÜ'¨Ô8VÐcgÔhÐhr   )ÚinputÚtools)ÚmessagesrD   )Ú__doc__Ú
__future__r   r,   Útypingr   ÚRESPONSES_BYPASS_FIELDSrA   r/   r   r7   rB   r
   r   r   Ú<module>rJ      sO   ðñõ #ã 	Ý ð -Ð Ø!6Ð ð 0Ð õð 6ñð ÷	ð ÷:ir   