Ë
    áß²j( ã                  ó”  — U d Z ddlmZ ddlZddlZddlZddlZddlZddlm	Z	 ddl
mZ ddlmZmZmZmZmZmZ ddlmZ ddlmZ dd	lmZ dd
lmZ ddlmZ ddlmZmZ ddl m!Z!m"Z" ddl#m$Z$ ddl%m&Z&m'Z' ddl(m)Z)  ejT                  e+«      Z,dPd„Z-	 	 	 	 	 	 	 	 dQd„Z.dRd„Z/	 	 	 	 	 	 dSd„Z0	 	 	 	 	 	 	 	 dTd„Z1dUd„Z2dVd„Z3dWd„Z4dXd„Z5dYd„Z6dYd„Z7dZd„Z8 e9ddh«      Z:d[d„Z;d\d „Z<d]d!„Z=d^d"„Z>	 	 	 	 	 	 	 	 	 	 d_d#„Z? G d$„ d%e@«      ZAd`d&„ZBd`d'„ZCdRd(„ZD	 	 	 	 	 	 	 	 dad)„ZE	 	 	 	 	 	 	 	 	 	 dbd*„ZFdd+œ	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 dcd,„ZGe G d-„ d.«      «       ZHddd/„ZId\d0„ZJd\d1„ZK	 	 	 	 	 	 	 	 	 	 	 	 ded2„ZLd3ZMd4eNd5<   d\d6„ZO	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 dfd7„ZPdgd8„ZQdRd9„ZRdhd:„ZSdid;„ZT	 	 	 	 	 	 	 	 	 	 	 	 	 	 djd<„ZU	 	 	 	 	 	 	 	 	 	 dkd=„ZVd\d>„ZWdld?„ZX	 dm	 	 	 	 	 	 	 dnd@„ZY	 	 	 	 	 	 	 	 	 	 	 	 	 	 dodA„ZZ	 	 	 	 	 	 	 	 	 	 	 	 dpdB„Z[	 	 	 	 	 	 	 	 	 	 dqdC„Z\	 	 drddddDdEœ	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 dsdF„Z]dtdG„Z^	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 dudH„Z_dIdJdKdLdMdNœZ`dO„ Zay)vaÇ  Per-turn setup for ``run_conversation`` (the turn prologue).

``build_turn_context`` runs the once-per-turn setup (stdio guard, sanitization, prompt
restore-or-build, session row, idle/preflight compaction via ``turn_context_compaction``,
pre_llm_call hook, prefetch, persistence), mutating ``agent`` as the loop expects, and
returns a ``TurnContext`` with only the locals the loop reads back.
``build_api_messages`` builds the wire copy for one API call.é    )ÚannotationsN)Úsuppress)Ú	dataclass)ÚAnyÚDictÚListÚMappingÚOptionalÚTuple)Ú#recover_rotated_compression_session)ÚIterationBudget)Úbuild_memory_context_block)Úis_trivial_prompt©Úflatten_message_text)Úappend_messageÚstamp_message_timestamp)Úestimate_messages_tokens_roughÚestimate_request_tokens_rough)Úbind_image_token_cost)Úanchored_context_tokensÚrestore_usage_anchor)Úparse_turn_authorc                ó$   — t        | |d«      xs dS )uS   ``getattr(agent, name, "") or ""`` â€” route facts read off partial agents/doubles.Ú ©Úgetattr)ÚagentÚnames     ú7/home/ubuntu/.hermes/hermes-agent/agent/turn_context.pyÚ	_str_attrr!   "   s   € ä�5˜$ Ó#Ò) rÐ)ó    c                ól  — t        |t        | dd«      «      }|du| _        |�|S t        | dd«      xs d}	 ddlm}  || ||xs d|¬«      }t        |t        «      rt        |t        «      s|dk\  r|S t        ||xs d|t        | «      ¬«      S # t        $ r t        j                  dd	¬
«       Y Œ>w xY w)z¢Token estimate for automatic preflight compression: a valid provider usage anchor,
    else the checkpoint-pruned native wire payload, else the generic estimator.Ú_usage_anchorNÚtoolsr   )Ú*estimate_native_responses_preflight_tokensr   )Úsystem_promptr%   zRnative Responses preflight estimate unavailable; using generic transcript estimateT©Úexc_info)r'   r%   Úcharge_stale_thinking)r   r   Ú_request_pressure_anchoredÚagent.codex_responses_adapterr&   Ú
isinstanceÚintÚboolÚ	ExceptionÚloggerÚdebugr   Ú_agent_stale_thinking_on_wire)r   Úmessagesr'   Úanchoredr%   r&   Únatives          r    Ú_preflight_request_tokensr7   '   sÓ   € ô
 ' x´¸ÀÐQUÓ1VÓW€HØ'/°tÐ';€EÔ$ØÐØˆÜ�E˜7 DÓ)Ò1¨T€Eð
Ý\á;Ø�8¨=Ò+>¸BÀeô
ˆô �fœcÔ"¬:°f¼dÔ+CÈÐRSÊØˆMô )Ø Ò 3°¸5Ü;¸EÓBôð øô ò 
Ü�‰ð0àð 	ö 	
ð
ús   ·<B Â B3Â2B3c                óL   ‡ — 	 ddl m}  |ˆ fd„dD «       Ž S # t        $ r Y yw xY w)zWhether the active route replays stale thinking text; ``True`` (conservative full
    charge) when route facts are unavailable.r   )Ústale_thinking_reaches_wirec              3  ó6   •K  — | ]  }t        ‰|«      –— Œ y ­w©N)r!   )Ú.0Úkr   s     €r    ú	<genexpr>z0_agent_stale_thinking_on_wire.<locals>.<genexpr>L   s   øè ø€ ÒY aŒi˜˜q×!ÑYùs   ƒ)Úapi_modeÚproviderÚmodelÚbase_urlT)Úagent.message_sanitizationr9   r0   )r   r9   s   ` r    r3   r3   E   s5   ø€ ðÝJá*ÛYÐ+XÔYð
ð 	
øô ò Ùðús   ƒ —	#¢#c                ó|   — | rt        | «      nd}||fD �cg c]  }|sŒ|‘Œ	 }}|rdj                  |«      S dS c c}w )z÷The ephemeral context of one turn (memory prefetch + ``pre_llm_call``) as one text
    block; ``None`` when nothing is injected. The string sidecar appends it to ``content``;
    a multimodal (list) turn carries it as a durable text part (#71998).r   ú

N)r   Újoin)Úext_prefetch_cacheÚplugin_user_contextÚfencedÚpartÚ
injectionss        r    Úcompose_multimodal_context_partrL   R   sN   € ñ @RÔ'Ð(:Ô;ÐWY€FØ$*Ð,?Ð#@ÖI˜4ÂD’$ÐI€JÐIÙ&0ˆ6�;‰;�zÓ"Ð:°dÐ:ùò Js   –9ž9c                óT   — t        | t        «      syt        ||«      }|€dS | dz   |z   S )aB  Compose the API-bound content of the current turn's string user message.

    Single source for the ``api_content`` sidecar and the wire bytes so they never drift
    (what turn N sends is what turn N+1 replays). ``None`` when nothing is injected or the
    content is not a string (list content takes the text-part path).NrE   )r-   ÚstrrL   )ÚcontentrG   rH   Ú	injections       r    Úcompose_user_api_contentrQ   ]   s9   € ô �gœsÔ#ØÜ/Ð0BÐDWÓX€IØÐ$ˆ4ÐF¨'°FÑ*:¸YÑ*FÐFr"   c                ó~   — | j                  dd«      }t        |t        «      r|r| j                  d«      dv r|| d<   |S )zœPop the ``api_content`` sidecar and substitute it into ``content`` (keeps the
    prompt-cache prefix byte-stable). Returns the popped sidecar, or ``None``.Úapi_contentNÚrole©ÚuserÚ	assistantrO   )Úpopr-   rN   Úget)Úapi_msgÚsidecars     r    Úsubstitute_api_contentr\   k   s@   € ð �k‰k˜-¨Ó.€GÜ�'œ3Ô¡G°·±¸FÓ0CÐG\Ñ0\Ø$ˆ�	ÑØ€Nr"   c                ó(   — | j                  dd«       y)z�Drop the ``api_content`` sidecar from a message whose content was rewritten
    (replaying it would resend what the rewrite removed; cost is one cache miss).rS   N)rX   )Úmsgs    r    Údrop_stale_api_contentr_   t   s   € ð ‡G�GˆM˜4Õ r"   c                óL   — | j                  d«      }t        |t        «      r|S dS )zEExtract the ``api_content`` sidecar; ``None`` when absent/non-string.rS   N)rY   r-   rN   )r^   Úvs     r    Úextract_api_content_sidecarrb   z   s$   € à�‰�Ó€AÜ˜1œcÔ"ˆ1Ð,¨Ð,r"   c                óÆ   — t        | |d«      xs d}t        | |«      r%t        t        «      5  t	        | |d«       ddd«       t        |t        «      r|S dS # 1 sw Y   ŒxY w)z�One-shot per-turn note: read and clear, so the system prompt stays byte-stable and a
    cached agent never replays a stale note.r   N)r   Úhasattrr   r0   Úsetattrr-   rN   )r   ÚattrÚnotes      r    Ú_pop_turn_noterh   €   s^   € ô �5˜$ Ó#Ò) r€DÜˆu�dÔÜ”iÓ ñ 	%Ü�E˜4 Ô$÷	%ä˜d¤CÔ(ˆ4Ð0¨bÐ0÷	%ð 	%ús   ­AÁA c                ó   — t        | d«      S )z.Pop the gateway's per-turn must-deliver notes.Ú_gateway_turn_context_notes©rh   ©r   s    r    Ú"consume_gateway_turn_context_notesrm   Š   s   € ä˜%Ð!>Ó?Ð?r"   c                ó   — t        | d«      S )z¢Pop the surface-switch note staged by the system-prompt restore (#104414); rides the same
    user-message channel as the gateway notes, behind the cached prefix.Ú_surface_switch_noterk   rl   s    r    Úconsume_surface_switch_noterp   �   s   € ô ˜%Ð!7Ó8Ð8r"   c                óœ   — |rt        | t        «      syt        t        «      5  | j	                  d|dœ«       	 ddd«       y# 1 sw Y   yxY w)z”Append must-deliver notes as a durable text part on a multimodal (list) user
    message (the sidecar path returns ``None`` for non-string content).FÚtext)Útyperr   NT)r-   Úlistr   r0   Úappend)rO   Únotess     r    Ú"append_notes_to_multimodal_contentrw   •   sI   € ñ œ
 7¬DÔ1ØÜ	”)Ó	ñ Ø�‰ °Ñ6Ô7Ø÷÷ ð ð ús   £AÁAÚcronÚsubagentc                óº  ‡ ‡— t        ‰ dd«      }t        ‰ dd«      }|r|syt        t        ‰ dd«      xs d«      j                  «       t        v ry	 ddlm} ddlm} d}d}t        |xs g «      D ]“  }t        |t        «      sŒ|j                  d	«      d
k(  sŒ) ||j                  d«      «      j                  «       }|j                  d«      }	t        |	t        «      r$t        |	j                  d«      t        «      r|	d   } n |syt        ‰ dd«      s-t        ‰ dd«      }
t        |
«      r |
«        t        ‰ dd«      sydD �ci c]  }|t        ‰ |d«      “Œ c}Š |||||t        ‰ dd«      xs t        ‰ dd«      ‰t        ‰ dd«      ˆ ˆfd„|¬«	      }|�|j                  €|‰ _        yyyc c}w # t         $ r t"        j%                  dd¬«       Y yw xY w)zHKick off auto-titling for the session's first user message; never fatal.Ú_session_dbNÚ
session_idÚplatformr   r   r   )Úmaybe_auto_titlerT   rV   rO   Údisplay_metadataÚtitle_previewÚ_session_db_createdFÚ_ensure_db_session)rA   r@   rB   Úapi_keyr?   r|   Ú_title_failure_callbackÚ_emit_auxiliary_failureÚ_on_session_titlec                 óT   •— t        ‰ dd «      ‰d   k(  xr t        ‰ dd «      ‰d   k(  S )NrA   r@   r   )r   Úmain_runtimes   €€r    ú<lambda>z4_maybe_title_session_at_turn_start.<locals>.<lambda>Ù   s:   ø€ Ü˜˜w¨Ó-°¸gÑ1FÑFò QÜ˜E :¨tÓ4¸ÀZÑ8PÑPð r"   )Úconversation_historyÚfailure_callbackrˆ   Útitle_callbackÚruntime_validatorr€   z%Turn-start auto-title dispatch failedTr(   )r   rN   ÚlowerÚ_UNTITLED_PLATFORMSÚagent.message_contentr   Úagent.title_generatorr~   Úreversedr-   ÚdictrY   ÚstripÚcallableÚidentÚ_deferred_title_upgrader0   r1   r2   )r   r4   Ú
session_dbr|   r   r~   Ú	user_textr€   r^   ÚmetadataÚensurer=   Úupgraderˆ   s   `            @r    Ú"_maybe_title_session_at_turn_startr�   ¥   sõ  ù€ ä˜ ¨tÓ4€JÜ˜ ¨dÓ3€JÙ™ZØÜ
Œ7�5˜* bÓ)Ò/¨RÓ0×6Ñ6Ó8Ô<OÑOØð7MÝ>Ý:ð ˆ	ØˆÜ˜HšN¨Ó+ò 	ˆCÜ˜#œtÕ$¨¯©°«¸FÓ)BÙ0°·±¸Ó1CÓD×JÑJÓL�	ØŸ7™7Ð#5Ó6�Ü˜h¬Ô-´*¸X¿\¹\È/Ó=ZÔ\_Ô2`Ø$,¨_Ñ$=�MÙð	ñ Øô �uÐ3°UÔ;Ü˜UÐ$8¸$Ó?ˆFÜ˜ÔÙ”Ü˜5Ð"7¸Ô?Øð \ö
àð Œw�u˜a Ó&Ñ&ò
ˆñ
 #ØØØØ!)ä˜Ð8¸$Ó?ò CÜ˜5Ð";¸TÓBà%Ü" 5Ð*=¸tÓDôð (ô
ˆð& Ð 7§=¡=Ð#8Ø,3ˆEÕ)ð $9Ðùò1
øô4 ò MÜ�‰Ð<ÀtˆÖLðMús>   Á2F7 ÂF7 ÂA/F7 Ä
9F7 ÅF7 ÅF2ÅAF7 Æ2F7 Æ7 GÇGc                óN   — t        | dd«      }|€yd| _        ddlm}  ||«       y)zYFire the title upgrade ``_maybe_title_session_at_turn_start`` held back; no-op when none.r—   Nr   )Ústart_title_upgrade)r   r—   r‘   rŸ   )r   rœ   rŸ   s      r    Ústart_deferred_title_upgrader    ç   s,   € ä�eÐ6¸Ó=€GØ€ØØ$(€EÔ!Ý9Ù˜Õ r"   c                ó,  — ddl m} d}t        t        | «      dz
  dd«      D ]o  }| |   }t	        |t
        «      r|j                  d«      dk(  sŒ-|j                  d«      |k(  r|c S  ||«      }|€ŒP|j                  d«      |k(  r|c S |dk  sŒn|}Œq |S )u/  Locate this turn's user message after compaction rebuilt ``messages``.

    Prefers the LAST user message whose content exactly matches this turn's text, else
    the last user-originated turn; compaction handoffs are never the fallback.
    Returns -1 when there is no user-originated message.

    Compression replaces list entries with fresh copies (and may append a todo-snapshot user message or a
    restored user turn AFTER the surviving copy of the current turn's message), so a pre-compression index
    is meaningless. Prefer the LAST user message whose content exactly matches this turn's text â€” the
    surviving copy in the common case â€” so the injection stamp and the #48677 persist override can't land on
    a todo-snapshot or historical row. Fall back to the last *user-originated* turn when no exact match
    survives (merge-summary-into-tail rewrites the content but the trackers still need a live anchor).
    Compaction handoffs must never become the fallback anchor (#80622) â€” they are reference-only
    scaffolding, not the active ask.
    r   ©Úuser_originated_turn_viewéÿÿÿÿé   rT   rV   rO   )Úagent.context_compressorr£   ÚrangeÚlenr-   r“   rY   )r4   Úuser_messager£   ÚfallbackÚir^   Ú	live_views          r    Úreanchor_current_turn_user_idxr­   ñ   s©   € õ  Cà€HÜ”3�x“= 1Ñ$ b¨"Ó-ò ˆØ�q‰kˆÜ˜3¤Ô%¨#¯'©'°&«/¸VÒ*CØð �7‰7�9Ó Ò-ØŠHÙ-¨cÓ2ˆ	ØÐØØ�=‰=˜Ó# |Ò3ØŠHð �a‹<Ø‰Hð!ð" €Or"   c                ó  — t        |t        «      r|j                  d«      dk(  r|S |j                  d«      }t        t	        | dd«      xs d«      }t        |t
        «      r|r|€|S t        ||«      }|dk  s|t        |«      k\  r|S ||   }t        |t        «      r|j                  d«      dk(  s|S dd	lm	}  ||«      }|j                  d
«      |k7  r&t        |t        «      r|j                  d
«      |k(  s|S ||d<   ||d<   |S )af  Stamp ``{turn_id, current_turn_user_idx}`` on a result envelope, proven against the
    exact ``result["messages"]`` projection it travels with.

    Hosts that settle their own transcript by index (hermes-webui) must never guess which
    row is the current user turn after this loop rewrote history (alternation repair,
    compaction, post-turn micro-compaction): a guessed index or a text match can relabel an
    identical historical prompt and claim its old answer as this turn's. So the producer
    exports the coordinate, computed on the final list, only when the addressed row is this
    turn's user message verbatim. Otherwise the keys are omitted and hosts fail closed.

    A preflight-timeout envelope carries the prior history without this turn's row (#7100), so a
    repeated prompt would resolve to its historical copy: nothing is exported there.
    Úturn_exit_reasonÚcontext_compression_timeoutr4   Ú_current_turn_idr   r   rT   rV   r¢   rO   Úturn_idÚcurrent_turn_user_idx)
r-   r“   rY   rN   r   rt   r­   r¨   r¦   r£   )	r   Úresultr©   r4   r²   ÚidxÚrowr£   r¬   s	            r    Úexport_current_turn_boundaryr·     s  € ô �fœdÔ# v§z¡zÐ2DÓ'EÐIfÒ'fØˆØ�z‰z˜*Ó%€HÜ”'˜%Ð!3°RÓ8Ò>¸BÓ?€GÜ�h¤Ô%©W¸Ð8LØˆÜ
(¨°<Ó
@€CØ
ˆQ‚w�#œ˜X›Ò&ØˆØ
�3‰-€CÜ�sœDÔ! c§g¡g¨f£o¸Ò&?ØˆÝBá)¨#Ó.€IØ
‡w�wˆyÓ˜\Ò)Ü�9œdÔ#¨	¯©°iÓ(@ÀLÒ(PàˆØ€Fˆ9ÑØ&)€FÐ"Ñ#Ø€Mr"   c                ó.   — || k  xs |dkD  xr ||dz  k  S )u�  ``True`` if a compression pass materially reduced the request: fewer rows, or a
    >5% token cut with the same rows (same floor as the overflow-handler retry).

    Compression can succeed by summarising message contents â€” reducing the estimated request token count â€”
    without reducing the message row count. Treating row count as the sole progress signal false-positives
    on size-only wins and surfaces a misleading "Cannot compress further" failure even when post-compression
    tokens are well below the model context window. See issue #39548 for an observed case: 220 â†’ 220
    messages, ~288k â†’ ~183k tokens on a 1M-context model still triggered auto-reset.
    The token reduction must be *material* (>5%) to count as progress â€” the same floor the overflow-handler
    retry path uses (conversation_loop.py, 39550) â€” so a sub-5% wobble doesn't keep the multi-pass loop
    spinning. See #39550.
    r   çffffffî?© )Úorig_lenÚnew_lenÚorig_tokensÚ
new_tokenss       r    Úcompression_made_progressr¿   >  s(   € ð �XÑÒV +°¡/Ò"U°jÀ;ÐQUÑCUÑ6UÐVr"   c                  ó   — e Zd ZdZy)ÚPreflightCompressionTimedOutz=Raised when an oversized turn cannot safely finish preflight.N)Ú__name__Ú
__module__Ú__qualname__Ú__doc__rº   r"   r    rÁ   rÁ   P  s   „ ÚGr"   rÁ   c                óº   — ddl m}m}  || «      sy || |«      du r0t        j	                  d|d›| j
                  j                  d›«       yt        d|d›d�«      ‚)	u¿  Stop an oversized turn instead of sending its unchanged provider payload.
    Only a request the model cannot accept (above its context window, or of unknown fit) is stopped: a
    request that merely sits above the compression threshold is sent unchanged, exactly as the
    cooldown-blocked path sends it every turn â€” otherwise a slow summariser turns a session that still
    fits its window into a turn that can never run (#113646, #114594).r   )Úcontext_compression_timed_outÚrequest_exceeds_model_windowNFzzPreflight compression timed out but the request (~%s tokens) fits the model window (%s); sending it uncompressed this turnú,z_Context compression timed out before it could commit while the request was still approximately z] tokens. The provider call was not sent. Run /compress and wait for it to finish, then retry.)Úagent.conversation_compressionrÇ   rÈ   r1   ÚwarningÚcontext_compressorÚcontext_lengthrÁ   )r   Úrequest_tokensrÇ   rÈ   s       r    Ú$_fail_closed_after_preflight_timeoutrÏ   T  sy   € ÷ ká(¨Ô/ØÙ# E¨>Ó:¸eÑCÜ�‰ð0à˜aÐ  e×&>Ñ&>×&MÑ&MÈaÐ%Pô	
ð
 	Ü
&ð	#Ø#1°!Ð"4ð 5Mð	Móð r"   c                ó�   — ddl m}m}  || |«      dury || «      ry| j                  j                  }t        d|d›d|d›d�«      ‚)	uh  Stop an over-window turn the moment preflight proves it cannot shrink the session, with
    "start a new session" guidance, instead of sending a request the model cannot accept.

    ``_fail_closed_after_preflight_timeout`` only stops a turn whose compression wait timed out. A
    pass that ran and reclaimed nothing (or under 5%) on a request still above the model window used
    to fall through to the provider call: the provider rejected it, the overflow handler forced
    another compression pass, and each pass re-waited its budget while the UI sat blocked (#116472:
    ~356k tokens on a 131k window). Only a ``True`` verdict fails closed â€” an unknown window or a
    fitting request keeps the send-as-is behaviour â€” and a pass skipped by the summary-failure
    cooldown is a defer, not proof of incompressibility, so it keeps its typed cooldown result.
    r   )Úcompression_blocked_transientlyrÈ   TNzTContext compression could not bring this session under the model's context window (~rÉ   z tokens vs zp). The provider call was not sent. Start a new session with /new; this session is too large to compress further.)rÊ   rÑ   rÈ   rÌ   rÍ   rÁ   )r   rÎ   rÑ   rÈ   Úwindows        r    Ú%_fail_closed_on_insufficient_progressrÓ   l  sd   € ÷ má# E¨>Ó:À$ÑFØÙ& uÔ-ØØ×%Ñ%×4Ñ4€FÜ
&ð	Ø˜AÐ˜k¨&°¨ð 4^ð	^óð r"   c                óN   — t        t        | dd«      xr t        | dd«       «      S )zÞWhether a detached review fork has yet to send its first provider request: it
    replays the parent's FULL snapshot as a warm cache read, so compaction must wait
    for that first response. Dormant without the attribute.Ú._review_defer_compaction_before_first_responseFÚ _turn_received_provider_response)r/   r   rl   s    r    Ú"_review_fork_first_request_pendingr×   †  s4   € ô Ü�ÐGÈÓOò 	JÜ˜ÐAÀ5ÓIÐIóð r"   c                ó.   — ||k\  xr | dkD  xr || dz  k  S )zcAnother immediate summary only if still over threshold AND the previous pass cut
    tokens by >5%.r   r¹   rº   )r½   r¾   Úthreshold_tokenss      r    Ú,_compression_warrants_another_preflight_passrÚ   �  s)   € ð
 Ð)Ñ)Òa¨k¸A©oÒaÀ*È{Ð]aÑOaÑBaÐar"   c                óJ   — t        | «      ||z   dz   kD  xs t        | «      |k\  S )a-  Cheap gate for the (expensive) full preflight estimate: message count exceeds the
    protected ranges OR a rough char-based estimate crosses the threshold (few-but-huge
    case). The estimator undercounts by design (omits system/tools) so one large base64
    image is not mistaken for ~250K tokens.r¥   )r¨   r   )r4   Úprotect_first_nÚprotect_last_nrÙ   s       r    Ú_should_run_preflight_estimaterÞ   ˜  s3   € ô 	ˆH‹˜¨.Ñ8¸1Ñ<Ñ<ò 	HÜ)¨(Ó3Ð7GÑGðr"   )Úlast_compaction_tokensc                óV   — | r|dk  s||k  s|ry|}|dkD  rt        |||z   «      }||kD  S )uŸ  Pure predicate: idle compaction fires after a wall-clock gap of
    ``idle_after_seconds`` (opt-in, <= 0 disables), independent of ``threshold_tokens``;
    never at/below ``floor_tokens`` or during a compression-failure cooldown.

    ``floor_tokens`` (``threshold_tokens Ã— summary_target_ratio``) is a theoretical target a
    real pass routinely misses (system prompt, tool schemas and protected head/tail are
    incompressible), so a session compacted to above it would re-summarise on every idle
    resume without growing. ``last_compaction_tokens`` â€” what the previous pass actually
    produced (``ContextCompressor.last_compression_rough_tokens``, same rough shape as
    ``tokens``) â€” raises the floor to ``last + floor_tokens`` so the transcript must gain a
    floor's worth of NEW content first. ``0`` (nothing compacted yet / counter reset) keeps
    the original semantics exactly.

    A session that compacted to well above that target therefore stays above it forever, so every later idle
    resume re-runs a full summarisation over a transcript that has not grown â€” minutes of silently blocked
    prompt on a slow route, reclaiming nothing (#97239).
    r   F)Úmax)ÚenabledÚidle_after_secondsÚidle_gap_secondsÚtokensÚfloor_tokensÚcooldown_activerß   Úeffective_floors           r    Ú_should_idle_compactré   ¥  sH   € ñ* Ð(¨AÒ-Ð1AÐDVÒ1VÑZiØØ"€OØ Ò!Ü˜oÐ/EÈÑ/TÓUˆØ�OÑ#Ð#r"   c                  óš   — e Zd ZU dZded<   ded<   ded<   ded	<   d
ed<   ded<   ded<   ded<   dZded<   dZded<   dZded<   dZded<   y)ÚTurnContextzCValues produced by the turn prologue and consumed by the turn loop.rN   r©   r   Úoriginal_user_messageúList[Dict[str, Any]]r4   úOptional[List[Dict[str, Any]]]rŠ   úOptional[str]Úactive_system_promptÚeffective_task_idr²   r.   r³   Fr/   Úshould_review_memoryr   rH   rG   Úpreflight_compression_blockedN)	rÂ   rÃ   rÄ   rÅ   Ú__annotations__rò   rH   rG   ró   rº   r"   r    rë   rë   Â  s`   … áMàÓØÓØ"Ó"Ø8Ó8Ø'Ó'ØÓØƒLØÓØ!&Ð˜$Ó&Ø!Ð˜Ó!Ø Ð˜Ó Ø*/Ð! 4Ô/r"   rë   c                óˆ  — 	 t        | dd«      }|€ |«        n|5   |«        ddd«       t        |t        «      r|j                  d«      rd| _        yy# 1 sw Y   Œ3xY w# t        $ r) t        j                  || j                  xs dd¬«       Y Œgw xY w# t        |t        «      r|j                  d«      rd| _        w w xY w)uS  Run ``fn`` under the session persist lock (when the agent has one), log-and-swallow
    failures, then drop staged CLI input â€” unless it is an unmarked handoff kept for a
    close retry (once ``_db_persisted`` the close path must not treat it as pre-worker
    UI input). Eager clearing keeps a preflight crash from leaking stale input.Ú_session_persist_lockNÚnoneTr(   Ú_db_persisted)	r   r0   r1   rË   r|   r-   r“   rY   Ú_pending_cli_user_message)r   ÚfnÚfailure_msgÚpending_cli_messageÚlocks        r    Ú_persist_under_lockrþ   Ô  s¿   € ð
3Ü�uÐ5°tÓ<ˆØˆ<Ù�Dàñ Ù”÷ô
 Ð-¬tÔ4Ð8K×8OÑ8OÐP_Ô8`Ø.2ˆEÕ+ð 9a÷ð ûäò OÜ�‰�{ E×$4Ñ$4Ò$>¸ÈˆÖNðOûô Ð-¬tÔ4Ð8K×8OÑ8OÐP_Ô8`Ø.2ˆEÕ+ð 9aús9   ‚A! ›A£A! ÁAÁA! Á!/BÂB ÂBÂB Â+Cc                óü   — t        t        «      5  ddlm} ddlm}  || «      xs d} |t        | d«      t        | d«      fi dD �ci c]  }|t        | |«      “Œ c}¤d|i¤Ž d	d	d	«       y	c c}w # 1 sw Y   y	xY w)
z¡Tell auxiliary_client the live main provider/model for this turn (after primary
    restoration settled the runtime). Never raises: failure loses only the scope.r   )Úset_runtime_main)Úresolve_prompt_cache_scope_safer   r@   rA   )Úrequested_providerrB   rƒ   r?   Ú	auth_moder|   Úcache_scopeN)r   r0   Úagent.auxiliary_clientr   Úagent.prompt_cache_scoper  r!   )r   r   r  Ú_cache_scoper=   s        r    Ú_publish_runtime_mainr  ç  sŒ   € ô 
”)Ó	ñ 
Ý;ÝLñ 7°uÓ=ÒCÀˆÙÜ�e˜ZÓ(¬)°E¸7Ó*Cñ	
ð0ö ¨!ˆq”)˜E 1Ó%Ñ%ò ñ	
ð
 %ó	
÷
ð 
ùò÷
ð 
ús   �7A2ÁA-Á	A2Á-A2Á2A;c                ó  — 	 dt         j                  v rddlm}  || «       t	        | dd«      s3dt         j                  v r ddlm} ddlm}  |«       r || d	d	¬
«       yyyy# t        $ r t        j                  dd	¬«       Y yw xY w)z×Late-connecting MCP servers land in THIS turn's snapshot, before the first API
    call assembles ``tools=``. ``preserve_prefix`` keeps the tool array append-only so a
    flapping ``check_fn`` can't fork the cache.ztools.connectors.mcpr   )Úadopt_late_connectionsÚ_skip_mcp_refreshFztools.mcp_tool)Úhas_registered_mcp_tools)Úrefresh_agent_mcp_toolsT)Ú
quiet_modeÚpreserve_prefixz&between-turns MCP tool refresh skippedr(   N)ÚsysÚmodulesÚtools.connectors.mcpr
  r   Útools.mcp_tool_discoveryr  Útools.mcp_tool_agentr  r0   r1   r2   )r   r
  r  r  s       r    Ú _refresh_mcp_tools_between_turnsr  ÿ  sŠ   € ðNð "¤S§[¡[Ñ0ÝCÙ" 5Ô)ô �uÐ1°5Ô9Ð>NÔRU×R]ÑR]Ñ>]ÝIÝDÙ'Ô)Ù'¨¸$ÐPTÖUð *ð ?^Ð9øô
 ò NÜ�‰Ð=ÈˆÖMðNús   ‚AA# Á# BÂBc                óº  — || _         d| _        || _        || _        || _        |xs t        t        j                  «       «      }|| _        h t        | dd«      £|’| _
        t        t        | dd«      xs d«      xs7 | j                  xs d› d|› dt        j                  «       j                  dd › �}d| _        || _        d| _        d	d
lm}  || |«       ||fS )zƒStage callback/persist overrides on the agent and bind this turn's task and turn
    ids. Returns ``(effective_task_id, turn_id)``.NÚ_process_owner_task_idsrº   Ú_relay_pending_turn_idr   Úsessionú:é   r   )Únote_turn_start)Ú_stream_callbackÚ_persist_user_message_idxÚ_persist_user_message_overrideÚ_persist_user_message_timestampÚ!_persist_user_message_platform_idrN   ÚuuidÚuuid4Ú_current_task_idr   r  r|   Úhexr  r±   Ú_current_api_request_idÚagent.agent_runtime_helpersr  )	r   Útask_idÚstream_callbackÚpersist_user_messageÚpersist_user_timestampÚpersist_user_platform_idrñ   r²   r  s	            r    Ú_bind_turn_identityr-    sõ   € ð -€EÔØ&*€EÔ#Ø+?€EÔ(Ø,B€EÔ)Ø.F€EÔ+àÒ4¤3¤t§z¡z£|Ó#4ÐØ.€EÔØ$g¤g¨eÐ5NÐPRÓ&SÐ$gÐUfÐ$g€EÔ!Ü”'˜%Ð!9¸2Ó>ÒDÀ"ÓEò Ø×ÑÒ(˜yÐ
)¨Ð+<Ð*=¸Q¼t¿z¹z»|×?OÑ?OÐPRÐQRÐ?SÐ>TÐUð ð $(€EÔ Ø$€EÔØ$&€EÔ!õ <Ù�E˜7Ô#Ø˜gÐ%Ð%r"   ))Ú_invalid_tool_retriesr   )Ú_invalid_json_retriesr   )Ú_empty_content_retriesr   )Ú_incomplete_scratchpad_retriesr   )Ú_codex_incomplete_retriesr   )Ú_codex_reasoning_only_streakr   )Ú_thinking_prefill_retriesr   )Ú_post_tool_empty_retriedF)Ú_last_content_with_toolsN)Ú$_last_content_tools_all_housekeepingF)Ú_mute_post_responseF)Ú_unicode_sanitization_passesr   )Ú_tool_guardrail_halt_decisionN)Ú"_iteration_budget_warning_injectedF)Ú_run_budget_wrapup_injectedF)Ú_verification_stop_nudgesr   )Ú_pre_verify_nudgesr   zTuple[Tuple[str, Any], ...]Ú_PER_TURN_RESET_STATEc                óÞ  — t         D ]  \  }}t        | ||«       Œ i | _        t        «       | _        | j
                  j                  «        t        | j                  dd«      }t        |«      r |«        t        j                  «       | _        | j                  dk7  r9t        t        «      5  | j                  «       r| j!                  d«       ddd«       | j"                  r| j%                  «        d| _        t'        | j(                  «      | _        t        | dd«      rt        j                  «       nd| _        dD ]"  }t        | |d«      }|€Œ|j/                  «        Œ$ y# 1 sw Y   Œ–xY w)zJReset retry counters, guardrails, iteration and run budgets at turn start.Úreset_consolidation_failuresNÚanthropic_messagesu~   ðŸ”Œ Detected stale connections from a previous provider issue â€” cleaned up automatically. Proceeding with fresh connection.Úrun_budget_seconds)Ú_stream_context_scrubberÚ_stream_think_scrubber)r?  re   Ú_turn_failed_file_mutationsÚsetÚ_turn_file_mutation_pathsÚ_tool_guardrailsÚreset_for_turnr   Ú_memory_storer•   ÚtimeÚ_current_turn_timestampr?   r   r0   Ú_cleanup_dead_connectionsÚ_emit_diagnostic_statusÚ_compression_warningÚ_replay_compression_warningr   Úmax_iterationsÚiteration_budgetÚ_run_budget_started_atÚreset)r   r   ÚvalueÚ_reset_consolÚscrubbers        r    Ú_reset_per_turn_agent_staterY  B  sF  € ä,ò $‰ˆˆeÜ��t˜UÕ#ð$à(*€EÔ%Ü&)£e€EÔ#Ø	×Ñ×)Ñ)Ô+Ü˜E×/Ñ/Ð1OÐQUÓV€MÜ�ÔÙŒô
 %)§I¡I£K€EÔ!ð ‡~�~Ð-Ò-Ü”iÓ ñ 	Ø×.Ñ.Ô0Ø×-Ñ-ð"ô÷	ð ×!Ò!Ø×)Ñ)Ô+Ø%)ˆÔ"ä,¨U×-AÑ-AÓB€EÔô ˜uÐ&:¸DÔAŒ�	‰	ŒÀtð 
Ô ð Gò ˆÜ˜5 $¨Ó-ˆØÑØ�N‰NÕñ÷%	ð 	ús   Â,"E#Å#E,c                ó  — t        | dd«      }|�|n|}t        |t        «      r|j                  d«      |k(  r|}	||	d<   nd|dœ}	t        |t        «      rd| _        t        |	|¬«       |r||	d<   |r||	d<   |�||	d	<   |	|fS )
zíBuild this turn's user dict, reusing CLI-staged input only when its clean text
    matches this turn (a stale handoff must not replace later input; voice turns
    compare the clean override). Returns ``(user_msg, pending_cli_message)``.rù   NrO   rV   ©rT   rO   )Ú	timestampÚdisplay_kindr   Úplatform_message_id)r   r-   r“   rY   rù   r   )
r   r©   r*  r+  r,  Úpersist_user_display_kindÚpersist_user_display_metadatarü   Úexpected_persist_contentÚuser_msgs
             r    Ú_stage_turn_user_messagerc  l  s¼   € ô " %Ð)DÀdÓKÐà 4Ð @ÑÀlð ô 	Ð&¬Ô-Ø×#Ñ# IÓ.Ð2JÒJà&ˆð +ˆ�Òà"¨|Ñ<ˆÜÐ)¬4Ô0Ø.2ˆEÔ+ô ˜HÐ0FÕGñ !Ø#<ˆ�Ñ Ù$Ø'DˆÐ#Ñ$ð  Ð+Ø*BˆÐ&Ñ'ØÐ(Ð(Ð(r"   c                ó  — |sy| j                   j                  «       s| j                  |«       | j                  dk(  r©t	        | |«       t        t        | dd«      dd«      }t        |«      r&	 ddlm}  || |«      r |«        ddl	m
}  || d«       t        d
„ |D «       «      }|dkD  r<|| _        | j                  dkD  r%| j                   dk(  r|| j                  z  | _        yyyyy# t        $ r t        j                  dd¬	«       Y Œww xY w)zMHydrate process-local state from persisted history on the first resumed turn.Nr   rÌ   Ú!note_native_compaction_checkpoint)Ú+has_replayable_native_compaction_checkpoint)Úset_usage_anchorz,restored native checkpoint hydration skippedTr(   c              3  óJ   K  — | ]  }|j                  d «      dk(  sŒd–— Œ y­w)rT   rV   r¥   N)rY   )r<   Úms     r    r>   z(_hydrate_from_history.<locals>.<genexpr>¾  s    è ø€ ÒZ QÀ!Ç%Á%ÈÃ-ÐSYÓBYœqÑZùs   ‚#œ#)Ú_todo_storeÚ	has_itemsÚ_hydrate_todo_storeÚ_user_turn_countr   r   r•   r,   rf  Úagent.usage_anchorrg  r0   r1   r2   ÚsumÚ_memory_nudge_intervalÚ_turns_since_memory)r   rŠ   Únote_checkpointrf  rg  Úprior_user_turnss         r    Ú_hydrate_from_historyrt  –  s,  € áØØ×Ñ×&Ñ&Ô(Ø×!Ñ!Ð"6Ô7ð ×Ñ Ò"ô 	˜UÐ$8Ô9Ü!Ü�EÐ/°Ó6Ø/Øó
ˆô
 �OÔ$ðõñ ?ØÐ/ôñ $Ô%õ Dá$ U¨DÔ1ô ÑZÐ*>ÔZÓZÐØ˜aÒØ%5ˆEÔ"Ø×+Ñ+¨aÒ/°E×4MÑ4MÐQRÒ4RØ,<¸u×?[Ñ?[Ñ,[�Õ)ð 5SÐ/ð  ð= #øô0 ò Ü—‘ØBÈTð ö ðús   Á.%C( Ã( DÄ
Dc                óÂ   — | j                   dkD  rPd| j                  v rB| j                  r6| xj                  dz  c_        | j                  | j                   k\  rd| _        yy)zRAdvance the turn-based memory nudge counter; ``True`` when the review should fire.r   Úmemoryr¥   TF)rp  Úvalid_tool_namesrK  rq  rl   s    r    Ú_tick_memory_nudgerx  Å  sZ   € à×$Ñ$ qÒ(Ø˜E×2Ñ2Ñ2Ø×#Ò#Ø×!Ò! QÑ&Õ!Ø×$Ñ$¨×(DÑ(DÒDØ()ˆEÔ%ØØr"   c                óœ   — t        | dd«      }|€yt        t        «      5  ddlm}  ||«      }|r ||«       ddd«       y# 1 sw Y   yxY w)zŒCosmetic side-signal: detect an affection reaction so the host can play hearts.
    Token-free, never touches the conversation, never fatal.Úreaction_callbackNr   )Údetect_reaction)r   r   r0   Úagent.reactionsr{  )r   rì   rz  r{  Úkinds        r    Ú_emit_reactionr~  Ñ  sS   € ô   Ð':¸DÓAÐØÐ ØÜ	”)Ó	ñ $Ý3áÐ4Ó5ˆÙÙ˜dÔ#÷$÷ $ñ $ús    AÁAc                ó4   — t        | | j                  d|«       y)zæCreate the DB row now (system prompt populated => non-NULL) and BEFORE preflight
    compression: compaction/rotation INSERTs reference this row under PRAGMA
    foreign_keys=ON. Idempotent; the user-turn crash persist runs later.z5Turn-start session row creation failed for session=%sN)rþ   r‚   )r   rü   s     r    Ú_ensure_session_rowr€  ß  s   € ô Øˆu×'Ñ'Ø?ÐATõr"   c               ó   — t        | dd«      ry	 ddlm}  |d| j                  |||t	        |«      t        |«       | j                  t        | dd«      xs dt        | d	d«      xs dt        | d
d«      xs d¬«      }	 ddlm}m	}	  |«       }
g }|D ]€  }t        |t        «      r |j                  d«      rt        |d   «      }n$t        |t        «      r|j                  «       r|}nŒW|	�	  |	|| j                  d|
¬«      }|j%                  |«       Œ‚ dj'                  |«      S # t        $ r d}	d}
Y Œ§w xY w# t        $ r }t         j#                  d|«       Y d}~Œ[d}~ww xY w# t        $ r }t         j#                  d|«       Y d}~yd}~ww xY w)zàRun ``pre_llm_call`` plugins; their context is injected into the user message
    (never the system prompt). Oversized per-hook context is spilled to disk so a
    runaway plugin can't inflate every subsequent turn's prompt.Ú_persist_disabledFr   r   )Úinvoke_hookÚpre_llm_callr}   NÚ_parent_session_idÚ_user_id)
r|   r(  r²   r©   rŠ   Úis_first_turnrA   r}   Úparent_session_idÚ	sender_id)Úget_spill_configÚspill_if_oversizedÚcontextzplugin hook)r|   ÚsourceÚconfigzhook context spill failed: %srE   zpre_llm_call hook failed: %s)r   Úhermes_cli.lifecyclerƒ  r|   rt   r/   rA   Útools.hook_output_spillrŠ  r‹  r0   r-   r“   rY   rN   r”   r1   rË   ru   rF   )r   rñ   r²   rì   r4   rŠ   Ú_invoke_hookÚ_pre_resultsÚ
_spill_cfgÚ_spill_if_oversizedÚ_spill_config_cachedÚ
_ctx_partsÚrÚ_pieceÚ
_spill_excÚexcs                   r    Ú_collect_pre_llm_call_contextr›  é  sŸ  € ô ˆuÐ)¨5Ô1Øð,<ÝDÙ#ØØ×'Ñ'Ø%ØØ.Ü!% h£Ü#Ð$8Ó9Ð9Ø—+‘+Ü˜U J°Ó5Ò;¸Ü% eÐ-AÀ4ÓHÒNÈBÜ˜e Z°Ó6Ò<¸"ô
ˆð		(÷ñ $.£<Ð ð !#ˆ
Øò 	&ˆAÜ˜!œTÔ" q§u¡u¨YÔ'7Ü˜Q˜y™\Ó*‘Ü˜AœsÔ#¨¯©¬	Ø‘àØ"Ð.ðPÙ0Ø¨5×+;Ñ+;ÀMØ3ô�Fð ×Ñ˜fÕ%ð	&ð  �{‰{˜:Ó&Ð&øô) ò 	(Ø"&ÐØ#'Ò ð	(ûô" !ò PÜ—N‘NÐ#BÀJ×OÑOûðPûô ò <Ü�‰Ð5°s×;Ð;Øûð<úsg   �A-E$ Á>D% ÂAE$ Ã+D8Ä#E$ Ä%D5Ä2E$ Ä4D5Ä5E$ Ä8	E!ÅEÅE$ ÅE!Å!E$ Å$	FÅ-FÆFc                ó6  — dj                  d„ t        | «      t        | «      fD «       «      }|s|S d|cxk  rt        |«      k  r*n n't	        ||   t
        «      r||   j                  d«      nd}t	        |t        «      rt        ||«       |S |r|dz   |z   S |S )u,  Must-deliver per-turn notes ride the user-message injection channel (one-shot) so the
    ephemeral system prompt stays byte-stable: the gateway's staged notes, then the
    surface-switch correction. Multimodal (list) content can't take the string sidecar â€”
    append a durable text part instead.rE   c              3  ó$   K  — | ]  }|r|–— Œ
 y ­wr;   rº   )r<   rJ   s     r    r>   z'_merge_gateway_notes.<locals>.<genexpr>)  s   è ø€ ò ØÙAEô 	ñùs   ‚r   rO   N)	rF   rm   rp   r¨   r-   r“   rY   rt   rw   )r   r4   r³   rH   Ú_turn_notesÚ_gw_turn_contents         r    Ú_merge_gateway_notesr   "  s»   € ð —+‘+ñ Ü<¸UÓCÜ5°eÓ<ð>ôó €Kñ Ø"Ð"ð Ð%Ô5¬¨H«Õ5Ü�xÐ 5Ñ6¼Ô=ð 	Ð&Ñ'×+Ñ+¨IÔ6ð ð	 ô Ð"¤DÔ)Ü*Ð+;¸[ÔIØ"Ð"á6IÐ˜fÑ$ {Ñ2ðØOZðr"   c           	     ó:  — t        j                  «       j                  | _         |«       j	                  d| j                  «       | j
                  r6 |«       j	                  d| j                  t        | dd«      ¬«       d| _	        yd| _        d| _        d| _	        y)z§Record the execution thread so interrupt()/clear_interrupt() scope the tool-level
    signal to THIS agent's thread; clear stale state, preserving a pending interrupt.FTÚ_tool_interrupt_reasonN)Úreason)
Ú	threadingÚcurrent_threadr–   Ú_execution_thread_idÚ_set_interruptÚ_interrupt_requestedr   Ú_interrupt_messager¢  Ú _interrupt_thread_signal_pending)r   Úras     r    Ú_bind_interrupt_scoper¬  =  s�   € ô "+×!9Ñ!9Ó!;×!AÑ!A€EÔÙƒD×Ñ˜˜u×9Ñ9Ô:Ø×!Ò!Ù
‹×ÑØ�%×,Ñ,´W¸UÐD\Ð^bÓ5cð 	ô 	
ð .3€EÕ*ð $(ˆÔ Ø'+ˆÔ$Ø-2€EÕ*r"   c                óF   — t        | t        t        f«      rt        | «      S y)a  Semantic text of the turn for memory queries: a multimodal (list) turn carries its text
    in parts, so keying off ``isinstance(str)`` collapsed it to ``""`` and ``is_trivial_prompt``
    skipped prefetch entirely. An image-only turn still flattens to ``""`` (trivial).r   )r-   rN   rt   r   )rì   s    r    Ú_memory_query_textr®  L  s"   € ô Ð'¬#¬t¨Ô5Ü#Ð$9Ó:Ð:Ør"   c                óÚ  — | j                   syt        |«      }t        |t        «      r|ni }t	        t
        «      5  | j                   j                  | j                  ||j                  d«      xs d|j                  d«      xs dt        |j                  d«      «      ¬«       ddd«       d}t	        t
        «      5  t        |«      s+| j                   j                  || j                  ¬«      xs d}ddd«       |rGt	        t
        «      5  | j                   j                  «       }|r| j                  |«       ddd«       |S |S # 1 sw Y   Œ¤xY w# 1 sw Y   Œ`xY w# 1 sw Y   |S xY w)zÜNotify memory providers of the new turn, then prefetch external memory once
    before the tool loop (skipped on trivial prompts with no semantic signal).
    Returns the prefetch text (``""`` when nothing was injected).r   ÚidNr   Úis_bot)Ú	author_idÚauthor_nameÚauthor_is_bot)r|   )Ú_memory_managerr®  r-   r“   r   r0   Úon_turn_startrm  rY   r/   r   Úprefetch_allr|   Údescribe_recallÚ_emit_status)r   rì   Úturn_authorÚ_queryÚ_authorrG   Ú_recall_indicators          r    Ú_memory_turn_start_and_prefetchr¾  U  sS  € ð × Ò ØÜÐ 5Ó6€Fä'¨´TÔ:‰kÀ€GÜ	”)Ó	ñ 
Ø×Ñ×+Ñ+Ø×"Ñ" FØ—k‘k $Ó'Ò/¨4¸W¿[¹[ÈÓ=PÒ=XÐTXÜ˜wŸ{™{¨8Ó4Ó5ð 	,ô 	
÷
ð ÐÜ	”)Ó	ñ oÜ  Ô(Ø!&×!6Ñ!6×!CÑ!CÀFÐW\×WgÑWgÐ!CÓ!hÒ!nÐlnÐ÷oñ
 Ü”iÓ ñ 	6Ø %× 5Ñ 5× EÑ EÓ GÐÙ Ø×"Ñ"Ð#4Ô5÷	6ð ÐÐÐ÷#
ð 
ú÷oð oú÷	6ð Ðús$   ¼A)EÂ>7EÄ.E ÅEÅEÅ E*c          
     ó~  — ||   }|j                  d«      }ddlm}m}	  |	| ||t	        |xs d||«      «      \  }
}|�||
k(  ry||d<    || «      5  |j                  d«      }|xr t        t        | dd	«      «      }t        | d
d«      }|�t        |t        «      s|s
	 ddd«       y	 t        |t        «      r|j                  | j                  ||
|«       n|j                  | j                  |
|«       ddd«       y# t        $ r) t        j                  d| j                  xs dd¬«       Y Œ:w xY w# 1 sw Y   yxY w)uš   api_content sidecar â€” persist what you send: injected context lives only in the
    API copy, so stamp the exact sent bytes on the live dict for replay.rO   r   )Ú_persist_lockÚdurable_user_row_contentr   NrS   Ú_row_idÚ_last_compaction_in_placeFr{   z*api_content backfill failed for session=%sr÷   Tr(   )rY   Úagent.session_persistencerÀ  rÁ  rQ   r/   r   r-   r.   Úset_message_api_contentr|   Úset_latest_user_api_contentr0   r1   rË   )r   r4   r³   rG   rH   Úpreflight_compressedÚ_turn_user_msgÚlive_contentrÀ  rÁ  Údurable_contentÚ_api_contentrÂ  Ú_in_place_compactedÚ_dbs                  r    Ú_stamp_api_content_sidecarrÎ  t  sb  € ð Ð3Ñ4€NØ!×%Ñ% iÓ0€LßQá$<Øˆ~˜|Ü  Ò!3°Ð5GÐI\Ó]ó%Ñ!€O�\ð Ð˜|¨Ò>ØØ$0€N�=Ñ!ñ 
�uÓ	ñ tØ ×$Ñ$ YÓ/ˆØ2Òo´t¼GÀEÐKfÐhmÓ<nÓ7oÐÜ�e˜]¨DÓ1ˆØˆ;œz¨'´3Ô7Ñ;NØ÷tð tð	tÜ˜'¤3Ô'Ø×+Ñ+¨E×,<Ñ,<¸gÀÐXdÕeð ×/Ñ/°×0@Ñ0@À/ÐS_Ô`÷tð tøô ò 	tÜ�N‰NÐGÈ×IYÑIYÒIcÐ]cÐnrˆNÖsð	tú÷tð tús,   ÁAD3Â)AC>Ã>/D0Ä-D3Ä/D0Ä0D3Ä3D<c               ó  — t        ||«      }t        |j                  d«      |«      syddlm}m}  || «      5  |j                  d«      }t        | dd«      }	|	�t        |t        «      s
	 ddd«       y|xr t        t        | dd«      «      }
|
r|d   n
 ||d   «      }	 |	j                  | j                  ||«       ddd«       y# t        $ r) t        j                  d	| j                  xs d
d¬«       Y Œ:w xY w# 1 sw Y   yxY w)a  Multimodal (list) content takes no string sidecar: the turn's context becomes a durable
    text part on the current turn's live list (the gateway must-deliver-note channel, #71998),
    so wire, persisted row, compaction and replay all carry the same parts. Runs once per turn,
    before the first request; historical rows are never touched.

    A user row another writer materialized BEFORE the prologue (in-place preflight compaction,
    a close/early flush that raced it) is updated in place: the crash persist marker-skips that
    message, so without this a resumed session replays a view the model never saw. Same
    ``_row_id``-under-lock protocol as the string sidecar backfill; the row keeps its writer's
    shape (compaction inserted the raw parts, a flush the text projection).rO   Nr   )Ú_durable_contentrÀ  rÂ  r{   rÃ  Fz1multimodal context backfill failed for session=%sr÷   Tr(   )rL   rw   rY   rÄ  rÐ  rÀ  r   r-   r.   r/   Úset_user_message_contentr|   r0   r1   rË   )r   Úturn_user_msgrG   rH   rÇ  Ú_mm_ctxrÐ  rÀ  rÂ  rÍ  rÌ  rO   s               r    Ú_append_multimodal_contextrÔ  £  s  € ô .Ð.@ÐBUÓV€GÜ-¨m×.?Ñ.?À	Ó.JÈGÔTØßIá	�uÓ	ñ 
{Ø×#Ñ# IÓ.ˆÜ�e˜]¨DÓ1ˆØˆ;œj¨´#Ô6Ø÷	
{ð 
{ð
 3Òo´t¼GÀEÐKfÐhmÓ<nÓ7oÐÙ.A�- 	Ò*ÑGWÐXeÐfoÑXpÓGqˆð	{Ø×(Ñ(¨×)9Ñ)9¸7ÀGÔL÷
{ð 
{øô ò 	{Ü�N‰NÐNÐPU×P`ÑP`ÒPjÐdjÐuyˆNÖzð	{ú÷
{ð 
{ús/   ¹2C<Á4,C<Â!CÃ/C9Ã6C<Ã8C9Ã9C<Ã<Dc                ó6   ‡ ‡‡— dˆ ˆˆfd„}t        ‰ |d|«       y)zêCrash-resilience: persist the inbound user turn once, with final api_content,
    before the first LLM call. Same critical section as CLI close persistence; retries
    the row create if the pre-compression attempt failed transiently.c                 óJ   •— ‰ j                  «        ‰ j                  ‰‰«       y r;   )r‚   Ú_persist_session)r   rŠ   r4   s   €€€r    Ú_ensure_and_persistz0_persist_turn_start.<locals>._ensure_and_persistÊ  s    ø€ Ø× Ñ Ô"Ø×Ñ˜xÐ)=Õ>r"   z:Early turn-start session persistence failed for session=%sN)ÚreturnÚNone)rþ   )r   r4   rŠ   rü   rØ  s   ```  r    Ú_persist_turn_startrÛ  Ã  s   ú€ ÷?ô ØÐ"ØDÐFYõr"   F)r_  r`  rº  Ú
moa_activec	               ó0  ‡&— ddl m}  |«        t        |«      }|| _        t	        | «      }|�|} || j
                  «        |t        | dd«      «       ddlm}  |t        | dd«      «       | j                  «        t        | «       t        | «       t        |t        «      r ||«      }t        |t        «      r ||«      }t        | |||||«      \  }}t        | «        ||«      }|dd	 t!        |«      d	kD  rd
ndz   }t"        j%                  d| j
                  xs d| j&                  | j(                  xs d| j*                  xs dt!        |xs g «      |j-                  dd«      «       |rt/        |«      ng }t1        | |||||	|
«      \  }}t3        | |«       t5        | «       t7        ||«       t!        |«      dz
  }|| _        | xj:                  dz  c_        d| _        |�|n|}t?        | «      } tA        | |«       | jB                  s*| jE                  d|dd › t!        |«      dkD  rd
nd› d�«       | jF                  €
 || ||«       | jF                  }!	 ddl$m%}"  |"| «       tQ        | |«       ddl)m*Š& |r&tW        ˆ&fd„|D «       «      r| jY                  ||«        || |||!||||¬«      }#|#jZ                  }|#j\                  }!|#j^                  }|#j`                  }tc        | |||||¬«      }$te        | |||$«      }$tg        | |«       ti        | ||«      }%tk        | |«       d|cxk  rt!        |«      k  r‡n n„||   jm                  d«      dk(  rmt        ||   jm                  d«      t.        «      rto        | ||   |%|$|#jp                  ¬ «       n-|s+t        | d!d«      d"k7  rts        | |||%|$|#jp                  ¬ «       tu        | |||«       tw        |||||!|||| |$|%|#jx                  ¬#«      S # tL        $ r t"        jO                  dd¬«       Y �Œ«w xY w)$aT  Run the once-per-turn setup and return the loop's input context.

    Helpers are passed in to avoid an import cycle with ``agent.conversation_loop``.
    Order matters: the DB session row is created only AFTER the system prompt is built
    (else it persists system_prompt=NULL and costs a cache miss) and BEFORE preflight
    compression.r   )Úrun_turn_start_compactionNÚ_memory_write_originÚassistant_tool)Úset_review_attendedÚ_review_attendedFéP   z...r   zPconversation turn: session=%s model=%s provider=%s platform=%s history=%d msg=%rr÷   Úunknownú
ú r¥   Tu   ðŸ’¬ Starting conversation: 'é<   ú')Úensure_message_agent_toolzmessage_agent injection skippedr(   )Ú"_PERSIST_AFTER_ADMISSION_INTERRUPTc              3  ód   •K  — | ]'  }t        |t        «      xr |j                  ‰«      –— Œ) y ­wr;   )r-   r“   rY   )r<   r^   rê  s     €r    r>   z%build_turn_context.<locals>.<genexpr>I  s2   øè ø€ ò $àô 	�3œÓÒM #§'¡'Ð*LÓ"MÓMñ$ùs   ƒ-0)r4   Úsystem_messagerð   rŠ   r³   r©   rñ   )rñ   r²   rì   r4   rŠ   rT   rV   rO   )rÇ  r?   Úcodex_app_server)r©   rì   r4   rŠ   rð   rñ   r²   r³   rò   rH   rG   ró   )=Úagent.turn_context_compactionrÞ  r   Ú_turn_authorr   r|   r   Útools.skill_provenancerá  Ú_restore_primary_runtimer  r  r-   rN   r-  rY  r¨   r1   ÚinforA   r@   r}   Úreplacert   rc  rt  r   r   r  rm  Ú_is_user_initiated_turnrx  r~  r  Ú_safe_printÚ_cached_system_promptÚtools.bot_mode_dmré  r0   r2   r€  rÄ  rê  ÚanyÚ_flush_messages_to_session_dbr4   rð   rŠ   r³   r›  r   r¬  r¾  r�   rY   rÔ  Ú
compressedrÎ  rÛ  rë   Úblocked)'r   r©   rì  rŠ   r(  r)  r*  r+  r,  r_  r`  rº  Úrestore_or_build_system_promptÚinstall_safe_stdioÚsanitize_surrogatesÚsummarize_user_message_for_logÚset_session_contextÚset_current_write_originr«  rÜ  rÞ  Úrecovered_historyrá  rñ   r²   Ú_preview_textÚ_msg_previewr4   rb  rü   r³   rì   rò   rð   ré  Ú
compactionrH   rG   rê  s'                                         @r    Úbuild_turn_contextr  Ô  s…  ø€ õ  Hñ Ôô $ KÓ0€KØ$€EÔô <¸EÓBÐØÐ$Ø0Ðñ ˜×(Ñ(Ô)ÙœW UÐ,BÐDTÓUÔVÝ:Ùœ Ð'9¸5ÓAÔBØ	×"Ñ"Ô$Ü˜%Ô Ü$ UÔ+ä�,¤Ô$Ù*¨<Ó8ˆÜÐ&¬Ô,Ù2Ð3GÓHÐä!4Øˆw˜Ð)=ØÐ 8ó"ÑÐ�wô   Ô&á2°<Ó@€MØ   "Ð%´#°mÓ2DÀrÒ2I©ÈrÑR€LÜ
‡K�KØZØ×ÑÒ"˜F E§K¡K°·±Ò1LÀ9Ø�‰Ò#˜)¤SÐ)=Ò)CÀÓ%DØ×Ñ˜T 3Ó'ô	ñ .BŒtÐ(Ô)Àr€HÜ$<Øˆ|Ð1Ð3IØ Ð";Ð=Zó%Ñ!€HÐ!ô ˜%Ð!5Ô6ä˜%Ô ä�8˜XÔ&Ü ›M¨AÑ-ÐØ&;€EÔ#à	×Ò˜aÑÕð %)€EÔ!ð 5IÐ4TÑ0ÐZfÐÜ-¨eÓ4ÐÜ�5Ð/Ô0à×ÒØ×ÑØ+¨M¸#¸2Ð,>Ð+?Ü˜MÓ*¨RÒ/‰u°RÐ8¸ð;ô	
ð ×"Ñ"Ð*Ù& u¨nÐ>RÔSØ ×6Ñ6ÐðGÝ?á! %Ô(ô ˜Ð2Ô3õ
 Má¤ó $à'ô$ô !ð 	×+Ñ+Ð,@ÐBVÔWá*Ø˜°Ø1ÐH\Ø3À,Ø+ô	€Jð ×"Ñ"€HØ%×:Ñ:ÐØ%×:Ñ:ÐØ&×<Ñ<Ðä7ØÐ!2¸GØ3¸hØ1ôÐô
 /ØˆxÐ.Ð0CóÐô ˜% Ô$Ü8¸Ð@UÐWbÓcÐô
 ' u¨hÔ7ð 	Ð!Ô1¤C¨£MÕ1°hÐ?TÑ6U×6YÑ6YÐZ`Ó6aÐekÒ6kÜ�hÐ4Ñ5×9Ñ9¸)ÓDÄdÔKÜ&Ø�xÐ 5Ñ6Ð8JÐL_Ø%/×%:Ñ%:öñ ¤¨¨z¸4Ó @ÐDVÒ VÜ&Ø�xÐ!6Ð8JØ#¸*×:OÑ:Oõô
 ˜˜xÐ)=Ð?RÔSäØ!Ð9NÐYaØ1ÐH\Ø+°WØ3ÐJ^Ø/ÐDVØ&0×&8Ñ&8ôð øôw ò GÜ�‰Ð6Àˆ×FðGús   ÉO1 Ï1 PÐPc                ó  — | j                   }| j                  dk(  rl|r+|j                  d«      xs i }|j                  d«      r|d   }|| j                   k(  r0t        t        | dd«      dd«      }|r|j                  d«      r|d   }|S )zÀModel name for strict-API tool-call sanitization. In MoA mode ``agent.model`` is
    the virtual preset name; use the resolved aggregator so Gemini keeps
    thought_signature (extra_content).ÚmoaÚ
aggregatorrA   ÚclientNÚlast_aggregator_slot)rA   r@   rY   r   )r   Ú
moa_configÚ_sanitize_modelÚ_aggÚ	_agg_slots        r    Ú_sanitize_model_forr  „  s‰   € ð —k‘k€OØ‡~�~˜ÒÙØ—>‘> ,Ó/Ò5°2ˆDØ�x‰x˜Ô Ø"& w¡-�Ø˜eŸk™kÒ)ô  ¤¨¨x¸Ó >Ð@VÐX\Ó]ˆIÙ˜YŸ]™]¨7Ô3Ø"+¨GÑ"4�ØÐr"   c               óN  — ddl m} ddlm} ddlm}	 t        |t        «      xr d|cxk  xr t        |«      k  nc }
|
r||   nd}| j                  }|
r|nd} |	|d| |¬«      ||d z   }g }t        |«      D �]i  \  }} ||«      }|j                  dd«      }dD ]  }|j                  |d«       Œ ||u rQ|j                  d	«      d
k(  r=t        |t        «      r|r||d<   nOt        |j                  dd«      ||«      }|�0||d<   n*t        |t        «      r|r|j                  d	«      dv r||d<   | j                  ||«       |j                  dd«       |j                  dd«        |||t        |«      dz
  k(  ¬«       |j                  dd«       |j                  dd«       | j!                  «       r| j#                  |t%        | |«      ¬«       |j'                  |«       �Œl |xs d}| j(                  r |dz   | j(                  z   j+                  «       }|r	d|dœg|z   }||fS )u—  Build the wire copy of ``messages`` for one API call plus the effective system
    message. Returns ``(api_messages, effective_system)``.

    Prompt-cache invariant: historical user/assistant rows replay their ``api_content``
    sidecar (the exact bytes sent live) so the prefix stays byte-stable; the current
    user turn reuses the prologue's stamp (or composes live when a caller bypassed the
    prologue). Ephemeral context (prefetch, ``pre_llm_call`` hooks,
    ``ephemeral_system_prompt``) is added at API time only â€” ``messages`` stays untouched
    beyond the sidecar stamp, and the system prompt is built ONCE per session and
    replayed verbatim.r   )Ú!fill_empty_non_final_wire_payload)Ú_clone_message_for_send)Úcanonicalize_replay_historyN)ÚnowrS   )r]  r   rÂ  rT   rV   rO   r   rU   Ú	reasoningÚfinish_reasonr¥   )Úis_finalÚ_length_continuation_fragmentÚ_length_continuation_nudge)rA   rE   Úsystemr[  )r'  r  Úagent.conversation_loopr  Úagent.replay_cleanupr  r-   r.   r¨   rM  Ú	enumeraterX   rY   rN   rQ   Ú_copy_reasoning_content_for_apiÚ_should_sanitize_tool_callsÚ#_sanitize_tool_calls_for_strict_apir  ru   Úephemeral_system_promptr”   )r   r4   r³   rG   rH   r  rð   r  r  r  Úhas_currentÚcurrent_turn_messageÚturn_nowÚsplitÚcanonical_messagesÚapi_messagesrµ   r^   rZ   rË  ÚkeyÚ	_composedÚeffective_systems                          r    Úbuild_api_messagesr,  —  sf  € õ NÝ?Ý@äÐ2´CÓ8Òg¸QÐBWÖ=gÔZ]Ð^fÓZgÔ=g€KÙ>I˜8Ð$9Ò:ÈtÐð ×,Ñ,€HÙ%0Ñ!°a€EÙ4°X¸f¸uÐ5EÈ8ÔTÐW_Ð`eÐ`fÐWgÑgÐà€LÜÐ0Ó1ó :%‰ˆˆSñ *¨#Ó.ˆð
 —{‘{ =°$Ó7ˆØBò 	#ˆCØ�K‰K˜˜TÕ"ð	#ð
 Ð&Ñ&¨3¯7©7°6«?¸fÒ+DÜ˜,¬Ô,±ð &2�˜	Ò"ô 5Ø—K‘K 	¨2Ó.Ð0BÐDWó�	ð Ð(Ø)2�G˜IÒ&ä�|¤SÔ)©lØ—‘˜“Ð#8Ñ8ð
 ".ˆG�IÑð 	×-Ñ-¨c°7Ô;ð 	�‰�K Ô&Ø�‰�O TÔ*ñ 	*¨'¸SÄCÐHZÓD[Ð^_ÑD_Ñ=_Õað 	�‰Ð3°TÔ:Ø�‰Ð0°$Ô7ð ×,Ñ,Ô.Ø×5Ñ5ØÔ2°5¸*ÓEð 6ô ð
 	×Ñ˜GÖ$ðu:%ð~ ,Ò1¨rÐØ×$Ò$Ø,¨vÑ5¸×8UÑ8UÑU×\Ñ\Ó^ÐÙØ!)Ð6FÑGÐHÈ<ÑWˆØÐ)Ð)Ð)r"   )úagent.conversation_compressionÚIDLE_COMPACTION_STATUS_TEMPLATE)r-  Ú%PREFLIGHT_COMPRESSION_STATUS_TEMPLATE)zagent.context_engineÚ#automatic_compaction_status_message)r-  Úcompression_skipped_due_to_lock)r-  Ú&conversation_history_after_compression)r.  r/  r0  r1  r2  c                óÌ   — t         j                  | «      }|€t        dt        ›d| ›�«      ‚dd l}ddlm}  |t        | g|¢­Ž  t        |j                  |d   «      |d   «      S )Nzmodule z has no attribute r   )Ú	warn_oncer¥   )	Ú_PLUGIN_COMPAT_LAZYrY   ÚAttributeErrorrÂ   Ú	importlibÚhermes_cli.plugin_compatr4  r   Úimport_module)r   Útargetr7  r4  s       r    Ú__getattr__r;    se   € Ü ×$Ñ$ TÓ*€FØ€~Ü˜w¤x lÐ2DÀTÀHÐMÓNÐNÛÝ2ÙŒh˜Ð&˜vÓ&Ü�9×*Ñ*¨6°!©9Ó5°v¸a±yÓAÐAr"   )r   r   r   rN   rÙ  rN   )r   r   r4   rí   r'   rN   rÙ  r.   )r   r   rÙ  r/   )rG   rN   rH   rN   rÙ  rï   )rO   r   rG   rN   rH   rN   rÙ  rï   )rZ   úDict[str, Any]rÙ  rï   )r^   r<  rÙ  rÚ  )r^   zMapping[str, Any]rÙ  rï   )r   r   rf   rN   rÙ  rN   )r   r   rÙ  rN   )rO   r   rv   rï   rÙ  r/   )r   r   r4   ú	List[Any]rÙ  rÚ  )r   r   rÙ  rÚ  )r4   r=  r©   r   rÙ  r.   )r   r   r´   r   r©   r   rÙ  r   )
r»   r.   r¼   r.   r½   r.   r¾   r.   rÙ  r/   )rÎ   r.   rÙ  rÚ  )r½   r.   r¾   r.   rÙ   r.   rÙ  r/   )
r4   rí   rÜ   r.   rÝ   r.   rÙ   r.   rÙ  r/   )râ   r/   rã   r.   rä   Úfloatrå   r.   ræ   r.   rç   r/   rß   r.   rÙ  r/   )r   r   rû   rN   rü   r   rÙ  rÚ  )r   r   r(  rï   r*  r   r+  úOptional[float]r,  rï   rÙ  zTuple[str, str])r   r   r©   r   r*  r   r+  r?  r,  rï   r_  rï   r`  úOptional[Dict[str, Any]]rÙ  zTuple[Dict[str, Any], Any])r   r   rŠ   úOptional[List[Any]]rÙ  rÚ  )r   r   rì   r   rÙ  rÚ  )r   r   rü   r   rÙ  rÚ  )r   r   rñ   rN   r²   rN   rì   r   r4   r=  rŠ   rA  rÙ  rN   )
r   r   r4   r=  r³   r.   rH   rN   rÙ  rN   )rì   r   rÙ  rN   r;   )r   r   rì   r   rº  r@  rÙ  rN   )r   r   r4   r=  r³   r.   rG   rN   rH   rN   rÇ  r/   rÙ  rÚ  )r   r   rÒ  r<  rG   rN   rH   rN   rÇ  r/   rÙ  rÚ  )
r   r   r4   r=  rŠ   rA  rü   r   rÙ  rÚ  )NN)r©   r   rì  rï   rŠ   rî   r(  rï   r*  zOptional[Any]r+  r?  r,  rï   r_  rï   r`  r@  rº  r@  rÜ  r/   rÙ  rë   )r   r   r  r   rÙ  r   )r   r   r4   rí   r³   r   rG   r   rH   r   r  r   rð   r   rÙ  z Tuple[List[Dict[str, Any]], str])brÅ   Ú
__future__r   Úloggingr  r¤  rL  r"  Ú
contextlibr   Údataclassesr   Útypingr   r   r   r	   r
   r   rÊ   r   Úagent.iteration_budgetr   Úagent.memory_managerr   Úagent.memory_providerr   r�   r   Úagent.message_metadatar   r   Úagent.model_metadatar   r   Úagent.image_token_costr   rn  r   r   Úagent.turn_authorr   Ú	getLoggerrÂ   r1   r!   r7   r3   rL   rQ   r\   r_   rb   rh   rm   rp   rw   Ú	frozensetr�   r�   r    r­   r·   r¿   ÚRuntimeErrorrÁ   rÏ   rÓ   r×   rÚ   rÞ   ré   rë   rþ   r  r  r-  r?  rô   rY  rc  rt  rx  r~  r€  r›  r   r¬  r®  r¾  rÎ  rÔ  rÛ  r  r  r,  r5  r;  rº   r"   r    ú<module>rQ     sf  ðòAõ #ã Û 
Û Û Û Ý Ý !ß <× <å NÝ 2Ý ;Ý 3Ý 6ß Jß ^Ý 8ß LÝ /à	ˆ×	Ñ	˜8Ó	$€ó*ð
ØðØ.ðØ?Bðàóó<
ð;Øð;Ø25ð;àó;ðGØðGØ&)ðGØ@CðGàóGóó!ó-ó1ó@ó
9óñ   ¨Ð 4Ó5Ð ó?MóD!ó$óN#ðLWØðWØðWØ.1ðWØ?BðWà	óWô$H <ô Hóó0ó4ðbØðbØ"%ðbØ9<ðbà	óbð
Ø"ð
Ø58ð
ØJMð
Øadð
à	ó
ð MNñ$Øð$Ø*-ð$ØAFð$ØPSð$àð$à(,ð$àFIð$ð 
ó$ð: ÷0ð 0ó ð0ó"3ó&
ó0Nð*&Øð&Ø&ð&ØORð&à+ð&àGTð&ð ó&ð<6Ð Ð2ó ó 'ðT')Øð')Ø!ð')Ø9<ð')à+ð')àGTð')ð  -ð')ð $<ð	')ð
  ó')óT,\ó^	ó$óð6Øð6Ø&)ð6Ø47ð6ØPSð6àð6à/Bð6ð 	ó6ðrØðØ#ðØ<?ðØVYðàóó63óð UYðØðØ'*ðØ9Qðàóð>,tØð,tØ#ð,tØ<?ð,tØUXð,tàð,tà7;ð,tð 
ó,tð^{Øð{Ø-ð{ØCFð{Ø]`ð{à!ð{ð 
ó{ð@ØðØ#ðØ;Nðàðð 
óð( RVØ,0ð	mð _cØ<@Ðhlð 49ñmØðmØ.;ðmà8ðmàCPðmð (ðmð BQðmð ,ð	mð Q^ð	mð
 $<ðmð
 Phðmð /3ðmð ómó`ð&g*Øðg*Ø.ðg*ØJMðg*àðg*à25ðg*àCFðg*à^aðg*ð &óg*ðb (mØ-xØ+jØ'lØ.zñÐ óBr"   