+
    lHàj. ã                  óò  € 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	H
t
Ht ^ RIHt ^ RIHtHtHtHt ^ RIHt ^ RIHt ^ RIHtHt ^ R	IHt ^ R
IHtHt ^ RI H!t!H"t"H#t#H$t$ ^ RI%H&t&H't'H(t(H)t) ]PT                  ! R4      t+RVR R llt,R R lt-R R lt.R R lt/RVR R llt0R R lt1R R lt2R R lt3R R lt4R  R! lt5R"R#/R$ R% llt6R& R' lt7RWt8R( R) lt9R* R+ lt:R, R- lt;R. R/ lt<R0t=R1t>R2 R3 lt?R4 R5 lt@R6 R7 ltAR8 R9 ltB ! R: R;4      tCR< R= ltDR> R? ltER@ RA ltFRB RC ltGRD RE ltHRF RG ltI] ! RH RI4      4       tJRJ RK ltKRL RM ltLRN RO ltMRP RQ ltNRR RS ltO] ! RT RU4      4       tPR# )Xz�Running ONE pre-built child agent: heartbeat, registry entry, workspace seeding,
timeout/failure handling, result-entry assembly and cleanup (``_ChildRun``).)ÚannotationsN)Úredact_child_resultÚredact_child_text)ÚTimeoutError)ÚAnyÚDictÚListÚOptional)Úelide)Úrequest_hard_interrupt)Ú	dataclassÚfield)Ú
file_state)Ú_quietÚ_safe_progress)Ú _capture_gateway_steer_authorityÚ_close_subagent_steeringÚ_register_subagentÚ_unregister_subagent)Ú_extract_output_tailÚ_looks_like_error_outputÚ_stringify_tool_contentÚ_summarize_tool_argumentsztools.delegate_toolc               ó$   € V ^8„  d   QhRRRRRR/# )é   Úvaluer   ÚdefaultÚintÚreturn© )Úformats   "ÚB/home/ubuntu/.hermes/hermes-agent/tools/delegate_tool_child_run.pyÚ__annotate__r"      s&   € ÷ Fñ F�ð F˜cð F¨#ñ Fó    c                óT   € \        V \        \        34      '       d   \        V 4      # T# )z:int() for counters that may be mocks/None on test doubles.)Ú
isinstancer   Úfloat)r   r   s   &&r!   Ú_numr'      s!   € ä# E¬C´¨<×8Ò8Œ3ˆu‹:ÐE¸gÐEr#   c               ó    € V ^8„  d   QhRRRR/# )r   r   r   r   úOptional[str]r   )r    s   "r!   r"   r"   !   s   € ÷ 5ñ 5˜ð 5 ñ 5r#   c                ó6   € \        V \        4      '       d   V # R # ©N)r%   Ústr)r   s   &r!   Ú_str_or_noner-   !   s   € Ü˜u¤c×*Ò*ˆ5Ð4°Ð4r#   c               ó    € V ^8„  d   QhRRRR/# )r   Úchildr   r   r   )r    s   "r!   r"   r"   $   s   € ÷ ñ ˜3ð  3ñ r#   c                óŒ  € \        V RR4      '       d   V P                  # \        V RR4      p\        V\        4      '       d   TM/ p\        VP	                  R4      \        4      '       d   VP	                  R4      M/ pW3 F>  pVP	                  R4      '       d   VR,          u # VP	                  R4      R8X  g   K=   R# 	  R# )z·The child's speed tier: its own (a route's tier), else the one its request settings carry (an inherited
``service_tier: priority`` or ``speed: fast``, top level or in ``extra_body``).Úservice_tierNÚrequest_overridesÚ
extra_bodyÚspeedÚfastÚpriority)Úgetattrr1   r%   ÚdictÚget)r/   Ú	overridesÚextraÚscopes   &   r!   Ú_tier_in_effectr=   $   s¨   € ô ˆu�n d×+Ò+Ø×!Ñ!Ð!Ü˜Ð2°DÓ9€IÜ'¨	´4×8Ò8‘	¸b€IÜ+5°i·m±mÀLÓ6QÔSW×+XÒ+XˆI�M‰M˜,Ô'Ð^`€EØÓ#ˆØ�9‰9�^×$Ò$Ø˜Õ(Ò(Ø�9‰9�WÓ Ö'Úñ	 $ñ
 r#   c               ó    € V ^8„  d   QhRRRR/# )r   r/   r   r   úOptional[dict[str, Any]]r   )r    s   "r!   r"   r"   4   s   € ÷ nñ n˜ð nÐ!9ñ nr#   c                óÄ  € \        V RR4      p\        V\        4      '       g   R# ^ RIHp \        V RR4      pRp\        V\        4      '       d,   VP                  RR4      '       d   VP                  R4      MRp/ VCR	\        \        V R	R4      4      R
\        \        V R
R4      4      R\        V4      RV! \        V 4      4      /C\        V RR4      RJ d   RR/C# / C# )aD  What a backend-routed child actually ran on: its backend and label plus the provider, model, reasoning effort
(None = the provider's default) and speed tier read off the child when its result is assembled, so a fallback
provider that took over shows (``fallback_activated``). None for the default backend's unlabelled route.Ú_delegate_routeN)Úservice_tier_wordÚreasoning_configÚenabledTÚeffortÚnoneÚproviderÚmodelÚreasoning_effortr1   Ú_fallback_activatedFÚfallback_activated)r7   r%   r8   Úagent.fast_moderB   r9   r-   r=   )r/   ÚrouterB   Ú	reasoningrE   s   &    r!   Ú_route_reportrO   4   sú   € ô �EÐ,¨dÓ3€EÜ�eœT×"Ò"ÙÝ1Ü˜Ð1°4Ó8€IØ€FÜ�)œT×"Ò"Ø,5¯M©M¸)ÀT×,JÒ,J�—‘˜xÔ(ÐPVˆðnˆeð n�Z¤¬g°e¸ZÈÓ.NÓ!OØ”\¤'¨%°¸$Ó"?Ó@ÐBTÔVbÐciÓVjØÑ-¬o¸eÓ.DÓEñnô 07°uÐ>SÐUZÓ/[Ð_cÓ/cÐ$ dÐ+ðnð nð jlðnð nr#   c               ó0   € V ^8„  d   QhRRRRRRRRRR	R
R/# )r   Úidxr   Ústatusr,   Úerrorr/   r   Údurationr&   r   údict[str, Any]r   )r    s   "r!   r"   r"   E   s7   € ÷ 	ñ 	˜3ð 	¨ð 	°Cð 	Àð 	Èuð 	Ð]kñ 	r#   c                ób   € RV RVRRRVR^ RVR\        VR	R4      /p\        V4      pVe   WeR
&   V# )zGResult entry for a child that raised, never finished, or was abandoned.Ú
task_indexrR   ÚsummaryNrS   Ú	api_callsÚduration_secondsÚ_child_roleÚ_delegate_rolerM   )r7   rO   )rQ   rR   rS   r/   rT   ÚentryrM   s   &&&&&  r!   Ú_fabricated_entryr^   E   sS   € ð 	�c˜8 V¨Y¸¸gÀuÈkÐ[\Ø˜H m´W¸UÐDTÐVZÓ5[ð€Eô ˜%Ó €EØÒØˆg‰Ø€Lr#   c               ó$   € V ^8„  d   QhRRRRRR/# )r   r]   rU   Ú
late_steerr)   r   ÚNoner   )r    s   "r!   r"   r"   P   s&   € ÷ bñ b ð b¸Mð bÈdñ br#   c                óT   € V'       d    WR&   V R;;,          RV R2,          uu&   R# R# )zERecord steer text that won the race with the child's failure/timeout.Úmissed_steerrS   z2 [steer did not land before the subagent stopped: Ú]Nr   )r]   r`   s   &&r!   Ú_append_missed_steerre   P   s-   € çØ *ˆnÑØˆg�ÐOÐS]ÐR^Ð^_Ð`Õa�ñ r#   c               ó$   € V ^8„  d   QhRRRRRR/# )r   r/   r   Úlog_messager,   r   ra   r   )r    s   "r!   r"   r"   V   s!   € ÷ ñ ˜ð ¨#ð °$ñ r#   c                ó´   € \        VRR7      ;_uu_ 4        \        V RR4      p\        V4      '       d   V! 4        RRR4       R#   + '       g   i     R# ; i)zOBest-effort ``child.close()`` (tool sandboxes, browser daemons, httpx clients).T©Úexc_infoÚcloseN)r   r7   Úcallable)r/   rg   rk   s   && r!   Ú_close_childrm   V   s:   € ä	� d×	+Ö	+Ü˜˜w¨Ó-ˆÜ�E�?Š?ÙŒG÷ 
,×	+×	+Ò	+ús   –&AÁA	c               ó(   € V ^8„  d   QhRRRRRRRR/# )r   Úparent_agentr   Úopr,   r/   r   ra   r   )r    s   "r!   r"   r"   ]   s(   € ÷ :ñ : cð :¨sð :¸3ð :À4ñ :r#   c                óò   € \        V RR4      pV'       d2   V;_uu_ 4        \        V P                  V4      ! V4       RRR4       R# \        V P                  V4      ! V4       R#   + '       g   i     R# ; i)zV``parent_agent._active_children.<op>(child)`` under the parent's lock when it has one.Ú_active_children_lockN)r7   Ú_active_children)ro   rp   r/   Úlocks   &&& r!   Ú_with_children_lockru   ]   sV   € ä�<Ð!8¸$Ó?€DßßŠTÜ�L×1Ñ1°2Ô6°uÔ=÷ ‰Tô 	�×-Ñ-¨rÔ2°5Ö9÷ �TˆTús    A%Á%A6	c               ó$   € V ^8„  d   QhRRRRRR/# ©r   ro   r   r/   r   ra   r   )r    s   "r!   r"   r"   f   s!   € ÷ %ñ % ð %¨Cð %°Dñ %r#   c           	     ó°  € \        V R4      '       d   \        V RV4       \        V RR4      RJd   R# \        V RR4      p\        V RR4      pVe   VP                  4       '       d/   \	        Y;'       g    R	\        V R
R4      ;'       g    R	R7       R# \        R4      ;_uu_ 4        VP                  V4       RRR4       R#   + '       g   i     R# ; i)a‹  Register the child for parent interrupt propagation.

``interrupt()`` fans out to a SNAPSHOT of ``_active_children``; a child attached after the stop
landed (a fan-out still building its siblings, a turn that has not reached its iteration check yet)
would otherwise start with no signal and run to completion as an orphan. Mirror a pending stop here
so the whole spawn tree dies with its parent.rs   ÚappendÚ_interrupt_requestedFTNÚ_interrupt_messageÚ_hard_interrupt_requestedzparent agent interruptedÚ_tool_interrupt_reason)Útool_reasonz/Failed to propagate interrupt to late child: %s)Úhasattrru   r7   Úis_setÚ_signal_child_stopr   Ú	interrupt)ro   r/   ÚmessageÚhards   &&  r!   Ú_attach_childr…   f   sµ   € ô ˆ|Ð/×0Ò0Ü˜L¨(°EÔ:Üˆ|Ð3°UÓ;À4ÓGÙä�lÐ$8¸$Ó?€GÜ�<Ð!<¸dÓC€DØ‚|�t—{‘{—}’}Ü˜5×"GÐ"GÐ-GÜ'.¨|Ð=UÐW[Ó'\×'zÐ'zÐ`z÷	|ô ÐE×FÕFØ�O‰O˜GÔ$÷ G×F×FÒFús   Â(CÃC	c               ó$   € V ^8„  d   QhRRRRRR/# rw   r   )r    s   "r!   r"   r"   {   s&   € ÷ Kñ K ð K¨Cð K°Dñ Kr#   c                ó´   € \        V R4      '       g   R#  \        V RV4       R#   \        \        3 d"   p\        P                  RT4        Rp?R# Rp?ii ; i)zERemove the child from parent interrupt propagation (no-op if absent).rs   NÚremovez/Could not remove child from active_children: %s)r   ru   Ú
ValueErrorÚUnboundLocalErrorÚloggerÚdebug)ro   r/   Úes   && r!   Ú_detach_childrŽ   {   sO   € ä�<Ð!3×4Ò4ÙðKÜ˜L¨(°EÖ:øÜÔ)Ð*ô KÜ�‰ÐFÈ×JÒJûðKús   –% ¥A¶AÁAr~   zparent delegation endedc               ó(   € V ^8„  d   QhRRRRRRRR/# )r   r/   r   Úreasonr,   r~   r   ra   r   )r    s   "r!   r"   r"   „   s)   € ÷ .ñ .˜cð .¨Cð .¸cð .Ðbfñ .r#   c               óÊ   € \        R4      ;_uu_ 4        V e/   \        V .VO5RV/ '       g   \        V R4      '       d   RV n        RRR4       R#   + '       g   i     R# ; i)zºCooperative interrupt so the child's worker thread can exit cleanly. ``tool_reason`` is the
fixed cause the child's tools see (a pending approval wait reports it instead of a user deny).Nr~   rz   T)r   r   r   rz   )r/   r~   r�   s   &$*r!   r�   r�   „   sK   € ô 
���ØÒÔ&<¸UÐ&eÀVÒ&eÐYd×&eÐ&eÜ˜EÐ#9×:Ò:Ø)-ˆEÔ&÷ 
��Šús   ”3AÁA"	c               ó$   € V ^8„  d   QhRRRRRR/# )r   Úframer   Úindentr,   r   ú	list[str]r   )r    s   "r!   r"   r"   Ž   s&   € ÷ zñ z ð z¨Sð z°Yñ zr#   c                ó¬   € ^ RI pVP                  V 4       UUu. uF-  q3P                  4       P                  R4       F  qA V 2NK
  	  K/  	  upp# u uppi )é    NÚ
)Ú	tracebackÚformat_stackÚrstripÚsplit)r“   r”   Ú
_tracebackÚ
frame_lineÚsubs   &&   r!   Ú_format_thread_stackr    Ž   sO   € Û"Ø/9×/FÑ/FÀuÔ/MÔyÑ/M ×YjÑYjÓYl×YrÑYrÐswÖYxÐRUˆh�s�eÓÑYxÑÑ/MÒyÐyùÓys   ™3Ac               ó    € V ^8„  d   QhRRRR/# )r   Úlabelr,   r   r•   r   )r    s   "r!   r"   r"   —   s   € ÷ $ñ $˜ð $¨)ñ $r#   c                óf   €  \        V! 4       4      #   \         d   pRT  T R2.u Rp?# Rp?ii ; i)zfLines from ``produce()``, or one ``<label: ...exc>`` line so a broken attribute never aborts the dump.ú  Ú>N)ÚlistÚ	Exception)r¢   ÚproduceÚexcs   && r!   Ú_diag_sectionrª   —   s9   € ð$Ü‘G“I‹ÐøÜô $Ø�U�G˜C˜5 Ð"Ð#Õ#ûð$ús   ‚ ’0�+¥0«0c               ó    € V ^8„  d   QhRRRR/# )r   r/   r   r   r•   r   )r    s   "r!   r"   r"   ž   s   € ÷ Mñ M�sð M˜yñ Mr#   c                óf   a € V 3R  lpV 3R lpR.\        RV4      ,           \        RV4      ,           # )c                 ó   <€ \        SR R4      ;'       g    \        SRR4      ;'       g    Rp \        V \        4      pRV'       d   \        V P	                  R4      4      MR 2RV'       d   \        V 4       2.# R 2.# )Úephemeral_system_promptNÚsystem_promptÚ z  system_prompt_bytes: úutf-8zn/az  system_prompt_chars: )r7   r%   r,   ÚlenÚencode)Ú
sys_promptÚis_strr/   s     €r!   Ú_promptÚ_diag_sizes.<locals>._promptŸ   s‰   ø€ Ü˜UÐ$=¸tÓD×sÐsÌÐPUÐWfÐhlÓHm×sÐsÐqsˆ
Ü˜J¬Ó,ˆà%Ï¤c¨*×*;Ñ*;¸GÓ*DÔ&EÐUZÐ%[Ð\Ø%¿¤c¨*£oÐ%KÐLð
ð 	
àEJÐ%KÐLð
ð 	
r#   c            	     ó´   <€ \        SR R4      p V f   . # R\        V 4       2R\        \        P                  ! V \        R7      P                  R4      4       2.# )ÚtoolsNz  tool_schema_count: z  tool_schema_bytes: )r   r±   )r7   r²   ÚjsonÚdumpsr,   r³   )Útools_schemar/   s    €r!   Ú_toolsÚ_diag_sizes.<locals>._tools§   s]   ø€ Ü˜u g¨tÓ4ˆØÒØˆIà#¤C¨Ó$5Ð#6Ð7Ø#¤C¬¯
ª
°<ÌÔ(M×(TÑ(TÐU\Ó(]Ó$^Ð#_Ð`ð
ð 	
r#   z## Prompt / schema sizeszsystem_prompt: <error: ztool_schema: <error: )rª   )r/   r¶   r½   s   f  r!   Ú_diag_sizesr¿   ž   sG   ø€ õ
õ
ð 'Ð'¬-Ð8QÐSZÓ*[Õ[Ô^kð  mDð  FLó  _Mõ  Mð  Mr#   c               ó    € V ^8„  d   QhRRRR/# )r   Úworker_threadúOptional[threading.Thread]r   r•   r   )r    s   "r!   r"   r"   ²   s   € ÷ vñ vÐ!;ð vÀ	ñ vr#   c                óX  a a€ ^ RI oR.pSP                  4       pS eU   S P                  4       '       d?   VP                  S P                  4      pTP                  Ve   \        VR4      MR.4       MTP                  S f   RMR4       VV 3R lpVRR	.,           \        R
V4      ,           # )zÀWorker stack plus all other live threads (bounded to 40): the worker is often parked on a helper thread, so a
pre-HTTP wedge is indistinguishable from a slow provider without the full picture.Nz!## Worker thread stack at timeoutr¤   z  <worker frame not available>z  <no worker thread handle>z   <worker thread already exited>c                 óž  <a€ SP                  4       p \        P                  ! 4        Uu/ uF#  qP                  '       g   K  VP                  VbK%  	  ppS	'       d   S	P                  MR o. p\        V3R lV P	                  4        4       4       F´  w  pw  rVV^(8¼  d0   VP                  R\        V 4      V,
          ^,
           R24        V# VP                  V4      pTP                  RV'       d   VP                  MRV 2 V'       d   VP                  '       d   RMR R24       VP                  \        VR	4      4       K¶  	  V# u upi )
Nc              3  óF   <"  € T F  q^ ,          S8w  g   K  Vx € K  	  R# 5i)r—   Nr   )Ú.0ÚfÚworker_idents   & €r!   Ú	<genexpr>Ú6_diag_threads.<locals>._all_threads.<locals>.<genexpr>Ã   s   øé € Ð/b¹>°aÈqÍTÐUaÑMa·²»>ùs   ƒ!—
!z  <z more threads omitted>z  --- zident=z daemonr°   z ---z    )Ú_current_framesÚ	threadingÚ	enumerateÚidentÚitemsry   r²   r9   ÚnameÚdaemonÚextendr    )
ÚframesÚthÚby_identÚoutÚdumpedrÎ   r“   rÈ   Ú_sysrÁ   s
          @€€r!   Ú_all_threadsÚ#_diag_threads.<locals>._all_threads¾   s  ù€ Ø×%Ñ%Ó'ˆÜ+4×+>Ò+>Ô+@ÓMÑ+@ RÇHÅH”L�B—H‘H˜b’LÑ+@ˆÐMß.;�}×*Ò*ÀˆØˆÜ&/Ô/b¸6¿<¹<¼>Ó/bÖ&bÑ"ˆF‘N�UØ˜Œ|Ø—
‘
˜S¤ V£¨vÕ!5¸Õ!9Ð :Ð:PÐQÔRØð ˆ
ð —‘˜eÓ$ˆBØ�J‰J˜¯2 §¢°V¸E¸7Ð3CÐD×SUÐZ\×Zc×ZcÐZcÁYÐjlÐDmÐmqÐrÔsØ�J‰JÔ+¨E°6Ó:Ö;ñ 'cð ˆ
ùò Ns   ªE
ÁE
r°   z## All thread stacks at timeoutz<all-thread dump failed: )	ÚsysrË   Úis_aliver9   rÎ   rÒ   r    ry   rª   )rÁ   ÚlinesrÓ   Úworker_framerÙ   rØ   s   f    @r!   Ú_diag_threadsrß   ²   s«   ù€ ó Ø0Ð1€EØ×!Ñ!Ó#€FØÒ  ]×%;Ñ%;×%=Ò%=Ø—z‘z -×"5Ñ"5Ó6ˆØ�‰ÀÒAYÔ)¨,¸Ô=ð  aAð  `Bõ  	Cà�‰°mÒ6KÑ2ÐQsÔtöð �BÐ9Ð:Õ:¼]ÐKfÐhtÓ=uÕuÐur#   c               ó4   € V ^8„  d   QhRRRRRRRRRR	R
RRR/# )r   r/   r   rW   r   Útimeout_secondsr&   rZ   rÁ   rÂ   Úgoalr,   r   r)   r   )r    s   "r!   r"   r"   Î   sF   € ÷ 3ñ 3Øð3Ø"ð3Ø5:ð3ØNSð3à-ð3à58ð3ð ñ3r#   c                óº  a €  ^ RI Hp ^ RIpV! 4       R,          p VP                  RRR7       \        S RR4      ;'       g    RT 2p	TRT	 R	TP                  P                  4       P                  R
4       R2,          p
\        T;'       g    RP                  4       R4      pT 3R lp\        S RR4      pRRTP                  P                  4       P                  4        2RRRT 2RT	 2RT R2RTR R2RRT;'       g    RRR.\        T\        4      ORNRNR\        S RR4      : 2NpT'       dW   TP                  R\        T4       24       \        R4      ;_uu_ 4        TP                  R \!        T4       24       RRR4       TR.\#        S 4      ORNR!N,          pT\%        R"T 3R# l4      ,          pTR.\'        T4      ORNR$NR%NR&NR'NR(N,          pT
P)                  R)P+                  T4      R*R+7       \-        T
4      #   \         d     R# i ; i  + '       g   i     L ; i  \         d"   p\.        P1                  R,T4        Rp?R# Rp?ii ; i)-a1  Structured diagnostic for a subagent that timed out before any API call (otherwise "timed out with no
response", 0 API calls, nothing to inspect): ``~/.hermes/logs/subagent-timeout-<sid>-<ts>.log`` with the
child's config, prompt/schema sizes, activity snapshot and worker stack. Path, or None on failure.)Úget_hermes_homeNÚlogsT)ÚparentsÚexist_okÚ_subagent_idrQ   zsubagent-timeout-Ú-z%Y%m%d_%H%M%Sz.logr°   iè  c                ó\   <€  R V  R\        SV R4      : 2#   \         d
    R T  R2u # i ; i)r¤   ú: Nz: <unreadable>)r7   r§   )Úattrr/   s   &€r!   Ú
_attr_lineÚ5_dump_subagent_timeout_diagnostic.<locals>._attr_lineá   sC   ø€ ð1Ø˜D˜6 ¤G¨E°4¸Ó$>Ñ#AÐBÐBøÜô 1Ø˜D˜6 Ð0Ò0ð1ús   ƒ —+ª+Úvalid_tool_namesu.   # Subagent timeout diagnostic â€” issue #14726z# Generated: z
## Timeoutz  task_index:        z  subagent_id:       z  configured_timeout: Úsz  actual_duration:   z.2fz## Goalú(empty)z## Child configz## Toolsetsz  enabled_toolsets:  Úenabled_toolsetsz  loaded tool count: z  loaded tools:      z## Activity summaryz<get_activity_summary failed: c                 ó‚   <€ SP                  4       P                  4        U Uu. uF  w  rR V  RV: 2NK  	  upp # u upp i )r¤   rë   )Úget_activity_summaryrÏ   )ÚkÚvr/   s     €r!   Ú<lambda>Ú3_dump_subagent_timeout_diagnostic.<locals>.<lambda>õ   s:   ø€ ÐSX×SmÑSmÓSo×SuÑSuÔSwÔ6xÑSwÉ4È1¸¸A¸3¸bÀÁ³ÑSwÓ6xùÓ6xs   £;z## NoteszG  This file is written ONLY when a subagent times out with 0 API calls.zI  0-API-call timeouts mean the child never reached its first LLM request.zG  Common causes: oversized prompt rejected by provider, transport hang,z<  credential resolution stuck. See issue #14726 for context.r˜   r±   )Úencodingz+Subagent timeout diagnostic dump failed: %s)Úhermes_constantsrä   ÚdatetimeÚmkdirr§   r7   ÚnowÚstrftimer
   ÚstripÚ	isoformatÚmapÚ_DIAG_CHILD_ATTRSry   r²   r   Úsortedr¿   rª   rß   Ú
write_textÚjoinr,   r‹   Úwarning)r/   rW   rá   rZ   rÁ   râ   rä   Ú_dtÚlogs_dirÚsubagent_idÚ	dump_pathÚ_goal_previewrí   Ú
tool_namesrÝ   r©   s   d$$$$$          r!   Ú!_dump_subagent_timeout_diagnosticr  Î   s¯  ø€ ð,Ý4ÛÙ"Ó$ vÕ-ˆð	Ø�N‰N 4°$ˆNÔ7ô ˜e ^°TÓ:×PÐPÀÀJÀ<Ð>PˆØÐ!2°;°-¸qÀÇÁ×AQÑAQÓAS×A\ÑA\Ð]lÓAmÐ@nÐnrÐsÕsˆ	Ü˜tŸz˜z r×0Ñ0Ó2°DÓ9ˆõ	1ô ˜UÐ$6¸Ó=ˆ
à<ÀÈcÏlÉl×N^ÑN^ÓN`×NjÑNjÓNlÐMmÐ>nÐprØÐ1°*°Ð>ÐBWÐXcÐWdÐ@eØ$ _Ð$5°QÐ7Ð;PÐQaÐbeÐPfÐfgÐ9hÐjlÐnwØ×&Ð&˜Y¨Ð,=ð	
ô ADÀJÔPaÓ@bð	
ð
 ð
ð
 ð
ð
 "7´w¸uÐFXÐZ^Ó7_Ñ6bÐcð
ˆ÷ Ø�L‰LÐ0´°Z³Ð0AÐBÔCÜ˜—•Ø—‘Ð4´V¸JÓ5GÐ4HÐIÔJ÷ à�"ÐE”{ 5Ó)ÐE¨2ÐEÐ/DÐEÕEˆØ”Ø,Ô.xó
õ 	
ˆð 	�"ð 
”} ]Ó3ð 
°Rð 
¸ð 
ØUð
àWð
ð Vð
ð Kð	
õ 	
ˆð 	×Ñ˜TŸY™Y uÓ-¸ÐÔ@Ü�9‹~ÐøôG ô 	Úð	ú÷, —ûô ô Ü�‰ÐDÀcÔJÝûðúsg   ƒH. œH	 ¯H. ÁA
H. ÂA3H. ÄA#H. Å%HÆBH. È	HÈH. ÈHÈH. ÈH+	È&H. È.IÈ9IÉIç      @gš™™™™™é?c               ó$   € V ^8„  d   QhRRRRRR/# )r   Úidle_secondsr&   Úchild_timeoutr   r,   r   )r    s   "r!   r"   r"     s!   € ÷ ñ  uð ¸Uð Àsñ r#   c                ó   € R V R RVR R2# )z3[delegation budget warning] No progress signal for z.0fz
s of your uy   s inactivity window. Finish the current step and return your summary now â€” the work is discarded if the window elapses.r   )r  r  s   &&r!   Ú_budget_warning_textr    s'   € à
=¸lÈ3Ð=OÈzÐZgÐhkÐYlð mð 	ðr#   c               ó(   € V ^8„  d   QhRRRRRRRR/# )r   r/   r   r  r&   r  r   ra   r   )r    s   "r!   r"   r"     s)   € ÷ =ñ =˜cð =°ð =Àuð =ÐQUñ =r#   c                óÈ   € \        V RR4      p\        V4      '       g   R#  V! \        W4      4       R#   \         d"   p\        P                  RT4        Rp?R# Rp?ii ; i)zeQueue the one-line warning through the child's steer path (delivered at its next iteration boundary).ÚsteerNzbudget warning steer failed: %s)r7   rl   r  r§   r‹   rŒ   )r/   r  r  r  r©   s   &&&  r!   Ú_warn_child_budgetr    sQ   € ä�E˜7 DÓ)€EÜ�E�?Š?Ùð=ÙÔ" <Ó?Ö@øÜô =Ü�‰Ð6¸×<Ò<ûð=ús   ¢5 µA!Á AÁA!c               ó    € V ^8„  d   QhRRRR/# )r   r/   r   r   Útupler   )r    s   "r!   r"   r"     s   € ÷ 	iñ 	i sð 	i¨uñ 	ir#   c                óÂ   €  V P                  4       ;'       g    / pTP                  R4      TP                  R4      TP                  R4      3#   \         d    Ru # i ; i)u‹  ``(completed calls, current tool, activity clock)`` â€” the progress signals the heartbeat's stale verdict
already watches. A child waiting on an in-flight LLM completion is ALIVE: its activity clock ticks while the
provider works (``direct_api_call``'s 15s heartbeat) and the call itself is bounded by the per-call stale
watchdog, so at the delegation layer it must not read as stuck (#116001).Úapi_call_countÚcurrent_toolÚlast_activity_ts)NNN)rô   r§   r9   )r/   rX   s   & r!   Ú_child_activity_fingerprintr    s`   € ð
"Ø×,Ñ,Ó.×4Ð4°"ˆð �K‰KÐ(Ó)¨7¯;©;°~Ó+FÈÏÉÐTfÓHgÐhÐhøô ô "Ø!Ò!ð"ús   ‚A ™A ÁAÁAc               ó    € V ^8„  d   QhRRRR/# )r   r/   r   r   úOptional[float]r   )r    s   "r!   r"   r"   (  s   € ÷ ñ  ð ¨ñ r#   c           	     óø   €  V P                  4       ;'       g    / P                  R4      pVe:   \        \        R\        P                  ! 4       \        V4      ,
          4      ^4      # R#   \         d     R# i ; i)zÒSeconds since the child's activity clock last ticked, or None when the child exposes no clock. Reported on a
timeout so an operator can tell a slow-but-live provider from a runaway without transcript forensics.r  Nç        )rô   r9   ÚroundÚmaxÚtimer&   r§   )r/   Útss   & r!   Ú_child_last_event_ager'  (  sh   € ðØ×(Ñ(Ó*×0Ð0¨b×5Ñ5Ð6HÓIˆØ>@ºnŒu”S˜œdŸiši›k¬E°"«IÕ5Ó6¸Ó:ÐVÐRVÐVøÜô Úðús   ‚A* ™AA* Á(A* Á*A9Á8A9c                  óD   € ] tR tRtRtR R ltR R ltR R ltR	 tR
t	R# )Ú
_Heartbeati1  uC  One child's parent-activity heartbeat via the shared periodic scheduler
(``agent.periodic_scheduler``) â€” not one daemon thread per child. NOT started at construction:
the caller calls ``start()`` inside its ``try`` so a failed schedule (OS thread exhaustion on
first use) leaves ``handle`` None and ``stop()`` is a no-op.c               ó$   € V ^8„  d   QhRRRRRR/# )r   r/   r   ro   rW   r   r   )r    s   "r!   r"   Ú_Heartbeat.__annotate__7  s!   € ÷ =ñ =˜cð =°ð =À#ñ =r#   c                	óž   € WVuV n         V n        V n        R ^ RRRRR^ /V n        RV n        \
        P                  ! 4       V n        RV n        R# )ÚiterÚtoolNr&  Ústale)	r/   ro   rW   Ú	last_seenÚhandlerÌ   ÚEventÚsettledÚstale_threshold_seconds)Úselfr/   ro   rW   s   &&&&r!   Ú__init__Ú_Heartbeat.__init__7  sR   € Ø9>ÈjÐ6ˆŒ
�DÔ% t¤ð ! ! V¨T°4¸¸wÈÐJˆŒØˆŒô !—’Ó(ˆŒð 9=ˆÖ$r#   c               ó   € V ^8„  d   QhRR/# ©r   r   ra   r   )r    s   "r!   r"   r+  D  s   € ÷ ?ñ ?�tñ ?r#   c                	óN   € ^ RI Hp ^ RIHp V! V P                  V4      V n        R# )r—   )Úschedule)Ú_HEARTBEAT_INTERVALN)Úagent.periodic_schedulerr;  Útools.delegate_toolr<  Útickr1  )r5  r;  r<  s   &  r!   ÚstartÚ_Heartbeat.startD  s   € Ý5Ý;Ù˜tŸy™yÐ*=Ó>ˆŽr#   c               ó   € V ^8„  d   QhRR/# r9  r   )r    s   "r!   r"   r+  I  s   € ÷ 'ñ '�dñ 'r#   c                ó^   € V P                   e   V P                   P                  ^R7       R# R# )z?wait=5 mirrors the old thread join: an in-flight tick finishes.N©Úwait)r1  Úcancel©r5  s   &r!   ÚstopÚ_Heartbeat.stopI  s&   € à�;‰;Ò"Ø�K‰K×Ñ AÐÖ&ñ #r#   c                óf  € ^ RI HpHpHp V P                  V P
                  V P                  V P                  3w  rErgVe   \        VRR4      MRpV'       g   R# RV R2p	 VP                  4       p
V
P                  R4      pV
P                  R^ 4      pV
P                  R^ 4      pV
P                  R	4      pVRJ;'       d    VR
,          RJ ;'       g    WçR
,          8„  pWÇR,          8”  g   W·R,          8w  g	   V'       d   VP                  WË^ R7       Ve   WçR
&   MVR;;,          ^,          uu&   V'       d   TMTpVR,          V8¼  dS   \        P                  RYgR,          T;'       g    R4       VV,          V n        V P                  P!                  4        R# V'       d   RV RV RV R2p	M4V
P                  RR4      '       d   RV
P                  RR4       RV RV R2p	\%        R4      ;_uu_ 4        V! V	4       RRR4       R#   \"         d     L3i ; i  + '       g   i     R# ; i)z,Returning False stops the periodic callback.)r<  Ú_HEARTBEAT_STALE_CYCLES_IDLEÚ_HEARTBEAT_STALE_CYCLES_IN_TOOLNÚ_touch_activityzdelegate_task: subagent z workingr  r  Úmax_iterationsr  r&  r-  r.  )r-  r.  r/  r/  u`   Subagent %d appears stale (no progress for %d heartbeat cycles, tool=%s) â€” abandoning its waitz<none>Fz delegate_task: subagent running z (iteration Ú/Ú)Úlast_activity_descr°   )r>  r<  rK  rL  r/   ro   rW   r0  r7   rô   r9   Úupdater‹   r  r4  r3  Úsetr§   r   )r5  r<  rK  rL  r/   ro   rW   r0  ÚtouchÚdescÚchild_summaryÚ
child_toolÚ
child_iterÚ	child_maxÚchild_activity_tsÚactivity_advancedÚstale_cycless   &                r!   r?  Ú_Heartbeat.tickN  sC  € çzÑzØ59·Z±ZÀ×ARÑARÐTX×TcÑTcÐei×esÑesÐ5sÑ2ˆ˜ZØBNÒBZ”˜Ð&7¸Ô>Ð`dˆßÙØ)¨*¨°XÐ>ˆð 	Ø!×6Ñ6Ó8ˆMØ&×*Ñ*¨>Ó:ˆJØ&×*Ñ*Ð+;¸QÓ?ˆJØ%×)Ñ)Ð*:¸AÓ>ˆIØ -× 1Ñ 1Ð2DÓ EÐð !2¸Ð =÷ !ð !Ø˜$• 4Ð'×NÐNÐ+<È½Ñ+Nð ð  fÕ-Ô-°ÈÕ?PÔ1P×TeØ× Ñ  jÈÐ ÔKØ$Ò0Ø&7˜d‘Oøà˜'×" aÕ'Ó"ß>HÑ:ÐNjˆLØ˜Õ! \Ô1Ü—‘ØvØ¨'Õ 2°J×4JÐ4JÀ(ôð
 0<Ð>QÕ/Q�Ô,Ø—‘× Ñ Ô"ÙßØ9¸*¸À\ÐR\ÐQ]Ð]^Ð_hÐ^iÐijÐk‘Ø×"Ñ"Ð#7¸×<Ò<Ø1°-×2CÑ2CÐDXÐZ\Ó2]Ð1^Ð^jÐkuÐjvÐvwð  yBð  xCð  CDð  E�ô �D�\�\Ù�$ŒK÷ áøô	 ô 	Ùð	úçŽ\áúsU   Á A H ÃH Ã-H Ä8H Ä;2H Å./H ÆH Æ'H Æ4H ÇH Ç;	HÈHÈHÈH0	)r/   r1  r0  ro   r3  r4  rW   N)
Ú__name__Ú
__module__Ú__qualname__Ú__firstlineno__Ú__doc__r6  r@  rH  r?  Ú__static_attributes__r   r#   r!   r)  r)  1  s   † ñDõ
=õ?õ
'ö
+r#   r)  c               ó(   € V ^8„  d   QhRRRRRRRR/# )r   r/   r   ro   rW   r   r   r)  r   )r    s   "r!   r"   r"   |  s(   € ÷ 7ñ 7˜Cð 7¨sð 7Àð 7È
ñ 7r#   c                ó   € \        WV4      # )z<Build (not start) one child's heartbeat; see ``_Heartbeat``.)r)  )r/   ro   rW   s   &&&r!   Ú_start_heartbeatrf  |  s   € ä�e¨:Ó6Ð6r#   c               ó4   € V ^8„  d   QhRRRRRRRRRRR	RR
R/# )r   r/   r   ro   râ   r,   Úowner_session_idr)   Úowner_transportÚowner_session_recordr   r   )r    s   "r!   r"   r"   €  sF   € ÷ $ñ $Øð$Ø!ð$Ø),ð$ØCPð$Øcfð$àð$ð ñ$r#   c               ó,  € \        V RR4      p\        V\        4      '       d	   V'       g   R# Vf6   \        R4      ;_uu_ 4        ^ RIHp V! RR4      ;'       g    RpRRR4       V'       d   Ve   Vf   \        V4      w  rE\        V R^4      p\        RTR\        \        V R	R4      4      R
\        V\        4      '       d   \        ^ V^,
          4      M^ RTR\        \        V RR4      4      R\        \        V RR4      4      R\        P                  ! 4       RRR^ RT R\        \        V RR4      ;'       g    R4      ;'       g+    \        \        VRR4      ;'       g    R4      ;'       g    RRVRVRV/4       V#   + '       g   i     EL,; i)zÑRegister the live child in the module registry; return its subagent_id. Test doubles without a stable string
``_subagent_id`` are not registered (None) and the caller skips every registry interaction for them.rè   N)Úget_session_envÚHERMES_UI_SESSION_IDr°   Ú_delegate_depthr	  Ú	parent_idÚ_parent_subagent_idÚdepthrâ   Údelegation_idÚ_delegation_idrH   Ú
started_atrR   ÚrunningÚ
tool_countÚagentÚowner_agent_session_idÚ_parent_session_idÚ
session_idrh  ri  rj  )r7   r%   r,   r   Úgateway.session_contextrl  r   r   r-   r   r$  r%  )	r/   ro   râ   rh  ri  rj  rè   rl  Ú
_raw_depths	   &&&$$$   r!   Ú_register_childr}  €  st  € ô ˜5 .°$Ó7€LÜ�l¤C×(Ò(·ÙØÒÜ�D�\�\Ý?Ù.Ð/EÀrÓJ×RÐRÈdÐ÷ ÷ ˜_Ò4Ð8LÒ8TÜ0PÐQaÓ0bÑ-ˆÜ˜Ð 1°1Ó5€JÜØ�|Ø”\¤'¨%Ð1FÈÓ"MÓNØ¬:°jÄ#×+FÒ+F”�Q˜
 Q�Ô'ÈAØ�Øœ¤g¨eÐ5EÀtÓ&LÓMØ”œg e¨W°dÓ;Ó<Ø”d—i’i“k 8¨Y¸ÀaÈÐRWð 	!Ü”˜Ð3°RÓ8×>Ð>¸BÓ?×}Ð}Ä3ÄwÈ|Ð]iÐkmÓGn×GtÐGtÐrtÓCu×}Ð}Ðy}ð 	Ð,Ø˜?ØÐ 4ð%ô ð( Ð÷5 �\ˆ\ús   ÁFÆF	c               ó$   € V ^8„  d   QhRRRRRR/# )r   ro   r   Úparent_task_idr	  r)   r   )r    s   "r!   r"   r"   ¦  s"   € ÷ ñ ¨Cð Àð ÐS`ñ r#   c           	     óÐ  € ^ RI HpHp V! 4       '       g   R# \        R4      ;_uu_ 4        ^ RIHp VP                  4       '       g!   \        P                  R4        RRR4       R# Rp\        R4      ;_uu_ 4        ^ RI	H
p V! V4      pRRR4       TP                  T;'       g	    V! V 4      VR7      uuRRR4       #   + '       g   i     L=; i  + '       g   i     R# ; i)zÚOpt-in worktree isolation: own git worktree off the parent's HEAD (the
child's terminal starts there). Git-only, local-backend-only; failures
degrade silently to the shared workspace. Returns the worktree info or None.)Ú_get_worktree_isolationÚ_resolve_workspace_hintNz#worktree isolation setup failed: %s©Úsubagent_worktreez6worktree isolation skipped: non-local terminal backend)Úget_session_cwd)r	  )r>  r�  r‚  r   r¹   r„  Úlocal_backend_activer‹   rŒ   Útools.terminal_toolr…  Úcreate_subagent_worktree)ro   r  r	  r�  r‚  r„  Ú_parent_cwdÚ_gscs   &&&     r!   Ú_create_isolated_worktreer‹  ¦  s²   € ÷ UÙ"×$Ò$ÙÜ	Ð5×	6Õ	6Ý+Ø ×5Ñ5×7Ò7Ü�L‰LÐQÔRØ÷	 
7Ñ	6ð
 ˆÜ�D�\�\ÝCÙ˜~Ó.ˆK÷ ð !×9Ñ9Ø×@Ð@Ñ2°<Ó@Èkð :ó 
÷ 
7Ò	6÷ �\ú÷ 
7Ö	6ñ ús/   «3CÁ(CÁ=C	ÂCÂ(CÃCÃCÃC%	c               ó$   € V ^8„  d   QhRRRRRR/# )r   r/   r   Úchild_futurer   ra   r   )r    s   "r!   r"   r"   »  s!   € ÷ ñ  cð ¸ð Àñ r#   c                ó   a aaa€ SP                  V 3R l4       \        S RR4      o\        S4      '       g   R# R V3R lloS! R4       \        P                  ! RVV3R l4      pR	Vn        VP                  4        R# )
u�  Hand ``child.close()`` to a Future done-callback and drain its transports.

The interrupt is cooperative: the worker still runs its finally path, so closing now could close SQLite under its
final write â€” the done-callback is the first safe boundary. The abandoned worker is usually parked in an OpenSSL
read; NEVER hard-close that transport from this thread (cross-thread FD release under a live SSL read corrupts
native state) â€” shutdown() the pooled sockets so the read settles with EOF and the worker unwinds. One immediate
sweep + one delayed re-sweep for a connection opened in between; a worker that still won't settle keeps its
resources until process exit.
c                ó   <€ \        SR 4      # )z1Failed to close timed-out child after worker exit)rm   )Ú_doner/   s   &€r!   r÷   Ú,_defer_close_after_timeout.<locals>.<lambda>Å  s   ø€ ´¸eÐExÔ1yr#   Ú#_drain_transports_after_abandonmentNc               ó    € V ^8„  d   QhRRRR/# )r   Úphaser,   r   ra   r   )r    s   "r!   r"   Ú0_defer_close_after_timeout.<locals>.__annotate__Ð  s   € ÷ 7ñ 7˜3ð 7 4ñ 7r#   c                ó†   <€ \        R V RR7      ;_uu_ 4        S! RV  2R7       RRR4       R#   + '       g   i     R# ; i)z+Timed-out child transport drain (%s) failedTri   Údelegate_timeout_)r�   N)r   )r”  Ú_drains   &€r!   Ú_drain_onceÚ/_defer_close_after_timeout.<locals>._drain_onceÐ  s4   ø€ ÜÐAÀ5ÐSW×XÖXÙÐ-¨e¨WÐ5Õ6÷ Y×X×XÒXús	   ˜/¯A 	Ú	immediater  c                 óD   <€ SP                  4       '       d   R # S ! R4      # )NÚresweep)Údone)r™  r�  s   €€r!   r÷   r‘  Õ  s"   ø€ ¸,×:KÑ:K×:MÒ:M°$Ð2iÑS^Ð_hÓSiÐ2ir#   T)Úadd_done_callbackr7   rl   rÌ   ÚTimerrÑ   r@  )r/   r�  Ú_resweep_timerr˜  r™  s   ff @@r!   Ú_defer_close_after_timeoutr¢  »  sl   û€ ð ×"Ñ"Ô#yÔzô �UÐAÀ4ÓH€FÜ�F×ÒÙ÷7ð 7ñ �ÔÜ—_’_ SÕ*iÓj€NØ €NÔØ×ÑÖr#   c               ó    € V ^8„  d   QhRRRR/# )r   r/   r   r   ztuple[Any, Optional[str]]r   )r    s   "r!   r"   r"   Ù  s   € ÷ &ñ & 3ð &Ð+Dñ &r#   c           	     ó®  aaa€ \        V RR4      pVf   R
# ^ RIHo ^ RIHp \        V RR4      oV! V 4      ;_uu_ 4        VP                  4       oSeÎ   \        R4      ;_uu_ 4        \        V3R lVP                  4        4       R4      pS! VS4      '       gX   VP                  S4       \        VV3R lVP                  4        4       R4      pVe   VP                  VP                  4      MRoVe$   \        V R	4      '       d   V P                  V4       RRR4       RRR4       VS3#   + '       g   i     L; i  + '       g   i     TS3# ; i)aØ  Lease a credential from the child's pool (if any) and bind it; ``(pool, lease_id)``. The bound entry must
serve the child's endpoint: on a mixed same-provider pool the least-leased pick may target another host, so it is
released and an endpoint-matching entry is leased by id instead (#68237). Child work, so it runs in the child's
profile scope: a lease may refresh that profile's OAuth entries, and ``_swap_credential`` re-reads TLS/header
config for the bound endpoint.Ú_credential_poolN)Ú%credential_pool_entry_serves_endpoint©Úchild_profile_scopeÚbase_urlz-Failed to bind child to leased credential: %sc              3  óL   <"  € T F  qP                   S8X  g   K  Vx € K  	  R # 5ir+   )Úid)rÆ   r�   Úleased_cred_ids   & €r!   rÉ   Ú*_lease_child_credential.<locals>.<genexpr>ë  s   øé € Ð$_Ñ0D¨1ÏÉÐP^ÑH^§Q¢QÓ0Dùs   ƒ$š
$c              3  ón   <"  € T F*  qP                   R 8w  g   K  S! VS4      '       g   K&  Vx € K,  	  R# 5i)ÚdeadN)Úlast_status)rÆ   r�   Ú_entry_serves_endpointr©  s   & €€r!   rÉ   r­  ï  s,   øé € Ð|Ñ$8˜q¿M¹MÈVÑ<SœÑXnÐopÐrz×X{ŸšÓ$8ùs   ƒ5š5«
5Ú_swap_credential)NN)r7   Úagent.credential_poolr¦  Útools.delegate_tool_routesr¨  Úacquire_leaser   ÚnextÚentriesÚrelease_leaser«  r   r²  )r/   Ú
child_poolr¨  Úleased_entryr±  r©  r¬  s   &   @@@r!   Ú_lease_child_credentialr»  Ù  s/  ú€ ô ˜Ð 2°DÓ9€JØÒØÐÝeÝ>Ü�u˜j¨$Ó/€HÙ	˜U×	#Õ	#Ø#×1Ñ1Ó3ˆØÒ%ÜÐG×HÕHô  $Ô$_°
×0BÑ0BÔ0DÓ$_ÐaeÓf�Ù-¨l¸H×EÒEØ×,Ñ,¨^Ô<Ü#'Ý| J×$6Ñ$6Ô$8Ó|Øó$�Lð S_ÒRj Z×%=Ñ%=¸l¿o¹oÔ%NÐpt�NØÒ+´¸Ð?Q×0RÒ0RØ×*Ñ*¨<Ô8÷ I÷ 
$ð  �~Ð%Ð%÷ I×Hú÷ 
$Ö	#ð  �~Ð%Ð%ús%   Á (EÁ(B2D.	ÄEÄ.D>Ä9EÅE	c               ó(   € V ^8„  d   QhRRRRRRRR/# )	r   ÚresultrU   r	  r)   r/   r   r   ra   r   )r    s   "r!   r"   r"   ÷  s0   € ÷ lñ l˜nð l¸=ð lÐQTð lÐY]ñ lr#   c                óº   € V'       d   \        W4      MRpV'       d>   V P                  R4      p\        V\        4      '       d   V'       d   V RV 2MTV R&   R# R# )züLinearization boundary for registry steering: from here the child cannot consume another steer. Closing under
the registry lock either rejects a concurrent caller or drains every accepted exact text into the result before
callbacks/result assembly run.NÚpending_steerr˜   )r   r9   r%   r,   )r½  r	  r/   ÚlateÚexistings   &&&  r!   Ú_merge_late_steerrÂ  ÷  sR   € ÷ <GÔ# KÔ7ÈD€DßØ—:‘:˜oÓ.ˆÜ;EÀhÔPS×;TÒ;T×Ya X J¨b°°Ñ"7ÐgkˆˆÓñ r#   c                  ó@   € ] tR tRt$ R]R&   R]R&   R]R&   R]R	&   R
tR# )Ú_SchemaOutcomei  r?   ÚschemazOptional[bool]Úvalidr•   Úerrorsr   Úretriesr   N)r^  r_  r`  ra  Ú__annotations__rc  r   r#   r!   rÄ  rÄ    s   ‡ à$Ó$ØÓØÓØ‡Lr#   rÄ  c               ó0   € V ^8„  d   QhRRRRRRRRR	RR
R/# )r   r/   r   r½  rU   rW   r   Úchild_task_idr,   Úrelay_child_textr   rÄ  r   )r    s   "r!   r"   r"     sD   € ÷ )Lñ )LØð)LØ&ð)LØ47ð)LØHKð)LØ_bð)Làñ)Lr#   c                ó:  € \        V RR4      p\        V\        4      '       g   \        VR. ^ 4      # ^ RIHpHp VP                  R4      ;'       g    RpV! W…4      w  ršV	'       g/   VP                  4       '       d   VP                  RR4      '       d   \        WYV
^ 4      # Rp ^ RI	H
p ^ R	IHp V! V 4      ;_uu_ 4        T! \        \        V R
R4      ;'       g    R4      4      ;_uu_ 4        V P                  V! V
4      VVR7      pRRR4       RRR4       \        T\        4      '       dò   TP                  R4      ;'       g    RpTP                  4       '       d   YñR&    \%        TP                  R^ 4      ;'       g    ^ 4      \%        TP                  R^ 4      ;'       g    ^ 4      ,           TR&   TP                  R4      p\        T\*        4      '       d9   \        TP                  R4      \*        4      '       d   TR,          T,           TR&   T! Yõ4      w  rš\        YYT
^4      #   + '       g   i     EL-; i  + '       g   i     EL9; i  \         d"   p\         P#                  RY.4        Rp?ELcRp?ii ; i  \&        \(        3 d     Lài ; i)zØValidate the final answer against the attached output_schema with ONE bounded retry. Schema-less children (no
dict on ``child._delegate_output_schema``) take no branch here so their result entry stays byte-identical.Ú_delegate_output_schemaN)Úbuild_retry_messageÚvalidate_outputÚfinal_responser°   ÚinterruptedF©Údelegated_child_contextr§  rz  ©Úuser_messageÚtask_idÚstream_callbackz(Subagent %d schema-retry turn failed: %srY   Úmessages)r7   r%   r8   rÄ  Útools.delegation_output_schemarÏ  rÐ  r9   rÿ   Úagent.delegation_contextrÔ  r´  r¨  r,   Úrun_conversationr§   r‹   r  r   Ú	TypeErrorr‰   r¦   )r/   r½  rW   rË  rÌ  Ú_output_schemarÏ  rÐ  Ú_first_textÚ_schema_validÚ_schema_errorsÚ_retry_resultrÔ  r¨  Ú
_retry_excÚ_retry_textÚ_retry_messagess   &&&&&            r!   Ú_validate_child_output_schemaræ    s:  € ô
 ˜UÐ$=¸tÓD€NÜ�n¤d×+Ò+Ü˜n¨d°B¸Ó:Ð:ßSØ—*‘*Ð-Ó.×4Ð4°"€KÙ$3°KÓ$PÑ!€Mß˜K×-Ñ-×/Ò/°6·:±:¸mÈU×3SÒ3SÜ˜n¸^ÈQÓOÐOð €Mð[õ 	EÝBÙ  ×'Õ'Ñ)@ÄÄWÈUÐT`ÐbdÓEe×EkÐEkÐikÓAl×)mÕ)mØ!×2Ñ2Ù0°Ó@È-Ø 0ð 3ó ˆM÷ *n×'ô �-¤×&Ò&Ø#×'Ñ'Ð(8Ó9×?Ð?¸RˆØ×Ñ×ÒØ'2Ð#Ñ$ð	Ü"% f§j¡j°¸aÓ&@×&EÐ&EÀAÓ"FÌÈ]×M^ÑM^Ð_jÐlmÓMn×MsÐMsÐrsÓItÕ"tˆF�;Ñð (×+Ñ+¨JÓ7ˆÜ�o¤t×,Ò,´¸F¿J¹JÀzÓ<RÔTX×1YÒ1YØ!'¨
Õ!3°oÕ!EˆF�:ÑÙ(7¸Ó(TÑ%ˆÜ˜.¸ÈÓKÐK÷' *n×)mÐ)mú×'×'Ð'ûô
 ô [Ü�‰ÐAÀ:×ZÒZûð[ûô œ:Ð&ô 	Ùð	úsl   Â%I Ã/IÃ0H/	ÄIÄI Å'J Æ#J Æ)J È/I È:	IÉI	ÉI ÉI ÉJÉ"I>É>JÊJÊJc               ó    € V ^8„  d   QhRRRR/# )r   rÙ  r   r   zlist[dict[str, Any]]r   )r    s   "r!   r"   r"   3  s   € ÷ ñ  ð Ð(<ñ r#   c           
     óv  € . p/ p\        V \        4      '       g   V# V  EF•  p\        V\        4      '       g   K  VP                  R4      R8X  d¨   VP                  R4      ;'       g    .  F†  pVP                  R/ 4      pVP                  RR4      pRVP                  RR	4      R
\	        V4      R\        V4      /pVP                  V4       VP                  R4      '       g   K{  WrVR,          &   Kˆ  	  KÙ  VP                  R4      R8X  g   Kñ  \        VP                  RR4      4      pR\	        V4      R\        V4      '       d   RMR/p	VP                  R4      p
V
'       d   VP                  V
4      MRpVe   VP                  V	4       EKr  V'       g   EK}  VR,          P                  V	4       EK˜  	  V# )zrTool trace from the child's conversation messages, pairing parallel
tool calls with their results by tool_call_id.ÚroleÚ	assistantÚ
tool_callsÚfunctionÚ	argumentsr°   r.  rÐ   ÚunknownÚ
args_bytesÚinput_summaryr«  ÚcontentÚresult_bytesrR   rS   ÚokÚtool_call_idNéÿÿÿÿ)
r%   r¦   r8   r9   r²   r   ry   r   r   rR  )rÙ  Ú
tool_traceÚtrace_by_idÚmsgÚtcÚfnrí  Úentry_trñ  Úresult_metaÚtc_idÚtargets   &           r!   Ú_build_tool_tracerÿ  3  su  € ð (*€JØ-/€KÜ�h¤×%Ò%ØÐÜˆÜ˜#œt×$Ò$ÙØ�7‰7�6‹?˜kÔ)Ø—g‘g˜lÓ+×1Ð1¨rÒ1�Ø—V‘V˜J¨Ó+�ØŸF™F ;°Ó3�	à˜BŸF™F 6¨9Ó5°|ÄSÈÃ^Ø#Ô%>¸yÓ%Ið�ð ×!Ñ! 'Ô*Ø—6‘6˜$—<”<Ø,3  4¥Ó)ó 2ð �W‰W�V‹_ Ö&Ü-¨c¯g©g°iÀÓ.DÓEˆGØ)¬3¨w«<¸ÔNfÐgn×NoÒNoÁ7ÐuyÐzˆKØ—G‘G˜NÓ+ˆEß/4�[—_‘_ UÔ+¸$ˆFØÒ!Ø—‘˜k×*ß’Ø˜2•×%Ñ% k×2ñ- ð. Ðr#   c               ó0   € V ^8„  d   QhRRRRRRRRR	R
RR/# )r   r/   r   r½  rU   rW   r   rT   r&   rÅ  rÄ  r   r   )r    s   "r!   r"   r"   S  sD   € ÷ dñ dØðdØ&ðdØ47ðdØCHðdØR`ðdàñdr#   c                óÂ  aaa€ VP                  R4      ;'       g    Rp\        V4      ;'       d    VP                  4       R8g  pRpVP                  RR4      '       dq   RRr˜^ RIHo RVP                  4       R0o\        VVV3R l\        VP                  R	4      ;'       g    . 4       4       R4      p
V
'       d   VP                  4       T
rWMZVP                  R
4      '       g   VP                  R4      '       d   R
Rr˜M(VP                  RR4      '       d   RMRp	V'       d   RMR
p\        V RR4      p\        V RR4      pRTRTRTRVP                  R^ 4      RTR\        \        V RR4      4      RT	RV	R8H  RR\        \        V R^ 4      4      R\        \        V R^ 4      4      /R\        VP                  R	4      ;'       g    . 4      R \        V R!R4      R"\        V\        \        34      '       d   \        T;'       g    R4      MR/p\        VR",          ^4      VR#&   \        V\        4      '       d   V'       d   TMR$VR%&   \!        V 4      pVe   WíR&&   VR
8X  dJ   VP                  RR'4      VR&   VP                  R(4      p\        V\        4      '       d   V'       d   WýR(&   MV'       d   W}R&   \        VP"                  \$        4      '       d¬   \        VP&                  4      VR)&   VP(                  '       d   VP(                  VR*&   VP&                  '       g"   VP*                  '       d   VP*                  VR+&   VP&                  RJ d0   V'       d(   R,VP(                  '       d   R-MR,           R.,           VR/&   VP                  R04      p\        V\        4      '       d6   VP                  4       '       d    VVR1&   R2V R32pV'       d   V R4V 2MTVR&   V# )5a  Parent-visible result entry (status, exit_reason, tool trace, tokens, cost).
``status``/``exit_reason``/``truncated`` follow the ``_run_single_child`` contract; a structured failure always
wins over the summary-presence heuristic (a fallback for legacy/mock results only).rÑ  r°   rñ   rÒ  F)Úflatten_message_textzOperation interrupted.c              3  ó²   <"  € T FL  qP                  R 4      R8X  g   K  S! VP                  R4      4      P                  4       ;oS9  g   KH  Sx € KN  	  R# 5i)ré  rê  rñ  N)r9   rÿ   )rÆ   Úmr  ÚplaceholdersÚts   & €€€r!   rÉ   Ú&_build_result_entry.<locals>.<genexpr>e  sQ   øé € ð gÑ#I˜aÏUÉUÐSYË]Ð^iÑMiœÙ"6°q·u±u¸YÓ7GÓ"H×"NÑ"NÓ"PÐP˜QÐYeÑe÷ šÓ#Iùs   ƒAŸ)AÁ
ArÙ  ÚfailedrS   Ú	completedrN  Úsession_estimated_cost_usdr"  Úsession_cost_statusNrW   rR   rX   rY   rZ   rH   Úexit_reasonÚ	truncatedÚtokensÚinputÚsession_prompt_tokensÚoutputÚsession_completion_tokensrö  r[   r\   Ú_child_cost_usdÚcost_usdrî  Úcost_statusrM   z$Subagent did not produce a response.Úfailure_reasonÚschema_validÚschema_retriesÚschema_errorsz8Final answer does not satisfy the declared output_schemaz (after 1 retry)u–   ; `summary` is the child's raw, UNVALIDATED final text â€” extract what you need from it yourself (see schema_errors) rather than re-running the task.Úschema_noter¿  rc   uL   [steer did not land â€” the subagent finished before it could be delivered: rd   ú

)r9   Úboolrÿ   Úagent.message_contentr  r¶  Úreversedr7   r-   r'   rÿ  r%   r   r&   r#  r,   rO   rÅ  r8   rÆ  rÈ  rÇ  )r/   r½  rW   rT   rÅ  rX   Úusable_summaryÚinterrupt_noterR   r  ÚpartialÚ_costÚ_cost_statusr]   Ú_routeÚ_failure_reasonÚ_missed_steerÚ
_miss_noter  r  r  s   &&&&&             @@@r!   Ú_build_result_entryr(  S  s…  ú€ ð �j‰jÐ)Ó*×0Ð0¨b€Gô ˜'“]×CÐC w§}¡}£¸)Ñ'C€NØ€NØ‡z�z�- ×'Ò'Ø+¨]�õ 	?Ø˜GŸM™M›OÐ-EÐFˆÜö g¤8¨F¯J©J°zÓ,B×,HÐ,HÀbÔ#Ió gØhjólˆçØ&-§m¡m£o°w˜GøØ	�‰�H×	Ò	 §¡¨G×!4Ò!4ð '¨‘ð &,§Z¡Z°¸U×%CÒ%C‘kÐIYˆß .‘°Hˆä�EÐ7¸Ó=€EÜ˜5Ð"7¸Ó>€Lð 	�jØ�&Ø�7Ø�V—Z‘Z ¨QÓ/Ø˜HØ”œg e¨W°dÓ;Ó<Ø�{ð 	�[Ð$4Ñ4ØØ”Tœ' %Ð)@À!ÓDÓEØ”dœ7 5Ð*EÀqÓIÓJð
ð 	Ô'¨¯
©
°:Ó(>×(DÐ(DÀ"ÓEð 	”w˜uÐ&6¸Ó=Ø´*¸UÄSÌ%ÀL×2QÒ2Qœ5 § ¨#Ô.ÐWZð)€Eô. ˜eÐ$5Õ6¸Ó:€Eˆ*ÑÜ+5°lÄC×+HÒ+HÏ\™<Ð_h€Eˆ-ÑÜ˜5Ó!€FØÒØˆg‰Ø�ÔØŸ™ GÐ-SÓTˆˆg‰ð !Ÿ*™*Ð%5Ó6ˆÜ�o¤s×+Ò+·Ø&5Ð"Ñ#øß	Ø'ˆg‰ô �&—-‘-¤×&Ò&Ü $ V§\¡\Ó 2ˆˆnÑØ�>�>ˆ>Ø&,§n¡nˆEÐ"Ñ#Ø�|�|ˆ| §§ Ø%+§]¡]ˆE�/Ñ"Ø�<‰<˜5Ó §^àJØ)/¯¯¨Ñ%¸RõAðPõPð �-Ñ ð —J‘J˜Ó/€MÜ�-¤×%Ò%¨-×*=Ñ*=×*?Ò*?Ø -ˆˆnÑØgÐhuÐgvÐvwÐxˆ
ß;B˜g˜Y d¨:¨,Ñ7È
ˆˆiÑØ€Lr#   c               ó    € V ^8„  d   QhRRRR/# )r   Úrefr,   r   r  r   )r    s   "r!   r"   r"   º  s   € ÷ Bñ B�sð B˜tñ Br#   c                ó$   € V P                  R4      # )úhttp://)r,  zhttps://údata:image/)Ú
startswith)r*  s   &r!   Ú_is_image_urlr/  º  s   € Ø�>‰>Ð@ÓAÐAr#   c               ó$   € V ^8„  d   QhRRRRRR/# )r   râ   r,   Úimagesr•   r   r   r   )r    s   "r!   r"   r"   ¾  s!   € ÷ ,ñ , Cð ,°ð ,Àcñ ,r#   c                óì  €  V Uu. uF  q3P                  R4      '       g   K  VNK  	  ppV Uu. uF   p\        V4      '       g   K  W49  g   K  VNK"  	  ppV Uu. uF  p\        V4      '       d   K  VNK  	  pp^ RIHpHp Rp	\        R4      ;_uu_ 4        ^ RIHp
 V
! 4       p	RRR4       T! \        \        VRR4      ;'       g    R4      \        \        VRR4      ;'       g    R4      T	\        \        VRR4      ;'       g    R4      R	7      pVR
8X  d¾   V! WV4      w  rÍV'       d7   \        P                  R\        V4      RP                  VR,          4      4       V'       d/   T;'       g    RRRV /.V Uu. uF  pRRRRV//NK  	  up,           p\        ;QJ d    R V 4       F  '       g   K   RM	  RM! R V 4       4      '       d   V# T # V'       d    \        P                  R\        V4      4       . pV FU  p\        P                   P#                  V4      '       d   VP%                  RV R24       K?  \        P                  RV4       KW  	  VP'                  R V 4       4       V'       g   V # V R,           RP                  V4      ,           R,           # u upi u upi u upi   + '       g   i     EL; iu upi   \(         d    \        P                  RRR7       T u # i ; i)uC  The child's first user message when a task forwards ``images``.

Routing reuses the inbound-image policy (``agent.image_routing``, honouring ``agent.image_input_mode``): a
vision-capable child gets an OpenAI-style content list (text part + one ``image_url`` part per image; local files
as data URLs behind the read guard, http(s)/data URLs verbatim); otherwise the goal gains ``[Image attached â€¦]``
hint lines for ``vision_analyze``. Any failure degrades to the text-only goal so image plumbing never breaks a
spawn â€” logged at warning since the caller asked for the images.
r-  )Úbuild_native_content_partsÚdecide_image_input_modeN)Úload_config_readonlyrG   r°   rH   Úrequested_provider)r6  Únativez>delegate_task: skipped %d unreadable image(s) for subagent: %sú, :Né   NÚtypeÚtextÚ	image_urlÚurlc              3  óH   "  € T F  qP                  R 4      R8H  x € K  	  R# 5i)r:  r<  N)r9   )rÆ   Úps   & r!   rÉ   Ú,_build_child_goal_message.<locals>.<genexpr>Û  s   é € ÐLÁeÀ§¡ f£°Ö <Ãeùs   ‚ "TFzLdelegate_task: %d inline data-URL image(s) dropped for a non-vision subagentz[Image attached at: rd   z6delegate_task: image path not found, not forwarded: %sc              3  ó.   "  € T F  pR V R2x € K  	  R# 5i)z[Image attached: rd   Nr   )rÆ   Úus   & r!   rÉ   r@  ä  s   é € Ð<±t°!Ð(¨¨¨1Õ-³tùs   ‚r  r˜   z,
Use vision_analyze to inspect these images.z>delegate_task: image forwarding failed; sending text-only goalri   )r.  r/  Úagent.image_routingr3  r4  r   Úhermes_cli.configr5  r,   r7   r‹   r  r²   r  ÚanyÚosÚpathÚisfilery   rÒ   r§   )râ   r1  r/   rð   Ú	data_urlsÚurlsÚpathsr3  r4  Úcfgr5  ÚmodeÚpartsÚskippedrB  Úhintsr?  s   &&&              r!   Ú_build_child_goal_messagerQ  ¾  s¥  € ð#á &ÓF¡˜1¯,©,°}×*E—Q�Q¡ˆ	ÐFÙ!ÓM™6�a¤]°1×%5”¸!Ñ:L—�™6ˆÐMÙ"Ó;™F�q¬-¸×*:—�™FˆÐ;ß[ØˆÜ�D�\�\Ý>Ù&Ó(ˆC÷ ñ 'Ü”˜˜z¨2Ó.×4Ð4°"Ó5´s¼7À5È'ÐSUÓ;V×;\Ð;\ÐZ\Ó7]Ð_bÜ"¤7¨5Ð2FÈÓ#K×#QÐ#QÈrÓRô
ˆð �8ÔÙ7¸ÀTÓJ‰NˆEßÜ—‘Ð_ÔadÐelÓamÐos×oxÑoxð  zAð  BDõ  zEó  pFô  GßØ×BÐB F¨F°F¸DÐ#AÐ"Bñ  @Ió  GJñ  @IÐz{ÈÐP[Ð]hÐkpÐrsÐjtÓGuñ  @Iñ  GJõ  J�ß›CÑLÁeÓLŸCŸCšCÑLÁeÓL×LÒL�5ÐVÐRVÐVßÜ�N‰NÐiÔknÐoxÓkyÔzØˆÛˆAÜ�w‰w�~‰~˜a× Ò Ø—‘Ð3°A°3°aÐ8Ö9ä—‘ÐWÐYZÖ[ñ	 ð
 	�‰Ñ<±tÓ<Ô<ßØˆKØ�f�}˜tŸy™y¨Ó/Õ/Ð2aÕaÐaùò= GùÚMùÚ;÷ �\ˆ\üò GJøô ô Ü�‰ÐWÐbfˆÔgØŠðúsÃ   ‚K †J$£J$©K ¯J)ÁJ)ÁJ)ÁK ÁJ.Á3J.Á9K ÂJ3Â&"K Ã	K Ã(K ÄA#K Å,K Å5K Æ KÆK Æ%K Æ9K ÇK ÇK ÇK Ç BK É<K É>%K Ê$K Ê3K	Ê>K Ë$K3Ë2K3c                  ó†  € ] tR tRt$ RtR]R&   R]R&   R]R&   R]R	&   R
]R&   R]R&   RtR]R&   ]! ]P                  R7      t
R]R&   RtR]R&   RtR]R&   RtR
]R&   RtR]R&   ]! ]R7      tR]R&   R R ltR R ltR R  ltR! R" ltR#RR$R/R% R& lltR' R( ltR) R* ltR+ R, ltR- R. ltR/ R0 ltR1 R2 ltR3 R4 ltR5tR# )6Ú	_ChildRunií  zßState of one child run, shared by every phase of ``_run_single_child``.
``worktree_info`` stays None until isolation engages (``attach_worktree`` is
then a no-op on every early error path); ``seed_workspace`` sets the rest.r   r/   ro   r   rW   r,   râ   r)   r	  Úchild_progress_cbNÚ	heartbeat)Údefault_factoryr&   Úchild_startzOptional[dict[str, str]]Úworktree_infor°   rË  r  r"  Ú
wall_startr¦   Úparent_reads_snapshotc               ó   € V ^8„  d   QhRR/# )r   r   r&   r   )r    s   "r!   r"   Ú_ChildRun.__annotate__  s   € ÷ =ñ =˜ñ =r#   c                	ób   € \        \        P                  ! 4       V P                  ,
          ^4      # )r   )r#  r%  Ú	monotonicrW  rG  s   &r!   ÚelapsedÚ_ChildRun.elapsed  s!   € Ü”T—^’^Ó%¨×(8Ñ(8Õ8¸!Ó<Ð<r#   c               ó    € V ^8„  d   QhRRRR/# )r   Údeltar,   r   ra   r   )r    s   "r!   r"   r\    s   € ÷ Sñ S ð S¨ñ Sr#   c                óJ   € V'       d   \        V P                  RVR7       R# R# )u×   Stream callback forwarding the child's reply text up the progress relay so gateway watch windows mirror it
live (subagent.text â†’ message.delta). Inert under CLI/TUI: their progress handlers ignore non-tool events.zsubagent.text©ÚpreviewN)r   rT  )r5  rb  s   &&r!   Ú
relay_textÚ_ChildRun.relay_text  s   € ÷ Ü˜4×1Ñ1°?ÈE×Rñ r#   c               ó    € V ^8„  d   QhRRRR/# )r   Ú
entry_dictrU   r   r   )r    s   "r!   r"   r\  
  s   € ÷ rñ r¨.ð r¸^ñ rr#   c                óp  € V P                   pVf$   \        V\        V P                  RR4      RR7      # ^ RIHp  VP                  V4      VR&   \        V\        V P                  RR4      RR7      #   \         d9   p\        P                  RT4       TP                  TRT 24      TR&    Rp?LaRp?ii ; i)	zWInspect + prune the child worktree, reporting into the entry (no-op without isolation).NrÎ  F©Úforcerƒ  Úworktreezworktree finalize failed: %szfinalize raised: )rX  r   r7   r/   r¹   r„  Úfinalize_subagent_worktreer§   r‹   r  Úunproven_worktree_payload)r5  ri  Úinfor„  r�   s   &&   r!   Úattach_worktreeÚ_ChildRun.attach_worktree
  s¸   € à×!Ñ!ˆØŠ<Ü& z´7¸4¿:¹:ÐG`ÐbfÓ3gÐotÔuÐuÝ+ð	pØ%6×%QÑ%QÐRVÓ%WˆJ�zÑ"ô # :¬w°t·z±zÐC\Ð^bÓ/cÐkpÔqÐqøô ô 	pô �N‰NÐ9¸1Ô=Ø%6×%PÑ%PÐQUÐYjÐklÐjmÐWnÓ%oˆJ�zÖ"ûð		pús   »A2 Á2B5Á=.B0Â0B5c               ó   € V ^8„  d   QhRR/# r9  r   )r    s   "r!   r"   r\    s   € ÷ vñ v ñ vr#   c           	     ó  € ^ RI pV P                  ;'       g2    RV P                   RVP                  4       P                  R,           2T n        \        V P                  RR4      V n        ^ RI	H
p \        R4      ;_uu_ 4        ^ RIHpHpHp V! V P                  4      pV! V P                   4      ;_uu_ 4        V! V P
                  V4       RRR4       V! V P
                  V P                  4       RRR4       \#        V P                  V P                  V P                  4      V n        V P$                  e˜   \        R	4      ;_uu_ 4        V! V P                   4      ;_uu_ 4        ^ R
IHp V! V P
                  V P$                  R,          4       RRR4       RRR4       ^ RIHp V P*                  V! V P$                  4      ,           V n        \,        P,                  ! 4       V n        V P                  '       d1   \1        \2        P4                  ! V P                  4      4      V n        R# . V n        R#   + '       g   i     ELp; i  + '       g   i     EL_; i  + '       g   i     LÓ; i  + '       g   i     LÞ; i)z–Seed cwd/container aliases and optional worktree isolation for the child;
``goal`` is extended with the worktree contract note when isolation engaged.Nz	subagent-ré   ºNé   NÚ_current_task_idr§  zChild cwd seed failed: %s)r…  Úrecord_session_cwdÚregister_container_aliaszworktree cwd seed failed: %s)rx  rG  )Úbuild_worktree_context_note)Úuuidr	  rW   Úuuid4ÚhexrË  r7   ro   r  r´  r¨  r   r‡  r…  rx  ry  r/   r‹  rX  Útools.subagent_worktreerz  râ   r%  rY  r¦   r   Úknown_readsrZ  )	r5  Ú_uuidr¨  r…  rx  ry  Ú
parent_cwdÚ_rscrz  s	   &        r!   Úseed_workspaceÚ_ChildRun.seed_workspace  s¾  € ó 	Ø!×-Ñ-×fÐf°9¸T¿_¹_Ð<MÈQÈuÏ{É{Ë}×O`ÑO`ÐacÕOdÐNeÐ1fˆÔÜ% d×&7Ñ&7Ð9KÈTÓRˆÔõ 	CÜÐ/×0Õ0ßiÑiÙ(¨×)<Ñ)<Ó=ˆJÙ$ T§Z¡Z×0Õ0Ù" 4×#5Ñ#5°zÔB÷ 1á$ T×%7Ñ%7¸×9LÑ9LÔM÷ 1ô 7°t×7HÑ7HÈ$×J]ÑJ]Ð_c×_oÑ_oÓpˆÔØ×ÑÒ)ÜÐ6×7Õ7Ñ9LÈTÏZÉZ×9XÕ9XÝJÙ�T×'Ñ'¨×);Ñ);¸FÕ)CÔD÷ :Y×7õ
 LØŸ	™	Ñ$?À×@RÑ@RÓ$SÕSˆDŒIÜŸ)š)›+ˆŒØZ^×Zm×ZmÐZm¤T¬*×*@Ò*@À×ATÑATÓ*UÓ%VˆÖ"ÐsuˆÖ"÷ 1×0Ð0ú÷ 1×0Ð0ú÷ :Y×9Xú×7×7úsH   Â7I
Â;H6	Ã%I
ÅI1Å(+I	ÆI1È6IÉ	I
É
I	ÉI.É)I1É1J	rX   rR   c               ó0   € V ^8„  d   QhRRRRRRRRRRR	R/# )
r   r]   rU   r`   r)   re  r,   rX   rR   r   r   )r    s   "r!   r"   r\  8  s<   € ÷ +ñ +Ø#ð+Ø1>ð+ØLOð+ØZ]ð+Ølyð+à	ñ+r#   c               óØ   € \        V P                  R\        VRR7      T;'       g
    VR,          VR,          Ve   \        VRR7      MRR7       \        W4       V P	                  V4      # )z°Shared tail of every failure path: emit ``subagent.complete`` (``status`` defaults to the entry's), note
the steer text that won the race with the failure, report the worktree.úsubagent.completeFrk  rR   rZ   N)re  rR   rZ   rX   )r   rT  r   re   rq  )r5  r]   r`   re  rX   rR   s   &&&$$$r!   Úfinish_failedÚ_ChildRun.finish_failed8  s�   € ô
 	Ø×"Ñ"Ð$7ÔARÐSZÐbgÔAhÐqw÷  rKð  rKð  |Að  BJõ  |KØ"Ð#5Õ6Ø?FÒ?RÔ% g°UÕ;ÐX\õ	
ô
 	˜UÔ/Ø×#Ñ# EÓ*Ð*r#   c               ó   € V ^8„  d   QhRR/# )r   r   r)   r   )r    s   "r!   r"   r\  E  s   € ÷ dñ d ñ dr#   c                ój   € V P                   '       d!   \        V P                   V P                  4      # R# )zTClose steer acceptance (see ``_merge_late_steer``); returns late steer text, if any.N)r	  r   r/   rG  s   &r!   Úclose_steeringÚ_ChildRun.close_steeringE  s+   € àIM×IY×IYÐIYÔ'¨×(8Ñ(8¸$¿*¹*ÓEÐcÐ_cÐcr#   c               ó(   € V ^8„  d   QhRRRRRRRR/# )	r   r3  zthreading.Eventr�  r   r  r   r   ra   r   )r    s   "r!   r"   r\  I  s0   € ÷ $mñ $m¨?ð $mÈ#ð $mÐ^mð $mÐrvñ $mr#   c                óF  € Vf   VP                  4        R# \        P                  ! 4       V,           pWCR\        ,
          ,          ,
          pRp\	        V P
                  4      p \        P                  ! 4       pWH,
          p	V	^ 8:  d   R# \        \        V	4      p
V'       g   \        V
\        WX,
          R4      4      p
VP                  V
R7       VP                  4       '       d   R# \	        V P
                  4      pW·8w  d=   Tp\        P                  ! 4       V,           pWCR\        ,
          ,          ,
          pRpKÜ  V'       d   Kæ  \        P                  ! 4       V8¼  g   EK  Rp\        V P
                  W4\        P                  ! 4       ,
          ,
          V4       EK?  )uÜ  Wait for the worker or the stale verdict, where ``child_timeout`` bounds INACTIVITY, not total runtime.

A configured cap used to be a dispatch-to-death stopwatch, so it only ever killed children the runtime had
already judged healthy: all 75 reported deaths happened while waiting on an in-flight LLM completion, none
mid-tool (#116001). A provider serving multi-minute completions is progress â€” the child's activity clock
ticks during the wait and the request is bounded by the per-call stale watchdog â€” so the budget restarts on
every sign of progress, exactly the signals the heartbeat's stale verdict reads. Genuinely frozen children
keep two authorities: this budget (when configured) and the heartbeat's stale threshold.
Ng      ð?FTr"  ©Útimeout)rE  r%  r^  Ú_BUDGET_WARNING_FRACTIONr  r/   ÚminÚ_LIVENESS_POLL_SECONDSr$  r€   r  )r5  r3  r�  r  ÚdeadlineÚwarn_atÚwarnedÚfingerprintrý   Ú	remainingrE  Úcurrents   &&&&        r!   Úwait_liveness_awareÚ_ChildRun.wait_liveness_awareI  s*  € ð Ò Ø�L‰LŒNÙÜ—>’>Ó# mÕ3ˆØ¨cÔ4LÕ.LÕMÕMˆØˆÜ1°$·*±*Ó=ˆØÜ—.’.Ó"ˆCØ �ˆIØ˜AŒ~ÙÜÔ-¨yÓ9ˆDßÜ˜4¤ W¥]°CÓ!8Ó9�Ø�L‰L ˆLÔ&Ø�~‰~×ÒÙÜ1°$·*±*Ó=ˆGØÔ%Ø%�ÜŸ>š>Ó+¨mÕ;�Ø"°cÔ<TÕ6TÕ%UÕU�Ø’ß‘V¤§¢Ó 0°G× ;Ø�Ü" 4§:¡:¨}Ì4Ï>Ê>ÓK[Õ@[Õ/\Ð^k×lr#   c               ó   € V ^8„  d   QhRR/# )r   r   z?tuple[Optional[dict[str, Any]], Optional[dict[str, Any]], bool]r   )r    s   "r!   r"   r\  o  s   € ÷ N2ñ N2Ð\ñ N2r#   c                ó
  a aaaaa€ ^ RI HpHpHpHp ^ RIHp S P                  S P                  uopV! 4       pV! ^WC! 4       3R7      pRR/o\        \        SRR4      ;'       g    . 4      p	V	'       d   \        S P                  V	S4      MS P                  oVV VV3R lp
VP                  \        P                  ! 4       P                   V
4      pS P"                  e   S P"                  P$                  M\&        P(                  ! 4       oVP+                  V3R l4       Rp S P-                  SW·4       VP/                  4       '       gÐ   \        S P"                  R	R4      pVf   \1        4       h\3        S4       Tp\&        P(                  ! 4       oVP+                  V3R
 l4       SP5                  VR7      '       d   VP/                  4       '       g   \1        4       h\6        P9                  RWm4       VP;                  4       RR3VP=                  RR7       # VP;                  4       RR3VP=                  RR7       #   \>         d   pTp Rp?MRp?ii ; i TP=                  RR7       M  TP=                  RR7       i ; iS PA                  4       p\3        S4       \C        T\0        \D        34      pTe   TMTpS PG                  4       p\6        PI                  RTT'       d   RMR\K        T4      PL                   2T4       ^ p\O        R4      ;_uu_ 4        \Q        SPS                  4       PU                  R^ 4      ;'       g    ^ 4      pRRR4       M  + '       g   i     M; iT;'       d    T^ 8H  pRpT'       df   \W        ST\Y        T;'       g    R4      \Y        T4      SPU                  R4      S P                  R7      pT'       d   \6        PI                  RTT4       T'       g   \[        T4      pM'Te   RT RTR R2pMT'       d   RT R2pM	RT RT R2pT'       d   TRT 2,          pT'       d   RMR pR!TR"TR#RR TR$TR%TR&TR'T'       d   TMRR(T'       d   TMRR)T'       d   R*MT'       d   R+MRR,T'       d   \]        S4      MRR-\        SR.R4      R/T/pS P_                  TTT'       d   R0T R12M
\[        T4      R27      pT;'       d    TP/                  4       '       * pT'       d   \a        ST4       RTT3# )3u‚  Run the child's conversation on a daemon worker: ``(result, None, False)`` or ``(None, error_entry,
close_deferred)`` on timeout/exception.

Hard timeout is off by default (``result(timeout=None)``; stuck children are the heartbeat's job). Daemon
worker: an abandoned timed-out child on a non-daemon thread would block interpreter exit at atexit join. The
worker installs a non-interactive approval callback (deny/approve per delegation.subagent_auto_approve) so
dangerous-command prompts never fall back to ``input()`` and deadlock the parent TUI. On failure: steer
acceptance closes BEFORE the stop signal (a concurrent steer is drained into the entry or rejected, never
lost); a 0-API-call timeout gets a diagnostic dump; a worker that still owns the child gets ``child.close()``
via a Future done-callback (``close_deferred=True``) â€” closing here would race its still-unwinding finally
path.
)Ú_STALE_RESULT_GRACE_SECONDSÚ_get_child_timeoutÚ_get_subagent_approval_callbackÚ_set_subagent_approval_cb)ÚDaemonThreadPoolExecutor)Úmax_workersÚinitializerÚinitargsr  NÚ_delegate_imagesc                 ó¦  <€ \         P                  ! 4       SR &   ^ RIHp  ^ RIHp V! S4      ;_uu_ 4        T ! \        \        SRR4      ;'       g    R4      4      ;_uu_ 4        SP                  SSP                  SP                  R7      uuRRR4       uuRRR4       #   + '       g   i     M; iRRR4       R#   + '       g   i     R# ; i)r  rÓ  r§  rz  r°   rÕ  N)rÌ   Úcurrent_threadrÛ  rÔ  r´  r¨  r,   r7   rÜ  rË  rf  )rÔ  r¨  r/   r5  rÖ  Úworker_thread_holders     €€€€r!   Ú_run_with_thread_captureÚ7_ChildRun.await_child.<locals>._run_with_thread_capture‹  s—   ø€ Ü(1×(@Ò(@Ó(BÐ  Ñ%ÝHÝFá$ U×+Õ+Ñ-DÄSÌÐQVÐXdÐfhÓIi×IoÐIoÐmoÓEp×-qÕ-qØ×-Ñ-Ø!-°t×7IÑ7IÐ[_×[jÑ[jð .ó ÷ .rÑ-q×+Ò+×-q×-qú×+×+×+Ò+ús#   ¶/B?Á%(B"	Â
B?Â"B2Â-B?Â?C	c                ó$   <€ SP                  4       # r+   ©rS  )Ú_fr3  s   &€r!   r÷   Ú'_ChildRun.await_child.<locals>.<lambda>›  s   ø€ ¨G¯K©K¬Mr#   r4  c                ó$   <€ SP                  4       # r+   r®  )r¯  Ú
grace_dones   &€r!   r÷   r°  ³  s   ø€ °J·N±NÔ4Dr#   r�  u]   Subagent %d settled inside the %.1fs stale-result grace window â€” collecting its real resultFrD  zSubagent %d %s after %.1fsz	timed outzraised r  r"  )r/   rW   rá   rZ   rÁ   râ   u;   Subagent %d 0-API-call timeout â€” diagnostic written to %sz'Subagent stopped making progress after u!    API call(s) â€” no activity for Úgz@s (heartbeat stale threshold); the pending worker was abandoned.zSubagent timed out after u˜   s without making any API call â€” the child never reached its first LLM request (prompt construction, credential resolution, or transport may be stuck).zs with u®    API call(s) completed â€” no progress in that window (no completed call, tool change, or activity-clock tick): a stalled provider request or an unresponsive network request.z Diagnostic: r‘  rS   rW   rR   rX   r  rY   rZ   rá   Útimed_out_after_secondsÚtimeout_phaseÚbefore_first_llm_callÚafter_llm_callsÚlast_event_ager[   r\   Údiagnostic_pathzTimed out after rð   rd  )1r>  rŸ  r   r¡  r¢  Útools.daemon_poolr£  r/   rW   r¦   r7   rQ  râ   ÚsubmitÚcontextvarsÚcopy_contextÚrunrU  r3  rÌ   r2  rŸ  r›  rž  ÚFuturesTimeoutErrorr�   rE  r‹   rp  r½  Úshutdownr§   rŒ  r%   r   r_  r  r:  r^  r   r   rô   r9   r  r&   r,   r'  rˆ  r¢  ) r5  rŸ  r   r¡  r¢  r£  rW   r  ÚexecutorÚ_imagesr«  ÚfutureÚstale_afterÚgraceÚwait_excr©   Ú_late_pending_steerÚ
is_timeoutÚtimeout_causerT   Úchild_api_callsÚbefore_first_callr¹  Ú_errrR   Ú_error_entryÚclose_deferredr/   r²  r3  rÖ  rª  s    f                          @@@@@r!   Úawait_childÚ_ChildRun.await_childo  sÃ  ý€ ÷	
ó 	
õ 	?Ø ŸJ™J¨¯©ÐˆˆzÙ*Ó,ˆÙ+ØÐ'@ÐLkÓLmÐKoô
ˆð HKÈDÀkÐä”w˜uÐ&8¸$Ó?×EÐEÀ2ÓFˆßT[Ô5°d·i±iÀÈ%ÔPÐae×ajÑajˆ÷	ð 	ð —‘¤×!9Ò!9Ó!;×!?Ñ!?ÐAYÓZˆð
 -1¯N©NÒ,F�$—.‘.×(Ò(ÌIÏOÊOÓL]ˆØ× Ñ Ô!9Ô:à'+ˆð"	*Ø×$Ñ$ W¨fÔDØ—;‘;—=’=Ü% d§n¡nÐ6OÐQUÓV�ØÒ&ô .Ó/Ð/ô # 5Ô)Ø3�Ü&Ÿ_š_Ó.�
Ø×(Ñ(Ô)DÔEØ!—‘¨u�×5Ò5¸V¿[¹[¿]º]Ü-Ó/Ð/Ü—‘ØsØôð —}‘}“¨¨eÐ3ð ×Ñ 5ÐÕ)ð —=‘=“? D¨%Ð/ð
 ×Ñ 5ÐÕ)øô	 ô 	*Ø!)�Cûð	*úØð ×Ñ 5ÐÕ)øˆH×Ñ 5ÐÕ)úà"×1Ñ1Ó3ÐÜ˜5Ô!Ü Ô&9¼<Ð%HÓIˆ
à'2Ò'>™ÀMˆØ—<‘<“>ˆÜ�‰Ð3°Z×PZÁÐbiÔjnÐorÓjs×j|Ñj|Ði}Ð`~ð  AIô  	JØˆÜ�D�\�\Ü! %×"<Ñ"<Ó">×"BÑ"BÐCSÐUVÓ"W×"\Ð"\Ð[\Ó]ˆO÷ �\�\ˆ\úð '×?Ð?¨?¸aÑ+?ÐØ)-ˆßÜ?Ø¨
ä % m×&:Ð&:°sÓ ;ÌeÐT\ËoØ2×6Ñ6°sÓ;À$Ç)Á)ô	ˆO÷ Ü—‘Ð\Ð^hÐjyÔzßÜ�s“8‰DØÒ$à9¸/Ð9JÐJkØ˜q�/Ð!aðcñ ÷ à+¨M¨?ð ;mð nñ ð ,¨M¨?¸'À/ÐARð SGð Hð ÷
 Ø�m OÐ#4Ð5Õ5ˆDß(‘¨gˆà˜* h°¸	À4ÈÐRVÐXeÐgmØ˜Ð*<¸hØ·
™}ÀØ%·:¡xÀ4Ø×8IÑ4×dnÑO`Ðtxð ¿jÔ3°EÔ:ÈdØœ7 5Ð*:¸DÓAØ˜ð
ˆð ×)Ñ)¨,Ð8K÷  xBÐWgÐhpÐgqÐqrÑUsô  HKð  LOó  HPÐ)ó  QˆØ#×9Ð9¨F¯K©K«MÔ(9ˆßÜ& u¨fÔ5Ø�\ >Ð1Ð1sC   Ä!B1H= Ç2H= ÈH= È=IÉIÉ
I+ ÉIÉI+ É+I?Ì4MÍM%	c               ó    € V ^8„  d   QhRRRR/# ©r   r]   rU   r   ra   r   )r    s   "r!   r"   r\  ÿ  s   € ÷ 1ñ 1°>ð 1Àdñ 1r#   c           
     óÐ  € V P                   '       d   V P                  '       g   R# \        RRR7      ;_uu_ 4        \        P                  ! V P                   V P
                  V P                  4      pV'       d3   \        VP                  4        UUu0 uF  q3 F  qDkK  	  K  	  upp4      M. pV'       g    RRR4       R# RRP                  VR,          4      ,           \        V4      ^8”  d   R\        V4      ^,
           R	2MR
,           R,           pVP                  R4      '       d   VR,          V,           VR&   MWQR&   RRR4       R# u uppi   + '       g   i     R# ; i)uÀ   Warn the parent when this child wrote files the parent had already read. Checks writes by ANY non-parent
task_id (not just this child's) so nested orchestratorâ†’worker chains are covered too.Nz%file_state sibling-write check failedTri   uX   

[NOTE: subagent modified files the parent previously read â€” re-read before editing: r8  ru  z (+z more)r°   rd   rX   Ústale_paths)r  rZ  r   r   Úwrites_sincerY  r  Úvaluesr  r²   r9   )r5  r]   Úsibling_writesrK  r?  Ú	mod_pathsÚreminders   &&     r!   Úappend_sibling_write_reminderÚ'_ChildRun.append_sibling_write_reminderÿ  s,  € ð ×#×#Ð#¨×(B×(BÐ(BÙÜÐ;Àd×KÖKÜ'×4Ò4°T×5HÑ5HÈ$Ï/É/Ð[_×[uÑ[uÓvˆNß[iœ¨~×/DÑ/DÔ/FÔVÑ/F eÒPUÈ1¢ÑPU¡Ñ/FÒVÔWÐoqˆIßØ÷	 LÑKð mØ—)‘)˜I b�MÓ*õ+ä7:¸9³~ÈÔ7I�Sœ˜Y›¨!Õ+Ð,¨FÑ3ÈrõSð õð ð �y‰y˜×#Ò#Ø#(¨Õ#3°hÕ#>��iÒ à'0�mÑ$÷ LÑKùãV÷ L×KÐKús1   ¼AEÂEÂ%EÂ7EÃA)EÄ,EÅEÅE%	c               ó    € V ^8„  d   QhRRRR/# rÒ  r   )r    s   "r!   r"   r\    s   € ÷ Cñ C°.ð CÀTñ Cr#   c                óH  € \        \        V P                  RR4      ;'       g    . 4      pV'       d   W!R&   \        R4      ;_uu_ 4        ^ RIHpHp VP                  V P                  4      pV'       do   V Uu. uF^  pRVP                  R\        VP                  RR7      R	,          R
\        \        P                  ! 4       VP                  ,
          4      /NK`  	  upVR&   VP                  V P                  4      pV'       dv   V Uu. uFe  pRVP                  R\        VP                  RR7      R	,          RVP                   R\        V! V\#        VP$                  4      4      RR7      RR /NKg  	  upVR&   RRR4       R# u upi u upi   + '       g   i     R# ; i)a?  Name the child's background processes on the result BEFORE ``cleanup`` kills them: handed-off ones now
belong to the parent (their completion lands in the parent's chat); anything else still running is about to be
terminated, and the parent must hear that from the runtime rather than trust a child's "watcher running".Ú_handed_off_processesNÚhanded_off_processes)Úprocess_registryÚ_output_tailrz  ÚcommandFrk  :NéÈ   NÚruntime_secondsÚorphaned_processesÚ	exit_codeÚoutput_tailÚunread_completionsi¨ýÿÿ)r¦   r7   r/   r   Útools.process_registryrà  rá  Úrunning_owned_byrË  r«  r   râ  r#  r%  rt  Úunread_completions_owned_byræ  r²   Úoutput_buffer)r5  r]   Úhandedrà  rá  Úleftoverrð   Úunreads   &&      r!   Úaccount_background_processesÚ&_ChildRun.account_background_processes  s¡  € ô ”g˜dŸj™jÐ*AÀ4ÓH×NÐNÈBÓOˆßØ,2Ð(Ñ)Ü�D�\�\ßMØ'×8Ñ8¸×9KÑ9KÓLˆHßñ &ó/'á%˜ð " 1§4¡4¨Ô4EÀaÇiÁiÐW\Ô4]Ð^bÕ4cÐevÔx}ô  C÷  Hò  Hó  Jð  MN÷  MYñ  MYõ  Yó  yZó  [Ù%ñ/'�Ð*Ñ+ð &×AÑAÀ$×BTÑBTÓUˆFßñ |Bó/Cñ |BÐvwð " 1§4¡4¨Ô4EÀaÇiÁiÐW\Ô4]Ð^bÕ4cÐepÐrs×r}Ñr}Ø"Ô$5±lÀ1ÄcÈ!Ï/É/ÓFZÓ6[ÐchÔ$iÐjnÐjoÐ$pórñ |Bñ/C�Ð*Ñ+÷ ‰\ùò/'ùò
/C÷ �\ˆ\ús2   Á
0FÁ:A$FÃ(FÄFÄA+FÅ6FÆ
FÆF!	c               ó(   € V ^8„  d   QhRRRRRRRR/# )r   r½  rU   r]   rT   r&   r   ra   r   )r    s   "r!   r"   r\  (  s0   € ÷ #yñ #y Nð #y¸>ð #yÐUZð #yÐ_cñ #yr#   c                óV  € V P                   '       g   R# V P                  pVP                  \        V\	        VRR4      RR7      4       VR,          p. p\        R4      ;_uu_ 4        \        \        P                  ! V P                  4      4      R,          pRRR4       / p\        R4      ;_uu_ 4        \        P                  ! RV P                  . 4      pRRR4       RV'       d
   VR	,          MVP                  R
R4      RVR,          RTRV'       d
   VR,          MVP                  R
R4      R\        \	        VR^ 4      4      R\        \	        VR^ 4      4      R\        \	        VR^ 4      4      R\        VR,          4      RTR\        VP                  4        UU	U
u0 uF!  w  r‰W€P                  8X  g   K  V	 F  qªkK  	  K#  	  up
p	p4      R,          R\!        V^RR7      /pVP                  R4      '       d   VR,          VR&   \	        VRR4      pVe+   \        R4      ;_uu_ 4        \#        V4      VR&   RRR4       \%        V P                   R3/ \        VRR7      B  R#   + '       g   i     ELÚ; i  + '       g   i     EL®; iu up
p	pi   + '       g   i     Lc; i)z´Fire ``subagent.complete`` with the per-branch observability payload (tokens, cost, files touched,
tool-output tail); every field is optional and degrades gracefully on the client.NrÎ  Frk  rX   :Né(   Nr°   re  :Né    NrS   rR   rZ   :Niô  NÚinput_tokensr  Úoutput_tokensr  Úreasoning_tokensÚsession_reasoning_tokensrY   Ú
files_readÚfiles_writtenrç  iX  )Úmax_entriesÚ	max_charsr  r
  r  r‡  )rT  r/   rR  r   r7   r   r¦   r   r  rË  rÕ  rY  r9   r'   r  rÏ   r   r&   r   )r5  r½  r]   rT   r/   rX   Ú_files_readÚ_files_written_mapÚtidrK  r?  Úcomplete_kwargsÚ	_cost_usds   &&&&         r!   Úemit_completeÚ_ChildRun.emit_complete(  s<  € ð ×%×%Ð%ÙØ—
‘
ˆà�‰Ô(¨´¸Ð?XÐZ^Ó0_ÐglÔmÔnØ˜	Õ"ˆØˆÜ�D�\�\Üœz×5Ò5°d×6HÑ6HÓIÓJÈ3ÕOˆK÷ à#%ÐÜ�D�\�\Ü!+×!8Ò!8¸¸T¿_¹_ÈbÓ!QÐ÷ ð ¯�w˜t–}°U·Y±Y¸wÈÓ5KØ�e˜H•oØ Ø¯�w˜t–}°U·Y±Y¸wÈÓ5KØœD¤¨Ð0GÈÓ!KÓLØœT¤'¨%Ð1LÈaÓ"PÓQØ¤¤W¨UÐ4NÐPQÓ%RÓ SØœ˜e KÕ0Ó1Ø˜+ØœVÐ9K×9QÑ9QÔ9Sõ  %AÑ9S©:¨3ÐWZ×^pÑ^pÑWp¤QÓzÐuv¢QÑz¡QÑ9Só  %Aó  Bð  CFõ  GØÔ/°ÀAÐQTÔUð+
ˆð �9‰9Ð%×&Ò&à05Ð6FÕ0GˆOÐ,Ñ-Ü˜EÐ#?ÀÓFˆ	ØÒ Ü˜—•Ü.3°IÓ.>� 
Ñ+÷ ä�t×-Ñ-Ð/BÑxÔFYÐZiÐqvÔFwÔx÷3 �\ˆ\ú÷ �\ˆ\üô %A÷ —ús0   Á'1I)Â5#I=Æ!J2Æ:J2È.JÉ)I:	É=J	ÊJ(	c          
     ó,   € V ^8„  d   QhRRRRRRRRRR	/# )
r   rU  r)  r¹  r   r¬  rÎ  r  r   ra   r   )r    s   "r!   r"   r\  M  s9   € ÷ -Tñ -T Jð -T¸Cð -TÐQTð -TÐfjð -TÐosñ -Tr#   c               ó  € V P                   pVP                  4        V P                  '       d   \        V P                  VR7       Ve2   Ve.   \	        R4      ;_uu_ 4        VP                  V4       RRR4       ^ RIp\        VRR4      p\        V\        4      '       d   \        V4      Vn
        \        V P                  V4       V'       g   \        VR4       \	        R4      ;_uu_ 4        ^ RIHp T! \!        \        VRR	4      ;'       g    R	4      4       RRR4       \	        R
4      ;_uu_ 4        ^ RIHp	 V	P'                  RR7      p
\!        \        VRR	4      ;'       g    R	4      pV	P(                  P+                  V	P-                  4       VR7      pV
e$   V'       d   V'       g   V
P/                  RV/4       RRR4       R#   + '       g   i     ELb; i  + '       g   i     LÌ; i  + '       g   i     R# ; i)uW  Finally-path teardown (idempotent, never raises). Order matters: stop heartbeat â†’ drop registry entry â†’
release credential lease â†’ restore the parent's process-global tool names â†’ detach from the parent's
interrupt list â†’ close the child (unless a timed-out worker still owns it) â†’ pop the child's Relay scope if
no turn is active.)rw  Nz&Failed to release credential lease: %sÚ_delegate_saved_tool_namesz,Failed to close child agent after delegationz0Failed to dispose child execute_code kernels: %s)Ú$shutdown_kernels_for_delegated_childrz  r°   z4Failed to close child Relay session after delegation)Úrelay_runtimeF)Úcreate)Úprofile_keyrz  Úchild_session_id)r/   rH  r	  r   r   r¸  Úmodel_toolsr7   r%   r¦   Ú_last_resolved_tool_namesrŽ   ro   rm   Útools.code_kernelr  r,   rw  r	  Úget_runtimeÚSESSION_COORDINATORÚhas_active_turnÚcurrent_profile_keyÚunregister_subagent)r5  rU  r¹  r¬  rÎ  r/   r  Úsaved_tool_namesr  r	  Úruntimer  Úchild_turn_is_actives   &$$$$        r!   ÚcleanupÚ_ChildRun.cleanupM  s¤  € ð
 —
‘
ˆØ�‰Ôð ××ÐÜ  ×!1Ñ!1¸Õ?àÒ! nÒ&@ÜÐ@×AÕAØ×(Ñ(¨Ô8÷ Bó
 	Ü" 5Ð*FÈÓMÐÜÐ&¬×-Ò-Ü48Ð9IÓ4JˆKÔ1ä�d×'Ñ'¨Ô/÷ Ü˜Ð NÔOô ÐF×GÕGÝNÙ0´´W¸UÀLÐRTÓ5U×5[Ð5[ÐY[Ó1\Ô]÷ Hô ÐJ×KÕKÝ+Ø#×/Ñ/°uÐ/Ó=ˆGÜ"¤7¨5°,ÀÓ#C×#IÐ#IÀrÓJÐØ#0×#DÑ#D×#TÑ#TØ)×=Ñ=Ó?ÐL\ð $Uó $Ð ð Ò"×'7×@TØ×+Ñ+Ð-?ÐAQÐ,RÔS÷ LÑK÷1 B×AÐAú÷$ H×Gú÷ L×KÐKús1   Á!GÃ/-G Ä7A/G3Æ'G3Æ/G3ÇG	Ç G0	Ç3H	)rË  râ   rZ  r  rY  rX  )r^  r_  r`  ra  rb  rÉ  rU  r   r%  r^  rW  rX  rË  r  rY  r¦   rZ  r_  rf  rq  rƒ  rˆ  rŒ  r›  rÏ  rÚ  rð  r  r  rc  r   r#   r!   rS  rS  í  sã   ‡ ñRð ƒJØÓØƒOØ
ƒIØÓØÓØ€IˆsÓÙ¨t¯~©~Ô>€K�Ó>Ø.2€MÐ+Ó2Ø€M�3ÓØ$(€N�MÓ(Ø€J�ÓÙ"'¸Ô"=Ð˜4Ó=õ=õSõrõvð>+Ø`bð+ð }A÷+õdõ$mõLN2õ`1õ*Cõ(#y÷J-Tñ -Tr#   rS  )r—   )rH   rG   Úapi_moder©  rN  Ú
quiet_modeÚskip_memoryÚskip_context_filesÚplatformr\   rn  )Qrb  Ú
__future__r   Úloggingr¼  rº   rF  rÌ   r%  Útools.delegation_redactionr   r   Úconcurrent.futuresr   r¿  Útypingr   r   r   r	   Úagent.compression_markerr
   Úagent.interrupt_compatr   Údataclassesr   r   r¹   r   Útools.delegate_tool_progressr   r   Útools.delegate_tool_registryr   r   r   r   Útools.delegate_tool_resultsr   r   r   r   Ú	getLoggerr‹   r'   r-   r=   rO   r^   re   rm   ru   r…   rŽ   r�   r    r  rª   r¿   rß   r  r”  r’  r  r  r  r'  r)  rf  r}  r‹  r¢  r»  rÂ  rÄ  ræ  rÿ  r(  r/  rQ  rS  r   r#   r!   Ú<module>r+     sv  ðñPõ #ã Û Û Û 	Û Û ß MÝ Bß ,Ó ,Ý *Ý 9ß (Ý ß ?÷ó ÷ó ð 
×	Ò	Ð0Ó	1€÷Fõ5õõ n÷"	õbõõ:õ%õ*Kð.ÐD]÷ .õzðÐ õ
$õMõ(võ83ðr Ð ð Ð õõ=õ	iõ÷Hñ HõV7õ$õLõ*õ<&õ<lð ÷ð ó ðõ)LõVõ@dõNBõ,ð^ ÷LTð LTó òLTr#   